@visactor/vtable-plugins 1.23.3 → 1.24.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/cjs/auto-fill/index.d.ts +3 -2
  2. package/cjs/auto-fill/index.js.map +1 -1
  3. package/cjs/auto-fill/series-converters.d.ts +3 -3
  4. package/cjs/auto-fill/series-converters.js.map +1 -1
  5. package/cjs/contextmenu/handle-menu-helper.js +1 -2
  6. package/cjs/contextmenu/index.js +2 -1
  7. package/cjs/excel-edit-cell-keyboard.d.ts +4 -2
  8. package/cjs/excel-edit-cell-keyboard.js.map +1 -1
  9. package/cjs/filter/filter-engine.js +5 -1
  10. package/cjs/filter/filter-engine.js.map +1 -1
  11. package/cjs/filter/filter-state-manager.d.ts +6 -1
  12. package/cjs/filter/filter-state-manager.js +81 -0
  13. package/cjs/filter/filter-state-manager.js.map +1 -1
  14. package/cjs/filter/filter-toolbar.d.ts +2 -0
  15. package/cjs/filter/filter-toolbar.js +23 -3
  16. package/cjs/filter/filter-toolbar.js.map +1 -1
  17. package/cjs/filter/filter.d.ts +4 -2
  18. package/cjs/filter/filter.js +32 -10
  19. package/cjs/filter/filter.js.map +1 -1
  20. package/cjs/filter/index.js +2 -1
  21. package/cjs/filter/types.d.ts +3 -0
  22. package/cjs/filter/types.js.map +1 -1
  23. package/cjs/filter/value-filter.js +11 -41
  24. package/cjs/filter/value-filter.js.map +1 -1
  25. package/cjs/filter/value-filter.syncSingleStateFromTableData.backup.d.ts +46 -0
  26. package/cjs/filter/value-filter.syncSingleStateFromTableData.backup.js +247 -0
  27. package/cjs/filter/value-filter.syncSingleStateFromTableData.backup.js.map +1 -0
  28. package/cjs/history/formula.d.ts +40 -0
  29. package/cjs/history/formula.js +112 -0
  30. package/cjs/history/formula.js.map +1 -0
  31. package/cjs/history/history-plugin.d.ts +88 -0
  32. package/cjs/history/history-plugin.js +699 -0
  33. package/cjs/history/history-plugin.js.map +1 -0
  34. package/cjs/history/index.d.ts +3 -0
  35. package/cjs/history/index.js +24 -0
  36. package/cjs/history/index.js.map +1 -0
  37. package/cjs/history/replay.d.ts +9 -0
  38. package/cjs/history/replay.js +268 -0
  39. package/cjs/history/replay.js.map +1 -0
  40. package/cjs/history/sheet-key.d.ts +9 -0
  41. package/cjs/history/sheet-key.js +44 -0
  42. package/cjs/history/sheet-key.js.map +1 -0
  43. package/cjs/history/snapshot.d.ts +15 -0
  44. package/cjs/history/snapshot.js +78 -0
  45. package/cjs/history/snapshot.js.map +1 -0
  46. package/cjs/history/types.d.ts +105 -0
  47. package/cjs/history/types.js +6 -0
  48. package/cjs/history/types.js.map +1 -0
  49. package/cjs/history-plugin.d.ts +1 -0
  50. package/cjs/history-plugin.js +21 -0
  51. package/cjs/history-plugin.js.map +1 -0
  52. package/cjs/index.d.ts +1 -0
  53. package/cjs/index.js +2 -1
  54. package/cjs/index.js.map +1 -1
  55. package/cjs/master-detail-plugin/checkbox.js +1 -1
  56. package/cjs/master-detail-plugin/config.js +1 -1
  57. package/cjs/master-detail-plugin/core.js +1 -1
  58. package/cjs/master-detail-plugin/events.js +1 -1
  59. package/cjs/master-detail-plugin/types.d.ts +1 -1
  60. package/cjs/master-detail-plugin/types.js.map +1 -1
  61. package/cjs/rotate-table.d.ts +7 -6
  62. package/cjs/rotate-table.js +12 -13
  63. package/cjs/rotate-table.js.map +1 -1
  64. package/cjs/row-series.js +2 -1
  65. package/cjs/table-export/util/pagination.js.map +1 -1
  66. package/cjs/wps-fill-handle.d.ts +4 -2
  67. package/cjs/wps-fill-handle.js.map +1 -1
  68. package/dist/vtable-plugins.js +1903 -81
  69. package/dist/vtable-plugins.min.js +3 -3
  70. package/es/auto-fill/index.d.ts +3 -2
  71. package/es/auto-fill/index.js.map +1 -1
  72. package/es/auto-fill/series-converters.d.ts +3 -3
  73. package/es/auto-fill/series-converters.js.map +1 -1
  74. package/es/contextmenu/handle-menu-helper.js +1 -2
  75. package/es/contextmenu/index.js +2 -1
  76. package/es/excel-edit-cell-keyboard.d.ts +4 -2
  77. package/es/excel-edit-cell-keyboard.js.map +1 -1
  78. package/es/filter/filter-engine.js +5 -1
  79. package/es/filter/filter-engine.js.map +1 -1
  80. package/es/filter/filter-state-manager.d.ts +6 -1
  81. package/es/filter/filter-state-manager.js +81 -0
  82. package/es/filter/filter-state-manager.js.map +1 -1
  83. package/es/filter/filter-toolbar.d.ts +2 -0
  84. package/es/filter/filter-toolbar.js +23 -3
  85. package/es/filter/filter-toolbar.js.map +1 -1
  86. package/es/filter/filter.d.ts +4 -2
  87. package/es/filter/filter.js +32 -10
  88. package/es/filter/filter.js.map +1 -1
  89. package/es/filter/index.js +2 -1
  90. package/es/filter/types.d.ts +3 -0
  91. package/es/filter/types.js.map +1 -1
  92. package/es/filter/value-filter.js +12 -41
  93. package/es/filter/value-filter.js.map +1 -1
  94. package/es/filter/value-filter.syncSingleStateFromTableData.backup.d.ts +46 -0
  95. package/es/filter/value-filter.syncSingleStateFromTableData.backup.js +242 -0
  96. package/es/filter/value-filter.syncSingleStateFromTableData.backup.js.map +1 -0
  97. package/es/history/formula.d.ts +40 -0
  98. package/es/history/formula.js +103 -0
  99. package/es/history/formula.js.map +1 -0
  100. package/es/history/history-plugin.d.ts +88 -0
  101. package/es/history/history-plugin.js +698 -0
  102. package/es/history/history-plugin.js.map +1 -0
  103. package/es/history/index.d.ts +3 -0
  104. package/es/history/index.js +4 -0
  105. package/es/history/index.js.map +1 -0
  106. package/es/history/replay.d.ts +9 -0
  107. package/es/history/replay.js +260 -0
  108. package/es/history/replay.js.map +1 -0
  109. package/es/history/sheet-key.d.ts +9 -0
  110. package/es/history/sheet-key.js +38 -0
  111. package/es/history/sheet-key.js.map +1 -0
  112. package/es/history/snapshot.d.ts +15 -0
  113. package/es/history/snapshot.js +71 -0
  114. package/es/history/snapshot.js.map +1 -0
  115. package/es/history/types.d.ts +105 -0
  116. package/es/history/types.js +2 -0
  117. package/es/history/types.js.map +1 -0
  118. package/es/history-plugin.d.ts +1 -0
  119. package/es/history-plugin.js +2 -0
  120. package/es/history-plugin.js.map +1 -0
  121. package/es/index.d.ts +1 -0
  122. package/es/index.js +2 -0
  123. package/es/index.js.map +1 -1
  124. package/es/master-detail-plugin/checkbox.js +1 -1
  125. package/es/master-detail-plugin/config.js +1 -1
  126. package/es/master-detail-plugin/core.js +1 -1
  127. package/es/master-detail-plugin/events.js +1 -1
  128. package/es/master-detail-plugin/types.d.ts +1 -1
  129. package/es/master-detail-plugin/types.js.map +1 -1
  130. package/es/rotate-table.d.ts +7 -6
  131. package/es/rotate-table.js +2 -3
  132. package/es/rotate-table.js.map +1 -1
  133. package/es/row-series.js +2 -1
  134. package/es/table-export/util/pagination.js.map +1 -1
  135. package/es/wps-fill-handle.d.ts +4 -2
  136. package/es/wps-fill-handle.js.map +1 -1
  137. package/package.json +9 -7
  138. package/cjs/auto-fill/__tests__/formula-integration.test.d.ts +0 -23
  139. package/cjs/auto-fill/__tests__/formula-integration.test.js +0 -61
  140. package/cjs/auto-fill/__tests__/formula-integration.test.js.map +0 -1
  141. package/es/auto-fill/__tests__/formula-integration.test.d.ts +0 -23
  142. package/es/auto-fill/__tests__/formula-integration.test.js +0 -54
  143. package/es/auto-fill/__tests__/formula-integration.test.js.map +0 -1
@@ -1,61 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: !0
5
- }), exports.testVTableSheetIntegration = exports.testFormulaAutoFill = exports.formulaAutoFillExamples = exports.demonstrateFormulaAdapter = exports.setupAutoFillWithFormulas = void 0;
6
-
7
- const auto_fill_1 = require("../src/auto-fill");
8
-
9
- function setupAutoFillWithFormulas(table, formulaManager) {
10
- const autoFillPlugin = new auto_fill_1.AutoFillPlugin({
11
- fillMode: "series"
12
- });
13
- return table.registerPlugin(autoFillPlugin), autoFillPlugin;
14
- }
15
-
16
- function demonstrateFormulaAdapter(table, formulaManager) {
17
- const formulaAdapter = (0, auto_fill_1.createFormulaAdapter)(table, formulaManager);
18
- formulaAdapter.isFormulaCell(0, 0), formulaAdapter.getCellFormula(0, 0);
19
- formulaAdapter.setCellFormula(1, 0, "=A1+1");
20
- formulaAdapter.getCalculatedValue(1, 0);
21
- }
22
-
23
- function testFormulaAutoFill() {}
24
-
25
- function testVTableSheetIntegration(table) {
26
- table.changeCellValue(1, 0, "10"), table.changeCellValue(1, 1, "20"), table.changeCellValue(1, 2, "30");
27
- (0, auto_fill_1.createFormulaAdapter)(table).setCellFormula(0, 0, "=B1*2");
28
- }
29
-
30
- exports.setupAutoFillWithFormulas = setupAutoFillWithFormulas, exports.demonstrateFormulaAdapter = demonstrateFormulaAdapter,
31
- exports.formulaAutoFillExamples = {
32
- simpleSeries: [ {
33
- cell: "A1",
34
- formula: "=B1"
35
- }, {
36
- cell: "A2",
37
- formula: "=B2"
38
- } ],
39
- mixedReferences: [ {
40
- cell: "C1",
41
- formula: "=$A$1+B1"
42
- }, {
43
- cell: "C2",
44
- formula: "=$A$1+B2"
45
- } ],
46
- mathematicalSeries: [ {
47
- cell: "D1",
48
- formula: "=A1+1"
49
- }, {
50
- cell: "D2",
51
- formula: "=A2+2"
52
- } ],
53
- functionSeries: [ {
54
- cell: "E1",
55
- formula: "=SUM(A1:B1)"
56
- }, {
57
- cell: "E2",
58
- formula: "=SUM(A2:B2)"
59
- } ]
60
- }, exports.testFormulaAutoFill = testFormulaAutoFill, exports.testVTableSheetIntegration = testVTableSheetIntegration;
61
- //# sourceMappingURL=formula-integration.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/auto-fill/__tests__/formula-integration.test.ts"],"names":[],"mappings":";;;AAKA,gDAAwE;AAMxE,SAAgB,yBAAyB,CAAC,KAAgB,EAAE,cAAoB;IAE9E,MAAM,cAAc,GAAG,IAAI,0BAAc,CAAC;QACxC,QAAQ,EAAE,QAAQ;KACnB,CAAC,CAAC;IAGH,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;IAErC,OAAO,cAAc,CAAC;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C,CAAC,CAAC;IACrD,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;IAC7B,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;IAG7B,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IAC/B,OAAO,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC;IAC5C,OAAO,CAAC,GAAG,CAAC,uCAAuC,CAAC,CAAC;IACrD,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAC9B,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAC9B,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;AAChC,CAAC;AA1CD,kDA0CC;AAKD,SAAgB,0BAA0B,CAAC,KAAgB;IAEzD,OAAO,CAAC,GAAG,CAAC,4CAA4C,CAAC,CAAC;IAG1D,KAAK,CAAC,eAAe,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;IAClC,KAAK,CAAC,eAAe,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;IAClC,KAAK,CAAC,eAAe,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;IAGlC,MAAM,cAAc,GAAG,IAAA,gCAAoB,EAAC,KAAK,CAAC,CAAC;IACnD,cAAc,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC;IAE7C,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC;IACxC,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;AAChD,CAAC;AAfD,gEAeC","file":"formula-integration.test.js","sourcesContent":["/**\n * Test file for formula-aware auto-fill functionality\n * This demonstrates the integration between auto-fill plugin and vtable-sheet formula system\n */\n\nimport { AutoFillPlugin, createFormulaAdapter } from '../src/auto-fill';\nimport type { ListTable } from '@visactor/vtable';\n\n/**\n * Example: Setting up auto-fill with formula support\n */\nexport function setupAutoFillWithFormulas(table: ListTable, formulaManager?: any) {\n // Create auto-fill plugin with formula support\n const autoFillPlugin = new AutoFillPlugin({\n fillMode: 'series' // Enable series fill for formula adjustment\n });\n\n // The plugin will automatically detect and integrate with formula system\n table.registerPlugin(autoFillPlugin);\n\n return autoFillPlugin;\n}\n\n/**\n * Example: Manual formula adapter usage\n */\nexport function demonstrateFormulaAdapter(table: ListTable, formulaManager?: any) {\n // Create formula adapter\n const formulaAdapter = createFormulaAdapter(table, formulaManager);\n\n // Check if cell contains formula\n const hasFormula = formulaAdapter.isFormulaCell(0, 0);\n console.log('Cell A1 has formula:', hasFormula);\n\n // Get formula from cell\n const formula = formulaAdapter.getCellFormula(0, 0);\n console.log('Formula in A1:', formula);\n\n // Set formula in cell\n formulaAdapter.setCellFormula(1, 0, '=A1+1');\n\n // Get calculated value\n const value = formulaAdapter.getCalculatedValue(1, 0);\n console.log('Calculated value:', value);\n}\n\n/**\n * Example: Formula auto-fill scenarios\n */\nexport const formulaAutoFillExamples = {\n /**\n * Simple formula series: =A1, =A2, =A3, ...\n */\n simpleSeries: [\n { cell: 'A1', formula: '=B1' },\n { cell: 'A2', formula: '=B2' }\n ],\n\n /**\n * Complex formula with mixed references: =$A$1+B1, =$A$1+B2, =$A$1+B3, ...\n */\n mixedReferences: [\n { cell: 'C1', formula: '=$A$1+B1' },\n { cell: 'C2', formula: '=$A$1+B2' }\n ],\n\n /**\n * Mathematical series: =A1+1, =A2+2, =A3+3, ...\n */\n mathematicalSeries: [\n { cell: 'D1', formula: '=A1+1' },\n { cell: 'D2', formula: '=A2+2' }\n ],\n\n /**\n * Function-based formulas: =SUM(A1:B1), =SUM(A2:B2), ...\n */\n functionSeries: [\n { cell: 'E1', formula: '=SUM(A1:B1)' },\n { cell: 'E2', formula: '=SUM(A2:B2)' }\n ]\n};\n\n/**\n * Test function to verify formula auto-fill behavior\n */\nexport function testFormulaAutoFill() {\n console.log('Formula Auto-Fill Test Cases:');\n console.log('============================');\n\n // Test case 1: Simple relative reference\n console.log('\\n1. Simple Relative Reference:');\n console.log('Source: A1 contains \"=B1\"');\n console.log('Auto-fill down 3 rows should produce:');\n console.log(' A2: \"=B2\"');\n console.log(' A3: \"=B3\"');\n console.log(' A4: \"=B4\"');\n\n // Test case 2: Absolute reference\n console.log('\\n2. Absolute Reference:');\n console.log('Source: A1 contains \"=$B$1\"');\n console.log('Auto-fill down 3 rows should produce:');\n console.log(' A2: \"=$B$1\"');\n console.log(' A3: \"=$B$1\"');\n console.log(' A4: \"=$B$1\"');\n\n // Test case 3: Mixed reference\n console.log('\\n3. Mixed Reference:');\n console.log('Source: A1 contains \"=$B1\"');\n console.log('Auto-fill down 3 rows should produce:');\n console.log(' A2: \"=$B2\"');\n console.log(' A3: \"=$B3\"');\n console.log(' A4: \"=$B4\"');\n\n // Test case 4: Series pattern detection\n console.log('\\n4. Series Pattern Detection:');\n console.log('Source: A1 contains \"=B1+1\", A2 contains \"=B2+2\"');\n console.log('Auto-fill down 2 rows should produce:');\n console.log(' A3: \"=B3+3\"');\n console.log(' A4: \"=B4+4\"');\n\n // Test case 5: Copy mode\n console.log('\\n5. Copy Mode:');\n console.log('Source: A1 contains \"=B1+C1\"');\n console.log('Copy fill down 3 rows should produce:');\n console.log(' A2: \"=B1+C1\"');\n console.log(' A3: \"=B1+C1\"');\n console.log(' A4: \"=B1+C1\"');\n}\n\n/**\n * Integration test for vtable-sheet\n */\nexport function testVTableSheetIntegration(table: ListTable) {\n // This would be used in actual vtable-sheet environment\n console.log('Testing VTableSheet Formula Integration...');\n\n // Set up some test data\n table.changeCellValue(1, 0, '10'); // B1 = 10\n table.changeCellValue(1, 1, '20'); // B2 = 20\n table.changeCellValue(1, 2, '30'); // B3 = 30\n\n // Set up formula\n const formulaAdapter = createFormulaAdapter(table);\n formulaAdapter.setCellFormula(0, 0, '=B1*2'); // A1 = B1 * 2\n\n console.log('Test data setup complete');\n console.log('Ready for auto-fill testing...');\n}\n"]}
@@ -1,23 +0,0 @@
1
- import type { ListTable } from '@visactor/vtable';
2
- export declare function setupAutoFillWithFormulas(table: ListTable, formulaManager?: any): any;
3
- export declare function demonstrateFormulaAdapter(table: ListTable, formulaManager?: any): void;
4
- export declare const formulaAutoFillExamples: {
5
- simpleSeries: {
6
- cell: string;
7
- formula: string;
8
- }[];
9
- mixedReferences: {
10
- cell: string;
11
- formula: string;
12
- }[];
13
- mathematicalSeries: {
14
- cell: string;
15
- formula: string;
16
- }[];
17
- functionSeries: {
18
- cell: string;
19
- formula: string;
20
- }[];
21
- };
22
- export declare function testFormulaAutoFill(): void;
23
- export declare function testVTableSheetIntegration(table: ListTable): void;
@@ -1,54 +0,0 @@
1
- import { AutoFillPlugin, createFormulaAdapter } from "../src/auto-fill";
2
-
3
- export function setupAutoFillWithFormulas(table, formulaManager) {
4
- const autoFillPlugin = new AutoFillPlugin({
5
- fillMode: "series"
6
- });
7
- return table.registerPlugin(autoFillPlugin), autoFillPlugin;
8
- }
9
-
10
- export function demonstrateFormulaAdapter(table, formulaManager) {
11
- const formulaAdapter = createFormulaAdapter(table, formulaManager);
12
- formulaAdapter.isFormulaCell(0, 0), formulaAdapter.getCellFormula(0, 0);
13
- formulaAdapter.setCellFormula(1, 0, "=A1+1");
14
- formulaAdapter.getCalculatedValue(1, 0);
15
- }
16
-
17
- export const formulaAutoFillExamples = {
18
- simpleSeries: [ {
19
- cell: "A1",
20
- formula: "=B1"
21
- }, {
22
- cell: "A2",
23
- formula: "=B2"
24
- } ],
25
- mixedReferences: [ {
26
- cell: "C1",
27
- formula: "=$A$1+B1"
28
- }, {
29
- cell: "C2",
30
- formula: "=$A$1+B2"
31
- } ],
32
- mathematicalSeries: [ {
33
- cell: "D1",
34
- formula: "=A1+1"
35
- }, {
36
- cell: "D2",
37
- formula: "=A2+2"
38
- } ],
39
- functionSeries: [ {
40
- cell: "E1",
41
- formula: "=SUM(A1:B1)"
42
- }, {
43
- cell: "E2",
44
- formula: "=SUM(A2:B2)"
45
- } ]
46
- };
47
-
48
- export function testFormulaAutoFill() {}
49
-
50
- export function testVTableSheetIntegration(table) {
51
- table.changeCellValue(1, 0, "10"), table.changeCellValue(1, 1, "20"), table.changeCellValue(1, 2, "30");
52
- createFormulaAdapter(table).setCellFormula(0, 0, "=B1*2");
53
- }
54
- //# sourceMappingURL=formula-integration.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/auto-fill/__tests__/formula-integration.test.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAMxE,MAAM,UAAU,yBAAyB,CAAC,KAAgB,EAAE,cAAoB;IAE9E,MAAM,cAAc,GAAG,IAAI,cAAc,CAAC;QACxC,QAAQ,EAAE,QAAQ;KACnB,CAAC,CAAC;IAGH,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;IAErC,OAAO,cAAc,CAAC;AACxB,CAAC;AAKD,MAAM,UAAU,yBAAyB,CAAC,KAAgB,EAAE,cAAoB;IAE9E,MAAM,cAAc,GAAG,oBAAoB,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;IAGnE,MAAM,UAAU,GAAG,cAAc,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACtD,OAAO,CAAC,GAAG,CAAC,sBAAsB,EAAE,UAAU,CAAC,CAAC;IAGhD,MAAM,OAAO,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACpD,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;IAGvC,cAAc,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC;IAG7C,MAAM,KAAK,GAAG,cAAc,CAAC,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACtD,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,KAAK,CAAC,CAAC;AAC1C,CAAC;AAKD,MAAM,CAAC,MAAM,uBAAuB,GAAG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CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;IAGlC,MAAM,cAAc,GAAG,oBAAoB,CAAC,KAAK,CAAC,CAAC;IACnD,cAAc,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC;IAE7C,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC;IACxC,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;AAChD,CAAC","file":"formula-integration.test.js","sourcesContent":["/**\n * Test file for formula-aware auto-fill functionality\n * This demonstrates the integration between auto-fill plugin and vtable-sheet formula system\n */\n\nimport { AutoFillPlugin, createFormulaAdapter } from '../src/auto-fill';\nimport type { ListTable } from '@visactor/vtable';\n\n/**\n * Example: Setting up auto-fill with formula support\n */\nexport function setupAutoFillWithFormulas(table: ListTable, formulaManager?: any) {\n // Create auto-fill plugin with formula support\n const autoFillPlugin = new AutoFillPlugin({\n fillMode: 'series' // Enable series fill for formula adjustment\n });\n\n // The plugin will automatically detect and integrate with formula system\n table.registerPlugin(autoFillPlugin);\n\n return autoFillPlugin;\n}\n\n/**\n * Example: Manual formula adapter usage\n */\nexport function demonstrateFormulaAdapter(table: ListTable, formulaManager?: any) {\n // Create formula adapter\n const formulaAdapter = createFormulaAdapter(table, formulaManager);\n\n // Check if cell contains formula\n const hasFormula = formulaAdapter.isFormulaCell(0, 0);\n console.log('Cell A1 has formula:', hasFormula);\n\n // Get formula from cell\n const formula = formulaAdapter.getCellFormula(0, 0);\n console.log('Formula in A1:', formula);\n\n // Set formula in cell\n formulaAdapter.setCellFormula(1, 0, '=A1+1');\n\n // Get calculated value\n const value = formulaAdapter.getCalculatedValue(1, 0);\n console.log('Calculated value:', value);\n}\n\n/**\n * Example: Formula auto-fill scenarios\n */\nexport const formulaAutoFillExamples = {\n /**\n * Simple formula series: =A1, =A2, =A3, ...\n */\n simpleSeries: [\n { cell: 'A1', formula: '=B1' },\n { cell: 'A2', formula: '=B2' }\n ],\n\n /**\n * Complex formula with mixed references: =$A$1+B1, =$A$1+B2, =$A$1+B3, ...\n */\n mixedReferences: [\n { cell: 'C1', formula: '=$A$1+B1' },\n { cell: 'C2', formula: '=$A$1+B2' }\n ],\n\n /**\n * Mathematical series: =A1+1, =A2+2, =A3+3, ...\n */\n mathematicalSeries: [\n { cell: 'D1', formula: '=A1+1' },\n { cell: 'D2', formula: '=A2+2' }\n ],\n\n /**\n * Function-based formulas: =SUM(A1:B1), =SUM(A2:B2), ...\n */\n functionSeries: [\n { cell: 'E1', formula: '=SUM(A1:B1)' },\n { cell: 'E2', formula: '=SUM(A2:B2)' }\n ]\n};\n\n/**\n * Test function to verify formula auto-fill behavior\n */\nexport function testFormulaAutoFill() {\n console.log('Formula Auto-Fill Test Cases:');\n console.log('============================');\n\n // Test case 1: Simple relative reference\n console.log('\\n1. Simple Relative Reference:');\n console.log('Source: A1 contains \"=B1\"');\n console.log('Auto-fill down 3 rows should produce:');\n console.log(' A2: \"=B2\"');\n console.log(' A3: \"=B3\"');\n console.log(' A4: \"=B4\"');\n\n // Test case 2: Absolute reference\n console.log('\\n2. Absolute Reference:');\n console.log('Source: A1 contains \"=$B$1\"');\n console.log('Auto-fill down 3 rows should produce:');\n console.log(' A2: \"=$B$1\"');\n console.log(' A3: \"=$B$1\"');\n console.log(' A4: \"=$B$1\"');\n\n // Test case 3: Mixed reference\n console.log('\\n3. Mixed Reference:');\n console.log('Source: A1 contains \"=$B1\"');\n console.log('Auto-fill down 3 rows should produce:');\n console.log(' A2: \"=$B2\"');\n console.log(' A3: \"=$B3\"');\n console.log(' A4: \"=$B4\"');\n\n // Test case 4: Series pattern detection\n console.log('\\n4. Series Pattern Detection:');\n console.log('Source: A1 contains \"=B1+1\", A2 contains \"=B2+2\"');\n console.log('Auto-fill down 2 rows should produce:');\n console.log(' A3: \"=B3+3\"');\n console.log(' A4: \"=B4+4\"');\n\n // Test case 5: Copy mode\n console.log('\\n5. Copy Mode:');\n console.log('Source: A1 contains \"=B1+C1\"');\n console.log('Copy fill down 3 rows should produce:');\n console.log(' A2: \"=B1+C1\"');\n console.log(' A3: \"=B1+C1\"');\n console.log(' A4: \"=B1+C1\"');\n}\n\n/**\n * Integration test for vtable-sheet\n */\nexport function testVTableSheetIntegration(table: ListTable) {\n // This would be used in actual vtable-sheet environment\n console.log('Testing VTableSheet Formula Integration...');\n\n // Set up some test data\n table.changeCellValue(1, 0, '10'); // B1 = 10\n table.changeCellValue(1, 1, '20'); // B2 = 20\n table.changeCellValue(1, 2, '30'); // B3 = 30\n\n // Set up formula\n const formulaAdapter = createFormulaAdapter(table);\n formulaAdapter.setCellFormula(0, 0, '=B1*2'); // A1 = B1 * 2\n\n console.log('Test data setup complete');\n console.log('Ready for auto-fill testing...');\n}\n"]}