@visactor/vtable 1.2.1-alpha.1 → 1.3.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 (181) hide show
  1. package/cjs/ListTable.js +2 -1
  2. package/cjs/ListTable.js.map +1 -1
  3. package/cjs/PivotChart.d.ts +1 -5
  4. package/cjs/PivotChart.js +7 -30
  5. package/cjs/PivotChart.js.map +1 -1
  6. package/cjs/PivotTable.d.ts +7 -2
  7. package/cjs/PivotTable.js +85 -17
  8. package/cjs/PivotTable.js.map +1 -1
  9. package/cjs/body-helper/style/Style.d.ts +3 -0
  10. package/cjs/body-helper/style/Style.js +32 -25
  11. package/cjs/body-helper/style/Style.js.map +1 -1
  12. package/cjs/components/title/title.js +4 -2
  13. package/cjs/components/title/title.js.map +1 -1
  14. package/cjs/components/tooltip/TooltipHandler.js +3 -1
  15. package/cjs/components/tooltip/TooltipHandler.js.map +1 -1
  16. package/cjs/components/tooltip/logic/BubbleTooltipElement.js +3 -7
  17. package/cjs/components/tooltip/logic/BubbleTooltipElement.js.map +1 -1
  18. package/cjs/components/tooltip/logic/BubbleTooltipElementStyle.js +1 -1
  19. package/cjs/components/tooltip/logic/BubbleTooltipElementStyle.js.map +1 -1
  20. package/cjs/core/BaseTable.d.ts +1 -1
  21. package/cjs/core/BaseTable.js +6 -5
  22. package/cjs/core/BaseTable.js.map +1 -1
  23. package/cjs/core/tableHelper.js +2 -1
  24. package/cjs/core/tableHelper.js.map +1 -1
  25. package/cjs/event/event.d.ts +1 -0
  26. package/cjs/event/event.js +1 -1
  27. package/cjs/event/event.js.map +1 -1
  28. package/cjs/event/listener/container-dom.js +9 -6
  29. package/cjs/event/listener/container-dom.js.map +1 -1
  30. package/cjs/event/listener/table-group.js +8 -7
  31. package/cjs/event/listener/table-group.js.map +1 -1
  32. package/cjs/event/sparkline-event.js +2 -1
  33. package/cjs/event/sparkline-event.js.map +1 -1
  34. package/cjs/header-helper/header-helper.d.ts +1 -0
  35. package/cjs/header-helper/header-helper.js +12 -2
  36. package/cjs/header-helper/header-helper.js.map +1 -1
  37. package/cjs/header-helper/style/Style.d.ts +3 -0
  38. package/cjs/header-helper/style/Style.js +34 -27
  39. package/cjs/header-helper/style/Style.js.map +1 -1
  40. package/cjs/index.d.ts +1 -1
  41. package/cjs/index.js +2 -2
  42. package/cjs/index.js.map +1 -1
  43. package/cjs/layout/pivot-header-layout.js +26 -8
  44. package/cjs/layout/pivot-header-layout.js.map +1 -1
  45. package/cjs/layout/tree-helper.js +4 -1
  46. package/cjs/layout/tree-helper.js.map +1 -1
  47. package/cjs/scenegraph/group-creater/cell-helper.js +1 -1
  48. package/cjs/scenegraph/group-creater/cell-helper.js.map +1 -1
  49. package/cjs/scenegraph/group-creater/cell-type/checkbox-cell.js +1 -1
  50. package/cjs/scenegraph/group-creater/cell-type/checkbox-cell.js.map +1 -1
  51. package/cjs/scenegraph/group-creater/cell-type/radio-cell.js +1 -1
  52. package/cjs/scenegraph/group-creater/cell-type/radio-cell.js.map +1 -1
  53. package/cjs/scenegraph/icon/icon-update.js +9 -9
  54. package/cjs/scenegraph/icon/icon-update.js.map +1 -1
  55. package/cjs/scenegraph/layout/compute-col-width.js +14 -3
  56. package/cjs/scenegraph/layout/compute-col-width.js.map +1 -1
  57. package/cjs/scenegraph/utils/text-icon-layout.js +8 -7
  58. package/cjs/scenegraph/utils/text-icon-layout.js.map +1 -1
  59. package/cjs/state/select/update-position.js +1 -1
  60. package/cjs/state/select/update-position.js.map +1 -1
  61. package/cjs/state/state.js +5 -4
  62. package/cjs/state/state.js.map +1 -1
  63. package/cjs/themes/theme.js +3 -6
  64. package/cjs/themes/theme.js.map +1 -1
  65. package/cjs/ts-types/base-table.d.ts +2 -1
  66. package/cjs/ts-types/base-table.js.map +1 -1
  67. package/cjs/ts-types/column/style.d.ts +1 -0
  68. package/cjs/ts-types/column/style.js.map +1 -1
  69. package/cjs/ts-types/common.d.ts +4 -13
  70. package/cjs/ts-types/common.js.map +1 -1
  71. package/cjs/ts-types/component/title.d.ts +2 -0
  72. package/cjs/ts-types/component/title.js.map +1 -1
  73. package/cjs/ts-types/icon.d.ts +0 -2
  74. package/cjs/ts-types/icon.js.map +1 -1
  75. package/cjs/ts-types/list-table/layout-map/api.d.ts +2 -1
  76. package/cjs/ts-types/list-table/layout-map/api.js.map +1 -1
  77. package/cjs/ts-types/pivot-table/dimension/basic-dimension.d.ts +3 -1
  78. package/cjs/ts-types/pivot-table/dimension/basic-dimension.js.map +1 -1
  79. package/cjs/ts-types/pivot-table/indicator/basic-indicator.d.ts +1 -0
  80. package/cjs/ts-types/pivot-table/indicator/basic-indicator.js.map +1 -1
  81. package/cjs/ts-types/style-define.d.ts +1 -0
  82. package/cjs/ts-types/style-define.js.map +1 -1
  83. package/cjs/ts-types/table-engine.d.ts +4 -1
  84. package/cjs/ts-types/table-engine.js.map +1 -1
  85. package/cjs/ts-types/theme.d.ts +0 -2
  86. package/cjs/ts-types/theme.js.map +1 -1
  87. package/cjs/ts-types/tooltip.d.ts +0 -2
  88. package/cjs/ts-types/tooltip.js.map +1 -1
  89. package/cjs/vrender.js.map +1 -1
  90. package/dist/vtable.js +368 -123
  91. package/dist/vtable.min.js +2 -2
  92. package/es/ListTable.js +2 -1
  93. package/es/ListTable.js.map +1 -1
  94. package/es/PivotChart.d.ts +1 -5
  95. package/es/PivotChart.js +6 -31
  96. package/es/PivotChart.js.map +1 -1
  97. package/es/PivotTable.d.ts +7 -2
  98. package/es/PivotTable.js +87 -19
  99. package/es/PivotTable.js.map +1 -1
  100. package/es/body-helper/style/Style.d.ts +3 -0
  101. package/es/body-helper/style/Style.js +32 -25
  102. package/es/body-helper/style/Style.js.map +1 -1
  103. package/es/components/title/title.js +4 -2
  104. package/es/components/title/title.js.map +1 -1
  105. package/es/components/tooltip/TooltipHandler.js +3 -1
  106. package/es/components/tooltip/TooltipHandler.js.map +1 -1
  107. package/es/components/tooltip/logic/BubbleTooltipElement.js +3 -7
  108. package/es/components/tooltip/logic/BubbleTooltipElement.js.map +1 -1
  109. package/es/components/tooltip/logic/BubbleTooltipElementStyle.js +1 -1
  110. package/es/components/tooltip/logic/BubbleTooltipElementStyle.js.map +1 -1
  111. package/es/core/BaseTable.d.ts +1 -1
  112. package/es/core/BaseTable.js +6 -5
  113. package/es/core/BaseTable.js.map +1 -1
  114. package/es/core/tableHelper.js +2 -1
  115. package/es/core/tableHelper.js.map +1 -1
  116. package/es/event/event.d.ts +1 -0
  117. package/es/event/event.js +1 -1
  118. package/es/event/event.js.map +1 -1
  119. package/es/event/listener/container-dom.js +9 -6
  120. package/es/event/listener/container-dom.js.map +1 -1
  121. package/es/event/listener/table-group.js +8 -7
  122. package/es/event/listener/table-group.js.map +1 -1
  123. package/es/event/sparkline-event.js +2 -1
  124. package/es/event/sparkline-event.js.map +1 -1
  125. package/es/header-helper/header-helper.d.ts +1 -0
  126. package/es/header-helper/header-helper.js +12 -2
  127. package/es/header-helper/header-helper.js.map +1 -1
  128. package/es/header-helper/style/Style.d.ts +3 -0
  129. package/es/header-helper/style/Style.js +34 -27
  130. package/es/header-helper/style/Style.js.map +1 -1
  131. package/es/index.d.ts +1 -1
  132. package/es/index.js +1 -1
  133. package/es/index.js.map +1 -1
  134. package/es/layout/pivot-header-layout.js +26 -8
  135. package/es/layout/pivot-header-layout.js.map +1 -1
  136. package/es/layout/tree-helper.js +4 -1
  137. package/es/layout/tree-helper.js.map +1 -1
  138. package/es/scenegraph/group-creater/cell-helper.js +1 -1
  139. package/es/scenegraph/group-creater/cell-helper.js.map +1 -1
  140. package/es/scenegraph/group-creater/cell-type/checkbox-cell.js +1 -1
  141. package/es/scenegraph/group-creater/cell-type/checkbox-cell.js.map +1 -1
  142. package/es/scenegraph/group-creater/cell-type/radio-cell.js +1 -1
  143. package/es/scenegraph/group-creater/cell-type/radio-cell.js.map +1 -1
  144. package/es/scenegraph/icon/icon-update.js +9 -9
  145. package/es/scenegraph/icon/icon-update.js.map +1 -1
  146. package/es/scenegraph/layout/compute-col-width.js +14 -3
  147. package/es/scenegraph/layout/compute-col-width.js.map +1 -1
  148. package/es/scenegraph/utils/text-icon-layout.js +9 -8
  149. package/es/scenegraph/utils/text-icon-layout.js.map +1 -1
  150. package/es/state/select/update-position.js +1 -1
  151. package/es/state/select/update-position.js.map +1 -1
  152. package/es/state/state.js +5 -4
  153. package/es/state/state.js.map +1 -1
  154. package/es/themes/theme.js +3 -6
  155. package/es/themes/theme.js.map +1 -1
  156. package/es/ts-types/base-table.d.ts +2 -1
  157. package/es/ts-types/base-table.js.map +1 -1
  158. package/es/ts-types/column/style.d.ts +1 -0
  159. package/es/ts-types/column/style.js.map +1 -1
  160. package/es/ts-types/common.d.ts +4 -13
  161. package/es/ts-types/common.js.map +1 -1
  162. package/es/ts-types/component/title.d.ts +2 -0
  163. package/es/ts-types/component/title.js.map +1 -1
  164. package/es/ts-types/icon.d.ts +0 -2
  165. package/es/ts-types/icon.js.map +1 -1
  166. package/es/ts-types/list-table/layout-map/api.d.ts +2 -1
  167. package/es/ts-types/list-table/layout-map/api.js.map +1 -1
  168. package/es/ts-types/pivot-table/dimension/basic-dimension.d.ts +3 -1
  169. package/es/ts-types/pivot-table/dimension/basic-dimension.js.map +1 -1
  170. package/es/ts-types/pivot-table/indicator/basic-indicator.d.ts +1 -0
  171. package/es/ts-types/pivot-table/indicator/basic-indicator.js.map +1 -1
  172. package/es/ts-types/style-define.d.ts +1 -0
  173. package/es/ts-types/style-define.js.map +1 -1
  174. package/es/ts-types/table-engine.d.ts +4 -1
  175. package/es/ts-types/table-engine.js.map +1 -1
  176. package/es/ts-types/theme.d.ts +0 -2
  177. package/es/ts-types/theme.js.map +1 -1
  178. package/es/ts-types/tooltip.d.ts +0 -2
  179. package/es/ts-types/tooltip.js.map +1 -1
  180. package/es/vrender.js.map +1 -1
  181. package/package.json +5 -5
package/dist/vtable.js CHANGED
@@ -22113,6 +22113,7 @@
22113
22113
  };
22114
22114
  let Style$1 = class Style extends EventTarget$1 {
22115
22115
  _color;
22116
+ _strokeColor;
22116
22117
  _fontSize;
22117
22118
  _fontFamily;
22118
22119
  _fontWeight;
@@ -22151,6 +22152,7 @@
22151
22152
  this._textAlign = style?.textAlign ?? bodyStyle?.textAlign;
22152
22153
  this._textBaseline = style?.textBaseline ?? bodyStyle?.textBaseline;
22153
22154
  this._color = style?.color ?? bodyStyle?.color;
22155
+ this._strokeColor = style?.strokeColor ?? bodyStyle?.strokeColor;
22154
22156
  this._fontSize = style.fontSize ?? bodyStyle?.fontSize;
22155
22157
  this._fontFamily = style.fontFamily ?? bodyStyle?.fontFamily;
22156
22158
  this._fontWeight = style.fontWeight ?? bodyStyle?.fontWeight;
@@ -22182,6 +22184,12 @@
22182
22184
  set color(color) {
22183
22185
  this._color = color;
22184
22186
  }
22187
+ get strokeColor() {
22188
+ return this._strokeColor;
22189
+ }
22190
+ set strokeColor(strokeColor) {
22191
+ this._strokeColor = strokeColor;
22192
+ }
22185
22193
  get fontSize() {
22186
22194
  return this._fontSize;
22187
22195
  }
@@ -22642,6 +22650,7 @@
22642
22650
  };
22643
22651
  class Style extends EventTarget$1 {
22644
22652
  _color;
22653
+ _strokeColor;
22645
22654
  _fontSize;
22646
22655
  _fontFamily;
22647
22656
  _fontWeight;
@@ -22678,6 +22687,7 @@
22678
22687
  constructor(style = {}, headerStyle = {}) {
22679
22688
  super();
22680
22689
  this._color = style.color ?? headerStyle?.color;
22690
+ this._strokeColor = style?.strokeColor ?? headerStyle?.strokeColor;
22681
22691
  this._fontSize = style.fontSize ?? headerStyle?.fontSize;
22682
22692
  this._fontFamily = style.fontFamily ?? headerStyle?.fontFamily;
22683
22693
  this._fontWeight = style.fontWeight ?? headerStyle?.fontWeight;
@@ -22717,6 +22727,12 @@
22717
22727
  set color(color) {
22718
22728
  this._color = color;
22719
22729
  }
22730
+ get strokeColor() {
22731
+ return this._strokeColor;
22732
+ }
22733
+ set strokeColor(strokeColor) {
22734
+ this._strokeColor = strokeColor;
22735
+ }
22720
22736
  get fontSize() {
22721
22737
  return this._fontSize;
22722
22738
  }
@@ -25045,12 +25061,6 @@
25045
25061
  },
25046
25062
  get color() {
25047
25063
  return tooltip.color ?? '#FFF';
25048
- },
25049
- get maxWidth() {
25050
- return tooltip.maxWidth;
25051
- },
25052
- get maxHeight() {
25053
- return tooltip.maxHeight;
25054
25064
  }
25055
25065
  };
25056
25066
  }
@@ -25241,6 +25251,9 @@
25241
25251
  get color() {
25242
25252
  return style.color;
25243
25253
  },
25254
+ get strokeColor() {
25255
+ return style.strokeColor;
25256
+ },
25244
25257
  get borderColor() {
25245
25258
  return style.borderColor;
25246
25259
  },
@@ -35071,6 +35084,7 @@
35071
35084
  const textAlign = getProp('textAlign', headerStyle, col, row, table);
35072
35085
  const textBaseline = getProp('textBaseline', headerStyle, col, row, table);
35073
35086
  const color = getProp('color', headerStyle, col, row, table);
35087
+ const strokeColor = getProp('strokeColor', headerStyle, col, row, table);
35074
35088
  const lineHeight = getProp('lineHeight', headerStyle, col, row, table);
35075
35089
  const underline = getProp('underline', headerStyle, col, row, table);
35076
35090
  const underlineDash = getProp('underlineDash', headerStyle, col, row, table);
@@ -35107,6 +35121,7 @@
35107
35121
  fontStyle,
35108
35122
  fontVariant,
35109
35123
  fill: color,
35124
+ stroke: strokeColor ?? false,
35110
35125
  textAlign,
35111
35126
  textBaseline,
35112
35127
  lineHeight: lineHeight ?? fontSize,
@@ -37878,7 +37893,7 @@
37878
37893
  wordBreak: 'break-word',
37879
37894
  heightLimit: autoRowHeight && !table.options.customConfig?.multilinesForXTable
37880
37895
  ? -1
37881
- : cellHeight - (padding[0] + padding[2]),
37896
+ : cellHeight - Math.floor(padding[0] + padding[2]),
37882
37897
  pickable: false,
37883
37898
  dx: (textAlign === 'left' ? hierarchyOffset : 0) + _contentOffset,
37884
37899
  whiteSpace: text.length === 1 && !autoWrapText ? 'no-wrap' : 'normal'
@@ -37979,7 +37994,7 @@
37979
37994
  textBaseline: 'top',
37980
37995
  heightLimit: autoRowHeight && !table.options.customConfig?.multilinesForXTable
37981
37996
  ? -1
37982
- : cellHeight - (padding[0] + padding[2]),
37997
+ : cellHeight - Math.floor(padding[0] + padding[2]),
37983
37998
  pickable: false,
37984
37999
  autoWrapText,
37985
38000
  lineClamp,
@@ -38192,6 +38207,9 @@
38192
38207
  return config;
38193
38208
  }
38194
38209
  function updateCellContentWidth(cellGroup, distWidth, cellHeight, detaX, autoRowHeight, padding, textAlign, textBaseline, scene) {
38210
+ if (isValidNumber$1(cellGroup.contentWidth)) {
38211
+ detaX = distWidth - (cellGroup.contentWidth ?? cellGroup.attribute.width);
38212
+ }
38195
38213
  let leftIconWidth = 0;
38196
38214
  let leftIconHeight = 0;
38197
38215
  let rightIconWidth = 0;
@@ -38239,7 +38257,7 @@
38239
38257
  else if (child.role === 'icon-absolute-right') {
38240
38258
  child.setAttribute('x', child.attribute.x + detaX);
38241
38259
  }
38242
- else if (child.name === 'content' || child.name === 'text') {
38260
+ else if (child.name === 'content' || (child.name === 'text' && child.type !== 'richtext')) {
38243
38261
  const childTextAlign = child.attribute.textAlign ?? textAlign;
38244
38262
  if (childTextAlign === 'center') {
38245
38263
  child.setAttribute('x', padding[3] + leftIconWidth + (distWidth - (padding[1] + padding[3]) - leftIconWidth - rightIconWidth) / 2);
@@ -38299,7 +38317,7 @@
38299
38317
  return false;
38300
38318
  }
38301
38319
  function updateCellContentHeight(cellGroup, distHeight, detaY, autoRowHeight, padding, textAlign, textBaseline) {
38302
- const newHeight = distHeight - (padding[0] + padding[2]);
38320
+ const newHeight = distHeight - Math.floor(padding[0] + padding[2]);
38303
38321
  const textMark = cellGroup.getChildByName('text');
38304
38322
  if (textMark instanceof Text$1 && !autoRowHeight) {
38305
38323
  textMark.setAttributes({
@@ -38737,7 +38755,7 @@
38737
38755
  autoWrapText,
38738
38756
  lineClamp,
38739
38757
  wordBreak: 'break-word',
38740
- heightLimit: autoRowHeight ? -1 : cellHeight - (padding[0] + padding[2]),
38758
+ heightLimit: autoRowHeight ? -1 : cellHeight - Math.floor(padding[0] + padding[2]),
38741
38759
  pickable: false,
38742
38760
  dx: hierarchyOffset,
38743
38761
  whiteSpace: text.length === 1 && !autoWrapText ? 'no-wrap' : 'normal'
@@ -38868,7 +38886,7 @@
38868
38886
  autoWrapText,
38869
38887
  lineClamp,
38870
38888
  wordBreak: 'break-word',
38871
- heightLimit: autoRowHeight ? -1 : cellHeight - (padding[0] + padding[2]),
38889
+ heightLimit: autoRowHeight ? -1 : cellHeight - Math.floor(padding[0] + padding[2]),
38872
38890
  pickable: false,
38873
38891
  dx: hierarchyOffset
38874
38892
  };
@@ -39183,7 +39201,7 @@
39183
39201
  autoWrapText,
39184
39202
  lineClamp,
39185
39203
  wordBreak: 'break-word',
39186
- heightLimit: cellHeight - (padding[0] + padding[2]),
39204
+ heightLimit: cellHeight - Math.floor(padding[0] + padding[2]),
39187
39205
  pickable: false,
39188
39206
  dx: textAlign === 'left' ? hierarchyOffset : 0,
39189
39207
  x
@@ -45007,6 +45025,8 @@
45007
45025
  function getAdaptiveWidth(totalDrawWidth, startCol, endColPlus1, update, newWidths, table, fromScenegraph) {
45008
45026
  let actualWidth = 0;
45009
45027
  const adaptiveColumns = [];
45028
+ const sparklineColumns = [];
45029
+ let totalSparklineAbleWidth = 0;
45010
45030
  for (let col = startCol; col < endColPlus1; col++) {
45011
45031
  const width = update ? newWidths[col] : table.getColWidth(col);
45012
45032
  const maxWidth = table.getMaxColWidth(col);
@@ -45018,8 +45038,34 @@
45018
45038
  else {
45019
45039
  totalDrawWidth -= width;
45020
45040
  }
45041
+ if (table.options.customConfig?.shrinkSparklineFirst) {
45042
+ const bodyCellType = table.getBodyColumnType(col, 0);
45043
+ if (bodyCellType === 'sparkline') {
45044
+ sparklineColumns.push({ col, width });
45045
+ totalSparklineAbleWidth += width - table.defaultColWidth;
45046
+ }
45047
+ }
45021
45048
  }
45022
45049
  const factor = totalDrawWidth / actualWidth;
45050
+ if (table.options.customConfig?.shrinkSparklineFirst &&
45051
+ factor < 1 &&
45052
+ totalDrawWidth - actualWidth < totalSparklineAbleWidth) {
45053
+ for (let i = 0; i < sparklineColumns.length; i++) {
45054
+ const { col, width } = sparklineColumns[i];
45055
+ const deltaWidth = (actualWidth - totalDrawWidth) / sparklineColumns.length;
45056
+ const colWidth = Math.floor(width - deltaWidth);
45057
+ if (update) {
45058
+ newWidths[col] = table._adjustColWidth(col, colWidth);
45059
+ }
45060
+ else if (fromScenegraph) {
45061
+ table.scenegraph.setColWidth(col, table._adjustColWidth(col, colWidth));
45062
+ }
45063
+ else {
45064
+ table._setColWidth(col, table._adjustColWidth(col, colWidth), false, true);
45065
+ }
45066
+ }
45067
+ return;
45068
+ }
45023
45069
  for (let i = 0; i < adaptiveColumns.length; i++) {
45024
45070
  const col = adaptiveColumns[i];
45025
45071
  let colWidth;
@@ -48446,7 +48492,6 @@
48446
48492
  if (iconBack) {
48447
48493
  iconBack.setAttributes({
48448
48494
  x: (icon.attribute.x ?? 0) +
48449
- (icon.attribute.dx ?? 0) +
48450
48495
  (icon.AABBBounds.width() - icon.backgroundWidth) / 2,
48451
48496
  y: (icon.attribute.y ?? 0) + (icon.AABBBounds.height() - icon.backgroundHeight) / 2,
48452
48497
  dx: icon.attribute.dx ?? 0,
@@ -48461,7 +48506,6 @@
48461
48506
  else {
48462
48507
  iconBack = createRect({
48463
48508
  x: (icon.attribute.x ?? 0) +
48464
- (icon.attribute.dx ?? 0) +
48465
48509
  (icon.AABBBounds.width() - icon.backgroundWidth) / 2,
48466
48510
  y: (icon.attribute.y ?? 0) + (icon.AABBBounds.height() - icon.backgroundHeight) / 2,
48467
48511
  dx: icon.attribute.dx ?? 0,
@@ -50685,6 +50729,10 @@
50685
50729
  !table.stateManager.isResizeCol()) {
50686
50730
  const currentRange = state.select.ranges[state.select.ranges.length - 1];
50687
50731
  if (isShift && currentRange) {
50732
+ if (!isCtrl) {
50733
+ cellPos.col = col;
50734
+ cellPos.row = row;
50735
+ }
50688
50736
  if (state.select.headerSelectMode !== 'cell' && table.isColumnHeader(col, row)) {
50689
50737
  const startCol = Math.min(currentRange.start.col, currentRange.end.col, col);
50690
50738
  const endCol = Math.max(currentRange.start.col, currentRange.end.col, col);
@@ -52379,12 +52427,15 @@
52379
52427
  endMoveCol(this);
52380
52428
  }
52381
52429
  checkFrozen() {
52382
- const originalFrozenColCount = this.table.isListTable() && !this.table.internalProps.transpose
52430
+ let originalFrozenColCount = this.table.isListTable() && !this.table.internalProps.transpose
52383
52431
  ? this.table.options.frozenColCount
52384
52432
  : this.table.isPivotChart()
52385
52433
  ? this.table.rowHeaderLevelCount ?? 0
52386
52434
  : Math.max((this.table.rowHeaderLevelCount ?? 0) + this.table.internalProps.layoutMap.leftRowSeriesNumberColumnCount, this.table.options.frozenColCount ?? 0);
52387
52435
  if (originalFrozenColCount) {
52436
+ if (originalFrozenColCount > this.table.colCount) {
52437
+ originalFrozenColCount = this.table.colCount;
52438
+ }
52388
52439
  if (this.table.tableNoFrameWidth - this.table.getColsWidth(0, originalFrozenColCount - 1) <= 120) {
52389
52440
  this.table._setFrozenColCount(0);
52390
52441
  this.setFrozenCol(-1);
@@ -52713,7 +52764,10 @@
52713
52764
  }
52714
52765
  triggerSort(col, row, iconMark, event) {
52715
52766
  if (this.table.isPivotTable()) {
52716
- const order = this.table.getPivotSortState(col, row);
52767
+ const sortState = this.table.getPivotSortState(col, row);
52768
+ const order = sortState ? sortState.toUpperCase() : 'DESC';
52769
+ const new_order = order === 'ASC' ? 'DESC' : 'ASC';
52770
+ this.table.sort(col, row, new_order);
52717
52771
  this.table.fireListeners(PIVOT_TABLE_EVENT_TYPE.PIVOT_SORT_CLICK, {
52718
52772
  col: col,
52719
52773
  row: row,
@@ -52969,6 +53023,9 @@
52969
53023
  }
52970
53024
 
52971
53025
  function bindSparklineHoverEvent(table) {
53026
+ if (table.eventManager.bindSparklineHoverEvent) {
53027
+ return;
53028
+ }
52972
53029
  let hasSparkLine = false;
52973
53030
  if (table.isPivotTable()) {
52974
53031
  const layoutMap = table.internalProps.layoutMap;
@@ -52985,6 +53042,7 @@
52985
53042
  if (!hasSparkLine) {
52986
53043
  return;
52987
53044
  }
53045
+ table.eventManager.bindSparklineHoverEvent = true;
52988
53046
  table.on(TABLE_EVENT_TYPE.MOUSEMOVE_CELL, (e) => {
52989
53047
  const { col, row, x, y } = e;
52990
53048
  const type = table.getBodyColumnType(col, row);
@@ -53259,7 +53317,9 @@
53259
53317
  table.editorManager?.completeEdit(e.nativeEvent);
53260
53318
  const hitIcon = eventArgsSet?.eventArgs?.target?.role?.startsWith('icon')
53261
53319
  ? eventArgsSet.eventArgs.target
53262
- : undefined;
53320
+ : e.target.role?.startsWith('icon')
53321
+ ? e.target
53322
+ : undefined;
53263
53323
  eventManager.downIcon = hitIcon;
53264
53324
  if (!hitIcon || hitIcon.attribute.interactive === false) {
53265
53325
  if (e.pointerType === 'touch') {
@@ -53479,7 +53539,11 @@
53479
53539
  stateManager.hideMenu();
53480
53540
  }
53481
53541
  table.editorManager?.completeEdit(e.nativeEvent);
53482
- if (!eventManager.checkCellFillhandle(eventArgsSet) && eventManager.checkColumnResize(eventArgsSet, true)) {
53542
+ const hitIcon = e.target.role?.startsWith('icon') ? e.target : undefined;
53543
+ eventManager.downIcon = hitIcon;
53544
+ if (!hitIcon &&
53545
+ !eventManager.checkCellFillhandle(eventArgsSet) &&
53546
+ eventManager.checkColumnResize(eventArgsSet, true)) {
53483
53547
  table.scenegraph.updateChartState(null);
53484
53548
  stateManager.updateInteractionState(InteractionState.grabing);
53485
53549
  const { eventArgs } = eventArgsSet;
@@ -54035,22 +54099,62 @@
54035
54099
  let targetCol;
54036
54100
  let targetRow;
54037
54101
  if (e.key === 'ArrowUp') {
54038
- targetCol = stateManager.select.cellPos.col;
54039
- targetRow = Math.min(table.rowCount - 1, Math.max(0, stateManager.select.cellPos.row - 1));
54102
+ if (e.ctrlKey || e.metaKey) {
54103
+ targetCol = stateManager.select.cellPos.col;
54104
+ targetRow = 0;
54105
+ }
54106
+ else if (e.shiftKey) {
54107
+ targetCol = stateManager.select.cellPos.col;
54108
+ targetRow = Math.min(table.rowCount - 1, Math.max(0, stateManager.select.cellPos.row - 1));
54109
+ }
54110
+ else {
54111
+ targetCol = stateManager.select.cellPos.col;
54112
+ targetRow = Math.min(table.rowCount - 1, Math.max(0, stateManager.select.cellPos.row - 1));
54113
+ }
54040
54114
  }
54041
54115
  else if (e.key === 'ArrowDown') {
54042
- targetCol = stateManager.select.cellPos.col;
54043
- targetRow = Math.min(table.rowCount - 1, Math.max(0, stateManager.select.cellPos.row + 1));
54116
+ if (e.ctrlKey || e.metaKey) {
54117
+ targetCol = stateManager.select.cellPos.col;
54118
+ targetRow = table.rowCount - 1;
54119
+ }
54120
+ else if (e.shiftKey) {
54121
+ targetCol = stateManager.select.cellPos.col;
54122
+ targetRow = Math.min(table.rowCount - 1, Math.max(0, stateManager.select.cellPos.row + 1));
54123
+ }
54124
+ else {
54125
+ targetCol = stateManager.select.cellPos.col;
54126
+ targetRow = Math.min(table.rowCount - 1, Math.max(0, stateManager.select.cellPos.row + 1));
54127
+ }
54044
54128
  }
54045
54129
  else if (e.key === 'ArrowLeft') {
54046
- targetRow = stateManager.select.cellPos.row;
54047
- targetCol = Math.min(table.colCount - 1, Math.max(0, stateManager.select.cellPos.col - 1));
54130
+ if (e.ctrlKey || e.metaKey) {
54131
+ targetCol = 0;
54132
+ targetRow = stateManager.select.cellPos.row;
54133
+ }
54134
+ else if (e.shiftKey) {
54135
+ targetRow = stateManager.select.cellPos.row;
54136
+ targetCol = Math.min(table.colCount - 1, Math.max(0, stateManager.select.cellPos.col - 1));
54137
+ }
54138
+ else {
54139
+ targetRow = stateManager.select.cellPos.row;
54140
+ targetCol = Math.min(table.colCount - 1, Math.max(0, stateManager.select.cellPos.col - 1));
54141
+ }
54048
54142
  }
54049
54143
  else if (e.key === 'ArrowRight') {
54050
- targetRow = stateManager.select.cellPos.row;
54051
- targetCol = Math.min(table.colCount - 1, Math.max(0, stateManager.select.cellPos.col + 1));
54144
+ if (e.ctrlKey || e.metaKey) {
54145
+ targetCol = table.colCount - 1;
54146
+ targetRow = stateManager.select.cellPos.row;
54147
+ }
54148
+ else if (e.shiftKey) {
54149
+ targetRow = stateManager.select.cellPos.row;
54150
+ targetCol = Math.min(table.colCount - 1, Math.max(0, stateManager.select.cellPos.col + 1));
54151
+ }
54152
+ else {
54153
+ targetRow = stateManager.select.cellPos.row;
54154
+ targetCol = Math.min(table.colCount - 1, Math.max(0, stateManager.select.cellPos.col + 1));
54155
+ }
54052
54156
  }
54053
- table.selectCell(targetCol, targetRow);
54157
+ table.selectCell(targetCol, targetRow, e.shiftKey);
54054
54158
  if ((table.options.keyboardOptions?.moveEditCellOnArrowKeys ?? false) &&
54055
54159
  table.editorManager.editingEditor) {
54056
54160
  table.editorManager.completeEdit();
@@ -54786,6 +54890,7 @@
54786
54890
  downIcon;
54787
54891
  globalEventListeners = [];
54788
54892
  inertiaScroll;
54893
+ bindSparklineHoverEvent;
54789
54894
  constructor(table) {
54790
54895
  this.table = table;
54791
54896
  this.handleTextStickBindId = [];
@@ -54824,6 +54929,7 @@
54824
54929
  });
54825
54930
  this.handleTextStickBindId = [];
54826
54931
  }
54932
+ bindSparklineHoverEvent(this.table);
54827
54933
  }, 0);
54828
54934
  }
54829
54935
  bindSelfEvent() {
@@ -56072,10 +56178,19 @@
56072
56178
  getIcons(col, row) {
56073
56179
  const icons = [];
56074
56180
  if (this._table.isPivotTable()) {
56075
- const { showSort } = this._table.internalProps.layoutMap.getHeader(col, row);
56181
+ const { showSort, sort } = this._table.internalProps.layoutMap.getHeader(col, row);
56076
56182
  if (showSort) {
56077
- const order = this._table.getPivotSortState(col, row);
56078
- const sortIcon = order === 'asc' ? this.downIcon : order === 'desc' ? this.upIcon : this.normalIcon;
56183
+ let order = this._table.getPivotSortState(col, row);
56184
+ if (order) {
56185
+ order = order.toUpperCase();
56186
+ }
56187
+ const sortIcon = order === 'ASC' ? this.downIcon : order === 'DESC' ? this.upIcon : this.normalIcon;
56188
+ if (sortIcon) {
56189
+ icons.push(sortIcon);
56190
+ }
56191
+ }
56192
+ else if (sort) {
56193
+ const sortIcon = this.getSortIconForPivotTable(this._table.getPivotSortState(col, row), this._table, col, row);
56079
56194
  if (sortIcon) {
56080
56195
  icons.push(sortIcon);
56081
56196
  }
@@ -56198,6 +56313,17 @@
56198
56313
  }
56199
56314
  return icon;
56200
56315
  }
56316
+ getSortIconForPivotTable(order, _table, col, row) {
56317
+ const headerC = _table.getHeaderDefine(col, row);
56318
+ if (!headerC ||
56319
+ headerC.showSort === false ||
56320
+ (!isValid$1(headerC.showSort) && !headerC.sort) ||
56321
+ (headerC.columns && headerC.columns.length > 0)) {
56322
+ return null;
56323
+ }
56324
+ const icon = order === 'ASC' ? this.downIcon : order === 'DESC' ? this.upIcon : this.normalIcon;
56325
+ return icon;
56326
+ }
56201
56327
  getDropDownStateIcons(_table, col, row) {
56202
56328
  const headerC = _table.getHeaderDefine(col, row);
56203
56329
  const headerL = _table._getHeaderLayoutMap(col, row);
@@ -56449,30 +56575,12 @@
56449
56575
  white-space: pre-wrap;
56450
56576
  margin: 0;
56451
56577
  box-sizing: border-box;
56452
- overflow: auto;
56578
+ overflow: hidden;
56453
56579
  word-wrap: break-word;
56454
56580
  position: relative;
56455
56581
  background-color: #FFF;
56456
56582
  z-index: 2;
56457
- border-radius: 4px;
56458
- }
56459
- /* WebKit Microsoft Edge(新版): */
56460
- .vtable__bubble-tooltip-element__content::-webkit-scrollbar {
56461
- width: 0;
56462
- height: 0;
56463
- background-color: transparent;
56464
- }
56465
- /* Opera Firefox */
56466
- .vtable__bubble-tooltip-element__content > scrollbar-track {
56467
- width: 0;
56468
- height: 0;
56469
- background-color: transparent;
56470
- }
56471
- /* Internet Explorer 11 和 Microsoft Edge(旧版) */
56472
- .vtable__bubble-tooltip-element__content > scrollbar {
56473
- width: 0;
56474
- height: 0;
56475
- background-color: transparent;
56583
+ border-radius: 4px
56476
56584
  }
56477
56585
  .vtable__bubble-tooltip-element__triangle {
56478
56586
  /* font-size: .75rem; */
@@ -56506,7 +56614,7 @@
56506
56614
  constructor() {
56507
56615
  this._handler = new EventHandler();
56508
56616
  const rootElement = (this._rootElement = createElement('div', [TOOLTIP_CLASS, HIDDEN_CLASS]));
56509
- const messageElement = createElement('div', [CONTENT_CLASS]);
56617
+ const messageElement = createElement('span', [CONTENT_CLASS]);
56510
56618
  const triangle = createElement('span', [TRIANGLE_CLASS]);
56511
56619
  rootElement.appendChild(triangle);
56512
56620
  rootElement.appendChild(messageElement);
@@ -56519,9 +56627,6 @@
56519
56627
  this._disappearDelay = undefined;
56520
56628
  this.unbindFromCell();
56521
56629
  });
56522
- messageElement.addEventListener('wheel', e => {
56523
- e.stopPropagation();
56524
- });
56525
56630
  }
56526
56631
  bindToCell(table, col, row, tooltipInstanceInfo, confine) {
56527
56632
  this._disappearDelay = tooltipInstanceInfo?.disappearDelay;
@@ -56546,10 +56651,6 @@
56546
56651
  tooltipInstanceInfo?.style?.color && (messageElement.style.color = tooltipInstanceInfo?.style?.color);
56547
56652
  tooltipInstanceInfo?.style?.padding &&
56548
56653
  (messageElement.style.padding = `${tooltipInstanceInfo?.style?.padding.join('px ')}px`);
56549
- tooltipInstanceInfo?.style?.maxHeight &&
56550
- (messageElement.style.maxHeight = `${tooltipInstanceInfo?.style?.maxHeight}px`);
56551
- tooltipInstanceInfo?.style?.maxWidth &&
56552
- (messageElement.style.maxWidth = `${tooltipInstanceInfo?.style?.maxWidth}px`);
56553
56654
  messageElement && (messageElement.textContent = tooltipInstanceInfo?.content);
56554
56655
  const binded = this._bindToCell(table, col, row, tooltipInstanceInfo?.position, tooltipInstanceInfo?.referencePosition, confine, tooltipInstanceInfo?.style?.arrowMark);
56555
56656
  if (binded) {
@@ -56928,7 +57029,7 @@
56928
57029
  rect
56929
57030
  },
56930
57031
  disappearDelay: table.internalProps.tooltip.overflowTextTooltipDisappearDelay ?? 0,
56931
- style: table.theme.tooltipStyle
57032
+ style: { arrowMark: false }
56932
57033
  };
56933
57034
  }
56934
57035
  else if (table.internalProps.tooltip?.isShowOverflowTextTooltip) {
@@ -58675,7 +58776,7 @@
58675
58776
  : Object.assign({}, (indicatorInfo ?? dimensionInfo)?.headerStyle),
58676
58777
  headerType: indicatorInfo?.headerType ?? dimensionInfo?.headerType ?? 'text',
58677
58778
  headerIcon: indicatorInfo?.headerIcon ?? dimensionInfo?.headerIcon,
58678
- define: Object.assign({}, hd, indicatorInfo ?? dimensionInfo),
58779
+ define: Object.assign({}, hd, indicatorInfo ?? Object.assign({}, dimensionInfo, { sort: undefined })),
58679
58780
  fieldFormat: indicatorInfo?.headerFormat ?? dimensionInfo?.headerFormat,
58680
58781
  dropDownMenu: indicatorInfo?.dropDownMenu ?? dimensionInfo?.dropDownMenu,
58681
58782
  pivotInfo: {
@@ -58687,6 +58788,7 @@
58687
58788
  minWidth: dimensionInfo?.minWidth,
58688
58789
  maxWidth: dimensionInfo?.maxWidth,
58689
58790
  showSort: indicatorInfo?.showSort ?? dimensionInfo?.showSort,
58791
+ sort: indicatorInfo?.sort,
58690
58792
  description: dimensionInfo?.description
58691
58793
  };
58692
58794
  if (indicatorInfo) {
@@ -59103,7 +59205,7 @@
59103
59205
  return TABLE_EVENT_TYPE;
59104
59206
  }
59105
59207
  options;
59106
- version = "1.2.1-alpha.1";
59208
+ version = "1.3.0";
59107
59209
  pagination;
59108
59210
  id = `VTable${Date.now()}`;
59109
59211
  headerStyleCache;
@@ -60715,8 +60817,8 @@
60715
60817
  clearSelected() {
60716
60818
  this.stateManager.updateSelectPos(-1, -1);
60717
60819
  }
60718
- selectCell(col, row) {
60719
- this.stateManager.updateSelectPos(col, row);
60820
+ selectCell(col, row, isShift, isCtrl) {
60821
+ this.stateManager.updateSelectPos(col, row, isShift, isCtrl);
60720
60822
  this.stateManager.endSelectCells();
60721
60823
  }
60722
60824
  selectCells(cellRanges) {
@@ -61028,8 +61130,11 @@
61028
61130
  let cacheKey;
61029
61131
  if (this.isPivotTable() && !this.isBottomFrozenRow(row) && !this.isRightFrozenColumn(col)) {
61030
61132
  const define = this.getHeaderDefine(col, row);
61133
+ const isCorner = this.isCornerHeader(col, row);
61031
61134
  cacheKey = define?.dimensionKey
61032
- ? `dim-${define.dimensionKey}`
61135
+ ? isCorner
61136
+ ? `dim-cor-${define.dimensionKey}`
61137
+ : `dim-${define.dimensionKey}`
61033
61138
  : define?.indicatorKey
61034
61139
  ? `ind-${define.indicatorKey}`
61035
61140
  : `${col}-${row}`;
@@ -61343,6 +61448,9 @@
61343
61448
  ? getProp('bgColor', actStyle, col, row, this)
61344
61449
  : theme.group.fill,
61345
61450
  color: isBoolean$2(theme.text.fill) ? getProp('color', actStyle, col, row, this) : theme.text.fill,
61451
+ strokeColor: isBoolean$2(theme.text.stroke)
61452
+ ? getProp('strokeColor', actStyle, col, row, this)
61453
+ : theme.text.stroke,
61346
61454
  fontFamily: theme.text.fontFamily,
61347
61455
  fontSize: theme.text.fontSize,
61348
61456
  fontWeight: theme.text.fontWeight,
@@ -63803,7 +63911,9 @@
63803
63911
  subtextStyle: {
63804
63912
  width: realWidth,
63805
63913
  ...this._titleOption.subtextStyle
63806
- }
63914
+ },
63915
+ dx: this._titleOption.dx ?? 0,
63916
+ dy: this._titleOption.dy ?? 0
63807
63917
  };
63808
63918
  }
63809
63919
  }
@@ -64694,7 +64804,7 @@
64694
64804
  const cellType = this.getCellType(col, row);
64695
64805
  if (isValid$1(field) && cellType === 'checkbox') {
64696
64806
  const dataIndex = this.dataSource.getIndexKey(this.getRecordShowIndexByCell(col, row));
64697
- return this.stateManager.checkedState[dataIndex][field];
64807
+ return this.stateManager.checkedState[dataIndex]?.[field];
64698
64808
  }
64699
64809
  return undefined;
64700
64810
  }
@@ -65793,11 +65903,15 @@
65793
65903
  : dimensionKey === 'axis'
65794
65904
  ? ''
65795
65905
  : dimensionKey,
65796
- field: '维度名称',
65906
+ field: dimensionKey,
65797
65907
  style: this.cornerSetting.headerStyle,
65798
65908
  headerType: this.cornerSetting.headerType ?? 'text',
65909
+ showSort: dimensionInfo?.showSortInCorner,
65910
+ sort: dimensionInfo?.sort,
65799
65911
  define: {
65800
- dimensionKey: '维度名称',
65912
+ showSort: dimensionInfo?.showSortInCorner,
65913
+ sort: dimensionInfo?.sort,
65914
+ dimensionKey: dimensionKey,
65801
65915
  id,
65802
65916
  value: dimensionKey,
65803
65917
  disableHeaderHover: !!this.cornerSetting.disableHeaderHover,
@@ -67081,6 +67195,7 @@
67081
67195
  getCellAdressByHeaderPath(dimensionPaths) {
67082
67196
  let colHeaderPaths;
67083
67197
  let rowHeaderPaths;
67198
+ let isCornerCell = false;
67084
67199
  let forceBody = false;
67085
67200
  if (Array.isArray(dimensionPaths)) {
67086
67201
  if (dimensionPaths.length > this.rowDimensionKeys.length + this.colDimensionKeys.length) {
@@ -67109,6 +67224,32 @@
67109
67224
  return (this.fullRowDimensionKeys.indexOf(a.dimensionKey ?? this.indicatorDimensionKey) -
67110
67225
  this.fullRowDimensionKeys.indexOf(b.dimensionKey ?? this.indicatorDimensionKey));
67111
67226
  });
67227
+ colHeaderPaths?.forEach(a => {
67228
+ if (a.isPivotCorner) {
67229
+ isCornerCell = true;
67230
+ }
67231
+ });
67232
+ rowHeaderPaths?.forEach(a => {
67233
+ if (a.isPivotCorner) {
67234
+ isCornerCell = true;
67235
+ }
67236
+ });
67237
+ if (isCornerCell) {
67238
+ if (this.cornerSetting.titleOnDimension === 'row') {
67239
+ for (let i = 0; i < this.rowDimensionKeys.length; i++) {
67240
+ if (rowHeaderPaths[0].dimensionKey === this.rowDimensionKeys[i]) {
67241
+ return { col: i + this.leftRowSeriesNumberColumnCount, row: 0 };
67242
+ }
67243
+ }
67244
+ }
67245
+ else {
67246
+ for (let i = 0; i < this.colDimensionKeys.length; i++) {
67247
+ if (colHeaderPaths[0].dimensionKey === this.colDimensionKeys[i]) {
67248
+ return { col: 0, row: i };
67249
+ }
67250
+ }
67251
+ }
67252
+ }
67112
67253
  let needLowestLevel = false;
67113
67254
  if (colHeaderPaths?.length >= 1 && rowHeaderPaths?.length >= 1) {
67114
67255
  needLowestLevel = true;
@@ -67209,7 +67350,7 @@
67209
67350
  }
67210
67351
  }
67211
67352
  if (colDimensionFinded || forceBody) {
67212
- col = this.rowHeaderLevelCount;
67353
+ col = this.rowHeaderLevelCount + this.leftRowSeriesNumberColumnCount;
67213
67354
  const { startInTotal, level } = colDimensionFinded ?? defaultDimension;
67214
67355
  col += startInTotal ?? 0;
67215
67356
  defaultRow = this.columnHeaderTitle ? level + 1 : level;
@@ -67728,7 +67869,9 @@
67728
67869
  return totalCount;
67729
67870
  }
67730
67871
  resetHeaderTree() {
67872
+ this.colIndex = 0;
67731
67873
  this._rowHeaderCellFullPathIds_FULL = [];
67874
+ this._columnHeaderCellFullPathIds = [];
67732
67875
  this._columnHeaderCellIds = [];
67733
67876
  const dataset = this.dataset;
67734
67877
  this.rowTree = dataset.rowHeaderTree;
@@ -67744,6 +67887,8 @@
67744
67887
  o[e.id] = e;
67745
67888
  return o;
67746
67889
  }, {});
67890
+ this._CellHeaderPathMap = new Map();
67891
+ this._largeCellRangeCache.length = 0;
67747
67892
  this.generateCellIdsConsiderHideHeader();
67748
67893
  this.setPagination(this.pagination);
67749
67894
  }
@@ -69348,9 +69493,10 @@
69348
69493
  }
69349
69494
  this.internalProps.layoutMap = new PivotHeaderLayoutMap(this, this.dataset, columnDimensionTree, rowDimensionTree);
69350
69495
  }
69351
- this.pivotSortState = [];
69352
- if (options.pivotSortState) {
69353
- this.updatePivotSortState(options.pivotSortState);
69496
+ this._changePivotSortStateBySortRules();
69497
+ if ((options.pivotSortState?.length ?? 0) > 0) {
69498
+ this.pivotSortState = [];
69499
+ this.pivotSortState = options.pivotSortState;
69354
69500
  }
69355
69501
  if (Env.mode !== 'node') {
69356
69502
  this.editorManager = new EditManeger(this);
@@ -69485,9 +69631,10 @@
69485
69631
  }
69486
69632
  internalProps.layoutMap = new PivotHeaderLayoutMap(this, this.dataset, columnDimensionTree, rowDimensionTree);
69487
69633
  }
69488
- this.pivotSortState = [];
69489
- if (options.pivotSortState) {
69490
- this.updatePivotSortState(options.pivotSortState);
69634
+ this._changePivotSortStateBySortRules();
69635
+ if ((options.pivotSortState?.length ?? 0) > 0) {
69636
+ this.pivotSortState = [];
69637
+ this.pivotSortState = options.pivotSortState;
69491
69638
  }
69492
69639
  this.refreshHeader();
69493
69640
  if (internalProps.releaseList) {
@@ -69925,24 +70072,147 @@
69925
70072
  }
69926
70073
  }
69927
70074
  updateSortRules(sortRules) {
69928
- this.internalProps.dataConfig.sortRules = sortRules;
70075
+ if (this.internalProps.dataConfig) {
70076
+ this.internalProps.dataConfig.sortRules = sortRules;
70077
+ }
70078
+ else {
70079
+ this.internalProps.dataConfig = { sortRules };
70080
+ }
69929
70081
  this.dataset.updateSortRules(sortRules);
70082
+ this._changePivotSortStateBySortRules();
69930
70083
  this.internalProps.layoutMap.resetHeaderTree();
69931
70084
  this.scenegraph.clearCells();
69932
70085
  this.refreshHeader();
69933
70086
  this.scenegraph.createSceneGraph();
69934
70087
  this.render();
69935
70088
  }
69936
- updatePivotSortState(pivotSortStateConfig) {
69937
- for (let i = 0; i < pivotSortStateConfig.length; i++) {
69938
- const { dimensions, order } = pivotSortStateConfig[i];
69939
- const cellAddress = this.internalProps.layoutMap.getPivotCellAdress(dimensions);
69940
- cellAddress &&
70089
+ _changePivotSortStateBySortRules() {
70090
+ this.pivotSortState = [];
70091
+ const sortRules = this.internalProps.dataConfig?.sortRules ?? [];
70092
+ for (let i = 0; i < sortRules.length; i++) {
70093
+ const sortRule = sortRules[i];
70094
+ if (sortRule.sortType) {
70095
+ const dimensions = [];
70096
+ if (sortRule.sortByIndicator) {
70097
+ if (sortRule.sortField ===
70098
+ (this.dataset.indicatorsAsCol
70099
+ ? this.dataset.rows[this.dataset.rows.length - 1]
70100
+ : this.dataset.columns[this.dataset.columns.length - 1])) {
70101
+ for (let j = 0; j < sortRule.query.length; j++) {
70102
+ dimensions.push({
70103
+ dimensionKey: this.dataset.indicatorsAsCol ? this.dataset.columns[j] : this.dataset.rows[j],
70104
+ value: sortRule.query[j]
70105
+ });
70106
+ }
70107
+ dimensions.push({
70108
+ indicatorKey: sortRule.sortByIndicator,
70109
+ value: this.internalProps.layoutMap.getIndicatorInfo(sortRule.sortByIndicator)
70110
+ ?.title ?? sortRule.sortByIndicator
70111
+ });
70112
+ }
70113
+ }
70114
+ else {
70115
+ dimensions.push({
70116
+ dimensionKey: sortRule.sortField,
70117
+ isPivotCorner: true,
70118
+ value: sortRule.sortField
70119
+ });
70120
+ }
69941
70121
  this.pivotSortState.push({
69942
- col: cellAddress.col,
69943
- row: cellAddress.row,
69944
- order
70122
+ dimensions,
70123
+ order: sortRule.sortType
69945
70124
  });
70125
+ }
70126
+ }
70127
+ }
70128
+ updatePivotSortState(pivotSortStateConfig) {
70129
+ this.pivotSortState = pivotSortStateConfig;
70130
+ }
70131
+ sort(col, row, order) {
70132
+ let dimensions;
70133
+ if (this.isCornerHeader(col, row)) {
70134
+ const dimensionInfo = this.getHeaderDefine(col, row);
70135
+ dimensions = [];
70136
+ const dimension = {
70137
+ isPivotCorner: true,
70138
+ dimensionKey: dimensionInfo.value,
70139
+ value: dimensionInfo.value
70140
+ };
70141
+ dimensions.push(dimension);
70142
+ }
70143
+ else if (this.isColumnHeader(col, row)) {
70144
+ dimensions = this.getCellHeaderPaths(col, row).colHeaderPaths;
70145
+ }
70146
+ else {
70147
+ dimensions = this.getCellHeaderPaths(col, row).rowHeaderPaths;
70148
+ }
70149
+ const sortIndicator = dimensions[dimensions.length - 1].indicatorKey;
70150
+ const headerDefine = this.getHeaderDefine(col, row);
70151
+ if (headerDefine.sort) {
70152
+ if (this.dataset.sortRules) {
70153
+ for (let i = this.dataset.sortRules.length - 1; i >= 0; i--) {
70154
+ const sortRule = this.dataset.sortRules[i];
70155
+ if (headerDefine.dimensionKey && sortRule.sortField === headerDefine.dimensionKey) {
70156
+ this.dataset.sortRules.splice(i, 1);
70157
+ }
70158
+ else if (sortIndicator &&
70159
+ sortRule.sortField ===
70160
+ (this.dataset.indicatorsAsCol
70161
+ ? this.dataset.rows[this.dataset.rows.length - 1]
70162
+ : this.dataset.columns[this.dataset.columns.length - 1])) {
70163
+ this.dataset.sortRules.splice(i, 1);
70164
+ }
70165
+ }
70166
+ if (sortIndicator) {
70167
+ this.dataset.sortRules.push({
70168
+ sortField: this.dataset.indicatorsAsCol
70169
+ ? this.dataset.rows[this.dataset.rows.length - 1]
70170
+ : this.dataset.columns[this.dataset.columns.length - 1],
70171
+ sortType: SortType[order],
70172
+ sortByIndicator: sortIndicator,
70173
+ query: dimensions.reduce((arr, dimension) => {
70174
+ if (dimension.dimensionKey) {
70175
+ arr.push(dimension.value);
70176
+ }
70177
+ return arr;
70178
+ }, [])
70179
+ });
70180
+ }
70181
+ else {
70182
+ this.dataset.sortRules.push({
70183
+ sortField: headerDefine.dimensionKey,
70184
+ sortType: SortType[order]
70185
+ });
70186
+ }
70187
+ }
70188
+ else {
70189
+ if (sortIndicator) {
70190
+ this.dataset.sortRules = [
70191
+ {
70192
+ sortField: this.dataset.indicatorsAsCol
70193
+ ? this.dataset.rows[this.dataset.rows.length - 1]
70194
+ : this.dataset.columns[this.dataset.columns.length - 1],
70195
+ sortType: SortType[order],
70196
+ sortByIndicator: sortIndicator,
70197
+ query: dimensions.reduce((arr, dimension) => {
70198
+ if (dimension.dimensionKey) {
70199
+ arr.push(dimension.value);
70200
+ }
70201
+ return arr;
70202
+ }, [])
70203
+ }
70204
+ ];
70205
+ }
70206
+ else {
70207
+ this.dataset.sortRules = [
70208
+ {
70209
+ sortField: headerDefine.dimensionKey,
70210
+ sortType: SortType[order]
70211
+ }
70212
+ ];
70213
+ }
70214
+ }
70215
+ this.updateSortRules(this.dataset.sortRules);
69946
70216
  }
69947
70217
  }
69948
70218
  getPivotSortState(col, row) {
@@ -69951,8 +70221,11 @@
69951
70221
  }
69952
70222
  const cellRange = this.getCellRange(col, row);
69953
70223
  for (let i = 0; i < this.pivotSortState.length; i++) {
69954
- const { col: sortCol, row: sortRow, order } = this.pivotSortState[i];
69955
- if (cellInRange(cellRange, sortCol, sortRow)) {
70224
+ const pivotState = this.pivotSortState[i];
70225
+ const dimensions = pivotState.dimensions;
70226
+ const cell = this.getCellAddressByHeaderPaths(dimensions);
70227
+ const order = pivotState.order;
70228
+ if (cell && cellInRange(cellRange, cell.col, cell.row)) {
69956
70229
  return order;
69957
70230
  }
69958
70231
  }
@@ -70141,7 +70414,7 @@
70141
70414
  internalProps.layoutMap = new PivotHeaderLayoutMap(this, this.dataset, columnDimensionTree, rowDimensionTree);
70142
70415
  this.pivotSortState = [];
70143
70416
  if (options.pivotSortState) {
70144
- this.updatePivotSortState(options.pivotSortState);
70417
+ this.pivotSortState = options.pivotSortState;
70145
70418
  }
70146
70419
  }
70147
70420
  this.refreshHeader();
@@ -70955,7 +71228,12 @@
70955
71228
  return this.getCellOriginRecord(col, row);
70956
71229
  }
70957
71230
  updateSortRules(sortRules) {
70958
- this.internalProps.dataConfig.sortRules = sortRules;
71231
+ if (this.internalProps.dataConfig) {
71232
+ this.internalProps.dataConfig.sortRules = sortRules;
71233
+ }
71234
+ else {
71235
+ this.internalProps.dataConfig = { sortRules };
71236
+ }
70959
71237
  this.dataset.updateSortRules(sortRules);
70960
71238
  this.internalProps.layoutMap.resetHeaderTree();
70961
71239
  this.scenegraph.clearCells();
@@ -70963,18 +71241,6 @@
70963
71241
  this.scenegraph.createSceneGraph();
70964
71242
  this.render();
70965
71243
  }
70966
- updatePivotSortState(pivotSortStateConfig) {
70967
- for (let i = 0; i < pivotSortStateConfig.length; i++) {
70968
- const { dimensions, order } = pivotSortStateConfig[i];
70969
- const cellAddress = this.internalProps.layoutMap.getPivotCellAdress(dimensions);
70970
- cellAddress &&
70971
- this.pivotSortState.push({
70972
- col: cellAddress.col,
70973
- row: cellAddress.row,
70974
- order
70975
- });
70976
- }
70977
- }
70978
71244
  getPivotSortState(col, row) {
70979
71245
  if (!this.pivotSortState) {
70980
71246
  return undefined;
@@ -71015,27 +71281,6 @@
71015
71281
  return null;
71016
71282
  }
71017
71283
  toggleHierarchyState(col, row) {
71018
- const hierarchyState = this.getHierarchyState(col, row);
71019
- if (hierarchyState === HierarchyState.expand) {
71020
- this.fireListeners(PIVOT_CHART_EVENT_TYPE.TREE_HIERARCHY_STATE_CHANGE, {
71021
- col: col,
71022
- row: row,
71023
- hierarchyState: HierarchyState.collapse
71024
- });
71025
- }
71026
- else if (hierarchyState === HierarchyState.collapse) {
71027
- this.fireListeners(PIVOT_CHART_EVENT_TYPE.TREE_HIERARCHY_STATE_CHANGE, {
71028
- col: col,
71029
- row: row,
71030
- hierarchyState: HierarchyState.expand,
71031
- originData: this.getCellOriginRecord(col, row)
71032
- });
71033
- }
71034
- const result = this.internalProps.layoutMap.toggleHierarchyState(col, row);
71035
- this.refreshRowColCount();
71036
- this.clearCellStyleCache();
71037
- this.scenegraph.updateHierarchyIcon(col, row);
71038
- this.scenegraph.updateRow(result.removeCellPositions, result.addCellPositions);
71039
71284
  }
71040
71285
  getHeaderCellAddressByPath(dimensionPaths) {
71041
71286
  const cellAddress = this.internalProps.layoutMap.getPivotCellAdress(dimensionPaths);
@@ -72085,7 +72330,7 @@
72085
72330
  }
72086
72331
 
72087
72332
  registerForVrender();
72088
- const version = "1.2.1-alpha.1";
72333
+ const version = "1.3.0";
72089
72334
  function getIcons() {
72090
72335
  return get$2();
72091
72336
  }