@visactor/vtable 1.7.3 → 1.7.5-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) 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 +35 -25
  25. package/cjs/layout/pivot-header-layout.js.map +1 -1
  26. package/cjs/layout/tree-helper.js +10 -4
  27. package/cjs/layout/tree-helper.js.map +1 -1
  28. package/cjs/scenegraph/graphic/contributions/group-contribution-render.d.ts +1 -7
  29. package/cjs/scenegraph/graphic/contributions/group-contribution-render.js +18 -32
  30. package/cjs/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
  31. package/cjs/scenegraph/graphic/contributions/index.js +0 -2
  32. package/cjs/scenegraph/graphic/contributions/index.js.map +1 -1
  33. package/cjs/scenegraph/group-creater/cell-type/spark-line-cell.js +15 -3
  34. package/cjs/scenegraph/group-creater/cell-type/spark-line-cell.js.map +1 -1
  35. package/cjs/scenegraph/layout/update-height.js +1 -1
  36. package/cjs/scenegraph/layout/update-height.js.map +1 -1
  37. package/cjs/scenegraph/layout/update-width.js +1 -1
  38. package/cjs/scenegraph/layout/update-width.js.map +1 -1
  39. package/cjs/state/checkbox/checkbox.d.ts +1 -0
  40. package/cjs/state/checkbox/checkbox.js +13 -2
  41. package/cjs/state/checkbox/checkbox.js.map +1 -1
  42. package/cjs/state/state.js +1 -1
  43. package/cjs/state/state.js.map +1 -1
  44. package/cjs/ts-types/new-data-set.d.ts +8 -2
  45. package/cjs/ts-types/new-data-set.js +2 -1
  46. package/cjs/ts-types/new-data-set.js.map +1 -1
  47. package/cjs/ts-types/table-engine.d.ts +4 -2
  48. package/cjs/ts-types/table-engine.js.map +1 -1
  49. package/cjs/vrender.js.map +1 -1
  50. package/dist/vtable.js +291 -225
  51. package/dist/vtable.min.js +2 -2
  52. package/es/ListTable.js +7 -3
  53. package/es/ListTable.js.map +1 -1
  54. package/es/PivotTable.d.ts +3 -2
  55. package/es/PivotTable.js +31 -28
  56. package/es/PivotTable.js.map +1 -1
  57. package/es/core/BaseTable.js +1 -1
  58. package/es/core/BaseTable.js.map +1 -1
  59. package/es/data/CachedDataSource.js +14 -10
  60. package/es/data/CachedDataSource.js.map +1 -1
  61. package/es/dataset/dataset-pivot-table.d.ts +2 -2
  62. package/es/dataset/dataset.d.ts +5 -4
  63. package/es/dataset/dataset.js +55 -84
  64. package/es/dataset/dataset.js.map +1 -1
  65. package/es/dataset/statistics-helper.d.ts +4 -3
  66. package/es/dataset/statistics-helper.js +41 -27
  67. package/es/dataset/statistics-helper.js.map +1 -1
  68. package/es/event/listener/table-group.js +28 -30
  69. package/es/event/listener/table-group.js.map +1 -1
  70. package/es/header-helper/header-helper.js +1 -1
  71. package/es/header-helper/header-helper.js.map +1 -1
  72. package/es/index.d.ts +1 -1
  73. package/es/index.js +1 -1
  74. package/es/index.js.map +1 -1
  75. package/es/layout/pivot-header-layout.js +34 -25
  76. package/es/layout/pivot-header-layout.js.map +1 -1
  77. package/es/layout/tree-helper.js +10 -4
  78. package/es/layout/tree-helper.js.map +1 -1
  79. package/es/scenegraph/graphic/contributions/group-contribution-render.d.ts +1 -7
  80. package/es/scenegraph/graphic/contributions/group-contribution-render.js +16 -30
  81. package/es/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
  82. package/es/scenegraph/graphic/contributions/index.js +1 -2
  83. package/es/scenegraph/graphic/contributions/index.js.map +1 -1
  84. package/es/scenegraph/group-creater/cell-type/spark-line-cell.js +14 -3
  85. package/es/scenegraph/group-creater/cell-type/spark-line-cell.js.map +1 -1
  86. package/es/scenegraph/layout/update-height.js +1 -1
  87. package/es/scenegraph/layout/update-height.js.map +1 -1
  88. package/es/scenegraph/layout/update-width.js +1 -1
  89. package/es/scenegraph/layout/update-width.js.map +1 -1
  90. package/es/state/checkbox/checkbox.d.ts +1 -0
  91. package/es/state/checkbox/checkbox.js +11 -1
  92. package/es/state/checkbox/checkbox.js.map +1 -1
  93. package/es/state/state.js +1 -1
  94. package/es/state/state.js.map +1 -1
  95. package/es/ts-types/new-data-set.d.ts +8 -2
  96. package/es/ts-types/new-data-set.js +2 -1
  97. package/es/ts-types/new-data-set.js.map +1 -1
  98. package/es/ts-types/table-engine.d.ts +4 -2
  99. package/es/ts-types/table-engine.js.map +1 -1
  100. package/es/vrender.js.map +1 -1
  101. package/package.json +3 -3
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 : 0;
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) {
@@ -52711,7 +52736,8 @@
52711
52736
  value: node.value,
52712
52737
  hierarchyState: node.hierarchyState,
52713
52738
  children: undefined,
52714
- virtual: node.virtual ?? false
52739
+ virtual: node.virtual ?? false,
52740
+ levelSpan: node.levelSpan ?? 1
52715
52741
  };
52716
52742
  tree.push(diemnsonNode);
52717
52743
  if (node.children) {
@@ -52821,6 +52847,9 @@
52821
52847
  for (let i = 1; i < hd.levelSpan; i++) {
52822
52848
  if (!_headerCellIds[row + i]) {
52823
52849
  _headerCellIds[row + i] = [];
52850
+ for (let col = 0; col < layoutMap.colIndex; col++) {
52851
+ _headerCellIds[row + i][col] = _headerCellIds[row][col];
52852
+ }
52824
52853
  }
52825
52854
  _headerCellIds[row + i][layoutMap.colIndex] = id;
52826
52855
  }
@@ -54412,7 +54441,7 @@
54412
54441
  return TABLE_EVENT_TYPE;
54413
54442
  }
54414
54443
  options;
54415
- version = "1.7.3";
54444
+ version = "1.7.5-alpha.0";
54416
54445
  pagination;
54417
54446
  id = `VTable${Date.now()}`;
54418
54447
  headerStyleCache;
@@ -60802,7 +60831,11 @@
60802
60831
  this.stateManager.initLeftRecordsCheckState(this.records);
60803
60832
  }
60804
60833
  if (isValid$1(field)) {
60805
- return this.stateManager.checkedState.map(state => {
60834
+ let stateArr = this.stateManager.checkedState;
60835
+ if (this.options.groupBy) {
60836
+ stateArr = getGroupCheckboxState(this);
60837
+ }
60838
+ return stateArr.map(state => {
60806
60839
  return state[field];
60807
60840
  });
60808
60841
  }
@@ -64643,13 +64676,14 @@
64643
64676
  yField = sparklineSpec.yField.field;
64644
64677
  }
64645
64678
  else if (typeof sparklineSpec.yField === 'string') {
64646
- const values = dataValue.map((value) => value[sparklineSpec.yField]);
64679
+ const values = getYNumbers(dataValue, sparklineSpec.yField);
64647
64680
  yScale.domain([Math.min(...values), Math.max(...values)]);
64648
64681
  yField = sparklineSpec.yField;
64649
64682
  }
64650
64683
  else {
64651
- if (Array.isArray(dataValue) && dataValue.every((value) => typeof value === 'number')) {
64652
- yScale.domain([Math.min(...dataValue), Math.max(...dataValue)]);
64684
+ if (Array.isArray(dataValue)) {
64685
+ const values = getYNumbers(dataValue);
64686
+ yScale.domain([Math.min(...values), Math.max(...values)]);
64653
64687
  yField = sparklineSpec.yField;
64654
64688
  }
64655
64689
  }
@@ -64784,6 +64818,19 @@
64784
64818
  }
64785
64819
  return group;
64786
64820
  }
64821
+ function getYNumbers(data, field) {
64822
+ const numbers = [];
64823
+ for (let i = 0; i < data.length; i++) {
64824
+ const item = data[i];
64825
+ if (isValid$1(field) && isValid$1(item[field])) {
64826
+ numbers.push(item[field]);
64827
+ }
64828
+ else if (!isValid$1(field) && isValid$1(item)) {
64829
+ numbers.push(item);
64830
+ }
64831
+ }
64832
+ return numbers;
64833
+ }
64787
64834
 
64788
64835
  const regedIcons = get$2();
64789
64836
  function createVideoCellGroup(columnGroup, xOrigin, yOrigin, col, row, width, height, keepAspectRatio, imageAutoSizing, padding, textAlign, textBaseline, mayHaveIcon, table, cellTheme, range, isAsync) {
@@ -65845,9 +65892,9 @@
65845
65892
  this.sharedVar.seqId = Math.max(this.sharedVar.seqId, this._headerObjects.length);
65846
65893
  let colDimensionKeys = this.columnDimensionTree.dimensionKeysIncludeVirtual.valueArr();
65847
65894
  if (this.dataset &&
65895
+ !this._table.isPivotChart() &&
65848
65896
  (this.dataset.records?.length ?? 0) === 0 &&
65849
- !this.dataset.customColTree &&
65850
- !this.dataset.customRowTree) {
65897
+ !this.dataset.customColTree) {
65851
65898
  colDimensionKeys = this.columnsDefine.map(define => {
65852
65899
  if (typeof define === 'string') {
65853
65900
  return define;
@@ -65875,8 +65922,8 @@
65875
65922
  else {
65876
65923
  rowDimensionKeys = this.rowDimensionTree.dimensionKeysIncludeVirtual.valueArr();
65877
65924
  if (this.dataset &&
65925
+ !this._table.isPivotChart() &&
65878
65926
  (this.dataset.records?.length ?? 0) === 0 &&
65879
- !this.dataset.customColTree &&
65880
65927
  !this.dataset.customRowTree) {
65881
65928
  rowDimensionKeys = this.rowsDefine.map(define => {
65882
65929
  if (typeof define === 'string') {
@@ -65994,6 +66041,7 @@
65994
66041
  if (this.columnDimensionTree.tree.children?.length >= 1) {
65995
66042
  let startRow = 0;
65996
66043
  if (this.dataset &&
66044
+ !this._table.isPivotChart() &&
65997
66045
  (this.dataset.records?.length ?? 0) === 0 &&
65998
66046
  !this.dataset.customColTree &&
65999
66047
  !this.dataset.customRowTree &&
@@ -66042,6 +66090,7 @@
66042
66090
  else {
66043
66091
  let startRow = 0;
66044
66092
  if (this.dataset &&
66093
+ !this._table.isPivotChart() &&
66045
66094
  (this.dataset.records?.length ?? 0) === 0 &&
66046
66095
  !this.dataset.customColTree &&
66047
66096
  !this.dataset.customRowTree &&
@@ -66479,7 +66528,8 @@
66479
66528
  });
66480
66529
  }
66481
66530
  else {
66482
- this.rowDimensionKeys.forEach((objKey, index) => {
66531
+ const rowDimensionKeys = this.rowDimensionTree.dimensionKeysIncludeVirtual.valueArr();
66532
+ rowDimensionKeys.forEach((objKey, index) => {
66483
66533
  const dimension = this.rowsDefine?.find(dimension => typeof dimension === 'string' ? false : dimension.dimensionKey === objKey);
66484
66534
  dimension &&
66485
66535
  (returnWidths[index + (this.rowHeaderTitle ? 1 : 0) + this.leftRowSeriesNumberColumnCount] = {
@@ -66768,30 +66818,22 @@
66768
66818
  : this.columnDimensionTree.totalLevel
66769
66819
  : this.columnDimensionTree.totalLevel
66770
66820
  : 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
66821
  if (count === 0 &&
66781
66822
  this.dataset &&
66782
66823
  !this.dataset.customColTree?.length) {
66783
66824
  if (this.cornerSetting.titleOnDimension === 'row' && this.cornerSetting.forceShowHeader) {
66784
66825
  count = 1;
66785
66826
  }
66786
- else if ((this.dataset.records?.length ?? 0) === 0 &&
66827
+ else if (!this._table.isPivotChart() &&
66828
+ (this.dataset.records?.length ?? 0) === 0 &&
66787
66829
  (this.cornerSetting.titleOnDimension === 'column' || this.cornerSetting.titleOnDimension === 'all')) {
66788
66830
  count = this.columnsDefine.length ?? 0;
66789
66831
  }
66790
66832
  }
66791
66833
  else if (this.dataset &&
66834
+ !this._table.isPivotChart() &&
66792
66835
  (this.dataset.records?.length ?? 0) === 0 &&
66793
- !this.dataset.customColTree &&
66794
- !this.dataset.customRowTree) {
66836
+ !this.dataset.customColTree) {
66795
66837
  if (this.cornerSetting.titleOnDimension === 'column' || this.cornerSetting.titleOnDimension === 'all') {
66796
66838
  count = this.columnsDefine.length ?? 0;
66797
66839
  if (!this.hideIndicatorName && this.indicatorsAsCol) {
@@ -66799,6 +66841,15 @@
66799
66841
  }
66800
66842
  }
66801
66843
  }
66844
+ if (this.columnHeaderTitle) {
66845
+ count += 1;
66846
+ }
66847
+ if (this._table.isPivotChart() &&
66848
+ this.indicatorsAsCol &&
66849
+ !this.hasTwoIndicatorAxes &&
66850
+ checkHasCartesianChart(this.indicatorsDefine)) {
66851
+ count -= 1;
66852
+ }
66802
66853
  this.columnHeaderLevelCount = count;
66803
66854
  return;
66804
66855
  }
@@ -66818,28 +66869,21 @@
66818
66869
  }
66819
66870
  const rowLevelCount = this.rowDimensionTree.totalLevel;
66820
66871
  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
66872
  if (count === 0 &&
66830
66873
  this.dataset &&
66831
66874
  !this.dataset.customRowTree?.length) {
66832
66875
  if (this.cornerSetting.titleOnDimension === 'column' && this.cornerSetting.forceShowHeader) {
66833
66876
  count = 1;
66834
66877
  }
66835
- else if ((this.dataset.records?.length ?? 0) === 0 &&
66878
+ else if (!this._table.isPivotChart() &&
66879
+ (this.dataset.records?.length ?? 0) === 0 &&
66836
66880
  (this.cornerSetting.titleOnDimension === 'row' || this.cornerSetting.titleOnDimension === 'all')) {
66837
66881
  count = this.rowsDefine.length ?? 0;
66838
66882
  }
66839
66883
  }
66840
66884
  else if (this.dataset &&
66885
+ !this._table.isPivotChart() &&
66841
66886
  (this.dataset.records?.length ?? 0) === 0 &&
66842
- !this.dataset.customColTree &&
66843
66887
  !this.dataset.customRowTree) {
66844
66888
  if (this.cornerSetting.titleOnDimension === 'row' || this.cornerSetting.titleOnDimension === 'all') {
66845
66889
  count = this.rowsDefine.length;
@@ -66848,6 +66892,14 @@
66848
66892
  }
66849
66893
  }
66850
66894
  }
66895
+ if (!this.indicatorsAsCol &&
66896
+ this.hideIndicatorName &&
66897
+ this.rowDimensionKeys[this.rowDimensionKeys.length - 1] === this.indicatorDimensionKey) {
66898
+ count = rowLevelCount - 1;
66899
+ }
66900
+ if (this.rowHeaderTitle) {
66901
+ count += 1;
66902
+ }
66851
66903
  this.rowHeaderLevelCount = count;
66852
66904
  return;
66853
66905
  }
@@ -67339,6 +67391,7 @@
67339
67391
  return this.isColumnIndicatorHeader(col, row) || this.isRowIndicatorHeader(col, row);
67340
67392
  }
67341
67393
  toggleHierarchyState(col, row) {
67394
+ this.colIndex = 0;
67342
67395
  const oldRowHeaderCellIds = this._rowHeaderCellFullPathIds_FULL.slice(0);
67343
67396
  const oldRowHeaderCellPositons = oldRowHeaderCellIds.map((id, row) => {
67344
67397
  return { col, row: row + this.columnHeaderLevelCount };
@@ -67412,7 +67465,7 @@
67412
67465
  let colDimension;
67413
67466
  for (let i = 0; i < dimensions.length; i++) {
67414
67467
  const highlightDimension = dimensions[i];
67415
- if ((highlightDimension.isPivotCorner || !highlightDimension.value) &&
67468
+ if ((highlightDimension.isPivotCorner || !isValid$1(highlightDimension.value)) &&
67416
67469
  i === dimensions.length - 1) {
67417
67470
  if (this?.cornerSetting?.titleOnDimension === 'row') {
67418
67471
  let col = 0;
@@ -67827,7 +67880,7 @@
67827
67880
  dimension.value === rowDimension.value) ||
67828
67881
  (isValid$1(rowDimension.indicatorKey) &&
67829
67882
  dimension.indicatorKey === rowDimension.indicatorKey &&
67830
- (!rowDimension.value || dimension.value === rowDimension.value))) {
67883
+ (!isValid$1(rowDimension.value) || dimension.value === rowDimension.value))) {
67831
67884
  rowArr = dimension.children;
67832
67885
  if (needLowestLevel && (!rowArr || rowArr.some(row => row.dimensionKey === 'axis'))) {
67833
67886
  rowDimensionFinded = dimension;
@@ -68035,7 +68088,7 @@
68035
68088
  }
68036
68089
  for (let i = 0; i < dimensions.length; i++) {
68037
68090
  const highlightDimension = dimensions[i];
68038
- if ((highlightDimension.isPivotCorner || !highlightDimension.value) &&
68091
+ if ((highlightDimension.isPivotCorner || !isValid$1(highlightDimension.value)) &&
68039
68092
  i === dimensions.length - 1) {
68040
68093
  return undefined;
68041
68094
  }
@@ -68386,6 +68439,13 @@
68386
68439
  const dataset = this.dataset;
68387
68440
  this.rowTree = dataset.rowHeaderTree;
68388
68441
  this.columnTree = dataset.colHeaderTree;
68442
+ const beforeRowDimensions = this.rowDimensionTree.tree.children;
68443
+ this.rowTree?.forEach((node, index) => {
68444
+ const beforeRowDimension = beforeRowDimensions.find(item => item.dimensionKey === node.dimensionKey && item.value === node.value);
68445
+ if (beforeRowDimension) {
68446
+ this._table._syncHierarchyState(beforeRowDimension, node);
68447
+ }
68448
+ });
68389
68449
  this.columnDimensionTree = new DimensionTree(this.columnTree ?? [], this.sharedVar);
68390
68450
  this.rowDimensionTree = new DimensionTree(this.rowTree ?? [], this.sharedVar, this.rowHierarchyType, this.rowHierarchyType === 'tree' ? this.rowExpandLevel : undefined);
68391
68451
  this.resetColumnHeaderLevelCount();
@@ -68894,6 +68954,8 @@
68894
68954
  rowFlatKeys = {};
68895
68955
  colKeys = [];
68896
68956
  rowKeys = [];
68957
+ colKeys_normal = [];
68958
+ rowKeys_normal = [];
68897
68959
  rowOrder = 'key_a_to_z';
68898
68960
  colOrder = 'key_a_to_z';
68899
68961
  sorted = false;
@@ -68936,6 +68998,7 @@
68936
68998
  constructor(dataConfig, rows, columns, indicatorKeys, indicators, indicatorsAsCol, records, rowHierarchyType, customColTree, customRowTree, needSplitPositiveAndNegative) {
68937
68999
  this.registerAggregators();
68938
69000
  this.dataConfig = dataConfig;
69001
+ this.filterRules = this.dataConfig?.filterRules;
68939
69002
  this.rowHierarchyType = rowHierarchyType ?? 'grid';
68940
69003
  this.sortRules = this.dataConfig?.sortRules;
68941
69004
  this.aggregationRules = this.dataConfig?.aggregationRules;
@@ -69013,6 +69076,8 @@
69013
69076
  typeof window !== 'undefined' ? window.performance.now() : 0;
69014
69077
  this.totalStatistics();
69015
69078
  typeof window !== 'undefined' ? window.performance.now() : 0;
69079
+ this.rowKeys_normal = this.rowKeys.slice();
69080
+ this.colKeys_normal = this.colKeys.slice();
69016
69081
  typeof window !== 'undefined' ? window.performance.now() : 0;
69017
69082
  this.sortKeys();
69018
69083
  typeof window !== 'undefined' ? window.performance.now() : 0;
@@ -69136,7 +69201,7 @@
69136
69201
  }
69137
69202
  processRecords() {
69138
69203
  let isNeedFilter = false;
69139
- if ((this.dataConfig?.filterRules?.length ?? 0) >= 1) {
69204
+ if ((this.filterRules?.length ?? 0) >= 1) {
69140
69205
  isNeedFilter = true;
69141
69206
  }
69142
69207
  if (Array.isArray(this.records)) {
@@ -69162,9 +69227,9 @@
69162
69227
  }
69163
69228
  filterRecord(record) {
69164
69229
  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];
69230
+ if (this.filterRules) {
69231
+ for (let i = 0; i < this.filterRules.length; i++) {
69232
+ const filterRule = this.filterRules[i];
69168
69233
  if (filterRule.filterKey) {
69169
69234
  const filterValue = record[filterRule.filterKey];
69170
69235
  if (filterRule.filteredValues?.indexOf(filterValue) === -1) {
@@ -69493,6 +69558,7 @@
69493
69558
  this.processRecords();
69494
69559
  this.processCollectedValuesWithSumBy();
69495
69560
  this.processCollectedValuesWithSortBy();
69561
+ this.totalStatistics();
69496
69562
  if (this.dataConfig?.isPivotChart) {
69497
69563
  this.cacheDeminsionCollectedValues();
69498
69564
  }
@@ -69590,41 +69656,13 @@
69590
69656
  };
69591
69657
  }
69592
69658
  sortKeys() {
69593
- const that = this;
69659
+ this.colKeys = this.colKeys_normal.slice();
69660
+ this.rowKeys = this.rowKeys_normal.slice();
69594
69661
  if (!this.sorted) {
69595
69662
  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
- }
69663
+ this.rowKeys.sort(this.arrSort(this.rows, true));
69664
+ const sortfun = this.arrSort(this.columns, false);
69665
+ this.colKeys.sort(sortfun);
69628
69666
  }
69629
69667
  }
69630
69668
  arrSort(fieldArr, isRow) {
@@ -69659,17 +69697,27 @@
69659
69697
  let bChanged = b;
69660
69698
  if (sorter.fieldIndex < fieldArr.length - 1) {
69661
69699
  aChanged = a.slice(0, sorter.fieldIndex + 1);
69662
- aChanged.push(isRow ? that.rowSubTotalLabel : that.colSubTotalLabel);
69700
+ if (that.rowHierarchyType === 'grid' && isRow) {
69701
+ aChanged.push(that.rowSubTotalLabel);
69702
+ }
69703
+ else if (!isRow) {
69704
+ aChanged.push(that.colSubTotalLabel);
69705
+ }
69663
69706
  bChanged = b.slice(0, sorter.fieldIndex + 1);
69664
- bChanged.push(isRow ? that.rowSubTotalLabel : that.colSubTotalLabel);
69707
+ if (that.rowHierarchyType === 'grid' && isRow) {
69708
+ bChanged.push(that.rowSubTotalLabel);
69709
+ }
69710
+ else if (!isRow) {
69711
+ bChanged.push(that.colSubTotalLabel);
69712
+ }
69665
69713
  }
69666
- comparison = sorter.func(aChanged, bChanged);
69714
+ comparison = sorter.func(aChanged, bChanged, sorter.sortRule?.sortType);
69667
69715
  }
69668
69716
  else {
69669
- comparison = sorter.func?.(a[sorter.fieldIndex], b[sorter.fieldIndex]);
69717
+ comparison = sorter.func?.(a[sorter.fieldIndex], b[sorter.fieldIndex], sorter.sortRule?.sortType);
69670
69718
  }
69671
69719
  if (comparison !== 0) {
69672
- return comparison * (sorter.sortRule?.sortType === SortType.DESC ? -1 : 1);
69720
+ return comparison;
69673
69721
  }
69674
69722
  }
69675
69723
  return 0;
@@ -69678,9 +69726,10 @@
69678
69726
  getSort(sortRule, isSortRow) {
69679
69727
  const that = this;
69680
69728
  if (sortRule.sortByIndicator) {
69681
- return (a, b) => {
69729
+ return (a, b, sortType) => {
69682
69730
  const getValue = function (rowKey, colKey) {
69683
- if (rowKey.length < that.rows.length &&
69731
+ if (that.rowHierarchyType === 'grid' &&
69732
+ rowKey.length < that.rows.length &&
69684
69733
  rowKey[rowKey.length - 1] !== that.rowSubTotalLabel &&
69685
69734
  rowKey[rowKey.length - 1] !== that.rowGrandTotalLabel) {
69686
69735
  rowKey.push(that.rowSubTotalLabel);
@@ -69693,20 +69742,20 @@
69693
69742
  return that.getAggregator(rowKey, colKey, sortRule.sortByIndicator).value();
69694
69743
  };
69695
69744
  if (isSortRow) {
69696
- return naturalSort(getValue(a, sortRule.query), getValue(b, sortRule.query));
69745
+ return naturalSort(getValue(a, sortRule.query), getValue(b, sortRule.query), sortType);
69697
69746
  }
69698
- return naturalSort(getValue(sortRule.query, a), getValue(sortRule.query, b));
69747
+ return naturalSort(getValue(sortRule.query, a), getValue(sortRule.query, b), sortType);
69699
69748
  };
69700
69749
  }
69701
69750
  else if (sortRule.sortBy) {
69702
69751
  return sortBy(sortRule.sortBy);
69703
69752
  }
69704
- if (sortRule.sortType) {
69705
- return typeSort;
69706
- }
69707
69753
  if (sortRule.sortFunc) {
69708
69754
  return sortRule.sortFunc;
69709
69755
  }
69756
+ if (sortRule.sortType) {
69757
+ return typeSort;
69758
+ }
69710
69759
  return naturalSort;
69711
69760
  }
69712
69761
  totalStatistics() {
@@ -69759,7 +69808,9 @@
69759
69808
  dependIndicatorKeys: calculatedFieldRule?.dependIndicatorKeys
69760
69809
  });
69761
69810
  }
69762
- this.tree[flatRowKey][flatColTotalKey][i].push(that.tree[flatRowKey]?.[flatColKey]?.[i]);
69811
+ if (flatColTotalKey !== flatColKey) {
69812
+ this.tree[flatRowKey][flatColTotalKey][i].push(that.tree[flatRowKey]?.[flatColKey]?.[i]);
69813
+ }
69763
69814
  }
69764
69815
  else {
69765
69816
  if (!this.tree[flatRowKey][flatColTotalKey][i]) {
@@ -69776,7 +69827,9 @@
69776
69827
  })?.format
69777
69828
  });
69778
69829
  }
69779
- this.tree[flatRowKey][flatColTotalKey][i].push(that.tree[flatRowKey]?.[flatColKey]?.[i]);
69830
+ if (flatColTotalKey !== flatColKey) {
69831
+ this.tree[flatRowKey][flatColTotalKey][i].push(that.tree[flatRowKey]?.[flatColKey]?.[i]);
69832
+ }
69780
69833
  }
69781
69834
  }
69782
69835
  }
@@ -69811,7 +69864,9 @@
69811
69864
  dependIndicatorKeys: calculatedFieldRule?.dependIndicatorKeys
69812
69865
  });
69813
69866
  }
69814
- this.tree[flatRowKey][flatColTotalKey][i].push(that.tree[flatRowKey]?.[flatColKey]?.[i]);
69867
+ if (flatColTotalKey !== flatColKey) {
69868
+ this.tree[flatRowKey][flatColTotalKey][i].push(that.tree[flatRowKey]?.[flatColKey]?.[i]);
69869
+ }
69815
69870
  }
69816
69871
  else {
69817
69872
  if (!this.tree[flatRowKey][flatColTotalKey][i]) {
@@ -69828,7 +69883,9 @@
69828
69883
  })?.format
69829
69884
  });
69830
69885
  }
69831
- this.tree[flatRowKey][flatColTotalKey][i].push(that.tree[flatRowKey]?.[flatColKey]?.[i]);
69886
+ if (flatColTotalKey !== flatColKey) {
69887
+ this.tree[flatRowKey][flatColTotalKey][i].push(that.tree[flatRowKey]?.[flatColKey]?.[i]);
69888
+ }
69832
69889
  }
69833
69890
  }
69834
69891
  }
@@ -69890,7 +69947,9 @@
69890
69947
  });
69891
69948
  }
69892
69949
  }
69893
- this.tree[flatRowTotalKey][flatColKey][i].push(that.tree[flatRowKey]?.[flatColKey]?.[i]);
69950
+ if (flatRowTotalKey !== flatRowKey) {
69951
+ this.tree[flatRowTotalKey][flatColKey][i].push(that.tree[flatRowKey]?.[flatColKey]?.[i]);
69952
+ }
69894
69953
  }
69895
69954
  }
69896
69955
  }
@@ -69939,7 +69998,9 @@
69939
69998
  });
69940
69999
  }
69941
70000
  }
69942
- this.tree[flatRowTotalKey][flatColKey][i].push(that.tree[flatRowKey]?.[flatColKey]?.[i]);
70001
+ if (flatRowTotalKey !== flatRowKey) {
70002
+ this.tree[flatRowTotalKey][flatColKey][i].push(that.tree[flatRowKey]?.[flatColKey]?.[i]);
70003
+ }
69943
70004
  }
69944
70005
  }
69945
70006
  colCompute(flatRowKey, flatColKey);
@@ -70398,7 +70459,7 @@
70398
70459
  this.internalProps.rowTree?.forEach((node, index) => {
70399
70460
  const beforeRowDimension = beforeRowDimensions.find(item => item.dimensionKey === node.dimensionKey && item.value === node.value);
70400
70461
  if (beforeRowDimension) {
70401
- this.syncHierarchyState(beforeRowDimension, node);
70462
+ this._syncHierarchyState(beforeRowDimension, node);
70402
70463
  }
70403
70464
  });
70404
70465
  }
@@ -70531,7 +70592,7 @@
70531
70592
  get rowHierarchyType() {
70532
70593
  return this.internalProps.layoutMap.rowHierarchyType;
70533
70594
  }
70534
- syncHierarchyState(sourceNode, targetNode) {
70595
+ _syncHierarchyState(sourceNode, targetNode) {
70535
70596
  if (sourceNode.value === targetNode.value && sourceNode.dimensionKey === targetNode.dimensionKey) {
70536
70597
  targetNode.hierarchyState =
70537
70598
  targetNode.hierarchyState ?? (targetNode?.children ? sourceNode.hierarchyState : undefined);
@@ -70539,7 +70600,7 @@
70539
70600
  if (sourceNode?.children?.[index] && targetChildNode) {
70540
70601
  const beforeRowDimension = sourceNode.children.find((item) => item.dimensionKey === targetChildNode.dimensionKey && item.value === targetChildNode.value);
70541
70602
  if (beforeRowDimension) {
70542
- this.syncHierarchyState(beforeRowDimension, targetChildNode);
70603
+ this._syncHierarchyState(beforeRowDimension, targetChildNode);
70543
70604
  }
70544
70605
  }
70545
70606
  });
@@ -70972,38 +71033,36 @@
70972
71033
  const sortRules = this.internalProps.dataConfig?.sortRules ?? [];
70973
71034
  for (let i = 0; i < sortRules.length; i++) {
70974
71035
  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 {
71036
+ const dimensions = [];
71037
+ if (sortRule.sortByIndicator &&
71038
+ sortRule.sortField ===
71039
+ (this.dataset.indicatorsAsCol
71040
+ ? this.dataset.rows[this.dataset.rows.length - 1]
71041
+ : this.dataset.columns[this.dataset.columns.length - 1])) {
71042
+ for (let j = 0; j < sortRule.query.length; j++) {
70996
71043
  dimensions.push({
70997
- dimensionKey: sortRule.sortField,
70998
- isPivotCorner: true,
70999
- value: sortRule.sortField
71044
+ dimensionKey: this.dataset.indicatorsAsCol ? this.dataset.columns[j] : this.dataset.rows[j],
71045
+ value: sortRule.query[j]
71000
71046
  });
71001
71047
  }
71002
- this.pivotSortState.push({
71003
- dimensions,
71004
- order: sortRule.sortType
71048
+ dimensions.push({
71049
+ indicatorKey: sortRule.sortByIndicator,
71050
+ value: this.internalProps.layoutMap.getIndicatorInfo(sortRule.sortByIndicator)?.title ??
71051
+ sortRule.sortByIndicator
71005
71052
  });
71006
71053
  }
71054
+ else {
71055
+ dimensions.push({
71056
+ dimensionKey: sortRule.sortField,
71057
+ isPivotCorner: true,
71058
+ value: sortRule.sortField
71059
+ });
71060
+ }
71061
+ const sortType = sortRule.sortType ? sortRule.sortType.toUpperCase() : 'ASC';
71062
+ this.pivotSortState.push({
71063
+ dimensions,
71064
+ order: SortType[sortType]
71065
+ });
71007
71066
  }
71008
71067
  }
71009
71068
  updatePivotSortState(pivotSortStateConfig) {
@@ -71031,9 +71090,11 @@
71031
71090
  const headerDefine = this.getHeaderDefine(col, row);
71032
71091
  if (headerDefine.sort) {
71033
71092
  if (this.dataset.sortRules) {
71093
+ const cacheOldDimensionSortRule = {};
71034
71094
  for (let i = this.dataset.sortRules.length - 1; i >= 0; i--) {
71035
71095
  const sortRule = this.dataset.sortRules[i];
71036
71096
  if (headerDefine.dimensionKey && sortRule.sortField === headerDefine.dimensionKey) {
71097
+ cacheOldDimensionSortRule[sortRule.sortField] = sortRule;
71037
71098
  this.dataset.sortRules.splice(i, 1);
71038
71099
  }
71039
71100
  else if (sortIndicator &&
@@ -71060,10 +71121,10 @@
71060
71121
  });
71061
71122
  }
71062
71123
  else {
71063
- this.dataset.sortRules.push({
71124
+ this.dataset.sortRules.push(Object.assign(cacheOldDimensionSortRule[headerDefine.dimensionKey] ?? {}, {
71064
71125
  sortField: headerDefine.dimensionKey,
71065
71126
  sortType: SortType[order]
71066
- });
71127
+ }));
71067
71128
  }
71068
71129
  }
71069
71130
  else {
@@ -71645,6 +71706,11 @@
71645
71706
  });
71646
71707
  }
71647
71708
  }
71709
+ updateFilterRules(filterRules) {
71710
+ this.internalProps.dataConfig.filterRules = filterRules;
71711
+ this.dataset.updateFilterRules(filterRules);
71712
+ this.renderWithRecreateCells();
71713
+ }
71648
71714
  }
71649
71715
 
71650
71716
  registerAxis();
@@ -73295,7 +73361,7 @@
73295
73361
  }
73296
73362
 
73297
73363
  registerForVrender();
73298
- const version = "1.7.3";
73364
+ const version = "1.7.5-alpha.0";
73299
73365
  function getIcons() {
73300
73366
  return get$2();
73301
73367
  }