@visactor/vseed 0.4.5 → 0.4.7

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 (128) hide show
  1. package/dist/cjs/index.cjs +2 -2
  2. package/dist/cjs/index.cjs.map +1 -1
  3. package/dist/esm/builder/builder/builder.d.ts +36 -127
  4. package/dist/esm/builder/builder/builder.js +10 -2
  5. package/dist/esm/builder/builder/builder.js.map +1 -1
  6. package/dist/esm/builder/builder/prepare.js +87 -153
  7. package/dist/esm/builder/builder/prepare.js.map +1 -1
  8. package/dist/esm/dataSelector/selector.d.ts +2 -2
  9. package/dist/esm/dataSelector/selector.js.map +1 -1
  10. package/dist/esm/i18n/i18nData.js +28 -0
  11. package/dist/esm/i18n/i18nData.js.map +1 -1
  12. package/dist/esm/pipeline/advanced/chart/pipes/default/defaultMeasures.js.map +1 -1
  13. package/dist/esm/pipeline/advanced/table/pipes/config/pivotTableConfig.js +2 -1
  14. package/dist/esm/pipeline/advanced/table/pipes/config/pivotTableConfig.js.map +1 -1
  15. package/dist/esm/pipeline/advanced/table/pipes/default/defaultMeasures.js.map +1 -1
  16. package/dist/esm/pipeline/spec/chart/pipes/label/label.js +6 -2
  17. package/dist/esm/pipeline/spec/chart/pipes/label/label.js.map +1 -1
  18. package/dist/esm/pipeline/spec/table/pipeline/table.js +2 -1
  19. package/dist/esm/pipeline/spec/table/pipeline/table.js.map +1 -1
  20. package/dist/esm/pipeline/spec/table/pipes/columns/columnsAggregation.d.ts +8 -0
  21. package/dist/esm/pipeline/spec/table/pipes/columns/columnsAggregation.js +76 -0
  22. package/dist/esm/pipeline/spec/table/pipes/columns/columnsAggregation.js.map +1 -0
  23. package/dist/esm/pipeline/spec/table/pipes/columns/dimensionsToColumns.js +1 -27
  24. package/dist/esm/pipeline/spec/table/pipes/columns/dimensionsToColumns.js.map +1 -1
  25. package/dist/esm/pipeline/spec/table/pipes/columns/index.d.ts +1 -0
  26. package/dist/esm/pipeline/spec/table/pipes/columns/index.js +1 -0
  27. package/dist/esm/pipeline/spec/table/pipes/columns/measuresToColumns.js +1 -27
  28. package/dist/esm/pipeline/spec/table/pipes/columns/measuresToColumns.js.map +1 -1
  29. package/dist/esm/pipeline/spec/table/pipes/columns/pivotColumns.js +12 -2
  30. package/dist/esm/pipeline/spec/table/pipes/columns/pivotColumns.js.map +1 -1
  31. package/dist/esm/pipeline/spec/table/pipes/columns/utils.d.ts +15 -0
  32. package/dist/esm/pipeline/spec/table/pipes/columns/utils.js +35 -0
  33. package/dist/esm/pipeline/spec/table/pipes/columns/utils.js.map +1 -0
  34. package/dist/esm/pipeline/spec/table/pipes/indicators/pivotDataConfig.js +39 -4
  35. package/dist/esm/pipeline/spec/table/pipes/indicators/pivotDataConfig.js.map +1 -1
  36. package/dist/esm/types/advancedVSeed.d.ts +2 -1
  37. package/dist/esm/types/advancedVSeed.js +3 -2
  38. package/dist/esm/types/advancedVSeed.js.map +1 -1
  39. package/dist/esm/types/chartType/area/zArea.d.ts +113 -8
  40. package/dist/esm/types/chartType/areaPercent/zAreaPercent.d.ts +113 -8
  41. package/dist/esm/types/chartType/bar/zBar.d.ts +97 -4
  42. package/dist/esm/types/chartType/barParallel/zBarParallel.d.ts +97 -4
  43. package/dist/esm/types/chartType/barPercent/zBarPercent.d.ts +97 -4
  44. package/dist/esm/types/chartType/boxPlot/zBoxPlot.d.ts +89 -2
  45. package/dist/esm/types/chartType/circlePacking/zCirclePacking.d.ts +81 -0
  46. package/dist/esm/types/chartType/column/zColumn.d.ts +97 -4
  47. package/dist/esm/types/chartType/columnParallel/zColumnParallel.d.ts +97 -4
  48. package/dist/esm/types/chartType/columnPercent/zColumnPercent.d.ts +97 -4
  49. package/dist/esm/types/chartType/donut/zDonut.d.ts +81 -0
  50. package/dist/esm/types/chartType/dualAxis/zDualAxis.d.ts +121 -10
  51. package/dist/esm/types/chartType/funnel/zFunnel.d.ts +81 -0
  52. package/dist/esm/types/chartType/heatmap/zHeatmap.d.ts +81 -0
  53. package/dist/esm/types/chartType/histogram/zHistogram.d.ts +97 -4
  54. package/dist/esm/types/chartType/line/zLine.d.ts +105 -6
  55. package/dist/esm/types/chartType/pie/zPie.d.ts +81 -0
  56. package/dist/esm/types/chartType/pivotTable/pivotTable.d.ts +6 -1
  57. package/dist/esm/types/chartType/pivotTable/zPivotTable.d.ts +12 -0
  58. package/dist/esm/types/chartType/pivotTable/zPivotTable.js +2 -1
  59. package/dist/esm/types/chartType/pivotTable/zPivotTable.js.map +1 -1
  60. package/dist/esm/types/chartType/raceBar/zRaceBar.d.ts +97 -4
  61. package/dist/esm/types/chartType/raceColumn/zRaceColumn.d.ts +97 -4
  62. package/dist/esm/types/chartType/raceDonut/zRaceDonut.d.ts +81 -0
  63. package/dist/esm/types/chartType/raceLine/zRaceLine.d.ts +105 -6
  64. package/dist/esm/types/chartType/racePie/zRacePie.d.ts +81 -0
  65. package/dist/esm/types/chartType/raceScatter/zRaceScatter.d.ts +97 -4
  66. package/dist/esm/types/chartType/radar/zRadar.d.ts +81 -0
  67. package/dist/esm/types/chartType/rose/zRose.d.ts +81 -0
  68. package/dist/esm/types/chartType/roseParallel/zRoseParallel.d.ts +81 -0
  69. package/dist/esm/types/chartType/scatter/zScatter.d.ts +97 -4
  70. package/dist/esm/types/chartType/sunburst/zSunburst.d.ts +81 -0
  71. package/dist/esm/types/chartType/table/table.d.ts +11 -1
  72. package/dist/esm/types/chartType/table/zTable.d.ts +7 -0
  73. package/dist/esm/types/chartType/table/zTable.js +2 -1
  74. package/dist/esm/types/chartType/table/zTable.js.map +1 -1
  75. package/dist/esm/types/chartType/treeMap/zTreeMap.d.ts +81 -0
  76. package/dist/esm/types/dataSelector/selector.d.ts +53 -29
  77. package/dist/esm/types/dataSelector/selector.js +1 -1
  78. package/dist/esm/types/dataSelector/selector.js.map +1 -1
  79. package/dist/esm/types/properties/aggregation/aggregation.d.ts +9 -0
  80. package/dist/esm/types/properties/aggregation/aggregation.js +0 -0
  81. package/dist/esm/types/properties/aggregation/index.d.ts +2 -0
  82. package/dist/esm/types/properties/aggregation/index.js +2 -0
  83. package/dist/esm/types/properties/aggregation/zAggregation.d.ts +8 -0
  84. package/dist/esm/types/properties/aggregation/zAggregation.js +11 -0
  85. package/dist/esm/types/properties/aggregation/zAggregation.js.map +1 -0
  86. package/dist/esm/types/properties/annotation/annotation.d.ts +8 -2
  87. package/dist/esm/types/properties/annotation/zAnnotationPoint.d.ts +4 -1
  88. package/dist/esm/types/properties/config/annotation/zAnnotation.d.ts +8 -2
  89. package/dist/esm/types/properties/config/area.d.ts +170 -2
  90. package/dist/esm/types/properties/config/bar.d.ts +255 -3
  91. package/dist/esm/types/properties/config/boxplot.d.ts +85 -1
  92. package/dist/esm/types/properties/config/circlePacking.d.ts +81 -0
  93. package/dist/esm/types/properties/config/column.d.ts +255 -3
  94. package/dist/esm/types/properties/config/config.d.ts +2425 -19
  95. package/dist/esm/types/properties/config/dualAxis.d.ts +85 -1
  96. package/dist/esm/types/properties/config/funnel.d.ts +81 -0
  97. package/dist/esm/types/properties/config/heatmap.d.ts +81 -0
  98. package/dist/esm/types/properties/config/histogram.d.ts +85 -1
  99. package/dist/esm/types/properties/config/label/label.d.ts +18 -1
  100. package/dist/esm/types/properties/config/label/zLabel.d.ts +81 -0
  101. package/dist/esm/types/properties/config/label/zLabel.js +3 -2
  102. package/dist/esm/types/properties/config/label/zLabel.js.map +1 -1
  103. package/dist/esm/types/properties/config/label/zPieLabel.d.ts +81 -0
  104. package/dist/esm/types/properties/config/line.d.ts +85 -1
  105. package/dist/esm/types/properties/config/pie.d.ts +243 -0
  106. package/dist/esm/types/properties/config/race.d.ts +510 -6
  107. package/dist/esm/types/properties/config/rose.d.ts +162 -0
  108. package/dist/esm/types/properties/config/scatter.d.ts +85 -1
  109. package/dist/esm/types/properties/config/sunburst.d.ts +81 -0
  110. package/dist/esm/types/properties/config/treeMap.d.ts +81 -0
  111. package/dist/esm/types/properties/index.d.ts +2 -0
  112. package/dist/esm/types/properties/index.js +2 -0
  113. package/dist/esm/types/properties/markStyle/barStyle.d.ts +4 -1
  114. package/dist/esm/types/properties/markStyle/lineStyle.d.ts +4 -1
  115. package/dist/esm/types/properties/markStyle/markStyle.d.ts +32 -8
  116. package/dist/esm/types/properties/markStyle/pointStyle.d.ts +4 -1
  117. package/dist/esm/types/properties/markStyle/zAreaStyle.d.ts +4 -1
  118. package/dist/esm/types/properties/theme/customTheme.d.ts +4850 -38
  119. package/dist/esm/types/properties/totals/index.d.ts +2 -0
  120. package/dist/esm/types/properties/totals/index.js +2 -0
  121. package/dist/esm/types/properties/totals/totals.d.ts +34 -0
  122. package/dist/esm/types/properties/totals/totals.js +0 -0
  123. package/dist/esm/types/properties/totals/zTotals.d.ts +18 -0
  124. package/dist/esm/types/properties/totals/zTotals.js +13 -0
  125. package/dist/esm/types/properties/totals/zTotals.js.map +1 -0
  126. package/dist/umd/index.js +301 -213
  127. package/dist/umd/index.js.map +1 -1
  128. package/package.json +8 -5
package/dist/umd/index.js CHANGED
@@ -305,6 +305,7 @@
305
305
  zPieLabel: ()=>zPieLabel,
306
306
  zUnfoldInfo: ()=>zUnfoldInfo,
307
307
  zRadarConfig: ()=>zRadarConfig,
308
+ zPivotTableTotals: ()=>zPivotTableTotals,
308
309
  a: ()=>i18n_a,
309
310
  createNumFormatter: ()=>createNumFormatter,
310
311
  HAS_BUILTIN_UTILS: ()=>HAS_BUILTIN_UTILS,
@@ -324,6 +325,7 @@
324
325
  DetailEncoding: ()=>DetailEncoding,
325
326
  isPivot: ()=>chatType_isPivot,
326
327
  raceScatterAdvancedPipeline: ()=>raceScatterAdvancedPipeline,
328
+ zRowOrColumnTotalConfig: ()=>zRowOrColumnTotalConfig,
327
329
  zPlayer: ()=>zPlayer,
328
330
  zPointStyle: ()=>zPointStyle,
329
331
  zDimension: ()=>zDimension,
@@ -349,6 +351,7 @@
349
351
  zBoxPlot: ()=>zBoxPlot,
350
352
  zRaceScatter: ()=>zRaceScatter,
351
353
  registerBarParallel: ()=>registerBarParallel,
354
+ zTotalType: ()=>zTotalType,
352
355
  pivotTableSpecPipeline: ()=>pivotTableSpecPipeline,
353
356
  DUAL_AXIS_LABEL_Z_INDEX: ()=>1002,
354
357
  MeasureEncodingEnum: ()=>MeasureEncodingEnum,
@@ -429,6 +432,34 @@
429
432
  下边界: {
430
433
  'en-US': 'Lower Whisker',
431
434
  'zh-CN': '下边界'
435
+ },
436
+ 总计: {
437
+ 'en-US': 'Total',
438
+ 'zh-CN': '总计'
439
+ },
440
+ 小计: {
441
+ 'en-US': 'Sub Total',
442
+ 'zh-CN': '小计'
443
+ },
444
+ 合计: {
445
+ 'en-US': 'Total',
446
+ 'zh-CN': '合计'
447
+ },
448
+ 平均: {
449
+ 'en-US': 'Average',
450
+ 'zh-CN': '平均'
451
+ },
452
+ 最大值: {
453
+ 'en-US': 'Max',
454
+ 'zh-CN': '最大值'
455
+ },
456
+ 最小值: {
457
+ 'en-US': 'Min',
458
+ 'zh-CN': '最小值'
459
+ },
460
+ 计数: {
461
+ 'en-US': 'Count',
462
+ 'zh-CN': '计数'
432
463
  }
433
464
  };
434
465
  class i18n_Intl {
@@ -1805,82 +1836,93 @@ self.R = R;
1805
1836
  }
1806
1837
  return defaultSelector ? selector_selector(vchartDatum, defaultSelector) : false;
1807
1838
  };
1839
+ const dynamicFilterConfig = {
1840
+ table: [
1841
+ 'bodyCellStyle'
1842
+ ],
1843
+ pivotTable: [
1844
+ 'bodyCellStyle'
1845
+ ],
1846
+ bar: [
1847
+ 'barStyle',
1848
+ 'annotationPoint',
1849
+ 'annotationVerticalLine',
1850
+ 'label'
1851
+ ],
1852
+ barParallel: [
1853
+ 'barStyle',
1854
+ 'annotationPoint',
1855
+ 'annotationVerticalLine',
1856
+ 'label'
1857
+ ],
1858
+ barPercent: [
1859
+ 'barStyle',
1860
+ 'annotationPoint',
1861
+ 'annotationVerticalLine',
1862
+ 'label'
1863
+ ],
1864
+ column: [
1865
+ 'barStyle',
1866
+ 'annotationPoint',
1867
+ 'annotationHorizontalLine',
1868
+ 'label'
1869
+ ],
1870
+ columnParallel: [
1871
+ 'barStyle',
1872
+ 'annotationPoint',
1873
+ 'annotationHorizontalLine',
1874
+ 'label'
1875
+ ],
1876
+ columnPercent: [
1877
+ 'barStyle',
1878
+ 'annotationPoint',
1879
+ 'annotationHorizontalLine',
1880
+ 'label'
1881
+ ],
1882
+ line: [
1883
+ 'lineStyle',
1884
+ 'pointStyle',
1885
+ 'annotationPoint',
1886
+ 'annotationHorizontalLine',
1887
+ 'label'
1888
+ ],
1889
+ area: [
1890
+ 'lineStyle',
1891
+ 'pointStyle',
1892
+ 'annotationPoint',
1893
+ 'annotationHorizontalLine',
1894
+ 'label'
1895
+ ],
1896
+ areaPercent: [
1897
+ 'lineStyle',
1898
+ 'pointStyle',
1899
+ 'annotationPoint',
1900
+ 'annotationHorizontalLine',
1901
+ 'label'
1902
+ ],
1903
+ dualAxis: [
1904
+ 'barStyle',
1905
+ 'lineStyle',
1906
+ 'pointStyle',
1907
+ 'annotationPoint',
1908
+ 'annotationHorizontalLine',
1909
+ 'label'
1910
+ ],
1911
+ scatter: [
1912
+ 'pointStyle',
1913
+ 'annotationPoint',
1914
+ 'annotationHorizontalLine',
1915
+ 'annotationVerticalLine',
1916
+ 'label'
1917
+ ],
1918
+ histogram: [
1919
+ 'annotationHorizontalLine'
1920
+ ],
1921
+ boxPlot: [
1922
+ 'annotationHorizontalLine'
1923
+ ]
1924
+ };
1808
1925
  const generateDynamicFilterKeyPaths = ()=>{
1809
- const dynamicFilterConfig = {
1810
- table: [
1811
- 'bodyCellStyle'
1812
- ],
1813
- pivotTable: [
1814
- 'bodyCellStyle'
1815
- ],
1816
- bar: [
1817
- 'barStyle',
1818
- 'annotationPoint',
1819
- 'annotationVerticalLine'
1820
- ],
1821
- barParallel: [
1822
- 'barStyle',
1823
- 'annotationPoint',
1824
- 'annotationVerticalLine'
1825
- ],
1826
- barPercent: [
1827
- 'barStyle',
1828
- 'annotationPoint',
1829
- 'annotationVerticalLine'
1830
- ],
1831
- column: [
1832
- 'barStyle',
1833
- 'annotationPoint',
1834
- 'annotationHorizontalLine'
1835
- ],
1836
- columnParallel: [
1837
- 'barStyle',
1838
- 'annotationPoint',
1839
- 'annotationHorizontalLine'
1840
- ],
1841
- columnPercent: [
1842
- 'barStyle',
1843
- 'annotationPoint',
1844
- 'annotationHorizontalLine'
1845
- ],
1846
- line: [
1847
- 'lineStyle',
1848
- 'pointStyle',
1849
- 'annotationPoint',
1850
- 'annotationHorizontalLine'
1851
- ],
1852
- area: [
1853
- 'lineStyle',
1854
- 'pointStyle',
1855
- 'annotationPoint',
1856
- 'annotationHorizontalLine'
1857
- ],
1858
- areaPercent: [
1859
- 'lineStyle',
1860
- 'pointStyle',
1861
- 'annotationPoint',
1862
- 'annotationHorizontalLine'
1863
- ],
1864
- dualAxis: [
1865
- 'barStyle',
1866
- 'lineStyle',
1867
- 'pointStyle',
1868
- 'annotationPoint',
1869
- 'annotationHorizontalLine'
1870
- ],
1871
- scatter: [
1872
- 'pointStyle',
1873
- 'annotationPoint',
1874
- 'annotationHorizontalLine',
1875
- 'annotationVerticalLine'
1876
- ],
1877
- histogram: [
1878
- 'annotationHorizontalLine'
1879
- ],
1880
- boxPlot: [
1881
- 'annotationHorizontalLine'
1882
- ]
1883
- };
1884
1926
  const result = {};
1885
1927
  for (const [chartType, baseKeyPaths] of Object.entries(dynamicFilterConfig))result[chartType] = baseKeyPaths.flatMap((basePath)=>[
1886
1928
  `${basePath}[].dynamicFilter`,
@@ -1889,84 +1931,7 @@ self.R = R;
1889
1931
  return result;
1890
1932
  };
1891
1933
  const dynamicFilterKeyPathsByChartType = generateDynamicFilterKeyPaths();
1892
- const getBasePathsForDeepClone = (chartType)=>{
1893
- const config = {
1894
- table: [
1895
- 'bodyCellStyle'
1896
- ],
1897
- pivotTable: [
1898
- 'bodyCellStyle'
1899
- ],
1900
- bar: [
1901
- 'barStyle',
1902
- 'annotationPoint',
1903
- 'annotationVerticalLine'
1904
- ],
1905
- barParallel: [
1906
- 'barStyle',
1907
- 'annotationPoint',
1908
- 'annotationVerticalLine'
1909
- ],
1910
- barPercent: [
1911
- 'barStyle',
1912
- 'annotationPoint',
1913
- 'annotationVerticalLine'
1914
- ],
1915
- column: [
1916
- 'barStyle',
1917
- 'annotationPoint',
1918
- 'annotationHorizontalLine'
1919
- ],
1920
- columnParallel: [
1921
- 'barStyle',
1922
- 'annotationPoint',
1923
- 'annotationHorizontalLine'
1924
- ],
1925
- columnPercent: [
1926
- 'barStyle',
1927
- 'annotationPoint',
1928
- 'annotationHorizontalLine'
1929
- ],
1930
- line: [
1931
- 'lineStyle',
1932
- 'pointStyle',
1933
- 'annotationPoint',
1934
- 'annotationHorizontalLine'
1935
- ],
1936
- area: [
1937
- 'lineStyle',
1938
- 'pointStyle',
1939
- 'annotationPoint',
1940
- 'annotationHorizontalLine'
1941
- ],
1942
- areaPercent: [
1943
- 'lineStyle',
1944
- 'pointStyle',
1945
- 'annotationPoint',
1946
- 'annotationHorizontalLine'
1947
- ],
1948
- dualAxis: [
1949
- 'barStyle',
1950
- 'lineStyle',
1951
- 'pointStyle',
1952
- 'annotationPoint',
1953
- 'annotationHorizontalLine'
1954
- ],
1955
- scatter: [
1956
- 'pointStyle',
1957
- 'annotationPoint',
1958
- 'annotationHorizontalLine',
1959
- 'annotationVerticalLine'
1960
- ],
1961
- histogram: [
1962
- 'annotationHorizontalLine'
1963
- ],
1964
- boxPlot: [
1965
- 'annotationHorizontalLine'
1966
- ]
1967
- };
1968
- return config[chartType] ?? [];
1969
- };
1934
+ const getBasePathsForDeepClone = (chartType)=>dynamicFilterConfig[chartType] ?? [];
1970
1935
  const parseKeyPath = (path)=>path.split('.').map((segment)=>{
1971
1936
  if (segment.endsWith('[]')) return {
1972
1937
  key: segment.slice(0, -2),
@@ -2390,13 +2355,21 @@ self.R = R;
2390
2355
  }
2391
2356
  static getAdvancedPipeline = (chartType)=>{
2392
2357
  const customPipe = Builder._customAdvancedPipe[chartType];
2393
- const pipeline = Builder._advancedPipelineMap[chartType];
2358
+ const originalPipeline = Builder._advancedPipelineMap[chartType];
2359
+ if (!originalPipeline) return originalPipeline;
2360
+ const pipeline = [
2361
+ ...originalPipeline
2362
+ ];
2394
2363
  if (customPipe) pipeline.push(customPipe);
2395
2364
  return pipeline;
2396
2365
  };
2397
2366
  static getSpecPipeline = (chartType)=>{
2398
2367
  const customPipe = Builder._customSpecPipe[chartType];
2399
- const pipeline = Builder._specPipelineMap[chartType];
2368
+ const originalPipeline = Builder._specPipelineMap[chartType];
2369
+ if (!originalPipeline) return originalPipeline;
2370
+ const pipeline = [
2371
+ ...originalPipeline
2372
+ ];
2400
2373
  if (customPipe) pipeline.push(customPipe);
2401
2374
  return pipeline;
2402
2375
  };
@@ -2801,27 +2774,10 @@ self.R = R;
2801
2774
  }
2802
2775
  };
2803
2776
  };
2804
- const dimensionTreeToColumns = (spec, context)=>{
2805
- const { advancedVSeed } = context;
2806
- const dimensionTree = advancedVSeed.dimensionTree;
2807
- const result = {
2808
- ...spec
2809
- };
2810
- const eachNode = (node)=>{
2811
- if (isMeasure(node)) return {
2812
- width: 'auto'
2813
- };
2814
- return {};
2815
- };
2816
- const columns = treeTreeToColumns(dimensionTree, eachNode);
2817
- return {
2818
- ...result,
2819
- columns: [
2820
- ...result.columns || [],
2821
- ...columns
2822
- ]
2823
- };
2824
- };
2777
+ function extractLeafIds(tree) {
2778
+ const leafNodes = findTreeNodesBy(tree, ()=>true);
2779
+ return new Set(leafNodes.map((node)=>node.id));
2780
+ }
2825
2781
  const treeTreeToColumns = (tree, callback)=>{
2826
2782
  const result = tree.map((item)=>{
2827
2783
  if ('children' in item && Array.isArray(item.children)) {
@@ -2849,6 +2805,27 @@ self.R = R;
2849
2805
  });
2850
2806
  return result || [];
2851
2807
  };
2808
+ const dimensionTreeToColumns = (spec, context)=>{
2809
+ const { advancedVSeed } = context;
2810
+ const dimensionTree = advancedVSeed.dimensionTree;
2811
+ const result = {
2812
+ ...spec
2813
+ };
2814
+ const eachNode = (node)=>{
2815
+ if (isMeasure(node)) return {
2816
+ width: 'auto'
2817
+ };
2818
+ return {};
2819
+ };
2820
+ const columns = treeTreeToColumns(dimensionTree, eachNode);
2821
+ return {
2822
+ ...result,
2823
+ columns: [
2824
+ ...result.columns || [],
2825
+ ...columns
2826
+ ]
2827
+ };
2828
+ };
2852
2829
  const createNumFormatter = (format, locale = intl.getLocale())=>{
2853
2830
  const { type = 'number', ratio = 1, thousandSeparator = true, prefix = '', suffix = '', symbol = '', fractionDigits = 2, significantDigits, roundingMode = 'halfExpand', roundingPriority = 'auto' } = format || {};
2854
2831
  const numFormatterOptions = {
@@ -2934,7 +2911,7 @@ self.R = R;
2934
2911
  };
2935
2912
  return {};
2936
2913
  };
2937
- const columns = measuresToColumns_treeTreeToColumns(measureTree, eachNode);
2914
+ const columns = treeTreeToColumns(measureTree, eachNode);
2938
2915
  return {
2939
2916
  ...result,
2940
2917
  columns: [
@@ -2951,32 +2928,75 @@ self.R = R;
2951
2928
  return formatter(value);
2952
2929
  };
2953
2930
  };
2954
- const measuresToColumns_treeTreeToColumns = (tree, callback)=>{
2955
- const result = tree.map((item)=>{
2956
- if ('children' in item && Array.isArray(item.children)) {
2957
- const groupNode = item;
2958
- const field = groupNode.id;
2959
- const title = groupNode.alias ?? groupNode.id;
2960
- const props = callback?.(groupNode) || {};
2931
+ const columnsAggregation = (spec, context)=>{
2932
+ const { vseed, advancedVSeed } = context;
2933
+ const { totals } = vseed;
2934
+ if (!totals) return spec;
2935
+ const totalLabelMap = {
2936
+ sum: intl.i18n`合计`,
2937
+ avg: intl.i18n`平均`,
2938
+ max: intl.i18n`最大值`,
2939
+ min: intl.i18n`最小值`,
2940
+ count: intl.i18n`计数`
2941
+ };
2942
+ const totalLabel = totalLabelMap[totals] || intl.i18n`合计`;
2943
+ const vtableAggregationMap = {
2944
+ sum: 'SUM',
2945
+ avg: 'AVG',
2946
+ max: 'MAX',
2947
+ min: 'MIN',
2948
+ count: 'COUNT'
2949
+ };
2950
+ const vtableAggregationType = vtableAggregationMap[totals] || 'SUM';
2951
+ const dimensionIds = extractLeafIds(advancedVSeed.dimensionTree || []);
2952
+ const measureTree = advancedVSeed.measureTree || [];
2953
+ const measureIds = extractLeafIds(measureTree);
2954
+ const leafMeasures = findTreeNodesBy(measureTree, ()=>true);
2955
+ const measureMap = new Map();
2956
+ leafMeasures.forEach((node)=>{
2957
+ if (isMeasure(node)) measureMap.set(node.id, node);
2958
+ });
2959
+ let isFirstDimensionColumn = true;
2960
+ const updatedColumns = spec.columns?.map((column)=>{
2961
+ const fieldKey = column.field;
2962
+ if (dimensionIds.has(fieldKey)) {
2963
+ if (isFirstDimensionColumn) {
2964
+ isFirstDimensionColumn = false;
2965
+ return {
2966
+ ...column,
2967
+ aggregation: {
2968
+ aggregationType: 'NONE',
2969
+ formatFun: ()=>totalLabel
2970
+ }
2971
+ };
2972
+ }
2961
2973
  return {
2962
- field,
2963
- title,
2964
- columns: measuresToColumns_treeTreeToColumns(item.children, callback),
2965
- ...props
2974
+ ...column,
2975
+ aggregation: {
2976
+ aggregationType: 'NONE',
2977
+ formatFun: ()=>''
2978
+ }
2966
2979
  };
2967
2980
  }
2968
- {
2969
- const field = item.id;
2970
- const title = item.alias ?? item.id;
2971
- const props = callback?.(item) || {};
2981
+ if (measureIds.has(fieldKey)) {
2982
+ const measure = measureMap.get(fieldKey);
2983
+ const formatter = createFormatterByMeasure(measure);
2972
2984
  return {
2973
- field,
2974
- title,
2975
- ...props
2985
+ ...column,
2986
+ aggregation: {
2987
+ aggregationType: vtableAggregationType,
2988
+ showOnTop: false,
2989
+ formatFun: (value)=>formatter(value)
2990
+ }
2976
2991
  };
2977
2992
  }
2993
+ return column;
2978
2994
  });
2979
- return result || [];
2995
+ return {
2996
+ ...spec,
2997
+ columns: updatedColumns,
2998
+ bottomFrozenRowCount: 1
2999
+ };
2980
3000
  };
2981
3001
  const bodyStyle = (spec, context)=>{
2982
3002
  const result = {
@@ -3190,6 +3210,7 @@ self.R = R;
3190
3210
  initTable,
3191
3211
  dimensionTreeToColumns,
3192
3212
  measureTreeToColumns,
3213
+ columnsAggregation,
3193
3214
  bodyStyle,
3194
3215
  headerStyle,
3195
3216
  tableThemeStyle,
@@ -3360,7 +3381,8 @@ self.R = R;
3360
3381
  'hoverHeaderBackgroundColor',
3361
3382
  'hoverHeaderInlineBackgroundColor',
3362
3383
  'selectedBorderColor',
3363
- 'selectedBackgroundColor'
3384
+ 'selectedBackgroundColor',
3385
+ 'totals'
3364
3386
  ]);
3365
3387
  result.config = {
3366
3388
  ...result.config || {},
@@ -3432,13 +3454,21 @@ self.R = R;
3432
3454
  const { encoding } = advancedVSeed;
3433
3455
  const dimensions = advancedVSeed.dimensionTree;
3434
3456
  const columns = dimensions.filter((item)=>encoding.column?.includes(item.id));
3457
+ const allMeasures = findAllMeasures(advancedVSeed.measureTree);
3435
3458
  return {
3436
3459
  ...spec,
3437
- columns: columns.map((item)=>({
3460
+ columns: columns.map((item)=>{
3461
+ const res = {
3438
3462
  dimensionKey: item.id,
3439
3463
  title: item.alias || item.id,
3440
3464
  width: 'auto'
3441
- }))
3465
+ };
3466
+ if (item.id === MeasureId) res.headerFormat = (measureId)=>{
3467
+ const measure = allMeasures.find((m)=>m.id === measureId);
3468
+ return measure?.alias ?? measureId;
3469
+ };
3470
+ return res;
3471
+ })
3442
3472
  };
3443
3473
  };
3444
3474
  const pivotRows = (spec, context)=>{
@@ -3660,18 +3690,52 @@ self.R = R;
3660
3690
  };
3661
3691
  };
3662
3692
  const dataConfig = (spec, context)=>{
3663
- const { advancedVSeed } = context;
3693
+ const { advancedVSeed, vseed } = context;
3664
3694
  const measures = findAllMeasures(advancedVSeed.measureTree);
3665
3695
  const aggregationRules = measures.map((measure)=>({
3666
3696
  field: measure.id,
3667
3697
  aggregationType: 'NONE',
3668
3698
  indicatorKey: measure.id
3669
3699
  }));
3700
+ const dataConfigObj = {
3701
+ aggregationRules
3702
+ };
3703
+ const { totals } = vseed;
3704
+ if (totals) {
3705
+ const grandTotalLabel = intl.i18n`总计`;
3706
+ const subTotalLabel = intl.i18n`小计`;
3707
+ const dimensionIds = (advancedVSeed.dimensionTree || []).map((dim)=>dim.id);
3708
+ dataConfigObj.totals = {};
3709
+ if (totals.row) {
3710
+ const rowSubDimensions = totals.row.subTotalsDimensions?.filter((dim)=>dimensionIds.includes(dim));
3711
+ const normalizedRowSubDimensions = totals.row.showSubTotals && (!rowSubDimensions || 0 === rowSubDimensions.length) ? dimensionIds.length > 0 ? [
3712
+ dimensionIds[0]
3713
+ ] : [] : rowSubDimensions;
3714
+ dataConfigObj.totals.row = {
3715
+ showGrandTotals: totals.row.showGrandTotals ?? false,
3716
+ showSubTotals: totals.row.showSubTotals ?? false,
3717
+ subTotalsDimensions: normalizedRowSubDimensions,
3718
+ grandTotalLabel,
3719
+ subTotalLabel
3720
+ };
3721
+ }
3722
+ if (totals.column) {
3723
+ const columnSubDimensions = totals.column.subTotalsDimensions?.filter((dim)=>dimensionIds.includes(dim));
3724
+ const normalizedColumnSubDimensions = totals.column.showSubTotals && (!columnSubDimensions || 0 === columnSubDimensions.length) ? dimensionIds.length > 0 ? [
3725
+ dimensionIds[0]
3726
+ ] : [] : columnSubDimensions;
3727
+ dataConfigObj.totals.column = {
3728
+ showGrandTotals: totals.column.showGrandTotals ?? false,
3729
+ showSubTotals: totals.column.showSubTotals ?? false,
3730
+ subTotalsDimensions: normalizedColumnSubDimensions,
3731
+ grandTotalLabel,
3732
+ subTotalLabel
3733
+ };
3734
+ }
3735
+ }
3670
3736
  return {
3671
3737
  ...spec,
3672
- dataConfig: {
3673
- aggregationRules
3674
- }
3738
+ dataConfig: dataConfigObj
3675
3739
  };
3676
3740
  };
3677
3741
  const pivotTableSpecPipeline = [
@@ -5199,7 +5263,11 @@ self.R = R;
5199
5263
  const percentFormatter = createFormatter(percentFormat);
5200
5264
  const result = {
5201
5265
  visible: enable,
5202
- dataFilter: (data)=>data.filter((entry)=>entry.data?.[DATUM_HIDE_KEY] !== true && selector_selector(entry.data, label.selector, 'Or')),
5266
+ dataFilter: (data)=>data.filter((entry)=>{
5267
+ if (entry.data?.[DATUM_HIDE_KEY]) return false;
5268
+ const shouldApply = label.dynamicFilter ? selectorWithDynamicFilter(entry.data, label.dynamicFilter, label.selector) : selector_selector(entry.data, label.selector, 'Or');
5269
+ return shouldApply;
5270
+ }),
5203
5271
  formatMethod: (_, datum)=>{
5204
5272
  const result = [];
5205
5273
  const dimLabels = labelDims.map((item)=>{
@@ -8222,7 +8290,7 @@ self.R = R;
8222
8290
  });
8223
8291
  return result;
8224
8292
  };
8225
- const column = [
8293
+ const column_column = [
8226
8294
  initColumn,
8227
8295
  stackCornerRadius_stackCornerRadius,
8228
8296
  barMaxWidth_barMaxWidth,
@@ -8279,7 +8347,7 @@ self.R = R;
8279
8347
  dimensionLinkage
8280
8348
  ];
8281
8349
  const columnSpecPipeline = [
8282
- pivotAdapter_pivotAdapter(column, pivotColumn)
8350
+ pivotAdapter_pivotAdapter(column_column, pivotColumn)
8283
8351
  ];
8284
8352
  const registerColumn = ()=>{
8285
8353
  Builder.registerAdvancedPipeline('column', columnAdvancedPipeline);
@@ -12900,21 +12968,21 @@ self.R = R;
12900
12968
  };
12901
12969
  const isObjectLike = (value)=>"object" == typeof value && null !== value;
12902
12970
  const common_isObjectLike = isObjectLike;
12903
- const isPlainObject_isPlainObject = function(value) {
12971
+ const isPlainObject = function(value) {
12904
12972
  if (!common_isObjectLike(value) || !isType(value, "Object")) return !1;
12905
12973
  if (null === Object.getPrototypeOf(value)) return !0;
12906
12974
  let proto = value;
12907
12975
  for(; null !== Object.getPrototypeOf(proto);)proto = Object.getPrototypeOf(proto);
12908
12976
  return Object.getPrototypeOf(value) === proto;
12909
12977
  };
12910
- const isPlainObject = isPlainObject_isPlainObject;
12978
+ const common_isPlainObject = isPlainObject;
12911
12979
  const isString = (value, fuzzy = !1)=>{
12912
12980
  const type = typeof value;
12913
12981
  return fuzzy ? "string" === type : "string" === type || isType(value, "String");
12914
12982
  };
12915
12983
  const common_isString = isString;
12916
12984
  function pickWithout(obj, keys) {
12917
- if (!obj || !isPlainObject(obj)) return obj;
12985
+ if (!obj || !common_isPlainObject(obj)) return obj;
12918
12986
  const result = {};
12919
12987
  return Object.keys(obj).forEach((k)=>{
12920
12988
  const v = obj[k];
@@ -15250,7 +15318,7 @@ self.R = R;
15250
15318
  const length = objValue.length;
15251
15319
  for(; ++index < length;)newValue[index] = objValue[index];
15252
15320
  }
15253
- } else isPlainObject(srcValue) ? (newValue = null != objValue ? objValue : {}, "function" != typeof objValue && "object" == typeof objValue || (newValue = {})) : isCommon = !1;
15321
+ } else common_isPlainObject(srcValue) ? (newValue = null != objValue ? objValue : {}, "function" != typeof objValue && "object" == typeof objValue || (newValue = {})) : isCommon = !1;
15254
15322
  isCommon && baseMerge(newValue, srcValue, shallowArray, skipTargetArray), assignMergeValue(target, key, newValue);
15255
15323
  }
15256
15324
  function assignMergeValue(target, key, value) {
@@ -23086,7 +23154,7 @@ self.R = R;
23086
23154
  ]).optional(),
23087
23155
  result: schemas_object({
23088
23156
  success: schemas_boolean(),
23089
- data: schemas_array(record(schemas_string(), any())).optional()
23157
+ data: schemas_array(zCellSelector).optional()
23090
23158
  }).optional()
23091
23159
  });
23092
23160
  const zValueDynamicFilter = schemas_object({
@@ -23127,7 +23195,8 @@ self.R = R;
23127
23195
  selector: union([
23128
23196
  zSelector,
23129
23197
  zSelectors
23130
- ]).nullish()
23198
+ ]).nullish(),
23199
+ dynamicFilter: zChartDynamicFilter.optional()
23131
23200
  });
23132
23201
  const zLegend = schemas_object({
23133
23202
  enable: schemas_boolean().default(true).nullish(),
@@ -23985,6 +24054,22 @@ self.R = R;
23985
24054
  field: schemas_string(),
23986
24055
  currentValue: schemas_string()
23987
24056
  });
24057
+ const zRowOrColumnTotalConfig = schemas_object({
24058
+ showGrandTotals: schemas_boolean().optional(),
24059
+ showSubTotals: schemas_boolean().optional(),
24060
+ subTotalsDimensions: schemas_array(schemas_string()).optional()
24061
+ });
24062
+ const zPivotTableTotals = schemas_object({
24063
+ row: zRowOrColumnTotalConfig.optional(),
24064
+ column: zRowOrColumnTotalConfig.optional()
24065
+ });
24066
+ const zTotalType = schemas_enum([
24067
+ 'sum',
24068
+ 'avg',
24069
+ 'max',
24070
+ 'min',
24071
+ 'count'
24072
+ ]);
23988
24073
  const zLocale = schemas_enum([
23989
24074
  'zh-CN',
23990
24075
  'en-US'
@@ -24010,6 +24095,7 @@ self.R = R;
24010
24095
  selectedBorderColor: schemas_string().nullish(),
24011
24096
  selectedBackgroundColor: schemas_string().nullish(),
24012
24097
  bodyCellStyle: schemas_array(zBodyCellStyle).or(zBodyCellStyle).nullish(),
24098
+ totals: zTotalType.nullish(),
24013
24099
  theme: zTheme.nullish(),
24014
24100
  locale: zLocale.nullish()
24015
24101
  });
@@ -24034,6 +24120,7 @@ self.R = R;
24034
24120
  selectedBorderColor: schemas_string().nullish(),
24035
24121
  selectedBackgroundColor: schemas_string().nullish(),
24036
24122
  bodyCellStyle: schemas_array(zBodyCellStyle).or(zBodyCellStyle).nullish(),
24123
+ totals: zPivotTableTotals.nullish(),
24037
24124
  theme: zTheme.nullish(),
24038
24125
  locale: zLocale.nullish()
24039
24126
  });
@@ -24772,7 +24859,8 @@ self.R = R;
24772
24859
  customTheme: zCustomThemeConfig,
24773
24860
  annotation: zAnnotation,
24774
24861
  locale: zLocale,
24775
- regressionLine: zRegressionLine
24862
+ regressionLine: zRegressionLine,
24863
+ totals: zPivotTableTotals.optional()
24776
24864
  });
24777
24865
  const i18n_a = 123;
24778
24866
  return __webpack_exports__;