Skip to content

Commit

Permalink
v2.21.8
Browse files Browse the repository at this point in the history
  • Loading branch information
huangshuwei committed Nov 22, 2022
1 parent 9028a15 commit 03f5ff1
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 5 deletions.
18 changes: 18 additions & 0 deletions CHANGE-LOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,24 @@ Vx.x.x(TPL)
- Style changes
- Dependencies Changes

V2.21.8

### Breaking Changes

- Change contextmenu type name of the header: CANCLE_LEFT_FIXED_COLUMN_TO -> CANCEL_LEFT_FIXED_COLUMN_TO

### Bug Fixes

- Fix the bug that the column width restoring when cancel or fix the column through the right-click menu after dragging the column width

### Breaking Changes

- 修改表头右键菜单类型名称: CANCLE_LEFT_FIXED_COLUMN_TO -> CANCEL_LEFT_FIXED_COLUMN_TO

### Bug Fixes

- 修复列宽拖动后,通过右键菜单取消或者固定列时,列宽还原的问题

V2.21.7

### Bug Fixes
Expand Down
2 changes: 1 addition & 1 deletion examples/public/versions.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"value":"/vue-easytable","label":"2.21.6"},{"value":"/vue-easytable/2.20.2","label":"2.20.2"},{"value":"/vue-easytable/2.19.1","label":"2.19.1"},{"value":"/vue-easytable/2.18.3","label":"2.18.3"},{"value":"/vue-easytable/2.17.3","label":"2.17.3"},{"value":"/vue-easytable/2.16.3/","label":"2.16.3"},{"value":"/vue-easytable/2.15.0/","label":"2.15.0"},{"value":"/vue-easytable/2.14.4/","label":"2.14.4"},{"value":"/vue-easytable/2.13.1/","label":"2.13.1"},{"value":"/vue-easytable/2.12.3/","label":"2.12.3"},{"value":"/vue-easytable/2.11.0/","label":"2.11.0"},{"value":"/vue-easytable/1.7.2/app.html","label":"1.x","isVersion1":true}]
[{"value":"/vue-easytable","label":"2.21.8"},{"value":"/vue-easytable/2.20.2","label":"2.20.2"},{"value":"/vue-easytable/2.19.1","label":"2.19.1"},{"value":"/vue-easytable/2.18.3","label":"2.18.3"},{"value":"/vue-easytable/2.17.3","label":"2.17.3"},{"value":"/vue-easytable/2.16.3/","label":"2.16.3"},{"value":"/vue-easytable/2.15.0/","label":"2.15.0"},{"value":"/vue-easytable/2.14.4/","label":"2.14.4"},{"value":"/vue-easytable/2.13.1/","label":"2.13.1"},{"value":"/vue-easytable/2.12.3/","label":"2.12.3"},{"value":"/vue-easytable/2.11.0/","label":"2.11.0"},{"value":"/vue-easytable/1.7.2/app.html","label":"1.x","isVersion1":true}]
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-easytable",
"version": "2.21.7",
"version": "2.21.8",
"main": "libs/main.js",
"description": "Vue table component",
"keywords": [
Expand Down Expand Up @@ -136,7 +136,7 @@
"docVersions": [
{
"value": "/vue-easytable",
"label": "2.21.7"
"label": "2.21.8"
},
{
"value": "/vue-easytable/2.20.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import VeSelect from './ve-select';
import VeTable from './ve-table';


const version = '2.21.7';
const version = '2.21.8';
const components = [
VeCheckbox,
VeCheckboxGroup,
Expand Down
9 changes: 9 additions & 0 deletions packages/ve-table/src/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,8 @@ export default {
cloneColumns: {
handler() {
this.initGroupColumns();
// 右键(取消)固定列会操作 cloneColumns
this.initColumnWidthByColumnResize();

this.columnsOptionResetTime++;
// 需要等待 initColumns 和 initGroupColumns 先执行
Expand Down Expand Up @@ -2821,6 +2823,7 @@ export default {
cellSelectionRangeData,
allRowKeys,
colgroups,
enableColumnResize,
} = this;

const { rowKey, colKey } = cellSelectionData.currentCell;
Expand Down Expand Up @@ -2869,6 +2872,8 @@ export default {
cloneColumns: this.cloneColumns,
cellSelectionRangeData,
fixedType: COLUMN_FIXED_TYPE.LEFT,
colgroups,
enableColumnResize,
});
}
// cancel left fixed column to
Expand All @@ -2879,6 +2884,7 @@ export default {
cloneColumns: this.cloneColumns,
colgroups,
fixedType: COLUMN_FIXED_TYPE.LEFT,
enableColumnResize,
});
}
// right fixed column to
Expand All @@ -2889,6 +2895,8 @@ export default {
cloneColumns: this.cloneColumns,
cellSelectionRangeData,
fixedType: COLUMN_FIXED_TYPE.RIGHT,
colgroups,
enableColumnResize,
});
}
// cancel right fixed column to
Expand All @@ -2899,6 +2907,7 @@ export default {
cloneColumns: this.cloneColumns,
colgroups,
fixedType: COLUMN_FIXED_TYPE.RIGHT,
enableColumnResize,
});
}
}
Expand Down
39 changes: 38 additions & 1 deletion packages/ve-table/src/util/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1458,12 +1458,16 @@ export function cellAutofill({
* @param {array<object>} cloneColumns
* @param {object} cellSelectionRangeData
* @param {string} fixedType COLUMN_FIXED_TYPE
* @param {array<object>} colgroups
* @param {bool} enableColumnResize
* @return cloneColumns
*/
export function setColumnFixed({
cloneColumns,
cellSelectionRangeData,
fixedType,
colgroups,
enableColumnResize,
}) {
let result = cloneColumns;

Expand Down Expand Up @@ -1503,6 +1507,20 @@ export function setColumnFixed({
if (colItem.fixed === fixedType) {
colItem.fixed = "";
}

// 允许列自适应 && 不是多列表头
if (
enableColumnResize &&
!(Array.isArray(colItem.children) && colItem.children.length)
) {
const _colItem = colgroups.find(
(x) => x.key === colItem.key && !isEmptyValue(x.key),
);
if (_colItem) {
colItem.width = _colItem._columnResizeWidth;
}
}

if (COLUMN_FIXED_TYPE.LEFT === fixedType) {
// 不允许左冻结最后一列
if (index <= fixedColIndex && index < cloneColumns.length) {
Expand All @@ -1527,10 +1545,29 @@ export function setColumnFixed({
* @param {array<object>} cloneColumns
* @param {array<object>} colgroups
* @param {string} fixedType COLUMN_FIXED_TYPE
* @param {bool} enableColumnResize
* @return cloneColumns
*/
export function cancelColumnFixed({ cloneColumns, colgroups, fixedType }) {
export function cancelColumnFixed({
cloneColumns,
colgroups,
fixedType,
enableColumnResize,
}) {
return cloneColumns.map((colItem) => {
// 允许列自适应 && 不是多列表头
if (
enableColumnResize &&
!(Array.isArray(colItem.children) && colItem.children.length)
) {
const _colItem = colgroups.find(
(x) => x.key === colItem.key && !isEmptyValue(x.key),
);
if (_colItem) {
colItem.width = _colItem._columnResizeWidth;
}
}

if (COLUMN_FIXED_TYPE.LEFT === fixedType) {
if (
colItem.fixed === fixedType &&
Expand Down

0 comments on commit 03f5ff1

Please sign in to comment.