releases 4.7.17
This commit is contained in:
@@ -760,10 +760,10 @@ hooks.add('tableEditModule', {
|
||||
let { autofocus, autoselect } = editRender
|
||||
let inputElem
|
||||
if (!autofocus && compRender) {
|
||||
autofocus = compRender.autofocus
|
||||
autofocus = compRender.tableAutofocus || compRender.autofocus
|
||||
}
|
||||
if (!autoselect && compRender) {
|
||||
autoselect = compRender.autoselect
|
||||
autoselect = compRender.tableAutoSelect || compRender.autoselect
|
||||
}
|
||||
// 如果指定了聚焦 class
|
||||
if (XEUtils.isFunction(autofocus)) {
|
||||
|
||||
@@ -353,7 +353,7 @@ hooks.add('tableExportModule', {
|
||||
if (!bodyExportMethod && renderOpts && renderOpts.name) {
|
||||
const compConf = renderer.get(renderOpts.name)
|
||||
if (compConf) {
|
||||
bodyExportMethod = compConf.exportMethod
|
||||
bodyExportMethod = compConf.tableExportMethod || compConf.exportMethod
|
||||
}
|
||||
}
|
||||
if (!bodyExportMethod) {
|
||||
@@ -471,7 +471,7 @@ hooks.add('tableExportModule', {
|
||||
if (!footLabelMethod && renderOpts && renderOpts.name) {
|
||||
const compConf = renderer.get(renderOpts.name)
|
||||
if (compConf) {
|
||||
footLabelMethod = compConf.footerExportMethod
|
||||
footLabelMethod = compConf.tableFooterExportMethod || compConf.footerExportMethod
|
||||
}
|
||||
}
|
||||
if (!footLabelMethod) {
|
||||
|
||||
@@ -40,7 +40,7 @@ hooks.add('tableFilterModule', {
|
||||
const { visibleWidth } = getDomNode()
|
||||
const { filters, filterMultiple, filterRender } = column
|
||||
const compConf = filterRender ? renderer.get(filterRender.name) : null
|
||||
const filterRecoverMethod = column.filterRecoverMethod || (compConf ? compConf.filterRecoverMethod : null)
|
||||
const frMethod = column.filterRecoverMethod || (compConf ? (compConf.tableFilterRecoverMethod || compConf.filterRecoverMethod) : null)
|
||||
internalData._currFilterParams = params
|
||||
Object.assign(filterStore, {
|
||||
multiple: filterMultiple,
|
||||
@@ -53,8 +53,8 @@ hooks.add('tableFilterModule', {
|
||||
const { _checked, checked } = option
|
||||
option._checked = checked
|
||||
if (!checked && _checked !== checked) {
|
||||
if (filterRecoverMethod) {
|
||||
filterRecoverMethod({ option, column, $table: $xeTable })
|
||||
if (frMethod) {
|
||||
frMethod({ option, column, $table: $xeTable })
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -119,16 +119,16 @@ hooks.add('tableFilterModule', {
|
||||
const { filters, filterRender } = column
|
||||
if (filters) {
|
||||
const compConf = filterRender ? renderer.get(filterRender.name) : null
|
||||
const filterResetMethod = column.filterResetMethod || (compConf ? compConf.filterResetMethod : null)
|
||||
const frMethod = column.filterResetMethod || (compConf ? (compConf.tableFilterResetMethod || compConf.filterResetMethod) : null)
|
||||
filters.forEach((item: any) => {
|
||||
item._checked = false
|
||||
item.checked = false
|
||||
if (!filterResetMethod) {
|
||||
if (!frMethod) {
|
||||
item.data = XEUtils.clone(item.resetValue, true)
|
||||
}
|
||||
})
|
||||
if (filterResetMethod) {
|
||||
filterResetMethod({ options: filters, column, $table: $xeTable })
|
||||
if (frMethod) {
|
||||
frMethod({ options: filters, column, $table: $xeTable })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,17 +111,18 @@ export default defineComponent({
|
||||
const { slots } = column
|
||||
const filterSlot = slots ? slots.filter : null
|
||||
const params = Object.assign({}, tableInternalData._currFilterParams, { $panel, $table: $xeTable })
|
||||
const rtFilter = compConf ? (compConf.renderTableFilter || compConf.renderFilter) : null
|
||||
if (filterSlot) {
|
||||
return [
|
||||
h('div', {
|
||||
class: 'vxe-table--filter-template'
|
||||
}, $xeTable.callSlot(filterSlot, params))
|
||||
]
|
||||
} else if (compConf && compConf.renderFilter) {
|
||||
} else if (rtFilter) {
|
||||
return [
|
||||
h('div', {
|
||||
class: 'vxe-table--filter-template'
|
||||
}, getSlotVNs(compConf.renderFilter(filterRender, params)))
|
||||
}, getSlotVNs(rtFilter(filterRender, params)))
|
||||
]
|
||||
}
|
||||
const isAllChecked = multiple ? filterStore.isAllSelected : !filterStore.options.some((item: any) => item._checked)
|
||||
@@ -192,7 +193,7 @@ export default defineComponent({
|
||||
const filterRender = column.filterRender
|
||||
const compConf = filterRender ? renderer.get(filterRender.name) : null
|
||||
const isDisabled = !hasCheckOption && !filterStore.isAllSelected && !filterStore.isIndeterminate
|
||||
return multiple && (!compConf || compConf.showFilterFooter !== false)
|
||||
return multiple && (compConf ? !(compConf.showTableFilterFooter === false || compConf.showFilterFooter === false) : true)
|
||||
? [
|
||||
h('div', {
|
||||
class: 'vxe-table--filter-footer'
|
||||
@@ -218,7 +219,7 @@ export default defineComponent({
|
||||
const { column } = filterStore
|
||||
const filterRender = column ? column.filterRender : null
|
||||
const compConf = filterRender ? renderer.get(filterRender.name) : null
|
||||
const filterClassName = compConf ? compConf.filterClassName : ''
|
||||
const filterClassName = compConf ? (compConf.tableFilterClassName || compConf.filterClassName) : ''
|
||||
const params = Object.assign({}, tableInternalData._currFilterParams, { $panel, $table: $xeTable })
|
||||
return h('div', {
|
||||
class: [
|
||||
|
||||
@@ -143,8 +143,8 @@ export default defineComponent({
|
||||
const { height: rowHeight } = rowOpts
|
||||
const renderOpts = editRender || cellRender
|
||||
const compConf = renderOpts ? renderer.get(renderOpts.name) : null
|
||||
const compCellClassName = compConf ? compConf.cellClassName : ''
|
||||
const compCellStyle = compConf ? compConf.cellStyle : ''
|
||||
const compCellClassName = compConf ? (compConf.tableCellClassName || compConf.cellClassName) : null
|
||||
const compCellStyle = compConf ? (compConf.tableCellStyle || compConf.cellStyle) : ''
|
||||
const showAllTip = tooltipOpts.showAll
|
||||
const columnIndex = $xeTable.getColumnIndex(column)
|
||||
const _columnIndex = $xeTable.getVTColumnIndex(column)
|
||||
@@ -795,9 +795,9 @@ export default defineComponent({
|
||||
emptyContent = $xeTable.callSlot(emptySlot, { $table: $xeTable, $grid: $xeTable.xegrid })
|
||||
} else {
|
||||
const compConf = emptyOpts.name ? renderer.get(emptyOpts.name) : null
|
||||
const renderTableEmptyView = compConf ? compConf.renderTableEmptyView || compConf.renderEmpty : null
|
||||
if (renderTableEmptyView) {
|
||||
emptyContent = getSlotVNs(renderTableEmptyView(emptyOpts, { $table: $xeTable }))
|
||||
const rtEmptyView = compConf ? compConf.renderTableEmptyView || compConf.renderEmpty : null
|
||||
if (rtEmptyView) {
|
||||
emptyContent = getSlotVNs(rtEmptyView(emptyOpts, { $table: $xeTable }))
|
||||
} else {
|
||||
emptyContent = tableProps.emptyText || getI18n('vxe.table.emptyText')
|
||||
}
|
||||
|
||||
@@ -104,8 +104,11 @@ function getFooterContent (params: VxeTableDefines.CellRenderFooterParams) {
|
||||
}
|
||||
if (renderOpts) {
|
||||
const compConf = renderer.get(renderOpts.name)
|
||||
if (compConf && compConf.renderFooter) {
|
||||
return getSlotVNs(compConf.renderFooter(renderOpts, params))
|
||||
if (compConf) {
|
||||
const rtFooter = compConf.renderTableFooter || compConf.renderFooter
|
||||
if (rtFooter) {
|
||||
return getSlotVNs(rtFooter(renderOpts, params))
|
||||
}
|
||||
}
|
||||
}
|
||||
// 兼容老模式
|
||||
@@ -187,8 +190,11 @@ export const Cell = {
|
||||
}
|
||||
if (renderOpts) {
|
||||
const compConf = renderer.get(renderOpts.name)
|
||||
if (compConf && compConf.renderHeader) {
|
||||
return renderTitleContent(params, getSlotVNs(compConf.renderHeader(renderOpts, params)))
|
||||
if (compConf) {
|
||||
const rtHeader = compConf.renderTableHeader || compConf.renderHeader
|
||||
if (rtHeader) {
|
||||
return renderTitleContent(params, getSlotVNs(rtHeader(renderOpts, params)))
|
||||
}
|
||||
}
|
||||
}
|
||||
return renderTitleContent(params, formatText(column.getTitle(), 1))
|
||||
@@ -205,11 +211,14 @@ export const Cell = {
|
||||
return $table.callSlot(defaultSlot, params)
|
||||
}
|
||||
if (renderOpts) {
|
||||
const funName = editRender ? 'renderCell' : 'renderDefault'
|
||||
const compConf = renderer.get(renderOpts.name)
|
||||
const compFn = compConf ? compConf[funName] : null
|
||||
if (compFn) {
|
||||
return getSlotVNs(compFn(renderOpts, Object.assign({ $type: editRender ? 'edit' : 'cell' }, params)))
|
||||
if (compConf) {
|
||||
const rtCell = compConf.renderTableCell || compConf.renderCell
|
||||
const rtDefault = compConf.renderTableDefault || compConf.renderDefault
|
||||
const renderFn = editRender ? rtCell : rtDefault
|
||||
if (renderFn) {
|
||||
return getSlotVNs(renderFn(renderOpts, Object.assign({ $type: editRender ? 'edit' : 'cell' }, params)))
|
||||
}
|
||||
}
|
||||
}
|
||||
const cellValue = $table.getCellLabel(row, column)
|
||||
@@ -661,8 +670,11 @@ export const Cell = {
|
||||
}
|
||||
if (contentRender) {
|
||||
const compConf = renderer.get(contentRender.name)
|
||||
if (compConf && compConf.renderExpand) {
|
||||
return getSlotVNs(compConf.renderExpand(contentRender, params))
|
||||
if (compConf) {
|
||||
const rtExpand = compConf.renderTableExpand || compConf.renderExpand
|
||||
if (rtExpand) {
|
||||
return getSlotVNs(rtExpand(contentRender, params))
|
||||
}
|
||||
}
|
||||
}
|
||||
return []
|
||||
@@ -839,12 +851,13 @@ export const Cell = {
|
||||
const defaultSlot = slots ? slots.default : null
|
||||
const editSlot = slots ? slots.edit : null
|
||||
const compConf = renderer.get(editRender.name)
|
||||
const rtEdit = compConf ? (compConf.renderTableEdit || compConf.renderEdit) : null
|
||||
if (isEdit) {
|
||||
if (editSlot) {
|
||||
return $table.callSlot(editSlot, params)
|
||||
}
|
||||
if (compConf && compConf.renderEdit) {
|
||||
return getSlotVNs(compConf.renderEdit(editRender, Object.assign({ $type: 'edit' }, params)))
|
||||
if (rtEdit) {
|
||||
return getSlotVNs(rtEdit(editRender, Object.assign({ $type: 'edit' }, params)))
|
||||
}
|
||||
return []
|
||||
}
|
||||
|
||||
@@ -1360,8 +1360,8 @@ export default defineComponent({
|
||||
return filterColumns.every(({ column, valueList, itemList }) => {
|
||||
const { filterMethod, filterRender } = column
|
||||
const compConf = filterRender ? renderer.get(filterRender.name) : null
|
||||
const compFilterMethod = compConf ? compConf.filterMethod : null
|
||||
const defaultFilterMethod = compConf ? compConf.defaultFilterMethod : null
|
||||
const compFilterMethod = compConf ? (compConf.tableFilterMethod || compConf.filterMethod) : null
|
||||
const tdFilterMethod = compConf ? (compConf.defaultTableFilterMethod || compConf.defaultFilterMethod) : null
|
||||
const cellValue = getCellValue(row, column)
|
||||
if (filterMethod) {
|
||||
return itemList.some((item) => filterMethod({ value: item.value, option: item, cellValue, row, column, $table: $xeTable }))
|
||||
@@ -1369,8 +1369,8 @@ export default defineComponent({
|
||||
return itemList.some((item) => compFilterMethod({ value: item.value, option: item, cellValue, row, column, $table: $xeTable }))
|
||||
} else if (allFilterMethod) {
|
||||
return allFilterMethod({ options: itemList, values: valueList, cellValue, row, column })
|
||||
} else if (defaultFilterMethod) {
|
||||
return itemList.some((item) => defaultFilterMethod({ value: item.value, option: item, cellValue, row, column, $table: $xeTable }))
|
||||
} else if (tdFilterMethod) {
|
||||
return itemList.some((item) => tdFilterMethod({ value: item.value, option: item, cellValue, row, column, $table: $xeTable }))
|
||||
}
|
||||
return valueList.indexOf(XEUtils.get(row, column.field)) > -1
|
||||
})
|
||||
@@ -2623,6 +2623,18 @@ export default defineComponent({
|
||||
})
|
||||
}
|
||||
|
||||
const handleCheckAllEvent = (evnt: Event | null, value: any) => {
|
||||
handleCheckedAllCheckboxRow(value)
|
||||
if (evnt) {
|
||||
tableMethods.dispatchEvent('checkbox-all', {
|
||||
records: tableMethods.getCheckboxRecords(),
|
||||
reserves: tableMethods.getCheckboxReserveRecords(),
|
||||
indeterminates: tableMethods.getCheckboxIndeterminateRecords(),
|
||||
checked: value
|
||||
}, evnt)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 纵向 Y 可视渲染处理
|
||||
*/
|
||||
@@ -3579,7 +3591,7 @@ export default defineComponent({
|
||||
* 多选,切换所有行的选中状态
|
||||
*/
|
||||
toggleAllCheckboxRow () {
|
||||
tablePrivateMethods.triggerCheckAllEvent(null, !reactData.isAllSelected)
|
||||
handleCheckAllEvent(null, !reactData.isAllSelected)
|
||||
return nextTick()
|
||||
},
|
||||
/**
|
||||
@@ -5879,8 +5891,11 @@ export default defineComponent({
|
||||
handleToggleCheckRowEvent (evnt, params) {
|
||||
const { selectCheckboxMaps } = reactData
|
||||
const checkboxOpts = computeCheckboxOpts.value
|
||||
const { checkField } = checkboxOpts
|
||||
const { checkField, trigger } = checkboxOpts
|
||||
const { row } = params
|
||||
if (trigger === 'manual') {
|
||||
return
|
||||
}
|
||||
let value = false
|
||||
if (checkField) {
|
||||
value = !XEUtils.get(row, checkField)
|
||||
@@ -5897,7 +5912,10 @@ export default defineComponent({
|
||||
const checkboxOpts = computeCheckboxOpts.value
|
||||
const { row } = params
|
||||
const { afterFullData } = internalData
|
||||
const { checkMethod } = checkboxOpts
|
||||
const { checkMethod, trigger } = checkboxOpts
|
||||
if (trigger === 'manual') {
|
||||
return
|
||||
}
|
||||
if (checkboxOpts.isShiftKey && evnt.shiftKey && !props.treeConfig) {
|
||||
const checkboxRecords = tableMethods.getCheckboxRecords()
|
||||
if (checkboxRecords.length) {
|
||||
@@ -5927,15 +5945,12 @@ export default defineComponent({
|
||||
* 多选,选中所有事件
|
||||
*/
|
||||
triggerCheckAllEvent (evnt, value) {
|
||||
handleCheckedAllCheckboxRow(value)
|
||||
if (evnt) {
|
||||
tableMethods.dispatchEvent('checkbox-all', {
|
||||
records: tableMethods.getCheckboxRecords(),
|
||||
reserves: tableMethods.getCheckboxReserveRecords(),
|
||||
indeterminates: tableMethods.getCheckboxIndeterminateRecords(),
|
||||
checked: value
|
||||
}, evnt)
|
||||
const checkboxOpts = computeCheckboxOpts.value
|
||||
const { trigger } = checkboxOpts
|
||||
if (trigger === 'manual') {
|
||||
return
|
||||
}
|
||||
handleCheckAllEvent(evnt, value)
|
||||
},
|
||||
/**
|
||||
* 单选,行选中事件
|
||||
@@ -5944,6 +5959,10 @@ export default defineComponent({
|
||||
const { selectRadioRow: oldValue } = reactData
|
||||
const { row } = params
|
||||
const radioOpts = computeRadioOpts.value
|
||||
const { trigger } = radioOpts
|
||||
if (trigger === 'manual') {
|
||||
return
|
||||
}
|
||||
let newValue = row
|
||||
let isChange = oldValue !== newValue
|
||||
if (isChange) {
|
||||
@@ -5975,7 +5994,10 @@ export default defineComponent({
|
||||
const { rowExpandLazyLoadedMaps, expandColumn: column } = reactData
|
||||
const expandOpts = computeExpandOpts.value
|
||||
const { row } = params
|
||||
const { lazy } = expandOpts
|
||||
const { lazy, trigger } = expandOpts
|
||||
if (trigger === 'manual') {
|
||||
return
|
||||
}
|
||||
const rowid = getRowid($xeTable, row)
|
||||
if (!lazy || !rowExpandLazyLoadedMaps[rowid]) {
|
||||
const expanded = !tableMethods.isRowExpandByRow(row)
|
||||
@@ -6000,7 +6022,10 @@ export default defineComponent({
|
||||
const { treeExpandLazyLoadedMaps } = reactData
|
||||
const treeOpts = computeTreeOpts.value
|
||||
const { row, column } = params
|
||||
const { lazy } = treeOpts
|
||||
const { lazy, trigger } = treeOpts
|
||||
if (trigger === 'manual') {
|
||||
return
|
||||
}
|
||||
const rowid = getRowid($xeTable, row)
|
||||
if (!lazy || !treeExpandLazyLoadedMaps[rowid]) {
|
||||
const expanded = !tableMethods.isTreeExpandByRow(row)
|
||||
@@ -6360,9 +6385,9 @@ export default defineComponent({
|
||||
return slots.empty(params)
|
||||
} else {
|
||||
const compConf = emptyOpts.name ? renderer.get(emptyOpts.name) : null
|
||||
const renderTableEmptyView = compConf ? compConf.renderTableEmptyView || compConf.renderEmpty : null
|
||||
if (renderTableEmptyView) {
|
||||
return getSlotVNs(renderTableEmptyView(emptyOpts, params))
|
||||
const rtEmptyView = compConf ? compConf.renderTableEmptyView || compConf.renderEmpty : null
|
||||
if (rtEmptyView) {
|
||||
return getSlotVNs(rtEmptyView(emptyOpts, params))
|
||||
}
|
||||
}
|
||||
return getFuncText(props.emptyText) || getI18n('vxe.table.emptyText')
|
||||
|
||||
@@ -57,7 +57,7 @@ export default defineComponent({
|
||||
let toolbarMethods = {} as ToolbarMethods
|
||||
|
||||
const $xeGrid = inject('$xeGrid', null as (VxeGridConstructor & GridPrivateMethods) | null)
|
||||
let $xeTable: VxeTableConstructor & VxeTableMethods & VxeTablePrivateMethods
|
||||
const refTable = ref<VxeTableConstructor & VxeTableMethods & VxeTablePrivateMethods>()
|
||||
|
||||
const connectFlag = ref(0)
|
||||
|
||||
@@ -86,9 +86,10 @@ export default defineComponent({
|
||||
})
|
||||
|
||||
const computeTableCustomOpts = computed(() => {
|
||||
if (connectFlag.value || $xeTable) {
|
||||
if ($xeTable) {
|
||||
const { computeCustomOpts } = $xeTable.getComputeMaps()
|
||||
const $table = refTable.value
|
||||
if (connectFlag.value || $table) {
|
||||
if ($table) {
|
||||
const { computeCustomOpts } = $table.getComputeMaps()
|
||||
return computeCustomOpts.value
|
||||
}
|
||||
}
|
||||
@@ -101,16 +102,18 @@ export default defineComponent({
|
||||
})
|
||||
|
||||
const checkTable = () => {
|
||||
if ($xeTable) {
|
||||
const $table = refTable.value
|
||||
if ($table) {
|
||||
return true
|
||||
}
|
||||
errLog('vxe.error.barUnableLink')
|
||||
}
|
||||
|
||||
const handleClickSettingEvent = ({ $event }: any) => {
|
||||
if ($xeTable) {
|
||||
if ($xeTable.triggerCustomEvent) {
|
||||
$xeTable.triggerCustomEvent($event)
|
||||
const $table = refTable.value
|
||||
if ($table) {
|
||||
if ($table.triggerCustomEvent) {
|
||||
$table.triggerCustomEvent($event)
|
||||
} else {
|
||||
errLog('vxe.error.reqModule', ['VxeTableCustomModule'])
|
||||
}
|
||||
@@ -118,21 +121,25 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
const handleMouseenterSettingEvent = ({ $event }: any) => {
|
||||
if ($xeTable) {
|
||||
$xeTable.customOpenEvent($event)
|
||||
const $table = refTable.value
|
||||
if ($table) {
|
||||
$table.customOpenEvent($event)
|
||||
} else {
|
||||
errLog('vxe.error.reqModule', ['VxeTableCustomModule'])
|
||||
}
|
||||
}
|
||||
|
||||
const handleMouseleaveSettingEvent = ({ $event }: any) => {
|
||||
const { customStore } = $xeTable.reactData
|
||||
customStore.activeBtn = false
|
||||
setTimeout(() => {
|
||||
if (!customStore.activeBtn && !customStore.activeWrapper) {
|
||||
$xeTable.customCloseEvent($event)
|
||||
}
|
||||
}, 350)
|
||||
const $table = refTable.value
|
||||
if ($table) {
|
||||
const { customStore } = $table.reactData
|
||||
customStore.activeBtn = false
|
||||
setTimeout(() => {
|
||||
if (!customStore.activeBtn && !customStore.activeWrapper) {
|
||||
$table.customCloseEvent($event)
|
||||
}
|
||||
}, 350)
|
||||
}
|
||||
}
|
||||
|
||||
const refreshEvent = (evnt: KeyboardEvent) => {
|
||||
@@ -165,13 +172,14 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
const btnEvent = (evnt: Event, item: VxeToolbarPropTypes.ButtonConfig) => {
|
||||
const $table = refTable.value
|
||||
const { code } = item
|
||||
if (code) {
|
||||
if ($xeGrid) {
|
||||
$xeGrid.triggerToolbarBtnEvent(item, evnt)
|
||||
} else {
|
||||
const gCommandOpts = commands.get(code)
|
||||
const params = { code, button: item, $table: $xeTable, $grid: $xeGrid, $event: evnt }
|
||||
const params = { code, button: item, $table: $table!, $grid: $xeGrid, $event: evnt }
|
||||
if (gCommandOpts) {
|
||||
if (gCommandOpts.commandMethod) {
|
||||
gCommandOpts.commandMethod(params)
|
||||
@@ -187,13 +195,14 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
const tolEvent = (evnt: Event, item: VxeToolbarPropTypes.ButtonConfig) => {
|
||||
const $table = refTable.value
|
||||
const { code } = item
|
||||
if (code) {
|
||||
if ($xeGrid) {
|
||||
$xeGrid.triggerToolbarTolEvent(item, evnt)
|
||||
} else {
|
||||
const gCommandOpts = commands.get(code)
|
||||
const params = { code, tool: item, $table: $xeTable, $grid: $xeGrid, $event: evnt }
|
||||
const params = { code, tool: item, $table: $table!, $grid: $xeGrid, $event: evnt }
|
||||
if (gCommandOpts) {
|
||||
if (gCommandOpts.commandMethod) {
|
||||
gCommandOpts.commandMethod(params)
|
||||
@@ -210,19 +219,28 @@ export default defineComponent({
|
||||
|
||||
const importEvent = () => {
|
||||
if (checkTable()) {
|
||||
$xeTable.openImport()
|
||||
const $table = refTable.value
|
||||
if ($table) {
|
||||
$table.openImport()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const exportEvent = () => {
|
||||
if (checkTable()) {
|
||||
$xeTable.openExport()
|
||||
const $table = refTable.value
|
||||
if ($table) {
|
||||
$table.openExport()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const printEvent = () => {
|
||||
if (checkTable()) {
|
||||
$xeTable.openPrint()
|
||||
const $table = refTable.value
|
||||
if ($table) {
|
||||
$table.openPrint()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -256,9 +274,10 @@ export default defineComponent({
|
||||
*/
|
||||
const renderBtns = () => {
|
||||
const { buttons } = props
|
||||
const $table = refTable.value
|
||||
const buttonsSlot = slots.buttons
|
||||
if (buttonsSlot) {
|
||||
return getSlotVNs(buttonsSlot({ $grid: $xeGrid, $table: $xeTable }))
|
||||
return getSlotVNs(buttonsSlot({ $grid: $xeGrid, $table: $table }))
|
||||
}
|
||||
const btnVNs: VNode[] = []
|
||||
if (buttons) {
|
||||
@@ -268,7 +287,7 @@ export default defineComponent({
|
||||
const compConf = buttonRender ? renderer.get(buttonRender.name) : null
|
||||
if (buttonRender && compConf && compConf.renderToolbarButton) {
|
||||
const toolbarButtonClassName = compConf.toolbarButtonClassName
|
||||
const params = { $grid: $xeGrid, $table: $xeTable, button: item }
|
||||
const params = { $grid: $xeGrid, $table: $table!, button: item }
|
||||
btnVNs.push(
|
||||
h('span', {
|
||||
class: ['vxe-button--item', toolbarButtonClassName ? (XEUtils.isFunction(toolbarButtonClassName) ? toolbarButtonClassName(params) : toolbarButtonClassName) : '']
|
||||
@@ -307,9 +326,10 @@ export default defineComponent({
|
||||
*/
|
||||
const renderRightTools = () => {
|
||||
const { tools } = props
|
||||
const $table = refTable.value
|
||||
const toolsSlot = slots.tools
|
||||
if (toolsSlot) {
|
||||
return getSlotVNs(toolsSlot({ $grid: $xeGrid, $table: $xeTable }))
|
||||
return getSlotVNs(toolsSlot({ $grid: $xeGrid, $table: $table }))
|
||||
}
|
||||
const btnVNs: VNode[] = []
|
||||
if (tools) {
|
||||
@@ -320,7 +340,7 @@ export default defineComponent({
|
||||
const compConf = toolRender ? renderer.get(rdName) : null
|
||||
if (toolRender && compConf && compConf.renderToolbarTool) {
|
||||
const toolbarToolClassName = compConf.toolbarToolClassName
|
||||
const params = { $grid: $xeGrid, $table: $xeTable, tool: item }
|
||||
const params = { $grid: $xeGrid, $table: $table!, tool: item }
|
||||
btnVNs.push(
|
||||
h('span', {
|
||||
key: rdName as string,
|
||||
@@ -447,7 +467,7 @@ export default defineComponent({
|
||||
},
|
||||
syncUpdate (params) {
|
||||
const { collectColumn } = params
|
||||
$xeTable = params.$table
|
||||
refTable.value = params.$table
|
||||
reactData.columns = collectColumn
|
||||
connectFlag.value++
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user