vxe-table 4.12.0-beta.2 → 4.12.0-beta.20
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 +61 -44
- 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/filter/panel.js +12 -2
- package/es/table/module/keyboard/hook.js +47 -4
- package/es/table/render/index.js +91 -60
- package/es/table/src/body.js +12 -7
- package/es/table/src/cell.js +10 -9
- package/es/table/src/footer.js +9 -4
- package/es/table/src/header.js +2 -2
- package/es/table/src/props.js +4 -0
- package/es/table/src/table.js +366 -182
- package/es/table/src/util.js +58 -3
- package/es/ui/index.js +1 -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 +58 -48
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.umd.js +1245 -12123
- 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-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/filter/panel.js +8 -2
- package/lib/table/module/filter/panel.min.js +1 -1
- package/lib/table/module/keyboard/hook.js +51 -4
- package/lib/table/module/keyboard/hook.min.js +1 -1
- package/lib/table/render/index.js +100 -65
- package/lib/table/render/index.min.js +1 -1
- package/lib/table/src/body.js +11 -6
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/cell.js +15 -8
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/footer.js +9 -3
- package/lib/table/src/footer.min.js +1 -1
- package/lib/table/src/header.js +2 -1
- package/lib/table/src/header.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 +402 -188
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +65 -6
- package/lib/table/src/util.min.js +1 -1
- package/lib/ui/index.js +1 -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 +65 -50
- 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/filter/panel.ts +12 -2
- package/packages/table/module/keyboard/hook.ts +47 -6
- package/packages/table/render/index.ts +90 -59
- package/packages/table/src/body.ts +11 -6
- package/packages/table/src/cell.ts +10 -9
- package/packages/table/src/footer.ts +9 -4
- package/packages/table/src/header.ts +2 -2
- package/packages/table/src/props.ts +4 -0
- package/packages/table/src/table.ts +373 -183
- package/packages/table/src/util.ts +66 -3
- /package/es/{iconfont.1741080000843.ttf → iconfont.1742353689933.ttf} +0 -0
- /package/es/{iconfont.1741080000843.woff → iconfont.1742353689933.woff} +0 -0
- /package/es/{iconfont.1741080000843.woff2 → iconfont.1742353689933.woff2} +0 -0
- /package/lib/{iconfont.1741080000843.ttf → iconfont.1742353689933.ttf} +0 -0
- /package/lib/{iconfont.1741080000843.woff → iconfont.1742353689933.woff} +0 -0
- /package/lib/{iconfont.1741080000843.woff2 → iconfont.1742353689933.woff2} +0 -0
|
@@ -3,7 +3,7 @@ import { VxeUI } from '../../../ui'
|
|
|
3
3
|
import { getRefElem } from '../../src/util'
|
|
4
4
|
import { browse, hasClass, getAbsolutePos, addClass, removeClass } from '../../../ui/src/dom'
|
|
5
5
|
|
|
6
|
-
import type { TableKeyboardPrivateMethods } from '../../../../types'
|
|
6
|
+
import type { TableKeyboardPrivateMethods, VxeTableDefines } from '../../../../types'
|
|
7
7
|
|
|
8
8
|
const { hooks } = VxeUI
|
|
9
9
|
|
|
@@ -33,7 +33,7 @@ hooks.add('tableKeyboardModule', {
|
|
|
33
33
|
setupTable ($xeTable) {
|
|
34
34
|
const { props, reactData, internalData } = $xeTable
|
|
35
35
|
const { refElem } = $xeTable.getRefMaps()
|
|
36
|
-
const { computeEditOpts, computeCheckboxOpts, computeMouseOpts, computeTreeOpts, computeRowOpts, computeCellOpts, computeDefaultRowHeight } = $xeTable.getComputeMaps()
|
|
36
|
+
const { computeEditOpts, computeCheckboxOpts, computeMouseOpts, computeTreeOpts, computeRowOpts, computeColumnOpts, computeCellOpts, computeDefaultRowHeight, computeCurrentRowOpts, computeCurrentColumnOpts } = $xeTable.getComputeMaps()
|
|
37
37
|
|
|
38
38
|
function getCheckboxRangeRows (evnt: MouseEvent, params: any, targetTrElem: HTMLElement, trRect: DOMRect, offsetClientTop: number, moveRange: number) {
|
|
39
39
|
const { showOverflow } = props
|
|
@@ -282,7 +282,11 @@ hooks.add('tableKeyboardModule', {
|
|
|
282
282
|
const { editConfig } = props
|
|
283
283
|
const { afterFullData, visibleColumn } = internalData
|
|
284
284
|
const editOpts = computeEditOpts.value
|
|
285
|
-
|
|
285
|
+
const rowOpts = computeRowOpts.value
|
|
286
|
+
const currentRowOpts = computeCurrentRowOpts.value
|
|
287
|
+
const columnOpts = computeColumnOpts.value
|
|
288
|
+
const currentColumnOpts = computeCurrentColumnOpts.value
|
|
289
|
+
let targetRow: any
|
|
286
290
|
let targetRowIndex: any
|
|
287
291
|
let targetColumnIndex: any
|
|
288
292
|
const params = Object.assign({}, args)
|
|
@@ -324,18 +328,28 @@ hooks.add('tableKeyboardModule', {
|
|
|
324
328
|
params.columnIndex = targetColumnIndex
|
|
325
329
|
params.column = targetColumn
|
|
326
330
|
params.cell = $xeTable.getCellElement(params.row, params.column)
|
|
331
|
+
if (rowOpts.isCurrent && currentRowOpts.isFollowSelected) {
|
|
332
|
+
$xeTable.triggerCurrentRowEvent(evnt, params)
|
|
333
|
+
}
|
|
334
|
+
if (columnOpts.isCurrent && currentColumnOpts.isFollowSelected) {
|
|
335
|
+
$xeTable.triggerCurrentColumnEvent(evnt, params)
|
|
336
|
+
}
|
|
327
337
|
if (editConfig) {
|
|
328
338
|
if (editOpts.trigger === 'click' || editOpts.trigger === 'dblclick') {
|
|
329
339
|
if (editOpts.mode === 'row') {
|
|
330
340
|
$xeTable.handleEdit(params, evnt)
|
|
331
341
|
} else {
|
|
332
342
|
$xeTable.scrollToRow(params.row, params.column)
|
|
333
|
-
.then(() =>
|
|
343
|
+
.then(() => {
|
|
344
|
+
$xeTable.handleSelected(params, evnt)
|
|
345
|
+
})
|
|
334
346
|
}
|
|
335
347
|
}
|
|
336
348
|
} else {
|
|
337
349
|
$xeTable.scrollToRow(params.row, params.column)
|
|
338
|
-
.then(() =>
|
|
350
|
+
.then(() => {
|
|
351
|
+
$xeTable.handleSelected(params, evnt)
|
|
352
|
+
})
|
|
339
353
|
}
|
|
340
354
|
}
|
|
341
355
|
},
|
|
@@ -347,7 +361,6 @@ hooks.add('tableKeyboardModule', {
|
|
|
347
361
|
const treeOpts = computeTreeOpts.value
|
|
348
362
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
349
363
|
let targetRow
|
|
350
|
-
evnt.preventDefault()
|
|
351
364
|
if (currentRow) {
|
|
352
365
|
if (treeConfig) {
|
|
353
366
|
const { index, items } = XEUtils.findTree(afterFullData, item => item === currentRow, { children: childrenField })
|
|
@@ -368,6 +381,7 @@ hooks.add('tableKeyboardModule', {
|
|
|
368
381
|
targetRow = afterFullData[0]
|
|
369
382
|
}
|
|
370
383
|
if (targetRow) {
|
|
384
|
+
evnt.preventDefault()
|
|
371
385
|
const params = {
|
|
372
386
|
$table: $xeTable,
|
|
373
387
|
row: targetRow,
|
|
@@ -378,6 +392,33 @@ hooks.add('tableKeyboardModule', {
|
|
|
378
392
|
.then(() => $xeTable.triggerCurrentRowEvent(evnt, params))
|
|
379
393
|
}
|
|
380
394
|
},
|
|
395
|
+
// 处理当前列方向键移动
|
|
396
|
+
moveCurrentColumn (isLeftArrow, isRightArrow, evnt) {
|
|
397
|
+
const { currentColumn } = reactData
|
|
398
|
+
const { visibleColumn } = internalData
|
|
399
|
+
let targetCol: VxeTableDefines.ColumnInfo | null = null
|
|
400
|
+
if (currentColumn) {
|
|
401
|
+
const _columnIndex = $xeTable.getVTColumnIndex(currentColumn)
|
|
402
|
+
if (isLeftArrow && _columnIndex > 0) {
|
|
403
|
+
targetCol = visibleColumn[_columnIndex - 1]
|
|
404
|
+
} else if (isRightArrow && _columnIndex < visibleColumn.length - 1) {
|
|
405
|
+
targetCol = visibleColumn[_columnIndex + 1]
|
|
406
|
+
}
|
|
407
|
+
} else {
|
|
408
|
+
targetCol = visibleColumn[0]
|
|
409
|
+
}
|
|
410
|
+
if (targetCol) {
|
|
411
|
+
evnt.preventDefault()
|
|
412
|
+
const params = {
|
|
413
|
+
$table: $xeTable,
|
|
414
|
+
column: targetCol,
|
|
415
|
+
columnIndex: $xeTable.getColumnIndex(targetCol),
|
|
416
|
+
$columnIndex: $xeTable.getVMColumnIndex(targetCol)
|
|
417
|
+
}
|
|
418
|
+
$xeTable.scrollToColumn(targetCol)
|
|
419
|
+
.then(() => $xeTable.triggerCurrentColumnEvent(evnt, params))
|
|
420
|
+
}
|
|
421
|
+
},
|
|
381
422
|
// 处理可编辑方向键移动
|
|
382
423
|
moveSelected (args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow, evnt) {
|
|
383
424
|
const { afterFullData, visibleColumn } = internalData
|
|
@@ -6,10 +6,9 @@ import { getFuncText, formatText, isEmptyValue } from '../../ui/src/utils'
|
|
|
6
6
|
import { getOnName, getModelEvent, getChangeEvent } from '../../ui/src/vn'
|
|
7
7
|
import { errLog } from '../../ui/src/log'
|
|
8
8
|
|
|
9
|
-
import type { VxeButtonComponent } from 'vxe-pc-ui'
|
|
10
9
|
import type { VxeGlobalRendererHandles, VxeColumnPropTypes, VxeTableConstructor, VxeTablePrivateMethods } from '../../../types'
|
|
11
10
|
|
|
12
|
-
const { getConfig, renderer, getI18n } = VxeUI
|
|
11
|
+
const { getConfig, renderer, getI18n, getComponent } = VxeUI
|
|
13
12
|
|
|
14
13
|
const componentDefaultModelProp = 'modelValue'
|
|
15
14
|
|
|
@@ -41,7 +40,7 @@ function getOldComponentName (name: string) {
|
|
|
41
40
|
}
|
|
42
41
|
|
|
43
42
|
function getDefaultComponent ({ name }: any) {
|
|
44
|
-
return
|
|
43
|
+
return getComponent(name)
|
|
45
44
|
}
|
|
46
45
|
|
|
47
46
|
/**
|
|
@@ -393,7 +392,7 @@ function oldEditRender (renderOpts: VxeGlobalRendererHandles.RenderTableEditOpti
|
|
|
393
392
|
*/
|
|
394
393
|
function oldButtonEditRender (renderOpts: any, params: any) {
|
|
395
394
|
return [
|
|
396
|
-
h(
|
|
395
|
+
h(getComponent('vxe-button'), {
|
|
397
396
|
...getCellEditProps(renderOpts, params, null),
|
|
398
397
|
...getComponentOns(renderOpts, params)
|
|
399
398
|
})
|
|
@@ -609,6 +608,62 @@ function handleExportTreeSelectMethod (params: any) {
|
|
|
609
608
|
return options.original ? getCellValue(row, column) : getTreeSelectCellValue(column.editRender || column.cellRender, params)
|
|
610
609
|
}
|
|
611
610
|
|
|
611
|
+
function handleNumberCell (renderOpts: VxeGlobalRendererHandles.RenderTableDefaultOptions, params: VxeGlobalRendererHandles.RenderTableDefaultParams) {
|
|
612
|
+
const { props = {}, showNegativeStatus } = renderOpts
|
|
613
|
+
const { row, column } = params
|
|
614
|
+
const { type } = props
|
|
615
|
+
let cellValue = XEUtils.get(row, column.field)
|
|
616
|
+
let isNegative = false
|
|
617
|
+
if (!isEmptyValue(cellValue)) {
|
|
618
|
+
const numberInputConfig = getConfig().numberInput || {}
|
|
619
|
+
if (type === 'float') {
|
|
620
|
+
const autoFill = handleDefaultValue(props.autoFill, numberInputConfig.autoFill, true)
|
|
621
|
+
const digits = handleDefaultValue(props.digits, numberInputConfig.digits, 1)
|
|
622
|
+
cellValue = XEUtils.toFixed(XEUtils.floor(cellValue, digits), digits)
|
|
623
|
+
if (!autoFill) {
|
|
624
|
+
cellValue = XEUtils.toNumber(cellValue)
|
|
625
|
+
}
|
|
626
|
+
if (showNegativeStatus) {
|
|
627
|
+
if (cellValue < 0) {
|
|
628
|
+
isNegative = true
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
} else if (type === 'amount') {
|
|
632
|
+
const autoFill = handleDefaultValue(props.autoFill, numberInputConfig.autoFill, true)
|
|
633
|
+
const digits = handleDefaultValue(props.digits, numberInputConfig.digits, 2)
|
|
634
|
+
const showCurrency = handleDefaultValue(props.showCurrency, numberInputConfig.showCurrency, false)
|
|
635
|
+
cellValue = XEUtils.toNumber(cellValue)
|
|
636
|
+
if (showNegativeStatus) {
|
|
637
|
+
if (cellValue < 0) {
|
|
638
|
+
isNegative = true
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
cellValue = XEUtils.commafy(cellValue, { digits })
|
|
642
|
+
if (!autoFill) {
|
|
643
|
+
const [iStr, dStr] = cellValue.split('.')
|
|
644
|
+
if (dStr) {
|
|
645
|
+
const dRest = dStr.replace(/0+$/, '')
|
|
646
|
+
cellValue = dRest ? [iStr, '.', dRest].join('') : iStr
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
if (showCurrency) {
|
|
650
|
+
cellValue = `${props.currencySymbol || numberInputConfig.currencySymbol || getI18n('vxe.numberInput.currencySymbol') || ''}${cellValue}`
|
|
651
|
+
}
|
|
652
|
+
} else {
|
|
653
|
+
if (showNegativeStatus) {
|
|
654
|
+
if (XEUtils.toNumber(cellValue) < 0) {
|
|
655
|
+
isNegative = true
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
return getCellLabelVNs(renderOpts, params, cellValue, isNegative
|
|
661
|
+
? {
|
|
662
|
+
class: 'is--negative'
|
|
663
|
+
}
|
|
664
|
+
: {})
|
|
665
|
+
}
|
|
666
|
+
|
|
612
667
|
/**
|
|
613
668
|
* 表格 - 渲染器
|
|
614
669
|
*/
|
|
@@ -674,64 +729,19 @@ renderer.mixin({
|
|
|
674
729
|
renderTableFilter: defaultFilterRender,
|
|
675
730
|
tableFilterDefaultMethod: handleInputFilterMethod
|
|
676
731
|
},
|
|
732
|
+
FormatNumberInput: {
|
|
733
|
+
renderTableDefault: handleNumberCell,
|
|
734
|
+
tableFilterDefaultMethod: handleInputFilterMethod,
|
|
735
|
+
tableExportMethod (params) {
|
|
736
|
+
const { row, column } = params
|
|
737
|
+
const cellValue = XEUtils.get(row, column.field)
|
|
738
|
+
return cellValue
|
|
739
|
+
}
|
|
740
|
+
},
|
|
677
741
|
VxeNumberInput: {
|
|
678
742
|
tableAutoFocus: 'input',
|
|
679
743
|
renderTableEdit: defaultEditRender,
|
|
680
|
-
renderTableCell
|
|
681
|
-
const { props = {}, showNegativeStatus } = renderOpts
|
|
682
|
-
const { row, column } = params
|
|
683
|
-
const { type } = props
|
|
684
|
-
let cellValue = XEUtils.get(row, column.field)
|
|
685
|
-
let isNegative = false
|
|
686
|
-
if (!isEmptyValue(cellValue)) {
|
|
687
|
-
const numberInputConfig = getConfig().numberInput || {}
|
|
688
|
-
if (type === 'float') {
|
|
689
|
-
const autoFill = handleDefaultValue(props.autoFill, numberInputConfig.autoFill, true)
|
|
690
|
-
const digits = handleDefaultValue(props.digits, numberInputConfig.digits, 1)
|
|
691
|
-
cellValue = XEUtils.toFixed(XEUtils.floor(cellValue, digits), digits)
|
|
692
|
-
if (!autoFill) {
|
|
693
|
-
cellValue = XEUtils.toNumber(cellValue)
|
|
694
|
-
}
|
|
695
|
-
if (showNegativeStatus) {
|
|
696
|
-
if (cellValue < 0) {
|
|
697
|
-
isNegative = true
|
|
698
|
-
}
|
|
699
|
-
}
|
|
700
|
-
} else if (type === 'amount') {
|
|
701
|
-
const autoFill = handleDefaultValue(props.autoFill, numberInputConfig.autoFill, true)
|
|
702
|
-
const digits = handleDefaultValue(props.digits, numberInputConfig.digits, 2)
|
|
703
|
-
const showCurrency = handleDefaultValue(props.showCurrency, numberInputConfig.showCurrency, false)
|
|
704
|
-
cellValue = XEUtils.toNumber(cellValue)
|
|
705
|
-
if (showNegativeStatus) {
|
|
706
|
-
if (cellValue < 0) {
|
|
707
|
-
isNegative = true
|
|
708
|
-
}
|
|
709
|
-
}
|
|
710
|
-
cellValue = XEUtils.commafy(cellValue, { digits })
|
|
711
|
-
if (!autoFill) {
|
|
712
|
-
const [iStr, dStr] = cellValue.split('.')
|
|
713
|
-
if (dStr) {
|
|
714
|
-
const dRest = dStr.replace(/0+$/, '')
|
|
715
|
-
cellValue = dRest ? [iStr, '.', dRest].join('') : iStr
|
|
716
|
-
}
|
|
717
|
-
}
|
|
718
|
-
if (showCurrency) {
|
|
719
|
-
cellValue = `${props.currencySymbol || numberInputConfig.currencySymbol || getI18n('vxe.numberInput.currencySymbol') || ''}${cellValue}`
|
|
720
|
-
}
|
|
721
|
-
} else {
|
|
722
|
-
if (showNegativeStatus) {
|
|
723
|
-
if (XEUtils.toNumber(cellValue) < 0) {
|
|
724
|
-
isNegative = true
|
|
725
|
-
}
|
|
726
|
-
}
|
|
727
|
-
}
|
|
728
|
-
}
|
|
729
|
-
return getCellLabelVNs(renderOpts, params, cellValue, isNegative
|
|
730
|
-
? {
|
|
731
|
-
class: 'is--negative'
|
|
732
|
-
}
|
|
733
|
-
: {})
|
|
734
|
-
},
|
|
744
|
+
renderTableCell: handleNumberCell,
|
|
735
745
|
renderTableFooter (renderOpts, params) {
|
|
736
746
|
const { props = {} } = renderOpts
|
|
737
747
|
const { row, column, _columnIndex } = params
|
|
@@ -841,11 +851,22 @@ renderer.mixin({
|
|
|
841
851
|
tableFilterDefaultMethod: handleFilterMethod,
|
|
842
852
|
tableExportMethod: handleExportSelectMethod
|
|
843
853
|
},
|
|
854
|
+
/**
|
|
855
|
+
* 已废弃,被 FormatSelect 替换
|
|
856
|
+
* @deprecated
|
|
857
|
+
*/
|
|
844
858
|
formatOption: {
|
|
845
859
|
renderTableDefault (renderOpts, params) {
|
|
846
860
|
return getCellLabelVNs(renderOpts, params, getSelectCellValue(renderOpts, params))
|
|
847
861
|
}
|
|
848
862
|
},
|
|
863
|
+
FormatSelect: {
|
|
864
|
+
renderTableDefault (renderOpts, params) {
|
|
865
|
+
return getCellLabelVNs(renderOpts, params, getSelectCellValue(renderOpts, params))
|
|
866
|
+
},
|
|
867
|
+
tableFilterDefaultMethod: handleFilterMethod,
|
|
868
|
+
tableExportMethod: handleExportSelectMethod
|
|
869
|
+
},
|
|
849
870
|
VxeTreeSelect: {
|
|
850
871
|
tableAutoFocus: 'input',
|
|
851
872
|
renderTableEdit: defaultTableOrTreeSelectEditRender,
|
|
@@ -854,11 +875,21 @@ renderer.mixin({
|
|
|
854
875
|
},
|
|
855
876
|
tableExportMethod: handleExportTreeSelectMethod
|
|
856
877
|
},
|
|
878
|
+
/**
|
|
879
|
+
* 已废弃,被 FormatTreeSelect 替换
|
|
880
|
+
* @deprecated
|
|
881
|
+
*/
|
|
857
882
|
formatTree: {
|
|
858
883
|
renderTableDefault (renderOpts, params) {
|
|
859
884
|
return getCellLabelVNs(renderOpts, params, getTreeSelectCellValue(renderOpts, params))
|
|
860
885
|
}
|
|
861
886
|
},
|
|
887
|
+
FormatTreeSelect: {
|
|
888
|
+
renderTableDefault (renderOpts, params) {
|
|
889
|
+
return getCellLabelVNs(renderOpts, params, getTreeSelectCellValue(renderOpts, params))
|
|
890
|
+
},
|
|
891
|
+
tableExportMethod: handleExportTreeSelectMethod
|
|
892
|
+
},
|
|
862
893
|
VxeTableSelect: {
|
|
863
894
|
tableAutoFocus: 'input',
|
|
864
895
|
renderTableEdit: defaultTableOrTreeSelectEditRender,
|
|
@@ -230,6 +230,7 @@ export default defineComponent({
|
|
|
230
230
|
tdOns.onDblclick = (evnt: MouseEvent) => {
|
|
231
231
|
$xeTable.triggerCellDblclickEvent(evnt, cellParams)
|
|
232
232
|
}
|
|
233
|
+
let isMergeCell = false
|
|
233
234
|
// 合并行或列
|
|
234
235
|
if (mergeList.length) {
|
|
235
236
|
const spanRest = mergeBodyMethod(mergeList, _rowIndex, _columnIndex)
|
|
@@ -239,9 +240,11 @@ export default defineComponent({
|
|
|
239
240
|
return null
|
|
240
241
|
}
|
|
241
242
|
if (rowspan > 1) {
|
|
243
|
+
isMergeCell = true
|
|
242
244
|
tdAttrs.rowspan = rowspan
|
|
243
245
|
}
|
|
244
246
|
if (colspan > 1) {
|
|
247
|
+
isMergeCell = true
|
|
245
248
|
tdAttrs.colspan = colspan
|
|
246
249
|
}
|
|
247
250
|
}
|
|
@@ -276,11 +279,13 @@ export default defineComponent({
|
|
|
276
279
|
const isAutoCellWidth = !column.resizeWidth && (column.minWidth === 'auto' || column.width === 'auto')
|
|
277
280
|
|
|
278
281
|
let isVNPreEmptyStatus = false
|
|
279
|
-
if (!
|
|
280
|
-
if (
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
282
|
+
if (!isMergeCell) {
|
|
283
|
+
if (!dragRow || getRowid($xeTable, dragRow) !== rowid) {
|
|
284
|
+
if (scrollYLoad && (_rowIndex < scrollYStore.visibleStartIndex - scrollYStore.preloadSize || _rowIndex > scrollYStore.visibleEndIndex + scrollYStore.preloadSize)) {
|
|
285
|
+
isVNPreEmptyStatus = true
|
|
286
|
+
} else if (scrollXLoad && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex - scrollXStore.preloadSize || _columnIndex > scrollXStore.visibleEndIndex + scrollXStore.preloadSize)) {
|
|
287
|
+
isVNPreEmptyStatus = true
|
|
288
|
+
}
|
|
284
289
|
}
|
|
285
290
|
}
|
|
286
291
|
|
|
@@ -657,7 +662,7 @@ export default defineComponent({
|
|
|
657
662
|
}
|
|
658
663
|
}
|
|
659
664
|
|
|
660
|
-
if (fixedType || !overflowX) {
|
|
665
|
+
if (!isColLoading && (fixedType || !overflowX)) {
|
|
661
666
|
renderColumnList = visibleColumn
|
|
662
667
|
}
|
|
663
668
|
|
|
@@ -598,7 +598,8 @@ export const Cell = {
|
|
|
598
598
|
const headerSlot = slots ? slots.header : null
|
|
599
599
|
const titleSlot = slots ? slots.title : null
|
|
600
600
|
const checkboxOpts = computeCheckboxOpts.value
|
|
601
|
-
const headerTitle =
|
|
601
|
+
const { checkStrictly, showHeader, headerTitle } = checkboxOpts
|
|
602
|
+
const colTitle = column.getTitle()
|
|
602
603
|
const ons: Record<string, any> = {}
|
|
603
604
|
if (!isHidden) {
|
|
604
605
|
ons.onClick = (evnt: MouseEvent) => {
|
|
@@ -611,11 +612,11 @@ export const Cell = {
|
|
|
611
612
|
if (headerSlot) {
|
|
612
613
|
return renderHeaderCellBaseVNs(params, renderTitleContent(checkboxParams, $table.callSlot(headerSlot, checkboxParams)))
|
|
613
614
|
}
|
|
614
|
-
if (
|
|
615
|
+
if (checkStrictly ? !showHeader : showHeader === false) {
|
|
615
616
|
return renderHeaderCellBaseVNs(params, renderTitleContent(checkboxParams, [
|
|
616
617
|
h('span', {
|
|
617
618
|
class: 'vxe-checkbox--label'
|
|
618
|
-
}, titleSlot ? $table.callSlot(titleSlot, checkboxParams) :
|
|
619
|
+
}, titleSlot ? $table.callSlot(titleSlot, checkboxParams) : colTitle)
|
|
619
620
|
]))
|
|
620
621
|
}
|
|
621
622
|
return renderHeaderCellBaseVNs(params,
|
|
@@ -626,17 +627,17 @@ export const Cell = {
|
|
|
626
627
|
'is--disabled': isAllCheckboxDisabled,
|
|
627
628
|
'is--indeterminate': isAllCheckboxIndeterminate
|
|
628
629
|
}],
|
|
629
|
-
title: getI18n('vxe.table.allTitle')
|
|
630
|
+
title: XEUtils.eqNull(headerTitle) ? getI18n('vxe.table.allTitle') : `${headerTitle || ''}`,
|
|
630
631
|
...ons
|
|
631
632
|
}, [
|
|
632
633
|
h('span', {
|
|
633
634
|
class: ['vxe-checkbox--icon', isAllCheckboxIndeterminate ? getIcon().TABLE_CHECKBOX_INDETERMINATE : (isAllCheckboxSelected ? getIcon().TABLE_CHECKBOX_CHECKED : getIcon().TABLE_CHECKBOX_UNCHECKED)]
|
|
634
635
|
})
|
|
635
|
-
].concat(titleSlot ||
|
|
636
|
+
].concat(titleSlot || colTitle
|
|
636
637
|
? [
|
|
637
638
|
h('span', {
|
|
638
639
|
class: 'vxe-checkbox--label'
|
|
639
|
-
}, titleSlot ? $table.callSlot(titleSlot, checkboxParams) :
|
|
640
|
+
}, titleSlot ? $table.callSlot(titleSlot, checkboxParams) : colTitle)
|
|
640
641
|
]
|
|
641
642
|
: []))
|
|
642
643
|
])
|
|
@@ -889,7 +890,7 @@ export const Cell = {
|
|
|
889
890
|
const { $table, column } = params
|
|
890
891
|
const { computeSortOpts } = $table.getComputeMaps()
|
|
891
892
|
const sortOpts = computeSortOpts.value
|
|
892
|
-
const { showIcon, allowBtn, iconLayout, iconAsc, iconDesc, iconVisibleMethod } = sortOpts
|
|
893
|
+
const { showIcon, allowBtn, ascTitle, descTitle, iconLayout, iconAsc, iconDesc, iconVisibleMethod } = sortOpts
|
|
893
894
|
const { order } = column
|
|
894
895
|
if (showIcon && (!iconVisibleMethod || iconVisibleMethod(params))) {
|
|
895
896
|
return [
|
|
@@ -900,7 +901,7 @@ export const Cell = {
|
|
|
900
901
|
class: ['vxe-sort--asc-btn', iconAsc || getIcon().TABLE_SORT_ASC, {
|
|
901
902
|
'sort--active': order === 'asc'
|
|
902
903
|
}],
|
|
903
|
-
title: getI18n('vxe.table.sortAsc')
|
|
904
|
+
title: XEUtils.eqNull(ascTitle) ? getI18n('vxe.table.sortAsc') : `${ascTitle || ''}`,
|
|
904
905
|
onClick: allowBtn
|
|
905
906
|
? (evnt: Event) => {
|
|
906
907
|
evnt.stopPropagation()
|
|
@@ -912,7 +913,7 @@ export const Cell = {
|
|
|
912
913
|
class: ['vxe-sort--desc-btn', iconDesc || getIcon().TABLE_SORT_DESC, {
|
|
913
914
|
'sort--active': order === 'desc'
|
|
914
915
|
}],
|
|
915
|
-
title: getI18n('vxe.table.sortDesc')
|
|
916
|
+
title: XEUtils.eqNull(descTitle) ? getI18n('vxe.table.sortDesc') : `${descTitle || ''}`,
|
|
916
917
|
onClick: allowBtn
|
|
917
918
|
? (evnt: Event) => {
|
|
918
919
|
evnt.stopPropagation()
|
|
@@ -137,6 +137,7 @@ export default defineComponent({
|
|
|
137
137
|
tfOns.onDblclick = (evnt: MouseEvent) => {
|
|
138
138
|
$xeTable.dispatchEvent('footer-cell-dblclick', Object.assign({ cell: evnt.currentTarget }, cellParams), evnt)
|
|
139
139
|
}
|
|
140
|
+
let isMergeCell = false
|
|
140
141
|
// 合并行或列
|
|
141
142
|
if (mergeFooterList.length) {
|
|
142
143
|
const spanRest = mergeFooterMethod(mergeFooterList, _rowIndex, _columnIndex)
|
|
@@ -146,9 +147,11 @@ export default defineComponent({
|
|
|
146
147
|
return null
|
|
147
148
|
}
|
|
148
149
|
if (rowspan > 1) {
|
|
150
|
+
isMergeCell = true
|
|
149
151
|
attrs.rowspan = rowspan
|
|
150
152
|
}
|
|
151
153
|
if (colspan > 1) {
|
|
154
|
+
isMergeCell = true
|
|
152
155
|
attrs.colspan = colspan
|
|
153
156
|
}
|
|
154
157
|
}
|
|
@@ -169,8 +172,10 @@ export default defineComponent({
|
|
|
169
172
|
const isAutoCellWidth = !column.resizeWidth && (column.minWidth === 'auto' || column.width === 'auto')
|
|
170
173
|
|
|
171
174
|
let isVNPreEmptyStatus = false
|
|
172
|
-
if (
|
|
173
|
-
|
|
175
|
+
if (!isMergeCell) {
|
|
176
|
+
if (scrollXLoad && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex - scrollXStore.preloadSize || _columnIndex > scrollXStore.visibleEndIndex + scrollXStore.preloadSize)) {
|
|
177
|
+
isVNPreEmptyStatus = true
|
|
178
|
+
}
|
|
174
179
|
}
|
|
175
180
|
|
|
176
181
|
const tcStyle: Record<string, string> = {}
|
|
@@ -267,7 +272,7 @@ export default defineComponent({
|
|
|
267
272
|
const { fixedType, fixedColumn, tableColumn } = props
|
|
268
273
|
const { spanMethod, footerSpanMethod, showFooterOverflow: allColumnFooterOverflow } = tableProps
|
|
269
274
|
const { visibleColumn, fullColumnIdData } = tableInternalData
|
|
270
|
-
const { isGroup, overflowX, scrollXLoad, scrollYLoad, dragCol } = tableReactData
|
|
275
|
+
const { isGroup, isColLoading, overflowX, scrollXLoad, scrollYLoad, dragCol } = tableReactData
|
|
271
276
|
|
|
272
277
|
let renderColumnList = tableColumn
|
|
273
278
|
let isOptimizeMode = false
|
|
@@ -280,7 +285,7 @@ export default defineComponent({
|
|
|
280
285
|
}
|
|
281
286
|
}
|
|
282
287
|
|
|
283
|
-
if (fixedType || !overflowX) {
|
|
288
|
+
if (!isColLoading && (fixedType || !overflowX)) {
|
|
284
289
|
renderColumnList = visibleColumn
|
|
285
290
|
}
|
|
286
291
|
|
|
@@ -223,7 +223,7 @@ export default defineComponent({
|
|
|
223
223
|
const renderVN = () => {
|
|
224
224
|
const { fixedType, fixedColumn, tableColumn } = props
|
|
225
225
|
const { mouseConfig, showHeaderOverflow: allColumnHeaderOverflow, spanMethod, footerSpanMethod } = tableProps
|
|
226
|
-
const { isGroup, overflowX, scrollXLoad, scrollYLoad, dragCol } = tableReactData
|
|
226
|
+
const { isGroup, isColLoading, overflowX, scrollXLoad, scrollYLoad, dragCol } = tableReactData
|
|
227
227
|
const { visibleColumn, fullColumnIdData } = tableInternalData
|
|
228
228
|
|
|
229
229
|
const mouseOpts = computeMouseOpts.value
|
|
@@ -243,7 +243,7 @@ export default defineComponent({
|
|
|
243
243
|
}
|
|
244
244
|
}
|
|
245
245
|
|
|
246
|
-
if (fixedType || !overflowX) {
|
|
246
|
+
if (!isColLoading && (fixedType || !overflowX)) {
|
|
247
247
|
renderColumnList = visibleColumn
|
|
248
248
|
}
|
|
249
249
|
|
|
@@ -188,6 +188,8 @@ export default {
|
|
|
188
188
|
resizeConfig: Object as PropType<VxeTablePropTypes.ResizeConfig>,
|
|
189
189
|
// 列配置信息
|
|
190
190
|
columnConfig: Object as PropType<VxeTablePropTypes.ColumnConfig>,
|
|
191
|
+
// 当前列配置信息
|
|
192
|
+
currentColumnConfig: Object as PropType<VxeTablePropTypes.CurrentColumnConfig>,
|
|
191
193
|
// 单元格配置信息
|
|
192
194
|
cellConfig: Object as PropType<VxeTablePropTypes.CellConfig>,
|
|
193
195
|
// 表头单元格配置信息
|
|
@@ -196,6 +198,8 @@ export default {
|
|
|
196
198
|
footerCellConfig: Object as PropType<VxeTablePropTypes.FooterCellConfig>,
|
|
197
199
|
// 行配置信息
|
|
198
200
|
rowConfig: Object as PropType<VxeTablePropTypes.RowConfig>,
|
|
201
|
+
// 当前行配置信息
|
|
202
|
+
currentRowConfig: Object as PropType<VxeTablePropTypes.CurrentRowConfig>,
|
|
199
203
|
// 已废弃,被 rowDragConfig 替换
|
|
200
204
|
dragConfig: Object as PropType<VxeTablePropTypes.DragConfig>,
|
|
201
205
|
// 行拖拽排序配置项
|