vxe-table 3.4.14-beta.3 → 3.5.0-beta.1
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.
- package/README.md +2 -6
- package/helper/vetur/attributes.json +30 -10
- package/helper/vetur/tags.json +7 -2
- package/lib/button/src/button.js +19 -9
- package/lib/button/src/button.min.js +1 -1
- package/lib/checkbox/src/checkbox.js +2 -2
- package/lib/checkbox/src/checkbox.min.js +1 -1
- package/lib/edit/src/mixin.js +26 -18
- package/lib/edit/src/mixin.min.js +1 -1
- package/lib/export/src/export-panel.js +2 -2
- package/lib/export/src/export-panel.min.js +1 -1
- package/lib/export/src/import-panel.js +2 -2
- package/lib/export/src/import-panel.min.js +1 -1
- package/lib/export/src/mixin.js +26 -24
- package/lib/export/src/mixin.min.js +1 -1
- package/lib/filter/src/mixin.js +4 -4
- package/lib/filter/src/mixin.min.js +1 -1
- package/lib/filter/src/panel.js +2 -2
- package/lib/filter/src/panel.min.js +1 -1
- package/lib/footer/src/footer.js +7 -4
- package/lib/footer/src/footer.min.js +1 -1
- package/lib/form/src/form-gather.js +2 -2
- package/lib/form/src/form-gather.min.js +1 -1
- package/lib/form/src/form-item.js +10 -5
- package/lib/form/src/form-item.min.js +1 -1
- package/lib/form/src/form.js +72 -83
- package/lib/form/src/form.min.js +1 -1
- package/lib/form/src/render.js +17 -14
- package/lib/form/src/render.min.js +1 -1
- package/lib/form/src/util.js +13 -2
- package/lib/form/src/util.min.js +1 -1
- package/lib/grid/src/grid.js +44 -34
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/header/src/header.js +10 -8
- package/lib/header/src/header.min.js +1 -1
- package/lib/index.css +1 -1
- package/lib/index.umd.js +2301 -2267
- package/lib/index.umd.min.js +1 -2
- package/lib/input/src/input.js +30 -18
- package/lib/input/src/input.min.js +1 -1
- package/lib/keyboard/src/mixin.js +12 -8
- package/lib/keyboard/src/mixin.min.js +1 -1
- package/lib/list/src/list.js +7 -5
- package/lib/list/src/list.min.js +1 -1
- package/lib/menu/src/mixin.js +24 -14
- package/lib/menu/src/mixin.min.js +1 -1
- package/lib/menu/src/panel.js +3 -3
- package/lib/menu/src/panel.min.js +1 -1
- package/lib/modal/src/modal.js +24 -12
- package/lib/modal/src/modal.min.js +1 -1
- package/lib/pulldown/src/pulldown.js +16 -12
- package/lib/pulldown/src/pulldown.min.js +1 -1
- package/lib/radio/src/button.js +2 -2
- package/lib/radio/src/button.min.js +1 -1
- package/lib/radio/src/radio.js +2 -2
- package/lib/radio/src/radio.min.js +1 -1
- package/lib/select/src/select.js +26 -16
- package/lib/select/src/select.min.js +1 -1
- package/lib/select/style/style.css +1 -1
- package/lib/select/style/style.min.css +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/switch/src/switch.js +4 -4
- package/lib/switch/src/switch.min.js +1 -1
- package/lib/table/src/body.js +36 -38
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/cell.js +22 -14
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/column.js +6 -4
- package/lib/table/src/column.min.js +1 -1
- package/lib/table/src/columnInfo.js +202 -0
- package/lib/table/src/columnInfo.min.js +1 -0
- package/lib/table/src/methods.js +241 -242
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/table.js +99 -124
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +38 -3
- package/lib/table/src/util.min.js +1 -1
- package/lib/textarea/src/textarea.js +2 -2
- package/lib/textarea/src/textarea.min.js +1 -1
- package/lib/toolbar/src/toolbar.js +16 -10
- package/lib/toolbar/src/toolbar.min.js +1 -1
- package/lib/tools/{src/dom.js → dom.js} +6 -8
- package/lib/tools/dom.min.js +1 -0
- package/lib/tools/{src/event.js → event.js} +3 -6
- package/lib/tools/event.min.js +1 -0
- package/lib/tools/log.js +29 -0
- package/lib/tools/log.min.js +1 -0
- package/lib/tools/{src/resize.js → resize.js} +1 -1
- package/lib/tools/resize.min.js +1 -0
- package/lib/tools/utils.js +155 -0
- package/lib/tools/utils.min.js +1 -0
- package/lib/tooltip/src/tooltip.js +138 -76
- package/lib/tooltip/src/tooltip.min.js +1 -1
- package/lib/tooltip/style/style.css +1 -1
- package/lib/tooltip/style/style.min.css +1 -1
- package/lib/v-x-e-table/index.js +7 -4
- package/lib/v-x-e-table/index.min.js +1 -1
- package/lib/v-x-e-table/src/conf.js +12 -7
- package/lib/v-x-e-table/src/conf.min.js +1 -1
- package/lib/v-x-e-table/src/interceptor.js +4 -4
- package/lib/v-x-e-table/src/interceptor.min.js +1 -1
- package/lib/v-x-e-table/src/renderer.js +18 -10
- package/lib/v-x-e-table/src/renderer.min.js +1 -1
- package/lib/v-x-e-table/src/store.js +3 -3
- package/lib/v-x-e-table/src/store.min.js +1 -1
- package/lib/validator/src/mixin.js +4 -4
- package/lib/validator/src/mixin.min.js +1 -1
- package/package.json +3 -3
- package/packages/button/src/button.js +4 -2
- package/packages/checkbox/src/checkbox.js +2 -2
- package/packages/edit/src/mixin.js +7 -6
- package/packages/export/src/export-panel.js +1 -1
- package/packages/export/src/import-panel.js +1 -1
- package/packages/export/src/mixin.js +20 -19
- package/packages/filter/src/mixin.js +3 -3
- package/packages/filter/src/panel.js +1 -1
- package/packages/footer/src/footer.js +4 -2
- package/packages/form/src/form-gather.js +2 -2
- package/packages/form/src/form-item.js +9 -4
- package/packages/form/src/form.js +41 -48
- package/packages/form/src/render.js +9 -9
- package/packages/form/src/util.js +9 -2
- package/packages/grid/src/grid.js +22 -20
- package/packages/header/src/header.js +3 -2
- package/packages/input/src/input.js +6 -3
- package/packages/keyboard/src/mixin.js +1 -2
- package/packages/list/src/list.js +3 -2
- package/packages/menu/src/mixin.js +5 -3
- package/packages/menu/src/panel.js +3 -3
- package/packages/modal/src/modal.js +7 -4
- package/packages/pulldown/src/pulldown.js +3 -1
- package/packages/radio/src/button.js +2 -2
- package/packages/radio/src/radio.js +2 -2
- package/packages/select/src/select.js +5 -3
- package/packages/switch/src/switch.js +4 -4
- package/packages/table/src/body.js +25 -27
- package/packages/table/src/cell.js +8 -7
- package/packages/table/src/column.js +4 -2
- package/packages/table/src/columnInfo.js +149 -0
- package/packages/table/src/methods.js +90 -101
- package/packages/table/src/table.js +68 -98
- package/packages/table/src/util.js +19 -1
- package/packages/textarea/src/textarea.js +2 -2
- package/packages/toolbar/src/toolbar.js +7 -4
- package/packages/tools/{src/dom.js → dom.js} +6 -6
- package/packages/tools/{src/event.js → event.js} +1 -3
- package/packages/tools/log.js +16 -0
- package/packages/tools/{src/resize.js → resize.js} +1 -1
- package/packages/tools/utils.js +108 -0
- package/packages/tooltip/src/tooltip.js +90 -46
- package/packages/v-x-e-table/index.js +4 -2
- package/packages/v-x-e-table/src/conf.js +12 -7
- package/packages/v-x-e-table/src/interceptor.js +3 -3
- package/packages/v-x-e-table/src/renderer.js +4 -3
- package/packages/v-x-e-table/src/store.js +2 -2
- package/packages/validator/src/mixin.js +3 -3
- package/styles/select.scss +1 -1
- package/styles/tooltip.scss +1 -1
- package/types/v-x-e-table/index.d.ts +8 -0
- package/README.en.md +0 -170
- package/README.zh-TW.md +0 -174
- package/lib/tools/index.js +0 -76
- package/lib/tools/index.min.js +0 -1
- package/lib/tools/src/dom.min.js +0 -1
- package/lib/tools/src/event.min.js +0 -1
- package/lib/tools/src/resize.min.js +0 -1
- package/lib/tools/src/utils.js +0 -365
- package/lib/tools/src/utils.min.js +0 -1
- package/packages/tools/index.js +0 -14
- package/packages/tools/src/utils.js +0 -272
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import GlobalConfig from '../../v-x-e-table/src/conf'
|
|
2
2
|
import vSize from '../../mixins/size'
|
|
3
3
|
import XEUtils from 'xe-utils'
|
|
4
|
-
import
|
|
4
|
+
import UtilTools, { getFuncText } from '../../tools/utils'
|
|
5
|
+
import DomTools from '../../tools/dom'
|
|
6
|
+
import { GlobalEvent } from '../../tools/event'
|
|
7
|
+
import { errLog } from '../../tools/log'
|
|
5
8
|
|
|
6
9
|
export const allActivedModals = []
|
|
7
10
|
export const msgQueue = []
|
|
@@ -86,7 +89,7 @@ export default {
|
|
|
86
89
|
},
|
|
87
90
|
created () {
|
|
88
91
|
if (this.storage && !this.id) {
|
|
89
|
-
|
|
92
|
+
errLog('vxe.error.reqProp', ['modal.id'])
|
|
90
93
|
}
|
|
91
94
|
},
|
|
92
95
|
mounted () {
|
|
@@ -167,7 +170,7 @@ export default {
|
|
|
167
170
|
}, headerSlot ? (!inited || (destroyOnClose && !visible) ? [] : headerSlot.call(this, { $modal: this }, h)) : [
|
|
168
171
|
titleSlot ? titleSlot.call(this, { $modal: this }, h) : h('span', {
|
|
169
172
|
class: 'vxe-modal--title'
|
|
170
|
-
}, title ?
|
|
173
|
+
}, title ? getFuncText(title) : GlobalConfig.i18n('vxe.alert.title')),
|
|
171
174
|
showZoom ? h('i', {
|
|
172
175
|
class: ['vxe-modal--zoom-btn', 'trigger--btn', zoomLocat ? GlobalConfig.icon.MODAL_ZOOM_OUT : GlobalConfig.icon.MODAL_ZOOM_IN],
|
|
173
176
|
attrs: {
|
|
@@ -199,7 +202,7 @@ export default {
|
|
|
199
202
|
]) : null,
|
|
200
203
|
h('div', {
|
|
201
204
|
class: 'vxe-modal--content'
|
|
202
|
-
}, defaultSlot ? (!inited || (destroyOnClose && !visible) ? [] : defaultSlot.call(this, { $modal: this }, h)) :
|
|
205
|
+
}, defaultSlot ? (!inited || (destroyOnClose && !visible) ? [] : defaultSlot.call(this, { $modal: this }, h)) : getFuncText(content)),
|
|
203
206
|
!isMsg ? h('div', {
|
|
204
207
|
class: ['vxe-loading', {
|
|
205
208
|
'is--visible': loading
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import GlobalConfig from '../../v-x-e-table/src/conf'
|
|
2
2
|
import vSize from '../../mixins/size'
|
|
3
|
-
import
|
|
3
|
+
import UtilTools from '../../tools/utils'
|
|
4
|
+
import DomTools from '../../tools/dom'
|
|
5
|
+
import { GlobalEvent } from '../../tools/event'
|
|
4
6
|
|
|
5
7
|
export default {
|
|
6
8
|
name: 'VxePulldown',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getFuncText } from '../../tools/utils'
|
|
2
2
|
import GlobalConfig from '../../v-x-e-table/src/conf'
|
|
3
3
|
|
|
4
4
|
export default {
|
|
@@ -60,7 +60,7 @@ export default {
|
|
|
60
60
|
}),
|
|
61
61
|
h('span', {
|
|
62
62
|
class: 'vxe-radio--label'
|
|
63
|
-
}, $scopedSlots.default ? $scopedSlots.default.call(this, {}) : [
|
|
63
|
+
}, $scopedSlots.default ? $scopedSlots.default.call(this, {}) : [getFuncText(content)])
|
|
64
64
|
])
|
|
65
65
|
},
|
|
66
66
|
methods: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getFuncText } from '../../tools/utils'
|
|
2
2
|
import GlobalConfig from '../../v-x-e-table/src/conf'
|
|
3
3
|
import vSize from '../../mixins/size'
|
|
4
4
|
|
|
@@ -63,7 +63,7 @@ export default {
|
|
|
63
63
|
}),
|
|
64
64
|
h('span', {
|
|
65
65
|
class: 'vxe-radio--label'
|
|
66
|
-
}, $scopedSlots.default ? $scopedSlots.default.call(this, {}) : [
|
|
66
|
+
}, $scopedSlots.default ? $scopedSlots.default.call(this, {}) : [getFuncText(content)])
|
|
67
67
|
])
|
|
68
68
|
},
|
|
69
69
|
methods: {
|
|
@@ -2,7 +2,9 @@ import XEUtils from 'xe-utils'
|
|
|
2
2
|
import VxeInput from '../../input/src/input'
|
|
3
3
|
import GlobalConfig from '../../v-x-e-table/src/conf'
|
|
4
4
|
import vSize from '../../mixins/size'
|
|
5
|
-
import
|
|
5
|
+
import UtilTools, { getFuncText } from '../../tools/utils'
|
|
6
|
+
import DomTools from '../../tools/dom'
|
|
7
|
+
import { GlobalEvent } from '../../tools/event'
|
|
6
8
|
|
|
7
9
|
function isOptionVisible (option) {
|
|
8
10
|
return option.visible !== false
|
|
@@ -146,7 +148,7 @@ export function renderOption (h, _vm, list, group) {
|
|
|
146
148
|
}
|
|
147
149
|
}
|
|
148
150
|
}
|
|
149
|
-
}, defaultSlot ? _vm.callSlot(defaultSlot, { option, $select: _vm }, h) : UtilTools.formatText(
|
|
151
|
+
}, defaultSlot ? _vm.callSlot(defaultSlot, { option, $select: _vm }, h) : UtilTools.formatText(getFuncText(option[labelField]))) : null
|
|
150
152
|
})
|
|
151
153
|
}
|
|
152
154
|
|
|
@@ -168,7 +170,7 @@ export function renderOptgroup (h, _vm) {
|
|
|
168
170
|
}, [
|
|
169
171
|
h('div', {
|
|
170
172
|
class: 'vxe-optgroup--title'
|
|
171
|
-
}, defaultSlot ? _vm.callSlot(defaultSlot, { option: group, $select: _vm }, h) :
|
|
173
|
+
}, defaultSlot ? _vm.callSlot(defaultSlot, { option: group, $select: _vm }, h) : getFuncText(group[groupLabelField])),
|
|
172
174
|
h('div', {
|
|
173
175
|
class: 'vxe-optgroup--wrapper'
|
|
174
176
|
}, renderOption(h, _vm, group[groupOptionsField], group))
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getFuncText } from '../../tools/utils'
|
|
2
2
|
import GlobalConfig from '../../v-x-e-table/src/conf'
|
|
3
3
|
import vSize from '../../mixins/size'
|
|
4
|
-
import { browse } from '../../tools/
|
|
4
|
+
import { browse } from '../../tools/dom'
|
|
5
5
|
|
|
6
6
|
export default {
|
|
7
7
|
name: 'VxeSwitch',
|
|
@@ -30,10 +30,10 @@ export default {
|
|
|
30
30
|
return this.value === this.openValue
|
|
31
31
|
},
|
|
32
32
|
onShowLabel () {
|
|
33
|
-
return
|
|
33
|
+
return getFuncText(this.openLabel)
|
|
34
34
|
},
|
|
35
35
|
offShowLabel () {
|
|
36
|
-
return
|
|
36
|
+
return getFuncText(this.closeLabel)
|
|
37
37
|
},
|
|
38
38
|
styles () {
|
|
39
39
|
return browse.msie && this.isChecked ? {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import XEUtils from 'xe-utils'
|
|
2
2
|
import GlobalConfig from '../../v-x-e-table/src/conf'
|
|
3
3
|
import VXETable from '../../v-x-e-table'
|
|
4
|
-
import
|
|
4
|
+
import UtilTools, { isEnableConf } from '../../tools/utils'
|
|
5
5
|
import { getOffsetSize, calcTreeLine, mergeBodyMethod, removeScrollListener, restoreScrollListener } from './util'
|
|
6
|
-
import
|
|
6
|
+
import DomTools from '../../tools/dom'
|
|
7
7
|
|
|
8
8
|
const renderType = 'body'
|
|
9
9
|
|
|
@@ -83,7 +83,8 @@ function renderColumn (h, _vm, $xetable, seq, rowid, fixedType, rowLevel, row, r
|
|
|
83
83
|
editStore,
|
|
84
84
|
validStore,
|
|
85
85
|
tooltipConfig,
|
|
86
|
-
rowOpts
|
|
86
|
+
rowOpts,
|
|
87
|
+
columnOpts
|
|
87
88
|
} = $xetable
|
|
88
89
|
const { type, cellRender, editRender, align, showOverflow, className, treeNode } = column
|
|
89
90
|
const { actived } = editStore
|
|
@@ -267,7 +268,7 @@ function renderColumn (h, _vm, $xetable, seq, rowid, fixedType, rowLevel, row, r
|
|
|
267
268
|
'col--valid-error': hasValidError,
|
|
268
269
|
'col--current': currentColumn === column
|
|
269
270
|
}, UtilTools.getClass(className, params), UtilTools.getClass(cellClassName, params)],
|
|
270
|
-
key: columnKey ? column.id : $columnIndex,
|
|
271
|
+
key: columnKey || columnOpts.useKey ? column.id : $columnIndex,
|
|
271
272
|
attrs,
|
|
272
273
|
style: Object.assign({
|
|
273
274
|
height: hasEllipsis && (scrollYRHeight || rowHeight) ? `${scrollYRHeight || rowHeight}px` : ''
|
|
@@ -343,7 +344,7 @@ function renderRows (h, _vm, $xetable, fixedType, tableData, tableColumn) {
|
|
|
343
344
|
rowid: rowid
|
|
344
345
|
},
|
|
345
346
|
style: rowStyle ? (XEUtils.isFunction(rowStyle) ? rowStyle(params) : rowStyle) : null,
|
|
346
|
-
key: rowKey || treeConfig ? rowid : $rowIndex,
|
|
347
|
+
key: (rowKey || rowOpts.useKey) || treeConfig ? rowid : $rowIndex,
|
|
347
348
|
on: trOn
|
|
348
349
|
}, tableColumn.map((column, $columnIndex) => {
|
|
349
350
|
return renderColumn(h, _vm, $xetable, seq, rowid, fixedType, rowLevel, row, rowIndex, $rowIndex, _rowIndex, column, $columnIndex, tableColumn, tableData)
|
|
@@ -413,29 +414,26 @@ function syncBodyScroll (_vm, fixedType, scrollTop, elem1, elem2) {
|
|
|
413
414
|
}
|
|
414
415
|
clearTimeout(scrollProcessTimeout)
|
|
415
416
|
scrollProcessTimeout = setTimeout(() => {
|
|
416
|
-
const { tableBody, leftBody, rightBody } = _vm.$refs
|
|
417
|
-
const bodyElem = tableBody.$el
|
|
418
|
-
const leftElem = leftBody ? leftBody.$el : null
|
|
419
|
-
const rightElem = rightBody ? rightBody.$el : null
|
|
417
|
+
// const { tableBody, leftBody, rightBody } = _vm.$refs
|
|
418
|
+
// const bodyElem = tableBody.$el
|
|
419
|
+
// const leftElem = leftBody ? leftBody.$el : null
|
|
420
|
+
// const rightElem = rightBody ? rightBody.$el : null
|
|
420
421
|
restoreScrollListener(elem1)
|
|
421
422
|
restoreScrollListener(elem2)
|
|
422
423
|
// 检查滚动条是的同步
|
|
423
|
-
let targetTop = bodyElem.scrollTop
|
|
424
|
-
|
|
425
|
-
if (
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
setScrollLeftAndTop(bodyElem, targetLeft, targetTop)
|
|
437
|
-
setScrollLeftAndTop(leftElem, targetLeft, targetTop)
|
|
438
|
-
setScrollLeftAndTop(rightElem, targetLeft, targetTop)
|
|
424
|
+
// let targetTop = bodyElem.scrollTop
|
|
425
|
+
// if (fixedType === 'left') {
|
|
426
|
+
// if (leftElem) {
|
|
427
|
+
// targetTop = leftElem.scrollTop
|
|
428
|
+
// }
|
|
429
|
+
// } else if (fixedType === 'right') {
|
|
430
|
+
// if (rightElem) {
|
|
431
|
+
// targetTop = rightElem.scrollTop
|
|
432
|
+
// }
|
|
433
|
+
// }
|
|
434
|
+
// setScrollTop(bodyElem, targetTop)
|
|
435
|
+
// setScrollTop(leftElem, targetTop)
|
|
436
|
+
// setScrollTop(rightElem, targetTop)
|
|
439
437
|
}, 300)
|
|
440
438
|
}
|
|
441
439
|
}
|
|
@@ -749,8 +747,8 @@ export default {
|
|
|
749
747
|
const { tableBody } = $refs
|
|
750
748
|
const bodyElem = tableBody.$el
|
|
751
749
|
|
|
752
|
-
const deltaTop =
|
|
753
|
-
const deltaLeft =
|
|
750
|
+
const deltaTop = deltaY
|
|
751
|
+
const deltaLeft = deltaX
|
|
754
752
|
const isTopWheel = deltaTop < 0
|
|
755
753
|
// 如果滚动位置已经是顶部或底部,则不需要触发
|
|
756
754
|
if (isTopWheel ? scrollBodyElem.scrollTop <= 0 : scrollBodyElem.scrollTop >= scrollBodyElem.scrollHeight - scrollBodyElem.clientHeight) {
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import XEUtils from 'xe-utils'
|
|
2
2
|
import GlobalConfig from '../../v-x-e-table/src/conf'
|
|
3
3
|
import VXETable from '../../v-x-e-table'
|
|
4
|
-
import
|
|
5
|
-
import { eqEmptyValue, isEnableConf } from '../../tools/
|
|
4
|
+
import DomTools from '../../tools/dom'
|
|
5
|
+
import UtilTools, { eqEmptyValue, isEnableConf, getFuncText } from '../../tools/utils'
|
|
6
|
+
import { getColumnConfig } from './util'
|
|
6
7
|
|
|
7
8
|
function renderHelpIcon (h, params) {
|
|
8
9
|
const { $table, column } = params
|
|
9
|
-
const
|
|
10
|
-
return
|
|
10
|
+
const titlePrefix = column.titlePrefix || column.titleHelp
|
|
11
|
+
return titlePrefix ? [
|
|
11
12
|
h('i', {
|
|
12
|
-
class: ['vxe-cell-help-icon',
|
|
13
|
+
class: ['vxe-cell-help-icon', titlePrefix.icon || GlobalConfig.icon.TABLE_HELP],
|
|
13
14
|
on: {
|
|
14
15
|
mouseenter (evnt) {
|
|
15
16
|
$table.triggerHeaderHelpEvent(evnt, params)
|
|
@@ -136,7 +137,7 @@ export const Cell = {
|
|
|
136
137
|
renMaps.renderHeader = this.renderFilterHeader
|
|
137
138
|
}
|
|
138
139
|
}
|
|
139
|
-
return
|
|
140
|
+
return getColumnConfig($xetable, _vm, renMaps)
|
|
140
141
|
},
|
|
141
142
|
/**
|
|
142
143
|
* 单元格
|
|
@@ -182,7 +183,7 @@ export const Cell = {
|
|
|
182
183
|
// 如果设置占位符
|
|
183
184
|
h('span', {
|
|
184
185
|
class: 'vxe-cell--placeholder'
|
|
185
|
-
}, UtilTools.formatText(
|
|
186
|
+
}, UtilTools.formatText(getFuncText(cellPlaceholder), 1))
|
|
186
187
|
] : UtilTools.formatText(cellValue, 1))
|
|
187
188
|
]
|
|
188
189
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Cell from '../../table/src/cell'
|
|
2
|
-
import
|
|
2
|
+
import UtilTools from '../../tools/utils'
|
|
3
3
|
|
|
4
4
|
const props = {
|
|
5
5
|
// 列唯一主键
|
|
@@ -68,8 +68,10 @@ const props = {
|
|
|
68
68
|
exportMethod: Function,
|
|
69
69
|
// 表尾单元格数据导出方法
|
|
70
70
|
footerExportMethod: Function,
|
|
71
|
-
//
|
|
71
|
+
// 已废弃,被 titlePrefix 替换
|
|
72
72
|
titleHelp: Object,
|
|
73
|
+
// 标题帮助图标配置项
|
|
74
|
+
titlePrefix: Object,
|
|
73
75
|
// 单元格值类型
|
|
74
76
|
cellType: String,
|
|
75
77
|
// 单元格渲染配置项
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import XEUtils from 'xe-utils'
|
|
2
|
+
import GlobalConfig from '../../v-x-e-table/src/conf'
|
|
3
|
+
import { formats } from '../../v-x-e-table/src/formats'
|
|
4
|
+
import { toFilters } from './util'
|
|
5
|
+
import { getFuncText } from '../../tools/utils'
|
|
6
|
+
import { warnLog, errLog } from '../../tools/log'
|
|
7
|
+
|
|
8
|
+
export class ColumnInfo {
|
|
9
|
+
/* eslint-disable @typescript-eslint/no-use-before-define */
|
|
10
|
+
constructor ($xetable, _vm, { renderHeader, renderCell, renderFooter, renderData } = {}) {
|
|
11
|
+
const $xegrid = $xetable.$xegrid
|
|
12
|
+
const proxyOpts = $xegrid ? $xegrid.proxyOpts : null
|
|
13
|
+
const formatter = _vm.formatter
|
|
14
|
+
const visible = XEUtils.isBoolean(_vm.visible) ? _vm.visible : true
|
|
15
|
+
|
|
16
|
+
if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
|
|
17
|
+
const types = ['seq', 'checkbox', 'radio', 'expand', 'html']
|
|
18
|
+
if (_vm.type && types.indexOf(_vm.type) === -1) {
|
|
19
|
+
warnLog('vxe.error.errProp', [`type=${_vm.type}`, types.join(', ')])
|
|
20
|
+
}
|
|
21
|
+
if (XEUtils.isBoolean(_vm.cellRender) || (_vm.cellRender && !XEUtils.isObject(_vm.cellRender))) {
|
|
22
|
+
warnLog('vxe.error.errProp', [`column.cell-render=${_vm.cellRender}`, 'column.cell-render={}'])
|
|
23
|
+
}
|
|
24
|
+
if (XEUtils.isBoolean(_vm.editRender) || (_vm.editRender && !XEUtils.isObject(_vm.editRender))) {
|
|
25
|
+
warnLog('vxe.error.errProp', [`column.edit-render=${_vm.editRender}`, 'column.edit-render={}'])
|
|
26
|
+
}
|
|
27
|
+
if (_vm.cellRender && _vm.editRender) {
|
|
28
|
+
warnLog('vxe.error.errConflicts', ['column.cell-render', 'column.edit-render'])
|
|
29
|
+
}
|
|
30
|
+
if (_vm.type === 'expand') {
|
|
31
|
+
if ($xetable.treeConfig && $xetable.treeOpts.line) {
|
|
32
|
+
errLog('vxe.error.errConflicts', ['tree-config.line', 'column.type=expand'])
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
if (_vm.remoteSort) {
|
|
36
|
+
warnLog('vxe.error.delProp', ['column.remote-sort', 'sort-config.remote'])
|
|
37
|
+
}
|
|
38
|
+
if (_vm.sortMethod) {
|
|
39
|
+
warnLog('vxe.error.delProp', ['column.sort-method', 'sort-config.sortMethod'])
|
|
40
|
+
}
|
|
41
|
+
if (formatter) {
|
|
42
|
+
if (XEUtils.isString(formatter)) {
|
|
43
|
+
const globalFunc = formats.get(formatter) || XEUtils[formatter]
|
|
44
|
+
if (!XEUtils.isFunction(globalFunc)) {
|
|
45
|
+
errLog('vxe.error.notFunc', [formatter])
|
|
46
|
+
}
|
|
47
|
+
} else if (XEUtils.isArray(formatter)) {
|
|
48
|
+
const globalFunc = formats.get(formatter[0]) || XEUtils[formatter[0]]
|
|
49
|
+
if (!XEUtils.isFunction(globalFunc)) {
|
|
50
|
+
errLog('vxe.error.notFunc', [formatter[0]])
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
Object.assign(this, {
|
|
57
|
+
// 基本属性
|
|
58
|
+
type: _vm.type,
|
|
59
|
+
property: _vm.field,
|
|
60
|
+
field: _vm.field,
|
|
61
|
+
title: _vm.title,
|
|
62
|
+
width: _vm.width,
|
|
63
|
+
minWidth: _vm.minWidth,
|
|
64
|
+
resizable: _vm.resizable,
|
|
65
|
+
fixed: _vm.fixed,
|
|
66
|
+
align: _vm.align,
|
|
67
|
+
headerAlign: _vm.headerAlign,
|
|
68
|
+
footerAlign: _vm.footerAlign,
|
|
69
|
+
showOverflow: _vm.showOverflow,
|
|
70
|
+
showHeaderOverflow: _vm.showHeaderOverflow,
|
|
71
|
+
showFooterOverflow: _vm.showFooterOverflow,
|
|
72
|
+
className: _vm.className,
|
|
73
|
+
headerClassName: _vm.headerClassName,
|
|
74
|
+
footerClassName: _vm.footerClassName,
|
|
75
|
+
formatter: formatter,
|
|
76
|
+
sortable: _vm.sortable,
|
|
77
|
+
sortBy: _vm.sortBy,
|
|
78
|
+
sortType: _vm.sortType,
|
|
79
|
+
sortMethod: _vm.sortMethod,
|
|
80
|
+
remoteSort: _vm.remoteSort,
|
|
81
|
+
filters: toFilters(_vm.filters),
|
|
82
|
+
filterMultiple: XEUtils.isBoolean(_vm.filterMultiple) ? _vm.filterMultiple : true,
|
|
83
|
+
filterMethod: _vm.filterMethod,
|
|
84
|
+
filterResetMethod: _vm.filterResetMethod,
|
|
85
|
+
filterRecoverMethod: _vm.filterRecoverMethod,
|
|
86
|
+
filterRender: _vm.filterRender,
|
|
87
|
+
treeNode: _vm.treeNode,
|
|
88
|
+
cellType: _vm.cellType,
|
|
89
|
+
cellRender: _vm.cellRender,
|
|
90
|
+
editRender: _vm.editRender,
|
|
91
|
+
contentRender: _vm.contentRender,
|
|
92
|
+
exportMethod: _vm.exportMethod,
|
|
93
|
+
footerExportMethod: _vm.footerExportMethod,
|
|
94
|
+
titleHelp: _vm.titleHelp,
|
|
95
|
+
titlePrefix: _vm.titlePrefix,
|
|
96
|
+
// 自定义参数
|
|
97
|
+
params: _vm.params,
|
|
98
|
+
// 渲染属性
|
|
99
|
+
id: _vm.colId || XEUtils.uniqueId('col_'),
|
|
100
|
+
parentId: null,
|
|
101
|
+
visible,
|
|
102
|
+
// 内部属性(一旦被使用,将导致不可升级版本)
|
|
103
|
+
halfVisible: false,
|
|
104
|
+
defaultVisible: visible,
|
|
105
|
+
checked: false,
|
|
106
|
+
halfChecked: false,
|
|
107
|
+
disabled: false,
|
|
108
|
+
level: 1,
|
|
109
|
+
rowSpan: 1,
|
|
110
|
+
colSpan: 1,
|
|
111
|
+
order: null,
|
|
112
|
+
sortTime: 0,
|
|
113
|
+
renderWidth: 0,
|
|
114
|
+
renderHeight: 0,
|
|
115
|
+
resizeWidth: 0,
|
|
116
|
+
renderLeft: 0,
|
|
117
|
+
renderArgs: [], // 渲染参数可用于扩展
|
|
118
|
+
model: {},
|
|
119
|
+
renderHeader: renderHeader || _vm.renderHeader,
|
|
120
|
+
renderCell: renderCell || _vm.renderCell,
|
|
121
|
+
renderFooter: renderFooter || _vm.renderFooter,
|
|
122
|
+
renderData: renderData,
|
|
123
|
+
// 单元格插槽,只对 grid 有效
|
|
124
|
+
slots: _vm.slots
|
|
125
|
+
})
|
|
126
|
+
if (proxyOpts && proxyOpts.beforeColumn) {
|
|
127
|
+
proxyOpts.beforeColumn({ $grid: $xegrid, column: this })
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
getTitle () {
|
|
132
|
+
return getFuncText(this.title || (this.type === 'seq' ? GlobalConfig.i18n('vxe.table.seqTitle') : ''))
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
getKey () {
|
|
136
|
+
return this.property || (this.type ? `type=${this.type}` : null)
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
update (name, value) {
|
|
140
|
+
// 不支持双向的属性
|
|
141
|
+
if (name !== 'filters') {
|
|
142
|
+
if (name === 'field') {
|
|
143
|
+
// 兼容旧属性
|
|
144
|
+
this.property = value
|
|
145
|
+
}
|
|
146
|
+
this[name] = value
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|