vxe-table 4.12.0-beta.0 → 4.12.0-beta.10
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 +70 -76
- package/es/locale/lang/ar-EG.js +3 -0
- package/es/locale/lang/de-DE.js +3 -0
- package/es/locale/lang/en-US.js +3 -0
- package/es/locale/lang/es-ES.js +3 -0
- package/es/locale/lang/fr-FR.js +3 -0
- package/es/locale/lang/hu-HU.js +3 -0
- package/es/locale/lang/hy-AM.js +3 -0
- package/es/locale/lang/id-ID.js +3 -0
- package/es/locale/lang/it-IT.js +3 -0
- package/es/locale/lang/ja-JP.js +3 -0
- package/es/locale/lang/ko-KR.js +3 -0
- package/es/locale/lang/nb-NO.js +3 -0
- package/es/locale/lang/pt-BR.js +3 -0
- package/es/locale/lang/ru-RU.js +3 -0
- package/es/locale/lang/th-TH.js +3 -0
- package/es/locale/lang/ug-CN.js +3 -0
- package/es/locale/lang/uk-UA.js +3 -0
- package/es/locale/lang/vi-VN.js +3 -0
- package/es/locale/lang/zh-CHT.js +3 -0
- package/es/locale/lang/zh-CN.js +3 -0
- package/es/style.css +1 -1
- package/es/table/module/custom/panel.js +19 -21
- package/es/table/module/edit/hook.js +1 -1
- package/es/table/module/export/export-panel.js +17 -19
- package/es/table/module/export/hook.js +5 -11
- package/es/table/module/export/import-panel.js +11 -13
- package/es/table/module/keyboard/hook.js +49 -6
- package/es/table/module/validator/hook.js +1 -3
- package/es/table/render/index.js +90 -61
- package/es/table/src/body.js +13 -8
- package/es/table/src/columnInfo.js +26 -28
- package/es/table/src/footer.js +7 -2
- package/es/table/src/props.js +4 -0
- package/es/table/src/table.js +374 -191
- package/es/table/src/util.js +30 -3
- package/es/toolbar/src/toolbar.js +16 -24
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/grid/src/grid.js +67 -82
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.umd.js +1276 -12214
- package/lib/index.umd.min.js +1 -1
- package/lib/locale/lang/ar-EG.js +3 -0
- package/lib/locale/lang/ar-EG.min.js +1 -1
- package/lib/locale/lang/de-DE.js +3 -0
- package/lib/locale/lang/de-DE.min.js +1 -1
- package/lib/locale/lang/en-US.js +3 -0
- package/lib/locale/lang/en-US.min.js +1 -1
- package/lib/locale/lang/en-US.umd.js +3 -0
- package/lib/locale/lang/es-ES.js +3 -0
- package/lib/locale/lang/es-ES.min.js +1 -1
- package/lib/locale/lang/es-ES.umd.js +3 -0
- package/lib/locale/lang/fr-FR.js +3 -0
- package/lib/locale/lang/fr-FR.min.js +1 -1
- package/lib/locale/lang/hu-HU.js +3 -0
- package/lib/locale/lang/hu-HU.min.js +1 -1
- package/lib/locale/lang/hu-HU.umd.js +3 -0
- package/lib/locale/lang/hy-AM.js +3 -0
- package/lib/locale/lang/hy-AM.min.js +1 -1
- package/lib/locale/lang/id-ID.js +3 -0
- package/lib/locale/lang/id-ID.min.js +1 -1
- package/lib/locale/lang/it-IT.js +3 -0
- package/lib/locale/lang/it-IT.min.js +1 -1
- package/lib/locale/lang/ja-JP.js +3 -0
- package/lib/locale/lang/ja-JP.min.js +1 -1
- package/lib/locale/lang/ja-JP.umd.js +3 -0
- package/lib/locale/lang/ko-KR.js +3 -0
- package/lib/locale/lang/ko-KR.min.js +1 -1
- package/lib/locale/lang/ko-KR.umd.js +3 -0
- package/lib/locale/lang/nb-NO.js +3 -0
- package/lib/locale/lang/nb-NO.min.js +1 -1
- package/lib/locale/lang/pt-BR.js +3 -0
- package/lib/locale/lang/pt-BR.min.js +1 -1
- package/lib/locale/lang/pt-BR.umd.js +3 -0
- package/lib/locale/lang/ru-RU.js +3 -0
- package/lib/locale/lang/ru-RU.min.js +1 -1
- package/lib/locale/lang/ru-RU.umd.js +3 -0
- package/lib/locale/lang/th-TH.js +3 -0
- package/lib/locale/lang/th-TH.min.js +1 -1
- package/lib/locale/lang/ug-CN.js +3 -0
- package/lib/locale/lang/ug-CN.min.js +1 -1
- package/lib/locale/lang/uk-UA.js +3 -0
- package/lib/locale/lang/uk-UA.min.js +1 -1
- package/lib/locale/lang/uk-UA.umd.js +3 -0
- package/lib/locale/lang/vi-VN.js +3 -0
- package/lib/locale/lang/vi-VN.min.js +1 -1
- package/lib/locale/lang/zh-CHT.js +3 -0
- package/lib/locale/lang/zh-CHT.min.js +1 -1
- package/lib/locale/lang/zh-CN.js +3 -0
- package/lib/locale/lang/zh-CN.min.js +1 -1
- package/lib/locale/lang/zh-CN.umd.js +3 -0
- package/lib/style.css +1 -1
- package/lib/table/module/custom/panel.js +21 -23
- package/lib/table/module/custom/panel.min.js +1 -1
- package/lib/table/module/edit/hook.js +1 -1
- package/lib/table/module/edit/hook.min.js +1 -1
- package/lib/table/module/export/export-panel.js +17 -19
- package/lib/table/module/export/export-panel.min.js +1 -1
- package/lib/table/module/export/hook.js +5 -11
- package/lib/table/module/export/hook.min.js +1 -1
- package/lib/table/module/export/import-panel.js +11 -13
- package/lib/table/module/export/import-panel.min.js +1 -1
- package/lib/table/module/keyboard/hook.js +53 -6
- package/lib/table/module/keyboard/hook.min.js +1 -1
- package/lib/table/module/validator/hook.js +1 -3
- package/lib/table/module/validator/hook.min.js +1 -1
- package/lib/table/render/index.js +98 -66
- package/lib/table/render/index.min.js +1 -1
- package/lib/table/src/body.js +12 -6
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/columnInfo.js +30 -32
- package/lib/table/src/columnInfo.min.js +1 -1
- package/lib/table/src/footer.js +7 -2
- package/lib/table/src/footer.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 +409 -189
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +35 -6
- package/lib/table/src/util.min.js +1 -1
- package/lib/toolbar/src/toolbar.js +16 -24
- package/lib/toolbar/src/toolbar.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 +75 -82
- package/packages/locale/lang/ar-EG.ts +3 -0
- package/packages/locale/lang/de-DE.ts +3 -0
- package/packages/locale/lang/en-US.ts +3 -0
- package/packages/locale/lang/es-ES.ts +3 -0
- package/packages/locale/lang/fr-FR.ts +3 -0
- package/packages/locale/lang/hu-HU.ts +3 -0
- package/packages/locale/lang/hy-AM.ts +3 -0
- package/packages/locale/lang/id-ID.ts +3 -0
- package/packages/locale/lang/it-IT.ts +3 -0
- package/packages/locale/lang/ja-JP.ts +3 -0
- package/packages/locale/lang/ko-KR.ts +3 -0
- package/packages/locale/lang/nb-NO.ts +3 -0
- package/packages/locale/lang/pt-BR.ts +3 -0
- package/packages/locale/lang/ru-RU.ts +3 -0
- package/packages/locale/lang/th-TH.ts +3 -0
- package/packages/locale/lang/ug-CN.ts +3 -0
- package/packages/locale/lang/uk-UA.ts +3 -0
- package/packages/locale/lang/vi-VN.ts +3 -0
- package/packages/locale/lang/zh-CHT.ts +3 -0
- package/packages/locale/lang/zh-CN.ts +3 -0
- package/packages/table/module/custom/panel.ts +19 -21
- package/packages/table/module/edit/hook.ts +1 -1
- package/packages/table/module/export/export-panel.ts +17 -19
- package/packages/table/module/export/hook.ts +5 -11
- package/packages/table/module/export/import-panel.ts +11 -13
- package/packages/table/module/keyboard/hook.ts +49 -8
- package/packages/table/module/validator/hook.ts +1 -3
- package/packages/table/render/index.ts +89 -59
- package/packages/table/src/body.ts +12 -7
- package/packages/table/src/columnInfo.ts +26 -28
- package/packages/table/src/footer.ts +7 -2
- package/packages/table/src/props.ts +4 -0
- package/packages/table/src/table.ts +380 -189
- package/packages/table/src/util.ts +34 -3
- package/packages/toolbar/src/toolbar.ts +16 -24
- /package/es/{iconfont.1740732137800.ttf → iconfont.1741664494856.ttf} +0 -0
- /package/es/{iconfont.1740732137800.woff → iconfont.1741664494856.woff} +0 -0
- /package/es/{iconfont.1740732137800.woff2 → iconfont.1741664494856.woff2} +0 -0
- /package/lib/{iconfont.1740732137800.ttf → iconfont.1741664494856.ttf} +0 -0
- /package/lib/{iconfont.1740732137800.woff → iconfont.1741664494856.woff} +0 -0
- /package/lib/{iconfont.1740732137800.woff2 → iconfont.1741664494856.woff2} +0 -0
|
@@ -956,9 +956,7 @@ hooks.add('tableExportModule', {
|
|
|
956
956
|
}
|
|
957
957
|
} else {
|
|
958
958
|
// 不支持的浏览器
|
|
959
|
-
|
|
960
|
-
errLog('vxe.error.notExp')
|
|
961
|
-
}
|
|
959
|
+
errLog('vxe.error.notExp')
|
|
962
960
|
_importResolve({ status: true })
|
|
963
961
|
}
|
|
964
962
|
})
|
|
@@ -1572,10 +1570,8 @@ hooks.add('tableExportModule', {
|
|
|
1572
1570
|
message: true,
|
|
1573
1571
|
types: XEUtils.keys(exportOpts._typeMaps)
|
|
1574
1572
|
}, exportOpts, options)
|
|
1575
|
-
if (
|
|
1576
|
-
|
|
1577
|
-
errLog('vxe.error.reqProp', ['export-config'])
|
|
1578
|
-
}
|
|
1573
|
+
if (!props.exportConfig) {
|
|
1574
|
+
errLog('vxe.error.reqProp', ['export-config'])
|
|
1579
1575
|
}
|
|
1580
1576
|
handleExportAndPrint(defOpts)
|
|
1581
1577
|
},
|
|
@@ -1585,10 +1581,8 @@ hooks.add('tableExportModule', {
|
|
|
1585
1581
|
const defOpts = Object.assign({
|
|
1586
1582
|
message: true
|
|
1587
1583
|
}, printOpts, options)
|
|
1588
|
-
if (
|
|
1589
|
-
|
|
1590
|
-
errLog('vxe.error.reqProp', ['print-config'])
|
|
1591
|
-
}
|
|
1584
|
+
if (!props.printConfig) {
|
|
1585
|
+
errLog('vxe.error.reqProp', ['print-config'])
|
|
1592
1586
|
}
|
|
1593
1587
|
handleExportAndPrint(defOpts, true)
|
|
1594
1588
|
}
|
|
@@ -238,19 +238,17 @@ export default defineComponent({
|
|
|
238
238
|
: createCommentVNode()
|
|
239
239
|
}
|
|
240
240
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
})
|
|
253
|
-
}
|
|
241
|
+
nextTick(() => {
|
|
242
|
+
if (!VxeUIModalComponent) {
|
|
243
|
+
errLog('vxe.error.reqComp', ['vxe-modal'])
|
|
244
|
+
}
|
|
245
|
+
if (!VxeUIButtonComponent) {
|
|
246
|
+
errLog('vxe.error.reqComp', ['vxe-button'])
|
|
247
|
+
}
|
|
248
|
+
if (!VxeUISelectComponent) {
|
|
249
|
+
errLog('vxe.error.reqComp', ['vxe-select'])
|
|
250
|
+
}
|
|
251
|
+
})
|
|
254
252
|
|
|
255
253
|
return renderVN
|
|
256
254
|
}
|
|
@@ -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
|
|
@@ -262,8 +262,8 @@ hooks.add('tableKeyboardModule', {
|
|
|
262
262
|
const checkboxOpts = computeCheckboxOpts.value
|
|
263
263
|
const mouseOpts = computeMouseOpts.value
|
|
264
264
|
const editOpts = computeEditOpts.value
|
|
265
|
-
if (mouseConfig && mouseOpts.area && $xeTable.
|
|
266
|
-
return $xeTable.
|
|
265
|
+
if (mouseConfig && mouseOpts.area && $xeTable.handleCellAreaMousedownEvent) {
|
|
266
|
+
return $xeTable.handleCellAreaMousedownEvent(evnt, params)
|
|
267
267
|
} else {
|
|
268
268
|
if (checkboxConfig && checkboxOpts.range) {
|
|
269
269
|
handleCheckboxRangeEvent(evnt, params)
|
|
@@ -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
|
|
@@ -419,9 +419,7 @@ hooks.add('tableValidatorModule', {
|
|
|
419
419
|
}
|
|
420
420
|
}
|
|
421
421
|
} else {
|
|
422
|
-
|
|
423
|
-
errLog('vxe.error.notValidators', [validator])
|
|
424
|
-
}
|
|
422
|
+
errLog('vxe.error.notValidators', [validator])
|
|
425
423
|
}
|
|
426
424
|
} else {
|
|
427
425
|
customValid = validator(validParams)
|
|
@@ -185,10 +185,8 @@ function getComponentOns (renderOpts: any, params: any, eFns?: {
|
|
|
185
185
|
const ons: any = {}
|
|
186
186
|
XEUtils.objectEach(events, (func, key: any) => {
|
|
187
187
|
ons[getOnName(key)] = function (...args: any[]) {
|
|
188
|
-
if (
|
|
189
|
-
|
|
190
|
-
errLog('vxe.error.errFunc', [func])
|
|
191
|
-
}
|
|
188
|
+
if (!XEUtils.isFunction(func)) {
|
|
189
|
+
errLog('vxe.error.errFunc', [func])
|
|
192
190
|
}
|
|
193
191
|
func(params, ...args)
|
|
194
192
|
}
|
|
@@ -611,6 +609,62 @@ function handleExportTreeSelectMethod (params: any) {
|
|
|
611
609
|
return options.original ? getCellValue(row, column) : getTreeSelectCellValue(column.editRender || column.cellRender, params)
|
|
612
610
|
}
|
|
613
611
|
|
|
612
|
+
function handleNumberCell (renderOpts: VxeGlobalRendererHandles.RenderTableDefaultOptions, params: VxeGlobalRendererHandles.RenderTableDefaultParams) {
|
|
613
|
+
const { props = {}, showNegativeStatus } = renderOpts
|
|
614
|
+
const { row, column } = params
|
|
615
|
+
const { type } = props
|
|
616
|
+
let cellValue = XEUtils.get(row, column.field)
|
|
617
|
+
let isNegative = false
|
|
618
|
+
if (!isEmptyValue(cellValue)) {
|
|
619
|
+
const numberInputConfig = getConfig().numberInput || {}
|
|
620
|
+
if (type === 'float') {
|
|
621
|
+
const autoFill = handleDefaultValue(props.autoFill, numberInputConfig.autoFill, true)
|
|
622
|
+
const digits = handleDefaultValue(props.digits, numberInputConfig.digits, 1)
|
|
623
|
+
cellValue = XEUtils.toFixed(XEUtils.floor(cellValue, digits), digits)
|
|
624
|
+
if (!autoFill) {
|
|
625
|
+
cellValue = XEUtils.toNumber(cellValue)
|
|
626
|
+
}
|
|
627
|
+
if (showNegativeStatus) {
|
|
628
|
+
if (cellValue < 0) {
|
|
629
|
+
isNegative = true
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
} else if (type === 'amount') {
|
|
633
|
+
const autoFill = handleDefaultValue(props.autoFill, numberInputConfig.autoFill, true)
|
|
634
|
+
const digits = handleDefaultValue(props.digits, numberInputConfig.digits, 2)
|
|
635
|
+
const showCurrency = handleDefaultValue(props.showCurrency, numberInputConfig.showCurrency, false)
|
|
636
|
+
cellValue = XEUtils.toNumber(cellValue)
|
|
637
|
+
if (showNegativeStatus) {
|
|
638
|
+
if (cellValue < 0) {
|
|
639
|
+
isNegative = true
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
cellValue = XEUtils.commafy(cellValue, { digits })
|
|
643
|
+
if (!autoFill) {
|
|
644
|
+
const [iStr, dStr] = cellValue.split('.')
|
|
645
|
+
if (dStr) {
|
|
646
|
+
const dRest = dStr.replace(/0+$/, '')
|
|
647
|
+
cellValue = dRest ? [iStr, '.', dRest].join('') : iStr
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
if (showCurrency) {
|
|
651
|
+
cellValue = `${props.currencySymbol || numberInputConfig.currencySymbol || getI18n('vxe.numberInput.currencySymbol') || ''}${cellValue}`
|
|
652
|
+
}
|
|
653
|
+
} else {
|
|
654
|
+
if (showNegativeStatus) {
|
|
655
|
+
if (XEUtils.toNumber(cellValue) < 0) {
|
|
656
|
+
isNegative = true
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
return getCellLabelVNs(renderOpts, params, cellValue, isNegative
|
|
662
|
+
? {
|
|
663
|
+
class: 'is--negative'
|
|
664
|
+
}
|
|
665
|
+
: {})
|
|
666
|
+
}
|
|
667
|
+
|
|
614
668
|
/**
|
|
615
669
|
* 表格 - 渲染器
|
|
616
670
|
*/
|
|
@@ -676,64 +730,19 @@ renderer.mixin({
|
|
|
676
730
|
renderTableFilter: defaultFilterRender,
|
|
677
731
|
tableFilterDefaultMethod: handleInputFilterMethod
|
|
678
732
|
},
|
|
733
|
+
FormatNumberInput: {
|
|
734
|
+
renderTableDefault: handleNumberCell,
|
|
735
|
+
tableFilterDefaultMethod: handleInputFilterMethod,
|
|
736
|
+
tableExportMethod (params) {
|
|
737
|
+
const { row, column } = params
|
|
738
|
+
const cellValue = XEUtils.get(row, column.field)
|
|
739
|
+
return cellValue
|
|
740
|
+
}
|
|
741
|
+
},
|
|
679
742
|
VxeNumberInput: {
|
|
680
743
|
tableAutoFocus: 'input',
|
|
681
744
|
renderTableEdit: defaultEditRender,
|
|
682
|
-
renderTableCell
|
|
683
|
-
const { props = {}, showNegativeStatus } = renderOpts
|
|
684
|
-
const { row, column } = params
|
|
685
|
-
const { type } = props
|
|
686
|
-
let cellValue = XEUtils.get(row, column.field)
|
|
687
|
-
let isNegative = false
|
|
688
|
-
if (!isEmptyValue(cellValue)) {
|
|
689
|
-
const numberInputConfig = getConfig().numberInput || {}
|
|
690
|
-
if (type === 'float') {
|
|
691
|
-
const autoFill = handleDefaultValue(props.autoFill, numberInputConfig.autoFill, true)
|
|
692
|
-
const digits = handleDefaultValue(props.digits, numberInputConfig.digits, 1)
|
|
693
|
-
cellValue = XEUtils.toFixed(XEUtils.floor(cellValue, digits), digits)
|
|
694
|
-
if (!autoFill) {
|
|
695
|
-
cellValue = XEUtils.toNumber(cellValue)
|
|
696
|
-
}
|
|
697
|
-
if (showNegativeStatus) {
|
|
698
|
-
if (cellValue < 0) {
|
|
699
|
-
isNegative = true
|
|
700
|
-
}
|
|
701
|
-
}
|
|
702
|
-
} else if (type === 'amount') {
|
|
703
|
-
const autoFill = handleDefaultValue(props.autoFill, numberInputConfig.autoFill, true)
|
|
704
|
-
const digits = handleDefaultValue(props.digits, numberInputConfig.digits, 2)
|
|
705
|
-
const showCurrency = handleDefaultValue(props.showCurrency, numberInputConfig.showCurrency, false)
|
|
706
|
-
cellValue = XEUtils.toNumber(cellValue)
|
|
707
|
-
if (showNegativeStatus) {
|
|
708
|
-
if (cellValue < 0) {
|
|
709
|
-
isNegative = true
|
|
710
|
-
}
|
|
711
|
-
}
|
|
712
|
-
cellValue = XEUtils.commafy(cellValue, { digits })
|
|
713
|
-
if (!autoFill) {
|
|
714
|
-
const [iStr, dStr] = cellValue.split('.')
|
|
715
|
-
if (dStr) {
|
|
716
|
-
const dRest = dStr.replace(/0+$/, '')
|
|
717
|
-
cellValue = dRest ? [iStr, '.', dRest].join('') : iStr
|
|
718
|
-
}
|
|
719
|
-
}
|
|
720
|
-
if (showCurrency) {
|
|
721
|
-
cellValue = `${props.currencySymbol || numberInputConfig.currencySymbol || getI18n('vxe.numberInput.currencySymbol') || ''}${cellValue}`
|
|
722
|
-
}
|
|
723
|
-
} else {
|
|
724
|
-
if (showNegativeStatus) {
|
|
725
|
-
if (XEUtils.toNumber(cellValue) < 0) {
|
|
726
|
-
isNegative = true
|
|
727
|
-
}
|
|
728
|
-
}
|
|
729
|
-
}
|
|
730
|
-
}
|
|
731
|
-
return getCellLabelVNs(renderOpts, params, cellValue, isNegative
|
|
732
|
-
? {
|
|
733
|
-
class: 'is--negative'
|
|
734
|
-
}
|
|
735
|
-
: {})
|
|
736
|
-
},
|
|
745
|
+
renderTableCell: handleNumberCell,
|
|
737
746
|
renderTableFooter (renderOpts, params) {
|
|
738
747
|
const { props = {} } = renderOpts
|
|
739
748
|
const { row, column, _columnIndex } = params
|
|
@@ -843,11 +852,22 @@ renderer.mixin({
|
|
|
843
852
|
tableFilterDefaultMethod: handleFilterMethod,
|
|
844
853
|
tableExportMethod: handleExportSelectMethod
|
|
845
854
|
},
|
|
855
|
+
/**
|
|
856
|
+
* 已废弃,被 FormatSelect 替换
|
|
857
|
+
* @deprecated
|
|
858
|
+
*/
|
|
846
859
|
formatOption: {
|
|
847
860
|
renderTableDefault (renderOpts, params) {
|
|
848
861
|
return getCellLabelVNs(renderOpts, params, getSelectCellValue(renderOpts, params))
|
|
849
862
|
}
|
|
850
863
|
},
|
|
864
|
+
FormatSelect: {
|
|
865
|
+
renderTableDefault (renderOpts, params) {
|
|
866
|
+
return getCellLabelVNs(renderOpts, params, getSelectCellValue(renderOpts, params))
|
|
867
|
+
},
|
|
868
|
+
tableFilterDefaultMethod: handleFilterMethod,
|
|
869
|
+
tableExportMethod: handleExportSelectMethod
|
|
870
|
+
},
|
|
851
871
|
VxeTreeSelect: {
|
|
852
872
|
tableAutoFocus: 'input',
|
|
853
873
|
renderTableEdit: defaultTableOrTreeSelectEditRender,
|
|
@@ -856,11 +876,21 @@ renderer.mixin({
|
|
|
856
876
|
},
|
|
857
877
|
tableExportMethod: handleExportTreeSelectMethod
|
|
858
878
|
},
|
|
879
|
+
/**
|
|
880
|
+
* 已废弃,被 FormatTreeSelect 替换
|
|
881
|
+
* @deprecated
|
|
882
|
+
*/
|
|
859
883
|
formatTree: {
|
|
860
884
|
renderTableDefault (renderOpts, params) {
|
|
861
885
|
return getCellLabelVNs(renderOpts, params, getTreeSelectCellValue(renderOpts, params))
|
|
862
886
|
}
|
|
863
887
|
},
|
|
888
|
+
FormatTreeSelect: {
|
|
889
|
+
renderTableDefault (renderOpts, params) {
|
|
890
|
+
return getCellLabelVNs(renderOpts, params, getTreeSelectCellValue(renderOpts, params))
|
|
891
|
+
},
|
|
892
|
+
tableExportMethod: handleExportTreeSelectMethod
|
|
893
|
+
},
|
|
864
894
|
VxeTableSelect: {
|
|
865
895
|
tableAutoFocus: 'input',
|
|
866
896
|
renderTableEdit: defaultTableOrTreeSelectEditRender,
|
|
@@ -103,7 +103,7 @@ export default defineComponent({
|
|
|
103
103
|
items: any[]
|
|
104
104
|
) => {
|
|
105
105
|
const { fullAllDataRowIdData } = tableInternalData
|
|
106
|
-
const { columnKey, resizable: allResizable, border, height, cellClassName: allCellClassName, cellStyle, align: allAlign, spanMethod, mouseConfig, editConfig, editRules, tooltipConfig, padding: allPadding } = tableProps
|
|
106
|
+
const { columnKey, resizable: allResizable, showOverflow: allShowOverflow, border, height, cellClassName: allCellClassName, cellStyle, align: allAlign, spanMethod, mouseConfig, editConfig, editRules, tooltipConfig, padding: allPadding } = tableProps
|
|
107
107
|
const { tableData, dragRow, overflowX, currentColumn, scrollXLoad, scrollYLoad, calcCellHeightFlag, resizeHeightFlag, mergeList, editStore, isAllOverflow, validErrorMaps } = tableReactData
|
|
108
108
|
const { afterFullData, scrollXStore, scrollYStore } = tableInternalData
|
|
109
109
|
const cellOpts = computeCellOpts.value
|
|
@@ -138,7 +138,7 @@ export default defineComponent({
|
|
|
138
138
|
const resizeHeight = resizeHeightFlag ? rowRest.resizeHeight : 0
|
|
139
139
|
let fixedHiddenColumn = fixedType ? column.fixed !== fixedType : column.fixed && overflowX
|
|
140
140
|
const isCellPadding = XEUtils.eqNull(padding) ? (allPadding === null ? cellOpts.padding : allPadding) : padding
|
|
141
|
-
const cellOverflow = XEUtils.eqNull(showOverflow) ?
|
|
141
|
+
const cellOverflow = XEUtils.eqNull(showOverflow) ? allShowOverflow : showOverflow
|
|
142
142
|
const showEllipsis = cellOverflow === 'ellipsis'
|
|
143
143
|
const showTitle = cellOverflow === 'title'
|
|
144
144
|
const showTooltip = cellOverflow === true || cellOverflow === 'tooltip'
|
|
@@ -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
|
|
|
@@ -15,36 +15,34 @@ export class ColumnInfo {
|
|
|
15
15
|
const visible = XEUtils.isBoolean(_vm.visible) ? _vm.visible : true
|
|
16
16
|
const { props: tableProps } = $xeTable
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
18
|
+
const types = ['seq', 'checkbox', 'radio', 'expand', 'html']
|
|
19
|
+
if (_vm.type && types.indexOf(_vm.type) === -1) {
|
|
20
|
+
warnLog('vxe.error.errProp', [`type=${_vm.type}`, types.join(', ')])
|
|
21
|
+
}
|
|
22
|
+
if (XEUtils.isBoolean(_vm.cellRender) || (_vm.cellRender && !XEUtils.isObject(_vm.cellRender))) {
|
|
23
|
+
warnLog('vxe.error.errProp', [`column.cell-render=${_vm.cellRender}`, 'column.cell-render={}'])
|
|
24
|
+
}
|
|
25
|
+
if (XEUtils.isBoolean(_vm.editRender) || (_vm.editRender && !XEUtils.isObject(_vm.editRender))) {
|
|
26
|
+
warnLog('vxe.error.errProp', [`column.edit-render=${_vm.editRender}`, 'column.edit-render={}'])
|
|
27
|
+
}
|
|
28
|
+
if (_vm.type === 'expand') {
|
|
29
|
+
const { treeConfig } = tableProps
|
|
30
|
+
const { computeTreeOpts } = $xeTable.getComputeMaps()
|
|
31
|
+
const treeOpts = computeTreeOpts.value
|
|
32
|
+
if (treeConfig && (treeOpts.showLine || treeOpts.line)) {
|
|
33
|
+
errLog('vxe.error.errConflicts', ['tree-config.showLine', 'column.type=expand'])
|
|
28
34
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const
|
|
33
|
-
if (
|
|
34
|
-
errLog('vxe.error.
|
|
35
|
+
}
|
|
36
|
+
if (formatter) {
|
|
37
|
+
if (XEUtils.isString(formatter)) {
|
|
38
|
+
const gFormatOpts = formats.get(formatter) || XEUtils[formatter]
|
|
39
|
+
if (!gFormatOpts || !XEUtils.isFunction(gFormatOpts.tableCellFormatMethod || gFormatOpts.cellFormatMethod)) {
|
|
40
|
+
errLog('vxe.error.notFormats', [formatter])
|
|
35
41
|
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
if (XEUtils.
|
|
39
|
-
|
|
40
|
-
if (!gFormatOpts || !XEUtils.isFunction(gFormatOpts.tableCellFormatMethod || gFormatOpts.cellFormatMethod)) {
|
|
41
|
-
errLog('vxe.error.notFormats', [formatter])
|
|
42
|
-
}
|
|
43
|
-
} else if (XEUtils.isArray(formatter)) {
|
|
44
|
-
const gFormatOpts = formats.get(formatter[0]) || XEUtils[formatter[0]]
|
|
45
|
-
if (!gFormatOpts || !XEUtils.isFunction(gFormatOpts.tableCellFormatMethod || gFormatOpts.cellFormatMethod)) {
|
|
46
|
-
errLog('vxe.error.notFormats', [formatter[0]])
|
|
47
|
-
}
|
|
42
|
+
} else if (XEUtils.isArray(formatter)) {
|
|
43
|
+
const gFormatOpts = formats.get(formatter[0]) || XEUtils[formatter[0]]
|
|
44
|
+
if (!gFormatOpts || !XEUtils.isFunction(gFormatOpts.tableCellFormatMethod || gFormatOpts.cellFormatMethod)) {
|
|
45
|
+
errLog('vxe.error.notFormats', [formatter[0]])
|
|
48
46
|
}
|
|
49
47
|
}
|
|
50
48
|
}
|
|
@@ -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> = {}
|
|
@@ -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
|
// 行拖拽排序配置项
|