Skip to content

Commit 7f44a5d

Browse files
authored
Merge pull request #5101 from VisActor/5096-bug-drag-autofill-plugin-getorigincellvalue
5096 bug drag autofill plugin getorigincellvalue
2 parents 3c97ef5 + 914cb51 commit 7f44a5d

File tree

5 files changed

+71
-1
lines changed

5 files changed

+71
-1
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"changes": [
3+
{
4+
"comment": "fix: fill handle logic about get cell value #5096\n\n",
5+
"type": "none",
6+
"packageName": "@visactor/vtable"
7+
}
8+
],
9+
"packageName": "@visactor/vtable",
10+
"email": "892739385@qq.com"
11+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import * as VTable from '@visactor/vtable';
2+
import * as VTablePlugins from '../../src';
3+
4+
const CONTAINER_ID = 'vTable';
5+
6+
export function createTable() {
7+
const columns: VTable.ColumnsDefine = [
8+
{
9+
field: 'name',
10+
title: 'Name',
11+
width: 150
12+
},
13+
{
14+
field: 'sales',
15+
title: 'Sales',
16+
width: 150,
17+
fieldFormat: rec => {
18+
if (rec.sales) {
19+
return `$${rec.sales}`;
20+
}
21+
return '';
22+
}
23+
}
24+
];
25+
26+
const records = [{ name: 'John', sales: 100 }, { name: 'Jane', sales: 200 }, { name: 'Doe', sales: 300 }, {}, {}, {}];
27+
28+
const option: VTable.ListTableConstructorOptions = {
29+
container: document.getElementById(CONTAINER_ID)!,
30+
columns,
31+
records,
32+
excelOptions: {
33+
fillHandle: true
34+
},
35+
plugins: [new VTablePlugins.AutoFillPlugin()]
36+
};
37+
38+
const instance = new VTable.ListTable(option);
39+
(window as any).tableInstance = instance;
40+
}

packages/vtable-plugins/demo/menu.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ export const menus = [
3939
path: 'auto-fill',
4040
name: 'auto-fill'
4141
},
42+
{
43+
path: 'auto-fill',
44+
name: 'fill-handle-origin-value'
45+
},
4246
{
4347
path: 'wps-fill-handle',
4448
name: 'wps-fill-handle'

packages/vtable-plugins/src/auto-fill/auto-fill-helper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export function openAutoFillMenu(tableInstance: ListTable, endCol: number, endRo
8686
export function getCellMatrix(table: ListTable) {
8787
return {
8888
getValue: (row: number, col: number) => {
89-
const value = table.getCellValue(col, row);
89+
const value = table.getCellOriginValue(col, row);
9090
if (typeof value === 'number' || !isNaN(Number(value))) {
9191
return {
9292
v: value,

skills-lock.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"version": 1,
3+
"skills": {
4+
"vtable-browser-debugger-assistant": {
5+
"source": "VisActor/VTable",
6+
"sourceType": "github",
7+
"computedHash": "be064dc336796005c403d281243b25684e4f7abc1513125f91d6c65e912bc88b"
8+
},
9+
"vtable-development-assistant": {
10+
"source": "VisActor/VTable",
11+
"sourceType": "github",
12+
"computedHash": "6f24fceb32b7d460587ed0c8e93c643e969e8102a0a791e0880ad692af07e79a"
13+
}
14+
}
15+
}

0 commit comments

Comments
 (0)