@visactor/vseed 0.1.30 → 0.1.31
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 +2 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/pipeline/advanced/table/pipes/default/defaultMeasureName.js +2 -1
- package/dist/esm/pipeline/advanced/table/pipes/default/defaultMeasureName.js.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationPoint.js +16 -5
- package/dist/esm/pipeline/spec/chart/pipes/annotation/annotationPoint.js.map +1 -1
- package/dist/esm/pipeline/spec/table/pipeline/pivotTable.js +2 -1
- package/dist/esm/pipeline/spec/table/pipeline/pivotTable.js.map +1 -1
- package/dist/esm/pipeline/spec/table/pipes/corner/index.d.ts +1 -0
- package/dist/esm/pipeline/spec/table/pipes/corner/index.js +2 -0
- package/dist/esm/pipeline/spec/table/pipes/corner/titleOnDimension.d.ts +2 -0
- package/dist/esm/pipeline/spec/table/pipes/corner/titleOnDimension.js +12 -0
- package/dist/esm/pipeline/spec/table/pipes/corner/titleOnDimension.js.map +1 -0
- package/dist/esm/pipeline/spec/table/pipes/index.d.ts +1 -0
- package/dist/esm/pipeline/spec/table/pipes/index.js +1 -0
- package/dist/esm/pipeline/spec/table/pipes/indicators/pivotIndicators.js +5 -3
- package/dist/esm/pipeline/spec/table/pipes/indicators/pivotIndicators.js.map +1 -1
- package/dist/esm/pipeline/spec/table/pipes/rows/pivotRows.js.map +1 -1
- package/dist/esm/pipeline/utils/chatType.d.ts +1 -0
- package/dist/esm/pipeline/utils/chatType.js +2 -1
- package/dist/esm/pipeline/utils/chatType.js.map +1 -1
- package/dist/umd/index.js +35 -10
- package/dist/umd/index.js.map +1 -1
- package/package.json +1 -1
@@ -8,7 +8,8 @@ const defaultMeasureName = (advancedVSeed)=>{
|
|
8
8
|
const measures = findAllMeasures(advancedVSeed.measures);
|
9
9
|
if (measures.length > 1 && !result.dimensions?.some((dim)=>dim.id === MeasureName)) result.dimensions?.push({
|
10
10
|
id: MeasureName,
|
11
|
-
alias: intl.i18n
|
11
|
+
alias: intl.i18n`指标名称`,
|
12
|
+
encoding: 'column'
|
12
13
|
});
|
13
14
|
return result;
|
14
15
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"pipeline/advanced/table/pipes/default/defaultMeasureName.js","sources":["webpack://@visactor/vseed/./src/pipeline/advanced/table/pipes/default/defaultMeasureName.ts"],"sourcesContent":["import { MeasureName } from 'src/dataReshape'\nimport { intl } from 'src/i18n'\nimport { findAllMeasures } from 'src/pipeline/utils/measures/find'\nimport type { AdvancedPipe, Dimension, DimensionTree } from 'src/types'\n\nexport const defaultMeasureName: AdvancedPipe = (advancedVSeed) => {\n const result = { ...advancedVSeed }\n const measures = findAllMeasures(advancedVSeed.measures as DimensionTree)\n\n // 如果没有指标名称维度,则默认添加指标名称维度\n if (measures.length > 1 && !result.dimensions?.some((dim) => dim.id === MeasureName)) {\n result.dimensions?.push({\n id: MeasureName,\n alias: intl.i18n`指标名称`,\n } as Dimension)\n }\n\n return result\n}\n"],"names":["defaultMeasureName","advancedVSeed","result","measures","findAllMeasures","dim","MeasureName","intl"],"mappings":";;;AAKO,MAAMA,qBAAmC,CAACC;IAC/C,MAAMC,SAAS;QAAE,GAAGD,aAAa;IAAC;IAClC,MAAME,WAAWC,gBAAgBH,cAAc,QAAQ;IAGvD,IAAIE,SAAS,MAAM,GAAG,KAAK,CAACD,OAAO,UAAU,EAAE,KAAK,CAACG,MAAQA,IAAI,EAAE,KAAKC,cACtEJ,OAAO,UAAU,EAAE,KAAK;QACtB,IAAII;QACJ,OAAOC,KAAK,IAAI,CAAC,IAAI,CAAC;
|
1
|
+
{"version":3,"file":"pipeline/advanced/table/pipes/default/defaultMeasureName.js","sources":["webpack://@visactor/vseed/./src/pipeline/advanced/table/pipes/default/defaultMeasureName.ts"],"sourcesContent":["import { MeasureName } from 'src/dataReshape'\nimport { intl } from 'src/i18n'\nimport { findAllMeasures } from 'src/pipeline/utils/measures/find'\nimport type { AdvancedPipe, Dimension, DimensionTree } from 'src/types'\n\nexport const defaultMeasureName: AdvancedPipe = (advancedVSeed) => {\n const result = { ...advancedVSeed }\n const measures = findAllMeasures(advancedVSeed.measures as DimensionTree)\n\n // 如果没有指标名称维度,则默认添加指标名称维度\n if (measures.length > 1 && !result.dimensions?.some((dim) => dim.id === MeasureName)) {\n result.dimensions?.push({\n id: MeasureName,\n alias: intl.i18n`指标名称`,\n encoding: 'column',\n } as Dimension)\n }\n\n return result\n}\n"],"names":["defaultMeasureName","advancedVSeed","result","measures","findAllMeasures","dim","MeasureName","intl"],"mappings":";;;AAKO,MAAMA,qBAAmC,CAACC;IAC/C,MAAMC,SAAS;QAAE,GAAGD,aAAa;IAAC;IAClC,MAAME,WAAWC,gBAAgBH,cAAc,QAAQ;IAGvD,IAAIE,SAAS,MAAM,GAAG,KAAK,CAACD,OAAO,UAAU,EAAE,KAAK,CAACG,MAAQA,IAAI,EAAE,KAAKC,cACtEJ,OAAO,UAAU,EAAE,KAAK;QACtB,IAAII;QACJ,OAAOC,KAAK,IAAI,CAAC,IAAI,CAAC;QACtB,UAAU;IACZ;IAGF,OAAOL;AACT"}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { selector } from "../../../../../dataSelector/index.js";
|
2
2
|
import { isSubset } from "./utils.js";
|
3
3
|
import { ANNOTATION_Z_INDEX } from "../../../../utils/constant.js";
|
4
|
+
import { isBarLikeChart } from "../../../../utils/chatType.js";
|
4
5
|
const annotationPoint_annotationPoint = (spec, context)=>{
|
5
6
|
const { advancedVSeed } = context;
|
6
7
|
const { annotation } = advancedVSeed;
|
@@ -9,10 +10,20 @@ const annotationPoint_annotationPoint = (spec, context)=>{
|
|
9
10
|
const annotationPointList = Array.isArray(annotationPoint) ? annotationPoint : [
|
10
11
|
annotationPoint
|
11
12
|
];
|
13
|
+
const isHorizontalBar = isBarLikeChart(advancedVSeed);
|
14
|
+
const defaultStyle = isHorizontalBar ? {
|
15
|
+
textAlign: 'right',
|
16
|
+
textBaseline: 'middle'
|
17
|
+
} : {
|
18
|
+
textAlign: 'center',
|
19
|
+
textBaseline: 'top'
|
20
|
+
};
|
12
21
|
const markPoint = annotationPointList.flatMap((annotationPoint)=>{
|
13
|
-
const { selector: selectorPoint, text = '', textColor = '#ffffff', textFontSize = 12, textFontWeight = 400, textAlign =
|
22
|
+
const { selector: selectorPoint, text = '', textColor = '#ffffff', textFontSize = 12, textFontWeight = 400, textAlign = defaultStyle.textAlign, textBaseline = defaultStyle.textBaseline, textBackgroundBorderColor, textBackgroundBorderRadius = 4, textBackgroundBorderWidth = 1, textBackgroundColor = '#212121', textBackgroundPadding = 2, textBackgroundVisible = true, offsetX = 0, offsetY = 0 } = annotationPoint;
|
14
23
|
const dataset = advancedVSeed.dataset.flat();
|
15
24
|
const selectedData = selectorPoint ? dataset.filter((datum)=>selector(datum, selectorPoint)) : [];
|
25
|
+
const dx = -10 - (isHorizontalBar ? textFontSize : 0);
|
26
|
+
const dy = isHorizontalBar ? 0 : textFontSize;
|
16
27
|
return selectedData.map((datum)=>({
|
17
28
|
zIndex: ANNOTATION_Z_INDEX,
|
18
29
|
regionRelative: true,
|
@@ -35,8 +46,8 @@ const annotationPoint_annotationPoint = (spec, context)=>{
|
|
35
46
|
lineWidth: 1,
|
36
47
|
fontSize: textFontSize,
|
37
48
|
fontWeight: textFontWeight,
|
38
|
-
|
39
|
-
|
49
|
+
dx,
|
50
|
+
dy
|
40
51
|
},
|
41
52
|
labelBackground: {
|
42
53
|
visible: textBackgroundVisible,
|
@@ -46,8 +57,8 @@ const annotationPoint_annotationPoint = (spec, context)=>{
|
|
46
57
|
fill: textBackgroundColor,
|
47
58
|
stroke: textBackgroundBorderColor,
|
48
59
|
lineWidth: textBackgroundBorderWidth,
|
49
|
-
|
50
|
-
|
60
|
+
dx,
|
61
|
+
dy
|
51
62
|
}
|
52
63
|
}
|
53
64
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"pipeline/spec/chart/pipes/annotation/annotationPoint.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/annotation/annotationPoint.ts"],"sourcesContent":["import type { ILineChartSpec } from '@visactor/vchart'\nimport { selector } from '../../../../../dataSelector'\nimport type { Datum, SpecPipe } from 'src/types'\nimport { isSubset } from './utils'\nimport { ANNOTATION_Z_INDEX } from '../../../../utils/constant'\n\nexport const annotationPoint: SpecPipe = (spec, context) => {\n const { advancedVSeed } = context\n const { annotation } = advancedVSeed\n\n if (!annotation || !annotation.annotationPoint) {\n return spec\n }\n\n const { annotationPoint } = annotation\n const annotationPointList = Array.isArray(annotationPoint) ? annotationPoint : [annotationPoint]\n\n const markPoint = annotationPointList.flatMap((annotationPoint) => {\n const {\n selector: selectorPoint,\n text = '',\n textColor = '#ffffff',\n textFontSize = 12,\n textFontWeight = 400,\n textAlign =
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/annotation/annotationPoint.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/annotation/annotationPoint.ts"],"sourcesContent":["import type { ILineChartSpec } from '@visactor/vchart'\nimport { selector } from '../../../../../dataSelector'\nimport type { Datum, SpecPipe } from 'src/types'\nimport { isSubset } from './utils'\nimport { ANNOTATION_Z_INDEX } from '../../../../utils/constant'\nimport { isBarLikeChart } from 'src/pipeline/utils/chatType'\n\nexport const annotationPoint: SpecPipe = (spec, context) => {\n const { advancedVSeed } = context\n const { annotation } = advancedVSeed\n\n if (!annotation || !annotation.annotationPoint) {\n return spec\n }\n\n const { annotationPoint } = annotation\n const annotationPointList = Array.isArray(annotationPoint) ? annotationPoint : [annotationPoint]\n const isHorizontalBar = isBarLikeChart(advancedVSeed)\n const defaultStyle = isHorizontalBar\n ? {\n textAlign: 'right',\n textBaseline: 'middle',\n }\n : {\n textAlign: 'center',\n textBaseline: 'top',\n }\n\n const markPoint = annotationPointList.flatMap((annotationPoint) => {\n const {\n selector: selectorPoint,\n text = '',\n textColor = '#ffffff',\n textFontSize = 12,\n textFontWeight = 400,\n textAlign = defaultStyle.textAlign,\n textBaseline = defaultStyle.textBaseline,\n textBackgroundBorderColor,\n textBackgroundBorderRadius = 4,\n textBackgroundBorderWidth = 1,\n textBackgroundColor = '#212121',\n textBackgroundPadding = 2,\n textBackgroundVisible = true,\n offsetX = 0,\n offsetY = 0,\n } = annotationPoint\n\n const dataset = advancedVSeed.dataset.flat()\n const selectedData = selectorPoint ? dataset.filter((datum) => selector(datum, selectorPoint)) : []\n const dx = -10 - (isHorizontalBar ? (textFontSize as number) : 0) // 由于vchart tag实现问题,需要设置这个强制偏移量\n const dy = isHorizontalBar ? 0 : (textFontSize as number)\n\n return selectedData.map((datum) => {\n return {\n zIndex: ANNOTATION_Z_INDEX,\n regionRelative: true,\n coordinate: (data: Datum[]) => {\n return data.find((item) => isSubset(datum, item))\n },\n\n itemLine: {\n visible: false,\n },\n itemContent: {\n offsetY,\n offsetX,\n confine: true,\n text: {\n text: text,\n style: {\n visible: true,\n textAlign: textAlign,\n textBaseline: textBaseline,\n fill: textColor,\n stroke: textBackgroundColor,\n lineWidth: 1,\n fontSize: textFontSize,\n fontWeight: textFontWeight,\n dx,\n dy,\n },\n labelBackground: {\n visible: textBackgroundVisible,\n padding: textBackgroundPadding,\n style: {\n cornerRadius: textBackgroundBorderRadius ?? 4,\n fill: textBackgroundColor,\n stroke: textBackgroundBorderColor,\n lineWidth: textBackgroundBorderWidth,\n dx,\n dy,\n },\n },\n },\n },\n }\n })\n }) as ILineChartSpec['markPoint']\n\n return {\n ...spec,\n markPoint,\n }\n}\n"],"names":["annotationPoint","spec","context","advancedVSeed","annotation","annotationPointList","Array","isHorizontalBar","isBarLikeChart","defaultStyle","markPoint","selectorPoint","text","textColor","textFontSize","textFontWeight","textAlign","textBaseline","textBackgroundBorderColor","textBackgroundBorderRadius","textBackgroundBorderWidth","textBackgroundColor","textBackgroundPadding","textBackgroundVisible","offsetX","offsetY","dataset","selectedData","datum","selector","dx","dy","ANNOTATION_Z_INDEX","data","item","isSubset"],"mappings":";;;;AAOO,MAAMA,kCAA4B,CAACC,MAAMC;IAC9C,MAAM,EAAEC,aAAa,EAAE,GAAGD;IAC1B,MAAM,EAAEE,UAAU,EAAE,GAAGD;IAEvB,IAAI,CAACC,cAAc,CAACA,WAAW,eAAe,EAC5C,OAAOH;IAGT,MAAM,EAAED,eAAe,EAAE,GAAGI;IAC5B,MAAMC,sBAAsBC,MAAM,OAAO,CAACN,mBAAmBA,kBAAkB;QAACA;KAAgB;IAChG,MAAMO,kBAAkBC,eAAeL;IACvC,MAAMM,eAAeF,kBACjB;QACE,WAAW;QACX,cAAc;IAChB,IACA;QACE,WAAW;QACX,cAAc;IAChB;IAEJ,MAAMG,YAAYL,oBAAoB,OAAO,CAAC,CAACL;QAC7C,MAAM,EACJ,UAAUW,aAAa,EACvBC,OAAO,EAAE,EACTC,YAAY,SAAS,EACrBC,eAAe,EAAE,EACjBC,iBAAiB,GAAG,EACpBC,YAAYP,aAAa,SAAS,EAClCQ,eAAeR,aAAa,YAAY,EACxCS,yBAAyB,EACzBC,6BAA6B,CAAC,EAC9BC,4BAA4B,CAAC,EAC7BC,sBAAsB,SAAS,EAC/BC,wBAAwB,CAAC,EACzBC,wBAAwB,IAAI,EAC5BC,UAAU,CAAC,EACXC,UAAU,CAAC,EACZ,GAAGzB;QAEJ,MAAM0B,UAAUvB,cAAc,OAAO,CAAC,IAAI;QAC1C,MAAMwB,eAAehB,gBAAgBe,QAAQ,MAAM,CAAC,CAACE,QAAUC,SAASD,OAAOjB,kBAAkB,EAAE;QACnG,MAAMmB,KAAK,MAAOvB,CAAAA,kBAAmBO,eAA0B;QAC/D,MAAMiB,KAAKxB,kBAAkB,IAAKO;QAElC,OAAOa,aAAa,GAAG,CAAC,CAACC,QAChB;gBACL,QAAQI;gBACR,gBAAgB;gBAChB,YAAY,CAACC,OACJA,KAAK,IAAI,CAAC,CAACC,OAASC,SAASP,OAAOM;gBAG7C,UAAU;oBACR,SAAS;gBACX;gBACA,aAAa;oBACXT;oBACAD;oBACA,SAAS;oBACT,MAAM;wBACJ,MAAMZ;wBACN,OAAO;4BACL,SAAS;4BACT,WAAWI;4BACX,cAAcC;4BACd,MAAMJ;4BACN,QAAQQ;4BACR,WAAW;4BACX,UAAUP;4BACV,YAAYC;4BACZe;4BACAC;wBACF;wBACA,iBAAiB;4BACf,SAASR;4BACT,SAASD;4BACT,OAAO;gCACL,cAAcH,8BAA8B;gCAC5C,MAAME;gCACN,QAAQH;gCACR,WAAWE;gCACXU;gCACAC;4BACF;wBACF;oBACF;gBACF;YACF;IAEJ;IAEA,OAAO;QACL,GAAG9B,IAAI;QACPS;IACF;AACF"}
|
@@ -1,9 +1,10 @@
|
|
1
|
-
import { bodyStyle, cornerHeaderStyle, frameStyle, headerStyle, initPivotTable, pivotColumns, pivotIndicators, pivotRows, rowHeaderStyle, selectionStyle } from "../pipes/index.js";
|
1
|
+
import { bodyStyle, cornerHeaderStyle, frameStyle, headerStyle, initPivotTable, pivotColumns, pivotIndicators, pivotRows, rowHeaderStyle, selectionStyle, titleOnDimension } from "../pipes/index.js";
|
2
2
|
import { dataConfig } from "../pipes/indicators/pivotDataConfig.js";
|
3
3
|
const pivotTableSpecPipeline = [
|
4
4
|
initPivotTable,
|
5
5
|
pivotColumns,
|
6
6
|
pivotRows,
|
7
|
+
titleOnDimension,
|
7
8
|
pivotIndicators,
|
8
9
|
bodyStyle,
|
9
10
|
headerStyle,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"pipeline/spec/table/pipeline/pivotTable.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/table/pipeline/pivotTable.ts"],"sourcesContent":["import type { SpecPipeline } from 'src/types'\nimport {\n initPivotTable,\n pivotColumns,\n pivotRows,\n pivotIndicators,\n bodyStyle,\n headerStyle,\n rowHeaderStyle,\n cornerHeaderStyle,\n frameStyle,\n selectionStyle,\n} from '../pipes'\nimport { dataConfig } from '../pipes/indicators/pivotDataConfig'\n\nexport const pivotTableSpecPipeline: SpecPipeline = [\n initPivotTable,\n pivotColumns,\n pivotRows,\n pivotIndicators,\n bodyStyle,\n headerStyle,\n rowHeaderStyle,\n cornerHeaderStyle,\n frameStyle,\n selectionStyle,\n dataConfig,\n]\n"],"names":["pivotTableSpecPipeline","initPivotTable","pivotColumns","pivotRows","pivotIndicators","bodyStyle","headerStyle","rowHeaderStyle","cornerHeaderStyle","frameStyle","selectionStyle","dataConfig"],"mappings":";;
|
1
|
+
{"version":3,"file":"pipeline/spec/table/pipeline/pivotTable.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/table/pipeline/pivotTable.ts"],"sourcesContent":["import type { SpecPipeline } from 'src/types'\nimport {\n initPivotTable,\n pivotColumns,\n pivotRows,\n pivotIndicators,\n bodyStyle,\n headerStyle,\n rowHeaderStyle,\n cornerHeaderStyle,\n frameStyle,\n selectionStyle,\n titleOnDimension,\n} from '../pipes'\nimport { dataConfig } from '../pipes/indicators/pivotDataConfig'\n\nexport const pivotTableSpecPipeline: SpecPipeline = [\n initPivotTable,\n pivotColumns,\n pivotRows,\n titleOnDimension,\n pivotIndicators,\n bodyStyle,\n headerStyle,\n rowHeaderStyle,\n cornerHeaderStyle,\n frameStyle,\n selectionStyle,\n dataConfig,\n]\n"],"names":["pivotTableSpecPipeline","initPivotTable","pivotColumns","pivotRows","titleOnDimension","pivotIndicators","bodyStyle","headerStyle","rowHeaderStyle","cornerHeaderStyle","frameStyle","selectionStyle","dataConfig"],"mappings":";;AAgBO,MAAMA,yBAAuC;IAClDC;IACAC;IACAC;IACAC;IACAC;IACAC;IACAC;IACAC;IACAC;IACAC;IACAC;IACAC;CACD"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export { titleOnDimension } from './titleOnDimension';
|
@@ -0,0 +1,12 @@
|
|
1
|
+
const titleOnDimension = (spec)=>{
|
2
|
+
const { rows = [], columns = [] } = spec;
|
3
|
+
return {
|
4
|
+
...spec,
|
5
|
+
corner: {
|
6
|
+
titleOnDimension: rows.length <= 1 && columns.length >= 1 ? 'column' : 'row'
|
7
|
+
}
|
8
|
+
};
|
9
|
+
};
|
10
|
+
export { titleOnDimension };
|
11
|
+
|
12
|
+
//# sourceMappingURL=titleOnDimension.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"pipeline/spec/table/pipes/corner/titleOnDimension.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/table/pipes/corner/titleOnDimension.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/no-unsafe-assignment */\nimport type { SpecPipe } from 'src/types'\n\nexport const titleOnDimension: SpecPipe = (spec) => {\n const { rows = [], columns = [] } = spec as any\n\n return {\n ...spec,\n corner: {\n titleOnDimension: (rows as any[]).length <= 1 && (columns as any[]).length >= 1 ? 'column' : 'row',\n },\n }\n}\n"],"names":["titleOnDimension","spec","rows","columns"],"mappings":"AAIO,MAAMA,mBAA6B,CAACC;IACzC,MAAM,EAAEC,OAAO,EAAE,EAAEC,UAAU,EAAE,EAAE,GAAGF;IAEpC,OAAO;QACL,GAAGA,IAAI;QACP,QAAQ;YACN,kBAAmBC,KAAe,MAAM,IAAI,KAAMC,QAAkB,MAAM,IAAI,IAAI,WAAW;QAC/F;IACF;AACF"}
|
@@ -5,16 +5,18 @@ const pivotIndicators = (spec, context)=>{
|
|
5
5
|
const { advancedVSeed } = context;
|
6
6
|
const { measures, datasetReshapeInfo } = advancedVSeed;
|
7
7
|
const { foldInfo } = datasetReshapeInfo[0];
|
8
|
+
const hasRow = spec?.rows?.length > 0;
|
9
|
+
const foldMapValues = Object.values(foldInfo.foldMap);
|
8
10
|
return {
|
9
11
|
...spec,
|
10
|
-
indicatorsAsCol: true,
|
11
12
|
indicatorTitle: intl.i18n`指标名称`,
|
12
|
-
|
13
|
+
indicatorsAsCol: hasRow,
|
14
|
+
hideIndicatorName: hasRow,
|
13
15
|
indicators: [
|
14
16
|
{
|
15
17
|
cellType: 'text',
|
16
18
|
indicatorKey: foldInfo.measureValue,
|
17
|
-
title: '
|
19
|
+
title: foldMapValues.length > 1 ? '' : foldMapValues[0],
|
18
20
|
width: 'auto',
|
19
21
|
format: fieldFormat(measures, foldInfo)
|
20
22
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"pipeline/spec/table/pipes/indicators/pivotIndicators.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/table/pipes/indicators/pivotIndicators.ts"],"sourcesContent":["import type { PivotChartConstructorOptions } from '@visactor/vtable'\nimport type { BaseTableAPI, FieldFormat } from '@visactor/vtable/es/ts-types'\nimport { isNumber } from 'remeda'\nimport { intl } from 'src/i18n'\nimport { createFormatterByMeasure, findMeasureById } from 'src/pipeline/utils'\nimport type { Datum, FoldInfo, MeasureTree, SpecPipe } from 'src/types'\n\nexport const pivotIndicators: SpecPipe = (spec, context) => {\n const { advancedVSeed } = context\n const { measures, datasetReshapeInfo } = advancedVSeed\n const { foldInfo } = datasetReshapeInfo[0]\n\n return {\n ...spec,\n
|
1
|
+
{"version":3,"file":"pipeline/spec/table/pipes/indicators/pivotIndicators.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/table/pipes/indicators/pivotIndicators.ts"],"sourcesContent":["import type { PivotChartConstructorOptions } from '@visactor/vtable'\nimport type { BaseTableAPI, FieldFormat } from '@visactor/vtable/es/ts-types'\nimport { isNumber } from 'remeda'\nimport { intl } from 'src/i18n'\nimport { createFormatterByMeasure, findMeasureById } from 'src/pipeline/utils'\nimport type { Datum, FoldInfo, MeasureTree, SpecPipe } from 'src/types'\n\nexport const pivotIndicators: SpecPipe = (spec, context) => {\n const { advancedVSeed } = context\n const { measures, datasetReshapeInfo } = advancedVSeed\n const { foldInfo } = datasetReshapeInfo[0]\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access\n const hasRow = ((spec as any)?.rows as any[])?.length > 0\n const foldMapValues = Object.values(foldInfo.foldMap)\n\n return {\n ...spec,\n indicatorTitle: intl.i18n`指标名称`,\n indicatorsAsCol: hasRow,\n hideIndicatorName: hasRow,\n indicators: [\n {\n cellType: 'text',\n indicatorKey: foldInfo.measureValue,\n title: foldMapValues.length > 1 ? '' : foldMapValues[0],\n width: 'auto',\n format: fieldFormat(measures, foldInfo as FoldInfo),\n },\n ] as unknown as PivotChartConstructorOptions['indicators'],\n }\n}\n\nconst fieldFormat = (measures: MeasureTree, foldInfo: FoldInfo): FieldFormat => {\n return (value: number | string, col?: number, row?: number, table?: BaseTableAPI) => {\n if (!isNumber(col) || !isNumber(row) || !table) {\n return value\n }\n\n const datum = table.getCellOriginRecord(col, row) as Datum[]\n if (!datum[0]) {\n return value\n }\n const { measureId: foldMeasureId } = foldInfo\n const measureId = datum[0][foldMeasureId] as string\n const measure = findMeasureById(measures, measureId)\n const formatter = createFormatterByMeasure(measure)\n return formatter(value)\n }\n}\n"],"names":["pivotIndicators","spec","context","advancedVSeed","measures","datasetReshapeInfo","foldInfo","hasRow","foldMapValues","Object","intl","fieldFormat","value","col","row","table","isNumber","datum","foldMeasureId","measureId","measure","findMeasureById","formatter","createFormatterByMeasure"],"mappings":";;;AAOO,MAAMA,kBAA4B,CAACC,MAAMC;IAC9C,MAAM,EAAEC,aAAa,EAAE,GAAGD;IAC1B,MAAM,EAAEE,QAAQ,EAAEC,kBAAkB,EAAE,GAAGF;IACzC,MAAM,EAAEG,QAAQ,EAAE,GAAGD,kBAAkB,CAAC,EAAE;IAE1C,MAAME,SAAWN,MAAc,MAAgB,SAAS;IACxD,MAAMO,gBAAgBC,OAAO,MAAM,CAACH,SAAS,OAAO;IAEpD,OAAO;QACL,GAAGL,IAAI;QACP,gBAAgBS,KAAK,IAAI,CAAC,IAAI,CAAC;QAC/B,iBAAiBH;QACjB,mBAAmBA;QACnB,YAAY;YACV;gBACE,UAAU;gBACV,cAAcD,SAAS,YAAY;gBACnC,OAAOE,cAAc,MAAM,GAAG,IAAI,KAAKA,aAAa,CAAC,EAAE;gBACvD,OAAO;gBACP,QAAQG,YAAYP,UAAUE;YAChC;SACD;IACH;AACF;AAEA,MAAMK,cAAc,CAACP,UAAuBE,WACnC,CAACM,OAAwBC,KAAcC,KAAcC;QAC1D,IAAI,CAACC,SAASH,QAAQ,CAACG,SAASF,QAAQ,CAACC,OACvC,OAAOH;QAGT,MAAMK,QAAQF,MAAM,mBAAmB,CAACF,KAAKC;QAC7C,IAAI,CAACG,KAAK,CAAC,EAAE,EACX,OAAOL;QAET,MAAM,EAAE,WAAWM,aAAa,EAAE,GAAGZ;QACrC,MAAMa,YAAYF,KAAK,CAAC,EAAE,CAACC,cAAc;QACzC,MAAME,UAAUC,gBAAgBjB,UAAUe;QAC1C,MAAMG,YAAYC,yBAAyBH;QAC3C,OAAOE,UAAUV;IACnB"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"pipeline/spec/table/pipes/rows/pivotRows.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/table/pipes/rows/pivotRows.ts"],"sourcesContent":["import type { Dimensions, SpecPipe } from 'src/types'\n\nexport const pivotRows: SpecPipe = (spec, context) => {\n const { advancedVSeed } = context\n const dimensions = advancedVSeed.dimensions as Dimensions\n const { encoding } = advancedVSeed\n const rows = dimensions.filter((item) => encoding.row?.includes(item.id))\n return {\n ...spec,\n rows: rows.map((item) => {\n return {\n dimensionKey: item.id,\n title: item.alias || item.id,\n width: 'auto',\n }\n }),\n }\n}\n"],"names":["pivotRows","spec","context","advancedVSeed","dimensions","encoding","rows","item"],"mappings":"AAEO,MAAMA,YAAsB,CAACC,MAAMC;IACxC,MAAM,EAAEC,aAAa,EAAE,GAAGD;IAC1B,MAAME,aAAaD,cAAc,UAAU;IAC3C,MAAM,EAAEE,QAAQ,EAAE,GAAGF;IACrB,MAAMG,OAAOF,WAAW,MAAM,CAAC,CAACG,OAASF,SAAS,GAAG,EAAE,SAASE,KAAK,EAAE;
|
1
|
+
{"version":3,"file":"pipeline/spec/table/pipes/rows/pivotRows.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/table/pipes/rows/pivotRows.ts"],"sourcesContent":["import type { Dimensions, SpecPipe } from 'src/types'\n\nexport const pivotRows: SpecPipe = (spec, context) => {\n const { advancedVSeed } = context\n const dimensions = advancedVSeed.dimensions as Dimensions\n const { encoding } = advancedVSeed\n const rows = dimensions.filter((item) => encoding.row?.includes(item.id))\n\n return {\n ...spec,\n rows: rows.map((item) => {\n return {\n dimensionKey: item.id,\n title: item.alias || item.id,\n width: 'auto',\n }\n }),\n }\n}\n"],"names":["pivotRows","spec","context","advancedVSeed","dimensions","encoding","rows","item"],"mappings":"AAEO,MAAMA,YAAsB,CAACC,MAAMC;IACxC,MAAM,EAAEC,aAAa,EAAE,GAAGD;IAC1B,MAAME,aAAaD,cAAc,UAAU;IAC3C,MAAM,EAAEE,QAAQ,EAAE,GAAGF;IACrB,MAAMG,OAAOF,WAAW,MAAM,CAAC,CAACG,OAASF,SAAS,GAAG,EAAE,SAASE,KAAK,EAAE;IAEvE,OAAO;QACL,GAAGN,IAAI;QACP,MAAMK,KAAK,GAAG,CAAC,CAACC,OACP;gBACL,cAAcA,KAAK,EAAE;gBACrB,OAAOA,KAAK,KAAK,IAAIA,KAAK,EAAE;gBAC5B,OAAO;YACT;IAEJ;AACF"}
|
@@ -5,6 +5,7 @@ export declare const isRadar: (vseed: VSeed) => vseed is import("../../types").R
|
|
5
5
|
export declare const isAreaPercent: (vseed: VSeed) => vseed is import("../../types").AreaPercent;
|
6
6
|
export declare const isColumnPercent: (vseed: VSeed) => vseed is import("../../types").ColumnPercent;
|
7
7
|
export declare const isBarPercent: (vseed: VSeed) => vseed is import("../../types").BarPercent;
|
8
|
+
export declare const isBarLikeChart: (vseed: VSeed) => vseed is import("../../types").Bar | import("../../types").BarParallel | import("../../types").BarPercent;
|
8
9
|
export declare const isVTable: (vseed: VSeed) => boolean;
|
9
10
|
export declare const isVChart: (vseed: VSeed) => boolean;
|
10
11
|
/**
|
@@ -8,6 +8,7 @@ const isRadar = (vseed)=>vseed.chartType === ChartTypeEnum.Radar;
|
|
8
8
|
const isAreaPercent = (vseed)=>vseed.chartType === ChartTypeEnum.AreaPercent;
|
9
9
|
const isColumnPercent = (vseed)=>vseed.chartType === ChartTypeEnum.ColumnPercent;
|
10
10
|
const isBarPercent = (vseed)=>vseed.chartType === ChartTypeEnum.BarPercent;
|
11
|
+
const isBarLikeChart = (vseed)=>vseed.chartType === ChartTypeEnum.Bar || vseed.chartType === ChartTypeEnum.BarPercent || vseed.chartType === ChartTypeEnum.BarParallel;
|
11
12
|
const isVTable = (vseed)=>[
|
12
13
|
'table',
|
13
14
|
'pivotTable'
|
@@ -49,6 +50,6 @@ const isCombination = (vseed)=>{
|
|
49
50
|
const hasMeasureGroup = measures && measures.some((measure)=>measure && measure.children);
|
50
51
|
return hasMeasureGroup;
|
51
52
|
};
|
52
|
-
export { isAreaPercent, isBarPercent, isColumnPercent, isCombination, isPivot, isPivotChart, isPivotTable, isRadar, isTable, isVChart, isVTable };
|
53
|
+
export { isAreaPercent, isBarLikeChart, isBarPercent, isColumnPercent, isCombination, isPivot, isPivotChart, isPivotTable, isRadar, isTable, isVChart, isVTable };
|
53
54
|
|
54
55
|
//# sourceMappingURL=chatType.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"pipeline/utils/chatType.js","sources":["webpack://@visactor/vseed/./src/pipeline/utils/chatType.ts"],"sourcesContent":["import { type Dimensions, type DimensionGroup, type DimensionTree, type VSeed, type Measure } from 'src/types'\nimport { measureDepth } from './measures'\nimport { isMeasureTreeWithChildren, isMeasureTreeWithParentId } from '../advanced/chart/pipes/measures/utils'\nimport { unique } from 'remeda'\nimport { ChartTypeEnum, DEFAULT_PARENT_ID } from './constant'\n\nexport const isTable = (vseed: VSeed) => {\n return vseed.chartType === ChartTypeEnum.Table\n}\nexport const isPivotTable = (vseed: VSeed) => {\n return vseed.chartType === ChartTypeEnum.PivotTable\n}\nexport const isRadar = (vseed: VSeed) => {\n return vseed.chartType === ChartTypeEnum.Radar\n}\nexport const isAreaPercent = (vseed: VSeed) => {\n return vseed.chartType === ChartTypeEnum.AreaPercent\n}\nexport const isColumnPercent = (vseed: VSeed) => {\n return vseed.chartType === ChartTypeEnum.ColumnPercent\n}\nexport const isBarPercent = (vseed: VSeed) => {\n return vseed.chartType === ChartTypeEnum.BarPercent\n}\n\nexport const isVTable = (vseed: VSeed) => {\n return ['table', 'pivotTable'].includes(vseed.chartType)\n}\nexport const isVChart = (vseed: VSeed): boolean => {\n return !isVTable(vseed)\n}\n\n/**\n * @description 透视图表或组合图\n * - 透视图表定义: 存在 column 或 row的 encoding\n * - 组合图表定义: 存在多组指标的情况\n * - 透视组合图表: 存在 column 或 row的 encoding 且 存在多组指标的情况\n * 上述三者都只能使用 VTable.PivotChart 绘制\n */\nexport const isPivotChart = (vseed: VSeed) => {\n if (isVTable(vseed)) {\n return false\n }\n\n if (isPivot(vseed)) {\n return true\n }\n\n return isCombination(vseed)\n}\n\n/**\n * @description 存在column 或 row的encoding\n */\nexport const isPivot = (vseed: VSeed) => {\n const { dimensions = [] } = vseed as {\n dimensions: Dimensions\n }\n\n return dimensions && dimensions.some((dimension) => dimension.encoding === 'row' || dimension.encoding === 'column')\n}\n/**\n * @description 不存在column 或 row的encoding, 但是有多组指标的情况\n */\nexport const isCombination = (vseed: VSeed) => {\n if (isMeasureTreeWithParentId(vseed.measures)) {\n const parentIds = vseed.measures?.map((measure: Measure) => measure.parentId || DEFAULT_PARENT_ID)\n return parentIds && unique(parentIds).length > 1\n }\n\n if (vseed.chartType === 'dualAxis' || vseed.chartType === 'scatter') {\n if (vseed.chartType === 'scatter') {\n if (isMeasureTreeWithChildren(vseed.measures)) {\n const depth = measureDepth(vseed.measures)\n return depth === 3\n }\n\n if (vseed.scatterMeasures && vseed.scatterMeasures.length > 1) {\n return true\n }\n return false\n }\n if (vseed.chartType === 'dualAxis') {\n if (isMeasureTreeWithChildren(vseed.measures)) {\n const depth = measureDepth(vseed.measures)\n return depth === 3\n }\n\n if (vseed.dualMeasures && vseed.dualMeasures.length > 1) {\n return true\n }\n }\n\n return false\n }\n\n const { measures = [] } = vseed as {\n measures: DimensionTree\n dimensions: Dimensions\n }\n\n const hasMeasureGroup = measures && measures.some((measure: DimensionGroup) => measure && measure.children)\n\n return hasMeasureGroup\n}\n"],"names":["isTable","vseed","ChartTypeEnum","isPivotTable","isRadar","isAreaPercent","isColumnPercent","isBarPercent","isVTable","isVChart","isPivotChart","isPivot","isCombination","dimensions","dimension","isMeasureTreeWithParentId","parentIds","measure","DEFAULT_PARENT_ID","unique","isMeasureTreeWithChildren","depth","measureDepth","measures","hasMeasureGroup"],"mappings":";;;;AAMO,MAAMA,UAAU,CAACC,QACfA,MAAM,SAAS,KAAKC,cAAc,KAAK;AAEzC,MAAMC,eAAe,CAACF,QACpBA,MAAM,SAAS,KAAKC,cAAc,UAAU;AAE9C,MAAME,UAAU,CAACH,QACfA,MAAM,SAAS,KAAKC,cAAc,KAAK;AAEzC,MAAMG,gBAAgB,CAACJ,QACrBA,MAAM,SAAS,KAAKC,cAAc,WAAW;AAE/C,MAAMI,kBAAkB,CAACL,QACvBA,MAAM,SAAS,KAAKC,cAAc,aAAa;AAEjD,MAAMK,eAAe,CAACN,QACpBA,MAAM,SAAS,KAAKC,cAAc,UAAU;AAG9C,MAAMM,
|
1
|
+
{"version":3,"file":"pipeline/utils/chatType.js","sources":["webpack://@visactor/vseed/./src/pipeline/utils/chatType.ts"],"sourcesContent":["import { type Dimensions, type DimensionGroup, type DimensionTree, type VSeed, type Measure } from 'src/types'\nimport { measureDepth } from './measures'\nimport { isMeasureTreeWithChildren, isMeasureTreeWithParentId } from '../advanced/chart/pipes/measures/utils'\nimport { unique } from 'remeda'\nimport { ChartTypeEnum, DEFAULT_PARENT_ID } from './constant'\n\nexport const isTable = (vseed: VSeed) => {\n return vseed.chartType === ChartTypeEnum.Table\n}\nexport const isPivotTable = (vseed: VSeed) => {\n return vseed.chartType === ChartTypeEnum.PivotTable\n}\nexport const isRadar = (vseed: VSeed) => {\n return vseed.chartType === ChartTypeEnum.Radar\n}\nexport const isAreaPercent = (vseed: VSeed) => {\n return vseed.chartType === ChartTypeEnum.AreaPercent\n}\nexport const isColumnPercent = (vseed: VSeed) => {\n return vseed.chartType === ChartTypeEnum.ColumnPercent\n}\nexport const isBarPercent = (vseed: VSeed) => {\n return vseed.chartType === ChartTypeEnum.BarPercent\n}\n\nexport const isBarLikeChart = (vseed: VSeed) => {\n return (\n vseed.chartType === ChartTypeEnum.Bar ||\n vseed.chartType === ChartTypeEnum.BarPercent ||\n vseed.chartType === ChartTypeEnum.BarParallel\n )\n}\n\nexport const isVTable = (vseed: VSeed) => {\n return ['table', 'pivotTable'].includes(vseed.chartType)\n}\nexport const isVChart = (vseed: VSeed): boolean => {\n return !isVTable(vseed)\n}\n\n/**\n * @description 透视图表或组合图\n * - 透视图表定义: 存在 column 或 row的 encoding\n * - 组合图表定义: 存在多组指标的情况\n * - 透视组合图表: 存在 column 或 row的 encoding 且 存在多组指标的情况\n * 上述三者都只能使用 VTable.PivotChart 绘制\n */\nexport const isPivotChart = (vseed: VSeed) => {\n if (isVTable(vseed)) {\n return false\n }\n\n if (isPivot(vseed)) {\n return true\n }\n\n return isCombination(vseed)\n}\n\n/**\n * @description 存在column 或 row的encoding\n */\nexport const isPivot = (vseed: VSeed) => {\n const { dimensions = [] } = vseed as {\n dimensions: Dimensions\n }\n\n return dimensions && dimensions.some((dimension) => dimension.encoding === 'row' || dimension.encoding === 'column')\n}\n/**\n * @description 不存在column 或 row的encoding, 但是有多组指标的情况\n */\nexport const isCombination = (vseed: VSeed) => {\n if (isMeasureTreeWithParentId(vseed.measures)) {\n const parentIds = vseed.measures?.map((measure: Measure) => measure.parentId || DEFAULT_PARENT_ID)\n return parentIds && unique(parentIds).length > 1\n }\n\n if (vseed.chartType === 'dualAxis' || vseed.chartType === 'scatter') {\n if (vseed.chartType === 'scatter') {\n if (isMeasureTreeWithChildren(vseed.measures)) {\n const depth = measureDepth(vseed.measures)\n return depth === 3\n }\n\n if (vseed.scatterMeasures && vseed.scatterMeasures.length > 1) {\n return true\n }\n return false\n }\n if (vseed.chartType === 'dualAxis') {\n if (isMeasureTreeWithChildren(vseed.measures)) {\n const depth = measureDepth(vseed.measures)\n return depth === 3\n }\n\n if (vseed.dualMeasures && vseed.dualMeasures.length > 1) {\n return true\n }\n }\n\n return false\n }\n\n const { measures = [] } = vseed as {\n measures: DimensionTree\n dimensions: Dimensions\n }\n\n const hasMeasureGroup = measures && measures.some((measure: DimensionGroup) => measure && measure.children)\n\n return hasMeasureGroup\n}\n"],"names":["isTable","vseed","ChartTypeEnum","isPivotTable","isRadar","isAreaPercent","isColumnPercent","isBarPercent","isBarLikeChart","isVTable","isVChart","isPivotChart","isPivot","isCombination","dimensions","dimension","isMeasureTreeWithParentId","parentIds","measure","DEFAULT_PARENT_ID","unique","isMeasureTreeWithChildren","depth","measureDepth","measures","hasMeasureGroup"],"mappings":";;;;AAMO,MAAMA,UAAU,CAACC,QACfA,MAAM,SAAS,KAAKC,cAAc,KAAK;AAEzC,MAAMC,eAAe,CAACF,QACpBA,MAAM,SAAS,KAAKC,cAAc,UAAU;AAE9C,MAAME,UAAU,CAACH,QACfA,MAAM,SAAS,KAAKC,cAAc,KAAK;AAEzC,MAAMG,gBAAgB,CAACJ,QACrBA,MAAM,SAAS,KAAKC,cAAc,WAAW;AAE/C,MAAMI,kBAAkB,CAACL,QACvBA,MAAM,SAAS,KAAKC,cAAc,aAAa;AAEjD,MAAMK,eAAe,CAACN,QACpBA,MAAM,SAAS,KAAKC,cAAc,UAAU;AAG9C,MAAMM,iBAAiB,CAACP,QAE3BA,MAAM,SAAS,KAAKC,cAAc,GAAG,IACrCD,MAAM,SAAS,KAAKC,cAAc,UAAU,IAC5CD,MAAM,SAAS,KAAKC,cAAc,WAAW;AAI1C,MAAMO,WAAW,CAACR,QAChB;QAAC;QAAS;KAAa,CAAC,QAAQ,CAACA,MAAM,SAAS;AAElD,MAAMS,WAAW,CAACT,QAChB,CAACQ,SAASR;AAUZ,MAAMU,eAAe,CAACV;IAC3B,IAAIQ,SAASR,QACX,OAAO;IAGT,IAAIW,QAAQX,QACV,OAAO;IAGT,OAAOY,cAAcZ;AACvB;AAKO,MAAMW,UAAU,CAACX;IACtB,MAAM,EAAEa,aAAa,EAAE,EAAE,GAAGb;IAI5B,OAAOa,cAAcA,WAAW,IAAI,CAAC,CAACC,YAAcA,AAAuB,UAAvBA,UAAU,QAAQ,IAAcA,AAAuB,aAAvBA,UAAU,QAAQ;AACxG;AAIO,MAAMF,gBAAgB,CAACZ;IAC5B,IAAIe,0BAA0Bf,MAAM,QAAQ,GAAG;QAC7C,MAAMgB,YAAYhB,MAAM,QAAQ,EAAE,IAAI,CAACiB,UAAqBA,QAAQ,QAAQ,IAAIC;QAChF,OAAOF,aAAaG,OAAOH,WAAW,MAAM,GAAG;IACjD;IAEA,IAAIhB,AAAoB,eAApBA,MAAM,SAAS,IAAmBA,AAAoB,cAApBA,MAAM,SAAS,EAAgB;QACnE,IAAIA,AAAoB,cAApBA,MAAM,SAAS,EAAgB;YACjC,IAAIoB,0BAA0BpB,MAAM,QAAQ,GAAG;gBAC7C,MAAMqB,QAAQC,aAAatB,MAAM,QAAQ;gBACzC,OAAOqB,AAAU,MAAVA;YACT;YAEA,IAAIrB,MAAM,eAAe,IAAIA,MAAM,eAAe,CAAC,MAAM,GAAG,GAC1D,OAAO;YAET,OAAO;QACT;QACA,IAAIA,AAAoB,eAApBA,MAAM,SAAS,EAAiB;YAClC,IAAIoB,0BAA0BpB,MAAM,QAAQ,GAAG;gBAC7C,MAAMqB,QAAQC,aAAatB,MAAM,QAAQ;gBACzC,OAAOqB,AAAU,MAAVA;YACT;YAEA,IAAIrB,MAAM,YAAY,IAAIA,MAAM,YAAY,CAAC,MAAM,GAAG,GACpD,OAAO;QAEX;QAEA,OAAO;IACT;IAEA,MAAM,EAAEuB,WAAW,EAAE,EAAE,GAAGvB;IAK1B,MAAMwB,kBAAkBD,YAAYA,SAAS,IAAI,CAAC,CAACN,UAA4BA,WAAWA,QAAQ,QAAQ;IAE1G,OAAOO;AACT"}
|
package/dist/umd/index.js
CHANGED
@@ -295,10 +295,11 @@
|
|
295
295
|
zScatterConfig: ()=>zScatterConfig,
|
296
296
|
donutAdvancedPipeline: ()=>donutAdvancedPipeline,
|
297
297
|
zTooltip: ()=>zTooltip,
|
298
|
+
isBarLikeChart: ()=>isBarLikeChart,
|
298
299
|
barParallelAdvancedPipeline: ()=>barParallelAdvancedPipeline,
|
299
300
|
deleteMeasureTreeByCallback: ()=>deleteMeasureTreeByCallback,
|
300
|
-
barPercentSpecPipeline: ()=>barPercentSpecPipeline,
|
301
301
|
zBarPercentConfig: ()=>zBarPercentConfig,
|
302
|
+
barPercentSpecPipeline: ()=>barPercentSpecPipeline,
|
302
303
|
dataReshapeByEncoding: ()=>dataReshapeByEncoding,
|
303
304
|
lineSpecPipeline: ()=>lineSpecPipeline,
|
304
305
|
zDimensionGroup: ()=>zDimensionGroup
|
@@ -562,6 +563,7 @@
|
|
562
563
|
const isAreaPercent = (vseed)=>vseed.chartType === ChartTypeEnum.AreaPercent;
|
563
564
|
const isColumnPercent = (vseed)=>vseed.chartType === ChartTypeEnum.ColumnPercent;
|
564
565
|
const isBarPercent = (vseed)=>vseed.chartType === ChartTypeEnum.BarPercent;
|
566
|
+
const isBarLikeChart = (vseed)=>vseed.chartType === ChartTypeEnum.Bar || vseed.chartType === ChartTypeEnum.BarPercent || vseed.chartType === ChartTypeEnum.BarParallel;
|
565
567
|
const isVTable = (vseed)=>[
|
566
568
|
'table',
|
567
569
|
'pivotTable'
|
@@ -1337,7 +1339,8 @@
|
|
1337
1339
|
const measures = findAllMeasures(advancedVSeed.measures);
|
1338
1340
|
if (measures.length > 1 && !result.dimensions?.some((dim)=>dim.id === MeasureName)) result.dimensions?.push({
|
1339
1341
|
id: MeasureName,
|
1340
|
-
alias: intl.i18n
|
1342
|
+
alias: intl.i18n`指标名称`,
|
1343
|
+
encoding: 'column'
|
1341
1344
|
});
|
1342
1345
|
return result;
|
1343
1346
|
};
|
@@ -1597,20 +1600,31 @@
|
|
1597
1600
|
}))
|
1598
1601
|
};
|
1599
1602
|
};
|
1603
|
+
const titleOnDimension = (spec)=>{
|
1604
|
+
const { rows = [], columns = [] } = spec;
|
1605
|
+
return {
|
1606
|
+
...spec,
|
1607
|
+
corner: {
|
1608
|
+
titleOnDimension: rows.length <= 1 && columns.length >= 1 ? 'column' : 'row'
|
1609
|
+
}
|
1610
|
+
};
|
1611
|
+
};
|
1600
1612
|
const pivotIndicators = (spec, context)=>{
|
1601
1613
|
const { advancedVSeed } = context;
|
1602
1614
|
const { measures, datasetReshapeInfo } = advancedVSeed;
|
1603
1615
|
const { foldInfo } = datasetReshapeInfo[0];
|
1616
|
+
const hasRow = spec?.rows?.length > 0;
|
1617
|
+
const foldMapValues = Object.values(foldInfo.foldMap);
|
1604
1618
|
return {
|
1605
1619
|
...spec,
|
1606
|
-
indicatorsAsCol: true,
|
1607
1620
|
indicatorTitle: intl.i18n`指标名称`,
|
1608
|
-
|
1621
|
+
indicatorsAsCol: hasRow,
|
1622
|
+
hideIndicatorName: hasRow,
|
1609
1623
|
indicators: [
|
1610
1624
|
{
|
1611
1625
|
cellType: 'text',
|
1612
1626
|
indicatorKey: foldInfo.measureValue,
|
1613
|
-
title: '
|
1627
|
+
title: foldMapValues.length > 1 ? '' : foldMapValues[0],
|
1614
1628
|
width: 'auto',
|
1615
1629
|
format: pivotIndicators_fieldFormat(measures, foldInfo)
|
1616
1630
|
}
|
@@ -1753,6 +1767,7 @@
|
|
1753
1767
|
initPivotTable,
|
1754
1768
|
pivotColumns,
|
1755
1769
|
pivotRows,
|
1770
|
+
titleOnDimension,
|
1756
1771
|
pivotIndicators,
|
1757
1772
|
bodyStyle,
|
1758
1773
|
headerStyle,
|
@@ -3550,10 +3565,20 @@
|
|
3550
3565
|
const annotationPointList = Array.isArray(annotationPoint) ? annotationPoint : [
|
3551
3566
|
annotationPoint
|
3552
3567
|
];
|
3568
|
+
const isHorizontalBar = isBarLikeChart(advancedVSeed);
|
3569
|
+
const defaultStyle = isHorizontalBar ? {
|
3570
|
+
textAlign: 'right',
|
3571
|
+
textBaseline: 'middle'
|
3572
|
+
} : {
|
3573
|
+
textAlign: 'center',
|
3574
|
+
textBaseline: 'top'
|
3575
|
+
};
|
3553
3576
|
const markPoint = annotationPointList.flatMap((annotationPoint)=>{
|
3554
|
-
const { selector: selectorPoint, text = '', textColor = '#ffffff', textFontSize = 12, textFontWeight = 400, textAlign =
|
3577
|
+
const { selector: selectorPoint, text = '', textColor = '#ffffff', textFontSize = 12, textFontWeight = 400, textAlign = defaultStyle.textAlign, textBaseline = defaultStyle.textBaseline, textBackgroundBorderColor, textBackgroundBorderRadius = 4, textBackgroundBorderWidth = 1, textBackgroundColor = '#212121', textBackgroundPadding = 2, textBackgroundVisible = true, offsetX = 0, offsetY = 0 } = annotationPoint;
|
3555
3578
|
const dataset = advancedVSeed.dataset.flat();
|
3556
3579
|
const selectedData = selectorPoint ? dataset.filter((datum)=>selector_selector(datum, selectorPoint)) : [];
|
3580
|
+
const dx = -10 - (isHorizontalBar ? textFontSize : 0);
|
3581
|
+
const dy = isHorizontalBar ? 0 : textFontSize;
|
3557
3582
|
return selectedData.map((datum)=>({
|
3558
3583
|
zIndex: 1000,
|
3559
3584
|
regionRelative: true,
|
@@ -3576,8 +3601,8 @@
|
|
3576
3601
|
lineWidth: 1,
|
3577
3602
|
fontSize: textFontSize,
|
3578
3603
|
fontWeight: textFontWeight,
|
3579
|
-
|
3580
|
-
|
3604
|
+
dx,
|
3605
|
+
dy
|
3581
3606
|
},
|
3582
3607
|
labelBackground: {
|
3583
3608
|
visible: textBackgroundVisible,
|
@@ -3587,8 +3612,8 @@
|
|
3587
3612
|
fill: textBackgroundColor,
|
3588
3613
|
stroke: textBackgroundBorderColor,
|
3589
3614
|
lineWidth: textBackgroundBorderWidth,
|
3590
|
-
|
3591
|
-
|
3615
|
+
dx,
|
3616
|
+
dy
|
3592
3617
|
}
|
3593
3618
|
}
|
3594
3619
|
}
|