@visactor/vtable 1.7.2 → 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 (131) 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/container-dom.js +1 -1
  18. package/cjs/event/listener/container-dom.js.map +1 -1
  19. package/cjs/event/listener/table-group.js +28 -30
  20. package/cjs/event/listener/table-group.js.map +1 -1
  21. package/cjs/event/scroll.js +1 -1
  22. package/cjs/event/scroll.js.map +1 -1
  23. package/cjs/header-helper/header-helper.js +1 -1
  24. package/cjs/header-helper/header-helper.js.map +1 -1
  25. package/cjs/index.d.ts +1 -1
  26. package/cjs/index.js +1 -1
  27. package/cjs/index.js.map +1 -1
  28. package/cjs/layout/pivot-header-layout.js +20 -13
  29. package/cjs/layout/pivot-header-layout.js.map +1 -1
  30. package/cjs/plugins/custom-cell-style.js +6 -2
  31. package/cjs/plugins/custom-cell-style.js.map +1 -1
  32. package/cjs/scenegraph/component/table-component.js.map +1 -1
  33. package/cjs/scenegraph/graphic/contributions/group-contribution-render.d.ts +1 -7
  34. package/cjs/scenegraph/graphic/contributions/group-contribution-render.js +18 -32
  35. package/cjs/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
  36. package/cjs/scenegraph/graphic/contributions/index.js +0 -2
  37. package/cjs/scenegraph/graphic/contributions/index.js.map +1 -1
  38. package/cjs/scenegraph/group-creater/cell-helper.js +1 -1
  39. package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
  40. package/cjs/scenegraph/group-creater/cell-type/spark-line-cell.js +15 -3
  41. package/cjs/scenegraph/group-creater/cell-type/spark-line-cell.js.map +1 -1
  42. package/cjs/scenegraph/layout/update-height.js +1 -1
  43. package/cjs/scenegraph/layout/update-height.js.map +1 -1
  44. package/cjs/scenegraph/layout/update-width.js +1 -1
  45. package/cjs/scenegraph/layout/update-width.js.map +1 -1
  46. package/cjs/scenegraph/scenegraph.js +12 -7
  47. package/cjs/scenegraph/scenegraph.js.map +1 -1
  48. package/cjs/scenegraph/style/frame-border.js +6 -3
  49. package/cjs/scenegraph/style/frame-border.js.map +1 -1
  50. package/cjs/state/checkbox/checkbox.d.ts +1 -0
  51. package/cjs/state/checkbox/checkbox.js +13 -2
  52. package/cjs/state/checkbox/checkbox.js.map +1 -1
  53. package/cjs/state/resize/update-resize-column.js +2 -1
  54. package/cjs/state/resize/update-resize-column.js.map +1 -1
  55. package/cjs/state/select/is-cell-select-highlight.js +2 -2
  56. package/cjs/state/select/is-cell-select-highlight.js.map +1 -1
  57. package/cjs/state/state.js +1 -1
  58. package/cjs/state/state.js.map +1 -1
  59. package/cjs/ts-types/new-data-set.d.ts +8 -2
  60. package/cjs/ts-types/new-data-set.js +2 -1
  61. package/cjs/ts-types/new-data-set.js.map +1 -1
  62. package/cjs/ts-types/table-engine.d.ts +2 -2
  63. package/cjs/ts-types/table-engine.js.map +1 -1
  64. package/cjs/vrender.js.map +1 -1
  65. package/dist/vtable.js +313 -237
  66. package/dist/vtable.min.js +2 -2
  67. package/es/ListTable.js +7 -3
  68. package/es/ListTable.js.map +1 -1
  69. package/es/PivotTable.d.ts +3 -2
  70. package/es/PivotTable.js +31 -28
  71. package/es/PivotTable.js.map +1 -1
  72. package/es/core/BaseTable.js +1 -1
  73. package/es/core/BaseTable.js.map +1 -1
  74. package/es/data/CachedDataSource.js +14 -10
  75. package/es/data/CachedDataSource.js.map +1 -1
  76. package/es/dataset/dataset-pivot-table.d.ts +2 -2
  77. package/es/dataset/dataset.d.ts +5 -4
  78. package/es/dataset/dataset.js +55 -84
  79. package/es/dataset/dataset.js.map +1 -1
  80. package/es/dataset/statistics-helper.d.ts +4 -3
  81. package/es/dataset/statistics-helper.js +41 -27
  82. package/es/dataset/statistics-helper.js.map +1 -1
  83. package/es/event/listener/container-dom.js +1 -1
  84. package/es/event/listener/container-dom.js.map +1 -1
  85. package/es/event/listener/table-group.js +28 -30
  86. package/es/event/listener/table-group.js.map +1 -1
  87. package/es/event/scroll.js +1 -1
  88. package/es/event/scroll.js.map +1 -1
  89. package/es/header-helper/header-helper.js +1 -1
  90. package/es/header-helper/header-helper.js.map +1 -1
  91. package/es/index.d.ts +1 -1
  92. package/es/index.js +1 -1
  93. package/es/index.js.map +1 -1
  94. package/es/layout/pivot-header-layout.js +20 -13
  95. package/es/layout/pivot-header-layout.js.map +1 -1
  96. package/es/plugins/custom-cell-style.js +6 -2
  97. package/es/plugins/custom-cell-style.js.map +1 -1
  98. package/es/scenegraph/component/table-component.js.map +1 -1
  99. package/es/scenegraph/graphic/contributions/group-contribution-render.d.ts +1 -7
  100. package/es/scenegraph/graphic/contributions/group-contribution-render.js +16 -30
  101. package/es/scenegraph/graphic/contributions/group-contribution-render.js.map +1 -1
  102. package/es/scenegraph/graphic/contributions/index.js +1 -2
  103. package/es/scenegraph/graphic/contributions/index.js.map +1 -1
  104. package/es/scenegraph/group-creater/cell-helper.js +1 -1
  105. package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
  106. package/es/scenegraph/group-creater/cell-type/spark-line-cell.js +14 -3
  107. package/es/scenegraph/group-creater/cell-type/spark-line-cell.js.map +1 -1
  108. package/es/scenegraph/layout/update-height.js +1 -1
  109. package/es/scenegraph/layout/update-height.js.map +1 -1
  110. package/es/scenegraph/layout/update-width.js +1 -1
  111. package/es/scenegraph/layout/update-width.js.map +1 -1
  112. package/es/scenegraph/scenegraph.js +12 -7
  113. package/es/scenegraph/scenegraph.js.map +1 -1
  114. package/es/scenegraph/style/frame-border.js +6 -3
  115. package/es/scenegraph/style/frame-border.js.map +1 -1
  116. package/es/state/checkbox/checkbox.d.ts +1 -0
  117. package/es/state/checkbox/checkbox.js +11 -1
  118. package/es/state/checkbox/checkbox.js.map +1 -1
  119. package/es/state/resize/update-resize-column.js +2 -1
  120. package/es/state/resize/update-resize-column.js.map +1 -1
  121. package/es/state/select/is-cell-select-highlight.js +2 -2
  122. package/es/state/select/is-cell-select-highlight.js.map +1 -1
  123. package/es/state/state.js +1 -1
  124. package/es/state/state.js.map +1 -1
  125. package/es/ts-types/new-data-set.d.ts +8 -2
  126. package/es/ts-types/new-data-set.js +2 -1
  127. package/es/ts-types/new-data-set.js.map +1 -1
  128. package/es/ts-types/table-engine.d.ts +2 -2
  129. package/es/ts-types/table-engine.js.map +1 -1
  130. package/es/vrender.js.map +1 -1
  131. 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) {
@@ -33997,7 +34018,7 @@
33997
34018
  isAsync = true;
33998
34019
  }
33999
34020
  let cellGroup;
34000
- if (type === 'text' || type === 'link') {
34021
+ if (type === 'text' || type === 'link' || customResult) {
34001
34022
  if (type === 'link') {
34002
34023
  const cellValue = value;
34003
34024
  const headerStyle = table._getCellStyle(col, row);
@@ -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
  }
@@ -37286,10 +37307,13 @@
37286
37307
  });
37287
37308
  borderRect.addChild(shadowRect);
37288
37309
  const hackRect = createRect({
37289
- width: 1,
37290
- height: 1,
37310
+ x: borderLeft / 2,
37311
+ y: borderTop / 2,
37312
+ width: group.attribute.width,
37313
+ height: group.attribute.height,
37291
37314
  fill: 'transparent',
37292
- pickable: false
37315
+ pickable: false,
37316
+ globalCompositeOperation: 'source-over'
37293
37317
  });
37294
37318
  borderRect.addChild(hackRect);
37295
37319
  }
@@ -38177,7 +38201,11 @@
38177
38201
  else if (state.table.theme.selectionStyle.selectionFillMode === 'replace') {
38178
38202
  for (let i = 0; i < ranges.length; i++) {
38179
38203
  const range = ranges[i];
38180
- if (range.start.col <= col && range.start.row <= row && range.end.col >= col && range.end.row >= row) {
38204
+ const rangeColStart = Math.min(range.start.col, range.end.col);
38205
+ const rangeColEnd = Math.max(range.start.col, range.end.col);
38206
+ const rangeRowStart = Math.min(range.start.row, range.end.row);
38207
+ const rangeRowEnd = Math.max(range.start.row, range.end.row);
38208
+ if (rangeColStart <= col && rangeRowStart <= row && rangeColEnd >= col && rangeRowEnd >= row) {
38181
38209
  selectMode = 'cellBgColor';
38182
38210
  break;
38183
38211
  }
@@ -38674,7 +38702,7 @@
38674
38702
  time = BaseRenderContributionTime.beforeFillStroke;
38675
38703
  useStyle = true;
38676
38704
  order = 0;
38677
- 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) {
38678
38706
  const table = group.stage.table;
38679
38707
  if (!table) {
38680
38708
  return;
@@ -38684,89 +38712,80 @@
38684
38712
  const y = -(group.attribute.y ?? 0) + table.getFrozenRowsHeight();
38685
38713
  const width = group.parent.attribute.width - table.getFrozenColsWidth() - table.getRightFrozenColsWidth();
38686
38714
  const height = group.parent.attribute.height - table.getFrozenRowsHeight() - table.getBottomFrozenRowsHeight();
38687
- context.beginPath();
38688
- context.rect(x, y, width, height);
38715
+ drawClipRect(context, x, y, width, height);
38689
38716
  }
38690
38717
  else if (group.role === 'row-header') {
38691
38718
  const x = 0;
38692
38719
  const y = -(group.attribute.y ?? 0) + table.getFrozenRowsHeight();
38693
38720
  const width = table.getFrozenColsWidth();
38694
38721
  const height = group.parent.attribute.height - table.getFrozenRowsHeight() - table.getBottomFrozenRowsHeight();
38695
- context.beginPath();
38696
- context.rect(x, y, width, height);
38722
+ drawClipRect(context, x, y, width, height);
38697
38723
  }
38698
38724
  else if (group.role === 'col-header') {
38699
38725
  const x = -(group.attribute.x ?? 0) + table.getFrozenColsWidth();
38700
38726
  const y = 0;
38701
38727
  const width = group.parent.attribute.width - table.getFrozenColsWidth() - table.getRightFrozenColsWidth();
38702
38728
  const height = table.getFrozenRowsHeight();
38703
- context.beginPath();
38704
- context.rect(x, y, width, height);
38729
+ drawClipRect(context, x, y, width, height);
38705
38730
  }
38706
38731
  else if (group.role === 'right-frozen') {
38707
38732
  const x = 0;
38708
38733
  const y = -(group.attribute.y ?? 0) + table.getFrozenRowsHeight();
38709
38734
  const width = table.getRightFrozenColsWidth();
38710
38735
  const height = group.parent.attribute.height - table.getFrozenRowsHeight() - table.getBottomFrozenRowsHeight();
38711
- context.beginPath();
38712
- context.rect(x, y, width, height);
38736
+ drawClipRect(context, x, y, width, height);
38713
38737
  }
38714
38738
  else if (group.role === 'bottom-frozen') {
38715
38739
  const x = -(group.attribute.x ?? 0) + table.getFrozenColsWidth();
38716
38740
  const y = 0;
38717
38741
  const width = group.parent.attribute.width - table.getFrozenColsWidth() - table.getRightFrozenColsWidth();
38718
38742
  const height = table.getBottomFrozenRowsHeight();
38719
- context.beginPath();
38720
- context.rect(x, y, width, height);
38743
+ drawClipRect(context, x, y, width, height);
38721
38744
  }
38722
38745
  else if (group.role === 'corner-header') {
38723
38746
  const x = 0;
38724
38747
  const y = 0;
38725
38748
  const width = table.getFrozenColsWidth();
38726
38749
  const height = table.getFrozenRowsHeight();
38727
- context.beginPath();
38728
- context.rect(x, y, width, height);
38750
+ drawClipRect(context, x, y, width, height);
38729
38751
  }
38730
38752
  else if (group.role === 'corner-right-top-header') {
38731
38753
  const x = 0;
38732
38754
  const y = 0;
38733
38755
  const width = table.getRightFrozenColsWidth();
38734
38756
  const height = table.getFrozenRowsHeight();
38735
- context.beginPath();
38736
- context.rect(x, y, width, height);
38757
+ drawClipRect(context, x, y, width, height);
38737
38758
  }
38738
38759
  else if (group.role === 'corner-right-bottom-header') {
38739
38760
  const x = 0;
38740
38761
  const y = 0;
38741
38762
  const width = table.getRightFrozenColsWidth();
38742
38763
  const height = table.getBottomFrozenRowsHeight();
38743
- context.beginPath();
38744
- context.rect(x, y, width, height);
38764
+ drawClipRect(context, x, y, width, height);
38745
38765
  }
38746
38766
  else if (group.role === 'corner-left-bottom-header') {
38747
38767
  const x = 0;
38748
38768
  const y = 0;
38749
38769
  const width = table.getFrozenColsWidth();
38750
38770
  const height = table.getBottomFrozenRowsHeight();
38751
- context.beginPath();
38752
- context.rect(x, y, width, height);
38771
+ drawClipRect(context, x, y, width, height);
38753
38772
  }
38754
38773
  }
38755
38774
  };
38756
38775
  ClipBodyGroupBeforeRenderContribution = __decorate([
38757
38776
  injectable()
38758
38777
  ], ClipBodyGroupBeforeRenderContribution);
38759
- let ClipBodyGroupAfterRenderContribution = class ClipBodyGroupAfterRenderContribution {
38760
- time = BaseRenderContributionTime.afterFillStroke;
38761
- useStyle = true;
38762
- order = 0;
38763
- drawShape(group, context, x, y, doFill, doStroke, fVisible, sVisible, groupAttribute, drawContext, fillCb, strokeCb) {
38764
- 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);
38765
38784
  }
38766
- };
38767
- ClipBodyGroupAfterRenderContribution = __decorate([
38768
- injectable()
38769
- ], ClipBodyGroupAfterRenderContribution);
38785
+ else {
38786
+ context.rect(x, y, width, height);
38787
+ }
38788
+ }
38770
38789
  function getCellSizeForDraw(group, width, height, bottomRight) {
38771
38790
  const table = group.stage.table;
38772
38791
  if (group.role === 'cell') {
@@ -39216,8 +39235,6 @@
39216
39235
  bind(GroupRenderContribution).toService(AdjustPosGroupAfterRenderContribution);
39217
39236
  bind(ClipBodyGroupBeforeRenderContribution).toSelf().inSingletonScope();
39218
39237
  bind(GroupRenderContribution).toService(ClipBodyGroupBeforeRenderContribution);
39219
- bind(ClipBodyGroupAfterRenderContribution).toSelf().inSingletonScope();
39220
- bind(GroupRenderContribution).toService(ClipBodyGroupAfterRenderContribution);
39221
39238
  bind(VTableDrawItemInterceptorContribution).toSelf().inSingletonScope();
39222
39239
  bind(DrawItemInterceptor).toService(VTableDrawItemInterceptorContribution);
39223
39240
  bind(SuffixTextBeforeRenderContribution).toSelf().inSingletonScope();
@@ -44401,7 +44418,7 @@
44401
44418
  this.bodyGroup.children?.forEach((columnGroup) => {
44402
44419
  columnGroup
44403
44420
  .getChildAt(row)
44404
- .getChildren()
44421
+ ?.getChildren()
44405
44422
  .forEach((node) => {
44406
44423
  if (node.name === 'checkbox') {
44407
44424
  node.setAttribute('checked', checked);
@@ -44411,7 +44428,7 @@
44411
44428
  }
44412
44429
  else {
44413
44430
  const columnGroup = this.getColGroup(col);
44414
- columnGroup.children?.forEach((cellNode) => {
44431
+ columnGroup?.children?.forEach((cellNode) => {
44415
44432
  cellNode.getChildren().find(node => {
44416
44433
  if (node.name === 'checkbox') {
44417
44434
  node.setAttribute('checked', checked);
@@ -45076,10 +45093,15 @@
45076
45093
  const drawRange = this.table.getDrawRange();
45077
45094
  if (abstractY >= drawRange.top && abstractY <= drawRange.bottom) {
45078
45095
  cell = this.table.getCellAtRelativePosition(abstractX - offset, abstractY);
45079
- return cell;
45096
+ if (cell.col === this.table.colCount - 1) {
45097
+ return cell;
45098
+ }
45080
45099
  }
45081
45100
  return { col: -1, row: -1 };
45082
45101
  }
45102
+ if (!cellGroup.stage) {
45103
+ return { col: -1, row: -1 };
45104
+ }
45083
45105
  if (abstractX < cellGroup.globalAABBBounds.x1 + offset) {
45084
45106
  cell = { col: cellGroup.col - 1, row: cellGroup.row, x: cellGroup.globalAABBBounds.x1 };
45085
45107
  }
@@ -45088,7 +45110,7 @@
45088
45110
  }
45089
45111
  if (cell &&
45090
45112
  this.table.rightFrozenColCount > 0 &&
45091
- cell.col === this.table.colCount - this.table.rightFrozenColCount - 1 &&
45113
+ cell.col >= this.table.colCount - this.table.rightFrozenColCount - 1 &&
45092
45114
  this.table.tableNoFrameWidth -
45093
45115
  this.table.getFrozenColsWidth() -
45094
45116
  this.table.getRightFrozenColsWidth() +
@@ -45114,7 +45136,7 @@
45114
45136
  }
45115
45137
  if (cell &&
45116
45138
  this.table.bottomFrozenRowCount > 0 &&
45117
- cell.row === this.table.rowCount - this.table.bottomFrozenRowCount - 1 &&
45139
+ cell.row >= this.table.rowCount - this.table.bottomFrozenRowCount - 1 &&
45118
45140
  this.table.tableNoFrameHeight -
45119
45141
  this.table.getFrozenRowsHeight() -
45120
45142
  this.table.getBottomFrozenRowsHeight() +
@@ -46368,14 +46390,14 @@
46368
46390
  !state.table.transpose) {
46369
46391
  state.table.scenegraph.component.setFrozenColumnShadow(state.table.frozenColCount - 1, state.columnResize.isRightFrozen);
46370
46392
  }
46371
- else if (state.columnResize.col >= state.table.colCount - state.table.rightFrozenColCount &&
46393
+ else if (state.table.options.frozenColCount) {
46394
+ state.table.scenegraph.component.setFrozenColumnShadow(state.table.frozenColCount - 1);
46395
+ }
46396
+ if (state.columnResize.col >= state.table.colCount - state.table.rightFrozenColCount &&
46372
46397
  !state.table.isPivotTable() &&
46373
46398
  !state.table.transpose) {
46374
46399
  state.table.scenegraph.component.setRightFrozenColumnShadow(state.table.colCount - state.table.rightFrozenColCount);
46375
46400
  }
46376
- else if (state.table.options.frozenColCount) {
46377
- state.table.scenegraph.component.setFrozenColumnShadow(state.table.frozenColCount - 1);
46378
- }
46379
46401
  else if (state.table.options.rightFrozenColCount) {
46380
46402
  state.table.scenegraph.component.setRightFrozenColumnShadow(state.table.colCount - state.table.rightFrozenColCount);
46381
46403
  }
@@ -46802,6 +46824,18 @@
46802
46824
  checkedState[targetIndex] = sourceRecord;
46803
46825
  }
46804
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
+ }
46805
46839
 
46806
46840
  function updateResizeRow(xInTable, yInTable, state) {
46807
46841
  xInTable = Math.ceil(xInTable);
@@ -47740,8 +47774,8 @@
47740
47774
  triggerSort(col, row, iconMark, event) {
47741
47775
  if (this.table.isPivotTable()) {
47742
47776
  const sortState = this.table.getPivotSortState(col, row);
47743
- const order = sortState ? sortState.toUpperCase() : 'DESC';
47744
- 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';
47745
47779
  this.table.sort(col, row, new_order);
47746
47780
  this.table.fireListeners(PIVOT_TABLE_EVENT_TYPE.PIVOT_SORT_CLICK, {
47747
47781
  col: col,
@@ -48057,11 +48091,11 @@
48057
48091
  state.showVerticalScrollBar(true);
48058
48092
  }
48059
48093
  isWheelEvent && state.resetInteractionState();
48060
- if (event.cancelable &&
48094
+ if (event.nativeEvent.cancelable &&
48061
48095
  (state.table.internalProps.overscrollBehavior === 'none' ||
48062
48096
  (Math.abs(deltaY) >= Math.abs(deltaX) && deltaY !== 0 && isVerticalScrollable(deltaY, state)) ||
48063
48097
  (Math.abs(deltaY) <= Math.abs(deltaX) && deltaX !== 0 && isHorizontalScrollable(deltaX, state)))) {
48064
- event.preventDefault();
48098
+ event.nativeEvent.preventDefault();
48065
48099
  }
48066
48100
  }
48067
48101
  function optimizeScrollXY(x, y, ratio) {
@@ -48619,27 +48653,11 @@
48619
48653
  }
48620
48654
  });
48621
48655
  table.scenegraph.tableGroup.addEventListener('pointertap', (e) => {
48622
- if (table.stateManager.columnResize.resizing || table.stateManager.columnMove.moving) {
48623
- return;
48624
- }
48625
48656
  const eventArgsSet = getCellEventArgsSet(e);
48626
- eventManager.dealIconClick(e, eventArgsSet);
48627
- if (!eventArgsSet?.eventArgs) {
48628
- return;
48629
- }
48630
- if (eventManager.touchSetTimeout) {
48631
- if (e.pointerType === 'touch') {
48632
- const eventArgsSet = getCellEventArgsSet(e);
48633
- if (eventManager.touchSetTimeout) {
48634
- clearTimeout(eventManager.touchSetTimeout);
48635
- const isHasSelected = !!stateManager.select.ranges?.length;
48636
- eventManager.dealTableSelect(eventArgsSet);
48637
- stateManager.endSelectCells(true, isHasSelected);
48638
- eventManager.touchSetTimeout = undefined;
48639
- }
48640
- }
48641
- }
48642
- 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)) {
48643
48661
  const { col, row } = eventArgsSet.eventArgs;
48644
48662
  const cellInfo = table.getCellInfo(col, row);
48645
48663
  let icon;
@@ -48668,6 +48686,25 @@
48668
48686
  };
48669
48687
  table.fireListeners(TABLE_EVENT_TYPE.CLICK_CELL, cellsEvent);
48670
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
+ }
48671
48708
  });
48672
48709
  table.scenegraph.stage.addEventListener('pointerdown', (e) => {
48673
48710
  const eventArgsSet = getCellEventArgsSet(e);
@@ -49263,7 +49300,7 @@
49263
49300
  }
49264
49301
  }
49265
49302
  }
49266
- else {
49303
+ else if (!(e.ctrlKey || e.metaKey || e.shiftKey)) {
49267
49304
  const editCellTrigger = table.options.editCellTrigger;
49268
49305
  if ((editCellTrigger === 'keydown' || (Array.isArray(editCellTrigger) && editCellTrigger.includes('keydown'))) &&
49269
49306
  !table.editorManager?.editingEditor) {
@@ -51822,7 +51859,7 @@
51822
51859
  (headerC.columns && headerC.columns.length > 0)) {
51823
51860
  return null;
51824
51861
  }
51825
- 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;
51826
51863
  return icon;
51827
51864
  }
51828
51865
  getDropDownStateIcons(_table, col, row) {
@@ -52430,6 +52467,9 @@
52430
52467
  customStyleId: customStyleId
52431
52468
  });
52432
52469
  }
52470
+ else if (this.customCellStyleArrangement[index].customStyleId === customStyleId) {
52471
+ return;
52472
+ }
52433
52473
  else {
52434
52474
  this.customCellStyleArrangement[index].customStyleId = customStyleId;
52435
52475
  }
@@ -54397,7 +54437,7 @@
54397
54437
  return TABLE_EVENT_TYPE;
54398
54438
  }
54399
54439
  options;
54400
- version = "1.7.2";
54440
+ version = "1.7.4";
54401
54441
  pagination;
54402
54442
  id = `VTable${Date.now()}`;
54403
54443
  headerStyleCache;
@@ -60787,7 +60827,11 @@
60787
60827
  this.stateManager.initLeftRecordsCheckState(this.records);
60788
60828
  }
60789
60829
  if (isValid$1(field)) {
60790
- 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 => {
60791
60835
  return state[field];
60792
60836
  });
60793
60837
  }
@@ -64628,13 +64672,14 @@
64628
64672
  yField = sparklineSpec.yField.field;
64629
64673
  }
64630
64674
  else if (typeof sparklineSpec.yField === 'string') {
64631
- const values = dataValue.map((value) => value[sparklineSpec.yField]);
64675
+ const values = getYNumbers(dataValue, sparklineSpec.yField);
64632
64676
  yScale.domain([Math.min(...values), Math.max(...values)]);
64633
64677
  yField = sparklineSpec.yField;
64634
64678
  }
64635
64679
  else {
64636
- if (Array.isArray(dataValue) && dataValue.every((value) => typeof value === 'number')) {
64637
- 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)]);
64638
64683
  yField = sparklineSpec.yField;
64639
64684
  }
64640
64685
  }
@@ -64769,6 +64814,19 @@
64769
64814
  }
64770
64815
  return group;
64771
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
+ }
64772
64830
 
64773
64831
  const regedIcons = get$2();
64774
64832
  function createVideoCellGroup(columnGroup, xOrigin, yOrigin, col, row, width, height, keepAspectRatio, imageAutoSizing, padding, textAlign, textBaseline, mayHaveIcon, table, cellTheme, range, isAsync) {
@@ -65830,9 +65888,9 @@
65830
65888
  this.sharedVar.seqId = Math.max(this.sharedVar.seqId, this._headerObjects.length);
65831
65889
  let colDimensionKeys = this.columnDimensionTree.dimensionKeysIncludeVirtual.valueArr();
65832
65890
  if (this.dataset &&
65891
+ !this._table.isPivotChart() &&
65833
65892
  (this.dataset.records?.length ?? 0) === 0 &&
65834
- !this.dataset.customColTree &&
65835
- !this.dataset.customRowTree) {
65893
+ !this.dataset.customColTree) {
65836
65894
  colDimensionKeys = this.columnsDefine.map(define => {
65837
65895
  if (typeof define === 'string') {
65838
65896
  return define;
@@ -65860,8 +65918,8 @@
65860
65918
  else {
65861
65919
  rowDimensionKeys = this.rowDimensionTree.dimensionKeysIncludeVirtual.valueArr();
65862
65920
  if (this.dataset &&
65921
+ !this._table.isPivotChart() &&
65863
65922
  (this.dataset.records?.length ?? 0) === 0 &&
65864
- !this.dataset.customColTree &&
65865
65923
  !this.dataset.customRowTree) {
65866
65924
  rowDimensionKeys = this.rowsDefine.map(define => {
65867
65925
  if (typeof define === 'string') {
@@ -65979,6 +66037,7 @@
65979
66037
  if (this.columnDimensionTree.tree.children?.length >= 1) {
65980
66038
  let startRow = 0;
65981
66039
  if (this.dataset &&
66040
+ !this._table.isPivotChart() &&
65982
66041
  (this.dataset.records?.length ?? 0) === 0 &&
65983
66042
  !this.dataset.customColTree &&
65984
66043
  !this.dataset.customRowTree &&
@@ -66027,6 +66086,7 @@
66027
66086
  else {
66028
66087
  let startRow = 0;
66029
66088
  if (this.dataset &&
66089
+ !this._table.isPivotChart() &&
66030
66090
  (this.dataset.records?.length ?? 0) === 0 &&
66031
66091
  !this.dataset.customColTree &&
66032
66092
  !this.dataset.customRowTree &&
@@ -66753,30 +66813,22 @@
66753
66813
  : this.columnDimensionTree.totalLevel
66754
66814
  : this.columnDimensionTree.totalLevel
66755
66815
  : this.columnDimensionTree.totalLevel;
66756
- if (this.columnHeaderTitle) {
66757
- count += 1;
66758
- }
66759
- if (this._table.isPivotChart() &&
66760
- this.indicatorsAsCol &&
66761
- !this.hasTwoIndicatorAxes &&
66762
- checkHasCartesianChart(this.indicatorsDefine)) {
66763
- count -= 1;
66764
- }
66765
66816
  if (count === 0 &&
66766
66817
  this.dataset &&
66767
66818
  !this.dataset.customColTree?.length) {
66768
66819
  if (this.cornerSetting.titleOnDimension === 'row' && this.cornerSetting.forceShowHeader) {
66769
66820
  count = 1;
66770
66821
  }
66771
- else if ((this.dataset.records?.length ?? 0) === 0 &&
66822
+ else if (!this._table.isPivotChart() &&
66823
+ (this.dataset.records?.length ?? 0) === 0 &&
66772
66824
  (this.cornerSetting.titleOnDimension === 'column' || this.cornerSetting.titleOnDimension === 'all')) {
66773
66825
  count = this.columnsDefine.length ?? 0;
66774
66826
  }
66775
66827
  }
66776
66828
  else if (this.dataset &&
66829
+ !this._table.isPivotChart() &&
66777
66830
  (this.dataset.records?.length ?? 0) === 0 &&
66778
- !this.dataset.customColTree &&
66779
- !this.dataset.customRowTree) {
66831
+ !this.dataset.customColTree) {
66780
66832
  if (this.cornerSetting.titleOnDimension === 'column' || this.cornerSetting.titleOnDimension === 'all') {
66781
66833
  count = this.columnsDefine.length ?? 0;
66782
66834
  if (!this.hideIndicatorName && this.indicatorsAsCol) {
@@ -66784,6 +66836,15 @@
66784
66836
  }
66785
66837
  }
66786
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
+ }
66787
66848
  this.columnHeaderLevelCount = count;
66788
66849
  return;
66789
66850
  }
@@ -66803,28 +66864,21 @@
66803
66864
  }
66804
66865
  const rowLevelCount = this.rowDimensionTree.totalLevel;
66805
66866
  let count = rowLevelCount;
66806
- if (this.indicatorsAsCol) ;
66807
- else if (this.hideIndicatorName &&
66808
- this.rowDimensionKeys[this.rowDimensionKeys.length - 1] === this.indicatorDimensionKey) {
66809
- count = rowLevelCount - 1;
66810
- }
66811
- if (this.rowHeaderTitle) {
66812
- count += 1;
66813
- }
66814
66867
  if (count === 0 &&
66815
66868
  this.dataset &&
66816
66869
  !this.dataset.customRowTree?.length) {
66817
66870
  if (this.cornerSetting.titleOnDimension === 'column' && this.cornerSetting.forceShowHeader) {
66818
66871
  count = 1;
66819
66872
  }
66820
- else if ((this.dataset.records?.length ?? 0) === 0 &&
66873
+ else if (!this._table.isPivotChart() &&
66874
+ (this.dataset.records?.length ?? 0) === 0 &&
66821
66875
  (this.cornerSetting.titleOnDimension === 'row' || this.cornerSetting.titleOnDimension === 'all')) {
66822
66876
  count = this.rowsDefine.length ?? 0;
66823
66877
  }
66824
66878
  }
66825
66879
  else if (this.dataset &&
66880
+ !this._table.isPivotChart() &&
66826
66881
  (this.dataset.records?.length ?? 0) === 0 &&
66827
- !this.dataset.customColTree &&
66828
66882
  !this.dataset.customRowTree) {
66829
66883
  if (this.cornerSetting.titleOnDimension === 'row' || this.cornerSetting.titleOnDimension === 'all') {
66830
66884
  count = this.rowsDefine.length;
@@ -66833,6 +66887,14 @@
66833
66887
  }
66834
66888
  }
66835
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
+ }
66836
66898
  this.rowHeaderLevelCount = count;
66837
66899
  return;
66838
66900
  }
@@ -67324,6 +67386,7 @@
67324
67386
  return this.isColumnIndicatorHeader(col, row) || this.isRowIndicatorHeader(col, row);
67325
67387
  }
67326
67388
  toggleHierarchyState(col, row) {
67389
+ this.colIndex = 0;
67327
67390
  const oldRowHeaderCellIds = this._rowHeaderCellFullPathIds_FULL.slice(0);
67328
67391
  const oldRowHeaderCellPositons = oldRowHeaderCellIds.map((id, row) => {
67329
67392
  return { col, row: row + this.columnHeaderLevelCount };
@@ -68371,6 +68434,13 @@
68371
68434
  const dataset = this.dataset;
68372
68435
  this.rowTree = dataset.rowHeaderTree;
68373
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
+ });
68374
68444
  this.columnDimensionTree = new DimensionTree(this.columnTree ?? [], this.sharedVar);
68375
68445
  this.rowDimensionTree = new DimensionTree(this.rowTree ?? [], this.sharedVar, this.rowHierarchyType, this.rowHierarchyType === 'tree' ? this.rowExpandLevel : undefined);
68376
68446
  this.resetColumnHeaderLevelCount();
@@ -68879,6 +68949,8 @@
68879
68949
  rowFlatKeys = {};
68880
68950
  colKeys = [];
68881
68951
  rowKeys = [];
68952
+ colKeys_normal = [];
68953
+ rowKeys_normal = [];
68882
68954
  rowOrder = 'key_a_to_z';
68883
68955
  colOrder = 'key_a_to_z';
68884
68956
  sorted = false;
@@ -68921,6 +68993,7 @@
68921
68993
  constructor(dataConfig, rows, columns, indicatorKeys, indicators, indicatorsAsCol, records, rowHierarchyType, customColTree, customRowTree, needSplitPositiveAndNegative) {
68922
68994
  this.registerAggregators();
68923
68995
  this.dataConfig = dataConfig;
68996
+ this.filterRules = this.dataConfig?.filterRules;
68924
68997
  this.rowHierarchyType = rowHierarchyType ?? 'grid';
68925
68998
  this.sortRules = this.dataConfig?.sortRules;
68926
68999
  this.aggregationRules = this.dataConfig?.aggregationRules;
@@ -68998,6 +69071,8 @@
68998
69071
  typeof window !== 'undefined' ? window.performance.now() : 0;
68999
69072
  this.totalStatistics();
69000
69073
  typeof window !== 'undefined' ? window.performance.now() : 0;
69074
+ this.rowKeys_normal = this.rowKeys.slice();
69075
+ this.colKeys_normal = this.colKeys.slice();
69001
69076
  typeof window !== 'undefined' ? window.performance.now() : 0;
69002
69077
  this.sortKeys();
69003
69078
  typeof window !== 'undefined' ? window.performance.now() : 0;
@@ -69121,7 +69196,7 @@
69121
69196
  }
69122
69197
  processRecords() {
69123
69198
  let isNeedFilter = false;
69124
- if ((this.dataConfig?.filterRules?.length ?? 0) >= 1) {
69199
+ if ((this.filterRules?.length ?? 0) >= 1) {
69125
69200
  isNeedFilter = true;
69126
69201
  }
69127
69202
  if (Array.isArray(this.records)) {
@@ -69147,9 +69222,9 @@
69147
69222
  }
69148
69223
  filterRecord(record) {
69149
69224
  let isReserved = true;
69150
- if (this.dataConfig?.filterRules) {
69151
- for (let i = 0; i < this.dataConfig.filterRules.length; i++) {
69152
- 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];
69153
69228
  if (filterRule.filterKey) {
69154
69229
  const filterValue = record[filterRule.filterKey];
69155
69230
  if (filterRule.filteredValues?.indexOf(filterValue) === -1) {
@@ -69478,6 +69553,7 @@
69478
69553
  this.processRecords();
69479
69554
  this.processCollectedValuesWithSumBy();
69480
69555
  this.processCollectedValuesWithSortBy();
69556
+ this.totalStatistics();
69481
69557
  if (this.dataConfig?.isPivotChart) {
69482
69558
  this.cacheDeminsionCollectedValues();
69483
69559
  }
@@ -69575,41 +69651,13 @@
69575
69651
  };
69576
69652
  }
69577
69653
  sortKeys() {
69578
- const that = this;
69654
+ this.colKeys = this.colKeys_normal.slice();
69655
+ this.rowKeys = this.rowKeys_normal.slice();
69579
69656
  if (!this.sorted) {
69580
69657
  this.sorted = true;
69581
- const getValue = function (rowKey, colKey) {
69582
- return that.getAggregator(rowKey, colKey, '').value();
69583
- };
69584
- switch (this.rowOrder) {
69585
- case 'value_a_to_z':
69586
- this.rowKeys.sort(function (a, b) {
69587
- return naturalSort(getValue(a, []), getValue(b, []));
69588
- });
69589
- break;
69590
- case 'value_z_to_a':
69591
- this.rowKeys.sort(function (a, b) {
69592
- return -naturalSort(getValue(a, []), getValue(b, []));
69593
- });
69594
- break;
69595
- default:
69596
- this.rowKeys.sort(this.arrSort(this.rows, true));
69597
- }
69598
- switch (this.colOrder) {
69599
- case 'value_a_to_z':
69600
- this.colKeys.sort(function (a, b) {
69601
- return naturalSort(getValue([], a), getValue([], b));
69602
- });
69603
- break;
69604
- case 'value_z_to_a':
69605
- this.colKeys.sort(function (a, b) {
69606
- return -naturalSort(getValue([], a), getValue([], b));
69607
- });
69608
- break;
69609
- default:
69610
- const sortfun = this.arrSort(this.columns, false);
69611
- this.colKeys.sort(sortfun);
69612
- }
69658
+ this.rowKeys.sort(this.arrSort(this.rows, true));
69659
+ const sortfun = this.arrSort(this.columns, false);
69660
+ this.colKeys.sort(sortfun);
69613
69661
  }
69614
69662
  }
69615
69663
  arrSort(fieldArr, isRow) {
@@ -69644,17 +69692,27 @@
69644
69692
  let bChanged = b;
69645
69693
  if (sorter.fieldIndex < fieldArr.length - 1) {
69646
69694
  aChanged = a.slice(0, sorter.fieldIndex + 1);
69647
- 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
+ }
69648
69701
  bChanged = b.slice(0, sorter.fieldIndex + 1);
69649
- 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
+ }
69650
69708
  }
69651
- comparison = sorter.func(aChanged, bChanged);
69709
+ comparison = sorter.func(aChanged, bChanged, sorter.sortRule?.sortType);
69652
69710
  }
69653
69711
  else {
69654
- comparison = sorter.func?.(a[sorter.fieldIndex], b[sorter.fieldIndex]);
69712
+ comparison = sorter.func?.(a[sorter.fieldIndex], b[sorter.fieldIndex], sorter.sortRule?.sortType);
69655
69713
  }
69656
69714
  if (comparison !== 0) {
69657
- return comparison * (sorter.sortRule?.sortType === SortType.DESC ? -1 : 1);
69715
+ return comparison;
69658
69716
  }
69659
69717
  }
69660
69718
  return 0;
@@ -69663,9 +69721,10 @@
69663
69721
  getSort(sortRule, isSortRow) {
69664
69722
  const that = this;
69665
69723
  if (sortRule.sortByIndicator) {
69666
- return (a, b) => {
69724
+ return (a, b, sortType) => {
69667
69725
  const getValue = function (rowKey, colKey) {
69668
- if (rowKey.length < that.rows.length &&
69726
+ if (that.rowHierarchyType === 'grid' &&
69727
+ rowKey.length < that.rows.length &&
69669
69728
  rowKey[rowKey.length - 1] !== that.rowSubTotalLabel &&
69670
69729
  rowKey[rowKey.length - 1] !== that.rowGrandTotalLabel) {
69671
69730
  rowKey.push(that.rowSubTotalLabel);
@@ -69678,20 +69737,20 @@
69678
69737
  return that.getAggregator(rowKey, colKey, sortRule.sortByIndicator).value();
69679
69738
  };
69680
69739
  if (isSortRow) {
69681
- return naturalSort(getValue(a, sortRule.query), getValue(b, sortRule.query));
69740
+ return naturalSort(getValue(a, sortRule.query), getValue(b, sortRule.query), sortType);
69682
69741
  }
69683
- return naturalSort(getValue(sortRule.query, a), getValue(sortRule.query, b));
69742
+ return naturalSort(getValue(sortRule.query, a), getValue(sortRule.query, b), sortType);
69684
69743
  };
69685
69744
  }
69686
69745
  else if (sortRule.sortBy) {
69687
69746
  return sortBy(sortRule.sortBy);
69688
69747
  }
69689
- if (sortRule.sortType) {
69690
- return typeSort;
69691
- }
69692
69748
  if (sortRule.sortFunc) {
69693
69749
  return sortRule.sortFunc;
69694
69750
  }
69751
+ if (sortRule.sortType) {
69752
+ return typeSort;
69753
+ }
69695
69754
  return naturalSort;
69696
69755
  }
69697
69756
  totalStatistics() {
@@ -69744,7 +69803,9 @@
69744
69803
  dependIndicatorKeys: calculatedFieldRule?.dependIndicatorKeys
69745
69804
  });
69746
69805
  }
69747
- 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
+ }
69748
69809
  }
69749
69810
  else {
69750
69811
  if (!this.tree[flatRowKey][flatColTotalKey][i]) {
@@ -69761,7 +69822,9 @@
69761
69822
  })?.format
69762
69823
  });
69763
69824
  }
69764
- 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
+ }
69765
69828
  }
69766
69829
  }
69767
69830
  }
@@ -69796,7 +69859,9 @@
69796
69859
  dependIndicatorKeys: calculatedFieldRule?.dependIndicatorKeys
69797
69860
  });
69798
69861
  }
69799
- 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
+ }
69800
69865
  }
69801
69866
  else {
69802
69867
  if (!this.tree[flatRowKey][flatColTotalKey][i]) {
@@ -69813,7 +69878,9 @@
69813
69878
  })?.format
69814
69879
  });
69815
69880
  }
69816
- 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
+ }
69817
69884
  }
69818
69885
  }
69819
69886
  }
@@ -69875,7 +69942,9 @@
69875
69942
  });
69876
69943
  }
69877
69944
  }
69878
- 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
+ }
69879
69948
  }
69880
69949
  }
69881
69950
  }
@@ -69924,7 +69993,9 @@
69924
69993
  });
69925
69994
  }
69926
69995
  }
69927
- 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
+ }
69928
69999
  }
69929
70000
  }
69930
70001
  colCompute(flatRowKey, flatColKey);
@@ -70383,7 +70454,7 @@
70383
70454
  this.internalProps.rowTree?.forEach((node, index) => {
70384
70455
  const beforeRowDimension = beforeRowDimensions.find(item => item.dimensionKey === node.dimensionKey && item.value === node.value);
70385
70456
  if (beforeRowDimension) {
70386
- this.syncHierarchyState(beforeRowDimension, node);
70457
+ this._syncHierarchyState(beforeRowDimension, node);
70387
70458
  }
70388
70459
  });
70389
70460
  }
@@ -70516,7 +70587,7 @@
70516
70587
  get rowHierarchyType() {
70517
70588
  return this.internalProps.layoutMap.rowHierarchyType;
70518
70589
  }
70519
- syncHierarchyState(sourceNode, targetNode) {
70590
+ _syncHierarchyState(sourceNode, targetNode) {
70520
70591
  if (sourceNode.value === targetNode.value && sourceNode.dimensionKey === targetNode.dimensionKey) {
70521
70592
  targetNode.hierarchyState =
70522
70593
  targetNode.hierarchyState ?? (targetNode?.children ? sourceNode.hierarchyState : undefined);
@@ -70524,7 +70595,7 @@
70524
70595
  if (sourceNode?.children?.[index] && targetChildNode) {
70525
70596
  const beforeRowDimension = sourceNode.children.find((item) => item.dimensionKey === targetChildNode.dimensionKey && item.value === targetChildNode.value);
70526
70597
  if (beforeRowDimension) {
70527
- this.syncHierarchyState(beforeRowDimension, targetChildNode);
70598
+ this._syncHierarchyState(beforeRowDimension, targetChildNode);
70528
70599
  }
70529
70600
  }
70530
70601
  });
@@ -70957,38 +71028,36 @@
70957
71028
  const sortRules = this.internalProps.dataConfig?.sortRules ?? [];
70958
71029
  for (let i = 0; i < sortRules.length; i++) {
70959
71030
  const sortRule = sortRules[i];
70960
- if (sortRule.sortType) {
70961
- const dimensions = [];
70962
- if (sortRule.sortByIndicator) {
70963
- if (sortRule.sortField ===
70964
- (this.dataset.indicatorsAsCol
70965
- ? this.dataset.rows[this.dataset.rows.length - 1]
70966
- : this.dataset.columns[this.dataset.columns.length - 1])) {
70967
- for (let j = 0; j < sortRule.query.length; j++) {
70968
- dimensions.push({
70969
- dimensionKey: this.dataset.indicatorsAsCol ? this.dataset.columns[j] : this.dataset.rows[j],
70970
- value: sortRule.query[j]
70971
- });
70972
- }
70973
- dimensions.push({
70974
- indicatorKey: sortRule.sortByIndicator,
70975
- value: this.internalProps.layoutMap.getIndicatorInfo(sortRule.sortByIndicator)
70976
- ?.title ?? sortRule.sortByIndicator
70977
- });
70978
- }
70979
- }
70980
- 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++) {
70981
71038
  dimensions.push({
70982
- dimensionKey: sortRule.sortField,
70983
- isPivotCorner: true,
70984
- value: sortRule.sortField
71039
+ dimensionKey: this.dataset.indicatorsAsCol ? this.dataset.columns[j] : this.dataset.rows[j],
71040
+ value: sortRule.query[j]
70985
71041
  });
70986
71042
  }
70987
- this.pivotSortState.push({
70988
- dimensions,
70989
- order: sortRule.sortType
71043
+ dimensions.push({
71044
+ indicatorKey: sortRule.sortByIndicator,
71045
+ value: this.internalProps.layoutMap.getIndicatorInfo(sortRule.sortByIndicator)?.title ??
71046
+ sortRule.sortByIndicator
71047
+ });
71048
+ }
71049
+ else {
71050
+ dimensions.push({
71051
+ dimensionKey: sortRule.sortField,
71052
+ isPivotCorner: true,
71053
+ value: sortRule.sortField
70990
71054
  });
70991
71055
  }
71056
+ const sortType = sortRule.sortType ? sortRule.sortType.toUpperCase() : 'ASC';
71057
+ this.pivotSortState.push({
71058
+ dimensions,
71059
+ order: SortType[sortType]
71060
+ });
70992
71061
  }
70993
71062
  }
70994
71063
  updatePivotSortState(pivotSortStateConfig) {
@@ -71016,9 +71085,11 @@
71016
71085
  const headerDefine = this.getHeaderDefine(col, row);
71017
71086
  if (headerDefine.sort) {
71018
71087
  if (this.dataset.sortRules) {
71088
+ const cacheOldDimensionSortRule = {};
71019
71089
  for (let i = this.dataset.sortRules.length - 1; i >= 0; i--) {
71020
71090
  const sortRule = this.dataset.sortRules[i];
71021
71091
  if (headerDefine.dimensionKey && sortRule.sortField === headerDefine.dimensionKey) {
71092
+ cacheOldDimensionSortRule[sortRule.sortField] = sortRule;
71022
71093
  this.dataset.sortRules.splice(i, 1);
71023
71094
  }
71024
71095
  else if (sortIndicator &&
@@ -71045,10 +71116,10 @@
71045
71116
  });
71046
71117
  }
71047
71118
  else {
71048
- this.dataset.sortRules.push({
71119
+ this.dataset.sortRules.push(Object.assign(cacheOldDimensionSortRule[headerDefine.dimensionKey] ?? {}, {
71049
71120
  sortField: headerDefine.dimensionKey,
71050
71121
  sortType: SortType[order]
71051
- });
71122
+ }));
71052
71123
  }
71053
71124
  }
71054
71125
  else {
@@ -71630,6 +71701,11 @@
71630
71701
  });
71631
71702
  }
71632
71703
  }
71704
+ updateFilterRules(filterRules) {
71705
+ this.internalProps.dataConfig.filterRules = filterRules;
71706
+ this.dataset.updateFilterRules(filterRules);
71707
+ this.renderWithRecreateCells();
71708
+ }
71633
71709
  }
71634
71710
 
71635
71711
  registerAxis();
@@ -73280,7 +73356,7 @@
73280
73356
  }
73281
73357
 
73282
73358
  registerForVrender();
73283
- const version = "1.7.2";
73359
+ const version = "1.7.4";
73284
73360
  function getIcons() {
73285
73361
  return get$2();
73286
73362
  }