@milaboratories/graph-maker 1.2.1 → 1.2.3

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 (92) hide show
  1. package/dist/assets/ui.css +1 -1
  2. package/dist/components/ChartTruncationWarningAlert.css +1 -0
  3. package/dist/components/ChartTruncationWarningAlert.vue.d.ts +7 -0
  4. package/dist/components/ChartTruncationWarningAlert.vue.d.ts.map +1 -0
  5. package/dist/components/ChartTruncationWarningAlert.vue.js +10 -0
  6. package/dist/components/ChartTruncationWarningAlert.vue.js.map +1 -0
  7. package/dist/components/ChartTruncationWarningAlert.vue2.js +54 -0
  8. package/dist/components/ChartTruncationWarningAlert.vue2.js.map +1 -0
  9. package/dist/components/ChartTruncationWarningAlert.vue3.js +8 -0
  10. package/dist/components/ChartTruncationWarningAlert.vue3.js.map +1 -0
  11. package/dist/components/DragAndDrop/DnDBasketChip.vue.d.ts.map +1 -1
  12. package/dist/components/DragAndDrop/DnDBasketChip.vue.js +34 -31
  13. package/dist/components/DragAndDrop/DnDBasketChip.vue.js.map +1 -1
  14. package/dist/components/DragAndDrop/DnDRangeChip.vue.d.ts.map +1 -1
  15. package/dist/components/DragAndDrop/DnDRangeChip.vue.js +34 -31
  16. package/dist/components/DragAndDrop/DnDRangeChip.vue.js.map +1 -1
  17. package/dist/components/DragAndDrop/DndDoubleChip.vue.d.ts.map +1 -1
  18. package/dist/components/DragAndDrop/DndDoubleChip.vue.js +40 -35
  19. package/dist/components/DragAndDrop/DndDoubleChip.vue.js.map +1 -1
  20. package/dist/components/PanelModal.vue.d.ts.map +1 -1
  21. package/dist/components/PanelModal.vue.js +25 -11
  22. package/dist/components/PanelModal.vue.js.map +1 -1
  23. package/dist/constantsCommon.d.ts +6 -0
  24. package/dist/constantsCommon.d.ts.map +1 -1
  25. package/dist/constantsCommon.js +36 -32
  26. package/dist/constantsCommon.js.map +1 -1
  27. package/dist/dataBindAes.d.ts.map +1 -1
  28. package/dist/dataBindAes.js +81 -86
  29. package/dist/dataBindAes.js.map +1 -1
  30. package/dist/forms/AxesSettingsForm/BubbleAxesSettingsForm.vue.d.ts.map +1 -1
  31. package/dist/forms/AxesSettingsForm/BubbleAxesSettingsForm.vue.js +64 -54
  32. package/dist/forms/AxesSettingsForm/BubbleAxesSettingsForm.vue.js.map +1 -1
  33. package/dist/forms/AxesSettingsForm/DiscreteAxesSettingsForm.vue.d.ts.map +1 -1
  34. package/dist/forms/AxesSettingsForm/DiscreteAxesSettingsForm.vue.js +177 -157
  35. package/dist/forms/AxesSettingsForm/DiscreteAxesSettingsForm.vue.js.map +1 -1
  36. package/dist/forms/AxesSettingsForm/HeatmapAxesSettingsForm.vue.d.ts.map +1 -1
  37. package/dist/forms/AxesSettingsForm/HeatmapAxesSettingsForm.vue.js +133 -123
  38. package/dist/forms/AxesSettingsForm/HeatmapAxesSettingsForm.vue.js.map +1 -1
  39. package/dist/forms/AxesSettingsForm/HistogramAxesSettingsForm.vue.d.ts.map +1 -1
  40. package/dist/forms/AxesSettingsForm/HistogramAxesSettingsForm.vue.js +130 -120
  41. package/dist/forms/AxesSettingsForm/HistogramAxesSettingsForm.vue.js.map +1 -1
  42. package/dist/forms/AxesSettingsForm/ScatterplotAxesSettingsForm.vue.d.ts.map +1 -1
  43. package/dist/forms/AxesSettingsForm/ScatterplotAxesSettingsForm.vue.js +164 -147
  44. package/dist/forms/AxesSettingsForm/ScatterplotAxesSettingsForm.vue.js.map +1 -1
  45. package/dist/forms/DataMappingForm/utils.js +58 -58
  46. package/dist/forms/DataMappingForm/utils.js.map +1 -1
  47. package/dist/forms/LayersForm/AesSelector.vue.js +66 -66
  48. package/dist/forms/LayersForm/AesSelector.vue.js.map +1 -1
  49. package/dist/index.vue.d.ts.map +1 -1
  50. package/dist/index.vue.js +186 -172
  51. package/dist/index.vue.js.map +1 -1
  52. package/dist/store.d.ts +2 -1
  53. package/dist/store.d.ts.map +1 -1
  54. package/dist/store.js +140 -134
  55. package/dist/store.js.map +1 -1
  56. package/dist/types.d.ts +2 -0
  57. package/dist/types.d.ts.map +1 -1
  58. package/dist/utils/calculateDiscreteGroups.d.ts.map +1 -1
  59. package/dist/utils/calculateDiscreteGroups.js +6 -6
  60. package/dist/utils/calculateDiscreteGroups.js.map +1 -1
  61. package/dist/utils/createChartSettingsForRender/composeBubbleSettings.d.ts +1 -0
  62. package/dist/utils/createChartSettingsForRender/composeBubbleSettings.d.ts.map +1 -1
  63. package/dist/utils/createChartSettingsForRender/composeChartSettings.d.ts +19 -1
  64. package/dist/utils/createChartSettingsForRender/composeChartSettings.d.ts.map +1 -1
  65. package/dist/utils/createChartSettingsForRender/composeChartSettings.js +74 -40
  66. package/dist/utils/createChartSettingsForRender/composeChartSettings.js.map +1 -1
  67. package/dist/utils/createChartSettingsForRender/composeDendroSettings.d.ts +1 -0
  68. package/dist/utils/createChartSettingsForRender/composeDendroSettings.d.ts.map +1 -1
  69. package/dist/utils/createChartSettingsForRender/composeDendroSettings.js +22 -22
  70. package/dist/utils/createChartSettingsForRender/composeDendroSettings.js.map +1 -1
  71. package/dist/utils/createChartSettingsForRender/composeDiscreteSettings.d.ts +4 -487
  72. package/dist/utils/createChartSettingsForRender/composeDiscreteSettings.d.ts.map +1 -1
  73. package/dist/utils/createChartSettingsForRender/composeDiscreteSettings.js +48 -35
  74. package/dist/utils/createChartSettingsForRender/composeDiscreteSettings.js.map +1 -1
  75. package/dist/utils/createChartSettingsForRender/composeHeatmapSettings.d.ts +1 -0
  76. package/dist/utils/createChartSettingsForRender/composeHeatmapSettings.d.ts.map +1 -1
  77. package/dist/utils/createChartSettingsForRender/composeHistogramSettings.d.ts +1 -0
  78. package/dist/utils/createChartSettingsForRender/composeHistogramSettings.d.ts.map +1 -1
  79. package/dist/utils/createChartSettingsForRender/composeScatterplotSettings.d.ts +1 -0
  80. package/dist/utils/createChartSettingsForRender/composeScatterplotSettings.d.ts.map +1 -1
  81. package/dist/utils/createChartSettingsForRender/composeScatterplotSettings.js +80 -67
  82. package/dist/utils/createChartSettingsForRender/composeScatterplotSettings.js.map +1 -1
  83. package/dist/utils/createChartSettingsForRender/getAxesDataFromForms.d.ts.map +1 -1
  84. package/dist/utils/createChartSettingsForRender/getAxesDataFromForms.js +28 -28
  85. package/dist/utils/createChartSettingsForRender/getAxesDataFromForms.js.map +1 -1
  86. package/dist/utils/loadUniqueValuesToSave.d.ts +3 -1
  87. package/dist/utils/loadUniqueValuesToSave.d.ts.map +1 -1
  88. package/dist/utils/loadUniqueValuesToSave.js +81 -63
  89. package/dist/utils/loadUniqueValuesToSave.js.map +1 -1
  90. package/package.json +3 -3
  91. package/dist/assets/drag-and-drop/img/chip-close.svg.js +0 -7
  92. package/dist/assets/drag-and-drop/img/chip-close.svg.js.map +0 -1
@@ -1,50 +1,50 @@
1
- function O(i, t = []) {
2
- return i !== null ? i : t.length > 6 && t.some(({ label: c }) => c.length > 5) ? "45deg" : "center";
1
+ function G(i, t = []) {
2
+ return i !== null ? i : t.length > 6 && t.some(({ label: d }) => d.length > 5) ? "45deg" : "center";
3
3
  }
4
- function E(i, t, c, s) {
5
- var Y, S, x, k, w, p, y, T, M, _, C, G;
6
- let e = {}, l = {};
7
- e.showGrid = i.axisX.gridlines, e.showTicks = i.axisX.ticks, l.showGrid = i.axisY.gridlines, l.showTicks = i.axisY.ticks;
8
- const o = ((Y = c.components.x.selectorStates) == null ? void 0 : Y[0].selectedSource) ?? null, d = ((S = c.components.y.selectorStates) == null ? void 0 : S[0].selectedSource) ?? null, f = o ? s.getSourceInfo(o) : null, A = d ? s.getSourceInfo(d) : null, R = (f == null ? void 0 : f.type) === "String", B = (A == null ? void 0 : A.type) === "String";
9
- if (R) {
4
+ function R(i, t, d, l) {
5
+ var S, k, x, w, p, T, M, _;
6
+ let e = {}, s = {};
7
+ e.showGrid = i.axisX.gridlines, e.showTicks = i.axisX.ticks, s.showGrid = i.axisY.gridlines, s.showTicks = i.axisY.ticks;
8
+ const f = ((S = d.components.x.selectorStates) == null ? void 0 : S[0].selectedSource) ?? null, r = ((k = d.components.y.selectorStates) == null ? void 0 : k[0].selectedSource) ?? null, A = f ? l.getSourceInfo(f) : null, X = r ? l.getSourceInfo(r) : null, y = (A == null ? void 0 : A.type) === "String", C = (X == null ? void 0 : X.type) === "String";
9
+ if (y) {
10
10
  e = e, e.scale = "discrete", e.labelsPosition = i.axisX.labelsRotation ?? "center";
11
- const u = ((x = i.axisX.order) == null ? void 0 : x.source) === o, g = (k = t[o]) == null ? void 0 : k.list, h = (w = t[o]) == null ? void 0 : w.labels, b = u ? ((p = i.axisX.order) == null ? void 0 : p.options.map((n) => n.value)) ?? g : g, L = u ? ((y = i.axisX.order) == null ? void 0 : y.options.reduce((n, r) => (n[r.value] = r.label, n), {})) ?? h : h;
12
- b && L && (e.keys = b, e.labels = L);
11
+ const n = ((x = i.axisX.order) == null ? void 0 : x.source) === f, c = t[f], u = c == null ? void 0 : c.list, g = c == null ? void 0 : c.labels, h = n ? ((w = i.axisX.order) == null ? void 0 : w.options.map((o) => o.value)) ?? u : u, b = n ? ((p = i.axisX.order) == null ? void 0 : p.options.reduce((o, L) => (o[L.value] = L.label, o), {})) ?? g : g;
12
+ h && b && (e.keys = h, e.labels = b);
13
13
  } else
14
14
  e = e, e.scale = i.axisX.scale, e.significantLinesStyle = i.axisX.significantLinesStyle;
15
- if (B) {
16
- l = l, l.scale = "discrete", l.labelsPosition = i.axisY.labelsRotation ?? "center";
17
- const u = (T = t[d]) == null ? void 0 : T.list, g = (M = t[d]) == null ? void 0 : M.labels, h = ((_ = i.axisY.order) == null ? void 0 : _.source) === d, b = h ? ((C = i.axisY.order) == null ? void 0 : C.options.map((n) => n.value)) ?? u : u, L = h ? ((G = i.axisY.order) == null ? void 0 : G.options.reduce((n, r) => (n[r.value] = r.label, n), {})) ?? g : g;
18
- b && L && (l.keys = b, l.labels = L);
15
+ if (C) {
16
+ s = s, s.scale = "discrete", s.labelsPosition = i.axisY.labelsRotation ?? "center";
17
+ const n = t[r], c = n == null ? void 0 : n.list, u = n == null ? void 0 : n.labels, g = ((T = i.axisY.order) == null ? void 0 : T.source) === r, h = g ? ((M = i.axisY.order) == null ? void 0 : M.options.map((o) => o.value)) ?? c : c, b = g ? ((_ = i.axisY.order) == null ? void 0 : _.options.reduce((o, L) => (o[L.value] = L.label, o), {})) ?? u : u;
18
+ h && b && (s.keys = h, s.labels = b);
19
19
  } else
20
- l = l, l.scale = i.axisY.scale, l.significantLinesStyle = i.axisY.significantLinesStyle;
21
- i.axisY.titleMode !== "auto" && (l.title = i.axisY.titleMode === "custom" ? i.axisY.customTitle : ""), i.axisX.titleMode !== "auto" && (e.title = i.axisX.titleMode === "custom" ? i.axisX.customTitle : ""), e.hiddenLabels = i.axisX.hideAxisLabels, l.hiddenLabels = i.axisY.hideAxisLabels;
22
- const X = {
20
+ s = s, s.scale = i.axisY.scale, s.significantLinesStyle = i.axisY.significantLinesStyle;
21
+ i.axisY.titleMode !== "auto" && (s.title = i.axisY.titleMode === "custom" ? i.axisY.customTitle : ""), i.axisX.titleMode !== "auto" && (e.title = i.axisX.titleMode === "custom" ? i.axisX.customTitle : ""), e.hiddenLabels = i.axisX.hideAxisLabels, s.hiddenLabels = i.axisY.hideAxisLabels;
22
+ const Y = {
23
23
  xAxis: e,
24
- yAxis: l,
24
+ yAxis: s,
25
25
  frame: { type: i.other.frame },
26
26
  facetSettings: {
27
27
  nCols: i.other.facetColumns
28
28
  }
29
29
  };
30
- return X.facetSettings.sharedX = ["x", "xy"].includes(i.other.facetSharedBy), X.facetSettings.sharedY = ["y", "xy"].includes(i.other.facetSharedBy), X;
30
+ return Y.facetSettings.sharedX = ["x", "xy"].includes(i.other.facetSharedBy), Y.facetSettings.sharedY = ["y", "xy"].includes(i.other.facetSharedBy), Y;
31
31
  }
32
- function H(i, t, c = []) {
33
- const s = {}, e = {};
34
- t === "discrete" && (s.labelsPosition = O(i.axisX.labelsRotation, c), s.linesBetweenCategories = i.axisX.linesBetweenCategories, e.scale = i.axisY.scale, s.showGrid = i.axisX.gridlines, s.showTicks = i.axisX.ticks, s.hiddenLabels = i.axisX.hideAxisLabels, e.hiddenLabels = i.axisY.hideAxisLabels, e.showGrid = i.axisY.gridlines, e.showTicks = i.axisY.ticks), t === "histogram" && (s.scale = i.axisX.scale, e.scale = i.axisY.scale, s.hiddenLabels = i.axisX.hideAxisLabels, e.hiddenLabels = i.axisY.hideAxisLabels, s.showTicks = i.axisX.ticks, e.showTicks = i.axisY.ticks, s.showGrid = i.axisX.gridlines, e.showGrid = i.axisY.gridlines), (t === "heatmap" || t === "bubble") && (s.axisLabelsAngle = i.axisX.axisLabelsAngle, s.groupLabelsAngle = i.axisX.groupLabelsAngle, e.axisLabelsAngle = i.axisY.axisLabelsAngle, e.groupLabelsAngle = i.axisY.groupLabelsAngle, s.sorting = i.axisX.sorting, e.sorting = i.axisY.sorting, s.showAxisLabels = !i.axisX.hideAxisLabels, e.showAxisLabels = !i.axisY.hideAxisLabels, s.showGroupLabels = !i.axisX.hideAxisGroupLabels, e.showGroupLabels = !i.axisY.hideAxisGroupLabels, s.showTicks = i.axisX.ticks, e.showTicks = i.axisY.ticks), i.axisY.titleMode !== "auto" && (e.title = i.axisY.titleMode === "custom" ? i.axisY.customTitle : ""), i.axisX.titleMode !== "auto" && (s.title = i.axisX.titleMode === "custom" ? i.axisX.customTitle : "");
35
- const l = {
36
- xAxis: s,
32
+ function B(i, t, d = []) {
33
+ const l = {}, e = {};
34
+ t === "discrete" && (l.labelsPosition = G(i.axisX.labelsRotation, d), l.linesBetweenCategories = i.axisX.linesBetweenCategories, e.scale = i.axisY.scale, l.showGrid = i.axisX.gridlines, l.showTicks = i.axisX.ticks, l.hiddenLabels = i.axisX.hideAxisLabels, e.hiddenLabels = i.axisY.hideAxisLabels, e.showGrid = i.axisY.gridlines, e.showTicks = i.axisY.ticks), t === "histogram" && (l.scale = i.axisX.scale, e.scale = i.axisY.scale, l.hiddenLabels = i.axisX.hideAxisLabels, e.hiddenLabels = i.axisY.hideAxisLabels, l.showTicks = i.axisX.ticks, e.showTicks = i.axisY.ticks, l.showGrid = i.axisX.gridlines, e.showGrid = i.axisY.gridlines), (t === "heatmap" || t === "bubble") && (l.axisLabelsAngle = i.axisX.axisLabelsAngle, l.groupLabelsAngle = i.axisX.groupLabelsAngle, e.axisLabelsAngle = i.axisY.axisLabelsAngle, e.groupLabelsAngle = i.axisY.groupLabelsAngle, l.sorting = i.axisX.sorting, e.sorting = i.axisY.sorting, l.showAxisLabels = !i.axisX.hideAxisLabels, e.showAxisLabels = !i.axisY.hideAxisLabels, l.showGroupLabels = !i.axisX.hideAxisGroupLabels, e.showGroupLabels = !i.axisY.hideAxisGroupLabels, l.showTicks = i.axisX.ticks, e.showTicks = i.axisY.ticks), i.axisY.titleMode !== "auto" && (e.title = i.axisY.titleMode === "custom" ? i.axisY.customTitle : ""), i.axisX.titleMode !== "auto" && (l.title = i.axisX.titleMode === "custom" ? i.axisX.customTitle : "");
35
+ const s = {
36
+ xAxis: l,
37
37
  yAxis: e,
38
38
  frame: { type: i.other.frame },
39
39
  facetSettings: {
40
40
  nCols: i.other.facetColumns
41
41
  }
42
42
  };
43
- return (t === "discrete" || t === "scatterplot" || t === "heatmap") && (l.orientation = i.other.reverse ? "horizontal" : "vertical", l.facetSettings.sharedX = ["x", "xy"].includes(i.other.facetSharedBy), l.facetSettings.sharedY = ["y", "xy"].includes(i.other.facetSharedBy)), t === "histogram" && (l.groupingDirection = i.other.groupingDirection, l.groupingStack = i.other.groupingStack), l;
43
+ return (t === "discrete" || t === "scatterplot" || t === "heatmap") && (s.orientation = i.other.reverse ? "horizontal" : "vertical", s.facetSettings.sharedX = ["x", "xy"].includes(i.other.facetSharedBy), s.facetSettings.sharedY = ["y", "xy"].includes(i.other.facetSharedBy)), t === "histogram" && (s.groupingDirection = i.other.groupingDirection, s.groupingStack = i.other.groupingStack), s;
44
44
  }
45
45
  export {
46
- H as getAxesDataFromForms,
47
- E as getAxesDataFromFormsScatterplot,
48
- O as getDiscreteLabelsRotation
46
+ B as getAxesDataFromForms,
47
+ R as getAxesDataFromFormsScatterplot,
48
+ G as getDiscreteLabelsRotation
49
49
  };
50
50
  //# sourceMappingURL=getAxesDataFromForms.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getAxesDataFromForms.js","sources":["../../../src/utils/createChartSettingsForRender/getAxesDataFromForms.ts"],"sourcesContent":["import type { AxesState } from '../../constantsCommon';\nimport type { ChartType, InputGuide, InputState } from '@milaboratories/pf-plots';\nimport type { LabelsRotation, ReactiveState, UniqueValuesBySourceMap, UniqueValuesData } from '../../types';\nimport type { AxisSettingsContinuous } from '@milaboratories/miplots4';\nimport type { AxisSettingsDiscrete } from '@milaboratories/miplots4';\nimport type { HeatmapSettings } from '@milaboratories/miplots4';\n\ntype AxesSettings = {\n xAxis: AxisSettingsDiscrete | AxisSettingsContinuous | HeatmapSettings['xAxis'];\n yAxis: AxisSettingsDiscrete | AxisSettingsContinuous | HeatmapSettings['yAxis'];\n frame: { type: string };\n orientation?: string;\n title?: Record<string, string>;\n facetSettings: {\n nCols: number;\n sharedX?: boolean;\n sharedY?: boolean;\n };\n groupingDirection?: AxesState['other']['groupingDirection'];\n groupingStack?: AxesState['other']['groupingStack'];\n};\n\nconst HORIZONTAL_CAPTURES_MAX_COUNT = 6;\nconst SHORT_LABEL_MAX_LENGTH = 5;\n\nexport function getDiscreteLabelsRotation(value: LabelsRotation | null, discreteGroups: UniqueValuesData['options'] = []) {\n if (value !== null) {\n return value;\n }\n if (\n discreteGroups.length > HORIZONTAL_CAPTURES_MAX_COUNT\n && discreteGroups.some(({ label }) => label.length > SHORT_LABEL_MAX_LENGTH)\n ) {\n return '45deg';\n }\n return 'center';\n}\n\nexport function getAxesDataFromFormsScatterplot(\n axesFormsData: AxesState,\n uniqueValues: UniqueValuesBySourceMap,\n optionsState: ReactiveState['optionsState'],\n inputGuide: InputGuide<InputState>,\n): AxesSettings {\n let xAxis: AxisSettingsContinuous | AxisSettingsDiscrete = {};\n let yAxis: AxisSettingsContinuous | AxisSettingsDiscrete = {};\n xAxis.showGrid = axesFormsData.axisX.gridlines;\n xAxis.showTicks = axesFormsData.axisX.ticks;\n yAxis.showGrid = axesFormsData.axisY.gridlines;\n yAxis.showTicks = axesFormsData.axisY.ticks;\n\n const xSource = optionsState.components.x.selectorStates?.[0].selectedSource ?? null;\n const ySource = optionsState.components.y.selectorStates?.[0].selectedSource ?? null;\n const infoX = xSource ? inputGuide.getSourceInfo(xSource) : null;\n const infoY = ySource ? inputGuide.getSourceInfo(ySource) : null;\n\n const isDiscreteX = infoX?.type === 'String';\n const isDiscreteY = infoY?.type === 'String';\n\n if (isDiscreteX) {\n xAxis = xAxis as AxisSettingsDiscrete;\n xAxis.scale = 'discrete';\n xAxis.labelsPosition = axesFormsData.axisX.labelsRotation ?? 'center';\n\n const saved = axesFormsData.axisX.order?.source === xSource;\n const uniqueList = uniqueValues[xSource]?.list;\n const uniqueLabels = uniqueValues[xSource]?.labels;\n const keys = saved ? axesFormsData.axisX.order?.options.map((v) => v.value) ?? uniqueList : uniqueList;\n const labels = saved\n ? axesFormsData.axisX.order?.options.reduce((res, v) => {\n res[v.value] = v.label;\n return res;\n }, {} as Record<string, string>) ?? uniqueLabels\n : uniqueLabels;\n if (keys && labels) {\n xAxis.keys = keys;\n xAxis.labels = labels;\n };\n } else {\n xAxis = xAxis as AxisSettingsContinuous;\n xAxis.scale = axesFormsData.axisX.scale;\n xAxis.significantLinesStyle = axesFormsData.axisX.significantLinesStyle;\n }\n\n if (isDiscreteY) {\n yAxis = yAxis as AxisSettingsDiscrete;\n yAxis.scale = 'discrete';\n yAxis.labelsPosition = axesFormsData.axisY.labelsRotation ?? 'center';\n\n const uniqueList = uniqueValues[ySource]?.list;\n const uniqueLabels = uniqueValues[ySource]?.labels;\n const saved = axesFormsData.axisY.order?.source === ySource;\n const keys = saved ? axesFormsData.axisY.order?.options.map((v) => v.value) ?? uniqueList : uniqueList;\n const labels = saved\n ? axesFormsData.axisY.order?.options.reduce((res, v) => {\n res[v.value] = v.label;\n return res;\n }, {} as Record<string, string>) ?? uniqueLabels\n : uniqueLabels;\n if (keys && labels) {\n yAxis.keys = keys;\n yAxis.labels = labels;\n };\n } else {\n yAxis = yAxis as AxisSettingsContinuous;\n yAxis.scale = axesFormsData.axisY.scale;\n yAxis.significantLinesStyle = axesFormsData.axisY.significantLinesStyle;\n }\n\n if (axesFormsData.axisY.titleMode !== 'auto') {\n yAxis.title = axesFormsData.axisY.titleMode === 'custom' ? axesFormsData.axisY.customTitle : '';\n }\n if (axesFormsData.axisX.titleMode !== 'auto') {\n xAxis.title = axesFormsData.axisX.titleMode === 'custom' ? axesFormsData.axisX.customTitle : '';\n }\n\n (xAxis as AxisSettingsContinuous).hiddenLabels = axesFormsData.axisX.hideAxisLabels;\n (yAxis as AxisSettingsContinuous).hiddenLabels = axesFormsData.axisY.hideAxisLabels;\n\n const result: AxesSettings = {\n xAxis,\n yAxis,\n frame: { type: axesFormsData.other.frame },\n facetSettings: {\n nCols: axesFormsData.other.facetColumns,\n },\n };\n result.facetSettings.sharedX = (['x', 'xy']).includes(axesFormsData.other.facetSharedBy);\n result.facetSettings.sharedY = (['y', 'xy']).includes(axesFormsData.other.facetSharedBy);\n\n return result;\n}\n\nexport function getAxesDataFromForms(axesFormsData: AxesState, chartType: ChartType, discreteGroups: UniqueValuesData['options'] = []): AxesSettings {\n const xAxis: AxesSettings['xAxis'] = {};\n const yAxis: AxesSettings['yAxis'] = {};\n if (chartType === 'discrete') {\n (xAxis as AxisSettingsDiscrete).labelsPosition = getDiscreteLabelsRotation(axesFormsData.axisX.labelsRotation, discreteGroups);\n (xAxis as AxisSettingsDiscrete).linesBetweenCategories = axesFormsData.axisX.linesBetweenCategories;\n (yAxis as AxisSettingsContinuous).scale = axesFormsData.axisY.scale;\n (xAxis as AxisSettingsDiscrete).showGrid = axesFormsData.axisX.gridlines;\n (xAxis as AxisSettingsDiscrete).showTicks = axesFormsData.axisX.ticks;\n (xAxis as AxisSettingsDiscrete).hiddenLabels = axesFormsData.axisX.hideAxisLabels;\n (yAxis as AxisSettingsDiscrete).hiddenLabels = axesFormsData.axisY.hideAxisLabels;\n (yAxis as AxisSettingsContinuous).showGrid = axesFormsData.axisY.gridlines;\n (yAxis as AxisSettingsContinuous).showTicks = axesFormsData.axisY.ticks;\n }\n if (chartType === 'histogram') {\n (xAxis as AxisSettingsContinuous).scale = axesFormsData.axisX.scale;\n (yAxis as AxisSettingsContinuous).scale = axesFormsData.axisY.scale;\n (xAxis as AxisSettingsContinuous).hiddenLabels = axesFormsData.axisX.hideAxisLabels;\n (yAxis as AxisSettingsContinuous).hiddenLabels = axesFormsData.axisY.hideAxisLabels;\n (xAxis as AxisSettingsContinuous).showTicks = axesFormsData.axisX.ticks;\n (yAxis as AxisSettingsContinuous).showTicks = axesFormsData.axisY.ticks;\n (xAxis as AxisSettingsContinuous).showGrid = axesFormsData.axisX.gridlines;\n (yAxis as AxisSettingsContinuous).showGrid = axesFormsData.axisY.gridlines;\n }\n if (chartType === 'heatmap' || chartType === 'bubble') {\n (xAxis as HeatmapSettings['xAxis'])!.axisLabelsAngle = axesFormsData.axisX.axisLabelsAngle;\n (xAxis as HeatmapSettings['xAxis'])!.groupLabelsAngle = axesFormsData.axisX.groupLabelsAngle;\n (yAxis as HeatmapSettings['yAxis'])!.axisLabelsAngle = axesFormsData.axisY.axisLabelsAngle;\n (yAxis as HeatmapSettings['yAxis'])!.groupLabelsAngle = axesFormsData.axisY.groupLabelsAngle;\n (xAxis as HeatmapSettings['xAxis'])!.sorting = axesFormsData.axisX.sorting;\n (yAxis as HeatmapSettings['yAxis'])!.sorting = axesFormsData.axisY.sorting;\n (xAxis as HeatmapSettings['xAxis'])!.showAxisLabels = !axesFormsData.axisX.hideAxisLabels;\n (yAxis as HeatmapSettings['yAxis'])!.showAxisLabels = !axesFormsData.axisY.hideAxisLabels;\n (xAxis as HeatmapSettings['xAxis'])!.showGroupLabels = !axesFormsData.axisX.hideAxisGroupLabels;\n (yAxis as HeatmapSettings['yAxis'])!.showGroupLabels = !axesFormsData.axisY.hideAxisGroupLabels;\n (xAxis as HeatmapSettings['xAxis'])!.showTicks = axesFormsData.axisX.ticks;\n (yAxis as HeatmapSettings['yAxis'])!.showTicks = axesFormsData.axisY.ticks;\n }\n if (axesFormsData.axisY.titleMode !== 'auto') {\n yAxis!.title = axesFormsData.axisY.titleMode === 'custom' ? axesFormsData.axisY.customTitle : '';\n }\n if (axesFormsData.axisX.titleMode !== 'auto') {\n xAxis!.title = axesFormsData.axisX.titleMode === 'custom' ? axesFormsData.axisX.customTitle : '';\n }\n\n const result: AxesSettings = {\n xAxis,\n yAxis,\n frame: { type: axesFormsData.other.frame },\n facetSettings: {\n nCols: axesFormsData.other.facetColumns,\n },\n };\n\n if (chartType === 'discrete' || chartType === 'scatterplot' || chartType === 'heatmap') {\n result.orientation = axesFormsData.other.reverse ? 'horizontal' : 'vertical';\n result.facetSettings.sharedX = (['x', 'xy']).includes(axesFormsData.other.facetSharedBy);\n result.facetSettings.sharedY = (['y', 'xy']).includes(axesFormsData.other.facetSharedBy);\n }\n if (chartType === 'histogram') {\n result.groupingDirection = axesFormsData.other.groupingDirection;\n result.groupingStack = axesFormsData.other.groupingStack;\n }\n return result;\n}\n"],"names":["getDiscreteLabelsRotation","value","discreteGroups","label","getAxesDataFromFormsScatterplot","axesFormsData","uniqueValues","optionsState","inputGuide","_a","_b","_c","_d","_e","_f","_g","_h","_i","_j","_k","_l","xAxis","yAxis","xSource","ySource","infoX","infoY","isDiscreteX","isDiscreteY","saved","uniqueList","uniqueLabels","keys","v","labels","res","result","getAxesDataFromForms","chartType"],"mappings":"AAyBO,SAASA,EAA0BC,GAA8BC,IAA8C,IAAI;AACxH,SAAID,MAAU,OACLA,IAGPC,EAAe,SAAS,KACrBA,EAAe,KAAK,CAAC,EAAE,OAAAC,QAAYA,EAAM,SAAS,CAAsB,IAEpE,UAEF;AACT;AAEO,SAASC,EACdC,GACAC,GACAC,GACAC,GACc;AArBhB,MAAA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C,UAAUhB,EAAc,MAAM,SAClEiB,EAAoC,UAAUjB,EAAc,MAAM,SAClEgB,EAAoC,iBAAiB,CAAChB,EAAc,MAAM,gBAC1EiB,EAAoC,iBAAiB,CAACjB,EAAc,MAAM,gBAC1EgB,EAAoC,kBAAkB,CAAChB,EAAc,MAAM,qBAC3EiB,EAAoC,kBAAkB,CAACjB,EAAc,MAAM,qBAC3EgB,EAAoC,YAAYhB,EAAc,MAAM,OACpEiB,EAAoC,YAAYjB,EAAc,MAAM,QAEnEA,EAAc,MAAM,cAAc,WACpCiB,EAAO,QAAQjB,EAAc,MAAM,cAAc,WAAWA,EAAc,MAAM,cAAc,KAE5FA,EAAc,MAAM,cAAc,WACpCgB,EAAO,QAAQhB,EAAc,MAAM,cAAc,WAAWA,EAAc,MAAM,cAAc;AAGhG,QAAM+B,IAAuB;AAAA,IAC3B,OAAAf;AAAA,IACA,OAAAC;AAAA,IACA,OAAO,EAAE,MAAMjB,EAAc,MAAM,MAAA;AAAA,IACnC,eAAe;AAAA,MACb,OAAOA,EAAc,MAAM;AAAA,IAAA;AAAA,EAC7B;AAGF,UAAIiC,MAAc,cAAcA,MAAc,iBAAiBA,MAAc,eAC3EF,EAAO,cAAc/B,EAAc,MAAM,UAAU,eAAe,YAClE+B,EAAO,cAAc,UAAW,CAAC,KAAK,IAAI,EAAG,SAAS/B,EAAc,MAAM,aAAa,GACvF+B,EAAO,cAAc,UAAW,CAAC,KAAK,IAAI,EAAG,SAAS/B,EAAc,MAAM,aAAa,IAErFiC,MAAc,gBAChBF,EAAO,oBAAoB/B,EAAc,MAAM,mBAC/C+B,EAAO,gBAAgB/B,EAAc,MAAM,gBAEtC+B;AACT;"}
1
+ {"version":3,"file":"getAxesDataFromForms.js","sources":["../../../src/utils/createChartSettingsForRender/getAxesDataFromForms.ts"],"sourcesContent":["import type { AxesState } from '../../constantsCommon';\nimport type { ChartType, InputGuide, InputState } from '@milaboratories/pf-plots';\nimport type { LabelsRotation, ReactiveState, UniqueValuesBySourceMap, UniqueValuesData } from '../../types';\nimport type { AxisSettingsContinuous } from '@milaboratories/miplots4';\nimport type { AxisSettingsDiscrete } from '@milaboratories/miplots4';\nimport type { HeatmapSettings } from '@milaboratories/miplots4';\n\ntype AxesSettings = {\n xAxis: AxisSettingsDiscrete | AxisSettingsContinuous | HeatmapSettings['xAxis'];\n yAxis: AxisSettingsDiscrete | AxisSettingsContinuous | HeatmapSettings['yAxis'];\n frame: { type: string };\n orientation?: string;\n title?: Record<string, string>;\n facetSettings: {\n nCols: number;\n sharedX?: boolean;\n sharedY?: boolean;\n };\n groupingDirection?: AxesState['other']['groupingDirection'];\n groupingStack?: AxesState['other']['groupingStack'];\n};\n\nconst HORIZONTAL_CAPTURES_MAX_COUNT = 6;\nconst SHORT_LABEL_MAX_LENGTH = 5;\n\nexport function getDiscreteLabelsRotation(value: LabelsRotation | null, discreteGroups: UniqueValuesData['options'] = []) {\n if (value !== null) {\n return value;\n }\n if (\n discreteGroups.length > HORIZONTAL_CAPTURES_MAX_COUNT\n && discreteGroups.some(({ label }) => label.length > SHORT_LABEL_MAX_LENGTH)\n ) {\n return '45deg';\n }\n return 'center';\n}\n\nexport function getAxesDataFromFormsScatterplot(\n axesFormsData: AxesState,\n uniqueValues: UniqueValuesBySourceMap,\n optionsState: ReactiveState['optionsState'],\n inputGuide: InputGuide<InputState>,\n): AxesSettings {\n let xAxis: AxisSettingsContinuous | AxisSettingsDiscrete = {};\n let yAxis: AxisSettingsContinuous | AxisSettingsDiscrete = {};\n xAxis.showGrid = axesFormsData.axisX.gridlines;\n xAxis.showTicks = axesFormsData.axisX.ticks;\n yAxis.showGrid = axesFormsData.axisY.gridlines;\n yAxis.showTicks = axesFormsData.axisY.ticks;\n\n const xSource = optionsState.components.x.selectorStates?.[0].selectedSource ?? null;\n const ySource = optionsState.components.y.selectorStates?.[0].selectedSource ?? null;\n const infoX = xSource ? inputGuide.getSourceInfo(xSource) : null;\n const infoY = ySource ? inputGuide.getSourceInfo(ySource) : null;\n\n const isDiscreteX = infoX?.type === 'String';\n const isDiscreteY = infoY?.type === 'String';\n\n if (isDiscreteX) {\n xAxis = xAxis as AxisSettingsDiscrete;\n xAxis.scale = 'discrete';\n xAxis.labelsPosition = axesFormsData.axisX.labelsRotation ?? 'center';\n\n const saved = axesFormsData.axisX.order?.source === xSource;\n const xEntry = uniqueValues[xSource];\n const uniqueList = xEntry?.list;\n const uniqueLabels = xEntry?.labels;\n const keys = saved ? axesFormsData.axisX.order?.options.map((v) => v.value) ?? uniqueList : uniqueList;\n const labels = saved\n ? axesFormsData.axisX.order?.options.reduce((res, v) => {\n res[v.value] = v.label;\n return res;\n }, {} as Record<string, string>) ?? uniqueLabels\n : uniqueLabels;\n if (keys && labels) {\n xAxis.keys = keys;\n xAxis.labels = labels;\n };\n } else {\n xAxis = xAxis as AxisSettingsContinuous;\n xAxis.scale = axesFormsData.axisX.scale;\n xAxis.significantLinesStyle = axesFormsData.axisX.significantLinesStyle;\n }\n\n if (isDiscreteY) {\n yAxis = yAxis as AxisSettingsDiscrete;\n yAxis.scale = 'discrete';\n yAxis.labelsPosition = axesFormsData.axisY.labelsRotation ?? 'center';\n\n const yEntry = uniqueValues[ySource];\n const uniqueList = yEntry?.list;\n const uniqueLabels = yEntry?.labels;\n const saved = axesFormsData.axisY.order?.source === ySource;\n const keys = saved ? axesFormsData.axisY.order?.options.map((v) => v.value) ?? uniqueList : uniqueList;\n const labels = saved\n ? axesFormsData.axisY.order?.options.reduce((res, v) => {\n res[v.value] = v.label;\n return res;\n }, {} as Record<string, string>) ?? uniqueLabels\n : uniqueLabels;\n if (keys && labels) {\n yAxis.keys = keys;\n yAxis.labels = labels;\n };\n } else {\n yAxis = yAxis as AxisSettingsContinuous;\n yAxis.scale = axesFormsData.axisY.scale;\n yAxis.significantLinesStyle = axesFormsData.axisY.significantLinesStyle;\n }\n\n if (axesFormsData.axisY.titleMode !== 'auto') {\n yAxis.title = axesFormsData.axisY.titleMode === 'custom' ? axesFormsData.axisY.customTitle : '';\n }\n if (axesFormsData.axisX.titleMode !== 'auto') {\n xAxis.title = axesFormsData.axisX.titleMode === 'custom' ? axesFormsData.axisX.customTitle : '';\n }\n\n (xAxis as AxisSettingsContinuous).hiddenLabels = axesFormsData.axisX.hideAxisLabels;\n (yAxis as AxisSettingsContinuous).hiddenLabels = axesFormsData.axisY.hideAxisLabels;\n\n const result: AxesSettings = {\n xAxis,\n yAxis,\n frame: { type: axesFormsData.other.frame },\n facetSettings: {\n nCols: axesFormsData.other.facetColumns,\n },\n };\n result.facetSettings.sharedX = (['x', 'xy']).includes(axesFormsData.other.facetSharedBy);\n result.facetSettings.sharedY = (['y', 'xy']).includes(axesFormsData.other.facetSharedBy);\n\n return result;\n}\n\nexport function getAxesDataFromForms(axesFormsData: AxesState, chartType: ChartType, discreteGroups: UniqueValuesData['options'] = []): AxesSettings {\n const xAxis: AxesSettings['xAxis'] = {};\n const yAxis: AxesSettings['yAxis'] = {};\n if (chartType === 'discrete') {\n (xAxis as AxisSettingsDiscrete).labelsPosition = getDiscreteLabelsRotation(axesFormsData.axisX.labelsRotation, discreteGroups);\n (xAxis as AxisSettingsDiscrete).linesBetweenCategories = axesFormsData.axisX.linesBetweenCategories;\n (yAxis as AxisSettingsContinuous).scale = axesFormsData.axisY.scale;\n (xAxis as AxisSettingsDiscrete).showGrid = axesFormsData.axisX.gridlines;\n (xAxis as AxisSettingsDiscrete).showTicks = axesFormsData.axisX.ticks;\n (xAxis as AxisSettingsDiscrete).hiddenLabels = axesFormsData.axisX.hideAxisLabels;\n (yAxis as AxisSettingsDiscrete).hiddenLabels = axesFormsData.axisY.hideAxisLabels;\n (yAxis as AxisSettingsContinuous).showGrid = axesFormsData.axisY.gridlines;\n (yAxis as AxisSettingsContinuous).showTicks = axesFormsData.axisY.ticks;\n }\n if (chartType === 'histogram') {\n (xAxis as AxisSettingsContinuous).scale = axesFormsData.axisX.scale;\n (yAxis as AxisSettingsContinuous).scale = axesFormsData.axisY.scale;\n (xAxis as AxisSettingsContinuous).hiddenLabels = axesFormsData.axisX.hideAxisLabels;\n (yAxis as AxisSettingsContinuous).hiddenLabels = axesFormsData.axisY.hideAxisLabels;\n (xAxis as AxisSettingsContinuous).showTicks = axesFormsData.axisX.ticks;\n (yAxis as AxisSettingsContinuous).showTicks = axesFormsData.axisY.ticks;\n (xAxis as AxisSettingsContinuous).showGrid = axesFormsData.axisX.gridlines;\n (yAxis as AxisSettingsContinuous).showGrid = axesFormsData.axisY.gridlines;\n }\n if (chartType === 'heatmap' || chartType === 'bubble') {\n (xAxis as HeatmapSettings['xAxis'])!.axisLabelsAngle = axesFormsData.axisX.axisLabelsAngle;\n (xAxis as HeatmapSettings['xAxis'])!.groupLabelsAngle = axesFormsData.axisX.groupLabelsAngle;\n (yAxis as HeatmapSettings['yAxis'])!.axisLabelsAngle = axesFormsData.axisY.axisLabelsAngle;\n (yAxis as HeatmapSettings['yAxis'])!.groupLabelsAngle = axesFormsData.axisY.groupLabelsAngle;\n (xAxis as HeatmapSettings['xAxis'])!.sorting = axesFormsData.axisX.sorting;\n (yAxis as HeatmapSettings['yAxis'])!.sorting = axesFormsData.axisY.sorting;\n (xAxis as HeatmapSettings['xAxis'])!.showAxisLabels = !axesFormsData.axisX.hideAxisLabels;\n (yAxis as HeatmapSettings['yAxis'])!.showAxisLabels = !axesFormsData.axisY.hideAxisLabels;\n (xAxis as HeatmapSettings['xAxis'])!.showGroupLabels = !axesFormsData.axisX.hideAxisGroupLabels;\n (yAxis as HeatmapSettings['yAxis'])!.showGroupLabels = !axesFormsData.axisY.hideAxisGroupLabels;\n (xAxis as HeatmapSettings['xAxis'])!.showTicks = axesFormsData.axisX.ticks;\n (yAxis as HeatmapSettings['yAxis'])!.showTicks = axesFormsData.axisY.ticks;\n }\n if (axesFormsData.axisY.titleMode !== 'auto') {\n yAxis!.title = axesFormsData.axisY.titleMode === 'custom' ? axesFormsData.axisY.customTitle : '';\n }\n if (axesFormsData.axisX.titleMode !== 'auto') {\n xAxis!.title = axesFormsData.axisX.titleMode === 'custom' ? axesFormsData.axisX.customTitle : '';\n }\n\n const result: AxesSettings = {\n xAxis,\n yAxis,\n frame: { type: axesFormsData.other.frame },\n facetSettings: {\n nCols: axesFormsData.other.facetColumns,\n },\n };\n\n if (chartType === 'discrete' || chartType === 'scatterplot' || chartType === 'heatmap') {\n result.orientation = axesFormsData.other.reverse ? 'horizontal' : 'vertical';\n result.facetSettings.sharedX = (['x', 'xy']).includes(axesFormsData.other.facetSharedBy);\n result.facetSettings.sharedY = (['y', 'xy']).includes(axesFormsData.other.facetSharedBy);\n }\n if (chartType === 'histogram') {\n result.groupingDirection = axesFormsData.other.groupingDirection;\n result.groupingStack = axesFormsData.other.groupingStack;\n }\n return result;\n}\n"],"names":["getDiscreteLabelsRotation","value","discreteGroups","label","getAxesDataFromFormsScatterplot","axesFormsData","uniqueValues","optionsState","inputGuide","_a","_b","_c","_d","_e","_f","_g","_h","xAxis","yAxis","xSource","ySource","infoX","infoY","isDiscreteX","isDiscreteY","saved","xEntry","uniqueList","uniqueLabels","keys","v","labels","res","yEntry","result","getAxesDataFromForms","chartType"],"mappings":"AAyBO,SAASA,EAA0BC,GAA8BC,IAA8C,IAAI;AACxH,SAAID,MAAU,OACLA,IAGPC,EAAe,SAAS,KACrBA,EAAe,KAAK,CAAC,EAAE,OAAAC,QAAYA,EAAM,SAAS,CAAsB,IAEpE,UAEF;AACT;AAEO,SAASC,EACdC,GACAC,GACAC,GACAC,GACc;AArBhB,MAAAC,GAAAC,GAAAC,GAAAC,GAAAC,GAAAC,GAAAC,GAAAC;AAsBE,MAAIC,IAAuD,CAAA,GACvDC,IAAuD,CAAA;AAC3D,EAAAD,EAAM,WAAWZ,EAAc,MAAM,WACrCY,EAAM,YAAYZ,EAAc,MAAM,OACtCa,EAAM,WAAWb,EAAc,MAAM,WACrCa,EAAM,YAAYb,EAAc,MAAM;AAEtC,QAAMc,MAAUV,IAAAF,EAAa,WAAW,EAAE,mBAA1B,gBAAAE,EAA2C,G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cAAc,WACpCY,EAAO,QAAQZ,EAAc,MAAM,cAAc,WAAWA,EAAc,MAAM,cAAc;AAGhG,QAAM6B,IAAuB;AAAA,IAC3B,OAAAjB;AAAA,IACA,OAAAC;AAAA,IACA,OAAO,EAAE,MAAMb,EAAc,MAAM,MAAA;AAAA,IACnC,eAAe;AAAA,MACb,OAAOA,EAAc,MAAM;AAAA,IAAA;AAAA,EAC7B;AAGF,UAAI+B,MAAc,cAAcA,MAAc,iBAAiBA,MAAc,eAC3EF,EAAO,cAAc7B,EAAc,MAAM,UAAU,eAAe,YAClE6B,EAAO,cAAc,UAAW,CAAC,KAAK,IAAI,EAAG,SAAS7B,EAAc,MAAM,aAAa,GACvF6B,EAAO,cAAc,UAAW,CAAC,KAAK,IAAI,EAAG,SAAS7B,EAAc,MAAM,aAAa,IAErF+B,MAAc,gBAChBF,EAAO,oBAAoB7B,EAAc,MAAM,mBAC/C6B,EAAO,gBAAgB7B,EAAc,MAAM,gBAEtC6B;AACT;"}
@@ -1,8 +1,10 @@
1
1
  import { FilterLabelsInfoBySourceMap, FilterSuggestionsBySourceMap, UniqueValuesBySourceMap } from '../types';
2
2
  import { Controller, DemoDataStore, InputGuide, InputState, PlotDataAndSettings } from '@milaboratories/pf-plots';
3
- export declare function getUniqueValuesFromReadyChartData(chartData: PlotDataAndSettings, inputGuide: InputGuide<InputState>, optionsState: InputState['components'], controller: Controller<InputState>, dataStore: DemoDataStore, previousFilterSuggestions: FilterSuggestionsBySourceMap): Promise<{
3
+ export declare function getUniqueValuesFromReadyChartData(chartData: PlotDataAndSettings, inputGuide: InputGuide<InputState>, optionsState: InputState['components'], controller: Controller<InputState>, dataStore: DemoDataStore, previousFilterSuggestions: FilterSuggestionsBySourceMap, maxGroupCount?: number): Promise<{
4
4
  uniqueValues: UniqueValuesBySourceMap;
5
5
  filterSuggestions: FilterSuggestionsBySourceMap;
6
6
  }>;
7
+ /** Build facet values map from facetBy columns in chart data, limited by maxFacetsCount (same shape as unique values). */
8
+ export declare function getFacetValuesFromReadyChartData(chartData: PlotDataAndSettings, optionsState: InputState['components'], maxSavedFacetsCount?: number): UniqueValuesBySourceMap;
7
9
  export declare function loadFilterLabelsForTitle(optionsState: InputState['components'], inputGuide: InputGuide<InputState>, controller: Controller<InputState>, dataStore: DemoDataStore): Promise<FilterLabelsInfoBySourceMap>;
8
10
  //# sourceMappingURL=loadUniqueValuesToSave.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"loadUniqueValuesToSave.d.ts","sourceRoot":"","sources":["../../src/utils/loadUniqueValuesToSave.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,4BAA4B,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AACnH,OAAO,KAAK,EAEV,UAAU,EACV,aAAa,EACb,UAAU,EACV,UAAU,EACV,mBAAmB,EAEpB,MAAM,0BAA0B,CAAC;AA+ClC,wBAAsB,iCAAiC,CACrD,SAAS,EAAE,mBAAmB,EAC9B,UAAU,EAAE,UAAU,CAAC,UAAU,CAAC,EAClC,YAAY,EAAE,UAAU,CAAC,YAAY,CAAC,EACtC,UAAU,EAAE,UAAU,CAAC,UAAU,CAAC,EAClC,SAAS,EAAE,aAAa,EACxB,yBAAyB,EAAE,4BAA4B,GACtD,OAAO,CAAC;IAAE,YAAY,EAAE,uBAAuB,CAAC;IAAC,iBAAiB,EAAE,4BAA4B,CAAA;CAAE,CAAC,CAgFrG;AAED,wBAAsB,wBAAwB,CAC5C,YAAY,EAAE,UAAU,CAAC,YAAY,CAAC,EACtC,UAAU,EAAE,UAAU,CAAC,UAAU,CAAC,EAClC,UAAU,EAAE,UAAU,CAAC,UAAU,CAAC,EAClC,SAAS,EAAE,aAAa,GACvB,OAAO,CAAC,2BAA2B,CAAC,CA4BtC"}
1
+ {"version":3,"file":"loadUniqueValuesToSave.d.ts","sourceRoot":"","sources":["../../src/utils/loadUniqueValuesToSave.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,4BAA4B,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AACnH,OAAO,KAAK,EAEV,UAAU,EACV,aAAa,EACb,UAAU,EACV,UAAU,EACV,mBAAmB,EAEpB,MAAM,0BAA0B,CAAC;AAyDlC,wBAAsB,iCAAiC,CACrD,SAAS,EAAE,mBAAmB,EAC9B,UAAU,EAAE,UAAU,CAAC,UAAU,CAAC,EAClC,YAAY,EAAE,UAAU,CAAC,YAAY,CAAC,EACtC,UAAU,EAAE,UAAU,CAAC,UAAU,CAAC,EAClC,SAAS,EAAE,aAAa,EACxB,yBAAyB,EAAE,4BAA4B,EACvD,aAAa,SAAmB,GAC/B,OAAO,CAAC;IAAE,YAAY,EAAE,uBAAuB,CAAC;IAAC,iBAAiB,EAAE,4BAA4B,CAAA;CAAE,CAAC,CAgFrG;AAED,0HAA0H;AAC1H,wBAAgB,gCAAgC,CAC9C,SAAS,EAAE,mBAAmB,EAC9B,YAAY,EAAE,UAAU,CAAC,YAAY,CAAC,EACtC,mBAAmB,SAAO,GACzB,uBAAuB,CAazB;AAED,wBAAsB,wBAAwB,CAC5C,YAAY,EAAE,UAAU,CAAC,YAAY,CAAC,EACtC,UAAU,EAAE,UAAU,CAAC,UAAU,CAAC,EAClC,UAAU,EAAE,UAAU,CAAC,UAAU,CAAC,EAClC,SAAS,EAAE,aAAa,GACvB,OAAO,CAAC,2BAA2B,CAAC,CA4BtC"}
@@ -1,85 +1,103 @@
1
- const g = ["primaryGrouping", "secondaryGrouping"], E = ["grouping", "dotShape"], A = ["x", "y"], p = ["grouping"], T = [
1
+ import { MAX_GROUPS_COUNT as E } from "../constantsCommon.js";
2
+ const y = ["primaryGrouping", "secondaryGrouping"], A = ["grouping", "dotShape"], p = ["x", "y"], R = ["grouping"], b = [
2
3
  "nodeColor",
3
4
  "nodeShape",
4
5
  "lineColor",
5
6
  "heatmapAnnotation"
6
7
  // dendro
7
- ], I = ["filters", "highlight", "tabBy"], v = (t) => t.sort((u, c) => u.label.localeCompare(c.label, "en", { numeric: !0 }));
8
- function _(t, u, c, r) {
9
- const a = t.data.byColumns.values[c], f = r ? t.data.byColumns.values[r] : null, l = /* @__PURE__ */ new Set(), n = [];
10
- for (let o = 0; o < a.length; o++) {
11
- const s = String(a[o]);
12
- if (l.has(s))
8
+ ], d = ["filters", "highlight", "tabBy"], v = (t) => t.sort((u, r) => u.label.localeCompare(r.label, "en", { numeric: !0 })), T = 100;
9
+ function _(t, u, r, f, c) {
10
+ const S = t.data.byColumns.values[r], n = c ? t.data.byColumns.values[c] : null, o = /* @__PURE__ */ new Set(), l = [];
11
+ for (let i = 0; i < S.length; i++) {
12
+ const e = String(S[i]);
13
+ if (o.has(e))
13
14
  continue;
14
- if (l.size === 100) {
15
- u[c] = null;
15
+ if (o.size === f) {
16
+ v(l), u[r] = {
17
+ list: l.map((a) => a.value),
18
+ labels: l.reduce((a, g) => (a[g.value] = g.label, a), {}),
19
+ options: l,
20
+ overflow: l.length > T
21
+ };
16
22
  return;
17
23
  }
18
- l.add(s);
19
- const e = f ? String(f[o]) : s;
20
- n.push({ value: s, label: e });
24
+ o.add(e);
25
+ const s = n ? String(n[i]) : e;
26
+ l.push({ value: e, label: s });
21
27
  }
22
- v(n), u[c] = {
23
- list: n.map((o) => o.value),
24
- labels: n.reduce((o, s) => (o[s.value] = s.label, o), {}),
25
- options: n
28
+ v(l), u[r] = {
29
+ list: l.map((i) => i.value),
30
+ labels: l.reduce((i, e) => (i[e.value] = e.label, i), {}),
31
+ options: l,
32
+ overflow: l.length > T
26
33
  };
27
34
  }
28
- async function y(t, u, c, r, a, f) {
29
- const l = {};
30
- t.settings.type === "discrete" && g.forEach((s) => {
31
- const e = t.settings[s];
32
- if (e) {
33
- const { columnName: i } = e;
34
- _(t, l, i.value, i.valueLabels);
35
+ async function h(t, u, r, f, c, S, n = E) {
36
+ const o = {};
37
+ t.settings.type === "discrete" && y.forEach((e) => {
38
+ const s = t.settings[e];
39
+ if (s) {
40
+ const { columnName: a } = s;
41
+ _(t, o, a.value, n, a.valueLabels);
35
42
  }
36
- }), (t.settings.type === "scatterplot" || t.settings.type === "scatterplot-umap") && (A.forEach((s) => {
37
- const e = t.settings[s];
38
- e && u.getSourceInfo(e.value).type === "String" && _(t, l, e.value, e.valueLabels);
39
- }), E.forEach((s) => {
40
- const e = t.settings[s];
41
- e == null || e.forEach(({ columnName: i }) => {
42
- const S = u.getSourceInfo(i.value).type;
43
- (S === "String" || S === "Int" || S === "Long") && _(t, l, i.value, i.valueLabels);
43
+ }), (t.settings.type === "scatterplot" || t.settings.type === "scatterplot-umap") && (p.forEach((e) => {
44
+ const s = t.settings[e];
45
+ s && u.getSourceInfo(s.value).type === "String" && _(t, o, s.value, n, s.valueLabels);
46
+ }), A.forEach((e) => {
47
+ const s = t.settings[e];
48
+ s == null || s.forEach(({ columnName: a }) => {
49
+ const g = u.getSourceInfo(a.value).type;
50
+ (g === "String" || g === "Int" || g === "Long") && _(t, o, a.value, n, a.valueLabels);
44
51
  });
45
- })), t.settings.type === "histogram" && p.forEach((s) => {
46
- const e = t.settings[s];
47
- e && _(t, l, e.value, e.valueLabels);
48
- }), t.settings.type === "dendro" && T.forEach((s) => {
49
- const e = t.settings[s];
50
- e && _(t, l, e.value, e.valueLabels);
52
+ })), t.settings.type === "histogram" && R.forEach((e) => {
53
+ const s = t.settings[e];
54
+ s && _(t, o, s.value, n, s.valueLabels);
55
+ }), t.settings.type === "dendro" && b.forEach((e) => {
56
+ const s = t.settings[e];
57
+ s && _(t, o, s.value, n, s.valueLabels);
51
58
  });
52
- const n = { ...f }, o = [];
53
- [...u.fullOptionsSet].forEach((s) => {
54
- const e = u.getSourceInfo(s);
55
- e.kind === "axis" && e.isNonHomogenous && o.push(s);
56
- }), I.forEach((s) => {
57
- const e = c[s];
58
- if (e)
59
- for (const { selectedSource: i, type: S } of e.selectorStates)
60
- ((s === "filters" || s === "highlight") && S === "equals" || s === "tabBy") && o.push(i);
59
+ const l = { ...S }, i = [];
60
+ [...u.fullOptionsSet].forEach((e) => {
61
+ const s = u.getSourceInfo(e);
62
+ s.kind === "axis" && s.isNonHomogenous && i.push(e);
63
+ }), d.forEach((e) => {
64
+ const s = r[e];
65
+ if (s)
66
+ for (const { selectedSource: a, type: g } of s.selectorStates)
67
+ ((e === "filters" || e === "highlight") && g === "equals" || e === "tabBy") && i.push(a);
61
68
  });
62
- for (const s of o)
63
- n[s] || a && (n[s] = await r.getUniqueSourceValuesWithLabels(a, u, s, 100));
64
- return { uniqueValues: l, filterSuggestions: n };
69
+ for (const e of i)
70
+ l[e] || c && (l[e] = await f.getUniqueSourceValuesWithLabels(c, u, e, n));
71
+ return { uniqueValues: o, filterSuggestions: l };
65
72
  }
66
- async function L(t, u, c, r) {
67
- const a = [];
68
- ["filters", "tabBy"].forEach((n) => {
69
- const o = t[n];
70
- if (o)
71
- for (const { selectedSource: s, selectedFilterValues: e, type: i } of o.selectorStates)
72
- n === "filters" && i === "equals" && e ? a.push([s, e]) : e && a.push([s, e]);
73
+ function L(t, u, r = 1e3) {
74
+ var n;
75
+ const f = {}, c = u == null ? void 0 : u.facetBy;
76
+ if (!((n = c == null ? void 0 : c.selectorStates) != null && n.length))
77
+ return f;
78
+ const S = t.data.byColumns.values;
79
+ return c.selectorStates.forEach(({ selectedSource: o }) => {
80
+ S[o] && _(t, f, o, r);
81
+ }), f;
82
+ }
83
+ async function V(t, u, r, f) {
84
+ const c = [];
85
+ ["filters", "tabBy"].forEach((o) => {
86
+ const l = t[o];
87
+ if (l)
88
+ for (const { selectedSource: i, selectedFilterValues: e, type: s } of l.selectorStates)
89
+ o === "filters" && s === "equals" && e ? c.push([i, e]) : e && c.push([i, e]);
73
90
  });
74
- const l = {};
75
- for (const [n, o] of a)
76
- (await Promise.all(o.map((e) => c.getUniqueSourceValuesWithLabels(r, u, n, 1, void 0, e)))).forEach((e, i) => {
77
- e.values.length > 0 && (l[n] || (l[n] = {}), l[n][o[i]] = e.values[0]);
91
+ const n = {};
92
+ for (const [o, l] of c)
93
+ (await Promise.all(l.map((e) => r.getUniqueSourceValuesWithLabels(f, u, o, 1, void 0, e)))).forEach((e, s) => {
94
+ e.values.length > 0 && (n[o] || (n[o] = {}), n[o][l[s]] = e.values[0]);
78
95
  });
79
- return l;
96
+ return n;
80
97
  }
81
98
  export {
82
- y as getUniqueValuesFromReadyChartData,
83
- L as loadFilterLabelsForTitle
99
+ L as getFacetValuesFromReadyChartData,
100
+ h as getUniqueValuesFromReadyChartData,
101
+ V as loadFilterLabelsForTitle
84
102
  };
85
103
  //# sourceMappingURL=loadUniqueValuesToSave.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"loadUniqueValuesToSave.js","sources":["../../src/utils/loadUniqueValuesToSave.ts"],"sourcesContent":["import type { FilterLabelsInfoBySourceMap, FilterSuggestionsBySourceMap, UniqueValuesBySourceMap } from '../types';\nimport type {\n ComponentStateFilter,\n Controller,\n DemoDataStore,\n InputGuide,\n InputState,\n PlotDataAndSettings,\n SelectorStateFilter,\n} from '@milaboratories/pf-plots';\nimport type { DendroSettings, DiscreteSettings, HistogramSettings, ScatterplotSettings } from '@milaboratories/miplots4';\n\nconst SAVED_UNIQUE_VALUES_LIMIT = 100;\n\nconst SAVED_IN_CHART_DATA_DISCRETE_GROUPINGS = ['primaryGrouping', 'secondaryGrouping'];\nconst SAVED_IN_CHART_DATA_SCATTERPLOT_GROUPINGS = ['grouping', 'dotShape'];\nconst SAVED_IN_CHART_DATA_SCATTERPLOT_XY = ['x', 'y'];\nconst SAVED_IN_CHART_DATA_HISTOGRAM_GROUPING = ['grouping'];\nconst SAVED_IN_CHART_DATA_DENDRO_GROUPING = [\n 'nodeColor', 'nodeShape', 'lineColor', 'heatmapAnnotation', // dendro\n];\n\nconst FILTER_INPUTS = ['filters', 'highlight', 'tabBy'] as ((keyof InputState['components'])[]);\n\nconst sortValues = (values: { value: string; label: string }[]) => values.sort((a, b) => a.label.localeCompare(b.label, 'en', { numeric: true }));\n\nfunction addUniqueData(chartData: PlotDataAndSettings, resultMap: UniqueValuesBySourceMap, sourceId: string, labelId?: string) {\n const data = chartData!.data.byColumns.values[sourceId];\n const dataLabels = labelId ? chartData!.data.byColumns.values[labelId] : null;\n\n const resultSet = new Set();\n const result: { value: string; label: string }[] = [];\n for (let i = 0; i < data.length; i++) {\n const v = String(data[i]);\n if (resultSet.has(v)) {\n continue;\n }\n if (resultSet.size === SAVED_UNIQUE_VALUES_LIMIT) {\n resultMap[sourceId] = null;\n return;\n }\n resultSet.add(v);\n const label = dataLabels ? String(dataLabels[i]) : v;\n result.push({ value: v, label });\n }\n sortValues(result);\n resultMap[sourceId] = {\n list: result.map((el) => el.value),\n labels: result.reduce((res, el) => {\n res[el.value] = el.label;\n return res;\n }, {} as Record<string, string>),\n options: result,\n };\n}\n\nexport async function getUniqueValuesFromReadyChartData(\n chartData: PlotDataAndSettings,\n inputGuide: InputGuide<InputState>,\n optionsState: InputState['components'],\n controller: Controller<InputState>,\n dataStore: DemoDataStore,\n previousFilterSuggestions: FilterSuggestionsBySourceMap,\n): Promise<{ uniqueValues: UniqueValuesBySourceMap; filterSuggestions: FilterSuggestionsBySourceMap }> {\n const resultMap: UniqueValuesBySourceMap = {};\n\n if (chartData.settings.type === 'discrete') {\n SAVED_IN_CHART_DATA_DISCRETE_GROUPINGS.forEach((inputName: string) => {\n const savedData = chartData.settings[inputName] as unknown as DiscreteSettings['primaryGrouping'];\n if (savedData) {\n const { columnName } = savedData;\n addUniqueData(chartData, resultMap, columnName.value, columnName.valueLabels);\n }\n });\n }\n if (chartData.settings.type === 'scatterplot' || chartData.settings.type === 'scatterplot-umap') {\n SAVED_IN_CHART_DATA_SCATTERPLOT_XY.forEach((inputName: string) => {\n const columnName = chartData.settings[inputName] as unknown as ScatterplotSettings['x'];\n if (columnName) {\n const valueType = inputGuide.getSourceInfo(columnName.value).type;\n if (valueType === 'String') {\n addUniqueData(chartData, resultMap, columnName.value, columnName.valueLabels);\n }\n }\n });\n SAVED_IN_CHART_DATA_SCATTERPLOT_GROUPINGS.forEach((inputName: string) => {\n const savedInGrouping = chartData.settings[inputName] as unknown as ScatterplotSettings['grouping'];\n savedInGrouping?.forEach(({ columnName }) => {\n const valueType = inputGuide.getSourceInfo(columnName.value).type;\n if (valueType === 'String' || valueType === 'Int' || valueType === 'Long') {\n addUniqueData(chartData, resultMap, columnName.value, columnName.valueLabels);\n }\n });\n });\n }\n\n if (chartData.settings.type === 'histogram') {\n SAVED_IN_CHART_DATA_HISTOGRAM_GROUPING.forEach((inputName: string) => {\n const savedByInputName = chartData.settings[inputName] as unknown as HistogramSettings['grouping'];\n if (savedByInputName) {\n addUniqueData(chartData, resultMap, savedByInputName.value, savedByInputName.valueLabels);\n }\n });\n }\n\n if (chartData.settings.type === 'dendro') {\n SAVED_IN_CHART_DATA_DENDRO_GROUPING.forEach((inputName: string) => {\n const savedByInputName = chartData.settings[inputName] as unknown as DendroSettings['heatmapAnnotation'];\n if (savedByInputName) {\n addUniqueData(chartData, resultMap, savedByInputName.value, savedByInputName.valueLabels);\n }\n });\n }\n\n const filterSuggestionsMap: FilterSuggestionsBySourceMap = { ...previousFilterSuggestions };\n\n // sources for loading\n const selectedSources: string[] = [];\n ([...inputGuide.fullOptionsSet]).forEach((id) => {\n const info = inputGuide.getSourceInfo(id);\n if (info.kind === 'axis' && info.isNonHomogenous) {\n selectedSources.push(id);\n }\n });\n FILTER_INPUTS.forEach((inputName) => {\n const componentState = optionsState[inputName] as ComponentStateFilter;\n if (!componentState) {\n return;\n }\n for (const { selectedSource, type } of componentState.selectorStates as SelectorStateFilter[]) {\n if (((inputName === 'filters' || inputName === 'highlight') && type === 'equals') || inputName === 'tabBy') {\n selectedSources.push(selectedSource);\n }\n }\n });\n for (const source of selectedSources) {\n if (filterSuggestionsMap[source]) {\n continue;\n } else if (dataStore) {\n filterSuggestionsMap[source] = await controller.getUniqueSourceValuesWithLabels(dataStore, inputGuide, source, SAVED_UNIQUE_VALUES_LIMIT);\n }\n }\n return { uniqueValues: resultMap, filterSuggestions: filterSuggestionsMap };\n}\n\nexport async function loadFilterLabelsForTitle(\n optionsState: InputState['components'],\n inputGuide: InputGuide<InputState>,\n controller: Controller<InputState>,\n dataStore: DemoDataStore,\n): Promise<FilterLabelsInfoBySourceMap> {\n const selected: [string, string[]][] = [];\n const INPUTS_REQUESTING_LABELS = ['filters', 'tabBy'] as ((keyof InputState['components'])[]);\n INPUTS_REQUESTING_LABELS.forEach((inputName) => {\n const componentState = optionsState[inputName];\n if (componentState) {\n for (const { selectedSource, selectedFilterValues, type } of componentState.selectorStates as SelectorStateFilter[]) {\n if (inputName === 'filters' && type === 'equals' && selectedFilterValues) {\n selected.push([selectedSource, selectedFilterValues]);\n } else if (selectedFilterValues) {\n selected.push([selectedSource, selectedFilterValues]);\n }\n }\n }\n });\n const result: FilterLabelsInfoBySourceMap = {};\n for (const [source, selectedValues] of selected) {\n const uniqueValuesResponses = await Promise.all(selectedValues.map((v) => controller.getUniqueSourceValuesWithLabels(dataStore, inputGuide, source, 1, undefined, v)));\n uniqueValuesResponses.forEach((response, idx) => {\n if (response.values.length > 0) {\n if (!result[source]) {\n result[source] = {};\n }\n result[source][selectedValues[idx] as string] = response.values[0];\n }\n });\n }\n return result;\n}\n"],"names":["SAVED_IN_CHART_DATA_DISCRETE_GROUPINGS","SAVED_IN_CHART_DATA_SCATTERPLOT_GROUPINGS","SAVED_IN_CHART_DATA_SCATTERPLOT_XY","SAVED_IN_CHART_DATA_HISTOGRAM_GROUPING","SAVED_IN_CHART_DATA_DENDRO_GROUPING","FILTER_INPUTS","sortValues","values","a","b","addUniqueData","chartData","resultMap","sourceId","labelId","data","dataLabels","resultSet","result","i","v","label","el","res","getUniqueValuesFromReadyChartData","inputGuide","optionsState","controller","dataStore","previousFilterSuggestions","inputName","savedData","columnName","savedInGrouping","valueType","savedByInputName","filterSuggestionsMap","selectedSources","id","info","componentState","selectedSource","type","source","loadFilterLabelsForTitle","selected","selectedFilterValues","selectedValues","response","idx"],"mappings":"AAcA,MAAMA,I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aAAW,CAACyB,GAAQI,CAAc,KAAKF;AAErC,KAD8B,MAAM,QAAQ,IAAIE,EAAe,IAAI,CAAC3B,MAAMO,EAAW,gCAAgCC,GAAWH,GAAYkB,GAAQ,GAAG,QAAWvB,CAAC,CAAC,CAAC,GAC/I,QAAQ,CAAC4B,GAAUC,MAAQ;AAC/C,MAAID,EAAS,OAAO,SAAS,MACtB9B,EAAOyB,CAAM,MAChBzB,EAAOyB,CAAM,IAAI,CAAA,IAEnBzB,EAAOyB,CAAM,EAAEI,EAAeE,CAAG,CAAW,IAAID,EAAS,OAAO,CAAC;AAAA,IAErE,CAAC;AAEH,SAAO9B;AACT;"}
1
+ {"version":3,"file":"loadUniqueValuesToSave.js","sources":["../../src/utils/loadUniqueValuesToSave.ts"],"sourcesContent":["import type { FilterLabelsInfoBySourceMap, FilterSuggestionsBySourceMap, UniqueValuesBySourceMap } from '../types';\nimport type {\n ComponentStateFilter,\n Controller,\n DemoDataStore,\n InputGuide,\n InputState,\n PlotDataAndSettings,\n SelectorStateFilter,\n} from '@milaboratories/pf-plots';\nimport type { DendroSettings, DiscreteSettings, HistogramSettings, ScatterplotSettings } from '@milaboratories/miplots4';\nimport { MAX_GROUPS_COUNT } from '../constantsCommon';\n\nconst SAVED_IN_CHART_DATA_DISCRETE_GROUPINGS = ['primaryGrouping', 'secondaryGrouping'];\nconst SAVED_IN_CHART_DATA_SCATTERPLOT_GROUPINGS = ['grouping', 'dotShape'];\nconst SAVED_IN_CHART_DATA_SCATTERPLOT_XY = ['x', 'y'];\nconst SAVED_IN_CHART_DATA_HISTOGRAM_GROUPING = ['grouping'];\nconst SAVED_IN_CHART_DATA_DENDRO_GROUPING = [\n 'nodeColor', 'nodeShape', 'lineColor', 'heatmapAnnotation', // dendro\n];\n\nconst FILTER_INPUTS = ['filters', 'highlight', 'tabBy'] as ((keyof InputState['components'])[]);\n\nconst sortValues = (values: { value: string; label: string }[]) => values.sort((a, b) => a.label.localeCompare(b.label, 'en', { numeric: true }));\n\nconst OVERFLOW_LIMIT = 100;\nfunction addUniqueData(chartData: PlotDataAndSettings, resultMap: UniqueValuesBySourceMap, sourceId: string, maxGroupCount: number, labelId?: string) {\n const data = chartData!.data.byColumns.values[sourceId];\n const dataLabels = labelId ? chartData!.data.byColumns.values[labelId] : null;\n\n const resultSet = new Set();\n const result: { value: string; label: string }[] = [];\n for (let i = 0; i < data.length; i++) {\n const v = String(data[i]);\n if (resultSet.has(v)) {\n continue;\n }\n if (resultSet.size === maxGroupCount) {\n sortValues(result);\n resultMap[sourceId] = {\n list: result.map((el) => el.value),\n labels: result.reduce((res, el) => {\n res[el.value] = el.label;\n return res;\n }, {} as Record<string, string>),\n options: result,\n overflow: result.length > OVERFLOW_LIMIT,\n };\n return;\n }\n resultSet.add(v);\n const label = dataLabels ? String(dataLabels[i]) : v;\n result.push({ value: v, label });\n }\n sortValues(result);\n resultMap[sourceId] = {\n list: result.map((el) => el.value),\n labels: result.reduce((res, el) => {\n res[el.value] = el.label;\n return res;\n }, {} as Record<string, string>),\n options: result,\n overflow: result.length > OVERFLOW_LIMIT,\n };\n}\n\nexport async function getUniqueValuesFromReadyChartData(\n chartData: PlotDataAndSettings,\n inputGuide: InputGuide<InputState>,\n optionsState: InputState['components'],\n controller: Controller<InputState>,\n dataStore: DemoDataStore,\n previousFilterSuggestions: FilterSuggestionsBySourceMap,\n maxGroupCount = MAX_GROUPS_COUNT,\n): Promise<{ uniqueValues: UniqueValuesBySourceMap; filterSuggestions: FilterSuggestionsBySourceMap }> {\n const resultMap: UniqueValuesBySourceMap = {};\n\n if (chartData.settings.type === 'discrete') {\n SAVED_IN_CHART_DATA_DISCRETE_GROUPINGS.forEach((inputName: string) => {\n const savedData = chartData.settings[inputName] as unknown as DiscreteSettings['primaryGrouping'];\n if (savedData) {\n const { columnName } = savedData;\n addUniqueData(chartData, resultMap, columnName.value, maxGroupCount, columnName.valueLabels);\n }\n });\n }\n if (chartData.settings.type === 'scatterplot' || chartData.settings.type === 'scatterplot-umap') {\n SAVED_IN_CHART_DATA_SCATTERPLOT_XY.forEach((inputName: string) => {\n const columnName = chartData.settings[inputName] as unknown as ScatterplotSettings['x'];\n if (columnName) {\n const valueType = inputGuide.getSourceInfo(columnName.value).type;\n if (valueType === 'String') {\n addUniqueData(chartData, resultMap, columnName.value, maxGroupCount, columnName.valueLabels);\n }\n }\n });\n SAVED_IN_CHART_DATA_SCATTERPLOT_GROUPINGS.forEach((inputName: string) => {\n const savedInGrouping = chartData.settings[inputName] as unknown as ScatterplotSettings['grouping'];\n savedInGrouping?.forEach(({ columnName }) => {\n const valueType = inputGuide.getSourceInfo(columnName.value).type;\n if (valueType === 'String' || valueType === 'Int' || valueType === 'Long') {\n addUniqueData(chartData, resultMap, columnName.value, maxGroupCount, columnName.valueLabels);\n }\n });\n });\n }\n\n if (chartData.settings.type === 'histogram') {\n SAVED_IN_CHART_DATA_HISTOGRAM_GROUPING.forEach((inputName: string) => {\n const savedByInputName = chartData.settings[inputName] as unknown as HistogramSettings['grouping'];\n if (savedByInputName) {\n addUniqueData(chartData, resultMap, savedByInputName.value, maxGroupCount, savedByInputName.valueLabels);\n }\n });\n }\n\n if (chartData.settings.type === 'dendro') {\n SAVED_IN_CHART_DATA_DENDRO_GROUPING.forEach((inputName: string) => {\n const savedByInputName = chartData.settings[inputName] as unknown as DendroSettings['heatmapAnnotation'];\n if (savedByInputName) {\n addUniqueData(chartData, resultMap, savedByInputName.value, maxGroupCount, savedByInputName.valueLabels);\n }\n });\n }\n\n const filterSuggestionsMap: FilterSuggestionsBySourceMap = { ...previousFilterSuggestions };\n\n // sources for loading\n const selectedSources: string[] = [];\n ([...inputGuide.fullOptionsSet]).forEach((id) => {\n const info = inputGuide.getSourceInfo(id);\n if (info.kind === 'axis' && info.isNonHomogenous) {\n selectedSources.push(id);\n }\n });\n FILTER_INPUTS.forEach((inputName) => {\n const componentState = optionsState[inputName] as ComponentStateFilter;\n if (!componentState) {\n return;\n }\n for (const { selectedSource, type } of componentState.selectorStates as SelectorStateFilter[]) {\n if (((inputName === 'filters' || inputName === 'highlight') && type === 'equals') || inputName === 'tabBy') {\n selectedSources.push(selectedSource);\n }\n }\n });\n for (const source of selectedSources) {\n if (filterSuggestionsMap[source]) {\n continue;\n } else if (dataStore) {\n filterSuggestionsMap[source] = await controller.getUniqueSourceValuesWithLabels(dataStore, inputGuide, source, maxGroupCount);\n }\n }\n return { uniqueValues: resultMap, filterSuggestions: filterSuggestionsMap };\n}\n\n/** Build facet values map from facetBy columns in chart data, limited by maxFacetsCount (same shape as unique values). */\nexport function getFacetValuesFromReadyChartData(\n chartData: PlotDataAndSettings,\n optionsState: InputState['components'],\n maxSavedFacetsCount = 1000,\n): UniqueValuesBySourceMap {\n const resultMap: UniqueValuesBySourceMap = {};\n const facetBy = optionsState?.facetBy as { selectorStates: { selectedSource: string }[] } | undefined;\n if (!facetBy?.selectorStates?.length) {\n return resultMap;\n }\n const columns = chartData.data.byColumns.values;\n facetBy.selectorStates.forEach(({ selectedSource }) => {\n if (columns[selectedSource]) {\n addUniqueData(chartData, resultMap, selectedSource, maxSavedFacetsCount);\n }\n });\n return resultMap;\n}\n\nexport async function loadFilterLabelsForTitle(\n optionsState: InputState['components'],\n inputGuide: InputGuide<InputState>,\n controller: Controller<InputState>,\n dataStore: DemoDataStore,\n): Promise<FilterLabelsInfoBySourceMap> {\n const selected: [string, string[]][] = [];\n const INPUTS_REQUESTING_LABELS = ['filters', 'tabBy'] as ((keyof InputState['components'])[]);\n INPUTS_REQUESTING_LABELS.forEach((inputName) => {\n const componentState = optionsState[inputName];\n if (componentState) {\n for (const { selectedSource, selectedFilterValues, type } of componentState.selectorStates as SelectorStateFilter[]) {\n if (inputName === 'filters' && type === 'equals' && selectedFilterValues) {\n selected.push([selectedSource, selectedFilterValues]);\n } else if (selectedFilterValues) {\n selected.push([selectedSource, selectedFilterValues]);\n }\n }\n }\n });\n const result: FilterLabelsInfoBySourceMap = {};\n for (const [source, selectedValues] of selected) {\n const uniqueValuesResponses = await Promise.all(selectedValues.map((v) => controller.getUniqueSourceValuesWithLabels(dataStore, inputGuide, source, 1, undefined, v)));\n uniqueValuesResponses.forEach((response, idx) => {\n if (response.values.length > 0) {\n if (!result[source]) {\n result[source] = {};\n }\n result[source][selectedValues[idx] as string] = response.values[0];\n }\n });\n }\n return result;\n}\n"],"names":["SAVED_IN_CHART_DATA_DISCRETE_GROUPINGS","SAVED_IN_CHART_DATA_SCATTERPLOT_GROUPINGS","SAVED_IN_CHART_DATA_SCATTERPLOT_XY","SAVED_IN_CHART_DATA_HISTOGRAM_GROUPING","SAVED_IN_CHART_DATA_DENDRO_GROUPING","FILTER_INPUTS","sortValues","values","a","b","OVERFLOW_LIMIT","addUniqueData","chartData","resultMap","sourceId","maxGroupCount","labelId","data","dataLabels","resultSet","result","v","el","res","label","getUniqueValuesFromReadyChartData","inputGuide","optionsState","controller","dataStore","previousFilterSuggestions","MAX_GROUPS_COUNT","inputName","savedData","columnName","savedInGrouping","valueType","savedByInputName","filterSuggestionsMap","selectedSources","id","info","componentState","selectedSource","type","source","getFacetValuesFromReadyChartData","maxSavedFacetsCount","facetBy","_a","columns","loadFilterLabelsForTitle","selected","selectedFilterValues","selectedValues","response","idx"],"mappings":";AAaA,MAAMA,IAAyC,CAAC,mBAAmB,mBAAmB,GAChFC,IAA4C,CAAC,YAAY,UAAU,GACnEC,IAAqC,CAAC,KAAK,GAAG,GAC9CC,IAAyC,CAAC,UAAU,GACpDC,IAAsC;AAAA,EAC1C;AAAA,EAAa;AAAA,EAAa;AAAA,EAAa;AAAA;AACzC,GAEMC,IAAgB,CAAC,WAAW,aAAa,OAAO,GAEhDC,IAAa,CAACC,MAA+CA,EAAO,KAAK,CAACC,GAAGC,MAAMD,EAAE,MAAM,cAAcC,EAAE,OAAO,MAAM,EAAE,SAAS,GAAA,CAAM,CAAC,GAE1IC,IAAiB;AACvB,SAASC,EAAcC,GAAgCC,GAAoCC,GAAkBC,GAAuBC,GAAkB;AACpJ,QAAMC,IAAOL,EA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AaK,CAAS;AAC7C,QAAIU;AACF,iBAAW,EAAE,gBAAAC,GAAgB,sBAAAU,GAAsB,MAAAT,EAAA,KAAUF,EAAe;AAC1E,QAAIV,MAAc,aAAaY,MAAS,YAAYS,IAClDD,EAAS,KAAK,CAACT,GAAgBU,CAAoB,CAAC,IAC3CA,KACTD,EAAS,KAAK,CAACT,GAAgBU,CAAoB,CAAC;AAAA,EAI5D,CAAC;AACD,QAAMjC,IAAsC,CAAA;AAC5C,aAAW,CAACyB,GAAQS,CAAc,KAAKF;AAErC,KAD8B,MAAM,QAAQ,IAAIE,EAAe,IAAI,CAACjC,MAAMO,EAAW,gCAAgCC,GAAWH,GAAYmB,GAAQ,GAAG,QAAWxB,CAAC,CAAC,CAAC,GAC/I,QAAQ,CAACkC,GAAUC,MAAQ;AAC/C,MAAID,EAAS,OAAO,SAAS,MACtBnC,EAAOyB,CAAM,MAChBzB,EAAOyB,CAAM,IAAI,CAAA,IAEnBzB,EAAOyB,CAAM,EAAES,EAAeE,CAAG,CAAW,IAAID,EAAS,OAAO,CAAC;AAAA,IAErE,CAAC;AAEH,SAAOnC;AACT;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@milaboratories/graph-maker",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -33,8 +33,8 @@
33
33
  "d3-hierarchy": "^3.1.2",
34
34
  "d3-scale": "^4.0.2",
35
35
  "vue": "^3.5.24",
36
- "@milaboratories/pf-plots": "1.1.65",
37
- "@milaboratories/miplots4": "1.0.174"
36
+ "@milaboratories/miplots4": "1.0.176",
37
+ "@milaboratories/pf-plots": "1.1.66"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@milaboratories/build-configs": "^1.5.0",
@@ -1,7 +0,0 @@
1
- const e = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none">
2
- <path fill-rule="evenodd" clip-rule="evenodd" d="M4.00011 2.93933L8.00011 6.93933L12.0001 2.93933L13.0608 3.99999L9.06077 7.99999L13.0608 12L12.0001 13.0607L8.00011 9.06065L4.00011 13.0607L2.93945 12L6.93945 7.99999L2.93945 3.99999L4.00011 2.93933Z" fill="#110529"/>
3
- </svg>`;
4
- export {
5
- e as default
6
- };
7
- //# sourceMappingURL=chip-close.svg.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"chip-close.svg.js","sources":["../../../../src/assets/drag-and-drop/img/chip-close.svg?raw"],"sourcesContent":["export default \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\" width=\\\"16\\\" height=\\\"16\\\" viewBox=\\\"0 0 16 16\\\" fill=\\\"none\\\">\\n <path fill-rule=\\\"evenodd\\\" clip-rule=\\\"evenodd\\\" d=\\\"M4.00011 2.93933L8.00011 6.93933L12.0001 2.93933L13.0608 3.99999L9.06077 7.99999L13.0608 12L12.0001 13.0607L8.00011 9.06065L4.00011 13.0607L2.93945 12L6.93945 7.99999L2.93945 3.99999L4.00011 2.93933Z\\\" fill=\\\"#110529\\\"/>\\n</svg>\""],"names":["CloseIcon"],"mappings":"AAAA,MAAAA,IAAe;AAAA;AAAA;"}