@milaboratories/miplots4 1.0.147 → 1.0.148

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.
@@ -1,104 +1,104 @@
1
- import { j as i } from "../../../node_modules/react/jsx-runtime.js";
1
+ import { j as l } from "../../../node_modules/react/jsx-runtime.js";
2
2
  import { Annotation as p } from "./Annotation.js";
3
- import { ANNOTATION_WIDTH as c, ANNOTATIONS_OFFSET as A } from "../../constants.js";
4
- function f(r, n) {
5
- return r.showTitle && n.includes(r.titlePosition);
3
+ import { ANNOTATION_WIDTH as c, ANNOTATIONS_OFFSET as T } from "../../constants.js";
4
+ function v(u, n) {
5
+ return u.showTitle && n.includes(u.titlePosition);
6
6
  }
7
- function J({
8
- facetKey: r,
7
+ function G({
8
+ facetKey: u,
9
9
  sideElementBBoxes: n,
10
- annotations: x,
10
+ annotations: A,
11
11
  annotationColorScales: s,
12
- cellsMeta: h,
12
+ cellsMeta: x,
13
13
  chartEdgeSides: a,
14
- sharedX: v,
15
- sharedY: j,
16
- width: w,
17
- height: N,
18
- scales: b,
19
- stepX: O,
20
- stepY: d,
21
- aes: D,
22
- frame: I,
23
- xGroupKeys: g,
24
- yGroupKeys: F,
25
- xKeysByGroups: K,
26
- yKeysByGroups: P,
27
- tooltipsData: _,
28
- cellsRenderingMode: C
14
+ sharedX: b,
15
+ sharedY: h,
16
+ width: j,
17
+ height: w,
18
+ scales: N,
19
+ stepX: C,
20
+ stepY: O,
21
+ aes: L,
22
+ frame: d,
23
+ xGroupKeys: D,
24
+ yGroupKeys: I,
25
+ xKeysByGroups: g,
26
+ yKeysByGroups: F,
27
+ tooltipsData: K,
28
+ cellsRenderingMode: P
29
29
  }) {
30
- const l = x.filter((o) => a.includes(o.position) || !v && ["left", "right"].includes(o.position) || !j && ["top", "bottom"].includes(o.position)), H = l.filter((o) => o.position === "left"), R = l.filter((o) => o.position === "right"), W = l.filter((o) => o.position === "top"), k = l.filter((o) => o.position === "bottom"), { xDataByKeys: y, yDataByKeys: T } = h, u = {
31
- facetKey: r,
32
- scales: b,
33
- stepX: O,
34
- stepY: d,
35
- width: w,
36
- height: N,
37
- aes: D,
38
- frame: I,
39
- xGroupKeys: g,
40
- yGroupKeys: F,
41
- xKeysByGroups: K,
42
- yKeysByGroups: P,
43
- tooltipsData: _,
44
- cellsRenderingMode: C
30
+ const i = A.filter((o) => a.includes(o.position) || !b && ["left", "right"].includes(o.position) || !h && ["top", "bottom"].includes(o.position)), _ = i.filter((o) => o.position === "left"), H = i.filter((o) => o.position === "right"), R = i.filter((o) => o.position === "top"), W = i.filter((o) => o.position === "bottom"), { xDataByKeys: f, yDataByKeys: y } = x, r = {
31
+ facetKey: u,
32
+ scales: N,
33
+ stepX: C,
34
+ stepY: O,
35
+ width: j,
36
+ height: w,
37
+ aes: L,
38
+ frame: d,
39
+ xGroupKeys: D,
40
+ yGroupKeys: I,
41
+ xKeysByGroups: g,
42
+ yKeysByGroups: F,
43
+ tooltipsData: K,
44
+ cellsRenderingMode: P
45
45
  };
46
- return /* @__PURE__ */ i.jsxs("g", { children: [
47
- H.map((o, t) => /* @__PURE__ */ i.jsx(
46
+ return /* @__PURE__ */ l.jsxs("g", { children: [
47
+ _.map((o, t) => /* @__PURE__ */ l.jsx(
48
48
  p,
49
49
  {
50
50
  annotation: o,
51
51
  colorScale: s[o.id],
52
- data: T[o.valueColumn.value],
53
- showTitle: f(o, a),
52
+ data: y[o.valueColumn.valueLabels ?? o.valueColumn.value],
53
+ showTitle: v(o, a),
54
54
  x: n.left.annotations.x + t * c,
55
55
  y: n.left.annotations.y,
56
- ...u
56
+ ...r
57
57
  },
58
58
  o.id
59
59
  )),
60
- R.map((o, t) => /* @__PURE__ */ i.jsx(
60
+ H.map((o, t) => /* @__PURE__ */ l.jsx(
61
61
  p,
62
62
  {
63
63
  annotation: o,
64
64
  colorScale: s[o.id],
65
- data: T[o.valueColumn.value],
66
- showTitle: f(o, a),
67
- x: n.right.annotations.x + t * c + A,
65
+ data: y[o.valueColumn.valueLabels ?? o.valueColumn.value],
66
+ showTitle: v(o, a),
67
+ x: n.right.annotations.x + t * c + T,
68
68
  y: n.right.annotations.y,
69
- ...u
69
+ ...r
70
70
  },
71
71
  o.id
72
72
  )),
73
- W.map((o, t) => /* @__PURE__ */ i.jsx(
73
+ R.map((o, t) => /* @__PURE__ */ l.jsx(
74
74
  p,
75
75
  {
76
76
  annotation: o,
77
77
  colorScale: s[o.id],
78
- data: y[o.valueColumn.value],
79
- showTitle: f(o, a),
78
+ data: f[o.valueColumn.valueLabels ?? o.valueColumn.value],
79
+ showTitle: v(o, a),
80
80
  x: n.top.annotations.x,
81
81
  y: n.top.annotations.y + t * c,
82
- ...u
82
+ ...r
83
83
  },
84
84
  o.id
85
85
  )),
86
- k.map((o, t) => /* @__PURE__ */ i.jsx(
86
+ W.map((o, t) => /* @__PURE__ */ l.jsx(
87
87
  p,
88
88
  {
89
89
  annotation: o,
90
90
  colorScale: s[o.id],
91
- data: y[o.valueColumn.value],
92
- showTitle: f(o, a),
91
+ data: f[o.valueColumn.valueLabels ?? o.valueColumn.value],
92
+ showTitle: v(o, a),
93
93
  x: n.bottom.annotations.x,
94
- y: n.bottom.annotations.y + t * c + A,
95
- ...u
94
+ y: n.bottom.annotations.y + t * c + T,
95
+ ...r
96
96
  },
97
97
  o.id
98
98
  ))
99
99
  ] });
100
100
  }
101
101
  export {
102
- J as Annotations
102
+ G as Annotations
103
103
  };
104
104
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../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","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;AAAA,EACA,mBAAAC;AAAA,EACA,aAAAC;AAAA,EACA,uBAAAC;AAAA,EACA,WAAAC;AAAA,EACA,gBAAAN;AAAA,EACA,SAAAO;AAAA,EACA,SAAAC;AAAA,EACA,OAAAC;AAAA,EACA,QAAAC;AAAA,EACA,QAAAC;AAAA,EACA,OAAAC;AAAA,EACA,OAAAC;AAAA,EACA,KAAAC;AAAA,EACA,OAAAC;AAAA,EACA,YAAAC;AAAA,EACA,YAAAC;AAAA,EACA,eAAAC;AAAA,EACA,eAAAC;AAAA,EACA,cAAAC;AAAA,EACA,oBAAAC;AACJ,GAAoB;AAChB,QAAMC,IAAkBlB,EAAY,OAAO,CAAAL,MAEnCC,EAAe,SAASD,EAAK,QAAQ,KACpC,CAACQ,KAAW,CAAC,QAAQ,OAAO,EAAE,SAASR,EAAK,QAAQ,KACpD,CAACS,KAAW,CAAC,OAAO,QAAQ,EAAE,SAAST,EAAK,QAAQ,CAE5D,GACKwB,IAAkBD,EAAgB,OAAO,CAAAvB,MAAQA,EAAK,aAAa,MAAM,GACzEyB,IAAmBF,EAAgB,OAAO,CAAAvB,MAAQA,EAAK,aAAa,OAAO,GAC3E0B,IAAiBH,EAAgB,OAAO,CAAAvB,MAAQA,EAAK,aAAa,KAAK,GACvE2B,IAAoBJ,EAAgB,OAAO,CAAAvB,MAAQA,EAAK,aAAa,QAAQ,GAC7E,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AAAA;AAAAA,MAACC;AAAA,MAAA;AAAA,QAEG,YAAYjC;AAAA,QACZ,YAAYM,EAAsBN,EAAK,EAAE;AAAA,QACzC,MAAM4B,EAAY5B,EAAK,YAAY,KAAK;AAAA,QACxC,WAAWD,EAAUC,GAAMC,CAAc;AAAA,QACzC,GAAGG,EAAkB,IAAI,YAAY;AAAA,QACrC,GAAGA,EAAkB,IAAI,YAAY,IAAI2B,IAAMG;AAAA,QAC9C,GAAGJ;AAAA,MAAA;AAAA,MAPC9B,EAAK;AAAA,IAAA,CAUrB;AAAA,IACA2B,EAAkB,IAAI,CAAC3B,GAAM+B,MAEtBC,gBAAAA,EAAAA;AAAAA,MAACC;AAAA,MAAA;AAAA,QAEG,YAAYjC;AAAA,QACZ,YAAYM,EAAsBN,EAAK,EAAE;AAAA,QACzC,MAAM4B,EAAY5B,EAAK,YAAY,KAAK;AAAA,QACxC,WAAWD,EAAUC,GAAMC,CAAc;AAAA,QACzC,GAAGG,EAAkB,OAAO,YAAY;AAAA,QACxC,GAAGA,EAAkB,OAAO,YAAY,IAAI2B,IAAMG,IAAmBC;AAAA,QACpE,GAAGL;AAAA,MAAA;AAAA,MAPC9B,EAAK;AAAA,IAAA,CAUrB;AAAA,EAAA,GACL;AAER;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../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","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;AAAA,EACA,mBAAAC;AAAA,EACA,aAAAC;AAAA,EACA,uBAAAC;AAAA,EACA,WAAAC;AAAA,EACA,gBAAAN;AAAA,EACA,SAAAO;AAAA,EACA,SAAAC;AAAA,EACA,OAAAC;AAAA,EACA,QAAAC;AAAA,EACA,QAAAC;AAAA,EACA,OAAAC;AAAA,EACA,OAAAC;AAAA,EACA,KAAAC;AAAA,EACA,OAAAC;AAAA,EACA,YAAAC;AAAA,EACA,YAAAC;AAAA,EACA,eAAAC;AAAA,EACA,eAAAC;AAAA,EACA,cAAAC;AAAA,EACA,oBAAAC;AACJ,GAAoB;AAChB,QAAMC,IAAkBlB,EAAY,OAAO,CAAAL,MAEnCC,EAAe,SAASD,EAAK,QAAQ,KACpC,CAACQ,KAAW,CAAC,QAAQ,OAAO,EAAE,SAASR,EAAK,QAAQ,KACpD,CAACS,KAAW,CAAC,OAAO,QAAQ,EAAE,SAAST,EAAK,QAAQ,CAE5D,GACKwB,IAAkBD,EAAgB,OAAO,CAAAvB,MAAQA,EAAK,aAAa,MAAM,GACzEyB,IAAmBF,EAAgB,OAAO,CAAAvB,MAAQA,EAAK,aAAa,OAAO,GAC3E0B,IAAiBH,EAAgB,OAAO,CAAAvB,MAAQA,EAAK,aAAa,KAAK,GACvE2B,IAAoBJ,EAAgB,OAAO,CAAAvB,MAAQA,EAAK,aAAa,QAAQ,GAC7E,EAAC,aAAA4B,GAAa,aAAAC,EAAA,IAAetB,GAE7BuB,IAAc;AAAA,IAChB,UAAA3B;AAAA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YAAYjC;AAAA,QACZ,YAAYM,EAAsBN,EAAK,EAAE;AAAA,QACzC,MAAM4B,EAAY5B,EAAK,YAAY,eAAeA,EAAK,YAAY,KAAK;AAAA,QACxE,WAAWD,EAAUC,GAAMC,CAAc;AAAA,QACzC,GAAGG,EAAkB,IAAI,YAAY;AAAA,QACrC,GAAGA,EAAkB,IAAI,YAAY,IAAI2B,IAAMG;AAAA,QAC9C,GAAGJ;AAAA,MAAA;AAAA,MAPC9B,EAAK;AAAA,IAAA,CAUrB;AAAA,IACA2B,EAAkB,IAAI,CAAC3B,GAAM+B,MAEtBC,gBAAAA,EAAAA;AAAAA,MAACC;AAAA,MAAA;AAAA,QAEG,YAAYjC;AAAA,QACZ,YAAYM,EAAsBN,EAAK,EAAE;AAAA,QACzC,MAAM4B,EAAY5B,EAAK,YAAY,eAAeA,EAAK,YAAY,KAAK;AAAA,QACxE,WAAWD,EAAUC,GAAMC,CAAc;AAAA,QACzC,GAAGG,EAAkB,OAAO,YAAY;AAAA,QACxC,GAAGA,EAAkB,OAAO,YAAY,IAAI2B,IAAMG,IAAmBC;AAAA,QACpE,GAAGL;AAAA,MAAA;AAAA,MAPC9B,EAAK;AAAA,IAAA,CAUrB;AAAA,EAAA,GACL;AAER;"}
@@ -36,5 +36,5 @@ export type GroupedCellsData = {
36
36
  cells: Record<string, Record<string, Cell>>;
37
37
  }>;
38
38
  };
39
- export declare function getCells(data: DataFrame, xColumn: ColumnName, yColumn: ColumnName, valueColumn: ColumnName, facetBy: ColumnName[], xGroupBy: ColumnName[], yGroupBy: ColumnName[], annotations: HeatmapSettingsImpl['annotations'], dendrogramX: HeatmapSettingsImpl['dendrogramX'], dendrogramY: HeatmapSettingsImpl['dendrogramY'], normalization: HeatmapSettingsImpl['normalization'], NAValueAs: HeatmapSettingsImpl['NAValueAs'], keysOrder: HeatmapSettingsImpl['keysOrder'], xAxis: HeatmapSettingsImpl['chartSettings']['xAxis'], yAxis: HeatmapSettingsImpl['chartSettings']['yAxis']): GroupedCellsData;
39
+ export declare function getCells(data: DataFrame, xColumn: ColumnName, yColumn: ColumnName, valueColumn: ColumnName, facetBy: ColumnName[], xGroupBy: ColumnName[], yGroupBy: ColumnName[], annotations: HeatmapSettingsImpl['annotations'], dendrogramX: HeatmapSettingsImpl['dendrogramX'], dendrogramY: HeatmapSettingsImpl['dendrogramY'], normalization: HeatmapSettingsImpl['normalization'], NAValueAs: HeatmapSettingsImpl['NAValueAs'], keysOrder: HeatmapSettingsImpl['keysOrder'], xAxis: HeatmapSettingsImpl['chartSettings']['xAxis'], yAxis: HeatmapSettingsImpl['chartSettings']['yAxis'], aggregation: HeatmapSettingsImpl['aggregation']): GroupedCellsData;
40
40
  //# sourceMappingURL=getCells.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getCells.d.ts","sourceRoot":"","sources":["../../src/heatmap/getCells.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAuB,MAAM,UAAU,CAAC;AAC3E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AA8BjE,MAAM,MAAM,IAAI,GAAG;IACf,MAAM,EAAE,IAAI,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,SAAS,CAAC;IACjB,eAAe,EAAE,SAAS,CAAC;IAC3B,CAAC,EAAE,SAAS,CAAC;IACb,CAAC,EAAE,SAAS,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC3B,IAAI,EAAE;QACF,SAAS,EAAE,MAAM,EAAE,CAAC;QACpB,UAAU,EAAE,MAAM,EAAE,CAAC;QACrB,UAAU,EAAE,MAAM,EAAE,CAAC;QACrB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;QACxC,aAAa,EAAE,MAAM,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W,EAAE,UAAU,EACvB,OAAO,EAAE,UAAU,EAAE,EACrB,QAAQ,EAAE,UAAU,EAAE,EACtB,QAAQ,EAAE,UAAU,EAAE,EACtB,WAAW,EAAE,mBAAmB,CAAC,aAAa,CAAC,EAC/C,WAAW,EAAE,mBAAmB,CAAC,aAAa,CAAC,EAC/C,WAAW,EAAE,mBAAmB,CAAC,aAAa,CAAC,EAC/C,aAAa,EAAE,mBAAmB,CAAC,eAAe,CAAC,EACnD,SAAS,EAAE,mBAAmB,CAAC,WAAW,CAAC,EAC3C,SAAS,EAAE,mBAAmB,CAAC,WAAW,CAAC,EAC3C,KAAK,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC,OAAO,CAAC,EACpD,KAAK,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC,OAAO,CAAC,EACpD,WAAW,EAAE,mBAAmB,CAAC,aAAa,CAAC,GAChD,gBAAgB,CA6LlB"}
@@ -1,38 +1,68 @@
1
- import v from "../node_modules/lodash/lodash.js";
2
- import Z from "../node_modules/d3-array/src/deviation.js";
3
- import I from "../node_modules/d3-array/src/mean.js";
4
- import O from "../node_modules/d3-array/src/extent.js";
5
- function k(n) {
6
- const o = Z(n), l = I(n);
7
- return o === void 0 || l === void 0 || o === 0 ? (c) => c : (c) => (c - l) / o;
1
+ import K from "../node_modules/lodash/lodash.js";
2
+ import { exhaustive as ee } from "../utils/index.js";
3
+ import X from "../node_modules/d3-array/src/mean.js";
4
+ import { quantileSorted as te } from "../node_modules/d3-array/src/quantile.js";
5
+ import ae from "../node_modules/d3-array/src/deviation.js";
6
+ import se from "../node_modules/d3-array/src/extent.js";
7
+ function ne(t) {
8
+ const s = ae(t), n = X(t);
9
+ return s === void 0 || n === void 0 || s === 0 ? (u) => u : (u) => (u - n) / s;
8
10
  }
9
- function ee(n) {
10
- const o = I(n), [l, c] = O(n);
11
- return o === void 0 || l === void 0 || c === void 0 || c === l ? (f) => f : (f) => (f - o) / (c - l);
11
+ function oe(t) {
12
+ const s = X(t), [n, u] = se(t);
13
+ return s === void 0 || n === void 0 || u === void 0 || u === n ? (r) => r : (r) => (r - s) / (u - n);
12
14
  }
13
- function te(n, o) {
14
- return n === "standardScaling" ? k(o) : n === "meanNormalization" ? ee(o) : (l) => l;
15
+ function le(t, s) {
16
+ return t === "standardScaling" ? ne(s) : t === "meanNormalization" ? oe(s) : (n) => n;
15
17
  }
16
- function B(n) {
17
- if (!n.length)
18
+ function N(t, s) {
19
+ switch (t) {
20
+ case "max": {
21
+ let n = s[0];
22
+ for (const u of s)
23
+ n = Math.max(n, u);
24
+ return n;
25
+ }
26
+ case "min": {
27
+ let n = s[0];
28
+ for (const u of s)
29
+ n = Math.min(n, u);
30
+ return n;
31
+ }
32
+ case "median": {
33
+ const n = s.sort((u, r) => u - r);
34
+ return te(n, 0.5);
35
+ }
36
+ case "mean":
37
+ return X(s) ?? s[0];
38
+ default:
39
+ ee(t, `Unknown aggregation function ${t}`);
40
+ }
41
+ }
42
+ function P(t) {
43
+ const s = [...new Set(t)].sort();
44
+ return s.length > 3 ? [...s.slice(0, 3), "..."].join(", ") : s.join(", ");
45
+ }
46
+ function A(t) {
47
+ if (!t.length)
18
48
  return [];
19
- let o = [[]];
20
- return n.forEach((l) => {
21
- const c = [];
22
- l.forEach((f) => {
23
- c.push(...o.map((d) => [...d, f]));
24
- }), o = c;
25
- }), o;
49
+ let s = [[]];
50
+ return t.forEach((n) => {
51
+ const u = [];
52
+ n.forEach((r) => {
53
+ u.push(...s.map((p) => [...p, r]));
54
+ }), s = u;
55
+ }), s;
26
56
  }
27
- const _ = (n, o, l = {}) => n.sort(
28
- (c, f) => o === "asc" ? (l[c] ?? c).localeCompare(l[f] ?? f, "en", { numeric: !0 }) : (l[f] ?? f).localeCompare(l[c] ?? c, "en", { numeric: !0 })
57
+ const Q = (t, s, n = {}) => t.sort(
58
+ (u, r) => s === "asc" ? (n[u] ?? u).localeCompare(n[r] ?? r, "en", { numeric: !0 }) : (n[r] ?? r).localeCompare(n[u] ?? u, "en", { numeric: !0 })
29
59
  );
30
- function le(n, o, l, c, f, d, b, D, z, X, C, Y, x, A, N) {
31
- const F = f.length ? f.map((e) => x[e.value] ?? n.getColumnCategories(e.value)) : [["null"]], R = d.length ? d.map((e) => x[e.value] ?? n.getColumnCategories(e.value)) : [["null"]], H = b.length ? b.map((e) => x[e.value] ?? n.getColumnCategories(e.value)) : [["null"]], S = B(F), M = B(R), j = B(H), $ = S.map((e) => e.join("_")), E = M.map((e) => e.join("_")), L = j.map((e) => e.join("_")), t = {
60
+ function ue() {
61
+ return {
32
62
  meta: {
33
- facetKeys: $,
34
- xGroupKeys: E,
35
- yGroupKeys: L,
63
+ facetKeys: [],
64
+ xGroupKeys: [],
65
+ yGroupKeys: [],
36
66
  xKeysByGroups: {},
37
67
  yKeysByGroups: {},
38
68
  xLabels: {},
@@ -41,104 +71,168 @@ function le(n, o, l, c, f, d, b, D, z, X, C, Y, x, A, N) {
41
71
  yGroupLabels: {},
42
72
  xDataByKeys: {},
43
73
  yDataByKeys: {},
44
- facetKeyValues: $.reduce((e, a, u) => (e[a] = S[u], e), {}),
45
- xGroupKeyValues: E.reduce((e, a, u) => (e[a] = M[u], e), {}),
46
- yGroupKeyValues: L.reduce((e, a, u) => (e[a] = j[u], e), {}),
74
+ facetKeyValues: {},
75
+ xGroupKeyValues: {},
76
+ yGroupKeyValues: {},
47
77
  valueExtent: [1 / 0, -1 / 0]
48
78
  },
49
79
  facets: {}
50
- }, w = o.valueLabels ?? o.value, q = l.valueLabels ?? l.value, J = D.filter((e) => e.axis === "x").map((e) => e.valueColumn.value), P = D.filter((e) => e.axis === "y").map((e) => e.valueColumn.value), Q = Object.values(z ?? {}).map((e) => e.value), T = Object.values(X ?? {}).map((e) => e.value), U = v.uniq([...J, ...Q, w]), W = v.uniq([...P, ...T, q]);
51
- for (let e = 0; e < n.rowsCount; e++) {
52
- const a = f.length ? f.map((s) => n.getColumnValue(s.value, e)).join("_") : "null", u = d.length ? d.map((s) => n.getColumnValue(s.value, e)).join("_") : "null", y = b.length ? b.map((s) => n.getColumnValue(s.value, e)).join("_") : "null", K = d.length ? d.map((s) => n.getColumnValue(s.valueLabels ?? s.value, e)).join(", ") : "", G = b.length ? b.map((s) => n.getColumnValue(s.valueLabels ?? s.value, e)).join(", ") : "";
53
- t.meta.xGroupLabels[u] = K, t.meta.yGroupLabels[y] = G;
54
- const i = String(n.getColumnValue(o.value, e)), r = String(n.getColumnValue(l.value, e)), p = n.getColumnValue(c.value, e) ?? Y;
55
- if (i === "null" || r === "null" || p === null)
80
+ };
81
+ }
82
+ function ie(t, s, n, u, r) {
83
+ if (s.x || s.y) {
84
+ const p = [1 / 0, -1 / 0];
85
+ t.meta.facetKeys.forEach((y) => {
86
+ const { xKeys: B, yKeys: w, cells: g, xKeysByGroups: G, yKeysByGroups: E } = t.facets[y], c = s.x ? G : B.reduce((e, i) => (e[i] = [i], e), {}), V = s.y ? E : w.reduce((e, i) => (e[i] = [i], e), {}), d = Object.keys(c), D = Object.keys(V);
87
+ for (const e of d)
88
+ for (const i of D) {
89
+ const b = [];
90
+ if (c[e].forEach((v) => {
91
+ V[i].forEach((C) => {
92
+ var $, q, S;
93
+ const x = (q = ($ = g[v]) == null ? void 0 : $[C]) == null ? void 0 : q.value;
94
+ x !== void 0 && (b.push(x), (S = g[v]) == null || delete S[C]);
95
+ });
96
+ }), b.length > 0) {
97
+ const v = N(s.method, b);
98
+ t.facets[y].cells[e] || (t.facets[y].cells[e] = {}), t.facets[y].cells[e][i] = {
99
+ isCell: !0,
100
+ idx: 0,
101
+ id: `${e}_${i}`,
102
+ x: e,
103
+ y: i,
104
+ value: v,
105
+ normalizedValue: v
106
+ }, p[0] = Math.min(v, p[0]), p[1] = Math.max(v, p[1]);
107
+ }
108
+ }
109
+ s.x && d.forEach((e) => {
110
+ n.forEach((i) => {
111
+ const b = r.find((x) => x.valueColumn.value === i || x.valueColumn.valueLabels === i);
112
+ if (!b)
113
+ return;
114
+ const v = [];
115
+ c[e].forEach((x) => {
116
+ v.push(t.meta.xDataByKeys[i][x]), delete t.meta.xDataByKeys[i][x];
117
+ });
118
+ const C = b.type === "continuous" ? N(s.method, v) : P(v);
119
+ t.meta.xDataByKeys[i][e] = C;
120
+ });
121
+ }), s.y && (u.forEach((e) => {
122
+ t.meta.yDataByKeys[e] = {};
123
+ }), D.forEach((e) => {
124
+ u.forEach((i) => {
125
+ const b = r.find((x) => x.valueColumn.value === i || x.valueColumn.valueLabels === i);
126
+ if (!b)
127
+ return;
128
+ const v = [];
129
+ V[e].forEach((x) => {
130
+ v.push(t.meta.yDataByKeys[i][x]), delete t.meta.yDataByKeys[i][x];
131
+ });
132
+ const C = b.type === "continuous" ? N(s.method, v) : P(v);
133
+ t.meta.yDataByKeys[i][e] = C;
134
+ });
135
+ })), s.x && (t.facets[y].xKeys = Object.keys(G), t.facets[y].xKeysByGroups = { null: t.facets[y].xKeys }, t.meta.xLabels = t.meta.xGroupLabels, t.meta.xGroupKeys = ["null"], t.meta.xGroupKeyValues = { null: ["null"] }), s.y && (t.facets[y].yKeys = Object.keys(E), t.facets[y].yKeysByGroups = { null: t.facets[y].yKeys }, t.meta.yLabels = t.meta.yGroupLabels, t.meta.yGroupKeys = ["null"], t.meta.yGroupKeyValues = { null: ["null"] });
136
+ }), t.meta.valueExtent = p;
137
+ }
138
+ }
139
+ function re(t, s) {
140
+ if (s) {
141
+ const n = [1 / 0, -1 / 0];
142
+ t.meta.facetKeys.forEach((u) => {
143
+ const { xKeys: r, yKeys: p, cells: y } = t.facets[u], B = s.direction === "row" ? r : p, w = s.direction === "row" ? p : r, g = s.direction === "row" ? (G, E) => {
144
+ var c;
145
+ return (c = y[G]) == null ? void 0 : c[E];
146
+ } : (G, E) => {
147
+ var c;
148
+ return (c = y[E]) == null ? void 0 : c[G];
149
+ };
150
+ w.forEach((G) => {
151
+ const E = [];
152
+ B.forEach((V) => {
153
+ var D;
154
+ const d = (D = g(V, G)) == null ? void 0 : D.value;
155
+ d !== void 0 && E.push(d);
156
+ });
157
+ const c = le(s.method, E);
158
+ B.forEach((V) => {
159
+ const d = g(V, G);
160
+ d !== void 0 && (d.normalizedValue = c(d.value), n[0] = Math.min(d.normalizedValue, n[0]), n[1] = Math.max(d.normalizedValue, n[1]));
161
+ });
162
+ });
163
+ }), t.meta.valueExtent = n;
164
+ }
165
+ }
166
+ function xe(t, s, n, u, r, p, y, B, w, g, G, E, c, V, d, D) {
167
+ const e = ue(), i = r.length ? r.map((a) => c[a.value] ?? t.getColumnCategories(a.value)) : [["null"]], b = p.length ? p.map((a) => c[a.value] ?? t.getColumnCategories(a.value)) : [["null"]], v = y.length ? y.map((a) => c[a.value] ?? t.getColumnCategories(a.value)) : [["null"]], C = A(i), x = A(b), $ = A(v), q = C.map((a) => a.join("_")), S = x.map((a) => a.join("_")), z = $.map((a) => a.join("_"));
168
+ e.meta.facetKeys = q, e.meta.xGroupKeys = S, e.meta.yGroupKeys = z, e.meta.facetKeyValues = q.reduce((a, o, f) => (a[o] = C[f], a), {}), e.meta.xGroupKeyValues = S.reduce((a, o, f) => (a[o] = x[f], a), {}), e.meta.yGroupKeyValues = z.reduce((a, o, f) => (a[o] = $[f], a), {});
169
+ const Y = s.valueLabels ?? s.value, F = n.valueLabels ?? n.value, T = B.filter((a) => a.axis === "x").map((a) => a.valueColumn.valueLabels ?? a.valueColumn.value), W = B.filter((a) => a.axis === "y").map((a) => a.valueColumn.valueLabels ?? a.valueColumn.value), Z = Object.values(w ?? {}).map((a) => a.value), O = Object.values(g ?? {}).map((a) => a.value), R = K.uniq([...T, ...Z, Y]), U = K.uniq([...W, ...O, F]);
170
+ for (let a = 0; a < t.rowsCount; a++) {
171
+ const o = r.length ? r.map((l) => t.getColumnValue(l.value, a)).join("_") : "null", f = p.length ? p.map((l) => t.getColumnValue(l.value, a)).join("_") : "null", L = y.length ? y.map((l) => t.getColumnValue(l.value, a)).join("_") : "null", j = p.length ? p.map((l) => t.getColumnValue(l.valueLabels ?? l.value, a)).join(", ") : "", k = y.length ? y.map((l) => t.getColumnValue(l.valueLabels ?? l.value, a)).join(", ") : "";
172
+ e.meta.xGroupLabels[f] = j, e.meta.yGroupLabels[L] = k;
173
+ const m = String(t.getColumnValue(s.value, a)), h = String(t.getColumnValue(n.value, a)), M = t.getColumnValue(u.value, a) ?? E;
174
+ if (m === "null" || h === "null" || M === null)
56
175
  continue;
57
- if (t.facets[a] || (t.facets[a] = {
176
+ if (e.facets[o] || (e.facets[o] = {
58
177
  xKeys: [],
59
178
  yKeys: [],
60
179
  xKeysByGroups: {},
61
180
  yKeysByGroups: {},
62
181
  cells: {}
63
- }), t.facets[a].xKeysByGroups[u] || (t.facets[a].xKeysByGroups[u] = []), t.facets[a].yKeysByGroups[y] || (t.facets[a].yKeysByGroups[y] = []), t.facets[a].xKeys.push(i), t.facets[a].yKeys.push(r), t.facets[a].xKeysByGroups[u].push(i), t.facets[a].yKeysByGroups[y].push(r), t.facets[a].cells[i] || (t.facets[a].cells[i] = {}), t.meta.valueExtent[0] = Math.min(p, t.meta.valueExtent[0]), t.meta.valueExtent[1] = Math.max(p, t.meta.valueExtent[1]), t.facets[a].cells[i][r] && t.facets[a].cells[i][r].value !== p)
64
- throw Error(`More than 1 value for x=${i}, y=${r}`);
65
- const h = n.getColumnValue(w, e);
66
- if (t.meta.xLabels[i] && String(h) !== t.meta.xLabels[i])
67
- throw Error(`More than 1 x-label value for x=${i}`);
68
- const g = n.getColumnValue(q, e);
69
- if (t.meta.yLabels[r] && String(g) !== t.meta.yLabels[r])
70
- throw Error(`More than 1 y-label value for y=${r}`);
71
- t.meta.xLabels[i] = String(h), t.meta.yLabels[r] = String(g), U.forEach((s) => {
72
- const m = typeof t.meta.xDataByKeys[s] < "u", V = m && typeof t.meta.xDataByKeys[s][i] < "u";
73
- if (m || (t.meta.xDataByKeys[s] = {}), V && t.meta.xDataByKeys[s][i] !== n.getColumnValue(s, e))
74
- throw Error(`More than 1 value for x = ${i} and column = ${s}`);
75
- V || (t.meta.xDataByKeys[s][i] = n.getColumnValue(s, e));
76
- }), W.forEach((s) => {
77
- const m = typeof t.meta.yDataByKeys[s] < "u", V = m && typeof t.meta.yDataByKeys[s][r] < "u";
78
- if (m || (t.meta.yDataByKeys[s] = {}), V && t.meta.yDataByKeys[s][r] !== n.getColumnValue(s, e))
79
- throw Error(`More than 1 value for y = ${r} and column = ${s}`);
80
- V || (t.meta.yDataByKeys[s][r] = n.getColumnValue(s, e));
81
- }), t.facets[a].cells[i][r] = {
182
+ }), e.facets[o].xKeysByGroups[f] || (e.facets[o].xKeysByGroups[f] = []), e.facets[o].yKeysByGroups[L] || (e.facets[o].yKeysByGroups[L] = []), e.facets[o].xKeys.push(m), e.facets[o].yKeys.push(h), e.facets[o].xKeysByGroups[f].push(m), e.facets[o].yKeysByGroups[L].push(h), e.facets[o].cells[m] || (e.facets[o].cells[m] = {}), e.meta.valueExtent[0] = Math.min(M, e.meta.valueExtent[0]), e.meta.valueExtent[1] = Math.max(M, e.meta.valueExtent[1]), e.facets[o].cells[m][h] && e.facets[o].cells[m][h].value !== M)
183
+ throw Error(`More than 1 value for x=${m}, y=${h}`);
184
+ const H = t.getColumnValue(Y, a);
185
+ if (e.meta.xLabels[m] && String(H) !== e.meta.xLabels[m])
186
+ throw Error(`More than 1 x-label value for x=${m}`);
187
+ const J = t.getColumnValue(F, a);
188
+ if (e.meta.yLabels[h] && String(J) !== e.meta.yLabels[h])
189
+ throw Error(`More than 1 y-label value for y=${h}`);
190
+ e.meta.xLabels[m] = String(H), e.meta.yLabels[h] = String(J), R.forEach((l) => {
191
+ const I = typeof e.meta.xDataByKeys[l] < "u", _ = I && typeof e.meta.xDataByKeys[l][m] < "u";
192
+ if (I || (e.meta.xDataByKeys[l] = {}), _ && e.meta.xDataByKeys[l][m] !== t.getColumnValue(l, a))
193
+ throw Error(`More than 1 value for x = ${m} and column = ${l}`);
194
+ _ || (e.meta.xDataByKeys[l][m] = t.getColumnValue(l, a));
195
+ }), U.forEach((l) => {
196
+ const I = typeof e.meta.yDataByKeys[l] < "u", _ = I && typeof e.meta.yDataByKeys[l][h] < "u";
197
+ if (I || (e.meta.yDataByKeys[l] = {}), _ && e.meta.yDataByKeys[l][h] !== t.getColumnValue(l, a))
198
+ throw Error(`More than 1 value for y = ${h} and column = ${l}`);
199
+ _ || (e.meta.yDataByKeys[l][h] = t.getColumnValue(l, a));
200
+ }), e.facets[o].cells[m][h] = {
82
201
  isCell: !0,
83
- idx: e,
84
- id: `${i}_${r}`,
85
- x: i,
86
- y: r,
87
- value: p,
88
- normalizedValue: p
202
+ idx: a,
203
+ id: `${m}_${h}`,
204
+ x: m,
205
+ y: h,
206
+ value: M,
207
+ normalizedValue: M
89
208
  };
90
209
  }
91
- if (t.meta.facetKeys = t.meta.facetKeys.filter((e) => t.facets[e]), t.meta.facetKeys.forEach((e) => {
92
- const a = t.facets[e], u = v.uniq(a.xKeys), y = v.uniq(a.yKeys);
93
- a.xKeys = x[o.value] ? v.intersection(x[o.value], u) : u, a.yKeys = x[l.value] ? v.intersection(x[l.value], y) : y, E.forEach((K) => {
94
- t.facets[e].xKeysByGroups[K] = v.intersection(
95
- a.xKeys,
96
- t.facets[e].xKeysByGroups[K]
210
+ return e.meta.facetKeys = e.meta.facetKeys.filter((a) => e.facets[a]), e.meta.facetKeys.forEach((a) => {
211
+ const o = e.facets[a], f = K.uniq(o.xKeys), L = K.uniq(o.yKeys);
212
+ o.xKeys = c[s.value] ? K.intersection(c[s.value], f) : f, o.yKeys = c[n.value] ? K.intersection(c[n.value], L) : L, S.forEach((j) => {
213
+ e.facets[a].xKeysByGroups[j] = K.intersection(
214
+ o.xKeys,
215
+ e.facets[a].xKeysByGroups[j]
97
216
  );
98
- }), L.forEach((K) => {
99
- t.facets[e].yKeysByGroups[K] = v.intersection(
100
- a.yKeys,
101
- t.facets[e].yKeysByGroups[K]
217
+ }), z.forEach((j) => {
218
+ e.facets[a].yKeysByGroups[j] = K.intersection(
219
+ o.yKeys,
220
+ e.facets[a].yKeysByGroups[j]
102
221
  );
103
222
  });
104
- }), C) {
105
- const e = [1 / 0, -1 / 0];
106
- t.meta.facetKeys.forEach((a) => {
107
- const { xKeys: u, yKeys: y, cells: K } = t.facets[a], G = C.direction === "row" ? u : y, i = C.direction === "row" ? y : u, r = C.direction === "row" ? (p, h) => {
108
- var g;
109
- return (g = K[p]) == null ? void 0 : g[h];
110
- } : (p, h) => {
111
- var g;
112
- return (g = K[h]) == null ? void 0 : g[p];
113
- };
114
- i.forEach((p) => {
115
- const h = [];
116
- G.forEach((s) => {
117
- var V;
118
- const m = (V = r(s, p)) == null ? void 0 : V.value;
119
- m !== void 0 && h.push(m);
120
- });
121
- const g = te(C.method, h);
122
- G.forEach((s) => {
123
- const m = r(s, p);
124
- m !== void 0 && (m.normalizedValue = g(m.value), e[0] = Math.min(m.normalizedValue, e[0]), e[1] = Math.max(m.normalizedValue, e[1]));
125
- });
126
- });
127
- }), t.meta.valueExtent = e;
128
- }
129
- return t.meta.xKeysByGroups = E.reduce((e, a) => {
130
- const u = _(v.uniq(
131
- v.flatten(t.meta.facetKeys.map((y) => t.facets[y].xKeysByGroups[a]))
132
- ), A.sorting, t.meta.xLabels);
133
- return e[a] = x[o.value] ? v.intersection(x[o.value], u) : u, e;
134
- }, {}), t.meta.yKeysByGroups = L.reduce((e, a) => {
135
- const u = _(v.uniq(
136
- v.flatten(t.meta.facetKeys.map((y) => t.facets[y].yKeysByGroups[a]))
137
- ), N.sorting, t.meta.yLabels);
138
- return e[a] = x[l.value] ? v.intersection(x[l.value], u) : u, e;
139
- }, {}), t.meta.valueExtent[0] === 1 / 0 && (t.meta.valueExtent[0] = 0), t.meta.valueExtent[1] === -1 / 0 && (t.meta.valueExtent[1] = 0), t;
223
+ }), ie(e, D, R, U, B), re(e, G), e.meta.xKeysByGroups = e.meta.xGroupKeys.reduce((a, o) => {
224
+ const f = Q(K.uniq(
225
+ K.flatten(e.meta.facetKeys.map((L) => e.facets[L].xKeysByGroups[o]))
226
+ ), V.sorting, e.meta.xLabels);
227
+ return a[o] = c[s.value] ? K.intersection(c[s.value], f) : f, a;
228
+ }, {}), e.meta.yKeysByGroups = e.meta.yGroupKeys.reduce((a, o) => {
229
+ const f = Q(K.uniq(
230
+ K.flatten(e.meta.facetKeys.map((L) => e.facets[L].yKeysByGroups[o]))
231
+ ), d.sorting, e.meta.yLabels);
232
+ return a[o] = c[n.value] ? K.intersection(c[n.value], f) : f, a;
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
- le as getCells
236
+ xe as getCells
143
237
  };
144
238
  //# sourceMappingURL=getCells.js.map