vxe-table 3.4.12 → 3.4.13

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 (46) hide show
  1. package/README.en.md +3 -1
  2. package/README.md +3 -1
  3. package/README.zh-TW.md +3 -1
  4. package/lib/edit/src/mixin.js +9 -1
  5. package/lib/edit/src/mixin.min.js +1 -1
  6. package/lib/export/src/mixin.js +15 -10
  7. package/lib/export/src/mixin.min.js +1 -1
  8. package/lib/footer/src/footer.js +11 -0
  9. package/lib/footer/src/footer.min.js +1 -1
  10. package/lib/form/src/form.js +2 -1
  11. package/lib/form/src/form.min.js +1 -1
  12. package/lib/grid/src/grid.js +4 -1
  13. package/lib/grid/src/grid.min.js +1 -1
  14. package/lib/header/src/header.js +12 -0
  15. package/lib/header/src/header.min.js +1 -1
  16. package/lib/index.css +1 -1
  17. package/lib/index.umd.js +99 -24
  18. package/lib/index.umd.min.js +1 -1
  19. package/lib/modal/src/modal.js +1 -1
  20. package/lib/modal/src/modal.min.js +1 -1
  21. package/lib/pulldown/src/pulldown.js +13 -0
  22. package/lib/pulldown/src/pulldown.min.js +1 -1
  23. package/lib/style.css +1 -1
  24. package/lib/style.min.css +1 -1
  25. package/lib/table/src/body.js +24 -5
  26. package/lib/table/src/body.min.js +1 -1
  27. package/lib/table/src/methods.js +11 -5
  28. package/lib/table/src/methods.min.js +1 -1
  29. package/lib/tools/src/utils.js +1 -0
  30. package/lib/tools/src/utils.min.js +1 -1
  31. package/package.json +4 -4
  32. package/packages/edit/src/mixin.js +1 -1
  33. package/packages/export/src/mixin.js +16 -9
  34. package/packages/footer/src/footer.js +10 -0
  35. package/packages/form/src/form.js +2 -1
  36. package/packages/grid/src/grid.js +2 -1
  37. package/packages/header/src/header.js +11 -0
  38. package/packages/modal/src/modal.js +1 -1
  39. package/packages/pulldown/src/pulldown.js +12 -0
  40. package/packages/table/src/body.js +41 -7
  41. package/packages/table/src/methods.js +5 -5
  42. package/packages/tools/src/utils.js +1 -0
  43. package/styles/button.scss +4 -4
  44. package/styles/modal.scss +14 -13
  45. package/styles/table.scss +4 -4
  46. package/styles/variable.scss +8 -0
@@ -36,6 +36,16 @@ export default {
36
36
  elemStore[`${prefix}list`] = $refs.tfoot
37
37
  elemStore[`${prefix}xSpace`] = $refs.xSpace
38
38
  },
39
+ destroyed () {
40
+ const { $parent: $xetable, fixedType } = this
41
+ const { elemStore } = $xetable
42
+ const prefix = `${fixedType || 'main'}-footer-`
43
+ elemStore[`${prefix}wrapper`] = null
44
+ elemStore[`${prefix}table`] = null
45
+ elemStore[`${prefix}colgroup`] = null
46
+ elemStore[`${prefix}list`] = null
47
+ elemStore[`${prefix}xSpace`] = null
48
+ },
39
49
  render (h) {
40
50
  let { _e, $parent: $xetable, fixedType, fixedColumn, tableColumn, footerTableData } = this
41
51
  const {
@@ -340,6 +340,7 @@ export default {
340
340
  submitEvent (evnt) {
341
341
  evnt.preventDefault()
342
342
  if (!this.preventSubmit) {
343
+ this.clearValidate()
343
344
  this.beginValidate(this.getItems()).then(() => {
344
345
  this.$emit('submit', { data: this.data, $form: this, $event: evnt })
345
346
  }).catch(errMap => {
@@ -442,6 +443,7 @@ export default {
442
443
  return this.$nextTick()
443
444
  },
444
445
  validate (callback) {
446
+ this.clearValidate()
445
447
  return this.beginValidate(this.getItems(), '', callback)
446
448
  },
447
449
  validateField (field, callback) {
@@ -452,7 +454,6 @@ export default {
452
454
  const validRest = {}
453
455
  const validFields = []
454
456
  const itemValids = []
455
- this.clearValidate()
456
457
  clearTimeout(this.showErrTime)
457
458
  if (data && formRules) {
458
459
  itemList.forEach(item => {
@@ -401,7 +401,7 @@ export default {
401
401
  handleActiveMethod (params) {
402
402
  const { editConfig } = this
403
403
  const activeMethod = editConfig ? editConfig.activeMethod : null
404
- return this.pendingRecords.indexOf(params.row) === -1 && (!activeMethod || activeMethod(params))
404
+ return this.pendingRecords.indexOf(params.row) === -1 && (!activeMethod || activeMethod({ ...params, $grid: this }))
405
405
  },
406
406
  initToolbar () {
407
407
  this.$nextTick(() => {
@@ -531,6 +531,7 @@ export default {
531
531
  }
532
532
  sortList = defaultSort.map((item) => {
533
533
  return {
534
+ field: item.field,
534
535
  property: item.field,
535
536
  order: item.order
536
537
  }
@@ -39,6 +39,17 @@ export default {
39
39
  elemStore[`${prefix}xSpace`] = $refs.xSpace
40
40
  elemStore[`${prefix}repair`] = $refs.repair
41
41
  },
42
+ destroyed () {
43
+ const { $parent: $xetable, fixedType } = this
44
+ const { elemStore } = $xetable
45
+ const prefix = `${fixedType || 'main'}-header-`
46
+ elemStore[`${prefix}wrapper`] = null
47
+ elemStore[`${prefix}table`] = null
48
+ elemStore[`${prefix}colgroup`] = null
49
+ elemStore[`${prefix}list`] = null
50
+ elemStore[`${prefix}xSpace`] = null
51
+ elemStore[`${prefix}repair`] = null
52
+ },
42
53
  render (h) {
43
54
  const { _e, $parent: $xetable, fixedType, headerColumn, fixedColumn } = this
44
55
  const { $listeners: tableListeners, tId, isGroup, resizable, border, columnKey, headerRowClassName, headerCellClassName, headerRowStyle, headerCellStyle, showHeaderOverflow: allColumnHeaderOverflow, headerAlign: allHeaderAlign, align: allAlign, highlightCurrentColumn, currentColumn, scrollXLoad, overflowX, scrollbarWidth, sortOpts, mouseConfig, columnOpts } = $xetable
@@ -459,7 +459,7 @@ export default {
459
459
  maximize () {
460
460
  return this.$nextTick().then(() => {
461
461
  if (!this.zoomLocat) {
462
- const marginSize = this.marginSize
462
+ const marginSize = Math.max(0, this.marginSize)
463
463
  const modalBoxElem = this.getBox()
464
464
  const { visibleHeight, visibleWidth } = DomTools.getDomNode()
465
465
  this.zoomLocat = {
@@ -6,6 +6,7 @@ export default {
6
6
  name: 'VxePulldown',
7
7
  mixins: [vSize],
8
8
  props: {
9
+ value: Boolean,
9
10
  disabled: Boolean,
10
11
  placement: String,
11
12
  size: { type: String, default: () => GlobalConfig.size },
@@ -24,6 +25,15 @@ export default {
24
25
  isActivated: false
25
26
  }
26
27
  },
28
+ watch: {
29
+ value (value) {
30
+ if (value) {
31
+ this.showPanel()
32
+ } else {
33
+ this.hidePanel()
34
+ }
35
+ }
36
+ },
27
37
  created () {
28
38
  GlobalEvent.on(this, 'mousewheel', this.handleGlobalMousewheelEvent)
29
39
  GlobalEvent.on(this, 'mousedown', this.handleGlobalMousedownEvent)
@@ -140,6 +150,7 @@ export default {
140
150
  this.animatVisible = true
141
151
  setTimeout(() => {
142
152
  this.visiblePanel = true
153
+ this.$emit('update:input', true)
143
154
  this.updatePlacement()
144
155
  setTimeout(() => {
145
156
  resolve(this.updatePlacement())
@@ -156,6 +167,7 @@ export default {
156
167
  */
157
168
  hidePanel () {
158
169
  this.visiblePanel = false
170
+ this.$emit('update:input', false)
159
171
  return new Promise(resolve => {
160
172
  if (this.animatVisible) {
161
173
  this.hidePanelTimeout = setTimeout(() => {
@@ -455,6 +455,18 @@ export default {
455
455
  this.$el._onscroll = null
456
456
  this.$el.onscroll = null
457
457
  },
458
+ destroyed () {
459
+ const { $parent: $xetable, fixedType } = this
460
+ const { elemStore } = $xetable
461
+ const prefix = `${fixedType || 'main'}-body-`
462
+ elemStore[`${prefix}wrapper`] = null
463
+ elemStore[`${prefix}table`] = null
464
+ elemStore[`${prefix}colgroup`] = null
465
+ elemStore[`${prefix}list`] = null
466
+ elemStore[`${prefix}xSpace`] = null
467
+ elemStore[`${prefix}ySpace`] = null
468
+ elemStore[`${prefix}emptyBlock`] = null
469
+ },
458
470
  render (h) {
459
471
  const { _e, $parent: $xetable, fixedColumn, fixedType } = this
460
472
  let { $scopedSlots, tId, tableData, tableColumn, visibleColumn, showOverflow: allColumnOverflow, keyboardConfig, keyboardOpts, mergeList, spanMethod, scrollXLoad, scrollYLoad, isAllOverflow, emptyOpts, mouseConfig, mouseOpts, sYOpts } = $xetable
@@ -595,8 +607,8 @@ export default {
595
607
  const rightElem = rightBody ? rightBody.$el : null
596
608
  const bodyYElem = elemStore['main-body-ySpace']
597
609
  const bodyXElem = elemStore['main-body-xSpace']
598
- const bodyHeight = bodyYElem ? bodyYElem.clientHeight : 0
599
- const bodyWidth = bodyXElem ? bodyXElem.clientWidth : 0
610
+ const bodyHeight = scrollYLoad && bodyYElem ? bodyYElem.clientHeight : bodyElem.clientHeight
611
+ const bodyWidth = scrollXLoad && bodyXElem ? bodyXElem.clientWidth : bodyElem.clientWidth
600
612
  let scrollTop = scrollBodyElem.scrollTop
601
613
  const scrollLeft = bodyElem.scrollLeft
602
614
  const isRollX = scrollLeft !== lastScrollLeft
@@ -638,11 +650,22 @@ export default {
638
650
  if (isRollX && validTip && validTip.visible) {
639
651
  validTip.updatePlacement()
640
652
  }
641
- $xetable.emitEvent('scroll', { type: renderType, fixed: fixedType, scrollTop, scrollLeft, bodyHeight, bodyWidth, isX: isRollX, isY: isRollY }, evnt)
653
+ $xetable.emitEvent('scroll', {
654
+ type: renderType,
655
+ fixed: fixedType,
656
+ scrollTop,
657
+ scrollLeft,
658
+ scrollHeight: bodyElem.scrollHeight,
659
+ scrollWidth: bodyElem.scrollWidth,
660
+ bodyHeight,
661
+ bodyWidth,
662
+ isX: isRollX,
663
+ isY: isRollY
664
+ }, evnt)
642
665
  },
643
666
  handleWheel (evnt, isTopWheel, deltaTop, isRollX, isRollY) {
644
667
  const { $parent: $xetable } = this
645
- const { $refs, elemStore } = $xetable
668
+ const { $refs, elemStore, scrollYLoad, scrollXLoad } = $xetable
646
669
  const { tableBody, leftBody, rightBody } = $refs
647
670
  const bodyElem = tableBody.$el
648
671
  const leftElem = leftBody ? leftBody.$el : null
@@ -650,8 +673,8 @@ export default {
650
673
  const remainSize = this.isPrevWheelTop === isTopWheel ? Math.max(0, this.wheelYSize - this.wheelYTotal) : 0
651
674
  const bodyYElem = elemStore['main-body-ySpace']
652
675
  const bodyXElem = elemStore['main-body-xSpace']
653
- const bodyHeight = bodyYElem ? bodyYElem.clientHeight : 0
654
- const bodyWidth = bodyXElem ? bodyXElem.clientWidth : 0
676
+ const bodyHeight = scrollYLoad && bodyYElem ? bodyYElem.clientHeight : bodyElem.clientHeight
677
+ const bodyWidth = scrollXLoad && bodyXElem ? bodyXElem.clientWidth : bodyElem.clientWidth
655
678
  this.isPrevWheelTop = isTopWheel
656
679
  this.wheelYSize = Math.abs(isTopWheel ? deltaTop - remainSize : deltaTop + remainSize)
657
680
  this.wheelYInterval = 0
@@ -679,7 +702,18 @@ export default {
679
702
  }
680
703
  this.wheelYTotal = wheelYTotal
681
704
  this.wheelYInterval = wheelYInterval
682
- $xetable.emitEvent('scroll', { type: renderType, fixed: fixedType, scrollTop: bodyElem.scrollTop, scrollLeft: bodyElem.scrollLeft, bodyHeight, bodyWidth, isX: isRollX, isY: isRollY }, evnt)
705
+ $xetable.emitEvent('scroll', {
706
+ type: renderType,
707
+ fixed: fixedType,
708
+ scrollTop: bodyElem.scrollTop,
709
+ scrollLeft: bodyElem.scrollLeft,
710
+ scrollHeight: bodyElem.scrollHeight,
711
+ scrollWidth: bodyElem.scrollWidth,
712
+ bodyHeight,
713
+ bodyWidth,
714
+ isX: isRollX,
715
+ isY: isRollY
716
+ }, evnt)
683
717
  }
684
718
  }
685
719
  handleSmooth()
@@ -1139,7 +1139,7 @@ const Methods = {
1139
1139
  const filterColumns = []
1140
1140
  const orderColumns = []
1141
1141
  tableFullColumn.forEach(column => {
1142
- const { sortable, order, filters } = column
1142
+ const { property, sortable, order, filters } = column
1143
1143
  if (!allRemoteFilter && filters && filters.length) {
1144
1144
  const valueList = []
1145
1145
  const itemList = []
@@ -1154,7 +1154,7 @@ const Methods = {
1154
1154
  }
1155
1155
  }
1156
1156
  if (!allRemoteSort && sortable && order) {
1157
- orderColumns.push({ column, property: column.property, order })
1157
+ orderColumns.push({ column, field: column.property, property, order })
1158
1158
  }
1159
1159
  })
1160
1160
  if (filterColumns.length) {
@@ -2462,7 +2462,7 @@ const Methods = {
2462
2462
  // }
2463
2463
  // 如果是按下非功能键之外允许直接编辑
2464
2464
  if (selected.column && selected.row && isEnableConf(selected.column.editRender)) {
2465
- if (!editOpts.activeMethod || editOpts.activeMethod(selected.args)) {
2465
+ if (!editOpts.activeMethod || editOpts.activeMethod({ ...selected.args, $table: this })) {
2466
2466
  if (editMethod) {
2467
2467
  editMethod({
2468
2468
  row: selected.row,
@@ -3586,9 +3586,9 @@ const Methods = {
3586
3586
  getSortColumns () {
3587
3587
  const sortList = []
3588
3588
  this.tableFullColumn.forEach((column) => {
3589
- const { order } = column
3589
+ const { property, order } = column
3590
3590
  if ((column.sortable || column.remoteSort) && order) {
3591
- sortList.push({ column, property: column.property, order })
3591
+ sortList.push({ column, field: column.property, property, order })
3592
3592
  }
3593
3593
  })
3594
3594
  return sortList
@@ -57,6 +57,7 @@ class ColumnInfo {
57
57
  // 基本属性
58
58
  type: _vm.type,
59
59
  property: _vm.field,
60
+ field: _vm.field,
60
61
  title: _vm.title,
61
62
  width: _vm.width,
62
63
  minWidth: _vm.minWidth,
@@ -124,7 +124,7 @@ $btnThemeList: (
124
124
  line-height: 1;
125
125
  border: 1px solid $vxe-input-border-color;
126
126
  &.is--round {
127
- border-radius: $vxe-button-height-default * 0.5;
127
+ border-radius: $vxe-button-round-border-radius-default;
128
128
  }
129
129
  &:not(.is--round) {
130
130
  border-radius: $vxe-border-radius;
@@ -223,7 +223,7 @@ $btnThemeList: (
223
223
  min-width: $vxe-button-height-medium;
224
224
  }
225
225
  &.is--round {
226
- border-radius: $vxe-button-height-medium * 0.5;
226
+ border-radius: $vxe-button-round-border-radius-medium;
227
227
  }
228
228
  }
229
229
  .vxe-button--loading-icon,
@@ -239,7 +239,7 @@ $btnThemeList: (
239
239
  min-width: $vxe-button-height-small;
240
240
  }
241
241
  &.is--round {
242
- border-radius: $vxe-button-height-small * 0.5;
242
+ border-radius: $vxe-button-round-border-radius-small;
243
243
  }
244
244
  }
245
245
  .vxe-button--loading-icon,
@@ -255,7 +255,7 @@ $btnThemeList: (
255
255
  min-width: $vxe-button-height-mini;
256
256
  }
257
257
  &.is--round {
258
- border-radius: $vxe-button-height-mini * 0.5;
258
+ border-radius: $vxe-button-round-border-radius-mini;
259
259
  }
260
260
  }
261
261
  .vxe-button--loading-icon,
package/styles/modal.scss CHANGED
@@ -294,7 +294,8 @@
294
294
  }
295
295
  }
296
296
  .vxe-modal--resize {
297
- $SpaceSize: 8;
297
+ $SpaceSize: 8px;
298
+ $SpaceWidth: 5px;
298
299
  .wl-resize,
299
300
  .wr-resize,
300
301
  .swst-resize,
@@ -308,32 +309,32 @@
308
309
  }
309
310
  .wl-resize,
310
311
  .wr-resize {
311
- width: #{$SpaceSize}px;
312
+ width: $SpaceSize;
312
313
  height: 100%;
313
314
  top: 0;
314
315
  cursor: w-resize;
315
316
  }
316
317
  .wl-resize {
317
- left: -#{$SpaceSize * 0.5 + 1}px;
318
+ left: -$SpaceWidth;
318
319
  }
319
320
  .wr-resize {
320
- right: -#{$SpaceSize * 0.5 + 1}px;
321
+ right: -$SpaceWidth;
321
322
  }
322
323
  .swst-resize,
323
324
  .sest-resize,
324
325
  .swlb-resize,
325
326
  .selb-resize {
326
- width: #{$SpaceSize + 2}px;
327
- height: #{$SpaceSize + 2}px;
327
+ width: $SpaceSize + 2;
328
+ height: $SpaceSize + 2;
328
329
  z-index: 101;
329
330
  }
330
331
  .swst-resize,
331
332
  .sest-resize {
332
- top: -#{$SpaceSize}px;
333
+ top: -$SpaceSize;
333
334
  }
334
335
  .swlb-resize,
335
336
  .selb-resize {
336
- bottom: -#{$SpaceSize}px;
337
+ bottom: -$SpaceSize;
337
338
  }
338
339
  .sest-resize,
339
340
  .swlb-resize {
@@ -345,24 +346,24 @@
345
346
  }
346
347
  .swst-resize,
347
348
  .swlb-resize {
348
- left: -#{$SpaceSize}px;
349
+ left: -$SpaceSize;
349
350
  }
350
351
  .sest-resize,
351
352
  .selb-resize {
352
- right: -#{$SpaceSize}px;
353
+ right: -$SpaceSize;
353
354
  }
354
355
  .st-resize,
355
356
  .sb-resize {
356
357
  width: 100%;
357
- height: #{$SpaceSize}px;
358
+ height: $SpaceSize;
358
359
  left: 0;
359
360
  cursor: s-resize;
360
361
  }
361
362
  .st-resize {
362
- top: -#{$SpaceSize * 0.5 + 1}px;
363
+ top: -$SpaceWidth;
363
364
  }
364
365
  .sb-resize {
365
- bottom: -#{$SpaceSize * 0.5 + 1}px;
366
+ bottom: -$SpaceWidth;
366
367
  }
367
368
  }
368
369
  }
package/styles/table.scss CHANGED
@@ -474,7 +474,7 @@
474
474
  line-height: $vxe-table-row-line-height;
475
475
  text-align: left;
476
476
  &:not(.col--ellipsis) {
477
- padding: #{floor(($vxe-table-row-height-default - $vxe-table-row-line-height) * 0.5)} 0;
477
+ padding: $vxe-table-column-padding-default;
478
478
  }
479
479
  &.col--current {
480
480
  background-color: $vxe-table-column-current-background-color;
@@ -612,7 +612,7 @@
612
612
  .vxe-body--column,
613
613
  .vxe-footer--column {
614
614
  &:not(.col--ellipsis) {
615
- padding: #{floor(($vxe-table-row-height-medium - $vxe-table-row-line-height) * 0.5)} 0;
615
+ padding: $vxe-table-column-padding-medium;
616
616
  }
617
617
  }
618
618
  .vxe-cell {
@@ -638,7 +638,7 @@
638
638
  .vxe-body--column,
639
639
  .vxe-footer--column {
640
640
  &:not(.col--ellipsis) {
641
- padding: #{floor(($vxe-table-row-height-small - $vxe-table-row-line-height) * 0.5)} 0;
641
+ padding: $vxe-table-column-padding-small;
642
642
  }
643
643
  }
644
644
  .vxe-cell {
@@ -664,7 +664,7 @@
664
664
  .vxe-body--column,
665
665
  .vxe-footer--column {
666
666
  &:not(.col--ellipsis) {
667
- padding: #{floor(($vxe-table-row-height-mini - $vxe-table-row-line-height) * 0.5)} 0;
667
+ padding: $vxe-table-column-padding-mini;
668
668
  }
669
669
  }
670
670
  .vxe-cell {
@@ -62,6 +62,10 @@ $vxe-table-row-hover-checkbox-checked-background-color: #ffebbc !default;
62
62
  $vxe-table-row-current-background-color: #e6f7ff !default;
63
63
  $vxe-table-row-hover-current-background-color: #d7effb !default;
64
64
 
65
+ $vxe-table-column-padding-default: 13px 0 !default;
66
+ $vxe-table-column-padding-medium: 11px 0 !default;
67
+ $vxe-table-column-padding-small: 9px 0 !default;
68
+ $vxe-table-column-padding-mini: 7px 0 !default;
65
69
  $vxe-table-column-hover-background-color: #d7effb !default;
66
70
  $vxe-table-column-current-background-color: #e6f7ff !default;
67
71
  $vxe-table-column-icon-border-color: #c0c4cc !default;
@@ -175,6 +179,10 @@ $vxe-button-height-default: 34px !default;
175
179
  $vxe-button-height-medium: 32px !default;
176
180
  $vxe-button-height-small: 30px !default;
177
181
  $vxe-button-height-mini: 28px !default;
182
+ $vxe-button-round-border-radius-default: 17px !default;
183
+ $vxe-button-round-border-radius-medium: 16px !default;
184
+ $vxe-button-round-border-radius-small: 15px !default;
185
+ $vxe-button-round-border-radius-mini: 14px !default;
178
186
 
179
187
  /*input*/
180
188
  $vxe-input-background-color: #fff !default;