@milaboratories/graph-maker 1.1.162 → 1.1.164

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/GraphMaker/constantsCommon.d.ts +7 -0
  2. package/dist/GraphMaker/constantsCommon.d.ts.map +1 -1
  3. package/dist/GraphMaker/constantsCommon.js +26 -19
  4. package/dist/GraphMaker/constantsCommon.js.map +1 -1
  5. package/dist/GraphMaker/forms/LayersForm/Layer/discrete/Line.vue.d.ts.map +1 -1
  6. package/dist/GraphMaker/forms/LayersForm/Layer/discrete/Line.vue.js +63 -52
  7. package/dist/GraphMaker/forms/LayersForm/Layer/discrete/Line.vue.js.map +1 -1
  8. package/dist/GraphMaker/forms/LayersForm/Layer/heatmap/Heatmap.vue.d.ts.map +1 -1
  9. package/dist/GraphMaker/forms/LayersForm/Layer/heatmap/Heatmap.vue.js +122 -91
  10. package/dist/GraphMaker/forms/LayersForm/Layer/heatmap/Heatmap.vue.js.map +1 -1
  11. package/dist/GraphMaker/forms/LayersForm/Layer/heatmap/HeatmapClustered.vue.d.ts.map +1 -1
  12. package/dist/GraphMaker/forms/LayersForm/Layer/heatmap/HeatmapClustered.vue.js +105 -77
  13. package/dist/GraphMaker/forms/LayersForm/Layer/heatmap/HeatmapClustered.vue.js.map +1 -1
  14. package/dist/GraphMaker/index.vue.d.ts.map +1 -1
  15. package/dist/GraphMaker/index.vue.js +50 -46
  16. package/dist/GraphMaker/index.vue.js.map +1 -1
  17. package/dist/GraphMaker/utils/createChartSettingsForRender/composeDiscreteSettings.d.ts +1 -0
  18. package/dist/GraphMaker/utils/createChartSettingsForRender/composeDiscreteSettings.d.ts.map +1 -1
  19. package/dist/GraphMaker/utils/createChartSettingsForRender/composeHeatmapSettings.d.ts +5 -0
  20. package/dist/GraphMaker/utils/createChartSettingsForRender/composeHeatmapSettings.d.ts.map +1 -1
  21. package/dist/GraphMaker/utils/createChartSettingsForRender/composeHeatmapSettings.js +28 -24
  22. package/dist/GraphMaker/utils/createChartSettingsForRender/composeHeatmapSettings.js.map +1 -1
  23. package/dist/GraphMaker/utils/createChartSettingsForRender/getLayersDataFromForms.d.ts +1 -1
  24. package/dist/GraphMaker/utils/createChartSettingsForRender/getLayersDataFromForms.d.ts.map +1 -1
  25. package/dist/GraphMaker/utils/createChartSettingsForRender/getLayersDataFromForms.js +11 -10
  26. package/dist/GraphMaker/utils/createChartSettingsForRender/getLayersDataFromForms.js.map +1 -1
  27. package/dist/node_modules/@milaboratories/miplots4/dist/MiPlots.js +4 -4
  28. package/dist/node_modules/@milaboratories/miplots4/dist/common/Legend.js +3 -3
  29. package/dist/node_modules/@milaboratories/miplots4/dist/common/Legend.js.map +1 -1
  30. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/DiscreteSettingsImpl.js +24 -24
  31. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/DiscreteSettingsImpl.js.map +1 -1
  32. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/index.js +13 -13
  33. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/lines.js +31 -40
  34. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/lines.js.map +1 -1
  35. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/ChartRenderer.js +25 -25
  36. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/ChartRenderer.js.map +1 -1
  37. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/HeatmapSettingsImpl.js +13 -8
  38. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/HeatmapSettingsImpl.js.map +1 -1
  39. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/Annotations/index.js +58 -58
  40. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/Annotations/index.js.map +1 -1
  41. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/Chart.js +4 -4
  42. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/getCells.js +204 -110
  43. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/getCells.js.map +1 -1
  44. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/index.js +81 -78
  45. package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/index.js.map +1 -1
  46. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/react/index.js +1 -1
  47. package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/react-dom/index.js +1 -1
  48. package/dist/node_modules/@milaboratories/miplots4/dist/types/discrete.js +11 -10
  49. package/dist/node_modules/@milaboratories/miplots4/dist/types/discrete.js.map +1 -1
  50. package/dist/node_modules/@milaboratories/miplots4/dist/types/heatmap.js +14 -9
  51. package/dist/node_modules/@milaboratories/miplots4/dist/types/heatmap.js.map +1 -1
  52. package/package.json +2 -2
@@ -1,97 +1,97 @@
1
1
  import { j as i } from "../../../node_modules/react/jsx-runtime.js";
2
- import { Annotation as p } from "./Annotation.js";
3
- import { ANNOTATION_WIDTH as y, ANNOTATIONS_OFFSET as m } from "../../constants.js";
4
- function u(s, o) {
5
- return s.showTitle && o.includes(s.titlePosition);
2
+ import { Annotation as u } from "./Annotation.js";
3
+ import { ANNOTATION_WIDTH as p, ANNOTATIONS_OFFSET as m } from "../../constants.js";
4
+ function y(s, e) {
5
+ return s.showTitle && e.includes(s.titlePosition);
6
6
  }
7
- function F({
7
+ function Y({
8
8
  facetKey: s,
9
- sideElementBBoxes: o,
9
+ sideElementBBoxes: e,
10
10
  annotations: x,
11
11
  annotationColorScales: n,
12
12
  cellsMeta: f,
13
- chartEdgeSides: a,
13
+ chartEdgeSides: o,
14
14
  sharedX: h,
15
- sharedY: K,
16
- width: T,
17
- height: g,
18
- scales: v,
19
- stepX: B,
15
+ sharedY: v,
16
+ width: K,
17
+ height: T,
18
+ scales: g,
19
+ stepX: C,
20
20
  stepY: G,
21
- aes: S,
22
- frame: w,
23
- xGroupKeys: N,
24
- yGroupKeys: j,
25
- xKeysByGroups: A,
26
- yKeysByGroups: C,
27
- tooltipsData: D,
28
- cellsRenderingMode: O
21
+ aes: b,
22
+ frame: B,
23
+ xGroupKeys: S,
24
+ yGroupKeys: w,
25
+ xKeysByGroups: N,
26
+ yKeysByGroups: j,
27
+ tooltipsData: A,
28
+ cellsRenderingMode: D
29
29
  }) {
30
- const l = x.filter((t) => a.includes(t.position) || !h && ["left", "right"].includes(t.position) || !K && ["top", "bottom"].includes(t.position)), b = l.filter((t) => t.position === "left"), E = l.filter((t) => t.position === "right"), I = l.filter((t) => t.position === "top"), M = l.filter((t) => t.position === "bottom"), { xDataByKeys: d, yDataByKeys: c } = f, r = {
30
+ const l = x.filter((t) => o.includes(t.position) || !h && ["left", "right"].includes(t.position) || !v && ["top", "bottom"].includes(t.position)), O = l.filter((t) => t.position === "left"), L = l.filter((t) => t.position === "right"), E = l.filter((t) => t.position === "top"), I = l.filter((t) => t.position === "bottom"), { xDataByKeys: d, yDataByKeys: c } = f, r = {
31
31
  facetKey: s,
32
- scales: v,
33
- stepX: B,
32
+ scales: g,
33
+ stepX: C,
34
34
  stepY: G,
35
- width: T,
36
- height: g,
37
- aes: S,
38
- frame: w,
39
- xGroupKeys: N,
40
- yGroupKeys: j,
41
- xKeysByGroups: A,
42
- yKeysByGroups: C,
43
- tooltipsData: D,
44
- cellsRenderingMode: O
35
+ width: K,
36
+ height: T,
37
+ aes: b,
38
+ frame: B,
39
+ xGroupKeys: S,
40
+ yGroupKeys: w,
41
+ xKeysByGroups: N,
42
+ yKeysByGroups: j,
43
+ tooltipsData: A,
44
+ cellsRenderingMode: D
45
45
  };
46
46
  return /* @__PURE__ */ i.jsxs("g", { children: [
47
- b.map((t, e) => /* @__PURE__ */ i.jsx(
48
- p,
47
+ O.map((t, a) => /* @__PURE__ */ i.jsx(
48
+ u,
49
49
  {
50
50
  annotation: t,
51
51
  colorScale: n[t.id],
52
- data: c[t.valueColumn.value],
53
- showTitle: u(t, a),
54
- x: o.left.annotations.x + e * y,
55
- y: o.left.annotations.y,
52
+ data: c[t.valueColumn.valueLabels ?? t.valueColumn.value],
53
+ showTitle: y(t, o),
54
+ x: e.left.annotations.x + a * p,
55
+ y: e.left.annotations.y,
56
56
  ...r
57
57
  },
58
58
  t.id
59
59
  )),
60
- E.map((t, e) => /* @__PURE__ */ i.jsx(
61
- p,
60
+ L.map((t, a) => /* @__PURE__ */ i.jsx(
61
+ u,
62
62
  {
63
63
  annotation: t,
64
64
  colorScale: n[t.id],
65
- data: c[t.valueColumn.value],
66
- showTitle: u(t, a),
67
- x: o.right.annotations.x + e * y + m,
68
- y: o.right.annotations.y,
65
+ data: c[t.valueColumn.valueLabels ?? t.valueColumn.value],
66
+ showTitle: y(t, o),
67
+ x: e.right.annotations.x + a * p + m,
68
+ y: e.right.annotations.y,
69
69
  ...r
70
70
  },
71
71
  t.id
72
72
  )),
73
- I.map((t, e) => /* @__PURE__ */ i.jsx(
74
- p,
73
+ E.map((t, a) => /* @__PURE__ */ i.jsx(
74
+ u,
75
75
  {
76
76
  annotation: t,
77
77
  colorScale: n[t.id],
78
- data: d[t.valueColumn.value],
79
- showTitle: u(t, a),
80
- x: o.top.annotations.x,
81
- y: o.top.annotations.y + e * y,
78
+ data: d[t.valueColumn.valueLabels ?? t.valueColumn.value],
79
+ showTitle: y(t, o),
80
+ x: e.top.annotations.x,
81
+ y: e.top.annotations.y + a * p,
82
82
  ...r
83
83
  },
84
84
  t.id
85
85
  )),
86
- M.map((t, e) => /* @__PURE__ */ i.jsx(
87
- p,
86
+ I.map((t, a) => /* @__PURE__ */ i.jsx(
87
+ u,
88
88
  {
89
89
  annotation: t,
90
90
  colorScale: n[t.id],
91
- data: d[t.valueColumn.value],
92
- showTitle: u(t, a),
93
- x: o.bottom.annotations.x,
94
- y: o.bottom.annotations.y + e * y + m,
91
+ data: d[t.valueColumn.valueLabels ?? t.valueColumn.value],
92
+ showTitle: y(t, o),
93
+ x: e.bottom.annotations.x,
94
+ y: e.bottom.annotations.y + a * p + m,
95
95
  ...r
96
96
  },
97
97
  t.id
@@ -99,6 +99,6 @@ function F({
99
99
  ] });
100
100
  }
101
101
  export {
102
- F as Annotations
102
+ Y as Annotations
103
103
  };
104
104
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../../../../../node_modules/@milaboratories/miplots4/src/heatmap/components/Annotations/index.tsx"],"sourcesContent":["import type {TooltipsData} from '../../../common/Tooltip';\nimport {Annotation} from './Annotation';\nimport type {\n AnnotationColorScales,\n AnnotationTooltipData,\n ChartDimensionsData,\n ChartScales,\n} from '../types';\nimport {ANNOTATION_WIDTH, ANNOTATIONS_OFFSET} from '../../constants';\nimport type {Cell} from '../../getCells';\nimport type {GroupedCellsData} from '../../getCells';\nimport type {HeatmapSettingsImpl} from '../../HeatmapSettingsImpl';\nimport React from 'react';\n\nfunction showTitle(item: HeatmapSettingsImpl['annotations'][0], chartEdgeSides: ChartDimensionsData['chartEdgeSides']) {\n return item.showTitle && chartEdgeSides.includes(item.titlePosition);\n}\n\ninterface AnnotationProps {\n facetKey: string;\n sideElementBBoxes: ChartDimensionsData['sideElementBBoxes'];\n annotations: HeatmapSettingsImpl['annotations'];\n cellsMeta: GroupedCellsData['meta'];\n annotationColorScales: AnnotationColorScales;\n sharedX: boolean;\n sharedY: boolean;\n chartEdgeSides: ChartDimensionsData['chartEdgeSides'];\n width: number;\n height: number;\n scales: ChartScales;\n stepX: number;\n stepY: number;\n aes: HeatmapSettingsImpl['aes'];\n frame: HeatmapSettingsImpl['chartSettings']['frame'];\n xGroupKeys: string[];\n yGroupKeys: string[];\n xKeysByGroups: GroupedCellsData['facets'][keyof GroupedCellsData['facets']]['xKeysByGroups'];\n yKeysByGroups: GroupedCellsData['facets'][keyof GroupedCellsData['facets']]['yKeysByGroups'];\n tooltipsData: TooltipsData<Cell|AnnotationTooltipData>;\n cellsRenderingMode: 'canvas' | 'svg';\n}\n\nexport function Annotations({\n facetKey,\n sideElementBBoxes,\n annotations,\n annotationColorScales,\n cellsMeta,\n chartEdgeSides,\n sharedX,\n sharedY,\n width,\n height,\n scales,\n stepX,\n stepY,\n aes,\n frame,\n xGroupKeys,\n yGroupKeys,\n xKeysByGroups,\n yKeysByGroups,\n tooltipsData,\n cellsRenderingMode,\n}: AnnotationProps) {\n const usedAnnotations = annotations.filter(item => {\n return (\n chartEdgeSides.includes(item.position) ||\n (!sharedX && ['left', 'right'].includes(item.position)) ||\n (!sharedY && ['top', 'bottom'].includes(item.position))\n );\n });\n const leftAnnotations = usedAnnotations.filter(item => item.position === 'left');\n const rightAnnotations = usedAnnotations.filter(item => item.position === 'right');\n const topAnnotations = usedAnnotations.filter(item => item.position === 'top');\n const bottomAnnotations = usedAnnotations.filter(item => item.position === 'bottom');\n const {xDataByKeys, yDataByKeys} = cellsMeta;\n\n const commonProps = {\n facetKey,\n scales,\n stepX,\n stepY,\n width,\n height,\n aes,\n frame,\n xGroupKeys,\n yGroupKeys,\n xKeysByGroups,\n yKeysByGroups,\n tooltipsData,\n cellsRenderingMode,\n };\n return (\n <g>\n {leftAnnotations.map((item, idx) => {\n return (\n <Annotation\n key={item.id}\n annotation={item}\n colorScale={annotationColorScales[item.id]}\n data={yDataByKeys[item.valueColumn.value]}\n showTitle={showTitle(item, chartEdgeSides)}\n x={sideElementBBoxes.left.annotations.x + idx * ANNOTATION_WIDTH}\n y={sideElementBBoxes.left.annotations.y}\n {...commonProps}\n />\n );\n })}\n {rightAnnotations.map((item, idx) => {\n return (\n <Annotation\n key={item.id}\n annotation={item}\n colorScale={annotationColorScales[item.id]}\n data={yDataByKeys[item.valueColumn.value]}\n showTitle={showTitle(item, chartEdgeSides)}\n x={sideElementBBoxes.right.annotations.x + idx * ANNOTATION_WIDTH + ANNOTATIONS_OFFSET}\n y={sideElementBBoxes.right.annotations.y}\n {...commonProps}\n />\n );\n })}\n {topAnnotations.map((item, idx) => {\n return (\n <Annotation\n key={item.id}\n annotation={item}\n colorScale={annotationColorScales[item.id]}\n data={xDataByKeys[item.valueColumn.value]}\n showTitle={showTitle(item, chartEdgeSides)}\n x={sideElementBBoxes.top.annotations.x}\n y={sideElementBBoxes.top.annotations.y + idx * ANNOTATION_WIDTH}\n {...commonProps}\n />\n );\n })}\n {bottomAnnotations.map((item, idx) => {\n return (\n <Annotation\n key={item.id}\n annotation={item}\n colorScale={annotationColorScales[item.id]}\n data={xDataByKeys[item.valueColumn.value]}\n showTitle={showTitle(item, chartEdgeSides)}\n x={sideElementBBoxes.bottom.annotations.x}\n y={sideElementBBoxes.bottom.annotations.y + idx * ANNOTATION_WIDTH + ANNOTATIONS_OFFSET}\n {...commonProps}\n />\n );\n })}\n </g>\n );\n}\n"],"names":["showTitle","item","chartEdgeSides","Annotations","facetKey","sideElementBBoxes","annotations","annotationColorScales","cellsMeta","sharedX","sharedY","width","height","scales","stepX","stepY","aes","frame","xGroupKeys","yGroupKeys","xKeysByGroups","yKeysByGroups","tooltipsData","cellsRenderingMode","usedAnnotations","leftAnnotations","rightAnnotations","topAnnotations","bottomAnnotations","xDataByKeys","yDataByKeys","commonProps","i","idx","jsx","Annotation","ANNOTATION_WIDTH","ANNOTATIONS_OFFSET"],"mappings":";;;AAcA,SAASA,EAAUC,GAA6CC,GAAuD;AACnH,SAAOD,EAAK,aAAaC,EAAe,SAASD,EAAK,aAAa;AACvE;AA0BO,SAASE,EAAY;AAAA,EACxB,UAAAC;AAAAA,EACA,mBAAAC;AAAAA,EACA,aAAAC;AAAAA,EACA,uBAAAC;AAAAA,EACA,WAAAC;AAAAA,EACA,gBAAAN;AAAAA,EACA,SAAAO;AAAAA,EACA,SAAAC;AAAAA,EACA,OAAAC;AAAAA,EACA,QAAAC;AAAAA,EACA,QAAAC;AAAAA,EACA,OAAAC;AAAAA,EACA,OAAAC;AAAAA,EACA,KAAAC;AAAAA,EACA,OAAAC;AAAAA,EACA,YAAAC;AAAAA,EACA,YAAAC;AAAAA,EACA,eAAAC;AAAAA,EACA,eAAAC;AAAAA,EACA,cAAAC;AAAAA,EACA,oBAAAC;AACJ,GAAoB;AAChB,QAAMC,IAAkBl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MAPC9B,EAAK;AAAA,IAAA,CAUrB;AAAA,EAAA,GACL;AAER;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index.js","sources":["../../../../../../../../node_modules/@milaboratories/miplots4/src/heatmap/components/Annotations/index.tsx"],"sourcesContent":["import type {TooltipsData} from '../../../common/Tooltip';\nimport {Annotation} from './Annotation';\nimport type {\n AnnotationColorScales,\n AnnotationTooltipData,\n ChartDimensionsData,\n ChartScales,\n} from '../types';\nimport {ANNOTATION_WIDTH, ANNOTATIONS_OFFSET} from '../../constants';\nimport type {Cell} from '../../getCells';\nimport type {GroupedCellsData} from '../../getCells';\nimport type {HeatmapSettingsImpl} from '../../HeatmapSettingsImpl';\nimport React from 'react';\n\nfunction showTitle(item: HeatmapSettingsImpl['annotations'][0], chartEdgeSides: ChartDimensionsData['chartEdgeSides']) {\n return item.showTitle && chartEdgeSides.includes(item.titlePosition);\n}\n\ninterface AnnotationProps {\n facetKey: string;\n sideElementBBoxes: ChartDimensionsData['sideElementBBoxes'];\n annotations: HeatmapSettingsImpl['annotations'];\n cellsMeta: GroupedCellsData['meta'];\n annotationColorScales: AnnotationColorScales;\n sharedX: boolean;\n sharedY: boolean;\n chartEdgeSides: ChartDimensionsData['chartEdgeSides'];\n width: number;\n height: number;\n scales: ChartScales;\n stepX: number;\n stepY: number;\n aes: HeatmapSettingsImpl['aes'];\n frame: HeatmapSettingsImpl['chartSettings']['frame'];\n xGroupKeys: string[];\n yGroupKeys: string[];\n xKeysByGroups: GroupedCellsData['facets'][keyof GroupedCellsData['facets']]['xKeysByGroups'];\n yKeysByGroups: GroupedCellsData['facets'][keyof GroupedCellsData['facets']]['yKeysByGroups'];\n tooltipsData: TooltipsData<Cell|AnnotationTooltipData>;\n cellsRenderingMode: 'canvas' | 'svg';\n}\n\nexport function Annotations({\n facetKey,\n sideElementBBoxes,\n annotations,\n annotationColorScales,\n cellsMeta,\n chartEdgeSides,\n sharedX,\n sharedY,\n width,\n height,\n scales,\n stepX,\n stepY,\n aes,\n frame,\n xGroupKeys,\n yGroupKeys,\n xKeysByGroups,\n yKeysByGroups,\n tooltipsData,\n cellsRenderingMode,\n}: AnnotationProps) {\n const usedAnnotations = annotations.filter(item => {\n return (\n chartEdgeSides.includes(item.position) ||\n (!sharedX && ['left', 'right'].includes(item.position)) ||\n (!sharedY && ['top', 'bottom'].includes(item.position))\n );\n });\n const leftAnnotations = usedAnnotations.filter(item => item.position === 'left');\n const rightAnnotations = usedAnnotations.filter(item => item.position === 'right');\n const topAnnotations = usedAnnotations.filter(item => item.position === 'top');\n const bottomAnnotations = usedAnnotations.filter(item => item.position === 'bottom');\n const {xDataByKeys, yDataByKeys} = cellsMeta;\n\n const commonProps = {\n facetKey,\n scales,\n stepX,\n stepY,\n width,\n height,\n aes,\n frame,\n xGroupKeys,\n yGroupKeys,\n xKeysByGroups,\n yKeysByGroups,\n tooltipsData,\n cellsRenderingMode,\n };\n return (\n <g>\n {leftAnnotations.map((item, idx) => {\n return (\n <Annotation\n key={item.id}\n annotation={item}\n colorScale={annotationColorScales[item.id]}\n data={yDataByKeys[item.valueColumn.valueLabels ?? item.valueColumn.value]}\n showTitle={showTitle(item, chartEdgeSides)}\n x={sideElementBBoxes.left.annotations.x + idx * ANNOTATION_WIDTH}\n y={sideElementBBoxes.left.annotations.y}\n {...commonProps}\n />\n );\n })}\n {rightAnnotations.map((item, idx) => {\n return (\n <Annotation\n key={item.id}\n annotation={item}\n colorScale={annotationColorScales[item.id]}\n data={yDataByKeys[item.valueColumn.valueLabels ?? item.valueColumn.value]}\n showTitle={showTitle(item, chartEdgeSides)}\n x={sideElementBBoxes.right.annotations.x + idx * ANNOTATION_WIDTH + ANNOTATIONS_OFFSET}\n y={sideElementBBoxes.right.annotations.y}\n {...commonProps}\n />\n );\n })}\n {topAnnotations.map((item, idx) => {\n return (\n <Annotation\n key={item.id}\n annotation={item}\n colorScale={annotationColorScales[item.id]}\n data={xDataByKeys[item.valueColumn.valueLabels ?? item.valueColumn.value]}\n showTitle={showTitle(item, chartEdgeSides)}\n x={sideElementBBoxes.top.annotations.x}\n y={sideElementBBoxes.top.annotations.y + idx * ANNOTATION_WIDTH}\n {...commonProps}\n />\n );\n })}\n {bottomAnnotations.map((item, idx) => {\n return (\n <Annotation\n key={item.id}\n annotation={item}\n colorScale={annotationColorScales[item.id]}\n data={xDataByKeys[item.valueColumn.valueLabels ?? item.valueColumn.value]}\n showTitle={showTitle(item, chartEdgeSides)}\n x={sideElementBBoxes.bottom.annotations.x}\n y={sideElementBBoxes.bottom.annotations.y + idx * ANNOTATION_WIDTH + ANNOTATIONS_OFFSET}\n {...commonProps}\n />\n );\n })}\n </g>\n );\n}\n"],"names":["showTitle","item","chartEdgeSides","Annotations","facetKey","sideElementBBoxes","annotations","annotationColorScales","cellsMeta","sharedX","sharedY","width","height","scales","stepX","stepY","aes","frame","xGroupKeys","yGroupKeys","xKeysByGroups","yKeysByGroups","tooltipsData","cellsRenderingMode","usedAnnotations","leftAnnotations","rightAnnotations","topAnnotations","bottomAnnotations","xDataByKeys","yDataByKeys","commonProps","l","idx","jsx","Annotation","ANNOTATION_WIDTH","ANNOTATIONS_OFFSET"],"mappings":";;;AAcA,SAASA,EAAUC,GAA6CC,GAAuD;AACnH,SAAOD,EAAK,aAAaC,EAAe,SAASD,EAAK,aAAa;AACvE;AA0BO,SAASE,EAAY;AAAA,EACxB,UAAAC;AAAAA,EACA,mBAAAC;AAAAA,EACA,aAAAC;AAAAA,EACA,uBAAAC;AAAAA,EACA,WAAAC;AAAAA,EACA,gBAAAN;AAAAA,EACA,SAAAO;AAAAA,EACA,SAAAC;AAAAA,EACA,OAAAC;AAAAA,EACA,QAAAC;AAAAA,EACA,QAAAC;AAAAA,EACA,OAAAC;AAAAA,EACA,OAAAC;AAAAA,EACA,KAAAC;AAAAA,EACA,OAAAC;AAAAA,EACA,YAAAC;AAAAA,EACA,YAAAC;AAAAA,EACA,eAAAC;AAAAA,EACA,eAAAC;AAAAA,EACA,cAAAC;AAAAA,EACA,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AkB,OAAO,YAAY;AAAA,QACxC,GAAGA,EAAkB,OAAO,YAAY,IAAI4B,IAAMG,IAAmBC;AAAAA,QACpE,GAAGN;AAAAA,MAAA;AAAA,MAPC9B,EAAK;AAAA,IAAA,CAUrB;AAAA,EAAA,GACL;AAER;","x_google_ignoreList":[0]}
@@ -1,6 +1,6 @@
1
1
  import { j as t } from "../../node_modules/react/jsx-runtime.js";
2
2
  import { Tooltip as E } from "../../common/Tooltip.js";
3
- import { useDataFrame as q } from "../../common/useDataFrame.js";
3
+ import { useDataFrame as J } from "../../common/useDataFrame.js";
4
4
  import { FONT_SIZE as N, FACET_TITLE_OFFSET as P } from "../constants.js";
5
5
  import { Annotations as Q } from "./Annotations/index.js";
6
6
  import { Captions as U } from "./Captions/index.js";
@@ -37,7 +37,7 @@ function fe({
37
37
  tooltipsData: e,
38
38
  cellsRenderingMode: D
39
39
  }) {
40
- const R = q(), { xAxis: V, yAxis: W, tooltips: T } = p, { width: G, height: B } = l.inner, { padding: i, chartEdgeSides: _, sideElementBBoxes: n } = l, { xGroupLabels: H, yGroupLabels: I, xLabels: J, yLabels: O } = a, h = s.x.domain(), S = s.y.domain(), b = {
40
+ const R = J(), { xAxis: V, yAxis: W, tooltips: T } = p, { width: G, height: B } = l.inner, { padding: i, chartEdgeSides: _, sideElementBBoxes: n } = l, { xGroupLabels: H, yGroupLabels: I, xLabels: O, yLabels: q } = a, h = s.x.domain(), S = s.y.domain(), b = {
41
41
  left: x.left + l.left + i.left,
42
42
  right: d.totalWidth - (x.left + l.left + i.left),
43
43
  top: x.top + l.top + i.top,
@@ -160,8 +160,8 @@ function fe({
160
160
  xGroupLabels: H,
161
161
  yGroupLabels: I,
162
162
  labelAngles: M,
163
- xLabels: J,
164
- yLabels: O
163
+ xLabels: O,
164
+ yLabels: q
165
165
  }
166
166
  )
167
167
  ] }),
@@ -1,38 +1,68 @@
1
- import v from "../node_modules/lodash/lodash.js";
2
- import X from "../node_modules/d3-array/src/deviation.js";
3
- import z from "../node_modules/d3-array/src/mean.js";
4
- import Y from "../node_modules/d3-array/src/extent.js";
5
- function Z(l) {
6
- const o = X(l), s = z(l);
7
- return o === void 0 || s === void 0 || o === 0 ? (m) => m : (m) => (m - s) / o;
1
+ import h from "../node_modules/lodash/lodash.js";
2
+ import { exhaustive as ee } from "../utils/index.js";
3
+ import N from "../node_modules/d3-array/src/mean.js";
4
+ import { quantileSorted as ae } from "../node_modules/d3-array/src/quantile.js";
5
+ import te from "../node_modules/d3-array/src/deviation.js";
6
+ import ue from "../node_modules/d3-array/src/extent.js";
7
+ function oe(a) {
8
+ const u = te(a), o = N(a);
9
+ return u === void 0 || o === void 0 || u === 0 ? (n) => n : (n) => (n - o) / u;
8
10
  }
9
- function ee(l) {
10
- const o = z(l), [s, m] = Y(l);
11
- return o === void 0 || s === void 0 || m === void 0 || m === s ? (c) => c : (c) => (c - o) / (m - s);
11
+ function le(a) {
12
+ const u = N(a), [o, n] = ue(a);
13
+ return u === void 0 || o === void 0 || n === void 0 || n === o ? (y) => y : (y) => (y - u) / (n - o);
12
14
  }
13
- function ae(l, o) {
14
- return l === "standardScaling" ? Z(o) : l === "meanNormalization" ? ee(o) : (s) => s;
15
+ function se(a, u) {
16
+ return a === "standardScaling" ? oe(u) : a === "meanNormalization" ? le(u) : (o) => o;
15
17
  }
16
- function b(l) {
17
- if (!l.length)
18
+ function k(a, u) {
19
+ switch (a) {
20
+ case "max": {
21
+ let o = u[0];
22
+ for (const n of u)
23
+ o = Math.max(o, n);
24
+ return o;
25
+ }
26
+ case "min": {
27
+ let o = u[0];
28
+ for (const n of u)
29
+ o = Math.min(o, n);
30
+ return o;
31
+ }
32
+ case "median": {
33
+ const o = u.sort((n, y) => n - y);
34
+ return ae(o, 0.5);
35
+ }
36
+ case "mean":
37
+ return N(u) ?? u[0];
38
+ default:
39
+ ee(a, `Unknown aggregation function ${a}`);
40
+ }
41
+ }
42
+ function Q(a) {
43
+ const u = [...new Set(a)].sort();
44
+ return u.length > 3 ? [...u.slice(0, 3), "..."].join(", ") : u.join(", ");
45
+ }
46
+ function I(a) {
47
+ if (!a.length)
18
48
  return [];
19
- let o = [[]];
20
- return l.forEach((s) => {
21
- const m = [];
22
- s.forEach((c) => {
23
- m.push(...o.map((B) => [...B, c]));
24
- }), o = m;
25
- }), o;
49
+ let u = [[]];
50
+ return a.forEach((o) => {
51
+ const n = [];
52
+ o.forEach((y) => {
53
+ n.push(...u.map((v) => [...v, y]));
54
+ }), u = n;
55
+ }), u;
26
56
  }
27
- const q = (l, o, s = {}) => l.sort(
28
- (m, c) => o === "asc" ? (s[m] ?? m).localeCompare(s[c] ?? c, "en", { numeric: !0 }) : (s[c] ?? c).localeCompare(s[m] ?? m, "en", { numeric: !0 })
57
+ const R = (a, u, o = {}) => a.sort(
58
+ (n, y) => u === "asc" ? (o[n] ?? n).localeCompare(o[y] ?? y, "en", { numeric: !0 }) : (o[y] ?? y).localeCompare(o[n] ?? n, "en", { numeric: !0 })
29
59
  );
30
- function se(l, o, s, m, c, B, E, j, O, k, d, F, K, H, J) {
31
- const N = c.length ? c.map((e) => K[e.value] ?? l.getColumnCategories(e.value)) : [["null"]], P = B.length ? B.map((e) => K[e.value] ?? l.getColumnCategories(e.value)) : [["null"]], Q = E.length ? E.map((e) => K[e.value] ?? l.getColumnCategories(e.value)) : [["null"]], D = b(N), w = b(P), M = b(Q), $ = D.map((e) => e.join("_")), V = w.map((e) => e.join("_")), C = M.map((e) => e.join("_")), a = {
60
+ function ne() {
61
+ return {
32
62
  meta: {
33
- facetKeys: $,
34
- xGroupKeys: V,
35
- yGroupKeys: C,
63
+ facetKeys: [],
64
+ xGroupKeys: [],
65
+ yGroupKeys: [],
36
66
  xKeysByGroups: {},
37
67
  yKeysByGroups: {},
38
68
  xLabels: {},
@@ -41,104 +71,168 @@ function se(l, o, s, m, c, B, E, j, O, k, d, F, K, H, J) {
41
71
  yGroupLabels: {},
42
72
  xDataByKeys: {},
43
73
  yDataByKeys: {},
44
- facetKeyValues: $.reduce((e, t, r) => (e[t] = D[r], e), {}),
45
- xGroupKeyValues: V.reduce((e, t, r) => (e[t] = w[r], e), {}),
46
- yGroupKeyValues: C.reduce((e, t, r) => (e[t] = M[r], e), {}),
74
+ facetKeyValues: {},
75
+ xGroupKeyValues: {},
76
+ yGroupKeyValues: {},
47
77
  valueExtent: [1 / 0, -1 / 0]
48
78
  },
49
79
  facets: {}
50
- }, S = o.valueLabels ?? o.value, _ = s.valueLabels ?? s.value, R = j.filter((e) => e.axis === "x").map((e) => e.valueColumn.value), T = j.filter((e) => e.axis === "y").map((e) => e.valueColumn.value), U = Object.values(O ?? {}).map((e) => e.value), W = Object.values(k ?? {}).map((e) => e.value), A = v.uniq([...R, ...U, S]), I = v.uniq([...T, ...W, _]);
51
- for (let e = 0; e < l.rowsCount; e++) {
52
- const t = c.length ? c.map((u) => l.getColumnValue(u.value, e)).join("_") : "null", r = B.length ? B.map((u) => l.getColumnValue(u.value, e)).join("_") : "null", i = E.length ? E.map((u) => l.getColumnValue(u.value, e)).join("_") : "null", g = B.length ? B.map((u) => l.getColumnValue(u.valueLabels ?? u.value, e)).join(", ") : "", L = E.length ? E.map((u) => l.getColumnValue(u.valueLabels ?? u.value, e)).join(", ") : "";
53
- a.meta.xGroupLabels[r] = g, a.meta.yGroupLabels[i] = L;
54
- const n = String(l.getColumnValue(o.value, e)), y = String(l.getColumnValue(s.value, e)), p = l.getColumnValue(m.value, e) ?? F;
55
- if (n === "null" || y === "null" || p === null)
80
+ };
81
+ }
82
+ function re(a, u, o, n, y) {
83
+ if (u.x || u.y) {
84
+ const v = [1 / 0, -1 / 0];
85
+ a.meta.facetKeys.forEach((m) => {
86
+ const { xKeys: L, yKeys: M, cells: V, xKeysByGroups: g, yKeysByGroups: G } = a.facets[m], c = u.x ? g : L.reduce((e, r) => (e[r] = [r], e), {}), b = u.y ? G : M.reduce((e, r) => (e[r] = [r], e), {}), d = Object.keys(c), D = Object.keys(b);
87
+ for (const e of d)
88
+ for (const r of D) {
89
+ const B = [];
90
+ if (c[e].forEach((K) => {
91
+ b[r].forEach((C) => {
92
+ var p, S, _;
93
+ const j = (S = (p = V[K]) == null ? void 0 : p[C]) == null ? void 0 : S.value;
94
+ j !== void 0 && (B.push(j), (_ = V[K]) == null || delete _[C]);
95
+ });
96
+ }), B.length > 0) {
97
+ const K = k(u.method, B);
98
+ a.facets[m].cells[e] || (a.facets[m].cells[e] = {}), a.facets[m].cells[e][r] = {
99
+ isCell: !0,
100
+ idx: 0,
101
+ id: `${e}_${r}`,
102
+ x: e,
103
+ y: r,
104
+ value: K,
105
+ normalizedValue: K
106
+ }, v[0] = Math.min(K, v[0]), v[1] = Math.max(K, v[1]);
107
+ }
108
+ }
109
+ u.x && d.forEach((e) => {
110
+ o.forEach((r) => {
111
+ const B = y.find((p) => p.valueColumn.value === r || p.valueColumn.valueLabels === r);
112
+ if (!B)
113
+ return;
114
+ const K = [];
115
+ c[e].forEach((p) => {
116
+ K.push(a.meta.xDataByKeys[r][p]), delete a.meta.xDataByKeys[r][p];
117
+ });
118
+ const C = B.type === "continuous" ? k(u.method, K) : Q(K);
119
+ a.meta.xDataByKeys[r][e] = C;
120
+ });
121
+ }), u.y && (n.forEach((e) => {
122
+ a.meta.yDataByKeys[e] = {};
123
+ }), D.forEach((e) => {
124
+ n.forEach((r) => {
125
+ const B = y.find((p) => p.valueColumn.value === r || p.valueColumn.valueLabels === r);
126
+ if (!B)
127
+ return;
128
+ const K = [];
129
+ b[e].forEach((p) => {
130
+ K.push(a.meta.yDataByKeys[r][p]), delete a.meta.yDataByKeys[r][p];
131
+ });
132
+ const C = B.type === "continuous" ? k(u.method, K) : Q(K);
133
+ a.meta.yDataByKeys[r][e] = C;
134
+ });
135
+ })), u.x && (a.facets[m].xKeys = Object.keys(g), a.facets[m].xKeysByGroups = { null: a.facets[m].xKeys }, a.meta.xLabels = a.meta.xGroupLabels, a.meta.xGroupKeys = ["null"], a.meta.xGroupKeyValues = { null: ["null"] }), u.y && (a.facets[m].yKeys = Object.keys(G), a.facets[m].yKeysByGroups = { null: a.facets[m].yKeys }, a.meta.yLabels = a.meta.yGroupLabels, a.meta.yGroupKeys = ["null"], a.meta.yGroupKeyValues = { null: ["null"] });
136
+ }), a.meta.valueExtent = v;
137
+ }
138
+ }
139
+ function ye(a, u) {
140
+ if (u) {
141
+ const o = [1 / 0, -1 / 0];
142
+ a.meta.facetKeys.forEach((n) => {
143
+ const { xKeys: y, yKeys: v, cells: m } = a.facets[n], L = u.direction === "row" ? y : v, M = u.direction === "row" ? v : y, V = u.direction === "row" ? (g, G) => {
144
+ var c;
145
+ return (c = m[g]) == null ? void 0 : c[G];
146
+ } : (g, G) => {
147
+ var c;
148
+ return (c = m[G]) == null ? void 0 : c[g];
149
+ };
150
+ M.forEach((g) => {
151
+ const G = [];
152
+ L.forEach((b) => {
153
+ var d;
154
+ const D = (d = V(b, g)) == null ? void 0 : d.value;
155
+ D !== void 0 && G.push(D);
156
+ });
157
+ const c = se(u.method, G);
158
+ L.forEach((b) => {
159
+ const d = V(b, g);
160
+ d !== void 0 && (d.normalizedValue = c(d.value), o[0] = Math.min(d.normalizedValue, o[0]), o[1] = Math.max(d.normalizedValue, o[1]));
161
+ });
162
+ });
163
+ }), a.meta.valueExtent = o;
164
+ }
165
+ }
166
+ function pe(a, u, o, n, y, v, m, L, M, V, g, G, c, b, d, D) {
167
+ const e = ne(), r = y.length ? y.map((t) => c[t.value] ?? a.getColumnCategories(t.value)) : [["null"]], B = v.length ? v.map((t) => c[t.value] ?? a.getColumnCategories(t.value)) : [["null"]], K = m.length ? m.map((t) => c[t.value] ?? a.getColumnCategories(t.value)) : [["null"]], C = I(r), p = I(B), S = I(K), _ = C.map((t) => t.join("_")), j = p.map((t) => t.join("_")), O = S.map((t) => t.join("_"));
168
+ e.meta.facetKeys = _, e.meta.xGroupKeys = j, e.meta.yGroupKeys = O, e.meta.facetKeyValues = _.reduce((t, l, f) => (t[l] = C[f], t), {}), e.meta.xGroupKeyValues = j.reduce((t, l, f) => (t[l] = p[f], t), {}), e.meta.yGroupKeyValues = O.reduce((t, l, f) => (t[l] = S[f], t), {});
169
+ const U = u.valueLabels ?? u.value, A = o.valueLabels ?? o.value, T = L.filter((t) => t.axis === "x").map((t) => t.valueColumn.valueLabels ?? t.valueColumn.value), W = L.filter((t) => t.axis === "y").map((t) => t.valueColumn.valueLabels ?? t.valueColumn.value), Y = Object.values(M ?? {}).map((t) => t.value), Z = Object.values(V ?? {}).map((t) => t.value), F = h.uniq([...T, ...Y, U]), H = h.uniq([...W, ...Z, A]);
170
+ for (let t = 0; t < a.rowsCount; t++) {
171
+ const l = y.length ? y.map((s) => a.getColumnValue(s.value, t)).join("_") : "null", f = v.length ? v.map((s) => a.getColumnValue(s.value, t)).join("_") : "null", E = m.length ? m.map((s) => a.getColumnValue(s.value, t)).join("_") : "null", $ = v.length ? v.map((s) => a.getColumnValue(s.valueLabels ?? s.value, t)).join(", ") : "", X = m.length ? m.map((s) => a.getColumnValue(s.valueLabels ?? s.value, t)).join(", ") : "";
172
+ e.meta.xGroupLabels[f] = $, e.meta.yGroupLabels[E] = X;
173
+ const i = String(a.getColumnValue(u.value, t)), x = String(a.getColumnValue(o.value, t)), w = a.getColumnValue(n.value, t) ?? G;
174
+ if (i === "null" || x === "null" || w === null)
56
175
  continue;
57
- if (a.facets[t] || (a.facets[t] = {
176
+ if (e.facets[l] || (e.facets[l] = {
58
177
  xKeys: [],
59
178
  yKeys: [],
60
179
  xKeysByGroups: {},
61
180
  yKeysByGroups: {},
62
181
  cells: {}
63
- }), a.facets[t].xKeysByGroups[r] || (a.facets[t].xKeysByGroups[r] = []), a.facets[t].yKeysByGroups[i] || (a.facets[t].yKeysByGroups[i] = []), a.facets[t].xKeys.push(n), a.facets[t].yKeys.push(y), a.facets[t].xKeysByGroups[r].push(n), a.facets[t].yKeysByGroups[i].push(y), a.facets[t].cells[n] || (a.facets[t].cells[n] = {}), a.meta.valueExtent[0] = Math.min(p, a.meta.valueExtent[0]), a.meta.valueExtent[1] = Math.max(p, a.meta.valueExtent[1]), a.facets[t].cells[n][y] && a.facets[t].cells[n][y].value !== p)
64
- throw Error(`More than 1 value for x=${n}, y=${y}`);
65
- const x = l.getColumnValue(S, e);
66
- if (a.meta.xLabels[n] && String(x) !== a.meta.xLabels[n])
67
- throw Error(`More than 1 x-label value for x=${n}`);
68
- const h = l.getColumnValue(_, e);
69
- if (a.meta.yLabels[y] && String(h) !== a.meta.yLabels[y])
70
- throw Error(`More than 1 y-label value for y=${y}`);
71
- a.meta.xLabels[n] = String(x), a.meta.yLabels[y] = String(h), A.forEach((u) => {
72
- const f = typeof a.meta.xDataByKeys[u] < "u", G = f && typeof a.meta.xDataByKeys[u][n] < "u";
73
- if (f || (a.meta.xDataByKeys[u] = {}), G && a.meta.xDataByKeys[u][n] !== l.getColumnValue(u, e))
74
- throw Error(`More than 1 value for x = ${n} and column = ${u}`);
75
- G || (a.meta.xDataByKeys[u][n] = l.getColumnValue(u, e));
76
- }), I.forEach((u) => {
77
- const f = typeof a.meta.yDataByKeys[u] < "u", G = f && typeof a.meta.yDataByKeys[u][y] < "u";
78
- if (f || (a.meta.yDataByKeys[u] = {}), G && a.meta.yDataByKeys[u][y] !== l.getColumnValue(u, e))
79
- throw Error(`More than 1 value for y = ${y} and column = ${u}`);
80
- G || (a.meta.yDataByKeys[u][y] = l.getColumnValue(u, e));
81
- }), a.facets[t].cells[n][y] = {
182
+ }), e.facets[l].xKeysByGroups[f] || (e.facets[l].xKeysByGroups[f] = []), e.facets[l].yKeysByGroups[E] || (e.facets[l].yKeysByGroups[E] = []), e.facets[l].xKeys.push(i), e.facets[l].yKeys.push(x), e.facets[l].xKeysByGroups[f].push(i), e.facets[l].yKeysByGroups[E].push(x), e.facets[l].cells[i] || (e.facets[l].cells[i] = {}), e.meta.valueExtent[0] = Math.min(w, e.meta.valueExtent[0]), e.meta.valueExtent[1] = Math.max(w, e.meta.valueExtent[1]), e.facets[l].cells[i][x] && e.facets[l].cells[i][x].value !== w)
183
+ throw Error(`More than 1 value for x=${i}, y=${x}`);
184
+ const J = a.getColumnValue(U, t);
185
+ if (e.meta.xLabels[i] && String(J) !== e.meta.xLabels[i])
186
+ throw Error(`More than 1 x-label value for x=${i}`);
187
+ const P = a.getColumnValue(A, t);
188
+ if (e.meta.yLabels[x] && String(P) !== e.meta.yLabels[x])
189
+ throw Error(`More than 1 y-label value for y=${x}`);
190
+ e.meta.xLabels[i] = String(J), e.meta.yLabels[x] = String(P), F.forEach((s) => {
191
+ const q = typeof e.meta.xDataByKeys[s] < "u", z = q && typeof e.meta.xDataByKeys[s][i] < "u";
192
+ if (q || (e.meta.xDataByKeys[s] = {}), z && e.meta.xDataByKeys[s][i] !== a.getColumnValue(s, t))
193
+ throw Error(`More than 1 value for x = ${i} and column = ${s}`);
194
+ z || (e.meta.xDataByKeys[s][i] = a.getColumnValue(s, t));
195
+ }), H.forEach((s) => {
196
+ const q = typeof e.meta.yDataByKeys[s] < "u", z = q && typeof e.meta.yDataByKeys[s][x] < "u";
197
+ if (q || (e.meta.yDataByKeys[s] = {}), z && e.meta.yDataByKeys[s][x] !== a.getColumnValue(s, t))
198
+ throw Error(`More than 1 value for y = ${x} and column = ${s}`);
199
+ z || (e.meta.yDataByKeys[s][x] = a.getColumnValue(s, t));
200
+ }), e.facets[l].cells[i][x] = {
82
201
  isCell: !0,
83
- idx: e,
84
- id: `${n}_${y}`,
85
- x: n,
86
- y,
87
- value: p,
88
- normalizedValue: p
202
+ idx: t,
203
+ id: `${i}_${x}`,
204
+ x: i,
205
+ y: x,
206
+ value: w,
207
+ normalizedValue: w
89
208
  };
90
209
  }
91
- if (a.meta.facetKeys = a.meta.facetKeys.filter((e) => a.facets[e]), a.meta.facetKeys.forEach((e) => {
92
- const t = a.facets[e], r = v.uniq(t.xKeys), i = v.uniq(t.yKeys);
93
- t.xKeys = K[o.value] ? v.intersection(K[o.value], r) : r, t.yKeys = K[s.value] ? v.intersection(K[s.value], i) : i, V.forEach((g) => {
94
- a.facets[e].xKeysByGroups[g] = v.intersection(
95
- t.xKeys,
96
- a.facets[e].xKeysByGroups[g]
210
+ return e.meta.facetKeys = e.meta.facetKeys.filter((t) => e.facets[t]), e.meta.facetKeys.forEach((t) => {
211
+ const l = e.facets[t], f = h.uniq(l.xKeys), E = h.uniq(l.yKeys);
212
+ l.xKeys = c[u.value] ? h.intersection(c[u.value], f) : f, l.yKeys = c[o.value] ? h.intersection(c[o.value], E) : E, j.forEach(($) => {
213
+ e.facets[t].xKeysByGroups[$] = h.intersection(
214
+ l.xKeys,
215
+ e.facets[t].xKeysByGroups[$]
97
216
  );
98
- }), C.forEach((g) => {
99
- a.facets[e].yKeysByGroups[g] = v.intersection(
100
- t.yKeys,
101
- a.facets[e].yKeysByGroups[g]
217
+ }), O.forEach(($) => {
218
+ e.facets[t].yKeysByGroups[$] = h.intersection(
219
+ l.yKeys,
220
+ e.facets[t].yKeysByGroups[$]
102
221
  );
103
222
  });
104
- }), d) {
105
- const e = [1 / 0, -1 / 0];
106
- a.meta.facetKeys.forEach((t) => {
107
- const { xKeys: r, yKeys: i, cells: g } = a.facets[t], L = d.direction === "row" ? r : i, n = d.direction === "row" ? i : r, y = d.direction === "row" ? (p, x) => {
108
- var h;
109
- return (h = g[p]) == null ? void 0 : h[x];
110
- } : (p, x) => {
111
- var h;
112
- return (h = g[x]) == null ? void 0 : h[p];
113
- };
114
- n.forEach((p) => {
115
- const x = [];
116
- L.forEach((u) => {
117
- var f;
118
- const G = (f = y(u, p)) == null ? void 0 : f.value;
119
- G !== void 0 && x.push(G);
120
- });
121
- const h = ae(d.method, x);
122
- L.forEach((u) => {
123
- const f = y(u, p);
124
- f !== void 0 && (f.normalizedValue = h(f.value), e[0] = Math.min(f.normalizedValue, e[0]), e[1] = Math.max(f.normalizedValue, e[1]));
125
- });
126
- });
127
- }), a.meta.valueExtent = e;
128
- }
129
- return a.meta.xKeysByGroups = V.reduce((e, t) => {
130
- const r = q(v.uniq(
131
- v.flatten(a.meta.facetKeys.map((i) => a.facets[i].xKeysByGroups[t]))
132
- ), H.sorting, a.meta.xLabels);
133
- return e[t] = K[o.value] ? v.intersection(K[o.value], r) : r, e;
134
- }, {}), a.meta.yKeysByGroups = C.reduce((e, t) => {
135
- const r = q(v.uniq(
136
- v.flatten(a.meta.facetKeys.map((i) => a.facets[i].yKeysByGroups[t]))
137
- ), J.sorting, a.meta.yLabels);
138
- return e[t] = K[s.value] ? v.intersection(K[s.value], r) : r, e;
139
- }, {}), a.meta.valueExtent[0] === 1 / 0 && (a.meta.valueExtent[0] = 0), a.meta.valueExtent[1] === -1 / 0 && (a.meta.valueExtent[1] = 0), a;
223
+ }), re(e, D, F, H, L), ye(e, g), e.meta.xKeysByGroups = e.meta.xGroupKeys.reduce((t, l) => {
224
+ const f = R(h.uniq(
225
+ h.flatten(e.meta.facetKeys.map((E) => e.facets[E].xKeysByGroups[l]))
226
+ ), b.sorting, e.meta.xLabels);
227
+ return t[l] = c[u.value] ? h.intersection(c[u.value], f) : f, t;
228
+ }, {}), e.meta.yKeysByGroups = e.meta.yGroupKeys.reduce((t, l) => {
229
+ const f = R(h.uniq(
230
+ h.flatten(e.meta.facetKeys.map((E) => e.facets[E].yKeysByGroups[l]))
231
+ ), d.sorting, e.meta.yLabels);
232
+ return t[l] = c[o.value] ? h.intersection(c[o.value], f) : f, t;
233
+ }, {}), e.meta.valueExtent[0] === 1 / 0 && (e.meta.valueExtent[0] = 0), e.meta.valueExtent[1] === -1 / 0 && (e.meta.valueExtent[1] = 0), e;
140
234
  }
141
235
  export {
142
- se as getCells
236
+ pe as getCells
143
237
  };
144
238
  //# sourceMappingURL=getCells.js.map