@visactor/vseed 0.4.17 → 0.4.19
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 +1 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/pipeline/spec/chart/pipes/stack/stackCornerRadius.js +36 -1
- package/dist/esm/pipeline/spec/chart/pipes/stack/stackCornerRadius.js.map +1 -1
- package/dist/umd/index.js +36 -1
- package/dist/umd/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,35 @@
|
|
|
1
1
|
import { FoldMeasureId } from "../../../../../dataReshape/constant.js";
|
|
2
|
+
const reverseStackCornerRadius = (cornerRadius)=>{
|
|
3
|
+
if (!Array.isArray(cornerRadius)) return cornerRadius;
|
|
4
|
+
const [topLeft = 0, topRight = 0, bottomRight = 0, bottomLeft = 0] = cornerRadius;
|
|
5
|
+
return [
|
|
6
|
+
bottomRight,
|
|
7
|
+
bottomLeft,
|
|
8
|
+
topLeft,
|
|
9
|
+
topRight
|
|
10
|
+
];
|
|
11
|
+
};
|
|
12
|
+
const mergeStackCornerRadius = (cornerRadius)=>{
|
|
13
|
+
if (!Array.isArray(cornerRadius)) return cornerRadius;
|
|
14
|
+
const [topLeft = 0, topRight = 0, bottomRight = 0, bottomLeft = 0] = cornerRadius;
|
|
15
|
+
return [
|
|
16
|
+
Math.max(topLeft, bottomRight),
|
|
17
|
+
Math.max(topRight, bottomLeft),
|
|
18
|
+
Math.max(bottomRight, topLeft),
|
|
19
|
+
Math.max(bottomLeft, topRight)
|
|
20
|
+
];
|
|
21
|
+
};
|
|
22
|
+
const getStackRangeCornerRadius = (cornerRadius, datum)=>{
|
|
23
|
+
const stackStart = datum?.['__VCHART_STACK_START'];
|
|
24
|
+
const stackEnd = datum?.['__VCHART_STACK_END'];
|
|
25
|
+
if ('number' != typeof stackStart || 'number' != typeof stackEnd) return;
|
|
26
|
+
const hasPositivePart = stackStart > 0 || stackEnd > 0;
|
|
27
|
+
const hasNegativePart = stackStart < 0 || stackEnd < 0;
|
|
28
|
+
if (hasPositivePart && hasNegativePart) return mergeStackCornerRadius(cornerRadius);
|
|
29
|
+
if (hasPositivePart) return cornerRadius;
|
|
30
|
+
if (hasNegativePart) return reverseStackCornerRadius(cornerRadius);
|
|
31
|
+
return 0;
|
|
32
|
+
};
|
|
2
33
|
const stackCornerRadius_stackCornerRadius = (spec, context)=>{
|
|
3
34
|
const { advancedVSeed, vseed } = context;
|
|
4
35
|
const { chartType } = vseed;
|
|
@@ -7,7 +38,11 @@ const stackCornerRadius_stackCornerRadius = (spec, context)=>{
|
|
|
7
38
|
return {
|
|
8
39
|
...spec,
|
|
9
40
|
stackCornerRadius: (_, datum)=>{
|
|
10
|
-
|
|
41
|
+
const stackRangeCornerRadius = getStackRangeCornerRadius(stackCornerRadius, datum);
|
|
42
|
+
if (void 0 !== stackRangeCornerRadius) return stackRangeCornerRadius;
|
|
43
|
+
const value = datum?.[datum?.[FoldMeasureId]];
|
|
44
|
+
if (value > 0) return stackCornerRadius;
|
|
45
|
+
if (value < 0) return reverseStackCornerRadius(stackCornerRadius);
|
|
11
46
|
return 0;
|
|
12
47
|
}
|
|
13
48
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline/spec/chart/pipes/stack/stackCornerRadius.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/stack/stackCornerRadius.ts"],"sourcesContent":["import type { IBarChartSpec } from '@visactor/vchart'\nimport { FoldMeasureId } from 'src/dataReshape/constant'\nimport type { Datum, VChartSpecPipe, StackCornerRadius } from 'src/types'\n\nexport const stackCornerRadius: VChartSpecPipe = (spec, context) => {\n const { advancedVSeed, vseed } = context\n const { chartType } = vseed\n const stackCornerRadius = advancedVSeed.config?.[chartType as 'column']?.stackCornerRadius as StackCornerRadius\n\n if (chartType === 'dualAxis' && (spec as any).type !== 'bar') {\n return spec\n }\n\n return {\n ...spec,\n stackCornerRadius: (_: unknown, datum: Datum) => {\n
|
|
1
|
+
{"version":3,"file":"pipeline/spec/chart/pipes/stack/stackCornerRadius.js","sources":["webpack://@visactor/vseed/./src/pipeline/spec/chart/pipes/stack/stackCornerRadius.ts"],"sourcesContent":["import type { IBarChartSpec } from '@visactor/vchart'\nimport { FoldMeasureId } from 'src/dataReshape/constant'\nimport type { Datum, VChartSpecPipe, StackCornerRadius } from 'src/types'\n\nconst reverseStackCornerRadius = (cornerRadius: StackCornerRadius): StackCornerRadius => {\n if (!Array.isArray(cornerRadius)) {\n return cornerRadius\n }\n\n const [topLeft = 0, topRight = 0, bottomRight = 0, bottomLeft = 0] = cornerRadius\n\n return [bottomRight, bottomLeft, topLeft, topRight]\n}\n\nconst mergeStackCornerRadius = (cornerRadius: StackCornerRadius): StackCornerRadius => {\n if (!Array.isArray(cornerRadius)) {\n return cornerRadius\n }\n\n const [topLeft = 0, topRight = 0, bottomRight = 0, bottomLeft = 0] = cornerRadius\n\n return [\n Math.max(topLeft, bottomRight),\n Math.max(topRight, bottomLeft),\n Math.max(bottomRight, topLeft),\n Math.max(bottomLeft, topRight),\n ]\n}\n\nconst getStackRangeCornerRadius = (\n cornerRadius: StackCornerRadius,\n datum: Datum,\n): StackCornerRadius | 0 | undefined => {\n const stackStart = datum?.['__VCHART_STACK_START']\n const stackEnd = datum?.['__VCHART_STACK_END']\n\n if (typeof stackStart !== 'number' || typeof stackEnd !== 'number') {\n return undefined\n }\n\n const hasPositivePart = stackStart > 0 || stackEnd > 0\n const hasNegativePart = stackStart < 0 || stackEnd < 0\n\n if (hasPositivePart && hasNegativePart) {\n // Mixed positive/negative stack range: merge normal/reverse corners for whole-bar style.\n return mergeStackCornerRadius(cornerRadius)\n }\n\n if (hasPositivePart) {\n return cornerRadius\n }\n\n if (hasNegativePart) {\n return reverseStackCornerRadius(cornerRadius)\n }\n\n return 0\n}\n\nexport const stackCornerRadius: VChartSpecPipe = (spec, context) => {\n const { advancedVSeed, vseed } = context\n const { chartType } = vseed\n const stackCornerRadius = advancedVSeed.config?.[chartType as 'column']?.stackCornerRadius as StackCornerRadius\n\n if (chartType === 'dualAxis' && (spec as any).type !== 'bar') {\n return spec\n }\n\n return {\n ...spec,\n stackCornerRadius: (_: unknown, datum: Datum) => {\n const stackRangeCornerRadius = getStackRangeCornerRadius(stackCornerRadius, datum)\n\n if (stackRangeCornerRadius !== undefined) {\n return stackRangeCornerRadius\n }\n\n const value = datum?.[datum?.[FoldMeasureId]]\n\n if (value > 0) {\n return stackCornerRadius\n }\n\n if (value < 0) {\n return reverseStackCornerRadius(stackCornerRadius)\n }\n\n return 0\n },\n } as IBarChartSpec\n}\n"],"names":["reverseStackCornerRadius","cornerRadius","Array","topLeft","topRight","bottomRight","bottomLeft","mergeStackCornerRadius","Math","getStackRangeCornerRadius","datum","stackStart","stackEnd","hasPositivePart","hasNegativePart","stackCornerRadius","spec","context","advancedVSeed","vseed","chartType","_","stackRangeCornerRadius","undefined","value","FoldMeasureId"],"mappings":";AAIA,MAAMA,2BAA2B,CAACC;IAChC,IAAI,CAACC,MAAM,OAAO,CAACD,eACjB,OAAOA;IAGT,MAAM,CAACE,UAAU,CAAC,EAAEC,WAAW,CAAC,EAAEC,cAAc,CAAC,EAAEC,aAAa,CAAC,CAAC,GAAGL;IAErE,OAAO;QAACI;QAAaC;QAAYH;QAASC;KAAS;AACrD;AAEA,MAAMG,yBAAyB,CAACN;IAC9B,IAAI,CAACC,MAAM,OAAO,CAACD,eACjB,OAAOA;IAGT,MAAM,CAACE,UAAU,CAAC,EAAEC,WAAW,CAAC,EAAEC,cAAc,CAAC,EAAEC,aAAa,CAAC,CAAC,GAAGL;IAErE,OAAO;QACLO,KAAK,GAAG,CAACL,SAASE;QAClBG,KAAK,GAAG,CAACJ,UAAUE;QACnBE,KAAK,GAAG,CAACH,aAAaF;QACtBK,KAAK,GAAG,CAACF,YAAYF;KACtB;AACH;AAEA,MAAMK,4BAA4B,CAChCR,cACAS;IAEA,MAAMC,aAAaD,OAAO,CAAC,uBAAuB;IAClD,MAAME,WAAWF,OAAO,CAAC,qBAAqB;IAE9C,IAAI,AAAsB,YAAtB,OAAOC,cAA2B,AAAoB,YAApB,OAAOC,UAC3C;IAGF,MAAMC,kBAAkBF,aAAa,KAAKC,WAAW;IACrD,MAAME,kBAAkBH,aAAa,KAAKC,WAAW;IAErD,IAAIC,mBAAmBC,iBAErB,OAAOP,uBAAuBN;IAGhC,IAAIY,iBACF,OAAOZ;IAGT,IAAIa,iBACF,OAAOd,yBAAyBC;IAGlC,OAAO;AACT;AAEO,MAAMc,sCAAoC,CAACC,MAAMC;IACtD,MAAM,EAAEC,aAAa,EAAEC,KAAK,EAAE,GAAGF;IACjC,MAAM,EAAEG,SAAS,EAAE,GAAGD;IACtB,MAAMJ,oBAAoBG,cAAc,MAAM,EAAE,CAACE,UAAsB,EAAE;IAEzE,IAAIA,AAAc,eAAdA,aAA6BJ,AAAsB,UAAtBA,KAAa,IAAI,EAChD,OAAOA;IAGT,OAAO;QACL,GAAGA,IAAI;QACP,mBAAmB,CAACK,GAAYX;YAC9B,MAAMY,yBAAyBb,0BAA0BM,mBAAmBL;YAE5E,IAAIY,AAA2BC,WAA3BD,wBACF,OAAOA;YAGT,MAAME,QAAQd,OAAO,CAACA,OAAO,CAACe,cAAc,CAAC;YAE7C,IAAID,QAAQ,GACV,OAAOT;YAGT,IAAIS,QAAQ,GACV,OAAOxB,yBAAyBe;YAGlC,OAAO;QACT;IACF;AACF"}
|
package/dist/umd/index.js
CHANGED
|
@@ -8899,6 +8899,37 @@ self.R = R;
|
|
|
8899
8899
|
result.animation = true;
|
|
8900
8900
|
return result;
|
|
8901
8901
|
};
|
|
8902
|
+
const reverseStackCornerRadius = (cornerRadius)=>{
|
|
8903
|
+
if (!Array.isArray(cornerRadius)) return cornerRadius;
|
|
8904
|
+
const [topLeft = 0, topRight = 0, bottomRight = 0, bottomLeft = 0] = cornerRadius;
|
|
8905
|
+
return [
|
|
8906
|
+
bottomRight,
|
|
8907
|
+
bottomLeft,
|
|
8908
|
+
topLeft,
|
|
8909
|
+
topRight
|
|
8910
|
+
];
|
|
8911
|
+
};
|
|
8912
|
+
const mergeStackCornerRadius = (cornerRadius)=>{
|
|
8913
|
+
if (!Array.isArray(cornerRadius)) return cornerRadius;
|
|
8914
|
+
const [topLeft = 0, topRight = 0, bottomRight = 0, bottomLeft = 0] = cornerRadius;
|
|
8915
|
+
return [
|
|
8916
|
+
Math.max(topLeft, bottomRight),
|
|
8917
|
+
Math.max(topRight, bottomLeft),
|
|
8918
|
+
Math.max(bottomRight, topLeft),
|
|
8919
|
+
Math.max(bottomLeft, topRight)
|
|
8920
|
+
];
|
|
8921
|
+
};
|
|
8922
|
+
const getStackRangeCornerRadius = (cornerRadius, datum)=>{
|
|
8923
|
+
const stackStart = datum?.['__VCHART_STACK_START'];
|
|
8924
|
+
const stackEnd = datum?.['__VCHART_STACK_END'];
|
|
8925
|
+
if ('number' != typeof stackStart || 'number' != typeof stackEnd) return;
|
|
8926
|
+
const hasPositivePart = stackStart > 0 || stackEnd > 0;
|
|
8927
|
+
const hasNegativePart = stackStart < 0 || stackEnd < 0;
|
|
8928
|
+
if (hasPositivePart && hasNegativePart) return mergeStackCornerRadius(cornerRadius);
|
|
8929
|
+
if (hasPositivePart) return cornerRadius;
|
|
8930
|
+
if (hasNegativePart) return reverseStackCornerRadius(cornerRadius);
|
|
8931
|
+
return 0;
|
|
8932
|
+
};
|
|
8902
8933
|
const stackCornerRadius_stackCornerRadius = (spec, context)=>{
|
|
8903
8934
|
const { advancedVSeed, vseed } = context;
|
|
8904
8935
|
const { chartType } = vseed;
|
|
@@ -8907,7 +8938,11 @@ self.R = R;
|
|
|
8907
8938
|
return {
|
|
8908
8939
|
...spec,
|
|
8909
8940
|
stackCornerRadius: (_, datum)=>{
|
|
8910
|
-
|
|
8941
|
+
const stackRangeCornerRadius = getStackRangeCornerRadius(stackCornerRadius, datum);
|
|
8942
|
+
if (void 0 !== stackRangeCornerRadius) return stackRangeCornerRadius;
|
|
8943
|
+
const value = datum?.[datum?.[FoldMeasureId]];
|
|
8944
|
+
if (value > 0) return stackCornerRadius;
|
|
8945
|
+
if (value < 0) return reverseStackCornerRadius(stackCornerRadius);
|
|
8911
8946
|
return 0;
|
|
8912
8947
|
}
|
|
8913
8948
|
};
|