@visactor/vtable 0.10.3-alpha.0 → 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.
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
  }
@@ -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
  }
@@ -46986,6 +47011,14 @@
46986
47011
  : layout.dataset.collectedValues[defaultKey];
46987
47012
  const index = layout.getRecordIndexByRow(row);
46988
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
  }
@@ -47035,10 +47072,22 @@
47035
47072
  : layout.dataset.collectedValues[defaultKey];
47036
47073
  const index = layout.getRecordIndexByRow(row);
47037
47074
  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);
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
  }
@@ -47068,8 +47117,8 @@
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 = [];
@@ -57259,7 +57314,7 @@
57259
57314
  }
57260
57315
  }
57261
57316
  release() {
57262
- this.table.scenegraph.stage.defaultLayer.removeChild(this._titleComponent);
57317
+ this._titleComponent && this.table.scenegraph.stage.defaultLayer.removeChild(this._titleComponent);
57263
57318
  this._titleComponent = null;
57264
57319
  }
57265
57320
  _getTitleAttrs() {
@@ -57325,7 +57380,7 @@
57325
57380
  return TABLE_EVENT_TYPE;
57326
57381
  }
57327
57382
  options;
57328
- version = "0.10.3-alpha.0";
57383
+ version = "0.10.3-alpha.1";
57329
57384
  pagination;
57330
57385
  id = `VTable${Date.now()}`;
57331
57386
  headerStyleCache;
@@ -58825,10 +58880,14 @@
58825
58880
  return cacheStyle;
58826
58881
  }
58827
58882
  const hd = layoutMap.getHeader(col, row);
58828
- 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))) {
58829
58888
  return EMPTY_STYLE;
58830
58889
  }
58831
- const styleClass = this.internalProps.headerHelper.getStyleClass(hd.headerType);
58890
+ const styleClass = this.internalProps.headerHelper.getStyleClass(hd?.headerType || 'text');
58832
58891
  if (layoutMap.isBottomFrozenRow(col, row) && this.theme.bottomFrozenStyle) {
58833
58892
  cacheStyle = of$1({}, this.theme.bottomFrozenStyle, {
58834
58893
  col,
@@ -58850,7 +58909,7 @@
58850
58909
  }, styleClass, this.options.autoWrapText);
58851
58910
  }
58852
58911
  else {
58853
- const { style } = hd;
58912
+ const style = hd?.style || {};
58854
58913
  cacheStyle = of$1(style, layoutMap.isColumnHeader(col, row) || layoutMap.isBottomFrozenRow(col, row)
58855
58914
  ? this.theme.headerStyle
58856
58915
  : layoutMap.isRowHeader(col, row) || layoutMap.isRightFrozenColumn(col, row)
@@ -59482,9 +59541,13 @@
59482
59541
  const data = layout.dataset.collectedValues[key + (isZeroAlign ? '_align' : '')]
59483
59542
  ? layout.dataset.collectedValues[key + (isZeroAlign ? '_align' : '')]
59484
59543
  : layout.dataset.collectedValues[key];
59485
- const range = data?.[layout.getColKeysPath()[colIndex][Math.max(0, layout.columnHeaderLevelCount - 1 - layout.topAxesCount)]] ?? { min: 0, max: 1 };
59486
- const axisOption = getAxisOption(col, row, index === 0 ? 'bottom' : 'top', layout);
59487
- 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) {
59488
59551
  range.min = Math.min(range.min, 0);
59489
59552
  range.max = Math.max(range.max, 0);
59490
59553
  }
@@ -59511,7 +59574,7 @@
59511
59574
  const recordRow = layout.getRecordIndexByRow(row);
59512
59575
  const rowPath = layout.getRowKeysPath()[recordRow];
59513
59576
  const domain = data[rowPath[rowPath.length - 1]];
59514
- const axisOption = getAxisOption(col, row, 'left', layout);
59577
+ const { axisOption, isPercent } = getAxisOption(col, row, 'left', layout);
59515
59578
  axes.push(merge$2({
59516
59579
  domain: Array.from(domain)
59517
59580
  }, axisOption, {
@@ -59537,8 +59600,12 @@
59537
59600
  ? layout.dataset.collectedValues[key + (isZeroAlign ? '_align' : '')]
59538
59601
  : layout.dataset.collectedValues[key];
59539
59602
  const range = data?.[layout.getRowKeysPath()[rowIndex]?.[Math.max(0, layout.rowHeaderLevelCount - 1 - layout.leftAxesCount)] ?? ''] ?? { min: 0, max: 1 };
59540
- const axisOption = getAxisOption(col, row, index === 0 ? 'left' : 'right', layout);
59541
- if (axisOption?.zero) {
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) {
59542
59609
  range.min = Math.min(range.min, 0);
59543
59610
  range.max = Math.max(range.max, 0);
59544
59611
  }
@@ -59565,7 +59632,7 @@
59565
59632
  const recordCol = layout.getRecordIndexByCol(col);
59566
59633
  const colPath = layout.getColKeysPath()[recordCol];
59567
59634
  const domain = data?.[colPath?.[colPath?.length - 1] ?? ''] ?? [];
59568
- const axisOption = getAxisOption(col, row, 'bottom', layout);
59635
+ const { axisOption, isPercent } = getAxisOption(col, row, 'bottom', layout);
59569
59636
  axes.push(merge$2({
59570
59637
  domain: Array.from(domain)
59571
59638
  }, axisOption, {
@@ -62998,17 +63065,20 @@
62998
63065
  }
62999
63066
  else if (this.isColumnHeader(col, row)) {
63000
63067
  if (row < this.columns.length + (this.columnHeaderTitle ? 1 : 0)) {
63001
- return this.convertColKeys[row][this.indicatorsAsCol
63068
+ return (this.convertColKeys[row]?.[this.indicatorsAsCol
63002
63069
  ? Math.floor((col - this.rowHeaderLevelCount) / this.indicatorKeys.length)
63003
- : col - this.rowHeaderLevelCount];
63070
+ : col - this.rowHeaderLevelCount] ?? `colHeaderAxis-${col}-${row}`);
63004
63071
  }
63005
63072
  return this.indicatorKeys[(col - this.rowHeaderLevelCount) % this.indicatorKeys.length];
63006
63073
  }
63007
63074
  else if (this.isRowHeader(col, row)) {
63008
63075
  if (col < this.rows.length + (this.rowHeaderTitle ? 1 : 0)) {
63009
- return this.rowKeysPath[!this.indicatorsAsCol
63076
+ return (this.rowKeysPath[!this.indicatorsAsCol
63010
63077
  ? Math.floor((row - this.columnHeaderLevelCount) / this.indicatorKeys.length)
63011
- : 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}`;
63012
63082
  }
63013
63083
  return this.indicatorKeys[(row - this.columnHeaderLevelCount) % this.indicatorKeys.length];
63014
63084
  }
@@ -63039,7 +63109,10 @@
63039
63109
  return this.indicatorKeys[bodyRow % this.indicatorKeys.length];
63040
63110
  }
63041
63111
  getHeader(col, row) {
63042
- const id = this.getCellId(col, row);
63112
+ let id = this.getCellId(col, row);
63113
+ if (id?.toString().startsWith('rowHeaderAxis')) {
63114
+ id = 'rowHeaderEmpty';
63115
+ }
63043
63116
  return this._headerObjectMap[id] ?? EMPTY_HEADER;
63044
63117
  }
63045
63118
  getHeaderField(col, row) {
@@ -66692,7 +66765,7 @@
66692
66765
  percentCalc: percentCalc
66693
66766
  });
66694
66767
 
66695
- const version = "0.10.3-alpha.0";
66768
+ const version = "0.10.3-alpha.1";
66696
66769
  function getIcons() {
66697
66770
  return get$1();
66698
66771
  }