vxe-table 4.19.4 → 4.19.6
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/dist/all.esm.js +188 -31
- package/dist/style.css +1 -1
- package/es/style.css +1 -1
- package/es/table/module/export/hook.js +3 -3
- package/es/table/src/cell.js +8 -7
- package/es/table/src/columnInfo.js +1 -4
- package/es/table/src/emits.js +1 -0
- package/es/table/src/table.js +135 -12
- package/es/table/src/util.js +28 -8
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/index.umd.js +65 -43
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/module/export/hook.js +3 -3
- package/lib/table/module/export/hook.min.js +1 -1
- package/lib/table/src/cell.js +8 -8
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/columnInfo.js +1 -5
- package/lib/table/src/columnInfo.min.js +1 -1
- package/lib/table/src/emits.js +1 -1
- package/lib/table/src/emits.min.js +1 -1
- package/lib/table/src/table.js +17 -14
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +31 -7
- package/lib/table/src/util.min.js +1 -1
- package/lib/ui/index.js +1 -1
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/package.json +2 -2
- package/packages/table/module/export/hook.ts +3 -3
- package/packages/table/src/cell.ts +8 -7
- package/packages/table/src/columnInfo.ts +1 -5
- package/packages/table/src/emits.ts +1 -0
- package/packages/table/src/table.ts +137 -13
- package/packages/table/src/util.ts +27 -8
- /package/es/{iconfont.1779936744129.ttf → iconfont.1780293024194.ttf} +0 -0
- /package/es/{iconfont.1779936744129.woff → iconfont.1780293024194.woff} +0 -0
- /package/es/{iconfont.1779936744129.woff2 → iconfont.1780293024194.woff2} +0 -0
- /package/lib/{iconfont.1779936744129.ttf → iconfont.1780293024194.ttf} +0 -0
- /package/lib/{iconfont.1779936744129.woff → iconfont.1780293024194.woff} +0 -0
- /package/lib/{iconfont.1779936744129.woff2 → iconfont.1780293024194.woff2} +0 -0
package/lib/index.umd.js
CHANGED
|
@@ -3314,7 +3314,7 @@ function getDefaultConfig(val1, def1) {
|
|
|
3314
3314
|
/* unused harmony import specifier */ var VxeUI;
|
|
3315
3315
|
|
|
3316
3316
|
|
|
3317
|
-
const version = "4.19.
|
|
3317
|
+
const version = "4.19.6";
|
|
3318
3318
|
core_.VxeUI.version = version;
|
|
3319
3319
|
core_.VxeUI.tableVersion = version;
|
|
3320
3320
|
core_.VxeUI.setConfig({
|
|
@@ -3848,7 +3848,7 @@ var es_iterator_some = __webpack_require__(3579);
|
|
|
3848
3848
|
const {
|
|
3849
3849
|
log: log_log
|
|
3850
3850
|
} = core_.VxeUI;
|
|
3851
|
-
const log_version = `table v${"4.19.
|
|
3851
|
+
const log_version = `table v${"4.19.6"}`;
|
|
3852
3852
|
const warnLog = log_log.create('warn', log_version);
|
|
3853
3853
|
const errLog = log_log.create('error', log_version);
|
|
3854
3854
|
;// ./packages/table/src/columnInfo.ts
|
|
@@ -3877,8 +3877,7 @@ class ColumnInfo {
|
|
|
3877
3877
|
const {
|
|
3878
3878
|
field,
|
|
3879
3879
|
editRender,
|
|
3880
|
-
filterRender
|
|
3881
|
-
headerFormatter
|
|
3880
|
+
filterRender
|
|
3882
3881
|
} = _vm;
|
|
3883
3882
|
const colId = _vm.colId || external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().uniqueId('col_');
|
|
3884
3883
|
const formatter = _vm.formatter;
|
|
@@ -3886,9 +3885,6 @@ class ColumnInfo {
|
|
|
3886
3885
|
const flCompConf = isEnableConf(filterRender) ? columnInfo_renderer.get(filterRender.name) : null;
|
|
3887
3886
|
const ctFilterOptions = flCompConf ? flCompConf.createTableFilterOptions : null;
|
|
3888
3887
|
const filters = toFilters(_vm.filters, colId);
|
|
3889
|
-
if (headerFormatter) {
|
|
3890
|
-
errLog('vxe.error.notProp', ['header-formatter']);
|
|
3891
|
-
}
|
|
3892
3888
|
const types = ['seq', 'checkbox', 'radio', 'expand', 'html'];
|
|
3893
3889
|
if (_vm.type && types.indexOf(_vm.type) === -1) {
|
|
3894
3890
|
warnLog('vxe.error.errProp', [`type=${_vm.type}`, types.join(', ')]);
|
|
@@ -4334,7 +4330,6 @@ function wheelScrollTopTo(diffNum, cb) {
|
|
|
4334
4330
|
});
|
|
4335
4331
|
}
|
|
4336
4332
|
;// ./packages/table/src/util.ts
|
|
4337
|
-
/* unused harmony import specifier */ var util_XEUtils;
|
|
4338
4333
|
|
|
4339
4334
|
|
|
4340
4335
|
|
|
@@ -4421,6 +4416,7 @@ function createInternalData() {
|
|
|
4421
4416
|
// 数据集(仅可视)
|
|
4422
4417
|
visibleDataRowIdData: {},
|
|
4423
4418
|
keepUpdateFieldMaps: {},
|
|
4419
|
+
headerFullDataColData: {},
|
|
4424
4420
|
footerFullDataRowData: {},
|
|
4425
4421
|
// 渲染中缓存数据
|
|
4426
4422
|
sourceDataRowIdData: {},
|
|
@@ -5058,33 +5054,54 @@ function getCalcHeight(height) {
|
|
|
5058
5054
|
}
|
|
5059
5055
|
/**
|
|
5060
5056
|
* 列宽拖动最大宽度
|
|
5061
|
-
* @param params
|
|
5062
|
-
* @returns
|
|
5063
5057
|
*/
|
|
5064
5058
|
function getColReMaxWidth(params) {
|
|
5065
5059
|
const {
|
|
5066
|
-
$table
|
|
5060
|
+
$table,
|
|
5061
|
+
column,
|
|
5062
|
+
cell
|
|
5067
5063
|
} = params;
|
|
5064
|
+
const internalData = $table.internalData;
|
|
5068
5065
|
const {
|
|
5066
|
+
elemStore
|
|
5067
|
+
} = internalData;
|
|
5068
|
+
const {
|
|
5069
|
+
computeColumnOpts,
|
|
5069
5070
|
computeResizableOpts
|
|
5070
5071
|
} = $table.getComputeMaps();
|
|
5071
5072
|
const resizableOpts = computeResizableOpts.value;
|
|
5073
|
+
const columnOpts = computeColumnOpts.value;
|
|
5072
5074
|
const {
|
|
5073
5075
|
maxWidth: reMaxWidth
|
|
5074
5076
|
} = resizableOpts;
|
|
5077
|
+
const colMaxWidth = column.maxWidth || columnOpts.maxWidth;
|
|
5075
5078
|
// 如果自定义调整宽度逻辑
|
|
5076
5079
|
if (reMaxWidth) {
|
|
5077
|
-
const customMaxWidth =
|
|
5080
|
+
const customMaxWidth = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(reMaxWidth) ? reMaxWidth(params) : reMaxWidth;
|
|
5078
5081
|
if (customMaxWidth !== 'auto') {
|
|
5079
|
-
return Math.max(1,
|
|
5082
|
+
return Math.max(1, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(customMaxWidth));
|
|
5083
|
+
}
|
|
5084
|
+
}
|
|
5085
|
+
const minTitleWidth = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().floor((external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(getComputedStyle(cell).fontSize) || 14) * 1.8);
|
|
5086
|
+
const paddingLeftRight = getPaddingLeftRightSize(cell) + getPaddingLeftRightSize(queryElement(cell, '.vxe-cell'));
|
|
5087
|
+
const mWidth = minTitleWidth + paddingLeftRight;
|
|
5088
|
+
// 如果设置最小宽
|
|
5089
|
+
if (colMaxWidth) {
|
|
5090
|
+
const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
|
|
5091
|
+
if (bodyScrollElem) {
|
|
5092
|
+
if (isScale(colMaxWidth)) {
|
|
5093
|
+
const bodyWidth = bodyScrollElem.clientWidth - 1;
|
|
5094
|
+
const meanWidth = bodyWidth / 100;
|
|
5095
|
+
return Math.max(mWidth, Math.floor(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(colMaxWidth) * meanWidth));
|
|
5096
|
+
} else if (isPx(colMaxWidth)) {
|
|
5097
|
+
return Math.max(mWidth, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(colMaxWidth));
|
|
5098
|
+
}
|
|
5080
5099
|
}
|
|
5081
5100
|
}
|
|
5082
5101
|
return -1;
|
|
5083
5102
|
}
|
|
5084
5103
|
/**
|
|
5085
5104
|
* 列宽拖动最小宽度
|
|
5086
|
-
* @param params
|
|
5087
|
-
* @returns
|
|
5088
5105
|
*/
|
|
5089
5106
|
function getColReMinWidth(params) {
|
|
5090
5107
|
const {
|
|
@@ -5095,9 +5112,11 @@ function getColReMinWidth(params) {
|
|
|
5095
5112
|
const tableProps = $table.props;
|
|
5096
5113
|
const internalData = $table.internalData;
|
|
5097
5114
|
const {
|
|
5115
|
+
computeColumnOpts,
|
|
5098
5116
|
computeResizableOpts
|
|
5099
5117
|
} = $table.getComputeMaps();
|
|
5100
5118
|
const resizableOpts = computeResizableOpts.value;
|
|
5119
|
+
const columnOpts = computeColumnOpts.value;
|
|
5101
5120
|
const {
|
|
5102
5121
|
minWidth: reMinWidth
|
|
5103
5122
|
} = resizableOpts;
|
|
@@ -5115,9 +5134,9 @@ function getColReMinWidth(params) {
|
|
|
5115
5134
|
showHeaderOverflow: allColumnHeaderOverflow
|
|
5116
5135
|
} = tableProps;
|
|
5117
5136
|
const {
|
|
5118
|
-
showHeaderOverflow
|
|
5119
|
-
minWidth: colMinWidth
|
|
5137
|
+
showHeaderOverflow
|
|
5120
5138
|
} = column;
|
|
5139
|
+
const colMinWidth = column.minWidth || columnOpts.minWidth;
|
|
5121
5140
|
const headOverflow = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isUndefined(showHeaderOverflow) || external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNull(showHeaderOverflow) ? allColumnHeaderOverflow : showHeaderOverflow;
|
|
5122
5141
|
const showEllipsis = headOverflow === 'ellipsis';
|
|
5123
5142
|
const showTitle = headOverflow === 'title';
|
|
@@ -5922,7 +5941,7 @@ const Cell = {
|
|
|
5922
5941
|
}
|
|
5923
5942
|
}
|
|
5924
5943
|
}
|
|
5925
|
-
return renderTitleContent(params,
|
|
5944
|
+
return renderTitleContent(params, $table.getHeaderCellLabel(column));
|
|
5926
5945
|
},
|
|
5927
5946
|
renderDefaultHeader(params) {
|
|
5928
5947
|
return renderHeaderCellBaseVNs(params, Cell.renderHeaderTitle(params));
|
|
@@ -5948,8 +5967,7 @@ const Cell = {
|
|
|
5948
5967
|
editRender,
|
|
5949
5968
|
cellRender,
|
|
5950
5969
|
rowGroupNode,
|
|
5951
|
-
aggFunc
|
|
5952
|
-
formatter
|
|
5970
|
+
aggFunc
|
|
5953
5971
|
} = column;
|
|
5954
5972
|
const isEnableEdit = editConfig && isEnableConf(editConfig);
|
|
5955
5973
|
const editRenderOpts = isEnableEdit && isEnableConf(editRender) ? editRender : null;
|
|
@@ -6050,8 +6068,9 @@ const Cell = {
|
|
|
6050
6068
|
return renderCellBaseVNs(params, $table.callSlot(defaultSlot, params));
|
|
6051
6069
|
}
|
|
6052
6070
|
const renderOpts = editRenderOpts || cellRenderOpts;
|
|
6053
|
-
//
|
|
6054
|
-
|
|
6071
|
+
// 如果是编辑表格:renderTableCell > formatter
|
|
6072
|
+
// 如果是查看表格:renderTableDefault > formatter
|
|
6073
|
+
if (renderOpts) {
|
|
6055
6074
|
const compConf = cell_renderer.get(renderOpts.name);
|
|
6056
6075
|
if (compConf) {
|
|
6057
6076
|
const renderFn = editRenderOpts ? compConf.renderTableCell || compConf.renderCell : compConf.renderTableDefault || compConf.renderDefault;
|
|
@@ -6262,7 +6281,7 @@ const Cell = {
|
|
|
6262
6281
|
slots
|
|
6263
6282
|
} = column;
|
|
6264
6283
|
const headerSlot = slots ? slots.header : null;
|
|
6265
|
-
return renderHeaderCellBaseVNs(params, renderTitleContent(params, headerSlot ? $table.callSlot(headerSlot, params) :
|
|
6284
|
+
return renderHeaderCellBaseVNs(params, renderTitleContent(params, headerSlot ? $table.callSlot(headerSlot, params) : $table.getHeaderCellLabel(column)));
|
|
6266
6285
|
},
|
|
6267
6286
|
renderSeqCell(params) {
|
|
6268
6287
|
const {
|
|
@@ -6308,7 +6327,7 @@ const Cell = {
|
|
|
6308
6327
|
const titleSlot = slots ? slots.title : null;
|
|
6309
6328
|
return renderHeaderCellBaseVNs(params, renderTitleContent(params, headerSlot ? $table.callSlot(headerSlot, params) : [(0,external_commonjs_vue_commonjs2_vue_root_Vue_.h)('span', {
|
|
6310
6329
|
class: 'vxe-radio--label'
|
|
6311
|
-
}, titleSlot ? $table.callSlot(titleSlot, params) :
|
|
6330
|
+
}, titleSlot ? $table.callSlot(titleSlot, params) : $table.getHeaderCellLabel(column))]));
|
|
6312
6331
|
},
|
|
6313
6332
|
renderRadioCell(params) {
|
|
6314
6333
|
const {
|
|
@@ -6420,7 +6439,7 @@ const Cell = {
|
|
|
6420
6439
|
showHeader,
|
|
6421
6440
|
headerTitle
|
|
6422
6441
|
} = checkboxOpts;
|
|
6423
|
-
const colTitle =
|
|
6442
|
+
const colTitle = $table.getHeaderCellLabel(column);
|
|
6424
6443
|
const ons = {};
|
|
6425
6444
|
if (!isHidden) {
|
|
6426
6445
|
ons.onClick = evnt => {
|
|
@@ -7684,7 +7703,7 @@ const gridProps = {
|
|
|
7684
7703
|
}
|
|
7685
7704
|
};
|
|
7686
7705
|
;// ./packages/table/src/emits.ts
|
|
7687
|
-
const tableEmits = ['ready', 'init-rendered', 'data-rendered', 'update:data', 'keydown-start', 'keydown', 'keydown-end', 'paste', 'copy', 'cut', 'undo', 'redo', 'context-menu', 'columns-change', 'data-change', 'footer-data-change', 'current-change', 'current-row-change', 'current-row-disabled', 'current-column-change', 'current-column-disabled', 'radio-change', 'checkbox-change', 'checkbox-all', 'checkbox-range-start', 'checkbox-range-change', 'checkbox-range-end', 'checkbox-range-select', 'cell-click', 'cell-dblclick', 'cell-menu', 'cell-mouseenter', 'cell-mouseleave', 'cell-selected', 'cell-delete-value', 'cell-backspace-value', 'header-cell-click', 'header-cell-dblclick', 'header-cell-menu', 'footer-cell-click', 'footer-cell-dblclick', 'footer-cell-menu', 'clear-merge', 'sort-change', 'clear-sort', 'clear-all-sort', 'filter-change', 'filter-visible', 'clear-filter', 'clear-all-filter', 'resizable-change', 'column-resizable-change', 'row-resizable-change', 'toggle-row-group-expand', 'toggle-row-expand', 'toggle-tree-expand', 'menu-click', 'edit-closed', 'row-dragstart', 'row-dragover', 'row-dragend', 'row-remove-dragend', 'row-insert-dragend', 'column-dragstart', 'column-dragover', 'column-dragend', 'enter-append-row', 'tab-append-row', 'edit-actived', 'edit-activated', 'edit-disabled', 'valid-error', 'scroll', 'scroll-boundary', 'custom', 'custom-visible-change', 'custom-visible-all', 'custom-fixed-change', 'custom-sort-change', 'change-fnr', 'open-fnr', 'show-fnr', 'hide-fnr', 'fnr-change', 'fnr-find', 'fnr-find-all', 'fnr-replace', 'fnr-replace-all', 'cell-area-copy', 'cell-area-cut', 'cell-area-paste', 'cell-area-merge', 'clear-cell-area-selection', 'clear-cell-area-merge', 'header-cell-area-selection', 'cell-area-selection-invalid', 'cell-area-selection-start', 'cell-area-selection-drag', 'cell-area-selection-end', 'cell-area-extension-start', 'cell-area-extension-drag', 'cell-area-extension-end', 'cell-area-extension-fill', 'cell-area-selection-all-start', 'cell-area-selection-all-end', 'cell-area-arrows-start', 'cell-area-arrows-end', 'active-cell-change-start', 'active-cell-change-end'];
|
|
7706
|
+
const tableEmits = ['ready', 'init-rendered', 'data-rendered', 'update:data', 'keydown-start', 'keydown', 'keydown-end', 'paste', 'copy', 'cut', 'undo', 'redo', 'context-menu', 'columns-change', 'data-change', 'footer-data-change', 'current-change', 'current-row-change', 'current-row-disabled', 'current-column-change', 'current-column-disabled', 'radio-change', 'checkbox-change', 'checkbox-all', 'checkbox-range-start', 'checkbox-range-change', 'checkbox-range-end', 'checkbox-range-select', 'cell-click', 'cell-dblclick', 'cell-menu', 'cell-mouseenter', 'cell-mouseleave', 'cell-selected', 'cell-delete-value', 'cell-backspace-value', 'header-cell-click', 'header-cell-dblclick', 'header-cell-menu', 'footer-cell-click', 'footer-cell-dblclick', 'footer-cell-menu', 'clear-merge', 'sort-change', 'clear-sort', 'clear-all-sort', 'filter-change', 'filter-visible', 'clear-filter', 'clear-all-filter', 'resizable-change', 'column-resizable-change', 'row-resizable-change', 'toggle-row-group-expand', 'toggle-row-expand', 'toggle-tree-expand', 'menu-click', 'edit-closed', 'row-dragstart', 'row-dragover', 'row-dragend', 'row-remove-dragend', 'row-insert-dragend', 'column-dragstart', 'column-dragover', 'column-dragend', 'enter-append-row', 'tab-append-row', 'edit-actived', 'edit-activated', 'edit-disabled', 'valid-error', 'scroll', 'scroll-boundary', 'custom', 'custom-visible-change', 'custom-visible-all', 'custom-fixed-change', 'custom-sort-change', 'change-fnr', 'open-fnr', 'show-fnr', 'hide-fnr', 'fnr-change', 'fnr-find', 'fnr-find-all', 'fnr-replace', 'fnr-replace-all', 'cell-area-copy', 'cell-area-cut', 'cell-area-paste', 'cell-area-merge', 'clear-cell-area-selection', 'clear-cell-area-merge', 'header-cell-area-selection', 'cell-area-selection-invalid', 'cell-area-selection-start', 'cell-area-selection-drag', 'cell-area-selection-end', 'cell-area-extension-start', 'cell-area-extension-drag', 'cell-area-extension-end', 'cell-area-extension-fill', 'cell-area-selection-all-start', 'cell-area-selection-all-end', 'cell-area-arrows-start', 'cell-area-arrows-end', 'cell-area-fill-copy', 'active-cell-change-start', 'active-cell-change-end'];
|
|
7688
7707
|
;// ./packages/grid/src/emits.ts
|
|
7689
7708
|
|
|
7690
7709
|
const gridEmits = [...tableEmits, 'page-change', 'form-submit', 'form-submit-invalid', 'form-reset', 'form-collapse', 'form-toggle-collapse', 'proxy-query', 'proxy-delete', 'proxy-save', 'toolbar-button-click', 'toolbar-tool-click', 'zoom'];
|
|
@@ -15070,7 +15089,7 @@ export_hook_hooks.add('tableExportModule', {
|
|
|
15070
15089
|
column,
|
|
15071
15090
|
options: opts,
|
|
15072
15091
|
$table: $xeTable
|
|
15073
|
-
}) : (opts.isTitle ?
|
|
15092
|
+
}) : (opts.isTitle ? $xeTable.getHeaderCellLabel(column) : column.field) || '';
|
|
15074
15093
|
}
|
|
15075
15094
|
const toBooleanValue = cellValue => {
|
|
15076
15095
|
return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isBoolean(cellValue) ? cellValue ? 'TRUE' : 'FALSE' : cellValue;
|
|
@@ -15858,12 +15877,12 @@ export_hook_hooks.add('tableExportModule', {
|
|
|
15858
15877
|
const tableTitleMaps = {};
|
|
15859
15878
|
tableFullColumn.forEach(column => {
|
|
15860
15879
|
const field = column.field;
|
|
15861
|
-
const title =
|
|
15880
|
+
const title = $xeTable.getHeaderCellLabel(column);
|
|
15862
15881
|
if (field) {
|
|
15863
15882
|
tableFieldMaps[field] = column;
|
|
15864
15883
|
}
|
|
15865
15884
|
if (title) {
|
|
15866
|
-
tableTitleMaps[
|
|
15885
|
+
tableTitleMaps[title] = column;
|
|
15867
15886
|
}
|
|
15868
15887
|
});
|
|
15869
15888
|
const tableConf = {
|
|
@@ -20326,19 +20345,20 @@ if(reactData.scrollYLoad&&!(internalData.customHeight||internalData.customMinHei
|
|
|
20326
20345
|
* 支持动态列表调整分配
|
|
20327
20346
|
* 支持自动分配偏移量
|
|
20328
20347
|
* 支持 width=60 width=60px width=10% min-width=60 min-width=60px min-width=10%
|
|
20329
|
-
*/const autoCellWidth=()=>{const{elemStore}=internalData;const bodyWrapperElem=getRefElem(elemStore['main-body-wrapper']);if(!bodyWrapperElem){return;}const yHandleEl=refScrollYHandleElem.value;if(!yHandleEl){return;}const xHandleEl=refScrollXHandleElem.value;if(!xHandleEl){return;}let tWidth=0;const minCellWidth=40;// 列宽最少限制 40px
|
|
20330
|
-
const bodyWidth=bodyWrapperElem.clientWidth;let remainWidth=bodyWidth;let meanWidth=remainWidth/100;const{fit}=props;const{columnStore}=reactData;const{resizeList,pxMinList,autoMinList,pxList,scaleList,scaleMinList,autoList,remainList}=columnStore;// 最小宽
|
|
20331
|
-
pxMinList.forEach(column=>{
|
|
20332
|
-
autoMinList.forEach(column=>{
|
|
20333
|
-
scaleMinList.forEach(column=>{
|
|
20334
|
-
scaleList.forEach(column=>{
|
|
20335
|
-
pxList.forEach(column=>{
|
|
20336
|
-
autoList.forEach(column=>{
|
|
20337
|
-
resizeList.forEach(column=>{const reWidth=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(column.resizeWidth);tWidth+=reWidth;column.renderWidth=reWidth;});remainWidth-=tWidth;meanWidth=remainWidth>0?Math.floor(remainWidth/(
|
|
20348
|
+
*/const autoCellWidth=()=>{const{elemStore}=internalData;const bodyWrapperElem=getRefElem(elemStore['main-body-wrapper']);if(!bodyWrapperElem){return;}const yHandleEl=refScrollYHandleElem.value;if(!yHandleEl){return;}const xHandleEl=refScrollXHandleElem.value;if(!xHandleEl){return;}const columnOpts=computeColumnOpts.value;let tWidth=0;const minCellWidth=40;// 列宽最少限制 40px
|
|
20349
|
+
const bodyWidth=bodyWrapperElem.clientWidth;let remainWidth=bodyWidth;let meanWidth=remainWidth/100;const{fit}=props;const{columnStore}=reactData;const{resizeList,pxMinList,autoMinList,pxList,scaleList,scaleMinList,autoList,remainList}=columnStore;const parseColumnMaxWidth=column=>{const maxWidth=column.maxWidth||columnOpts.maxWidth;if(maxWidth&&maxWidth!=='auto'){if(isScale(maxWidth)){return Math.floor(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(maxWidth)*meanWidth);}return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(maxWidth);}return 0;};// 最小宽
|
|
20350
|
+
pxMinList.forEach(column=>{let miWidth=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(column.minWidth);const mxWidth=parseColumnMaxWidth(column);if(mxWidth){miWidth=Math.min(miWidth,mxWidth);}tWidth+=miWidth;column.renderWidth=miWidth;});// 最小自适应
|
|
20351
|
+
autoMinList.forEach(column=>{let caWidth=Math.max(60,external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(column.renderAutoWidth));const mxWidth=parseColumnMaxWidth(column);if(mxWidth){caWidth=Math.min(caWidth,mxWidth);}tWidth+=caWidth;column.renderWidth=caWidth;});// 最小百分比
|
|
20352
|
+
scaleMinList.forEach(column=>{let smWidth=Math.floor(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(column.minWidth)*meanWidth);const mxWidth=parseColumnMaxWidth(column);if(mxWidth){smWidth=Math.min(smWidth,mxWidth);}tWidth+=smWidth;column.renderWidth=smWidth;});// 固定百分比
|
|
20353
|
+
scaleList.forEach(column=>{let sfWidth=Math.floor(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(column.width)*meanWidth);const mxWidth=parseColumnMaxWidth(column);if(mxWidth){sfWidth=Math.min(sfWidth,mxWidth);}tWidth+=sfWidth;column.renderWidth=sfWidth;});// 固定宽
|
|
20354
|
+
pxList.forEach(column=>{let pWidth=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(column.width);const mxWidth=parseColumnMaxWidth(column);if(mxWidth){pWidth=Math.min(pWidth,mxWidth);}tWidth+=pWidth;column.renderWidth=pWidth;});// 自适应宽
|
|
20355
|
+
autoList.forEach(column=>{let aWidth=Math.max(60,external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(column.renderAutoWidth));const mxWidth=parseColumnMaxWidth(column);if(mxWidth){aWidth=Math.min(aWidth,mxWidth);}tWidth+=aWidth;column.renderWidth=aWidth;});// 调整了列宽
|
|
20356
|
+
resizeList.forEach(column=>{const reWidth=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(column.resizeWidth);tWidth+=reWidth;column.renderWidth=reWidth;});const zoomColumnList=scaleMinList.concat(pxMinList).concat(autoMinList).filter(column=>!parseColumnMaxWidth(column));remainWidth-=tWidth;meanWidth=remainWidth>0?Math.floor(remainWidth/(zoomColumnList.length+remainList.length)):0;if(fit){if(remainWidth>0){zoomColumnList.forEach(column=>{tWidth+=meanWidth;column.renderWidth+=meanWidth;});}}else{meanWidth=minCellWidth;}// 剩余均分
|
|
20338
20357
|
remainList.forEach(column=>{const width=Math.max(meanWidth,minCellWidth);column.renderWidth=width;tWidth+=width;});if(fit){/**
|
|
20339
20358
|
* 偏移量算法
|
|
20340
20359
|
* 如果所有列足够放的情况下,从最后动态列开始分配
|
|
20341
|
-
|
|
20360
|
+
* 排除已设置 max-width
|
|
20361
|
+
*/const dynamicList=scaleList.concat(scaleMinList).concat(pxMinList).concat(autoMinList).concat(remainList).filter(column=>!parseColumnMaxWidth(column));let dynamicSize=dynamicList.length-1;if(dynamicSize>0){let i=bodyWidth-tWidth;if(i>0){while(i>0&&dynamicSize>=0){i--;dynamicList[dynamicSize--].renderWidth++;}tWidth=bodyWidth;}}}reactData.scrollXWidth=tWidth;reactData.resizeWidthFlag++;updateColumnOffsetLeft();updateHeight();};/**
|
|
20342
20362
|
* 计算自适应行高
|
|
20343
20363
|
*/const calcCellAutoHeight=(rowRest,wrapperEl)=>{const{scrollXLoad}=reactData;const wrapperElemList=wrapperEl.querySelectorAll(`.vxe-cell--wrapper[rowid="${rowRest.rowid}"]`);let colHeight=0;let firstCellStyle=null;let topBottomPadding=0;for(let i=0;i<wrapperElemList.length;i++){const wrapperElem=wrapperElemList[i];const cellElem=wrapperElem.parentElement;const cellStyle=cellElem.style;const orHeight=cellStyle.height;if(!scrollXLoad){cellStyle.height='';}if(!firstCellStyle){firstCellStyle=getComputedStyle(cellElem);topBottomPadding=firstCellStyle?Math.ceil(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(firstCellStyle.paddingTop)+external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(firstCellStyle.paddingBottom)):0;}if(!scrollXLoad){cellStyle.height=orHeight;}const cellHeight=wrapperElem?wrapperElem.clientHeight:0;colHeight=Math.max(colHeight,Math.ceil(cellHeight+topBottomPadding));}if(scrollXLoad){colHeight=Math.max(colHeight,rowRest.height);}return colHeight;};/**
|
|
20344
20364
|
* 自适应行高
|
|
@@ -20496,7 +20516,7 @@ tableFullColumn.forEach(column=>{if(column.visible){if(column.fixed==='left'){le
|
|
|
20496
20516
|
// }
|
|
20497
20517
|
if(props.spanMethod){warnLog('vxe.error.scrollErrProp',['span-method']);}if(props.footerSpanMethod){warnLog('vxe.error.scrollErrProp',['footer-span-method']);}if(isReset){const{visibleSize}=handleVirtualXVisible();scrollXStore.startIndex=0;scrollXStore.endIndex=visibleSize;scrollXStore.visibleSize=visibleSize;scrollXStore.visibleStartIndex=0;scrollXStore.visibleEndIndex=visibleSize;}}// 如果列被显示/隐藏,则清除合并状态
|
|
20498
20518
|
// 如果列被设置为固定,则清除合并状态
|
|
20499
|
-
if(visibleColumn.length!==internalData.visibleColumn.length||!internalData.visibleColumn.every((column,index)=>column===visibleColumn[index])){$xeTable.clearMergeCells();$xeTable.clearMergeFooterItems();}visibleColumn.forEach((column,index)=>{const colid=column.id;const colRest=fullColumnIdData[colid];if(colRest){colRest._index=index;}});handleTableColumn();handleUpdateAggValues();if(isReset){updateColumnOffsetLeft();return $xeTable.updateFooter().then(()=>{return $xeTable.recalculate();}).then(()=>{$xeTable.updateCellAreas();return $xeTable.recalculate();});}return $xeTable.updateFooter();};const initColumnHierarchy=()=>{const{collectColumn}=internalData;const fullColIdData={};const fullColFieldData={};let sortIndex=1;external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(collectColumn,(column,index,items,path,parentColumn)=>{const{id:colid,field}=column;const parentId=parentColumn?parentColumn.id:null;const rest={$index:-1,_index:-1,column,colid,index,items,parent:parentColumn||null,width:0,oLeft:0};column.parentId=parentId;column.defaultParentId=parentId;column.sortNumber=sortIndex;column.renderSortNumber=sortIndex;sortIndex++;if(field){if(fullColFieldData[field]){errLog('vxe.error.colRepet',['field',field]);}fullColFieldData[field]=rest;}fullColIdData[colid]=rest;});internalData.fullColumnIdData=fullColIdData;internalData.fullColumnFieldData=fullColFieldData;};const handleInitColumn=collectColumn=>{const expandOpts=computeExpandOpts.value;internalData.collectColumn=collectColumn;const tFullColumn=getColumnList(collectColumn);internalData.tableFullColumn=tFullColumn;reactData.updateColFlag++;reactData.isColLoading=true;initColumnHierarchy();return Promise.resolve(restoreCustomStorage()).then(()=>{const{scrollXLoad,scrollYLoad,expandColumn}=reactData;cacheColumnMap();parseColumns(true).then(()=>{if(reactData.scrollXLoad){loadScrollXData();}});$xeTable.clearMergeCells();$xeTable.clearMergeFooterItems();$xeTable.handleTableData(true);$xeTable.handleAggregateSummaryData();if((scrollXLoad||scrollYLoad)&&expandColumn&&expandOpts.mode!=='fixed'){warnLog('vxe.error.scrollErrProp',['column.type=expand']);}return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)().then(()=>{if($xeToolbar){$xeToolbar.syncUpdate({collectColumn:internalData.collectColumn,$table:$xeTable});}if($xeTable.handleUpdateCustomColumn){$xeTable.handleUpdateCustomColumn();}const columnOpts=computeColumnOpts.value;if(props.showCustomHeader&&reactData.isGroup&&(columnOpts.resizable||props.resizable)){warnLog('vxe.error.notConflictProp',['show-custom-header & colgroup','column-config.resizable=false']);}reactData.isColLoading=false;return handleLazyRecalculate(false,true,true);});});};const updateScrollXStatus=fullColumn=>{const virtualXOpts=computeVirtualXOpts.value;const allCols=fullColumn||internalData.tableFullColumn;// 如果gt为0,则总是启用
|
|
20519
|
+
if(visibleColumn.length!==internalData.visibleColumn.length||!internalData.visibleColumn.every((column,index)=>column===visibleColumn[index])){$xeTable.clearMergeCells();$xeTable.clearMergeFooterItems();}visibleColumn.forEach((column,index)=>{const colid=column.id;const colRest=fullColumnIdData[colid];if(colRest){colRest._index=index;}});handleTableColumn();handleUpdateAggValues();if(isReset){updateColumnOffsetLeft();return $xeTable.updateFooter().then(()=>{return $xeTable.recalculate();}).then(()=>{$xeTable.updateCellAreas();return $xeTable.recalculate();});}return $xeTable.updateFooter();};const initColumnHierarchy=()=>{const{collectColumn}=internalData;const fullColIdData={};const fullColFieldData={};let sortIndex=1;external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(collectColumn,(column,index,items,path,parentColumn)=>{const{id:colid,field}=column;const parentId=parentColumn?parentColumn.id:null;const rest={$index:-1,_index:-1,column,colid,index,items,parent:parentColumn||null,width:0,oLeft:0};column.parentId=parentId;column.defaultParentId=parentId;column.sortNumber=sortIndex;column.renderSortNumber=sortIndex;sortIndex++;if(field){if(fullColFieldData[field]){errLog('vxe.error.colRepet',['field',field]);}fullColFieldData[field]=rest;}fullColIdData[colid]=rest;});internalData.fullColumnIdData=fullColIdData;internalData.fullColumnFieldData=fullColFieldData;};const handleInitColumn=collectColumn=>{const expandOpts=computeExpandOpts.value;internalData.collectColumn=collectColumn;const tFullColumn=getColumnList(collectColumn);internalData.tableFullColumn=tFullColumn;reactData.updateColFlag++;reactData.isColLoading=true;initColumnHierarchy();return Promise.resolve(restoreCustomStorage()).then(()=>{const{scrollXLoad,scrollYLoad,expandColumn}=reactData;cacheColumnMap();parseColumns(true).then(()=>{if(reactData.scrollXLoad){loadScrollXData();}});$xeTable.clearHeaderFormatterCache();$xeTable.clearMergeCells();$xeTable.clearMergeFooterItems();$xeTable.handleTableData(true);$xeTable.handleAggregateSummaryData();if((scrollXLoad||scrollYLoad)&&expandColumn&&expandOpts.mode!=='fixed'){warnLog('vxe.error.scrollErrProp',['column.type=expand']);}return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)().then(()=>{if($xeToolbar){$xeToolbar.syncUpdate({collectColumn:internalData.collectColumn,$table:$xeTable});}if($xeTable.handleUpdateCustomColumn){$xeTable.handleUpdateCustomColumn();}const columnOpts=computeColumnOpts.value;if(props.showCustomHeader&&reactData.isGroup&&(columnOpts.resizable||props.resizable)){warnLog('vxe.error.notConflictProp',['show-custom-header & colgroup','column-config.resizable=false']);}reactData.isColLoading=false;return handleLazyRecalculate(false,true,true);});});};const updateScrollXStatus=fullColumn=>{const virtualXOpts=computeVirtualXOpts.value;const allCols=fullColumn||internalData.tableFullColumn;// 如果gt为0,则总是启用
|
|
20500
20520
|
const scrollXLoad=!!virtualXOpts.enabled&&virtualXOpts.gt>-1&&(virtualXOpts.gt===0||virtualXOpts.gt<allCols.length);reactData.scrollXLoad=scrollXLoad;return scrollXLoad;};const updateScrollYStatus=fullData=>{const{treeConfig}=props;const $xeGanttView=internalData.xeGanttView;const virtualYOpts=computeVirtualYOpts.value;const treeOpts=computeTreeOpts.value;const{transform}=treeOpts;const allList=fullData||internalData.tableFullData;// 如果gt为0,则总是启用
|
|
20501
20521
|
const scrollYLoad=(transform||!treeConfig)&&!!virtualYOpts.enabled&&virtualYOpts.gt>-1&&(virtualYOpts.gt===0||virtualYOpts.gt<allList.length);reactData.scrollYLoad=scrollYLoad;if($xeGanttView&&$xeGanttView.handleUpdateSYStatus){$xeGanttView.handleUpdateSYStatus(scrollYLoad);}return scrollYLoad;};/**
|
|
20502
20522
|
* 展开与收起树节点
|
|
@@ -20616,7 +20636,7 @@ if(virtualXOpts.scrollToLeftOnChange){targetScrollLeft=0;}if(virtualYOpts.scroll
|
|
|
20616
20636
|
* @param {Array/Row} rows 行数据
|
|
20617
20637
|
* @param {String} field 字段名
|
|
20618
20638
|
*/clearData(rows,field){const{tableFullData,visibleColumn}=internalData;if(!arguments.length){rows=tableFullData;}else if(rows&&!external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(rows)){rows=[rows];}if(field){rows.forEach(row=>external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().set(row,field,null));}else{rows.forEach(row=>{visibleColumn.forEach(column=>{if(column.field){setCellValue(row,column,null);}});});}return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();},getCellElement(row,fieldOrColumn){const{elemStore}=internalData;const column=handleFieldOrColumn($xeTable,fieldOrColumn);if(!column){return null;}const rowid=getRowid($xeTable,row);const bodyScrollElem=getRefElem(elemStore['main-body-scroll']);const leftScrollElem=getRefElem(elemStore['left-body-scroll']);const rightScrollElem=getRefElem(elemStore['right-body-scroll']);let bodyElem;if(column){if(column.fixed){if(column.fixed==='left'){if(leftScrollElem){bodyElem=leftScrollElem;}}else{if(rightScrollElem){bodyElem=rightScrollElem;}}}if(!bodyElem){bodyElem=bodyScrollElem;}if(bodyElem){return bodyElem.querySelector(`.vxe-body--row[rowid="${rowid}"] .${column.id}`);}}return null;},getCellLabel(row,fieldOrColumn){const column=handleFieldOrColumn($xeTable,fieldOrColumn);if(!column){return null;}const{editConfig}=props;const{formatter,editRender,cellRender}=column;// formatter > tableCellFormatter
|
|
20619
|
-
const renderOpts=formatter?null:editConfig&&isEnableConf(editRender)?editRender:isEnableConf(cellRender)?cellRender:null;const compConf=renderOpts?table_renderer.get(renderOpts.name):null;const tcFormatter=compConf?compConf.tableCellFormatter:null;const cellValue=getCellValue(row,column);let cellLabel=cellValue;if(formatter||tcFormatter){let formatData;const{fullAllDataRowIdData}=internalData;const rowid=getRowid($xeTable,row);const colid=column.id;const rowRest=fullAllDataRowIdData[rowid];if(rowRest){formatData=rowRest.formatData;if(!formatData){formatData=fullAllDataRowIdData[rowid].formatData={};}if(rowRest&&formatData[colid]){if(formatData[colid].value===cellValue){return formatData[colid].label;}}}const formatParams={$table:$xeTable,cellValue,row,rowIndex:$xeTable.getRowIndex(row),column,columnIndex:$xeTable.getColumnIndex(column)};if(formatter){if(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(formatter)){const gFormatOpts=table_formats.get(formatter);const tcFormatMethod=gFormatOpts?gFormatOpts.tableCellFormatMethod||gFormatOpts.cellFormatMethod:null;cellLabel=tcFormatMethod?tcFormatMethod(formatParams):'';}else if(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(formatter)){const gFormatOpts=table_formats.get(formatter[0]);const tcFormatMethod=gFormatOpts?gFormatOpts.tableCellFormatMethod||gFormatOpts.cellFormatMethod:null;cellLabel=tcFormatMethod?tcFormatMethod(formatParams,...formatter.slice(1)):'';}else{cellLabel=formatter(formatParams);}}else if(renderOpts&&tcFormatter){cellLabel=tcFormatter(renderOpts,formatParams);}if(formatData){formatData[colid]={value:cellValue,label:cellLabel};}}return cellLabel;},updateCellLabel(row,fieldOrColumn){const column=handleFieldOrColumn($xeTable,fieldOrColumn);if(!column){return null;}const{fullAllDataRowIdData}=internalData;const rowid=getRowid($xeTable,row);if(rowid){const colid=column.id;const rowid=getRowid($xeTable,row);const rowRest=fullAllDataRowIdData[rowid];if(rowRest){const formatData=rowRest.formatData;if(formatData){delete formatData[colid];}}}return $xeTable.getFooterCellLabel(row,column);},clearFormatterCache(isUpdate){const{tableData,tableColumn}=reactData;const{fullAllDataRowIdData}=internalData;external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(fullAllDataRowIdData,rowRest=>{if(rowRest.formatData){rowRest.formatData=undefined;}});if(isUpdate){tableData.forEach(row=>{tableColumn.forEach(column=>{$xeTable.getCellLabel(row,column);});});}return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();},getFooterCellLabel(row,fieldOrColumn){const column=handleFieldOrColumn($xeTable,fieldOrColumn);if(!column){return null;}const{footerFormatter}=column;const _columnIndex=$xeTable.getVTColumnIndex(column);let itemValue='';// 兼容老模式
|
|
20639
|
+
const renderOpts=formatter?null:editConfig&&isEnableConf(editRender)?editRender:isEnableConf(cellRender)?cellRender:null;const compConf=renderOpts?table_renderer.get(renderOpts.name):null;const tcFormatter=compConf?compConf.tableCellFormatter:null;const cellValue=getCellValue(row,column);let cellLabel=cellValue;if(formatter||tcFormatter){let formatData;const{fullAllDataRowIdData}=internalData;const rowid=getRowid($xeTable,row);const colid=column.id;const rowRest=fullAllDataRowIdData[rowid];if(rowRest){formatData=rowRest.formatData;if(!formatData){formatData=fullAllDataRowIdData[rowid].formatData={};}if(rowRest&&formatData[colid]){if(formatData[colid].value===cellValue){return formatData[colid].label;}}}const formatParams={$table:$xeTable,cellValue,row,rowIndex:$xeTable.getRowIndex(row),column,columnIndex:$xeTable.getColumnIndex(column)};if(formatter){if(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(formatter)){const gFormatOpts=table_formats.get(formatter);const tcFormatMethod=gFormatOpts?gFormatOpts.tableCellFormatMethod||gFormatOpts.cellFormatMethod:null;cellLabel=tcFormatMethod?tcFormatMethod(formatParams):'';}else if(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(formatter)){const gFormatOpts=table_formats.get(formatter[0]);const tcFormatMethod=gFormatOpts?gFormatOpts.tableCellFormatMethod||gFormatOpts.cellFormatMethod:null;cellLabel=tcFormatMethod?tcFormatMethod(formatParams,...formatter.slice(1)):'';}else{cellLabel=formatter(formatParams);}}else if(renderOpts&&tcFormatter){cellLabel=tcFormatter(renderOpts,formatParams);}if(formatData){formatData[colid]={value:cellValue,label:cellLabel};}}return cellLabel;},updateCellLabel(row,fieldOrColumn){const column=handleFieldOrColumn($xeTable,fieldOrColumn);if(!column){return null;}const{fullAllDataRowIdData}=internalData;const rowid=getRowid($xeTable,row);if(rowid){const colid=column.id;const rowid=getRowid($xeTable,row);const rowRest=fullAllDataRowIdData[rowid];if(rowRest){const formatData=rowRest.formatData;if(formatData){delete formatData[colid];}}}return $xeTable.getFooterCellLabel(row,column);},clearFormatterCache(isUpdate){const{tableData,tableColumn}=reactData;const{fullAllDataRowIdData}=internalData;external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(fullAllDataRowIdData,rowRest=>{if(rowRest.formatData){rowRest.formatData=undefined;}});if(isUpdate){tableData.forEach(row=>{tableColumn.forEach(column=>{$xeTable.getCellLabel(row,column);});});}return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();},getHeaderCellLabel(fieldOrColumn){const column=handleFieldOrColumn($xeTable,fieldOrColumn);if(!column){return null;}const{headerFormatter}=column;const _columnIndex=$xeTable.getVTColumnIndex(column);let cellLabel=column.getTitle();if(headerFormatter){let formatData;const{headerFullDataColData}=internalData;const colid=column.id;let colRest=headerFullDataColData[colid];if(!colRest){colRest=headerFullDataColData[colid]={};}const formatObj=colRest.formatObj;if(formatObj&&formatObj.value===cellLabel){return formatObj.label;}const headFormatParams={$table:$xeTable,cellTitle:cellLabel,cellValue:cellLabel,column,_columnIndex,columnIndex:$xeTable.getColumnIndex(column)};if(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(headerFormatter)){const gFormatOpts=table_formats.get(headerFormatter);const fcFormatMethod=gFormatOpts?gFormatOpts.tableHeaderCellFormatMethod:null;cellLabel=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toValueString(fcFormatMethod?fcFormatMethod(headFormatParams):'');}else if(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(headerFormatter)){const gFormatOpts=table_formats.get(headerFormatter[0]);const fcFormatMethod=gFormatOpts?gFormatOpts.tableHeaderCellFormatMethod:null;cellLabel=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toValueString(fcFormatMethod?fcFormatMethod(headFormatParams,...headerFormatter.slice(1)):'');}else{cellLabel=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toValueString(headerFormatter(headFormatParams));}if(formatData){colRest.formatObj={value:cellLabel,label:cellLabel};}}return cellLabel;},updateHeaderCellLabel(fieldOrColumn){const column=handleFieldOrColumn($xeTable,fieldOrColumn);if(!column){return'';}const{headerFullDataColData}=internalData;const colid=column.id;const colRest=headerFullDataColData[colid];if(colRest){colRest.formatObj=undefined;}return $xeTable.getHeaderCellLabel(column);},clearHeaderFormatterCache(isUpdate){const{tableColumn}=reactData;const{headerFullDataColData}=internalData;external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(headerFullDataColData,colRest=>{if(colRest.formatObj){colRest.formatObj=undefined;}});if(isUpdate){tableColumn.forEach(column=>{$xeTable.getHeaderCellLabel(column);});}return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();},getFooterCellLabel(row,fieldOrColumn){const column=handleFieldOrColumn($xeTable,fieldOrColumn);if(!column){return null;}const{footerFormatter}=column;const _columnIndex=$xeTable.getVTColumnIndex(column);let itemValue='';// 兼容老模式
|
|
20620
20640
|
if(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(row)){itemValue=row[_columnIndex];}else{itemValue=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().get(row,column.field);}let cellLabel=itemValue;if(footerFormatter){let formatData;const{footerTableData}=reactData;const{footerFullDataRowData}=internalData;const colid=column.id;const $rowIndex=footerTableData.indexOf(row);let rowRest=null;if($rowIndex>-1){rowRest=footerFullDataRowData[$rowIndex];if(!rowRest){rowRest=footerFullDataRowData[$rowIndex]={};}formatData=rowRest.formatData;if(!formatData){formatData=footerFullDataRowData[$rowIndex].formatData={};}if(rowRest&&formatData[colid]){if(formatData[colid].value===itemValue){return formatData[colid].label;}}}const footerFormatParams={$table:$xeTable,cellValue:itemValue,itemValue,row,items:row,$rowIndex,column,_columnIndex,columnIndex:$xeTable.getColumnIndex(column)};if(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(footerFormatter)){const gFormatOpts=table_formats.get(footerFormatter);const fcFormatMethod=gFormatOpts?gFormatOpts.tableFooterCellFormatMethod:null;cellLabel=fcFormatMethod?fcFormatMethod(footerFormatParams):'';}else if(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(footerFormatter)){const gFormatOpts=table_formats.get(footerFormatter[0]);const fcFormatMethod=gFormatOpts?gFormatOpts.tableFooterCellFormatMethod:null;cellLabel=fcFormatMethod?fcFormatMethod(footerFormatParams,...footerFormatter.slice(1)):'';}else{cellLabel=footerFormatter(footerFormatParams);}if(formatData){formatData[colid]={value:itemValue,label:cellLabel};}}return cellLabel;},updateFooterCellLabel(row,fieldOrColumn){const column=handleFieldOrColumn($xeTable,fieldOrColumn);if(!column){return null;}const{footerTableData}=reactData;const{footerFullDataRowData}=internalData;const colid=column.id;const $rowIndex=footerTableData.indexOf(row);const rowRest=footerFullDataRowData[$rowIndex];if(rowRest){const formatData=rowRest.formatData;if(formatData){delete formatData[colid];}}return $xeTable.getFooterCellLabel(row,column);},clearFooterFormatterCache(isUpdate){const{tableData,tableColumn}=reactData;const{footerFullDataRowData}=internalData;external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(footerFullDataRowData,rowRest=>{if(rowRest.formatData){rowRest.formatData=undefined;}});if(isUpdate){tableData.forEach(row=>{tableColumn.forEach(column=>{$xeTable.getFooterCellLabel(row,column);});});}return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();},/**
|
|
20621
20641
|
* 检查是否为临时行数据
|
|
20622
20642
|
*/isInsertByRow(row){const rowid=getRowid($xeTable,row);return!!reactData.insertRowFlag&&!!internalData.insertRowMaps[rowid];},isRemoveByRow(row){const rowid=getRowid($xeTable,row);return!!reactData.removeRowFlag&&!!internalData.removeRowMaps[rowid];},/**
|
|
@@ -20832,7 +20852,7 @@ internalData._sToTime=setTimeout(()=>{internalData._sToTime=undefined;if(scrollY
|
|
|
20832
20852
|
* 手动清除滚动相关信息,还原到初始状态
|
|
20833
20853
|
*/clearScroll(){const{elemStore,scrollXStore,scrollYStore}=internalData;const headerScrollElem=getRefElem(elemStore['main-header-scroll']);const bodyScrollElem=getRefElem(elemStore['main-body-scroll']);const footerScrollElem=getRefElem(elemStore['main-footer-scroll']);const leftScrollElem=getRefElem(elemStore['left-body-scroll']);const rightScrollElem=getRefElem(elemStore['right-body-scroll']);const xHandleEl=refScrollXHandleElem.value;const yHandleEl=refScrollYHandleElem.value;internalData.intoRunScroll=true;setScrollLeft(xHandleEl,0);setScrollLeft(bodyScrollElem,0);setScrollLeft(headerScrollElem,0);setScrollLeft(footerScrollElem,0);setScrollTop(yHandleEl,0);setScrollTop(bodyScrollElem,0);setScrollTop(leftScrollElem,0);setScrollTop(rightScrollElem,0);scrollXStore.startIndex=0;scrollXStore.visibleStartIndex=0;scrollXStore.endIndex=scrollXStore.visibleSize;scrollXStore.visibleEndIndex=scrollXStore.visibleSize;scrollYStore.startIndex=0;scrollYStore.visibleStartIndex=0;scrollYStore.endIndex=scrollYStore.visibleSize;scrollYStore.visibleEndIndex=scrollYStore.visibleSize;return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)().then(()=>{internalData.lastScrollLeft=0;internalData.lastScrollTop=0;internalData.intoRunScroll=false;});},/**
|
|
20834
20854
|
* 更新表尾合计
|
|
20835
|
-
*/updateFooter(){const{showFooter,footerData,footerMethod}=props;const{visibleColumn,afterFullData}=internalData;let footData=[];if(showFooter&&footerData&&footerData.length){footData=footerData.slice(0);}else if(showFooter&&footerMethod){footData=visibleColumn.length?footerMethod({columns:visibleColumn,data:afterFullData,$table:$xeTable,$grid:$xeGrid,$gantt:$xeGantt}):[];}reactData.footerTableData=footData;$xeTable.handleUpdateFooterMerge();$xeTable.dispatchEvent('footer-data-change',{visibleColumn:internalData.visibleColumn,footData},null);return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();},/**
|
|
20855
|
+
*/updateFooter(){const{showFooter,footerData,footerMethod}=props;const{visibleColumn,afterFullData}=internalData;let footData=[];if(showFooter&&footerData&&footerData.length){footData=footerData.slice(0);}else if(showFooter&&footerMethod){footData=visibleColumn.length?footerMethod({columns:visibleColumn,data:afterFullData,$table:$xeTable,$grid:$xeGrid,$gantt:$xeGantt}):[];}reactData.footerTableData=footData;$xeTable.clearFooterFormatterCache();$xeTable.handleUpdateFooterMerge();$xeTable.dispatchEvent('footer-data-change',{visibleColumn:internalData.visibleColumn,footData},null);return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();},/**
|
|
20836
20856
|
* 更新列状态 updateStatus({ row, column }, cellValue)
|
|
20837
20857
|
* 如果组件值 v-model 发生 change 时,调用改函数用于更新某一列编辑状态
|
|
20838
20858
|
* 如果单元格配置了校验规则,则会进行校验
|
|
@@ -20970,8 +20990,10 @@ if(selectCheckboxMaps[rowid]){selectCheckboxMaps[rowid]=row;}if(rowExpandedMaps[
|
|
|
20970
20990
|
if(treeConfig){const childrenField=treeOpts.children||treeOpts.childrenField;external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(sourceData,handleSourceRow,{children:treeOpts.transform?treeOpts.mapChildrenField:childrenField});}else{sourceData.forEach(handleSourceRow);}internalData.sourceDataRowIdData=sourceRowIdData;internalData.tableSourceData=sourceData;},/**
|
|
20971
20991
|
* 指定列宽的列进行拆分
|
|
20972
20992
|
*/analyColumnWidth(){const{tableFullColumn}=internalData;const columnOpts=computeColumnOpts.value;const{width:defaultWidth,minWidth:defaultMinWidth}=columnOpts;const resizeList=[];const pxList=[];const pxMinList=[];const autoMinList=[];const scaleList=[];const scaleMinList=[];const autoList=[];const remainList=[];tableFullColumn.forEach(column=>{if(defaultWidth&&!column.width){column.width=defaultWidth;}if(defaultMinWidth&&!column.minWidth){column.minWidth=defaultMinWidth;}if(column.visible){if(column.resizeWidth){resizeList.push(column);}else if(column.width==='auto'){autoList.push(column);}else if(isPx(column.width)){pxList.push(column);}else if(isScale(column.width)){scaleList.push(column);}else if(isPx(column.minWidth)){pxMinList.push(column);}else if(column.minWidth==='auto'){autoMinList.push(column);}else if(isScale(column.minWidth)){scaleMinList.push(column);}else{remainList.push(column);}}});Object.assign(reactData.columnStore,{resizeList,pxList,pxMinList,autoMinList,scaleList,scaleMinList,autoList,remainList});},handleColResizeMousedownEvent(evnt,fixedType,params){const isLeftBtn=evnt.button===0;if(!isLeftBtn){return;}evnt.stopPropagation();evnt.preventDefault();const{column}=params;const{columnStore,overflowX,scrollbarHeight}=reactData;const{visibleColumn}=internalData;const{leftList,rightList}=columnStore;const resizableOpts=computeResizableOpts.value;const osbHeight=overflowX?scrollbarHeight:0;const tableEl=refElem.value;const leftContainerElem=refLeftContainer.value;const rightContainerElem=refRightContainer.value;const resizeBarElem=refColResizeBar.value;if(!resizeBarElem){return;}const isLeftFixed=fixedType==='left';const isRightFixed=fixedType==='right';const resizeTipElem=resizeBarElem.firstElementChild;const scrollbarXToTop=computeScrollbarXToTop.value;const{clientX:dragClientX}=evnt;const dragBtnElem=evnt.target;let cell=dragBtnElem.parentElement;let resizeColumn=column;const isDragGroupCol=column.children&&column.children.length;if(isDragGroupCol){resizeColumn=getLastChildColumn(column);if(isDragGroupCol){const trEl=cell?cell.parentElement:null;const theadEl=trEl?trEl.parentElement:null;cell=theadEl?theadEl.querySelector(`.vxe-header--column[colid="${resizeColumn.id}"]`):null;}}if(!cell){return;}const cellParams=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().assign(params,{cell,$table:$xeTable});let dragLeft=0;const tableRect=tableEl.getBoundingClientRect();const rightContainerRect=rightContainerElem?rightContainerElem.getBoundingClientRect():null;const cellRect=cell.getBoundingClientRect();const dragBtnRect=dragBtnElem.getBoundingClientRect();const dragBtnWidth=dragBtnElem.clientWidth;const dragBtnOffsetWidth=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().floor(dragBtnWidth/2);const dragPosLeft=dragBtnRect.x-tableRect.x+dragBtnOffsetWidth;const minInterval=getColReMinWidth(cellParams)-dragBtnOffsetWidth;// 列之间的最小间距
|
|
20993
|
+
const maxInterval=getColReMaxWidth(cellParams);// 列之间的最大间距
|
|
20973
20994
|
const dragMinLeft=isRightFixed?0:cellRect.x-tableRect.x+dragBtnWidth+minInterval;const dragMaxLeft=cellRect.x-tableRect.x+cell.clientWidth-minInterval;let fixedLeftRemainWidth=0;let fixedRightRemainWidth=0;if(isLeftFixed||isRightFixed){let isMach=false;const fixedColumn=isLeftFixed?leftList:rightList;for(let i=0;i<fixedColumn.length;i++){const item=fixedColumn[i];if(isMach){fixedLeftRemainWidth+=item.renderWidth;}else{isMach=item.id===resizeColumn.id;if(!isMach){fixedRightRemainWidth+=item.renderWidth;}}}}// 处理拖动事件
|
|
20974
|
-
const updateEvent=evnt=>{evnt.stopPropagation();evnt.preventDefault();const tableHeight=tableEl.clientHeight;const offsetX=evnt.clientX-dragClientX;let left=dragPosLeft+offsetX;if(isLeftFixed){if(rightContainerRect){left=Math.min(left,rightContainerRect.x-tableRect.x-fixedLeftRemainWidth-minInterval);}}else if(isRightFixed){if(leftContainerElem){left=Math.max(left,leftContainerElem.clientWidth+fixedRightRemainWidth+minInterval);}left=Math.min(left,dragMaxLeft);}dragLeft=Math.max(left,dragMinLeft)
|
|
20995
|
+
const updateEvent=evnt=>{evnt.stopPropagation();evnt.preventDefault();const tableHeight=tableEl.clientHeight;const offsetX=evnt.clientX-dragClientX;let left=dragPosLeft+offsetX;if(isLeftFixed){if(rightContainerRect){left=Math.min(left,rightContainerRect.x-tableRect.x-fixedLeftRemainWidth-minInterval);}}else if(isRightFixed){if(leftContainerElem){left=Math.max(left,leftContainerElem.clientWidth+fixedRightRemainWidth+minInterval);}left=Math.min(left,dragMaxLeft);}dragLeft=Math.max(left,dragMinLeft);// 最大宽
|
|
20996
|
+
if(maxInterval>1){dragLeft=Math.min(dragLeft,maxInterval+dragMinLeft-minInterval);}const resizeBarLeft=Math.max(1,dragLeft);resizeBarElem.style.left=`${resizeBarLeft}px`;resizeBarElem.style.top=`${scrollbarXToTop?osbHeight:0}px`;resizeBarElem.style.height=`${scrollbarXToTop?tableHeight-osbHeight:tableHeight}px`;if(resizableOpts.showDragTip&&resizeTipElem){resizeTipElem.textContent=table_getI18n('vxe.table.resizeColTip',[Math.floor(resizeColumn.renderWidth+(isRightFixed?dragPosLeft-dragLeft:dragLeft-dragPosLeft))]);const tableWrapperWidth=tableEl.clientWidth;const resizeBarWidth=resizeBarElem.clientWidth;const resizeTipWidth=resizeTipElem.clientWidth;const resizeTipHeight=resizeTipElem.clientHeight;let resizeTipLeft=-resizeTipWidth;if(resizeBarLeft<resizeTipWidth+resizeBarWidth){resizeTipLeft=0;}else if(resizeBarLeft>tableWrapperWidth){resizeTipLeft+=tableWrapperWidth-resizeBarLeft;}resizeTipElem.style.left=`${resizeTipLeft}px`;resizeTipElem.style.top=`${Math.min(tableHeight-resizeTipHeight,Math.max(0,evnt.clientY-tableRect.y-resizeTipHeight/2))}px`;}reactData.isDragResize=true;};reactData.isDragResize=true;addClass(tableEl,'col-drag--resize');resizeBarElem.style.display='block';document.onmousemove=updateEvent;document.onmouseup=function(evnt){document.onmousemove=null;document.onmouseup=null;resizeBarElem.style.display='none';internalData._lastResizeTime=Date.now();setTimeout(()=>{reactData.isDragResize=false;},50);const resizeWidth=resizeColumn.renderWidth+(isRightFixed?dragPosLeft-dragLeft:dragLeft-dragPosLeft);const resizeParams={...params,resizeWidth,resizeColumn};if(resizableOpts.dragMode==='fixed'){visibleColumn.forEach(item=>{if(item.id!==resizeColumn.id){if(!item.resizeWidth){item.resizeWidth=item.renderWidth;}}});}if($xeTable.handleColResizeCellAreaEvent){$xeTable.handleColResizeCellAreaEvent(evnt,resizeParams);}else{resizeColumn.resizeWidth=resizeWidth;handleUpdateColResize(evnt,resizeParams);}removeClass(tableEl,'col-drag--resize');};updateEvent(evnt);if($xeTable.closeMenu){$xeTable.closeMenu();}},handleColResizeDblclickEvent(evnt,params){const resizableOpts=computeResizableOpts.value;const{isDblclickAutoWidth}=resizableOpts;const el=refElem.value;if(isDblclickAutoWidth&&el){evnt.stopPropagation();evnt.preventDefault();const{fullColumnIdData}=internalData;const{column}=params;let resizeColumn=column;if(column.children&&column.children.length){external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(column.children,childColumn=>{resizeColumn=childColumn;});}const colid=resizeColumn.id;const colRest=fullColumnIdData[colid];const dragBtnElem=evnt.target;const cell=dragBtnElem.parentNode;const cellParams=Object.assign(params,{cell,$table:$xeTable});const colMinWidth=getColReMinWidth(cellParams);const colMaxWidth=getColReMaxWidth(cellParams);el.setAttribute('data-calc-col','Y');let resizeWidth=calcColumnAutoWidth(resizeColumn,el);el.removeAttribute('data-calc-col');if(colRest){resizeWidth=Math.max(resizeWidth,colRest.width);}resizeWidth=Math.max(colMinWidth,resizeWidth);if(colMaxWidth>1){resizeWidth=Math.min(colMaxWidth,resizeWidth);}const resizeParams={...params,resizeWidth,resizeColumn};reactData.isDragResize=false;internalData._lastResizeTime=Date.now();if($xeTable.handleColResizeDblclickCellAreaEvent){$xeTable.handleColResizeDblclickCellAreaEvent(evnt,resizeParams);}else{resizeColumn.resizeWidth=resizeWidth;handleUpdateColResize(evnt,resizeParams);}}},handleRowResizeMousedownEvent(evnt,params){evnt.stopPropagation();evnt.preventDefault();const{row}=params;const{showOverflow}=props;const{overflowX,scrollbarWidth,overflowY,scrollbarHeight}=reactData;const{elemStore,fullAllDataRowIdData}=internalData;const osbWidth=overflowY?scrollbarWidth:0;const osbHeight=overflowX?scrollbarHeight:0;const scrollbarYToLeft=computeScrollbarYToLeft.value;const resizableOpts=computeResizableOpts.value;const rowOpts=computeRowOpts.value;const cellOpts=computeCellOpts.value;let tableEl=refElem.value;if($xeGantt){const{refGanttContainerElem}=$xeGantt.getRefMaps();const ganttContainerElem=refGanttContainerElem.value;if(ganttContainerElem){tableEl=ganttContainerElem;}}const resizeBarElem=refRowResizeBar.value;if(!resizeBarElem){return;}const{clientY:dragClientY}=evnt;const resizeTipElem=resizeBarElem.firstElementChild;const dragBtnElem=evnt.currentTarget;const tdEl=dragBtnElem.parentNode;const trEl=tdEl.parentNode;const bodyScrollElem=getRefElem(elemStore['main-body-scroll']);if(!bodyScrollElem){return;}const rowid=getRowid($xeTable,row);const rowRest=fullAllDataRowIdData[rowid];if(!rowRest){return;}const defaultRowHeight=computeDefaultRowHeight.value;let currCellHeight=rowRest.resizeHeight||cellOpts.height||rowOpts.height||rowRest.height||defaultRowHeight;if(!showOverflow){currCellHeight=tdEl.clientHeight;}const tableRect=tableEl.getBoundingClientRect();const trRect=trEl.getBoundingClientRect();const targetOffsetY=dragClientY-trRect.y-trEl.clientHeight;let resizeHeight=currCellHeight;const cellEl=tdEl.querySelector('.vxe-cell');let cellMinHeight=0;if(cellEl){const cellStyle=getComputedStyle(cellEl);cellMinHeight=Math.max(1,Math.ceil(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(cellStyle.paddingTop)+external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(cellStyle.paddingBottom)));}const minTop=trRect.y-tableRect.y+cellMinHeight;// 处理拖动事件
|
|
20975
20997
|
const updateEvent=evnt=>{evnt.stopPropagation();evnt.preventDefault();const rtWidth=tableEl.clientWidth-osbWidth;const tableHeight=tableEl.clientHeight-osbHeight;let dragTop=evnt.clientY-tableRect.y-targetOffsetY;if(dragTop<minTop){dragTop=minTop;}else{resizeHeight=Math.max(cellMinHeight,currCellHeight+evnt.clientY-dragClientY);}resizeBarElem.style.left=`${scrollbarYToLeft?osbWidth:0}px`;resizeBarElem.style.top=`${dragTop}px`;resizeBarElem.style.width=`${rtWidth}px`;if(resizableOpts.showDragTip&&resizeTipElem){resizeTipElem.textContent=table_getI18n('vxe.table.resizeRowTip',[resizeHeight]);const resizeTipWidth=resizeTipElem.clientWidth;const resizeTipHeight=resizeTipElem.clientHeight;let resizeBarLeft=Math.max(2,evnt.clientX-tableRect.x);let resizeBarTop=0;if(resizeBarLeft+resizeTipWidth>=rtWidth-2){resizeBarLeft=rtWidth-resizeTipWidth-2;}if(dragTop+resizeTipHeight>=tableHeight){resizeBarTop=tableHeight-(dragTop+resizeTipHeight);}resizeTipElem.style.left=`${resizeBarLeft}px`;resizeTipElem.style.top=`${resizeBarTop}px`;}reactData.isDragResize=true;};reactData.isDragResize=true;addClass(tableEl,'row-drag--resize');resizeBarElem.style.display='block';document.onmousemove=updateEvent;document.onmouseup=function(evnt){document.onmousemove=null;document.onmouseup=null;resizeBarElem.style.display='none';internalData._lastResizeTime=Date.now();setTimeout(()=>{reactData.isDragResize=false;},50);if(resizeHeight!==currCellHeight){const resizeParams={...params,resizeHeight,resizeRow:row};internalData.isResizeCellHeight=true;if($xeTable.handleRowResizeCellAreaEvent){$xeTable.handleRowResizeCellAreaEvent(evnt,resizeParams);}else{rowRest.resizeHeight=resizeHeight;handleUpdateRowResize(evnt,resizeParams);updateRowOffsetTop();}}removeClass(tableEl,'row-drag--resize');};updateEvent(evnt);},handleRowResizeDblclickEvent(evnt,params){const resizableOpts=computeResizableOpts.value;const{isDblclickAutoHeight}=resizableOpts;const el=refElem.value;if(isDblclickAutoHeight&&el){evnt.stopPropagation();evnt.preventDefault();const{editStore}=reactData;const{fullAllDataRowIdData}=internalData;const{actived}=editStore;const{row}=params;const rowid=getRowid($xeTable,row);const rowRest=fullAllDataRowIdData[rowid];if(!rowRest){return;}const handleRsHeight=()=>{el.setAttribute('data-calc-row','Y');const resizeHeight=calcCellAutoHeight(rowRest,el);el.removeAttribute('data-calc-row');const resizeParams={...params,resizeHeight,resizeRow:row};reactData.isDragResize=false;internalData._lastResizeTime=Date.now();if($xeTable.handleRowResizeDblclickCellAreaEvent){$xeTable.handleRowResizeDblclickCellAreaEvent(evnt,resizeParams);}else{rowRest.resizeHeight=resizeHeight;handleUpdateRowResize(evnt,resizeParams);}};if(actived.row||actived.column){$xeTable.clearEdit().then(handleRsHeight);}else{handleRsHeight();}}},saveCustomStore(type){const{customConfig}=props;const tableId=computeTableId.value;const customOpts=computeCustomOpts.value;const{updateStore,storage,storeOptions}=customOpts;const isAllCustom=storage===true;const storageOpts=Object.assign({},isAllCustom?{}:storage||{},storeOptions);const isCustomResizable=hangleStorageDefaultValue(storageOpts.resizable,isAllCustom);const isCustomVisible=hangleStorageDefaultValue(storageOpts.visible,isAllCustom);const isCustomFixed=hangleStorageDefaultValue(storageOpts.fixed,isAllCustom);const isCustomSort=hangleStorageDefaultValue(storageOpts.sort,isAllCustom);const isCustomAggGroup=hangleStorageDefaultValue(storageOpts.aggGroup,isAllCustom);const isCustomAggFunc=hangleStorageDefaultValue(storageOpts.aggFunc,isAllCustom);if(type!=='reset'){// fix:修复拖动列宽,重置按钮无法点击的问题
|
|
20976
20998
|
reactData.isCustomStatus=true;}if(storage&&(customConfig?isEnableConf(customOpts):customOpts.enabled)&&(isCustomResizable||isCustomVisible||isCustomFixed||isCustomSort||isCustomAggGroup||isCustomAggFunc)){if(!tableId){errLog('vxe.error.reqProp',['id']);return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();}const storeData=type==='reset'?{resizableData:{},sortData:[],visibleData:{},fixedData:{},aggGroupData:{},aggFuncData:{}}:$xeTable.getCustomStoreData();if(updateStore){return updateStore({$table:$xeTable,id:tableId,type,storeData});}else{setCustomStorageMap(tableId,type==='reset'?null:storeData);}}return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();},handleCustom(){const{mouseConfig}=props;if(mouseConfig){if($xeTable.clearSelected){$xeTable.clearSelected();}if($xeTable.clearCellAreas){$xeTable.clearCellAreas();$xeTable.clearCopyCellArea();}}$xeTable.analyColumnWidth();return $xeTable.refreshColumn(true);},handleUpdateDataQueue(){reactData.upDataFlag++;},handleRefreshColumnQueue(){reactData.reColumnFlag++;},handleFilterOptions(column){if(column){const{filterStore}=reactData;const{filterRender,filters}=column;const filterOptions=filters||[];const compConf=isEnableConf(filterRender)?table_renderer.get(filterRender.name):null;const frMethod=column.filterRecoverMethod||(compConf?compConf.tableFilterRecoverMethod||compConf.filterRecoverMethod:null);filterStore.column=column;// 复原状态
|
|
20977
20999
|
filterOptions.forEach(option=>{const{_checked,checked}=option;option._checked=checked;if(!checked&&_checked!==checked){if(frMethod){frMethod({option,column,$table:$xeTable});}}});$xeTable.checkFilterOptions();}},preventEvent(evnt,type,args,next,end){let evntList=table_interceptor.get(type);// 兼容老版本
|