@visactor/vtable 1.7.3 → 1.7.4

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 (97) hide show
  1. package/cjs/ListTable.js +7 -2
  2. package/cjs/ListTable.js.map +1 -1
  3. package/cjs/PivotTable.d.ts +3 -2
  4. package/cjs/PivotTable.js +31 -28
  5. package/cjs/PivotTable.js.map +1 -1
  6. package/cjs/core/BaseTable.js +1 -1
  7. package/cjs/core/BaseTable.js.map +1 -1
  8. package/cjs/data/CachedDataSource.js +14 -10
  9. package/cjs/data/CachedDataSource.js.map +1 -1
  10. package/cjs/dataset/dataset-pivot-table.d.ts +2 -2
  11. package/cjs/dataset/dataset.d.ts +5 -4
  12. package/cjs/dataset/dataset.js +55 -84
  13. package/cjs/dataset/dataset.js.map +1 -1
  14. package/cjs/dataset/statistics-helper.d.ts +4 -3
  15. package/cjs/dataset/statistics-helper.js +39 -27
  16. package/cjs/dataset/statistics-helper.js.map +1 -1
  17. package/cjs/event/listener/table-group.js +28 -30
  18. package/cjs/event/listener/table-group.js.map +1 -1
  19. package/cjs/header-helper/header-helper.js +1 -1
  20. package/cjs/header-helper/header-helper.js.map +1 -1
  21. package/cjs/index.d.ts +1 -1
  22. package/cjs/index.js +1 -1
  23. package/cjs/index.js.map +1 -1
  24. package/cjs/layout/pivot-header-layout.js +20 -13
  25. package/cjs/layout/pivot-header-layout.js.map +1 -1
  26. package/cjs/scenegraph/graphic/contributions/group-contribution-render.d.ts +1 -7
  27. package/cjs/scenegraph/graphic/contributions/group-contribution-render.js +18 -32
  28. package/cjs/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
  29. package/cjs/scenegraph/graphic/contributions/index.js +0 -2
  30. package/cjs/scenegraph/graphic/contributions/index.js.map +1 -1
  31. package/cjs/scenegraph/group-creater/cell-type/spark-line-cell.js +15 -3
  32. package/cjs/scenegraph/group-creater/cell-type/spark-line-cell.js.map +1 -1
  33. package/cjs/scenegraph/layout/update-height.js +1 -1
  34. package/cjs/scenegraph/layout/update-height.js.map +1 -1
  35. package/cjs/scenegraph/layout/update-width.js +1 -1
  36. package/cjs/scenegraph/layout/update-width.js.map +1 -1
  37. package/cjs/state/checkbox/checkbox.d.ts +1 -0
  38. package/cjs/state/checkbox/checkbox.js +13 -2
  39. package/cjs/state/checkbox/checkbox.js.map +1 -1
  40. package/cjs/state/state.js +1 -1
  41. package/cjs/state/state.js.map +1 -1
  42. package/cjs/ts-types/new-data-set.d.ts +8 -2
  43. package/cjs/ts-types/new-data-set.js +2 -1
  44. package/cjs/ts-types/new-data-set.js.map +1 -1
  45. package/cjs/ts-types/table-engine.d.ts +2 -2
  46. package/cjs/ts-types/table-engine.js.map +1 -1
  47. package/cjs/vrender.js.map +1 -1
  48. package/dist/vtable.js +281 -220
  49. package/dist/vtable.min.js +2 -2
  50. package/es/ListTable.js +7 -3
  51. package/es/ListTable.js.map +1 -1
  52. package/es/PivotTable.d.ts +3 -2
  53. package/es/PivotTable.js +31 -28
  54. package/es/PivotTable.js.map +1 -1
  55. package/es/core/BaseTable.js +1 -1
  56. package/es/core/BaseTable.js.map +1 -1
  57. package/es/data/CachedDataSource.js +14 -10
  58. package/es/data/CachedDataSource.js.map +1 -1
  59. package/es/dataset/dataset-pivot-table.d.ts +2 -2
  60. package/es/dataset/dataset.d.ts +5 -4
  61. package/es/dataset/dataset.js +55 -84
  62. package/es/dataset/dataset.js.map +1 -1
  63. package/es/dataset/statistics-helper.d.ts +4 -3
  64. package/es/dataset/statistics-helper.js +41 -27
  65. package/es/dataset/statistics-helper.js.map +1 -1
  66. package/es/event/listener/table-group.js +28 -30
  67. package/es/event/listener/table-group.js.map +1 -1
  68. package/es/header-helper/header-helper.js +1 -1
  69. package/es/header-helper/header-helper.js.map +1 -1
  70. package/es/index.d.ts +1 -1
  71. package/es/index.js +1 -1
  72. package/es/index.js.map +1 -1
  73. package/es/layout/pivot-header-layout.js +20 -13
  74. package/es/layout/pivot-header-layout.js.map +1 -1
  75. package/es/scenegraph/graphic/contributions/group-contribution-render.d.ts +1 -7
  76. package/es/scenegraph/graphic/contributions/group-contribution-render.js +16 -30
  77. package/es/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
  78. package/es/scenegraph/graphic/contributions/index.js +1 -2
  79. package/es/scenegraph/graphic/contributions/index.js.map +1 -1
  80. package/es/scenegraph/group-creater/cell-type/spark-line-cell.js +14 -3
  81. package/es/scenegraph/group-creater/cell-type/spark-line-cell.js.map +1 -1
  82. package/es/scenegraph/layout/update-height.js +1 -1
  83. package/es/scenegraph/layout/update-height.js.map +1 -1
  84. package/es/scenegraph/layout/update-width.js +1 -1
  85. package/es/scenegraph/layout/update-width.js.map +1 -1
  86. package/es/state/checkbox/checkbox.d.ts +1 -0
  87. package/es/state/checkbox/checkbox.js +11 -1
  88. package/es/state/checkbox/checkbox.js.map +1 -1
  89. package/es/state/state.js +1 -1
  90. package/es/state/state.js.map +1 -1
  91. package/es/ts-types/new-data-set.d.ts +8 -2
  92. package/es/ts-types/new-data-set.js +2 -1
  93. package/es/ts-types/new-data-set.js.map +1 -1
  94. package/es/ts-types/table-engine.d.ts +2 -2
  95. package/es/ts-types/table-engine.js.map +1 -1
  96. package/es/vrender.js.map +1 -1
  97. package/package.json +4 -4
package/dist/vtable.js CHANGED
@@ -25611,6 +25611,10 @@
25611
25611
  (function (SortType) {
25612
25612
  SortType["ASC"] = "ASC";
25613
25613
  SortType["DESC"] = "DESC";
25614
+ SortType["NORMAL"] = "NORMAL";
25615
+ SortType["desc"] = "desc";
25616
+ SortType["asc"] = "asc";
25617
+ SortType["normal"] = "normal";
25614
25618
  })(SortType || (SortType = {}));
25615
25619
 
25616
25620
  var IconPosition;
@@ -28871,6 +28875,7 @@
28871
28875
  }
28872
28876
  reset() {
28873
28877
  this.records = [];
28878
+ this.clearCacheValue();
28874
28879
  }
28875
28880
  }
28876
28881
  class RecordAggregator extends Aggregator {
@@ -29016,7 +29021,7 @@
29016
29021
  }
29017
29022
  if (record.className === 'Aggregator') {
29018
29023
  const value = record.value();
29019
- this.sum += value;
29024
+ this.sum += value ?? 0;
29020
29025
  if (this.needSplitPositiveAndNegativeForSum) {
29021
29026
  if (value > 0) {
29022
29027
  this.positiveSum += value;
@@ -29041,7 +29046,7 @@
29041
29046
  }
29042
29047
  }
29043
29048
  value() {
29044
- return this.sum;
29049
+ return this.records?.length >= 1 ? this.sum : undefined;
29045
29050
  }
29046
29051
  positiveValue() {
29047
29052
  return this.positiveSum;
@@ -29050,6 +29055,7 @@
29050
29055
  return this.nagetiveSum;
29051
29056
  }
29052
29057
  reset() {
29058
+ super.reset();
29053
29059
  this.records = [];
29054
29060
  this.sum = 0;
29055
29061
  }
@@ -29061,7 +29067,7 @@
29061
29067
  const record = this.records[i];
29062
29068
  if (record.className === 'Aggregator') {
29063
29069
  const value = record.value();
29064
- this.sum += value;
29070
+ this.sum += value ?? 0;
29065
29071
  if (this.needSplitPositiveAndNegativeForSum) {
29066
29072
  if (value > 0) {
29067
29073
  this.positiveSum += value;
@@ -29156,7 +29162,7 @@
29156
29162
  }
29157
29163
  }
29158
29164
  value() {
29159
- return this.sum / this.count;
29165
+ return this.records?.length >= 1 ? this.sum / this.count : undefined;
29160
29166
  }
29161
29167
  reset() {
29162
29168
  this.records = [];
@@ -29210,7 +29216,7 @@
29210
29216
  }
29211
29217
  }
29212
29218
  value() {
29213
- return this.max;
29219
+ return this.records?.length >= 1 ? this.max : undefined;
29214
29220
  }
29215
29221
  reset() {
29216
29222
  this.records = [];
@@ -29263,7 +29269,7 @@
29263
29269
  }
29264
29270
  }
29265
29271
  value() {
29266
- return this.min;
29272
+ return this.records?.length >= 1 ? this.min : undefined;
29267
29273
  }
29268
29274
  reset() {
29269
29275
  this.records = [];
@@ -29288,16 +29294,23 @@
29288
29294
  }
29289
29295
  }
29290
29296
  }
29291
- function typeSort(a, b) {
29297
+ function typeSort(a, b, sortType) {
29298
+ if (sortType === SortType.NORMAL || sortType === SortType.normal) {
29299
+ return 0;
29300
+ }
29301
+ const factor = sortType === SortType.DESC || sortType === SortType.desc ? -1 : 1;
29292
29302
  if (a && b) {
29293
- return a.toString().localeCompare(b.toString(), 'zh');
29303
+ return a.toString().localeCompare(b.toString(), 'zh') * factor;
29294
29304
  }
29295
29305
  if (a) {
29296
- return 1;
29306
+ return 1 * factor;
29297
29307
  }
29298
- return -1;
29308
+ return -1 * factor;
29299
29309
  }
29300
- function naturalSort(as, bs) {
29310
+ function naturalSort(as, bs, sortType) {
29311
+ if (sortType === SortType.NORMAL || sortType === SortType.normal) {
29312
+ return 0;
29313
+ }
29301
29314
  const rx = /(\d+)|(\D+)/g;
29302
29315
  const rd = /\d/;
29303
29316
  const rz = /^0/;
@@ -29307,40 +29320,41 @@
29307
29320
  let b1;
29308
29321
  let nas = 0;
29309
29322
  let nbs = 0;
29323
+ const factor = sortType === SortType.DESC || sortType === SortType.desc ? -1 : 1;
29310
29324
  if (bs !== null && as === null) {
29311
- return -1;
29325
+ return -1 * factor;
29312
29326
  }
29313
29327
  if (as !== null && bs === null) {
29314
- return 1;
29328
+ return 1 * factor;
29315
29329
  }
29316
29330
  if (typeof as === 'number' && isNaN(as)) {
29317
- return -1;
29331
+ return -1 * factor;
29318
29332
  }
29319
29333
  if (typeof bs === 'number' && isNaN(bs)) {
29320
- return 1;
29334
+ return 1 * factor;
29321
29335
  }
29322
29336
  nas = +as;
29323
29337
  nbs = +bs;
29324
29338
  if (nas < nbs) {
29325
- return -1;
29339
+ return -1 * factor;
29326
29340
  }
29327
29341
  if (nas > nbs) {
29328
- return 1;
29342
+ return 1 * factor;
29329
29343
  }
29330
29344
  if (typeof as === 'number' && typeof bs !== 'number') {
29331
- return -1;
29345
+ return -1 * factor;
29332
29346
  }
29333
29347
  if (typeof bs === 'number' && typeof as !== 'number') {
29334
- return 1;
29348
+ return 1 * factor;
29335
29349
  }
29336
29350
  if (typeof as === 'number' && typeof bs === 'number') {
29337
29351
  return 0;
29338
29352
  }
29339
29353
  if (isNaN(nbs) && !isNaN(nas)) {
29340
- return -1;
29354
+ return -1 * factor;
29341
29355
  }
29342
29356
  if (isNaN(nas) && !isNaN(nbs)) {
29343
- return 1;
29357
+ return 1 * factor;
29344
29358
  }
29345
29359
  a = String(as);
29346
29360
  b = String(bs);
@@ -29348,7 +29362,7 @@
29348
29362
  return 0;
29349
29363
  }
29350
29364
  if (!(rd.test(a) && rd.test(b))) {
29351
- return a > b ? 1 : -1;
29365
+ return (a > b ? 1 : -1) * factor;
29352
29366
  }
29353
29367
  a = a.match(rx);
29354
29368
  b = b.match(rx);
@@ -29357,12 +29371,12 @@
29357
29371
  b1 = b.shift();
29358
29372
  if (a1 !== b1) {
29359
29373
  if (rd.test(a1) && rd.test(b1)) {
29360
- return a1.replace(rz, '.0') - b1.replace(rz, '.0');
29374
+ return (a1.replace(rz, '.0') - b1.replace(rz, '.0')) * factor;
29361
29375
  }
29362
- return a1 > b1 ? 1 : -1;
29376
+ return (a1 > b1 ? 1 : -1) * factor;
29363
29377
  }
29364
29378
  }
29365
- return a.length - b.length;
29379
+ return (a.length - b.length) * factor;
29366
29380
  }
29367
29381
  function sortBy(order) {
29368
29382
  let x;
@@ -29375,35 +29389,43 @@
29375
29389
  lowercase_mapping[x.toLowerCase()] = i;
29376
29390
  }
29377
29391
  }
29378
- return function (a, b) {
29392
+ return function (a, b, sortType) {
29393
+ if (sortType === SortType.NORMAL || sortType === SortType.normal) {
29394
+ return 0;
29395
+ }
29396
+ const factor = sortType === SortType.DESC || sortType === SortType.desc ? -1 : 1;
29397
+ let comparison;
29379
29398
  if (mapping[a] !== null && mapping[a] !== undefined && mapping[b] !== null && mapping[b] !== undefined) {
29380
- return mapping[a] - mapping[b];
29399
+ comparison = mapping[a] - mapping[b];
29381
29400
  }
29382
29401
  else if (mapping[a] !== null && mapping[a] !== undefined) {
29383
- return -1;
29402
+ comparison = -1;
29384
29403
  }
29385
29404
  else if (mapping[b] !== null && mapping[b] !== undefined) {
29386
- return 1;
29405
+ comparison = 1;
29387
29406
  }
29388
29407
  else if (lowercase_mapping[a] !== null &&
29389
29408
  mapping[a] !== undefined &&
29390
29409
  lowercase_mapping[b] !== null &&
29391
29410
  mapping[b] !== undefined) {
29392
- return lowercase_mapping[a] - lowercase_mapping[b];
29411
+ comparison = lowercase_mapping[a] - lowercase_mapping[b];
29393
29412
  }
29394
29413
  else if (lowercase_mapping[a] === null ||
29395
29414
  mapping[a] === undefined ||
29396
29415
  lowercase_mapping[b] === null ||
29397
29416
  mapping[b] === undefined) {
29398
- return 0;
29417
+ comparison = 0;
29399
29418
  }
29400
29419
  else if (lowercase_mapping[a] !== null && mapping[a] !== undefined) {
29401
- return -1;
29420
+ comparison = -1;
29402
29421
  }
29403
29422
  else if (lowercase_mapping[b] !== null && mapping[b] !== undefined) {
29404
- return 1;
29423
+ comparison = 1;
29424
+ }
29425
+ if (isValid$1(comparison)) {
29426
+ return comparison * factor;
29405
29427
  }
29406
- return naturalSort(a, b);
29428
+ return naturalSort(a, b, sortType);
29407
29429
  };
29408
29430
  }
29409
29431
  function _getDependAggregatorValues(aggregators, dependIndicatorKeys) {
@@ -30557,6 +30579,7 @@
30557
30579
  const groupResult = [];
30558
30580
  for (let i = 0; i < records.length; i++) {
30559
30581
  dealWithGroup(records[i], groupResult, groupMap, groupByKeys, 0);
30582
+ records[i].vtableOriginIndex = i;
30560
30583
  }
30561
30584
  return groupResult;
30562
30585
  }
@@ -30637,18 +30660,16 @@
30637
30660
  if (value !== undefined) {
30638
30661
  if (map.has(value)) {
30639
30662
  const index = map.get(value);
30640
- dealWithGroup(record, children[index].children, children[index].map, groupByKeys, level + 1);
30641
- }
30642
- else {
30643
- map.set(value, children.length);
30644
- children.push({
30645
- vtableMerge: true,
30646
- vtableMergeName: value,
30647
- children: [],
30648
- map: new Map()
30649
- });
30650
- dealWithGroup(record, children[children.length - 1].children, children[children.length - 1].map, groupByKeys, level + 1);
30651
- }
30663
+ return dealWithGroup(record, children[index].children, children[index].map, groupByKeys, level + 1);
30664
+ }
30665
+ map.set(value, children.length);
30666
+ children.push({
30667
+ vtableMerge: true,
30668
+ vtableMergeName: value,
30669
+ children: [],
30670
+ map: new Map()
30671
+ });
30672
+ return dealWithGroup(record, children[children.length - 1].children, children[children.length - 1].map, groupByKeys, level + 1);
30652
30673
  }
30653
30674
  }
30654
30675
  function syncGroupCollapseState(oldSource, newSource, oldGroupMap, newGroupMap) {
@@ -35484,7 +35505,7 @@
35484
35505
  let customRender;
35485
35506
  let customLayout;
35486
35507
  const cellLocation = scene.table.getCellLocation(col, row);
35487
- const { vtableMerge } = scene.table.getCellRawRecord(col, row);
35508
+ const { vtableMerge } = scene.table.getCellRawRecord(col, row) || {};
35488
35509
  if (vtableMerge && scene.table.options.groupTitleCustomLayout) {
35489
35510
  customLayout = scene.table.options.groupTitleCustomLayout;
35490
35511
  }
@@ -35839,7 +35860,7 @@
35839
35860
  let customRender;
35840
35861
  let customLayout;
35841
35862
  const cellType = scene.table.getCellLocation(col, row);
35842
- const { vtableMerge } = scene.table.getCellRawRecord(col, row);
35863
+ const { vtableMerge } = scene.table.getCellRawRecord(col, row) || {};
35843
35864
  if (vtableMerge && scene.table.options.groupTitleCustomLayout) {
35844
35865
  customLayout = scene.table.options.groupTitleCustomLayout;
35845
35866
  }
@@ -38681,7 +38702,7 @@
38681
38702
  time = BaseRenderContributionTime.beforeFillStroke;
38682
38703
  useStyle = true;
38683
38704
  order = 0;
38684
- drawShape(group, context, x, y, doFill, doStroke, fVisible, sVisible, groupAttribute, drawContext, fillCb, strokeCb, doFillOrStroke) {
38705
+ drawShape(group, context, xOrigin, yOrigin, doFill, doStroke, fVisible, sVisible, groupAttribute, drawContext, fillCb, strokeCb, doFillOrStroke) {
38685
38706
  const table = group.stage.table;
38686
38707
  if (!table) {
38687
38708
  return;
@@ -38691,89 +38712,80 @@
38691
38712
  const y = -(group.attribute.y ?? 0) + table.getFrozenRowsHeight();
38692
38713
  const width = group.parent.attribute.width - table.getFrozenColsWidth() - table.getRightFrozenColsWidth();
38693
38714
  const height = group.parent.attribute.height - table.getFrozenRowsHeight() - table.getBottomFrozenRowsHeight();
38694
- context.beginPath();
38695
- context.rect(x, y, width, height);
38715
+ drawClipRect(context, x, y, width, height);
38696
38716
  }
38697
38717
  else if (group.role === 'row-header') {
38698
38718
  const x = 0;
38699
38719
  const y = -(group.attribute.y ?? 0) + table.getFrozenRowsHeight();
38700
38720
  const width = table.getFrozenColsWidth();
38701
38721
  const height = group.parent.attribute.height - table.getFrozenRowsHeight() - table.getBottomFrozenRowsHeight();
38702
- context.beginPath();
38703
- context.rect(x, y, width, height);
38722
+ drawClipRect(context, x, y, width, height);
38704
38723
  }
38705
38724
  else if (group.role === 'col-header') {
38706
38725
  const x = -(group.attribute.x ?? 0) + table.getFrozenColsWidth();
38707
38726
  const y = 0;
38708
38727
  const width = group.parent.attribute.width - table.getFrozenColsWidth() - table.getRightFrozenColsWidth();
38709
38728
  const height = table.getFrozenRowsHeight();
38710
- context.beginPath();
38711
- context.rect(x, y, width, height);
38729
+ drawClipRect(context, x, y, width, height);
38712
38730
  }
38713
38731
  else if (group.role === 'right-frozen') {
38714
38732
  const x = 0;
38715
38733
  const y = -(group.attribute.y ?? 0) + table.getFrozenRowsHeight();
38716
38734
  const width = table.getRightFrozenColsWidth();
38717
38735
  const height = group.parent.attribute.height - table.getFrozenRowsHeight() - table.getBottomFrozenRowsHeight();
38718
- context.beginPath();
38719
- context.rect(x, y, width, height);
38736
+ drawClipRect(context, x, y, width, height);
38720
38737
  }
38721
38738
  else if (group.role === 'bottom-frozen') {
38722
38739
  const x = -(group.attribute.x ?? 0) + table.getFrozenColsWidth();
38723
38740
  const y = 0;
38724
38741
  const width = group.parent.attribute.width - table.getFrozenColsWidth() - table.getRightFrozenColsWidth();
38725
38742
  const height = table.getBottomFrozenRowsHeight();
38726
- context.beginPath();
38727
- context.rect(x, y, width, height);
38743
+ drawClipRect(context, x, y, width, height);
38728
38744
  }
38729
38745
  else if (group.role === 'corner-header') {
38730
38746
  const x = 0;
38731
38747
  const y = 0;
38732
38748
  const width = table.getFrozenColsWidth();
38733
38749
  const height = table.getFrozenRowsHeight();
38734
- context.beginPath();
38735
- context.rect(x, y, width, height);
38750
+ drawClipRect(context, x, y, width, height);
38736
38751
  }
38737
38752
  else if (group.role === 'corner-right-top-header') {
38738
38753
  const x = 0;
38739
38754
  const y = 0;
38740
38755
  const width = table.getRightFrozenColsWidth();
38741
38756
  const height = table.getFrozenRowsHeight();
38742
- context.beginPath();
38743
- context.rect(x, y, width, height);
38757
+ drawClipRect(context, x, y, width, height);
38744
38758
  }
38745
38759
  else if (group.role === 'corner-right-bottom-header') {
38746
38760
  const x = 0;
38747
38761
  const y = 0;
38748
38762
  const width = table.getRightFrozenColsWidth();
38749
38763
  const height = table.getBottomFrozenRowsHeight();
38750
- context.beginPath();
38751
- context.rect(x, y, width, height);
38764
+ drawClipRect(context, x, y, width, height);
38752
38765
  }
38753
38766
  else if (group.role === 'corner-left-bottom-header') {
38754
38767
  const x = 0;
38755
38768
  const y = 0;
38756
38769
  const width = table.getFrozenColsWidth();
38757
38770
  const height = table.getBottomFrozenRowsHeight();
38758
- context.beginPath();
38759
- context.rect(x, y, width, height);
38771
+ drawClipRect(context, x, y, width, height);
38760
38772
  }
38761
38773
  }
38762
38774
  };
38763
38775
  ClipBodyGroupBeforeRenderContribution = __decorate([
38764
38776
  injectable()
38765
38777
  ], ClipBodyGroupBeforeRenderContribution);
38766
- let ClipBodyGroupAfterRenderContribution = class ClipBodyGroupAfterRenderContribution {
38767
- time = BaseRenderContributionTime.afterFillStroke;
38768
- useStyle = true;
38769
- order = 0;
38770
- drawShape(group, context, x, y, doFill, doStroke, fVisible, sVisible, groupAttribute, drawContext, fillCb, strokeCb) {
38771
- if (group.role === 'body') ;
38778
+ const precision = Math.pow(2, 24);
38779
+ function drawClipRect(context, x, y, width, height) {
38780
+ context.beginPath();
38781
+ const matrix = context.applyedMatrix;
38782
+ if (Math.abs(matrix.f) > precision || Math.abs(matrix.g) > precision) {
38783
+ context.rect(x - precision, y - precision, width + precision * 2, height + precision * 2);
38772
38784
  }
38773
- };
38774
- ClipBodyGroupAfterRenderContribution = __decorate([
38775
- injectable()
38776
- ], ClipBodyGroupAfterRenderContribution);
38785
+ else {
38786
+ context.rect(x, y, width, height);
38787
+ }
38788
+ }
38777
38789
  function getCellSizeForDraw(group, width, height, bottomRight) {
38778
38790
  const table = group.stage.table;
38779
38791
  if (group.role === 'cell') {
@@ -39223,8 +39235,6 @@
39223
39235
  bind(GroupRenderContribution).toService(AdjustPosGroupAfterRenderContribution);
39224
39236
  bind(ClipBodyGroupBeforeRenderContribution).toSelf().inSingletonScope();
39225
39237
  bind(GroupRenderContribution).toService(ClipBodyGroupBeforeRenderContribution);
39226
- bind(ClipBodyGroupAfterRenderContribution).toSelf().inSingletonScope();
39227
- bind(GroupRenderContribution).toService(ClipBodyGroupAfterRenderContribution);
39228
39238
  bind(VTableDrawItemInterceptorContribution).toSelf().inSingletonScope();
39229
39239
  bind(DrawItemInterceptor).toService(VTableDrawItemInterceptorContribution);
39230
39240
  bind(SuffixTextBeforeRenderContribution).toSelf().inSingletonScope();
@@ -46814,6 +46824,18 @@
46814
46824
  checkedState[targetIndex] = sourceRecord;
46815
46825
  }
46816
46826
  }
46827
+ function getGroupCheckboxState(table) {
46828
+ const result = [];
46829
+ const dataSource = table.dataSource;
46830
+ const groupKeyLength = dataSource.dataConfig.groupByRules.length + 1;
46831
+ dataSource.currentIndexedData.forEach((indexArr, index) => {
46832
+ if (isArray$1(indexArr) && indexArr.length === groupKeyLength) {
46833
+ const { vtableOriginIndex } = dataSource.getRawRecord(indexArr);
46834
+ result[vtableOriginIndex] = table.stateManager.checkedState[indexArr];
46835
+ }
46836
+ });
46837
+ return result;
46838
+ }
46817
46839
 
46818
46840
  function updateResizeRow(xInTable, yInTable, state) {
46819
46841
  xInTable = Math.ceil(xInTable);
@@ -47752,8 +47774,8 @@
47752
47774
  triggerSort(col, row, iconMark, event) {
47753
47775
  if (this.table.isPivotTable()) {
47754
47776
  const sortState = this.table.getPivotSortState(col, row);
47755
- const order = sortState ? sortState.toUpperCase() : 'DESC';
47756
- const new_order = order === 'ASC' ? 'DESC' : 'ASC';
47777
+ const order = sortState ? sortState.toUpperCase() : 'NORMAL';
47778
+ const new_order = order === 'ASC' ? 'DESC' : order === 'DESC' ? 'NORMAL' : 'ASC';
47757
47779
  this.table.sort(col, row, new_order);
47758
47780
  this.table.fireListeners(PIVOT_TABLE_EVENT_TYPE.PIVOT_SORT_CLICK, {
47759
47781
  col: col,
@@ -48631,27 +48653,11 @@
48631
48653
  }
48632
48654
  });
48633
48655
  table.scenegraph.tableGroup.addEventListener('pointertap', (e) => {
48634
- if (table.stateManager.columnResize.resizing || table.stateManager.columnMove.moving) {
48635
- return;
48636
- }
48637
48656
  const eventArgsSet = getCellEventArgsSet(e);
48638
- eventManager.dealIconClick(e, eventArgsSet);
48639
- if (!eventArgsSet?.eventArgs) {
48640
- return;
48641
- }
48642
- if (eventManager.touchSetTimeout) {
48643
- if (e.pointerType === 'touch') {
48644
- const eventArgsSet = getCellEventArgsSet(e);
48645
- if (eventManager.touchSetTimeout) {
48646
- clearTimeout(eventManager.touchSetTimeout);
48647
- const isHasSelected = !!stateManager.select.ranges?.length;
48648
- eventManager.dealTableSelect(eventArgsSet);
48649
- stateManager.endSelectCells(true, isHasSelected);
48650
- eventManager.touchSetTimeout = undefined;
48651
- }
48652
- }
48653
- }
48654
- if (!eventManager.touchMove && e.button === 0 && table.hasListeners(TABLE_EVENT_TYPE.CLICK_CELL)) {
48657
+ if (!eventManager.touchMove &&
48658
+ e.button === 0 &&
48659
+ eventArgsSet.eventArgs &&
48660
+ table.hasListeners(TABLE_EVENT_TYPE.CLICK_CELL)) {
48655
48661
  const { col, row } = eventArgsSet.eventArgs;
48656
48662
  const cellInfo = table.getCellInfo(col, row);
48657
48663
  let icon;
@@ -48680,6 +48686,25 @@
48680
48686
  };
48681
48687
  table.fireListeners(TABLE_EVENT_TYPE.CLICK_CELL, cellsEvent);
48682
48688
  }
48689
+ if (table.stateManager.columnResize.resizing || table.stateManager.columnMove.moving) {
48690
+ return;
48691
+ }
48692
+ eventManager.dealIconClick(e, eventArgsSet);
48693
+ if (!eventArgsSet?.eventArgs) {
48694
+ return;
48695
+ }
48696
+ if (eventManager.touchSetTimeout) {
48697
+ if (e.pointerType === 'touch') {
48698
+ const eventArgsSet = getCellEventArgsSet(e);
48699
+ if (eventManager.touchSetTimeout) {
48700
+ clearTimeout(eventManager.touchSetTimeout);
48701
+ const isHasSelected = !!stateManager.select.ranges?.length;
48702
+ eventManager.dealTableSelect(eventArgsSet);
48703
+ stateManager.endSelectCells(true, isHasSelected);
48704
+ eventManager.touchSetTimeout = undefined;
48705
+ }
48706
+ }
48707
+ }
48683
48708
  });
48684
48709
  table.scenegraph.stage.addEventListener('pointerdown', (e) => {
48685
48710
  const eventArgsSet = getCellEventArgsSet(e);
@@ -51834,7 +51859,7 @@
51834
51859
  (headerC.columns && headerC.columns.length > 0)) {
51835
51860
  return null;
51836
51861
  }
51837
- const icon = order === 'ASC' ? this.downIcon : order === 'DESC' ? this.upIcon : this.normalIcon;
51862
+ const icon = order?.toUpperCase() === 'ASC' ? this.downIcon : order?.toUpperCase() === 'DESC' ? this.upIcon : this.normalIcon;
51838
51863
  return icon;
51839
51864
  }
51840
51865
  getDropDownStateIcons(_table, col, row) {
@@ -54412,7 +54437,7 @@
54412
54437
  return TABLE_EVENT_TYPE;
54413
54438
  }
54414
54439
  options;
54415
- version = "1.7.3";
54440
+ version = "1.7.4";
54416
54441
  pagination;
54417
54442
  id = `VTable${Date.now()}`;
54418
54443
  headerStyleCache;
@@ -60802,7 +60827,11 @@
60802
60827
  this.stateManager.initLeftRecordsCheckState(this.records);
60803
60828
  }
60804
60829
  if (isValid$1(field)) {
60805
- return this.stateManager.checkedState.map(state => {
60830
+ let stateArr = this.stateManager.checkedState;
60831
+ if (this.options.groupBy) {
60832
+ stateArr = getGroupCheckboxState(this);
60833
+ }
60834
+ return stateArr.map(state => {
60806
60835
  return state[field];
60807
60836
  });
60808
60837
  }
@@ -64643,13 +64672,14 @@
64643
64672
  yField = sparklineSpec.yField.field;
64644
64673
  }
64645
64674
  else if (typeof sparklineSpec.yField === 'string') {
64646
- const values = dataValue.map((value) => value[sparklineSpec.yField]);
64675
+ const values = getYNumbers(dataValue, sparklineSpec.yField);
64647
64676
  yScale.domain([Math.min(...values), Math.max(...values)]);
64648
64677
  yField = sparklineSpec.yField;
64649
64678
  }
64650
64679
  else {
64651
- if (Array.isArray(dataValue) && dataValue.every((value) => typeof value === 'number')) {
64652
- yScale.domain([Math.min(...dataValue), Math.max(...dataValue)]);
64680
+ if (Array.isArray(dataValue)) {
64681
+ const values = getYNumbers(dataValue);
64682
+ yScale.domain([Math.min(...values), Math.max(...values)]);
64653
64683
  yField = sparklineSpec.yField;
64654
64684
  }
64655
64685
  }
@@ -64784,6 +64814,19 @@
64784
64814
  }
64785
64815
  return group;
64786
64816
  }
64817
+ function getYNumbers(data, field) {
64818
+ const numbers = [];
64819
+ for (let i = 0; i < data.length; i++) {
64820
+ const item = data[i];
64821
+ if (isValid$1(field) && isValid$1(item[field])) {
64822
+ numbers.push(item[field]);
64823
+ }
64824
+ else if (!isValid$1(field) && isValid$1(item)) {
64825
+ numbers.push(item);
64826
+ }
64827
+ }
64828
+ return numbers;
64829
+ }
64787
64830
 
64788
64831
  const regedIcons = get$2();
64789
64832
  function createVideoCellGroup(columnGroup, xOrigin, yOrigin, col, row, width, height, keepAspectRatio, imageAutoSizing, padding, textAlign, textBaseline, mayHaveIcon, table, cellTheme, range, isAsync) {
@@ -65845,9 +65888,9 @@
65845
65888
  this.sharedVar.seqId = Math.max(this.sharedVar.seqId, this._headerObjects.length);
65846
65889
  let colDimensionKeys = this.columnDimensionTree.dimensionKeysIncludeVirtual.valueArr();
65847
65890
  if (this.dataset &&
65891
+ !this._table.isPivotChart() &&
65848
65892
  (this.dataset.records?.length ?? 0) === 0 &&
65849
- !this.dataset.customColTree &&
65850
- !this.dataset.customRowTree) {
65893
+ !this.dataset.customColTree) {
65851
65894
  colDimensionKeys = this.columnsDefine.map(define => {
65852
65895
  if (typeof define === 'string') {
65853
65896
  return define;
@@ -65875,8 +65918,8 @@
65875
65918
  else {
65876
65919
  rowDimensionKeys = this.rowDimensionTree.dimensionKeysIncludeVirtual.valueArr();
65877
65920
  if (this.dataset &&
65921
+ !this._table.isPivotChart() &&
65878
65922
  (this.dataset.records?.length ?? 0) === 0 &&
65879
- !this.dataset.customColTree &&
65880
65923
  !this.dataset.customRowTree) {
65881
65924
  rowDimensionKeys = this.rowsDefine.map(define => {
65882
65925
  if (typeof define === 'string') {
@@ -65994,6 +66037,7 @@
65994
66037
  if (this.columnDimensionTree.tree.children?.length >= 1) {
65995
66038
  let startRow = 0;
65996
66039
  if (this.dataset &&
66040
+ !this._table.isPivotChart() &&
65997
66041
  (this.dataset.records?.length ?? 0) === 0 &&
65998
66042
  !this.dataset.customColTree &&
65999
66043
  !this.dataset.customRowTree &&
@@ -66042,6 +66086,7 @@
66042
66086
  else {
66043
66087
  let startRow = 0;
66044
66088
  if (this.dataset &&
66089
+ !this._table.isPivotChart() &&
66045
66090
  (this.dataset.records?.length ?? 0) === 0 &&
66046
66091
  !this.dataset.customColTree &&
66047
66092
  !this.dataset.customRowTree &&
@@ -66768,30 +66813,22 @@
66768
66813
  : this.columnDimensionTree.totalLevel
66769
66814
  : this.columnDimensionTree.totalLevel
66770
66815
  : this.columnDimensionTree.totalLevel;
66771
- if (this.columnHeaderTitle) {
66772
- count += 1;
66773
- }
66774
- if (this._table.isPivotChart() &&
66775
- this.indicatorsAsCol &&
66776
- !this.hasTwoIndicatorAxes &&
66777
- checkHasCartesianChart(this.indicatorsDefine)) {
66778
- count -= 1;
66779
- }
66780
66816
  if (count === 0 &&
66781
66817
  this.dataset &&
66782
66818
  !this.dataset.customColTree?.length) {
66783
66819
  if (this.cornerSetting.titleOnDimension === 'row' && this.cornerSetting.forceShowHeader) {
66784
66820
  count = 1;
66785
66821
  }
66786
- else if ((this.dataset.records?.length ?? 0) === 0 &&
66822
+ else if (!this._table.isPivotChart() &&
66823
+ (this.dataset.records?.length ?? 0) === 0 &&
66787
66824
  (this.cornerSetting.titleOnDimension === 'column' || this.cornerSetting.titleOnDimension === 'all')) {
66788
66825
  count = this.columnsDefine.length ?? 0;
66789
66826
  }
66790
66827
  }
66791
66828
  else if (this.dataset &&
66829
+ !this._table.isPivotChart() &&
66792
66830
  (this.dataset.records?.length ?? 0) === 0 &&
66793
- !this.dataset.customColTree &&
66794
- !this.dataset.customRowTree) {
66831
+ !this.dataset.customColTree) {
66795
66832
  if (this.cornerSetting.titleOnDimension === 'column' || this.cornerSetting.titleOnDimension === 'all') {
66796
66833
  count = this.columnsDefine.length ?? 0;
66797
66834
  if (!this.hideIndicatorName && this.indicatorsAsCol) {
@@ -66799,6 +66836,15 @@
66799
66836
  }
66800
66837
  }
66801
66838
  }
66839
+ if (this.columnHeaderTitle) {
66840
+ count += 1;
66841
+ }
66842
+ if (this._table.isPivotChart() &&
66843
+ this.indicatorsAsCol &&
66844
+ !this.hasTwoIndicatorAxes &&
66845
+ checkHasCartesianChart(this.indicatorsDefine)) {
66846
+ count -= 1;
66847
+ }
66802
66848
  this.columnHeaderLevelCount = count;
66803
66849
  return;
66804
66850
  }
@@ -66818,28 +66864,21 @@
66818
66864
  }
66819
66865
  const rowLevelCount = this.rowDimensionTree.totalLevel;
66820
66866
  let count = rowLevelCount;
66821
- if (this.indicatorsAsCol) ;
66822
- else if (this.hideIndicatorName &&
66823
- this.rowDimensionKeys[this.rowDimensionKeys.length - 1] === this.indicatorDimensionKey) {
66824
- count = rowLevelCount - 1;
66825
- }
66826
- if (this.rowHeaderTitle) {
66827
- count += 1;
66828
- }
66829
66867
  if (count === 0 &&
66830
66868
  this.dataset &&
66831
66869
  !this.dataset.customRowTree?.length) {
66832
66870
  if (this.cornerSetting.titleOnDimension === 'column' && this.cornerSetting.forceShowHeader) {
66833
66871
  count = 1;
66834
66872
  }
66835
- else if ((this.dataset.records?.length ?? 0) === 0 &&
66873
+ else if (!this._table.isPivotChart() &&
66874
+ (this.dataset.records?.length ?? 0) === 0 &&
66836
66875
  (this.cornerSetting.titleOnDimension === 'row' || this.cornerSetting.titleOnDimension === 'all')) {
66837
66876
  count = this.rowsDefine.length ?? 0;
66838
66877
  }
66839
66878
  }
66840
66879
  else if (this.dataset &&
66880
+ !this._table.isPivotChart() &&
66841
66881
  (this.dataset.records?.length ?? 0) === 0 &&
66842
- !this.dataset.customColTree &&
66843
66882
  !this.dataset.customRowTree) {
66844
66883
  if (this.cornerSetting.titleOnDimension === 'row' || this.cornerSetting.titleOnDimension === 'all') {
66845
66884
  count = this.rowsDefine.length;
@@ -66848,6 +66887,14 @@
66848
66887
  }
66849
66888
  }
66850
66889
  }
66890
+ if (!this.indicatorsAsCol &&
66891
+ this.hideIndicatorName &&
66892
+ this.rowDimensionKeys[this.rowDimensionKeys.length - 1] === this.indicatorDimensionKey) {
66893
+ count = rowLevelCount - 1;
66894
+ }
66895
+ if (this.rowHeaderTitle) {
66896
+ count += 1;
66897
+ }
66851
66898
  this.rowHeaderLevelCount = count;
66852
66899
  return;
66853
66900
  }
@@ -67339,6 +67386,7 @@
67339
67386
  return this.isColumnIndicatorHeader(col, row) || this.isRowIndicatorHeader(col, row);
67340
67387
  }
67341
67388
  toggleHierarchyState(col, row) {
67389
+ this.colIndex = 0;
67342
67390
  const oldRowHeaderCellIds = this._rowHeaderCellFullPathIds_FULL.slice(0);
67343
67391
  const oldRowHeaderCellPositons = oldRowHeaderCellIds.map((id, row) => {
67344
67392
  return { col, row: row + this.columnHeaderLevelCount };
@@ -68386,6 +68434,13 @@
68386
68434
  const dataset = this.dataset;
68387
68435
  this.rowTree = dataset.rowHeaderTree;
68388
68436
  this.columnTree = dataset.colHeaderTree;
68437
+ const beforeRowDimensions = this.rowDimensionTree.tree.children;
68438
+ this.rowTree?.forEach((node, index) => {
68439
+ const beforeRowDimension = beforeRowDimensions.find(item => item.dimensionKey === node.dimensionKey && item.value === node.value);
68440
+ if (beforeRowDimension) {
68441
+ this._table._syncHierarchyState(beforeRowDimension, node);
68442
+ }
68443
+ });
68389
68444
  this.columnDimensionTree = new DimensionTree(this.columnTree ?? [], this.sharedVar);
68390
68445
  this.rowDimensionTree = new DimensionTree(this.rowTree ?? [], this.sharedVar, this.rowHierarchyType, this.rowHierarchyType === 'tree' ? this.rowExpandLevel : undefined);
68391
68446
  this.resetColumnHeaderLevelCount();
@@ -68894,6 +68949,8 @@
68894
68949
  rowFlatKeys = {};
68895
68950
  colKeys = [];
68896
68951
  rowKeys = [];
68952
+ colKeys_normal = [];
68953
+ rowKeys_normal = [];
68897
68954
  rowOrder = 'key_a_to_z';
68898
68955
  colOrder = 'key_a_to_z';
68899
68956
  sorted = false;
@@ -68936,6 +68993,7 @@
68936
68993
  constructor(dataConfig, rows, columns, indicatorKeys, indicators, indicatorsAsCol, records, rowHierarchyType, customColTree, customRowTree, needSplitPositiveAndNegative) {
68937
68994
  this.registerAggregators();
68938
68995
  this.dataConfig = dataConfig;
68996
+ this.filterRules = this.dataConfig?.filterRules;
68939
68997
  this.rowHierarchyType = rowHierarchyType ?? 'grid';
68940
68998
  this.sortRules = this.dataConfig?.sortRules;
68941
68999
  this.aggregationRules = this.dataConfig?.aggregationRules;
@@ -69013,6 +69071,8 @@
69013
69071
  typeof window !== 'undefined' ? window.performance.now() : 0;
69014
69072
  this.totalStatistics();
69015
69073
  typeof window !== 'undefined' ? window.performance.now() : 0;
69074
+ this.rowKeys_normal = this.rowKeys.slice();
69075
+ this.colKeys_normal = this.colKeys.slice();
69016
69076
  typeof window !== 'undefined' ? window.performance.now() : 0;
69017
69077
  this.sortKeys();
69018
69078
  typeof window !== 'undefined' ? window.performance.now() : 0;
@@ -69136,7 +69196,7 @@
69136
69196
  }
69137
69197
  processRecords() {
69138
69198
  let isNeedFilter = false;
69139
- if ((this.dataConfig?.filterRules?.length ?? 0) >= 1) {
69199
+ if ((this.filterRules?.length ?? 0) >= 1) {
69140
69200
  isNeedFilter = true;
69141
69201
  }
69142
69202
  if (Array.isArray(this.records)) {
@@ -69162,9 +69222,9 @@
69162
69222
  }
69163
69223
  filterRecord(record) {
69164
69224
  let isReserved = true;
69165
- if (this.dataConfig?.filterRules) {
69166
- for (let i = 0; i < this.dataConfig.filterRules.length; i++) {
69167
- const filterRule = this.dataConfig?.filterRules[i];
69225
+ if (this.filterRules) {
69226
+ for (let i = 0; i < this.filterRules.length; i++) {
69227
+ const filterRule = this.filterRules[i];
69168
69228
  if (filterRule.filterKey) {
69169
69229
  const filterValue = record[filterRule.filterKey];
69170
69230
  if (filterRule.filteredValues?.indexOf(filterValue) === -1) {
@@ -69493,6 +69553,7 @@
69493
69553
  this.processRecords();
69494
69554
  this.processCollectedValuesWithSumBy();
69495
69555
  this.processCollectedValuesWithSortBy();
69556
+ this.totalStatistics();
69496
69557
  if (this.dataConfig?.isPivotChart) {
69497
69558
  this.cacheDeminsionCollectedValues();
69498
69559
  }
@@ -69590,41 +69651,13 @@
69590
69651
  };
69591
69652
  }
69592
69653
  sortKeys() {
69593
- const that = this;
69654
+ this.colKeys = this.colKeys_normal.slice();
69655
+ this.rowKeys = this.rowKeys_normal.slice();
69594
69656
  if (!this.sorted) {
69595
69657
  this.sorted = true;
69596
- const getValue = function (rowKey, colKey) {
69597
- return that.getAggregator(rowKey, colKey, '').value();
69598
- };
69599
- switch (this.rowOrder) {
69600
- case 'value_a_to_z':
69601
- this.rowKeys.sort(function (a, b) {
69602
- return naturalSort(getValue(a, []), getValue(b, []));
69603
- });
69604
- break;
69605
- case 'value_z_to_a':
69606
- this.rowKeys.sort(function (a, b) {
69607
- return -naturalSort(getValue(a, []), getValue(b, []));
69608
- });
69609
- break;
69610
- default:
69611
- this.rowKeys.sort(this.arrSort(this.rows, true));
69612
- }
69613
- switch (this.colOrder) {
69614
- case 'value_a_to_z':
69615
- this.colKeys.sort(function (a, b) {
69616
- return naturalSort(getValue([], a), getValue([], b));
69617
- });
69618
- break;
69619
- case 'value_z_to_a':
69620
- this.colKeys.sort(function (a, b) {
69621
- return -naturalSort(getValue([], a), getValue([], b));
69622
- });
69623
- break;
69624
- default:
69625
- const sortfun = this.arrSort(this.columns, false);
69626
- this.colKeys.sort(sortfun);
69627
- }
69658
+ this.rowKeys.sort(this.arrSort(this.rows, true));
69659
+ const sortfun = this.arrSort(this.columns, false);
69660
+ this.colKeys.sort(sortfun);
69628
69661
  }
69629
69662
  }
69630
69663
  arrSort(fieldArr, isRow) {
@@ -69659,17 +69692,27 @@
69659
69692
  let bChanged = b;
69660
69693
  if (sorter.fieldIndex < fieldArr.length - 1) {
69661
69694
  aChanged = a.slice(0, sorter.fieldIndex + 1);
69662
- aChanged.push(isRow ? that.rowSubTotalLabel : that.colSubTotalLabel);
69695
+ if (that.rowHierarchyType === 'grid' && isRow) {
69696
+ aChanged.push(that.rowSubTotalLabel);
69697
+ }
69698
+ else if (!isRow) {
69699
+ aChanged.push(that.colSubTotalLabel);
69700
+ }
69663
69701
  bChanged = b.slice(0, sorter.fieldIndex + 1);
69664
- bChanged.push(isRow ? that.rowSubTotalLabel : that.colSubTotalLabel);
69702
+ if (that.rowHierarchyType === 'grid' && isRow) {
69703
+ bChanged.push(that.rowSubTotalLabel);
69704
+ }
69705
+ else if (!isRow) {
69706
+ bChanged.push(that.colSubTotalLabel);
69707
+ }
69665
69708
  }
69666
- comparison = sorter.func(aChanged, bChanged);
69709
+ comparison = sorter.func(aChanged, bChanged, sorter.sortRule?.sortType);
69667
69710
  }
69668
69711
  else {
69669
- comparison = sorter.func?.(a[sorter.fieldIndex], b[sorter.fieldIndex]);
69712
+ comparison = sorter.func?.(a[sorter.fieldIndex], b[sorter.fieldIndex], sorter.sortRule?.sortType);
69670
69713
  }
69671
69714
  if (comparison !== 0) {
69672
- return comparison * (sorter.sortRule?.sortType === SortType.DESC ? -1 : 1);
69715
+ return comparison;
69673
69716
  }
69674
69717
  }
69675
69718
  return 0;
@@ -69678,9 +69721,10 @@
69678
69721
  getSort(sortRule, isSortRow) {
69679
69722
  const that = this;
69680
69723
  if (sortRule.sortByIndicator) {
69681
- return (a, b) => {
69724
+ return (a, b, sortType) => {
69682
69725
  const getValue = function (rowKey, colKey) {
69683
- if (rowKey.length < that.rows.length &&
69726
+ if (that.rowHierarchyType === 'grid' &&
69727
+ rowKey.length < that.rows.length &&
69684
69728
  rowKey[rowKey.length - 1] !== that.rowSubTotalLabel &&
69685
69729
  rowKey[rowKey.length - 1] !== that.rowGrandTotalLabel) {
69686
69730
  rowKey.push(that.rowSubTotalLabel);
@@ -69693,20 +69737,20 @@
69693
69737
  return that.getAggregator(rowKey, colKey, sortRule.sortByIndicator).value();
69694
69738
  };
69695
69739
  if (isSortRow) {
69696
- return naturalSort(getValue(a, sortRule.query), getValue(b, sortRule.query));
69740
+ return naturalSort(getValue(a, sortRule.query), getValue(b, sortRule.query), sortType);
69697
69741
  }
69698
- return naturalSort(getValue(sortRule.query, a), getValue(sortRule.query, b));
69742
+ return naturalSort(getValue(sortRule.query, a), getValue(sortRule.query, b), sortType);
69699
69743
  };
69700
69744
  }
69701
69745
  else if (sortRule.sortBy) {
69702
69746
  return sortBy(sortRule.sortBy);
69703
69747
  }
69704
- if (sortRule.sortType) {
69705
- return typeSort;
69706
- }
69707
69748
  if (sortRule.sortFunc) {
69708
69749
  return sortRule.sortFunc;
69709
69750
  }
69751
+ if (sortRule.sortType) {
69752
+ return typeSort;
69753
+ }
69710
69754
  return naturalSort;
69711
69755
  }
69712
69756
  totalStatistics() {
@@ -69759,7 +69803,9 @@
69759
69803
  dependIndicatorKeys: calculatedFieldRule?.dependIndicatorKeys
69760
69804
  });
69761
69805
  }
69762
- this.tree[flatRowKey][flatColTotalKey][i].push(that.tree[flatRowKey]?.[flatColKey]?.[i]);
69806
+ if (flatColTotalKey !== flatColKey) {
69807
+ this.tree[flatRowKey][flatColTotalKey][i].push(that.tree[flatRowKey]?.[flatColKey]?.[i]);
69808
+ }
69763
69809
  }
69764
69810
  else {
69765
69811
  if (!this.tree[flatRowKey][flatColTotalKey][i]) {
@@ -69776,7 +69822,9 @@
69776
69822
  })?.format
69777
69823
  });
69778
69824
  }
69779
- this.tree[flatRowKey][flatColTotalKey][i].push(that.tree[flatRowKey]?.[flatColKey]?.[i]);
69825
+ if (flatColTotalKey !== flatColKey) {
69826
+ this.tree[flatRowKey][flatColTotalKey][i].push(that.tree[flatRowKey]?.[flatColKey]?.[i]);
69827
+ }
69780
69828
  }
69781
69829
  }
69782
69830
  }
@@ -69811,7 +69859,9 @@
69811
69859
  dependIndicatorKeys: calculatedFieldRule?.dependIndicatorKeys
69812
69860
  });
69813
69861
  }
69814
- this.tree[flatRowKey][flatColTotalKey][i].push(that.tree[flatRowKey]?.[flatColKey]?.[i]);
69862
+ if (flatColTotalKey !== flatColKey) {
69863
+ this.tree[flatRowKey][flatColTotalKey][i].push(that.tree[flatRowKey]?.[flatColKey]?.[i]);
69864
+ }
69815
69865
  }
69816
69866
  else {
69817
69867
  if (!this.tree[flatRowKey][flatColTotalKey][i]) {
@@ -69828,7 +69878,9 @@
69828
69878
  })?.format
69829
69879
  });
69830
69880
  }
69831
- this.tree[flatRowKey][flatColTotalKey][i].push(that.tree[flatRowKey]?.[flatColKey]?.[i]);
69881
+ if (flatColTotalKey !== flatColKey) {
69882
+ this.tree[flatRowKey][flatColTotalKey][i].push(that.tree[flatRowKey]?.[flatColKey]?.[i]);
69883
+ }
69832
69884
  }
69833
69885
  }
69834
69886
  }
@@ -69890,7 +69942,9 @@
69890
69942
  });
69891
69943
  }
69892
69944
  }
69893
- this.tree[flatRowTotalKey][flatColKey][i].push(that.tree[flatRowKey]?.[flatColKey]?.[i]);
69945
+ if (flatRowTotalKey !== flatRowKey) {
69946
+ this.tree[flatRowTotalKey][flatColKey][i].push(that.tree[flatRowKey]?.[flatColKey]?.[i]);
69947
+ }
69894
69948
  }
69895
69949
  }
69896
69950
  }
@@ -69939,7 +69993,9 @@
69939
69993
  });
69940
69994
  }
69941
69995
  }
69942
- this.tree[flatRowTotalKey][flatColKey][i].push(that.tree[flatRowKey]?.[flatColKey]?.[i]);
69996
+ if (flatRowTotalKey !== flatRowKey) {
69997
+ this.tree[flatRowTotalKey][flatColKey][i].push(that.tree[flatRowKey]?.[flatColKey]?.[i]);
69998
+ }
69943
69999
  }
69944
70000
  }
69945
70001
  colCompute(flatRowKey, flatColKey);
@@ -70398,7 +70454,7 @@
70398
70454
  this.internalProps.rowTree?.forEach((node, index) => {
70399
70455
  const beforeRowDimension = beforeRowDimensions.find(item => item.dimensionKey === node.dimensionKey && item.value === node.value);
70400
70456
  if (beforeRowDimension) {
70401
- this.syncHierarchyState(beforeRowDimension, node);
70457
+ this._syncHierarchyState(beforeRowDimension, node);
70402
70458
  }
70403
70459
  });
70404
70460
  }
@@ -70531,7 +70587,7 @@
70531
70587
  get rowHierarchyType() {
70532
70588
  return this.internalProps.layoutMap.rowHierarchyType;
70533
70589
  }
70534
- syncHierarchyState(sourceNode, targetNode) {
70590
+ _syncHierarchyState(sourceNode, targetNode) {
70535
70591
  if (sourceNode.value === targetNode.value && sourceNode.dimensionKey === targetNode.dimensionKey) {
70536
70592
  targetNode.hierarchyState =
70537
70593
  targetNode.hierarchyState ?? (targetNode?.children ? sourceNode.hierarchyState : undefined);
@@ -70539,7 +70595,7 @@
70539
70595
  if (sourceNode?.children?.[index] && targetChildNode) {
70540
70596
  const beforeRowDimension = sourceNode.children.find((item) => item.dimensionKey === targetChildNode.dimensionKey && item.value === targetChildNode.value);
70541
70597
  if (beforeRowDimension) {
70542
- this.syncHierarchyState(beforeRowDimension, targetChildNode);
70598
+ this._syncHierarchyState(beforeRowDimension, targetChildNode);
70543
70599
  }
70544
70600
  }
70545
70601
  });
@@ -70972,38 +71028,36 @@
70972
71028
  const sortRules = this.internalProps.dataConfig?.sortRules ?? [];
70973
71029
  for (let i = 0; i < sortRules.length; i++) {
70974
71030
  const sortRule = sortRules[i];
70975
- if (sortRule.sortType) {
70976
- const dimensions = [];
70977
- if (sortRule.sortByIndicator) {
70978
- if (sortRule.sortField ===
70979
- (this.dataset.indicatorsAsCol
70980
- ? this.dataset.rows[this.dataset.rows.length - 1]
70981
- : this.dataset.columns[this.dataset.columns.length - 1])) {
70982
- for (let j = 0; j < sortRule.query.length; j++) {
70983
- dimensions.push({
70984
- dimensionKey: this.dataset.indicatorsAsCol ? this.dataset.columns[j] : this.dataset.rows[j],
70985
- value: sortRule.query[j]
70986
- });
70987
- }
70988
- dimensions.push({
70989
- indicatorKey: sortRule.sortByIndicator,
70990
- value: this.internalProps.layoutMap.getIndicatorInfo(sortRule.sortByIndicator)
70991
- ?.title ?? sortRule.sortByIndicator
70992
- });
70993
- }
70994
- }
70995
- else {
71031
+ const dimensions = [];
71032
+ if (sortRule.sortByIndicator &&
71033
+ sortRule.sortField ===
71034
+ (this.dataset.indicatorsAsCol
71035
+ ? this.dataset.rows[this.dataset.rows.length - 1]
71036
+ : this.dataset.columns[this.dataset.columns.length - 1])) {
71037
+ for (let j = 0; j < sortRule.query.length; j++) {
70996
71038
  dimensions.push({
70997
- dimensionKey: sortRule.sortField,
70998
- isPivotCorner: true,
70999
- value: sortRule.sortField
71039
+ dimensionKey: this.dataset.indicatorsAsCol ? this.dataset.columns[j] : this.dataset.rows[j],
71040
+ value: sortRule.query[j]
71000
71041
  });
71001
71042
  }
71002
- this.pivotSortState.push({
71003
- dimensions,
71004
- order: sortRule.sortType
71043
+ dimensions.push({
71044
+ indicatorKey: sortRule.sortByIndicator,
71045
+ value: this.internalProps.layoutMap.getIndicatorInfo(sortRule.sortByIndicator)?.title ??
71046
+ sortRule.sortByIndicator
71005
71047
  });
71006
71048
  }
71049
+ else {
71050
+ dimensions.push({
71051
+ dimensionKey: sortRule.sortField,
71052
+ isPivotCorner: true,
71053
+ value: sortRule.sortField
71054
+ });
71055
+ }
71056
+ const sortType = sortRule.sortType ? sortRule.sortType.toUpperCase() : 'ASC';
71057
+ this.pivotSortState.push({
71058
+ dimensions,
71059
+ order: SortType[sortType]
71060
+ });
71007
71061
  }
71008
71062
  }
71009
71063
  updatePivotSortState(pivotSortStateConfig) {
@@ -71031,9 +71085,11 @@
71031
71085
  const headerDefine = this.getHeaderDefine(col, row);
71032
71086
  if (headerDefine.sort) {
71033
71087
  if (this.dataset.sortRules) {
71088
+ const cacheOldDimensionSortRule = {};
71034
71089
  for (let i = this.dataset.sortRules.length - 1; i >= 0; i--) {
71035
71090
  const sortRule = this.dataset.sortRules[i];
71036
71091
  if (headerDefine.dimensionKey && sortRule.sortField === headerDefine.dimensionKey) {
71092
+ cacheOldDimensionSortRule[sortRule.sortField] = sortRule;
71037
71093
  this.dataset.sortRules.splice(i, 1);
71038
71094
  }
71039
71095
  else if (sortIndicator &&
@@ -71060,10 +71116,10 @@
71060
71116
  });
71061
71117
  }
71062
71118
  else {
71063
- this.dataset.sortRules.push({
71119
+ this.dataset.sortRules.push(Object.assign(cacheOldDimensionSortRule[headerDefine.dimensionKey] ?? {}, {
71064
71120
  sortField: headerDefine.dimensionKey,
71065
71121
  sortType: SortType[order]
71066
- });
71122
+ }));
71067
71123
  }
71068
71124
  }
71069
71125
  else {
@@ -71645,6 +71701,11 @@
71645
71701
  });
71646
71702
  }
71647
71703
  }
71704
+ updateFilterRules(filterRules) {
71705
+ this.internalProps.dataConfig.filterRules = filterRules;
71706
+ this.dataset.updateFilterRules(filterRules);
71707
+ this.renderWithRecreateCells();
71708
+ }
71648
71709
  }
71649
71710
 
71650
71711
  registerAxis();
@@ -73295,7 +73356,7 @@
73295
73356
  }
73296
73357
 
73297
73358
  registerForVrender();
73298
- const version = "1.7.3";
73359
+ const version = "1.7.4";
73299
73360
  function getIcons() {
73300
73361
  return get$2();
73301
73362
  }