vxe-table 4.7.77 → 4.7.79
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.en.md +1 -1
- package/README.ja-JP.md +1 -1
- package/README.md +1 -1
- package/README.zh-TW.md +1 -1
- package/es/grid/src/grid.js +45 -36
- package/es/style.css +1 -1
- package/es/table/module/custom/panel.js +5 -0
- package/es/table/render/index.js +4 -25
- package/es/table/src/body.js +26 -2
- package/es/table/src/cell.js +6 -6
- package/es/table/src/column.js +45 -18
- package/es/table/src/footer.js +16 -4
- package/es/table/src/group.js +18 -12
- package/es/table/src/header.js +4 -1
- package/es/table/src/props.js +96 -24
- package/es/table/src/table.js +2 -4
- package/es/table/src/util.js +1 -1
- package/es/toolbar/src/toolbar.js +89 -68
- package/es/ui/index.js +2 -2
- package/es/ui/src/log.js +1 -1
- package/es/ui/src/vn.js +23 -0
- package/lib/grid/src/grid.js +45 -39
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.umd.js +278 -198
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/module/custom/panel.js +7 -0
- package/lib/table/module/custom/panel.min.js +1 -1
- package/lib/table/render/index.js +7 -28
- package/lib/table/render/index.min.js +1 -1
- package/lib/table/src/cell.js +3 -3
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/column.js +16 -10
- package/lib/table/src/column.min.js +1 -1
- package/lib/table/src/group.js +17 -11
- package/lib/table/src/group.min.js +1 -1
- package/lib/table/src/table.js +2 -4
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +1 -1
- package/lib/table/src/util.min.js +1 -1
- package/lib/toolbar/src/toolbar.js +109 -76
- package/lib/toolbar/src/toolbar.min.js +1 -1
- package/lib/ui/index.js +2 -2
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/lib/ui/src/vn.js +25 -0
- package/lib/ui/src/vn.min.js +1 -1
- package/package.json +2 -2
- package/packages/grid/src/grid.ts +54 -44
- package/packages/table/module/custom/panel.ts +5 -0
- package/packages/table/render/index.ts +4 -27
- package/packages/table/src/body.ts +26 -2
- package/packages/table/src/cell.ts +9 -8
- package/packages/table/src/column.ts +47 -20
- package/packages/table/src/footer.ts +16 -4
- package/packages/table/src/group.ts +19 -13
- package/packages/table/src/header.ts +4 -1
- package/packages/table/src/props.ts +97 -24
- package/packages/table/src/table.ts +2 -4
- package/packages/table/src/util.ts +2 -2
- package/packages/toolbar/src/toolbar.ts +97 -75
- package/packages/ui/src/vn.ts +25 -0
- /package/es/{iconfont.1725604498089.ttf → iconfont.1726116305532.ttf} +0 -0
- /package/es/{iconfont.1725604498089.woff → iconfont.1726116305532.woff} +0 -0
- /package/es/{iconfont.1725604498089.woff2 → iconfont.1726116305532.woff2} +0 -0
- /package/lib/{iconfont.1725604498089.ttf → iconfont.1726116305532.ttf} +0 -0
- /package/lib/{iconfont.1725604498089.woff → iconfont.1726116305532.woff} +0 -0
- /package/lib/{iconfont.1725604498089.woff2 → iconfont.1726116305532.woff2} +0 -0
|
@@ -10,7 +10,7 @@ import tableComponentEmits from '../../table/src/emits'
|
|
|
10
10
|
import { getSlotVNs } from '../../ui/src/vn'
|
|
11
11
|
import { errLog } from '../../ui/src/log'
|
|
12
12
|
|
|
13
|
-
import type { VxePagerComponent, VxeFormComponent, VxeFormEvents, VxeFormInstance, VxePagerEvents, VxeFormItemProps, VxePagerInstance } from 'vxe-pc-ui'
|
|
13
|
+
import type { ValueOf, VxePagerComponent, VxeFormComponent, VxeFormEvents, VxeFormInstance, VxePagerEvents, VxeFormItemProps, VxePagerInstance } from 'vxe-pc-ui'
|
|
14
14
|
import type { VxeTableMethods, VxeGridConstructor, VxeGridEmits, GridReactData, VxeGridPropTypes, VxeToolbarPropTypes, GridMethods, GridPrivateMethods, VxeGridPrivateComputed, VxeGridPrivateMethods, VxeToolbarInstance, GridPrivateRef, VxeTableProps, VxeTableConstructor, VxeTablePrivateMethods, VxeTableEvents, VxeTableDefines, VxeTableEventProps, VxeGridProps } from '../../../types'
|
|
15
15
|
|
|
16
16
|
const { getConfig, getI18n, commands, hooks, useFns, createEvent, globalEvents, GLOBAL_EVENT_KEYS } = VxeUI
|
|
@@ -46,7 +46,10 @@ export default defineComponent({
|
|
|
46
46
|
toolbarConfig: Object as PropType<VxeGridPropTypes.ToolbarConfig>,
|
|
47
47
|
formConfig: Object as PropType<VxeGridPropTypes.FormConfig>,
|
|
48
48
|
zoomConfig: Object as PropType<VxeGridPropTypes.ZoomConfig>,
|
|
49
|
-
size: {
|
|
49
|
+
size: {
|
|
50
|
+
type: String as PropType<VxeGridPropTypes.Size>,
|
|
51
|
+
default: () => getConfig().grid.size || getConfig().size
|
|
52
|
+
}
|
|
50
53
|
},
|
|
51
54
|
emits: gridComponentEmits,
|
|
52
55
|
setup (props, context) {
|
|
@@ -60,7 +63,7 @@ export default defineComponent({
|
|
|
60
63
|
|
|
61
64
|
const { computeSize } = useFns.useSize(props)
|
|
62
65
|
|
|
63
|
-
const reactData = reactive({
|
|
66
|
+
const reactData = reactive<GridReactData>({
|
|
64
67
|
tableLoading: false,
|
|
65
68
|
proxyInited: false,
|
|
66
69
|
isZMax: false,
|
|
@@ -74,7 +77,7 @@ export default defineComponent({
|
|
|
74
77
|
pageSize: getConfig().pager?.pageSize || 10,
|
|
75
78
|
currentPage: 1
|
|
76
79
|
}
|
|
77
|
-
}
|
|
80
|
+
})
|
|
78
81
|
|
|
79
82
|
const refElem = ref() as Ref<HTMLDivElement>
|
|
80
83
|
const refTable = ref() as Ref<ComponentPublicInstance<VxeTableProps, VxeTableConstructor & VxeTableMethods & VxeTablePrivateMethods>>
|
|
@@ -155,31 +158,6 @@ export default defineComponent({
|
|
|
155
158
|
return rest
|
|
156
159
|
})
|
|
157
160
|
|
|
158
|
-
const refMaps: GridPrivateRef = {
|
|
159
|
-
refElem,
|
|
160
|
-
refTable,
|
|
161
|
-
refForm,
|
|
162
|
-
refToolbar,
|
|
163
|
-
refPager
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
const computeMaps: VxeGridPrivateComputed = {
|
|
167
|
-
computeProxyOpts,
|
|
168
|
-
computePagerOpts,
|
|
169
|
-
computeFormOpts,
|
|
170
|
-
computeToolbarOpts,
|
|
171
|
-
computeZoomOpts
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
const $xeGrid = {
|
|
175
|
-
xID,
|
|
176
|
-
props: props as VxeGridProps,
|
|
177
|
-
context,
|
|
178
|
-
reactData,
|
|
179
|
-
getRefMaps: () => refMaps,
|
|
180
|
-
getComputeMaps: () => computeMaps
|
|
181
|
-
} as VxeGridConstructor & VxeGridPrivateMethods
|
|
182
|
-
|
|
183
161
|
const computeTableProps = computed(() => {
|
|
184
162
|
const { seqConfig, pagerConfig, loading, editConfig, proxyConfig } = props
|
|
185
163
|
const { isZMax, tableLoading, tablePage, tableData } = reactData
|
|
@@ -207,6 +185,39 @@ export default defineComponent({
|
|
|
207
185
|
return tableProps
|
|
208
186
|
})
|
|
209
187
|
|
|
188
|
+
const computeCurrLayout = computed(() => {
|
|
189
|
+
const { layouts } = props
|
|
190
|
+
if (layouts && layouts.length) {
|
|
191
|
+
return layouts
|
|
192
|
+
}
|
|
193
|
+
return getConfig().grid.layouts || ['Form', 'Toolbar', 'Top', 'Table', 'Bottom', 'Pager']
|
|
194
|
+
})
|
|
195
|
+
|
|
196
|
+
const refMaps: GridPrivateRef = {
|
|
197
|
+
refElem,
|
|
198
|
+
refTable,
|
|
199
|
+
refForm,
|
|
200
|
+
refToolbar,
|
|
201
|
+
refPager
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
const computeMaps: VxeGridPrivateComputed = {
|
|
205
|
+
computeProxyOpts,
|
|
206
|
+
computePagerOpts,
|
|
207
|
+
computeFormOpts,
|
|
208
|
+
computeToolbarOpts,
|
|
209
|
+
computeZoomOpts
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
const $xeGrid = {
|
|
213
|
+
xID,
|
|
214
|
+
props: props as VxeGridProps,
|
|
215
|
+
context,
|
|
216
|
+
reactData,
|
|
217
|
+
getRefMaps: () => refMaps,
|
|
218
|
+
getComputeMaps: () => computeMaps
|
|
219
|
+
} as VxeGridConstructor & VxeGridPrivateMethods
|
|
220
|
+
|
|
210
221
|
const initToolbar = () => {
|
|
211
222
|
const toolbarOpts = computeToolbarOpts.value
|
|
212
223
|
if (props.toolbarConfig && isEnableConf(toolbarOpts)) {
|
|
@@ -644,12 +655,9 @@ export default defineComponent({
|
|
|
644
655
|
return createCommentVNode()
|
|
645
656
|
}
|
|
646
657
|
|
|
647
|
-
const defaultLayouts = ['Form', 'Toolbar', 'Top', 'Table', 'Bottom', 'Pager']
|
|
648
|
-
|
|
649
658
|
const renderLayout = () => {
|
|
650
|
-
const { layouts } = props
|
|
651
659
|
const vns: VNode[] = []
|
|
652
|
-
const currLayouts =
|
|
660
|
+
const currLayouts = computeCurrLayout.value
|
|
653
661
|
currLayouts.forEach(name => {
|
|
654
662
|
switch (name) {
|
|
655
663
|
case 'Form':
|
|
@@ -731,10 +739,20 @@ export default defineComponent({
|
|
|
731
739
|
}
|
|
732
740
|
}
|
|
733
741
|
|
|
742
|
+
const handleGlobalKeydownEvent = (evnt: any) => {
|
|
743
|
+
const zoomOpts = computeZoomOpts.value
|
|
744
|
+
const isEsc = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ESCAPE)
|
|
745
|
+
if (isEsc && reactData.isZMax && zoomOpts.escRestore !== false) {
|
|
746
|
+
gridPrivateMethods.triggerZoomEvent(evnt)
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
const dispatchEvent = (type: ValueOf<VxeGridEmits>, params: Record<string, any>, evnt: Event | null) => {
|
|
751
|
+
emit(type, createEvent(evnt, { $grid: $xeGrid }, params))
|
|
752
|
+
}
|
|
753
|
+
|
|
734
754
|
const gridMethods: GridMethods = {
|
|
735
|
-
dispatchEvent
|
|
736
|
-
emit(type, createEvent(evnt, { $grid: $xeGrid }, params))
|
|
737
|
-
},
|
|
755
|
+
dispatchEvent,
|
|
738
756
|
/**
|
|
739
757
|
* 提交指令,支持 code 或 button
|
|
740
758
|
* @param {String/Object} code 字符串或对象
|
|
@@ -1219,14 +1237,6 @@ export default defineComponent({
|
|
|
1219
1237
|
initProxy()
|
|
1220
1238
|
})
|
|
1221
1239
|
|
|
1222
|
-
const handleGlobalKeydownEvent = (evnt: any) => {
|
|
1223
|
-
const zoomOpts = computeZoomOpts.value
|
|
1224
|
-
const isEsc = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ESCAPE)
|
|
1225
|
-
if (isEsc && reactData.isZMax && zoomOpts.escRestore !== false) {
|
|
1226
|
-
gridPrivateMethods.triggerZoomEvent(evnt)
|
|
1227
|
-
}
|
|
1228
|
-
}
|
|
1229
|
-
|
|
1230
1240
|
hooks.forEach((options) => {
|
|
1231
1241
|
const { setupGrid } = options
|
|
1232
1242
|
if (setupGrid) {
|
|
@@ -916,9 +916,14 @@ export default defineComponent({
|
|
|
916
916
|
|
|
917
917
|
if (process.env.VUE_APP_VXE_ENV === 'development') {
|
|
918
918
|
nextTick(() => {
|
|
919
|
+
const customOpts = computeCustomOpts.value
|
|
920
|
+
const { mode } = customOpts
|
|
919
921
|
if (!VxeUIModalComponent) {
|
|
920
922
|
errLog('vxe.error.reqComp', ['vxe-modal'])
|
|
921
923
|
}
|
|
924
|
+
if (!VxeUIDrawerComponent && (mode === 'drawer')) {
|
|
925
|
+
errLog('vxe.error.reqComp', ['vxe-drawer'])
|
|
926
|
+
}
|
|
922
927
|
if (!VxeUIButtonComponent) {
|
|
923
928
|
errLog('vxe.error.reqComp', ['vxe-button'])
|
|
924
929
|
}
|
|
@@ -3,7 +3,7 @@ import XEUtils from 'xe-utils'
|
|
|
3
3
|
import { VxeUI } from '../../ui'
|
|
4
4
|
import { getCellValue, setCellValue } from '../../table/src/util'
|
|
5
5
|
import { getFuncText, formatText, isEmptyValue } from '../../ui/src/utils'
|
|
6
|
-
import { getOnName } from '../../ui/src/vn'
|
|
6
|
+
import { getOnName, getModelEvent, getChangeEvent } from '../../ui/src/vn'
|
|
7
7
|
import { errLog } from '../../ui/src/log'
|
|
8
8
|
|
|
9
9
|
import type { VxeButtonComponent } from 'vxe-pc-ui'
|
|
@@ -15,29 +15,6 @@ const componentDefaultModelProp = 'modelValue'
|
|
|
15
15
|
|
|
16
16
|
const defaultCompProps = { transfer: true }
|
|
17
17
|
|
|
18
|
-
function getModelEvent (renderOpts: any) {
|
|
19
|
-
switch (renderOpts.name) {
|
|
20
|
-
case 'input':
|
|
21
|
-
case 'textarea':
|
|
22
|
-
return 'input'
|
|
23
|
-
}
|
|
24
|
-
return 'update:modelValue'
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function getChangeEvent (renderOpts: any) {
|
|
28
|
-
switch (renderOpts.name) {
|
|
29
|
-
case 'input':
|
|
30
|
-
case 'textarea':
|
|
31
|
-
case 'VxeInput':
|
|
32
|
-
case 'VxeNumberInput':
|
|
33
|
-
case 'VxeTextarea':
|
|
34
|
-
case '$input':
|
|
35
|
-
case '$textarea':
|
|
36
|
-
return 'input'
|
|
37
|
-
}
|
|
38
|
-
return 'change'
|
|
39
|
-
}
|
|
40
|
-
|
|
41
18
|
function parseDate (value: any, props: any) {
|
|
42
19
|
return value && props.valueFormat ? XEUtils.toStringDate(value, props.valueFormat) : value
|
|
43
20
|
}
|
|
@@ -133,7 +110,7 @@ function getCellLabelVNs (renderOpts: any, params: any, cellLabel: any) {
|
|
|
133
110
|
* @param modelFunc
|
|
134
111
|
* @param changeFunc
|
|
135
112
|
*/
|
|
136
|
-
function
|
|
113
|
+
function getNativeElementOns (renderOpts: any, params: any, modelFunc?: any, changeFunc?: any) {
|
|
137
114
|
const { events } = renderOpts
|
|
138
115
|
const modelEvent = getModelEvent(renderOpts)
|
|
139
116
|
const changeEvent = getChangeEvent(renderOpts)
|
|
@@ -246,7 +223,7 @@ function getFilterOns (renderOpts: any, params: any, option: any) {
|
|
|
246
223
|
function getNativeEditOns (renderOpts: any, params: any) {
|
|
247
224
|
const { $table, row, column } = params
|
|
248
225
|
const { model } = column
|
|
249
|
-
return
|
|
226
|
+
return getNativeElementOns(renderOpts, params, (evnt: any) => {
|
|
250
227
|
// 处理 model 值双向绑定
|
|
251
228
|
const cellValue = evnt.target.value
|
|
252
229
|
if (isImmediateCell(renderOpts, params)) {
|
|
@@ -263,7 +240,7 @@ function getNativeEditOns (renderOpts: any, params: any) {
|
|
|
263
240
|
}
|
|
264
241
|
|
|
265
242
|
function getNativeFilterOns (renderOpts: any, params: any, option: any) {
|
|
266
|
-
return
|
|
243
|
+
return getNativeElementOns(renderOpts, params, (evnt: any) => {
|
|
267
244
|
// 处理 model 值双向绑定
|
|
268
245
|
option.data = evnt.target.value
|
|
269
246
|
}, () => {
|
|
@@ -24,7 +24,10 @@ export default defineComponent({
|
|
|
24
24
|
tableData: Array as PropType<any[]>,
|
|
25
25
|
tableColumn: Array as PropType<VxeTableDefines.ColumnInfo[]>,
|
|
26
26
|
fixedColumn: Array as PropType<VxeTableDefines.ColumnInfo[]>,
|
|
27
|
-
fixedType: {
|
|
27
|
+
fixedType: {
|
|
28
|
+
type: String as PropType<VxeColumnPropTypes.Fixed>,
|
|
29
|
+
default: null
|
|
30
|
+
}
|
|
28
31
|
},
|
|
29
32
|
setup (props) {
|
|
30
33
|
const $xeTable = inject('$xeTable', {} as VxeTableConstructor & VxeTableMethods & VxeTablePrivateMethods)
|
|
@@ -162,7 +165,28 @@ export default defineComponent({
|
|
|
162
165
|
const errorValidItem = validErrorMaps[`${rowid}:${colid}`]
|
|
163
166
|
const showValidTip = editRules && validOpts.showMessage && (validOpts.message === 'default' ? (height || tableData.length > 1) : validOpts.message === 'inline')
|
|
164
167
|
const attrs: any = { colid }
|
|
165
|
-
const params: VxeTableDefines.CellRenderBodyParams = {
|
|
168
|
+
const params: VxeTableDefines.CellRenderBodyParams = {
|
|
169
|
+
$table: $xeTable,
|
|
170
|
+
$grid: $xeTable.xegrid,
|
|
171
|
+
isEdit: false,
|
|
172
|
+
seq,
|
|
173
|
+
rowid,
|
|
174
|
+
row,
|
|
175
|
+
rowIndex,
|
|
176
|
+
$rowIndex,
|
|
177
|
+
_rowIndex,
|
|
178
|
+
column,
|
|
179
|
+
columnIndex,
|
|
180
|
+
$columnIndex,
|
|
181
|
+
_columnIndex,
|
|
182
|
+
fixed: fixedType,
|
|
183
|
+
type: renderType,
|
|
184
|
+
isHidden: fixedHiddenColumn,
|
|
185
|
+
level: rowLevel,
|
|
186
|
+
visibleData: afterFullData,
|
|
187
|
+
data: tableData,
|
|
188
|
+
items
|
|
189
|
+
}
|
|
166
190
|
// 虚拟滚动不支持动态高度
|
|
167
191
|
if (scrollYLoad && !hasEllipsis) {
|
|
168
192
|
showEllipsis = hasEllipsis = true
|
|
@@ -268,14 +268,15 @@ export const Cell = {
|
|
|
268
268
|
return [
|
|
269
269
|
h('span', {
|
|
270
270
|
class: 'vxe-cell--label'
|
|
271
|
-
},
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
271
|
+
}, [
|
|
272
|
+
// 如果设置占位符
|
|
273
|
+
editRender && eqEmptyValue(cellValue)
|
|
274
|
+
? h('span', {
|
|
275
|
+
class: 'vxe-cell--placeholder'
|
|
276
|
+
}, formatText(getFuncText(cellPlaceholder), 1))
|
|
277
|
+
: h('span', formatText(cellValue, 1))
|
|
278
|
+
]
|
|
279
|
+
)
|
|
279
280
|
]
|
|
280
281
|
},
|
|
281
282
|
renderTreeCell (params: VxeTableDefines.CellRenderBodyParams) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineComponent, h, onUnmounted, inject, ref,
|
|
2
|
-
import { XEColumnInstance, watchColumn, assembleColumn, destroyColumn } from '
|
|
3
|
-
import Cell from '
|
|
1
|
+
import { defineComponent, h, onUnmounted, inject, ref, PropType, provide, onMounted, createCommentVNode } from 'vue'
|
|
2
|
+
import { XEColumnInstance, watchColumn, assembleColumn, destroyColumn } from './util'
|
|
3
|
+
import Cell from './cell'
|
|
4
4
|
|
|
5
5
|
import type { VxeTableConstructor, VxeTablePrivateMethods, VxeColumnPropTypes, VxeColumnProps } from '../../../types'
|
|
6
6
|
|
|
@@ -20,7 +20,10 @@ export const columnProps = {
|
|
|
20
20
|
// 列最大宽度
|
|
21
21
|
maxWidth: [Number, String] as PropType<VxeColumnPropTypes.MaxWidth>,
|
|
22
22
|
// 是否允许拖动列宽调整大小
|
|
23
|
-
resizable: {
|
|
23
|
+
resizable: {
|
|
24
|
+
type: Boolean as PropType<VxeColumnPropTypes.Resizable>,
|
|
25
|
+
default: null
|
|
26
|
+
},
|
|
24
27
|
// 将列固定在左侧或者右侧
|
|
25
28
|
fixed: String as PropType<VxeColumnPropTypes.Fixed>,
|
|
26
29
|
// 列对其方式
|
|
@@ -30,11 +33,20 @@ export const columnProps = {
|
|
|
30
33
|
// 表尾列的对齐方式
|
|
31
34
|
footerAlign: String as PropType<VxeColumnPropTypes.FooterAlign>,
|
|
32
35
|
// 当内容过长时显示为省略号
|
|
33
|
-
showOverflow: {
|
|
36
|
+
showOverflow: {
|
|
37
|
+
type: [Boolean, String] as PropType<VxeColumnPropTypes.ShowOverflow>,
|
|
38
|
+
default: null
|
|
39
|
+
},
|
|
34
40
|
// 当表头内容过长时显示为省略号
|
|
35
|
-
showHeaderOverflow: {
|
|
41
|
+
showHeaderOverflow: {
|
|
42
|
+
type: [Boolean, String] as PropType<VxeColumnPropTypes.ShowHeaderOverflow>,
|
|
43
|
+
default: null
|
|
44
|
+
},
|
|
36
45
|
// 当表尾内容过长时显示为省略号
|
|
37
|
-
showFooterOverflow: {
|
|
46
|
+
showFooterOverflow: {
|
|
47
|
+
type: [Boolean, String] as PropType<VxeColumnPropTypes.ShowFooterOverflow>,
|
|
48
|
+
default: null
|
|
49
|
+
},
|
|
38
50
|
// 给单元格附加 className
|
|
39
51
|
className: [String, Function] as PropType<VxeColumnPropTypes.ClassName>,
|
|
40
52
|
// 给表头单元格附加 className
|
|
@@ -52,9 +64,15 @@ export const columnProps = {
|
|
|
52
64
|
// 排序的字段类型,比如字符串转数值等
|
|
53
65
|
sortType: String as PropType<VxeColumnPropTypes.SortType>,
|
|
54
66
|
// 配置筛选条件数组
|
|
55
|
-
filters: {
|
|
67
|
+
filters: {
|
|
68
|
+
type: Array as PropType<VxeColumnPropTypes.Filters>,
|
|
69
|
+
default: null
|
|
70
|
+
},
|
|
56
71
|
// 筛选是否允许多选
|
|
57
|
-
filterMultiple: {
|
|
72
|
+
filterMultiple: {
|
|
73
|
+
type: Boolean as PropType<VxeColumnPropTypes.FilterMultiple>,
|
|
74
|
+
default: true
|
|
75
|
+
},
|
|
58
76
|
// 自定义筛选方法
|
|
59
77
|
filterMethod: Function as PropType<VxeColumnPropTypes.FilterMethod<any>>,
|
|
60
78
|
// 筛选重置方法
|
|
@@ -66,7 +84,10 @@ export const columnProps = {
|
|
|
66
84
|
// 指定为树节点
|
|
67
85
|
treeNode: Boolean as PropType<VxeColumnPropTypes.TreeNode>,
|
|
68
86
|
// 是否可视
|
|
69
|
-
visible: {
|
|
87
|
+
visible: {
|
|
88
|
+
type: Boolean as PropType<VxeColumnPropTypes.Visible>,
|
|
89
|
+
default: null
|
|
90
|
+
},
|
|
70
91
|
// 表头单元格数据导出方法
|
|
71
92
|
headerExportMethod: Function as PropType<VxeColumnPropTypes.HeaderExportMethod>,
|
|
72
93
|
// 单元格数据导出方法
|
|
@@ -95,11 +116,14 @@ export default defineComponent({
|
|
|
95
116
|
name: 'VxeColumn',
|
|
96
117
|
props: columnProps,
|
|
97
118
|
setup (props, { slots }) {
|
|
98
|
-
const refElem = ref
|
|
99
|
-
const $xeTable = inject('$xeTable',
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
|
|
119
|
+
const refElem = ref<HTMLDivElement>()
|
|
120
|
+
const $xeTable = inject<(VxeTableConstructor & VxeTablePrivateMethods) | null>('$xeTable', null)
|
|
121
|
+
const $xeColgroup = inject<XEColumnInstance | null>('$xeColgroup', null)
|
|
122
|
+
if (!$xeTable) {
|
|
123
|
+
return () => createCommentVNode()
|
|
124
|
+
}
|
|
125
|
+
const columnConfig = Cell.createColumn($xeTable, props as VxeColumnProps)
|
|
126
|
+
columnConfig.slots = slots
|
|
103
127
|
|
|
104
128
|
const renderVN = () => {
|
|
105
129
|
return h('div', {
|
|
@@ -108,19 +132,22 @@ export default defineComponent({
|
|
|
108
132
|
}
|
|
109
133
|
|
|
110
134
|
const $xeColumn = {
|
|
111
|
-
|
|
135
|
+
columnConfig,
|
|
112
136
|
|
|
113
137
|
renderVN
|
|
114
|
-
}
|
|
138
|
+
} as XEColumnInstance
|
|
115
139
|
|
|
116
|
-
watchColumn($xeTable, props,
|
|
140
|
+
watchColumn($xeTable, props, columnConfig)
|
|
117
141
|
|
|
118
142
|
onMounted(() => {
|
|
119
|
-
|
|
143
|
+
const elem = refElem.value
|
|
144
|
+
if (elem) {
|
|
145
|
+
assembleColumn($xeTable, elem, columnConfig, $xeColgroup)
|
|
146
|
+
}
|
|
120
147
|
})
|
|
121
148
|
|
|
122
149
|
onUnmounted(() => {
|
|
123
|
-
destroyColumn($xeTable,
|
|
150
|
+
destroyColumn($xeTable, columnConfig)
|
|
124
151
|
})
|
|
125
152
|
|
|
126
153
|
provide('$xeColumn', $xeColumn)
|
|
@@ -23,10 +23,22 @@ function mergeFooterMethod (mergeFooterList: VxeTableDefines.MergeItem[], _rowIn
|
|
|
23
23
|
export default defineComponent({
|
|
24
24
|
name: 'VxeTableFooter',
|
|
25
25
|
props: {
|
|
26
|
-
footerTableData: {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
footerTableData: {
|
|
27
|
+
type: Array as PropType<any[][]>,
|
|
28
|
+
default: () => []
|
|
29
|
+
},
|
|
30
|
+
tableColumn: {
|
|
31
|
+
type: Array as PropType<VxeTableDefines.ColumnInfo[]>,
|
|
32
|
+
default: () => []
|
|
33
|
+
},
|
|
34
|
+
fixedColumn: {
|
|
35
|
+
type: Array as PropType<VxeTableDefines.ColumnInfo[]>,
|
|
36
|
+
default: () => []
|
|
37
|
+
},
|
|
38
|
+
fixedType: {
|
|
39
|
+
type: String as PropType<VxeColumnPropTypes.Fixed>,
|
|
40
|
+
default: null
|
|
41
|
+
}
|
|
30
42
|
},
|
|
31
43
|
setup (props) {
|
|
32
44
|
const $xeTable = inject('$xeTable', {} as VxeTableConstructor & VxeTableMethods & VxeTablePrivateMethods)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent, h, onUnmounted, provide, inject, ref,
|
|
1
|
+
import { defineComponent, h, onUnmounted, provide, inject, ref, onMounted, Slot, createCommentVNode } from 'vue'
|
|
2
2
|
import { columnProps } from './column'
|
|
3
|
-
import { XEColumnInstance, watchColumn, assembleColumn, destroyColumn } from '
|
|
4
|
-
import Cell from '
|
|
3
|
+
import { XEColumnInstance, watchColumn, assembleColumn, destroyColumn } from './util'
|
|
4
|
+
import Cell from './cell'
|
|
5
5
|
|
|
6
6
|
import type { VxeTableConstructor, VxeTablePrivateMethods } from '../../../types'
|
|
7
7
|
|
|
@@ -9,10 +9,13 @@ export default defineComponent({
|
|
|
9
9
|
name: 'VxeColgroup',
|
|
10
10
|
props: columnProps,
|
|
11
11
|
setup (props, { slots }) {
|
|
12
|
-
const refElem = ref
|
|
13
|
-
const $xeTable = inject('$xeTable',
|
|
14
|
-
const
|
|
15
|
-
|
|
12
|
+
const refElem = ref<HTMLDivElement>()
|
|
13
|
+
const $xeTable = inject<(VxeTableConstructor & VxeTablePrivateMethods) | null>('$xeTable', null)
|
|
14
|
+
const $xeParentColgroup = inject<XEColumnInstance | null>('$xeColgroup', null)
|
|
15
|
+
if (!$xeTable) {
|
|
16
|
+
return () => createCommentVNode()
|
|
17
|
+
}
|
|
18
|
+
const columnConfig = Cell.createColumn($xeTable, props)
|
|
16
19
|
const columnSlots: {
|
|
17
20
|
header?: Slot;
|
|
18
21
|
} = {}
|
|
@@ -21,17 +24,20 @@ export default defineComponent({
|
|
|
21
24
|
columnSlots.header = slots.header
|
|
22
25
|
}
|
|
23
26
|
|
|
24
|
-
|
|
25
|
-
|
|
27
|
+
columnConfig.slots = columnSlots
|
|
28
|
+
columnConfig.children = []
|
|
26
29
|
|
|
27
|
-
watchColumn($xeTable, props,
|
|
30
|
+
watchColumn($xeTable, props, columnConfig)
|
|
28
31
|
|
|
29
32
|
onMounted(() => {
|
|
30
|
-
|
|
33
|
+
const elem = refElem.value
|
|
34
|
+
if (elem) {
|
|
35
|
+
assembleColumn($xeTable, elem, columnConfig, $xeParentColgroup)
|
|
36
|
+
}
|
|
31
37
|
})
|
|
32
38
|
|
|
33
39
|
onUnmounted(() => {
|
|
34
|
-
destroyColumn($xeTable,
|
|
40
|
+
destroyColumn($xeTable, columnConfig)
|
|
35
41
|
})
|
|
36
42
|
|
|
37
43
|
const renderVN = () => {
|
|
@@ -40,7 +46,7 @@ export default defineComponent({
|
|
|
40
46
|
}, slots.default ? slots.default() : [])
|
|
41
47
|
}
|
|
42
48
|
|
|
43
|
-
const $xeColgroup = {
|
|
49
|
+
const $xeColgroup = { columnConfig } as XEColumnInstance
|
|
44
50
|
|
|
45
51
|
provide('$xeColgroup', $xeColgroup)
|
|
46
52
|
provide('$xeGrid', null)
|
|
@@ -14,7 +14,10 @@ export default defineComponent({
|
|
|
14
14
|
tableColumn: Array as PropType<VxeTableDefines.ColumnInfo[]>,
|
|
15
15
|
tableGroupColumn: Array as PropType<VxeTableDefines.ColumnInfo[]>,
|
|
16
16
|
fixedColumn: Array as PropType<VxeTableDefines.ColumnInfo[]>,
|
|
17
|
-
fixedType: {
|
|
17
|
+
fixedType: {
|
|
18
|
+
type: String as PropType<VxeColumnPropTypes.Fixed>,
|
|
19
|
+
default: null
|
|
20
|
+
}
|
|
18
21
|
},
|
|
19
22
|
setup (props) {
|
|
20
23
|
const $xeTable = inject('$xeTable', {} as VxeTableConstructor & VxeTableMethods & VxeTablePrivateMethods)
|