vxe-table 3.7.10 → 3.8.0-beta.0

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 (79) hide show
  1. package/lib/all.js +16 -28
  2. package/lib/all.min.js +1 -1
  3. package/lib/button/src/button.js +49 -46
  4. package/lib/button/src/button.min.js +1 -1
  5. package/lib/button/src/group.js +60 -0
  6. package/lib/button/src/group.min.js +1 -0
  7. package/lib/button-group/index.d.ts +4 -0
  8. package/lib/button-group/index.js +16 -0
  9. package/lib/button-group/index.min.js +1 -0
  10. package/lib/checkbox/src/group.js +25 -3
  11. package/lib/checkbox/src/group.min.js +1 -1
  12. package/lib/export/src/mixin.js +1 -1
  13. package/lib/export/src/mixin.min.js +1 -1
  14. package/lib/footer/index.js +1 -1
  15. package/lib/footer/index.min.js +1 -1
  16. package/lib/header/index.js +1 -1
  17. package/lib/header/index.min.js +1 -1
  18. package/lib/icon/style/style.css +1 -1
  19. package/lib/icon/style/style.min.css +1 -1
  20. package/lib/index.css +1 -1
  21. package/lib/index.umd.js +11711 -11330
  22. package/lib/index.umd.min.js +1 -1
  23. package/lib/radio/src/group.js +24 -2
  24. package/lib/radio/src/group.min.js +1 -1
  25. package/lib/style.css +1 -1
  26. package/lib/style.min.css +1 -1
  27. package/lib/{header → table}/src/header.js +2 -3
  28. package/lib/table/src/header.min.js +1 -0
  29. package/lib/table/src/table.js +3 -5
  30. package/lib/table/src/table.min.js +1 -1
  31. package/lib/table/src/util.js +70 -0
  32. package/lib/table/src/util.min.js +1 -1
  33. package/lib/tools/log.js +1 -1
  34. package/lib/tools/log.min.js +1 -1
  35. package/lib/v-x-e-table/index.js +1 -1
  36. package/lib/v-x-e-table/index.min.js +1 -1
  37. package/lib/v-x-e-table/src/conf.js +6 -0
  38. package/lib/v-x-e-table/src/conf.min.js +1 -1
  39. package/lib/v-x-e-table/src/renderer.js +306 -37
  40. package/lib/v-x-e-table/src/renderer.min.js +1 -1
  41. package/package.json +1 -1
  42. package/packages/all.js +5 -6
  43. package/packages/button/src/button.js +23 -7
  44. package/packages/button/src/group.js +35 -0
  45. package/packages/button-group/index.d.ts +4 -0
  46. package/packages/button-group/index.js +9 -0
  47. package/packages/checkbox/src/group.js +22 -3
  48. package/packages/export/src/mixin.js +1 -0
  49. package/packages/footer/index.js +1 -1
  50. package/packages/header/index.js +1 -1
  51. package/packages/radio/src/group.js +21 -2
  52. package/packages/{header → table}/src/header.js +2 -3
  53. package/packages/table/src/table.js +3 -5
  54. package/packages/table/src/util.js +63 -0
  55. package/packages/v-x-e-table/src/conf.js +6 -0
  56. package/packages/v-x-e-table/src/renderer.js +266 -25
  57. package/styles/all.scss +1 -0
  58. package/styles/button-group.scss +1 -0
  59. package/types/all.d.ts +1 -0
  60. package/types/button-group.d.ts +9 -0
  61. package/lib/header/src/header.min.js +0 -1
  62. package/lib/header/src/util.js +0 -75
  63. package/lib/header/src/util.min.js +0 -1
  64. package/lib/header/style/index.js +0 -1
  65. package/lib/header/style/style.css +0 -25
  66. package/lib/header/style/style.min.css +0 -0
  67. package/packages/header/src/util.js +0 -62
  68. /package/lib/{footer → button-group}/style/index.js +0 -0
  69. /package/lib/{footer → button-group}/style/style.css +0 -0
  70. /package/lib/{footer → button-group}/style/style.min.css +0 -0
  71. /package/lib/icon/style/{iconfont.1712806346882.ttf → iconfont.1713080139463.ttf} +0 -0
  72. /package/lib/icon/style/{iconfont.1712806346882.woff → iconfont.1713080139463.woff} +0 -0
  73. /package/lib/icon/style/{iconfont.1712806346882.woff2 → iconfont.1713080139463.woff2} +0 -0
  74. /package/lib/{iconfont.1712806346882.ttf → iconfont.1713080139463.ttf} +0 -0
  75. /package/lib/{iconfont.1712806346882.woff → iconfont.1713080139463.woff} +0 -0
  76. /package/lib/{iconfont.1712806346882.woff2 → iconfont.1713080139463.woff2} +0 -0
  77. /package/lib/{footer → table}/src/footer.js +0 -0
  78. /package/lib/{footer → table}/src/footer.min.js +0 -0
  79. /package/packages/{footer → table}/src/footer.js +0 -0
@@ -27,6 +27,11 @@ export default {
27
27
  popupClassName: [String, Function],
28
28
  transfer: { type: Boolean, default: () => GlobalConfig.button.transfer }
29
29
  },
30
+ inject: {
31
+ $xebuttonggroup: {
32
+ default: null
33
+ }
34
+ },
30
35
  data () {
31
36
  return {
32
37
  inited: false,
@@ -47,8 +52,8 @@ export default {
47
52
  },
48
53
  created () {
49
54
  // if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
50
- // if (props.type === 'text') {
51
- // warnLog('vxe.error.delFunc', ['type=text', 'mode=text'])
55
+ // if (this.type === 'text') {
56
+ // warnLog('vxe.error.delProp', ['type=text', 'mode=text'])
52
57
  // }
53
58
  // }
54
59
 
@@ -64,7 +69,7 @@ export default {
64
69
  GlobalEvent.off(this, 'mousewheel')
65
70
  },
66
71
  render (h) {
67
- const { $scopedSlots, $listeners, className, popupClassName, inited, type, destroyOnClose, isFormBtn, status, btnType, vSize, name, disabled, loading, showPanel, animatVisible, panelPlacement } = this
72
+ const { $scopedSlots, className, popupClassName, inited, type, destroyOnClose, isFormBtn, status, btnType, vSize, name, disabled, loading, showPanel, animatVisible, panelPlacement } = this
68
73
  const downsSlot = $scopedSlots.dropdowns
69
74
  return downsSlot ? h('div', {
70
75
  class: ['vxe-button--dropdown', className ? (XEUtils.isFunction(className) ? className({ $button: this }) : className) : '', {
@@ -87,10 +92,11 @@ export default {
87
92
  type: isFormBtn ? type : 'button',
88
93
  disabled: disabled || loading
89
94
  },
90
- on: Object.assign({
95
+ on: {
91
96
  mouseenter: this.mouseenterTargetEvent,
92
- mouseleave: this.mouseleaveEvent
93
- }, XEUtils.objectMap($listeners, (cb, type) => evnt => this.$emit(type, { $event: evnt })))
97
+ mouseleave: this.mouseleaveEvent,
98
+ click: this.clickEvent
99
+ }
94
100
  }, this.renderContent(h).concat([
95
101
  h('i', {
96
102
  class: `vxe-button--dropdown-arrow ${GlobalConfig.icon.BUTTON_DROPDOWN}`
@@ -133,7 +139,9 @@ export default {
133
139
  type: isFormBtn ? type : 'button',
134
140
  disabled: disabled || loading
135
141
  },
136
- on: XEUtils.objectMap($listeners, (cb, type) => evnt => this.$emit(type, { $event: evnt }))
142
+ on: {
143
+ click: this.clickEvent
144
+ }
137
145
  }, this.renderContent(h))
138
146
  },
139
147
  methods: {
@@ -190,6 +198,14 @@ export default {
190
198
  evnt.stopPropagation()
191
199
  }
192
200
  },
201
+ clickEvent (evnt) {
202
+ const { $xebuttonggroup } = this
203
+ if ($xebuttonggroup) {
204
+ $xebuttonggroup.handleClick({ name: this.name }, evnt)
205
+ } else {
206
+ this.$emit('click', { $event: evnt })
207
+ }
208
+ },
193
209
  clickDropdownEvent (evnt) {
194
210
  const dropdownElem = evnt.currentTarget
195
211
  const panelElem = this.$refs.panel
@@ -0,0 +1,35 @@
1
+ import GlobalConfig from '../../v-x-e-table/src/conf'
2
+
3
+ export default {
4
+ name: 'VxeButtonGroup',
5
+ props: {
6
+ options: Array,
7
+ disabled: Boolean,
8
+ size: { type: String, default: () => GlobalConfig.buttonGroup.size || GlobalConfig.size }
9
+ },
10
+ provide () {
11
+ return {
12
+ $xebuttongroup: this
13
+ }
14
+ },
15
+ computed: {
16
+ vSize () {
17
+ return this.size || this.$parent.size || this.$parent.vSize
18
+ }
19
+ },
20
+ render (h) {
21
+ const { $scopedSlots, options } = this
22
+ const defaultSlot = $scopedSlots.default
23
+ return h('div', {
24
+ class: 'vxe-button-group'
25
+ }, defaultSlot ? defaultSlot.cell(this, {}) : (options ? options.map(item => h('vxe-button', { props: item })) : []))
26
+ },
27
+ methods: {
28
+ handleClick (params, evnt) {
29
+ const { options } = this
30
+ const { name } = params
31
+ const option = options ? options.find(item => item.name === name) : null
32
+ this.$emit('click', { ...params, option, $event: evnt })
33
+ }
34
+ }
35
+ }
@@ -0,0 +1,4 @@
1
+ import { ButtonGroup } from '../../types/button-group'
2
+
3
+ export * from '../../types/button-group'
4
+ export default ButtonGroup
@@ -0,0 +1,9 @@
1
+ import VxeButtonGroup from '../button/src/group'
2
+
3
+ export const ButtonGroup = Object.assign(VxeButtonGroup, {
4
+ install (Vue) {
5
+ Vue.component(VxeButtonGroup.name, VxeButtonGroup)
6
+ }
7
+ })
8
+
9
+ export default ButtonGroup
@@ -5,9 +5,11 @@ export default {
5
5
  name: 'VxeCheckboxGroup',
6
6
  props: {
7
7
  value: Array,
8
+ options: Array,
9
+ optionProps: Object,
8
10
  disabled: Boolean,
9
11
  max: [String, Number],
10
- size: { type: String, default: () => GlobalConfig.checkbox.size || GlobalConfig.size }
12
+ size: { type: String, default: () => GlobalConfig.checkboxGroup.size || GlobalConfig.size }
11
13
  },
12
14
  inject: {
13
15
  $xeform: {
@@ -32,13 +34,30 @@ export default {
32
34
  return value.length >= XEUtils.toNumber(max)
33
35
  }
34
36
  return false
37
+ },
38
+ propsOpts () {
39
+ return this.optionProps || {}
40
+ },
41
+ labelField () {
42
+ return this.propsOpts.label || 'label'
43
+ },
44
+ valueField () {
45
+ return this.propsOpts.value || 'value'
35
46
  }
36
47
  },
37
48
  render (h) {
38
- const { $scopedSlots } = this
49
+ const { $scopedSlots, options, valueField, labelField } = this
50
+ const defaultSlot = $scopedSlots.default
39
51
  return h('div', {
40
52
  class: 'vxe-checkbox-group'
41
- }, $scopedSlots.default ? $scopedSlots.default.call(this, {}) : [])
53
+ }, defaultSlot ? defaultSlot.call(this, {}) : (options ? options.map(item => {
54
+ return h('vxe-checkbox', {
55
+ props: {
56
+ label: item[valueField],
57
+ content: item[labelField]
58
+ }
59
+ })
60
+ }) : []))
42
61
  },
43
62
  methods: {
44
63
  handleChecked (params, evnt) {
@@ -336,6 +336,7 @@ function createHtmlPage (opts, content) {
336
336
  '<head>',
337
337
  '<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no,minimal-ui">',
338
338
  `<title>${opts.sheetName}</title>`,
339
+ '<style media="print">.vxe-page-break-before{page-break-before:always;}.vxe-page-break-after{page-break-after:always;}</style>',
339
340
  `<style>${defaultHtmlStyle}</style>`,
340
341
  style ? `<style>${style}</style>` : '',
341
342
  '</head>',
@@ -1,4 +1,4 @@
1
- import VxeTableFooter from './src/footer'
1
+ import VxeTableFooter from '../table/src/footer'
2
2
 
3
3
  export const Footer = Object.assign(VxeTableFooter, {
4
4
  install (Vue) {
@@ -1,4 +1,4 @@
1
- import VxeTableHeader from './src/header'
1
+ import VxeTableHeader from '../table/src/header'
2
2
 
3
3
  export const Header = Object.assign(VxeTableHeader, {
4
4
  install (Vue) {
@@ -5,6 +5,8 @@ export default {
5
5
  name: 'VxeRadioGroup',
6
6
  props: {
7
7
  value: [String, Number, Boolean],
8
+ options: Array,
9
+ optionProps: Object,
8
10
  disabled: Boolean,
9
11
  strict: { type: Boolean, default: () => GlobalConfig.radioGroup.strict },
10
12
  size: { type: String, default: () => GlobalConfig.radioGroup.size || GlobalConfig.size }
@@ -25,6 +27,15 @@ export default {
25
27
  computed: {
26
28
  vSize () {
27
29
  return this.size || this.$parent.size || this.$parent.vSize
30
+ },
31
+ propsOpts () {
32
+ return this.optionProps || {}
33
+ },
34
+ labelField () {
35
+ return this.propsOpts.label || 'label'
36
+ },
37
+ valueField () {
38
+ return this.propsOpts.value || 'value'
28
39
  }
29
40
  },
30
41
  data () {
@@ -33,10 +44,18 @@ export default {
33
44
  }
34
45
  },
35
46
  render (h) {
36
- const { $scopedSlots } = this
47
+ const { $scopedSlots, options, valueField, labelField } = this
48
+ const defaultSlot = $scopedSlots.default
37
49
  return h('div', {
38
50
  class: 'vxe-radio-group'
39
- }, $scopedSlots.default ? $scopedSlots.default.call(this, {}) : [])
51
+ }, defaultSlot ? defaultSlot.call(this, {}) : (options ? options.map(item => {
52
+ return h('vxe-radio', {
53
+ props: {
54
+ label: item[valueField],
55
+ content: item[labelField]
56
+ }
57
+ })
58
+ }) : []))
40
59
  },
41
60
  methods: {
42
61
  handleChecked (params, evnt) {
@@ -1,8 +1,7 @@
1
1
  import XEUtils from 'xe-utils'
2
2
  import UtilTools from '../../tools/utils'
3
3
  import DomTools from '../../tools/dom'
4
- import { convertToRows } from './util'
5
- import { getColReMinWidth } from '../../table/src/util'
4
+ import { convertHeaderColumnToRows, getColReMinWidth } from './util'
6
5
 
7
6
  const cellType = 'header'
8
7
 
@@ -206,7 +205,7 @@ export default {
206
205
  methods: {
207
206
  uploadColumn () {
208
207
  const { $parent: $xetable } = this
209
- this.headerColumn = $xetable.isGroup ? convertToRows(this.tableGroupColumn) : []
208
+ this.headerColumn = $xetable.isGroup ? convertHeaderColumnToRows(this.tableGroupColumn) : []
210
209
  },
211
210
  resizeMousedown (evnt, params) {
212
211
  const { column } = params
@@ -3,6 +3,7 @@ import GlobalConfig from '../../v-x-e-table/src/conf'
3
3
  import VXETable from '../../v-x-e-table'
4
4
  import VxeTableBody from './body'
5
5
  import VxeTableHeader from '../../header'
6
+ import VxeTableFooter from '../../footer'
6
7
  import vSize from '../../mixins/size'
7
8
  import { isEnableConf, getFuncText } from '../../tools/utils'
8
9
  import { createResizeEvent } from '../../tools/resize'
@@ -38,7 +39,7 @@ function renderFixed (h, $xetable, fixedType) {
38
39
  },
39
40
  ref: `${fixedType}Header`
40
41
  }) : _e(),
41
- h('vxe-table-body', {
42
+ h(VxeTableBody, {
42
43
  props: {
43
44
  fixedType,
44
45
  tableData,
@@ -48,7 +49,7 @@ function renderFixed (h, $xetable, fixedType) {
48
49
  },
49
50
  ref: `${fixedType}Body`
50
51
  }),
51
- showFooter ? h('vxe-table-footer', {
52
+ showFooter ? h(VxeTableFooter, {
52
53
  props: {
53
54
  footerTableData,
54
55
  tableColumn,
@@ -258,9 +259,6 @@ export default {
258
259
  // 额外的参数
259
260
  params: Object
260
261
  },
261
- components: {
262
- VxeTableBody
263
- },
264
262
  provide () {
265
263
  return {
266
264
  $xetable: this,
@@ -3,6 +3,69 @@ import XEUtils from 'xe-utils'
3
3
  import { ColumnInfo } from './columnInfo'
4
4
  import DomTools from '../../tools/dom'
5
5
 
6
+ const getAllConvertColumns = (columns, parentColumn) => {
7
+ const result = []
8
+ columns.forEach((column) => {
9
+ column.parentId = parentColumn ? parentColumn.id : null
10
+ if (column.visible) {
11
+ if (column.children && column.children.length && column.children.some(column => column.visible)) {
12
+ result.push(column)
13
+ result.push(...getAllConvertColumns(column.children, column))
14
+ } else {
15
+ result.push(column)
16
+ }
17
+ }
18
+ })
19
+ return result
20
+ }
21
+
22
+ export const convertHeaderColumnToRows = (originColumns) => {
23
+ let maxLevel = 1
24
+ const traverse = (column, parent) => {
25
+ if (parent) {
26
+ column.level = parent.level + 1
27
+ if (maxLevel < column.level) {
28
+ maxLevel = column.level
29
+ }
30
+ }
31
+ if (column.children && column.children.length && column.children.some(column => column.visible)) {
32
+ let colSpan = 0
33
+ column.children.forEach((subColumn) => {
34
+ if (subColumn.visible) {
35
+ traverse(subColumn, column)
36
+ colSpan += subColumn.colSpan
37
+ }
38
+ })
39
+ column.colSpan = colSpan
40
+ } else {
41
+ column.colSpan = 1
42
+ }
43
+ }
44
+
45
+ originColumns.forEach((column) => {
46
+ column.level = 1
47
+ traverse(column)
48
+ })
49
+
50
+ const rows = []
51
+ for (let i = 0; i < maxLevel; i++) {
52
+ rows.push([])
53
+ }
54
+
55
+ const allColumns = getAllConvertColumns(originColumns)
56
+
57
+ allColumns.forEach((column) => {
58
+ if (column.children && column.children.length && column.children.some(column => column.visible)) {
59
+ column.rowSpan = 1
60
+ } else {
61
+ column.rowSpan = maxLevel - column.level + 1
62
+ }
63
+ rows[column.level - 1].push(column)
64
+ })
65
+
66
+ return rows
67
+ }
68
+
6
69
  const lineOffsetSizes = {
7
70
  mini: 3,
8
71
  small: 2,
@@ -327,6 +327,9 @@ export default {
327
327
  // size: null,
328
328
  // transfer: false
329
329
  },
330
+ buttonGroup: {
331
+ // size: null
332
+ },
330
333
  radio: {
331
334
  // size: null,
332
335
  strict: true
@@ -342,6 +345,9 @@ export default {
342
345
  checkbox: {
343
346
  // size: null
344
347
  },
348
+ checkboxGroup: {
349
+ // size: null
350
+ },
345
351
  switch: {
346
352
  // size: null
347
353
  },