@visactor/vtable 1.26.0 → 1.26.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/cjs/PivotTable.js +84 -12
  2. package/cjs/PivotTable.js.map +1 -1
  3. package/cjs/core/BaseTable.js +1 -1
  4. package/cjs/core/BaseTable.js.map +1 -1
  5. package/cjs/event/listener/container-dom.js +39 -26
  6. package/cjs/event/listener/container-dom.js.map +1 -1
  7. package/cjs/event/listener/table-group.js +1 -0
  8. package/cjs/event/listener/table-group.js.map +1 -1
  9. package/cjs/index.d.ts +1 -1
  10. package/cjs/index.js +1 -1
  11. package/cjs/index.js.map +1 -1
  12. package/cjs/scenegraph/group-creater/progress/proxy.d.ts +2 -0
  13. package/cjs/scenegraph/group-creater/progress/proxy.js +18 -2
  14. package/cjs/scenegraph/group-creater/progress/proxy.js.map +1 -1
  15. package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-x.js +2 -1
  16. package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-x.js.map +1 -1
  17. package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-y.js +2 -1
  18. package/cjs/scenegraph/group-creater/progress/update-position/dynamic-set-y.js.map +1 -1
  19. package/cjs/scenegraph/scenegraph.js +7 -3
  20. package/cjs/scenegraph/scenegraph.js.map +1 -1
  21. package/cjs/ts-types/dataset/aggregation.js +94 -39
  22. package/cjs/ts-types/dataset/aggregation.js.map +1 -1
  23. package/cjs/ts-types/icon.d.ts +2 -2
  24. package/cjs/ts-types/icon.js.map +1 -1
  25. package/cjs/vrender.js.map +1 -1
  26. package/dist/vtable.js +288 -108
  27. package/dist/vtable.min.js +1 -1
  28. package/es/PivotTable.js +84 -12
  29. package/es/PivotTable.js.map +1 -1
  30. package/es/core/BaseTable.js +1 -1
  31. package/es/core/BaseTable.js.map +1 -1
  32. package/es/event/listener/container-dom.js +39 -26
  33. package/es/event/listener/container-dom.js.map +1 -1
  34. package/es/event/listener/table-group.js +1 -0
  35. package/es/event/listener/table-group.js.map +1 -1
  36. package/es/index.d.ts +1 -1
  37. package/es/index.js +1 -1
  38. package/es/index.js.map +1 -1
  39. package/es/scenegraph/group-creater/progress/proxy.d.ts +2 -0
  40. package/es/scenegraph/group-creater/progress/proxy.js +18 -2
  41. package/es/scenegraph/group-creater/progress/proxy.js.map +1 -1
  42. package/es/scenegraph/group-creater/progress/update-position/dynamic-set-x.js +2 -1
  43. package/es/scenegraph/group-creater/progress/update-position/dynamic-set-x.js.map +1 -1
  44. package/es/scenegraph/group-creater/progress/update-position/dynamic-set-y.js +2 -1
  45. package/es/scenegraph/group-creater/progress/update-position/dynamic-set-y.js.map +1 -1
  46. package/es/scenegraph/scenegraph.js +7 -3
  47. package/es/scenegraph/scenegraph.js.map +1 -1
  48. package/es/ts-types/dataset/aggregation.js +68 -38
  49. package/es/ts-types/dataset/aggregation.js.map +1 -1
  50. package/es/ts-types/icon.d.ts +2 -2
  51. package/es/ts-types/icon.js.map +1 -1
  52. package/es/vrender.js.map +1 -1
  53. package/package.json +4 -3
package/dist/vtable.js CHANGED
@@ -1789,6 +1789,20 @@
1789
1789
  function crossProduct(dir1, dir2) {
1790
1790
  return dir1[0] * dir2[1] - dir1[1] * dir2[0];
1791
1791
  }
1792
+ function fixPrecision$1(num, precision = 10) {
1793
+ return Math.round(num * precision) / precision;
1794
+ }
1795
+ function getDecimalPlaces(n) {
1796
+ const dStr = n.toString().split(/[eE]/),
1797
+ s = (dStr[0].split(".")[1] || "").length - (+dStr[1] || 0);
1798
+ return s > 0 ? s : 0;
1799
+ }
1800
+ function precisionAdd(a, b) {
1801
+ return fixPrecision$1(a + b, 10 ** Math.max(getDecimalPlaces(a), getDecimalPlaces(b)));
1802
+ }
1803
+ function precisionSub(a, b) {
1804
+ return fixPrecision$1(a - b, 10 ** Math.max(getDecimalPlaces(a), getDecimalPlaces(b)));
1805
+ }
1792
1806
 
1793
1807
  class Point {
1794
1808
  constructor(x = 0, y = 0, x1, y1) {
@@ -34217,25 +34231,25 @@
34217
34231
  if (record.isAggregator && this.children) {
34218
34232
  this.children.push(record);
34219
34233
  const value = record.value();
34220
- this.sum += value ?? 0;
34234
+ this.sum = precisionAdd(this.sum, value ?? 0);
34221
34235
  if (this.needSplitPositiveAndNegativeForSum) {
34222
34236
  if (value > 0) {
34223
- this.positiveSum += value;
34237
+ this.positiveSum = precisionAdd(this.positiveSum, value);
34224
34238
  }
34225
34239
  else if (value < 0) {
34226
- this.nagetiveSum += value;
34240
+ this.nagetiveSum = precisionAdd(this.nagetiveSum, value);
34227
34241
  }
34228
34242
  }
34229
34243
  }
34230
34244
  else if (this.field && !isNaN(parseFloat(record[this.field]))) {
34231
34245
  const value = parseFloat(record[this.field]);
34232
- this.sum += value;
34246
+ this.sum = precisionAdd(this.sum, value);
34233
34247
  if (this.needSplitPositiveAndNegativeForSum) {
34234
34248
  if (value > 0) {
34235
- this.positiveSum += value;
34249
+ this.positiveSum = precisionAdd(this.positiveSum, value);
34236
34250
  }
34237
34251
  else if (value < 0) {
34238
- this.nagetiveSum += value;
34252
+ this.nagetiveSum = precisionAdd(this.nagetiveSum, value);
34239
34253
  }
34240
34254
  }
34241
34255
  }
@@ -34245,30 +34259,36 @@
34245
34259
  deleteRecord(record) {
34246
34260
  if (record) {
34247
34261
  if (this.isRecord && this.records) {
34248
- this.records = this.records.filter(item => item !== record);
34262
+ const index = this.records.indexOf(record);
34263
+ if (index !== -1) {
34264
+ this.records.splice(index, 1);
34265
+ }
34249
34266
  }
34250
34267
  if (record.isAggregator && this.children) {
34251
- this.children = this.children.filter(item => item !== record);
34268
+ const index = this.children.indexOf(record);
34269
+ if (index !== -1) {
34270
+ this.children.splice(index, 1);
34271
+ }
34252
34272
  const value = record.value();
34253
- this.sum -= value ?? 0;
34273
+ this.sum = precisionSub(this.sum, value ?? 0);
34254
34274
  if (this.needSplitPositiveAndNegativeForSum) {
34255
34275
  if (value > 0) {
34256
- this.positiveSum -= value;
34276
+ this.positiveSum = precisionSub(this.positiveSum, value);
34257
34277
  }
34258
34278
  else if (value < 0) {
34259
- this.nagetiveSum -= value;
34279
+ this.nagetiveSum = precisionSub(this.nagetiveSum, value);
34260
34280
  }
34261
34281
  }
34262
34282
  }
34263
34283
  else if (this.field && !isNaN(parseFloat(record[this.field]))) {
34264
34284
  const value = parseFloat(record[this.field]);
34265
- this.sum -= value;
34285
+ this.sum = precisionSub(this.sum, value);
34266
34286
  if (this.needSplitPositiveAndNegativeForSum) {
34267
34287
  if (value > 0) {
34268
- this.positiveSum -= value;
34288
+ this.positiveSum = precisionSub(this.positiveSum, value);
34269
34289
  }
34270
34290
  else if (value < 0) {
34271
- this.nagetiveSum -= value;
34291
+ this.nagetiveSum = precisionSub(this.nagetiveSum, value);
34272
34292
  }
34273
34293
  }
34274
34294
  }
@@ -34278,50 +34298,50 @@
34278
34298
  updateRecord(oldRecord, newRecord) {
34279
34299
  if (oldRecord && newRecord) {
34280
34300
  if (this.isRecord && this.records) {
34281
- this.records = this.records.map(item => {
34282
- if (item === oldRecord) {
34283
- return newRecord;
34284
- }
34285
- return item;
34286
- });
34301
+ const index = this.records.indexOf(oldRecord);
34302
+ if (index !== -1) {
34303
+ this.records[index] = newRecord;
34304
+ }
34287
34305
  }
34288
34306
  if (oldRecord.isAggregator && this.children) {
34289
34307
  const oldValue = oldRecord.value();
34290
- this.children = this.children.filter(item => item !== oldRecord);
34308
+ const index = this.children.indexOf(oldRecord);
34309
+ if (index !== -1) {
34310
+ this.children[index] = newRecord;
34311
+ }
34291
34312
  const newValue = newRecord.value();
34292
- this.children.push(newRecord);
34293
- this.sum += newValue - oldValue;
34313
+ this.sum = precisionAdd(this.sum, precisionSub(newValue, oldValue));
34294
34314
  if (this.needSplitPositiveAndNegativeForSum) {
34295
34315
  if (oldValue > 0) {
34296
- this.positiveSum -= oldValue;
34316
+ this.positiveSum = precisionSub(this.positiveSum, oldValue);
34297
34317
  }
34298
34318
  else if (oldValue < 0) {
34299
- this.nagetiveSum -= oldValue;
34319
+ this.nagetiveSum = precisionSub(this.nagetiveSum, oldValue);
34300
34320
  }
34301
34321
  if (newValue > 0) {
34302
- this.positiveSum += newValue;
34322
+ this.positiveSum = precisionAdd(this.positiveSum, newValue);
34303
34323
  }
34304
34324
  else if (newValue < 0) {
34305
- this.nagetiveSum += newValue;
34325
+ this.nagetiveSum = precisionAdd(this.nagetiveSum, newValue);
34306
34326
  }
34307
34327
  }
34308
34328
  }
34309
34329
  else if (this.field && !isNaN(parseFloat(oldRecord[this.field]))) {
34310
34330
  const oldValue = parseFloat(oldRecord[this.field]);
34311
34331
  const newValue = parseFloat(newRecord[this.field]);
34312
- this.sum += newValue - oldValue;
34332
+ this.sum = precisionAdd(this.sum, precisionSub(newValue, oldValue));
34313
34333
  if (this.needSplitPositiveAndNegativeForSum) {
34314
34334
  if (oldValue > 0) {
34315
- this.positiveSum -= oldValue;
34335
+ this.positiveSum = precisionSub(this.positiveSum, oldValue);
34316
34336
  }
34317
34337
  else if (oldValue < 0) {
34318
- this.nagetiveSum -= oldValue;
34338
+ this.nagetiveSum = precisionSub(this.nagetiveSum, oldValue);
34319
34339
  }
34320
34340
  if (newValue > 0) {
34321
- this.positiveSum += newValue;
34341
+ this.positiveSum = precisionAdd(this.positiveSum, newValue);
34322
34342
  }
34323
34343
  else if (newValue < 0) {
34324
- this.nagetiveSum += newValue;
34344
+ this.nagetiveSum = precisionAdd(this.nagetiveSum, newValue);
34325
34345
  }
34326
34346
  }
34327
34347
  }
@@ -34329,7 +34349,8 @@
34329
34349
  }
34330
34350
  }
34331
34351
  value() {
34332
- return this.changedValue ?? (this.records?.length >= 1 ? this.sum : undefined);
34352
+ return (this.changedValue ??
34353
+ (this.records && this.records.length >= 1 ? this.sum : this.isRecord === false ? this.sum : undefined));
34333
34354
  }
34334
34355
  positiveValue() {
34335
34356
  return this.positiveSum;
@@ -34350,13 +34371,13 @@
34350
34371
  const child = this.children[i];
34351
34372
  if (child.isAggregator) {
34352
34373
  const value = child.value();
34353
- this.sum += value ?? 0;
34374
+ this.sum = precisionAdd(this.sum, value ?? 0);
34354
34375
  if (this.needSplitPositiveAndNegativeForSum) {
34355
34376
  if (value > 0) {
34356
- this.positiveSum += value;
34377
+ this.positiveSum = precisionAdd(this.positiveSum, value);
34357
34378
  }
34358
34379
  else if (value < 0) {
34359
- this.nagetiveSum += value;
34380
+ this.nagetiveSum = precisionAdd(this.nagetiveSum, value);
34360
34381
  }
34361
34382
  }
34362
34383
  }
@@ -34367,25 +34388,25 @@
34367
34388
  const record = this.records[i];
34368
34389
  if (record.isAggregator) {
34369
34390
  const value = record.value();
34370
- this.sum += value ?? 0;
34391
+ this.sum = precisionAdd(this.sum, value ?? 0);
34371
34392
  if (this.needSplitPositiveAndNegativeForSum) {
34372
34393
  if (value > 0) {
34373
- this.positiveSum += value;
34394
+ this.positiveSum = precisionAdd(this.positiveSum, value);
34374
34395
  }
34375
34396
  else if (value < 0) {
34376
- this.nagetiveSum += value;
34397
+ this.nagetiveSum = precisionAdd(this.nagetiveSum, value);
34377
34398
  }
34378
34399
  }
34379
34400
  }
34380
34401
  else if (this.field && !isNaN(parseFloat(record[this.field]))) {
34381
34402
  const value = parseFloat(record[this.field]);
34382
- this.sum += value;
34403
+ this.sum = precisionAdd(this.sum, value);
34383
34404
  if (this.needSplitPositiveAndNegativeForSum) {
34384
34405
  if (value > 0) {
34385
- this.positiveSum += value;
34406
+ this.positiveSum = precisionAdd(this.positiveSum, value);
34386
34407
  }
34387
34408
  else if (value < 0) {
34388
- this.nagetiveSum += value;
34409
+ this.nagetiveSum = precisionAdd(this.nagetiveSum, value);
34389
34410
  }
34390
34411
  }
34391
34412
  }
@@ -34513,11 +34534,11 @@
34513
34534
  if (this.children) {
34514
34535
  this.children.push(record);
34515
34536
  }
34516
- this.sum += record.sum;
34537
+ this.sum = precisionAdd(this.sum, record.sum);
34517
34538
  this.count += record.count;
34518
34539
  }
34519
34540
  else if (this.field && !isNaN(parseFloat(record[this.field]))) {
34520
- this.sum += parseFloat(record[this.field]);
34541
+ this.sum = precisionAdd(this.sum, parseFloat(record[this.field]));
34521
34542
  this.count++;
34522
34543
  }
34523
34544
  }
@@ -34526,17 +34547,23 @@
34526
34547
  deleteRecord(record) {
34527
34548
  if (record) {
34528
34549
  if (this.isRecord && this.records) {
34529
- this.records = this.records.filter(item => item !== record);
34550
+ const index = this.records.indexOf(record);
34551
+ if (index !== -1) {
34552
+ this.records.splice(index, 1);
34553
+ }
34530
34554
  }
34531
34555
  if (record.isAggregator && record.type === AggregationType.AVG) {
34532
34556
  if (this.children) {
34533
- this.children = this.children.filter(item => item !== record);
34557
+ const index = this.children.indexOf(record);
34558
+ if (index !== -1) {
34559
+ this.children.splice(index, 1);
34560
+ }
34534
34561
  }
34535
- this.sum -= record.sum;
34562
+ this.sum = precisionSub(this.sum, record.sum);
34536
34563
  this.count -= record.count;
34537
34564
  }
34538
34565
  else if (this.field && !isNaN(parseFloat(record[this.field]))) {
34539
- this.sum -= parseFloat(record[this.field]);
34566
+ this.sum = precisionSub(this.sum, parseFloat(record[this.field]));
34540
34567
  this.count--;
34541
34568
  }
34542
34569
  }
@@ -34545,33 +34572,34 @@
34545
34572
  updateRecord(oldRecord, newRecord) {
34546
34573
  if (oldRecord && newRecord) {
34547
34574
  if (this.isRecord && this.records) {
34548
- this.records = this.records.map(item => {
34549
- if (item === oldRecord) {
34550
- return newRecord;
34551
- }
34552
- return item;
34553
- });
34575
+ const index = this.records.indexOf(oldRecord);
34576
+ if (index !== -1) {
34577
+ this.records[index] = newRecord;
34578
+ }
34554
34579
  }
34555
34580
  if (oldRecord.isAggregator && oldRecord.type === AggregationType.AVG) {
34556
34581
  if (this.children && newRecord.isAggregator) {
34557
- this.children = this.children.map(item => {
34558
- if (item === oldRecord) {
34559
- return newRecord;
34560
- }
34561
- return item;
34562
- });
34582
+ const index = this.children.indexOf(oldRecord);
34583
+ if (index !== -1) {
34584
+ this.children[index] = newRecord;
34585
+ }
34563
34586
  }
34564
- this.sum += newRecord.sum - oldRecord.sum;
34587
+ this.sum = precisionAdd(this.sum, precisionSub(newRecord.sum, oldRecord.sum));
34565
34588
  this.count += newRecord.count - oldRecord.count;
34566
34589
  }
34567
34590
  else if (this.field && !isNaN(parseFloat(oldRecord[this.field]))) {
34568
- this.sum += parseFloat(newRecord[this.field]) - parseFloat(oldRecord[this.field]);
34591
+ this.sum = precisionAdd(this.sum, precisionSub(parseFloat(newRecord[this.field]), parseFloat(oldRecord[this.field])));
34569
34592
  }
34570
34593
  this.clearCacheValue();
34571
34594
  }
34572
34595
  }
34573
34596
  value() {
34574
- return this.changedValue ?? (this.records?.length >= 1 ? this.sum / this.count : undefined);
34597
+ return (this.changedValue ??
34598
+ (this.records && this.records.length >= 1
34599
+ ? this.sum / this.count
34600
+ : this.isRecord === false && this.count > 0
34601
+ ? this.sum / this.count
34602
+ : undefined));
34575
34603
  }
34576
34604
  reset() {
34577
34605
  this.changedValue = undefined;
@@ -34589,7 +34617,7 @@
34589
34617
  const child = this.children[i];
34590
34618
  if (child.isAggregator && child.type === AggregationType.AVG) {
34591
34619
  const childValue = child.value();
34592
- this.sum += childValue * child.count;
34620
+ this.sum = precisionAdd(this.sum, childValue * child.count);
34593
34621
  this.count += child.count;
34594
34622
  }
34595
34623
  }
@@ -34598,11 +34626,11 @@
34598
34626
  for (let i = 0; i < this.records.length; i++) {
34599
34627
  const record = this.records[i];
34600
34628
  if (record.isAggregator && record.type === AggregationType.AVG) {
34601
- this.sum += record.sum;
34629
+ this.sum = precisionAdd(this.sum, record.sum);
34602
34630
  this.count += record.count;
34603
34631
  }
34604
34632
  else if (this.field && !isNaN(parseFloat(record[this.field]))) {
34605
- this.sum += parseFloat(record[this.field]);
34633
+ this.sum = precisionAdd(this.sum, parseFloat(record[this.field]));
34606
34634
  this.count++;
34607
34635
  }
34608
34636
  }
@@ -54359,6 +54387,9 @@
54359
54387
 
54360
54388
  async function dynamicSetX(x, screenLeft, isEnd, proxy) {
54361
54389
  if (!screenLeft) {
54390
+ proxy.updateDeltaX(x);
54391
+ proxy.table.scenegraph.setBodyAndColHeaderX(-x + proxy.deltaX);
54392
+ proxy.table.scenegraph.updateNextFrame();
54362
54393
  return;
54363
54394
  }
54364
54395
  const screenLeftCol = screenLeft.col;
@@ -54669,6 +54700,9 @@
54669
54700
 
54670
54701
  async function dynamicSetY(y, screenTop, isEnd, proxy) {
54671
54702
  if (!screenTop) {
54703
+ proxy.updateDeltaY(y);
54704
+ proxy.updateBody(y - proxy.deltaY);
54705
+ proxy.table.scenegraph.updateNextFrame();
54672
54706
  return;
54673
54707
  }
54674
54708
  const screenTopRow = screenTop.row;
@@ -55583,7 +55617,7 @@
55583
55617
  async setY(y, isEnd = false) {
55584
55618
  const yLimitTop = this.table.getRowsHeight(this.bodyTopRow, this.bodyTopRow + (this.rowEnd - this.rowStart + 1)) / 2;
55585
55619
  const yLimitBottom = this.table.getAllRowsHeight() - yLimitTop;
55586
- const screenTop = this.table.getTargetRowAt(y + this.table.scenegraph.colHeaderGroup.attribute.height);
55620
+ const screenTop = this.resolveTargetRowInfo(y + this.table.scenegraph.colHeaderGroup.attribute.height);
55587
55621
  if (screenTop) {
55588
55622
  this.screenTopRow = screenTop.row;
55589
55623
  }
@@ -55611,7 +55645,7 @@
55611
55645
  async setX(x, isEnd = false) {
55612
55646
  const xLimitLeft = this.table.getColsWidth(this.bodyLeftCol, this.bodyLeftCol + (this.colEnd - this.colStart + 1)) / 2;
55613
55647
  const xLimitRight = this.table.getAllColsWidth() - xLimitLeft;
55614
- const screenLeft = this.table.getTargetColAt(x + this.table.scenegraph.rowHeaderGroup.attribute.width + (this.table.getFrozenColsOffset?.() ?? 0));
55648
+ const screenLeft = this.resolveTargetColInfo(x + this.table.scenegraph.rowHeaderGroup.attribute.width + (this.table.getFrozenColsOffset?.() ?? 0));
55615
55649
  if (screenLeft) {
55616
55650
  this.screenLeftCol = screenLeft.col;
55617
55651
  }
@@ -55639,6 +55673,26 @@
55639
55673
  async dynamicSetX(x, screenLeft, isEnd = false) {
55640
55674
  dynamicSetX(x, screenLeft, isEnd, this);
55641
55675
  }
55676
+ resolveTargetColInfo(absoluteX) {
55677
+ const offsets = [0, -1, 1, -2, 2];
55678
+ for (let i = 0; i < offsets.length; i++) {
55679
+ const screenLeft = this.table.getTargetColAt(absoluteX + offsets[i]);
55680
+ if (screenLeft) {
55681
+ return screenLeft;
55682
+ }
55683
+ }
55684
+ return null;
55685
+ }
55686
+ resolveTargetRowInfo(absoluteY) {
55687
+ const offsets = [0, -1, 1, -2, 2];
55688
+ for (let i = 0; i < offsets.length; i++) {
55689
+ const screenTop = this.table.getTargetRowAt(absoluteY + offsets[i]);
55690
+ if (screenTop) {
55691
+ return screenTop;
55692
+ }
55693
+ }
55694
+ return null;
55695
+ }
55642
55696
  updateBody(y) {
55643
55697
  this.table.scenegraph.setBodyAndRowHeaderY(-y);
55644
55698
  }
@@ -59763,8 +59817,13 @@
59763
59817
  this.table.scenegraph.proxy.setY(-y, isEnd);
59764
59818
  }
59765
59819
  setBodyAndRowHeaderY(y) {
59766
- const firstBodyCell = this.bodyGroup.firstChild?.firstChild ?? this.rowHeaderGroup.firstChild?.firstChild;
59767
- const lastBodyCell = this.bodyGroup.firstChild?.lastChild ?? this.rowHeaderGroup.firstChild?.lastChild;
59820
+ const firstBodyColGroup = this.bodyGroup.firstChild;
59821
+ const firstRowHeaderColGroup = this.rowHeaderGroup.firstChild;
59822
+ const firstBodyCell = firstBodyColGroup?.firstChild ?? firstRowHeaderColGroup?.firstChild;
59823
+ let lastBodyCell = (firstBodyColGroup?.lastChild ?? firstRowHeaderColGroup?.lastChild);
59824
+ if (lastBodyCell && lastBodyCell.type !== 'group') {
59825
+ lastBodyCell = lastBodyCell._prev;
59826
+ }
59768
59827
  if (y === 0 &&
59769
59828
  firstBodyCell &&
59770
59829
  firstBodyCell.row === this.table.frozenRowCount &&
@@ -59808,7 +59867,10 @@
59808
59867
  }
59809
59868
  setBodyAndColHeaderX(x) {
59810
59869
  const firstBodyCol = this.bodyGroup.firstChild;
59811
- const lastBodyCol = this.bodyGroup.lastChild;
59870
+ let lastBodyCol = this.bodyGroup.lastChild;
59871
+ if (lastBodyCol && lastBodyCol.type !== 'group') {
59872
+ lastBodyCol = lastBodyCol._prev;
59873
+ }
59812
59874
  if (x === 0 && firstBodyCol && firstBodyCol.col === this.table.frozenColCount && firstBodyCol.attribute.x + x < 0) {
59813
59875
  x = -firstBodyCol.attribute.x;
59814
59876
  }
@@ -65601,6 +65663,9 @@
65601
65663
  });
65602
65664
  }
65603
65665
  function dblclickHandler(e, table) {
65666
+ if (typeof e.button === 'number' && e.button !== 0) {
65667
+ return;
65668
+ }
65604
65669
  const eventArgsSet = getCellEventArgsSetWithTable(e, table);
65605
65670
  let col = -1;
65606
65671
  let row = -1;
@@ -65962,6 +66027,18 @@
65962
66027
  const table = eventManager.table;
65963
66028
  const stateManager = table.stateManager;
65964
66029
  const handler = table.internalProps.handler;
66030
+ const focusEditingInput = () => {
66031
+ table.editorManager?.editingEditor?.getInputElement?.()?.focus?.();
66032
+ };
66033
+ const afterCompleteEdit = (completeEditResult, onSuccess) => {
66034
+ getPromiseValue(completeEditResult, (isCompleteEdit) => {
66035
+ if (isCompleteEdit === false) {
66036
+ focusEditingInput();
66037
+ return;
66038
+ }
66039
+ onSuccess();
66040
+ });
66041
+ };
65965
66042
  handler.on(table.getElement(), 'blur', (e) => {
65966
66043
  const relatedTarget = e.relatedTarget;
65967
66044
  if (relatedTarget) {
@@ -66064,15 +66141,17 @@
66064
66141
  return;
66065
66142
  }
66066
66143
  const isEditingCell = !!table.editorManager?.editingEditor;
66067
- table.editorManager?.completeEdit();
66068
- table.getElement().focus();
66069
- const enableShiftSelectMode = table.options.keyboardOptions?.shiftMultiSelect ?? true;
66070
- table.selectCell(targetCol, targetRow, e.shiftKey && enableShiftSelectMode);
66071
- if ((table.options.keyboardOptions?.moveEditCellOnArrowKeys ?? false) && isEditingCell) {
66072
- if (table.getEditor(targetCol, targetRow)) {
66073
- table.editorManager?.startEditCell(targetCol, targetRow);
66144
+ const completeEditResult = table.editorManager?.completeEdit();
66145
+ afterCompleteEdit(completeEditResult, () => {
66146
+ table.getElement().focus();
66147
+ const enableShiftSelectMode = table.options.keyboardOptions?.shiftMultiSelect ?? true;
66148
+ table.selectCell(targetCol, targetRow, e.shiftKey && enableShiftSelectMode);
66149
+ if ((table.options.keyboardOptions?.moveEditCellOnArrowKeys ?? false) && isEditingCell) {
66150
+ if (table.getEditor(targetCol, targetRow)) {
66151
+ table.editorManager?.startEditCell(targetCol, targetRow);
66152
+ }
66074
66153
  }
66075
- }
66154
+ });
66076
66155
  }
66077
66156
  else if (e.key === 'Escape') {
66078
66157
  table.editorManager?.cancelEdit();
@@ -66081,17 +66160,19 @@
66081
66160
  else if (e.key === 'Enter') {
66082
66161
  if (table.editorManager?.editingEditor) {
66083
66162
  handleKeydownListener(e);
66084
- table.editorManager?.completeEdit();
66085
- table.getElement().focus();
66086
- if (table.options.keyboardOptions?.moveFocusCellOnEnter === true) {
66087
- const targetCol = stateManager.select.cellPos.col;
66088
- const targetRow = Math.min(table.rowCount - 1, Math.max(0, stateManager.select.cellPos.row + 1));
66089
- if (isCellDisableSelect(table, targetCol, targetRow)) {
66090
- return;
66163
+ const completeEditResult = table.editorManager?.completeEdit();
66164
+ afterCompleteEdit(completeEditResult, () => {
66165
+ table.getElement().focus();
66166
+ if (table.options.keyboardOptions?.moveFocusCellOnEnter === true) {
66167
+ const targetCol = stateManager.select.cellPos.col;
66168
+ const targetRow = Math.min(table.rowCount - 1, Math.max(0, stateManager.select.cellPos.row + 1));
66169
+ if (isCellDisableSelect(table, targetCol, targetRow)) {
66170
+ return;
66171
+ }
66172
+ const enableShiftSelectMode = table.options.keyboardOptions?.shiftMultiSelect ?? true;
66173
+ table.selectCell(targetCol, targetRow, e.shiftKey && enableShiftSelectMode);
66091
66174
  }
66092
- const enableShiftSelectMode = table.options.keyboardOptions?.shiftMultiSelect ?? true;
66093
- table.selectCell(targetCol, targetRow, e.shiftKey && enableShiftSelectMode);
66094
- }
66175
+ });
66095
66176
  return;
66096
66177
  }
66097
66178
  if (table.options.keyboardOptions?.moveFocusCellOnEnter === true) {
@@ -66139,14 +66220,16 @@
66139
66220
  return;
66140
66221
  }
66141
66222
  const isEditingCell = !!table.editorManager?.editingEditor;
66142
- table.editorManager?.completeEdit();
66143
- table.getElement().focus();
66144
- table.selectCell(targetCol, targetRow);
66145
- if (isEditingCell) {
66146
- if (table.getEditor(targetCol, targetRow)) {
66147
- table.editorManager?.startEditCell(targetCol, targetRow);
66223
+ const completeEditResult = table.editorManager?.completeEdit();
66224
+ afterCompleteEdit(completeEditResult, () => {
66225
+ table.getElement().focus();
66226
+ table.selectCell(targetCol, targetRow);
66227
+ if (isEditingCell) {
66228
+ if (table.getEditor(targetCol, targetRow)) {
66229
+ table.editorManager?.startEditCell(targetCol, targetRow);
66230
+ }
66148
66231
  }
66149
- }
66232
+ });
66150
66233
  }
66151
66234
  }
66152
66235
  }
@@ -71934,7 +72017,7 @@
71934
72017
  return TABLE_EVENT_TYPE;
71935
72018
  }
71936
72019
  options;
71937
- version = "1.26.0";
72020
+ version = "1.26.1";
71938
72021
  pagination;
71939
72022
  id = `VTable${Date.now()}`;
71940
72023
  headerStyleCache;
@@ -93681,6 +93764,7 @@
93681
93764
  for (let i = 0; i < sortRules.length; i++) {
93682
93765
  const sortRule = sortRules[i];
93683
93766
  const dimensions = [];
93767
+ const sortType = sortRule.sortType ? sortRule.sortType.toUpperCase() : 'ASC';
93684
93768
  if (sortRule.sortByIndicator &&
93685
93769
  sortRule.sortField ===
93686
93770
  (this.dataset.indicatorsAsCol
@@ -93697,19 +93781,58 @@
93697
93781
  value: this.internalProps.layoutMap.getIndicatorInfo(sortRule.sortByIndicator)?.title ??
93698
93782
  sortRule.sortByIndicator
93699
93783
  });
93784
+ this.pivotSortState.push({
93785
+ dimensions,
93786
+ order: SortType[sortType]
93787
+ });
93700
93788
  }
93701
93789
  else {
93702
- dimensions.push({
93703
- dimensionKey: sortRule.sortField,
93704
- isPivotCorner: true,
93705
- value: sortRule.sortField
93706
- });
93790
+ const sortField = sortRule.sortField;
93791
+ const rowIndex = this.dataset.rows.indexOf(sortField);
93792
+ const colIndex = this.dataset.columns.indexOf(sortField);
93793
+ let pushed = false;
93794
+ if (rowIndex >= 0) {
93795
+ const rowDimensions = [];
93796
+ for (let k = 0; k <= rowIndex; k++) {
93797
+ rowDimensions.push({
93798
+ dimensionKey: this.dataset.rows[k],
93799
+ isPivotCorner: true,
93800
+ value: this.dataset.rows[k]
93801
+ });
93802
+ }
93803
+ this.pivotSortState.push({
93804
+ dimensions: rowDimensions,
93805
+ order: SortType[sortType]
93806
+ });
93807
+ pushed = true;
93808
+ }
93809
+ if (colIndex >= 0) {
93810
+ const colDimensions = [];
93811
+ for (let k = 0; k <= colIndex; k++) {
93812
+ colDimensions.push({
93813
+ dimensionKey: this.dataset.columns[k],
93814
+ isPivotCorner: true,
93815
+ value: this.dataset.columns[k]
93816
+ });
93817
+ }
93818
+ this.pivotSortState.push({
93819
+ dimensions: colDimensions,
93820
+ order: SortType[sortType]
93821
+ });
93822
+ pushed = true;
93823
+ }
93824
+ if (!pushed) {
93825
+ dimensions.push({
93826
+ dimensionKey: sortField,
93827
+ isPivotCorner: true,
93828
+ value: sortField
93829
+ });
93830
+ this.pivotSortState.push({
93831
+ dimensions,
93832
+ order: SortType[sortType]
93833
+ });
93834
+ }
93707
93835
  }
93708
- const sortType = sortRule.sortType ? sortRule.sortType.toUpperCase() : 'ASC';
93709
- this.pivotSortState.push({
93710
- dimensions,
93711
- order: SortType[sortType]
93712
- });
93713
93836
  }
93714
93837
  }
93715
93838
  _filterHideIndicatorNode() {
@@ -93824,6 +93947,63 @@
93824
93947
  for (let i = 0; i < this.pivotSortState.length; i++) {
93825
93948
  const pivotState = this.pivotSortState[i];
93826
93949
  const dimensions = pivotState.dimensions;
93950
+ if (this.isCornerHeader(col, row)) {
93951
+ const layoutMap = this.internalProps.layoutMap;
93952
+ const header = layoutMap.getHeader(col, row);
93953
+ if (header && header.pivotInfo && dimensions && dimensions.length > 0) {
93954
+ let cellPathKeys = [];
93955
+ const leftSnCount = layoutMap.leftRowSeriesNumberColumnCount ?? 0;
93956
+ if (layoutMap.cornerSetting.titleOnDimension === 'row') {
93957
+ const dimIndex = col - leftSnCount;
93958
+ cellPathKeys = layoutMap.rowDimensionKeys.slice(0, dimIndex + 1);
93959
+ }
93960
+ else if (layoutMap.cornerSetting.titleOnDimension === 'column') {
93961
+ const dimIndex = row;
93962
+ cellPathKeys = layoutMap.colDimensionKeys.slice(0, dimIndex + 1);
93963
+ }
93964
+ else if (layoutMap.cornerSetting.titleOnDimension === 'all') {
93965
+ if (layoutMap.indicatorsAsCol) {
93966
+ let indicatorAtIndex = layoutMap.colDimensionKeys.indexOf(layoutMap.indicatorDimensionKey);
93967
+ if (indicatorAtIndex === -1) {
93968
+ indicatorAtIndex = layoutMap.columnHeaderLevelCount - 1;
93969
+ }
93970
+ if (row === indicatorAtIndex) {
93971
+ const dimIndex = col - leftSnCount;
93972
+ cellPathKeys = layoutMap.rowDimensionKeys.slice(0, dimIndex + 1);
93973
+ }
93974
+ else {
93975
+ const dimIndex = row;
93976
+ cellPathKeys = layoutMap.colDimensionKeys.slice(0, dimIndex + 1);
93977
+ }
93978
+ }
93979
+ else {
93980
+ let indicatorAtIndex = layoutMap.rowDimensionKeys.indexOf(layoutMap.indicatorDimensionKey);
93981
+ if (indicatorAtIndex === -1) {
93982
+ indicatorAtIndex = layoutMap.rowHeaderLevelCount - 1;
93983
+ }
93984
+ if (col - leftSnCount === indicatorAtIndex) {
93985
+ const dimIndex = row;
93986
+ cellPathKeys = layoutMap.colDimensionKeys.slice(0, dimIndex + 1);
93987
+ }
93988
+ else {
93989
+ const dimIndex = col - leftSnCount;
93990
+ cellPathKeys = layoutMap.rowDimensionKeys.slice(0, dimIndex + 1);
93991
+ }
93992
+ }
93993
+ }
93994
+ if (cellPathKeys.length > 0 && dimensions.length === cellPathKeys.length) {
93995
+ const isMatch = dimensions.every((dim, idx) => {
93996
+ const isCorner = dim.isPivotCorner || (!isValid$1(dim.isPivotCorner) && dim.dimensionKey && !dim.value);
93997
+ const keyMatch = dim.dimensionKey === cellPathKeys[idx] || dim.value === cellPathKeys[idx];
93998
+ return isCorner && keyMatch;
93999
+ });
94000
+ if (isMatch) {
94001
+ return pivotState.order;
94002
+ }
94003
+ }
94004
+ }
94005
+ continue;
94006
+ }
93827
94007
  const cell = this.getCellAddressByHeaderPaths(dimensions);
93828
94008
  const order = pivotState.order;
93829
94009
  if (cell && cellInRange(cellRange, cell.col, cell.row)) {
@@ -96410,7 +96590,7 @@
96410
96590
  }
96411
96591
 
96412
96592
  registerForVrender();
96413
- const version = "1.26.0";
96593
+ const version = "1.26.1";
96414
96594
  function getIcons() {
96415
96595
  return get$2();
96416
96596
  }