vxe-table 3.3.12 → 3.3.14-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/helper/vetur/attributes.json +8 -0
- package/helper/vetur/tags.json +2 -0
- package/lib/form/src/form-gather.js +13 -0
- package/lib/form/src/form-gather.min.js +1 -1
- package/lib/form/src/form-item.js +123 -1
- package/lib/form/src/form-item.min.js +1 -1
- package/lib/form/src/form.js +72 -102
- package/lib/form/src/form.min.js +1 -1
- package/lib/form/src/render.js +81 -0
- package/lib/form/src/render.min.js +1 -0
- package/lib/grid/src/grid.js +26 -9
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.css +1 -1
- package/lib/index.umd.js +1173 -226
- package/lib/index.umd.min.js +1 -1
- package/lib/modal/src/modal.js +16 -4
- package/lib/modal/src/modal.min.js +1 -1
- package/lib/modal/style/style.css +2 -2
- package/lib/modal/style/style.min.css +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/src/body.js +15 -1
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/methods.js +45 -30
- package/lib/table/src/methods.min.js +1 -1
- package/lib/textarea/src/textarea.js +11 -3
- package/lib/textarea/src/textarea.min.js +1 -1
- package/lib/textarea/style/style.css +11 -12
- package/lib/textarea/style/style.min.css +1 -1
- package/lib/v-x-e-table/src/conf.js +1 -0
- package/lib/v-x-e-table/src/conf.min.js +1 -1
- package/package.json +5 -5
- package/packages/form/src/form-gather.js +10 -0
- package/packages/form/src/form-item.js +101 -1
- package/packages/form/src/form.js +49 -107
- package/packages/form/src/render.js +79 -0
- package/packages/grid/src/grid.js +16 -5
- package/packages/modal/src/modal.js +9 -4
- package/packages/table/src/body.js +12 -4
- package/packages/table/src/methods.js +19 -9
- package/packages/textarea/src/textarea.js +8 -3
- package/packages/v-x-e-table/src/conf.js +1 -0
- package/styles/modal.scss +3 -3
- package/styles/textarea.scss +11 -11
- package/styles/variable.scss +198 -198
- package/types/form.d.ts +5 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import VxeFormItem from './form-item'
|
|
2
|
+
import { UtilTools } from '../../tools'
|
|
2
3
|
|
|
3
4
|
export default {
|
|
4
5
|
name: 'VxeFormGather',
|
|
@@ -8,6 +9,15 @@ export default {
|
|
|
8
9
|
xeformgather: this
|
|
9
10
|
}
|
|
10
11
|
},
|
|
12
|
+
created () {
|
|
13
|
+
if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
|
|
14
|
+
this.$nextTick(() => {
|
|
15
|
+
if (this.$xeform && this.$xeform.customLayout) {
|
|
16
|
+
UtilTools.error('vxe.error.errConflicts', ['custom-layout', '<form-gather ...>'])
|
|
17
|
+
}
|
|
18
|
+
})
|
|
19
|
+
}
|
|
20
|
+
},
|
|
11
21
|
render (h) {
|
|
12
22
|
return h('div', this.$slots.default)
|
|
13
23
|
}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
+
import XEUtils from 'xe-utils'
|
|
2
|
+
import GlobalConfig from '../../v-x-e-table/src/conf'
|
|
3
|
+
import VXETable from '../../v-x-e-table'
|
|
4
|
+
import { UtilTools, isEnableConf } from '../../tools'
|
|
1
5
|
import { createItem, destroyItem, assemItem } from './util'
|
|
6
|
+
import { renderTitle } from './render'
|
|
2
7
|
|
|
3
8
|
const props = {
|
|
4
9
|
title: String,
|
|
@@ -27,6 +32,100 @@ Object.keys(props).forEach(name => {
|
|
|
27
32
|
}
|
|
28
33
|
})
|
|
29
34
|
|
|
35
|
+
const renderItem = (h, _vm, item, slots) => {
|
|
36
|
+
const { rules, data, collapseAll, validOpts, titleOverflow: allTitleOverflow } = _vm
|
|
37
|
+
const { title, folding, visible, visibleMethod, field, collapseNode, itemRender, showError, errRule, className, titleOverflow } = item
|
|
38
|
+
const compConf = isEnableConf(itemRender) ? VXETable.renderer.get(itemRender.name) : null
|
|
39
|
+
const span = item.span || _vm.span
|
|
40
|
+
const align = item.align || _vm.align
|
|
41
|
+
const titleAlign = item.titleAlign || _vm.titleAlign
|
|
42
|
+
const titleWidth = item.titleWidth || _vm.titleWidth
|
|
43
|
+
let itemVisibleMethod = visibleMethod
|
|
44
|
+
const itemOverflow = (XEUtils.isUndefined(titleOverflow) || XEUtils.isNull(titleOverflow)) ? allTitleOverflow : titleOverflow
|
|
45
|
+
const showEllipsis = itemOverflow === 'ellipsis'
|
|
46
|
+
const showTitle = itemOverflow === 'title'
|
|
47
|
+
const showTooltip = itemOverflow === true || itemOverflow === 'tooltip'
|
|
48
|
+
const hasEllipsis = showTitle || showTooltip || showEllipsis
|
|
49
|
+
const params = { data, property: field, item, $form: _vm }
|
|
50
|
+
let isRequired
|
|
51
|
+
if (!itemVisibleMethod && compConf && compConf.itemVisibleMethod) {
|
|
52
|
+
itemVisibleMethod = compConf.itemVisibleMethod
|
|
53
|
+
}
|
|
54
|
+
if (rules) {
|
|
55
|
+
const itemRules = rules[field]
|
|
56
|
+
if (itemRules) {
|
|
57
|
+
isRequired = itemRules.some(rule => rule.required)
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
let contentVNs = []
|
|
61
|
+
if (slots && slots.default) {
|
|
62
|
+
contentVNs = _vm.callSlot(slots.default, params, h)
|
|
63
|
+
} else if (compConf && compConf.renderItemContent) {
|
|
64
|
+
contentVNs = compConf.renderItemContent.call(_vm, h, itemRender, params)
|
|
65
|
+
} else if (compConf && compConf.renderItem) {
|
|
66
|
+
contentVNs = compConf.renderItem.call(_vm, h, itemRender, params)
|
|
67
|
+
} else if (field) {
|
|
68
|
+
contentVNs = [`${XEUtils.get(data, field)}`]
|
|
69
|
+
}
|
|
70
|
+
const ons = showTooltip ? {
|
|
71
|
+
mouseenter (evnt) {
|
|
72
|
+
_vm.triggerHeaderHelpEvent(evnt, params)
|
|
73
|
+
},
|
|
74
|
+
mouseleave: _vm.handleTargetLeaveEvent
|
|
75
|
+
} : {}
|
|
76
|
+
return h('div', {
|
|
77
|
+
class: ['vxe-form--item', item.id, span ? `vxe-col--${span} is--span` : null, className ? (XEUtils.isFunction(className) ? className(params) : className) : '', {
|
|
78
|
+
'is--title': title,
|
|
79
|
+
'is--required': isRequired,
|
|
80
|
+
'is--hidden': visible === false || (folding && collapseAll),
|
|
81
|
+
'is--active': !itemVisibleMethod || itemVisibleMethod(params),
|
|
82
|
+
'is--error': showError
|
|
83
|
+
}]
|
|
84
|
+
}, [
|
|
85
|
+
h('div', {
|
|
86
|
+
class: 'vxe-form--item-inner'
|
|
87
|
+
}, [
|
|
88
|
+
title || (slots && slots.title) ? h('div', {
|
|
89
|
+
class: ['vxe-form--item-title', titleAlign ? `align--${titleAlign}` : null, {
|
|
90
|
+
'is--ellipsis': hasEllipsis
|
|
91
|
+
}],
|
|
92
|
+
style: titleWidth ? {
|
|
93
|
+
width: isNaN(titleWidth) ? titleWidth : `${titleWidth}px`
|
|
94
|
+
} : null,
|
|
95
|
+
attrs: {
|
|
96
|
+
title: showTitle ? UtilTools.getFuncText(title) : null
|
|
97
|
+
},
|
|
98
|
+
on: ons
|
|
99
|
+
}, renderTitle(h, _vm, item)) : null,
|
|
100
|
+
h('div', {
|
|
101
|
+
class: ['vxe-form--item-content', align ? `align--${align}` : null]
|
|
102
|
+
}, contentVNs.concat(
|
|
103
|
+
[
|
|
104
|
+
collapseNode ? h('div', {
|
|
105
|
+
class: 'vxe-form--item-trigger-node',
|
|
106
|
+
on: {
|
|
107
|
+
click: _vm.toggleCollapseEvent
|
|
108
|
+
}
|
|
109
|
+
}, [
|
|
110
|
+
h('span', {
|
|
111
|
+
class: 'vxe-form--item-trigger-text'
|
|
112
|
+
}, collapseAll ? GlobalConfig.i18n('vxe.form.unfolding') : GlobalConfig.i18n('vxe.form.folding')),
|
|
113
|
+
h('i', {
|
|
114
|
+
class: ['vxe-form--item-trigger-icon', collapseAll ? GlobalConfig.icon.FORM_FOLDING : GlobalConfig.icon.FORM_UNFOLDING]
|
|
115
|
+
})
|
|
116
|
+
]) : null,
|
|
117
|
+
errRule && validOpts.showMessage ? h('div', {
|
|
118
|
+
class: 'vxe-form--item-valid',
|
|
119
|
+
style: errRule.maxWidth ? {
|
|
120
|
+
width: `${errRule.maxWidth}px`
|
|
121
|
+
} : null
|
|
122
|
+
}, errRule.message) : null
|
|
123
|
+
])
|
|
124
|
+
)
|
|
125
|
+
])
|
|
126
|
+
])
|
|
127
|
+
}
|
|
128
|
+
|
|
30
129
|
export default {
|
|
31
130
|
name: 'VxeFormItem',
|
|
32
131
|
props,
|
|
@@ -49,6 +148,7 @@ export default {
|
|
|
49
148
|
destroyItem(this)
|
|
50
149
|
},
|
|
51
150
|
render (h) {
|
|
52
|
-
|
|
151
|
+
const { $xeform } = this
|
|
152
|
+
return $xeform && $xeform.customLayout ? renderItem(h, $xeform, this.itemConfig, this.$scopedSlots) : h('div')
|
|
53
153
|
}
|
|
54
154
|
}
|
|
@@ -2,8 +2,9 @@ import XEUtils from 'xe-utils'
|
|
|
2
2
|
import GlobalConfig from '../../v-x-e-table/src/conf'
|
|
3
3
|
import vSize from '../../mixins/size'
|
|
4
4
|
import VXETable from '../../v-x-e-table'
|
|
5
|
-
import { UtilTools, isEnableConf } from '../../tools'
|
|
5
|
+
import { UtilTools, DomTools, isEnableConf } from '../../tools'
|
|
6
6
|
import { createItem } from './util'
|
|
7
|
+
import { renderTitle } from './render'
|
|
7
8
|
import { eqEmptyValue } from '../../tools/src/utils'
|
|
8
9
|
import { browse } from '../../tools/src/dom'
|
|
9
10
|
|
|
@@ -57,95 +58,6 @@ function getResetValue (value, resetValue) {
|
|
|
57
58
|
return resetValue
|
|
58
59
|
}
|
|
59
60
|
|
|
60
|
-
function callSlot (_vm, slotFunc, params, h) {
|
|
61
|
-
if (slotFunc) {
|
|
62
|
-
const { $scopedSlots } = _vm
|
|
63
|
-
if (XEUtils.isString(slotFunc)) {
|
|
64
|
-
slotFunc = $scopedSlots[slotFunc] || null
|
|
65
|
-
}
|
|
66
|
-
if (XEUtils.isFunction(slotFunc)) {
|
|
67
|
-
return slotFunc.call(_vm, params, h)
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
return []
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
function renderPrefixIcon (h, titlePrefix) {
|
|
74
|
-
return h('span', {
|
|
75
|
-
class: 'vxe-form--item-title-prefix'
|
|
76
|
-
}, [
|
|
77
|
-
h('i', {
|
|
78
|
-
class: titlePrefix.icon || GlobalConfig.icon.FORM_PREFIX
|
|
79
|
-
})
|
|
80
|
-
])
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
function renderSuffixIcon (h, titleSuffix) {
|
|
84
|
-
return h('span', {
|
|
85
|
-
class: 'vxe-form--item-title-suffix'
|
|
86
|
-
}, [
|
|
87
|
-
h('i', {
|
|
88
|
-
class: titleSuffix.icon || GlobalConfig.icon.FORM_SUFFIX
|
|
89
|
-
})
|
|
90
|
-
])
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
function renderTitle (h, _vm, item) {
|
|
94
|
-
const { data } = _vm
|
|
95
|
-
const { slots, field, itemRender, titlePrefix, titleSuffix } = item
|
|
96
|
-
const compConf = isEnableConf(itemRender) ? VXETable.renderer.get(itemRender.name) : null
|
|
97
|
-
const params = { data, property: field, item, $form: _vm }
|
|
98
|
-
const contVNs = []
|
|
99
|
-
const titVNs = []
|
|
100
|
-
if (titlePrefix) {
|
|
101
|
-
titVNs.push(
|
|
102
|
-
titlePrefix.message
|
|
103
|
-
? h('vxe-tooltip', {
|
|
104
|
-
props: {
|
|
105
|
-
content: UtilTools.getFuncText(titlePrefix.message),
|
|
106
|
-
enterable: titlePrefix.enterable,
|
|
107
|
-
theme: titlePrefix.theme
|
|
108
|
-
}
|
|
109
|
-
}, [
|
|
110
|
-
renderPrefixIcon(h, titlePrefix)
|
|
111
|
-
])
|
|
112
|
-
: renderPrefixIcon(h, titlePrefix)
|
|
113
|
-
)
|
|
114
|
-
}
|
|
115
|
-
titVNs.push(
|
|
116
|
-
h('span', {
|
|
117
|
-
class: 'vxe-form--item-title-label'
|
|
118
|
-
}, compConf && compConf.renderItemTitle ? compConf.renderItemTitle(itemRender, params) : (slots && slots.title ? callSlot(_vm, slots.title, params, h) : UtilTools.getFuncText(item.title)))
|
|
119
|
-
)
|
|
120
|
-
contVNs.push(
|
|
121
|
-
h('div', {
|
|
122
|
-
class: 'vxe-form--item-title-content'
|
|
123
|
-
}, titVNs)
|
|
124
|
-
)
|
|
125
|
-
const fixVNs = []
|
|
126
|
-
if (titleSuffix) {
|
|
127
|
-
fixVNs.push(
|
|
128
|
-
titleSuffix.message
|
|
129
|
-
? h('vxe-tooltip', {
|
|
130
|
-
props: {
|
|
131
|
-
content: UtilTools.getFuncText(titleSuffix.message),
|
|
132
|
-
enterable: titleSuffix.enterable,
|
|
133
|
-
theme: titleSuffix.theme
|
|
134
|
-
}
|
|
135
|
-
}, [
|
|
136
|
-
renderSuffixIcon(h, titleSuffix)
|
|
137
|
-
])
|
|
138
|
-
: renderSuffixIcon(h, titleSuffix)
|
|
139
|
-
)
|
|
140
|
-
}
|
|
141
|
-
contVNs.push(
|
|
142
|
-
h('div', {
|
|
143
|
-
class: 'vxe-form--item-title-postfix'
|
|
144
|
-
}, fixVNs)
|
|
145
|
-
)
|
|
146
|
-
return contVNs
|
|
147
|
-
}
|
|
148
|
-
|
|
149
61
|
function renderItems (h, _vm, itemList) {
|
|
150
62
|
const { _e, rules, data, collapseAll, validOpts, titleOverflow: allTitleOverflow } = _vm
|
|
151
63
|
return itemList.map((item, index) => {
|
|
@@ -185,7 +97,7 @@ function renderItems (h, _vm, itemList) {
|
|
|
185
97
|
}
|
|
186
98
|
let contentVNs = []
|
|
187
99
|
if (slots && slots.default) {
|
|
188
|
-
contentVNs = callSlot(
|
|
100
|
+
contentVNs = _vm.callSlot(slots.default, params, h)
|
|
189
101
|
} else if (compConf && compConf.renderItemContent) {
|
|
190
102
|
contentVNs = compConf.renderItemContent.call(_vm, h, itemRender, params)
|
|
191
103
|
} else if (compConf && compConf.renderItem) {
|
|
@@ -258,6 +170,7 @@ export default {
|
|
|
258
170
|
name: 'VxeForm',
|
|
259
171
|
mixins: [vSize],
|
|
260
172
|
props: {
|
|
173
|
+
collapseStatus: { type: Boolean, default: true },
|
|
261
174
|
loading: Boolean,
|
|
262
175
|
data: Object,
|
|
263
176
|
size: { type: String, default: () => GlobalConfig.form.size || GlobalConfig.size },
|
|
@@ -272,11 +185,12 @@ export default {
|
|
|
272
185
|
items: Array,
|
|
273
186
|
rules: Object,
|
|
274
187
|
preventSubmit: { type: Boolean, default: () => GlobalConfig.form.preventSubmit },
|
|
275
|
-
validConfig: Object
|
|
188
|
+
validConfig: Object,
|
|
189
|
+
customLayout: { type: Boolean, default: () => GlobalConfig.form.customLayout }
|
|
276
190
|
},
|
|
277
191
|
data () {
|
|
278
192
|
return {
|
|
279
|
-
collapseAll:
|
|
193
|
+
collapseAll: this.collapseStatus,
|
|
280
194
|
staticItems: [],
|
|
281
195
|
formItems: [],
|
|
282
196
|
|
|
@@ -305,24 +219,32 @@ export default {
|
|
|
305
219
|
return opts
|
|
306
220
|
}
|
|
307
221
|
},
|
|
308
|
-
created () {
|
|
309
|
-
this.$nextTick(() => {
|
|
310
|
-
const { items } = this
|
|
311
|
-
if (items) {
|
|
312
|
-
this.loadItem(items)
|
|
313
|
-
}
|
|
314
|
-
})
|
|
315
|
-
},
|
|
316
222
|
watch: {
|
|
317
223
|
staticItems (value) {
|
|
318
224
|
this.formItems = value
|
|
319
225
|
},
|
|
320
226
|
items (value) {
|
|
321
227
|
this.loadItem(value)
|
|
228
|
+
},
|
|
229
|
+
collapseStatus (value) {
|
|
230
|
+
this.collapseAll = !!value
|
|
322
231
|
}
|
|
323
232
|
},
|
|
233
|
+
created () {
|
|
234
|
+
this.$nextTick(() => {
|
|
235
|
+
const { items } = this
|
|
236
|
+
if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
|
|
237
|
+
if (this.customLayout && this.items) {
|
|
238
|
+
UtilTools.error('vxe.error.errConflicts', ['custom-layout', 'items'])
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
if (items) {
|
|
242
|
+
this.loadItem(items)
|
|
243
|
+
}
|
|
244
|
+
})
|
|
245
|
+
},
|
|
324
246
|
render (h) {
|
|
325
|
-
const { _e, loading, className, data, vSize, tooltipOpts, formItems } = this
|
|
247
|
+
const { _e, loading, className, data, vSize, tooltipOpts, formItems, customLayout } = this
|
|
326
248
|
const hasUseTooltip = VXETable._tooltip
|
|
327
249
|
return h('form', {
|
|
328
250
|
class: ['vxe-form', className ? (XEUtils.isFunction(className) ? className({ items: formItems, data, $form: this }) : className) : '', {
|
|
@@ -338,11 +260,11 @@ export default {
|
|
|
338
260
|
}, [
|
|
339
261
|
h('div', {
|
|
340
262
|
class: 'vxe-form--wrapper vxe-row'
|
|
341
|
-
}, renderItems(h, this, formItems)),
|
|
263
|
+
}, customLayout ? this.$slots.default : renderItems(h, this, formItems)),
|
|
342
264
|
h('div', {
|
|
343
265
|
class: 'vxe-form-slots',
|
|
344
266
|
ref: 'hideItem'
|
|
345
|
-
}, this.$slots.default),
|
|
267
|
+
}, customLayout ? [] : this.$slots.default),
|
|
346
268
|
h('div', {
|
|
347
269
|
class: ['vxe-loading', {
|
|
348
270
|
'is--visible': loading
|
|
@@ -362,6 +284,18 @@ export default {
|
|
|
362
284
|
])
|
|
363
285
|
},
|
|
364
286
|
methods: {
|
|
287
|
+
callSlot (slotFunc, params, h) {
|
|
288
|
+
if (slotFunc) {
|
|
289
|
+
const { $scopedSlots } = this
|
|
290
|
+
if (XEUtils.isString(slotFunc)) {
|
|
291
|
+
slotFunc = $scopedSlots[slotFunc] || null
|
|
292
|
+
}
|
|
293
|
+
if (XEUtils.isFunction(slotFunc)) {
|
|
294
|
+
return slotFunc.call(this, params, h)
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
return []
|
|
298
|
+
},
|
|
365
299
|
loadItem (list) {
|
|
366
300
|
if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
|
|
367
301
|
const { $scopedSlots } = this
|
|
@@ -388,12 +322,16 @@ export default {
|
|
|
388
322
|
return itemList
|
|
389
323
|
},
|
|
390
324
|
toggleCollapse () {
|
|
391
|
-
|
|
325
|
+
const status = !this.collapseAll
|
|
326
|
+
this.collapseAll = status
|
|
327
|
+
this.$emit('update:collapseStatus', status)
|
|
392
328
|
return this.$nextTick()
|
|
393
329
|
},
|
|
394
330
|
toggleCollapseEvent (evnt) {
|
|
395
331
|
this.toggleCollapse()
|
|
396
|
-
|
|
332
|
+
const status = this.collapseAll
|
|
333
|
+
this.$emit('toggle-collapse', { status, collapse: status, data: this.data, $form: this, $event: evnt }, evnt)
|
|
334
|
+
this.$emit('collapse', { status, collapse: status, data: this.data, $form: this, $event: evnt }, evnt)
|
|
397
335
|
},
|
|
398
336
|
submitEvent (evnt) {
|
|
399
337
|
evnt.preventDefault()
|
|
@@ -631,12 +569,16 @@ export default {
|
|
|
631
569
|
handleFocus (fields) {
|
|
632
570
|
const { $el } = this
|
|
633
571
|
const itemList = this.getItems()
|
|
634
|
-
fields.some(property => {
|
|
572
|
+
fields.some((property, index) => {
|
|
635
573
|
const item = itemList.find(item => item.field === property)
|
|
636
574
|
if (item && isEnableConf(item.itemRender)) {
|
|
637
575
|
const { itemRender } = item
|
|
638
576
|
const compConf = VXETable.renderer.get(itemRender.name)
|
|
639
577
|
let inputElem
|
|
578
|
+
// 定位到第一个
|
|
579
|
+
if (!index) {
|
|
580
|
+
DomTools.scrollToView($el.querySelector(`.${item.id}`))
|
|
581
|
+
}
|
|
640
582
|
// 如果指定了聚焦 class
|
|
641
583
|
if (itemRender.autofocus) {
|
|
642
584
|
inputElem = $el.querySelector(`.${item.id} ${itemRender.autofocus}`)
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import GlobalConfig from '../../v-x-e-table/src/conf'
|
|
2
|
+
import VXETable from '../../v-x-e-table'
|
|
3
|
+
import { UtilTools, isEnableConf } from '../../tools'
|
|
4
|
+
|
|
5
|
+
function renderPrefixIcon (h, titlePrefix) {
|
|
6
|
+
return h('span', {
|
|
7
|
+
class: 'vxe-form--item-title-prefix'
|
|
8
|
+
}, [
|
|
9
|
+
h('i', {
|
|
10
|
+
class: titlePrefix.icon || GlobalConfig.icon.FORM_PREFIX
|
|
11
|
+
})
|
|
12
|
+
])
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function renderSuffixIcon (h, titleSuffix) {
|
|
16
|
+
return h('span', {
|
|
17
|
+
class: 'vxe-form--item-title-suffix'
|
|
18
|
+
}, [
|
|
19
|
+
h('i', {
|
|
20
|
+
class: titleSuffix.icon || GlobalConfig.icon.FORM_SUFFIX
|
|
21
|
+
})
|
|
22
|
+
])
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function renderTitle (h, _vm, item) {
|
|
26
|
+
const { data } = _vm
|
|
27
|
+
const { slots, field, itemRender, titlePrefix, titleSuffix } = item
|
|
28
|
+
const compConf = isEnableConf(itemRender) ? VXETable.renderer.get(itemRender.name) : null
|
|
29
|
+
const params = { data, property: field, item, $form: _vm }
|
|
30
|
+
const contVNs = []
|
|
31
|
+
const titVNs = []
|
|
32
|
+
if (titlePrefix) {
|
|
33
|
+
titVNs.push(
|
|
34
|
+
titlePrefix.message
|
|
35
|
+
? h('vxe-tooltip', {
|
|
36
|
+
props: {
|
|
37
|
+
content: UtilTools.getFuncText(titlePrefix.message),
|
|
38
|
+
enterable: titlePrefix.enterable,
|
|
39
|
+
theme: titlePrefix.theme
|
|
40
|
+
}
|
|
41
|
+
}, [
|
|
42
|
+
renderPrefixIcon(h, titlePrefix)
|
|
43
|
+
])
|
|
44
|
+
: renderPrefixIcon(h, titlePrefix)
|
|
45
|
+
)
|
|
46
|
+
}
|
|
47
|
+
titVNs.push(
|
|
48
|
+
h('span', {
|
|
49
|
+
class: 'vxe-form--item-title-label'
|
|
50
|
+
}, compConf && compConf.renderItemTitle ? compConf.renderItemTitle(itemRender, params) : (slots && slots.title ? _vm.callSlot(slots.title, params, h) : UtilTools.getFuncText(item.title)))
|
|
51
|
+
)
|
|
52
|
+
contVNs.push(
|
|
53
|
+
h('div', {
|
|
54
|
+
class: 'vxe-form--item-title-content'
|
|
55
|
+
}, titVNs)
|
|
56
|
+
)
|
|
57
|
+
const fixVNs = []
|
|
58
|
+
if (titleSuffix) {
|
|
59
|
+
fixVNs.push(
|
|
60
|
+
titleSuffix.message
|
|
61
|
+
? h('vxe-tooltip', {
|
|
62
|
+
props: {
|
|
63
|
+
content: UtilTools.getFuncText(titleSuffix.message),
|
|
64
|
+
enterable: titleSuffix.enterable,
|
|
65
|
+
theme: titleSuffix.theme
|
|
66
|
+
}
|
|
67
|
+
}, [
|
|
68
|
+
renderSuffixIcon(h, titleSuffix)
|
|
69
|
+
])
|
|
70
|
+
: renderSuffixIcon(h, titleSuffix)
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
contVNs.push(
|
|
74
|
+
h('div', {
|
|
75
|
+
class: 'vxe-form--item-title-postfix'
|
|
76
|
+
}, fixVNs)
|
|
77
|
+
)
|
|
78
|
+
return contVNs
|
|
79
|
+
}
|
|
@@ -40,8 +40,8 @@ function renderDefaultForm (h, _vm) {
|
|
|
40
40
|
on: {
|
|
41
41
|
submit: _vm.submitEvent,
|
|
42
42
|
reset: _vm.resetEvent,
|
|
43
|
-
|
|
44
|
-
'
|
|
43
|
+
collapse: _vm.collapseEvent,
|
|
44
|
+
'submit-invalid': _vm.submitInvalidEvent
|
|
45
45
|
},
|
|
46
46
|
scopedSlots: formSlots
|
|
47
47
|
})
|
|
@@ -428,9 +428,19 @@ export default {
|
|
|
428
428
|
if (proxyConfig) {
|
|
429
429
|
if (isEnableConf(formConfig) && proxyOpts.form && formOpts.items) {
|
|
430
430
|
const formData = {}
|
|
431
|
-
formOpts.items.forEach(
|
|
431
|
+
formOpts.items.forEach(item => {
|
|
432
|
+
const { field, itemRender } = item
|
|
432
433
|
if (field) {
|
|
433
|
-
|
|
434
|
+
let itemValue = null
|
|
435
|
+
if (itemRender) {
|
|
436
|
+
const { defaultValue } = itemRender
|
|
437
|
+
if (XEUtils.isFunction(defaultValue)) {
|
|
438
|
+
itemValue = defaultValue({ item })
|
|
439
|
+
} else if (!XEUtils.isUndefined(defaultValue)) {
|
|
440
|
+
itemValue = defaultValue
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
formData[field] = itemValue
|
|
434
444
|
}
|
|
435
445
|
})
|
|
436
446
|
this.formData = formData
|
|
@@ -809,9 +819,10 @@ export default {
|
|
|
809
819
|
submitInvalidEvent (params) {
|
|
810
820
|
this.$emit('form-submit-invalid', Object.assign({ $grid: this }, params))
|
|
811
821
|
},
|
|
812
|
-
|
|
822
|
+
collapseEvent (params) {
|
|
813
823
|
this.$nextTick(() => this.recalculate(true))
|
|
814
824
|
this.$emit('form-toggle-collapse', Object.assign({ $grid: this }, params))
|
|
825
|
+
this.$emit('form-collapse', Object.assign({ $grid: this }, params))
|
|
815
826
|
},
|
|
816
827
|
triggerZoomEvent (evnt) {
|
|
817
828
|
this.zoom()
|
|
@@ -44,6 +44,7 @@ export default {
|
|
|
44
44
|
zIndex: Number,
|
|
45
45
|
marginSize: { type: [Number, String], default: () => GlobalConfig.modal.marginSize },
|
|
46
46
|
fullscreen: Boolean,
|
|
47
|
+
draggable: { type: Boolean, default: () => GlobalConfig.modal.draggable },
|
|
47
48
|
remember: { type: Boolean, default: () => GlobalConfig.modal.remember },
|
|
48
49
|
destroyOnClose: { type: Boolean, default: () => GlobalConfig.modal.destroyOnClose },
|
|
49
50
|
showTitleOverflow: { type: Boolean, default: () => GlobalConfig.modal.showTitleOverflow },
|
|
@@ -115,14 +116,15 @@ export default {
|
|
|
115
116
|
}
|
|
116
117
|
},
|
|
117
118
|
render (h) {
|
|
118
|
-
const { _e, $scopedSlots, slots = {}, inited, vSize, className, type, resize, showClose, showZoom, animat, loading, status, iconStatus, showFooter, zoomLocat, modalTop, dblclickZoom, contentVisible, visible, title, lockScroll, lockView, mask, isMsg, showTitleOverflow, destroyOnClose } = this
|
|
119
|
+
const { _e, $scopedSlots, slots = {}, inited, vSize, className, type, resize, showClose, showZoom, animat, draggable, loading, status, iconStatus, showFooter, zoomLocat, modalTop, dblclickZoom, contentVisible, visible, title, lockScroll, lockView, mask, isMsg, showTitleOverflow, destroyOnClose } = this
|
|
119
120
|
const content = this.content || this.message
|
|
120
121
|
const defaultSlot = $scopedSlots.default || slots.default
|
|
121
122
|
const footerSlot = $scopedSlots.footer || slots.footer
|
|
122
123
|
const headerSlot = $scopedSlots.header || slots.header
|
|
123
124
|
const titleSlot = $scopedSlots.title || slots.title
|
|
124
|
-
const headerOns = {
|
|
125
|
-
|
|
125
|
+
const headerOns = {}
|
|
126
|
+
if (draggable) {
|
|
127
|
+
headerOns.mousedown = this.mousedownEvent
|
|
126
128
|
}
|
|
127
129
|
if (showZoom && dblclickZoom && type === 'modal') {
|
|
128
130
|
headerOns.dblclick = this.toggleZoomEvent
|
|
@@ -157,7 +159,10 @@ export default {
|
|
|
157
159
|
ref: 'modalBox'
|
|
158
160
|
}, [
|
|
159
161
|
this.showHeader ? h('div', {
|
|
160
|
-
class: ['vxe-modal--header',
|
|
162
|
+
class: ['vxe-modal--header', {
|
|
163
|
+
'is--drag': draggable,
|
|
164
|
+
'is--ellipsis': !isMsg && showTitleOverflow
|
|
165
|
+
}],
|
|
161
166
|
on: headerOns
|
|
162
167
|
}, headerSlot ? (!inited || (destroyOnClose && !visible) ? [] : headerSlot.call(this, { $modal: this }, h)) : [
|
|
163
168
|
titleSlot ? titleSlot.call(this, { $modal: this }, h) : h('span', {
|
|
@@ -574,13 +574,17 @@ export default {
|
|
|
574
574
|
*/
|
|
575
575
|
scrollEvent (evnt) {
|
|
576
576
|
const { $el: scrollBodyElem, $parent: $xetable, fixedType } = this
|
|
577
|
-
const { $refs, highlightHoverRow, scrollXLoad, scrollYLoad, lastScrollTop, lastScrollLeft } = $xetable
|
|
577
|
+
const { $refs, elemStore, highlightHoverRow, scrollXLoad, scrollYLoad, lastScrollTop, lastScrollLeft } = $xetable
|
|
578
578
|
const { tableHeader, tableBody, leftBody, rightBody, tableFooter, validTip } = $refs
|
|
579
579
|
const headerElem = tableHeader ? tableHeader.$el : null
|
|
580
580
|
const footerElem = tableFooter ? tableFooter.$el : null
|
|
581
581
|
const bodyElem = tableBody.$el
|
|
582
582
|
const leftElem = leftBody ? leftBody.$el : null
|
|
583
583
|
const rightElem = rightBody ? rightBody.$el : null
|
|
584
|
+
const bodyYElem = elemStore['main-body-ySpace']
|
|
585
|
+
const bodyXElem = elemStore['main-body-xSpace']
|
|
586
|
+
const bodyHeight = bodyYElem ? bodyYElem.clientHeight : 0
|
|
587
|
+
const bodyWidth = bodyXElem ? bodyXElem.clientWidth : 0
|
|
584
588
|
let scrollTop = scrollBodyElem.scrollTop
|
|
585
589
|
const scrollLeft = bodyElem.scrollLeft
|
|
586
590
|
const isRollX = scrollLeft !== lastScrollLeft
|
|
@@ -622,16 +626,20 @@ export default {
|
|
|
622
626
|
if (isRollX && validTip && validTip.visible) {
|
|
623
627
|
validTip.updatePlacement()
|
|
624
628
|
}
|
|
625
|
-
$xetable.emitEvent('scroll', { type: renderType, fixed: fixedType, scrollTop, scrollLeft, isX: isRollX, isY: isRollY }, evnt)
|
|
629
|
+
$xetable.emitEvent('scroll', { type: renderType, fixed: fixedType, scrollTop, scrollLeft, bodyHeight, bodyWidth, isX: isRollX, isY: isRollY }, evnt)
|
|
626
630
|
},
|
|
627
631
|
handleWheel (evnt, isTopWheel, deltaTop, isRollX, isRollY) {
|
|
628
632
|
const { $parent: $xetable } = this
|
|
629
|
-
const { $refs } = $xetable
|
|
633
|
+
const { $refs, elemStore } = $xetable
|
|
630
634
|
const { tableBody, leftBody, rightBody } = $refs
|
|
631
635
|
const bodyElem = tableBody.$el
|
|
632
636
|
const leftElem = leftBody ? leftBody.$el : null
|
|
633
637
|
const rightElem = rightBody ? rightBody.$el : null
|
|
634
638
|
const remainSize = this.isPrevWheelTop === isTopWheel ? Math.max(0, this.wheelYSize - this.wheelYTotal) : 0
|
|
639
|
+
const bodyYElem = elemStore['main-body-ySpace']
|
|
640
|
+
const bodyXElem = elemStore['main-body-xSpace']
|
|
641
|
+
const bodyHeight = bodyYElem ? bodyYElem.clientHeight : 0
|
|
642
|
+
const bodyWidth = bodyXElem ? bodyXElem.clientWidth : 0
|
|
635
643
|
this.isPrevWheelTop = isTopWheel
|
|
636
644
|
this.wheelYSize = Math.abs(isTopWheel ? deltaTop - remainSize : deltaTop + remainSize)
|
|
637
645
|
this.wheelYInterval = 0
|
|
@@ -659,7 +667,7 @@ export default {
|
|
|
659
667
|
}
|
|
660
668
|
this.wheelYTotal = wheelYTotal
|
|
661
669
|
this.wheelYInterval = wheelYInterval
|
|
662
|
-
$xetable.emitEvent('scroll', { type: renderType, fixed: fixedType, scrollTop: bodyElem.scrollTop, scrollLeft: bodyElem.scrollLeft, isX: isRollX, isY: isRollY }, evnt)
|
|
670
|
+
$xetable.emitEvent('scroll', { type: renderType, fixed: fixedType, scrollTop: bodyElem.scrollTop, scrollLeft: bodyElem.scrollLeft, bodyHeight, bodyWidth, isX: isRollX, isY: isRollY }, evnt)
|
|
663
671
|
}
|
|
664
672
|
}
|
|
665
673
|
handleSmooth()
|
|
@@ -456,8 +456,7 @@ const Methods = {
|
|
|
456
456
|
*/
|
|
457
457
|
loadColumn (columns) {
|
|
458
458
|
const collectColumn = XEUtils.mapTree(columns, column => Cell.createColumn(this, column), { children: 'children' })
|
|
459
|
-
this.handleColumn(collectColumn)
|
|
460
|
-
return this.$nextTick()
|
|
459
|
+
return this.handleColumn(collectColumn)
|
|
461
460
|
},
|
|
462
461
|
/**
|
|
463
462
|
* 加载列配置并恢复到初始状态
|
|
@@ -488,10 +487,11 @@ const Methods = {
|
|
|
488
487
|
UtilTools.warn('vxe.error.scrollErrProp', ['column.type=expand'])
|
|
489
488
|
}
|
|
490
489
|
}
|
|
491
|
-
this.$nextTick(() => {
|
|
490
|
+
return this.$nextTick().then(() => {
|
|
492
491
|
if (this.$toolbar) {
|
|
493
492
|
this.$toolbar.syncUpdate({ collectColumn, $table: this })
|
|
494
493
|
}
|
|
494
|
+
return this.recalculate()
|
|
495
495
|
})
|
|
496
496
|
},
|
|
497
497
|
/**
|
|
@@ -775,13 +775,23 @@ const Methods = {
|
|
|
775
775
|
defineField (record) {
|
|
776
776
|
const { radioOpts, checkboxOpts, treeConfig, treeOpts, expandOpts } = this
|
|
777
777
|
const rowkey = getRowkey(this)
|
|
778
|
-
this.
|
|
778
|
+
this.tableFullColumn.forEach(column => {
|
|
779
|
+
const { property, editRender } = column
|
|
779
780
|
if (property && !XEUtils.has(record, property)) {
|
|
780
|
-
|
|
781
|
+
let cellValue = null
|
|
782
|
+
if (editRender) {
|
|
783
|
+
const { defaultValue } = editRender
|
|
784
|
+
if (XEUtils.isFunction(defaultValue)) {
|
|
785
|
+
cellValue = defaultValue({ column })
|
|
786
|
+
} else if (!XEUtils.isUndefined(defaultValue)) {
|
|
787
|
+
cellValue = defaultValue
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
XEUtils.set(record, property, cellValue)
|
|
781
791
|
}
|
|
782
792
|
})
|
|
783
|
-
const
|
|
784
|
-
|
|
793
|
+
const otherFields = [radioOpts.labelField, checkboxOpts.checkField, checkboxOpts.labelField, expandOpts.labelField]
|
|
794
|
+
otherFields.forEach((key) => {
|
|
785
795
|
if (key && eqEmptyValue(XEUtils.get(record, key))) {
|
|
786
796
|
XEUtils.set(record, key, null)
|
|
787
797
|
}
|
|
@@ -3351,9 +3361,9 @@ const Methods = {
|
|
|
3351
3361
|
clearAllSort(this)
|
|
3352
3362
|
}
|
|
3353
3363
|
if (!sortOpts.remote) {
|
|
3354
|
-
|
|
3364
|
+
this.handleTableData(true)
|
|
3355
3365
|
}
|
|
3356
|
-
return this.$nextTick()
|
|
3366
|
+
return this.$nextTick().then(this.updateStyle)
|
|
3357
3367
|
},
|
|
3358
3368
|
// 在 v3 中废弃
|
|
3359
3369
|
getSortColumn () {
|