@visactor/vtable-sheet 1.22.0 → 1.22.2
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.
- package/cjs/components/vtable-sheet.d.ts +2 -2
- package/cjs/components/vtable-sheet.js +28 -2
- package/cjs/components/vtable-sheet.js.map +1 -1
- package/cjs/core/WorkSheet.d.ts +3 -0
- package/cjs/core/WorkSheet.js +22 -3
- package/cjs/core/WorkSheet.js.map +1 -1
- package/cjs/core/table-plugins.js +1 -2
- package/cjs/core/table-plugins.js.map +1 -1
- package/cjs/formula/formula-engine.d.ts +12 -1
- package/cjs/formula/formula-engine.js +281 -28
- package/cjs/formula/formula-engine.js.map +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/managers/formula-manager.d.ts +2 -0
- package/cjs/managers/formula-manager.js +29 -0
- package/cjs/managers/formula-manager.js.map +1 -1
- package/cjs/ts-types/index.d.ts +2 -2
- package/cjs/ts-types/index.js.map +1 -1
- package/dist/vtable-sheet.js +771 -158
- package/dist/vtable-sheet.min.js +1 -1
- package/es/components/vtable-sheet.d.ts +2 -2
- package/es/components/vtable-sheet.js +29 -3
- package/es/components/vtable-sheet.js.map +1 -1
- package/es/core/WorkSheet.d.ts +3 -0
- package/es/core/WorkSheet.js +22 -3
- package/es/core/WorkSheet.js.map +1 -1
- package/es/core/table-plugins.js +1 -2
- package/es/core/table-plugins.js.map +1 -1
- package/es/formula/formula-engine.d.ts +12 -1
- package/es/formula/formula-engine.js +281 -28
- package/es/formula/formula-engine.js.map +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/managers/formula-manager.d.ts +2 -0
- package/es/managers/formula-manager.js +29 -0
- package/es/managers/formula-manager.js.map +1 -1
- package/es/ts-types/index.d.ts +2 -2
- package/es/ts-types/index.js.map +1 -1
- package/package.json +6 -6
package/dist/vtable-sheet.js
CHANGED
|
@@ -268,8 +268,10 @@
|
|
|
268
268
|
sheet[cell.row][cell.col] = processedValue;
|
|
269
269
|
if (typeof processedValue === 'string' && processedValue.startsWith('=')) {
|
|
270
270
|
const cellKey = this.getCellKey(cell);
|
|
271
|
-
this.
|
|
272
|
-
this.
|
|
271
|
+
const correctedFormula = this.correctFormulaCase(processedValue);
|
|
272
|
+
this.formulaCells.set(cellKey, correctedFormula);
|
|
273
|
+
this.updateDependencies(cellKey, correctedFormula);
|
|
274
|
+
sheet[cell.row][cell.col] = correctedFormula;
|
|
273
275
|
}
|
|
274
276
|
this.recalculateDependents(cell);
|
|
275
277
|
}
|
|
@@ -317,7 +319,8 @@
|
|
|
317
319
|
if (!formula.startsWith('=')) {
|
|
318
320
|
return { value: formula, error: undefined };
|
|
319
321
|
}
|
|
320
|
-
const
|
|
322
|
+
const correctedFormula = this.correctFormulaCase(formula);
|
|
323
|
+
const expression = correctedFormula.substring(1).trim();
|
|
321
324
|
if (expression.includes('#REF!')) {
|
|
322
325
|
return { value: '#REF!', error: undefined };
|
|
323
326
|
}
|
|
@@ -331,6 +334,112 @@
|
|
|
331
334
|
};
|
|
332
335
|
}
|
|
333
336
|
}
|
|
337
|
+
correctFormulaCase(formula) {
|
|
338
|
+
if (!formula.startsWith('=')) {
|
|
339
|
+
return formula;
|
|
340
|
+
}
|
|
341
|
+
let corrected = '=';
|
|
342
|
+
const expression = formula.substring(1);
|
|
343
|
+
let inQuotes = false;
|
|
344
|
+
let quoteChar = '';
|
|
345
|
+
let i = 0;
|
|
346
|
+
while (i < expression.length) {
|
|
347
|
+
const char = expression[i];
|
|
348
|
+
if ((char === '"' || char === "'") && (i === 0 || expression[i - 1] !== '\\')) {
|
|
349
|
+
if (!inQuotes) {
|
|
350
|
+
inQuotes = true;
|
|
351
|
+
quoteChar = char;
|
|
352
|
+
}
|
|
353
|
+
else if (char === quoteChar) {
|
|
354
|
+
inQuotes = false;
|
|
355
|
+
quoteChar = '';
|
|
356
|
+
}
|
|
357
|
+
corrected += char;
|
|
358
|
+
i++;
|
|
359
|
+
continue;
|
|
360
|
+
}
|
|
361
|
+
if (inQuotes) {
|
|
362
|
+
corrected += char;
|
|
363
|
+
i++;
|
|
364
|
+
continue;
|
|
365
|
+
}
|
|
366
|
+
const funcMatch = expression.substring(i).match(/^[A-Za-z][A-Za-z0-9]*\s*\(/);
|
|
367
|
+
if (funcMatch) {
|
|
368
|
+
const funcName = funcMatch[0].replace(/\s*\($/, '');
|
|
369
|
+
corrected += funcName.toUpperCase() + '(';
|
|
370
|
+
i += funcName.length + 1;
|
|
371
|
+
while (i < expression.length && expression[i] === ' ') {
|
|
372
|
+
i++;
|
|
373
|
+
}
|
|
374
|
+
continue;
|
|
375
|
+
}
|
|
376
|
+
const sheetCellMatch = expression.substring(i).match(/^[A-Za-z0-9_]+![A-Za-z]+[0-9]+/);
|
|
377
|
+
if (sheetCellMatch) {
|
|
378
|
+
const fullRef = sheetCellMatch[0];
|
|
379
|
+
const [sheetName, cellRef] = fullRef.split('!');
|
|
380
|
+
const originalSheetName = this.findOriginalSheetName(sheetName);
|
|
381
|
+
const letters = cellRef.replace(/[0-9]/g, '');
|
|
382
|
+
const numbers = cellRef.replace(/[A-Za-z]/g, '');
|
|
383
|
+
corrected += (originalSheetName || sheetName) + '!' + letters.toUpperCase() + numbers;
|
|
384
|
+
i += fullRef.length;
|
|
385
|
+
continue;
|
|
386
|
+
}
|
|
387
|
+
const sheetRangeMatch = expression.substring(i).match(/^[A-Za-z0-9_]+![A-Za-z]+[0-9]+:[A-Za-z]+[0-9]+/);
|
|
388
|
+
if (sheetRangeMatch) {
|
|
389
|
+
const fullRangeRef = sheetRangeMatch[0];
|
|
390
|
+
const [sheetPart, rangePart] = fullRangeRef.split('!');
|
|
391
|
+
const [startCell, endCell] = rangePart.split(':');
|
|
392
|
+
const originalSheetName = this.findOriginalSheetName(sheetPart);
|
|
393
|
+
const startLetters = startCell.replace(/[0-9]/g, '');
|
|
394
|
+
const startNumbers = startCell.replace(/[A-Za-z]/g, '');
|
|
395
|
+
const newStartCell = startLetters.toUpperCase() + startNumbers;
|
|
396
|
+
const endLetters = endCell.replace(/[0-9]/g, '');
|
|
397
|
+
const endNumbers = endCell.replace(/[A-Za-z]/g, '');
|
|
398
|
+
const newEndCell = endLetters.toUpperCase() + endNumbers;
|
|
399
|
+
corrected += (originalSheetName || sheetPart) + '!' + newStartCell + ':' + newEndCell;
|
|
400
|
+
i += fullRangeRef.length;
|
|
401
|
+
continue;
|
|
402
|
+
}
|
|
403
|
+
const cellMatch = expression.substring(i).match(/^[A-Za-z]+[0-9]+/);
|
|
404
|
+
if (cellMatch) {
|
|
405
|
+
const cellRef = cellMatch[0];
|
|
406
|
+
const letters = cellRef.replace(/[0-9]/g, '');
|
|
407
|
+
const numbers = cellRef.replace(/[A-Za-z]/g, '');
|
|
408
|
+
corrected += letters.toUpperCase() + numbers;
|
|
409
|
+
i += cellRef.length;
|
|
410
|
+
continue;
|
|
411
|
+
}
|
|
412
|
+
const rangeMatch = expression.substring(i).match(/^[A-Za-z]+[0-9]+:[A-Za-z]+[0-9]+/);
|
|
413
|
+
if (rangeMatch) {
|
|
414
|
+
const rangeRef = rangeMatch[0];
|
|
415
|
+
const [startCell, endCell] = rangeRef.split(':');
|
|
416
|
+
const startLetters = startCell.replace(/[0-9]/g, '');
|
|
417
|
+
const startNumbers = startCell.replace(/[A-Za-z]/g, '');
|
|
418
|
+
const newStartCell = startLetters.toUpperCase() + startNumbers;
|
|
419
|
+
const endLetters = endCell.replace(/[0-9]/g, '');
|
|
420
|
+
const endNumbers = endCell.replace(/[A-Za-z]/g, '');
|
|
421
|
+
const newEndCell = endLetters.toUpperCase() + endNumbers;
|
|
422
|
+
corrected += newStartCell + ':' + newEndCell;
|
|
423
|
+
i += rangeRef.length;
|
|
424
|
+
continue;
|
|
425
|
+
}
|
|
426
|
+
corrected += char;
|
|
427
|
+
i++;
|
|
428
|
+
}
|
|
429
|
+
return corrected;
|
|
430
|
+
}
|
|
431
|
+
findOriginalSheetName(sheetName) {
|
|
432
|
+
if (this.sheets.has(sheetName)) {
|
|
433
|
+
return sheetName;
|
|
434
|
+
}
|
|
435
|
+
const lowerSheetName = sheetName.toLowerCase();
|
|
436
|
+
for (const [existingSheetName] of this.sheets.entries()) {
|
|
437
|
+
if (existingSheetName.toLowerCase() === lowerSheetName) {
|
|
438
|
+
return existingSheetName;
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
return null;
|
|
442
|
+
}
|
|
334
443
|
parseExpression(expr) {
|
|
335
444
|
expr = expr.trim();
|
|
336
445
|
const functionResult = this.tryParseFunction(expr);
|
|
@@ -895,24 +1004,6 @@
|
|
|
895
1004
|
return { value: null, error: 'Basic arithmetic evaluation failed' };
|
|
896
1005
|
}
|
|
897
1006
|
}
|
|
898
|
-
evaluateBasicArithmetic(expr) {
|
|
899
|
-
try {
|
|
900
|
-
if (/[A-Z]+\s*\(/.test(expr)) {
|
|
901
|
-
return { value: null, error: 'Expression contains function calls' };
|
|
902
|
-
}
|
|
903
|
-
let processedExpr = expr;
|
|
904
|
-
const cellRefs = processedExpr.match(/[A-Z]+[0-9]+/g) || [];
|
|
905
|
-
for (const cellRef of cellRefs) {
|
|
906
|
-
const value = this.getCellValueByA1(cellRef);
|
|
907
|
-
processedExpr = processedExpr.replace(cellRef, String(value));
|
|
908
|
-
}
|
|
909
|
-
const result = Function('"use strict"; return (' + processedExpr + ')')();
|
|
910
|
-
return { value: result, error: undefined };
|
|
911
|
-
}
|
|
912
|
-
catch (error) {
|
|
913
|
-
return { value: null, error: 'Basic arithmetic evaluation failed' };
|
|
914
|
-
}
|
|
915
|
-
}
|
|
916
1007
|
getCellValueByA1(a1Notation) {
|
|
917
1008
|
try {
|
|
918
1009
|
let sheetKey = this.activeSheetKey || this.reverseSheets.get(0) || 'Sheet1';
|
|
@@ -1488,7 +1579,8 @@
|
|
|
1488
1579
|
}
|
|
1489
1580
|
}
|
|
1490
1581
|
}
|
|
1491
|
-
|
|
1582
|
+
const entries = Array.from(this.formulaCells.entries());
|
|
1583
|
+
for (const [cellKey, formula] of entries) {
|
|
1492
1584
|
const cell = this.parseCellKey(cellKey);
|
|
1493
1585
|
if (!cell || cell.sheet !== sheetKey) {
|
|
1494
1586
|
continue;
|
|
@@ -1715,8 +1807,12 @@
|
|
|
1715
1807
|
if (dimension === 'row') {
|
|
1716
1808
|
const deleteStartRow = index;
|
|
1717
1809
|
const deleteEndRow = index + count - 1;
|
|
1810
|
+
const entireRangeDeleted = minRow >= deleteStartRow && maxRow <= deleteEndRow;
|
|
1811
|
+
if (entireRangeDeleted) {
|
|
1812
|
+
return '#REF!';
|
|
1813
|
+
}
|
|
1718
1814
|
if (minRow >= deleteStartRow && minRow <= deleteEndRow) {
|
|
1719
|
-
newMinRow = deleteStartRow
|
|
1815
|
+
newMinRow = deleteStartRow;
|
|
1720
1816
|
}
|
|
1721
1817
|
else if (minRow > deleteEndRow) {
|
|
1722
1818
|
newMinRow = minRow - count;
|
|
@@ -1740,6 +1836,10 @@
|
|
|
1740
1836
|
else if (dimension === 'column') {
|
|
1741
1837
|
const deleteStartCol = index;
|
|
1742
1838
|
const deleteEndCol = index + count - 1;
|
|
1839
|
+
const entireRangeDeleted = minCol >= deleteStartCol && maxCol <= deleteEndCol;
|
|
1840
|
+
if (entireRangeDeleted) {
|
|
1841
|
+
return '#REF!';
|
|
1842
|
+
}
|
|
1743
1843
|
if (minCol >= deleteStartCol && minCol <= deleteEndCol) {
|
|
1744
1844
|
newMinCol = deleteStartCol > 0 ? deleteStartCol - 1 : 0;
|
|
1745
1845
|
}
|
|
@@ -1808,6 +1908,308 @@
|
|
|
1808
1908
|
return '#REF!';
|
|
1809
1909
|
}
|
|
1810
1910
|
}
|
|
1911
|
+
adjustFormulaReferencesForColumnMove(sheetKey, sourceCol, targetCol, totalColCount, totalRowCount) {
|
|
1912
|
+
try {
|
|
1913
|
+
const adjustedFormulas = [];
|
|
1914
|
+
const movedFormulas = [];
|
|
1915
|
+
const isMovingForward = targetCol > sourceCol;
|
|
1916
|
+
const columnMapping = new Map();
|
|
1917
|
+
if (isMovingForward) {
|
|
1918
|
+
for (let col = sourceCol + 1; col <= targetCol; col++) {
|
|
1919
|
+
columnMapping.set(col, col - 1);
|
|
1920
|
+
}
|
|
1921
|
+
columnMapping.set(sourceCol, targetCol);
|
|
1922
|
+
}
|
|
1923
|
+
else {
|
|
1924
|
+
for (let col = targetCol; col < sourceCol; col++) {
|
|
1925
|
+
columnMapping.set(col, col + 1);
|
|
1926
|
+
}
|
|
1927
|
+
columnMapping.set(sourceCol, targetCol);
|
|
1928
|
+
}
|
|
1929
|
+
for (const [cellKey, formula] of Array.from(this.formulaCells.entries())) {
|
|
1930
|
+
const cell = this.parseCellKey(cellKey);
|
|
1931
|
+
if (!cell || cell.sheet !== sheetKey) {
|
|
1932
|
+
continue;
|
|
1933
|
+
}
|
|
1934
|
+
let needsCellMove = false;
|
|
1935
|
+
const newCellLocation = { ...cell };
|
|
1936
|
+
if (columnMapping.has(cell.col)) {
|
|
1937
|
+
const mappedCol = columnMapping.get(cell.col);
|
|
1938
|
+
if (mappedCol !== undefined) {
|
|
1939
|
+
newCellLocation.col = mappedCol;
|
|
1940
|
+
needsCellMove = true;
|
|
1941
|
+
}
|
|
1942
|
+
}
|
|
1943
|
+
const newFormula = this.adjustFormulaWithColumnMapping(formula, columnMapping);
|
|
1944
|
+
if (needsCellMove || newFormula !== formula) {
|
|
1945
|
+
if (needsCellMove) {
|
|
1946
|
+
movedFormulas.push({
|
|
1947
|
+
oldCellKey: cellKey,
|
|
1948
|
+
newCell: newCellLocation,
|
|
1949
|
+
formula: newFormula
|
|
1950
|
+
});
|
|
1951
|
+
this.formulaCells.delete(cellKey);
|
|
1952
|
+
this.clearDependencies(cellKey);
|
|
1953
|
+
}
|
|
1954
|
+
else {
|
|
1955
|
+
adjustedFormulas.push({ cell, oldFormula: formula, newFormula });
|
|
1956
|
+
this.clearDependencies(cellKey);
|
|
1957
|
+
}
|
|
1958
|
+
}
|
|
1959
|
+
}
|
|
1960
|
+
for (const { newCell, formula } of movedFormulas) {
|
|
1961
|
+
const newCellKey = this.getCellKey(newCell);
|
|
1962
|
+
this.formulaCells.set(newCellKey, formula);
|
|
1963
|
+
this.updateDependencies(newCellKey, formula);
|
|
1964
|
+
this.setCellContentWithoutDependencyUpdate(newCell, formula);
|
|
1965
|
+
}
|
|
1966
|
+
for (const { cell, newFormula } of adjustedFormulas) {
|
|
1967
|
+
const cellKey = this.getCellKey(cell);
|
|
1968
|
+
this.formulaCells.set(cellKey, newFormula);
|
|
1969
|
+
this.updateDependencies(cellKey, newFormula);
|
|
1970
|
+
this.setCellContentWithoutDependencyUpdate(cell, newFormula);
|
|
1971
|
+
}
|
|
1972
|
+
const adjustedCells = adjustedFormulas.map(item => item.cell);
|
|
1973
|
+
const movedCells = movedFormulas.map(item => item.newCell);
|
|
1974
|
+
return { adjustedCells, movedCells };
|
|
1975
|
+
}
|
|
1976
|
+
catch (error) {
|
|
1977
|
+
return { adjustedCells: [], movedCells: [] };
|
|
1978
|
+
}
|
|
1979
|
+
}
|
|
1980
|
+
adjustFormulaWithColumnMapping(formula, columnMapping) {
|
|
1981
|
+
if (!formula || !formula.startsWith('=')) {
|
|
1982
|
+
return formula;
|
|
1983
|
+
}
|
|
1984
|
+
let expression = formula.substring(1);
|
|
1985
|
+
const rangeRegex = /([A-Z]+)([0-9]+):([A-Z]+)([0-9]+)/g;
|
|
1986
|
+
let match;
|
|
1987
|
+
const rangeReplacements = [];
|
|
1988
|
+
const processedRanges = [];
|
|
1989
|
+
while ((match = rangeRegex.exec(expression)) !== null) {
|
|
1990
|
+
const fullMatch = match[0];
|
|
1991
|
+
const startCol = match[1];
|
|
1992
|
+
const startRow = match[2];
|
|
1993
|
+
const endCol = match[3];
|
|
1994
|
+
const endRow = match[4];
|
|
1995
|
+
const startColIndex = this.columnLettersToIndex(startCol);
|
|
1996
|
+
const endColIndex = this.columnLettersToIndex(endCol);
|
|
1997
|
+
let newStartCol = startColIndex;
|
|
1998
|
+
let newEndCol = endColIndex;
|
|
1999
|
+
if (columnMapping.has(startColIndex)) {
|
|
2000
|
+
const mappedStartCol = columnMapping.get(startColIndex);
|
|
2001
|
+
if (mappedStartCol !== undefined) {
|
|
2002
|
+
newStartCol = mappedStartCol;
|
|
2003
|
+
}
|
|
2004
|
+
}
|
|
2005
|
+
if (columnMapping.has(endColIndex)) {
|
|
2006
|
+
const mappedEndCol = columnMapping.get(endColIndex);
|
|
2007
|
+
if (mappedEndCol !== undefined) {
|
|
2008
|
+
newEndCol = mappedEndCol;
|
|
2009
|
+
}
|
|
2010
|
+
}
|
|
2011
|
+
if (newStartCol > newEndCol) {
|
|
2012
|
+
[newStartCol, newEndCol] = [newEndCol, newStartCol];
|
|
2013
|
+
}
|
|
2014
|
+
const newStartColLetters = this.indexToColumnLetters(newStartCol);
|
|
2015
|
+
const newEndColLetters = this.indexToColumnLetters(newEndCol);
|
|
2016
|
+
const replacement = `${newStartColLetters}${startRow}:${newEndColLetters}${endRow}`;
|
|
2017
|
+
rangeReplacements.push({
|
|
2018
|
+
start: match.index,
|
|
2019
|
+
end: match.index + fullMatch.length,
|
|
2020
|
+
replacement
|
|
2021
|
+
});
|
|
2022
|
+
processedRanges.push({ start: match.index, end: match.index + fullMatch.length });
|
|
2023
|
+
}
|
|
2024
|
+
for (let i = rangeReplacements.length - 1; i >= 0; i--) {
|
|
2025
|
+
const { start, end, replacement } = rangeReplacements[i];
|
|
2026
|
+
expression = expression.substring(0, start) + replacement + expression.substring(end);
|
|
2027
|
+
}
|
|
2028
|
+
const cellRegex = /([A-Z]+)([0-9]+)/g;
|
|
2029
|
+
const cellReplacements = [];
|
|
2030
|
+
while ((match = cellRegex.exec(expression)) !== null) {
|
|
2031
|
+
const fullMatch = match[0];
|
|
2032
|
+
const colLetters = match[1];
|
|
2033
|
+
const row = match[2];
|
|
2034
|
+
const colIndex = this.columnLettersToIndex(colLetters);
|
|
2035
|
+
const matchIndex = match.index;
|
|
2036
|
+
const isInProcessedRange = processedRanges.some(range => {
|
|
2037
|
+
return matchIndex >= range.start && matchIndex < range.end;
|
|
2038
|
+
});
|
|
2039
|
+
if (isInProcessedRange) {
|
|
2040
|
+
continue;
|
|
2041
|
+
}
|
|
2042
|
+
if (columnMapping.has(colIndex)) {
|
|
2043
|
+
const newColIndex = columnMapping.get(colIndex);
|
|
2044
|
+
if (newColIndex !== undefined) {
|
|
2045
|
+
const newColLetters = this.indexToColumnLetters(newColIndex);
|
|
2046
|
+
const replacement = `${newColLetters}${row}`;
|
|
2047
|
+
cellReplacements.push({
|
|
2048
|
+
start: match.index,
|
|
2049
|
+
end: match.index + fullMatch.length,
|
|
2050
|
+
replacement
|
|
2051
|
+
});
|
|
2052
|
+
}
|
|
2053
|
+
}
|
|
2054
|
+
}
|
|
2055
|
+
for (let i = cellReplacements.length - 1; i >= 0; i--) {
|
|
2056
|
+
const { start, end, replacement } = cellReplacements[i];
|
|
2057
|
+
expression = expression.substring(0, start) + replacement + expression.substring(end);
|
|
2058
|
+
}
|
|
2059
|
+
return '=' + expression;
|
|
2060
|
+
}
|
|
2061
|
+
adjustFormulaReferencesForRowMove(sheetKey, sourceRow, targetRow) {
|
|
2062
|
+
try {
|
|
2063
|
+
if (sourceRow < 0 || targetRow < 0) {
|
|
2064
|
+
return { adjustedCells: [], movedCells: [] };
|
|
2065
|
+
}
|
|
2066
|
+
const adjustedFormulas = [];
|
|
2067
|
+
const movedFormulas = [];
|
|
2068
|
+
const isMovingForward = targetRow > sourceRow;
|
|
2069
|
+
const rowMapping = new Map();
|
|
2070
|
+
if (isMovingForward) {
|
|
2071
|
+
for (let row = sourceRow + 1; row <= targetRow; row++) {
|
|
2072
|
+
rowMapping.set(row, row - 1);
|
|
2073
|
+
}
|
|
2074
|
+
rowMapping.set(sourceRow, targetRow);
|
|
2075
|
+
}
|
|
2076
|
+
else {
|
|
2077
|
+
for (let row = targetRow; row < sourceRow; row++) {
|
|
2078
|
+
rowMapping.set(row, row + 1);
|
|
2079
|
+
}
|
|
2080
|
+
rowMapping.set(sourceRow, targetRow);
|
|
2081
|
+
}
|
|
2082
|
+
for (const [cellKey, formula] of Array.from(this.formulaCells.entries())) {
|
|
2083
|
+
const cell = this.parseCellKey(cellKey);
|
|
2084
|
+
if (!cell || cell.sheet !== sheetKey) {
|
|
2085
|
+
continue;
|
|
2086
|
+
}
|
|
2087
|
+
let needsCellMove = false;
|
|
2088
|
+
const newCellLocation = { ...cell };
|
|
2089
|
+
if (rowMapping.has(cell.row)) {
|
|
2090
|
+
const mappedRow = rowMapping.get(cell.row);
|
|
2091
|
+
if (mappedRow !== undefined && mappedRow !== cell.row) {
|
|
2092
|
+
newCellLocation.row = mappedRow;
|
|
2093
|
+
needsCellMove = true;
|
|
2094
|
+
}
|
|
2095
|
+
}
|
|
2096
|
+
const newFormula = this.adjustFormulaWithRowMapping(formula, rowMapping);
|
|
2097
|
+
if (needsCellMove || newFormula !== formula) {
|
|
2098
|
+
if (needsCellMove) {
|
|
2099
|
+
movedFormulas.push({
|
|
2100
|
+
oldCellKey: cellKey,
|
|
2101
|
+
newCell: newCellLocation,
|
|
2102
|
+
formula: newFormula
|
|
2103
|
+
});
|
|
2104
|
+
this.formulaCells.delete(cellKey);
|
|
2105
|
+
this.clearDependencies(cellKey);
|
|
2106
|
+
}
|
|
2107
|
+
else {
|
|
2108
|
+
adjustedFormulas.push({ cell, oldFormula: formula, newFormula });
|
|
2109
|
+
this.clearDependencies(cellKey);
|
|
2110
|
+
}
|
|
2111
|
+
}
|
|
2112
|
+
}
|
|
2113
|
+
for (const { newCell, formula } of movedFormulas) {
|
|
2114
|
+
const newCellKey = this.getCellKey(newCell);
|
|
2115
|
+
this.formulaCells.set(newCellKey, formula);
|
|
2116
|
+
this.updateDependencies(newCellKey, formula);
|
|
2117
|
+
this.setCellContentWithoutDependencyUpdate(newCell, formula);
|
|
2118
|
+
}
|
|
2119
|
+
for (const { cell, newFormula } of adjustedFormulas) {
|
|
2120
|
+
const cellKey = this.getCellKey(cell);
|
|
2121
|
+
this.formulaCells.set(cellKey, newFormula);
|
|
2122
|
+
this.updateDependencies(cellKey, newFormula);
|
|
2123
|
+
this.setCellContentWithoutDependencyUpdate(cell, newFormula);
|
|
2124
|
+
}
|
|
2125
|
+
const adjustedCells = adjustedFormulas.map(item => item.cell);
|
|
2126
|
+
const movedCells = movedFormulas.map(item => item.newCell);
|
|
2127
|
+
return { adjustedCells, movedCells };
|
|
2128
|
+
}
|
|
2129
|
+
catch (error) {
|
|
2130
|
+
return { adjustedCells: [], movedCells: [] };
|
|
2131
|
+
}
|
|
2132
|
+
}
|
|
2133
|
+
adjustFormulaWithRowMapping(formula, rowMapping) {
|
|
2134
|
+
if (!formula || !formula.startsWith('=')) {
|
|
2135
|
+
return formula;
|
|
2136
|
+
}
|
|
2137
|
+
let expression = formula.substring(1);
|
|
2138
|
+
const rangeRegex = /([A-Z]+)([0-9]+):([A-Z]+)([0-9]+)/g;
|
|
2139
|
+
let match;
|
|
2140
|
+
const rangeReplacements = [];
|
|
2141
|
+
const processedRanges = [];
|
|
2142
|
+
while ((match = rangeRegex.exec(expression)) !== null) {
|
|
2143
|
+
const fullMatch = match[0];
|
|
2144
|
+
const startCol = match[1];
|
|
2145
|
+
const startRow = match[2];
|
|
2146
|
+
const endCol = match[3];
|
|
2147
|
+
const endRow = match[4];
|
|
2148
|
+
const startRowIndex = parseInt(startRow, 10) - 1;
|
|
2149
|
+
const endRowIndex = parseInt(endRow, 10) - 1;
|
|
2150
|
+
let newStartRow = startRowIndex;
|
|
2151
|
+
let newEndRow = endRowIndex;
|
|
2152
|
+
if (rowMapping.has(startRowIndex)) {
|
|
2153
|
+
const mappedStartRow = rowMapping.get(startRowIndex);
|
|
2154
|
+
if (mappedStartRow !== undefined) {
|
|
2155
|
+
newStartRow = mappedStartRow;
|
|
2156
|
+
}
|
|
2157
|
+
}
|
|
2158
|
+
if (rowMapping.has(endRowIndex)) {
|
|
2159
|
+
const mappedEndRow = rowMapping.get(endRowIndex);
|
|
2160
|
+
if (mappedEndRow !== undefined) {
|
|
2161
|
+
newEndRow = mappedEndRow;
|
|
2162
|
+
}
|
|
2163
|
+
}
|
|
2164
|
+
if (newStartRow !== startRowIndex || newEndRow !== endRowIndex) {
|
|
2165
|
+
const newStartRowNumber = newStartRow + 1;
|
|
2166
|
+
const newEndRowNumber = newEndRow + 1;
|
|
2167
|
+
const replacement = `${startCol}${newStartRowNumber}:${endCol}${newEndRowNumber}`;
|
|
2168
|
+
rangeReplacements.push({
|
|
2169
|
+
start: match.index,
|
|
2170
|
+
end: match.index + fullMatch.length,
|
|
2171
|
+
replacement
|
|
2172
|
+
});
|
|
2173
|
+
processedRanges.push({ start: match.index, end: match.index + fullMatch.length });
|
|
2174
|
+
}
|
|
2175
|
+
}
|
|
2176
|
+
for (let i = rangeReplacements.length - 1; i >= 0; i--) {
|
|
2177
|
+
const { start, end, replacement } = rangeReplacements[i];
|
|
2178
|
+
expression = expression.substring(0, start) + replacement + expression.substring(end);
|
|
2179
|
+
}
|
|
2180
|
+
const cellRegex = /([A-Z]+)([0-9]+)/g;
|
|
2181
|
+
const cellReplacements = [];
|
|
2182
|
+
while ((match = cellRegex.exec(expression)) !== null) {
|
|
2183
|
+
const fullMatch = match[0];
|
|
2184
|
+
const colLetters = match[1];
|
|
2185
|
+
const row = match[2];
|
|
2186
|
+
const rowIndex = parseInt(row, 10) - 1;
|
|
2187
|
+
const matchIndex = match.index;
|
|
2188
|
+
const isInProcessedRange = processedRanges.some(range => {
|
|
2189
|
+
return matchIndex >= range.start && matchIndex < range.end;
|
|
2190
|
+
});
|
|
2191
|
+
if (isInProcessedRange) {
|
|
2192
|
+
continue;
|
|
2193
|
+
}
|
|
2194
|
+
if (rowMapping.has(rowIndex)) {
|
|
2195
|
+
const newRowIndex = rowMapping.get(rowIndex);
|
|
2196
|
+
if (newRowIndex !== undefined) {
|
|
2197
|
+
const newRowNumber = newRowIndex + 1;
|
|
2198
|
+
const replacement = `${colLetters}${newRowNumber}`;
|
|
2199
|
+
cellReplacements.push({
|
|
2200
|
+
start: match.index,
|
|
2201
|
+
end: match.index + fullMatch.length,
|
|
2202
|
+
replacement
|
|
2203
|
+
});
|
|
2204
|
+
}
|
|
2205
|
+
}
|
|
2206
|
+
}
|
|
2207
|
+
for (let i = cellReplacements.length - 1; i >= 0; i--) {
|
|
2208
|
+
const { start, end, replacement } = cellReplacements[i];
|
|
2209
|
+
expression = expression.substring(0, start) + replacement + expression.substring(end);
|
|
2210
|
+
}
|
|
2211
|
+
return '=' + expression;
|
|
2212
|
+
}
|
|
1811
2213
|
}
|
|
1812
2214
|
class FormulaError {
|
|
1813
2215
|
message;
|
|
@@ -26772,12 +27174,12 @@
|
|
|
26772
27174
|
const parsedParams = this.parseParams(params, isTimeline);
|
|
26773
27175
|
return animate = isTimeline ? this.executeTimelineItem(parsedParams, graphic, index, count) : this.executeTypeConfigItem(parsedParams, graphic, index, count), animate && this._trackAnimation(animate), animate;
|
|
26774
27176
|
}
|
|
26775
|
-
stop(type) {
|
|
27177
|
+
stop(type, callEnd = !0) {
|
|
26776
27178
|
for (; this._animates.length > 0;) {
|
|
26777
27179
|
const animate = this._animates.pop();
|
|
26778
|
-
null == animate || animate.stop(type);
|
|
27180
|
+
!1 === callEnd && (animate.status = AnimateStatus.END), null == animate || animate.stop(type);
|
|
26779
27181
|
}
|
|
26780
|
-
this._animates = [], this._activeCount = 0, this._started && (this._started = !1, this.onEnd());
|
|
27182
|
+
this._animates = [], this._activeCount = 0, this._started && (this._started = !1, callEnd && this.onEnd());
|
|
26781
27183
|
}
|
|
26782
27184
|
}
|
|
26783
27185
|
AnimateExecutor.builtInAnimateMap = {};
|
|
@@ -26837,7 +27239,7 @@
|
|
|
26837
27239
|
executor: new AnimateExecutor(this.graphic)
|
|
26838
27240
|
});
|
|
26839
27241
|
}), shouldStopState.forEach(state => {
|
|
26840
|
-
state.executor.stop();
|
|
27242
|
+
state.executor.stop(null, !1);
|
|
26841
27243
|
}), shouldApplyState.length) {
|
|
26842
27244
|
shouldApplyState[0].executor.execute(shouldApplyState[0].animationConfig);
|
|
26843
27245
|
for (let i = 0; i < shouldApplyState.length; i++) {
|
|
@@ -26888,7 +27290,7 @@
|
|
|
26888
27290
|
clearState() {
|
|
26889
27291
|
var _a;
|
|
26890
27292
|
null === (_a = this.stateList) || void 0 === _a || _a.forEach(state => {
|
|
26891
|
-
state.executor.stop();
|
|
27293
|
+
state.executor.stop(null, !1);
|
|
26892
27294
|
}), this.stateList = null;
|
|
26893
27295
|
}
|
|
26894
27296
|
reApplyState(state) {
|
|
@@ -35213,7 +35615,7 @@
|
|
|
35213
35615
|
}(SeriesNumberCellStateValue || (SeriesNumberCellStateValue = {}));
|
|
35214
35616
|
var SeriesNumberEvent;
|
|
35215
35617
|
!function (SeriesNumberEvent) {
|
|
35216
|
-
SeriesNumberEvent.seriesNumberCellHover = "seriesNumberCellHover", SeriesNumberEvent.seriesNumberCellUnHover = "seriesNumberCellUnHover", SeriesNumberEvent.seriesNumberCellClick = "seriesNumberCellClick", SeriesNumberEvent.seriesNumberCellClickUp = "seriesNumberCellClickUp", SeriesNumberEvent.seriesNumberCellCancelClick = "seriesNumberCellCancelClick", SeriesNumberEvent.rowSeriesNumberWidthChange = "rowSeriesNumberWidthChange", SeriesNumberEvent.resizeRowHeightStart = "resizeRowHeightStart", SeriesNumberEvent.resizeColWidthStart = "resizeColWidthStart", SeriesNumberEvent.seriesNumberCellRightClick = "seriesNumberCellRightClick";
|
|
35618
|
+
SeriesNumberEvent.seriesNumberCellHover = "seriesNumberCellHover", SeriesNumberEvent.seriesNumberCellUnHover = "seriesNumberCellUnHover", SeriesNumberEvent.seriesNumberCellClick = "seriesNumberCellClick", SeriesNumberEvent.seriesNumberCellClickUp = "seriesNumberCellClickUp", SeriesNumberEvent.seriesNumberCellCancelClick = "seriesNumberCellCancelClick", SeriesNumberEvent.rowSeriesNumberWidthChange = "rowSeriesNumberWidthChange", SeriesNumberEvent.resizeRowHeightStart = "resizeRowHeightStart", SeriesNumberEvent.resizeColWidthStart = "resizeColWidthStart", SeriesNumberEvent.seriesNumberCellRightClick = "seriesNumberCellRightClick", SeriesNumberEvent.dragColumnOrderStart = "dragColumnOrderStart", SeriesNumberEvent.dragRowOrderStart = "dragRowOrderStart";
|
|
35217
35619
|
}(SeriesNumberEvent || (SeriesNumberEvent = {}));
|
|
35218
35620
|
|
|
35219
35621
|
class TableSeriesNumberEventManager {
|
|
@@ -35225,6 +35627,7 @@
|
|
|
35225
35627
|
event: e
|
|
35226
35628
|
});
|
|
35227
35629
|
}, this._onPointermove = e => {
|
|
35630
|
+
var _a, _b, _c, _d;
|
|
35228
35631
|
const target = e.target;
|
|
35229
35632
|
if (this.isPointerDownStartSelect) {
|
|
35230
35633
|
if (this._tableSeriesNumber.interactionState.selectIndexs.has(target.name)) {
|
|
@@ -35242,21 +35645,21 @@
|
|
|
35242
35645
|
this._tableSeriesNumber.interactionState._lastClickItem = target;
|
|
35243
35646
|
} else {
|
|
35244
35647
|
if (target.name.startsWith("col")) {
|
|
35245
|
-
Number(target.name.split("-")[1])
|
|
35246
|
-
|
|
35648
|
+
const colIndex = Number(target.name.split("-")[1]),
|
|
35649
|
+
canvasPointXY = target.stage.window.pointTransform(e.canvasX, e.canvasY),
|
|
35247
35650
|
XYtoTarget = {
|
|
35248
35651
|
x: 0,
|
|
35249
35652
|
y: 0
|
|
35250
35653
|
};
|
|
35251
|
-
target.globalTransMatrix.transformPoint(canvasPointXY, XYtoTarget), XYtoTarget.x <= 4 || XYtoTarget.x <= target.getAttributes().width && XYtoTarget.x >= target.getAttributes().width - 4 ? target.setAttribute("cursor", "col-resize") : target.setAttribute("cursor", "default");
|
|
35654
|
+
target.globalTransMatrix.transformPoint(canvasPointXY, XYtoTarget), XYtoTarget.x <= 4 || XYtoTarget.x <= target.getAttributes().width && XYtoTarget.x >= target.getAttributes().width - 4 ? target.setAttribute("cursor", "col-resize") : null != colIndex && (null === (_b = (_a = this._tableSeriesNumber.attribute).checkMoveColumnOrder) || void 0 === _b ? void 0 : _b.call(_a, colIndex)) ? target.setAttribute("cursor", "grab") : target.setAttribute("cursor", "default");
|
|
35252
35655
|
} else if (target.name.startsWith("row")) {
|
|
35253
|
-
Number(target.name.split("-")[1])
|
|
35254
|
-
|
|
35656
|
+
const rowIndex = Number(target.name.split("-")[1]),
|
|
35657
|
+
canvasPointXY = target.stage.window.pointTransform(e.canvasX, e.canvasY),
|
|
35255
35658
|
XYtoTarget = {
|
|
35256
35659
|
x: 0,
|
|
35257
35660
|
y: 0
|
|
35258
35661
|
};
|
|
35259
|
-
target.globalTransMatrix.transformPoint(canvasPointXY, XYtoTarget), XYtoTarget.y <= 4 || XYtoTarget.y <= target.getAttributes().height && XYtoTarget.y >= target.getAttributes().height - 4 ? target.setAttribute("cursor", "row-resize") : target.setAttribute("cursor", "default");
|
|
35662
|
+
target.globalTransMatrix.transformPoint(canvasPointXY, XYtoTarget), XYtoTarget.y <= 4 || XYtoTarget.y <= target.getAttributes().height && XYtoTarget.y >= target.getAttributes().height - 4 ? target.setAttribute("cursor", "row-resize") : null != rowIndex && (null === (_d = (_c = this._tableSeriesNumber.attribute).checkMoveRowOrder) || void 0 === _d ? void 0 : _d.call(_c, rowIndex)) ? target.setAttribute("cursor", "grab") : target.setAttribute("cursor", "default");
|
|
35260
35663
|
}
|
|
35261
35664
|
if (this._tableSeriesNumber.interactionState._lastHoverItem) {
|
|
35262
35665
|
if (this._tableSeriesNumber.interactionState._lastHoverItem.id === target.id) return;
|
|
@@ -35267,7 +35670,7 @@
|
|
|
35267
35670
|
}, this._onPointerleave = e => {
|
|
35268
35671
|
this._tableSeriesNumber.interactionState._lastHoverItem && (this._unHoverHandler(this._tableSeriesNumber.interactionState._lastHoverItem, e), this._tableSeriesNumber.interactionState._lastHoverItem = null);
|
|
35269
35672
|
}, this._onPointerdown = e => {
|
|
35270
|
-
var _a;
|
|
35673
|
+
var _a, _b, _c, _d, _e;
|
|
35271
35674
|
if (2 === e.button) return;
|
|
35272
35675
|
const target = e.target;
|
|
35273
35676
|
if (target.name.startsWith("col")) {
|
|
@@ -35284,6 +35687,10 @@
|
|
|
35284
35687
|
event: e
|
|
35285
35688
|
});
|
|
35286
35689
|
}
|
|
35690
|
+
if (null != colIndex && (null === (_b = (_a = this._tableSeriesNumber.attribute).checkMoveColumnOrder) || void 0 === _b ? void 0 : _b.call(_a, colIndex))) return void this._tableSeriesNumber.dispatchTableSeriesNumberEvent(SeriesNumberEvent.dragColumnOrderStart, {
|
|
35691
|
+
colIndex: colIndex,
|
|
35692
|
+
event: e
|
|
35693
|
+
});
|
|
35287
35694
|
} else if (target.name.startsWith("row")) {
|
|
35288
35695
|
const rowIndex = Number(target.name.split("-")[1]),
|
|
35289
35696
|
canvasPointXY = target.stage.window.pointTransform(e.canvasX, e.canvasY),
|
|
@@ -35298,8 +35705,12 @@
|
|
|
35298
35705
|
event: e
|
|
35299
35706
|
});
|
|
35300
35707
|
}
|
|
35708
|
+
if (null != rowIndex && (null === (_d = (_c = this._tableSeriesNumber.attribute).checkMoveRowOrder) || void 0 === _d ? void 0 : _d.call(_c, rowIndex))) return void this._tableSeriesNumber.dispatchTableSeriesNumberEvent(SeriesNumberEvent.dragRowOrderStart, {
|
|
35709
|
+
rowIndex: rowIndex,
|
|
35710
|
+
event: e
|
|
35711
|
+
});
|
|
35301
35712
|
}
|
|
35302
|
-
if (this.isPointerDownStartSelect = !0, null === (
|
|
35713
|
+
if (this.isPointerDownStartSelect = !0, null === (_e = this._tableSeriesNumber.interactionState.selectIndexs) || void 0 === _e ? void 0 : _e.size) if (this._tableSeriesNumber.interactionState.selectIndexs.has(target.name)) {
|
|
35303
35714
|
if (e.nativeEvent.ctrlKey || e.nativeEvent.metaKey) this._tableSeriesNumber.removeOneGroupSelected(target), this._unClickHandler(target.name, e);else {
|
|
35304
35715
|
this._tableSeriesNumber.removeAllSelectedIndexs();
|
|
35305
35716
|
for (const name of this._tableSeriesNumber.interactionState.selectIndexs) this._unClickHandler(name, e);
|
|
@@ -38140,7 +38551,7 @@
|
|
|
38140
38551
|
maxing = !1,
|
|
38141
38552
|
leading = !1,
|
|
38142
38553
|
trailing = !0;
|
|
38143
|
-
const useRAF = !wait && 0 !== wait && "function" == typeof
|
|
38554
|
+
const useRAF = !wait && 0 !== wait && "function" == typeof vglobal.getRequestAnimationFrame();
|
|
38144
38555
|
if ("function" != typeof func) throw new TypeError("Expected a function");
|
|
38145
38556
|
function invokeFunc(time) {
|
|
38146
38557
|
const args = lastArgs,
|
|
@@ -38148,7 +38559,7 @@
|
|
|
38148
38559
|
return lastThis = void 0, lastArgs = void 0, lastInvokeTime = time, result = func.apply(thisArg, args), result;
|
|
38149
38560
|
}
|
|
38150
38561
|
function startTimer(pendingFunc, wait) {
|
|
38151
|
-
return useRAF ?
|
|
38562
|
+
return useRAF ? vglobal.getRequestAnimationFrame()(pendingFunc) : setTimeout(pendingFunc, wait);
|
|
38152
38563
|
}
|
|
38153
38564
|
function shouldInvoke(time) {
|
|
38154
38565
|
const timeSinceLastCall = time - lastCallTime;
|
|
@@ -46077,14 +46488,15 @@
|
|
|
46077
46488
|
symbolX = 0,
|
|
46078
46489
|
symbolY = 0,
|
|
46079
46490
|
symbolRotate = Math.PI;
|
|
46080
|
-
const linePoints = []
|
|
46081
|
-
|
|
46491
|
+
const linePoints = [],
|
|
46492
|
+
movingColumnOrRow = this.table.stateManager.columnMove.movingColumnOrRow;
|
|
46493
|
+
return "columnHeader" === cellLocation && void 0 === movingColumnOrRow || "column" === movingColumnOrRow ? (rectX = this.table.getColsWidth(0, col - 1) - this.table.stateManager.scroll.horizontalBarPos, rectY = this.table.getRowsHeight(0, this.table.frozenRowCount - 1), rectHeight = this.table.tableNoFrameHeight, rectWidth = mergeInfo ? this.table.getColsWidth(mergeInfo.start.col, mergeInfo.end.col) : this.table.getColWidth(col), rectDx = rectX - delta, symbolX = rectX + rectWidth, symbolY = 2, linePoints.push({
|
|
46082
46494
|
x: 0,
|
|
46083
46495
|
y: 0
|
|
46084
46496
|
}), linePoints.push({
|
|
46085
46497
|
x: 0,
|
|
46086
46498
|
y: this.table.tableNoFrameHeight
|
|
46087
|
-
})) : ("rowHeader" === cellLocation || this.table.internalProps.layoutMap.isSeriesNumberInBody(col, row)) && (rectY = this.table.getRowsHeight(0, row - 1) - this.table.stateManager.scroll.verticalBarPos, rectX = this.table.getColsWidth(0, this.table.frozenColCount - 1), rectWidth = this.table.tableNoFrameWidth, rectHeight = mergeInfo ? this.table.getRowsHeight(mergeInfo.start.row, mergeInfo.end.row) : this.table.getRowHeight(row), rectDy = rectY - delta, symbolX = 2, symbolY = rectY + rectHeight, symbolRotate = Math.PI / 2, linePoints.push({
|
|
46499
|
+
})) : ("rowHeader" === cellLocation || this.table.internalProps.layoutMap.isSeriesNumberInBody(col, row) || "row" === movingColumnOrRow) && (rectY = this.table.getRowsHeight(0, row - 1) - this.table.stateManager.scroll.verticalBarPos, rectX = this.table.getColsWidth(0, this.table.frozenColCount - 1), rectWidth = this.table.tableNoFrameWidth, rectHeight = mergeInfo ? this.table.getRowsHeight(mergeInfo.start.row, mergeInfo.end.row) : this.table.getRowHeight(row), rectDy = rectY - delta, symbolX = 2, symbolY = rectY + rectHeight, symbolRotate = Math.PI / 2, linePoints.push({
|
|
46088
46500
|
x: 0,
|
|
46089
46501
|
y: 0
|
|
46090
46502
|
}), linePoints.push({
|
|
@@ -47068,7 +47480,7 @@
|
|
|
47068
47480
|
isValid$4(count) && (batchRenderChartCount = count);
|
|
47069
47481
|
}
|
|
47070
47482
|
function clearChartRenderQueue() {
|
|
47071
|
-
chartRenderKeys = [], chartRenderQueueList = [], isHandlingChartQueue = !1,
|
|
47483
|
+
chartRenderKeys = [], chartRenderQueueList = [], isHandlingChartQueue = !1, vglobal.getCancelAnimationFrame()(requestAnimationFrameId);
|
|
47072
47484
|
}
|
|
47073
47485
|
function IsHandlingChartQueue() {
|
|
47074
47486
|
return isHandlingChartQueue;
|
|
@@ -47147,7 +47559,7 @@
|
|
|
47147
47559
|
tickMode: null === (_e = axis.tick) || void 0 === _e ? void 0 : _e.tickMode
|
|
47148
47560
|
}
|
|
47149
47561
|
}, !0);
|
|
47150
|
-
}), null === (_c = null === (_b = table.internalProps.layoutMap) || void 0 === _b ? void 0 : _b.updateDataStateToActiveChartInstance) || void 0 === _c || _c.call(_b, chartInstance), "string" == typeof dataId) chartInstance.updateDataSync(dataId, null != data ? data : []);else {
|
|
47562
|
+
}), null === (_c = null === (_b = table.internalProps.layoutMap) || void 0 === _b ? void 0 : _b.updateDataStateToActiveChartInstance) || void 0 === _c || _c.call(_b, chartInstance), "string" == typeof dataId) chartInstance.getChart().setLayoutTag(!0), chartInstance.updateDataSync(dataId, null != data ? data : []);else {
|
|
47151
47563
|
const dataBatch = [];
|
|
47152
47564
|
for (const dataIdStr in dataId) {
|
|
47153
47565
|
const dataIdAndField = dataId[dataIdStr],
|
|
@@ -47161,7 +47573,7 @@
|
|
|
47161
47573
|
fields: null === (_e = null == series ? void 0 : series.data) || void 0 === _e ? void 0 : _e.fields
|
|
47162
47574
|
}), chartInstance.updateFullDataSync || chartInstance.updateDataSync(dataIdStr, dataIdAndField ? null !== (_f = null == data ? void 0 : data.filter(item => item.hasOwnProperty(dataIdAndField))) && void 0 !== _f ? _f : [] : null != data ? data : []);
|
|
47163
47575
|
}
|
|
47164
|
-
null === (_g = chartInstance.updateFullDataSync) || void 0 === _g || _g.call(chartInstance, dataBatch);
|
|
47576
|
+
chartInstance.getChart().setLayoutTag(!0), null === (_g = chartInstance.updateFullDataSync) || void 0 === _g || _g.call(chartInstance, dataBatch);
|
|
47165
47577
|
}
|
|
47166
47578
|
table.fireListeners("before_cache_chart_image", {
|
|
47167
47579
|
chartInstance: chartInstance
|
|
@@ -47169,7 +47581,7 @@
|
|
|
47169
47581
|
cacheStageCanvas(chartInstance.getStage(), chart);
|
|
47170
47582
|
}
|
|
47171
47583
|
function startRenderChartQueue(table) {
|
|
47172
|
-
isHandlingChartQueue = !0, chartRenderQueueList.length > 0 ? requestAnimationFrameId =
|
|
47584
|
+
isHandlingChartQueue = !0, chartRenderQueueList.length > 0 ? requestAnimationFrameId = vglobal.getRequestAnimationFrame()(() => {
|
|
47173
47585
|
const chartsToRender = chartRenderQueueList.splice(0, batchRenderChartCount);
|
|
47174
47586
|
chartRenderKeys.splice(0, batchRenderChartCount), chartsToRender.forEach(chart => {
|
|
47175
47587
|
renderChart(chart), chart.addUpdateBoundTag();
|
|
@@ -48108,10 +48520,12 @@
|
|
|
48108
48520
|
actualWidth = 0;
|
|
48109
48521
|
for (let col = 0; col < table.colCount; col++) {
|
|
48110
48522
|
const colWidth = update && null !== (_f = newWidths[col]) && void 0 !== _f ? _f : table.getColWidth(col);
|
|
48111
|
-
(col < table.rowHeaderLevelCount + table.leftRowSeriesNumberCount || table.isPivotChart() && col >= table.colCount - table.rightFrozenColCount) && (actualHeaderWidth += colWidth), actualWidth += colWidth;
|
|
48523
|
+
"only-body" === table.widthAdaptiveMode && (col < table.rowHeaderLevelCount + table.leftRowSeriesNumberCount || table.isPivotChart() && col >= table.colCount - table.rightFrozenColCount) && (actualHeaderWidth += colWidth), actualWidth += colWidth;
|
|
48112
48524
|
}
|
|
48113
48525
|
if (actualWidth < canvasWidth && actualWidth > actualHeaderWidth) {
|
|
48114
|
-
|
|
48526
|
+
let startCol = 0,
|
|
48527
|
+
endCol = table.colCount;
|
|
48528
|
+
"only-body" === table.widthAdaptiveMode && (startCol = table.rowHeaderLevelCount + table.leftRowSeriesNumberCount, endCol = table.isPivotChart() ? table.colCount - table.rightFrozenColCount : table.colCount), getAdaptiveWidth(canvasWidth - actualHeaderWidth, startCol, endCol, update, newWidths, table);
|
|
48115
48529
|
}
|
|
48116
48530
|
}
|
|
48117
48531
|
if (update) {
|
|
@@ -51796,12 +52210,12 @@
|
|
|
51796
52210
|
actualWidth = 0;
|
|
51797
52211
|
for (let col = 0; col < table.colCount; col++) {
|
|
51798
52212
|
const colWidth = table.getColWidth(col);
|
|
51799
|
-
(col < table.rowHeaderLevelCount || table.isPivotChart() && col >= table.colCount - table.rightFrozenColCount) && (actualHeaderWidth += colWidth), actualWidth += colWidth;
|
|
52213
|
+
"only-body" === table.widthAdaptiveMode && (col < table.rowHeaderLevelCount || table.isPivotChart() && col >= table.colCount - table.rightFrozenColCount) && (actualHeaderWidth += colWidth), actualWidth += colWidth;
|
|
51800
52214
|
}
|
|
51801
52215
|
if (actualWidth < canvasWidth && actualWidth > actualHeaderWidth) {
|
|
51802
|
-
|
|
51803
|
-
endCol = table.
|
|
51804
|
-
getAdaptiveWidth(canvasWidth - actualHeaderWidth, startCol, endCol, !1, [], table, !0);
|
|
52216
|
+
let startCol = 0,
|
|
52217
|
+
endCol = table.colCount;
|
|
52218
|
+
"only-body" === table.widthAdaptiveMode && (startCol = table.rowHeaderLevelCount, endCol = table.isPivotChart() ? table.colCount - table.rightFrozenColCount : table.colCount), getAdaptiveWidth(canvasWidth - actualHeaderWidth, startCol, endCol, !1, [], table, !0);
|
|
51805
52219
|
}
|
|
51806
52220
|
}
|
|
51807
52221
|
let bodyWidth = 0;
|
|
@@ -52766,24 +53180,26 @@
|
|
|
52766
53180
|
return target;
|
|
52767
53181
|
}
|
|
52768
53182
|
|
|
52769
|
-
function startMoveCol(col, row, x, y, state, event) {
|
|
53183
|
+
function startMoveCol(col, row, x, y, state, event, dragColumnOrRow) {
|
|
52770
53184
|
var _a;
|
|
52771
53185
|
if (!("canMoveHeaderPosition" in state.table.internalProps.layoutMap)) return;
|
|
52772
|
-
if (state.columnMove.moving = !0, state.columnMove.colSource = col, state.columnMove.rowSource = row, state.table.isListTable()) {
|
|
53186
|
+
if (state.columnMove.movingColumnOrRow = dragColumnOrRow, state.columnMove.moving = !0, state.columnMove.colSource = col, state.columnMove.rowSource = row, state.table.isListTable()) {
|
|
52773
53187
|
const nodeIndex = state.table.getRecordIndexByCell(col, row),
|
|
52774
53188
|
nodeData = state.table.getRecordByCell(col, row),
|
|
52775
53189
|
hierarchyState = state.table.getRecordHierarchyState(col, row);
|
|
52776
53190
|
state.columnMove.rowSourceSize = computeChildrenNodeLength(nodeIndex, hierarchyState, nodeData) + 1;
|
|
52777
53191
|
}
|
|
52778
|
-
|
|
52779
|
-
|
|
52780
|
-
|
|
52781
|
-
|
|
52782
|
-
|
|
52783
|
-
|
|
52784
|
-
|
|
52785
|
-
|
|
52786
|
-
|
|
53192
|
+
let delta;
|
|
53193
|
+
if (state.columnMove.x = x - state.table.tableX, state.columnMove.y = y - state.table.tableY, "column" === dragColumnOrRow) delta = state.columnMove.x;else if ("row" === dragColumnOrRow) delta = state.columnMove.y;else {
|
|
53194
|
+
const cellLocation = state.table.getCellLocation(col, row);
|
|
53195
|
+
delta = "columnHeader" === cellLocation ? state.columnMove.x : "rowHeader" === cellLocation || state.table.internalProps.layoutMap.isSeriesNumberInBody(col, row) ? state.columnMove.y : 0;
|
|
53196
|
+
}
|
|
53197
|
+
const {
|
|
53198
|
+
backX: backX,
|
|
53199
|
+
lineX: lineX,
|
|
53200
|
+
backY: backY,
|
|
53201
|
+
lineY: lineY
|
|
53202
|
+
} = state.table.scenegraph.component.showMoveCol(col, row, delta);
|
|
52787
53203
|
state.table.fireListeners(TABLE_EVENT_TYPE.CHANGE_HEADER_POSITION_START, {
|
|
52788
53204
|
col: col,
|
|
52789
53205
|
row: row,
|
|
@@ -52793,7 +53209,8 @@
|
|
|
52793
53209
|
lineX: lineX,
|
|
52794
53210
|
backY: backY,
|
|
52795
53211
|
lineY: lineY,
|
|
52796
|
-
event: event
|
|
53212
|
+
event: event,
|
|
53213
|
+
movingColumnOrRow: dragColumnOrRow
|
|
52797
53214
|
});
|
|
52798
53215
|
const isHasSelected = !!(null === (_a = state.select.ranges) || void 0 === _a ? void 0 : _a.length);
|
|
52799
53216
|
state.table.stateManager.updateSelectPos(-1, -1), state.table.stateManager.endSelectCells(!0, isHasSelected), state.table.scenegraph.updateNextFrame();
|
|
@@ -52823,7 +53240,7 @@
|
|
|
52823
53240
|
let lineX, backX, lineY, backY;
|
|
52824
53241
|
state.updateCursor("grabbing");
|
|
52825
53242
|
const cellLocation = state.table.getCellLocation(state.columnMove.colSource, state.columnMove.rowSource);
|
|
52826
|
-
"columnHeader" === cellLocation ? (backX = state.columnMove.x, lineX = state.table.isLeftFrozenColumn(col) ? state.columnMove.colTarget >= state.columnMove.colSource ? state.table.getColsWidth(0, state.columnMove.colTarget) : state.table.getColsWidth(0, state.columnMove.colTarget - 1) : state.table.isRightFrozenColumn(col) ? state.table.tableNoFrameWidth - state.table.getColsWidth(targetCell.col + 1, state.table.colCount - 1) : (state.columnMove.colTarget >= state.columnMove.colSource ? state.table.getColsWidth(0, state.columnMove.colTarget) : state.table.getColsWidth(0, state.columnMove.colTarget - 1)) - state.table.stateManager.scroll.horizontalBarPos) : ("rowHeader" === cellLocation || state.table.internalProps.layoutMap.isSeriesNumberInBody(col, row)) && (backY = state.columnMove.y, lineY = state.table.isFrozenRow(row) ? state.columnMove.rowTarget >= state.columnMove.rowSource ? state.table.getRowsHeight(0, state.columnMove.rowTarget) : state.table.getRowsHeight(0, state.columnMove.rowTarget - 1) : state.table.isBottomFrozenRow(row) ? state.table.tableNoFrameHeight - state.table.getRowsHeight(targetCell.row + 1, state.table.rowCount - 1) : (state.columnMove.rowTarget >= state.columnMove.rowSource ? state.table.getRowsHeight(0, state.columnMove.rowTarget) : state.table.getRowsHeight(0, state.columnMove.rowTarget - 1)) - state.table.stateManager.scroll.verticalBarPos), state.table.scenegraph.component.updateMoveCol(backX, lineX, backY, lineY), state.table.fireListeners(TABLE_EVENT_TYPE.CHANGING_HEADER_POSITION, {
|
|
53243
|
+
"columnHeader" === cellLocation ? (backX = state.columnMove.x, lineX = state.table.isLeftFrozenColumn(col) ? state.columnMove.colTarget >= state.columnMove.colSource ? state.table.getColsWidth(0, state.columnMove.colTarget) : state.table.getColsWidth(0, state.columnMove.colTarget - 1) : state.table.isRightFrozenColumn(col) ? state.table.tableNoFrameWidth - state.table.getColsWidth(targetCell.col + 1, state.table.colCount - 1) : (state.columnMove.colTarget >= state.columnMove.colSource ? state.table.getColsWidth(0, state.columnMove.colTarget) : state.table.getColsWidth(0, state.columnMove.colTarget - 1)) - state.table.stateManager.scroll.horizontalBarPos) : ("rowHeader" === cellLocation || state.table.internalProps.layoutMap.isSeriesNumberInBody(col, row) || "row" === state.columnMove.movingColumnOrRow) && (backY = state.columnMove.y, lineY = state.table.isFrozenRow(row) ? state.columnMove.rowTarget >= state.columnMove.rowSource ? state.table.getRowsHeight(0, state.columnMove.rowTarget) : state.table.getRowsHeight(0, state.columnMove.rowTarget - 1) : state.table.isBottomFrozenRow(row) ? state.table.tableNoFrameHeight - state.table.getRowsHeight(targetCell.row + 1, state.table.rowCount - 1) : (state.columnMove.rowTarget >= state.columnMove.rowSource ? state.table.getRowsHeight(0, state.columnMove.rowTarget) : state.table.getRowsHeight(0, state.columnMove.rowTarget - 1)) - state.table.stateManager.scroll.verticalBarPos), state.table.scenegraph.component.updateMoveCol(backX, lineX, backY, lineY), state.table.fireListeners(TABLE_EVENT_TYPE.CHANGING_HEADER_POSITION, {
|
|
52827
53244
|
col: col,
|
|
52828
53245
|
row: row,
|
|
52829
53246
|
x: x,
|
|
@@ -52832,14 +53249,15 @@
|
|
|
52832
53249
|
lineX: lineX,
|
|
52833
53250
|
backY: backY,
|
|
52834
53251
|
lineY: lineY,
|
|
52835
|
-
event: event
|
|
53252
|
+
event: event,
|
|
53253
|
+
movingColumnOrRow: state.columnMove.movingColumnOrRow
|
|
52836
53254
|
}), state.table.scenegraph.updateNextFrame();
|
|
52837
53255
|
} else state.updateCursor("not-allowed"), state.columnMove.colTarget = state.columnMove.colSource, state.columnMove.rowTarget = state.columnMove.rowSource;
|
|
52838
53256
|
}
|
|
52839
53257
|
function endMoveCol(state) {
|
|
52840
53258
|
var _a, _b;
|
|
52841
53259
|
let moveColResult = !1;
|
|
52842
|
-
if ("canMoveHeaderPosition" in state.table.internalProps.layoutMap && state.columnMove.moving && state.columnMove.colSource >= 0 && state.columnMove.rowSource >= 0 && state.columnMove.colTarget >= 0 && state.columnMove.rowTarget >= 0 && !0 !== (null === (_a = state.table.options.customConfig) || void 0 === _a ? void 0 : _a.notUpdateInColumnRowMove)) {
|
|
53260
|
+
if ("canMoveHeaderPosition" in state.table.internalProps.layoutMap && state.columnMove.moving && (state.columnMove.colSource >= 0 || "row" === state.columnMove.movingColumnOrRow) && (state.columnMove.rowSource >= 0 || "column" === state.columnMove.movingColumnOrRow) && (state.columnMove.colTarget >= 0 || "row" === state.columnMove.movingColumnOrRow) && (state.columnMove.rowTarget >= 0 || "column" === state.columnMove.movingColumnOrRow) && !0 !== (null === (_a = state.table.options.customConfig) || void 0 === _a ? void 0 : _a.notUpdateInColumnRowMove)) {
|
|
52843
53261
|
const oldSourceMergeInfo = state.table.getCellRange(state.columnMove.colSource, state.columnMove.rowSource),
|
|
52844
53262
|
oldTargetMergeInfo = state.table.getCellRange(state.columnMove.colTarget, state.columnMove.rowTarget),
|
|
52845
53263
|
moveContext = state.table._moveHeaderPosition({
|
|
@@ -52849,7 +53267,9 @@
|
|
|
52849
53267
|
col: state.columnMove.colTarget,
|
|
52850
53268
|
row: state.columnMove.rowTarget
|
|
52851
53269
|
});
|
|
52852
|
-
if (!moveContext || moveContext.targetIndex === moveContext.sourceIndex) return state.updateCursor(), state.columnMove.moving = !1,
|
|
53270
|
+
if (!moveContext || moveContext.targetIndex === moveContext.sourceIndex) return state.updateCursor(), state.columnMove.moving = !1, setTimeout(() => {
|
|
53271
|
+
delete state.columnMove.colSource, delete state.columnMove.rowSource, delete state.columnMove.colTarget, delete state.columnMove.rowTarget, state.columnMove.movingColumnOrRow = void 0;
|
|
53272
|
+
}, 0), state.table.scenegraph.component.hideMoveCol(), state.table.scenegraph.updateNextFrame(), !1;
|
|
52853
53273
|
{
|
|
52854
53274
|
state.table.internalProps.useOneRowHeightFillAll = !1, state.table.internalProps.layoutMap.clearCellRangeMap();
|
|
52855
53275
|
const sourceMergeInfo = state.table.getCellRange(state.columnMove.colSource, state.columnMove.rowSource),
|
|
@@ -52858,11 +53278,11 @@
|
|
|
52858
53278
|
colMax = Math.max(sourceMergeInfo.end.col, targetMergeInfo.end.col, oldSourceMergeInfo.end.col, oldTargetMergeInfo.end.col),
|
|
52859
53279
|
rowMin = Math.min(sourceMergeInfo.start.row, targetMergeInfo.start.row, oldSourceMergeInfo.start.row, oldTargetMergeInfo.start.row);
|
|
52860
53280
|
let rowMax = Math.max(sourceMergeInfo.end.row, targetMergeInfo.end.row, oldSourceMergeInfo.end.row, oldTargetMergeInfo.end.row);
|
|
52861
|
-
"row" === moveContext.moveType && "tree" === state.table.internalProps.layoutMap.rowHierarchyType && (rowMax = moveContext.targetIndex > moveContext.sourceIndex ? rowMax + moveContext.targetSize - 1 : rowMax + moveContext.sourceSize - 1),
|
|
53281
|
+
"row" === moveContext.moveType && "tree" === state.table.internalProps.layoutMap.rowHierarchyType && (rowMax = moveContext.targetIndex > moveContext.sourceIndex ? rowMax + moveContext.targetSize - 1 : rowMax + moveContext.sourceSize - 1), state.table.transpose || !state.table.internalProps.layoutMap.isSeriesNumberInBody(state.columnMove.colSource, state.columnMove.rowSource) && "row" !== state.columnMove.movingColumnOrRow || (state.table.changeRecordOrder(moveContext.sourceIndex, moveContext.targetIndex), state.changeCheckboxAndRadioOrder(moveContext.sourceIndex, moveContext.targetIndex)), "column" === moveContext.moveType ? clearWidthsAndHeightsCache(colMin, colMax, 0, -1, state.table) : clearWidthsAndHeightsCache(0, -1, rowMin, rowMax, state.table), state.table.clearCellStyleCache(), state.table.internalProps.layoutMap.isSeriesNumberInBody(state.columnMove.colSource, state.columnMove.rowSource) || "row" === state.columnMove.movingColumnOrRow ? state.table.scenegraph.updateHeaderPosition(state.table.scenegraph.proxy.colStart, state.table.scenegraph.proxy.colEnd, state.table.scenegraph.proxy.rowStart, state.table.scenegraph.proxy.rowEnd, moveContext.moveType) : "column" === moveContext.moveType ? state.table.scenegraph.updateHeaderPosition(colMin, colMax, 0, -1, moveContext.moveType) : state.table.scenegraph.updateHeaderPosition(0, -1, rowMin, rowMax, moveContext.moveType), "adjustFrozenCount" === state.table.internalProps.frozenColDragHeaderMode && state.table.isListTable() && (state.table.isLeftFrozenColumn(state.columnMove.colTarget) && !state.table.isLeftFrozenColumn(state.columnMove.colSource) ? state.table.frozenColCount += sourceMergeInfo.end.col - sourceMergeInfo.start.col + 1 : state.table.isLeftFrozenColumn(state.columnMove.colSource) && !state.table.isLeftFrozenColumn(state.columnMove.colTarget) && (state.table.frozenColCount -= sourceMergeInfo.end.col - sourceMergeInfo.start.col + 1), state.table.isRightFrozenColumn(state.columnMove.colTarget) && !state.table.isRightFrozenColumn(state.columnMove.colSource) ? state.table.rightFrozenColCount += sourceMergeInfo.end.col - sourceMergeInfo.start.col + 1 : state.table.isRightFrozenColumn(state.columnMove.colSource) && !state.table.isRightFrozenColumn(state.columnMove.colTarget) && (state.table.rightFrozenColCount -= sourceMergeInfo.end.col - sourceMergeInfo.start.col + 1)), moveColResult = !0;
|
|
52862
53282
|
}
|
|
52863
53283
|
}
|
|
52864
53284
|
return state.columnMove.moving = !1, setTimeout(() => {
|
|
52865
|
-
delete state.columnMove.colSource, delete state.columnMove.rowSource, delete state.columnMove.colTarget, delete state.columnMove.rowTarget;
|
|
53285
|
+
delete state.columnMove.colSource, delete state.columnMove.rowSource, delete state.columnMove.colTarget, delete state.columnMove.rowTarget, state.columnMove.movingColumnOrRow = void 0;
|
|
52866
53286
|
}, 0), state.table.scenegraph.component.hideMoveCol(), state.columnResize.col < state.table.frozenColCount && !state.table.isPivotTable() && !state.table.transpose ? (state.table.scenegraph.component.setFrozenColumnShadow(state.table.frozenColCount - 1, state.columnResize.isRightFrozen), state.table.scenegraph.component.setRightFrozenColumnShadow(state.table.colCount - state.table.rightFrozenColCount)) : state.columnResize.col >= state.table.colCount - state.table.rightFrozenColCount && !state.table.isPivotTable() && !state.table.transpose ? state.table.scenegraph.component.setRightFrozenColumnShadow(state.table.colCount - state.table.rightFrozenColCount) : state.table.options.frozenColCount ? state.table.scenegraph.component.setFrozenColumnShadow(state.table.frozenColCount - 1) : state.table.options.rightFrozenColCount && state.table.scenegraph.component.setRightFrozenColumnShadow(state.table.colCount - state.table.rightFrozenColCount), state.table.scenegraph.updateNextFrame(), !0 === (null === (_b = state.table.options.customConfig) || void 0 === _b ? void 0 : _b.notUpdateInColumnRowMove) || moveColResult;
|
|
52867
53287
|
}
|
|
52868
53288
|
function clearWidthsAndHeightsCache(colMin, colMax, rowMin, rowMax, table) {
|
|
@@ -52900,6 +53320,7 @@
|
|
|
52900
53320
|
}
|
|
52901
53321
|
|
|
52902
53322
|
function updateResizeColumn(xInTable, yInTable, state) {
|
|
53323
|
+
var _a;
|
|
52903
53324
|
xInTable = Math.ceil(xInTable), yInTable = Math.ceil(yInTable);
|
|
52904
53325
|
let detaX = state.columnResize.isRightFrozen ? state.columnResize.x - xInTable : xInTable - state.columnResize.x;
|
|
52905
53326
|
if (Math.abs(detaX) < 1) return;
|
|
@@ -52924,7 +53345,9 @@
|
|
|
52924
53345
|
}
|
|
52925
53346
|
rightColWidth - detaX < state.table.internalProps.limitMinWidth && (detaX = rightColWidth - state.table.internalProps.limitMinWidth);
|
|
52926
53347
|
}
|
|
52927
|
-
detaX = Math.ceil(detaX), state.columnResize.col < state.table.rowHeaderLevelCount || state.columnResize.col >= state.table.colCount - state.table.rightFrozenColCount ? updateResizeColForColumn(detaX, state) : "indicator" === state.table.internalProps.columnResizeType ? updateResizeColForIndicator$1(detaX, state) : "indicatorGroup" === state.table.internalProps.columnResizeType ? updateResizeColForIndicatorGroup$1(detaX, state) : "all" === state.table.internalProps.columnResizeType ? updateResizeColForAll$1(detaX, state) : updateResizeColForColumn(detaX, state), state.columnResize.x = xInTable, state.table.scenegraph.component.updateResizeCol(state.columnResize.col, yInTable, state.columnResize.isRightFrozen), state.table._updateSize(),
|
|
53348
|
+
detaX = Math.ceil(detaX), state.columnResize.col < state.table.rowHeaderLevelCount || state.columnResize.col >= state.table.colCount - state.table.rightFrozenColCount ? updateResizeColForColumn(detaX, state) : "indicator" === state.table.internalProps.columnResizeType ? updateResizeColForIndicator$1(detaX, state) : "indicatorGroup" === state.table.internalProps.columnResizeType ? updateResizeColForIndicatorGroup$1(detaX, state) : "all" === state.table.internalProps.columnResizeType ? updateResizeColForAll$1(detaX, state) : updateResizeColForColumn(detaX, state), state.columnResize.x = xInTable, state.table.scenegraph.component.updateResizeCol(state.columnResize.col, yInTable, state.columnResize.isRightFrozen), state.table._updateSize(), null === (_a = state.table.internalProps.legends) || void 0 === _a || _a.forEach(legend => {
|
|
53349
|
+
null == legend || legend.resize();
|
|
53350
|
+
}), state.table.internalProps.title && state.table.internalProps.title.resize(), state.table.internalProps.emptyTip && state.table.internalProps.emptyTip.resize(), state.columnResize.col < state.table.frozenColCount && !state.table.isPivotTable() && !state.table.transpose ? state.table.scenegraph.component.setFrozenColumnShadow(state.table.frozenColCount - 1, state.columnResize.isRightFrozen) : state.table.options.frozenColCount && state.table.scenegraph.component.setFrozenColumnShadow(state.table.frozenColCount - 1), (state.columnResize.col >= state.table.colCount - state.table.rightFrozenColCount && !state.table.isPivotTable() && !state.table.transpose || state.table.options.rightFrozenColCount) && state.table.scenegraph.component.setRightFrozenColumnShadow(state.table.colCount - state.table.rightFrozenColCount), state.table.scenegraph.updateNextFrame();
|
|
52928
53351
|
}
|
|
52929
53352
|
function updateResizeColForColumn(detaX, state) {
|
|
52930
53353
|
"adaptive" === state.table.widthMode && state.columnResize.col < state.table.colCount - 1 ? (state.table.scenegraph.updateColWidth(state.columnResize.col, detaX), state.table.scenegraph.updateColWidth(state.columnResize.col + 1, -detaX), state.table.internalProps._widthResizedColMap.add(state.columnResize.col), state.table.internalProps._widthResizedColMap.add(state.columnResize.col + 1)) : (state.table.scenegraph.updateColWidth(state.columnResize.col, detaX), state.table.internalProps._widthResizedColMap.add(state.columnResize.col));
|
|
@@ -53238,6 +53661,7 @@
|
|
|
53238
53661
|
}
|
|
53239
53662
|
|
|
53240
53663
|
function updateResizeRow(xInTable, yInTable, state) {
|
|
53664
|
+
var _a;
|
|
53241
53665
|
xInTable = Math.ceil(xInTable), yInTable = Math.ceil(yInTable);
|
|
53242
53666
|
let detaY = state.rowResize.isBottomFrozen ? state.rowResize.y - yInTable : yInTable - state.rowResize.y;
|
|
53243
53667
|
if (Math.abs(detaY) < 1) return;
|
|
@@ -53247,7 +53671,9 @@
|
|
|
53247
53671
|
let bottomRowHeight = state.table.getRowHeight(state.rowResize.row + 1);
|
|
53248
53672
|
bottomRowHeight -= detaY, bottomRowHeight - detaY < state.table.internalProps.limitMinHeight && (detaY = bottomRowHeight - state.table.internalProps.limitMinHeight);
|
|
53249
53673
|
}
|
|
53250
|
-
detaY = Math.ceil(detaY), state.rowResize.row < state.table.columnHeaderLevelCount || state.rowResize.row >= state.table.rowCount - state.table.bottomFrozenRowCount ? updateResizeColForRow(detaY, state) : "indicator" === state.table.internalProps.rowResizeType ? updateResizeColForIndicator(detaY, state) : "indicatorGroup" === state.table.internalProps.rowResizeType ? updateResizeColForIndicatorGroup(detaY, state) : "all" === state.table.internalProps.rowResizeType ? updateResizeColForAll(detaY, state) : updateResizeColForRow(detaY, state), state.rowResize.y = yInTable, state.table.scenegraph.component.updateResizeRow(state.rowResize.row, xInTable, state.rowResize.isBottomFrozen), state.table._updateSize(), state.table.
|
|
53674
|
+
detaY = Math.ceil(detaY), state.rowResize.row < state.table.columnHeaderLevelCount || state.rowResize.row >= state.table.rowCount - state.table.bottomFrozenRowCount ? updateResizeColForRow(detaY, state) : "indicator" === state.table.internalProps.rowResizeType ? updateResizeColForIndicator(detaY, state) : "indicatorGroup" === state.table.internalProps.rowResizeType ? updateResizeColForIndicatorGroup(detaY, state) : "all" === state.table.internalProps.rowResizeType ? updateResizeColForAll(detaY, state) : updateResizeColForRow(detaY, state), state.rowResize.y = yInTable, state.table.scenegraph.component.updateResizeRow(state.rowResize.row, xInTable, state.rowResize.isBottomFrozen), state.table._updateSize(), null === (_a = state.table.internalProps.legends) || void 0 === _a || _a.forEach(legend => {
|
|
53675
|
+
null == legend || legend.resize();
|
|
53676
|
+
}), state.table.internalProps.title && state.table.internalProps.title.resize(), state.table.internalProps.emptyTip && state.table.internalProps.emptyTip.resize(), state.table.scenegraph.updateNextFrame();
|
|
53251
53677
|
}
|
|
53252
53678
|
function updateResizeColForRow(detaY, state) {
|
|
53253
53679
|
"adaptive" === state.table.heightMode && state.rowResize.row < state.table.rowCount - 1 ? (state.table.scenegraph.updateRowHeight(state.rowResize.row, detaY), state.table.scenegraph.updateRowHeight(state.rowResize.row + 1, -detaY), state.table.internalProps._heightResizedRowMap.add(state.rowResize.row), state.table.internalProps._heightResizedRowMap.add(state.rowResize.row + 1)) : (state.table.scenegraph.updateRowHeight(state.rowResize.row, detaY), state.table.internalProps._heightResizedRowMap.add(state.rowResize.row));
|
|
@@ -53419,7 +53845,8 @@
|
|
|
53419
53845
|
rowTargetSize: 0,
|
|
53420
53846
|
x: 0,
|
|
53421
53847
|
y: 0,
|
|
53422
|
-
moving: !1
|
|
53848
|
+
moving: !1,
|
|
53849
|
+
movingColumnOrRow: void 0
|
|
53423
53850
|
}, this.menu = {
|
|
53424
53851
|
x: -1,
|
|
53425
53852
|
y: -1,
|
|
@@ -53486,7 +53913,8 @@
|
|
|
53486
53913
|
rowTargetSize: 0,
|
|
53487
53914
|
x: 0,
|
|
53488
53915
|
y: 0,
|
|
53489
|
-
moving: !1
|
|
53916
|
+
moving: !1,
|
|
53917
|
+
movingColumnOrRow: void 0
|
|
53490
53918
|
}, this.menu = {
|
|
53491
53919
|
x: -1,
|
|
53492
53920
|
y: -1,
|
|
@@ -53653,7 +54081,7 @@
|
|
|
53653
54081
|
if (this.select.selecting) {
|
|
53654
54082
|
if (this.select.selecting = !1, 0 === this.select.ranges.length) return;
|
|
53655
54083
|
const currentRange = this.select.ranges[this.select.ranges.length - 1];
|
|
53656
|
-
this.table.isSeriesNumber(this.select.cellPos.col, this.select.cellPos.row) || this.table.isHeader(this.select.cellPos.col, this.select.cellPos.row) || expendCellRange(currentRange, this.table);
|
|
54084
|
+
this.table.isSeriesNumber(this.select.cellPos.col, this.select.cellPos.row) || this.table.isHeader(this.select.cellPos.col, this.select.cellPos.row) || this.table.isSeriesNumberInBody(currentRange.start.col, currentRange.start.row) || expendCellRange(currentRange, this.table);
|
|
53657
54085
|
let isSame = !1;
|
|
53658
54086
|
for (let i = 0; i < this.select.ranges.length - 1; i++) {
|
|
53659
54087
|
const range = this.select.ranges[i];
|
|
@@ -53709,8 +54137,8 @@
|
|
|
53709
54137
|
direction: this.fillHandle.direction
|
|
53710
54138
|
}), this.fillHandle.beforeFillMaxCol = void 0, this.fillHandle.beforeFillMaxRow = void 0, this.fillHandle.beforeFillMinCol = void 0, this.fillHandle.beforeFillMinRow = void 0;
|
|
53711
54139
|
}
|
|
53712
|
-
startMoveCol(col, row, x, y, event) {
|
|
53713
|
-
startMoveCol(col, row, x, y, this, event);
|
|
54140
|
+
startMoveCol(col, row, x, y, event, dragColumnOrRow) {
|
|
54141
|
+
startMoveCol(col, row, x, y, this, event, dragColumnOrRow);
|
|
53714
54142
|
}
|
|
53715
54143
|
updateMoveCol(col, row, x, y, event) {
|
|
53716
54144
|
updateMoveCol(col, row, x, y, this, event);
|
|
@@ -54367,7 +54795,7 @@
|
|
|
54367
54795
|
this.scrollHandle = scrollHandle;
|
|
54368
54796
|
}
|
|
54369
54797
|
startInertia(speedX, speedY, friction) {
|
|
54370
|
-
this.lastTime = Date.now(), this.speedX = speedX, this.speedY = speedY, this.friction = friction, this.runingId || (this.runingId =
|
|
54798
|
+
this.lastTime = Date.now(), this.speedX = speedX, this.speedY = speedY, this.friction = friction, this.runingId || (this.runingId = vglobal.getRequestAnimationFrame()(this.inertia.bind(this)));
|
|
54371
54799
|
}
|
|
54372
54800
|
inertia() {
|
|
54373
54801
|
var _a;
|
|
@@ -54379,10 +54807,10 @@
|
|
|
54379
54807
|
newSpeedY = f * this.speedY;
|
|
54380
54808
|
let dx = 0,
|
|
54381
54809
|
dy = 0;
|
|
54382
|
-
Math.abs(newSpeedX) > .05 && (stopped = !1, dx = (this.speedX + newSpeedX) / 2 * dffTime), Math.abs(newSpeedY) > .05 && (stopped = !1, dy = (this.speedY + newSpeedY) / 2 * dffTime), null === (_a = this.scrollHandle) || void 0 === _a || _a.call(this, dx, dy), stopped ? this.runingId = null : (this.lastTime = now, this.speedX = newSpeedX, this.speedY = newSpeedY, this.runingId =
|
|
54810
|
+
Math.abs(newSpeedX) > .05 && (stopped = !1, dx = (this.speedX + newSpeedX) / 2 * dffTime), Math.abs(newSpeedY) > .05 && (stopped = !1, dy = (this.speedY + newSpeedY) / 2 * dffTime), null === (_a = this.scrollHandle) || void 0 === _a || _a.call(this, dx, dy), stopped ? this.runingId = null : (this.lastTime = now, this.speedX = newSpeedX, this.speedY = newSpeedY, this.runingId = vglobal.getRequestAnimationFrame()(this.inertia.bind(this)));
|
|
54383
54811
|
}
|
|
54384
54812
|
endInertia() {
|
|
54385
|
-
|
|
54813
|
+
vglobal.getCancelAnimationFrame()(this.runingId), this.runingId = null;
|
|
54386
54814
|
}
|
|
54387
54815
|
isInertiaScrolling() {
|
|
54388
54816
|
return !!this.runingId;
|
|
@@ -54397,7 +54825,8 @@
|
|
|
54397
54825
|
colSource: colSource,
|
|
54398
54826
|
rowSource: rowSource,
|
|
54399
54827
|
colTarget: colTarget,
|
|
54400
|
-
rowTarget: rowTarget
|
|
54828
|
+
rowTarget: rowTarget,
|
|
54829
|
+
movingColumnOrRow: movingColumnOrRow
|
|
54401
54830
|
} = table.stateManager.columnMove,
|
|
54402
54831
|
rowSourceSize = null !== (_e = table.stateManager.columnMove.rowSourceSize) && void 0 !== _e ? _e : 0,
|
|
54403
54832
|
rowTargetSize = null !== (_f = table.stateManager.columnMove.rowTargetSize) && void 0 !== _f ? _f : 0;
|
|
@@ -54410,6 +54839,7 @@
|
|
|
54410
54839
|
col: colSource,
|
|
54411
54840
|
row: rowSource
|
|
54412
54841
|
},
|
|
54842
|
+
movingColumnOrRow: movingColumnOrRow,
|
|
54413
54843
|
event: e
|
|
54414
54844
|
});
|
|
54415
54845
|
}
|
|
@@ -54425,6 +54855,7 @@
|
|
|
54425
54855
|
col: table.stateManager.columnMove.colSource,
|
|
54426
54856
|
row: table.stateManager.columnMove.rowSource
|
|
54427
54857
|
},
|
|
54858
|
+
movingColumnOrRow: table.stateManager.columnMove.movingColumnOrRow,
|
|
54428
54859
|
event: e
|
|
54429
54860
|
});
|
|
54430
54861
|
}
|
|
@@ -54450,7 +54881,7 @@
|
|
|
54450
54881
|
event: e.nativeEvent,
|
|
54451
54882
|
target: null === (_e = null == eventArgsSet ? void 0 : eventArgsSet.eventArgs) || void 0 === _e ? void 0 : _e.target,
|
|
54452
54883
|
mergeCellInfo: null === (_f = eventArgsSet.eventArgs) || void 0 === _f ? void 0 : _f.mergeInfo
|
|
54453
|
-
}), stateManager.interactionState === InteractionState.grabing) return void (Math.abs(lastX - e.x) + Math.abs(lastY - e.y) >= 1 && (stateManager.isResizeCol() || stateManager.isResizeRow() ||
|
|
54884
|
+
}), stateManager.interactionState === InteractionState.grabing) return void (Math.abs(lastX - e.x) + Math.abs(lastY - e.y) >= 1 && (stateManager.isResizeCol() || stateManager.isResizeRow() || stateManager.isMoveCol() || (stateManager.isFillHandle() ? eventManager.dealFillSelect(eventArgsSet, !0) : (null === (_g = table.options.select) || void 0 === _g ? void 0 : _g.disableDragSelect) || eventManager.dealTableSelect(eventArgsSet, !0))));
|
|
54454
54885
|
!(null === (_h = table.options.select) || void 0 === _h ? void 0 : _h.disableDragSelect) && table.eventManager.isDraging && stateManager.isSelecting() && !(null === (_j = table.editorManager) || void 0 === _j ? void 0 : _j.editingEditor) && eventManager.dealTableSelect(eventArgsSet, !0);
|
|
54455
54886
|
const cellGoup = e.path.find(node => "cell" === node.role);
|
|
54456
54887
|
if (table.hasListeners(TABLE_EVENT_TYPE.MOUSELEAVE_CELL) && (-1 === table.stateManager.hover.cellPos.col || -1 === table.stateManager.hover.cellPos.row || (null == cellGoup ? void 0 : cellGoup.col) === table.stateManager.hover.cellPos.col && (null == cellGoup ? void 0 : cellGoup.row) === table.stateManager.hover.cellPos.row || table.fireListeners(TABLE_EVENT_TYPE.MOUSELEAVE_CELL, {
|
|
@@ -55120,7 +55551,7 @@
|
|
|
55120
55551
|
!1 !== (null === (_a = table.eventOptions) || void 0 === _a ? void 0 : _a.preventDefaultContextMenu) ? e.preventDefault() : globalPointerupCallback(e);
|
|
55121
55552
|
}), table.options.canvas || handler.on(table.getContainer(), "resize", e => {
|
|
55122
55553
|
var _a;
|
|
55123
|
-
table.isReleased || 0 === e.width && 0 === e.height || ((table.autoFillWidth || table.autoFillHeight) && (null === (_a = table.editorManager) || void 0 === _a || _a.completeEdit()), isValid$4(table.options.pixelRatio) || table.setPixelRatio(getPixelRatio()), e.windowSizeNotChange || table.resize());
|
|
55554
|
+
table.isReleased || 0 === e.width && 0 === e.height || ((table.autoFillWidth || table.autoFillHeight || "adaptive" === table.widthMode || "adaptive" === table.heightMode) && (null === (_a = table.editorManager) || void 0 === _a || _a.completeEdit()), isValid$4(table.options.pixelRatio) || table.setPixelRatio(getPixelRatio()), e.windowSizeNotChange || table.resize());
|
|
55124
55555
|
});
|
|
55125
55556
|
const globalPointerdownCallback = e => {
|
|
55126
55557
|
var _a;
|
|
@@ -55202,10 +55633,10 @@
|
|
|
55202
55633
|
stateManager.interactionState === InteractionState.grabing && (stateManager.isResizeCol() ? (eventManager.dealColumnResize(x, y), table.hasListeners(TABLE_EVENT_TYPE.RESIZE_COLUMN) && table.fireListeners(TABLE_EVENT_TYPE.RESIZE_COLUMN, {
|
|
55203
55634
|
col: table.stateManager.columnResize.col,
|
|
55204
55635
|
colWidth: table.getColWidth(table.stateManager.columnResize.col)
|
|
55205
|
-
})) : stateManager.isResizeRow()
|
|
55636
|
+
})) : stateManager.isResizeRow() ? (eventManager.dealRowResize(x, y), table.hasListeners(TABLE_EVENT_TYPE.RESIZE_ROW) && table.fireListeners(TABLE_EVENT_TYPE.RESIZE_ROW, {
|
|
55206
55637
|
row: table.stateManager.rowResize.row,
|
|
55207
55638
|
rowHeight: table.getRowHeight(table.stateManager.rowResize.row)
|
|
55208
|
-
})));
|
|
55639
|
+
})) : stateManager.isMoveCol() && eventManager.dealColumnMover(x, y, e));
|
|
55209
55640
|
const isSelecting = table.stateManager.isSelecting();
|
|
55210
55641
|
if (eventManager._enableTableScroll && eventManager.isDraging && isSelecting && (null === (_e = table.stateManager.select.ranges) || void 0 === _e ? void 0 : _e.length) > 0) {
|
|
55211
55642
|
const drawRange = table.getDrawRange(),
|
|
@@ -55819,12 +56250,10 @@
|
|
|
55819
56250
|
} = eventArgsSet;
|
|
55820
56251
|
return !(!eventArgs || !this.table._canDragHeaderPosition(eventArgs.col, eventArgs.row)) && (this.table.stateManager.startMoveCol(eventArgs.col, eventArgs.row, eventArgsSet.abstractPos.x, eventArgsSet.abstractPos.y, null === (_a = null == eventArgs ? void 0 : eventArgs.event) || void 0 === _a ? void 0 : _a.nativeEvent), !0);
|
|
55821
56252
|
}
|
|
55822
|
-
dealColumnMover(
|
|
55823
|
-
|
|
55824
|
-
|
|
55825
|
-
|
|
55826
|
-
} = eventArgsSet;
|
|
55827
|
-
isValid$4(eventArgs.col) && isValid$4(eventArgs.row) && this.table.stateManager.updateMoveCol(eventArgs.col, eventArgs.row, eventArgsSet.abstractPos.x, eventArgsSet.abstractPos.y, null === (_a = null == eventArgs ? void 0 : eventArgs.event) || void 0 === _a ? void 0 : _a.nativeEvent);
|
|
56253
|
+
dealColumnMover(x, y, event) {
|
|
56254
|
+
let col = this.table.getColAtRelativePosition(x),
|
|
56255
|
+
row = this.table.getRowAtRelativePosition(y);
|
|
56256
|
+
-1 === col && "row" === this.table.stateManager.columnMove.movingColumnOrRow && (col = 0), -1 === row && "column" === this.table.stateManager.columnMove.movingColumnOrRow && (row = 0), isValid$4(col) && isValid$4(row) && this.table.stateManager.updateMoveCol(col, row, x, y, event);
|
|
55828
56257
|
}
|
|
55829
56258
|
startColumnResize(eventArgsSet) {}
|
|
55830
56259
|
dealIconClick(e, eventArgsSet) {
|
|
@@ -57291,12 +57720,12 @@
|
|
|
57291
57720
|
clearRange() {
|
|
57292
57721
|
this.cumulativeSum.clear(), this.difference.clear();
|
|
57293
57722
|
}
|
|
57294
|
-
|
|
57723
|
+
_add(position, value) {
|
|
57295
57724
|
if (!isValid$4(value)) return;
|
|
57296
57725
|
const defaultValue = this.table.getRowHeight(position);
|
|
57297
57726
|
this.data.has(position) || (this._keys.push(position), this._sorted = !1), this.data.set(position, value), this.totalSum += value, this.updateDifference(position, value - defaultValue);
|
|
57298
57727
|
}
|
|
57299
|
-
|
|
57728
|
+
_remove(position) {
|
|
57300
57729
|
if (this.data.has(position)) {
|
|
57301
57730
|
const value = this.data.get(position);
|
|
57302
57731
|
this.data.delete(position);
|
|
@@ -57313,7 +57742,7 @@
|
|
|
57313
57742
|
this.data.set(position, newValue);
|
|
57314
57743
|
const difference = newValue - oldValue;
|
|
57315
57744
|
this.totalSum += difference, this.updateDifference(position, difference);
|
|
57316
|
-
} else this.
|
|
57745
|
+
} else this._add(position, newValue);
|
|
57317
57746
|
}
|
|
57318
57747
|
get(position) {
|
|
57319
57748
|
return this.data.get(position);
|
|
@@ -57380,21 +57809,38 @@
|
|
|
57380
57809
|
}
|
|
57381
57810
|
insert(position, value) {
|
|
57382
57811
|
for (let i = position; i <= this.getLastIndex(); i++) this.cumulativeSum.delete(i);
|
|
57383
|
-
const lastIndex = this.getLastIndex() + 1
|
|
57384
|
-
|
|
57812
|
+
const lastIndex = this.getLastIndex() + 1,
|
|
57813
|
+
values = [];
|
|
57814
|
+
for (let i = position; i <= lastIndex; i++) this.has(i) && (values.push({
|
|
57815
|
+
position: i,
|
|
57816
|
+
value: this.get(i)
|
|
57817
|
+
}), this._remove(i));
|
|
57818
|
+
isValid$4(value) && this.put(position, value);
|
|
57819
|
+
for (const {
|
|
57820
|
+
position: position,
|
|
57821
|
+
value: value
|
|
57822
|
+
} of values) this.put(position + 1, value);
|
|
57385
57823
|
}
|
|
57386
57824
|
getLastIndex() {
|
|
57387
57825
|
return this._sort(), this._keys[this._keys.length - 1];
|
|
57388
57826
|
}
|
|
57389
57827
|
delLast() {
|
|
57390
57828
|
const lastIndex = this.getLastIndex();
|
|
57391
|
-
this.
|
|
57829
|
+
this._remove(lastIndex);
|
|
57392
57830
|
}
|
|
57393
57831
|
delete(position) {
|
|
57394
|
-
if (!this.has(position)) return;
|
|
57395
57832
|
for (let i = position; i <= this.getLastIndex(); i++) this.cumulativeSum.delete(i);
|
|
57396
57833
|
const lastIndex = this.getLastIndex();
|
|
57397
|
-
this.
|
|
57834
|
+
this.has(position) && this._remove(position);
|
|
57835
|
+
const values = [];
|
|
57836
|
+
for (let i = position + 1; i <= lastIndex; i++) this.has(i) && values.push({
|
|
57837
|
+
position: i,
|
|
57838
|
+
value: this.get(i)
|
|
57839
|
+
});
|
|
57840
|
+
for (const {
|
|
57841
|
+
position: position,
|
|
57842
|
+
value: value
|
|
57843
|
+
} of values) this._remove(position), this._add(position - 1, value);
|
|
57398
57844
|
}
|
|
57399
57845
|
adjustOrder(sourceIndex, targetIndex, moveCount) {
|
|
57400
57846
|
this.clearRange(), this._sort();
|
|
@@ -57422,28 +57868,12 @@
|
|
|
57422
57868
|
}
|
|
57423
57869
|
}
|
|
57424
57870
|
exchangeOrder(sourceIndex, sourceCount, targetIndex, targetCount, insertIndex) {
|
|
57425
|
-
const
|
|
57426
|
-
|
|
57427
|
-
|
|
57428
|
-
|
|
57429
|
-
|
|
57430
|
-
|
|
57431
|
-
for (let i = indexFirst(keys, targetIndex); i < indexFirst(keys, sourceIndex) + sourceCount; i++) {
|
|
57432
|
-
const key = keys[i];
|
|
57433
|
-
key >= sourceIndex && key < sourceIndex + sourceCount ? sourceVals.push(this.get(key)) : targetVals.push(this.get(key));
|
|
57434
|
-
}
|
|
57435
|
-
for (let i = 0; i < sourceCount; i++) this.put(insertIndex + i, sourceVals[i]);
|
|
57436
|
-
for (let i = 0; i < targetVals.length; i++) this.put(insertIndex + sourceCount + i, targetVals[i]);
|
|
57437
|
-
} else {
|
|
57438
|
-
const targetVals = [],
|
|
57439
|
-
sourceVals = [];
|
|
57440
|
-
for (let i = indexFirst(keys, sourceIndex); i < indexFirst(keys, targetIndex) + targetCount; i++) {
|
|
57441
|
-
const key = keys[i];
|
|
57442
|
-
key >= sourceIndex && key < sourceIndex + sourceCount ? sourceVals.push(this.get(key)) : targetVals.push(this.get(key));
|
|
57443
|
-
}
|
|
57444
|
-
for (let i = 0; i < sourceCount; i++) this.put(insertIndex + i, sourceVals[i]);
|
|
57445
|
-
for (let i = 0; i < targetVals.length; i++) this.put(sourceIndex + i, targetVals[i]);
|
|
57446
|
-
}
|
|
57871
|
+
const values = [];
|
|
57872
|
+
for (let i = sourceIndex + sourceCount - 1; i >= sourceIndex; i--) values.push({
|
|
57873
|
+
position: i,
|
|
57874
|
+
value: this.get(i)
|
|
57875
|
+
}), this.delete(i);
|
|
57876
|
+
for (let i = 0; i < sourceCount; i++) this.insert(insertIndex, values[i].value);
|
|
57447
57877
|
}
|
|
57448
57878
|
}
|
|
57449
57879
|
function indexFirst(arr, elm) {
|
|
@@ -57454,7 +57884,8 @@
|
|
|
57454
57884
|
if (arr[i] === elm) return i;
|
|
57455
57885
|
arr[i] > elm ? high = i - 1 : low = i + 1;
|
|
57456
57886
|
}
|
|
57457
|
-
|
|
57887
|
+
const tempI = high < 0 ? 0 : high;
|
|
57888
|
+
return arr[tempI] === elm ? tempI : -1;
|
|
57458
57889
|
}
|
|
57459
57890
|
|
|
57460
57891
|
class RowSeriesNumberHelper {
|
|
@@ -57870,6 +58301,34 @@
|
|
|
57870
58301
|
row: -1
|
|
57871
58302
|
};
|
|
57872
58303
|
}
|
|
58304
|
+
function getColAtRelativePosition(x, _this) {
|
|
58305
|
+
let leftFrozen = !1;
|
|
58306
|
+
(x -= _this.tableX) > 0 && x < _this.getFrozenColsWidth() && (leftFrozen = !0);
|
|
58307
|
+
let rightFrozen = !1;
|
|
58308
|
+
x > _this.tableNoFrameWidth - _this.getRightFrozenColsWidth() && x < _this.tableNoFrameWidth && x <= _this.getAllColsWidth() && (rightFrozen = !0);
|
|
58309
|
+
const colInfo = getTargetColAtConsiderRightFrozen((leftFrozen || rightFrozen ? x : x + _this.scrollLeft) + _this.tableX, rightFrozen, _this);
|
|
58310
|
+
if (colInfo) {
|
|
58311
|
+
const {
|
|
58312
|
+
col: col
|
|
58313
|
+
} = colInfo;
|
|
58314
|
+
return col;
|
|
58315
|
+
}
|
|
58316
|
+
return -1;
|
|
58317
|
+
}
|
|
58318
|
+
function getRowAtRelativePosition(y, _this) {
|
|
58319
|
+
let topFrozen = !1;
|
|
58320
|
+
(y -= _this.tableY) > 0 && y < _this.getFrozenRowsHeight() && (topFrozen = !0);
|
|
58321
|
+
let bottomFrozen = !1;
|
|
58322
|
+
y > _this.tableNoFrameHeight - _this.getBottomFrozenRowsHeight() && y < _this.tableNoFrameHeight && y <= _this.getAllRowsHeight() && (bottomFrozen = !0);
|
|
58323
|
+
const rowInfo = getTargetRowAtConsiderBottomFrozen((topFrozen || bottomFrozen ? y : y + _this.scrollTop) + _this.tableY, bottomFrozen, _this);
|
|
58324
|
+
if (rowInfo) {
|
|
58325
|
+
const {
|
|
58326
|
+
row: row
|
|
58327
|
+
} = rowInfo;
|
|
58328
|
+
return row;
|
|
58329
|
+
}
|
|
58330
|
+
return -1;
|
|
58331
|
+
}
|
|
57873
58332
|
|
|
57874
58333
|
function isValidAlignDomain(domain) {
|
|
57875
58334
|
return 2 === domain.length && isValidNumber$1(domain[0]) && isValidNumber$1(domain[1]) && domain[1] >= domain[0];
|
|
@@ -58788,7 +59247,7 @@
|
|
|
58788
59247
|
}
|
|
58789
59248
|
constructor(container, options = {}) {
|
|
58790
59249
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
|
|
58791
|
-
if (super(), this.showFrozenIcon = !0, this.version = "1.22.
|
|
59250
|
+
if (super(), this.showFrozenIcon = !0, this.version = "1.22.2", this.id = `VTable${Date.now()}`, this.isReleased = !1, this._chartEventMap = {}, this.throttleInvalidate = throttle2(this.render.bind(this), 200), "node" === Env$1.mode ? (options = container, container = null) : container instanceof HTMLElement || (options = container, container = container.container ? container.container : null), !container && "node" !== options.mode && !options.canvas) throw new Error("vtable's container is undefined");
|
|
58792
59251
|
this.pluginManager = new PluginManager(this, options), this.fireListeners(TABLE_EVENT_TYPE.BEFORE_INIT, {
|
|
58793
59252
|
options: options,
|
|
58794
59253
|
container: container
|
|
@@ -59540,6 +59999,12 @@
|
|
|
59540
59999
|
getCellAtRelativePosition(relativeX, relativeY) {
|
|
59541
60000
|
return getCellAtRelativePosition(relativeX, relativeY, this);
|
|
59542
60001
|
}
|
|
60002
|
+
getColAtRelativePosition(relativeX) {
|
|
60003
|
+
return getColAtRelativePosition(relativeX, this);
|
|
60004
|
+
}
|
|
60005
|
+
getRowAtRelativePosition(relativeY) {
|
|
60006
|
+
return getRowAtRelativePosition(relativeY, this);
|
|
60007
|
+
}
|
|
59543
60008
|
_checkRowCol(col, row) {
|
|
59544
60009
|
return col >= 0 && col < this.colCount && row >= 0 && row < this.rowCount;
|
|
59545
60010
|
}
|
|
@@ -60923,6 +61388,22 @@
|
|
|
60923
61388
|
height: !1
|
|
60924
61389
|
};
|
|
60925
61390
|
}
|
|
61391
|
+
isColumnSelected(col) {
|
|
61392
|
+
const selectRange = this.stateManager.select.ranges;
|
|
61393
|
+
for (let i = 0; i <= selectRange.length - 1; i++) {
|
|
61394
|
+
const range = selectRange[i];
|
|
61395
|
+
if (range.start.col <= col && range.end.col >= col && 0 === range.start.row && range.end.row === this.rowCount - 1) return !0;
|
|
61396
|
+
}
|
|
61397
|
+
return !1;
|
|
61398
|
+
}
|
|
61399
|
+
isRowSelected(row) {
|
|
61400
|
+
const selectRange = this.stateManager.select.ranges;
|
|
61401
|
+
for (let i = 0; i <= selectRange.length - 1; i++) {
|
|
61402
|
+
const range = selectRange[i];
|
|
61403
|
+
if (range.start.row <= row && range.end.row >= row && 0 === range.start.col && range.end.col === this.colCount - 1) return !0;
|
|
61404
|
+
}
|
|
61405
|
+
return !1;
|
|
61406
|
+
}
|
|
60926
61407
|
}
|
|
60927
61408
|
|
|
60928
61409
|
const chartTypes = {};
|
|
@@ -62950,13 +63431,14 @@
|
|
|
62950
63431
|
}
|
|
62951
63432
|
}
|
|
62952
63433
|
canMoveHeaderPosition(source, target) {
|
|
63434
|
+
const dragColumnOrRow = this._table.stateManager.columnMove.movingColumnOrRow;
|
|
62953
63435
|
if (this.isSeriesNumberInHeader(target.col, target.row) || this.isSeriesNumberInHeader(source.col, source.row)) return !1;
|
|
62954
|
-
if (!this.transpose && this.isSeriesNumberInBody(target.col, target.row) && this.isSeriesNumberInBody(source.col, source.row)) {
|
|
63436
|
+
if (!this.transpose && (this.isSeriesNumberInBody(target.col, target.row) && this.isSeriesNumberInBody(source.col, source.row) || "row" === dragColumnOrRow)) {
|
|
62955
63437
|
const sourceIndex = this.getRecordShowIndexByCell(0, source.row),
|
|
62956
63438
|
targetIndex = this.getRecordShowIndexByCell(0, target.row);
|
|
62957
63439
|
return this._table.dataSource.canChangeOrder(sourceIndex, targetIndex);
|
|
62958
63440
|
}
|
|
62959
|
-
if (this.transpose && this.isSeriesNumberInBody(target.col, target.row) && this.isSeriesNumberInBody(source.col, source.row) && (this.getBody(source.col + this.leftRowSeriesNumberColumnCount, source.row).isChildNode && this.getBody(target.col + this.leftRowSeriesNumberColumnCount, target.row).isChildNode ? (source.col = source.col + this.leftRowSeriesNumberColumnCount + this.rowHeaderLevelCount - 1, target.col = target.col + this.leftRowSeriesNumberColumnCount + this.rowHeaderLevelCount - 1) : (source.col = source.col + this.leftRowSeriesNumberColumnCount, target.col = target.col + this.leftRowSeriesNumberColumnCount)), source.col < 0 || source.row < 0 || target.col < 0 || target.row < 0) return !1;
|
|
63441
|
+
if (this.transpose && (this.isSeriesNumberInBody(target.col, target.row) && this.isSeriesNumberInBody(source.col, source.row) || "row" === dragColumnOrRow) && (this.getBody(source.col + this.leftRowSeriesNumberColumnCount, source.row).isChildNode && this.getBody(target.col + this.leftRowSeriesNumberColumnCount, target.row).isChildNode ? (source.col = source.col + this.leftRowSeriesNumberColumnCount + this.rowHeaderLevelCount - 1, target.col = target.col + this.leftRowSeriesNumberColumnCount + this.rowHeaderLevelCount - 1) : (source.col = source.col + this.leftRowSeriesNumberColumnCount, target.col = target.col + this.leftRowSeriesNumberColumnCount)), source.col < 0 || source.row < 0 || target.col < 0 || target.row < 0) return !1;
|
|
62960
63442
|
if ("disabled" === this._table.internalProps.frozenColDragHeaderMode && this._table.isFrozenColumn(target.col)) return !1;
|
|
62961
63443
|
const sourceCellRange = this.getCellRange(source.col, source.row);
|
|
62962
63444
|
if (this.isColumnHeader(source.col, source.row)) {
|
|
@@ -62968,7 +63450,7 @@
|
|
|
62968
63450
|
return !1;
|
|
62969
63451
|
}
|
|
62970
63452
|
moveHeaderPosition(source, target) {
|
|
62971
|
-
var _a, _b;
|
|
63453
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
62972
63454
|
if ((!(null === (_a = this._table.options.dragOrder) || void 0 === _a ? void 0 : _a.validateDragOrderOnEnd) || (null === (_b = this._table.options.dragOrder) || void 0 === _b ? void 0 : _b.validateDragOrderOnEnd(source, target))) && this.canMoveHeaderPosition(source, target)) {
|
|
62973
63455
|
let sourceCellRange = this.getCellRange(source.col, source.row);
|
|
62974
63456
|
if (this.isColumnHeader(source.col, source.row)) {
|
|
@@ -62980,8 +63462,18 @@
|
|
|
62980
63462
|
const sourceIds = this._headerCellIds[row].splice(sourceCellRange.start.col - this.leftRowSeriesNumberColumnCount, sourceSize);
|
|
62981
63463
|
sourceIds.unshift(targetIndex - this.leftRowSeriesNumberColumnCount, 0), Array.prototype.splice.apply(this._headerCellIds[row], sourceIds);
|
|
62982
63464
|
}
|
|
63465
|
+
if (null === (_c = this._table.options.dragOrder) || void 0 === _c ? void 0 : _c.maintainArrayDataOrder) for (let j = 0; j < (null === (_d = this._table.dataSource.dataSourceObj) || void 0 === _d ? void 0 : _d.records.length); j++) {
|
|
63466
|
+
const rowRecords = null === (_e = this._table.dataSource.dataSourceObj) || void 0 === _e ? void 0 : _e.records[j];
|
|
63467
|
+
if (Array.isArray(rowRecords)) {
|
|
63468
|
+
rowRecords.length - 1 < targetIndex && rowRecords.push(...Array(targetIndex - rowRecords.length + 1).fill(void 0));
|
|
63469
|
+
const sourceData = rowRecords.splice(sourceCellRange.start.col - this.leftRowSeriesNumberColumnCount, sourceSize);
|
|
63470
|
+
sourceData.unshift(targetIndex - this.leftRowSeriesNumberColumnCount, 0), Array.prototype.splice.apply(rowRecords, sourceData);
|
|
63471
|
+
}
|
|
63472
|
+
}
|
|
62983
63473
|
const sourceColumns = this._columns.splice(sourceCellRange.start.col - this.leftRowSeriesNumberColumnCount, sourceSize);
|
|
62984
|
-
|
|
63474
|
+
if (sourceColumns.unshift(targetIndex - this.leftRowSeriesNumberColumnCount, 0), Array.prototype.splice.apply(this._columns, sourceColumns), null === (_f = this._table.options.dragOrder) || void 0 === _f ? void 0 : _f.maintainArrayDataOrder) for (let i = 0; i < this._columns.length; i++) this._columns[i].field = i;
|
|
63475
|
+
if (this.columnTree.movePosition(sourceCellRange.start.row, sourceCellRange.start.col - this.leftRowSeriesNumberColumnCount, targetIndex - this.leftRowSeriesNumberColumnCount), null === (_g = this._table.options.dragOrder) || void 0 === _g ? void 0 : _g.maintainArrayDataOrder) for (let i = 0; i < this.columnTree.tree.children.length; i++) this.columnTree.tree.children[i].field = i;
|
|
63476
|
+
return this.columnTree.reset(this.columnTree.tree.children), this._cellRangeMap = new Map(), {
|
|
62985
63477
|
sourceIndex: sourceCellRange.start.col,
|
|
62986
63478
|
targetIndex: targetIndex,
|
|
62987
63479
|
sourceSize: sourceSize,
|
|
@@ -63008,7 +63500,7 @@
|
|
|
63008
63500
|
moveType: "row"
|
|
63009
63501
|
};
|
|
63010
63502
|
}
|
|
63011
|
-
if (this.isSeriesNumberInBody(source.col, source.row)) return {
|
|
63503
|
+
if (this.isSeriesNumberInBody(source.col, source.row) || "row" === this._table.stateManager.columnMove.movingColumnOrRow) return {
|
|
63012
63504
|
sourceIndex: source.row,
|
|
63013
63505
|
targetIndex: target.row,
|
|
63014
63506
|
sourceSize: 1,
|
|
@@ -63980,14 +64472,17 @@
|
|
|
63980
64472
|
get recordsCount() {
|
|
63981
64473
|
return this.dataSource.records.length;
|
|
63982
64474
|
}
|
|
63983
|
-
updateColumns(columns, options
|
|
64475
|
+
updateColumns(columns, options = {
|
|
64476
|
+
clearColWidthCache: !1,
|
|
64477
|
+
clearRowHeightCache: !0
|
|
64478
|
+
}) {
|
|
63984
64479
|
var _a, _b, _c, _d;
|
|
63985
64480
|
this.scenegraph.clearCells();
|
|
63986
64481
|
const oldHoverState = {
|
|
63987
64482
|
col: this.stateManager.hover.cellPos.col,
|
|
63988
64483
|
row: this.stateManager.hover.cellPos.row
|
|
63989
64484
|
};
|
|
63990
|
-
this.internalProps.columns = cloneDeepSpec(columns, ["children"]), generateAggregationForColumn(this), (null == options ? void 0 : options.clearColWidthCache) && this.internalProps._widthResizedColMap.clear(), this.options.columns = columns, this.internalProps.headerHelper.setTableColumnsEditor(), this._hasAutoImageColumn = void 0, this.refreshHeader(), null === (_b = (_a = this.dataSource).updateColumns) || void 0 === _b || _b.call(_a, this.internalProps.columns), this.records && checkHasAggregationOnColumnDefine(this.internalProps.columns) && this.dataSource.processRecords(null !== (_d = null === (_c = this.dataSource.dataSourceObj) || void 0 === _c ? void 0 : _c.records) && void 0 !== _d ? _d : this.dataSource.dataSourceObj), this.internalProps.useOneRowHeightFillAll = !1, this.headerStyleCache = new Map(), this.bodyStyleCache = new Map(), this.bodyBottomStyleCache = new Map(), this.scenegraph.createSceneGraph(), this.stateManager.updateHoverPos(oldHoverState.col, oldHoverState.row), this.renderAsync(), this.eventManager.updateEventBinder();
|
|
64485
|
+
this.internalProps.columns = cloneDeepSpec(columns, ["children"]), generateAggregationForColumn(this), (null == options ? void 0 : options.clearColWidthCache) && this.internalProps._widthResizedColMap.clear(), this.options.columns = columns, this.internalProps.headerHelper.setTableColumnsEditor(), this._hasAutoImageColumn = void 0, this.refreshHeader(), null === (_b = (_a = this.dataSource).updateColumns) || void 0 === _b || _b.call(_a, this.internalProps.columns), this.records && checkHasAggregationOnColumnDefine(this.internalProps.columns) && this.dataSource.processRecords(null !== (_d = null === (_c = this.dataSource.dataSourceObj) || void 0 === _c ? void 0 : _c.records) && void 0 !== _d ? _d : this.dataSource.dataSourceObj), this.internalProps.useOneRowHeightFillAll = !1, this.headerStyleCache = new Map(), this.bodyStyleCache = new Map(), this.bodyBottomStyleCache = new Map(), this.scenegraph.createSceneGraph(!(null == options ? void 0 : options.clearRowHeightCache)), this.stateManager.updateHoverPos(oldHoverState.col, oldHoverState.row), this.renderAsync(), this.eventManager.updateEventBinder();
|
|
63991
64486
|
}
|
|
63992
64487
|
_recreateSceneForStateChange() {
|
|
63993
64488
|
var _a, _b;
|
|
@@ -63999,15 +64494,23 @@
|
|
|
63999
64494
|
this._hasAutoImageColumn = void 0, this.refreshHeader(), this.records && checkHasAggregationOnColumnDefine(this.internalProps.columns) && this.dataSource.processRecords(null !== (_b = null === (_a = this.dataSource.dataSourceObj) || void 0 === _a ? void 0 : _a.records) && void 0 !== _b ? _b : this.dataSource.dataSourceObj), this.internalProps.useOneRowHeightFillAll = !1, this.headerStyleCache = new Map(), this.bodyStyleCache = new Map(), this.bodyBottomStyleCache = new Map(), this._updateSize(), this.scenegraph.createSceneGraph(), this.stateManager.updateHoverPos(oldHoverState.col, oldHoverState.row), this.renderAsync(), this.eventManager.updateEventBinder();
|
|
64000
64495
|
}
|
|
64001
64496
|
addColumns(toAddColumns, colIndex, isMaintainArrayData = !0) {
|
|
64497
|
+
var _a;
|
|
64002
64498
|
const columns = this.options.columns;
|
|
64003
|
-
|
|
64499
|
+
void 0 === colIndex ? (colIndex = columns.length, columns.push(...toAddColumns)) : columns.splice(colIndex, 0, ...toAddColumns);
|
|
64500
|
+
for (let i = 0; i < toAddColumns.length; i++) this.colWidthsMap.addAndReorder(colIndex + i, null !== (_a = toAddColumns[i].width) && void 0 !== _a ? _a : this.internalProps.defaultColWidth);
|
|
64501
|
+
this.internalProps._colRangeWidthsMap.clear();
|
|
64502
|
+
const resizedColIndexs = Array.from(this.internalProps._widthResizedColMap.keys());
|
|
64503
|
+
for (let i = 0; i < resizedColIndexs.length; i++) resizedColIndexs[i] >= colIndex && (this.internalProps._widthResizedColMap.delete(resizedColIndexs[i]), this.internalProps._widthResizedColMap.add(resizedColIndexs[i] + toAddColumns.length));
|
|
64504
|
+
if (isMaintainArrayData) {
|
|
64004
64505
|
for (let i = 0; i < columns.length; i++) columns[i].field = i;
|
|
64005
64506
|
for (let i = 0; i < this.records.length; i++) {
|
|
64006
64507
|
const record = this.records[i];
|
|
64007
64508
|
Array.isArray(record) && record.splice(colIndex, 0, ...Array(toAddColumns.length).fill(void 0));
|
|
64008
64509
|
}
|
|
64009
64510
|
}
|
|
64010
|
-
this.updateColumns(columns
|
|
64511
|
+
this.updateColumns(columns, {
|
|
64512
|
+
clearRowHeightCache: !1
|
|
64513
|
+
}), this.fireListeners(TABLE_EVENT_TYPE.ADD_COLUMN, {
|
|
64011
64514
|
columnIndex: colIndex,
|
|
64012
64515
|
columnCount: toAddColumns.length,
|
|
64013
64516
|
columns: columns
|
|
@@ -64016,12 +64519,20 @@
|
|
|
64016
64519
|
deleteColumns(deleteColIndexs, isMaintainArrayData = !0) {
|
|
64017
64520
|
const columns = this.options.columns;
|
|
64018
64521
|
deleteColIndexs.sort((a, b) => b - a);
|
|
64019
|
-
for (let i = 0; i < deleteColIndexs.length; i++) if (columns.splice(deleteColIndexs[i], 1), isMaintainArrayData) for (let j = 0; j < this.records.length; j++) {
|
|
64522
|
+
for (let i = 0; i < deleteColIndexs.length; i++) if (columns.splice(deleteColIndexs[i], 1), this.colWidthsMap.delAndReorder(deleteColIndexs[i]), this.internalProps._widthResizedColMap.delete(deleteColIndexs[i]), isMaintainArrayData) for (let j = 0; j < this.records.length; j++) {
|
|
64020
64523
|
const record = this.records[j];
|
|
64021
64524
|
Array.isArray(record) && record.splice(deleteColIndexs[i], 1);
|
|
64022
64525
|
}
|
|
64526
|
+
this.internalProps._colRangeWidthsMap.clear();
|
|
64527
|
+
const resizedColIndexs = Array.from(this.internalProps._widthResizedColMap.keys());
|
|
64528
|
+
for (let i = 0; i < resizedColIndexs.length; i++) for (let j = 0; j < deleteColIndexs.length; j++) if (resizedColIndexs[i] > deleteColIndexs[j]) {
|
|
64529
|
+
this.internalProps._widthResizedColMap.delete(resizedColIndexs[i]), this.internalProps._widthResizedColMap.add(resizedColIndexs[i] - (deleteColIndexs.length - j));
|
|
64530
|
+
break;
|
|
64531
|
+
}
|
|
64023
64532
|
if (isMaintainArrayData) for (let i = 0; i < columns.length; i++) columns[i].field = i;
|
|
64024
|
-
this.updateColumns(columns
|
|
64533
|
+
this.updateColumns(columns, {
|
|
64534
|
+
clearRowHeightCache: !1
|
|
64535
|
+
}), this.fireListeners(TABLE_EVENT_TYPE.DELETE_COLUMN, {
|
|
64025
64536
|
deleteColIndexs: deleteColIndexs,
|
|
64026
64537
|
columns: columns
|
|
64027
64538
|
});
|
|
@@ -71031,6 +71542,8 @@
|
|
|
71031
71542
|
this.seriesNumberComponent.setAttribute("hover", !0);
|
|
71032
71543
|
}, this.handleResizeRowEnd = e => {
|
|
71033
71544
|
this.seriesNumberComponent.setAttribute("hover", !0);
|
|
71545
|
+
}, this.handleChangeHeaderPosition = e => {
|
|
71546
|
+
this.syncColWidthToComponent();
|
|
71034
71547
|
}, this.handleSeriesNumberCellRightClick = e => {
|
|
71035
71548
|
const {
|
|
71036
71549
|
seriesNumberCell: seriesNumberCell,
|
|
@@ -71140,6 +71653,18 @@
|
|
|
71140
71653
|
event: event
|
|
71141
71654
|
} = e.detail;
|
|
71142
71655
|
this.table.stateManager.updateInteractionState(InteractionState.grabing), this.table.stateManager.startResizeRow(rowIndex, event.viewport.x, event.viewport.y);
|
|
71656
|
+
}, this.handleDragColumOrderStart = e => {
|
|
71657
|
+
const {
|
|
71658
|
+
colIndex: colIndex,
|
|
71659
|
+
event: event
|
|
71660
|
+
} = e.detail;
|
|
71661
|
+
this.table.stateManager.updateInteractionState(InteractionState.grabing), this.table.stateManager.startMoveCol(colIndex, 0, event.viewport.x, event.viewport.y, event.nativeEvent, "column");
|
|
71662
|
+
}, this.handleDragRowOrderStart = e => {
|
|
71663
|
+
const {
|
|
71664
|
+
rowIndex: rowIndex,
|
|
71665
|
+
event: event
|
|
71666
|
+
} = e.detail;
|
|
71667
|
+
this.table.stateManager.updateInteractionState(InteractionState.grabing), this.table.stateManager.startMoveCol(0, rowIndex, event.viewport.x, event.viewport.y, event.nativeEvent, "row");
|
|
71143
71668
|
}, this.pluginOptions = pluginOptions, this.seriesNumberComponent = new TableSeriesNumber$1({
|
|
71144
71669
|
rowCount: pluginOptions.rowCount,
|
|
71145
71670
|
colCount: pluginOptions.colCount,
|
|
@@ -71216,7 +71741,9 @@
|
|
|
71216
71741
|
opacity: 1
|
|
71217
71742
|
}
|
|
71218
71743
|
}
|
|
71219
|
-
}, pluginOptions.cornerCellStyle)
|
|
71744
|
+
}, pluginOptions.cornerCellStyle),
|
|
71745
|
+
checkMoveColumnOrder: colIndex => this.table.isColumnSelected(colIndex),
|
|
71746
|
+
checkMoveRowOrder: rowIndex => this.table.isRowSelected(rowIndex)
|
|
71220
71747
|
}), this.listenComponentEvents();
|
|
71221
71748
|
}
|
|
71222
71749
|
run(...args) {
|
|
@@ -71255,10 +71782,10 @@
|
|
|
71255
71782
|
}
|
|
71256
71783
|
}
|
|
71257
71784
|
listenTableEvents() {
|
|
71258
|
-
this.table.on(TABLE_EVENT_TYPE.SCROLL, this.handleScroll), this.table.on(TABLE_EVENT_TYPE.AFTER_SORT, this.handleAfterSort), this.table.on(TABLE_EVENT_TYPE.SELECTED_CHANGED, this.handleSelectedChanged), this.table.on(TABLE_EVENT_TYPE.RESIZE_COLUMN_END, this.handleResizeColumnEnd), this.table.on(TABLE_EVENT_TYPE.RESIZE_ROW_END, this.handleResizeRowEnd);
|
|
71785
|
+
this.table.on(TABLE_EVENT_TYPE.SCROLL, this.handleScroll), this.table.on(TABLE_EVENT_TYPE.AFTER_SORT, this.handleAfterSort), this.table.on(TABLE_EVENT_TYPE.SELECTED_CHANGED, this.handleSelectedChanged), this.table.on(TABLE_EVENT_TYPE.RESIZE_COLUMN_END, this.handleResizeColumnEnd), this.table.on(TABLE_EVENT_TYPE.RESIZE_ROW_END, this.handleResizeRowEnd), this.table.on(TABLE_EVENT_TYPE.CHANGE_HEADER_POSITION, this.handleChangeHeaderPosition);
|
|
71259
71786
|
}
|
|
71260
71787
|
listenComponentEvents() {
|
|
71261
|
-
this.seriesNumberComponent.on(SeriesNumberEvent.seriesNumberCellRightClick, this.handleSeriesNumberCellRightClick), this.seriesNumberComponent.on(SeriesNumberEvent.seriesNumberCellHover, this.handleSeriesNumberCellHover), this.seriesNumberComponent.on(SeriesNumberEvent.seriesNumberCellUnHover, this.handleSeriesNumberCellUnHover), this.seriesNumberComponent.on(SeriesNumberEvent.seriesNumberCellClick, this.handleSeriesNumberCellClick), this.seriesNumberComponent.on(SeriesNumberEvent.seriesNumberCellClickUp, this.handleSeriesNumberCellClickUp), this.seriesNumberComponent.on(SeriesNumberEvent.rowSeriesNumberWidthChange, this.handleRowSeriesNumberWidthChange), this.seriesNumberComponent.on(SeriesNumberEvent.resizeColWidthStart, this.handleResizeColWidthStart), this.seriesNumberComponent.on(SeriesNumberEvent.resizeRowHeightStart, this.handleResizeRowHeightStart);
|
|
71788
|
+
this.seriesNumberComponent.on(SeriesNumberEvent.seriesNumberCellRightClick, this.handleSeriesNumberCellRightClick), this.seriesNumberComponent.on(SeriesNumberEvent.seriesNumberCellHover, this.handleSeriesNumberCellHover), this.seriesNumberComponent.on(SeriesNumberEvent.seriesNumberCellUnHover, this.handleSeriesNumberCellUnHover), this.seriesNumberComponent.on(SeriesNumberEvent.seriesNumberCellClick, this.handleSeriesNumberCellClick), this.seriesNumberComponent.on(SeriesNumberEvent.seriesNumberCellClickUp, this.handleSeriesNumberCellClickUp), this.seriesNumberComponent.on(SeriesNumberEvent.rowSeriesNumberWidthChange, this.handleRowSeriesNumberWidthChange), this.seriesNumberComponent.on(SeriesNumberEvent.resizeColWidthStart, this.handleResizeColWidthStart), this.seriesNumberComponent.on(SeriesNumberEvent.resizeRowHeightStart, this.handleResizeRowHeightStart), this.seriesNumberComponent.on(SeriesNumberEvent.dragColumnOrderStart, this.handleDragColumOrderStart), this.seriesNumberComponent.on(SeriesNumberEvent.dragRowOrderStart, this.handleDragRowOrderStart);
|
|
71262
71789
|
}
|
|
71263
71790
|
release() {
|
|
71264
71791
|
var _a, _b;
|
|
@@ -71338,10 +71865,20 @@
|
|
|
71338
71865
|
table.eventManager.handlePaste(new KeyboardEvent("paste"));
|
|
71339
71866
|
}
|
|
71340
71867
|
handleInsertRowAbove(table, rowIndex, count = 1) {
|
|
71341
|
-
if (void 0 !== rowIndex && "function" == typeof table.addRecord)
|
|
71868
|
+
if (void 0 !== rowIndex && "function" == typeof table.addRecord) {
|
|
71869
|
+
const records = Array.from({
|
|
71870
|
+
length: count
|
|
71871
|
+
}, (_, i) => []);
|
|
71872
|
+
table.addRecords(records, rowIndex - 1);
|
|
71873
|
+
}
|
|
71342
71874
|
}
|
|
71343
71875
|
handleInsertRowBelow(table, rowIndex, count = 1) {
|
|
71344
|
-
if (void 0 !== rowIndex && "function" == typeof table.addRecord)
|
|
71876
|
+
if (void 0 !== rowIndex && "function" == typeof table.addRecord) {
|
|
71877
|
+
const records = Array.from({
|
|
71878
|
+
length: count
|
|
71879
|
+
}, (_, i) => []);
|
|
71880
|
+
table.addRecords(records, rowIndex);
|
|
71881
|
+
}
|
|
71345
71882
|
}
|
|
71346
71883
|
handleInsertColumnLeft(table, colIndex, count = 1) {
|
|
71347
71884
|
if (void 0 !== colIndex && "function" == typeof table.addColumns) {
|
|
@@ -71361,8 +71898,8 @@
|
|
|
71361
71898
|
table.addColumns(toAddColumns, colIndex + 1, !0);
|
|
71362
71899
|
}
|
|
71363
71900
|
}
|
|
71364
|
-
handleDeleteRow(table
|
|
71365
|
-
if (
|
|
71901
|
+
handleDeleteRow(table) {
|
|
71902
|
+
if ("function" == typeof table.deleteRecords) {
|
|
71366
71903
|
const selectRanges = table.stateManager.select.ranges,
|
|
71367
71904
|
deleteRowIndexs = [];
|
|
71368
71905
|
for (let i = 0; i < selectRanges.length; i++) {
|
|
@@ -71370,10 +71907,12 @@
|
|
|
71370
71907
|
for (let j = range.start.row; j <= range.end.row; j++) deleteRowIndexs.includes(j) || deleteRowIndexs.push(j);
|
|
71371
71908
|
}
|
|
71372
71909
|
deleteRowIndexs.sort((a, b) => b - a);
|
|
71910
|
+
const delRecordIndexs = [];
|
|
71373
71911
|
for (let i = 0; i < deleteRowIndexs.length; i++) {
|
|
71374
71912
|
const recordIndex = table.getRecordIndexByCell(0, deleteRowIndexs[i]);
|
|
71375
|
-
|
|
71913
|
+
delRecordIndexs.push(recordIndex);
|
|
71376
71914
|
}
|
|
71915
|
+
table.deleteRecords(delRecordIndexs);
|
|
71377
71916
|
}
|
|
71378
71917
|
}
|
|
71379
71918
|
handleDeleteColumn(table, colIndex) {
|
|
@@ -71525,7 +72064,7 @@
|
|
|
71525
72064
|
this.menuHandler.handleInsertColumnRight(table, colIndex, inputValue);
|
|
71526
72065
|
break;
|
|
71527
72066
|
case MenuKey.DELETE_ROW:
|
|
71528
|
-
this.menuHandler.handleDeleteRow(table
|
|
72067
|
+
this.menuHandler.handleDeleteRow(table);
|
|
71529
72068
|
break;
|
|
71530
72069
|
case MenuKey.DELETE_COLUMN:
|
|
71531
72070
|
this.menuHandler.handleDeleteColumn(table, colIndex);
|
|
@@ -75930,6 +76469,48 @@
|
|
|
75930
76469
|
throw new Error(`Failed to remove ${numberOfColumns} columns at index ${columnIndex}`);
|
|
75931
76470
|
}
|
|
75932
76471
|
}
|
|
76472
|
+
changeColumnHeaderPosition(sheetKey, sourceCol, targetCol) {
|
|
76473
|
+
this.ensureInitialized();
|
|
76474
|
+
try {
|
|
76475
|
+
const sheet = this.sheet.getSheet(sheetKey);
|
|
76476
|
+
if (!sheet) {
|
|
76477
|
+
throw new Error(`Sheet not found: ${sheetKey}`);
|
|
76478
|
+
}
|
|
76479
|
+
const totalColCount = sheet.columnCount;
|
|
76480
|
+
const totalRowCount = sheet.rowCount;
|
|
76481
|
+
const { adjustedCells, movedCells } = this.formulaEngine.adjustFormulaReferencesForColumnMove(sheetKey, sourceCol, targetCol, totalColCount, totalRowCount);
|
|
76482
|
+
const allAffectedCells = [...adjustedCells, ...movedCells];
|
|
76483
|
+
for (const cell of allAffectedCells) {
|
|
76484
|
+
const result = this.getCellValue(cell);
|
|
76485
|
+
this.sheet
|
|
76486
|
+
.getActiveSheet()
|
|
76487
|
+
.tableInstance?.changeCellValue(cell.col, cell.row, result.error ? '#ERROR!' : result.value);
|
|
76488
|
+
}
|
|
76489
|
+
}
|
|
76490
|
+
catch (error) {
|
|
76491
|
+
throw new Error(`Failed to change column header position: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
76492
|
+
}
|
|
76493
|
+
}
|
|
76494
|
+
changeRowHeaderPosition(sheetKey, sourceRow, targetRow) {
|
|
76495
|
+
this.ensureInitialized();
|
|
76496
|
+
try {
|
|
76497
|
+
const sheet = this.sheet.getSheet(sheetKey);
|
|
76498
|
+
if (!sheet) {
|
|
76499
|
+
throw new Error(`Sheet not found: ${sheetKey}`);
|
|
76500
|
+
}
|
|
76501
|
+
const { adjustedCells, movedCells } = this.formulaEngine.adjustFormulaReferencesForRowMove(sheetKey, sourceRow, targetRow);
|
|
76502
|
+
const allAffectedCells = [...adjustedCells, ...movedCells];
|
|
76503
|
+
for (const cell of allAffectedCells) {
|
|
76504
|
+
const result = this.getCellValue(cell);
|
|
76505
|
+
this.sheet
|
|
76506
|
+
.getActiveSheet()
|
|
76507
|
+
.tableInstance?.changeCellValue(cell.col, cell.row, result.error ? '#ERROR!' : result.value);
|
|
76508
|
+
}
|
|
76509
|
+
}
|
|
76510
|
+
catch (error) {
|
|
76511
|
+
throw new Error(`Failed to change row header position: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
76512
|
+
}
|
|
76513
|
+
}
|
|
75933
76514
|
getSheetSerialized(sheetKey) {
|
|
75934
76515
|
this.ensureInitialized();
|
|
75935
76516
|
try {
|
|
@@ -76529,15 +77110,21 @@
|
|
|
76529
77110
|
});
|
|
76530
77111
|
}
|
|
76531
77112
|
else {
|
|
76532
|
-
|
|
76533
|
-
|
|
76534
|
-
|
|
76535
|
-
|
|
76536
|
-
|
|
76537
|
-
|
|
77113
|
+
if (typeof this.options.theme === 'string') ;
|
|
77114
|
+
else {
|
|
77115
|
+
changedTheme = this.options.theme;
|
|
77116
|
+
changedTheme.frameStyle = Object.assign({}, this.options.theme.frameStyle, {
|
|
77117
|
+
shadowBlur: 0,
|
|
77118
|
+
cornerRadius: 0,
|
|
77119
|
+
borderLineWidth: 0
|
|
77120
|
+
});
|
|
77121
|
+
}
|
|
76538
77122
|
}
|
|
76539
77123
|
return {
|
|
76540
77124
|
...this.options,
|
|
77125
|
+
dragOrder: {
|
|
77126
|
+
maintainArrayDataOrder: true
|
|
77127
|
+
},
|
|
76541
77128
|
addRecordRule: 'Array',
|
|
76542
77129
|
defaultCursor: 'cell',
|
|
76543
77130
|
records: this.options.data,
|
|
@@ -76595,6 +77182,9 @@
|
|
|
76595
77182
|
this.tableInstance.on('click_cell', () => {
|
|
76596
77183
|
this.element.classList.add('vtable-excel-cursor');
|
|
76597
77184
|
});
|
|
77185
|
+
this.tableInstance.on('change_header_position', (event) => {
|
|
77186
|
+
this.handleChangeHeaderPosition(event);
|
|
77187
|
+
});
|
|
76598
77188
|
}
|
|
76599
77189
|
}
|
|
76600
77190
|
handleCellSelected(event) {
|
|
@@ -76715,6 +77305,32 @@
|
|
|
76715
77305
|
catch (error) {
|
|
76716
77306
|
}
|
|
76717
77307
|
}
|
|
77308
|
+
handleChangeHeaderPosition(event) {
|
|
77309
|
+
if (event.movingColumnOrRow === 'column') {
|
|
77310
|
+
this.handleChangeColumnHeaderPosition(event);
|
|
77311
|
+
}
|
|
77312
|
+
else {
|
|
77313
|
+
this.handleChangeRowHeaderPosition(event);
|
|
77314
|
+
}
|
|
77315
|
+
}
|
|
77316
|
+
handleChangeColumnHeaderPosition(event) {
|
|
77317
|
+
const { source, target } = event;
|
|
77318
|
+
const { col: sourceCol, row: sourceRow } = source;
|
|
77319
|
+
const { col: targetCol, row: targetRow } = target;
|
|
77320
|
+
const sheetKey = this.getKey();
|
|
77321
|
+
const normalizedData = this.vtableSheet.formulaManager.normalizeSheetData(this.tableInstance.records, this.tableInstance);
|
|
77322
|
+
this.vtableSheet.formulaManager.formulaEngine.updateSheetData(sheetKey, normalizedData);
|
|
77323
|
+
this.vtableSheet.formulaManager.changeColumnHeaderPosition(sheetKey, sourceCol, targetCol);
|
|
77324
|
+
}
|
|
77325
|
+
handleChangeRowHeaderPosition(event) {
|
|
77326
|
+
const { source, target } = event;
|
|
77327
|
+
const { row: sourceRow } = source;
|
|
77328
|
+
const { row: targetRow } = target;
|
|
77329
|
+
const sheetKey = this.getKey();
|
|
77330
|
+
const normalizedData = this.vtableSheet.formulaManager.normalizeSheetData(this.tableInstance.records, this.tableInstance);
|
|
77331
|
+
this.vtableSheet.formulaManager.formulaEngine.updateSheetData(sheetKey, normalizedData);
|
|
77332
|
+
this.vtableSheet.formulaManager.changeRowHeaderPosition(sheetKey, sourceRow, targetRow);
|
|
77333
|
+
}
|
|
76718
77334
|
fireEvent(eventName, eventData) {
|
|
76719
77335
|
this.fire(eventName, eventData);
|
|
76720
77336
|
}
|
|
@@ -76776,7 +77392,7 @@
|
|
|
76776
77392
|
this.options.sheetTitle = title;
|
|
76777
77393
|
}
|
|
76778
77394
|
getColumns() {
|
|
76779
|
-
return this.
|
|
77395
|
+
return this.tableInstance.columns || [];
|
|
76780
77396
|
}
|
|
76781
77397
|
getData() {
|
|
76782
77398
|
return this.options.data || [];
|
|
@@ -76870,7 +77486,7 @@
|
|
|
76870
77486
|
if (vtableRanges.length === 0) {
|
|
76871
77487
|
return this.selection ? [this.selection] : [];
|
|
76872
77488
|
}
|
|
76873
|
-
return vtableRanges.map(range => ({
|
|
77489
|
+
return vtableRanges.map((range) => ({
|
|
76874
77490
|
startRow: range.start.row,
|
|
76875
77491
|
startCol: range.start.col,
|
|
76876
77492
|
endRow: range.end.row,
|
|
@@ -76963,12 +77579,9 @@
|
|
|
76963
77579
|
}
|
|
76964
77580
|
if (options?.VTablePluginModules) {
|
|
76965
77581
|
options.VTablePluginModules.forEach((module) => {
|
|
76966
|
-
if (typeof module
|
|
77582
|
+
if (typeof module?.module === 'function') {
|
|
76967
77583
|
plugins.push(new module.module(module.moduleOptions));
|
|
76968
77584
|
}
|
|
76969
|
-
else {
|
|
76970
|
-
throw new Error(`Invalid plugin: ${module.module}`);
|
|
76971
|
-
}
|
|
76972
77585
|
});
|
|
76973
77586
|
}
|
|
76974
77587
|
return plugins;
|
|
@@ -78269,13 +78882,13 @@
|
|
|
78269
78882
|
}
|
|
78270
78883
|
}
|
|
78271
78884
|
}
|
|
78272
|
-
importFileToSheet() {
|
|
78885
|
+
async importFileToSheet() {
|
|
78273
78886
|
const sheet = this.getActiveSheet();
|
|
78274
78887
|
if (!sheet) {
|
|
78275
78888
|
return;
|
|
78276
78889
|
}
|
|
78277
78890
|
if (sheet.tableInstance?.importFile) {
|
|
78278
|
-
sheet.tableInstance.importFile();
|
|
78891
|
+
return await sheet.tableInstance.importFile();
|
|
78279
78892
|
}
|
|
78280
78893
|
}
|
|
78281
78894
|
getContainer() {
|
|
@@ -79770,7 +80383,7 @@
|
|
|
79770
80383
|
importStyle();
|
|
79771
80384
|
}
|
|
79772
80385
|
|
|
79773
|
-
const version = "1.22.
|
|
80386
|
+
const version = "1.22.2";
|
|
79774
80387
|
importStyles();
|
|
79775
80388
|
|
|
79776
80389
|
exports.TYPES = index;
|