@hitachivantara/uikit-react-viz 5.12.7 → 5.12.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -11,12 +11,10 @@ const useLegend = ({
|
|
|
11
11
|
direction = "horizontal"
|
|
12
12
|
}) => {
|
|
13
13
|
const option = react.useMemo(() => {
|
|
14
|
-
const position = {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
position.x = "center";
|
|
19
|
-
}
|
|
14
|
+
const position = {
|
|
15
|
+
y: positionProp?.y ?? "top",
|
|
16
|
+
x: positionProp?.x ?? "center"
|
|
17
|
+
};
|
|
20
18
|
return {
|
|
21
19
|
legend: {
|
|
22
20
|
show: show ?? (Array.isArray(series) && series.length > 1),
|
|
@@ -9,12 +9,10 @@ const useLegend = ({
|
|
|
9
9
|
direction = "horizontal"
|
|
10
10
|
}) => {
|
|
11
11
|
const option = useMemo(() => {
|
|
12
|
-
const position = {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
position.x = "center";
|
|
17
|
-
}
|
|
12
|
+
const position = {
|
|
13
|
+
y: positionProp?.y ?? "top",
|
|
14
|
+
x: positionProp?.x ?? "center"
|
|
15
|
+
};
|
|
18
16
|
return {
|
|
19
17
|
legend: {
|
|
20
18
|
show: show ?? (Array.isArray(series) && series.length > 1),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLegend.js","sources":["../../../src/hooks/useLegend.tsx"],"sourcesContent":["import { useMemo } from \"react\";\n\nimport { HvEChartsOption } from \"../types/common\";\nimport { HvChartLegend, HvChartLegendIcon } from \"../types/legend\";\nimport { getLegendIcon } from \"../utils\";\n\ninterface HvLegendHookProps {\n show?: HvChartLegend[\"show\"];\n direction?: HvChartLegend[\"direction\"];\n position?: HvChartLegend[\"position\"];\n series?: Pick<HvEChartsOption, \"series.series\">;\n icon?: HvChartLegendIcon;\n formatter?: string | ((value?: string) => string);\n}\n\nexport const useLegend = ({\n series,\n show,\n icon,\n formatter,\n position: positionProp,\n direction = \"horizontal\",\n}: HvLegendHookProps) => {\n const option = useMemo<Pick<HvEChartsOption, \"legend\">>(() => {\n const position: Record<string, string> = {
|
|
1
|
+
{"version":3,"file":"useLegend.js","sources":["../../../src/hooks/useLegend.tsx"],"sourcesContent":["import { useMemo } from \"react\";\n\nimport { HvEChartsOption } from \"../types/common\";\nimport { HvChartLegend, HvChartLegendIcon } from \"../types/legend\";\nimport { getLegendIcon } from \"../utils\";\n\ninterface HvLegendHookProps {\n show?: HvChartLegend[\"show\"];\n direction?: HvChartLegend[\"direction\"];\n position?: HvChartLegend[\"position\"];\n series?: Pick<HvEChartsOption, \"series.series\">;\n icon?: HvChartLegendIcon;\n formatter?: string | ((value?: string) => string);\n}\n\nexport const useLegend = ({\n series,\n show,\n icon,\n formatter,\n position: positionProp,\n direction = \"horizontal\",\n}: HvLegendHookProps) => {\n const option = useMemo<Pick<HvEChartsOption, \"legend\">>(() => {\n const position: Record<string, string> = {\n y: positionProp?.y ?? \"top\",\n x: positionProp?.x ?? \"center\",\n };\n\n return {\n legend: {\n show: show ?? (Array.isArray(series) && series.length > 1),\n itemGap: 20,\n formatter,\n orient: direction,\n ...position,\n ...(icon && { icon: getLegendIcon(icon) }),\n ...(!icon && {\n data:\n show !== false && Array.isArray(series)\n ? series.map((s) => {\n let iconType: HvChartLegendIcon = \"line\";\n if (s.areaStyle != null) {\n iconType = \"square\";\n }\n if (s.type === \"scatter\") {\n iconType = \"circle\";\n }\n return {\n name: s.name as string,\n icon: getLegendIcon(iconType),\n };\n })\n : undefined,\n }),\n },\n };\n }, [series, show, icon, formatter, positionProp, direction]);\n\n return option;\n};\n"],"names":[],"mappings":";;AAeO,MAAM,YAAY,CAAC;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV,YAAY;AACd,MAAyB;AACjB,QAAA,SAAS,QAAyC,MAAM;AAC5D,UAAM,WAAmC;AAAA,MACvC,GAAG,cAAc,KAAK;AAAA,MACtB,GAAG,cAAc,KAAK;AAAA,IAAA;AAGjB,WAAA;AAAA,MACL,QAAQ;AAAA,QACN,MAAM,SAAS,MAAM,QAAQ,MAAM,KAAK,OAAO,SAAS;AAAA,QACxD,SAAS;AAAA,QACT;AAAA,QACA,QAAQ;AAAA,QACR,GAAG;AAAA,QACH,GAAI,QAAQ,EAAE,MAAM,cAAc,IAAI,EAAE;AAAA,QACxC,GAAI,CAAC,QAAQ;AAAA,UACX,MACE,SAAS,SAAS,MAAM,QAAQ,MAAM,IAClC,OAAO,IAAI,CAAC,MAAM;AAChB,gBAAI,WAA8B;AAC9B,gBAAA,EAAE,aAAa,MAAM;AACZ,yBAAA;AAAA,YACb;AACI,gBAAA,EAAE,SAAS,WAAW;AACb,yBAAA;AAAA,YACb;AACO,mBAAA;AAAA,cACL,MAAM,EAAE;AAAA,cACR,MAAM,cAAc,QAAQ;AAAA,YAAA;AAAA,UAE/B,CAAA,IACD;AAAA,QACR;AAAA,MACF;AAAA,IAAA;AAAA,EACF,GACC,CAAC,QAAQ,MAAM,MAAM,WAAW,cAAc,SAAS,CAAC;AAEpD,SAAA;AACT;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hitachivantara/uikit-react-viz",
|
|
3
|
-
"version": "5.12.
|
|
3
|
+
"version": "5.12.9",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Hitachi Vantara UI Kit Team",
|
|
6
6
|
"description": "Contributed React visualization components for the NEXT UI Kit.",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@emotion/css": "^11.11.0",
|
|
36
|
-
"@hitachivantara/uikit-react-core": "^5.
|
|
36
|
+
"@hitachivantara/uikit-react-core": "^5.66.0"
|
|
37
37
|
},
|
|
38
38
|
"files": [
|
|
39
39
|
"dist"
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"access": "public",
|
|
43
43
|
"directory": "package"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "feb857e5023bcc3749cebe6937504cf35119b5d6",
|
|
46
46
|
"exports": {
|
|
47
47
|
".": {
|
|
48
48
|
"require": "./dist/cjs/index.cjs",
|