@visactor/vtable 0.10.2 → 0.10.3-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/cjs/PivotChart.js +26 -25
  2. package/cjs/PivotChart.js.map +1 -1
  3. package/cjs/PivotTable.js +8 -8
  4. package/cjs/PivotTable.js.map +1 -1
  5. package/cjs/components/axis/linear-scale.js.map +1 -1
  6. package/cjs/components/title/title.js +2 -1
  7. package/cjs/components/title/title.js.map +1 -1
  8. package/cjs/core/BaseTable.js +4 -4
  9. package/cjs/core/BaseTable.js.map +1 -1
  10. package/cjs/dataset/dataset-pivot-table.js.map +1 -1
  11. package/cjs/dataset/dataset.js +4 -5
  12. package/cjs/dataset/dataset.js.map +1 -1
  13. package/cjs/dataset/flatDataToObject.js +2 -1
  14. package/cjs/dataset/flatDataToObject.js.map +1 -1
  15. package/cjs/header-helper/header-helper.js +1 -0
  16. package/cjs/header-helper/header-helper.js.map +1 -1
  17. package/cjs/index.d.ts +1 -1
  18. package/cjs/index.js +1 -1
  19. package/cjs/index.js.map +1 -1
  20. package/cjs/layout/chart-helper/get-axis-config.d.ts +4 -1
  21. package/cjs/layout/chart-helper/get-axis-config.js +30 -20
  22. package/cjs/layout/chart-helper/get-axis-config.js.map +1 -1
  23. package/cjs/layout/chart-helper/get-chart-spec.js +11 -11
  24. package/cjs/layout/chart-helper/get-chart-spec.js.map +1 -1
  25. package/cjs/layout/pivot-header-layout.js +21 -19
  26. package/cjs/layout/pivot-header-layout.js.map +1 -1
  27. package/cjs/layout/pivot-layout.js +9 -7
  28. package/cjs/layout/pivot-layout.js.map +1 -1
  29. package/cjs/scenegraph/layout/frozen.js +18 -4
  30. package/cjs/scenegraph/layout/frozen.js.map +1 -1
  31. package/cjs/state/spark-line/index.js +3 -2
  32. package/cjs/state/spark-line/index.js.map +1 -1
  33. package/dist/vtable.js +203 -98
  34. package/dist/vtable.min.js +2 -2
  35. package/es/PivotChart.js +26 -25
  36. package/es/PivotChart.js.map +1 -1
  37. package/es/PivotTable.js +8 -8
  38. package/es/PivotTable.js.map +1 -1
  39. package/es/components/axis/linear-scale.js.map +1 -1
  40. package/es/components/title/title.js +2 -1
  41. package/es/components/title/title.js.map +1 -1
  42. package/es/core/BaseTable.js +4 -4
  43. package/es/core/BaseTable.js.map +1 -1
  44. package/es/dataset/dataset-pivot-table.js.map +1 -1
  45. package/es/dataset/dataset.js +4 -4
  46. package/es/dataset/dataset.js.map +1 -1
  47. package/es/dataset/flatDataToObject.js +2 -1
  48. package/es/dataset/flatDataToObject.js.map +1 -1
  49. package/es/header-helper/header-helper.js +1 -0
  50. package/es/header-helper/header-helper.js.map +1 -1
  51. package/es/index.d.ts +1 -1
  52. package/es/index.js +1 -1
  53. package/es/index.js.map +1 -1
  54. package/es/layout/chart-helper/get-axis-config.d.ts +4 -1
  55. package/es/layout/chart-helper/get-axis-config.js +30 -20
  56. package/es/layout/chart-helper/get-axis-config.js.map +1 -1
  57. package/es/layout/chart-helper/get-chart-spec.js +11 -11
  58. package/es/layout/chart-helper/get-chart-spec.js.map +1 -1
  59. package/es/layout/pivot-header-layout.js +21 -19
  60. package/es/layout/pivot-header-layout.js.map +1 -1
  61. package/es/layout/pivot-layout.js +9 -7
  62. package/es/layout/pivot-layout.js.map +1 -1
  63. package/es/scenegraph/layout/frozen.js +18 -4
  64. package/es/scenegraph/layout/frozen.js.map +1 -1
  65. package/es/state/spark-line/index.js +3 -2
  66. package/es/state/spark-line/index.js.map +1 -1
  67. package/package.json +3 -3
package/dist/vtable.js CHANGED
@@ -40107,10 +40107,10 @@
40107
40107
  parse(data, options) {
40108
40108
  let emit = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;
40109
40109
  var _a;
40110
- this.isRunning = !0, emit && this.target.emit("beforeParse", []);
40110
+ this.isRunning = !0, emit && this.target.emit("beforeParse", []), options && (this.parseOption = options);
40111
40111
  const cloneData = this.cloneParseData(data, options);
40112
40112
  if (null == options ? void 0 : options.type) {
40113
- this.parseOption = options, options = cloneDeep(options);
40113
+ options = cloneDeep(options);
40114
40114
  const parserData = (null !== (_a = this.dataSet.getParser(options.type)) && void 0 !== _a ? _a : this.dataSet.getParser("bytejson"))(cloneData, options.options, this);
40115
40115
  this.rawData = cloneData, this.parserData = parserData, this.history && this.historyData.push(cloneData, parserData), this.latestData = parserData;
40116
40116
  } else this.parserData = cloneData, this.rawData = cloneData, this.history && this.historyData.push(cloneData), this.latestData = cloneData;
@@ -40835,6 +40835,7 @@
40835
40835
  else if (isNil(this.domain?.min) && isValid(this.domain?.max)) {
40836
40836
  this._scale.niceMin(tickCount);
40837
40837
  }
40838
+ else ;
40838
40839
  }
40839
40840
  }
40840
40841
  includeZero(domain) {
@@ -46880,10 +46881,22 @@
46880
46881
  const range = data
46881
46882
  ? data[layout.getColKeysPath()[index][Math.max(0, layout.columnHeaderLevelCount - 1 - layout.topAxesCount)]]
46882
46883
  : { max: 1, min: 0 };
46883
- const axisOption = getAxisOption(col, row, 'top', layout);
46884
+ const { axisOption, isPercent } = getAxisOption(col, row + 1, 'top', layout);
46885
+ if (range.min === range.max) {
46886
+ if (range.min > 0) {
46887
+ range.min = 0;
46888
+ }
46889
+ else {
46890
+ range.max = 0;
46891
+ }
46892
+ }
46884
46893
  if (axisOption?.visible === false) {
46885
46894
  return;
46886
46895
  }
46896
+ if (isPercent) {
46897
+ range.min = 0;
46898
+ range.max = 1;
46899
+ }
46887
46900
  if (isNumber$1(axisOption?.min)) {
46888
46901
  range.min = axisOption.min;
46889
46902
  }
@@ -46913,7 +46926,15 @@
46913
46926
  ? layout.dataset.collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]
46914
46927
  : layout.dataset.collectedValues[defaultKey];
46915
46928
  const index = layout.getRecordIndexByCol(col);
46916
- const range = data?.[layout.getColKeysPath()[index][Math.max(0, layout.columnHeaderLevelCount - 1 - layout.topAxesCount)]] ?? { min: 0, max: 1 };
46929
+ const range = data?.[layout.getColKeysPath()?.[index]?.[Math.max(0, layout.columnHeaderLevelCount - 1 - layout.topAxesCount)]] ?? { min: 0, max: 1 };
46930
+ if (range.min === range.max) {
46931
+ if (range.min > 0) {
46932
+ range.min = 0;
46933
+ }
46934
+ else {
46935
+ range.max = 0;
46936
+ }
46937
+ }
46917
46938
  let indicatorInfo = null;
46918
46939
  indicatorKeys.forEach(key => {
46919
46940
  const info = layout.getIndicatorInfo(key);
@@ -46921,10 +46942,14 @@
46921
46942
  indicatorInfo = info;
46922
46943
  }
46923
46944
  });
46924
- const axisOption = getAxisOption(col, row, 'bottom', layout);
46945
+ const { axisOption, isPercent } = getAxisOption(col, row - 1, 'bottom', layout);
46925
46946
  if (axisOption?.visible === false) {
46926
46947
  return;
46927
46948
  }
46949
+ if (isPercent) {
46950
+ range.min = 0;
46951
+ range.max = 1;
46952
+ }
46928
46953
  if (isNumber$1(axisOption?.min)) {
46929
46954
  range.min = axisOption.min;
46930
46955
  }
@@ -46948,7 +46973,7 @@
46948
46973
  else if (col === layout.rowHeaderLevelCount - 1 &&
46949
46974
  row >= layout.columnHeaderLevelCount &&
46950
46975
  row < layout.rowCount - layout.bottomFrozenRowCount) {
46951
- let rowDimensionKey = layout.getDimensionKeyInChartSpec(layout.rowHeaderLevelCount, row)[0];
46976
+ let rowDimensionKey = layout.getDimensionKeyInChartSpec(layout.rowHeaderLevelCount, row)?.[0];
46952
46977
  if (isArray(rowDimensionKey)) {
46953
46978
  rowDimensionKey = rowDimensionKey[0];
46954
46979
  }
@@ -46956,7 +46981,7 @@
46956
46981
  const recordRow = layout.getRecordIndexByRow(row);
46957
46982
  const rowPath = layout.getRowKeysPath()[recordRow];
46958
46983
  const domain = data[rowPath[rowPath.length - 1]] ?? [];
46959
- const axisOption = getAxisOption(col, row, 'left', layout);
46984
+ const { axisOption, isPercent } = getAxisOption(col + 1, row, 'left', layout);
46960
46985
  if (axisOption?.visible === false) {
46961
46986
  return;
46962
46987
  }
@@ -46985,7 +47010,15 @@
46985
47010
  ? layout.dataset.collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]
46986
47011
  : layout.dataset.collectedValues[defaultKey];
46987
47012
  const index = layout.getRecordIndexByRow(row);
46988
- const range = data?.[layout.getRowKeysPath()[index][Math.max(0, layout.rowHeaderLevelCount - 1 - layout.leftAxesCount)]] ?? { min: 0, max: 1 };
47013
+ const range = data?.[layout.getRowKeysPath()[index]?.[Math.max(0, layout.rowHeaderLevelCount - 1 - layout.leftAxesCount)] ?? ''] ?? { min: 0, max: 1 };
47014
+ if (range.min === range.max) {
47015
+ if (range.min > 0) {
47016
+ range.min = 0;
47017
+ }
47018
+ else {
47019
+ range.max = 0;
47020
+ }
47021
+ }
46989
47022
  let indicatorInfo = null;
46990
47023
  indicatorKeys.forEach(key => {
46991
47024
  const info = layout.getIndicatorInfo(key);
@@ -46993,10 +47026,14 @@
46993
47026
  indicatorInfo = info;
46994
47027
  }
46995
47028
  });
46996
- const axisOption = getAxisOption(col, row, 'left', layout);
47029
+ const { axisOption, isPercent } = getAxisOption(col + 1, row, 'left', layout);
46997
47030
  if (axisOption?.visible === false) {
46998
47031
  return;
46999
47032
  }
47033
+ if (isPercent) {
47034
+ range.min = 0;
47035
+ range.max = 1;
47036
+ }
47000
47037
  if (isNumber$1(axisOption?.min)) {
47001
47038
  range.min = axisOption.min;
47002
47039
  }
@@ -47034,11 +47071,23 @@
47034
47071
  ? layout.dataset.collectedValues[defaultKey + (isZeroAlign ? '_align' : '')]
47035
47072
  : layout.dataset.collectedValues[defaultKey];
47036
47073
  const index = layout.getRecordIndexByRow(row);
47037
- const range = data?.[layout.getRowKeysPath()[index][Math.max(0, layout.rowHeaderLevelCount - 1 - layout.leftAxesCount)]] ?? { min: 0, max: 1 };
47038
- const axisOption = getAxisOption(col, row, 'right', layout);
47074
+ const range = data?.[layout.getRowKeysPath()[index]?.[Math.max(0, layout.rowHeaderLevelCount - 1 - layout.leftAxesCount)] ?? ''] ?? { min: 0, max: 1 };
47075
+ const { axisOption, isPercent } = getAxisOption(col - 1, row, 'right', layout);
47076
+ if (range.min === range.max) {
47077
+ if (range.min > 0) {
47078
+ range.min = 0;
47079
+ }
47080
+ else {
47081
+ range.max = 0;
47082
+ }
47083
+ }
47039
47084
  if (axisOption?.visible === false) {
47040
47085
  return;
47041
47086
  }
47087
+ if (isPercent) {
47088
+ range.min = 0;
47089
+ range.max = 1;
47090
+ }
47042
47091
  if (isNumber$1(axisOption?.min)) {
47043
47092
  range.min = axisOption.min;
47044
47093
  }
@@ -47061,15 +47110,15 @@
47061
47110
  else if (row === layout.rowCount - layout.bottomFrozenRowCount &&
47062
47111
  col >= layout.rowHeaderLevelCount &&
47063
47112
  col < layout.colCount - layout.rightFrozenColCount) {
47064
- let columnDimensionKey = layout.getDimensionKeyInChartSpec(col, layout.columnHeaderLevelCount)[0];
47113
+ let columnDimensionKey = layout.getDimensionKeyInChartSpec(col, layout.columnHeaderLevelCount)?.[0];
47065
47114
  if (isArray(columnDimensionKey)) {
47066
47115
  columnDimensionKey = columnDimensionKey[0];
47067
47116
  }
47068
47117
  const data = layout.dataset.collectedValues[columnDimensionKey] ?? [];
47069
47118
  const recordCol = layout.getRecordIndexByCol(col);
47070
47119
  const colPath = layout.getColKeysPath()[recordCol];
47071
- const domain = data?.[colPath[colPath.length - 1]] ?? [];
47072
- const axisOption = getAxisOption(col, row, 'bottom', layout);
47120
+ const domain = data?.[colPath?.[colPath?.length - 1] ?? ''] ?? [];
47121
+ const { axisOption, isPercent } = getAxisOption(col, row - 1, 'bottom', layout);
47073
47122
  if (axisOption?.visible === false) {
47074
47123
  return;
47075
47124
  }
@@ -47090,13 +47139,19 @@
47090
47139
  return axis.orient === orient;
47091
47140
  });
47092
47141
  if (axisOption) {
47093
- return axisOption;
47142
+ return {
47143
+ axisOption,
47144
+ isPercent: spec.percent
47145
+ };
47094
47146
  }
47095
47147
  }
47096
47148
  const axisOption = layout._table.pivotChartAxes.find(axisOption => {
47097
47149
  return axisOption.orient === orient;
47098
47150
  });
47099
- return axisOption;
47151
+ return {
47152
+ axisOption,
47153
+ isPercent: false
47154
+ };
47100
47155
  }
47101
47156
  function checkZeroAlign(col, row, orient, layout) {
47102
47157
  const orients = [];
@@ -50018,12 +50073,14 @@
50018
50073
  for (let i = 0; i < scene.table.frozenColCount - scene.table.rowHeaderLevelCount; i++) {
50019
50074
  moveColumnFromBodyToRowHeader(scene);
50020
50075
  moveColumnFromColHeaderToCornerHeader(scene);
50076
+ moveColumnFromBottomToLeftBottomCorner(scene);
50021
50077
  }
50022
50078
  }
50023
50079
  else if (scene.table.frozenColCount < scene.table.rowHeaderLevelCount) {
50024
50080
  for (let i = 0; i < scene.table.rowHeaderLevelCount - scene.table.frozenColCount; i++) {
50025
50081
  moveColumnFromRowHeaderToBody(scene);
50026
50082
  moveColumnFromCornerHeaderToColHeader(scene);
50083
+ moveColumnFromLeftBottomCornerToBottom(scene);
50027
50084
  }
50028
50085
  }
50029
50086
  scene.bodyGroup.setAttribute('x', scene.rowHeaderGroup.attribute.width);
@@ -50042,6 +50099,7 @@
50042
50099
  for (let i = 0; i < scene.frozenColCount - scene.table.rowHeaderLevelCount; i++) {
50043
50100
  moveColumnFromRowHeaderToBody(scene);
50044
50101
  moveColumnFromCornerHeaderToColHeader(scene);
50102
+ moveColumnFromLeftBottomCornerToBottom(scene);
50045
50103
  }
50046
50104
  }
50047
50105
  else if (scene.frozenColCount < scene.table.rowHeaderLevelCount) {
@@ -50051,6 +50109,7 @@
50051
50109
  for (let i = 0; i < scene.table.rowHeaderLevelCount - scene.frozenColCount; i++) {
50052
50110
  moveColumnFromBodyToRowHeader(scene);
50053
50111
  moveColumnFromColHeaderToCornerHeader(scene);
50112
+ moveColumnFromBottomToLeftBottomCorner(scene);
50054
50113
  }
50055
50114
  }
50056
50115
  scene.bodyGroup.setAttribute('x', scene.rowHeaderGroup.attribute.width);
@@ -50100,6 +50159,24 @@
50100
50159
  scene.cornerHeaderGroup.setAttribute('width', scene.cornerHeaderGroup.attribute.width - headerColumn.attribute.width);
50101
50160
  }
50102
50161
  }
50162
+ function moveColumnFromBottomToLeftBottomCorner(scene) {
50163
+ const column = scene.bottomFrozenGroup.firstChild instanceof Group ? scene.bottomFrozenGroup.firstChild : null;
50164
+ if (column) {
50165
+ scene.leftBottomCornerGroup.appendChild(column);
50166
+ scene.leftBottomCornerGroup.setAttribute('width', scene.leftBottomCornerGroup.attribute.width + column.attribute.width);
50167
+ scene.bottomFrozenGroup.setAttribute('width', scene.bottomFrozenGroup.attribute.width - column.attribute.width);
50168
+ }
50169
+ }
50170
+ function moveColumnFromLeftBottomCornerToBottom(scene) {
50171
+ const column = scene.leftBottomCornerGroup.lastChild instanceof Group
50172
+ ? scene.leftBottomCornerGroup.lastChild
50173
+ : scene.leftBottomCornerGroup.lastChild?._prev;
50174
+ if (column) {
50175
+ insertBefore(scene.bottomFrozenGroup, column, scene.bottomFrozenGroup.firstChild);
50176
+ scene.bottomFrozenGroup.setAttribute('width', scene.bottomFrozenGroup.attribute.width + column.attribute.width);
50177
+ scene.leftBottomCornerGroup.setAttribute('width', scene.leftBottomCornerGroup.attribute.width - column.attribute.width);
50178
+ }
50179
+ }
50103
50180
  function dealRightFrozen(distRightFrozenCol, scene) {
50104
50181
  const { table, proxy, rightTopCornerGroup, rightFrozenGroup, rightBottomCornerGroup, bottomFrozenGroup, bodyGroup, colHeaderGroup } = scene;
50105
50182
  const currentRightFrozenCol = scene.table.rightFrozenColCount;
@@ -52060,8 +52137,8 @@
52060
52137
  { x: 0, y: max },
52061
52138
  { x: 0, y: min }
52062
52139
  ],
52063
- lineWidth: line.hover.strokeWidth,
52064
- stroke: line.hover.stroke
52140
+ lineWidth: line.hover?.strokeWidth,
52141
+ stroke: line.hover?.stroke
52065
52142
  });
52066
52143
  highlightLine.name = 'highlight-line';
52067
52144
  sparkline.addChild(highlightLine);
@@ -55283,6 +55360,9 @@
55283
55360
  if (this._table.isPivotTable() || this._table.transpose) {
55284
55361
  return null;
55285
55362
  }
55363
+ if (this._table.rightFrozenColCount && col >= this._table.colCount - this._table.rightFrozenColCount) {
55364
+ return null;
55365
+ }
55286
55366
  const headerC = this._table.getHeaderDefine(col, row);
55287
55367
  if (headerC.columns && headerC.columns.length > 0) {
55288
55368
  return null;
@@ -57234,7 +57314,7 @@
57234
57314
  }
57235
57315
  }
57236
57316
  release() {
57237
- this.table.scenegraph.stage.defaultLayer.removeChild(this._titleComponent);
57317
+ this._titleComponent && this.table.scenegraph.stage.defaultLayer.removeChild(this._titleComponent);
57238
57318
  this._titleComponent = null;
57239
57319
  }
57240
57320
  _getTitleAttrs() {
@@ -57300,7 +57380,7 @@
57300
57380
  return TABLE_EVENT_TYPE;
57301
57381
  }
57302
57382
  options;
57303
- version = "0.10.2";
57383
+ version = "0.10.3-alpha.1";
57304
57384
  pagination;
57305
57385
  id = `VTable${Date.now()}`;
57306
57386
  headerStyleCache;
@@ -58800,10 +58880,14 @@
58800
58880
  return cacheStyle;
58801
58881
  }
58802
58882
  const hd = layoutMap.getHeader(col, row);
58803
- if (!hd || hd.isEmpty) {
58883
+ if ((!hd || hd.isEmpty) &&
58884
+ (layoutMap.isLeftBottomCorner(col, row) ||
58885
+ layoutMap.isRightBottomCorner(col, row) ||
58886
+ layoutMap.isCornerHeader(col, row) ||
58887
+ layoutMap.isRightTopCorner(col, row))) {
58804
58888
  return EMPTY_STYLE;
58805
58889
  }
58806
- const styleClass = this.internalProps.headerHelper.getStyleClass(hd.headerType);
58890
+ const styleClass = this.internalProps.headerHelper.getStyleClass(hd?.headerType || 'text');
58807
58891
  if (layoutMap.isBottomFrozenRow(col, row) && this.theme.bottomFrozenStyle) {
58808
58892
  cacheStyle = of$1({}, this.theme.bottomFrozenStyle, {
58809
58893
  col,
@@ -58825,7 +58909,7 @@
58825
58909
  }, styleClass, this.options.autoWrapText);
58826
58910
  }
58827
58911
  else {
58828
- const { style } = hd;
58912
+ const style = hd?.style || {};
58829
58913
  cacheStyle = of$1(style, layoutMap.isColumnHeader(col, row) || layoutMap.isBottomFrozenRow(col, row)
58830
58914
  ? this.theme.headerStyle
58831
58915
  : layoutMap.isRowHeader(col, row) || layoutMap.isRightFrozenColumn(col, row)
@@ -59457,9 +59541,13 @@
59457
59541
  const data = layout.dataset.collectedValues[key + (isZeroAlign ? '_align' : '')]
59458
59542
  ? layout.dataset.collectedValues[key + (isZeroAlign ? '_align' : '')]
59459
59543
  : layout.dataset.collectedValues[key];
59460
- const range = data?.[layout.getColKeysPath()[colIndex][Math.max(0, layout.columnHeaderLevelCount - 1 - layout.topAxesCount)]] ?? { min: 0, max: 1 };
59461
- const axisOption = getAxisOption(col, row, index === 0 ? 'bottom' : 'top', layout);
59462
- if (axisOption?.zero) {
59544
+ const range = data?.[layout.getColKeysPath()?.[colIndex]?.[Math.max(0, layout.columnHeaderLevelCount - 1 - layout.topAxesCount)]] ?? { min: 0, max: 1 };
59545
+ const { axisOption, isPercent } = getAxisOption(col, row, index === 0 ? 'bottom' : 'top', layout);
59546
+ if (isPercent) {
59547
+ range.min = 0;
59548
+ range.max = 1;
59549
+ }
59550
+ if (axisOption?.zero || range.min === range.max) {
59463
59551
  range.min = Math.min(range.min, 0);
59464
59552
  range.max = Math.max(range.max, 0);
59465
59553
  }
@@ -59486,7 +59574,7 @@
59486
59574
  const recordRow = layout.getRecordIndexByRow(row);
59487
59575
  const rowPath = layout.getRowKeysPath()[recordRow];
59488
59576
  const domain = data[rowPath[rowPath.length - 1]];
59489
- const axisOption = getAxisOption(col, row, 'left', layout);
59577
+ const { axisOption, isPercent } = getAxisOption(col, row, 'left', layout);
59490
59578
  axes.push(merge$2({
59491
59579
  domain: Array.from(domain)
59492
59580
  }, axisOption, {
@@ -59511,9 +59599,13 @@
59511
59599
  const data = layout.dataset.collectedValues[key + (isZeroAlign ? '_align' : '')]
59512
59600
  ? layout.dataset.collectedValues[key + (isZeroAlign ? '_align' : '')]
59513
59601
  : layout.dataset.collectedValues[key];
59514
- const range = data?.[layout.getRowKeysPath()[rowIndex][Math.max(0, layout.rowHeaderLevelCount - 1 - layout.leftAxesCount)]] ?? { min: 0, max: 1 };
59515
- const axisOption = getAxisOption(col, row, index === 0 ? 'left' : 'right', layout);
59516
- if (axisOption?.zero) {
59602
+ const range = data?.[layout.getRowKeysPath()[rowIndex]?.[Math.max(0, layout.rowHeaderLevelCount - 1 - layout.leftAxesCount)] ?? ''] ?? { min: 0, max: 1 };
59603
+ const { axisOption, isPercent } = getAxisOption(col, row, index === 0 ? 'left' : 'right', layout);
59604
+ if (isPercent) {
59605
+ range.min = 0;
59606
+ range.max = 1;
59607
+ }
59608
+ if (axisOption?.zero || range.min === range.max) {
59517
59609
  range.min = Math.min(range.min, 0);
59518
59610
  range.max = Math.max(range.max, 0);
59519
59611
  }
@@ -59539,8 +59631,8 @@
59539
59631
  [];
59540
59632
  const recordCol = layout.getRecordIndexByCol(col);
59541
59633
  const colPath = layout.getColKeysPath()[recordCol];
59542
- const domain = data?.[colPath[colPath.length - 1]] ?? [];
59543
- const axisOption = getAxisOption(col, row, 'bottom', layout);
59634
+ const domain = data?.[colPath?.[colPath?.length - 1] ?? ''] ?? [];
59635
+ const { axisOption, isPercent } = getAxisOption(col, row, 'bottom', layout);
59544
59636
  axes.push(merge$2({
59545
59637
  domain: Array.from(domain)
59546
59638
  }, axisOption, {
@@ -61047,8 +61139,8 @@
61047
61139
  if (indicatorInfo.customRender) {
61048
61140
  hd.customRender = indicatorInfo.customRender;
61049
61141
  }
61050
- if (!isValid$1(this._indicators.find(indicator => indicator.indicatorKey === indicatorInfo.indicatorKey))) {
61051
- this._indicators.push({
61142
+ if (!isValid$1(this._indicators?.find(indicator => indicator.indicatorKey === indicatorInfo.indicatorKey))) {
61143
+ this._indicators?.push({
61052
61144
  id: ++seqId,
61053
61145
  indicatorKey: indicatorInfo.indicatorKey,
61054
61146
  field: indicatorInfo.indicatorKey,
@@ -61070,8 +61162,8 @@
61070
61162
  }
61071
61163
  }
61072
61164
  else if (hd.indicatorKey) {
61073
- if (!isValid$1(this._indicators.find(indicator => indicator.indicatorKey === hd.indicatorKey))) {
61074
- this._indicators.push({
61165
+ if (!isValid$1(this._indicators?.find(indicator => indicator.indicatorKey === hd.indicatorKey))) {
61166
+ this._indicators?.push({
61075
61167
  id: ++seqId,
61076
61168
  indicatorKey: hd.indicatorKey,
61077
61169
  field: hd.indicatorKey,
@@ -61274,7 +61366,7 @@
61274
61366
  let maxWidth;
61275
61367
  let minWidth;
61276
61368
  let isAuto;
61277
- this._indicators.forEach((obj, index) => {
61369
+ this._indicators?.forEach((obj, index) => {
61278
61370
  if (typeof obj.width === 'number') {
61279
61371
  width = Math.max(obj.width, width);
61280
61372
  }
@@ -61580,7 +61672,7 @@
61580
61672
  const paths = this.getCellHeaderPaths(_col, _row);
61581
61673
  if (this.indicatorsAsCol) {
61582
61674
  const indicatorKey = paths.colHeaderPaths.find(colPath => colPath.indicatorKey)?.indicatorKey;
61583
- return (this._indicators.find(indicator => indicator.indicatorKey === indicatorKey) ??
61675
+ return (this._indicators?.find(indicator => indicator.indicatorKey === indicatorKey) ??
61584
61676
  this._indicators[0] ?? {
61585
61677
  id: '',
61586
61678
  field: undefined,
@@ -61590,7 +61682,7 @@
61590
61682
  });
61591
61683
  }
61592
61684
  const indicatorKey = paths.rowHeaderPaths.find(rowPath => rowPath.indicatorKey)?.indicatorKey;
61593
- return (this._indicators.find(indicator => indicator.indicatorKey === indicatorKey) ??
61685
+ return (this._indicators?.find(indicator => indicator.indicatorKey === indicatorKey) ??
61594
61686
  this._indicators[0] ?? {
61595
61687
  id: '',
61596
61688
  field: undefined,
@@ -62158,11 +62250,11 @@
62158
62250
  let indicatorObj;
62159
62251
  if (this.indicatorsAsCol) {
62160
62252
  const indicatorKey = paths.colHeaderPaths.find(colPath => colPath.indicatorKey)?.indicatorKey;
62161
- indicatorObj = this._indicators.find(indicator => indicator.indicatorKey === indicatorKey);
62253
+ indicatorObj = this._indicators?.find(indicator => indicator.indicatorKey === indicatorKey);
62162
62254
  }
62163
62255
  else {
62164
62256
  const indicatorKey = paths.rowHeaderPaths.find(rowPath => rowPath.indicatorKey)?.indicatorKey;
62165
- indicatorObj = this._indicators.find(indicator => indicator.indicatorKey === indicatorKey);
62257
+ indicatorObj = this._indicators?.find(indicator => indicator.indicatorKey === indicatorKey);
62166
62258
  }
62167
62259
  indicatorObj && (indicatorObj.chartInstance = chartInstance);
62168
62260
  }
@@ -62171,11 +62263,11 @@
62171
62263
  let indicatorObj;
62172
62264
  if (this.indicatorsAsCol) {
62173
62265
  const indicatorKey = paths.colHeaderPaths.find(colPath => colPath.indicatorKey)?.indicatorKey;
62174
- indicatorObj = this._indicators.find(indicator => indicator.indicatorKey === indicatorKey);
62266
+ indicatorObj = this._indicators?.find(indicator => indicator.indicatorKey === indicatorKey);
62175
62267
  }
62176
62268
  else {
62177
62269
  const indicatorKey = paths.rowHeaderPaths.find(rowPath => rowPath.indicatorKey)?.indicatorKey;
62178
- indicatorObj = this._indicators.find(indicator => indicator.indicatorKey === indicatorKey);
62270
+ indicatorObj = this._indicators?.find(indicator => indicator.indicatorKey === indicatorKey);
62179
62271
  }
62180
62272
  return indicatorObj?.chartInstance;
62181
62273
  }
@@ -62205,7 +62297,7 @@
62205
62297
  release() {
62206
62298
  const activeChartInstance = this._table._getActiveChartInstance();
62207
62299
  activeChartInstance?.release();
62208
- this._indicators.forEach(indicatorObject => {
62300
+ this._indicators?.forEach(indicatorObject => {
62209
62301
  indicatorObject.chartInstance?.release();
62210
62302
  });
62211
62303
  }
@@ -62973,17 +63065,20 @@
62973
63065
  }
62974
63066
  else if (this.isColumnHeader(col, row)) {
62975
63067
  if (row < this.columns.length + (this.columnHeaderTitle ? 1 : 0)) {
62976
- return this.convertColKeys[row][this.indicatorsAsCol
63068
+ return (this.convertColKeys[row]?.[this.indicatorsAsCol
62977
63069
  ? Math.floor((col - this.rowHeaderLevelCount) / this.indicatorKeys.length)
62978
- : col - this.rowHeaderLevelCount];
63070
+ : col - this.rowHeaderLevelCount] ?? `colHeaderAxis-${col}-${row}`);
62979
63071
  }
62980
63072
  return this.indicatorKeys[(col - this.rowHeaderLevelCount) % this.indicatorKeys.length];
62981
63073
  }
62982
63074
  else if (this.isRowHeader(col, row)) {
62983
63075
  if (col < this.rows.length + (this.rowHeaderTitle ? 1 : 0)) {
62984
- return this.rowKeysPath[!this.indicatorsAsCol
63076
+ return (this.rowKeysPath[!this.indicatorsAsCol
62985
63077
  ? Math.floor((row - this.columnHeaderLevelCount) / this.indicatorKeys.length)
62986
- : row - this.columnHeaderLevelCount][col];
63078
+ : row - this.columnHeaderLevelCount]?.[col] ?? `rowHeaderAxis-${col}-${row}`);
63079
+ }
63080
+ if (this.indicatorsAsCol && col === this.rowHeaderLevelCount - 1) {
63081
+ return `rowHeaderAxis-${col}-${row}`;
62987
63082
  }
62988
63083
  return this.indicatorKeys[(row - this.columnHeaderLevelCount) % this.indicatorKeys.length];
62989
63084
  }
@@ -62997,7 +63092,7 @@
62997
63092
  if (this.indicatorsAsCol) {
62998
63093
  return this.indicatorKeys[(col - this.rowHeaderLevelCount) % this.indicatorKeys.length];
62999
63094
  }
63000
- return this.convertColKeys[this.convertColKeys.length - 1][Math.floor((col - this.rowHeaderLevelCount) / this.indicatorKeys.length)];
63095
+ return this.convertColKeys[this.convertColKeys.length - 1]?.[Math.floor((col - this.rowHeaderLevelCount) / this.indicatorKeys.length)];
63001
63096
  }
63002
63097
  }
63003
63098
  return 0;
@@ -63014,7 +63109,10 @@
63014
63109
  return this.indicatorKeys[bodyRow % this.indicatorKeys.length];
63015
63110
  }
63016
63111
  getHeader(col, row) {
63017
- const id = this.getCellId(col, row);
63112
+ let id = this.getCellId(col, row);
63113
+ if (id?.toString().startsWith('rowHeaderAxis')) {
63114
+ id = 'rowHeaderEmpty';
63115
+ }
63018
63116
  return this._headerObjectMap[id] ?? EMPTY_HEADER;
63019
63117
  }
63020
63118
  getHeaderField(col, row) {
@@ -63139,6 +63237,9 @@
63139
63237
  if (colHeaderPaths && this.showColumnHeader && row < this.columns.length - 1) {
63140
63238
  colHeaderPaths = colHeaderPaths.slice(0, row + 1);
63141
63239
  }
63240
+ else if (!colHeaderPaths) {
63241
+ colHeaderPaths = [];
63242
+ }
63142
63243
  }
63143
63244
  if (recordRow >= 0) {
63144
63245
  rowPath = this.rowKeysPath[recordRow];
@@ -63146,6 +63247,9 @@
63146
63247
  if (rowHeaderPaths && this.showRowHeader && col < this.rows.length - 1) {
63147
63248
  rowHeaderPaths = rowHeaderPaths.slice(0, col + 1);
63148
63249
  }
63250
+ else if (!rowHeaderPaths) {
63251
+ rowHeaderPaths = [];
63252
+ }
63149
63253
  }
63150
63254
  if (colHeaderPaths && this.indicatorsAsCol && col >= this.rowHeaderLevelCount) {
63151
63255
  colHeaderPaths.push(this.indicatorKeys[(col - this.rowHeaderLevelCount) % this.indicatorKeys.length]);
@@ -63551,7 +63655,7 @@
63551
63655
  colKey.push(record[colAttr]);
63552
63656
  }
63553
63657
  }
63554
- this.dataConfig.indicators.forEach((indicatorKey) => {
63658
+ this.dataConfig.indicators?.forEach((indicatorKey) => {
63555
63659
  const recordValue = record[indicatorKey];
63556
63660
  if (recordValue !== undefined) {
63557
63661
  if (this.dataConfig.indicatorsAsCol) {
@@ -64204,6 +64308,9 @@
64204
64308
  const dimensionIndex = this.columns.indexOf(dimension);
64205
64309
  this.colsIsTotal[dimensionIndex] = true;
64206
64310
  }
64311
+ this.rowKeysPath = [];
64312
+ this.rowKeysPath_FULL = [];
64313
+ this.colKeysPath = [];
64207
64314
  if (records) {
64208
64315
  this.records = records;
64209
64316
  const t0 = typeof window !== 'undefined' ? window.performance.now() : 0;
@@ -64411,17 +64518,17 @@
64411
64518
  }
64412
64519
  else if (aggRule?.field) {
64413
64520
  if (typeof aggRule?.field === 'string') {
64414
- isValid$1(record[aggRule?.field]) && this.tree[flatRowKey]?.[flatColKey]?.[i].push(record);
64521
+ aggRule?.field in record && this.tree[flatRowKey]?.[flatColKey]?.[i].push(record);
64415
64522
  }
64416
64523
  else {
64417
64524
  const isPush = aggRule?.field.find((field) => {
64418
- return record[field];
64525
+ return field in record;
64419
64526
  });
64420
64527
  isPush && this.tree[flatRowKey]?.[flatColKey]?.[i].push(record);
64421
64528
  }
64422
64529
  }
64423
64530
  else {
64424
- isValid$1(record[this.indicatorKeys[i]]) && this.tree[flatRowKey]?.[flatColKey]?.[i].push(record);
64531
+ this.indicatorKeys[i] in record && this.tree[flatRowKey]?.[flatColKey]?.[i].push(record);
64425
64532
  }
64426
64533
  }
64427
64534
  }
@@ -64923,8 +65030,8 @@
64923
65030
  this.internalProps.columnResizeType = options.columnResizeType ?? 'column';
64924
65031
  this.internalProps.dataConfig = options.dataConfig;
64925
65032
  this.internalProps.enableDataAnalysis = options.enableDataAnalysis;
64926
- if (this.internalProps.enableDataAnalysis && (options.rows || options.columns)) {
64927
- const rowKeys = options.rows.reduce((keys, rowObj) => {
65033
+ if (this.internalProps.enableDataAnalysis) {
65034
+ const rowKeys = options.rows?.reduce((keys, rowObj) => {
64928
65035
  if (typeof rowObj === 'string') {
64929
65036
  keys.push(rowObj);
64930
65037
  }
@@ -64932,8 +65039,8 @@
64932
65039
  keys.push(rowObj.dimensionKey);
64933
65040
  }
64934
65041
  return keys;
64935
- }, []);
64936
- const columnKeys = options.columns.reduce((keys, columnObj) => {
65042
+ }, []) ?? [];
65043
+ const columnKeys = options.columns?.reduce((keys, columnObj) => {
64937
65044
  if (typeof columnObj === 'string') {
64938
65045
  keys.push(columnObj);
64939
65046
  }
@@ -64941,7 +65048,7 @@
64941
65048
  keys.push(columnObj.dimensionKey);
64942
65049
  }
64943
65050
  return keys;
64944
- }, []);
65051
+ }, []) ?? [];
64945
65052
  const indicatorKeys = options.indicators?.reduce((keys, indicatorObj) => {
64946
65053
  if (typeof indicatorObj === 'string') {
64947
65054
  keys.push(indicatorObj);
@@ -65026,7 +65133,7 @@
65026
65133
  }
65027
65134
  return keys;
65028
65135
  }, []);
65029
- const indicatorKeys = options.indicators.reduce((keys, indicatorObj) => {
65136
+ const indicatorKeys = options.indicators?.reduce((keys, indicatorObj) => {
65030
65137
  if (typeof indicatorObj === 'string') {
65031
65138
  keys.push(indicatorObj);
65032
65139
  }
@@ -65391,39 +65498,37 @@
65391
65498
  this.internalProps.columnResizeType = options.columnResizeType ?? 'column';
65392
65499
  this.internalProps.dataConfig = { isPivotChart: true };
65393
65500
  this._axes = isArray(options.axes) ? options.axes : [];
65394
- if (options.rows || options.columns) {
65395
- const rowKeys = options.rows.reduce((keys, rowObj) => {
65396
- if (typeof rowObj === 'string') {
65397
- keys.push(rowObj);
65398
- }
65399
- else {
65400
- keys.push(rowObj.dimensionKey);
65401
- }
65402
- return keys;
65403
- }, []);
65404
- const columnKeys = options.columns.reduce((keys, columnObj) => {
65405
- if (typeof columnObj === 'string') {
65406
- keys.push(columnObj);
65407
- }
65408
- else {
65409
- keys.push(columnObj.dimensionKey);
65410
- }
65411
- return keys;
65412
- }, []);
65413
- const indicatorKeys = options.indicators?.reduce((keys, indicatorObj) => {
65414
- if (typeof indicatorObj === 'string') {
65415
- keys.push(indicatorObj);
65416
- }
65417
- else {
65418
- keys.push(indicatorObj.indicatorKey);
65419
- }
65420
- return keys;
65421
- }, []) ?? [];
65422
- this.internalProps.dataConfig.collectValuesBy = this._generateCollectValuesConfig(columnKeys, rowKeys);
65423
- this.internalProps.dataConfig.aggregationRules = this._generateAggregationRules();
65424
- this.internalProps.dataConfig.dimensionSortArray = this._getDimensionSortArray();
65425
- this.dataset = new Dataset(this.internalProps.dataConfig, null, rowKeys, columnKeys, indicatorKeys, options.records, options.columnTree, options.rowTree);
65426
- }
65501
+ const rowKeys = options.rows?.reduce((keys, rowObj) => {
65502
+ if (typeof rowObj === 'string') {
65503
+ keys.push(rowObj);
65504
+ }
65505
+ else {
65506
+ keys.push(rowObj.dimensionKey);
65507
+ }
65508
+ return keys;
65509
+ }, []) ?? [];
65510
+ const columnKeys = options.columns?.reduce((keys, columnObj) => {
65511
+ if (typeof columnObj === 'string') {
65512
+ keys.push(columnObj);
65513
+ }
65514
+ else {
65515
+ keys.push(columnObj.dimensionKey);
65516
+ }
65517
+ return keys;
65518
+ }, []) ?? [];
65519
+ const indicatorKeys = options.indicators?.reduce((keys, indicatorObj) => {
65520
+ if (typeof indicatorObj === 'string') {
65521
+ keys.push(indicatorObj);
65522
+ }
65523
+ else {
65524
+ keys.push(indicatorObj.indicatorKey);
65525
+ }
65526
+ return keys;
65527
+ }, []) ?? [];
65528
+ this.internalProps.dataConfig.collectValuesBy = this._generateCollectValuesConfig(columnKeys, rowKeys);
65529
+ this.internalProps.dataConfig.aggregationRules = this._generateAggregationRules();
65530
+ this.internalProps.dataConfig.dimensionSortArray = this._getDimensionSortArray();
65531
+ this.dataset = new Dataset(this.internalProps.dataConfig, null, rowKeys, columnKeys, indicatorKeys, options.records, options.columnTree, options.rowTree);
65427
65532
  this.refreshHeader();
65428
65533
  if (options.dataSource) {
65429
65534
  _setDataSource(this, options.dataSource);
@@ -65488,7 +65593,7 @@
65488
65593
  }
65489
65594
  return keys;
65490
65595
  }, []);
65491
- const indicatorKeys = options.indicators.reduce((keys, indicatorObj) => {
65596
+ const indicatorKeys = options.indicators?.reduce((keys, indicatorObj) => {
65492
65597
  if (typeof indicatorObj === 'string') {
65493
65598
  keys.push(indicatorObj);
65494
65599
  }
@@ -65763,7 +65868,7 @@
65763
65868
  _generateCollectValuesConfig(columnKeys, rowKeys) {
65764
65869
  const option = this.options;
65765
65870
  const collectValuesBy = {};
65766
- for (let i = 0, len = option.indicators.length; i < len; i++) {
65871
+ for (let i = 0, len = option.indicators?.length; i < len; i++) {
65767
65872
  if (typeof option.indicators[i] !== 'string' && option.indicators[i].chartSpec) {
65768
65873
  if (option.indicatorsAsCol === false) {
65769
65874
  const indicatorDefine = option.indicators[i];
@@ -65881,7 +65986,7 @@
65881
65986
  }
65882
65987
  _generateAggregationRules() {
65883
65988
  const aggregationRules = [];
65884
- this.options.indicators.forEach((indicator) => {
65989
+ this.options.indicators?.forEach((indicator) => {
65885
65990
  if (typeof indicator === 'string') {
65886
65991
  aggregationRules.push({
65887
65992
  indicatorKey: indicator,
@@ -65945,7 +66050,7 @@
65945
66050
  delete spec.area.state.selected_reverse;
65946
66051
  }
65947
66052
  };
65948
- this.options.indicators.forEach((indicator) => {
66053
+ this.options.indicators?.forEach((indicator) => {
65949
66054
  if (indicator.chartSpec) {
65950
66055
  const spec = indicator.chartSpec;
65951
66056
  if (spec.series) {
@@ -66660,7 +66765,7 @@
66660
66765
  percentCalc: percentCalc
66661
66766
  });
66662
66767
 
66663
- const version = "0.10.2";
66768
+ const version = "0.10.3-alpha.1";
66664
66769
  function getIcons() {
66665
66770
  return get$1();
66666
66771
  }