vxe-table 3.14.0-beta.26 → 3.14.0-beta.28
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 +1 -2
- 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 +3 -2
- 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 +31 -28
- package/es/table/module/filter/panel.js +9 -8
- package/es/table/module/menu/mixin.js +6 -3
- package/es/table/module/menu/panel.js +7 -7
- package/es/table/src/body.js +8 -3
- package/es/table/src/cell.js +2 -2
- package/es/table/src/column.js +11 -9
- package/es/table/src/columnInfo.js +6 -6
- package/es/table/src/footer.js +6 -2
- package/es/table/src/group.js +6 -5
- package/es/table/src/header.js +9 -4
- package/es/table/src/methods.js +46 -32
- package/es/table/src/table.js +11 -21
- package/es/table/src/util.js +19 -12
- package/es/toolbar/src/toolbar.js +3 -3
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/grid/src/grid.js +1 -2
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.umd.js +241 -221
- package/lib/index.umd.min.js +1 -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 +3 -2
- 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 +36 -35
- package/lib/table/module/export/mixin.min.js +1 -1
- package/lib/table/module/filter/panel.js +8 -14
- package/lib/table/module/filter/panel.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/src/body.js +8 -3
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/cell.js +2 -2
- 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 +6 -2
- 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 +10 -5
- package/lib/table/src/header.min.js +1 -1
- package/lib/table/src/methods.js +48 -40
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/table.js +14 -25
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +24 -13
- package/lib/table/src/util.min.js +1 -1
- package/lib/toolbar/src/toolbar.js +3 -3
- 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 +1 -2
- 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 +3 -2
- 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 +38 -33
- package/packages/table/module/filter/panel.ts +13 -8
- package/packages/table/module/menu/mixin.ts +12 -6
- package/packages/table/module/menu/panel.ts +10 -7
- package/packages/table/src/body.ts +8 -3
- package/packages/table/src/cell.ts +2 -2
- package/packages/table/src/column.ts +14 -10
- package/packages/table/src/columnInfo.ts +9 -6
- package/packages/table/src/footer.ts +6 -2
- package/packages/table/src/group.ts +9 -5
- package/packages/table/src/header.ts +10 -4
- package/packages/table/src/methods.ts +57 -35
- package/packages/table/src/table.ts +12 -21
- package/packages/table/src/util.ts +22 -12
- package/packages/toolbar/src/toolbar.ts +3 -3
- /package/es/{iconfont.1742788336957.ttf → iconfont.1742809042196.ttf} +0 -0
- /package/es/{iconfont.1742788336957.woff → iconfont.1742809042196.woff} +0 -0
- /package/es/{iconfont.1742788336957.woff2 → iconfont.1742809042196.woff2} +0 -0
- /package/lib/{iconfont.1742788336957.ttf → iconfont.1742809042196.ttf} +0 -0
- /package/lib/{iconfont.1742788336957.woff → iconfont.1742809042196.woff} +0 -0
- /package/lib/{iconfont.1742788336957.woff2 → iconfont.1742809042196.woff2} +0 -0
|
@@ -89,6 +89,7 @@ const renderSimplePanel = (h, _vm) => {
|
|
|
89
89
|
const props = _vm;
|
|
90
90
|
const $xeTable = _vm.$xeTable;
|
|
91
91
|
const reactData = $xeTable;
|
|
92
|
+
const $xeGrid = $xeTable.$xeGrid;
|
|
92
93
|
const { customStore } = props;
|
|
93
94
|
const { isCustomStatus, customColumnList } = reactData;
|
|
94
95
|
const customOpts = $xeTable.computeCustomOpts;
|
|
@@ -115,7 +116,7 @@ const renderSimplePanel = (h, _vm) => {
|
|
|
115
116
|
}
|
|
116
117
|
const params = {
|
|
117
118
|
$table: $xeTable,
|
|
118
|
-
$grid: $
|
|
119
|
+
$grid: $xeGrid,
|
|
119
120
|
columns: customColumnList,
|
|
120
121
|
isAllChecked,
|
|
121
122
|
isAllIndeterminate,
|
|
@@ -253,7 +254,7 @@ const renderSimplePanel = (h, _vm) => {
|
|
|
253
254
|
class: ['vxe-table-custom-wrapper', `placement--${placement}`, {
|
|
254
255
|
'is--active': customStore.visible
|
|
255
256
|
}],
|
|
256
|
-
style: maxHeight && !['left', 'right'].includes(placement)
|
|
257
|
+
style: maxHeight && !['left', 'right'].includes(placement || '')
|
|
257
258
|
? {
|
|
258
259
|
maxHeight: `${maxHeight}px`
|
|
259
260
|
}
|
|
@@ -391,6 +392,7 @@ const renderPopupPanel = (h, _vm) => {
|
|
|
391
392
|
const $xeTable = _vm.$xeTable;
|
|
392
393
|
const tableProps = $xeTable;
|
|
393
394
|
const reactData = $xeTable;
|
|
395
|
+
const $xeGrid = $xeTable.$xeGrid;
|
|
394
396
|
const { customStore } = props;
|
|
395
397
|
const { resizable: allResizable } = tableProps;
|
|
396
398
|
const { isCustomStatus, customColumnList } = reactData;
|
|
@@ -417,7 +419,7 @@ const renderPopupPanel = (h, _vm) => {
|
|
|
417
419
|
const isAllIndeterminate = customStore.isIndeterminate;
|
|
418
420
|
const params = {
|
|
419
421
|
$table: $xeTable,
|
|
420
|
-
$grid: $
|
|
422
|
+
$grid: $xeGrid,
|
|
421
423
|
columns: customColumnList,
|
|
422
424
|
isAllChecked,
|
|
423
425
|
isAllIndeterminate,
|
|
@@ -802,9 +804,6 @@ export default {
|
|
|
802
804
|
inject: {
|
|
803
805
|
$xeTable: {
|
|
804
806
|
default: null
|
|
805
|
-
},
|
|
806
|
-
$xetable: {
|
|
807
|
-
default: null
|
|
808
807
|
}
|
|
809
808
|
},
|
|
810
809
|
data() {
|
|
@@ -822,8 +821,8 @@ export default {
|
|
|
822
821
|
const VxeUINumberInputComponent = VxeUI.getComponent('VxeNumberInput');
|
|
823
822
|
const VxeUIRadioGroupComponent = VxeUI.getComponent('VxeRadioGroup');
|
|
824
823
|
this.$nextTick(() => {
|
|
825
|
-
const
|
|
826
|
-
const { customOpts } = $
|
|
824
|
+
const $xeTable = this.$xeTable;
|
|
825
|
+
const { customOpts } = $xeTable;
|
|
827
826
|
const { mode } = customOpts;
|
|
828
827
|
if (!VxeUIModalComponent) {
|
|
829
828
|
errLog('vxe.error.reqComp', ['vxe-modal']);
|
|
@@ -852,16 +851,18 @@ export default {
|
|
|
852
851
|
},
|
|
853
852
|
methods: {
|
|
854
853
|
handleWrapperMouseenterEvent(evnt) {
|
|
855
|
-
const
|
|
854
|
+
const $xeTable = this.$xeTable;
|
|
855
|
+
const { customStore } = this;
|
|
856
856
|
customStore.activeWrapper = true;
|
|
857
|
-
$
|
|
857
|
+
$xeTable.customOpenEvent(evnt);
|
|
858
858
|
},
|
|
859
859
|
handleWrapperMouseleaveEvent(evnt) {
|
|
860
|
-
const
|
|
860
|
+
const $xeTable = this.$xeTable;
|
|
861
|
+
const { customStore } = this;
|
|
861
862
|
customStore.activeWrapper = false;
|
|
862
863
|
setTimeout(() => {
|
|
863
864
|
if (!customStore.activeBtn && !customStore.activeWrapper) {
|
|
864
|
-
$
|
|
865
|
+
$xeTable.customCloseEvent(evnt);
|
|
865
866
|
}
|
|
866
867
|
}, 300);
|
|
867
868
|
},
|
|
@@ -888,10 +889,10 @@ export default {
|
|
|
888
889
|
$xeTable.emitCustomEvent('cancel', $event);
|
|
889
890
|
},
|
|
890
891
|
handleResetCustomEvent(evnt) {
|
|
891
|
-
const
|
|
892
|
-
$
|
|
893
|
-
$
|
|
894
|
-
$
|
|
892
|
+
const $xeTable = this.$xeTable;
|
|
893
|
+
$xeTable.resetCustom(true);
|
|
894
|
+
$xeTable.closeCustom();
|
|
895
|
+
$xeTable.emitCustomEvent('reset', evnt);
|
|
895
896
|
},
|
|
896
897
|
resetCustomEvent(evnt) {
|
|
897
898
|
if (VxeUI.modal) {
|
|
@@ -964,7 +965,7 @@ export default {
|
|
|
964
965
|
$xeTable.checkCustomStatus();
|
|
965
966
|
},
|
|
966
967
|
changeColumnWidth(column) {
|
|
967
|
-
const $xeTable = this.$
|
|
968
|
+
const $xeTable = this.$xeTable;
|
|
968
969
|
const reactData = $xeTable;
|
|
969
970
|
const customOpts = $xeTable.computeCustomOpts;
|
|
970
971
|
if (customOpts.immediate) {
|
|
@@ -978,7 +979,7 @@ export default {
|
|
|
978
979
|
}
|
|
979
980
|
},
|
|
980
981
|
changeFixedOption(column, colFixed) {
|
|
981
|
-
const $xeTable = this.$
|
|
982
|
+
const $xeTable = this.$xeTable;
|
|
982
983
|
const reactData = $xeTable;
|
|
983
984
|
const isMaxFixedColumn = $xeTable.computeIsMaxFixedColumn;
|
|
984
985
|
const customOpts = $xeTable.computeCustomOpts;
|
|
@@ -1017,11 +1018,11 @@ export default {
|
|
|
1017
1018
|
}
|
|
1018
1019
|
},
|
|
1019
1020
|
allOptionEvent() {
|
|
1020
|
-
const
|
|
1021
|
-
$
|
|
1021
|
+
const $xeTable = this.$xeTable;
|
|
1022
|
+
$xeTable.toggleCustomAllCheckbox();
|
|
1022
1023
|
},
|
|
1023
1024
|
sortMousedownEvent(evnt) {
|
|
1024
|
-
const $xeTable = this.$
|
|
1025
|
+
const $xeTable = this.$xeTable;
|
|
1025
1026
|
const btnEl = evnt.currentTarget;
|
|
1026
1027
|
const cellEl = btnEl.parentElement;
|
|
1027
1028
|
const tdEl = cellEl.parentElement;
|
|
@@ -1048,7 +1049,7 @@ export default {
|
|
|
1048
1049
|
}
|
|
1049
1050
|
},
|
|
1050
1051
|
sortDragendEvent(evnt) {
|
|
1051
|
-
const $xeTable = this.$
|
|
1052
|
+
const $xeTable = this.$xeTable;
|
|
1052
1053
|
const tableProps = $xeTable;
|
|
1053
1054
|
const reactData = $xeTable;
|
|
1054
1055
|
const internalData = $xeTable;
|
|
@@ -1222,7 +1223,7 @@ export default {
|
|
|
1222
1223
|
removeClass(trEl, 'active--drag-origin');
|
|
1223
1224
|
},
|
|
1224
1225
|
sortDragoverEvent(evnt) {
|
|
1225
|
-
const $xeTable = this.$
|
|
1226
|
+
const $xeTable = this.$xeTable;
|
|
1226
1227
|
const { dragCol } = this;
|
|
1227
1228
|
const customOpts = $xeTable.computeCustomOpts;
|
|
1228
1229
|
const { immediate } = customOpts;
|
|
@@ -318,6 +318,7 @@ function handleClearEdit($xeTable, evnt, targetRow) {
|
|
|
318
318
|
function handleEditActive($xeTable, params, evnt, isFocus, isPos) {
|
|
319
319
|
const props = $xeTable;
|
|
320
320
|
const reactData = $xeTable;
|
|
321
|
+
const $xeGrid = $xeTable.$xeGrid;
|
|
321
322
|
const { editConfig, mouseConfig } = props;
|
|
322
323
|
const { editStore, tableColumn } = reactData;
|
|
323
324
|
const editOpts = $xeTable.computeEditOpts;
|
|
@@ -334,7 +335,7 @@ function handleEditActive($xeTable, params, evnt, isFocus, isPos) {
|
|
|
334
335
|
if (actived.row !== row || (mode === 'cell' ? actived.column !== column : false)) {
|
|
335
336
|
// 判断是否禁用编辑
|
|
336
337
|
let type = 'edit-disabled';
|
|
337
|
-
if (!beforeEditMethod || beforeEditMethod(Object.assign(Object.assign({}, params), { $table: $xeTable, $grid: $
|
|
338
|
+
if (!beforeEditMethod || beforeEditMethod(Object.assign(Object.assign({}, params), { $table: $xeTable, $grid: $xeGrid }))) {
|
|
338
339
|
if (mouseConfig) {
|
|
339
340
|
$xeTable.clearSelected();
|
|
340
341
|
if ($xeTable.clearCellAreas) {
|
|
@@ -363,7 +364,7 @@ function handleEditActive($xeTable, params, evnt, isFocus, isPos) {
|
|
|
363
364
|
$xeTable.handleFocus(params, evnt);
|
|
364
365
|
}
|
|
365
366
|
if (afterEditMethod) {
|
|
366
|
-
afterEditMethod(Object.assign(Object.assign({}, params), { $table: $xeTable, $grid: $
|
|
367
|
+
afterEditMethod(Object.assign(Object.assign({}, params), { $table: $xeTable, $grid: $xeGrid }));
|
|
367
368
|
}
|
|
368
369
|
});
|
|
369
370
|
}
|
|
@@ -78,6 +78,7 @@ export default {
|
|
|
78
78
|
},
|
|
79
79
|
render(h) {
|
|
80
80
|
const $xeTable = this.$xeTable;
|
|
81
|
+
const $xeGrid = $xeTable.$xeGrid;
|
|
81
82
|
const { _e, checkedAll, isAll: isAllChecked, isIndeterminate: isAllIndeterminate, showSheet, supportMerge, supportStyle, defaultOptions, storeData } = this;
|
|
82
83
|
const { hasTree, hasMerge, isPrint, hasColgroup, columns } = storeData;
|
|
83
84
|
const { isHeader } = defaultOptions;
|
|
@@ -158,7 +159,7 @@ export default {
|
|
|
158
159
|
default: () => {
|
|
159
160
|
const params = {
|
|
160
161
|
$table: $xeTable,
|
|
161
|
-
$grid: $
|
|
162
|
+
$grid: $xeGrid,
|
|
162
163
|
options: defaultOptions,
|
|
163
164
|
columns,
|
|
164
165
|
params: defaultOptions.params
|
|
@@ -426,7 +427,7 @@ export default {
|
|
|
426
427
|
footer: () => {
|
|
427
428
|
const params = {
|
|
428
429
|
$table: $xeTable,
|
|
429
|
-
$grid: $
|
|
430
|
+
$grid: $xeGrid,
|
|
430
431
|
options: defaultOptions,
|
|
431
432
|
columns,
|
|
432
433
|
params: defaultOptions.params
|
|
@@ -531,9 +532,9 @@ export default {
|
|
|
531
532
|
}
|
|
532
533
|
},
|
|
533
534
|
printEvent() {
|
|
534
|
-
const $
|
|
535
|
+
const $xeTable = this.$parent;
|
|
535
536
|
this.storeData.visible = false;
|
|
536
|
-
$
|
|
537
|
+
$xeTable.print(Object.assign({}, $xeTable.printOpts, this.getExportOption()));
|
|
537
538
|
},
|
|
538
539
|
exportEvent() {
|
|
539
540
|
const $xeTable = this.$xeTable;
|
|
@@ -61,7 +61,8 @@ export default {
|
|
|
61
61
|
});
|
|
62
62
|
},
|
|
63
63
|
render(h) {
|
|
64
|
-
const $xeTable = this.$
|
|
64
|
+
const $xeTable = this.$parent;
|
|
65
|
+
const $xeGrid = $xeTable.$xeGrid;
|
|
65
66
|
const { hasFile, loading, parseTypeLabel, defaultOptions, storeData, selectName } = this;
|
|
66
67
|
const slots = defaultOptions.slots || {};
|
|
67
68
|
const topSlot = slots.top;
|
|
@@ -96,7 +97,7 @@ export default {
|
|
|
96
97
|
default: () => {
|
|
97
98
|
const params = {
|
|
98
99
|
$table: $xeTable,
|
|
99
|
-
$grid: $
|
|
100
|
+
$grid: $xeGrid,
|
|
100
101
|
options: defaultOptions,
|
|
101
102
|
params: defaultOptions.params
|
|
102
103
|
};
|
|
@@ -185,7 +186,7 @@ export default {
|
|
|
185
186
|
footer: () => {
|
|
186
187
|
const params = {
|
|
187
188
|
$table: $xeTable,
|
|
188
|
-
$grid: $
|
|
189
|
+
$grid: $xeGrid,
|
|
189
190
|
options: defaultOptions,
|
|
190
191
|
params: defaultOptions.params
|
|
191
192
|
};
|
|
@@ -226,8 +227,8 @@ export default {
|
|
|
226
227
|
});
|
|
227
228
|
},
|
|
228
229
|
selectFileEvent() {
|
|
229
|
-
const $
|
|
230
|
-
$
|
|
230
|
+
const $xeTable = this.$parent;
|
|
231
|
+
$xeTable.readFile(this.defaultOptions).then((params) => {
|
|
231
232
|
const { file } = params;
|
|
232
233
|
Object.assign(this.storeData, parseFile(file), { file });
|
|
233
234
|
}).catch((e) => e);
|
|
@@ -245,9 +246,9 @@ export default {
|
|
|
245
246
|
this.storeData.visible = false;
|
|
246
247
|
},
|
|
247
248
|
importEvent() {
|
|
248
|
-
const $
|
|
249
|
+
const $xeTable = this.$parent;
|
|
249
250
|
this.loading = true;
|
|
250
|
-
$
|
|
251
|
+
$xeTable.importByFile(this.storeData.file, Object.assign({}, $xeTable.importOpts, this.defaultOptions)).then(() => {
|
|
251
252
|
this.loading = false;
|
|
252
253
|
this.storeData.visible = false;
|
|
253
254
|
}).catch(() => {
|
|
@@ -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
|
});
|
|
@@ -999,7 +1002,7 @@ function handleExportAndPrint($xeTable, options, isPrint) {
|
|
|
999
1002
|
const props = $xeTable;
|
|
1000
1003
|
const reactData = $xeTable;
|
|
1001
1004
|
const internalData = $xeTable;
|
|
1002
|
-
const $xeGrid = $xeTable
|
|
1005
|
+
const $xeGrid = $xeTable.$xeGrid;
|
|
1003
1006
|
const { treeConfig, showHeader, showFooter } = props;
|
|
1004
1007
|
const { initStore, mergeList, mergeFooterList, isGroup, footerTableData, exportStore, exportParams } = reactData;
|
|
1005
1008
|
const { collectColumn } = internalData;
|
|
@@ -190,19 +190,20 @@ export default {
|
|
|
190
190
|
*************************/
|
|
191
191
|
// (单选)筛选发生改变
|
|
192
192
|
changeRadioOption(evnt, checked, item) {
|
|
193
|
-
const
|
|
193
|
+
const $xeTable = this.$parent;
|
|
194
|
+
const { filterStore } = this;
|
|
194
195
|
filterStore.options.forEach((option) => {
|
|
195
196
|
option._checked = false;
|
|
196
197
|
});
|
|
197
198
|
item._checked = checked;
|
|
198
|
-
$
|
|
199
|
+
$xeTable.checkFilterOptions();
|
|
199
200
|
this.confirmFilter(evnt);
|
|
200
201
|
},
|
|
201
202
|
// (多选)筛选发生改变
|
|
202
203
|
changeMultipleOption(evnt, checked, item) {
|
|
203
|
-
const
|
|
204
|
+
const $xeTable = this.$parent;
|
|
204
205
|
item._checked = checked;
|
|
205
|
-
$
|
|
206
|
+
$xeTable.checkFilterOptions();
|
|
206
207
|
},
|
|
207
208
|
changeAllOption(evnt, checked) {
|
|
208
209
|
if (this.filterStore.multiple) {
|
|
@@ -223,13 +224,13 @@ export default {
|
|
|
223
224
|
},
|
|
224
225
|
// 确认筛选
|
|
225
226
|
confirmFilter(evnt) {
|
|
226
|
-
const
|
|
227
|
-
$
|
|
227
|
+
const $xeTable = this.$parent;
|
|
228
|
+
$xeTable.handleFilterConfirmFilter(evnt);
|
|
228
229
|
},
|
|
229
230
|
// 重置筛选
|
|
230
231
|
resetFilter(evnt) {
|
|
231
|
-
const
|
|
232
|
-
$
|
|
232
|
+
const $xeTable = this.$parent;
|
|
233
|
+
$xeTable.handleFilterResetFilter(evnt);
|
|
233
234
|
}
|
|
234
235
|
/*************************
|
|
235
236
|
* Publish methods
|
|
@@ -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
|
}, [
|
package/es/table/src/body.js
CHANGED
|
@@ -62,6 +62,7 @@ function renderTdColumn(h, _vm, seq, rowid, fixedType, isOptimizeMode, rowLevel,
|
|
|
62
62
|
const tableProps = $xeTable;
|
|
63
63
|
const tableReactData = $xeTable;
|
|
64
64
|
const tableInternalData = $xeTable;
|
|
65
|
+
const $xeGrid = $xeTable.$xeGrid;
|
|
65
66
|
const { fullAllDataRowIdData, visibleColumn } = tableInternalData;
|
|
66
67
|
const { columnKey, resizable: allResizable, showOverflow: allShowOverflow, border, height, cellClassName: allCellClassName, cellStyle, align: allAlign, spanMethod, mouseConfig, editConfig, editRules, tooltipConfig, padding: allPadding } = tableProps;
|
|
67
68
|
const { tableData, dragRow, overflowX, currentColumn, scrollXLoad, scrollYLoad, calcCellHeightFlag, resizeHeightFlag, resizeWidthFlag, mergeList, editStore, isAllOverflow, validErrorMaps } = tableReactData;
|
|
@@ -115,7 +116,7 @@ function renderTdColumn(h, _vm, seq, rowid, fixedType, isOptimizeMode, rowLevel,
|
|
|
115
116
|
const tdAttrs = { colid };
|
|
116
117
|
const cellParams = {
|
|
117
118
|
$table: $xeTable,
|
|
118
|
-
$grid: $
|
|
119
|
+
$grid: $xeGrid,
|
|
119
120
|
isEdit: false,
|
|
120
121
|
seq,
|
|
121
122
|
rowid,
|
|
@@ -628,6 +629,7 @@ export default {
|
|
|
628
629
|
const tableProps = $xeTable;
|
|
629
630
|
const tableReactData = $xeTable;
|
|
630
631
|
const tableInternalData = $xeTable;
|
|
632
|
+
const $xeGrid = $xeTable.$xeGrid;
|
|
631
633
|
const { xID, $scopedSlots } = $xeTable;
|
|
632
634
|
const { fixedColumn, fixedType, tableColumn } = props;
|
|
633
635
|
const { spanMethod, footerSpanMethod, mouseConfig } = tableProps;
|
|
@@ -708,7 +710,7 @@ export default {
|
|
|
708
710
|
}
|
|
709
711
|
let emptyContent;
|
|
710
712
|
if ($scopedSlots.empty) {
|
|
711
|
-
emptyContent = $scopedSlots.empty.call(this, { $table: $xeTable, $grid: $
|
|
713
|
+
emptyContent = $scopedSlots.empty.call(this, { $table: $xeTable, $grid: $xeGrid });
|
|
712
714
|
}
|
|
713
715
|
else {
|
|
714
716
|
const compConf = emptyOpts.name ? renderer.get(emptyOpts.name) : null;
|
|
@@ -767,7 +769,10 @@ export default {
|
|
|
767
769
|
attrs: {
|
|
768
770
|
name: column.id
|
|
769
771
|
},
|
|
770
|
-
key: $columnIndex
|
|
772
|
+
key: $columnIndex,
|
|
773
|
+
style: {
|
|
774
|
+
width: `${column.renderWidth}px`
|
|
775
|
+
}
|
|
771
776
|
});
|
|
772
777
|
})),
|
|
773
778
|
/**
|
package/es/table/src/cell.js
CHANGED
|
@@ -304,7 +304,7 @@ function renderFooterHandle(h, params) {
|
|
|
304
304
|
return Cell.renderDefaultFooter(h, params);
|
|
305
305
|
}
|
|
306
306
|
export const Cell = {
|
|
307
|
-
createColumn($
|
|
307
|
+
createColumn($xeTable, _vm) {
|
|
308
308
|
const { type } = _vm;
|
|
309
309
|
const renConfs = {
|
|
310
310
|
renderHeader: renderHeaderHandle,
|
|
@@ -314,7 +314,7 @@ export const Cell = {
|
|
|
314
314
|
if (type === 'expand') {
|
|
315
315
|
renConfs.renderData = Cell.renderExpandData;
|
|
316
316
|
}
|
|
317
|
-
return createColumn($
|
|
317
|
+
return createColumn($xeTable, _vm, renConfs);
|
|
318
318
|
},
|
|
319
319
|
/**
|
|
320
320
|
* 列头标题
|