@visactor/vseed 0.0.8 → 0.0.9

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 (36) hide show
  1. package/dist/builder/builder/builder.d.ts +137 -0
  2. package/dist/dataReshape/constant.d.ts +1 -0
  3. package/dist/dataSelector/index.d.ts +1 -0
  4. package/dist/dataSelector/selector.d.ts +7 -0
  5. package/dist/index.cjs +495 -79
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.js +488 -81
  8. package/dist/index.js.map +1 -1
  9. package/dist/pipeline/advanced/pipes/index.d.ts +1 -0
  10. package/dist/pipeline/advanced/pipes/markStyle/index.d.ts +1 -0
  11. package/dist/pipeline/advanced/pipes/markStyle/markStyle.d.ts +2 -0
  12. package/dist/pipeline/spec/pipes/index.d.ts +1 -0
  13. package/dist/pipeline/spec/pipes/legend/{pivotLegend.d.ts → discreteLegend.d.ts} +1 -1
  14. package/dist/pipeline/spec/pipes/legend/index.d.ts +2 -2
  15. package/dist/pipeline/spec/pipes/legend/pivotDiscreteLegend.d.ts +2 -0
  16. package/dist/pipeline/spec/pipes/{legend/legend.d.ts → markStyle/barStyle.d.ts} +1 -1
  17. package/dist/pipeline/spec/pipes/markStyle/index.d.ts +1 -0
  18. package/dist/pipeline/spec/pipes/stack/index.d.ts +1 -1
  19. package/dist/pipeline/spec/pipes/stack/stack.d.ts +2 -2
  20. package/dist/types/advancedVSeed.d.ts +129 -0
  21. package/dist/types/chartType/bar/bar.d.ts +10 -1
  22. package/dist/types/chartType/barParallel/barParallel.d.ts +10 -1
  23. package/dist/types/chartType/barPercent/barPercent.d.ts +10 -1
  24. package/dist/types/chartType/column/column.d.ts +10 -1
  25. package/dist/types/chartType/columnParallel/columnParallel.d.ts +10 -1
  26. package/dist/types/chartType/columnPercent/columnPercent.d.ts +10 -1
  27. package/dist/types/dataSelector/index.d.ts +1 -0
  28. package/dist/types/dataSelector/selector.d.ts +34 -0
  29. package/dist/types/properties/baseConfig/baseConfig.d.ts +102 -0
  30. package/dist/types/properties/baseConfig/legend.d.ts +101 -4
  31. package/dist/types/properties/index.d.ts +1 -0
  32. package/dist/types/properties/markStyle/barStyle.d.ts +114 -0
  33. package/dist/types/properties/markStyle/index.d.ts +2 -0
  34. package/dist/types/properties/markStyle/markStyle.d.ts +29 -0
  35. package/dist/types/properties/theme/customTheme.d.ts +102 -0
  36. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { clone as external_remeda_clone, mergeDeep as external_remeda_mergeDeep, pick as external_remeda_pick, unique } from "remeda";
1
+ import { clone as external_remeda_clone, mergeDeep as external_remeda_mergeDeep, omit, pick as external_remeda_pick, unique } from "remeda";
2
2
  import { z } from "zod";
3
3
  const initAdvancedVSeed = (advancedVSeed, context)=>{
4
4
  const { vseed } = context;
@@ -128,6 +128,7 @@ const FoldMeasureValue = '__MeaValue__';
128
128
  const FoldMeasureId = '__MeaId__';
129
129
  const UnfoldDimensionGroup = '__DimGroup__';
130
130
  const Separator = '-';
131
+ const ORIGINAL_DATA = '__OriginalData__';
131
132
  const unfoldDimensions = (dataset, dimensions, measures, unfoldStartIndex = 0, foldGroupName = UnfoldDimensionGroup, dimensionsSeparator = Separator)=>{
132
133
  if (unfoldStartIndex < 0 || unfoldStartIndex >= dimensions.length) throw new Error('unfoldStartIndex is out of range');
133
134
  const dimensionsToBeUnfolded = dimensions.slice(unfoldStartIndex);
@@ -165,12 +166,15 @@ const foldMeasures = (dataset, measures, measureId = FoldMeasureId, measureName
165
166
  };
166
167
  const result = new Array(dataset.length * measures.length);
167
168
  let index = 0;
169
+ const ids = measures.map((d)=>d.id);
168
170
  for(let i = 0; i < dataset.length; i++)for(let j = 0; j < measures.length; j++){
169
- const datum = {
171
+ const datum = omit({
170
172
  ...dataset[i]
171
- };
173
+ }, ids);
174
+ datum[ORIGINAL_DATA] = dataset[i];
172
175
  const measure = measures[j];
173
176
  const { id, alias } = measure;
177
+ datum[id] = dataset[i][id];
174
178
  datum[measureId] = id;
175
179
  datum[measureName] = alias;
176
180
  datum[measureValue] = dataset[i][id];
@@ -433,15 +437,16 @@ const encodingXY = (advancedVSeed)=>{
433
437
  if (!datasetReshapeInfo || !dimensions) return result;
434
438
  const encoding = datasetReshapeInfo.reduce((prev, cur)=>{
435
439
  const { foldInfo, unfoldInfo } = cur;
436
- const isSingleDimension = 0 === dimensions.length;
440
+ const isSingleDimension = 1 === dimensions.length;
441
+ const isZeroDimension = 0 === dimensions.length;
437
442
  const x = [
438
- isSingleDimension ? foldInfo.measureName : dimensions[0].id
443
+ isZeroDimension ? foldInfo.measureName : dimensions[0].id
439
444
  ];
440
445
  const y = [
441
446
  foldInfo.measureValue
442
447
  ];
443
448
  const group = [
444
- isSingleDimension ? foldInfo.measureName : unfoldInfo.groupName
449
+ isSingleDimension || isZeroDimension ? foldInfo.measureName : unfoldInfo.groupName
445
450
  ];
446
451
  const color = [
447
452
  foldInfo.measureName
@@ -469,15 +474,16 @@ const encodingYX = (advancedVSeed)=>{
469
474
  if (!datasetReshapeInfo || !dimensions) return result;
470
475
  const encoding = datasetReshapeInfo.reduce((prev, cur)=>{
471
476
  const { foldInfo, unfoldInfo } = cur;
472
- const isSingleDimension = 0 === dimensions.length;
477
+ const isZeroDimension = 0 === dimensions.length;
478
+ const isSingleDimension = 1 === dimensions.length;
473
479
  const y = [
474
- isSingleDimension ? foldInfo.measureName : dimensions[0].id
480
+ isZeroDimension ? foldInfo.measureName : dimensions[0].id
475
481
  ];
476
482
  const x = [
477
483
  foldInfo.measureValue
478
484
  ];
479
485
  const group = [
480
- isSingleDimension ? foldInfo.measureName : unfoldInfo.groupName
486
+ isSingleDimension || isZeroDimension ? foldInfo.measureName : unfoldInfo.groupName
481
487
  ];
482
488
  const color = [
483
489
  foldInfo.measureName
@@ -623,6 +629,16 @@ const pivotAdapter = (pipeline, pivotPipeline)=>(advancedVSeed, context)=>{
623
629
  if (usePivotChart) return execPipeline(pivotPipeline, context, advancedVSeed);
624
630
  return execPipeline(pipeline, context, advancedVSeed);
625
631
  };
632
+ const markStyle_markStyle = (advancedVSeed, context)=>{
633
+ const { vseed } = context;
634
+ const markStyle = external_remeda_pick(vseed, [
635
+ 'barStyle'
636
+ ]);
637
+ return {
638
+ ...advancedVSeed,
639
+ markStyle
640
+ };
641
+ };
626
642
  const lineAdvancedPipeline = [
627
643
  initAdvancedVSeed,
628
644
  autoMeasures,
@@ -649,7 +665,8 @@ const barAdvancedPipeline = [
649
665
  encodingYX,
650
666
  barConfig,
651
667
  vchartBaseConfig,
652
- vchartTheme
668
+ vchartTheme,
669
+ markStyle_markStyle
653
670
  ];
654
671
  const barParallelAdvancedPipeline = [
655
672
  initAdvancedVSeed,
@@ -663,7 +680,8 @@ const barParallelAdvancedPipeline = [
663
680
  encodingYX,
664
681
  barParallelConfig,
665
682
  vchartBaseConfig,
666
- vchartTheme
683
+ vchartTheme,
684
+ markStyle_markStyle
667
685
  ];
668
686
  const barPercentAdvancedPipeline = [
669
687
  initAdvancedVSeed,
@@ -677,7 +695,8 @@ const barPercentAdvancedPipeline = [
677
695
  encodingYX,
678
696
  barPercentConfig,
679
697
  vchartBaseConfig,
680
- vchartTheme
698
+ vchartTheme,
699
+ markStyle_markStyle
681
700
  ];
682
701
  const columnAdvancedPipeline = [
683
702
  initAdvancedVSeed,
@@ -691,7 +710,8 @@ const columnAdvancedPipeline = [
691
710
  encodingXY,
692
711
  columnConfig,
693
712
  vchartBaseConfig,
694
- vchartTheme
713
+ vchartTheme,
714
+ markStyle_markStyle
695
715
  ];
696
716
  const columnParallelAdvancedPipeline = [
697
717
  initAdvancedVSeed,
@@ -705,7 +725,8 @@ const columnParallelAdvancedPipeline = [
705
725
  encodingXY,
706
726
  columnParallelConfig,
707
727
  vchartBaseConfig,
708
- vchartTheme
728
+ vchartTheme,
729
+ markStyle_markStyle
709
730
  ];
710
731
  const columnPercentAdvancedPipeline = [
711
732
  initAdvancedVSeed,
@@ -719,7 +740,8 @@ const columnPercentAdvancedPipeline = [
719
740
  encodingXY,
720
741
  columnPercentConfig,
721
742
  vchartBaseConfig,
722
- vchartTheme
743
+ vchartTheme,
744
+ markStyle_markStyle
723
745
  ];
724
746
  const areaAdvancedPipeline = [
725
747
  initAdvancedVSeed,
@@ -1290,11 +1312,11 @@ const percent = (spec, context)=>{
1290
1312
  result.percent = true;
1291
1313
  return result;
1292
1314
  };
1293
- const stack = (spec, context)=>{
1315
+ const stackInverse = (spec)=>{
1294
1316
  const result = {
1295
1317
  ...spec
1296
1318
  };
1297
- result.stack = true;
1319
+ result.stackInverse = true;
1298
1320
  return result;
1299
1321
  };
1300
1322
  const background_backgroundColor = (spec, context)=>{
@@ -1340,24 +1362,103 @@ const label_label = (spec, context)=>{
1340
1362
  };
1341
1363
  return result;
1342
1364
  };
1343
- const defaultLegend = {
1344
- enable: true
1345
- };
1346
- const legend_legend = (spec, context)=>{
1365
+ const discreteLegend = (spec, context)=>{
1347
1366
  const result = {
1348
1367
  ...spec
1349
1368
  };
1350
1369
  const { advancedVSeed } = context;
1351
1370
  const baseConfig = advancedVSeed.baseConfig.vchart;
1352
1371
  if (!baseConfig || !baseConfig.legend) return result;
1353
- const { legend = defaultLegend } = baseConfig;
1354
- const { enable } = legend;
1372
+ const { legend } = baseConfig;
1373
+ const { enable, position = 'bottom', labelFontColor, labelFontSize = 12, labelFontWeight, maxSize, border, shapeType = 'rectRound' } = legend || {};
1374
+ const orient = [
1375
+ 'bottom',
1376
+ 'bottomLeft',
1377
+ 'bottomRight',
1378
+ 'bl',
1379
+ 'br'
1380
+ ].includes(position) ? 'bottom' : [
1381
+ 'top',
1382
+ 'topLeft',
1383
+ 'topRight',
1384
+ 'tl',
1385
+ 'tr'
1386
+ ].includes(position) ? 'top' : [
1387
+ 'left',
1388
+ 'leftTop',
1389
+ 'leftBottom',
1390
+ 'lt',
1391
+ 'lb'
1392
+ ].includes(position) ? 'left' : 'right';
1393
+ const legendPosition = [
1394
+ 'topLeft',
1395
+ 'bottomLeft',
1396
+ 'leftTop',
1397
+ 'rightTop',
1398
+ 'lt',
1399
+ 'rt',
1400
+ 'tl',
1401
+ 'bl'
1402
+ ].includes(position) ? 'start' : [
1403
+ 'topRight',
1404
+ 'bottomRight',
1405
+ 'leftBottom',
1406
+ 'rightBottom',
1407
+ 'lb',
1408
+ 'rb',
1409
+ 'rt',
1410
+ 'br'
1411
+ ].includes(position) ? 'end' : 'middle';
1355
1412
  result.legends = {
1356
- visible: enable
1413
+ type: 'discrete',
1414
+ visible: enable,
1415
+ maxCol: maxSize,
1416
+ maxRow: maxSize,
1417
+ autoPage: true,
1418
+ orient,
1419
+ position: legendPosition,
1420
+ data: border ? (items)=>items.map((item)=>{
1421
+ item.shape.outerBorder = {
1422
+ stroke: item.shape.fill,
1423
+ distance: 3,
1424
+ lineWidth: 1
1425
+ };
1426
+ return item;
1427
+ }) : void 0,
1428
+ item: {
1429
+ focus: true,
1430
+ focusIconStyle: {
1431
+ size: labelFontSize + 2,
1432
+ fill: labelFontColor,
1433
+ fontWeight: labelFontWeight
1434
+ },
1435
+ shape: {
1436
+ space: border ? 6 : 4,
1437
+ style: {
1438
+ symbolType: shapeType,
1439
+ size: border ? 8 : 10
1440
+ }
1441
+ },
1442
+ label: {
1443
+ style: {
1444
+ fontSize: labelFontSize,
1445
+ fill: labelFontColor,
1446
+ fontWeight: labelFontWeight
1447
+ }
1448
+ },
1449
+ background: {
1450
+ state: {
1451
+ selectedHover: {
1452
+ fill: labelFontColor,
1453
+ fillOpacity: 0.05
1454
+ }
1455
+ }
1456
+ }
1457
+ }
1357
1458
  };
1358
1459
  return result;
1359
1460
  };
1360
- const pivotLegend = (spec, context)=>{
1461
+ const pivotDiscreteLegend = (spec, context)=>{
1361
1462
  const result = {
1362
1463
  ...spec
1363
1464
  };
@@ -1367,38 +1468,94 @@ const pivotLegend = (spec, context)=>{
1367
1468
  const { datasetReshapeInfo } = advancedVSeed;
1368
1469
  const colorItems = unique(datasetReshapeInfo.flatMap((d)=>d.unfoldInfo.colorItems));
1369
1470
  const { legend, color } = baseConfig;
1370
- const { enable } = legend;
1371
1471
  const { colorScheme } = color;
1472
+ const { enable, position = 'bottom', labelFontColor, labelFontSize = 12, labelFontWeight, maxSize, border, shapeType = 'rectRound' } = legend || {};
1473
+ const orient = [
1474
+ 'bottom',
1475
+ 'bottomLeft',
1476
+ 'bottomRight',
1477
+ 'bl',
1478
+ 'br'
1479
+ ].includes(position) ? 'bottom' : [
1480
+ 'top',
1481
+ 'topLeft',
1482
+ 'topRight',
1483
+ 'tl',
1484
+ 'tr'
1485
+ ].includes(position) ? 'top' : [
1486
+ 'left',
1487
+ 'leftTop',
1488
+ 'leftBottom',
1489
+ 'lt',
1490
+ 'lb'
1491
+ ].includes(position) ? 'left' : 'right';
1492
+ const legendPosition = [
1493
+ 'topLeft',
1494
+ 'bottomLeft',
1495
+ 'leftTop',
1496
+ 'rightTop',
1497
+ 'lt',
1498
+ 'rt',
1499
+ 'tl',
1500
+ 'bl'
1501
+ ].includes(position) ? 'start' : [
1502
+ 'topRight',
1503
+ 'bottomRight',
1504
+ 'leftBottom',
1505
+ 'rightBottom',
1506
+ 'lb',
1507
+ 'rb',
1508
+ 'rt',
1509
+ 'br'
1510
+ ].includes(position) ? 'end' : 'middle';
1372
1511
  const legends = {
1373
1512
  visible: enable,
1374
- alignSelf: 'end',
1375
1513
  type: 'discrete',
1376
- position: 'middle',
1514
+ orient,
1515
+ position: legendPosition,
1516
+ maxCol: maxSize,
1517
+ maxRow: maxSize,
1377
1518
  data: colorItems.map((d, index)=>({
1378
1519
  label: d,
1379
1520
  shape: {
1380
- symbolType: 'square',
1521
+ outerBorder: border ? {
1522
+ stroke: colorScheme[index],
1523
+ distance: 3,
1524
+ lineWidth: 1
1525
+ } : void 0,
1381
1526
  fill: colorScheme[index]
1382
1527
  }
1383
1528
  })),
1384
1529
  item: {
1530
+ focus: true,
1531
+ focusIconStyle: {
1532
+ size: labelFontSize + 2,
1533
+ fill: labelFontColor,
1534
+ fontWeight: labelFontWeight
1535
+ },
1536
+ shape: {
1537
+ space: border ? 6 : 4,
1538
+ style: {
1539
+ symbolType: shapeType,
1540
+ size: border ? 8 : 10
1541
+ }
1542
+ },
1543
+ label: {
1544
+ style: {
1545
+ fontSize: labelFontSize,
1546
+ fill: labelFontColor,
1547
+ fontWeight: labelFontWeight
1548
+ }
1549
+ },
1385
1550
  background: {
1386
- visible: true,
1387
1551
  state: {
1388
1552
  selectedHover: {
1389
- fill: '#000000',
1553
+ fill: labelFontColor,
1390
1554
  fillOpacity: 0.05
1391
1555
  }
1392
1556
  }
1393
- },
1394
- label: {
1395
- style: {
1396
- fontSize: 12,
1397
- fill: '#6F6F6F'
1398
- }
1399
1557
  }
1400
- },
1401
- orient: 'bottom'
1558
+ }
1402
1559
  };
1403
1560
  return {
1404
1561
  ...result,
@@ -1647,6 +1804,122 @@ const pivotRowDimensions = (spec, context)=>{
1647
1804
  rows: rows
1648
1805
  };
1649
1806
  };
1807
+ const selector_selector = (datum, selector)=>{
1808
+ if (!selector) return true;
1809
+ const selectors = Array.isArray(selector) ? selector : [
1810
+ selector
1811
+ ];
1812
+ for (const selector of selectors)if (isValueSelector(selector)) {
1813
+ if (Object.values(datum).find((v)=>v === selector)) return true;
1814
+ } else if (isMeasureSelector(selector)) {
1815
+ const selectorValueArr = Array.isArray(selector.value) ? selector.value : [
1816
+ selector.value
1817
+ ];
1818
+ switch(selector.operator){
1819
+ case '=':
1820
+ if (datum[selector.field] === selectorValueArr[0]) return true;
1821
+ break;
1822
+ case '!=':
1823
+ if (datum[selector.field] !== selectorValueArr[0]) return true;
1824
+ break;
1825
+ case '>':
1826
+ if (datum[selector.field] > selectorValueArr[0]) return true;
1827
+ break;
1828
+ case '<':
1829
+ if (datum[selector.field] < selectorValueArr[0]) return true;
1830
+ break;
1831
+ case '>=':
1832
+ if (datum[selector.field] >= selectorValueArr[0]) return true;
1833
+ break;
1834
+ case '<=':
1835
+ if (datum[selector.field] <= selectorValueArr[0]) return true;
1836
+ break;
1837
+ case 'between':
1838
+ if (Array.isArray(selector.value) && datum[selector.field] >= selectorValueArr[0] && datum[selector.field] <= selectorValueArr[1]) return true;
1839
+ break;
1840
+ default:
1841
+ break;
1842
+ }
1843
+ } else if (isDimensionSelector(selector)) {
1844
+ const selectorValueArr = Array.isArray(selector.value) ? selector.value : [
1845
+ selector.value
1846
+ ];
1847
+ if ('in' === selector.operator && selectorValueArr.includes(datum[selector.field])) return true;
1848
+ if ('not in' === selector.operator && !selectorValueArr.includes(datum[selector.field])) return true;
1849
+ } else if (isPartialDatumSelector(selector)) {
1850
+ if (Object.keys(selector).every((key)=>datum[key] === selector[key])) return true;
1851
+ }
1852
+ return false;
1853
+ };
1854
+ const isValueSelector = (selector)=>'string' == typeof selector || 'number' == typeof selector;
1855
+ const isPartialDatumSelector = (selector)=>'object' == typeof selector && null !== selector;
1856
+ const isMeasureSelector = (selector)=>'object' == typeof selector && null !== selector && 'field' in selector && 'operator' in selector && 'value' in selector && [
1857
+ '=',
1858
+ '!=',
1859
+ '>',
1860
+ '<',
1861
+ '>=',
1862
+ '<=',
1863
+ 'between'
1864
+ ].includes(selector.operator);
1865
+ const isDimensionSelector = (selector)=>'object' == typeof selector && null !== selector && 'field' in selector && 'operator' in selector && 'value' in selector && [
1866
+ 'in',
1867
+ 'not in'
1868
+ ].includes(selector.operator);
1869
+ const barStyle_barStyle = (spec, context)=>{
1870
+ const { advancedVSeed } = context;
1871
+ const { markStyle, encoding } = advancedVSeed;
1872
+ const { barStyle } = markStyle;
1873
+ if (!barStyle) return spec;
1874
+ const result = {
1875
+ ...spec
1876
+ };
1877
+ const { selector: barSelector, barBorderColor, barBorderStyle, barBorderWidth, barColor, barColorOpacity, barRadius } = barStyle;
1878
+ return {
1879
+ ...result,
1880
+ bar: {
1881
+ style: {
1882
+ fill: (datum, context)=>{
1883
+ if (selector_selector(datum, barSelector)) return barColor;
1884
+ return context.seriesColor(datum[encoding[0]?.group?.[0]]);
1885
+ },
1886
+ fillOpacity: (datum)=>{
1887
+ if (selector_selector(datum, barSelector)) return barColorOpacity;
1888
+ return 1;
1889
+ },
1890
+ stroke: (datum, context)=>{
1891
+ if (selector_selector(datum, barSelector)) return barBorderColor;
1892
+ return context.seriesColor(datum[encoding[0]?.group?.[0]]);
1893
+ },
1894
+ lineWidth: (datum)=>{
1895
+ if (selector_selector(datum, barSelector)) return barBorderWidth;
1896
+ return 0;
1897
+ },
1898
+ lineDash: (datum)=>{
1899
+ if (selector_selector(datum, barSelector)) {
1900
+ if ('solid' === barBorderStyle) ;
1901
+ else if ('dashed' === barBorderStyle) return [
1902
+ 5,
1903
+ 5
1904
+ ];
1905
+ else if ('dotted' === barBorderStyle) return [
1906
+ 1,
1907
+ 5
1908
+ ];
1909
+ }
1910
+ return [
1911
+ 0,
1912
+ 0
1913
+ ];
1914
+ },
1915
+ cornerRadius: (datum)=>{
1916
+ if (selector_selector(datum, barSelector)) return barRadius;
1917
+ return 0;
1918
+ }
1919
+ }
1920
+ }
1921
+ };
1922
+ };
1650
1923
  const line_line = [
1651
1924
  initLine,
1652
1925
  color_color,
@@ -1656,7 +1929,7 @@ const line_line = [
1656
1929
  yLinear,
1657
1930
  label_label,
1658
1931
  tooltip_tooltip,
1659
- legend_legend
1932
+ discreteLegend
1660
1933
  ];
1661
1934
  const pivotLine = [
1662
1935
  initPivot,
@@ -1675,13 +1948,14 @@ const pivotLine = [
1675
1948
  ]),
1676
1949
  pivotRowDimensions,
1677
1950
  pivotColumnDimensions,
1678
- pivotLegend
1951
+ pivotDiscreteLegend
1679
1952
  ];
1680
1953
  const lineSpecPipeline = [
1681
1954
  pivotAdapter_pivotAdapter(line_line, pivotLine)
1682
1955
  ];
1683
1956
  const column = [
1684
1957
  initColumn,
1958
+ stackInverse,
1685
1959
  color_color,
1686
1960
  background_backgroundColor,
1687
1961
  dataset_dataset,
@@ -1689,7 +1963,8 @@ const column = [
1689
1963
  yLinear,
1690
1964
  label_label,
1691
1965
  tooltip_tooltip,
1692
- legend_legend
1966
+ discreteLegend,
1967
+ barStyle_barStyle
1693
1968
  ];
1694
1969
  const pivotColumn = [
1695
1970
  initPivot,
@@ -1698,17 +1973,19 @@ const pivotColumn = [
1698
1973
  datasetPivot,
1699
1974
  pivotIndicators([
1700
1975
  initColumn,
1976
+ stackInverse,
1701
1977
  color_color,
1702
1978
  background_backgroundColor,
1703
1979
  datasetPivotPlaceholder,
1704
1980
  xBand,
1705
1981
  yLinear,
1706
1982
  label_label,
1707
- tooltip_tooltip
1983
+ tooltip_tooltip,
1984
+ barStyle_barStyle
1708
1985
  ]),
1709
1986
  pivotRowDimensions,
1710
1987
  pivotColumnDimensions,
1711
- pivotLegend
1988
+ pivotDiscreteLegend
1712
1989
  ];
1713
1990
  const columnSpecPipeline = [
1714
1991
  pivotAdapter_pivotAdapter(column, pivotColumn)
@@ -1722,7 +1999,8 @@ const columnParallel = [
1722
1999
  yLinear,
1723
2000
  label_label,
1724
2001
  tooltip_tooltip,
1725
- legend_legend
2002
+ discreteLegend,
2003
+ barStyle_barStyle
1726
2004
  ];
1727
2005
  const pivotColumnParallel = [
1728
2006
  initPivot,
@@ -1737,17 +2015,19 @@ const pivotColumnParallel = [
1737
2015
  xBand,
1738
2016
  yLinear,
1739
2017
  label_label,
1740
- tooltip_tooltip
2018
+ tooltip_tooltip,
2019
+ barStyle_barStyle
1741
2020
  ]),
1742
2021
  pivotRowDimensions,
1743
2022
  pivotColumnDimensions,
1744
- pivotLegend
2023
+ pivotDiscreteLegend
1745
2024
  ];
1746
2025
  const columnParallelSpecPipeline = [
1747
2026
  pivotAdapter_pivotAdapter(columnParallel, pivotColumnParallel)
1748
2027
  ];
1749
2028
  const columnPercent = [
1750
2029
  initColumn,
2030
+ stackInverse,
1751
2031
  color_color,
1752
2032
  background_backgroundColor,
1753
2033
  percent,
@@ -1756,7 +2036,8 @@ const columnPercent = [
1756
2036
  yLinear,
1757
2037
  label_label,
1758
2038
  tooltip_tooltip,
1759
- legend_legend
2039
+ discreteLegend,
2040
+ barStyle_barStyle
1760
2041
  ];
1761
2042
  const pivotColumnPercent = [
1762
2043
  initPivot,
@@ -1765,6 +2046,7 @@ const pivotColumnPercent = [
1765
2046
  datasetPivot,
1766
2047
  pivotIndicators([
1767
2048
  initColumn,
2049
+ stackInverse,
1768
2050
  color_color,
1769
2051
  percent,
1770
2052
  background_backgroundColor,
@@ -1772,11 +2054,12 @@ const pivotColumnPercent = [
1772
2054
  xBand,
1773
2055
  yLinear,
1774
2056
  label_label,
1775
- tooltip_tooltip
2057
+ tooltip_tooltip,
2058
+ barStyle_barStyle
1776
2059
  ]),
1777
2060
  pivotRowDimensions,
1778
2061
  pivotColumnDimensions,
1779
- pivotLegend
2062
+ pivotDiscreteLegend
1780
2063
  ];
1781
2064
  const columnPercentSpecPipeline = [
1782
2065
  pivotAdapter_pivotAdapter(columnPercent, pivotColumnPercent)
@@ -1790,7 +2073,8 @@ const bar = [
1790
2073
  yBand,
1791
2074
  label_label,
1792
2075
  tooltip_tooltip,
1793
- legend_legend
2076
+ discreteLegend,
2077
+ barStyle_barStyle
1794
2078
  ];
1795
2079
  const pivotBar = [
1796
2080
  initPivot,
@@ -1805,11 +2089,12 @@ const pivotBar = [
1805
2089
  yBand,
1806
2090
  label_label,
1807
2091
  label_label,
1808
- tooltip_tooltip
2092
+ tooltip_tooltip,
2093
+ barStyle_barStyle
1809
2094
  ]),
1810
2095
  pivotRowDimensions,
1811
2096
  pivotColumnDimensions,
1812
- pivotLegend
2097
+ pivotDiscreteLegend
1813
2098
  ];
1814
2099
  const barSpecPipeline = [
1815
2100
  pivotAdapter_pivotAdapter(bar, pivotBar)
@@ -1823,7 +2108,8 @@ const barParallel = [
1823
2108
  yBand,
1824
2109
  label_label,
1825
2110
  tooltip_tooltip,
1826
- legend_legend
2111
+ discreteLegend,
2112
+ barStyle_barStyle
1827
2113
  ];
1828
2114
  const pivotBarParallel = [
1829
2115
  initPivot,
@@ -1838,11 +2124,12 @@ const pivotBarParallel = [
1838
2124
  yBand,
1839
2125
  xLinear,
1840
2126
  label_label,
1841
- tooltip_tooltip
2127
+ tooltip_tooltip,
2128
+ barStyle_barStyle
1842
2129
  ]),
1843
2130
  pivotRowDimensions,
1844
2131
  pivotColumnDimensions,
1845
- pivotLegend
2132
+ pivotDiscreteLegend
1846
2133
  ];
1847
2134
  const barParallelSpecPipeline = [
1848
2135
  pivotAdapter_pivotAdapter(barParallel, pivotBarParallel)
@@ -1857,7 +2144,8 @@ const barPercent = [
1857
2144
  yBand,
1858
2145
  label_label,
1859
2146
  tooltip_tooltip,
1860
- legend_legend
2147
+ discreteLegend,
2148
+ barStyle_barStyle
1861
2149
  ];
1862
2150
  const pivotBarPercent = [
1863
2151
  initPivot,
@@ -1873,26 +2161,27 @@ const pivotBarPercent = [
1873
2161
  yBand,
1874
2162
  xLinear,
1875
2163
  label_label,
1876
- tooltip_tooltip
2164
+ tooltip_tooltip,
2165
+ barStyle_barStyle
1877
2166
  ]),
1878
2167
  pivotRowDimensions,
1879
2168
  pivotColumnDimensions,
1880
- pivotLegend
2169
+ pivotDiscreteLegend
1881
2170
  ];
1882
2171
  const barPercentSpecPipeline = [
1883
2172
  pivotAdapter_pivotAdapter(barPercent, pivotBarPercent)
1884
2173
  ];
1885
2174
  const area_area = [
1886
2175
  initArea,
2176
+ stackInverse,
1887
2177
  color_color,
1888
2178
  background_backgroundColor,
1889
- stack,
1890
2179
  dataset_dataset,
1891
2180
  xBand,
1892
2181
  yLinear,
1893
2182
  label_label,
1894
2183
  tooltip_tooltip,
1895
- legend_legend
2184
+ discreteLegend
1896
2185
  ];
1897
2186
  const pivotArea = [
1898
2187
  initPivot,
@@ -1903,7 +2192,7 @@ const pivotArea = [
1903
2192
  initArea,
1904
2193
  color_color,
1905
2194
  background_backgroundColor,
1906
- stack,
2195
+ stackInverse,
1907
2196
  datasetPivotPlaceholder,
1908
2197
  xBand,
1909
2198
  yLinear,
@@ -1912,13 +2201,14 @@ const pivotArea = [
1912
2201
  ]),
1913
2202
  pivotRowDimensions,
1914
2203
  pivotColumnDimensions,
1915
- pivotLegend
2204
+ pivotDiscreteLegend
1916
2205
  ];
1917
2206
  const areaSpecPipeline = [
1918
2207
  pivotAdapter_pivotAdapter(area_area, pivotArea)
1919
2208
  ];
1920
2209
  const areaPercent = [
1921
2210
  initArea,
2211
+ stackInverse,
1922
2212
  color_color,
1923
2213
  background_backgroundColor,
1924
2214
  percent,
@@ -1927,7 +2217,7 @@ const areaPercent = [
1927
2217
  yLinear,
1928
2218
  label_label,
1929
2219
  tooltip_tooltip,
1930
- legend_legend
2220
+ discreteLegend
1931
2221
  ];
1932
2222
  const pivotAreaPercent = [
1933
2223
  initPivot,
@@ -1936,6 +2226,7 @@ const pivotAreaPercent = [
1936
2226
  datasetPivot,
1937
2227
  pivotIndicators([
1938
2228
  initArea,
2229
+ stackInverse,
1939
2230
  color_color,
1940
2231
  background_backgroundColor,
1941
2232
  percent,
@@ -1947,7 +2238,7 @@ const pivotAreaPercent = [
1947
2238
  ]),
1948
2239
  pivotRowDimensions,
1949
2240
  pivotColumnDimensions,
1950
- pivotLegend
2241
+ pivotDiscreteLegend
1951
2242
  ];
1952
2243
  const areaPercentSpecPipeline = [
1953
2244
  pivotAdapter_pivotAdapter(areaPercent, pivotAreaPercent)
@@ -1959,7 +2250,7 @@ const pie = [
1959
2250
  dataset_dataset,
1960
2251
  label_label,
1961
2252
  tooltip_tooltip,
1962
- legend_legend
2253
+ discreteLegend
1963
2254
  ];
1964
2255
  const pivotPie = [
1965
2256
  initPivot,
@@ -1976,7 +2267,7 @@ const pivotPie = [
1976
2267
  ]),
1977
2268
  pivotRowDimensions,
1978
2269
  pivotColumnDimensions,
1979
- pivotLegend
2270
+ pivotDiscreteLegend
1980
2271
  ];
1981
2272
  const pieSpecPipeline = [
1982
2273
  pivotAdapter_pivotAdapter(pie, pivotPie)
@@ -2172,10 +2463,10 @@ const darkTheme = ()=>{
2172
2463
  return {
2173
2464
  baseConfig: {
2174
2465
  vtable: {
2175
- backgroundColor: '#141414'
2466
+ backgroundColor: 'transparent'
2176
2467
  },
2177
2468
  vchart: {
2178
- backgroundColor: '#141414',
2469
+ backgroundColor: 'transparent',
2179
2470
  color: {
2180
2471
  colorScheme: [
2181
2472
  '#2E62F1',
@@ -2197,7 +2488,14 @@ const darkTheme = ()=>{
2197
2488
  enable: true
2198
2489
  },
2199
2490
  legend: {
2200
- enable: true
2491
+ enable: true,
2492
+ border: true,
2493
+ maxSize: 1,
2494
+ position: 'rt',
2495
+ shapeType: 'rectRound',
2496
+ labelFontColor: '#FDFDFD',
2497
+ labelFontSize: 12,
2498
+ labelFontWeight: 400
2201
2499
  }
2202
2500
  }
2203
2501
  },
@@ -2262,18 +2560,18 @@ const lightTheme = ()=>{
2262
2560
  },
2263
2561
  grid: {
2264
2562
  visible: true,
2265
- gridColor: 'rgba(54, 65, 89, 0.15)',
2563
+ gridColor: '#36415926',
2266
2564
  gridWidth: 0.5
2267
2565
  },
2268
2566
  tick: {
2269
2567
  visible: false,
2270
2568
  tickInside: false,
2271
2569
  tickSize: 4,
2272
- tickColor: 'rgba(54, 65, 89, 0.30)'
2570
+ tickColor: '#3641594d'
2273
2571
  },
2274
2572
  line: {
2275
2573
  visible: false,
2276
- lineColor: 'rgba(54, 65, 89, 0.30)',
2574
+ lineColor: '#3641594d',
2277
2575
  lineWidth: 1
2278
2576
  }
2279
2577
  };
@@ -2304,18 +2602,18 @@ const lightTheme = ()=>{
2304
2602
  },
2305
2603
  grid: {
2306
2604
  visible: false,
2307
- gridColor: 'rgba(54, 65, 89, 0.15)',
2605
+ gridColor: '#36415926',
2308
2606
  gridWidth: 0.5
2309
2607
  },
2310
2608
  tick: {
2311
2609
  visible: false,
2312
2610
  tickInside: false,
2313
2611
  tickSize: 4,
2314
- tickColor: 'rgba(54, 65, 89, 0.30)'
2612
+ tickColor: '#3641594d'
2315
2613
  },
2316
2614
  line: {
2317
2615
  visible: true,
2318
- lineColor: 'rgba(54, 65, 89, 0.30)',
2616
+ lineColor: '#3641594d',
2319
2617
  lineWidth: 1
2320
2618
  }
2321
2619
  };
@@ -2335,10 +2633,10 @@ const lightTheme = ()=>{
2335
2633
  return {
2336
2634
  baseConfig: {
2337
2635
  vtable: {
2338
- backgroundColor: '#ffffff'
2636
+ backgroundColor: 'transparent'
2339
2637
  },
2340
2638
  vchart: {
2341
- backgroundColor: '#ffffff',
2639
+ backgroundColor: 'transparent',
2342
2640
  color: {
2343
2641
  colorScheme: [
2344
2642
  '#8D72F6',
@@ -2360,7 +2658,14 @@ const lightTheme = ()=>{
2360
2658
  enable: true
2361
2659
  },
2362
2660
  legend: {
2363
- enable: true
2661
+ enable: true,
2662
+ border: true,
2663
+ maxSize: 1,
2664
+ shapeType: 'rectRound',
2665
+ position: 'rt',
2666
+ labelFontColor: '#646A73',
2667
+ labelFontSize: 12,
2668
+ labelFontWeight: 400
2364
2669
  }
2365
2670
  }
2366
2671
  },
@@ -2526,7 +2831,58 @@ const zTooltip = z.object({
2526
2831
  enable: z.boolean().default(true).optional()
2527
2832
  });
2528
2833
  const zLegend = z.object({
2529
- enable: z.boolean().default(true).optional()
2834
+ enable: z.boolean().default(true).optional(),
2835
+ border: z.boolean().default(true).optional(),
2836
+ maxSize: z.number().default(1).optional(),
2837
+ shapeType: z["enum"]([
2838
+ 'circle',
2839
+ 'cross',
2840
+ 'diamond',
2841
+ 'square',
2842
+ 'arrow',
2843
+ 'arrow2Left',
2844
+ 'arrow2Right',
2845
+ 'wedge',
2846
+ 'thinTriangle',
2847
+ 'triangle',
2848
+ 'triangleUp',
2849
+ 'triangleDown',
2850
+ 'triangleRight',
2851
+ 'triangleLeft',
2852
+ 'stroke',
2853
+ 'star',
2854
+ 'wye',
2855
+ 'rect',
2856
+ 'arrowLeft',
2857
+ 'arrowRight',
2858
+ 'rectRound',
2859
+ 'roundLine'
2860
+ ]).default('rectRound').optional(),
2861
+ position: z["enum"]([
2862
+ 'left',
2863
+ 'leftTop',
2864
+ 'leftBottom',
2865
+ 'lt',
2866
+ 'lb',
2867
+ 'top',
2868
+ 'topLeft',
2869
+ 'topRight',
2870
+ 'tl',
2871
+ 'tr',
2872
+ 'right',
2873
+ 'rightTop',
2874
+ 'rightBottom',
2875
+ 'rt',
2876
+ 'rb',
2877
+ 'bottom',
2878
+ 'bottomLeft',
2879
+ 'bottomRight',
2880
+ 'bl',
2881
+ 'br'
2882
+ ]).default('bottom').optional(),
2883
+ labelFontSize: z.number().default(12).optional(),
2884
+ labelFontColor: z.string().default('#fff').optional(),
2885
+ labelFontWeight: z.number().or(z.string()).default(400).optional()
2530
2886
  });
2531
2887
  const zVChartBaseConfig = z.object({
2532
2888
  backgroundColor: zBackgroundColor,
@@ -2723,6 +3079,57 @@ const zCustomThemeConfig = z.object({
2723
3079
  });
2724
3080
  const zCustomTheme = z.record(z.string(), zCustomThemeConfig).optional();
2725
3081
  const zTheme = z.string();
2726
- export { Builder, FoldMeasureId, FoldMeasureName, FoldMeasureValue, Separator, UnfoldDimensionGroup, areaAdvancedPipeline, areaPercentAdvancedPipeline, areaPercentSpecPipeline, areaSpecPipeline, barAdvancedPipeline, barParallelAdvancedPipeline, barParallelSpecPipeline, barPercentAdvancedPipeline, barPercentSpecPipeline, barSpecPipeline, columnAdvancedPipeline, columnParallelAdvancedPipeline, columnParallelSpecPipeline, columnPercentAdvancedPipeline, columnPercentSpecPipeline, columnSpecPipeline, darkTheme, dataReshapeFor1D1M, dataReshapeFor2D1M, execPipeline, foldMeasures, isPivotChart, isVChart, isVTable, lightTheme, lineAdvancedPipeline, lineSpecPipeline, pieAdvancedPipeline, pieSpecPipeline, all_registerAll as registerAll, registerArea, registerAreaPercent, registerBar, registerBarParallel, registerBarPercent, registerColumn, registerColumnParallel, registerColumnPercent, registerCustomTheme, registerDarkTheme, registerLightTheme, registerLine, unfoldDimensions, zAxis, zBackgroundColor, zBaseConfig, zChartType, zColor, zConfig, zCustomTheme, zCustomThemeConfig, zDataset, zDatasetReshapeInfo, zDatum, zDimension, zDimensions, zEncoding, zFoldInfo, zLabel, zLegend, zMeasure, zMeasureGroup, zMeasures, zTheme, zTooltip, zUnfoldInfo, zXBandAxis, zXLinearAxis, zYBandAxis, zYLinearAxis };
3082
+ const zSelector = z.union([
3083
+ z.string(),
3084
+ z.number(),
3085
+ z.object({
3086
+ field: z.string(),
3087
+ operator: z.string(),
3088
+ value: z.union([
3089
+ z.string(),
3090
+ z.number(),
3091
+ z.array(z.union([
3092
+ z.string(),
3093
+ z.number()
3094
+ ]))
3095
+ ])
3096
+ }),
3097
+ z.object({
3098
+ field: z.string(),
3099
+ operator: z.string(),
3100
+ value: z.union([
3101
+ z.string(),
3102
+ z.number(),
3103
+ z.array(z.union([
3104
+ z.string(),
3105
+ z.number()
3106
+ ]))
3107
+ ])
3108
+ })
3109
+ ]);
3110
+ const zSelectors = z.array(zSelector);
3111
+ const zBarStyle = z.object({
3112
+ selector: z.union([
3113
+ zSelector,
3114
+ zSelectors
3115
+ ]),
3116
+ barColor: z.string(),
3117
+ barColorOpacity: z.number(),
3118
+ barBorderColor: z.string(),
3119
+ barBorderWidth: z.number(),
3120
+ barBorderStyle: z.union([
3121
+ z.literal('solid'),
3122
+ z.literal('dashed'),
3123
+ z.literal('dotted')
3124
+ ]),
3125
+ barRadius: z.union([
3126
+ z.number(),
3127
+ z.array(z.number())
3128
+ ])
3129
+ });
3130
+ const zMarkStyle = z.object({
3131
+ barStyle: zBarStyle.optional()
3132
+ });
3133
+ export { Builder, FoldMeasureId, FoldMeasureName, FoldMeasureValue, ORIGINAL_DATA, Separator, UnfoldDimensionGroup, areaAdvancedPipeline, areaPercentAdvancedPipeline, areaPercentSpecPipeline, areaSpecPipeline, barAdvancedPipeline, barParallelAdvancedPipeline, barParallelSpecPipeline, barPercentAdvancedPipeline, barPercentSpecPipeline, barSpecPipeline, columnAdvancedPipeline, columnParallelAdvancedPipeline, columnParallelSpecPipeline, columnPercentAdvancedPipeline, columnPercentSpecPipeline, columnSpecPipeline, darkTheme, dataReshapeFor1D1M, dataReshapeFor2D1M, execPipeline, foldMeasures, isPivotChart, isVChart, isVTable, lightTheme, lineAdvancedPipeline, lineSpecPipeline, pieAdvancedPipeline, pieSpecPipeline, all_registerAll as registerAll, registerArea, registerAreaPercent, registerBar, registerBarParallel, registerBarPercent, registerColumn, registerColumnParallel, registerColumnPercent, registerCustomTheme, registerDarkTheme, registerLightTheme, registerLine, unfoldDimensions, zAxis, zBackgroundColor, zBarStyle, zBaseConfig, zChartType, zColor, zConfig, zCustomTheme, zCustomThemeConfig, zDataset, zDatasetReshapeInfo, zDatum, zDimension, zDimensions, zEncoding, zFoldInfo, zLabel, zLegend, zMarkStyle, zMeasure, zMeasureGroup, zMeasures, zTheme, zTooltip, zUnfoldInfo, zXBandAxis, zXLinearAxis, zYBandAxis, zYLinearAxis };
2727
3134
 
2728
3135
  //# sourceMappingURL=index.js.map