vxe-table 4.15.5 → 4.15.6
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 +6 -4
- package/es/grid/src/emits.js +16 -0
- package/es/grid/src/grid.js +77 -62
- package/es/grid/src/props.js +7 -0
- package/es/style.css +1 -1
- package/es/table/index.js +0 -8
- package/es/table/module/custom/hook.js +3 -0
- package/es/table/module/edit/hook.js +3 -0
- package/es/table/module/export/hook.js +6 -1
- package/es/table/module/filter/hook.js +3 -0
- package/es/table/module/menu/hook.js +3 -0
- package/es/table/module/validator/hook.js +3 -0
- package/es/table/src/emits.js +1 -1
- package/es/table/src/props.js +1 -1
- package/es/table/src/table.js +119 -43
- package/es/table/src/util.js +0 -4
- package/es/toolbar/src/toolbar.js +2 -2
- package/es/ui/index.js +13 -4
- package/es/ui/src/log.js +1 -1
- package/lib/grid/src/emits.js +8 -0
- package/lib/grid/src/emits.min.js +1 -0
- package/lib/grid/src/grid.js +78 -54
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/grid/src/props.js +24 -0
- package/lib/grid/src/props.min.js +1 -0
- package/lib/index.umd.js +12069 -11995
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/index.js +0 -8
- package/lib/table/index.min.js +1 -1
- package/lib/table/module/custom/hook.js +3 -0
- package/lib/table/module/custom/hook.min.js +1 -1
- package/lib/table/module/edit/hook.js +3 -0
- package/lib/table/module/edit/hook.min.js +1 -1
- package/lib/table/module/export/hook.js +8 -1
- package/lib/table/module/export/hook.min.js +1 -1
- package/lib/table/module/filter/hook.js +3 -0
- package/lib/table/module/filter/hook.min.js +1 -1
- package/lib/table/module/menu/hook.js +3 -0
- package/lib/table/module/menu/hook.min.js +1 -1
- package/lib/table/module/validator/hook.js +3 -0
- package/lib/table/module/validator/hook.min.js +1 -1
- package/lib/table/src/emits.js +2 -2
- package/lib/table/src/emits.min.js +1 -1
- package/lib/table/src/props.js +2 -2
- package/lib/table/src/props.min.js +1 -1
- package/lib/table/src/table.js +29 -22
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +0 -4
- package/lib/table/src/util.min.js +1 -1
- package/lib/toolbar/src/toolbar.js +2 -0
- package/lib/toolbar/src/toolbar.min.js +1 -1
- package/lib/ui/index.js +12 -3
- 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/package.json +1 -1
- package/packages/grid/src/emits.ts +19 -0
- package/packages/grid/src/grid.ts +89 -85
- package/packages/grid/src/props.ts +23 -0
- package/packages/table/index.ts +0 -8
- package/packages/table/module/custom/hook.ts +3 -0
- package/packages/table/module/edit/hook.ts +3 -0
- package/packages/table/module/export/hook.ts +8 -3
- package/packages/table/module/filter/hook.ts +3 -0
- package/packages/table/module/menu/hook.ts +3 -0
- package/packages/table/module/validator/hook.ts +3 -0
- package/packages/table/src/emits.ts +2 -2
- package/packages/table/src/props.ts +1 -1
- package/packages/table/src/table.ts +125 -45
- package/packages/table/src/util.ts +0 -4
- package/packages/toolbar/src/toolbar.ts +2 -2
- package/packages/ui/index.ts +12 -2
- package/packages/ui/src/dom.ts +1 -1
- /package/es/{iconfont.1754615009926.ttf → iconfont.1754905357789.ttf} +0 -0
- /package/es/{iconfont.1754615009926.woff → iconfont.1754905357789.woff} +0 -0
- /package/es/{iconfont.1754615009926.woff2 → iconfont.1754905357789.woff2} +0 -0
- /package/lib/{iconfont.1754615009926.ttf → iconfont.1754905357789.ttf} +0 -0
- /package/lib/{iconfont.1754615009926.woff → iconfont.1754905357789.woff} +0 -0
- /package/lib/{iconfont.1754615009926.woff2 → iconfont.1754905357789.woff2} +0 -0
|
@@ -1,64 +1,35 @@
|
|
|
1
|
-
import { h,
|
|
1
|
+
import { h, ref, computed, provide, reactive, onUnmounted, watch, nextTick, VNode, ComponentPublicInstance, onMounted } from 'vue'
|
|
2
2
|
import { defineVxeComponent } from '../../ui/src/comp'
|
|
3
3
|
import XEUtils from 'xe-utils'
|
|
4
4
|
import { getLastZIndex, nextZIndex, isEnableConf } from '../../ui/src/utils'
|
|
5
5
|
import { getOffsetHeight, getPaddingTopBottomSize, getDomNode, toCssUnit } from '../../ui/src/dom'
|
|
6
6
|
import { VxeUI } from '../../ui'
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import tableComponentProps from '../../table/src/props'
|
|
10
|
-
import tableComponentEmits from '../../table/src/emits'
|
|
7
|
+
import { gridProps } from './props'
|
|
8
|
+
import { gridEmits } from './emits'
|
|
11
9
|
import { getSlotVNs } from '../../ui/src/vn'
|
|
12
10
|
import { warnLog, errLog } from '../../ui/src/log'
|
|
11
|
+
import { tableEmits } from '../../table/src/emits'
|
|
12
|
+
import { tableProps } from '../../table/src/props'
|
|
13
|
+
import VxeTableComponent from '../../table/src/table'
|
|
14
|
+
import VxeToolbarComponent from '../../toolbar/src/toolbar'
|
|
13
15
|
|
|
14
16
|
import type { ValueOf, VxeFormEvents, VxeFormInstance, VxePagerEvents, VxeFormItemProps, VxePagerInstance, VxeComponentStyleType } from 'vxe-pc-ui'
|
|
15
17
|
import type { VxeTableMethods, VxeGridConstructor, VxeGridEmits, GridReactData, GridInternalData, VxeGridPropTypes, VxeToolbarPropTypes, GridMethods, GridPrivateMethods, VxeGridPrivateComputed, VxeGridPrivateMethods, VxeToolbarInstance, GridPrivateRef, VxeTableProps, VxeTableConstructor, VxeTablePrivateMethods, VxeTableEvents, VxeTableDefines, VxeTableEventProps, VxeGridProps } from '../../../types'
|
|
16
18
|
|
|
17
19
|
const { getConfig, getI18n, commands, hooks, useFns, createEvent, globalEvents, GLOBAL_EVENT_KEYS, renderEmptyElement } = VxeUI
|
|
18
20
|
|
|
19
|
-
const tableComponentPropKeys = Object.keys(
|
|
20
|
-
|
|
21
|
-
const tableComponentMethodKeys: (keyof VxeTableMethods)[] = ['clearAll', 'syncData', 'updateData', 'loadData', 'reloadData', 'reloadRow', 'loadColumn', 'reloadColumn', 'getRowNode', 'getColumnNode', 'getRowIndex', 'getVTRowIndex', 'getVMRowIndex', 'getColumnIndex', 'getVTColumnIndex', 'getVMColumnIndex', 'setRow', 'createData', 'createRow', 'revertData', 'clearData', 'isRemoveByRow', 'isInsertByRow', 'isUpdateByRow', 'getColumns', 'getColumnById', 'getColumnByField', 'getTableColumn', 'getFullColumns', 'getData', 'getCheckboxRecords', 'getParentRow', 'getTreeRowChildren', 'getTreeParentRow', 'getRowSeq', 'getRowById', 'getRowid', 'getTableData', 'getFullData', 'setColumnFixed', 'clearColumnFixed', 'setColumnWidth', 'getColumnWidth', 'recalcRowHeight', 'setRowHeightConf', 'getRowHeightConf', 'setRowHeight', 'getRowHeight', 'hideColumn', 'showColumn', 'resetColumn', 'refreshColumn', 'refreshScroll', 'recalculate', 'closeTooltip', 'isAllCheckboxChecked', 'isAllCheckboxIndeterminate', 'getCheckboxIndeterminateRecords', 'setCheckboxRow', 'setCheckboxRowKey', 'isCheckedByCheckboxRow', 'isCheckedByCheckboxRowKey', 'isIndeterminateByCheckboxRow', 'isIndeterminateByCheckboxRowKey', 'toggleCheckboxRow', 'setAllCheckboxRow', 'getRadioReserveRecord', 'clearRadioReserve', 'getCheckboxReserveRecords', 'clearCheckboxReserve', 'toggleAllCheckboxRow', 'clearCheckboxRow', 'setCurrentRow', 'isCheckedByRadioRow', 'isCheckedByRadioRowKey', 'setRadioRow', 'setRadioRowKey', 'clearCurrentRow', 'clearRadioRow', 'getCurrentRecord', 'getRadioRecord', 'getCurrentColumn', 'setCurrentColumn', 'clearCurrentColumn', 'setPendingRow', 'togglePendingRow', 'hasPendingByRow', 'isPendingByRow', 'getPendingRecords', 'clearPendingRow', 'setFilterByEvent', 'sort', 'setSort', 'setSortByEvent', 'clearSort', 'clearSortByEvent', 'isSort', 'getSortColumns', 'closeFilter', 'isFilter', 'clearFilterByEvent', 'isActiveFilterByColumn', 'isRowExpandLoaded', 'clearRowExpandLoaded', 'reloadRowExpand', 'reloadRowExpand', 'toggleRowExpand', 'setAllRowExpand', 'setRowExpand', 'isExpandByRow', 'isRowExpandByRow', 'clearRowExpand', 'clearRowExpandReserve', 'getRowExpandRecords', 'getTreeExpandRecords', 'isTreeExpandLoaded', 'clearTreeExpandLoaded', 'reloadTreeExpand', 'reloadTreeChilds', 'toggleTreeExpand', 'setAllTreeExpand', 'setTreeExpand', 'isTreeExpandByRow', 'clearTreeExpand', 'clearTreeExpandReserve', 'getScroll', 'scrollTo', 'scrollToRow', 'scrollToColumn', 'clearScroll', 'updateFooter', 'updateStatus', 'setMergeCells', 'removeInsertRow', 'removeMergeCells', 'getMergeCells', 'clearMergeCells', 'setMergeFooterItems', 'removeMergeFooterItems', 'getMergeFooterItems', 'clearMergeFooterItems', 'getCustomStoreData', 'setRowGroupExpand', 'setAllRowGroupExpand', 'clearRowGroupExpand', 'isRowGroupExpandByRow', 'isRowGroupRecord', 'isAggregateRecord', 'isAggregateExpandByRow', 'getAggregateContentByRow', 'getAggregateRowChildren', 'setRowGroups', 'clearRowGroups', 'openTooltip', 'moveColumnTo', 'moveRowTo', 'getCellLabel', 'getCellElement', 'focus', 'blur', 'connect']
|
|
22
|
-
|
|
23
|
-
const gridComponentEmits: VxeGridEmits = [
|
|
24
|
-
...tableComponentEmits,
|
|
25
|
-
'page-change',
|
|
26
|
-
'form-submit',
|
|
27
|
-
'form-submit-invalid',
|
|
28
|
-
'form-reset',
|
|
29
|
-
'form-collapse',
|
|
30
|
-
'form-toggle-collapse',
|
|
31
|
-
'proxy-query',
|
|
32
|
-
'proxy-delete',
|
|
33
|
-
'proxy-save',
|
|
34
|
-
'toolbar-button-click',
|
|
35
|
-
'toolbar-tool-click',
|
|
36
|
-
'zoom'
|
|
37
|
-
]
|
|
21
|
+
const tableComponentPropKeys = Object.keys(tableProps) as (keyof VxeTableProps)[]
|
|
22
|
+
const tableComponentMethodKeys: (keyof VxeTableMethods)[] = ['clearAll', 'syncData', 'updateData', 'loadData', 'reloadData', 'reloadRow', 'loadColumn', 'reloadColumn', 'getRowNode', 'getColumnNode', 'getRowIndex', 'getVTRowIndex', 'getVMRowIndex', 'getColumnIndex', 'getVTColumnIndex', 'getVMColumnIndex', 'setRow', 'createData', 'createRow', 'revertData', 'clearData', 'isRemoveByRow', 'isInsertByRow', 'isUpdateByRow', 'getColumns', 'getColumnById', 'getColumnByField', 'getTableColumn', 'getFullColumns', 'getData', 'getCheckboxRecords', 'getParentRow', 'getTreeRowChildren', 'getTreeParentRow', 'getRowSeq', 'getRowById', 'getRowid', 'getTableData', 'getFullData', 'setColumnFixed', 'clearColumnFixed', 'setColumnWidth', 'getColumnWidth', 'recalcRowHeight', 'setRowHeightConf', 'getRowHeightConf', 'setRowHeight', 'getRowHeight', 'hideColumn', 'showColumn', 'resetColumn', 'refreshColumn', 'refreshScroll', 'recalculate', 'closeTooltip', 'isAllCheckboxChecked', 'isAllCheckboxIndeterminate', 'getCheckboxIndeterminateRecords', 'setCheckboxRow', 'setCheckboxRowKey', 'isCheckedByCheckboxRow', 'isCheckedByCheckboxRowKey', 'isIndeterminateByCheckboxRow', 'isIndeterminateByCheckboxRowKey', 'toggleCheckboxRow', 'setAllCheckboxRow', 'getRadioReserveRecord', 'clearRadioReserve', 'getCheckboxReserveRecords', 'clearCheckboxReserve', 'toggleAllCheckboxRow', 'clearCheckboxRow', 'setCurrentRow', 'isCheckedByRadioRow', 'isCheckedByRadioRowKey', 'setRadioRow', 'setRadioRowKey', 'clearCurrentRow', 'clearRadioRow', 'getCurrentRecord', 'getRadioRecord', 'getCurrentColumn', 'setCurrentColumn', 'clearCurrentColumn', 'setPendingRow', 'togglePendingRow', 'hasPendingByRow', 'isPendingByRow', 'getPendingRecords', 'clearPendingRow', 'setFilterByEvent', 'sort', 'setSort', 'setSortByEvent', 'clearSort', 'clearSortByEvent', 'isSort', 'getSortColumns', 'closeFilter', 'isFilter', 'clearFilterByEvent', 'isActiveFilterByColumn', 'isRowExpandLoaded', 'clearRowExpandLoaded', 'reloadRowExpand', 'reloadRowExpand', 'toggleRowExpand', 'setAllRowExpand', 'setRowExpand', 'isExpandByRow', 'isRowExpandByRow', 'clearRowExpand', 'clearRowExpandReserve', 'getRowExpandRecords', 'getTreeExpandRecords', 'isTreeExpandLoaded', 'clearTreeExpandLoaded', 'reloadTreeExpand', 'reloadTreeChilds', 'toggleTreeExpand', 'setAllTreeExpand', 'setTreeExpand', 'isTreeExpandByRow', 'clearTreeExpand', 'clearTreeExpandReserve', 'getScroll', 'scrollTo', 'scrollToRow', 'scrollToColumn', 'clearScroll', 'updateFooter', 'updateStatus', 'setMergeCells', 'removeInsertRow', 'removeMergeCells', 'getMergeCells', 'clearMergeCells', 'setMergeFooterItems', 'removeMergeFooterItems', 'getMergeFooterItems', 'clearMergeFooterItems', 'getCustomStoreData', 'setRowGroupExpand', 'setAllRowGroupExpand', 'clearRowGroupExpand', 'isRowGroupExpandByRow', 'isRowGroupRecord', 'isAggregateRecord', 'isAggregateExpandByRow', 'getAggregateContentByRow', 'getAggregateRowChildren', 'setRowGroups', 'clearRowGroups', 'openTooltip', 'moveColumnTo', 'moveRowTo', 'getCellLabel', 'getCellElement', 'focus', 'blur', 'connect', 'connectToolbar']
|
|
38
23
|
|
|
39
24
|
function createInternalData (): GridInternalData {
|
|
40
25
|
return {
|
|
41
|
-
connectTable: null
|
|
42
26
|
}
|
|
43
27
|
}
|
|
44
28
|
|
|
45
29
|
export default defineVxeComponent({
|
|
46
30
|
name: 'VxeGrid',
|
|
47
|
-
props:
|
|
48
|
-
|
|
49
|
-
layouts: Array as PropType<VxeGridPropTypes.Layouts>,
|
|
50
|
-
columns: Array as PropType<VxeGridPropTypes.Columns<any>>,
|
|
51
|
-
pagerConfig: Object as PropType<VxeGridPropTypes.PagerConfig>,
|
|
52
|
-
proxyConfig: Object as PropType<VxeGridPropTypes.ProxyConfig<any>>,
|
|
53
|
-
toolbarConfig: Object as PropType<VxeGridPropTypes.ToolbarConfig>,
|
|
54
|
-
formConfig: Object as PropType<VxeGridPropTypes.FormConfig>,
|
|
55
|
-
zoomConfig: Object as PropType<VxeGridPropTypes.ZoomConfig>,
|
|
56
|
-
size: {
|
|
57
|
-
type: String as PropType<VxeGridPropTypes.Size>,
|
|
58
|
-
default: () => getConfig().grid.size || getConfig().size
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
emits: gridComponentEmits,
|
|
31
|
+
props: gridProps,
|
|
32
|
+
emits: gridEmits,
|
|
62
33
|
setup (props, context) {
|
|
63
34
|
const { slots, emit } = context
|
|
64
35
|
|
|
@@ -90,17 +61,17 @@ export default defineVxeComponent({
|
|
|
90
61
|
|
|
91
62
|
const internalData = createInternalData()
|
|
92
63
|
|
|
93
|
-
const refElem = ref
|
|
94
|
-
const refTable = ref
|
|
95
|
-
const refForm = ref
|
|
96
|
-
const refToolbar = ref
|
|
97
|
-
const refPager = ref
|
|
64
|
+
const refElem = ref<HTMLDivElement>()
|
|
65
|
+
const refTable = ref<ComponentPublicInstance<VxeTableProps, VxeTableConstructor & VxeTableMethods & VxeTablePrivateMethods>>()
|
|
66
|
+
const refForm = ref<VxeFormInstance>()
|
|
67
|
+
const refToolbar = ref<VxeToolbarInstance>()
|
|
68
|
+
const refPager = ref<VxePagerInstance>()
|
|
98
69
|
|
|
99
|
-
const refFormWrapper = ref
|
|
100
|
-
const refToolbarWrapper = ref
|
|
101
|
-
const refTopWrapper = ref
|
|
102
|
-
const refBottomWrapper = ref
|
|
103
|
-
const refPagerWrapper = ref
|
|
70
|
+
const refFormWrapper = ref<HTMLDivElement>()
|
|
71
|
+
const refToolbarWrapper = ref<HTMLDivElement>()
|
|
72
|
+
const refTopWrapper = ref<HTMLDivElement>()
|
|
73
|
+
const refBottomWrapper = ref<HTMLDivElement>()
|
|
74
|
+
const refPagerWrapper = ref<HTMLDivElement>()
|
|
104
75
|
|
|
105
76
|
const extendTableMethods = <T>(methodKeys: T[]) => {
|
|
106
77
|
const funcs: any = {}
|
|
@@ -174,10 +145,9 @@ export default defineVxeComponent({
|
|
|
174
145
|
})
|
|
175
146
|
|
|
176
147
|
const computeTableExtendProps = computed(() => {
|
|
177
|
-
const rest: any = {}
|
|
178
|
-
const gridProps: any = props
|
|
148
|
+
const rest: Record<string, any> = {}
|
|
179
149
|
tableComponentPropKeys.forEach((key) => {
|
|
180
|
-
rest[key] =
|
|
150
|
+
rest[key] = props[key]
|
|
181
151
|
})
|
|
182
152
|
return rest
|
|
183
153
|
})
|
|
@@ -297,7 +267,7 @@ export default defineVxeComponent({
|
|
|
297
267
|
const $xeTable = refTable.value
|
|
298
268
|
const $xeToolbar = refToolbar.value
|
|
299
269
|
if ($xeTable && $xeToolbar) {
|
|
300
|
-
$xeTable.
|
|
270
|
+
$xeTable.connectToolbar($xeToolbar)
|
|
301
271
|
}
|
|
302
272
|
})
|
|
303
273
|
}
|
|
@@ -338,10 +308,12 @@ export default defineVxeComponent({
|
|
|
338
308
|
const triggerPendingEvent = (code: string) => {
|
|
339
309
|
const isActiveMsg = computeIsActiveMsg.value
|
|
340
310
|
const $xeTable = refTable.value
|
|
341
|
-
const selectRecords = $xeTable.getCheckboxRecords()
|
|
311
|
+
const selectRecords = $xeTable ? $xeTable.getCheckboxRecords() : []
|
|
342
312
|
if (selectRecords.length) {
|
|
343
|
-
$xeTable
|
|
344
|
-
|
|
313
|
+
if ($xeTable) {
|
|
314
|
+
$xeTable.togglePendingRow(selectRecords)
|
|
315
|
+
}
|
|
316
|
+
$xeGrid.clearCheckboxRow()
|
|
345
317
|
} else {
|
|
346
318
|
if (isActiveMsg) {
|
|
347
319
|
if (VxeUI.modal) {
|
|
@@ -355,16 +327,17 @@ export default defineVxeComponent({
|
|
|
355
327
|
const proxyOpts = computeProxyOpts.value
|
|
356
328
|
const resConfigs = proxyOpts.response || proxyOpts.props || {}
|
|
357
329
|
const messageProp = resConfigs.message
|
|
330
|
+
const $xeTable = refTable.value
|
|
358
331
|
let msg
|
|
359
332
|
if (rest && messageProp) {
|
|
360
|
-
msg = XEUtils.isFunction(messageProp) ? messageProp({ data: rest, $grid: $xeGrid }) : XEUtils.get(rest, messageProp)
|
|
333
|
+
msg = XEUtils.isFunction(messageProp) ? messageProp({ data: rest, $table: $xeTable as VxeTableConstructor, $grid: $xeGrid, $gantt: null }) : XEUtils.get(rest, messageProp)
|
|
361
334
|
}
|
|
362
335
|
return msg || getI18n(defaultMsg)
|
|
363
336
|
}
|
|
364
337
|
|
|
365
338
|
const handleDeleteRow = (code: string, alertKey: string, callback: () => void): Promise<void> => {
|
|
366
339
|
const isActiveMsg = computeIsActiveMsg.value
|
|
367
|
-
const selectRecords =
|
|
340
|
+
const selectRecords = $xeGrid.getCheckboxRecords()
|
|
368
341
|
if (isActiveMsg) {
|
|
369
342
|
if (selectRecords.length) {
|
|
370
343
|
if (VxeUI.modal) {
|
|
@@ -405,6 +378,9 @@ export default defineVxeComponent({
|
|
|
405
378
|
const handleSortEvent: VxeTableEvents.SortChange | VxeTableEvents.ClearAllSort = (params) => {
|
|
406
379
|
const $xeTable = refTable.value
|
|
407
380
|
const { proxyConfig } = props
|
|
381
|
+
if (!$xeTable) {
|
|
382
|
+
return
|
|
383
|
+
}
|
|
408
384
|
const { computeSortOpts } = $xeTable.getComputeMaps()
|
|
409
385
|
const proxyOpts = computeProxyOpts.value
|
|
410
386
|
const sortOpts = computeSortOpts.value
|
|
@@ -433,6 +409,9 @@ export default defineVxeComponent({
|
|
|
433
409
|
const handleFilterEvent: VxeTableEvents.FilterChange | VxeTableEvents.ClearAllFilter = (params) => {
|
|
434
410
|
const $xeTable = refTable.value
|
|
435
411
|
const { proxyConfig } = props
|
|
412
|
+
if (!$xeTable) {
|
|
413
|
+
return
|
|
414
|
+
}
|
|
436
415
|
const { computeFilterOpts } = $xeTable.getComputeMaps()
|
|
437
416
|
const proxyOpts = computeProxyOpts.value
|
|
438
417
|
const filterOpts = computeFilterOpts.value
|
|
@@ -478,7 +457,9 @@ export default defineVxeComponent({
|
|
|
478
457
|
const { $event } = params
|
|
479
458
|
const proxyOpts = computeProxyOpts.value
|
|
480
459
|
if (proxyConfig && isEnableConf(proxyOpts)) {
|
|
481
|
-
$xeTable
|
|
460
|
+
if ($xeTable) {
|
|
461
|
+
$xeTable.clearScroll()
|
|
462
|
+
}
|
|
482
463
|
$xeGrid.commitProxy('reload').then((rest) => {
|
|
483
464
|
$xeGrid.dispatchEvent('proxy-query', { ...rest, isReload: true }, $event)
|
|
484
465
|
})
|
|
@@ -557,7 +538,7 @@ export default defineVxeComponent({
|
|
|
557
538
|
if ((formConfig && isEnableConf(formOpts)) || slots.form) {
|
|
558
539
|
let slotVNs: VNode[] = []
|
|
559
540
|
if (slots.form) {
|
|
560
|
-
slotVNs = slots.form({ $grid: $xeGrid })
|
|
541
|
+
slotVNs = slots.form({ $grid: $xeGrid, $gantt: null })
|
|
561
542
|
} else {
|
|
562
543
|
if (formOpts.items) {
|
|
563
544
|
const formSlots: { [key: string]: () => VNode[] } = {}
|
|
@@ -566,7 +547,7 @@ export default defineVxeComponent({
|
|
|
566
547
|
const beforeItem = proxyOpts.beforeItem
|
|
567
548
|
if (proxyOpts && beforeItem) {
|
|
568
549
|
formOpts.items.forEach((item) => {
|
|
569
|
-
beforeItem({ $grid: $xeGrid, item })
|
|
550
|
+
beforeItem({ $grid: $xeGrid, $gantt: null, item })
|
|
570
551
|
})
|
|
571
552
|
}
|
|
572
553
|
}
|
|
@@ -614,7 +595,7 @@ export default defineVxeComponent({
|
|
|
614
595
|
if ((toolbarConfig && isEnableConf(toolbarOpts)) || slots.toolbar) {
|
|
615
596
|
let slotVNs: VNode[] = []
|
|
616
597
|
if (slots.toolbar) {
|
|
617
|
-
slotVNs = slots.toolbar({ $grid: $xeGrid })
|
|
598
|
+
slotVNs = slots.toolbar({ $grid: $xeGrid, $gantt: null })
|
|
618
599
|
} else {
|
|
619
600
|
const toolbarOptSlots = toolbarOpts.slots
|
|
620
601
|
const toolbarSlots: {
|
|
@@ -678,7 +659,7 @@ export default defineVxeComponent({
|
|
|
678
659
|
ref: refTopWrapper,
|
|
679
660
|
key: 'top',
|
|
680
661
|
class: 'vxe-grid--top-wrapper'
|
|
681
|
-
}, topSlot({ $grid: $xeGrid }))
|
|
662
|
+
}, topSlot({ $grid: $xeGrid, $gantt: null }))
|
|
682
663
|
}
|
|
683
664
|
return renderEmptyElement($xeGrid)
|
|
684
665
|
}
|
|
@@ -688,7 +669,7 @@ export default defineVxeComponent({
|
|
|
688
669
|
if (leftSlot) {
|
|
689
670
|
return h('div', {
|
|
690
671
|
class: 'vxe-grid--left-wrapper'
|
|
691
|
-
}, leftSlot({ $grid: $xeGrid }))
|
|
672
|
+
}, leftSlot({ $grid: $xeGrid, $gantt: null }))
|
|
692
673
|
}
|
|
693
674
|
return renderEmptyElement($xeGrid)
|
|
694
675
|
}
|
|
@@ -698,7 +679,7 @@ export default defineVxeComponent({
|
|
|
698
679
|
if (rightSlot) {
|
|
699
680
|
return h('div', {
|
|
700
681
|
class: 'vxe-grid--right-wrapper'
|
|
701
|
-
}, rightSlot({ $grid: $xeGrid }))
|
|
682
|
+
}, rightSlot({ $grid: $xeGrid, $gantt: null }))
|
|
702
683
|
}
|
|
703
684
|
return renderEmptyElement($xeGrid)
|
|
704
685
|
}
|
|
@@ -763,7 +744,7 @@ export default defineVxeComponent({
|
|
|
763
744
|
ref: refBottomWrapper,
|
|
764
745
|
key: 'bottom',
|
|
765
746
|
class: 'vxe-grid--bottom-wrapper'
|
|
766
|
-
}, slots.bottom({ $grid: $xeGrid }))
|
|
747
|
+
}, slots.bottom({ $grid: $xeGrid, $gantt: null }))
|
|
767
748
|
}
|
|
768
749
|
return renderEmptyElement($xeGrid)
|
|
769
750
|
}
|
|
@@ -782,7 +763,7 @@ export default defineVxeComponent({
|
|
|
782
763
|
key: 'pager',
|
|
783
764
|
class: 'vxe-grid--pager-wrapper'
|
|
784
765
|
}, pagerSlot
|
|
785
|
-
? pagerSlot({ $grid: $xeGrid })
|
|
766
|
+
? pagerSlot({ $grid: $xeGrid, $gantt: null })
|
|
786
767
|
: [
|
|
787
768
|
VxeUIPagerComponent
|
|
788
769
|
? h(VxeUIPagerComponent, {
|
|
@@ -869,7 +850,7 @@ export default defineVxeComponent({
|
|
|
869
850
|
}
|
|
870
851
|
|
|
871
852
|
const tableCompEvents: VxeTableEventProps = {}
|
|
872
|
-
|
|
853
|
+
tableEmits.forEach(name => {
|
|
873
854
|
const type = XEUtils.camelCase(`on-${name}`) as keyof VxeTableEventProps
|
|
874
855
|
tableCompEvents[type] = (...args: any[]) => emit(name, ...args)
|
|
875
856
|
})
|
|
@@ -910,8 +891,8 @@ export default defineVxeComponent({
|
|
|
910
891
|
if (!proxyInited) {
|
|
911
892
|
reactData.proxyInited = true
|
|
912
893
|
if (proxyOpts.autoLoad !== false) {
|
|
913
|
-
nextTick().then(() =>
|
|
914
|
-
|
|
894
|
+
nextTick().then(() => $xeGrid.commitProxy('initial')).then((rest) => {
|
|
895
|
+
dispatchEvent('proxy-query', { ...rest, isInited: true }, new Event('initial'))
|
|
915
896
|
})
|
|
916
897
|
}
|
|
917
898
|
}
|
|
@@ -927,13 +908,13 @@ export default defineVxeComponent({
|
|
|
927
908
|
}
|
|
928
909
|
|
|
929
910
|
const dispatchEvent = (type: ValueOf<VxeGridEmits>, params: Record<string, any>, evnt: Event | null) => {
|
|
930
|
-
emit(type, createEvent(evnt, { $grid: $xeGrid }, params))
|
|
911
|
+
emit(type, createEvent(evnt, { $grid: $xeGrid, $gantt: null }, params))
|
|
931
912
|
}
|
|
932
913
|
|
|
933
914
|
const gridMethods: GridMethods = {
|
|
934
915
|
dispatchEvent,
|
|
935
916
|
getEl () {
|
|
936
|
-
return refElem.value
|
|
917
|
+
return refElem.value as HTMLDivElement
|
|
937
918
|
},
|
|
938
919
|
/**
|
|
939
920
|
* 提交指令,支持 code 或 button
|
|
@@ -950,6 +931,9 @@ export default defineVxeComponent({
|
|
|
950
931
|
const { beforeQuery, afterQuery, beforeDelete, afterDelete, beforeSave, afterSave, ajax = {} } = proxyOpts
|
|
951
932
|
const resConfigs = proxyOpts.response || proxyOpts.props || {}
|
|
952
933
|
const $xeTable = refTable.value
|
|
934
|
+
if (!$xeTable) {
|
|
935
|
+
return nextTick()
|
|
936
|
+
}
|
|
953
937
|
let formData = getFormData()
|
|
954
938
|
let button: VxeToolbarPropTypes.ButtonConfig | null = null
|
|
955
939
|
let code: string | null = null
|
|
@@ -1066,11 +1050,13 @@ export default defineVxeComponent({
|
|
|
1066
1050
|
}
|
|
1067
1051
|
}
|
|
1068
1052
|
const commitParams = {
|
|
1053
|
+
$table: $xeTable,
|
|
1054
|
+
$grid: $xeGrid,
|
|
1055
|
+
$gantt: null,
|
|
1069
1056
|
code,
|
|
1070
1057
|
button,
|
|
1071
1058
|
isInited,
|
|
1072
1059
|
isReload,
|
|
1073
|
-
$grid: $xeGrid,
|
|
1074
1060
|
page: pageParams,
|
|
1075
1061
|
sort: sortList.length ? sortList[0] : {},
|
|
1076
1062
|
sorts: sortList,
|
|
@@ -1088,10 +1074,10 @@ export default defineVxeComponent({
|
|
|
1088
1074
|
if (rest) {
|
|
1089
1075
|
if (pagerConfig && isEnableConf(pagerOpts)) {
|
|
1090
1076
|
const totalProp = resConfigs.total
|
|
1091
|
-
const total = (XEUtils.isFunction(totalProp) ? totalProp({ data: rest, $grid: $xeGrid }) : XEUtils.get(rest, totalProp || 'page.total')) || 0
|
|
1077
|
+
const total = (XEUtils.isFunction(totalProp) ? totalProp({ data: rest, $table: $xeTable, $grid: $xeGrid, $gantt: null }) : XEUtils.get(rest, totalProp || 'page.total')) || 0
|
|
1092
1078
|
tablePage.total = XEUtils.toNumber(total)
|
|
1093
1079
|
const resultProp = resConfigs.result
|
|
1094
|
-
tableData = (XEUtils.isFunction(resultProp) ? resultProp({ data: rest, $grid: $xeGrid }) : XEUtils.get(rest, resultProp || 'result')) || []
|
|
1080
|
+
tableData = (XEUtils.isFunction(resultProp) ? resultProp({ data: rest, $table: $xeTable, $grid: $xeGrid, $gantt: null }) : XEUtils.get(rest, resultProp || 'result')) || []
|
|
1095
1081
|
// 检验当前页码,不能超出当前最大页数
|
|
1096
1082
|
const pageCount = Math.max(Math.ceil(total / tablePage.pageSize), 1)
|
|
1097
1083
|
if (tablePage.currentPage > pageCount) {
|
|
@@ -1099,7 +1085,7 @@ export default defineVxeComponent({
|
|
|
1099
1085
|
}
|
|
1100
1086
|
} else {
|
|
1101
1087
|
const listProp = resConfigs.list
|
|
1102
|
-
tableData = (listProp ? (XEUtils.isFunction(listProp) ? listProp({ data: rest, $grid: $xeGrid }) : XEUtils.get(rest, listProp)) : rest) || []
|
|
1088
|
+
tableData = (listProp ? (XEUtils.isFunction(listProp) ? listProp({ data: rest, $table: $xeTable, $grid: $xeGrid, $gantt: null }) : XEUtils.get(rest, listProp)) : rest) || []
|
|
1103
1089
|
}
|
|
1104
1090
|
}
|
|
1105
1091
|
if ($xeTable as any) {
|
|
@@ -1135,10 +1121,19 @@ export default defineVxeComponent({
|
|
|
1135
1121
|
const deleteSuccessMethods = ajax.deleteSuccess
|
|
1136
1122
|
const deleteErrorMethods = ajax.deleteError
|
|
1137
1123
|
if (ajaxMethods) {
|
|
1138
|
-
const selectRecords =
|
|
1124
|
+
const selectRecords = $xeGrid.getCheckboxRecords()
|
|
1139
1125
|
const removeRecords = selectRecords.filter(row => !$xeTable.isInsertByRow(row))
|
|
1140
1126
|
const body = { removeRecords }
|
|
1141
|
-
const commitParams = {
|
|
1127
|
+
const commitParams = {
|
|
1128
|
+
$table: $xeTable,
|
|
1129
|
+
$grid: $xeGrid,
|
|
1130
|
+
$gantt: null,
|
|
1131
|
+
code,
|
|
1132
|
+
button,
|
|
1133
|
+
body,
|
|
1134
|
+
form: formData,
|
|
1135
|
+
options: ajaxMethods
|
|
1136
|
+
}
|
|
1142
1137
|
if (selectRecords.length) {
|
|
1143
1138
|
return handleDeleteRow(code, 'vxe.grid.deleteSelectRecord', () => {
|
|
1144
1139
|
if (!removeRecords.length) {
|
|
@@ -1157,7 +1152,7 @@ export default defineVxeComponent({
|
|
|
1157
1152
|
if (afterDelete) {
|
|
1158
1153
|
afterDelete(commitParams, ...args)
|
|
1159
1154
|
} else {
|
|
1160
|
-
|
|
1155
|
+
$xeGrid.commitProxy('query')
|
|
1161
1156
|
}
|
|
1162
1157
|
if (deleteSuccessMethods) {
|
|
1163
1158
|
deleteSuccessMethods({ ...commitParams, response: rest })
|
|
@@ -1196,7 +1191,16 @@ export default defineVxeComponent({
|
|
|
1196
1191
|
if (ajaxMethods) {
|
|
1197
1192
|
const body = $xeTable.getRecordset()
|
|
1198
1193
|
const { insertRecords, removeRecords, updateRecords, pendingRecords } = body
|
|
1199
|
-
const commitParams = {
|
|
1194
|
+
const commitParams = {
|
|
1195
|
+
$table: $xeTable,
|
|
1196
|
+
$grid: $xeGrid,
|
|
1197
|
+
$gantt: null,
|
|
1198
|
+
code,
|
|
1199
|
+
button,
|
|
1200
|
+
body,
|
|
1201
|
+
form: formData,
|
|
1202
|
+
options: ajaxMethods
|
|
1203
|
+
}
|
|
1200
1204
|
// 排除掉新增且标记为删除的数据
|
|
1201
1205
|
if (insertRecords.length) {
|
|
1202
1206
|
body.pendingRecords = pendingRecords.filter((row) => $xeTable.findRowIndexOf(insertRecords, row) === -1)
|
|
@@ -1229,7 +1233,7 @@ export default defineVxeComponent({
|
|
|
1229
1233
|
if (afterSave) {
|
|
1230
1234
|
afterSave(commitParams, ...args)
|
|
1231
1235
|
} else {
|
|
1232
|
-
|
|
1236
|
+
$xeGrid.commitProxy('query')
|
|
1233
1237
|
}
|
|
1234
1238
|
if (saveSuccessMethods) {
|
|
1235
1239
|
saveSuccessMethods({ ...commitParams, response: rest })
|
|
@@ -1266,7 +1270,7 @@ export default defineVxeComponent({
|
|
|
1266
1270
|
if (gCommandOpts) {
|
|
1267
1271
|
const tCommandMethod = gCommandOpts.tableCommandMethod || gCommandOpts.commandMethod
|
|
1268
1272
|
if (tCommandMethod) {
|
|
1269
|
-
tCommandMethod({ code, button, $grid: $xeGrid, $table: $xeTable }, ...args)
|
|
1273
|
+
tCommandMethod({ code, button, $grid: $xeGrid, $table: $xeTable, $gantt: null }, ...args)
|
|
1270
1274
|
} else {
|
|
1271
1275
|
errLog('vxe.error.notCommands', [code])
|
|
1272
1276
|
}
|
|
@@ -1280,9 +1284,9 @@ export default defineVxeComponent({
|
|
|
1280
1284
|
},
|
|
1281
1285
|
zoom () {
|
|
1282
1286
|
if (reactData.isZMax) {
|
|
1283
|
-
return
|
|
1287
|
+
return $xeGrid.revert()
|
|
1284
1288
|
}
|
|
1285
|
-
return
|
|
1289
|
+
return $xeGrid.maximize()
|
|
1286
1290
|
},
|
|
1287
1291
|
isMaximized () {
|
|
1288
1292
|
return reactData.isZMax
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
|
|
2
|
+
import { PropType } from 'vue'
|
|
3
|
+
import { VxeUI } from '../../ui'
|
|
4
|
+
import { tableProps } from '../../table/src/props'
|
|
5
|
+
|
|
6
|
+
import type { VxeGridPropTypes } from '../../../types'
|
|
7
|
+
|
|
8
|
+
const { getConfig } = VxeUI
|
|
9
|
+
|
|
10
|
+
export const gridProps = {
|
|
11
|
+
...tableProps,
|
|
12
|
+
layouts: Array as PropType<VxeGridPropTypes.Layouts>,
|
|
13
|
+
columns: Array as PropType<VxeGridPropTypes.Columns<any>>,
|
|
14
|
+
pagerConfig: Object as PropType<VxeGridPropTypes.PagerConfig>,
|
|
15
|
+
proxyConfig: Object as PropType<VxeGridPropTypes.ProxyConfig<any>>,
|
|
16
|
+
toolbarConfig: Object as PropType<VxeGridPropTypes.ToolbarConfig>,
|
|
17
|
+
formConfig: Object as PropType<VxeGridPropTypes.FormConfig>,
|
|
18
|
+
zoomConfig: Object as PropType<VxeGridPropTypes.ZoomConfig>,
|
|
19
|
+
size: {
|
|
20
|
+
type: String as PropType<VxeGridPropTypes.Size>,
|
|
21
|
+
default: () => getConfig().grid.size || getConfig().size
|
|
22
|
+
}
|
|
23
|
+
}
|
package/packages/table/index.ts
CHANGED
|
@@ -2,14 +2,6 @@ import { App } from 'vue'
|
|
|
2
2
|
import { VxeUI } from '../ui'
|
|
3
3
|
import VxeTableComponent from './src/table'
|
|
4
4
|
import { useCellView } from './src/use'
|
|
5
|
-
import './module/filter/hook'
|
|
6
|
-
import './module/menu/hook'
|
|
7
|
-
import './module/edit/hook'
|
|
8
|
-
import './module/export/hook'
|
|
9
|
-
import './module/keyboard/hook'
|
|
10
|
-
import './module/validator/hook'
|
|
11
|
-
import './module/custom/hook'
|
|
12
|
-
import './render'
|
|
13
5
|
|
|
14
6
|
import type { TableHandleExport } from '../../types'
|
|
15
7
|
|
|
@@ -7,7 +7,7 @@ import { hasClass } from '../../../ui/src/dom'
|
|
|
7
7
|
import { createHtmlPage, getExportBlobByContent } from './util'
|
|
8
8
|
import { warnLog, errLog } from '../../../ui/src/log'
|
|
9
9
|
|
|
10
|
-
import type { VxeGridConstructor,
|
|
10
|
+
import type { VxeGridConstructor, VxeTablePropTypes, VxeColumnPropTypes, TableExportMethods, VxeGridPropTypes, VxeTableDefines, VxeTableConstructor, VxeTablePrivateMethods } from '../../../../types'
|
|
11
11
|
|
|
12
12
|
const { getI18n, hooks, renderer } = VxeUI
|
|
13
13
|
|
|
@@ -301,7 +301,8 @@ hooks.add('tableExportModule', {
|
|
|
301
301
|
const { props, reactData, internalData } = $xeTable
|
|
302
302
|
const { computeTreeOpts, computePrintOpts, computeExportOpts, computeImportOpts, computeCustomOpts, computeSeqOpts, computeRadioOpts, computeCheckboxOpts, computeColumnOpts } = $xeTable.getComputeMaps()
|
|
303
303
|
|
|
304
|
-
const $xeGrid = inject('$xeGrid', null
|
|
304
|
+
const $xeGrid = inject<VxeGridConstructor | null>('$xeGrid', null)
|
|
305
|
+
const $xeGantt = inject('$xeGantt', null)
|
|
305
306
|
|
|
306
307
|
const hasTreeChildren = (row: any) => {
|
|
307
308
|
const treeOpts = computeTreeOpts.value
|
|
@@ -1354,6 +1355,7 @@ hooks.add('tableExportModule', {
|
|
|
1354
1355
|
const params = {
|
|
1355
1356
|
$table: $xeTable,
|
|
1356
1357
|
$grid: $xeGrid,
|
|
1358
|
+
$gantt: $xeGantt,
|
|
1357
1359
|
sort: sortData.length ? sortData[0] : {} as any,
|
|
1358
1360
|
sorts: sortData as any[],
|
|
1359
1361
|
filters: gridReactData.filterData,
|
|
@@ -1363,7 +1365,7 @@ hooks.add('tableExportModule', {
|
|
|
1363
1365
|
return Promise.resolve((beforeQueryAll || ajaxMethods)(params))
|
|
1364
1366
|
.then(rest => {
|
|
1365
1367
|
const listProp = resConfigs.list
|
|
1366
|
-
handleOptions.data = (listProp ? (XEUtils.isFunction(listProp) ? listProp({ data: rest, $grid: $xeGrid }) : XEUtils.get(rest, listProp)) : rest) || []
|
|
1368
|
+
handleOptions.data = (listProp ? (XEUtils.isFunction(listProp) ? listProp({ data: rest, $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt }) : XEUtils.get(rest, listProp)) : rest) || []
|
|
1367
1369
|
if (afterQueryAll) {
|
|
1368
1370
|
afterQueryAll(params)
|
|
1369
1371
|
}
|
|
@@ -1608,5 +1610,8 @@ hooks.add('tableExportModule', {
|
|
|
1608
1610
|
},
|
|
1609
1611
|
setupGrid ($xeGrid) {
|
|
1610
1612
|
return $xeGrid.extendTableMethods(tableExportMethodKeys)
|
|
1613
|
+
},
|
|
1614
|
+
setupGantt ($xeGantt) {
|
|
1615
|
+
return $xeGantt.extendTableMethods(tableExportMethodKeys)
|
|
1611
1616
|
}
|
|
1612
1617
|
})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { VxeTableEmits } from '../../../types'
|
|
2
2
|
|
|
3
|
-
export
|
|
3
|
+
export const tableEmits: VxeTableEmits = [
|
|
4
4
|
'update:data',
|
|
5
5
|
'keydown-start',
|
|
6
6
|
'keydown',
|
|
@@ -106,4 +106,4 @@ export default [
|
|
|
106
106
|
'cell-area-arrows-end',
|
|
107
107
|
'active-cell-change-start',
|
|
108
108
|
'active-cell-change-end'
|
|
109
|
-
]
|
|
109
|
+
]
|