vxe-table 3.14.0-beta.9 → 3.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/grid/src/grid.js +62 -42
- package/es/locale/lang/ar-EG.js +7 -1
- package/es/locale/lang/de-DE.js +7 -1
- package/es/locale/lang/en-US.js +7 -1
- package/es/locale/lang/es-ES.js +7 -1
- package/es/locale/lang/fr-FR.js +7 -1
- package/es/locale/lang/hu-HU.js +7 -1
- package/es/locale/lang/hy-AM.js +7 -1
- package/es/locale/lang/id-ID.js +7 -1
- package/es/locale/lang/it-IT.js +7 -1
- package/es/locale/lang/ja-JP.js +7 -1
- package/es/locale/lang/ko-KR.js +7 -1
- package/es/locale/lang/nb-NO.js +7 -1
- package/es/locale/lang/pt-BR.js +7 -1
- package/es/locale/lang/ru-RU.js +7 -1
- package/es/locale/lang/th-TH.js +7 -1
- package/es/locale/lang/ug-CN.js +7 -1
- package/es/locale/lang/uk-UA.js +7 -1
- package/es/locale/lang/vi-VN.js +7 -1
- package/es/locale/lang/zh-CHT.js +7 -1
- package/es/locale/lang/zh-CN.js +7 -1
- package/es/style.css +1 -1
- package/es/table/module/custom/mixin.js +4 -2
- package/es/table/module/custom/panel.js +24 -23
- package/es/table/module/edit/mixin.js +103 -68
- package/es/table/module/export/export-panel.js +5 -4
- package/es/table/module/export/import-panel.js +8 -7
- package/es/table/module/export/mixin.js +30 -27
- package/es/table/module/filter/panel.js +21 -10
- package/es/table/module/keyboard/mixin.js +141 -41
- package/es/table/module/menu/mixin.js +6 -3
- package/es/table/module/menu/panel.js +7 -7
- package/es/table/module/validator/mixin.js +2 -5
- package/es/table/render/index.js +2 -2
- package/es/table/src/body.js +43 -25
- package/es/table/src/cell.js +27 -22
- package/es/table/src/column.js +11 -9
- package/es/table/src/columnInfo.js +6 -6
- package/es/table/src/footer.js +12 -7
- package/es/table/src/group.js +6 -5
- package/es/table/src/header.js +15 -9
- package/es/table/src/methods.js +1047 -971
- package/es/table/src/props.js +4 -0
- package/es/table/src/table.js +100 -64
- package/es/table/src/util.js +55 -20
- package/es/toolbar/src/toolbar.js +3 -3
- package/es/ui/index.js +2 -1
- package/es/ui/src/log.js +1 -1
- package/helper/vetur/attributes.json +1 -1
- package/helper/vetur/tags.json +1 -1
- package/lib/grid/src/grid.js +69 -59
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.umd.js +2006 -1686
- package/lib/index.umd.min.js +1 -1
- package/lib/locale/lang/ar-EG.js +7 -1
- package/lib/locale/lang/ar-EG.min.js +1 -1
- package/lib/locale/lang/de-DE.js +7 -1
- package/lib/locale/lang/de-DE.min.js +1 -1
- package/lib/locale/lang/en-US.js +7 -1
- package/lib/locale/lang/en-US.min.js +1 -1
- package/lib/locale/lang/en-US.umd.js +7 -1
- package/lib/locale/lang/es-ES.js +7 -1
- package/lib/locale/lang/es-ES.min.js +1 -1
- package/lib/locale/lang/es-ES.umd.js +7 -1
- package/lib/locale/lang/fr-FR.js +7 -1
- package/lib/locale/lang/fr-FR.min.js +1 -1
- package/lib/locale/lang/hu-HU.js +7 -1
- package/lib/locale/lang/hu-HU.min.js +1 -1
- package/lib/locale/lang/hu-HU.umd.js +7 -1
- package/lib/locale/lang/hy-AM.js +7 -1
- package/lib/locale/lang/hy-AM.min.js +1 -1
- package/lib/locale/lang/id-ID.js +7 -1
- package/lib/locale/lang/id-ID.min.js +1 -1
- package/lib/locale/lang/it-IT.js +7 -1
- package/lib/locale/lang/it-IT.min.js +1 -1
- package/lib/locale/lang/ja-JP.js +7 -1
- package/lib/locale/lang/ja-JP.min.js +1 -1
- package/lib/locale/lang/ja-JP.umd.js +7 -1
- package/lib/locale/lang/ko-KR.js +7 -1
- package/lib/locale/lang/ko-KR.min.js +1 -1
- package/lib/locale/lang/ko-KR.umd.js +7 -1
- package/lib/locale/lang/nb-NO.js +7 -1
- package/lib/locale/lang/nb-NO.min.js +1 -1
- package/lib/locale/lang/pt-BR.js +7 -1
- package/lib/locale/lang/pt-BR.min.js +1 -1
- package/lib/locale/lang/pt-BR.umd.js +7 -1
- package/lib/locale/lang/ru-RU.js +7 -1
- package/lib/locale/lang/ru-RU.min.js +1 -1
- package/lib/locale/lang/ru-RU.umd.js +7 -1
- package/lib/locale/lang/th-TH.js +7 -1
- package/lib/locale/lang/th-TH.min.js +1 -1
- package/lib/locale/lang/ug-CN.js +7 -1
- package/lib/locale/lang/ug-CN.min.js +1 -1
- package/lib/locale/lang/uk-UA.js +7 -1
- package/lib/locale/lang/uk-UA.min.js +1 -1
- package/lib/locale/lang/uk-UA.umd.js +7 -1
- package/lib/locale/lang/vi-VN.js +7 -1
- package/lib/locale/lang/vi-VN.min.js +1 -1
- package/lib/locale/lang/zh-CHT.js +7 -1
- package/lib/locale/lang/zh-CHT.min.js +1 -1
- package/lib/locale/lang/zh-CHT.umd.js +7 -1
- package/lib/locale/lang/zh-CN.js +7 -1
- package/lib/locale/lang/zh-CN.min.js +1 -1
- package/lib/locale/lang/zh-CN.umd.js +7 -1
- package/lib/style.css +1 -1
- package/lib/table/module/custom/mixin.js +5 -3
- package/lib/table/module/custom/mixin.min.js +1 -1
- package/lib/table/module/custom/panel.js +22 -29
- package/lib/table/module/custom/panel.min.js +1 -1
- package/lib/table/module/edit/mixin.js +119 -105
- package/lib/table/module/edit/mixin.min.js +1 -1
- package/lib/table/module/export/export-panel.js +5 -4
- package/lib/table/module/export/export-panel.min.js +1 -1
- package/lib/table/module/export/import-panel.js +8 -7
- package/lib/table/module/export/import-panel.min.js +1 -1
- package/lib/table/module/export/mixin.js +35 -34
- package/lib/table/module/export/mixin.min.js +1 -1
- package/lib/table/module/filter/panel.js +16 -16
- package/lib/table/module/filter/panel.min.js +1 -1
- package/lib/table/module/keyboard/mixin.js +149 -47
- package/lib/table/module/keyboard/mixin.min.js +1 -1
- package/lib/table/module/menu/mixin.js +6 -3
- package/lib/table/module/menu/mixin.min.js +1 -1
- package/lib/table/module/menu/panel.js +7 -7
- package/lib/table/module/menu/panel.min.js +1 -1
- package/lib/table/module/validator/mixin.js +4 -10
- package/lib/table/module/validator/mixin.min.js +1 -1
- package/lib/table/render/index.js +3 -2
- package/lib/table/render/index.min.js +1 -1
- package/lib/table/src/body.js +51 -25
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/cell.js +39 -23
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/column.js +11 -9
- package/lib/table/src/column.min.js +1 -1
- package/lib/table/src/columnInfo.js +6 -6
- package/lib/table/src/columnInfo.min.js +1 -1
- package/lib/table/src/footer.js +12 -5
- package/lib/table/src/footer.min.js +1 -1
- package/lib/table/src/group.js +6 -5
- package/lib/table/src/group.min.js +1 -1
- package/lib/table/src/header.js +16 -8
- package/lib/table/src/header.min.js +1 -1
- package/lib/table/src/methods.js +1219 -1151
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/props.js +4 -0
- package/lib/table/src/props.min.js +1 -1
- package/lib/table/src/table.js +108 -67
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +62 -21
- package/lib/table/src/util.min.js +1 -1
- package/lib/toolbar/src/toolbar.js +3 -3
- package/lib/ui/index.js +2 -1
- 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 +2 -2
- package/packages/grid/src/grid.ts +75 -51
- package/packages/locale/lang/ar-EG.ts +7 -1
- package/packages/locale/lang/de-DE.ts +7 -1
- package/packages/locale/lang/en-US.ts +7 -1
- package/packages/locale/lang/es-ES.ts +7 -1
- package/packages/locale/lang/fr-FR.ts +7 -1
- package/packages/locale/lang/hu-HU.ts +7 -1
- package/packages/locale/lang/hy-AM.ts +7 -1
- package/packages/locale/lang/id-ID.ts +7 -1
- package/packages/locale/lang/it-IT.ts +7 -1
- package/packages/locale/lang/ja-JP.ts +7 -1
- package/packages/locale/lang/ko-KR.ts +7 -1
- package/packages/locale/lang/nb-NO.ts +7 -1
- package/packages/locale/lang/pt-BR.ts +7 -1
- package/packages/locale/lang/ru-RU.ts +7 -1
- package/packages/locale/lang/th-TH.ts +7 -1
- package/packages/locale/lang/ug-CN.ts +7 -1
- package/packages/locale/lang/uk-UA.ts +7 -1
- package/packages/locale/lang/vi-VN.ts +7 -1
- package/packages/locale/lang/zh-CHT.ts +7 -1
- package/packages/locale/lang/zh-CN.ts +7 -1
- package/packages/table/module/custom/mixin.ts +6 -3
- package/packages/table/module/custom/panel.ts +42 -37
- package/packages/table/module/edit/mixin.ts +139 -95
- package/packages/table/module/export/export-panel.ts +8 -5
- package/packages/table/module/export/import-panel.ts +11 -7
- package/packages/table/module/export/mixin.ts +37 -32
- package/packages/table/module/filter/panel.ts +25 -10
- package/packages/table/module/keyboard/mixin.ts +155 -49
- package/packages/table/module/menu/mixin.ts +12 -6
- package/packages/table/module/menu/panel.ts +10 -7
- package/packages/table/module/validator/mixin.ts +3 -6
- package/packages/table/render/index.ts +2 -2
- package/packages/table/src/body.ts +43 -25
- package/packages/table/src/cell.ts +27 -22
- package/packages/table/src/column.ts +14 -10
- package/packages/table/src/columnInfo.ts +9 -6
- package/packages/table/src/footer.ts +12 -7
- package/packages/table/src/group.ts +9 -5
- package/packages/table/src/header.ts +16 -9
- package/packages/table/src/methods.ts +1174 -1027
- package/packages/table/src/props.ts +16 -12
- package/packages/table/src/table.ts +117 -70
- package/packages/table/src/util.ts +65 -23
- package/packages/toolbar/src/toolbar.ts +3 -3
- package/packages/ui/index.ts +1 -0
- /package/es/{iconfont.1741336976538.ttf → iconfont.1743045564244.ttf} +0 -0
- /package/es/{iconfont.1741336976538.woff → iconfont.1743045564244.woff} +0 -0
- /package/es/{iconfont.1741336976538.woff2 → iconfont.1743045564244.woff2} +0 -0
- /package/lib/{iconfont.1741336976538.ttf → iconfont.1743045564244.ttf} +0 -0
- /package/lib/{iconfont.1741336976538.woff → iconfont.1743045564244.woff} +0 -0
- /package/lib/{iconfont.1741336976538.woff2 → iconfont.1743045564244.woff2} +0 -0
|
@@ -204,27 +204,27 @@ function getBodyLabelData ($xeTable: VxeTableConstructor, opts: VxeTablePropType
|
|
|
204
204
|
})
|
|
205
205
|
}
|
|
206
206
|
|
|
207
|
-
function getExportData ($
|
|
207
|
+
function getExportData ($xeTable: any, opts: VxeTablePropTypes.ExportHandleOptions) {
|
|
208
208
|
const { columns, dataFilterMethod } = opts
|
|
209
209
|
let datas = opts.data
|
|
210
210
|
if (dataFilterMethod) {
|
|
211
211
|
datas = datas.filter((row: any, index: any) => dataFilterMethod({ row, $rowIndex: index }))
|
|
212
212
|
}
|
|
213
|
-
return getBodyLabelData($
|
|
213
|
+
return getBodyLabelData($xeTable, opts, columns, datas)
|
|
214
214
|
}
|
|
215
215
|
|
|
216
216
|
function getBooleanValue (cellValue: any) {
|
|
217
217
|
return cellValue === 'TRUE' || cellValue === 'true' || cellValue === true
|
|
218
218
|
}
|
|
219
219
|
|
|
220
|
-
function getHeaderTitle ($
|
|
221
|
-
const
|
|
220
|
+
function getHeaderTitle ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, opts: any, column: any) {
|
|
221
|
+
const columnOpts = $xeTable.computeColumnOpts
|
|
222
222
|
const headExportMethod = column.headerExportMethod || columnOpts.headerExportMethod
|
|
223
|
-
return headExportMethod ? headExportMethod({ column, options: opts, $table: $
|
|
223
|
+
return headExportMethod ? headExportMethod({ column, options: opts, $table: $xeTable }) : ((opts.original ? column.field : column.getTitle()) || '')
|
|
224
224
|
}
|
|
225
225
|
|
|
226
|
-
function getFooterCellValue ($
|
|
227
|
-
const
|
|
226
|
+
function getFooterCellValue ($xeTable: any, opts: any, row: any, column: any) {
|
|
227
|
+
const columnOpts = $xeTable.computeColumnOpts
|
|
228
228
|
const renderOpts = column.editRender || column.cellRender
|
|
229
229
|
let footLabelMethod = column.footerExportMethod
|
|
230
230
|
if (!footLabelMethod && renderOpts && renderOpts.name) {
|
|
@@ -236,9 +236,9 @@ function getFooterCellValue ($xetable: any, opts: any, row: any, column: any) {
|
|
|
236
236
|
if (!footLabelMethod) {
|
|
237
237
|
footLabelMethod = columnOpts.footerExportMethod
|
|
238
238
|
}
|
|
239
|
-
const _columnIndex = $
|
|
239
|
+
const _columnIndex = $xeTable.getVTColumnIndex(column)
|
|
240
240
|
if (footLabelMethod) {
|
|
241
|
-
return footLabelMethod({ $table: $
|
|
241
|
+
return footLabelMethod({ $table: $xeTable, items: row, itemIndex: _columnIndex, row, _columnIndex, column, options: opts })
|
|
242
242
|
}
|
|
243
243
|
// 兼容老模式
|
|
244
244
|
if (XEUtils.isArray(row)) {
|
|
@@ -282,7 +282,7 @@ function toTxtCellLabel (val: any) {
|
|
|
282
282
|
return val
|
|
283
283
|
}
|
|
284
284
|
|
|
285
|
-
function toCsv ($xeTable: VxeTableConstructor, opts: VxeTablePropTypes.ExportHandleOptions, columns: VxeTableDefines.ColumnInfo[], datas: any[]) {
|
|
285
|
+
function toCsv ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, opts: VxeTablePropTypes.ExportHandleOptions, columns: VxeTableDefines.ColumnInfo[], datas: any[]) {
|
|
286
286
|
const reactData = $xeTable as unknown as TableReactData
|
|
287
287
|
|
|
288
288
|
let content = csvBOM
|
|
@@ -302,7 +302,7 @@ function toCsv ($xeTable: VxeTableConstructor, opts: VxeTablePropTypes.ExportHan
|
|
|
302
302
|
return content
|
|
303
303
|
}
|
|
304
304
|
|
|
305
|
-
function toTxt ($xeTable: VxeTableConstructor, opts: VxeTablePropTypes.ExportHandleOptions, columns: VxeTableDefines.ColumnInfo[], datas: any[]) {
|
|
305
|
+
function toTxt ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, opts: VxeTablePropTypes.ExportHandleOptions, columns: VxeTableDefines.ColumnInfo[], datas: any[]) {
|
|
306
306
|
const reactData = $xeTable as unknown as TableReactData
|
|
307
307
|
|
|
308
308
|
let content = ''
|
|
@@ -322,7 +322,7 @@ function toTxt ($xeTable: VxeTableConstructor, opts: VxeTablePropTypes.ExportHan
|
|
|
322
322
|
return content
|
|
323
323
|
}
|
|
324
324
|
|
|
325
|
-
function hasEllipsis ($xeTable: VxeTableConstructor, column: VxeTableDefines.ColumnInfo, property: 'showOverflow' | 'showHeaderOverflow', allColumnOverflow: VxeTablePropTypes.ShowOverflow | undefined) {
|
|
325
|
+
function hasEllipsis ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, column: VxeTableDefines.ColumnInfo, property: 'showOverflow' | 'showHeaderOverflow', allColumnOverflow: VxeTablePropTypes.ShowOverflow | undefined) {
|
|
326
326
|
const reactData = $xeTable as unknown as TableReactData
|
|
327
327
|
|
|
328
328
|
const columnOverflow = column[property]
|
|
@@ -339,7 +339,7 @@ function hasEllipsis ($xeTable: VxeTableConstructor, column: VxeTableDefines.Col
|
|
|
339
339
|
return isEllipsis
|
|
340
340
|
}
|
|
341
341
|
|
|
342
|
-
function toHtml ($xeTable: VxeTableConstructor, opts: VxeTablePropTypes.ExportHandleOptions, columns: VxeTableDefines.ColumnInfo[], datas: any[]) {
|
|
342
|
+
function toHtml ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, opts: VxeTablePropTypes.ExportHandleOptions, columns: VxeTableDefines.ColumnInfo[], datas: any[]) {
|
|
343
343
|
const props = $xeTable
|
|
344
344
|
const reactData = $xeTable as unknown as TableReactData
|
|
345
345
|
|
|
@@ -506,7 +506,9 @@ function toHtml ($xeTable: VxeTableConstructor, opts: VxeTablePropTypes.ExportHa
|
|
|
506
506
|
return isPrint ? tables.join('') : createHtmlPage(opts, tables.join(''))
|
|
507
507
|
}
|
|
508
508
|
|
|
509
|
-
function toXML ($
|
|
509
|
+
function toXML ($xeTable: any, opts: any, columns: any[], datas: any[]) {
|
|
510
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
511
|
+
|
|
510
512
|
let xml = [
|
|
511
513
|
'<?xml version="1.0"?>',
|
|
512
514
|
'<?mso-application progid="Excel.Sheet"?>',
|
|
@@ -527,22 +529,22 @@ function toXML ($xetable: any, opts: any, columns: any[], datas: any[]) {
|
|
|
527
529
|
columns.map(column => `<Column ss:Width="${column.renderWidth}"/>`).join('')
|
|
528
530
|
].join('')
|
|
529
531
|
if (opts.isHeader) {
|
|
530
|
-
xml += `<Row>${columns.map(column => `<Cell><Data ss:Type="String">${getHeaderTitle($
|
|
532
|
+
xml += `<Row>${columns.map(column => `<Cell><Data ss:Type="String">${getHeaderTitle($xeTable, opts, column)}</Data></Cell>`).join('')}</Row>`
|
|
531
533
|
}
|
|
532
534
|
datas.forEach(row => {
|
|
533
535
|
xml += '<Row>' + columns.map(column => `<Cell><Data ss:Type="String">${row[column.id]}</Data></Cell>`).join('') + '</Row>'
|
|
534
536
|
})
|
|
535
537
|
if (opts.isFooter) {
|
|
536
|
-
const footerTableData =
|
|
538
|
+
const { footerTableData } = reactData
|
|
537
539
|
const footers = getFooterData(opts, footerTableData)
|
|
538
540
|
footers.forEach((row: any) => {
|
|
539
|
-
xml += `<Row>${columns.map(column => `<Cell><Data ss:Type="String">${getFooterCellValue($
|
|
541
|
+
xml += `<Row>${columns.map(column => `<Cell><Data ss:Type="String">${getFooterCellValue($xeTable, opts, row, column)}</Data></Cell>`).join('')}</Row>`
|
|
540
542
|
})
|
|
541
543
|
}
|
|
542
544
|
return `${xml}</Table></Worksheet></Workbook>`
|
|
543
545
|
}
|
|
544
546
|
|
|
545
|
-
function getContent ($xeTable: VxeTableConstructor, opts: VxeTablePropTypes.ExportHandleOptions, columns: VxeTableDefines.ColumnInfo[], datas: any[]) {
|
|
547
|
+
function getContent ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, opts: VxeTablePropTypes.ExportHandleOptions, columns: VxeTableDefines.ColumnInfo[], datas: any[]) {
|
|
546
548
|
if (columns.length) {
|
|
547
549
|
switch (opts.type) {
|
|
548
550
|
case 'csv':
|
|
@@ -590,7 +592,7 @@ export function saveLocalFile (options: any) {
|
|
|
590
592
|
return Promise.reject(new Error(getI18n('vxe.error.notExp')))
|
|
591
593
|
}
|
|
592
594
|
|
|
593
|
-
function downloadFile ($
|
|
595
|
+
function downloadFile ($xeTable: any, opts: any, content: any) {
|
|
594
596
|
const { filename, type, download } = opts
|
|
595
597
|
if (!download) {
|
|
596
598
|
const blob = getExportBlobByContent(content, opts)
|
|
@@ -886,8 +888,10 @@ function handleImport ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, c
|
|
|
886
888
|
}
|
|
887
889
|
}
|
|
888
890
|
|
|
889
|
-
function handleFileImport ($
|
|
890
|
-
const
|
|
891
|
+
function handleFileImport ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, file: any, opts: any) {
|
|
892
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
893
|
+
|
|
894
|
+
const importOpts = $xeTable.computeImportOpts
|
|
891
895
|
const { importMethod, afterImportMethod } = opts
|
|
892
896
|
const { type, filename } = parseFile(file)
|
|
893
897
|
|
|
@@ -907,21 +911,21 @@ function handleFileImport ($xetable: any, file: any, opts: any) {
|
|
|
907
911
|
const rest = new Promise((resolve, reject) => {
|
|
908
912
|
const _importResolve = (params: any) => {
|
|
909
913
|
resolve(params)
|
|
910
|
-
$
|
|
911
|
-
$
|
|
914
|
+
;($xeTable as any)._importResolve = null
|
|
915
|
+
;($xeTable as any)._importReject = null
|
|
912
916
|
}
|
|
913
917
|
const _importReject = (params: any) => {
|
|
914
918
|
reject(params)
|
|
915
|
-
$
|
|
916
|
-
$
|
|
919
|
+
;($xeTable as any)._importResolve = null
|
|
920
|
+
;($xeTable as any)._importReject = null
|
|
917
921
|
}
|
|
918
|
-
$
|
|
919
|
-
$
|
|
922
|
+
;($xeTable as any)._importResolve = _importResolve
|
|
923
|
+
;($xeTable as any)._importReject = _importReject
|
|
920
924
|
if (window.FileReader) {
|
|
921
925
|
const options = Object.assign({ mode: 'insertTop' }, opts, { type, filename })
|
|
922
926
|
if (options.remote) {
|
|
923
927
|
if (importMethod) {
|
|
924
|
-
Promise.resolve(importMethod({ file, options, $table: $
|
|
928
|
+
Promise.resolve(importMethod({ file, options, $table: $xeTable })).then(() => {
|
|
925
929
|
_importResolve({ status: true })
|
|
926
930
|
}).catch(() => {
|
|
927
931
|
_importResolve({ status: true })
|
|
@@ -930,14 +934,15 @@ function handleFileImport ($xetable: any, file: any, opts: any) {
|
|
|
930
934
|
_importResolve({ status: true })
|
|
931
935
|
}
|
|
932
936
|
} else {
|
|
933
|
-
|
|
937
|
+
const { tableFullColumn } = internalData
|
|
938
|
+
$xeTable.preventEvent(null, 'event.import', { file, options, columns: tableFullColumn }, () => {
|
|
934
939
|
const reader = new FileReader()
|
|
935
940
|
reader.onerror = () => {
|
|
936
941
|
errLog('vxe.error.notType', [type])
|
|
937
942
|
_importReject({ status: false })
|
|
938
943
|
}
|
|
939
944
|
reader.onload = (e: any) => {
|
|
940
|
-
handleImport($
|
|
945
|
+
handleImport($xeTable, e.target.result, options)
|
|
941
946
|
}
|
|
942
947
|
reader.readAsText(file, options.encoding || 'UTF-8')
|
|
943
948
|
})
|
|
@@ -951,11 +956,11 @@ function handleFileImport ($xetable: any, file: any, opts: any) {
|
|
|
951
956
|
|
|
952
957
|
return rest.then(() => {
|
|
953
958
|
if (afterImportMethod) {
|
|
954
|
-
afterImportMethod({ status: true, options: opts, $table: $
|
|
959
|
+
afterImportMethod({ status: true, options: opts, $table: $xeTable })
|
|
955
960
|
}
|
|
956
961
|
}).catch((e) => {
|
|
957
962
|
if (afterImportMethod) {
|
|
958
|
-
afterImportMethod({ status: false, options: opts, $table: $
|
|
963
|
+
afterImportMethod({ status: false, options: opts, $table: $xeTable })
|
|
959
964
|
}
|
|
960
965
|
return Promise.reject(e)
|
|
961
966
|
})
|
|
@@ -61,13 +61,23 @@ export default {
|
|
|
61
61
|
if (filterSlot) {
|
|
62
62
|
return [
|
|
63
63
|
h('div', {
|
|
64
|
-
class: 'vxe-table--filter-template'
|
|
64
|
+
class: 'vxe-table--filter-template',
|
|
65
|
+
style: maxHeight
|
|
66
|
+
? {
|
|
67
|
+
maxHeight: `${maxHeight}px`
|
|
68
|
+
}
|
|
69
|
+
: {}
|
|
65
70
|
}, $xeTable.callSlot(filterSlot, params, h))
|
|
66
71
|
]
|
|
67
72
|
} else if (rtFilter) {
|
|
68
73
|
return [
|
|
69
74
|
h('div', {
|
|
70
|
-
class: 'vxe-table--filter-template'
|
|
75
|
+
class: 'vxe-table--filter-template',
|
|
76
|
+
style: maxHeight
|
|
77
|
+
? {
|
|
78
|
+
maxHeight: `${maxHeight}px`
|
|
79
|
+
}
|
|
80
|
+
: {}
|
|
71
81
|
}, getSlotVNs(rtFilter.call($xeTable, h, filterRender, params)))
|
|
72
82
|
]
|
|
73
83
|
}
|
|
@@ -188,19 +198,22 @@ export default {
|
|
|
188
198
|
*************************/
|
|
189
199
|
// (单选)筛选发生改变
|
|
190
200
|
changeRadioOption (evnt: any, checked: any, item: any) {
|
|
191
|
-
const
|
|
201
|
+
const $xeTable = this.$parent as VxeTableConstructor & VxeTablePrivateMethods
|
|
202
|
+
|
|
203
|
+
const { filterStore } = this
|
|
192
204
|
filterStore.options.forEach((option: any) => {
|
|
193
205
|
option._checked = false
|
|
194
206
|
})
|
|
195
207
|
item._checked = checked
|
|
196
|
-
$
|
|
208
|
+
$xeTable.checkFilterOptions()
|
|
197
209
|
this.confirmFilter(evnt)
|
|
198
210
|
},
|
|
199
211
|
// (多选)筛选发生改变
|
|
200
212
|
changeMultipleOption (evnt: any, checked: any, item: any) {
|
|
201
|
-
const
|
|
213
|
+
const $xeTable = this.$parent as VxeTableConstructor & VxeTablePrivateMethods
|
|
214
|
+
|
|
202
215
|
item._checked = checked
|
|
203
|
-
$
|
|
216
|
+
$xeTable.checkFilterOptions()
|
|
204
217
|
},
|
|
205
218
|
changeAllOption (evnt: any, checked: any) {
|
|
206
219
|
if (this.filterStore.multiple) {
|
|
@@ -219,13 +232,15 @@ export default {
|
|
|
219
232
|
},
|
|
220
233
|
// 确认筛选
|
|
221
234
|
confirmFilter (evnt: any) {
|
|
222
|
-
const
|
|
223
|
-
|
|
235
|
+
const $xeTable = this.$parent as VxeTableConstructor & VxeTablePrivateMethods
|
|
236
|
+
|
|
237
|
+
$xeTable.handleFilterConfirmFilter(evnt)
|
|
224
238
|
},
|
|
225
239
|
// 重置筛选
|
|
226
240
|
resetFilter (evnt: any) {
|
|
227
|
-
const
|
|
228
|
-
|
|
241
|
+
const $xeTable = this.$parent as VxeTableConstructor & VxeTablePrivateMethods
|
|
242
|
+
|
|
243
|
+
$xeTable.handleFilterResetFilter(evnt)
|
|
229
244
|
}
|
|
230
245
|
/*************************
|
|
231
246
|
* Publish methods
|
|
@@ -2,7 +2,7 @@ import XEUtils from 'xe-utils'
|
|
|
2
2
|
import { getRefElem } from '../../src/util'
|
|
3
3
|
import { browse, hasClass, getAbsolutePos, addClass, removeClass } from '../../../ui/src/dom'
|
|
4
4
|
|
|
5
|
-
import type { VxeTableConstructor, VxeTablePrivateMethods } from '../../../../types'
|
|
5
|
+
import type { VxeTableConstructor, VxeTablePrivateMethods, VxeTableDefines, TableReactData, TableInternalData } from '../../../../types'
|
|
6
6
|
|
|
7
7
|
function getTargetOffset (target: any, container: any) {
|
|
8
8
|
let offsetTop = 0
|
|
@@ -26,10 +26,10 @@ function getTargetOffset (target: any, container: any) {
|
|
|
26
26
|
return { offsetTop, offsetLeft }
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
function getCheckboxRangeRows ($xeTable:
|
|
29
|
+
function getCheckboxRangeRows ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, evnt: MouseEvent, params: any, targetTrElem: HTMLElement, trRect: DOMRect, offsetClientTop: number, moveRange: number) {
|
|
30
30
|
const props = $xeTable
|
|
31
|
-
const reactData = $xeTable
|
|
32
|
-
const internalData = $xeTable
|
|
31
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
32
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
33
33
|
|
|
34
34
|
const { showOverflow } = props
|
|
35
35
|
const { fullAllDataRowIdData, isResizeCellHeight } = internalData
|
|
@@ -96,17 +96,59 @@ function getCheckboxRangeRows ($xeTable: any, evnt: MouseEvent, params: any, tar
|
|
|
96
96
|
return rangeRows
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
+
function handleMoveSelected ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, evnt: any, args: any, isLeftArrow: boolean, isUpArrow: boolean, isRightArrow: boolean, isDwArrow: boolean) {
|
|
100
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
101
|
+
|
|
102
|
+
const { afterFullData, visibleColumn } = internalData
|
|
103
|
+
const params = Object.assign({}, args)
|
|
104
|
+
const _rowIndex = $xeTable.getVTRowIndex(params.row)
|
|
105
|
+
const _columnIndex = $xeTable.getVTColumnIndex(params.column)
|
|
106
|
+
evnt.preventDefault()
|
|
107
|
+
if (isUpArrow && _rowIndex > 0) {
|
|
108
|
+
// 移动到上一行
|
|
109
|
+
params.rowIndex = _rowIndex - 1
|
|
110
|
+
params.row = afterFullData[params.rowIndex]
|
|
111
|
+
} else if (isDwArrow && _rowIndex < afterFullData.length - 1) {
|
|
112
|
+
// 移动到下一行
|
|
113
|
+
params.rowIndex = _rowIndex + 1
|
|
114
|
+
params.row = afterFullData[params.rowIndex]
|
|
115
|
+
} else if (isLeftArrow && _columnIndex) {
|
|
116
|
+
// 移动到左侧单元格
|
|
117
|
+
params.columnIndex = _columnIndex - 1
|
|
118
|
+
params.column = visibleColumn[params.columnIndex]
|
|
119
|
+
} else if (isRightArrow && _columnIndex < visibleColumn.length - 1) {
|
|
120
|
+
// 移动到右侧单元格
|
|
121
|
+
params.columnIndex = _columnIndex + 1
|
|
122
|
+
params.column = visibleColumn[params.columnIndex]
|
|
123
|
+
}
|
|
124
|
+
$xeTable.scrollToRow(params.row, params.column).then(() => {
|
|
125
|
+
params.cell = $xeTable.getCellElement(params.row, params.column)
|
|
126
|
+
$xeTable.handleSelected(params, evnt)
|
|
127
|
+
})
|
|
128
|
+
return params
|
|
129
|
+
}
|
|
130
|
+
|
|
99
131
|
export default {
|
|
100
132
|
methods: {
|
|
101
133
|
// 处理 Tab 键移动
|
|
102
134
|
moveTabSelected (args: any, isLeft: any, evnt: any) {
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
135
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
136
|
+
const props = $xeTable
|
|
137
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
138
|
+
|
|
139
|
+
const { editConfig } = props
|
|
140
|
+
const { afterFullData, visibleColumn } = internalData
|
|
141
|
+
const editOpts = $xeTable.computeEditOpts
|
|
142
|
+
const rowOpts = $xeTable.computeRowOpts
|
|
143
|
+
const currentRowOpts = $xeTable.computeCurrentRowOpts
|
|
144
|
+
const columnOpts = $xeTable.computeColumnOpts
|
|
145
|
+
const currentColumnOpts = $xeTable.computeCurrentColumnOpts
|
|
146
|
+
let targetRow: any
|
|
147
|
+
let targetRowIndex: any
|
|
148
|
+
let targetColumnIndex: any
|
|
107
149
|
const params = Object.assign({}, args)
|
|
108
|
-
const _rowIndex =
|
|
109
|
-
const _columnIndex =
|
|
150
|
+
const _rowIndex = $xeTable.getVTRowIndex(params.row)
|
|
151
|
+
const _columnIndex = $xeTable.getVTColumnIndex(params.column)
|
|
110
152
|
evnt.preventDefault()
|
|
111
153
|
if (isLeft) {
|
|
112
154
|
// 向左
|
|
@@ -142,28 +184,45 @@ export default {
|
|
|
142
184
|
}
|
|
143
185
|
params.columnIndex = targetColumnIndex
|
|
144
186
|
params.column = targetColumn
|
|
145
|
-
params.cell =
|
|
187
|
+
params.cell = $xeTable.getCellElement(params.row, params.column)
|
|
188
|
+
if (rowOpts.isCurrent && currentRowOpts.isFollowSelected) {
|
|
189
|
+
$xeTable.triggerCurrentRowEvent(evnt, params)
|
|
190
|
+
}
|
|
191
|
+
if (columnOpts.isCurrent && currentColumnOpts.isFollowSelected) {
|
|
192
|
+
$xeTable.triggerCurrentColumnEvent(evnt, params)
|
|
193
|
+
}
|
|
146
194
|
if (editConfig) {
|
|
147
195
|
if (editOpts.trigger === 'click' || editOpts.trigger === 'dblclick') {
|
|
148
196
|
if (editOpts.mode === 'row') {
|
|
149
|
-
|
|
197
|
+
$xeTable.handleEdit(params, evnt)
|
|
150
198
|
} else {
|
|
151
|
-
|
|
152
|
-
.then(() =>
|
|
199
|
+
$xeTable.scrollToRow(params.row, params.column)
|
|
200
|
+
.then(() => {
|
|
201
|
+
$xeTable.handleSelected(params, evnt)
|
|
202
|
+
})
|
|
153
203
|
}
|
|
154
204
|
}
|
|
155
205
|
} else {
|
|
156
|
-
|
|
157
|
-
.then(() =>
|
|
206
|
+
$xeTable.scrollToRow(params.row, params.column)
|
|
207
|
+
.then(() => {
|
|
208
|
+
$xeTable.handleSelected(params, evnt)
|
|
209
|
+
})
|
|
158
210
|
}
|
|
159
211
|
}
|
|
160
212
|
},
|
|
161
213
|
// 处理当前行方向键移动
|
|
162
|
-
moveCurrentRow (isUpArrow:
|
|
163
|
-
const
|
|
214
|
+
moveCurrentRow (isUpArrow: boolean, isDwArrow: boolean, evnt: any) {
|
|
215
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
216
|
+
const props = $xeTable
|
|
217
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
218
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
219
|
+
|
|
220
|
+
const { treeConfig } = props
|
|
221
|
+
const { currentRow } = reactData
|
|
222
|
+
const { afterFullData } = internalData
|
|
223
|
+
const treeOpts = $xeTable.computeTreeOpts
|
|
164
224
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
165
225
|
let targetRow
|
|
166
|
-
evnt.preventDefault()
|
|
167
226
|
if (currentRow) {
|
|
168
227
|
if (treeConfig) {
|
|
169
228
|
const { index, items } = XEUtils.findTree(afterFullData, item => item === currentRow, { children: childrenField })
|
|
@@ -173,7 +232,7 @@ export default {
|
|
|
173
232
|
targetRow = items[index + 1]
|
|
174
233
|
}
|
|
175
234
|
} else {
|
|
176
|
-
const _rowIndex =
|
|
235
|
+
const _rowIndex = $xeTable.getVTRowIndex(currentRow)
|
|
177
236
|
if (isUpArrow && _rowIndex > 0) {
|
|
178
237
|
targetRow = afterFullData[_rowIndex - 1]
|
|
179
238
|
} else if (isDwArrow && _rowIndex < afterFullData.length - 1) {
|
|
@@ -184,39 +243,86 @@ export default {
|
|
|
184
243
|
targetRow = afterFullData[0]
|
|
185
244
|
}
|
|
186
245
|
if (targetRow) {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
246
|
+
evnt.preventDefault()
|
|
247
|
+
const params = {
|
|
248
|
+
$table: $xeTable,
|
|
249
|
+
row: targetRow,
|
|
250
|
+
rowIndex: $xeTable.getRowIndex(targetRow),
|
|
251
|
+
$rowIndex: $xeTable.getVMRowIndex(targetRow)
|
|
252
|
+
}
|
|
253
|
+
$xeTable.scrollToRow(targetRow)
|
|
254
|
+
.then(() => $xeTable.triggerCurrentRowEvent(evnt, params))
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
// 处理当前列方向键移动
|
|
258
|
+
moveCurrentColumn (isLeftArrow: boolean, isRightArrow: boolean, evnt: any) {
|
|
259
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
260
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
261
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
262
|
+
|
|
263
|
+
const { currentColumn } = reactData
|
|
264
|
+
const { visibleColumn } = internalData
|
|
265
|
+
let targetCol: VxeTableDefines.ColumnInfo | null = null
|
|
266
|
+
if (currentColumn) {
|
|
267
|
+
const _columnIndex = $xeTable.getVTColumnIndex(currentColumn)
|
|
268
|
+
if (isLeftArrow && _columnIndex > 0) {
|
|
269
|
+
targetCol = visibleColumn[_columnIndex - 1]
|
|
270
|
+
} else if (isRightArrow && _columnIndex < visibleColumn.length - 1) {
|
|
271
|
+
targetCol = visibleColumn[_columnIndex + 1]
|
|
272
|
+
}
|
|
273
|
+
} else {
|
|
274
|
+
targetCol = visibleColumn[0]
|
|
275
|
+
}
|
|
276
|
+
if (targetCol) {
|
|
277
|
+
evnt.preventDefault()
|
|
278
|
+
const params = {
|
|
279
|
+
$table: $xeTable,
|
|
280
|
+
column: targetCol,
|
|
281
|
+
columnIndex: $xeTable.getColumnIndex(targetCol),
|
|
282
|
+
$columnIndex: $xeTable.getVMColumnIndex(targetCol)
|
|
283
|
+
}
|
|
284
|
+
$xeTable.scrollToColumn(targetCol)
|
|
285
|
+
.then(() => $xeTable.triggerCurrentColumnEvent(evnt, params))
|
|
190
286
|
}
|
|
191
287
|
},
|
|
192
288
|
// 处理可编辑方向键移动
|
|
193
|
-
|
|
194
|
-
const
|
|
195
|
-
const
|
|
196
|
-
|
|
197
|
-
const
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
// 移动到下一行
|
|
205
|
-
params.rowIndex = _rowIndex + 1
|
|
206
|
-
params.row = afterFullData[params.rowIndex]
|
|
207
|
-
} else if (isLeftArrow && _columnIndex) {
|
|
208
|
-
// 移动到左侧单元格
|
|
209
|
-
params.columnIndex = _columnIndex - 1
|
|
210
|
-
params.column = visibleColumn[params.columnIndex]
|
|
211
|
-
} else if (isRightArrow && _columnIndex < visibleColumn.length - 1) {
|
|
212
|
-
// 移动到右侧单元格
|
|
213
|
-
params.columnIndex = _columnIndex + 1
|
|
214
|
-
params.column = visibleColumn[params.columnIndex]
|
|
289
|
+
moveArrowSelected (args: any, isLeftArrow: boolean, isUpArrow: boolean, isRightArrow: boolean, isDwArrow: boolean, evnt: any) {
|
|
290
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
291
|
+
const props = $xeTable
|
|
292
|
+
|
|
293
|
+
const { highlightCurrentRow, highlightCurrentColumn } = props
|
|
294
|
+
const rowOpts = $xeTable.computeRowOpts
|
|
295
|
+
const columnOpts = $xeTable.computeColumnOpts
|
|
296
|
+
handleMoveSelected($xeTable, evnt, args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow)
|
|
297
|
+
// 当前行按键上下移动
|
|
298
|
+
if ((isUpArrow || isDwArrow) && (rowOpts.isCurrent || highlightCurrentRow)) {
|
|
299
|
+
$xeTable.moveCurrentRow(isUpArrow, isDwArrow, evnt)
|
|
215
300
|
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
}
|
|
301
|
+
// 当前行按键左右移动
|
|
302
|
+
if ((isLeftArrow || isRightArrow) && (columnOpts.isCurrent || highlightCurrentColumn)) {
|
|
303
|
+
$xeTable.moveCurrentColumn(isLeftArrow, isRightArrow, evnt)
|
|
304
|
+
}
|
|
305
|
+
},
|
|
306
|
+
moveEnterSelected (args: any, isLeftArrow: boolean, isUpArrow: boolean, isRightArrow: boolean, isDwArrow: boolean, evnt: any) {
|
|
307
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
308
|
+
|
|
309
|
+
const rowOpts = $xeTable.computeRowOpts
|
|
310
|
+
const currentRowOpts = $xeTable.computeCurrentRowOpts
|
|
311
|
+
const columnOpts = $xeTable.computeColumnOpts
|
|
312
|
+
const currentColumnOpts = $xeTable.computeCurrentColumnOpts
|
|
313
|
+
const params = handleMoveSelected($xeTable, evnt, args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow)
|
|
314
|
+
if ((rowOpts.isCurrent && currentRowOpts.isFollowSelected)) {
|
|
315
|
+
$xeTable.triggerCurrentRowEvent(evnt, params)
|
|
316
|
+
}
|
|
317
|
+
if (columnOpts.isCurrent && currentColumnOpts.isFollowSelected) {
|
|
318
|
+
$xeTable.triggerCurrentColumnEvent(evnt, params)
|
|
319
|
+
}
|
|
320
|
+
},
|
|
321
|
+
// 处理可编辑方向键移动
|
|
322
|
+
moveSelected (args: any, isLeftArrow: boolean, isUpArrow: boolean, isRightArrow: boolean, isDwArrow: boolean, evnt: any) {
|
|
323
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
324
|
+
|
|
325
|
+
handleMoveSelected($xeTable, evnt, args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow)
|
|
220
326
|
},
|
|
221
327
|
handleCellMousedownEvent (evnt: any, params: any) {
|
|
222
328
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
@@ -4,6 +4,8 @@ import { getDomNode, getAbsolutePos, getEventTargetNode } from '../../../ui/src/
|
|
|
4
4
|
import { isEnableConf, hasChildrenList } from '../../../ui/src/utils'
|
|
5
5
|
import { warnLog } from '../../../ui/src/log'
|
|
6
6
|
|
|
7
|
+
import type { VxeTableConstructor, VxeTablePrivateMethods, VxeGridConstructor, GridPrivateMethods, TableInternalData } from '../../../../types'
|
|
8
|
+
|
|
7
9
|
const { menus } = VxeUI
|
|
8
10
|
|
|
9
11
|
export default {
|
|
@@ -55,8 +57,9 @@ export default {
|
|
|
55
57
|
* 快捷菜单事件处理
|
|
56
58
|
*/
|
|
57
59
|
handleGlobalContextmenuEvent (evnt: any) {
|
|
58
|
-
const $xeTable = this
|
|
59
|
-
const
|
|
60
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
61
|
+
const $xeGrid = $xeTable.$xeGrid as VxeGridConstructor & GridPrivateMethods
|
|
62
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
60
63
|
|
|
61
64
|
const { $refs, tId, editStore, menuConfig, contextMenu, ctxMenuStore, ctxMenuOpts, mouseConfig, mouseOpts } = this
|
|
62
65
|
const { selected } = editStore
|
|
@@ -69,7 +72,7 @@ export default {
|
|
|
69
72
|
}
|
|
70
73
|
if (internalData._keyCtx) {
|
|
71
74
|
const type = 'body'
|
|
72
|
-
const params: any = { type, $grid:
|
|
75
|
+
const params: any = { type, $grid: $xeGrid, $table: this, keyboard: true, columns: this.visibleColumn.slice(0), $event: evnt }
|
|
73
76
|
// 如果开启单元格区域
|
|
74
77
|
if (mouseConfig && mouseOpts.area) {
|
|
75
78
|
const activeArea = this.getActiveCellArea()
|
|
@@ -96,7 +99,7 @@ export default {
|
|
|
96
99
|
// target=td|th,直接向上找 table 去匹配即可
|
|
97
100
|
return target.parentNode.parentNode.parentNode.getAttribute('xid') === tId
|
|
98
101
|
})
|
|
99
|
-
const params: any = { type: layout, $grid:
|
|
102
|
+
const params: any = { type: layout, $grid: $xeGrid, $table: this, columns: this.visibleColumn.slice(0), $event: evnt }
|
|
100
103
|
if (columnTargetNode.flag) {
|
|
101
104
|
const cell = columnTargetNode.targetElem
|
|
102
105
|
const column = this.getColumnNode(cell).item
|
|
@@ -129,7 +132,7 @@ export default {
|
|
|
129
132
|
}
|
|
130
133
|
}
|
|
131
134
|
}
|
|
132
|
-
if (tableFilter && !getEventTargetNode(evnt, tableFilter.$el).flag) {
|
|
135
|
+
if (tableFilter && !getEventTargetNode(evnt, (tableFilter as any).$el).flag) {
|
|
133
136
|
this.closeFilter()
|
|
134
137
|
}
|
|
135
138
|
this.closeMenu()
|
|
@@ -253,10 +256,13 @@ export default {
|
|
|
253
256
|
* 快捷菜单点击事件
|
|
254
257
|
*/
|
|
255
258
|
ctxMenuLinkEvent (evnt: any, menu: any) {
|
|
259
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
260
|
+
const $xeGrid = $xeTable.$xeGrid as VxeGridConstructor & GridPrivateMethods
|
|
261
|
+
|
|
256
262
|
// 如果一级菜单有配置 code 则允许点击,否则不能点击
|
|
257
263
|
if (!menu.disabled && (menu.code || !menu.children || !menu.children.length)) {
|
|
258
264
|
const gMenuOpts = menus.get(menu.code)
|
|
259
|
-
const params = Object.assign({ menu, $grid:
|
|
265
|
+
const params = Object.assign({ menu, $grid: $xeGrid, $table: this, $event: evnt }, this.ctxMenuStore.args)
|
|
260
266
|
if (gMenuOpts && gMenuOpts.menuMethod) {
|
|
261
267
|
gMenuOpts.menuMethod(params, evnt)
|
|
262
268
|
}
|
|
@@ -2,6 +2,8 @@ import { CreateElement } from 'vue'
|
|
|
2
2
|
import { VxeUI } from '../../../ui'
|
|
3
3
|
import { getFuncText } from '../../../ui/src/utils'
|
|
4
4
|
|
|
5
|
+
import type { VxeTableConstructor, VxeTablePrivateMethods } from '../../../../types'
|
|
6
|
+
|
|
5
7
|
const { getIcon } = VxeUI
|
|
6
8
|
|
|
7
9
|
export default {
|
|
@@ -20,7 +22,8 @@ export default {
|
|
|
20
22
|
}
|
|
21
23
|
},
|
|
22
24
|
render (this: any, h: CreateElement) {
|
|
23
|
-
const $
|
|
25
|
+
const $xeTable = this.$parent as VxeTableConstructor & VxeTablePrivateMethods
|
|
26
|
+
|
|
24
27
|
const { _e, ctxMenuOpts, ctxMenuStore } = this
|
|
25
28
|
return h('div', {
|
|
26
29
|
class: ['vxe-table--context-menu-wrapper', ctxMenuOpts.className, {
|
|
@@ -50,13 +53,13 @@ export default {
|
|
|
50
53
|
class: 'vxe-context-menu--link',
|
|
51
54
|
on: {
|
|
52
55
|
click (evnt: any) {
|
|
53
|
-
$
|
|
56
|
+
$xeTable.ctxMenuLinkEvent(evnt, item)
|
|
54
57
|
},
|
|
55
58
|
mouseover (evnt: any) {
|
|
56
|
-
$
|
|
59
|
+
$xeTable.ctxMenuMouseoverEvent(evnt, item)
|
|
57
60
|
},
|
|
58
61
|
mouseout (evnt: any) {
|
|
59
|
-
$
|
|
62
|
+
$xeTable.ctxMenuMouseoutEvent(evnt, item)
|
|
60
63
|
}
|
|
61
64
|
}
|
|
62
65
|
}, [
|
|
@@ -101,13 +104,13 @@ export default {
|
|
|
101
104
|
class: 'vxe-context-menu--link',
|
|
102
105
|
on: {
|
|
103
106
|
click (evnt: any) {
|
|
104
|
-
$
|
|
107
|
+
$xeTable.ctxMenuLinkEvent(evnt, child)
|
|
105
108
|
},
|
|
106
109
|
mouseover (evnt: any) {
|
|
107
|
-
$
|
|
110
|
+
$xeTable.ctxMenuMouseoverEvent(evnt, item, child)
|
|
108
111
|
},
|
|
109
112
|
mouseout (evnt: any) {
|
|
110
|
-
$
|
|
113
|
+
$xeTable.ctxMenuMouseoutEvent(evnt, item)
|
|
111
114
|
}
|
|
112
115
|
}
|
|
113
116
|
}, [
|