vxe-table 3.14.0-beta.9 → 3.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/grid/src/grid.js +62 -42
- package/es/locale/lang/ar-EG.js +7 -1
- package/es/locale/lang/de-DE.js +7 -1
- package/es/locale/lang/en-US.js +7 -1
- package/es/locale/lang/es-ES.js +7 -1
- package/es/locale/lang/fr-FR.js +7 -1
- package/es/locale/lang/hu-HU.js +7 -1
- package/es/locale/lang/hy-AM.js +7 -1
- package/es/locale/lang/id-ID.js +7 -1
- package/es/locale/lang/it-IT.js +7 -1
- package/es/locale/lang/ja-JP.js +7 -1
- package/es/locale/lang/ko-KR.js +7 -1
- package/es/locale/lang/nb-NO.js +7 -1
- package/es/locale/lang/pt-BR.js +7 -1
- package/es/locale/lang/ru-RU.js +7 -1
- package/es/locale/lang/th-TH.js +7 -1
- package/es/locale/lang/ug-CN.js +7 -1
- package/es/locale/lang/uk-UA.js +7 -1
- package/es/locale/lang/vi-VN.js +7 -1
- package/es/locale/lang/zh-CHT.js +7 -1
- package/es/locale/lang/zh-CN.js +7 -1
- package/es/style.css +1 -1
- package/es/table/module/custom/mixin.js +4 -2
- package/es/table/module/custom/panel.js +24 -23
- package/es/table/module/edit/mixin.js +103 -68
- package/es/table/module/export/export-panel.js +5 -4
- package/es/table/module/export/import-panel.js +8 -7
- package/es/table/module/export/mixin.js +30 -27
- package/es/table/module/filter/panel.js +21 -10
- package/es/table/module/keyboard/mixin.js +141 -41
- package/es/table/module/menu/mixin.js +6 -3
- package/es/table/module/menu/panel.js +7 -7
- package/es/table/module/validator/mixin.js +2 -5
- package/es/table/render/index.js +2 -2
- package/es/table/src/body.js +43 -25
- package/es/table/src/cell.js +27 -22
- package/es/table/src/column.js +11 -9
- package/es/table/src/columnInfo.js +6 -6
- package/es/table/src/footer.js +12 -7
- package/es/table/src/group.js +6 -5
- package/es/table/src/header.js +15 -9
- package/es/table/src/methods.js +1047 -971
- package/es/table/src/props.js +4 -0
- package/es/table/src/table.js +100 -64
- package/es/table/src/util.js +55 -20
- package/es/toolbar/src/toolbar.js +3 -3
- package/es/ui/index.js +2 -1
- package/es/ui/src/log.js +1 -1
- package/helper/vetur/attributes.json +1 -1
- package/helper/vetur/tags.json +1 -1
- package/lib/grid/src/grid.js +69 -59
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.umd.js +2006 -1686
- package/lib/index.umd.min.js +1 -1
- package/lib/locale/lang/ar-EG.js +7 -1
- package/lib/locale/lang/ar-EG.min.js +1 -1
- package/lib/locale/lang/de-DE.js +7 -1
- package/lib/locale/lang/de-DE.min.js +1 -1
- package/lib/locale/lang/en-US.js +7 -1
- package/lib/locale/lang/en-US.min.js +1 -1
- package/lib/locale/lang/en-US.umd.js +7 -1
- package/lib/locale/lang/es-ES.js +7 -1
- package/lib/locale/lang/es-ES.min.js +1 -1
- package/lib/locale/lang/es-ES.umd.js +7 -1
- package/lib/locale/lang/fr-FR.js +7 -1
- package/lib/locale/lang/fr-FR.min.js +1 -1
- package/lib/locale/lang/hu-HU.js +7 -1
- package/lib/locale/lang/hu-HU.min.js +1 -1
- package/lib/locale/lang/hu-HU.umd.js +7 -1
- package/lib/locale/lang/hy-AM.js +7 -1
- package/lib/locale/lang/hy-AM.min.js +1 -1
- package/lib/locale/lang/id-ID.js +7 -1
- package/lib/locale/lang/id-ID.min.js +1 -1
- package/lib/locale/lang/it-IT.js +7 -1
- package/lib/locale/lang/it-IT.min.js +1 -1
- package/lib/locale/lang/ja-JP.js +7 -1
- package/lib/locale/lang/ja-JP.min.js +1 -1
- package/lib/locale/lang/ja-JP.umd.js +7 -1
- package/lib/locale/lang/ko-KR.js +7 -1
- package/lib/locale/lang/ko-KR.min.js +1 -1
- package/lib/locale/lang/ko-KR.umd.js +7 -1
- package/lib/locale/lang/nb-NO.js +7 -1
- package/lib/locale/lang/nb-NO.min.js +1 -1
- package/lib/locale/lang/pt-BR.js +7 -1
- package/lib/locale/lang/pt-BR.min.js +1 -1
- package/lib/locale/lang/pt-BR.umd.js +7 -1
- package/lib/locale/lang/ru-RU.js +7 -1
- package/lib/locale/lang/ru-RU.min.js +1 -1
- package/lib/locale/lang/ru-RU.umd.js +7 -1
- package/lib/locale/lang/th-TH.js +7 -1
- package/lib/locale/lang/th-TH.min.js +1 -1
- package/lib/locale/lang/ug-CN.js +7 -1
- package/lib/locale/lang/ug-CN.min.js +1 -1
- package/lib/locale/lang/uk-UA.js +7 -1
- package/lib/locale/lang/uk-UA.min.js +1 -1
- package/lib/locale/lang/uk-UA.umd.js +7 -1
- package/lib/locale/lang/vi-VN.js +7 -1
- package/lib/locale/lang/vi-VN.min.js +1 -1
- package/lib/locale/lang/zh-CHT.js +7 -1
- package/lib/locale/lang/zh-CHT.min.js +1 -1
- package/lib/locale/lang/zh-CHT.umd.js +7 -1
- package/lib/locale/lang/zh-CN.js +7 -1
- package/lib/locale/lang/zh-CN.min.js +1 -1
- package/lib/locale/lang/zh-CN.umd.js +7 -1
- package/lib/style.css +1 -1
- package/lib/table/module/custom/mixin.js +5 -3
- package/lib/table/module/custom/mixin.min.js +1 -1
- package/lib/table/module/custom/panel.js +22 -29
- package/lib/table/module/custom/panel.min.js +1 -1
- package/lib/table/module/edit/mixin.js +119 -105
- package/lib/table/module/edit/mixin.min.js +1 -1
- package/lib/table/module/export/export-panel.js +5 -4
- package/lib/table/module/export/export-panel.min.js +1 -1
- package/lib/table/module/export/import-panel.js +8 -7
- package/lib/table/module/export/import-panel.min.js +1 -1
- package/lib/table/module/export/mixin.js +35 -34
- package/lib/table/module/export/mixin.min.js +1 -1
- package/lib/table/module/filter/panel.js +16 -16
- package/lib/table/module/filter/panel.min.js +1 -1
- package/lib/table/module/keyboard/mixin.js +149 -47
- package/lib/table/module/keyboard/mixin.min.js +1 -1
- package/lib/table/module/menu/mixin.js +6 -3
- package/lib/table/module/menu/mixin.min.js +1 -1
- package/lib/table/module/menu/panel.js +7 -7
- package/lib/table/module/menu/panel.min.js +1 -1
- package/lib/table/module/validator/mixin.js +4 -10
- package/lib/table/module/validator/mixin.min.js +1 -1
- package/lib/table/render/index.js +3 -2
- package/lib/table/render/index.min.js +1 -1
- package/lib/table/src/body.js +51 -25
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/cell.js +39 -23
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/column.js +11 -9
- package/lib/table/src/column.min.js +1 -1
- package/lib/table/src/columnInfo.js +6 -6
- package/lib/table/src/columnInfo.min.js +1 -1
- package/lib/table/src/footer.js +12 -5
- package/lib/table/src/footer.min.js +1 -1
- package/lib/table/src/group.js +6 -5
- package/lib/table/src/group.min.js +1 -1
- package/lib/table/src/header.js +16 -8
- package/lib/table/src/header.min.js +1 -1
- package/lib/table/src/methods.js +1219 -1151
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/props.js +4 -0
- package/lib/table/src/props.min.js +1 -1
- package/lib/table/src/table.js +108 -67
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +62 -21
- package/lib/table/src/util.min.js +1 -1
- package/lib/toolbar/src/toolbar.js +3 -3
- package/lib/ui/index.js +2 -1
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/package.json +2 -2
- package/packages/grid/src/grid.ts +75 -51
- package/packages/locale/lang/ar-EG.ts +7 -1
- package/packages/locale/lang/de-DE.ts +7 -1
- package/packages/locale/lang/en-US.ts +7 -1
- package/packages/locale/lang/es-ES.ts +7 -1
- package/packages/locale/lang/fr-FR.ts +7 -1
- package/packages/locale/lang/hu-HU.ts +7 -1
- package/packages/locale/lang/hy-AM.ts +7 -1
- package/packages/locale/lang/id-ID.ts +7 -1
- package/packages/locale/lang/it-IT.ts +7 -1
- package/packages/locale/lang/ja-JP.ts +7 -1
- package/packages/locale/lang/ko-KR.ts +7 -1
- package/packages/locale/lang/nb-NO.ts +7 -1
- package/packages/locale/lang/pt-BR.ts +7 -1
- package/packages/locale/lang/ru-RU.ts +7 -1
- package/packages/locale/lang/th-TH.ts +7 -1
- package/packages/locale/lang/ug-CN.ts +7 -1
- package/packages/locale/lang/uk-UA.ts +7 -1
- package/packages/locale/lang/vi-VN.ts +7 -1
- package/packages/locale/lang/zh-CHT.ts +7 -1
- package/packages/locale/lang/zh-CN.ts +7 -1
- package/packages/table/module/custom/mixin.ts +6 -3
- package/packages/table/module/custom/panel.ts +42 -37
- package/packages/table/module/edit/mixin.ts +139 -95
- package/packages/table/module/export/export-panel.ts +8 -5
- package/packages/table/module/export/import-panel.ts +11 -7
- package/packages/table/module/export/mixin.ts +37 -32
- package/packages/table/module/filter/panel.ts +25 -10
- package/packages/table/module/keyboard/mixin.ts +155 -49
- package/packages/table/module/menu/mixin.ts +12 -6
- package/packages/table/module/menu/panel.ts +10 -7
- package/packages/table/module/validator/mixin.ts +3 -6
- package/packages/table/render/index.ts +2 -2
- package/packages/table/src/body.ts +43 -25
- package/packages/table/src/cell.ts +27 -22
- package/packages/table/src/column.ts +14 -10
- package/packages/table/src/columnInfo.ts +9 -6
- package/packages/table/src/footer.ts +12 -7
- package/packages/table/src/group.ts +9 -5
- package/packages/table/src/header.ts +16 -9
- package/packages/table/src/methods.ts +1174 -1027
- package/packages/table/src/props.ts +16 -12
- package/packages/table/src/table.ts +117 -70
- package/packages/table/src/util.ts +65 -23
- package/packages/toolbar/src/toolbar.ts +3 -3
- package/packages/ui/index.ts +1 -0
- /package/es/{iconfont.1741336976538.ttf → iconfont.1743045564244.ttf} +0 -0
- /package/es/{iconfont.1741336976538.woff → iconfont.1743045564244.woff} +0 -0
- /package/es/{iconfont.1741336976538.woff2 → iconfont.1743045564244.woff2} +0 -0
- /package/lib/{iconfont.1741336976538.ttf → iconfont.1743045564244.ttf} +0 -0
- /package/lib/{iconfont.1741336976538.woff → iconfont.1743045564244.woff} +0 -0
- /package/lib/{iconfont.1741336976538.woff2 → iconfont.1743045564244.woff2} +0 -0
|
@@ -195,24 +195,24 @@ function getBodyLabelData($xeTable, opts, columns, datas) {
|
|
|
195
195
|
return item;
|
|
196
196
|
});
|
|
197
197
|
}
|
|
198
|
-
function getExportData($
|
|
198
|
+
function getExportData($xeTable, opts) {
|
|
199
199
|
const { columns, dataFilterMethod } = opts;
|
|
200
200
|
let datas = opts.data;
|
|
201
201
|
if (dataFilterMethod) {
|
|
202
202
|
datas = datas.filter((row, index) => dataFilterMethod({ row, $rowIndex: index }));
|
|
203
203
|
}
|
|
204
|
-
return getBodyLabelData($
|
|
204
|
+
return getBodyLabelData($xeTable, opts, columns, datas);
|
|
205
205
|
}
|
|
206
206
|
function getBooleanValue(cellValue) {
|
|
207
207
|
return cellValue === 'TRUE' || cellValue === 'true' || cellValue === true;
|
|
208
208
|
}
|
|
209
|
-
function getHeaderTitle($
|
|
210
|
-
const
|
|
209
|
+
function getHeaderTitle($xeTable, opts, column) {
|
|
210
|
+
const columnOpts = $xeTable.computeColumnOpts;
|
|
211
211
|
const headExportMethod = column.headerExportMethod || columnOpts.headerExportMethod;
|
|
212
|
-
return headExportMethod ? headExportMethod({ column, options: opts, $table: $
|
|
212
|
+
return headExportMethod ? headExportMethod({ column, options: opts, $table: $xeTable }) : ((opts.original ? column.field : column.getTitle()) || '');
|
|
213
213
|
}
|
|
214
|
-
function getFooterCellValue($
|
|
215
|
-
const
|
|
214
|
+
function getFooterCellValue($xeTable, opts, row, column) {
|
|
215
|
+
const columnOpts = $xeTable.computeColumnOpts;
|
|
216
216
|
const renderOpts = column.editRender || column.cellRender;
|
|
217
217
|
let footLabelMethod = column.footerExportMethod;
|
|
218
218
|
if (!footLabelMethod && renderOpts && renderOpts.name) {
|
|
@@ -224,9 +224,9 @@ function getFooterCellValue($xetable, opts, row, column) {
|
|
|
224
224
|
if (!footLabelMethod) {
|
|
225
225
|
footLabelMethod = columnOpts.footerExportMethod;
|
|
226
226
|
}
|
|
227
|
-
const _columnIndex = $
|
|
227
|
+
const _columnIndex = $xeTable.getVTColumnIndex(column);
|
|
228
228
|
if (footLabelMethod) {
|
|
229
|
-
return footLabelMethod({ $table: $
|
|
229
|
+
return footLabelMethod({ $table: $xeTable, items: row, itemIndex: _columnIndex, row, _columnIndex, column, options: opts });
|
|
230
230
|
}
|
|
231
231
|
// 兼容老模式
|
|
232
232
|
if (XEUtils.isArray(row)) {
|
|
@@ -477,7 +477,8 @@ function toHtml($xeTable, opts, columns, datas) {
|
|
|
477
477
|
tables.push('</table>', script);
|
|
478
478
|
return isPrint ? tables.join('') : createHtmlPage(opts, tables.join(''));
|
|
479
479
|
}
|
|
480
|
-
function toXML($
|
|
480
|
+
function toXML($xeTable, opts, columns, datas) {
|
|
481
|
+
const reactData = $xeTable;
|
|
481
482
|
let xml = [
|
|
482
483
|
'<?xml version="1.0"?>',
|
|
483
484
|
'<?mso-application progid="Excel.Sheet"?>',
|
|
@@ -498,16 +499,16 @@ function toXML($xetable, opts, columns, datas) {
|
|
|
498
499
|
columns.map(column => `<Column ss:Width="${column.renderWidth}"/>`).join('')
|
|
499
500
|
].join('');
|
|
500
501
|
if (opts.isHeader) {
|
|
501
|
-
xml += `<Row>${columns.map(column => `<Cell><Data ss:Type="String">${getHeaderTitle($
|
|
502
|
+
xml += `<Row>${columns.map(column => `<Cell><Data ss:Type="String">${getHeaderTitle($xeTable, opts, column)}</Data></Cell>`).join('')}</Row>`;
|
|
502
503
|
}
|
|
503
504
|
datas.forEach(row => {
|
|
504
505
|
xml += '<Row>' + columns.map(column => `<Cell><Data ss:Type="String">${row[column.id]}</Data></Cell>`).join('') + '</Row>';
|
|
505
506
|
});
|
|
506
507
|
if (opts.isFooter) {
|
|
507
|
-
const footerTableData =
|
|
508
|
+
const { footerTableData } = reactData;
|
|
508
509
|
const footers = getFooterData(opts, footerTableData);
|
|
509
510
|
footers.forEach((row) => {
|
|
510
|
-
xml += `<Row>${columns.map(column => `<Cell><Data ss:Type="String">${getFooterCellValue($
|
|
511
|
+
xml += `<Row>${columns.map(column => `<Cell><Data ss:Type="String">${getFooterCellValue($xeTable, opts, row, column)}</Data></Cell>`).join('')}</Row>`;
|
|
511
512
|
});
|
|
512
513
|
}
|
|
513
514
|
return `${xml}</Table></Worksheet></Workbook>`;
|
|
@@ -559,7 +560,7 @@ export function saveLocalFile(options) {
|
|
|
559
560
|
}
|
|
560
561
|
return Promise.reject(new Error(getI18n('vxe.error.notExp')));
|
|
561
562
|
}
|
|
562
|
-
function downloadFile($
|
|
563
|
+
function downloadFile($xeTable, opts, content) {
|
|
563
564
|
const { filename, type, download } = opts;
|
|
564
565
|
if (!download) {
|
|
565
566
|
const blob = getExportBlobByContent(content, opts);
|
|
@@ -821,8 +822,9 @@ function handleImport($xeTable, content, opts) {
|
|
|
821
822
|
}
|
|
822
823
|
}
|
|
823
824
|
}
|
|
824
|
-
function handleFileImport($
|
|
825
|
-
const
|
|
825
|
+
function handleFileImport($xeTable, file, opts) {
|
|
826
|
+
const internalData = $xeTable;
|
|
827
|
+
const importOpts = $xeTable.computeImportOpts;
|
|
826
828
|
const { importMethod, afterImportMethod } = opts;
|
|
827
829
|
const { type, filename } = parseFile(file);
|
|
828
830
|
// 检查类型,如果为自定义导出,则不需要校验类型
|
|
@@ -840,21 +842,21 @@ function handleFileImport($xetable, file, opts) {
|
|
|
840
842
|
const rest = new Promise((resolve, reject) => {
|
|
841
843
|
const _importResolve = (params) => {
|
|
842
844
|
resolve(params);
|
|
843
|
-
$
|
|
844
|
-
$
|
|
845
|
+
$xeTable._importResolve = null;
|
|
846
|
+
$xeTable._importReject = null;
|
|
845
847
|
};
|
|
846
848
|
const _importReject = (params) => {
|
|
847
849
|
reject(params);
|
|
848
|
-
$
|
|
849
|
-
$
|
|
850
|
+
$xeTable._importResolve = null;
|
|
851
|
+
$xeTable._importReject = null;
|
|
850
852
|
};
|
|
851
|
-
$
|
|
852
|
-
$
|
|
853
|
+
$xeTable._importResolve = _importResolve;
|
|
854
|
+
$xeTable._importReject = _importReject;
|
|
853
855
|
if (window.FileReader) {
|
|
854
856
|
const options = Object.assign({ mode: 'insertTop' }, opts, { type, filename });
|
|
855
857
|
if (options.remote) {
|
|
856
858
|
if (importMethod) {
|
|
857
|
-
Promise.resolve(importMethod({ file, options, $table: $
|
|
859
|
+
Promise.resolve(importMethod({ file, options, $table: $xeTable })).then(() => {
|
|
858
860
|
_importResolve({ status: true });
|
|
859
861
|
}).catch(() => {
|
|
860
862
|
_importResolve({ status: true });
|
|
@@ -865,14 +867,15 @@ function handleFileImport($xetable, file, opts) {
|
|
|
865
867
|
}
|
|
866
868
|
}
|
|
867
869
|
else {
|
|
868
|
-
|
|
870
|
+
const { tableFullColumn } = internalData;
|
|
871
|
+
$xeTable.preventEvent(null, 'event.import', { file, options, columns: tableFullColumn }, () => {
|
|
869
872
|
const reader = new FileReader();
|
|
870
873
|
reader.onerror = () => {
|
|
871
874
|
errLog('vxe.error.notType', [type]);
|
|
872
875
|
_importReject({ status: false });
|
|
873
876
|
};
|
|
874
877
|
reader.onload = (e) => {
|
|
875
|
-
handleImport($
|
|
878
|
+
handleImport($xeTable, e.target.result, options);
|
|
876
879
|
};
|
|
877
880
|
reader.readAsText(file, options.encoding || 'UTF-8');
|
|
878
881
|
});
|
|
@@ -886,11 +889,11 @@ function handleFileImport($xetable, file, opts) {
|
|
|
886
889
|
});
|
|
887
890
|
return rest.then(() => {
|
|
888
891
|
if (afterImportMethod) {
|
|
889
|
-
afterImportMethod({ status: true, options: opts, $table: $
|
|
892
|
+
afterImportMethod({ status: true, options: opts, $table: $xeTable });
|
|
890
893
|
}
|
|
891
894
|
}).catch((e) => {
|
|
892
895
|
if (afterImportMethod) {
|
|
893
|
-
afterImportMethod({ status: false, options: opts, $table: $
|
|
896
|
+
afterImportMethod({ status: false, options: opts, $table: $xeTable });
|
|
894
897
|
}
|
|
895
898
|
return Promise.reject(e);
|
|
896
899
|
});
|
|
@@ -54,14 +54,24 @@ export default {
|
|
|
54
54
|
if (filterSlot) {
|
|
55
55
|
return [
|
|
56
56
|
h('div', {
|
|
57
|
-
class: 'vxe-table--filter-template'
|
|
57
|
+
class: 'vxe-table--filter-template',
|
|
58
|
+
style: maxHeight
|
|
59
|
+
? {
|
|
60
|
+
maxHeight: `${maxHeight}px`
|
|
61
|
+
}
|
|
62
|
+
: {}
|
|
58
63
|
}, $xeTable.callSlot(filterSlot, params, h))
|
|
59
64
|
];
|
|
60
65
|
}
|
|
61
66
|
else if (rtFilter) {
|
|
62
67
|
return [
|
|
63
68
|
h('div', {
|
|
64
|
-
class: 'vxe-table--filter-template'
|
|
69
|
+
class: 'vxe-table--filter-template',
|
|
70
|
+
style: maxHeight
|
|
71
|
+
? {
|
|
72
|
+
maxHeight: `${maxHeight}px`
|
|
73
|
+
}
|
|
74
|
+
: {}
|
|
65
75
|
}, getSlotVNs(rtFilter.call($xeTable, h, filterRender, params)))
|
|
66
76
|
];
|
|
67
77
|
}
|
|
@@ -180,19 +190,20 @@ export default {
|
|
|
180
190
|
*************************/
|
|
181
191
|
// (单选)筛选发生改变
|
|
182
192
|
changeRadioOption(evnt, checked, item) {
|
|
183
|
-
const
|
|
193
|
+
const $xeTable = this.$parent;
|
|
194
|
+
const { filterStore } = this;
|
|
184
195
|
filterStore.options.forEach((option) => {
|
|
185
196
|
option._checked = false;
|
|
186
197
|
});
|
|
187
198
|
item._checked = checked;
|
|
188
|
-
$
|
|
199
|
+
$xeTable.checkFilterOptions();
|
|
189
200
|
this.confirmFilter(evnt);
|
|
190
201
|
},
|
|
191
202
|
// (多选)筛选发生改变
|
|
192
203
|
changeMultipleOption(evnt, checked, item) {
|
|
193
|
-
const
|
|
204
|
+
const $xeTable = this.$parent;
|
|
194
205
|
item._checked = checked;
|
|
195
|
-
$
|
|
206
|
+
$xeTable.checkFilterOptions();
|
|
196
207
|
},
|
|
197
208
|
changeAllOption(evnt, checked) {
|
|
198
209
|
if (this.filterStore.multiple) {
|
|
@@ -213,13 +224,13 @@ export default {
|
|
|
213
224
|
},
|
|
214
225
|
// 确认筛选
|
|
215
226
|
confirmFilter(evnt) {
|
|
216
|
-
const
|
|
217
|
-
$
|
|
227
|
+
const $xeTable = this.$parent;
|
|
228
|
+
$xeTable.handleFilterConfirmFilter(evnt);
|
|
218
229
|
},
|
|
219
230
|
// 重置筛选
|
|
220
231
|
resetFilter(evnt) {
|
|
221
|
-
const
|
|
222
|
-
$
|
|
232
|
+
const $xeTable = this.$parent;
|
|
233
|
+
$xeTable.handleFilterResetFilter(evnt);
|
|
223
234
|
}
|
|
224
235
|
/*************************
|
|
225
236
|
* Publish methods
|
|
@@ -95,17 +95,59 @@ function getCheckboxRangeRows($xeTable, evnt, params, targetTrElem, trRect, offs
|
|
|
95
95
|
}
|
|
96
96
|
return rangeRows;
|
|
97
97
|
}
|
|
98
|
+
function handleMoveSelected($xeTable, evnt, args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow) {
|
|
99
|
+
const internalData = $xeTable;
|
|
100
|
+
const { afterFullData, visibleColumn } = internalData;
|
|
101
|
+
const params = Object.assign({}, args);
|
|
102
|
+
const _rowIndex = $xeTable.getVTRowIndex(params.row);
|
|
103
|
+
const _columnIndex = $xeTable.getVTColumnIndex(params.column);
|
|
104
|
+
evnt.preventDefault();
|
|
105
|
+
if (isUpArrow && _rowIndex > 0) {
|
|
106
|
+
// 移动到上一行
|
|
107
|
+
params.rowIndex = _rowIndex - 1;
|
|
108
|
+
params.row = afterFullData[params.rowIndex];
|
|
109
|
+
}
|
|
110
|
+
else if (isDwArrow && _rowIndex < afterFullData.length - 1) {
|
|
111
|
+
// 移动到下一行
|
|
112
|
+
params.rowIndex = _rowIndex + 1;
|
|
113
|
+
params.row = afterFullData[params.rowIndex];
|
|
114
|
+
}
|
|
115
|
+
else if (isLeftArrow && _columnIndex) {
|
|
116
|
+
// 移动到左侧单元格
|
|
117
|
+
params.columnIndex = _columnIndex - 1;
|
|
118
|
+
params.column = visibleColumn[params.columnIndex];
|
|
119
|
+
}
|
|
120
|
+
else if (isRightArrow && _columnIndex < visibleColumn.length - 1) {
|
|
121
|
+
// 移动到右侧单元格
|
|
122
|
+
params.columnIndex = _columnIndex + 1;
|
|
123
|
+
params.column = visibleColumn[params.columnIndex];
|
|
124
|
+
}
|
|
125
|
+
$xeTable.scrollToRow(params.row, params.column).then(() => {
|
|
126
|
+
params.cell = $xeTable.getCellElement(params.row, params.column);
|
|
127
|
+
$xeTable.handleSelected(params, evnt);
|
|
128
|
+
});
|
|
129
|
+
return params;
|
|
130
|
+
}
|
|
98
131
|
export default {
|
|
99
132
|
methods: {
|
|
100
133
|
// 处理 Tab 键移动
|
|
101
134
|
moveTabSelected(args, isLeft, evnt) {
|
|
102
|
-
const
|
|
135
|
+
const $xeTable = this;
|
|
136
|
+
const props = $xeTable;
|
|
137
|
+
const internalData = $xeTable;
|
|
138
|
+
const { editConfig } = props;
|
|
139
|
+
const { afterFullData, visibleColumn } = internalData;
|
|
140
|
+
const editOpts = $xeTable.computeEditOpts;
|
|
141
|
+
const rowOpts = $xeTable.computeRowOpts;
|
|
142
|
+
const currentRowOpts = $xeTable.computeCurrentRowOpts;
|
|
143
|
+
const columnOpts = $xeTable.computeColumnOpts;
|
|
144
|
+
const currentColumnOpts = $xeTable.computeCurrentColumnOpts;
|
|
103
145
|
let targetRow;
|
|
104
146
|
let targetRowIndex;
|
|
105
147
|
let targetColumnIndex;
|
|
106
148
|
const params = Object.assign({}, args);
|
|
107
|
-
const _rowIndex =
|
|
108
|
-
const _columnIndex =
|
|
149
|
+
const _rowIndex = $xeTable.getVTRowIndex(params.row);
|
|
150
|
+
const _columnIndex = $xeTable.getVTColumnIndex(params.column);
|
|
109
151
|
evnt.preventDefault();
|
|
110
152
|
if (isLeft) {
|
|
111
153
|
// 向左
|
|
@@ -145,30 +187,46 @@ export default {
|
|
|
145
187
|
}
|
|
146
188
|
params.columnIndex = targetColumnIndex;
|
|
147
189
|
params.column = targetColumn;
|
|
148
|
-
params.cell =
|
|
190
|
+
params.cell = $xeTable.getCellElement(params.row, params.column);
|
|
191
|
+
if (rowOpts.isCurrent && currentRowOpts.isFollowSelected) {
|
|
192
|
+
$xeTable.triggerCurrentRowEvent(evnt, params);
|
|
193
|
+
}
|
|
194
|
+
if (columnOpts.isCurrent && currentColumnOpts.isFollowSelected) {
|
|
195
|
+
$xeTable.triggerCurrentColumnEvent(evnt, params);
|
|
196
|
+
}
|
|
149
197
|
if (editConfig) {
|
|
150
198
|
if (editOpts.trigger === 'click' || editOpts.trigger === 'dblclick') {
|
|
151
199
|
if (editOpts.mode === 'row') {
|
|
152
|
-
|
|
200
|
+
$xeTable.handleEdit(params, evnt);
|
|
153
201
|
}
|
|
154
202
|
else {
|
|
155
|
-
|
|
156
|
-
.then(() =>
|
|
203
|
+
$xeTable.scrollToRow(params.row, params.column)
|
|
204
|
+
.then(() => {
|
|
205
|
+
$xeTable.handleSelected(params, evnt);
|
|
206
|
+
});
|
|
157
207
|
}
|
|
158
208
|
}
|
|
159
209
|
}
|
|
160
210
|
else {
|
|
161
|
-
|
|
162
|
-
.then(() =>
|
|
211
|
+
$xeTable.scrollToRow(params.row, params.column)
|
|
212
|
+
.then(() => {
|
|
213
|
+
$xeTable.handleSelected(params, evnt);
|
|
214
|
+
});
|
|
163
215
|
}
|
|
164
216
|
}
|
|
165
217
|
},
|
|
166
218
|
// 处理当前行方向键移动
|
|
167
219
|
moveCurrentRow(isUpArrow, isDwArrow, evnt) {
|
|
168
|
-
const
|
|
220
|
+
const $xeTable = this;
|
|
221
|
+
const props = $xeTable;
|
|
222
|
+
const reactData = $xeTable;
|
|
223
|
+
const internalData = $xeTable;
|
|
224
|
+
const { treeConfig } = props;
|
|
225
|
+
const { currentRow } = reactData;
|
|
226
|
+
const { afterFullData } = internalData;
|
|
227
|
+
const treeOpts = $xeTable.computeTreeOpts;
|
|
169
228
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
170
229
|
let targetRow;
|
|
171
|
-
evnt.preventDefault();
|
|
172
230
|
if (currentRow) {
|
|
173
231
|
if (treeConfig) {
|
|
174
232
|
const { index, items } = XEUtils.findTree(afterFullData, item => item === currentRow, { children: childrenField });
|
|
@@ -180,7 +238,7 @@ export default {
|
|
|
180
238
|
}
|
|
181
239
|
}
|
|
182
240
|
else {
|
|
183
|
-
const _rowIndex =
|
|
241
|
+
const _rowIndex = $xeTable.getVTRowIndex(currentRow);
|
|
184
242
|
if (isUpArrow && _rowIndex > 0) {
|
|
185
243
|
targetRow = afterFullData[_rowIndex - 1];
|
|
186
244
|
}
|
|
@@ -193,42 +251,84 @@ export default {
|
|
|
193
251
|
targetRow = afterFullData[0];
|
|
194
252
|
}
|
|
195
253
|
if (targetRow) {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
254
|
+
evnt.preventDefault();
|
|
255
|
+
const params = {
|
|
256
|
+
$table: $xeTable,
|
|
257
|
+
row: targetRow,
|
|
258
|
+
rowIndex: $xeTable.getRowIndex(targetRow),
|
|
259
|
+
$rowIndex: $xeTable.getVMRowIndex(targetRow)
|
|
260
|
+
};
|
|
261
|
+
$xeTable.scrollToRow(targetRow)
|
|
262
|
+
.then(() => $xeTable.triggerCurrentRowEvent(evnt, params));
|
|
263
|
+
}
|
|
264
|
+
},
|
|
265
|
+
// 处理当前列方向键移动
|
|
266
|
+
moveCurrentColumn(isLeftArrow, isRightArrow, evnt) {
|
|
267
|
+
const $xeTable = this;
|
|
268
|
+
const reactData = $xeTable;
|
|
269
|
+
const internalData = $xeTable;
|
|
270
|
+
const { currentColumn } = reactData;
|
|
271
|
+
const { visibleColumn } = internalData;
|
|
272
|
+
let targetCol = null;
|
|
273
|
+
if (currentColumn) {
|
|
274
|
+
const _columnIndex = $xeTable.getVTColumnIndex(currentColumn);
|
|
275
|
+
if (isLeftArrow && _columnIndex > 0) {
|
|
276
|
+
targetCol = visibleColumn[_columnIndex - 1];
|
|
277
|
+
}
|
|
278
|
+
else if (isRightArrow && _columnIndex < visibleColumn.length - 1) {
|
|
279
|
+
targetCol = visibleColumn[_columnIndex + 1];
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
else {
|
|
283
|
+
targetCol = visibleColumn[0];
|
|
284
|
+
}
|
|
285
|
+
if (targetCol) {
|
|
286
|
+
evnt.preventDefault();
|
|
287
|
+
const params = {
|
|
288
|
+
$table: $xeTable,
|
|
289
|
+
column: targetCol,
|
|
290
|
+
columnIndex: $xeTable.getColumnIndex(targetCol),
|
|
291
|
+
$columnIndex: $xeTable.getVMColumnIndex(targetCol)
|
|
292
|
+
};
|
|
293
|
+
$xeTable.scrollToColumn(targetCol)
|
|
294
|
+
.then(() => $xeTable.triggerCurrentColumnEvent(evnt, params));
|
|
199
295
|
}
|
|
200
296
|
},
|
|
201
297
|
// 处理可编辑方向键移动
|
|
202
|
-
|
|
203
|
-
const
|
|
204
|
-
const
|
|
205
|
-
const
|
|
206
|
-
const
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
298
|
+
moveArrowSelected(args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow, evnt) {
|
|
299
|
+
const $xeTable = this;
|
|
300
|
+
const props = $xeTable;
|
|
301
|
+
const { highlightCurrentRow, highlightCurrentColumn } = props;
|
|
302
|
+
const rowOpts = $xeTable.computeRowOpts;
|
|
303
|
+
const columnOpts = $xeTable.computeColumnOpts;
|
|
304
|
+
handleMoveSelected($xeTable, evnt, args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow);
|
|
305
|
+
// 当前行按键上下移动
|
|
306
|
+
if ((isUpArrow || isDwArrow) && (rowOpts.isCurrent || highlightCurrentRow)) {
|
|
307
|
+
$xeTable.moveCurrentRow(isUpArrow, isDwArrow, evnt);
|
|
212
308
|
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
params.row = afterFullData[params.rowIndex];
|
|
309
|
+
// 当前行按键左右移动
|
|
310
|
+
if ((isLeftArrow || isRightArrow) && (columnOpts.isCurrent || highlightCurrentColumn)) {
|
|
311
|
+
$xeTable.moveCurrentColumn(isLeftArrow, isRightArrow, evnt);
|
|
217
312
|
}
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
313
|
+
},
|
|
314
|
+
moveEnterSelected(args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow, evnt) {
|
|
315
|
+
const $xeTable = this;
|
|
316
|
+
const rowOpts = $xeTable.computeRowOpts;
|
|
317
|
+
const currentRowOpts = $xeTable.computeCurrentRowOpts;
|
|
318
|
+
const columnOpts = $xeTable.computeColumnOpts;
|
|
319
|
+
const currentColumnOpts = $xeTable.computeCurrentColumnOpts;
|
|
320
|
+
const params = handleMoveSelected($xeTable, evnt, args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow);
|
|
321
|
+
if ((rowOpts.isCurrent && currentRowOpts.isFollowSelected)) {
|
|
322
|
+
$xeTable.triggerCurrentRowEvent(evnt, params);
|
|
222
323
|
}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
params.columnIndex = _columnIndex + 1;
|
|
226
|
-
params.column = visibleColumn[params.columnIndex];
|
|
324
|
+
if (columnOpts.isCurrent && currentColumnOpts.isFollowSelected) {
|
|
325
|
+
$xeTable.triggerCurrentColumnEvent(evnt, params);
|
|
227
326
|
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
327
|
+
},
|
|
328
|
+
// 处理可编辑方向键移动
|
|
329
|
+
moveSelected(args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow, evnt) {
|
|
330
|
+
const $xeTable = this;
|
|
331
|
+
handleMoveSelected($xeTable, evnt, args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow);
|
|
232
332
|
},
|
|
233
333
|
handleCellMousedownEvent(evnt, params) {
|
|
234
334
|
const $xeTable = this;
|
|
@@ -58,6 +58,7 @@ export default {
|
|
|
58
58
|
*/
|
|
59
59
|
handleGlobalContextmenuEvent(evnt) {
|
|
60
60
|
const $xeTable = this;
|
|
61
|
+
const $xeGrid = $xeTable.$xeGrid;
|
|
61
62
|
const internalData = $xeTable;
|
|
62
63
|
const { $refs, tId, editStore, menuConfig, contextMenu, ctxMenuStore, ctxMenuOpts, mouseConfig, mouseOpts } = this;
|
|
63
64
|
const { selected } = editStore;
|
|
@@ -70,7 +71,7 @@ export default {
|
|
|
70
71
|
}
|
|
71
72
|
if (internalData._keyCtx) {
|
|
72
73
|
const type = 'body';
|
|
73
|
-
const params = { type, $grid:
|
|
74
|
+
const params = { type, $grid: $xeGrid, $table: this, keyboard: true, columns: this.visibleColumn.slice(0), $event: evnt };
|
|
74
75
|
// 如果开启单元格区域
|
|
75
76
|
if (mouseConfig && mouseOpts.area) {
|
|
76
77
|
const activeArea = this.getActiveCellArea();
|
|
@@ -98,7 +99,7 @@ export default {
|
|
|
98
99
|
// target=td|th,直接向上找 table 去匹配即可
|
|
99
100
|
return target.parentNode.parentNode.parentNode.getAttribute('xid') === tId;
|
|
100
101
|
});
|
|
101
|
-
const params = { type: layout, $grid:
|
|
102
|
+
const params = { type: layout, $grid: $xeGrid, $table: this, columns: this.visibleColumn.slice(0), $event: evnt };
|
|
102
103
|
if (columnTargetNode.flag) {
|
|
103
104
|
const cell = columnTargetNode.targetElem;
|
|
104
105
|
const column = this.getColumnNode(cell).item;
|
|
@@ -261,10 +262,12 @@ export default {
|
|
|
261
262
|
* 快捷菜单点击事件
|
|
262
263
|
*/
|
|
263
264
|
ctxMenuLinkEvent(evnt, menu) {
|
|
265
|
+
const $xeTable = this;
|
|
266
|
+
const $xeGrid = $xeTable.$xeGrid;
|
|
264
267
|
// 如果一级菜单有配置 code 则允许点击,否则不能点击
|
|
265
268
|
if (!menu.disabled && (menu.code || !menu.children || !menu.children.length)) {
|
|
266
269
|
const gMenuOpts = menus.get(menu.code);
|
|
267
|
-
const params = Object.assign({ menu, $grid:
|
|
270
|
+
const params = Object.assign({ menu, $grid: $xeGrid, $table: this, $event: evnt }, this.ctxMenuStore.args);
|
|
268
271
|
if (gMenuOpts && gMenuOpts.menuMethod) {
|
|
269
272
|
gMenuOpts.menuMethod(params, evnt);
|
|
270
273
|
}
|
|
@@ -17,7 +17,7 @@ export default {
|
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
19
|
render(h) {
|
|
20
|
-
const $
|
|
20
|
+
const $xeTable = this.$parent;
|
|
21
21
|
const { _e, ctxMenuOpts, ctxMenuStore } = this;
|
|
22
22
|
return h('div', {
|
|
23
23
|
class: ['vxe-table--context-menu-wrapper', ctxMenuOpts.className, {
|
|
@@ -47,13 +47,13 @@ export default {
|
|
|
47
47
|
class: 'vxe-context-menu--link',
|
|
48
48
|
on: {
|
|
49
49
|
click(evnt) {
|
|
50
|
-
$
|
|
50
|
+
$xeTable.ctxMenuLinkEvent(evnt, item);
|
|
51
51
|
},
|
|
52
52
|
mouseover(evnt) {
|
|
53
|
-
$
|
|
53
|
+
$xeTable.ctxMenuMouseoverEvent(evnt, item);
|
|
54
54
|
},
|
|
55
55
|
mouseout(evnt) {
|
|
56
|
-
$
|
|
56
|
+
$xeTable.ctxMenuMouseoutEvent(evnt, item);
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
}, [
|
|
@@ -98,13 +98,13 @@ export default {
|
|
|
98
98
|
class: 'vxe-context-menu--link',
|
|
99
99
|
on: {
|
|
100
100
|
click(evnt) {
|
|
101
|
-
$
|
|
101
|
+
$xeTable.ctxMenuLinkEvent(evnt, child);
|
|
102
102
|
},
|
|
103
103
|
mouseover(evnt) {
|
|
104
|
-
$
|
|
104
|
+
$xeTable.ctxMenuMouseoverEvent(evnt, item, child);
|
|
105
105
|
},
|
|
106
106
|
mouseout(evnt) {
|
|
107
|
-
$
|
|
107
|
+
$xeTable.ctxMenuMouseoutEvent(evnt, item);
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
}, [
|
|
@@ -149,13 +149,10 @@ export default {
|
|
|
149
149
|
beginValidate(rows, cols, cb, isFull) {
|
|
150
150
|
const $xeTable = this;
|
|
151
151
|
const props = $xeTable;
|
|
152
|
-
const reactData = $xeTable;
|
|
153
152
|
const internalData = $xeTable;
|
|
154
153
|
const validRest = {};
|
|
155
154
|
const { editRules, treeConfig } = props;
|
|
156
|
-
const {
|
|
157
|
-
const { afterFullData } = internalData;
|
|
158
|
-
const { removeMaps } = editStore;
|
|
155
|
+
const { afterFullData, pendingRowMaps, removeRowMaps } = internalData;
|
|
159
156
|
const treeOpts = $xeTable.computeTreeOpts;
|
|
160
157
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
161
158
|
let validList;
|
|
@@ -183,7 +180,7 @@ export default {
|
|
|
183
180
|
const handleVaild = (row) => {
|
|
184
181
|
const rowid = getRowid($xeTable, row);
|
|
185
182
|
// 是否删除
|
|
186
|
-
if (
|
|
183
|
+
if (removeRowMaps[rowid]) {
|
|
187
184
|
return;
|
|
188
185
|
}
|
|
189
186
|
// 是否标记删除
|
package/es/table/render/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { getCellValue, setCellValue } from '../src/util';
|
|
|
4
4
|
import { getFuncText, formatText, isEmptyValue } from '../../ui/src/utils';
|
|
5
5
|
import { getOnName, getModelEvent, getChangeEvent } from '../../ui/src/vn';
|
|
6
6
|
import { errLog } from '../../ui/src/log';
|
|
7
|
-
const { getConfig, renderer, getI18n } = VxeUI;
|
|
7
|
+
const { getConfig, renderer, getI18n, getComponent } = VxeUI;
|
|
8
8
|
const componentDefaultModelProp = 'value';
|
|
9
9
|
const defaultCompProps = {};
|
|
10
10
|
function handleDefaultValue(value, defaultVal, initVal) {
|
|
@@ -35,7 +35,7 @@ function getOldComponent({ name }) {
|
|
|
35
35
|
return getOldComponentName(name);
|
|
36
36
|
}
|
|
37
37
|
function getDefaultComponent({ name }) {
|
|
38
|
-
return name;
|
|
38
|
+
return getComponent(name) || name;
|
|
39
39
|
}
|
|
40
40
|
function handleConfirmFilter(params, checked, option) {
|
|
41
41
|
const { $panel } = params;
|