Skip to content

Commit d6c5d07

Browse files
committed
merge from origin/cell-edit
1 parent 4634c38 commit d6c5d07

File tree

26 files changed

+1977
-94
lines changed

26 files changed

+1977
-94
lines changed
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
:::anchor Single click edit
2+
3+
:::demo `doubleClickEdit=false` to turn off double click editing and turn on single click editing of cells
4+
5+
```html
6+
<template>
7+
<div>
8+
<ve-table
9+
ref="tableRef"
10+
rowKeyFieldName="rowKey"
11+
:max-height="300"
12+
:fixed-header="true"
13+
:columns="columns"
14+
:table-data="tableData"
15+
:editOption="editOption"
16+
/>
17+
</div>
18+
</template>
19+
20+
<script>
21+
export default {
22+
data() {
23+
return {
24+
// edit option 可控单元格编辑
25+
editOption: {
26+
// disable double click edit
27+
doubleClickEdit: false,
28+
// cell value change
29+
cellValueChange: ({ row, column }) => {
30+
console.log("cellValueChange row::", row);
31+
console.log("cellValueChange column::", column);
32+
},
33+
// row value change
34+
rowValueChange: ({ row }) => {
35+
console.log("rowValueChange row::", row);
36+
},
37+
},
38+
columns: [
39+
{
40+
field: "name",
41+
key: "name",
42+
title: "Name",
43+
align: "left",
44+
width: "15%",
45+
edit: true,
46+
},
47+
{
48+
field: "date",
49+
key: "date",
50+
title: "Date",
51+
align: "left",
52+
width: "15%",
53+
edit: true,
54+
},
55+
{
56+
field: "hobby",
57+
key: "hobby",
58+
title: "Hobby",
59+
align: "center",
60+
width: "30%",
61+
edit: true,
62+
},
63+
{
64+
field: "address",
65+
key: "address",
66+
title: "Address",
67+
align: "left",
68+
width: "40%",
69+
edit: true,
70+
},
71+
],
72+
// table data
73+
tableData: [
74+
{
75+
name: "John",
76+
date: "1900-05-20",
77+
hobby: "coding and coding repeat",
78+
address: "No.1 Century Avenue, Shanghai",
79+
rowKey: 0,
80+
},
81+
{
82+
name: "Dickerson",
83+
date: "1910-06-20",
84+
hobby: "coding and coding repeat",
85+
address: "No.1 Century Avenue, Beijing",
86+
rowKey: 1,
87+
},
88+
{
89+
name: "Larsen",
90+
date: "2000-07-20",
91+
hobby: "coding and coding repeat",
92+
address: "No.1 Century Avenue, Chongqing",
93+
rowKey: 2,
94+
},
95+
{
96+
name: "Geneva",
97+
date: "2010-08-20",
98+
hobby: "coding and coding repeat",
99+
address: "No.1 Century Avenue, Xiamen",
100+
rowKey: 3,
101+
},
102+
{
103+
name: "Jami",
104+
date: "2020-09-20",
105+
hobby: "coding and coding repeat",
106+
address: "No.1 Century Avenue, Shenzhen",
107+
rowKey: 4,
108+
},
109+
],
110+
};
111+
},
112+
};
113+
</script>
114+
```
115+
116+
:::

examples/src/docs/en/ve-table/cell-ellipsis/base.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ When the default text content exceeds the cell width, it will be displayed as a
66
```html
77
<template>
88
<ve-table
9-
rowKeyFieldName="rowkey"
9+
rowKeyFieldName="rowKey"
1010
:fixed-header="true"
1111
:columns="columns"
1212
:table-data="tableData"
@@ -55,38 +55,38 @@ When the default text content exceeds the cell width, it will be displayed as a
5555
hobby: "coding and coding repeat",
5656
address:
5757
"No.1 Century Avenue, Shanghai,this is a long text,this is a long text,this is a long text,this is a long text",
58-
rowkey: 0,
58+
rowKey: 0,
5959
},
6060
{
6161
name: "Dickerson",
6262
date: "1910-06-20",
6363
hobby: "coding and coding repeat",
6464
address:
6565
"No.1 Century Avenue, Beijing,this is a long text,this is a long text,this is a long text,this is a long text",
66-
rowkey: 1,
66+
rowKey: 1,
6767
},
6868
{
6969
name: "Larsen",
7070
date: "2000-07-20",
7171
hobby: "coding and coding repeat",
7272
address:
7373
"No.1 Century Avenue, Chongqing,this is a long text,this is a long text,this is a long text,this is a long text",
74-
rowkey: 2,
74+
rowKey: 2,
7575
},
7676
{
7777
name: "Geneva",
7878
date: "2010-08-20",
7979
hobby: "coding and coding repeat",
8080
address:
8181
"No.1 Century Avenue, Xiamen,this is a long text,this is a long text",
82-
rowkey: 3,
82+
rowKey: 3,
8383
},
8484
{
8585
name: "Jami",
8686
date: "2020-09-20",
8787
hobby: "coding and coding repeat",
8888
address: "No.1 Century Avenue, Shenzhen",
89-
rowkey: 4,
89+
rowKey: 4,
9090
},
9191
],
9292
};

examples/src/docs/en/ve-table/cell-ellipsis/ellipsis-line.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ At present, this function only supports browser with [-webkit-line-clamp attribu
77
```html
88
<template>
99
<ve-table
10-
rowKeyFieldName="rowkey"
10+
rowKeyFieldName="rowKey"
1111
:fixed-header="true"
1212
:columns="columns"
1313
:table-data="tableData"
@@ -60,38 +60,38 @@ At present, this function only supports browser with [-webkit-line-clamp attribu
6060
hobby: "coding and coding repeat",
6161
address:
6262
"No.1 Century Avenue, Shanghai,this is a long text,this is a long text,this is a long text,this is a long text,this is a long text,this is a long text",
63-
rowkey: 0,
63+
rowKey: 0,
6464
},
6565
{
6666
name: "Dickerson",
6767
date: "1910-06-20",
6868
hobby: "coding and coding repeat",
6969
address:
7070
"No.1 Century Avenue, Beijing,this is a long text,this is a long text,this is a long text,this is a long text",
71-
rowkey: 1,
71+
rowKey: 1,
7272
},
7373
{
7474
name: "Larsen",
7575
date: "2000-07-20",
7676
hobby: "coding and coding repeat",
7777
address:
7878
"No.1 Century Avenue, Chongqing,this is a long text,this is a long text,this is a long text,this is a long text,this is a long text,this is a long text,this is a long text,this is a long text",
79-
rowkey: 2,
79+
rowKey: 2,
8080
},
8181
{
8282
name: "Geneva",
8383
date: "2010-08-20",
8484
hobby: "coding and coding repeat",
8585
address:
8686
"No.1 Century Avenue, Xiamen,this is a long text,this is a long text",
87-
rowkey: 3,
87+
rowKey: 3,
8888
},
8989
{
9090
name: "Jami",
9191
date: "2020-09-20",
9292
hobby: "coding and coding repeat",
9393
address: "No.1 Century Avenue, Shenzhen",
94-
rowkey: 4,
94+
rowKey: 4,
9595
},
9696
],
9797
};

examples/src/docs/en/ve-table/cell-ellipsis/ellipsis.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
```html
66
<template>
77
<ve-table
8-
rowKeyFieldName="rowkey"
8+
rowKeyFieldName="rowKey"
99
:fixed-header="true"
1010
:columns="columns"
1111
:table-data="tableData"
@@ -57,38 +57,38 @@
5757
hobby: "coding and coding repeat",
5858
address:
5959
"No.1 Century Avenue, Shanghai,this is a long text,this is a long text,this is a long text,this is a long text",
60-
rowkey: 0,
60+
rowKey: 0,
6161
},
6262
{
6363
name: "Dickerson",
6464
date: "1910-06-20",
6565
hobby: "coding and coding repeat",
6666
address:
6767
"No.1 Century Avenue, Beijing,this is a long text,this is a long text,this is a long text,this is a long text",
68-
rowkey: 1,
68+
rowKey: 1,
6969
},
7070
{
7171
name: "Larsen",
7272
date: "2000-07-20",
7373
hobby: "coding and coding repeat",
7474
address:
7575
"No.1 Century Avenue, Chongqing,this is a long text,this is a long text,this is a long text,this is a long text",
76-
rowkey: 2,
76+
rowKey: 2,
7777
},
7878
{
7979
name: "Geneva",
8080
date: "2010-08-20",
8181
hobby: "coding and coding repeat",
8282
address:
8383
"No.1 Century Avenue, Xiamen,this is a long text,this is a long text",
84-
rowkey: 3,
84+
rowKey: 3,
8585
},
8686
{
8787
name: "Jami",
8888
date: "2020-09-20",
8989
hobby: "coding and coding repeat",
9090
address: "No.1 Century Avenue, Shenzhen",
91-
rowkey: 4,
91+
rowKey: 4,
9292
},
9393
],
9494
};

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
border-y
1010
:columns="columns"
1111
:table-data="tableData"
12-
rowKeyFieldName="rowkey"
12+
rowKeyFieldName="rowKey"
1313
/>
1414
</template>
1515

@@ -46,7 +46,7 @@
4646
let data = [];
4747
for (let i = 0; i < 10; i++) {
4848
data.push({
49-
rowkey: i,
49+
rowKey: i,
5050
col1: i,
5151
col2: i,
5252
col3: i,

examples/src/docs/en/ve-table/footer-summary/base.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
:columns="columns"
1212
:table-data="tableData"
1313
:footer-data="footerData"
14-
rowKeyFieldName="rowkey"
14+
rowKeyFieldName="rowKey"
1515
/>
1616
</template>
1717

@@ -44,7 +44,7 @@
4444
let data = [];
4545
for (let i = 0; i < 15; i++) {
4646
data.push({
47-
rowkey: i,
47+
rowKey: i,
4848
name: i,
4949
date: i,
5050
hobby: i,
@@ -57,14 +57,14 @@
5757
initFooterData() {
5858
this.footerData = [
5959
{
60-
rowkey: 0,
60+
rowKey: 0,
6161
name: "Average Values",
6262
date: 213,
6363
hobby: 355,
6464
address: 189,
6565
},
6666
{
67-
rowkey: 1,
67+
rowKey: 1,
6868
name: "Summary Values",
6969
date: 1780,
7070
hobby: 890,

examples/src/docs/en/ve-table/footer-summary/cell-span.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
:columns="columns"
1212
:table-data="tableData"
1313
:footer-data="footerData"
14-
rowKeyFieldName="rowkey"
14+
rowKeyFieldName="rowKey"
1515
:cell-span-option="cellSpanOption"
1616
/>
1717
</template>
@@ -104,7 +104,7 @@
104104
let data = [];
105105
for (let i = 0; i < 15; i++) {
106106
data.push({
107-
rowkey: i,
107+
rowKey: i,
108108
name: i,
109109
date: i,
110110
hobby: i,
@@ -117,14 +117,14 @@
117117
initFooterData() {
118118
this.footerData = [
119119
{
120-
rowkey: 0,
120+
rowKey: 0,
121121
name: "Average Values",
122122
date: 213,
123123
hobby: 355,
124124
address: 189,
125125
},
126126
{
127-
rowkey: 1,
127+
rowKey: 1,
128128
name: "Summary Values",
129129
date: 1780,
130130
hobby: 890,

examples/src/docs/en/ve-table/footer-summary/cell-style.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
:table-data="tableData"
1313
:footer-data="footerData"
1414
:cell-style-option="cellStyleOption"
15-
rowKeyFieldName="rowkey"
15+
rowKeyFieldName="rowKey"
1616
/>
1717
</template>
1818

@@ -63,7 +63,7 @@
6363
let data = [];
6464
for (let i = 0; i < 15; i++) {
6565
data.push({
66-
rowkey: i,
66+
rowKey: i,
6767
name: i,
6868
date: i,
6969
hobby: i,
@@ -76,14 +76,14 @@
7676
initFooterData() {
7777
this.footerData = [
7878
{
79-
rowkey: 0,
79+
rowKey: 0,
8080
name: "Average Values",
8181
date: 213,
8282
hobby: 355,
8383
address: 189,
8484
},
8585
{
86-
rowkey: 1,
86+
rowKey: 1,
8787
name: "Summary Values",
8888
date: 1780,
8989
hobby: 890,

0 commit comments

Comments
 (0)