vxe-table 4.11.16 → 4.11.18
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 +15 -29
- package/es/style.css +1 -1
- package/es/table/module/custom/panel.js +19 -21
- package/es/table/module/edit/hook.js +3 -5
- 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/validator/hook.js +1 -3
- package/es/table/render/index.js +90 -61
- package/es/table/src/columnInfo.js +26 -28
- package/es/table/src/table.js +132 -89
- 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 +15 -29
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.umd.js +361 -312
- package/lib/index.umd.min.js +1 -1
- 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 +3 -5
- 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/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/columnInfo.js +30 -32
- package/lib/table/src/columnInfo.min.js +1 -1
- package/lib/table/src/table.js +138 -85
- package/lib/table/src/table.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 +16 -29
- package/packages/table/module/custom/panel.ts +19 -21
- package/packages/table/module/edit/hook.ts +3 -5
- 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/validator/hook.ts +1 -3
- package/packages/table/render/index.ts +89 -59
- package/packages/table/src/columnInfo.ts +26 -28
- package/packages/table/src/table.ts +128 -85
- package/packages/toolbar/src/toolbar.ts +16 -24
- /package/es/{iconfont.1741051544689.ttf → iconfont.1741224125327.ttf} +0 -0
- /package/es/{iconfont.1741051544689.woff → iconfont.1741224125327.woff} +0 -0
- /package/es/{iconfont.1741051544689.woff2 → iconfont.1741224125327.woff2} +0 -0
- /package/lib/{iconfont.1741051544689.ttf → iconfont.1741224125327.ttf} +0 -0
- /package/lib/{iconfont.1741051544689.woff → iconfont.1741224125327.woff} +0 -0
- /package/lib/{iconfont.1741051544689.woff2 → iconfont.1741224125327.woff2} +0 -0
|
@@ -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,
|
|
@@ -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
|
}
|
|
@@ -1344,14 +1344,12 @@ export default defineComponent({
|
|
|
1344
1344
|
errLog('vxe.error.errConflicts', ['mouse-config.area', 'column.type=expand'])
|
|
1345
1345
|
}
|
|
1346
1346
|
|
|
1347
|
-
if (
|
|
1348
|
-
if (
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
errLog('vxe.error.reqProp', ['row-config.useKey & column.type=html'])
|
|
1354
|
-
}
|
|
1347
|
+
if (htmlColumn) {
|
|
1348
|
+
if (!columnOpts.useKey) {
|
|
1349
|
+
errLog('vxe.error.reqProp', ['column-config.useKey & column.type=html'])
|
|
1350
|
+
}
|
|
1351
|
+
if (!rowOpts.useKey) {
|
|
1352
|
+
errLog('vxe.error.reqProp', ['row-config.useKey & column.type=html'])
|
|
1355
1353
|
}
|
|
1356
1354
|
}
|
|
1357
1355
|
|
|
@@ -2756,28 +2754,26 @@ export default defineComponent({
|
|
|
2756
2754
|
if (treeConfig) {
|
|
2757
2755
|
if (transform) {
|
|
2758
2756
|
// 树结构自动转换
|
|
2759
|
-
if (
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
errLog('vxe.error.reqProp', ['tree-config.parentField'])
|
|
2765
|
-
}
|
|
2766
|
-
if (!childrenField) {
|
|
2767
|
-
errLog('vxe.error.reqProp', ['tree-config.childrenField'])
|
|
2768
|
-
}
|
|
2769
|
-
if (!treeOpts.mapChildrenField) {
|
|
2770
|
-
errLog('vxe.error.reqProp', ['tree-config.mapChildrenField'])
|
|
2771
|
-
}
|
|
2772
|
-
if (childrenField === treeOpts.mapChildrenField) {
|
|
2773
|
-
errLog('vxe.error.errConflicts', ['tree-config.childrenField', 'tree-config.mapChildrenField'])
|
|
2774
|
-
}
|
|
2775
|
-
// fullData.forEach(row => {
|
|
2776
|
-
// if (row[treeOpts.children] && row[treeOpts.children].length) {
|
|
2777
|
-
// warnLog('vxe.error.errConflicts', ['tree-config.transform', `row.${treeOpts.children}`])
|
|
2778
|
-
// }
|
|
2779
|
-
// })
|
|
2757
|
+
if (!treeOpts.rowField) {
|
|
2758
|
+
errLog('vxe.error.reqProp', ['tree-config.rowField'])
|
|
2759
|
+
}
|
|
2760
|
+
if (!treeOpts.parentField) {
|
|
2761
|
+
errLog('vxe.error.reqProp', ['tree-config.parentField'])
|
|
2780
2762
|
}
|
|
2763
|
+
if (!childrenField) {
|
|
2764
|
+
errLog('vxe.error.reqProp', ['tree-config.childrenField'])
|
|
2765
|
+
}
|
|
2766
|
+
if (!treeOpts.mapChildrenField) {
|
|
2767
|
+
errLog('vxe.error.reqProp', ['tree-config.mapChildrenField'])
|
|
2768
|
+
}
|
|
2769
|
+
if (childrenField === treeOpts.mapChildrenField) {
|
|
2770
|
+
errLog('vxe.error.errConflicts', ['tree-config.childrenField', 'tree-config.mapChildrenField'])
|
|
2771
|
+
}
|
|
2772
|
+
// fullData.forEach(row => {
|
|
2773
|
+
// if (row[treeOpts.children] && row[treeOpts.children].length) {
|
|
2774
|
+
// warnLog('vxe.error.errConflicts', ['tree-config.transform', `row.${treeOpts.children}`])
|
|
2775
|
+
// }
|
|
2776
|
+
// })
|
|
2781
2777
|
treeData = XEUtils.toArrayTree(fullData, {
|
|
2782
2778
|
key: treeOpts.rowField,
|
|
2783
2779
|
parentKey: treeOpts.parentField,
|
|
@@ -2843,16 +2839,14 @@ export default defineComponent({
|
|
|
2843
2839
|
// }
|
|
2844
2840
|
// }
|
|
2845
2841
|
|
|
2846
|
-
if (
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
warnLog('vxe.error.scrollErrProp', ['table.span-method'])
|
|
2855
|
-
}
|
|
2842
|
+
if (!(props.height || props.maxHeight)) {
|
|
2843
|
+
errLog('vxe.error.reqProp', ['table.height | table.max-height | table.scroll-y={enabled: false}'])
|
|
2844
|
+
}
|
|
2845
|
+
// if (!props.showOverflow) {
|
|
2846
|
+
// warnLog('vxe.error.reqProp', ['table.show-overflow'])
|
|
2847
|
+
// }
|
|
2848
|
+
if (props.spanMethod) {
|
|
2849
|
+
errLog('vxe.error.scrollErrProp', ['table.span-method'])
|
|
2856
2850
|
}
|
|
2857
2851
|
}
|
|
2858
2852
|
|
|
@@ -3846,11 +3840,13 @@ export default defineComponent({
|
|
|
3846
3840
|
* 如果还额外传了 field 则还原指定的单元格数据
|
|
3847
3841
|
*/
|
|
3848
3842
|
revertData (rows: any, field) {
|
|
3849
|
-
const { keepSource } = props
|
|
3850
|
-
const { tableSourceData, sourceDataRowIdData } = internalData
|
|
3843
|
+
const { keepSource, treeConfig } = props
|
|
3844
|
+
const { fullAllDataRowIdData, fullDataRowIdData, tableSourceData, sourceDataRowIdData, tableFullData, afterFullData } = internalData
|
|
3845
|
+
const treeOpts = computeTreeOpts.value
|
|
3846
|
+
const { transform } = treeOpts
|
|
3851
3847
|
if (!keepSource) {
|
|
3852
3848
|
if (process.env.VUE_APP_VXE_ENV === 'development') {
|
|
3853
|
-
|
|
3849
|
+
errLog('vxe.error.reqProp', ['keep-source'])
|
|
3854
3850
|
}
|
|
3855
3851
|
return nextTick()
|
|
3856
3852
|
}
|
|
@@ -3862,25 +3858,50 @@ export default defineComponent({
|
|
|
3862
3858
|
} else {
|
|
3863
3859
|
targetRows = XEUtils.toArray($xeTable.getUpdateRecords())
|
|
3864
3860
|
}
|
|
3861
|
+
let reDelFlag = false
|
|
3865
3862
|
if (targetRows.length) {
|
|
3866
|
-
targetRows.forEach((
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3863
|
+
targetRows.forEach((item: any) => {
|
|
3864
|
+
const rowid = getRowid($xeTable, item)
|
|
3865
|
+
const rowRest = fullAllDataRowIdData[rowid]
|
|
3866
|
+
if (rowRest) {
|
|
3867
|
+
const row = rowRest.row
|
|
3868
|
+
if (!$xeTable.isInsertByRow(row)) {
|
|
3869
|
+
const oRow = sourceDataRowIdData[rowid]
|
|
3870
|
+
if (oRow && row) {
|
|
3871
|
+
if (field) {
|
|
3872
|
+
XEUtils.set(row, field, XEUtils.clone(XEUtils.get(oRow, field), true))
|
|
3873
|
+
} else {
|
|
3874
|
+
XEUtils.destructuring(row, XEUtils.clone(oRow, true))
|
|
3875
|
+
}
|
|
3876
|
+
if (!fullDataRowIdData[rowid] && $xeTable.isRemoveByRow(row)) {
|
|
3877
|
+
tableFullData.unshift(row)
|
|
3878
|
+
afterFullData.unshift(row)
|
|
3879
|
+
reDelFlag = true
|
|
3880
|
+
}
|
|
3875
3881
|
}
|
|
3876
3882
|
}
|
|
3877
3883
|
}
|
|
3878
3884
|
})
|
|
3879
3885
|
}
|
|
3880
3886
|
if (rows) {
|
|
3881
|
-
|
|
3887
|
+
if (reDelFlag) {
|
|
3888
|
+
$xeTable.updateFooter()
|
|
3889
|
+
$xeTable.cacheRowMap(false)
|
|
3890
|
+
$xeTable.handleTableData(treeConfig && transform)
|
|
3891
|
+
if (!(treeConfig && transform)) {
|
|
3892
|
+
$xeTable.updateAfterDataIndex()
|
|
3893
|
+
}
|
|
3894
|
+
$xeTable.checkSelectionStatus()
|
|
3895
|
+
if (reactData.scrollYLoad) {
|
|
3896
|
+
$xeTable.updateScrollYSpace()
|
|
3897
|
+
}
|
|
3898
|
+
}
|
|
3899
|
+
return nextTick().then(() => {
|
|
3900
|
+
$xeTable.updateCellAreas()
|
|
3901
|
+
return $xeTable.recalculate()
|
|
3902
|
+
})
|
|
3882
3903
|
}
|
|
3883
|
-
return
|
|
3904
|
+
return $xeTable.reloadData(tableSourceData)
|
|
3884
3905
|
},
|
|
3885
3906
|
/**
|
|
3886
3907
|
* 清空单元格内容
|
|
@@ -3995,6 +4016,11 @@ export default defineComponent({
|
|
|
3995
4016
|
const rowid = getRowid($xeTable, row)
|
|
3996
4017
|
return !!editStore.insertMaps[rowid]
|
|
3997
4018
|
},
|
|
4019
|
+
isRemoveByRow (row) {
|
|
4020
|
+
const { editStore } = reactData
|
|
4021
|
+
const rowid = getRowid($xeTable, row)
|
|
4022
|
+
return !!editStore.removeMaps[rowid]
|
|
4023
|
+
},
|
|
3998
4024
|
/**
|
|
3999
4025
|
* 删除所有新增的临时数据
|
|
4000
4026
|
* @returns
|
|
@@ -6686,7 +6712,15 @@ export default defineComponent({
|
|
|
6686
6712
|
if (el) {
|
|
6687
6713
|
const parentElem = el.parentNode as HTMLElement
|
|
6688
6714
|
const parentPaddingSize = height === '100%' || height === 'auto' ? getPaddingTopBottomSize(parentElem) : 0
|
|
6689
|
-
|
|
6715
|
+
let parentWrapperHeight = 0
|
|
6716
|
+
if (parentElem) {
|
|
6717
|
+
if ($xeGrid && hasClass(parentElem, 'vxe-grid--table-wrapper')) {
|
|
6718
|
+
parentWrapperHeight = $xeGrid.getParentHeight()
|
|
6719
|
+
} else {
|
|
6720
|
+
parentWrapperHeight = parentElem.clientHeight
|
|
6721
|
+
}
|
|
6722
|
+
}
|
|
6723
|
+
return Math.floor(parentWrapperHeight - parentPaddingSize)
|
|
6690
6724
|
}
|
|
6691
6725
|
return 0
|
|
6692
6726
|
},
|
|
@@ -6772,14 +6806,15 @@ export default defineComponent({
|
|
|
6772
6806
|
*/
|
|
6773
6807
|
cacheRowMap () {
|
|
6774
6808
|
const { treeConfig } = props
|
|
6775
|
-
const
|
|
6809
|
+
const { treeExpandedMaps } = reactData
|
|
6776
6810
|
const { fullAllDataRowIdData, tableFullData, tableFullTreeData } = internalData
|
|
6811
|
+
const treeOpts = computeTreeOpts.value
|
|
6777
6812
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
6778
6813
|
const hasChildField = treeOpts.hasChild || treeOpts.hasChildField
|
|
6779
6814
|
const rowkey = getRowkey($xeTable)
|
|
6780
|
-
const
|
|
6781
|
-
const fullAllDataRowIdMaps: Record<string, VxeTableDefines.RowCacheItem> = {}
|
|
6815
|
+
const fullAllDataRowIdMaps: Record<string, VxeTableDefines.RowCacheItem> = { ...fullAllDataRowIdData } // 存在已删除数据
|
|
6782
6816
|
const fullDataRowIdMaps: Record<string, VxeTableDefines.RowCacheItem> = {}
|
|
6817
|
+
const treeTempExpandedMaps = { ...treeExpandedMaps }
|
|
6783
6818
|
const handleRow = (row: any, index: number, items: any, path?: any[], parentRow?: any, nodes?: any[]) => {
|
|
6784
6819
|
let rowid = getRowid($xeTable, row)
|
|
6785
6820
|
const seq = treeConfig && path ? toTreePathSeq(path) : index + 1
|
|
@@ -6788,13 +6823,24 @@ export default defineComponent({
|
|
|
6788
6823
|
rowid = getRowUniqueId()
|
|
6789
6824
|
XEUtils.set(row, rowkey, rowid)
|
|
6790
6825
|
}
|
|
6791
|
-
if (
|
|
6792
|
-
|
|
6826
|
+
if (treeConfig && treeOpts.lazy) {
|
|
6827
|
+
const treeExpRest = treeExpandedMaps[rowid]
|
|
6828
|
+
if (row[hasChildField] && XEUtils.isUndefined(row[childrenField])) {
|
|
6829
|
+
row[childrenField] = null
|
|
6830
|
+
}
|
|
6831
|
+
if (treeExpRest) {
|
|
6832
|
+
if (!row[childrenField] || !row[childrenField].length) {
|
|
6833
|
+
delete treeTempExpandedMaps[rowid]
|
|
6834
|
+
}
|
|
6835
|
+
}
|
|
6793
6836
|
}
|
|
6794
6837
|
let rowRest = fullAllDataRowIdData[rowid]
|
|
6795
6838
|
if (!rowRest) {
|
|
6796
6839
|
rowRest = { row, rowid, seq, index: -1, _index: -1, $index: -1, treeIndex: index, items, parent: parentRow, level, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 }
|
|
6797
6840
|
}
|
|
6841
|
+
rowRest.treeLoaded = false
|
|
6842
|
+
rowRest.expandLoaded = false
|
|
6843
|
+
|
|
6798
6844
|
rowRest.row = row
|
|
6799
6845
|
rowRest.items = items
|
|
6800
6846
|
rowRest.parent = parentRow
|
|
@@ -6803,13 +6849,14 @@ export default defineComponent({
|
|
|
6803
6849
|
fullDataRowIdMaps[rowid] = rowRest
|
|
6804
6850
|
fullAllDataRowIdMaps[rowid] = rowRest
|
|
6805
6851
|
}
|
|
6806
|
-
internalData.fullDataRowIdData = fullDataRowIdMaps
|
|
6807
|
-
internalData.fullAllDataRowIdData = fullAllDataRowIdMaps
|
|
6808
6852
|
if (treeConfig) {
|
|
6809
6853
|
XEUtils.eachTree(tableFullTreeData, handleRow, { children: childrenField })
|
|
6810
6854
|
} else {
|
|
6811
6855
|
tableFullData.forEach(handleRow)
|
|
6812
6856
|
}
|
|
6857
|
+
internalData.fullDataRowIdData = fullDataRowIdMaps
|
|
6858
|
+
internalData.fullAllDataRowIdData = fullAllDataRowIdMaps
|
|
6859
|
+
reactData.treeExpandedMaps = treeTempExpandedMaps
|
|
6813
6860
|
},
|
|
6814
6861
|
cacheSourceMap (fullData) {
|
|
6815
6862
|
const { treeConfig } = props
|
|
@@ -9331,18 +9378,16 @@ export default defineComponent({
|
|
|
9331
9378
|
}
|
|
9332
9379
|
|
|
9333
9380
|
// 检测对应模块是否安装
|
|
9334
|
-
|
|
9335
|
-
|
|
9336
|
-
(
|
|
9337
|
-
|
|
9338
|
-
|
|
9339
|
-
|
|
9340
|
-
|
|
9341
|
-
(
|
|
9342
|
-
|
|
9343
|
-
|
|
9344
|
-
})
|
|
9345
|
-
}
|
|
9381
|
+
'openExport,openPrint,exportData,openImport,importData,saveFile,readFile,importByFile,print'.split(',').forEach(name => {
|
|
9382
|
+
($xeTable as any)[name] = function () {
|
|
9383
|
+
errLog('vxe.error.reqModule', ['VxeTableExportModule'])
|
|
9384
|
+
}
|
|
9385
|
+
})
|
|
9386
|
+
'clearValidate,fullValidate,validate'.split(',').forEach(name => {
|
|
9387
|
+
($xeTable as any)[name] = function () {
|
|
9388
|
+
errLog('vxe.error.reqModule', ['VxeTableValidatorModule'])
|
|
9389
|
+
}
|
|
9390
|
+
})
|
|
9346
9391
|
|
|
9347
9392
|
Object.assign($xeTable, tableMethods, tablePrivateMethods)
|
|
9348
9393
|
|
|
@@ -10350,23 +10395,21 @@ export default defineComponent({
|
|
|
10350
10395
|
tablePrivateMethods.preventEvent(null, 'unmounted', { $table: $xeTable })
|
|
10351
10396
|
})
|
|
10352
10397
|
|
|
10353
|
-
|
|
10354
|
-
|
|
10355
|
-
if (
|
|
10356
|
-
|
|
10357
|
-
errLog('vxe.error.reqComp', ['vxe-loading'])
|
|
10358
|
-
}
|
|
10398
|
+
nextTick(() => {
|
|
10399
|
+
if (props.loading) {
|
|
10400
|
+
if (!VxeUILoadingComponent && !slots.loading) {
|
|
10401
|
+
errLog('vxe.error.reqComp', ['vxe-loading'])
|
|
10359
10402
|
}
|
|
10360
|
-
|
|
10403
|
+
}
|
|
10404
|
+
if ((props.showOverflow === true || props.showOverflow === 'tooltip') ||
|
|
10361
10405
|
(props.showHeaderOverflow === true || props.showHeaderOverflow === 'tooltip') ||
|
|
10362
10406
|
(props.showFooterOverflow === true || props.showFooterOverflow === 'tooltip') ||
|
|
10363
10407
|
props.tooltipConfig || props.editRules) {
|
|
10364
|
-
|
|
10365
|
-
|
|
10366
|
-
}
|
|
10408
|
+
if (!VxeUITooltipComponent) {
|
|
10409
|
+
errLog('vxe.error.reqComp', ['vxe-tooltip'])
|
|
10367
10410
|
}
|
|
10368
|
-
}
|
|
10369
|
-
}
|
|
10411
|
+
}
|
|
10412
|
+
})
|
|
10370
10413
|
|
|
10371
10414
|
provide('$xeColgroup', null)
|
|
10372
10415
|
provide('$xeTable', $xeTable)
|
|
@@ -210,9 +210,7 @@ export default defineComponent({
|
|
|
210
210
|
if (tCommandMethod) {
|
|
211
211
|
tCommandMethod(params)
|
|
212
212
|
} else {
|
|
213
|
-
|
|
214
|
-
errLog('vxe.error.notCommands', [code])
|
|
215
|
-
}
|
|
213
|
+
errLog('vxe.error.notCommands', [code])
|
|
216
214
|
}
|
|
217
215
|
}
|
|
218
216
|
$xeToolbar.dispatchEvent('button-click', params, evnt)
|
|
@@ -235,9 +233,7 @@ export default defineComponent({
|
|
|
235
233
|
if (tCommandMethod) {
|
|
236
234
|
tCommandMethod(params)
|
|
237
235
|
} else {
|
|
238
|
-
|
|
239
|
-
errLog('vxe.error.notCommands', [code])
|
|
240
|
-
}
|
|
236
|
+
errLog('vxe.error.notCommands', [code])
|
|
241
237
|
}
|
|
242
238
|
}
|
|
243
239
|
$xeToolbar.dispatchEvent('tool-click', params, evnt)
|
|
@@ -598,25 +594,21 @@ export default defineComponent({
|
|
|
598
594
|
warnLog('vxe.error.notFunc', ['queryMethod'])
|
|
599
595
|
}
|
|
600
596
|
const customOpts = computeCustomOpts.value
|
|
601
|
-
if (
|
|
602
|
-
|
|
603
|
-
warnLog('vxe.error.delProp', ['toolbar.custom.isFooter', 'table.custom-config.showFooter'])
|
|
604
|
-
}
|
|
605
|
-
if (customOpts.showFooter) {
|
|
606
|
-
warnLog('vxe.error.delProp', ['toolbar.custom.showFooter', 'table.custom-config.showFooter'])
|
|
607
|
-
}
|
|
608
|
-
if (customOpts.immediate) {
|
|
609
|
-
warnLog('vxe.error.delProp', ['toolbar.custom.immediate', 'table.custom-config.immediate'])
|
|
610
|
-
}
|
|
611
|
-
if (customOpts.trigger) {
|
|
612
|
-
warnLog('vxe.error.delProp', ['toolbar.custom.trigger', 'table.custom-config.trigger'])
|
|
613
|
-
}
|
|
597
|
+
if (customOpts.isFooter) {
|
|
598
|
+
warnLog('vxe.error.delProp', ['toolbar.custom.isFooter', 'table.custom-config.showFooter'])
|
|
614
599
|
}
|
|
615
|
-
if (
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
600
|
+
if (customOpts.showFooter) {
|
|
601
|
+
warnLog('vxe.error.delProp', ['toolbar.custom.showFooter', 'table.custom-config.showFooter'])
|
|
602
|
+
}
|
|
603
|
+
if (customOpts.immediate) {
|
|
604
|
+
warnLog('vxe.error.delProp', ['toolbar.custom.immediate', 'table.custom-config.immediate'])
|
|
605
|
+
}
|
|
606
|
+
if (customOpts.trigger) {
|
|
607
|
+
warnLog('vxe.error.delProp', ['toolbar.custom.trigger', 'table.custom-config.trigger'])
|
|
608
|
+
}
|
|
609
|
+
if (props.refresh || props.import || props.export || props.print || props.zoom) {
|
|
610
|
+
if (!VxeUIButtonComponent) {
|
|
611
|
+
errLog('vxe.error.reqComp', ['vxe-button'])
|
|
620
612
|
}
|
|
621
613
|
}
|
|
622
614
|
})
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|