Skip to content

Commit 4d4093f

Browse files
committed
Merge remote-tracking branch 'origin/column-width-drag'
2 parents 8e1b465 + b9a9bad commit 4d4093f

File tree

56 files changed

+3163
-2088
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+3163
-2088
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<template>
2+
<div>
3+
<tpl
4+
:desc="desc"
5+
:anchor="anchor"
6+
:table-data="db.columnWidthResizeOption.data"
7+
:columns="db.columnWidthResizeOption.columns"
8+
/>
9+
</div>
10+
</template>
11+
<script>
12+
import tpl from "@/comp/api-tpl";
13+
import { db } from "./db";
14+
export default {
15+
components: { tpl },
16+
props: {
17+
anchor: {
18+
type: String,
19+
default: "Column Resize Option",
20+
},
21+
desc: {
22+
type: String,
23+
default: "columnWidthResizeOption",
24+
},
25+
},
26+
data() {
27+
return {
28+
db: db,
29+
};
30+
},
31+
};
32+
</script>

examples/src/docs/en/ve-table/api/db.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,6 +1194,38 @@ export const db = {
11941194
desc: `The callback method after cell delete. Parameter Description:\r1、<code>data</code>delete data\r2、<code>selectionRangeIndexes</code>The indexs information of delete area\r3、<code>selectionRangeKeys</code>The keys information of delete paste`,
11951195
type: `<code>Function({
11961196
data, selectionRangeIndexes, selectionRangeKeys
1197+
})</code>`,
1198+
optionalVal: "-",
1199+
default: "-",
1200+
},
1201+
],
1202+
columns: columnsType1,
1203+
},
1204+
// 列宽改变配置
1205+
columnWidthResizeOption: {
1206+
data: [
1207+
{
1208+
param: "enable",
1209+
desc: `enable column resize`,
1210+
type: `<code>Boolean</code>`,
1211+
optionalVal: "-",
1212+
default: "false",
1213+
},
1214+
{
1215+
param: "minWidth",
1216+
desc: `min width of resize column`,
1217+
type: `<code>Number</code>`,
1218+
optionalVal: "-",
1219+
default: "30px",
1220+
},
1221+
{
1222+
param: "sizeChange",
1223+
desc: `The callback method after column resize. Parameter Description:\r1、<code>column</code>resize column\r2、<code>differWidth</code>Width of the difference after column resize\r3、<code>columnWidth</code>column width after column resize\r4、<code>tableWidth</code>table width after column resize`,
1224+
type: `<code>Function({
1225+
column,
1226+
differWidth,
1227+
columnWidth,
1228+
tableWidth
11971229
})</code>`,
11981230
optionalVal: "-",
11991231
default: "-",

examples/src/docs/en/ve-table/api/main.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
<cellAutofillOption />
4040
<!-- Clipboard Option -->
4141
<clipboardOption />
42+
<!-- Clipboard Option -->
43+
<columnWidthResizeOption />
4244
</div>
4345
</template>
4446
<script>
@@ -62,6 +64,7 @@ import contextmenuHeaderOption from "./contextmenu-header-option-props";
6264
import contextmenuBodyOption from "./contextmenu-body-option-props";
6365
import cellAutofillOption from "./cell-autofill-option-props";
6466
import clipboardOption from "./clipboard-option-props";
67+
import columnWidthResizeOption from "./column-width-resize-option-props";
6568
export default {
6669
components: {
6770
TableProps,
@@ -83,6 +86,7 @@ export default {
8386
contextmenuBodyOption,
8487
cellAutofillOption,
8588
clipboardOption,
89+
columnWidthResizeOption,
8690
},
8791
data() {
8892
return {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
:::tip
2-
1、像 excel 那样进行单元格内容的自动填充
2+
When there is data that needs to be copied repeatedly, you can automatically fill in the cell content like excel
33

44
:::

examples/src/docs/en/ve-table/cell-autofill/main.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
<template>
22
<div>
33
<h2>Cell Autofill</h2>
4+
<Explain />
45
<Base />
56
<AutofillDirection />
67
<API title="API" anchor="API" />
78
</div>
89
</template>
910
<script>
11+
import Explain from "./explain.md";
1012
import Base from "./base.md";
1113
import AutofillDirection from "./autofill-direction.md";
1214
import API from "../api/cell-autofill-option-props";
1315
1416
export default {
1517
name: "cell-selection",
1618
components: {
19+
Explain,
1720
Base,
1821
AutofillDirection,
1922
API,

examples/src/docs/en/ve-table/clipboard/base.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
:columns="columns"
1111
:table-data="tableData"
1212
borderY
13+
:rowStyleOption="rowStyleOption"
1314
:cell-autofill-option="cellAutofillOption"
1415
:edit-option="editOption"
1516
row-key-field-name="rowKey"
@@ -23,6 +24,10 @@
2324
export default {
2425
data() {
2526
return {
27+
rowStyleOption: {
28+
clickHighlight: false,
29+
hoverHighlight: false,
30+
},
2631
// clipboard option
2732
clipboardOption: {
2833
copy: true,
@@ -54,8 +59,6 @@
5459
this.log({ data, selectionRangeIndexes, selectionRangeKeys });
5560
},
5661
beforeDelete: ({ data, selectionRangeIndexes, selectionRangeKeys }) => {
57-
return false;
58-
5962
console.log("beforeDelete");
6063
this.log({ data, selectionRangeIndexes, selectionRangeKeys });
6164
},

examples/src/docs/en/ve-table/column-fixed/explain.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
:::tip
22
1、The property `scroll-width` is the width of the scroll area<br>
3-
2、The attribute `scroll-width` is the width of the scroll area. When the outer container width is less than the `scroll-width` value, a horizontal scroll bar will appear; when the outer container width is greater than the `scroll-width` value, it will follow the container<br>
3+
2、The attribute `scroll-width` is the width of the scroll area. When the outer container width is less than the `scroll-width` value, a horizontal scroll bar will appear; when the outer container width is greater than the `scroll-width` value, it will follow the container;when 'scroll-width=0', the scroll bar will be according to your column width<br>
44
3、Column width can not be set, or set to percentage, or pixel value (PX)<br>
55
4、The `scroll-width` attribute is set, and the column width unit **is strongly recommended to be consistent!**<br>
66

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
:::anchor Column Drag
2+
3+
You can hover the mouse between two columns and drag
4+
5+
:::demo 1、Set the min width of resize column through `minWidth`<br>2、Get the callback method of resize column changes through `sizeChange({ column, differWidth, columnWidth, tableWidth })`
6+
7+
```html
8+
<template>
9+
<ve-table
10+
style="width:100%"
11+
:scroll-width="0"
12+
:columns="columns"
13+
:table-data="tableData"
14+
:border-around="true"
15+
:border-x="true"
16+
:border-y="true"
17+
:column-width-resize-option="columnWidthResizeOption"
18+
/>
19+
</template>
20+
21+
<script>
22+
export default {
23+
data() {
24+
return {
25+
columnWidthResizeOption: {
26+
// default false
27+
enable: true,
28+
// column resize min width
29+
minWidth: 30,
30+
// column size change
31+
sizeChange: ({ column, differWidth, columnWidth, tableWidth }) => {
32+
console.log("----------sizeChange----------");
33+
console.log("column::", column);
34+
console.log("differWidth::", differWidth);
35+
console.log("columnWidth::", columnWidth);
36+
console.log("tableWidth::", tableWidth);
37+
},
38+
},
39+
columns: [
40+
{
41+
field: "index",
42+
key: "index",
43+
title: "#",
44+
width: 50,
45+
align: "center",
46+
fixed: "left",
47+
renderBodyCell: ({ row, column, rowIndex }, h) => {
48+
return ++rowIndex;
49+
},
50+
},
51+
{ field: "col1", key: "col1", title: "Col1" },
52+
{ field: "col2", key: "col2", title: "Col2" },
53+
{ field: "col3", key: "col3", title: "Col3" },
54+
{ field: "col4", key: "col4", title: "Col4" },
55+
{ field: "col5", key: "col5", title: "Col5" },
56+
{ field: "col6", key: "col6", title: "Col6" },
57+
],
58+
tableData: [],
59+
};
60+
},
61+
methods: {
62+
initTableData() {
63+
let data = [];
64+
for (let i = 0; i < 8; i++) {
65+
data.push({
66+
rowKey: i,
67+
col1: `A${i + 1}`,
68+
col2: `B${i + 1}`,
69+
col3: `C${i + 1}`,
70+
col4: `D${i + 1}`,
71+
col5: `E${i + 1}`,
72+
col6: `F${i + 1}`,
73+
col7: `G${i + 1}`,
74+
col8: `H${i + 1}`,
75+
});
76+
}
77+
this.tableData = data;
78+
},
79+
},
80+
created() {
81+
this.initTableData();
82+
},
83+
};
84+
</script>
85+
```
86+
87+
:::
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
:::tip
2+
1、Column width resize is useful when large text exists<br>
3+
2、Configure the column width resize through `columnWidthResizeOption`<br>
4+
3、It is recommended to set `scroll-width=0`, then dragging the column width will change the table width
5+
:::
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<template>
2+
<div>
3+
<h2>Column Resize</h2>
4+
<Explain />
5+
<Basic />
6+
<API title="API" anchor="API" />
7+
</div>
8+
</template>
9+
<script>
10+
import Explain from "./explain.md";
11+
import Basic from "./basic.md";
12+
import API from "../api/column-width-resize-option-props";
13+
14+
export default {
15+
name: "basic-main",
16+
components: {
17+
Explain,
18+
Basic,
19+
API,
20+
},
21+
};
22+
</script>

0 commit comments

Comments
 (0)