@visactor/vtable 0.25.0 → 0.25.1-alpha.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.
package/dist/vtable.js CHANGED
@@ -39873,7 +39873,7 @@
39873
39873
  visible: true,
39874
39874
  text: indicatorInfo?.title
39875
39875
  },
39876
- range: range
39876
+ range
39877
39877
  }, axisOption, {
39878
39878
  orient: 'bottom',
39879
39879
  type: axisOption?.type || 'linear',
@@ -39898,14 +39898,20 @@
39898
39898
  if (axisOption?.visible === false) {
39899
39899
  return;
39900
39900
  }
39901
+ const spec = layout.getRawChartSpec(col + 1, row);
39901
39902
  return merge({
39902
- domain: chartType === 'common' ? Array.from(domain) : Array.from(domain).reverse(),
39903
+ domain: chartType === 'scatter'
39904
+ ? undefined
39905
+ : spec?.series?.length >= 1
39906
+ ? Array.from(domain)
39907
+ : Array.from(domain).reverse(),
39908
+ range: chartType === 'scatter' ? domain : undefined,
39903
39909
  title: {
39904
39910
  autoRotate: true
39905
39911
  }
39906
39912
  }, axisOption, {
39907
39913
  orient: 'left',
39908
- type: 'band',
39914
+ type: chartType === 'scatter' ? axisOption?.type ?? 'linear' : 'band',
39909
39915
  __vtableChartTheme: theme
39910
39916
  });
39911
39917
  }
@@ -40023,15 +40029,16 @@
40023
40029
  const data = layout.dataset.collectedValues[columnDimensionKey] ?? [];
40024
40030
  const colPath = layout.getColKeysPath(col, row);
40025
40031
  const domain = data?.[colPath ?? ''] ?? [];
40026
- const { axisOption, isPercent, theme } = getAxisOption(col, row - 1, 'bottom', layout);
40032
+ const { axisOption, isPercent, theme, chartType } = getAxisOption(col, row - 1, 'bottom', layout);
40027
40033
  if (axisOption?.visible === false) {
40028
40034
  return;
40029
40035
  }
40030
40036
  return merge({
40031
- domain: Array.from(domain)
40037
+ domain: chartType === 'scatter' ? undefined : Array.from(domain),
40038
+ range: chartType === 'scatter' ? domain : undefined
40032
40039
  }, axisOption, {
40033
40040
  orient: 'bottom',
40034
- type: 'band',
40041
+ type: chartType === 'scatter' ? axisOption?.type ?? 'linear' : 'band',
40035
40042
  __vtableChartTheme: theme
40036
40043
  });
40037
40044
  }
@@ -40040,15 +40047,31 @@
40040
40047
  }
40041
40048
  function getAxisOption(col, row, orient, layout) {
40042
40049
  const spec = layout.getRawChartSpec(col, row);
40043
- if (spec && isArray$3(spec.axes)) {
40044
- const axisOption = spec.axes.find((axis) => {
40050
+ const axes = spec.axes ?? [];
40051
+ layout._table.pivotChartAxes.forEach(axis => {
40052
+ const index = axes.findIndex((a) => {
40053
+ return axis.orient === a.orient;
40054
+ });
40055
+ if (index === -1) {
40056
+ axes.push(axis);
40057
+ }
40058
+ });
40059
+ if (spec && isArray$3(axes)) {
40060
+ const axisOption = axes.find((axis) => {
40045
40061
  return axis.orient === orient;
40046
40062
  });
40047
40063
  if (axisOption) {
40048
40064
  const { seriesIndex, seriesId } = axisOption;
40049
40065
  let seriesIndice;
40066
+ let seriesSpec;
40050
40067
  if (isValid$3(seriesId) && isArray$3(spec.series)) {
40051
- seriesIndice = (isArray$3(seriesId) ? seriesId : [seriesId]).map(id => spec.series.findIndex((s) => s.id === id));
40068
+ seriesIndice = (isArray$3(seriesId) ? seriesId : [seriesId]).map(id => {
40069
+ const index = spec.series.findIndex((s) => s.id === id);
40070
+ if (index >= 0) {
40071
+ seriesSpec = spec.series[index];
40072
+ }
40073
+ return index;
40074
+ });
40052
40075
  }
40053
40076
  else if (isValid$3(seriesIndex) && isArray$3(spec.series)) {
40054
40077
  seriesIndice = seriesIndex;
@@ -40059,7 +40082,7 @@
40059
40082
  isZeroAlign: checkZeroAlign(spec, orient, layout),
40060
40083
  seriesIndice,
40061
40084
  theme: spec.theme,
40062
- chartType: spec.type
40085
+ chartType: seriesSpec?.type ?? spec.type
40063
40086
  };
40064
40087
  }
40065
40088
  }
@@ -58017,7 +58040,7 @@
58017
58040
  return TABLE_EVENT_TYPE;
58018
58041
  }
58019
58042
  options;
58020
- version = "0.25.0";
58043
+ version = "0.25.1-alpha.0";
58021
58044
  pagination;
58022
58045
  id = `VTable${Date.now()}`;
58023
58046
  headerStyleCache;
@@ -60869,7 +60892,10 @@
60869
60892
  for (let i = 0; i < layout.indicatorsDefine.length; i++) {
60870
60893
  const columnObj = layout.indicatorsDefine[i];
60871
60894
  if (columnObj.chartSpec) {
60872
- if (columnObj.chartSpec.type !== 'pie' &&
60895
+ if (columnObj.chartSpec.type !== 'wordCloud' &&
60896
+ columnObj.chartSpec.type !== 'radar' &&
60897
+ columnObj.chartSpec.type !== 'gauge' &&
60898
+ columnObj.chartSpec.type !== 'pie' &&
60873
60899
  columnObj.chartSpec.type !== 'funnel' &&
60874
60900
  columnObj.chartSpec.type !== 'rose') {
60875
60901
  isHasCartesianChart = true;
@@ -60883,7 +60909,12 @@
60883
60909
  let isHasCartesianChart = true;
60884
60910
  const chartSpec = layout.getRawChartSpec(col, row);
60885
60911
  if (chartSpec) {
60886
- if (chartSpec.type === 'pie' || chartSpec.type === 'funnel' || chartSpec.type === 'rose') {
60912
+ if (chartSpec.type === 'pie' ||
60913
+ chartSpec.type === 'radar' ||
60914
+ chartSpec.type === 'gauge' ||
60915
+ chartSpec.type === 'wordCloud' ||
60916
+ chartSpec.type === 'funnel' ||
60917
+ chartSpec.type === 'rose') {
60887
60918
  isHasCartesianChart = false;
60888
60919
  }
60889
60920
  }
@@ -60899,6 +60930,9 @@
60899
60930
  const columnObj = layout.indicatorsDefine[i];
60900
60931
  if (columnObj.chartSpec) {
60901
60932
  if (columnObj.chartSpec.type !== 'pie' &&
60933
+ columnObj.chartSpec.type !== 'wordCloud' &&
60934
+ columnObj.chartSpec.type !== 'radar' &&
60935
+ columnObj.chartSpec.type !== 'gauge' &&
60902
60936
  columnObj.chartSpec.type !== 'funnel' &&
60903
60937
  columnObj.chartSpec.type !== 'rose') {
60904
60938
  isHasCartesianChart = true;
@@ -60910,7 +60944,12 @@
60910
60944
  else {
60911
60945
  const chartSpec = layout.getRawChartSpec(col, row);
60912
60946
  if (chartSpec) {
60913
- if (chartSpec.type !== 'pie' && chartSpec.type !== 'funnel' && chartSpec.type !== 'rose') {
60947
+ if (chartSpec.type !== 'pie' &&
60948
+ chartSpec.type !== 'radar' &&
60949
+ chartSpec.type !== 'gauge' &&
60950
+ chartSpec.type !== 'wordCloud' &&
60951
+ chartSpec.type !== 'funnel' &&
60952
+ chartSpec.type !== 'rose') {
60914
60953
  isHasCartesianChart = true;
60915
60954
  }
60916
60955
  }
@@ -60931,7 +60970,9 @@
60931
60970
  serie.sortDataByAxis = true;
60932
60971
  });
60933
60972
  }
60934
- chartSpec.axes = layout.getChartAxes(col, row);
60973
+ if (chartSpec.type !== 'gauge' && chartSpec.type !== 'rose' && chartSpec.type !== 'radar') {
60974
+ chartSpec.axes = layout.getChartAxes(col, row);
60975
+ }
60935
60976
  chartSpec.padding = 0;
60936
60977
  chartSpec.dataZoom = [];
60937
60978
  return chartSpec;
@@ -60985,11 +61026,12 @@
60985
61026
  [];
60986
61027
  const rowPath = layout.getRowKeysPath(col, row);
60987
61028
  const domain = data[rowPath ?? ''];
60988
- const { axisOption, isPercent } = getAxisOption(col, row, 'left', layout);
61029
+ const { axisOption, isPercent, chartType } = getAxisOption(col, row, 'left', layout);
60989
61030
  axes.push(merge({
60990
- domain: Array.from(domain ?? [])
61031
+ domain: chartType === 'scatter' ? undefined : Array.from(domain ?? []),
61032
+ range: chartType === 'scatter' ? domain : undefined
60991
61033
  }, axisOption, {
60992
- type: 'band',
61034
+ type: chartType === 'scatter' ? axisOption?.type ?? 'linear' : 'band',
60993
61035
  orient: 'left',
60994
61036
  label: { visible: false },
60995
61037
  domainLine: { visible: false },
@@ -61041,11 +61083,12 @@
61041
61083
  [];
61042
61084
  const colPath = layout.getColKeysPath(col, row);
61043
61085
  const domain = data?.[colPath ?? ''] ?? [];
61044
- const { axisOption, isPercent } = getAxisOption(col, row, 'bottom', layout);
61086
+ const { axisOption, isPercent, chartType } = getAxisOption(col, row, 'bottom', layout);
61045
61087
  axes.push(merge({
61046
- domain: Array.from(domain)
61088
+ domain: chartType === 'scatter' ? undefined : Array.from(domain ?? []),
61089
+ range: chartType === 'scatter' ? domain : undefined
61047
61090
  }, axisOption, {
61048
- type: 'band',
61091
+ type: chartType === 'scatter' ? axisOption?.type ?? 'linear' : 'band',
61049
61092
  orient: 'bottom',
61050
61093
  visible: true,
61051
61094
  label: { visible: false },
@@ -67395,7 +67438,7 @@
67395
67438
  record[derivedFieldRule.fieldName] = derivedFieldRule.derivedFunc(record);
67396
67439
  });
67397
67440
  for (const field in this.collectValuesBy) {
67398
- if (record[field]) {
67441
+ if (isValid$3(record[field])) {
67399
67442
  if (!this.collectedValues[field]) {
67400
67443
  this.collectedValues[field] = {};
67401
67444
  }
@@ -69738,7 +69781,11 @@
69738
69781
  const collectValuesBy = {};
69739
69782
  for (let i = 0, len = indicators?.length; i < len; i++) {
69740
69783
  if (typeof indicators[i] !== 'string' && indicators[i].chartSpec) {
69741
- if (indicators[i].chartSpec?.type === 'pie') {
69784
+ if (indicators[i].chartSpec?.type === 'pie' ||
69785
+ indicators[i].chartSpec?.type === 'rose' ||
69786
+ indicators[i].chartSpec?.type === 'radar' ||
69787
+ indicators[i].chartSpec?.type === 'gauge' ||
69788
+ indicators[i].chartSpec?.type === 'wordCloud') {
69742
69789
  continue;
69743
69790
  }
69744
69791
  const indicatorDefine = indicators[i];
@@ -69758,7 +69805,7 @@
69758
69805
  collectValuesBy[xField] = {
69759
69806
  by: columnKeys,
69760
69807
  type: chartSeries.direction !== 'horizontal' ? 'xField' : undefined,
69761
- range: chartSeries.direction === 'horizontal',
69808
+ range: chartSeries.type === 'scatter' ? true : chartSeries.direction === 'horizontal',
69762
69809
  sortBy: chartSeries.direction !== 'horizontal'
69763
69810
  ? chartSeries?.data?.fields?.[xField]?.domain ?? indicatorSpec?.data?.fields?.[xField]?.domain
69764
69811
  : undefined
@@ -69769,7 +69816,7 @@
69769
69816
  (chartSeries.stack = true);
69770
69817
  collectValuesBy[yField] = {
69771
69818
  by: rowKeys,
69772
- range: chartSeries.direction !== 'horizontal',
69819
+ range: chartSeries.type === 'scatter' ? true : chartSeries.direction !== 'horizontal',
69773
69820
  sumBy: chartSeries.stack && columnKeys.concat(chartSeries?.xField),
69774
69821
  sortBy: chartSeries.direction === 'horizontal'
69775
69822
  ? chartSeries?.data?.fields?.[yField]?.domain ?? indicatorSpec?.data?.fields?.[yField]?.domain
@@ -69783,7 +69830,7 @@
69783
69830
  collectValuesBy[xField] = {
69784
69831
  by: columnKeys,
69785
69832
  type: indicatorSpec.direction !== 'horizontal' ? 'xField' : undefined,
69786
- range: indicatorSpec.direction === 'horizontal',
69833
+ range: indicatorSpec.type === 'scatter' ? true : indicatorSpec.direction === 'horizontal',
69787
69834
  sortBy: indicatorSpec.direction !== 'horizontal' ? indicatorSpec?.data?.fields?.[xField]?.domain : undefined
69788
69835
  };
69789
69836
  indicatorSpec?.stack !== false &&
@@ -69815,7 +69862,7 @@
69815
69862
  collectValuesBy[yField] = {
69816
69863
  by: rowKeys,
69817
69864
  type: chartSeries.direction === 'horizontal' ? 'yField' : undefined,
69818
- range: chartSeries.direction !== 'horizontal',
69865
+ range: chartSeries.type === 'scatter' ? true : chartSeries.direction !== 'horizontal',
69819
69866
  sortBy: chartSeries.direction === 'horizontal'
69820
69867
  ? chartSeries?.data?.fields?.[yField]?.domain ?? indicatorSpec?.data?.fields?.[yField]?.domain
69821
69868
  : undefined
@@ -69826,7 +69873,7 @@
69826
69873
  (chartSeries.stack = true);
69827
69874
  collectValuesBy[xField] = {
69828
69875
  by: columnKeys,
69829
- range: chartSeries.direction === 'horizontal',
69876
+ range: chartSeries.type === 'scatter' ? true : chartSeries.direction === 'horizontal',
69830
69877
  sumBy: chartSeries.stack && rowKeys.concat(chartSeries?.yField),
69831
69878
  sortBy: chartSeries.direction !== 'horizontal'
69832
69879
  ? chartSeries?.data?.fields?.[xField]?.domain ?? indicatorSpec?.data?.fields?.[xField]?.domain
@@ -69840,7 +69887,7 @@
69840
69887
  collectValuesBy[yField] = {
69841
69888
  by: rowKeys,
69842
69889
  type: indicatorSpec.direction === 'horizontal' ? 'yField' : undefined,
69843
- range: indicatorSpec.direction !== 'horizontal',
69890
+ range: indicatorSpec.type === 'scatter' ? true : indicatorSpec.direction !== 'horizontal',
69844
69891
  sortBy: indicatorSpec.direction === 'horizontal' ? indicatorSpec?.data?.fields?.[yField]?.domain : undefined
69845
69892
  };
69846
69893
  indicatorSpec?.stack !== false &&
@@ -69849,7 +69896,7 @@
69849
69896
  const xField = indicatorSpec.xField;
69850
69897
  collectValuesBy[xField] = {
69851
69898
  by: columnKeys,
69852
- range: indicatorSpec.direction === 'horizontal',
69899
+ range: indicatorSpec.type === 'scatter' ? true : indicatorSpec.direction === 'horizontal',
69853
69900
  sumBy: indicatorSpec.stack && rowKeys.concat(indicatorSpec?.yField),
69854
69901
  sortBy: indicatorSpec.direction !== 'horizontal' ? indicatorSpec?.data?.fields?.[xField]?.domain : undefined,
69855
69902
  extendRange: parseMarkLineGetExtendRange(indicatorSpec.markLine)
@@ -70653,7 +70700,7 @@
70653
70700
  }
70654
70701
 
70655
70702
  registerForVrender();
70656
- const version = "0.25.0";
70703
+ const version = "0.25.1-alpha.0";
70657
70704
  function getIcons() {
70658
70705
  return get$2();
70659
70706
  }