diff --git a/.gitignore b/.gitignore index 184de956f..bb1ecf0d1 100644 --- a/.gitignore +++ b/.gitignore @@ -108,4 +108,5 @@ packages/vtable/nodejs/*.png tsconfig.tsbuildinfo .history -.trae/ \ No newline at end of file +.trae/ +.agents/ \ No newline at end of file diff --git a/common/changes/@visactor/vtable/5096-bug-drag-autofill-plugin-getorigincellvalue_2026-04-08-08-39.json b/common/changes/@visactor/vtable/5096-bug-drag-autofill-plugin-getorigincellvalue_2026-04-08-08-39.json new file mode 100644 index 000000000..529ae0b0f --- /dev/null +++ b/common/changes/@visactor/vtable/5096-bug-drag-autofill-plugin-getorigincellvalue_2026-04-08-08-39.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "comment": "fix: fill handle logic about get cell value #5096\n\n", + "type": "none", + "packageName": "@visactor/vtable" + } + ], + "packageName": "@visactor/vtable", + "email": "892739385@qq.com" +} \ No newline at end of file diff --git a/packages/vtable-plugins/demo/auto-fill/fill-handle-origin-value.ts b/packages/vtable-plugins/demo/auto-fill/fill-handle-origin-value.ts new file mode 100644 index 000000000..ccf3b386e --- /dev/null +++ b/packages/vtable-plugins/demo/auto-fill/fill-handle-origin-value.ts @@ -0,0 +1,40 @@ +import * as VTable from '@visactor/vtable'; +import * as VTablePlugins from '../../src'; + +const CONTAINER_ID = 'vTable'; + +export function createTable() { + const columns: VTable.ColumnsDefine = [ + { + field: 'name', + title: 'Name', + width: 150 + }, + { + field: 'sales', + title: 'Sales', + width: 150, + fieldFormat: rec => { + if (rec.sales) { + return `$${rec.sales}`; + } + return ''; + } + } + ]; + + const records = [{ name: 'John', sales: 100 }, { name: 'Jane', sales: 200 }, { name: 'Doe', sales: 300 }, {}, {}, {}]; + + const option: VTable.ListTableConstructorOptions = { + container: document.getElementById(CONTAINER_ID)!, + columns, + records, + excelOptions: { + fillHandle: true + }, + plugins: [new VTablePlugins.AutoFillPlugin()] + }; + + const instance = new VTable.ListTable(option); + (window as any).tableInstance = instance; +} diff --git a/packages/vtable-plugins/demo/menu.ts b/packages/vtable-plugins/demo/menu.ts index 9600c76c7..a9718ec90 100644 --- a/packages/vtable-plugins/demo/menu.ts +++ b/packages/vtable-plugins/demo/menu.ts @@ -39,6 +39,10 @@ export const menus = [ path: 'auto-fill', name: 'auto-fill' }, + { + path: 'auto-fill', + name: 'fill-handle-origin-value' + }, { path: 'wps-fill-handle', name: 'wps-fill-handle' diff --git a/packages/vtable-plugins/src/auto-fill/auto-fill-helper.ts b/packages/vtable-plugins/src/auto-fill/auto-fill-helper.ts index a23fc1ec3..84d768821 100644 --- a/packages/vtable-plugins/src/auto-fill/auto-fill-helper.ts +++ b/packages/vtable-plugins/src/auto-fill/auto-fill-helper.ts @@ -86,7 +86,7 @@ export function openAutoFillMenu(tableInstance: ListTable, endCol: number, endRo export function getCellMatrix(table: ListTable) { return { getValue: (row: number, col: number) => { - const value = table.getCellValue(col, row); + const value = table.getCellOriginValue(col, row); if (typeof value === 'number' || !isNaN(Number(value))) { return { v: value, diff --git a/skills-lock.json b/skills-lock.json new file mode 100644 index 000000000..486223af0 --- /dev/null +++ b/skills-lock.json @@ -0,0 +1,15 @@ +{ + "version": 1, + "skills": { + "vtable-browser-debugger-assistant": { + "source": "VisActor/VTable", + "sourceType": "github", + "computedHash": "be064dc336796005c403d281243b25684e4f7abc1513125f91d6c65e912bc88b" + }, + "vtable-development-assistant": { + "source": "VisActor/VTable", + "sourceType": "github", + "computedHash": "6f24fceb32b7d460587ed0c8e93c643e969e8102a0a791e0880ad692af07e79a" + } + } +}