Skip to content

Commit c58d32b

Browse files
committed
releases 4.18.0
1 parent a368c8e commit c58d32b

File tree

10 files changed

+370
-362
lines changed

10 files changed

+370
-362
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vxe-table",
3-
"version": "4.17.37",
3+
"version": "4.18.0-beta.0",
44
"description": "A PC-end table component based on Vxe UI, supporting copy-paste, data pivot table, and high-performance virtual list table solution.",
55
"scripts": {
66
"update": "npm install --legacy-peer-deps",

packages/table/module/custom/panel.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export default defineVxeComponent({
2727
props: {
2828
customStore: {
2929
type: Object as PropType<VxeTableDefines.VxeTableCustomStoreObj>,
30-
default: () => ({})
30+
default: () => ({} as VxeTableDefines.VxeTableCustomStoreObj)
3131
}
3232
},
3333
setup (props, context) {

packages/table/module/edit/hook.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ hooks.add('tableEditModule', {
620620
const afIndex = $xeTable.findRowIndexOf(afterFullData, row)
621621
if (afIndex > -1) {
622622
// 刷新单元格合并
623-
mergeBodyList.forEach((mergeItem: any) => {
623+
mergeBodyList.forEach((mergeItem) => {
624624
const { row: mergeRowIndex, rowspan: mergeRowspan } = mergeItem
625625
if (mergeRowIndex > afIndex) {
626626
mergeItem.row = mergeRowIndex - 1

packages/table/module/export/export-panel.ts

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
1-
import { h, ref, Ref, computed, reactive, inject, nextTick } from 'vue'
1+
import { h, ref, Ref, computed, reactive, inject, nextTick, VNode, PropType } from 'vue'
22
import { defineVxeComponent } from '../../../ui/src/comp'
33
import { VxeUI } from '../../../ui'
44
import XEUtils from 'xe-utils'
55
import { formatText } from '../../../ui/src/utils'
66
import { errLog } from '../../../ui/src/log'
77

8-
import type { VxeTablePrivateMethods, VxeTableConstructor, VxeTableMethods } from '../../../../types'
8+
import type { VxeTablePrivateMethods, VxeTableConstructor, VxeTableMethods, VxeTableDefines } from '../../../../types'
99

1010
const { getI18n, getIcon, renderEmptyElement } = VxeUI
1111

1212
export default defineVxeComponent({
1313
name: 'VxeTableExportPanel',
1414
props: {
15-
defaultOptions: Object as any,
16-
storeData: Object as any
15+
defaultOptions: {
16+
type: Object as PropType<VxeTableDefines.ExportParamsObj>,
17+
default: () => ({} as VxeTableDefines.ExportParamsObj)
18+
},
19+
storeData: {
20+
type: Object as PropType<VxeTableDefines.ExportStoreObj>,
21+
default: () => ({} as VxeTableDefines.ExportStoreObj)
22+
}
1723
},
1824
setup (props) {
1925
const VxeUIModalComponent = VxeUI.getComponent('VxeModal')
@@ -37,7 +43,7 @@ export default defineVxeComponent({
3743

3844
const computeCheckedAll = computed(() => {
3945
const { storeData } = props
40-
return storeData.columns.every((column: any) => column.checked)
46+
return storeData.columns.every((column) => column.checked)
4147
})
4248

4349
const computeShowSheet = computed(() => {
@@ -169,7 +175,7 @@ export default defineVxeComponent({
169175
const { isAll: isAllChecked, isIndeterminate: isAllIndeterminate } = reactData
170176
const { hasTree, hasMerge, isPrint, hasColgroup, columns } = storeData
171177
const { isHeader } = defaultOptions
172-
const cols: any[] = []
178+
const colVNs: VNode[] = []
173179
const checkedAll = computeCheckedAll.value
174180
const showSheet = computeShowSheet.value
175181
const supportMerge = computeSupportMerge.value
@@ -181,13 +187,13 @@ export default defineVxeComponent({
181187
const defaultSlot = slots.default
182188
const footerSlot = slots.footer
183189
const parameterSlot = slots.parameter
184-
XEUtils.eachTree(columns, (column: any) => {
190+
XEUtils.eachTree(columns, (column) => {
185191
const colTitle = formatText(column.getTitle(), 1)
186192
const isColGroup = column.children && column.children.length
187193
const isChecked = column.checked
188194
const indeterminate = column.halfChecked
189195
const isHtml = column.type === 'html'
190-
cols.push(
196+
colVNs.push(
191197
h('li', {
192198
key: column.id,
193199
class: ['vxe-table-export--panel-column-option', `level--${column.level}`, {
@@ -374,7 +380,7 @@ export default defineVxeComponent({
374380
]),
375381
h('ul', {
376382
class: 'vxe-table-export--panel-column-body'
377-
}, cols)
383+
}, colVNs)
378384
])
379385
])
380386
]),

packages/table/module/export/import-panel.ts

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
1-
import { h, ref, Ref, computed, inject, reactive, nextTick } from 'vue'
1+
import { h, ref, Ref, computed, inject, reactive, nextTick, PropType } from 'vue'
22
import { defineVxeComponent } from '../../../ui/src/comp'
33
import { VxeUI } from '../../../ui'
44
import XEUtils from 'xe-utils'
55
import { parseFile } from '../../../ui/src/utils'
66
import { errLog } from '../../../ui/src/log'
77

8-
import type { VxeTablePrivateMethods, VxeTableConstructor, VxeTableMethods } from '../../../../types'
8+
import type { VxeTablePrivateMethods, VxeTableConstructor, VxeTableMethods, VxeTableDefines } from '../../../../types'
99

1010
const { getI18n, getIcon, renderEmptyElement } = VxeUI
1111

1212
export default defineVxeComponent({
1313
name: 'VxeTableImportPanel',
1414
props: {
15-
defaultOptions: Object as any,
16-
storeData: Object as any
15+
defaultOptions: {
16+
type: Object as PropType<VxeTableDefines.ImportParamsObj>,
17+
default: () => ({} as VxeTableDefines.ImportParamsObj)
18+
},
19+
storeData: {
20+
type: Object as PropType<VxeTableDefines.ImportStoreObj>,
21+
default: () => ({} as VxeTableDefines.ImportStoreObj)
22+
}
1723
},
1824
setup (props) {
1925
const VxeUIModalComponent = VxeUI.getComponent('VxeModal')
@@ -44,9 +50,9 @@ export default defineVxeComponent({
4450
const { type, typeList } = storeData
4551
if (type) {
4652
const selectItem = XEUtils.find(typeList, item => type === item.value)
47-
return selectItem ? selectItem.label : '*.*'
53+
return `${selectItem ? selectItem.label : '*.*'}`
4854
}
49-
return `*.${typeList.map((item: any) => item.value).join(', *.')}`
55+
return `*.${typeList.map((item) => item.value).join(', *.')}`
5056
})
5157

5258
const clearFileEvent = () => {
@@ -60,10 +66,10 @@ export default defineVxeComponent({
6066

6167
const selectFileEvent = () => {
6268
const { storeData, defaultOptions } = props
63-
$xeTable.readFile(defaultOptions).then((params: any) => {
69+
$xeTable.readFile(defaultOptions).then((params) => {
6470
const { file } = params
6571
Object.assign(storeData, parseFile(file), { file })
66-
}).catch((e: any) => e)
72+
}).catch(() => {})
6773
}
6874

6975
const showEvent = () => {

packages/table/module/filter/panel.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,8 @@ export default defineVxeComponent({
1616
name: 'VxeTableFilterPanel',
1717
props: {
1818
filterStore: {
19-
type: Object as PropType<{
20-
isAllSelected: boolean
21-
isIndeterminate: boolean
22-
style: any
23-
column: VxeTableDefines.ColumnInfo | null | undefined
24-
visible: boolean
25-
maxHeight: number | string | null
26-
}>,
27-
default: () => ({})
19+
type: Object as PropType<VxeTableDefines.FilterStoreObj>,
20+
default: () => ({} as VxeTableDefines.FilterStoreObj)
2821
}
2922
},
3023
setup (props, context) {

packages/table/module/keyboard/hook.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,8 @@ hooks.add('tableKeyboardModule', {
244244
const checkboxOpts = computeCheckboxOpts.value
245245
const mouseOpts = computeMouseOpts.value
246246
const editOpts = computeEditOpts.value
247-
if (mouseConfig && mouseOpts.area && $xeTable.triggerCellAreaModnEvent) {
248-
return $xeTable.triggerCellAreaModnEvent(evnt, params)
247+
if (mouseConfig && mouseOpts.area && $xeTable.triggerClAreaModnEvent) {
248+
return $xeTable.triggerClAreaModnEvent(evnt, params)
249249
} else {
250250
if (checkboxConfig && checkboxOpts.range) {
251251
handleCheckboxRangeEvent(evnt, params)

packages/table/module/validator/hook.ts

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,6 @@ hooks.add('tableValidatorModule', {
154154
let validatorMethods = {} as TableValidatorMethods
155155
let validatorPrivateMethods = {} as TableValidatorPrivateMethods
156156

157-
let validRuleErr: boolean
158-
159157
/**
160158
* 聚焦到校验通过的单元格并弹出校验错误提示
161159
*/
@@ -167,7 +165,7 @@ hooks.add('tableValidatorModule', {
167165
resolve()
168166
} else {
169167
$xeTable.handleEdit(params, { type: 'valid-error', trigger: 'call' }).then(() => {
170-
resolve(validatorPrivateMethods.showValidTooltip(params))
168+
resolve($xeTable.showValidTooltip(params))
171169
})
172170
}
173171
})
@@ -233,8 +231,8 @@ hooks.add('tableValidatorModule', {
233231
}
234232
const rowValidErrs: any = []
235233
internalData._lastCallTime = Date.now()
236-
validRuleErr = false // 如果为快速校验,当存在某列校验不通过时将终止执行
237-
validatorMethods.clearValidate()
234+
internalData.validRuleErr = false // 如果为快速校验,当存在某列校验不通过时将终止执行
235+
$xeTable.clearValidate()
238236
const validErrMaps: Record<string, {
239237
row: any;
240238
column: any;
@@ -256,11 +254,11 @@ hooks.add('tableValidatorModule', {
256254
if ($xeTable.isAggregateRecord(row)) {
257255
return
258256
}
259-
if (isFull || !validRuleErr) {
257+
if (isFull || !internalData.validRuleErr) {
260258
const colVailds: any[] = []
261259
columns.forEach((column) => {
262260
const field = XEUtils.isString(column) ? column : column.field
263-
if ((isFull || !validRuleErr) && XEUtils.has(editRules, field)) {
261+
if ((isFull || !internalData.validRuleErr) && XEUtils.has(editRules, field)) {
264262
colVailds.push(
265263
validatorPrivateMethods.validCellRules('all', row, column)
266264
.catch(({ rule, rules }) => {
@@ -285,7 +283,7 @@ hooks.add('tableValidatorModule', {
285283
}
286284
validRest[field].push(rest)
287285
if (!isFull) {
288-
validRuleErr = true
286+
internalData.validRuleErr = true
289287
return Promise.reject(rest)
290288
}
291289
})
@@ -508,21 +506,21 @@ hooks.add('tableValidatorModule', {
508506
}
509507
if (customValid) {
510508
if (XEUtils.isError(customValid)) {
511-
validRuleErr = true
509+
internalData.validRuleErr = true
512510
errorRules.push(new Rule({ type: 'custom', trigger, content: customValid.message, rule: new Rule(rule) }))
513511
} else if (customValid.catch) {
514512
// 如果为异步校验(注:异步校验是并发无序的)
515513
syncValidList.push(
516514
customValid.catch((e: any) => {
517-
validRuleErr = true
515+
internalData.validRuleErr = true
518516
errorRules.push(new Rule({ type: 'custom', trigger, content: e && e.message ? e.message : (rule.content || rule.message), rule: new Rule(rule) }))
519517
})
520518
)
521519
}
522520
}
523521
} else {
524522
if (!checkRuleStatus(rule, cellValue)) {
525-
validRuleErr = true
523+
internalData.validRuleErr = true
526524
errorRules.push(new Rule(rule))
527525
}
528526
}
@@ -563,16 +561,16 @@ hooks.add('tableValidatorModule', {
563561
// 校验单元格
564562
if (editConfig && editRules && actived.row) {
565563
const { row, column, cell } = actived.args
566-
if (validatorPrivateMethods.hasCellRules(type, row, column)) {
567-
return validatorPrivateMethods.validCellRules(type, row, column).then(() => {
564+
if ($xeTable.hasCellRules(type, row, column)) {
565+
return $xeTable.validCellRules(type, row, column).then(() => {
568566
if (editOpts.mode === 'row') {
569567
validatorMethods.clearValidate(row, column)
570568
}
571569
}).catch(({ rule }: any) => {
572570
// 如果校验不通过与触发方式一致,则聚焦提示错误,否则跳过并不作任何处理
573571
if (!rule.trigger || type === rule.trigger) {
574572
const rest = { rule, row, column, cell }
575-
validatorPrivateMethods.showValidTooltip(rest)
573+
$xeTable.showValidTooltip(rest)
576574
return Promise.reject(rest)
577575
}
578576
return Promise.resolve()

0 commit comments

Comments
 (0)