@visactor/vtable 0.13.3 → 0.13.4-alpha.2

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 (53) hide show
  1. package/cjs/components/axis/get-axis-attributes.d.ts +7 -0
  2. package/cjs/components/axis/get-axis-attributes.js +13 -17
  3. package/cjs/components/axis/get-axis-attributes.js.map +1 -1
  4. package/cjs/core/BaseTable.js +1 -1
  5. package/cjs/core/BaseTable.js.map +1 -1
  6. package/cjs/event/media-click.js +1 -2
  7. package/cjs/event/sparkline-event.js +2 -1
  8. package/cjs/index.d.ts +1 -1
  9. package/cjs/index.js +1 -1
  10. package/cjs/index.js.map +1 -1
  11. package/cjs/layout/chart-helper/get-axis-config.js +7 -5
  12. package/cjs/layout/chart-helper/get-axis-config.js.map +1 -1
  13. package/cjs/layout/chart-helper/get-axis-domain.d.ts +1 -1
  14. package/cjs/layout/chart-helper/get-axis-domain.js +17 -7
  15. package/cjs/layout/chart-helper/get-axis-domain.js.map +1 -1
  16. package/cjs/layout/chart-helper/get-chart-spec.js +3 -3
  17. package/cjs/layout/chart-helper/get-chart-spec.js.map +1 -1
  18. package/cjs/scenegraph/layout/update-height.js +2 -4
  19. package/cjs/scenegraph/layout/update-height.js.map +1 -1
  20. package/cjs/tools/LimitPromiseQueue.js +1 -1
  21. package/cjs/tools/NumberMap.js +1 -1
  22. package/cjs/tools/Rect.js +1 -1
  23. package/cjs/ts-types/base-table.js +1 -1
  24. package/cjs/ts-types/common.js +1 -1
  25. package/cjs/ts-types/customElement.js +1 -1
  26. package/dist/vtable.js +29 -12
  27. package/dist/vtable.min.js +2 -2
  28. package/es/components/axis/get-axis-attributes.d.ts +7 -0
  29. package/es/components/axis/get-axis-attributes.js +1 -1
  30. package/es/components/axis/get-axis-attributes.js.map +1 -1
  31. package/es/core/BaseTable.js +1 -1
  32. package/es/core/BaseTable.js.map +1 -1
  33. package/es/event/media-click.js +1 -2
  34. package/es/event/sparkline-event.js +2 -1
  35. package/es/index.d.ts +1 -1
  36. package/es/index.js +1 -1
  37. package/es/index.js.map +1 -1
  38. package/es/layout/chart-helper/get-axis-config.js +7 -5
  39. package/es/layout/chart-helper/get-axis-config.js.map +1 -1
  40. package/es/layout/chart-helper/get-axis-domain.d.ts +1 -1
  41. package/es/layout/chart-helper/get-axis-domain.js +19 -7
  42. package/es/layout/chart-helper/get-axis-domain.js.map +1 -1
  43. package/es/layout/chart-helper/get-chart-spec.js +3 -3
  44. package/es/layout/chart-helper/get-chart-spec.js.map +1 -1
  45. package/es/scenegraph/layout/update-height.js +2 -4
  46. package/es/scenegraph/layout/update-height.js.map +1 -1
  47. package/es/tools/LimitPromiseQueue.js +1 -1
  48. package/es/tools/NumberMap.js +1 -1
  49. package/es/tools/Rect.js +1 -1
  50. package/es/ts-types/base-table.js +1 -1
  51. package/es/ts-types/common.js +1 -1
  52. package/es/ts-types/customElement.js +1 -1
  53. package/package.json +3 -3
@@ -26,4 +26,4 @@ class LimitPromiseQueue {
26
26
  }
27
27
 
28
28
  exports.LimitPromiseQueue = LimitPromiseQueue;
29
- //# sourceMappingURL=LimitPromiseQueue.js.map
29
+ //# sourceMappingURL=LimitPromiseQueue.js.map
@@ -81,4 +81,4 @@ class NumberMap {
81
81
  }
82
82
 
83
83
  exports.NumberMap = NumberMap;
84
- //# sourceMappingURL=NumberMap.js.map
84
+ //# sourceMappingURL=NumberMap.js.map
package/cjs/tools/Rect.js CHANGED
@@ -67,4 +67,4 @@ class Rect {
67
67
  }
68
68
 
69
69
  exports.Rect = Rect;
70
- //# sourceMappingURL=Rect.js.map
70
+ //# sourceMappingURL=Rect.js.map
@@ -3,4 +3,4 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
5
  });
6
- //# sourceMappingURL=base-table.js.map
6
+ //# sourceMappingURL=base-table.js.map
@@ -11,4 +11,4 @@ function(HighlightScope) {
11
11
  HighlightScope.single = "single", HighlightScope.column = "column", HighlightScope.row = "row",
12
12
  HighlightScope.cross = "cross", HighlightScope.none = "none";
13
13
  }(HighlightScope = exports.HighlightScope || (exports.HighlightScope = {}));
14
- //# sourceMappingURL=common.js.map
14
+ //# sourceMappingURL=common.js.map
@@ -3,4 +3,4 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
5
  });
6
- //# sourceMappingURL=customElement.js.map
6
+ //# sourceMappingURL=customElement.js.map
package/dist/vtable.js CHANGED
@@ -40385,11 +40385,21 @@
40385
40385
  }
40386
40386
 
40387
40387
  const DEFAULT_CONTINUOUS_TICK_COUNT = 5;
40388
- function getAxisDomainRangeAndLabels(min, max, axisOption, isZeroAlign, skipTick) {
40388
+ function getAxisDomainRangeAndLabels(min, max, axisOption, isZeroAlign, axisLength, skipTick) {
40389
40389
  if (axisOption?.zero) {
40390
40390
  min = Math.min(min, 0);
40391
40391
  max = Math.max(max, 0);
40392
40392
  }
40393
+ if (axisOption?.expand) {
40394
+ const domainMin = min;
40395
+ const domainMax = max;
40396
+ if (isValid$6(axisOption.expand.min)) {
40397
+ min = domainMin - (domainMax - domainMin) * axisOption.expand.min;
40398
+ }
40399
+ if (isValid$6(axisOption.expand.max)) {
40400
+ max = domainMax + (domainMax - domainMin) * axisOption.expand.max;
40401
+ }
40402
+ }
40393
40403
  if (isNumber$6(axisOption?.min)) {
40394
40404
  min = axisOption.min;
40395
40405
  }
@@ -40411,6 +40421,14 @@
40411
40421
  scale.domain([min, max], !!axisOption?.nice);
40412
40422
  if (axisOption?.nice && !isZeroAlign) {
40413
40423
  let tickCount = axisOption.tick?.forceTickCount ?? axisOption.tick?.tickCount ?? 10;
40424
+ if (isFunction$1(tickCount)) {
40425
+ tickCount = tickCount({
40426
+ axisLength,
40427
+ labelStyle: axisOption?.label?.style ?? {
40428
+ fontSize: THEME_CONSTANTS.LABEL_FONT_SIZE
40429
+ }
40430
+ });
40431
+ }
40414
40432
  if (axisOption.niceType === 'accurateFirst') {
40415
40433
  tickCount = Math.max(10, tickCount);
40416
40434
  }
@@ -40441,6 +40459,7 @@
40441
40459
  if (!layout._table.isPivotChart()) {
40442
40460
  return undefined;
40443
40461
  }
40462
+ const table = layout._table;
40444
40463
  if (layout.indicatorsAsCol) {
40445
40464
  if (layout.hasTwoIndicatorAxes &&
40446
40465
  row === layout.columnHeaderLevelCount - 1 &&
@@ -40460,7 +40479,7 @@
40460
40479
  range.min = range.min < 0 ? -1 : 0;
40461
40480
  range.max = range.max > 0 ? 1 : 0;
40462
40481
  }
40463
- const { range: niceRange, ticks } = getAxisDomainRangeAndLabels(range.min, range.max, axisOption, isZeroAlign);
40482
+ const { range: niceRange, ticks } = getAxisDomainRangeAndLabels(range.min, range.max, axisOption, isZeroAlign, table.getColWidth(col));
40464
40483
  range.min = !isNaN(niceRange[0]) ? niceRange[0] : 0;
40465
40484
  range.max = !isNaN(niceRange[1]) ? niceRange[1] : 1;
40466
40485
  if (isNumber$6(axisOption?.min)) {
@@ -40510,7 +40529,7 @@
40510
40529
  range.min = range.min < 0 ? -1 : 0;
40511
40530
  range.max = range.max > 0 ? 1 : 0;
40512
40531
  }
40513
- const { range: niceRange, ticks } = getAxisDomainRangeAndLabels(range.min, range.max, axisOption, isZeroAlign);
40532
+ const { range: niceRange, ticks } = getAxisDomainRangeAndLabels(range.min, range.max, axisOption, isZeroAlign, table.getColWidth(col));
40514
40533
  range.min = !isNaN(niceRange[0]) ? niceRange[0] : 0;
40515
40534
  range.max = !isNaN(niceRange[1]) ? niceRange[1] : 1;
40516
40535
  if (isNumber$6(axisOption?.min)) {
@@ -40590,7 +40609,7 @@
40590
40609
  range.min = range.min < 0 ? -1 : 0;
40591
40610
  range.max = range.max > 0 ? 1 : 0;
40592
40611
  }
40593
- const { range: niceRange, ticks } = getAxisDomainRangeAndLabels(range.min, range.max, axisOption, isZeroAlign);
40612
+ const { range: niceRange, ticks } = getAxisDomainRangeAndLabels(range.min, range.max, axisOption, isZeroAlign, table.getRowHeight(row));
40594
40613
  range.min = !isNaN(niceRange[0]) ? niceRange[0] : 0;
40595
40614
  range.max = !isNaN(niceRange[1]) ? niceRange[1] : 1;
40596
40615
  if (isNumber$6(axisOption?.min)) {
@@ -40638,7 +40657,7 @@
40638
40657
  range.min = range.min < 0 ? -1 : 0;
40639
40658
  range.max = range.max > 0 ? 1 : 0;
40640
40659
  }
40641
- const { range: niceRange, ticks } = getAxisDomainRangeAndLabels(range.min, range.max, axisOption, isZeroAlign);
40660
+ const { range: niceRange, ticks } = getAxisDomainRangeAndLabels(range.min, range.max, axisOption, isZeroAlign, table.getRowHeight(row));
40642
40661
  range.min = !isNaN(niceRange[0]) ? niceRange[0] : 0;
40643
40662
  range.max = !isNaN(niceRange[1]) ? niceRange[1] : 1;
40644
40663
  if (isNumber$6(axisOption?.min)) {
@@ -41412,9 +41431,6 @@
41412
41431
  let rowStart = 0;
41413
41432
  let rowEnd = 0;
41414
41433
  if (row < scene.table.columnHeaderLevelCount) {
41415
- scene.colHeaderGroup.setAttribute('height', scene.colHeaderGroup.attribute.height + detaY);
41416
- scene.rowHeaderGroup.setAttribute('y', scene.colHeaderGroup.attribute.y + detaY);
41417
- scene.bodyGroup.setAttribute('y', scene.bodyGroup.attribute.y + detaY);
41418
41434
  rowStart = row + 1;
41419
41435
  rowEnd = scene.table.columnHeaderLevelCount - 1;
41420
41436
  }
@@ -54080,7 +54096,7 @@
54080
54096
  return TABLE_EVENT_TYPE;
54081
54097
  }
54082
54098
  options;
54083
- version = "0.13.3";
54099
+ version = "0.13.4-alpha.2";
54084
54100
  pagination;
54085
54101
  id = `VTable${Date.now()}`;
54086
54102
  headerStyleCache;
@@ -56351,6 +56367,7 @@
56351
56367
  }
56352
56368
  function getChartAxes(col, row, layout) {
56353
56369
  const axes = [];
56370
+ const table = layout._table;
56354
56371
  if (layout.indicatorsAsCol) {
56355
56372
  const indicatorKeys = layout.getIndicatorKeyInChartSpec(col, row);
56356
56373
  const colPath = layout.getColKeysPath(col, row);
@@ -56366,7 +56383,7 @@
56366
56383
  range.max = Math.max(range.max, 0);
56367
56384
  }
56368
56385
  if (axisOption?.nice) {
56369
- const { range: axisRange } = getAxisDomainRangeAndLabels(range.min, range.max, axisOption, isZeroAlign);
56386
+ const { range: axisRange } = getAxisDomainRangeAndLabels(range.min, range.max, axisOption, isZeroAlign, table.getColWidth(col));
56370
56387
  range.min = axisRange[0];
56371
56388
  range.max = axisRange[1];
56372
56389
  }
@@ -56427,7 +56444,7 @@
56427
56444
  range.max = Math.max(range.max, 0);
56428
56445
  }
56429
56446
  if (axisOption?.nice) {
56430
- const { range: axisRange } = getAxisDomainRangeAndLabels(range.min, range.max, axisOption, isZeroAlign);
56447
+ const { range: axisRange } = getAxisDomainRangeAndLabels(range.min, range.max, axisOption, isZeroAlign, table.getRowHeight(row));
56431
56448
  range.min = axisRange[0];
56432
56449
  range.max = axisRange[1];
56433
56450
  }
@@ -63965,7 +63982,7 @@
63965
63982
  return new Tag(params ? params.attribute : {});
63966
63983
  }
63967
63984
 
63968
- const version = "0.13.3";
63985
+ const version = "0.13.4-alpha.2";
63969
63986
  function getIcons() {
63970
63987
  return get$1();
63971
63988
  }