@visactor/vseed 0.4.2 → 0.4.3
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/cjs/index.cjs +646 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/builder/builder/buildSpec.d.ts +1 -2
- package/dist/esm/builder/builder/buildSpec.js.map +1 -1
- package/dist/esm/builder/builder/builder.d.ts +1116 -106
- package/dist/esm/builder/builder/builder.js +10 -0
- package/dist/esm/builder/builder/builder.js.map +1 -1
- package/dist/esm/builder/builder/prepare.d.ts +12 -0
- package/dist/esm/builder/builder/prepare.js +269 -0
- package/dist/esm/builder/builder/prepare.js.map +1 -0
- package/dist/esm/dataReshape/constant.d.ts +1 -0
- package/dist/esm/dataReshape/constant.js +2 -1
- package/dist/esm/dataReshape/constant.js.map +1 -1
- package/dist/esm/dataSelector/selector.d.ts +71 -2
- package/dist/esm/dataSelector/selector.js +96 -32
- package/dist/esm/dataSelector/selector.js.map +1 -1
- package/dist/esm/pipeline/advanced/chart/pipes/default/defaultMeasures.js +2 -1
- package/dist/esm/pipeline/advanced/chart/pipes/default/defaultMeasures.js.map +1 -1
- package/dist/esm/pipeline/advanced/table/pipes/default/defaultMeasures.js +2 -1
- package/dist/esm/pipeline/advanced/table/pipes/default/defaultMeasures.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationHorizontalLine.js +10 -4
- package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationHorizontalLine.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationPointCommon.d.ts +8 -2
- package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationPointCommon.js +13 -4
- package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationPointCommon.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationPointOfDualAxis.js +8 -4
- package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationPointOfDualAxis.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationVerticalLine.js +10 -4
- package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationVerticalLine.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/annotation/utils.d.ts +9 -1
- package/dist/esm/pipeline/spec/chart/pipes/annotation/utils.js +7 -1
- package/dist/esm/pipeline/spec/chart/pipes/annotation/utils.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/markStyle/barStyle.js +3 -2
- package/dist/esm/pipeline/spec/chart/pipes/markStyle/barStyle.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/markStyle/lineStyle.js +5 -2
- package/dist/esm/pipeline/spec/chart/pipes/markStyle/lineStyle.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/markStyle/pointStyle.js +3 -2
- package/dist/esm/pipeline/spec/chart/pipes/markStyle/pointStyle.js.map +1 -1
- package/dist/esm/pipeline/spec/table/pipes/cellStyle/common.d.ts +4 -1
- package/dist/esm/pipeline/spec/table/pipes/cellStyle/common.js +12 -1
- package/dist/esm/pipeline/spec/table/pipes/cellStyle/common.js.map +1 -1
- package/dist/esm/pipeline/spec/table/pipes/cellStyle/pivot.js +6 -3
- package/dist/esm/pipeline/spec/table/pipes/cellStyle/pivot.js.map +1 -1
- package/dist/esm/pipeline/spec/table/pipes/cellStyle/table.js +7 -3
- package/dist/esm/pipeline/spec/table/pipes/cellStyle/table.js.map +1 -1
- package/dist/esm/pipeline/utils/index.d.ts +1 -0
- package/dist/esm/pipeline/utils/index.js +1 -0
- package/dist/esm/pipeline/utils/sandbox/builtin-utils.d.ts +6 -0
- package/dist/esm/pipeline/utils/sandbox/builtin-utils.js +337 -0
- package/dist/esm/pipeline/utils/sandbox/builtin-utils.js.map +1 -0
- package/dist/esm/pipeline/utils/sandbox/execute.d.ts +73 -0
- package/dist/esm/pipeline/utils/sandbox/execute.js +716 -0
- package/dist/esm/pipeline/utils/sandbox/execute.js.map +1 -0
- package/dist/esm/pipeline/utils/sandbox/index.d.ts +7 -0
- package/dist/esm/pipeline/utils/sandbox/index.js +3 -0
- package/dist/esm/types/builder/builder.d.ts +1 -0
- package/dist/esm/types/builder/builder.js.map +1 -1
- package/dist/esm/types/chartType/area/zArea.d.ts +682 -18
- package/dist/esm/types/chartType/areaPercent/zAreaPercent.d.ts +682 -18
- package/dist/esm/types/chartType/bar/zBar.d.ts +362 -10
- package/dist/esm/types/chartType/barParallel/zBarParallel.d.ts +362 -10
- package/dist/esm/types/chartType/barPercent/zBarPercent.d.ts +362 -10
- package/dist/esm/types/chartType/boxPlot/zBoxPlot.d.ts +210 -14
- package/dist/esm/types/chartType/circlePacking/zCirclePacking.d.ts +2 -2
- package/dist/esm/types/chartType/column/zColumn.d.ts +362 -10
- package/dist/esm/types/chartType/columnParallel/zColumnParallel.d.ts +362 -10
- package/dist/esm/types/chartType/columnPercent/zColumnPercent.d.ts +362 -10
- package/dist/esm/types/chartType/donut/zDonut.d.ts +2 -2
- package/dist/esm/types/chartType/dualAxis/zDualAxis.d.ts +842 -22
- package/dist/esm/types/chartType/funnel/zFunnel.d.ts +2 -2
- package/dist/esm/types/chartType/heatmap/zHeatmap.d.ts +2 -2
- package/dist/esm/types/chartType/histogram/zHistogram.d.ts +362 -10
- package/dist/esm/types/chartType/line/zLine.d.ts +522 -14
- package/dist/esm/types/chartType/pie/zPie.d.ts +2 -2
- package/dist/esm/types/chartType/pivotTable/zPivotTable.d.ts +241 -4
- package/dist/esm/types/chartType/pivotTable/zPivotTable.js +1 -1
- package/dist/esm/types/chartType/pivotTable/zPivotTable.js.map +1 -1
- package/dist/esm/types/chartType/raceBar/zRaceBar.d.ts +362 -10
- package/dist/esm/types/chartType/raceColumn/zRaceColumn.d.ts +362 -10
- package/dist/esm/types/chartType/raceScatter/zRaceScatter.d.ts +362 -10
- package/dist/esm/types/chartType/radar/zRadar.d.ts +2 -2
- package/dist/esm/types/chartType/rose/zRose.d.ts +2 -2
- package/dist/esm/types/chartType/roseParallel/zRoseParallel.d.ts +2 -2
- package/dist/esm/types/chartType/scatter/zScatter.d.ts +362 -10
- package/dist/esm/types/chartType/sunburst/zSunburst.d.ts +2 -2
- package/dist/esm/types/chartType/table/zTable.d.ts +241 -4
- package/dist/esm/types/chartType/table/zTable.js +1 -1
- package/dist/esm/types/chartType/table/zTable.js.map +1 -1
- package/dist/esm/types/chartType/treeMap/zTreeMap.d.ts +2 -2
- package/dist/esm/types/dataSelector/selector.d.ts +594 -3
- package/dist/esm/types/dataSelector/selector.js +58 -2
- package/dist/esm/types/dataSelector/selector.js.map +1 -1
- package/dist/esm/types/properties/annotation/annotation.d.ts +200 -4
- package/dist/esm/types/properties/annotation/annotationHorizontalLine.d.ts +12 -0
- package/dist/esm/types/properties/annotation/annotationPoint.d.ts +19 -0
- package/dist/esm/types/properties/annotation/annotationVerticalLine.d.ts +12 -0
- package/dist/esm/types/properties/annotation/zAnnotationHorizontalLine.d.ts +10 -0
- package/dist/esm/types/properties/annotation/zAnnotationHorizontalLine.js +2 -0
- package/dist/esm/types/properties/annotation/zAnnotationHorizontalLine.js.map +1 -1
- package/dist/esm/types/properties/annotation/zAnnotationPoint.d.ts +80 -2
- package/dist/esm/types/properties/annotation/zAnnotationPoint.js +2 -1
- package/dist/esm/types/properties/annotation/zAnnotationPoint.js.map +1 -1
- package/dist/esm/types/properties/annotation/zAnnotationVerticalLine.d.ts +10 -0
- package/dist/esm/types/properties/annotation/zAnnotationVerticalLine.js +2 -0
- package/dist/esm/types/properties/annotation/zAnnotationVerticalLine.js.map +1 -1
- package/dist/esm/types/properties/cellStyle/bodyCellStyle.d.ts +105 -2
- package/dist/esm/types/properties/cellStyle/bodyCellStyle.js +2 -1
- package/dist/esm/types/properties/cellStyle/bodyCellStyle.js.map +1 -1
- package/dist/esm/types/properties/cellStyle/cellStyle.d.ts +83 -2
- package/dist/esm/types/properties/config/annotation/zAnnotation.d.ts +156 -0
- package/dist/esm/types/properties/config/area.d.ts +160 -4
- package/dist/esm/types/properties/config/bar.d.ts +240 -6
- package/dist/esm/types/properties/config/boxplot.d.ts +80 -2
- package/dist/esm/types/properties/config/circlePacking.d.ts +2 -2
- package/dist/esm/types/properties/config/column.d.ts +240 -6
- package/dist/esm/types/properties/config/config.d.ts +1300 -52
- package/dist/esm/types/properties/config/dualAxis.d.ts +80 -2
- package/dist/esm/types/properties/config/funnel.d.ts +2 -2
- package/dist/esm/types/properties/config/heatmap.d.ts +2 -2
- package/dist/esm/types/properties/config/histogram.d.ts +80 -2
- package/dist/esm/types/properties/config/label/zLabel.d.ts +2 -2
- package/dist/esm/types/properties/config/label/zPieLabel.d.ts +2 -2
- package/dist/esm/types/properties/config/line.d.ts +80 -2
- package/dist/esm/types/properties/config/pie.d.ts +6 -6
- package/dist/esm/types/properties/config/race.d.ts +240 -6
- package/dist/esm/types/properties/config/rose.d.ts +4 -4
- package/dist/esm/types/properties/config/scatter.d.ts +80 -2
- package/dist/esm/types/properties/config/sunburst.d.ts +2 -2
- package/dist/esm/types/properties/config/treeMap.d.ts +2 -2
- package/dist/esm/types/properties/markStyle/areaStyle.d.ts +19 -0
- package/dist/esm/types/properties/markStyle/barStyle.d.ts +99 -2
- package/dist/esm/types/properties/markStyle/barStyle.js +2 -1
- package/dist/esm/types/properties/markStyle/barStyle.js.map +1 -1
- package/dist/esm/types/properties/markStyle/boxPlotStyle.d.ts +2 -2
- package/dist/esm/types/properties/markStyle/lineStyle.d.ts +99 -2
- package/dist/esm/types/properties/markStyle/lineStyle.js +2 -1
- package/dist/esm/types/properties/markStyle/lineStyle.js.map +1 -1
- package/dist/esm/types/properties/markStyle/markStyle.d.ts +648 -24
- package/dist/esm/types/properties/markStyle/outlierStyle.d.ts +2 -2
- package/dist/esm/types/properties/markStyle/pointStyle.d.ts +99 -2
- package/dist/esm/types/properties/markStyle/pointStyle.js +2 -1
- package/dist/esm/types/properties/markStyle/pointStyle.js.map +1 -1
- package/dist/esm/types/properties/markStyle/zAreaStyle.d.ts +80 -2
- package/dist/esm/types/properties/markStyle/zAreaStyle.js +2 -1
- package/dist/esm/types/properties/markStyle/zAreaStyle.js.map +1 -1
- package/dist/esm/types/properties/theme/customTheme.d.ts +2600 -104
- package/dist/esm/types/sandbox.d.ts +19 -0
- package/dist/esm/types/sandbox.js +0 -0
- package/dist/esm/types/zVseed.d.ts +7 -25058
- package/dist/esm/types/zVseed.js.map +1 -1
- package/dist/umd/index.js +1772 -259
- package/dist/umd/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline/spec/chart/pipes/annotation/annotationVerticalLine.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/annotation/annotationVerticalLine.ts"],"sourcesContent":["import type { ILineChartSpec, IMarkLineSpec } from '@visactor/vchart'\nimport type { VChartSpecPipe } from 'src/types'\nimport { isArray, isNumber, isString } from 'remeda'\nimport { ANNOTATION_Z_INDEX } from '../../../../utils/constant'\n\nexport const annotationVerticalLine: VChartSpecPipe = (spec, context) => {\n const { advancedVSeed, vseed } = context\n const { annotation, config } = advancedVSeed\n\n if (!annotation || !annotation.annotationVerticalLine) {\n return spec\n }\n\n const theme = config?.[vseed.chartType as 'column']?.annotation?.annotationVerticalLine\n const { annotationVerticalLine } = annotation\n const annotationVerticalLineList = Array.isArray(annotationVerticalLine)\n ? annotationVerticalLine\n : [annotationVerticalLine]\n\n const positionMap = {\n outsideStart: 'start',\n outsideEnd: 'end',\n outsideMiddle: 'middle',\n insideStart: 'insideStartTop',\n insideMiddle: 'insideMiddleTop',\n insideEnd: 'insideEndTop',\n }\n const markLine = annotationVerticalLineList.flatMap((annotationVerticalLine) => {\n const {\n xValue,\n text = '',\n textPosition = 'insideEnd',\n textColor = theme?.textColor ?? '#ffffff',\n textFontSize = theme?.textFontSize ?? 12,\n textFontWeight = theme?.textFontWeight ?? 400,\n textAlign = 'center',\n textBaseline = 'top',\n\n lineColor = theme?.lineColor ?? '#212121',\n lineStyle = theme?.lineStyle ?? 'dashed',\n lineVisible = theme?.lineStyle ?? true,\n lineWidth = theme?.lineWidth ?? 1,\n\n textBackgroundVisible = theme?.textBackgroundVisible ?? true,\n textBackgroundColor = theme?.textBackgroundColor ?? '#212121',\n textBackgroundBorderColor = theme?.textBackgroundBorderColor ?? '#212121',\n textBackgroundBorderRadius = theme?.textBackgroundBorderRadius ?? 4,\n textBackgroundBorderWidth = theme?.textBackgroundBorderWidth ?? 1,\n textBackgroundPadding = theme?.textBackgroundPadding ?? 2,\n } = annotationVerticalLine\n\n const generateOneMarkLine = (x: number | string) => ({\n x,\n autoRange: true,\n zIndex: ANNOTATION_Z_INDEX,\n line: {\n style: {\n visible: lineVisible,\n stroke: lineColor,\n lineStyle: lineStyle,\n lineWidth: lineWidth,\n lineDash: lineStyle === 'dashed' ? [5, 2] : lineStyle === 'dotted' ? [2, 5] : [0],\n },\n },\n label: {\n confine: true,\n text: text,\n position: (positionMap as any)[textPosition || 'insideEnd'],\n style: {\n opacity: 0.95,\n dx: 5,\n visible: true,\n stroke: textBackgroundColor,\n lineWidth: 1,\n textAlign: textAlign,\n textBaseline: textBaseline,\n fill: textColor,\n fontSize: textFontSize,\n fontWeight: textFontWeight,\n },\n labelBackground: {\n visible: textBackgroundVisible,\n padding: textBackgroundPadding,\n style: {\n opacity: 0.95,\n dx: 5,\n cornerRadius: textBackgroundBorderRadius,\n fill: textBackgroundColor,\n fillOpacity: 1,\n stroke: textBackgroundBorderColor,\n lineWidth: textBackgroundBorderWidth,\n },\n },\n },\n startSymbol: {\n visible: theme?.startSymbolVisible ?? true,\n symbolType: theme?.startSymbolType ?? 'triangleDown',\n size: 5 + (lineWidth || 1),\n style: {\n dy: -3,\n fill: lineColor,\n },\n },\n endSymbol: {\n visible: theme?.endSymbolVisible ?? false,\n symbolType: theme?.endSymbolType ?? 'arrow',\n size: 10 + (lineWidth || 1),\n style: {\n dy: 4,\n fill: lineColor,\n },\n },\n })\n\n if (isArray(
|
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/annotation/annotationVerticalLine.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/annotation/annotationVerticalLine.ts"],"sourcesContent":["import type { ILineChartSpec, IMarkLineSpec } from '@visactor/vchart'\nimport type { VChartSpecPipe } from 'src/types'\nimport { isArray, isNumber, isString } from 'remeda'\nimport { ANNOTATION_Z_INDEX } from '../../../../utils/constant'\nimport { resolveAnnotationValue } from './utils'\n\nexport const annotationVerticalLine: VChartSpecPipe = (spec, context) => {\n const { advancedVSeed, vseed } = context\n const { annotation, config } = advancedVSeed\n\n if (!annotation || !annotation.annotationVerticalLine) {\n return spec\n }\n\n const theme = config?.[vseed.chartType as 'column']?.annotation?.annotationVerticalLine\n const { annotationVerticalLine } = annotation\n const annotationVerticalLineList = Array.isArray(annotationVerticalLine)\n ? annotationVerticalLine\n : [annotationVerticalLine]\n\n const positionMap = {\n outsideStart: 'start',\n outsideEnd: 'end',\n outsideMiddle: 'middle',\n insideStart: 'insideStartTop',\n insideMiddle: 'insideMiddleTop',\n insideEnd: 'insideEndTop',\n }\n const markLine = annotationVerticalLineList.flatMap((annotationVerticalLine) => {\n const {\n xValue,\n dynamicFilter,\n text = '',\n textPosition = 'insideEnd',\n textColor = theme?.textColor ?? '#ffffff',\n textFontSize = theme?.textFontSize ?? 12,\n textFontWeight = theme?.textFontWeight ?? 400,\n textAlign = 'center',\n textBaseline = 'top',\n\n lineColor = theme?.lineColor ?? '#212121',\n lineStyle = theme?.lineStyle ?? 'dashed',\n lineVisible = theme?.lineStyle ?? true,\n lineWidth = theme?.lineWidth ?? 1,\n\n textBackgroundVisible = theme?.textBackgroundVisible ?? true,\n textBackgroundColor = theme?.textBackgroundColor ?? '#212121',\n textBackgroundBorderColor = theme?.textBackgroundBorderColor ?? '#212121',\n textBackgroundBorderRadius = theme?.textBackgroundBorderRadius ?? 4,\n textBackgroundBorderWidth = theme?.textBackgroundBorderWidth ?? 1,\n textBackgroundPadding = theme?.textBackgroundPadding ?? 2,\n } = annotationVerticalLine\n\n const generateOneMarkLine = (x: number | string) => ({\n x,\n autoRange: true,\n zIndex: ANNOTATION_Z_INDEX,\n line: {\n style: {\n visible: lineVisible,\n stroke: lineColor,\n lineStyle: lineStyle,\n lineWidth: lineWidth,\n lineDash: lineStyle === 'dashed' ? [5, 2] : lineStyle === 'dotted' ? [2, 5] : [0],\n },\n },\n label: {\n confine: true,\n text: text,\n position: (positionMap as any)[textPosition || 'insideEnd'],\n style: {\n opacity: 0.95,\n dx: 5,\n visible: true,\n stroke: textBackgroundColor,\n lineWidth: 1,\n textAlign: textAlign,\n textBaseline: textBaseline,\n fill: textColor,\n fontSize: textFontSize,\n fontWeight: textFontWeight,\n },\n labelBackground: {\n visible: textBackgroundVisible,\n padding: textBackgroundPadding,\n style: {\n opacity: 0.95,\n dx: 5,\n cornerRadius: textBackgroundBorderRadius,\n fill: textBackgroundColor,\n fillOpacity: 1,\n stroke: textBackgroundBorderColor,\n lineWidth: textBackgroundBorderWidth,\n },\n },\n },\n startSymbol: {\n visible: theme?.startSymbolVisible ?? true,\n symbolType: theme?.startSymbolType ?? 'triangleDown',\n size: 5 + (lineWidth || 1),\n style: {\n dy: -3,\n fill: lineColor,\n },\n },\n endSymbol: {\n visible: theme?.endSymbolVisible ?? false,\n symbolType: theme?.endSymbolType ?? 'arrow',\n size: 10 + (lineWidth || 1),\n style: {\n dy: 4,\n fill: lineColor,\n },\n },\n })\n\n const finalXValue = resolveAnnotationValue({\n dynamicFilter,\n fallback: dynamicFilter?.fallback as string | number | undefined,\n defaultValue: xValue,\n })\n\n if (isArray(finalXValue) || isString(finalXValue) || isNumber(finalXValue)) {\n const xValueArr = Array.isArray(finalXValue) ? finalXValue : [finalXValue]\n return xValueArr.map(generateOneMarkLine)\n }\n\n return []\n }) as IMarkLineSpec[]\n\n const specMarkLine = ((spec as ILineChartSpec).markLine as IMarkLineSpec[]) || []\n const newMarkLine = [...specMarkLine, ...(markLine || [])]\n\n return {\n ...spec,\n markLine: newMarkLine,\n }\n}\n"],"names":["annotationVerticalLine","spec","context","advancedVSeed","vseed","annotation","config","theme","annotationVerticalLineList","Array","positionMap","markLine","xValue","dynamicFilter","text","textPosition","textColor","textFontSize","textFontWeight","textAlign","textBaseline","lineColor","lineStyle","lineVisible","lineWidth","textBackgroundVisible","textBackgroundColor","textBackgroundBorderColor","textBackgroundBorderRadius","textBackgroundBorderWidth","textBackgroundPadding","generateOneMarkLine","x","ANNOTATION_Z_INDEX","finalXValue","resolveAnnotationValue","isArray","isString","isNumber","xValueArr","specMarkLine","newMarkLine"],"mappings":";;;AAMO,MAAMA,gDAAyC,CAACC,MAAMC;IAC3D,MAAM,EAAEC,aAAa,EAAEC,KAAK,EAAE,GAAGF;IACjC,MAAM,EAAEG,UAAU,EAAEC,MAAM,EAAE,GAAGH;IAE/B,IAAI,CAACE,cAAc,CAACA,WAAW,sBAAsB,EACnD,OAAOJ;IAGT,MAAMM,QAAQD,QAAQ,CAACF,MAAM,SAAS,CAAa,EAAE,YAAY;IACjE,MAAM,EAAEJ,sBAAsB,EAAE,GAAGK;IACnC,MAAMG,6BAA6BC,MAAM,OAAO,CAACT,0BAC7CA,yBACA;QAACA;KAAuB;IAE5B,MAAMU,cAAc;QAClB,cAAc;QACd,YAAY;QACZ,eAAe;QACf,aAAa;QACb,cAAc;QACd,WAAW;IACb;IACA,MAAMC,WAAWH,2BAA2B,OAAO,CAAC,CAACR;QACnD,MAAM,EACJY,MAAM,EACNC,aAAa,EACbC,OAAO,EAAE,EACTC,eAAe,WAAW,EAC1BC,YAAYT,OAAO,aAAa,SAAS,EACzCU,eAAeV,OAAO,gBAAgB,EAAE,EACxCW,iBAAiBX,OAAO,kBAAkB,GAAG,EAC7CY,YAAY,QAAQ,EACpBC,eAAe,KAAK,EAEpBC,YAAYd,OAAO,aAAa,SAAS,EACzCe,YAAYf,OAAO,aAAa,QAAQ,EACxCgB,cAAchB,OAAO,aAAa,IAAI,EACtCiB,YAAYjB,OAAO,aAAa,CAAC,EAEjCkB,wBAAwBlB,OAAO,yBAAyB,IAAI,EAC5DmB,sBAAsBnB,OAAO,uBAAuB,SAAS,EAC7DoB,4BAA4BpB,OAAO,6BAA6B,SAAS,EACzEqB,6BAA6BrB,OAAO,8BAA8B,CAAC,EACnEsB,4BAA4BtB,OAAO,6BAA6B,CAAC,EACjEuB,wBAAwBvB,OAAO,yBAAyB,CAAC,EAC1D,GAAGP;QAEJ,MAAM+B,sBAAsB,CAACC,IAAwB;gBACnDA;gBACA,WAAW;gBACX,QAAQC;gBACR,MAAM;oBACJ,OAAO;wBACL,SAASV;wBACT,QAAQF;wBACR,WAAWC;wBACX,WAAWE;wBACX,UAAUF,AAAc,aAAdA,YAAyB;4BAAC;4BAAG;yBAAE,GAAGA,AAAc,aAAdA,YAAyB;4BAAC;4BAAG;yBAAE,GAAG;4BAAC;yBAAE;oBACnF;gBACF;gBACA,OAAO;oBACL,SAAS;oBACT,MAAMR;oBACN,UAAWJ,WAAmB,CAACK,gBAAgB,YAAY;oBAC3D,OAAO;wBACL,SAAS;wBACT,IAAI;wBACJ,SAAS;wBACT,QAAQW;wBACR,WAAW;wBACX,WAAWP;wBACX,cAAcC;wBACd,MAAMJ;wBACN,UAAUC;wBACV,YAAYC;oBACd;oBACA,iBAAiB;wBACf,SAASO;wBACT,SAASK;wBACT,OAAO;4BACL,SAAS;4BACT,IAAI;4BACJ,cAAcF;4BACd,MAAMF;4BACN,aAAa;4BACb,QAAQC;4BACR,WAAWE;wBACb;oBACF;gBACF;gBACA,aAAa;oBACX,SAAStB,OAAO,sBAAsB;oBACtC,YAAYA,OAAO,mBAAmB;oBACtC,MAAM,IAAKiB,CAAAA,aAAa;oBACxB,OAAO;wBACL,IAAI;wBACJ,MAAMH;oBACR;gBACF;gBACA,WAAW;oBACT,SAASd,OAAO,oBAAoB;oBACpC,YAAYA,OAAO,iBAAiB;oBACpC,MAAM,KAAMiB,CAAAA,aAAa;oBACzB,OAAO;wBACL,IAAI;wBACJ,MAAMH;oBACR;gBACF;YACF;QAEA,MAAMa,cAAcC,uBAAuB;YACzCtB;YACA,UAAUA,eAAe;YACzB,cAAcD;QAChB;QAEA,IAAIwB,QAAQF,gBAAgBG,SAASH,gBAAgBI,SAASJ,cAAc;YAC1E,MAAMK,YAAY9B,MAAM,OAAO,CAACyB,eAAeA,cAAc;gBAACA;aAAY;YAC1E,OAAOK,UAAU,GAAG,CAACR;QACvB;QAEA,OAAO,EAAE;IACX;IAEA,MAAMS,eAAiBvC,KAAwB,QAAQ,IAAwB,EAAE;IACjF,MAAMwC,cAAc;WAAID;WAAkB7B,YAAY,EAAE;KAAE;IAE1D,OAAO;QACL,GAAGV,IAAI;QACP,UAAUwC;IACZ;AACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Datum } from '../../../../../types';
|
|
1
|
+
import type { Datum, ValueDynamicFilter } from '../../../../../types';
|
|
2
2
|
export declare const isSubset: (sub: Datum, obj: Datum, excludeMeasuresIds?: string[]) => boolean;
|
|
3
3
|
export declare const ANNOTATION_AREA_TEXT_STYLE_BY_POSITION: {
|
|
4
4
|
top: {
|
|
@@ -34,3 +34,11 @@ export declare const ANNOTATION_AREA_TEXT_STYLE_BY_POSITION: {
|
|
|
34
34
|
textBaseline: string;
|
|
35
35
|
};
|
|
36
36
|
};
|
|
37
|
+
/**
|
|
38
|
+
* 解析标注线的值,优先级:dynamicFilter (success=true) > fallback > defaultValue
|
|
39
|
+
*/
|
|
40
|
+
export declare const resolveAnnotationValue: (options: {
|
|
41
|
+
dynamicFilter?: ValueDynamicFilter;
|
|
42
|
+
fallback?: string | number;
|
|
43
|
+
defaultValue?: any;
|
|
44
|
+
}) => (string | number) | (string | number)[] | undefined;
|
|
@@ -38,6 +38,12 @@ const ANNOTATION_AREA_TEXT_STYLE_BY_POSITION = {
|
|
|
38
38
|
textBaseline: 'middle'
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
|
-
|
|
41
|
+
const resolveAnnotationValue = (options)=>{
|
|
42
|
+
const { dynamicFilter, fallback, defaultValue } = options;
|
|
43
|
+
if (dynamicFilter?.result?.success && void 0 !== dynamicFilter.result.data) return dynamicFilter.result.data;
|
|
44
|
+
if (void 0 !== fallback) return fallback;
|
|
45
|
+
return defaultValue;
|
|
46
|
+
};
|
|
47
|
+
export { ANNOTATION_AREA_TEXT_STYLE_BY_POSITION, isSubset, resolveAnnotationValue };
|
|
42
48
|
|
|
43
49
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline/spec/chart/pipes/annotation/utils.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/annotation/utils.ts"],"sourcesContent":["import type { Datum } from 'src/types'\n\nexport const isSubset = (sub: Datum, obj: Datum, excludeMeasuresIds?: string[]) => {\n return Object.entries(sub).every(([key, value]) => {\n if (excludeMeasuresIds && excludeMeasuresIds.includes(key)) {\n return false\n }\n\n if (typeof value === 'string') {\n return obj[key] === value\n }\n if (typeof value === 'number') {\n return obj[key] === value\n }\n return true\n })\n}\n\nexport const ANNOTATION_AREA_TEXT_STYLE_BY_POSITION = {\n top: {\n textAlign: 'center',\n textBaseline: 'top',\n },\n topRight: {\n textAlign: 'right',\n textBaseline: 'top',\n },\n topLeft: {\n textAlign: 'left',\n textBaseline: 'top',\n },\n bottom: {\n textAlign: 'center',\n textBaseline: 'bottom',\n },\n bottomLeft: {\n textAlign: 'left',\n textBaseline: 'bottom',\n },\n bottomRight: {\n textAlign: 'right',\n textBaseline: 'bottom',\n },\n left: {\n textAlign: 'left',\n textBaseline: 'middle',\n },\n right: {\n textAlign: 'right',\n textBaseline: 'middle',\n },\n}\n"],"names":["isSubset","sub","obj","excludeMeasuresIds","Object","key","value","ANNOTATION_AREA_TEXT_STYLE_BY_POSITION"],"mappings":"AAEO,MAAMA,WAAW,CAACC,KAAYC,KAAYC,qBACxCC,OAAO,OAAO,CAACH,KAAK,KAAK,CAAC,CAAC,CAACI,KAAKC,MAAM;QAC5C,IAAIH,sBAAsBA,mBAAmB,QAAQ,CAACE,MACpD,OAAO;QAGT,IAAI,AAAiB,YAAjB,OAAOC,OACT,OAAOJ,GAAG,CAACG,IAAI,KAAKC;QAEtB,IAAI,AAAiB,YAAjB,OAAOA,OACT,OAAOJ,GAAG,CAACG,IAAI,KAAKC;QAEtB,OAAO;IACT;AAGK,MAAMC,yCAAyC;IACpD,KAAK;QACH,WAAW;QACX,cAAc;IAChB;IACA,UAAU;QACR,WAAW;QACX,cAAc;IAChB;IACA,SAAS;QACP,WAAW;QACX,cAAc;IAChB;IACA,QAAQ;QACN,WAAW;QACX,cAAc;IAChB;IACA,YAAY;QACV,WAAW;QACX,cAAc;IAChB;IACA,aAAa;QACX,WAAW;QACX,cAAc;IAChB;IACA,MAAM;QACJ,WAAW;QACX,cAAc;IAChB;IACA,OAAO;QACL,WAAW;QACX,cAAc;IAChB;AACF"}
|
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/annotation/utils.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/annotation/utils.ts"],"sourcesContent":["import type { Datum, ValueDynamicFilter } from 'src/types'\n\nexport const isSubset = (sub: Datum, obj: Datum, excludeMeasuresIds?: string[]) => {\n return Object.entries(sub).every(([key, value]) => {\n if (excludeMeasuresIds && excludeMeasuresIds.includes(key)) {\n return false\n }\n\n if (typeof value === 'string') {\n return obj[key] === value\n }\n if (typeof value === 'number') {\n return obj[key] === value\n }\n return true\n })\n}\n\nexport const ANNOTATION_AREA_TEXT_STYLE_BY_POSITION = {\n top: {\n textAlign: 'center',\n textBaseline: 'top',\n },\n topRight: {\n textAlign: 'right',\n textBaseline: 'top',\n },\n topLeft: {\n textAlign: 'left',\n textBaseline: 'top',\n },\n bottom: {\n textAlign: 'center',\n textBaseline: 'bottom',\n },\n bottomLeft: {\n textAlign: 'left',\n textBaseline: 'bottom',\n },\n bottomRight: {\n textAlign: 'right',\n textBaseline: 'bottom',\n },\n left: {\n textAlign: 'left',\n textBaseline: 'middle',\n },\n right: {\n textAlign: 'right',\n textBaseline: 'middle',\n },\n}\n\n/**\n * 解析标注线的值,优先级:dynamicFilter (success=true) > fallback > defaultValue\n */\nexport const resolveAnnotationValue = (options: {\n dynamicFilter?: ValueDynamicFilter\n fallback?: string | number\n defaultValue?: any\n}): (string | number) | (string | number)[] | undefined => {\n const { dynamicFilter, fallback, defaultValue } = options\n\n // 优先使用 dynamicFilter\n if (dynamicFilter?.result?.success && dynamicFilter.result.data !== undefined) {\n return dynamicFilter.result.data\n }\n\n // 其次使用 fallback\n if (fallback !== undefined) {\n return fallback\n }\n\n // 最后使用原始的 defaultValue\n return defaultValue\n}\n"],"names":["isSubset","sub","obj","excludeMeasuresIds","Object","key","value","ANNOTATION_AREA_TEXT_STYLE_BY_POSITION","resolveAnnotationValue","options","dynamicFilter","fallback","defaultValue","undefined"],"mappings":"AAEO,MAAMA,WAAW,CAACC,KAAYC,KAAYC,qBACxCC,OAAO,OAAO,CAACH,KAAK,KAAK,CAAC,CAAC,CAACI,KAAKC,MAAM;QAC5C,IAAIH,sBAAsBA,mBAAmB,QAAQ,CAACE,MACpD,OAAO;QAGT,IAAI,AAAiB,YAAjB,OAAOC,OACT,OAAOJ,GAAG,CAACG,IAAI,KAAKC;QAEtB,IAAI,AAAiB,YAAjB,OAAOA,OACT,OAAOJ,GAAG,CAACG,IAAI,KAAKC;QAEtB,OAAO;IACT;AAGK,MAAMC,yCAAyC;IACpD,KAAK;QACH,WAAW;QACX,cAAc;IAChB;IACA,UAAU;QACR,WAAW;QACX,cAAc;IAChB;IACA,SAAS;QACP,WAAW;QACX,cAAc;IAChB;IACA,QAAQ;QACN,WAAW;QACX,cAAc;IAChB;IACA,YAAY;QACV,WAAW;QACX,cAAc;IAChB;IACA,aAAa;QACX,WAAW;QACX,cAAc;IAChB;IACA,MAAM;QACJ,WAAW;QACX,cAAc;IAChB;IACA,OAAO;QACL,WAAW;QACX,cAAc;IAChB;AACF;AAKO,MAAMC,yBAAyB,CAACC;IAKrC,MAAM,EAAEC,aAAa,EAAEC,QAAQ,EAAEC,YAAY,EAAE,GAAGH;IAGlD,IAAIC,eAAe,QAAQ,WAAWA,AAA8BG,WAA9BH,cAAc,MAAM,CAAC,IAAI,EAC7D,OAAOA,cAAc,MAAM,CAAC,IAAI;IAIlC,IAAIC,AAAaE,WAAbF,UACF,OAAOA;IAIT,OAAOC;AACT"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { selector } from "../../../../../dataSelector/index.js";
|
|
1
|
+
import { selector, selectorWithDynamicFilter } from "../../../../../dataSelector/index.js";
|
|
2
2
|
import { isEmpty, isNullish } from "remeda";
|
|
3
3
|
const barStyle_barStyle = (spec, context)=>{
|
|
4
4
|
const { advancedVSeed } = context;
|
|
@@ -41,7 +41,8 @@ const barStyle_barStyle = (spec, context)=>{
|
|
|
41
41
|
[`custom${index + 1}`]: {
|
|
42
42
|
level: index + 1,
|
|
43
43
|
filter: (datum)=>{
|
|
44
|
-
|
|
44
|
+
const shouldApply = style.dynamicFilter ? selectorWithDynamicFilter(datum, style.dynamicFilter, style.selector) : selector(datum, style.selector);
|
|
45
|
+
if (shouldApply) return true;
|
|
45
46
|
return false;
|
|
46
47
|
},
|
|
47
48
|
style: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline/spec/chart/pipes/markStyle/barStyle.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/markStyle/barStyle.ts"],"sourcesContent":["import type { IBarChartSpec } from '@visactor/vchart'\nimport { selector } from '../../../../../dataSelector'\nimport type { BarStyle, Datum, VChartSpecPipe } from 'src/types'\nimport { isEmpty, isNullish } from 'remeda'\n\nexport const barStyle: VChartSpecPipe = (spec, context) => {\n const { advancedVSeed } = context\n const { markStyle, dataset = [] } = advancedVSeed\n const { barStyle } = markStyle\n\n const showStroke = dataset.length <= 100\n\n const result = {\n ...spec,\n bar: {\n style: {\n visible: true,\n fillOpacity: 1,\n lineWidth: showStroke ? 1 : 0,\n },\n state: {\n hover: {\n fillOpacity: 0.6,\n },\n },\n },\n } as IBarChartSpec\n\n if (isNullish(barStyle) || isEmpty(barStyle)) {\n return result\n }\n\n const barStyles = (Array.isArray(barStyle) ? barStyle : [barStyle]) as BarStyle[]\n\n const customMap = barStyles.reduce<object>((result, style, index) => {\n const {\n barBorderColor,\n barBorderStyle,\n barBorderWidth = 1,\n barColor,\n barColorOpacity,\n barBorderOpacity,\n barRadius,\n barVisible = true,\n } = style\n\n const lineDash = barBorderStyle === 'dashed' ? [5, 2] : barBorderStyle === 'dotted' ? [2, 5] : [0, 0]\n return {\n ...result,\n [`custom${index + 1}`]: {\n // 优先级: 后者覆盖前者\n level: index + 1,\n filter: (datum: Datum) => {\n
|
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/markStyle/barStyle.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/markStyle/barStyle.ts"],"sourcesContent":["import type { IBarChartSpec } from '@visactor/vchart'\nimport { selector, selectorWithDynamicFilter } from '../../../../../dataSelector'\nimport type { BarStyle, Datum, VChartSpecPipe } from 'src/types'\nimport { isEmpty, isNullish } from 'remeda'\n\nexport const barStyle: VChartSpecPipe = (spec, context) => {\n const { advancedVSeed } = context\n const { markStyle, dataset = [] } = advancedVSeed\n const { barStyle } = markStyle\n\n const showStroke = dataset.length <= 100\n\n const result = {\n ...spec,\n bar: {\n style: {\n visible: true,\n fillOpacity: 1,\n lineWidth: showStroke ? 1 : 0,\n },\n state: {\n hover: {\n fillOpacity: 0.6,\n },\n },\n },\n } as IBarChartSpec\n\n if (isNullish(barStyle) || isEmpty(barStyle)) {\n return result\n }\n\n const barStyles = (Array.isArray(barStyle) ? barStyle : [barStyle]) as BarStyle[]\n\n const customMap = barStyles.reduce<object>((result, style, index) => {\n const {\n barBorderColor,\n barBorderStyle,\n barBorderWidth = 1,\n barColor,\n barColorOpacity,\n barBorderOpacity,\n barRadius,\n barVisible = true,\n } = style\n\n const lineDash = barBorderStyle === 'dashed' ? [5, 2] : barBorderStyle === 'dotted' ? [2, 5] : [0, 0]\n return {\n ...result,\n [`custom${index + 1}`]: {\n // 优先级: 后者覆盖前者\n level: index + 1,\n filter: (datum: Datum) => {\n const shouldApply = style.dynamicFilter\n ? selectorWithDynamicFilter(datum, style.dynamicFilter, style.selector)\n : selector(datum, style.selector)\n if (shouldApply) {\n return true\n }\n return false\n },\n style: {\n visible: barVisible,\n fill: barColor,\n fillOpacity: barColorOpacity,\n cornerRadius: barRadius,\n lineWidth: barBorderWidth,\n stroke: barBorderColor,\n strokeOpacity: barBorderOpacity,\n lineDash: lineDash,\n },\n },\n }\n }, {})\n\n result.bar!.state = {\n ...result.bar!.state,\n ...customMap,\n }\n\n return result\n}\n"],"names":["barStyle","spec","context","advancedVSeed","markStyle","dataset","showStroke","result","isNullish","isEmpty","barStyles","Array","customMap","style","index","barBorderColor","barBorderStyle","barBorderWidth","barColor","barColorOpacity","barBorderOpacity","barRadius","barVisible","lineDash","datum","shouldApply","selectorWithDynamicFilter","selector"],"mappings":";;AAKO,MAAMA,oBAA2B,CAACC,MAAMC;IAC7C,MAAM,EAAEC,aAAa,EAAE,GAAGD;IAC1B,MAAM,EAAEE,SAAS,EAAEC,UAAU,EAAE,EAAE,GAAGF;IACpC,MAAM,EAAEH,QAAQ,EAAE,GAAGI;IAErB,MAAME,aAAaD,QAAQ,MAAM,IAAI;IAErC,MAAME,SAAS;QACb,GAAGN,IAAI;QACP,KAAK;YACH,OAAO;gBACL,SAAS;gBACT,aAAa;gBACb,WAAWK,aAAa,IAAI;YAC9B;YACA,OAAO;gBACL,OAAO;oBACL,aAAa;gBACf;YACF;QACF;IACF;IAEA,IAAIE,UAAUR,aAAaS,QAAQT,WACjC,OAAOO;IAGT,MAAMG,YAAaC,MAAM,OAAO,CAACX,YAAYA,WAAW;QAACA;KAAS;IAElE,MAAMY,YAAYF,UAAU,MAAM,CAAS,CAACH,QAAQM,OAAOC;QACzD,MAAM,EACJC,cAAc,EACdC,cAAc,EACdC,iBAAiB,CAAC,EAClBC,QAAQ,EACRC,eAAe,EACfC,gBAAgB,EAChBC,SAAS,EACTC,aAAa,IAAI,EAClB,GAAGT;QAEJ,MAAMU,WAAWP,AAAmB,aAAnBA,iBAA8B;YAAC;YAAG;SAAE,GAAGA,AAAmB,aAAnBA,iBAA8B;YAAC;YAAG;SAAE,GAAG;YAAC;YAAG;SAAE;QACrG,OAAO;YACL,GAAGT,MAAM;YACT,CAAC,CAAC,MAAM,EAAEO,QAAQ,GAAG,CAAC,EAAE;gBAEtB,OAAOA,QAAQ;gBACf,QAAQ,CAACU;oBACP,MAAMC,cAAcZ,MAAM,aAAa,GACnCa,0BAA0BF,OAAOX,MAAM,aAAa,EAAEA,MAAM,QAAQ,IACpEc,SAASH,OAAOX,MAAM,QAAQ;oBAClC,IAAIY,aACF,OAAO;oBAET,OAAO;gBACT;gBACA,OAAO;oBACL,SAASH;oBACT,MAAMJ;oBACN,aAAaC;oBACb,cAAcE;oBACd,WAAWJ;oBACX,QAAQF;oBACR,eAAeK;oBACf,UAAUG;gBACZ;YACF;QACF;IACF,GAAG,CAAC;IAEJhB,OAAO,GAAG,CAAE,KAAK,GAAG;QAClB,GAAGA,OAAO,GAAG,CAAE,KAAK;QACpB,GAAGK,SAAS;IACd;IAEA,OAAOL;AACT"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { selector } from "../../../../../dataSelector/index.js";
|
|
1
|
+
import { selector, selectorWithDynamicFilter } from "../../../../../dataSelector/index.js";
|
|
2
2
|
import { isEmpty, isNullish } from "remeda";
|
|
3
3
|
import { getCurveTension, getCurveType } from "./curve/index.js";
|
|
4
4
|
const lineStyle_lineStyle = (spec, context)=>{
|
|
@@ -37,7 +37,10 @@ const lineStyle_lineStyle = (spec, context)=>{
|
|
|
37
37
|
level: index + 1,
|
|
38
38
|
filter: (_, node)=>{
|
|
39
39
|
const lineData = node.renderNode.context.data;
|
|
40
|
-
for (const d of lineData)
|
|
40
|
+
for (const d of lineData){
|
|
41
|
+
const shouldApply = style.dynamicFilter ? selectorWithDynamicFilter(d, style.dynamicFilter, style.selector) : selector(d, style.selector);
|
|
42
|
+
if (shouldApply) return true;
|
|
43
|
+
}
|
|
41
44
|
return false;
|
|
42
45
|
},
|
|
43
46
|
style: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline/spec/chart/pipes/markStyle/lineStyle.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/markStyle/lineStyle.ts"],"sourcesContent":["import type { IAreaChartSpec } from '@visactor/vchart'\nimport { selector } from '../../../../../dataSelector'\nimport type { Datum, LineStyle, VChartSpecPipe } from 'src/types'\nimport { isEmpty, isNullish } from 'remeda'\nimport { getCurveTension, getCurveType } from './curve'\n\nexport const lineStyle: VChartSpecPipe = (spec, context) => {\n const { advancedVSeed } = context\n const { markStyle } = advancedVSeed\n const { lineStyle } = markStyle\n const result = {\n ...spec,\n line: {\n style: {},\n },\n } as IAreaChartSpec\n\n if (isNullish(lineStyle) || isEmpty(lineStyle)) {\n return result\n }\n\n const lineStyles = (Array.isArray(lineStyle) ? lineStyle : [lineStyle]) as LineStyle[]\n\n const customMap = lineStyles.reduce<object>((result, style, index) => {\n const { lineColor, lineColorOpacity, lineSmooth, lineStyle, lineWidth = 2, lineVisible = true } = style\n\n const dashSegment = lineWidth * 2\n const dashGap = lineWidth\n\n const lineDash =\n lineStyle === 'dashed' ? [dashSegment, dashSegment] : lineStyle === 'dotted' ? [dashGap / 2, dashGap * 2] : [0, 0]\n\n const curveType = getCurveType(context.vseed, lineSmooth)\n const curveTension = getCurveTension(context.vseed, lineSmooth)\n\n return {\n ...result,\n [`custom${index + 1}`]: {\n // 优先级: 后者覆盖前者\n level: index + 1,\n filter: (\n _: Datum,\n node: {\n renderNode: {\n context: {\n data: Datum[]\n }\n }\n },\n ) => {\n const lineData = node.renderNode.context.data\n for (const d of lineData) {\n
|
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/markStyle/lineStyle.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/markStyle/lineStyle.ts"],"sourcesContent":["import type { IAreaChartSpec } from '@visactor/vchart'\nimport { selector, selectorWithDynamicFilter } from '../../../../../dataSelector'\nimport type { Datum, LineStyle, VChartSpecPipe } from 'src/types'\nimport { isEmpty, isNullish } from 'remeda'\nimport { getCurveTension, getCurveType } from './curve'\n\nexport const lineStyle: VChartSpecPipe = (spec, context) => {\n const { advancedVSeed } = context\n const { markStyle } = advancedVSeed\n const { lineStyle } = markStyle\n const result = {\n ...spec,\n line: {\n style: {},\n },\n } as IAreaChartSpec\n\n if (isNullish(lineStyle) || isEmpty(lineStyle)) {\n return result\n }\n\n const lineStyles = (Array.isArray(lineStyle) ? lineStyle : [lineStyle]) as LineStyle[]\n\n const customMap = lineStyles.reduce<object>((result, style, index) => {\n const { lineColor, lineColorOpacity, lineSmooth, lineStyle, lineWidth = 2, lineVisible = true } = style\n\n const dashSegment = lineWidth * 2\n const dashGap = lineWidth\n\n const lineDash =\n lineStyle === 'dashed' ? [dashSegment, dashSegment] : lineStyle === 'dotted' ? [dashGap / 2, dashGap * 2] : [0, 0]\n\n const curveType = getCurveType(context.vseed, lineSmooth)\n const curveTension = getCurveTension(context.vseed, lineSmooth)\n\n return {\n ...result,\n [`custom${index + 1}`]: {\n // 优先级: 后者覆盖前者\n level: index + 1,\n filter: (\n _: Datum,\n node: {\n renderNode: {\n context: {\n data: Datum[]\n }\n }\n },\n ) => {\n const lineData = node.renderNode.context.data\n for (const d of lineData) {\n const shouldApply = style.dynamicFilter\n ? selectorWithDynamicFilter(d, style.dynamicFilter, style.selector)\n : selector(d, style.selector)\n if (shouldApply) {\n return true\n }\n }\n return false\n },\n style: {\n visible: lineVisible,\n curveType: curveType,\n curveTension: curveTension,\n strokeOpacity: lineColorOpacity,\n stroke: lineColor,\n lineWidth: lineWidth,\n lineDash: lineDash,\n },\n },\n }\n }, {})\n\n return {\n ...result,\n line: {\n ...result.line,\n state: {\n ...customMap,\n },\n },\n }\n}\n"],"names":["lineStyle","spec","context","advancedVSeed","markStyle","result","isNullish","isEmpty","lineStyles","Array","customMap","style","index","lineColor","lineColorOpacity","lineSmooth","lineWidth","lineVisible","dashSegment","dashGap","lineDash","curveType","getCurveType","curveTension","getCurveTension","_","node","lineData","d","shouldApply","selectorWithDynamicFilter","selector"],"mappings":";;;AAMO,MAAMA,sBAA4B,CAACC,MAAMC;IAC9C,MAAM,EAAEC,aAAa,EAAE,GAAGD;IAC1B,MAAM,EAAEE,SAAS,EAAE,GAAGD;IACtB,MAAM,EAAEH,SAAS,EAAE,GAAGI;IACtB,MAAMC,SAAS;QACb,GAAGJ,IAAI;QACP,MAAM;YACJ,OAAO,CAAC;QACV;IACF;IAEA,IAAIK,UAAUN,cAAcO,QAAQP,YAClC,OAAOK;IAGT,MAAMG,aAAcC,MAAM,OAAO,CAACT,aAAaA,YAAY;QAACA;KAAU;IAEtE,MAAMU,YAAYF,WAAW,MAAM,CAAS,CAACH,QAAQM,OAAOC;QAC1D,MAAM,EAAEC,SAAS,EAAEC,gBAAgB,EAAEC,UAAU,EAAEf,SAAS,EAAEgB,YAAY,CAAC,EAAEC,cAAc,IAAI,EAAE,GAAGN;QAElG,MAAMO,cAAcF,AAAY,IAAZA;QACpB,MAAMG,UAAUH;QAEhB,MAAMI,WACJpB,AAAc,aAAdA,YAAyB;YAACkB;YAAaA;SAAY,GAAGlB,AAAc,aAAdA,YAAyB;YAACmB,UAAU;YAAa,IAAVA;SAAY,GAAG;YAAC;YAAG;SAAE;QAEpH,MAAME,YAAYC,aAAapB,QAAQ,KAAK,EAAEa;QAC9C,MAAMQ,eAAeC,gBAAgBtB,QAAQ,KAAK,EAAEa;QAEpD,OAAO;YACL,GAAGV,MAAM;YACT,CAAC,CAAC,MAAM,EAAEO,QAAQ,GAAG,CAAC,EAAE;gBAEtB,OAAOA,QAAQ;gBACf,QAAQ,CACNa,GACAC;oBAQA,MAAMC,WAAWD,KAAK,UAAU,CAAC,OAAO,CAAC,IAAI;oBAC7C,KAAK,MAAME,KAAKD,SAAU;wBACxB,MAAME,cAAclB,MAAM,aAAa,GACnCmB,0BAA0BF,GAAGjB,MAAM,aAAa,EAAEA,MAAM,QAAQ,IAChEoB,SAASH,GAAGjB,MAAM,QAAQ;wBAC9B,IAAIkB,aACF,OAAO;oBAEX;oBACA,OAAO;gBACT;gBACA,OAAO;oBACL,SAASZ;oBACT,WAAWI;oBACX,cAAcE;oBACd,eAAeT;oBACf,QAAQD;oBACR,WAAWG;oBACX,UAAUI;gBACZ;YACF;QACF;IACF,GAAG,CAAC;IAEJ,OAAO;QACL,GAAGf,MAAM;QACT,MAAM;YACJ,GAAGA,OAAO,IAAI;YACd,OAAO;gBACL,GAAGK,SAAS;YACd;QACF;IACF;AACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { selector } from "../../../../../dataSelector/index.js";
|
|
1
|
+
import { selector, selectorWithDynamicFilter } from "../../../../../dataSelector/index.js";
|
|
2
2
|
import { isEmpty, isNullish } from "remeda";
|
|
3
3
|
const pointStyle_pointStyle = (spec, context)=>{
|
|
4
4
|
const { advancedVSeed } = context;
|
|
@@ -31,7 +31,8 @@ const pointStyle_pointStyle = (spec, context)=>{
|
|
|
31
31
|
[`custom${index + 1}`]: {
|
|
32
32
|
level: index + 1,
|
|
33
33
|
filter: (datum)=>{
|
|
34
|
-
|
|
34
|
+
const shouldApply = style.dynamicFilter ? selectorWithDynamicFilter(datum, style.dynamicFilter, style.selector) : selector(datum, style.selector);
|
|
35
|
+
if (shouldApply) return true;
|
|
35
36
|
return false;
|
|
36
37
|
},
|
|
37
38
|
style: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline/spec/chart/pipes/markStyle/pointStyle.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/markStyle/pointStyle.ts"],"sourcesContent":["import type { IAreaChartSpec } from '@visactor/vchart'\nimport { selector } from '../../../../../dataSelector'\nimport type { Datum, PointStyle, VChartSpecPipe } from 'src/types'\nimport { isEmpty, isNullish } from 'remeda'\n\nexport const pointStyle: VChartSpecPipe = (spec, context) => {\n const { advancedVSeed } = context\n const { markStyle } = advancedVSeed\n const { pointStyle } = markStyle\n const result = {\n ...spec,\n point: {\n style: {},\n },\n } as IAreaChartSpec\n\n if (isNullish(pointStyle) || isEmpty(pointStyle)) {\n return result\n }\n\n const pointStyles = (Array.isArray(pointStyle) ? pointStyle : [pointStyle]) as PointStyle[]\n\n const customMap = pointStyles.reduce<object>((result, style, index) => {\n const {\n pointBorderColor,\n pointBorderStyle,\n pointBorderWidth = 1,\n pointColor,\n pointColorOpacity,\n pointSize,\n pointVisible = true,\n } = style\n\n const lineDash = pointBorderStyle === 'dashed' ? [5, 2] : pointBorderStyle === 'dotted' ? [2, 5] : [0, 0]\n return {\n ...result,\n [`custom${index + 1}`]: {\n // 优先级: 后者覆盖前者\n level: index + 1,\n filter: (datum: Datum) => {\n
|
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/markStyle/pointStyle.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/markStyle/pointStyle.ts"],"sourcesContent":["import type { IAreaChartSpec } from '@visactor/vchart'\nimport { selector, selectorWithDynamicFilter } from '../../../../../dataSelector'\nimport type { Datum, PointStyle, VChartSpecPipe } from 'src/types'\nimport { isEmpty, isNullish } from 'remeda'\n\nexport const pointStyle: VChartSpecPipe = (spec, context) => {\n const { advancedVSeed } = context\n const { markStyle } = advancedVSeed\n const { pointStyle } = markStyle\n const result = {\n ...spec,\n point: {\n style: {},\n },\n } as IAreaChartSpec\n\n if (isNullish(pointStyle) || isEmpty(pointStyle)) {\n return result\n }\n\n const pointStyles = (Array.isArray(pointStyle) ? pointStyle : [pointStyle]) as PointStyle[]\n\n const customMap = pointStyles.reduce<object>((result, style, index) => {\n const {\n pointBorderColor,\n pointBorderStyle,\n pointBorderWidth = 1,\n pointColor,\n pointColorOpacity,\n pointSize,\n pointVisible = true,\n } = style\n\n const lineDash = pointBorderStyle === 'dashed' ? [5, 2] : pointBorderStyle === 'dotted' ? [2, 5] : [0, 0]\n return {\n ...result,\n [`custom${index + 1}`]: {\n // 优先级: 后者覆盖前者\n level: index + 1,\n filter: (datum: Datum) => {\n const shouldApply = style.dynamicFilter\n ? selectorWithDynamicFilter(datum, style.dynamicFilter, style.selector)\n : selector(datum, style.selector)\n if (shouldApply) {\n return true\n }\n return false\n },\n style: {\n visible: pointVisible,\n size: pointSize,\n fill: pointColor,\n fillOpacity: pointColorOpacity,\n innerBorder: {\n stroke: pointBorderColor,\n lineWidth: pointBorderWidth,\n distance: (pointBorderWidth || 0) / 2,\n lineDash: lineDash,\n },\n },\n },\n }\n }, {})\n\n return {\n ...result,\n point: {\n ...result.point,\n state: {\n ...customMap,\n },\n },\n }\n}\n"],"names":["pointStyle","spec","context","advancedVSeed","markStyle","result","isNullish","isEmpty","pointStyles","Array","customMap","style","index","pointBorderColor","pointBorderStyle","pointBorderWidth","pointColor","pointColorOpacity","pointSize","pointVisible","lineDash","datum","shouldApply","selectorWithDynamicFilter","selector"],"mappings":";;AAKO,MAAMA,wBAA6B,CAACC,MAAMC;IAC/C,MAAM,EAAEC,aAAa,EAAE,GAAGD;IAC1B,MAAM,EAAEE,SAAS,EAAE,GAAGD;IACtB,MAAM,EAAEH,UAAU,EAAE,GAAGI;IACvB,MAAMC,SAAS;QACb,GAAGJ,IAAI;QACP,OAAO;YACL,OAAO,CAAC;QACV;IACF;IAEA,IAAIK,UAAUN,eAAeO,QAAQP,aACnC,OAAOK;IAGT,MAAMG,cAAeC,MAAM,OAAO,CAACT,cAAcA,aAAa;QAACA;KAAW;IAE1E,MAAMU,YAAYF,YAAY,MAAM,CAAS,CAACH,QAAQM,OAAOC;QAC3D,MAAM,EACJC,gBAAgB,EAChBC,gBAAgB,EAChBC,mBAAmB,CAAC,EACpBC,UAAU,EACVC,iBAAiB,EACjBC,SAAS,EACTC,eAAe,IAAI,EACpB,GAAGR;QAEJ,MAAMS,WAAWN,AAAqB,aAArBA,mBAAgC;YAAC;YAAG;SAAE,GAAGA,AAAqB,aAArBA,mBAAgC;YAAC;YAAG;SAAE,GAAG;YAAC;YAAG;SAAE;QACzG,OAAO;YACL,GAAGT,MAAM;YACT,CAAC,CAAC,MAAM,EAAEO,QAAQ,GAAG,CAAC,EAAE;gBAEtB,OAAOA,QAAQ;gBACf,QAAQ,CAACS;oBACP,MAAMC,cAAcX,MAAM,aAAa,GACnCY,0BAA0BF,OAAOV,MAAM,aAAa,EAAEA,MAAM,QAAQ,IACpEa,SAASH,OAAOV,MAAM,QAAQ;oBAClC,IAAIW,aACF,OAAO;oBAET,OAAO;gBACT;gBACA,OAAO;oBACL,SAASH;oBACT,MAAMD;oBACN,MAAMF;oBACN,aAAaC;oBACb,aAAa;wBACX,QAAQJ;wBACR,WAAWE;wBACX,UAAWA,AAAAA,CAAAA,oBAAoB,KAAK;wBACpC,UAAUK;oBACZ;gBACF;YACF;QACF;IACF,GAAG,CAAC;IAEJ,OAAO;QACL,GAAGf,MAAM;QACT,OAAO;YACL,GAAGA,OAAO,KAAK;YACf,OAAO;gBACL,GAAGK,SAAS;YACd;QACF;IACF;AACF"}
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
import type { BodyCellStyle } from '../../../../../types';
|
|
1
|
+
import type { BodyCellStyle, Datum } from '../../../../../types';
|
|
2
2
|
export declare const pickBodyCellStyle: (bodyCellStyle: BodyCellStyle) => Record<string, any>;
|
|
3
|
+
export declare const getCellOriginalDataByDatum: (datum: any, hasDynamicFilter: boolean, originalDatum: Datum) => {
|
|
4
|
+
__row_index: any;
|
|
5
|
+
} | null;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { isArray } from "remeda";
|
|
2
|
+
import { InnerRowIndex } from "../../../../../dataReshape/index.js";
|
|
1
3
|
const tableStyleMap = {
|
|
2
4
|
backgroundColor: 'bgColor',
|
|
3
5
|
textColor: 'color',
|
|
@@ -9,6 +11,15 @@ const pickBodyCellStyle = (bodyCellStyle)=>Object.keys(tableStyleMap).reduce((ac
|
|
|
9
11
|
if (key in bodyCellStyle) acc[tableStyleMap[key]] = bodyCellStyle[key];
|
|
10
12
|
return acc;
|
|
11
13
|
}, {});
|
|
12
|
-
|
|
14
|
+
const getCellOriginalDataByDatum = (datum, hasDynamicFilter, originalDatum)=>{
|
|
15
|
+
const tableInstance = datum?.table;
|
|
16
|
+
let originRowData = tableInstance && hasDynamicFilter ? tableInstance?.getCellOriginRecord(datum?.col, datum?.row) : null;
|
|
17
|
+
if (originRowData && isArray(originRowData)) originRowData = originRowData[0];
|
|
18
|
+
return originRowData ? {
|
|
19
|
+
...originalDatum,
|
|
20
|
+
[InnerRowIndex]: originRowData?.[InnerRowIndex]
|
|
21
|
+
} : null;
|
|
22
|
+
};
|
|
23
|
+
export { getCellOriginalDataByDatum, pickBodyCellStyle };
|
|
13
24
|
|
|
14
25
|
//# sourceMappingURL=common.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline/spec/table/pipes/cellStyle/common.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/table/pipes/cellStyle/common.ts"],"sourcesContent":["import type { BodyCellStyle } from 'src/types'\n\nconst tableStyleMap = {\n backgroundColor: 'bgColor',\n textColor: 'color',\n textFontSize: 'fontSize',\n borderColor: 'borderColor',\n borderLineWidth: 'borderLineWidth',\n}\n\nexport const pickBodyCellStyle = (bodyCellStyle: BodyCellStyle) => {\n return (Object.keys(tableStyleMap) as Array<keyof typeof tableStyleMap>).reduce<Record<string, any>>((acc, key) => {\n if (key in bodyCellStyle) {\n acc[tableStyleMap[key]] = bodyCellStyle[key]\n }\n\n return acc\n }, {})\n}\n"],"names":["tableStyleMap","pickBodyCellStyle","bodyCellStyle","Object","acc","key"],"mappings":"
|
|
1
|
+
{"version":3,"file":"pipeline/spec/table/pipes/cellStyle/common.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/table/pipes/cellStyle/common.ts"],"sourcesContent":["import { isArray } from 'remeda'\nimport { InnerRowIndex } from 'src/dataReshape'\nimport type { BodyCellStyle, Datum } from 'src/types'\n\nconst tableStyleMap = {\n backgroundColor: 'bgColor',\n textColor: 'color',\n textFontSize: 'fontSize',\n borderColor: 'borderColor',\n borderLineWidth: 'borderLineWidth',\n}\n\nexport const pickBodyCellStyle = (bodyCellStyle: BodyCellStyle) => {\n return (Object.keys(tableStyleMap) as Array<keyof typeof tableStyleMap>).reduce<Record<string, any>>((acc, key) => {\n if (key in bodyCellStyle) {\n acc[tableStyleMap[key]] = bodyCellStyle[key]\n }\n\n return acc\n }, {})\n}\n\nexport const getCellOriginalDataByDatum = (datum: any, hasDynamicFilter: boolean, originalDatum: Datum) => {\n const tableInstance = datum?.table\n let originRowData =\n tableInstance && hasDynamicFilter ? tableInstance?.getCellOriginRecord(datum?.col, datum?.row) : null\n if (originRowData && isArray(originRowData)) {\n originRowData = originRowData[0]\n }\n return originRowData\n ? {\n ...originalDatum,\n [InnerRowIndex]: originRowData?.[InnerRowIndex], // 内部行号字段\n }\n : null\n}\n"],"names":["tableStyleMap","pickBodyCellStyle","bodyCellStyle","Object","acc","key","getCellOriginalDataByDatum","datum","hasDynamicFilter","originalDatum","tableInstance","originRowData","isArray","InnerRowIndex"],"mappings":";;AAIA,MAAMA,gBAAgB;IACpB,iBAAiB;IACjB,WAAW;IACX,cAAc;IACd,aAAa;IACb,iBAAiB;AACnB;AAEO,MAAMC,oBAAoB,CAACC,gBACxBC,OAAO,IAAI,CAACH,eAAqD,MAAM,CAAsB,CAACI,KAAKC;QACzG,IAAIA,OAAOH,eACTE,GAAG,CAACJ,aAAa,CAACK,IAAI,CAAC,GAAGH,aAAa,CAACG,IAAI;QAG9C,OAAOD;IACT,GAAG,CAAC;AAGC,MAAME,6BAA6B,CAACC,OAAYC,kBAA2BC;IAChF,MAAMC,gBAAgBH,OAAO;IAC7B,IAAII,gBACFD,iBAAiBF,mBAAmBE,eAAe,oBAAoBH,OAAO,KAAKA,OAAO,OAAO;IACnG,IAAII,iBAAiBC,QAAQD,gBAC3BA,gBAAgBA,aAAa,CAAC,EAAE;IAElC,OAAOA,gBACH;QACE,GAAGF,aAAa;QAChB,CAACI,cAAc,EAAEF,eAAe,CAACE,cAAc;IACjD,IACA;AACN"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { array } from "@visactor/vutils";
|
|
2
2
|
import { isNullish, isString } from "remeda";
|
|
3
|
-
import { selector } from "../../../../../dataSelector/selector.js";
|
|
4
|
-
import { pickBodyCellStyle } from "./common.js";
|
|
3
|
+
import { selector, selectorWithDynamicFilter } from "../../../../../dataSelector/selector.js";
|
|
4
|
+
import { getCellOriginalDataByDatum, pickBodyCellStyle } from "./common.js";
|
|
5
5
|
import { FoldMeasureValue, MeasureId } from "../../../../../dataReshape/index.js";
|
|
6
6
|
const pivotTableBodyCell = (spec, context)=>{
|
|
7
7
|
const { advancedVSeed } = context;
|
|
@@ -11,6 +11,7 @@ const pivotTableBodyCell = (spec, context)=>{
|
|
|
11
11
|
const bodyCellStyleList = array(bodyCellStyle);
|
|
12
12
|
const indicators = spec.indicators || [];
|
|
13
13
|
const selectedPos = [];
|
|
14
|
+
const hasDynamicFilter = bodyCellStyleList.some((style)=>!!style.dynamicFilter);
|
|
14
15
|
const newIndicators = indicators.map((ind)=>{
|
|
15
16
|
const newInd = isString(ind) ? {
|
|
16
17
|
indicatorKey: ind
|
|
@@ -29,8 +30,10 @@ const pivotTableBodyCell = (spec, context)=>{
|
|
|
29
30
|
if (path.dimensionKey) originalDatum[path.dimensionKey] = path.value;
|
|
30
31
|
});
|
|
31
32
|
if (!isNullish(originalDatum[MeasureId]) && !isNullish(originalDatum[FoldMeasureValue])) originalDatum[originalDatum[MeasureId]] = originalDatum[FoldMeasureValue];
|
|
33
|
+
const currentCellData = getCellOriginalDataByDatum(datum, hasDynamicFilter, originalDatum);
|
|
32
34
|
const mergedStyle = bodyCellStyleList.reduce((result, style)=>{
|
|
33
|
-
|
|
35
|
+
const shouldApply = style.dynamicFilter ? selectorWithDynamicFilter(currentCellData || originalDatum, style.dynamicFilter, style.selector) : selector(originalDatum, style.selector);
|
|
36
|
+
if (shouldApply) {
|
|
34
37
|
if (selectedPos.length && selectedPos[0].col === datum?.col && selectedPos[0].row === datum?.row) selectedPos.length = 0;
|
|
35
38
|
selectedPos.push({
|
|
36
39
|
col: datum?.col,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline/spec/table/pipes/cellStyle/pivot.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/table/pipes/cellStyle/pivot.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"pipeline/spec/table/pipes/cellStyle/pivot.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/table/pipes/cellStyle/pivot.ts"],"sourcesContent":["import type { IIndicator, PivotTableConstructorOptions } from '@visactor/vtable'\nimport { array } from '@visactor/vutils'\nimport { isNullish, isString } from 'remeda'\nimport { selector, selectorWithDynamicFilter } from 'src/dataSelector/selector'\nimport type { BodyCellStyle, Datum, PivotTableSpecPipe } from 'src/types'\nimport { getCellOriginalDataByDatum, pickBodyCellStyle } from './common'\nimport { FoldMeasureValue, MeasureId } from 'src/dataReshape'\n\nexport const pivotTableBodyCell: PivotTableSpecPipe = (spec, context) => {\n const { advancedVSeed } = context\n const { cellStyle } = advancedVSeed\n const bodyCellStyle = cellStyle?.bodyCellStyle\n\n if (!bodyCellStyle) {\n return spec as PivotTableConstructorOptions\n }\n const bodyCellStyleList = array(bodyCellStyle) as BodyCellStyle[]\n const indicators = (spec as PivotTableConstructorOptions).indicators || []\n const selectedPos: { col: number; row: number }[] = []\n const hasDynamicFilter = bodyCellStyleList.some((style) => !!style.dynamicFilter)\n\n const newIndicators = indicators.map((ind) => {\n const newInd = isString(ind)\n ? ({\n indicatorKey: ind,\n } as IIndicator)\n : ind\n\n const { indicatorKey } = newInd\n\n newInd.style = (datum: any) => {\n const { dataValue, cellHeaderPaths } = datum\n const headerPaths = [...cellHeaderPaths.colHeaderPaths, ...cellHeaderPaths.rowHeaderPaths]\n\n const originalDatum: Datum = {\n [indicatorKey]: dataValue,\n }\n\n headerPaths.forEach((path: any) => {\n if (path.dimensionKey) {\n originalDatum[path.dimensionKey] = path.value\n }\n })\n\n if (!isNullish(originalDatum[MeasureId]) && !isNullish(originalDatum[FoldMeasureValue])) {\n originalDatum[originalDatum[MeasureId]] = originalDatum[FoldMeasureValue]\n }\n const currentCellData = getCellOriginalDataByDatum(datum, hasDynamicFilter, originalDatum)\n\n const mergedStyle = bodyCellStyleList.reduce<Record<string, any>>((result, style) => {\n const shouldApply = style.dynamicFilter\n ? selectorWithDynamicFilter(currentCellData || originalDatum, style.dynamicFilter, style.selector)\n : selector(originalDatum, style.selector)\n if (shouldApply) {\n if (selectedPos.length && selectedPos[0].col === datum?.col && selectedPos[0].row === datum?.row) {\n // 说明重复进入了,清空历史\n selectedPos.length = 0\n }\n selectedPos.push({\n col: datum?.col,\n row: datum?.row,\n })\n return {\n ...result,\n ...pickBodyCellStyle(style),\n }\n }\n\n return result\n }, {})\n\n return mergedStyle\n }\n return newInd\n })\n return {\n ...spec,\n runningConfig: {\n ...((spec as any)?.runningConfig || {}),\n selectedPos,\n },\n indicators: newIndicators,\n } as PivotTableConstructorOptions\n}\n"],"names":["pivotTableBodyCell","spec","context","advancedVSeed","cellStyle","bodyCellStyle","bodyCellStyleList","array","indicators","selectedPos","hasDynamicFilter","style","newIndicators","ind","newInd","isString","indicatorKey","datum","dataValue","cellHeaderPaths","headerPaths","originalDatum","path","isNullish","MeasureId","FoldMeasureValue","currentCellData","getCellOriginalDataByDatum","mergedStyle","result","shouldApply","selectorWithDynamicFilter","selector","pickBodyCellStyle"],"mappings":";;;;;AAQO,MAAMA,qBAAyC,CAACC,MAAMC;IAC3D,MAAM,EAAEC,aAAa,EAAE,GAAGD;IAC1B,MAAM,EAAEE,SAAS,EAAE,GAAGD;IACtB,MAAME,gBAAgBD,WAAW;IAEjC,IAAI,CAACC,eACH,OAAOJ;IAET,MAAMK,oBAAoBC,MAAMF;IAChC,MAAMG,aAAcP,KAAsC,UAAU,IAAI,EAAE;IAC1E,MAAMQ,cAA8C,EAAE;IACtD,MAAMC,mBAAmBJ,kBAAkB,IAAI,CAAC,CAACK,QAAU,CAAC,CAACA,MAAM,aAAa;IAEhF,MAAMC,gBAAgBJ,WAAW,GAAG,CAAC,CAACK;QACpC,MAAMC,SAASC,SAASF,OACnB;YACC,cAAcA;QAChB,IACAA;QAEJ,MAAM,EAAEG,YAAY,EAAE,GAAGF;QAEzBA,OAAO,KAAK,GAAG,CAACG;YACd,MAAM,EAAEC,SAAS,EAAEC,eAAe,EAAE,GAAGF;YACvC,MAAMG,cAAc;mBAAID,gBAAgB,cAAc;mBAAKA,gBAAgB,cAAc;aAAC;YAE1F,MAAME,gBAAuB;gBAC3B,CAACL,aAAa,EAAEE;YAClB;YAEAE,YAAY,OAAO,CAAC,CAACE;gBACnB,IAAIA,KAAK,YAAY,EACnBD,aAAa,CAACC,KAAK,YAAY,CAAC,GAAGA,KAAK,KAAK;YAEjD;YAEA,IAAI,CAACC,UAAUF,aAAa,CAACG,UAAU,KAAK,CAACD,UAAUF,aAAa,CAACI,iBAAiB,GACpFJ,aAAa,CAACA,aAAa,CAACG,UAAU,CAAC,GAAGH,aAAa,CAACI,iBAAiB;YAE3E,MAAMC,kBAAkBC,2BAA2BV,OAAOP,kBAAkBW;YAE5E,MAAMO,cAActB,kBAAkB,MAAM,CAAsB,CAACuB,QAAQlB;gBACzE,MAAMmB,cAAcnB,MAAM,aAAa,GACnCoB,0BAA0BL,mBAAmBL,eAAeV,MAAM,aAAa,EAAEA,MAAM,QAAQ,IAC/FqB,SAASX,eAAeV,MAAM,QAAQ;gBAC1C,IAAImB,aAAa;oBACf,IAAIrB,YAAY,MAAM,IAAIA,WAAW,CAAC,EAAE,CAAC,GAAG,KAAKQ,OAAO,OAAOR,WAAW,CAAC,EAAE,CAAC,GAAG,KAAKQ,OAAO,KAE3FR,YAAY,MAAM,GAAG;oBAEvBA,YAAY,IAAI,CAAC;wBACf,KAAKQ,OAAO;wBACZ,KAAKA,OAAO;oBACd;oBACA,OAAO;wBACL,GAAGY,MAAM;wBACT,GAAGI,kBAAkBtB,MAAM;oBAC7B;gBACF;gBAEA,OAAOkB;YACT,GAAG,CAAC;YAEJ,OAAOD;QACT;QACA,OAAOd;IACT;IACA,OAAO;QACL,GAAGb,IAAI;QACP,eAAe;YACb,GAAKA,MAAc,iBAAiB,CAAC,CAAC;YACtCQ;QACF;QACA,YAAYG;IACd;AACF"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { array } from "@visactor/vutils";
|
|
2
2
|
import { isNullish, isNumber, isPlainObject, isString } from "remeda";
|
|
3
|
-
import { selector as selector_js_selector } from "../../../../../dataSelector/selector.js";
|
|
4
|
-
import { pickBodyCellStyle } from "./common.js";
|
|
3
|
+
import { selector as selector_js_selector, selectorWithDynamicFilter } from "../../../../../dataSelector/selector.js";
|
|
4
|
+
import { getCellOriginalDataByDatum, pickBodyCellStyle } from "./common.js";
|
|
5
5
|
import { preorderTraverse } from "../../../../utils/tree/traverse.js";
|
|
6
6
|
const tableBodyCell = (spec, context)=>{
|
|
7
7
|
const { advancedVSeed } = context;
|
|
@@ -14,17 +14,21 @@ const tableBodyCell = (spec, context)=>{
|
|
|
14
14
|
const setStyleOfColumn = (col)=>{
|
|
15
15
|
const field = col.field;
|
|
16
16
|
const matchedStyles = bodyCellStyleList.filter((style)=>{
|
|
17
|
+
if (style?.dynamicFilter) return style.dynamicFilter?.result?.success === true || !!style.dynamicFilter?.fallback;
|
|
17
18
|
if (isNullish(style.selector)) return true;
|
|
18
19
|
const selectors = array(style.selector);
|
|
19
20
|
return selectors.some((selector)=>isPlainObject(selector) ? isNullish(selector.field) || selector.field === field : isNumber(selector) || isString(selector));
|
|
20
21
|
});
|
|
21
22
|
if (!matchedStyles.length) return false;
|
|
23
|
+
const hasDynamicFilter = matchedStyles.some((style)=>!!style.dynamicFilter);
|
|
22
24
|
col.style = (datum)=>{
|
|
23
25
|
const originalDatum = {
|
|
24
26
|
[field]: datum.dataValue
|
|
25
27
|
};
|
|
28
|
+
const currentCellData = getCellOriginalDataByDatum(datum, hasDynamicFilter, originalDatum);
|
|
26
29
|
const mergedStyle = matchedStyles.reduce((result, style)=>{
|
|
27
|
-
|
|
30
|
+
const shouldApply = style.dynamicFilter ? selectorWithDynamicFilter(currentCellData || originalDatum, style.dynamicFilter, style.selector) : selector_js_selector(originalDatum, style.selector);
|
|
31
|
+
if (shouldApply) {
|
|
28
32
|
if (selectedPos.length && selectedPos[0].col === datum?.col && selectedPos[0].row === datum?.row) selectedPos.length = 0;
|
|
29
33
|
selectedPos.push({
|
|
30
34
|
col: datum?.col,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline/spec/table/pipes/cellStyle/table.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/table/pipes/cellStyle/table.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"pipeline/spec/table/pipes/cellStyle/table.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/table/pipes/cellStyle/table.ts"],"sourcesContent":["import type { ListTableConstructorOptions, ColumnDefine } from '@visactor/vtable'\nimport { array } from '@visactor/vutils'\nimport { isNullish, isNumber, isPlainObject, isString } from 'remeda'\nimport { selector, selectorWithDynamicFilter } from 'src/dataSelector/selector'\nimport type { BodyCellStyle, ListTableSpecPipe } from 'src/types'\nimport type { MeasureSelector, Selectors } from 'src/types/dataSelector'\nimport { getCellOriginalDataByDatum, pickBodyCellStyle } from './common'\nimport { preorderTraverse } from 'src/pipeline/utils/tree/traverse'\n\nexport const tableBodyCell: ListTableSpecPipe = (spec, context) => {\n const { advancedVSeed } = context\n const { cellStyle } = advancedVSeed\n const bodyCellStyle = cellStyle?.bodyCellStyle\n\n if (!bodyCellStyle) {\n return spec as ListTableConstructorOptions\n }\n const bodyCellStyleList = array(bodyCellStyle) as BodyCellStyle[]\n const columns = (spec as ListTableConstructorOptions).columns || []\n const selectedPos: { col: number; row: number }[] = []\n const setStyleOfColumn = (col: ColumnDefine) => {\n const field = col.field as string\n const matchedStyles = bodyCellStyleList.filter((style) => {\n if (style?.dynamicFilter) {\n return style.dynamicFilter?.result?.success === true || !!style.dynamicFilter?.fallback\n }\n if (isNullish(style.selector)) {\n return true\n }\n const selectors = array(style.selector) as Selectors\n\n return selectors.some((selector) => {\n return isPlainObject(selector)\n ? isNullish(selector.field) || (selector as MeasureSelector).field === field\n : isNumber(selector) || isString(selector)\n })\n })\n\n if (!matchedStyles.length) {\n return false\n }\n\n const hasDynamicFilter = matchedStyles.some((style) => !!style.dynamicFilter)\n\n col.style = (datum: any) => {\n const originalDatum = {\n [field]: datum.dataValue,\n }\n const currentCellData = getCellOriginalDataByDatum(datum, hasDynamicFilter, originalDatum)\n\n const mergedStyle = matchedStyles.reduce<Record<string, any>>((result, style) => {\n const shouldApply = style.dynamicFilter\n ? selectorWithDynamicFilter(currentCellData || originalDatum, style.dynamicFilter, style.selector)\n : selector(originalDatum, style.selector)\n\n if (shouldApply) {\n if (selectedPos.length && selectedPos[0].col === datum?.col && selectedPos[0].row === datum?.row) {\n // 说明重复进入了,清空历史\n selectedPos.length = 0\n }\n selectedPos.push({\n col: datum?.col,\n row: datum?.row,\n })\n return {\n ...result,\n ...pickBodyCellStyle(style),\n }\n }\n\n return result\n }, {})\n\n return mergedStyle\n }\n return false\n }\n\n preorderTraverse<ColumnDefine, 'columns'>(columns, setStyleOfColumn, 'columns')\n ;(spec as any).runningConfig = {\n ...((spec as any).runningConfig || {}),\n selectedPos,\n }\n\n return spec as ListTableConstructorOptions\n}\n"],"names":["tableBodyCell","spec","context","advancedVSeed","cellStyle","bodyCellStyle","bodyCellStyleList","array","columns","selectedPos","setStyleOfColumn","col","field","matchedStyles","style","isNullish","selectors","selector","isPlainObject","isNumber","isString","hasDynamicFilter","datum","originalDatum","currentCellData","getCellOriginalDataByDatum","mergedStyle","result","shouldApply","selectorWithDynamicFilter","pickBodyCellStyle","preorderTraverse"],"mappings":";;;;;AASO,MAAMA,gBAAmC,CAACC,MAAMC;IACrD,MAAM,EAAEC,aAAa,EAAE,GAAGD;IAC1B,MAAM,EAAEE,SAAS,EAAE,GAAGD;IACtB,MAAME,gBAAgBD,WAAW;IAEjC,IAAI,CAACC,eACH,OAAOJ;IAET,MAAMK,oBAAoBC,MAAMF;IAChC,MAAMG,UAAWP,KAAqC,OAAO,IAAI,EAAE;IACnE,MAAMQ,cAA8C,EAAE;IACtD,MAAMC,mBAAmB,CAACC;QACxB,MAAMC,QAAQD,IAAI,KAAK;QACvB,MAAME,gBAAgBP,kBAAkB,MAAM,CAAC,CAACQ;YAC9C,IAAIA,OAAO,eACT,OAAOA,MAAM,aAAa,EAAE,QAAQ,YAAY,QAAQ,CAAC,CAACA,MAAM,aAAa,EAAE;YAEjF,IAAIC,UAAUD,MAAM,QAAQ,GAC1B,OAAO;YAET,MAAME,YAAYT,MAAMO,MAAM,QAAQ;YAEtC,OAAOE,UAAU,IAAI,CAAC,CAACC,WACdC,cAAcD,YACjBF,UAAUE,SAAS,KAAK,KAAMA,SAA6B,KAAK,KAAKL,QACrEO,SAASF,aAAaG,SAASH;QAEvC;QAEA,IAAI,CAACJ,cAAc,MAAM,EACvB,OAAO;QAGT,MAAMQ,mBAAmBR,cAAc,IAAI,CAAC,CAACC,QAAU,CAAC,CAACA,MAAM,aAAa;QAE5EH,IAAI,KAAK,GAAG,CAACW;YACX,MAAMC,gBAAgB;gBACpB,CAACX,MAAM,EAAEU,MAAM,SAAS;YAC1B;YACA,MAAME,kBAAkBC,2BAA2BH,OAAOD,kBAAkBE;YAE5E,MAAMG,cAAcb,cAAc,MAAM,CAAsB,CAACc,QAAQb;gBACrE,MAAMc,cAAcd,MAAM,aAAa,GACnCe,0BAA0BL,mBAAmBD,eAAeT,MAAM,aAAa,EAAEA,MAAM,QAAQ,IAC/FG,qBAASM,eAAeT,MAAM,QAAQ;gBAE1C,IAAIc,aAAa;oBACf,IAAInB,YAAY,MAAM,IAAIA,WAAW,CAAC,EAAE,CAAC,GAAG,KAAKa,OAAO,OAAOb,WAAW,CAAC,EAAE,CAAC,GAAG,KAAKa,OAAO,KAE3Fb,YAAY,MAAM,GAAG;oBAEvBA,YAAY,IAAI,CAAC;wBACf,KAAKa,OAAO;wBACZ,KAAKA,OAAO;oBACd;oBACA,OAAO;wBACL,GAAGK,MAAM;wBACT,GAAGG,kBAAkBhB,MAAM;oBAC7B;gBACF;gBAEA,OAAOa;YACT,GAAG,CAAC;YAEJ,OAAOD;QACT;QACA,OAAO;IACT;IAEAK,iBAA0CvB,SAASE,kBAAkB;IACnET,KAAa,aAAa,GAAG;QAC7B,GAAKA,KAAa,aAAa,IAAI,CAAC,CAAC;QACrCQ;IACF;IAEA,OAAOR;AACT"}
|