@milaboratories/graph-maker 1.1.195 → 1.1.196
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/AesSettings/AesDataMappingDiscrete.vue2.js +127 -130
- package/dist/components/AesSettings/AesDataMappingDiscrete.vue2.js.map +1 -1
- package/dist/components/AesSettings/DiscreteRow.vue2.js +18 -18
- package/dist/components/AesSettings/DiscreteRow.vue2.js.map +1 -1
- package/dist/components/AesSettings/DiscreteRow.vue3.js +10 -8
- package/dist/components/AesSettings/DiscreteRow.vue3.js.map +1 -1
- package/dist/components/Chart.vue.js +118 -112
- package/dist/components/Chart.vue.js.map +1 -1
- package/dist/components/CollapsableBlock.vue.d.ts +1 -0
- package/dist/components/CollapsableBlock.vue.js +27 -21
- package/dist/components/CollapsableBlock.vue.js.map +1 -1
- package/dist/constantsCommon.d.ts +2 -0
- package/dist/constantsCommon.js +24 -16
- package/dist/constantsCommon.js.map +1 -1
- package/dist/forms/AxesSettingsForm/BubbleAxesSettingsForm.vue.js +156 -117
- package/dist/forms/AxesSettingsForm/BubbleAxesSettingsForm.vue.js.map +1 -1
- package/dist/forms/AxesSettingsForm/DiscreteAxesSettingsForm.vue.js +162 -134
- package/dist/forms/AxesSettingsForm/DiscreteAxesSettingsForm.vue.js.map +1 -1
- package/dist/forms/AxesSettingsForm/HeatmapAxesSettingsForm.vue.js +175 -153
- package/dist/forms/AxesSettingsForm/HeatmapAxesSettingsForm.vue.js.map +1 -1
- package/dist/forms/AxesSettingsForm/HistogramAxesSettingsForm.vue.js +177 -136
- package/dist/forms/AxesSettingsForm/HistogramAxesSettingsForm.vue.js.map +1 -1
- package/dist/forms/AxesSettingsForm/ScatterplotAxesSettingsForm.vue.js +243 -203
- package/dist/forms/AxesSettingsForm/ScatterplotAxesSettingsForm.vue.js.map +1 -1
- package/dist/forms/LayersForm/Layer/Bubble.vue.js +39 -43
- package/dist/forms/LayersForm/Layer/Bubble.vue.js.map +1 -1
- package/dist/forms/LayersForm/Layer/discrete/Bar.vue.js +30 -34
- package/dist/forms/LayersForm/Layer/discrete/Bar.vue.js.map +1 -1
- package/dist/forms/LayersForm/Layer/discrete/Errorbar.vue.js +24 -26
- package/dist/forms/LayersForm/Layer/discrete/Errorbar.vue.js.map +1 -1
- package/dist/forms/LayersForm/Layer/discrete/Line.vue.js +27 -29
- package/dist/forms/LayersForm/Layer/discrete/Line.vue.js.map +1 -1
- package/dist/forms/LayersForm/Layer/discrete/StackedArea.vue.js +38 -43
- package/dist/forms/LayersForm/Layer/discrete/StackedArea.vue.js.map +1 -1
- package/dist/forms/LayersForm/Layer/discrete/StackedBar.vue.js +31 -36
- package/dist/forms/LayersForm/Layer/discrete/StackedBar.vue.js.map +1 -1
- package/dist/forms/LayersForm/Layer/heatmap/Heatmap.vue.js +53 -57
- package/dist/forms/LayersForm/Layer/heatmap/Heatmap.vue.js.map +1 -1
- package/dist/forms/LayersForm/Layer/heatmap/HeatmapClustered.vue.js +70 -74
- package/dist/forms/LayersForm/Layer/heatmap/HeatmapClustered.vue.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.vue.js +1 -1
- package/dist/store.d.ts +3 -4
- package/dist/store.js +25 -26
- package/dist/store.js.map +1 -1
- package/dist/types.d.ts +4 -0
- package/dist/utils/createChartSettingsForRender/composeBubbleSettings.d.ts +1 -1
- package/dist/utils/createChartSettingsForRender/composeChartSettings.d.ts +4 -2
- package/dist/utils/createChartSettingsForRender/composeChartSettings.js +22 -22
- package/dist/utils/createChartSettingsForRender/composeChartSettings.js.map +1 -1
- package/dist/utils/createChartSettingsForRender/composeDiscreteSettings.d.ts +7 -5
- package/dist/utils/createChartSettingsForRender/composeHeatmapSettings.d.ts +1 -1
- package/dist/utils/createChartSettingsForRender/composeScatterplotSettings.d.ts +2 -1
- package/dist/utils/createChartSettingsForRender/composeScatterplotSettings.js +12 -12
- package/dist/utils/createChartSettingsForRender/composeScatterplotSettings.js.map +1 -1
- package/dist/utils/createChartSettingsForRender/composeScatterplotUmapSettings.js +11 -11
- package/dist/utils/createChartSettingsForRender/composeScatterplotUmapSettings.js.map +1 -1
- package/dist/utils/createChartSettingsForRender/getAxesDataFromForms.js +17 -17
- package/dist/utils/createChartSettingsForRender/getAxesDataFromForms.js.map +1 -1
- package/dist/utils/loadUniqueValuesToSave.d.ts +2 -3
- package/dist/utils/loadUniqueValuesToSave.js +2 -2
- package/dist/utils/loadUniqueValuesToSave.js.map +1 -1
- package/package.json +2 -2
package/dist/store.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { ChartType, DemoDataStore, DendroStateController, InputGuide, InputNamesByChartType, InputState, PlotDataAndSettings, getControllerByType } from '@milaboratories/pf-plots';
|
|
2
2
|
import { PColumnSpec } from '@platforma-sdk/model';
|
|
3
|
-
import { ListOption } from '@platforma-sdk/ui-vue';
|
|
4
3
|
import { Palette } from './components/AesSettings/types';
|
|
5
4
|
import { ComputedRef, Reactive, Ref } from 'vue';
|
|
6
5
|
import { AesType } from './constantsCommon';
|
|
7
|
-
import { DefaultPalettes, FilterSuggestionsBySourceMap, GraphMakerProps, GraphMakerState, ReactiveState, UniqueValuesBySourceMap } from './types';
|
|
6
|
+
import { DefaultPalettes, FilterLabelsInfoBySourceMap, FilterSuggestionsBySourceMap, GraphMakerProps, GraphMakerState, ReactiveState, UniqueValuesBySourceMap } from './types';
|
|
8
7
|
import { calculateDiscreteGroups } from './utils/calculateDiscreteGroups';
|
|
9
8
|
export declare function createReactiveState(initialData: GraphMakerState, chartType: ChartType): Reactive<ReactiveState>;
|
|
10
9
|
export interface Store {
|
|
@@ -30,11 +29,11 @@ export interface Store {
|
|
|
30
29
|
chartData: Ref<PlotDataAndSettings | null>;
|
|
31
30
|
uniqueValuesData: Ref<UniqueValuesBySourceMap>;
|
|
32
31
|
filterSuggestionsData: Ref<FilterSuggestionsBySourceMap>;
|
|
33
|
-
filterLabelsInfo: Ref<
|
|
32
|
+
filterLabelsInfo: Ref<FilterLabelsInfoBySourceMap>;
|
|
34
33
|
readonlyInputs?: InputNamesByChartType[ChartType][];
|
|
35
34
|
defaultPalette: DefaultPalettes;
|
|
36
35
|
}
|
|
37
|
-
export declare function factoryStore(reactiveState: Reactive<ReactiveState>, dataStore: DemoDataStore | null, inputGuide: Ref<InputGuide<InputState>>, chartData: Ref<PlotDataAndSettings | null>, dendroTableData: Ref<Awaited<ReturnType<DendroStateController['createTableData']>> | null>, uniqueValuesData: Ref<UniqueValuesBySourceMap>, filterSuggestionsData: Ref<FilterSuggestionsBySourceMap>, filterLabelsInfo: Ref<
|
|
36
|
+
export declare function factoryStore(reactiveState: Reactive<ReactiveState>, dataStore: DemoDataStore | null, inputGuide: Ref<InputGuide<InputState>>, chartData: Ref<PlotDataAndSettings | null>, dendroTableData: Ref<Awaited<ReturnType<DendroStateController['createTableData']>> | null>, uniqueValuesData: Ref<UniqueValuesBySourceMap>, filterSuggestionsData: Ref<FilterSuggestionsBySourceMap>, filterLabelsInfo: Ref<FilterLabelsInfoBySourceMap>, readonlyInputs?: InputNamesByChartType[ChartType][], defaultPalette?: Palette | {
|
|
38
37
|
categorical?: Palette;
|
|
39
38
|
continuous?: Palette;
|
|
40
39
|
}): Store;
|
package/dist/store.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { deepClone as j } from "@milaboratories/helpers";
|
|
2
2
|
import { getControllerByType as L, getInitialStateByType as H } from "@milaboratories/pf-plots";
|
|
3
|
-
import { ref as d, computed as
|
|
3
|
+
import { ref as d, computed as C, toRaw as G, watch as T, provide as V, reactive as K, inject as k } from "vue";
|
|
4
4
|
import { getInitialAxesSettings as q, getInitialLayersSettings as z, getInitialStatisticsState as J, getInitialTemplate as W } from "./constantsCommon.js";
|
|
5
5
|
import { updateDataBindAes as Q } from "./dataBindAes.js";
|
|
6
6
|
import { notEmpty as X } from "./helpers.js";
|
|
@@ -10,15 +10,15 @@ import { loadDataForPlot as $ } from "./utils/createChartSettingsForRender/compo
|
|
|
10
10
|
import { calculateDiscreteGroups as U } from "./utils/calculateDiscreteGroups.js";
|
|
11
11
|
import { addFixedOptionsToState as R } from "./utils/addFixedOptionsToState.js";
|
|
12
12
|
import { loadDefaultSources as x } from "./utils/loadDefaultSources.js";
|
|
13
|
-
import { copyJSON as
|
|
13
|
+
import { copyJSON as I } from "./utils/copyJSON.js";
|
|
14
14
|
import { getUsedAesInMapping as P } from "./utils/getUsedAesInMapping.js";
|
|
15
15
|
import { getUniqueValuesFromReadyChartData as tt, loadFilterLabelsForTitle as et } from "./utils/loadUniqueValuesToSave.js";
|
|
16
16
|
import { tabKeys as at } from "./forms/index.js";
|
|
17
17
|
function ot(t, e) {
|
|
18
|
-
const l =
|
|
18
|
+
const l = I(H(t));
|
|
19
19
|
if ((e == null ? void 0 : e.type) !== t)
|
|
20
20
|
return l;
|
|
21
|
-
const g =
|
|
21
|
+
const g = I(e);
|
|
22
22
|
return {
|
|
23
23
|
...l,
|
|
24
24
|
...g,
|
|
@@ -41,7 +41,7 @@ function nt(t, e) {
|
|
|
41
41
|
layersSettings: z(t.layersSettings),
|
|
42
42
|
axesSettings: q(e, t.axesSettings),
|
|
43
43
|
// common aesthetics data mapped on columns/axes values
|
|
44
|
-
dataBindAes:
|
|
44
|
+
dataBindAes: I(t.dataBindAes ?? {}),
|
|
45
45
|
chartScale: t.zoomState ?? 100,
|
|
46
46
|
lassoControlsState: null,
|
|
47
47
|
currentTab: null,
|
|
@@ -51,7 +51,7 @@ function nt(t, e) {
|
|
|
51
51
|
showTooltipHint: !1
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
|
-
function it(t, e, l, g, S, y, f,
|
|
54
|
+
function it(t, e, l, g, S, y, f, A, a, o) {
|
|
55
55
|
return {
|
|
56
56
|
reactive: t,
|
|
57
57
|
loading: K({
|
|
@@ -64,21 +64,21 @@ function it(t, e, l, g, S, y, f, D, a, o) {
|
|
|
64
64
|
dendroTableData: !1
|
|
65
65
|
}),
|
|
66
66
|
commonHelpersData: {
|
|
67
|
-
primaryGroups:
|
|
67
|
+
primaryGroups: C(
|
|
68
68
|
() => U(
|
|
69
69
|
t.optionsState,
|
|
70
70
|
y.value,
|
|
71
71
|
"primaryGrouping"
|
|
72
72
|
)
|
|
73
73
|
),
|
|
74
|
-
secondaryGroups:
|
|
74
|
+
secondaryGroups: C(
|
|
75
75
|
() => U(
|
|
76
76
|
t.optionsState,
|
|
77
77
|
y.value,
|
|
78
78
|
"secondaryGrouping"
|
|
79
79
|
)
|
|
80
80
|
),
|
|
81
|
-
usedAesInMapping:
|
|
81
|
+
usedAesInMapping: C(
|
|
82
82
|
() => P(
|
|
83
83
|
t.chartType,
|
|
84
84
|
t.template,
|
|
@@ -96,7 +96,7 @@ function it(t, e, l, g, S, y, f, D, a, o) {
|
|
|
96
96
|
chartData: g,
|
|
97
97
|
uniqueValuesData: y,
|
|
98
98
|
filterSuggestionsData: f,
|
|
99
|
-
filterLabelsInfo:
|
|
99
|
+
filterLabelsInfo: A,
|
|
100
100
|
readonlyInputs: a,
|
|
101
101
|
defaultPalette: {
|
|
102
102
|
categorical: typeof o == "object" && o.categorical ? o.categorical : typeof o == "string" ? o : Z,
|
|
@@ -104,22 +104,21 @@ function it(t, e, l, g, S, y, f, D, a, o) {
|
|
|
104
104
|
}
|
|
105
105
|
};
|
|
106
106
|
}
|
|
107
|
-
function bt(t, e, l, g, S, y, f,
|
|
108
|
-
|
|
109
|
-
const a = nt(t, l), o = L(a.chartType), h = d(L(a.chartType).getEmptyInputGuide(a.optionsState)), N = d(null), b = d({}), G = d({}), E = d({}), B = d(null), n = I(() => it(
|
|
107
|
+
function bt(t, e, l, g, S, y, f, A) {
|
|
108
|
+
const a = nt(t, l), o = L(a.chartType), D = d(L(a.chartType).getEmptyInputGuide(a.optionsState)), N = d(null), h = d({}), b = d({}), E = d({}), B = d(null), n = C(() => it(
|
|
110
109
|
a,
|
|
111
|
-
|
|
112
|
-
|
|
110
|
+
G(e.value),
|
|
111
|
+
D,
|
|
113
112
|
N,
|
|
114
113
|
B,
|
|
114
|
+
h,
|
|
115
115
|
b,
|
|
116
|
-
G,
|
|
117
116
|
E,
|
|
118
117
|
f,
|
|
119
|
-
|
|
118
|
+
A
|
|
120
119
|
));
|
|
121
120
|
T(() => e.value, () => {
|
|
122
|
-
E.value = {},
|
|
121
|
+
E.value = {}, h.value = {}, b.value = {};
|
|
123
122
|
}), T([
|
|
124
123
|
() => e.value,
|
|
125
124
|
() => g.value
|
|
@@ -127,7 +126,7 @@ function bt(t, e, l, g, S, y, f, D) {
|
|
|
127
126
|
if (!c || !i || !n.value.loading.initialDefaults)
|
|
128
127
|
return;
|
|
129
128
|
n.value.loading.initialDefaults = !1, n.value.loading.initialInputGuide = !0;
|
|
130
|
-
const s =
|
|
129
|
+
const s = I(a.optionsState.components), r = c.filter((u) => {
|
|
131
130
|
var v;
|
|
132
131
|
return ((v = a.optionsState.components[u.inputName]) == null ? void 0 : v.selectorStates.length) === 0 || (f == null ? void 0 : f.includes(u.inputName));
|
|
133
132
|
});
|
|
@@ -164,19 +163,19 @@ function bt(t, e, l, g, S, y, f, D) {
|
|
|
164
163
|
w.value++;
|
|
165
164
|
const r = w.value;
|
|
166
165
|
n.value.loading.inputGuide = !0;
|
|
167
|
-
const m = c && s ? (await x(c, s, !1)).map((p) => p.selectedSource) : [], u = c ? await o.calculateOptions(
|
|
168
|
-
if (r === w.value && (
|
|
166
|
+
const m = c && s ? (await x(c, s, !1)).map((p) => p.selectedSource) : [], u = c ? await o.calculateOptions(G(c), i, m, y) : o.getEmptyInputGuide(i);
|
|
167
|
+
if (r === w.value && (D.value = u, n.value.loading.inputGuide = !1, n.value.loading.initialInputGuide)) {
|
|
169
168
|
n.value.loading.initialInputGuide = !1;
|
|
170
169
|
const p = t.currentTab === void 0 ? "dataMapping" : t.currentTab;
|
|
171
170
|
n.value.reactive.currentTab = n.value.reactive.currentTab ?? p;
|
|
172
171
|
}
|
|
173
172
|
}, { immediate: !0, deep: !0 });
|
|
174
173
|
const F = d(0);
|
|
175
|
-
if (T(() =>
|
|
174
|
+
if (T(() => D.value, async (i) => {
|
|
176
175
|
F.value++;
|
|
177
176
|
const c = F.value, s = setTimeout(() => {
|
|
178
177
|
n.value.loading.chartData = !0;
|
|
179
|
-
}, 300), r =
|
|
178
|
+
}, 300), r = G(e.value), m = await $(i, a, r, S.value);
|
|
180
179
|
if (clearTimeout(s), m && r) {
|
|
181
180
|
const { uniqueValues: u, filterSuggestions: p } = await tt(
|
|
182
181
|
m,
|
|
@@ -184,9 +183,9 @@ function bt(t, e, l, g, S, y, f, D) {
|
|
|
184
183
|
a.optionsState.components,
|
|
185
184
|
o,
|
|
186
185
|
r,
|
|
187
|
-
|
|
186
|
+
G(b.value)
|
|
188
187
|
);
|
|
189
|
-
|
|
188
|
+
h.value = u, b.value = p, Q(a.optionsState, a.dataBindAes, h.value);
|
|
190
189
|
}
|
|
191
190
|
E.value = r ? await et(
|
|
192
191
|
a.optionsState.components,
|
|
@@ -199,7 +198,7 @@ function bt(t, e, l, g, S, y, f, D) {
|
|
|
199
198
|
T([
|
|
200
199
|
() => a.optionsState,
|
|
201
200
|
() => e.value,
|
|
202
|
-
() =>
|
|
201
|
+
() => D.value.readyData,
|
|
203
202
|
() => S.value
|
|
204
203
|
], async ([c, s, r, m]) => {
|
|
205
204
|
if (r && s) {
|
package/dist/store.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.js","sources":["../src/store.ts"],"sourcesContent":["import { deepClone } from '@milaboratories/helpers';\nimport type {\n ChartType,\n DemoDataStore,\n DendroStateController,\n DendroUIState,\n InputGuide,\n InputNamesByChartType,\n InputState,\n PlotDataAndSettings,\n} from '@milaboratories/pf-plots';\nimport {\n getControllerByType,\n getInitialStateByType,\n} from '@milaboratories/pf-plots';\nimport type { PColumnSpec } from '@platforma-sdk/model';\nimport type { ListOption } from '@platforma-sdk/ui-vue';\nimport type { CategoricalPalette, ContinuousPalette, Palette } from './components/AesSettings/types';\nimport type { ComputedRef, Reactive, Ref } from 'vue';\nimport { computed, inject, provide, reactive, ref, toRaw, watch } from 'vue';\nimport type {\n AesType } from './constantsCommon';\nimport {\n getInitialAxesSettings,\n getInitialLayersSettings,\n getInitialStatisticsState,\n getInitialTemplate,\n} from './constantsCommon';\nimport { updateDataBindAes } from './dataBindAes';\nimport { notEmpty } from './helpers';\nimport { storeKey } from './keys';\nimport type {\n DefaultPalettes,\n DendroNodeInfo,\n FilterSuggestionsBySourceMap,\n GraphMakerProps,\n GraphMakerState,\n ReactiveState, UniqueValuesBySourceMap,\n} from './types';\nimport { loadDefaultSources } from './utils';\nimport { addFixedOptionsToState } from './utils/addFixedOptionsToState';\nimport { calculateDiscreteGroups } from './utils/calculateDiscreteGroups';\nimport { copyJSON } from './utils/copyJSON';\nimport { loadDataForPlot } from './utils/createChartSettingsForRender/composeChartSettings';\nimport { getUsedAesInMapping } from './utils/getUsedAesInMapping';\nimport {\n getUniqueValuesFromReadyChartData,\n loadFilterLabelsForTitle,\n} from './utils/loadUniqueValuesToSave';\nimport type { FormKey } from './forms';\nimport { tabKeys } from './forms';\nimport { DEFAULT_CATEGORICAL_PALETTE, DEFAULT_CONTINUOUS_PALETTE } from './constantsAesthetic';\n\nfunction getInitialOptionsState(chartType: ChartType, optionsState: InputState | undefined) {\n const defaultState = copyJSON(getInitialStateByType(chartType));\n if (optionsState?.type !== chartType) {\n return defaultState;\n }\n const optionsStateCopy = copyJSON(optionsState);\n\n return {\n ...defaultState,\n ...optionsStateCopy,\n components: {\n ...defaultState.components,\n ...optionsStateCopy.components,\n },\n };\n}\n\nexport function createReactiveState(\n initialData: GraphMakerState,\n chartType: ChartType,\n): Reactive<ReactiveState> {\n return reactive({\n chartType: chartType,\n // from pf-plots\n optionsState: getInitialOptionsState(chartType, initialData.optionsState), // contains user selected inputs\n\n dataStateKey: deepClone(initialData.dataStateKey),\n // local form states, updates directly in forms\n template: getInitialTemplate(initialData.template, chartType),\n statisticsSettings: getInitialStatisticsState(chartType, initialData.statisticsSettings),\n layersSettings: getInitialLayersSettings(initialData.layersSettings),\n axesSettings: getInitialAxesSettings(chartType, initialData.axesSettings),\n // common aesthetics data mapped on columns/axes values\n dataBindAes: copyJSON(initialData.dataBindAes ?? {}),\n chartScale: initialData.zoomState ?? 100,\n lassoControlsState: null,\n currentTab: null,\n tabDefaultState: tabKeys().reduce((res, formKey: FormKey) => {\n res[formKey] = {};\n return res;\n }, {} as Record<FormKey, Record<string, boolean>>),\n dendroInfoByClick: null as null | DendroNodeInfo,\n dendroSelectedNodeId: null,\n showTooltipHint: false,\n });\n}\n\nexport interface Store {\n reactive: Reactive<ReactiveState>;\n loading: {\n initialInputGuide: boolean;\n initialCharts: boolean;\n initialDefaults: boolean;\n inputGuide: boolean;\n chartData: boolean;\n chartRendering: boolean;\n dendroTableData: boolean;\n };\n commonHelpersData: {\n primaryGroups: ComputedRef<ReturnType<typeof calculateDiscreteGroups>>;\n secondaryGroups: ComputedRef<ReturnType<typeof calculateDiscreteGroups>>;\n usedAesInMapping: ComputedRef<Record<string, Record<AesType, boolean>>>;\n dendroTableData: Ref<Awaited<ReturnType<DendroStateController['createTableData']>> | null>;\n };\n controller: ReturnType<typeof getControllerByType>;\n columnsDataStore: DemoDataStore | null;\n inputGuide: Ref<InputGuide<InputState>>;\n chartData: Ref<PlotDataAndSettings | null>;\n uniqueValuesData: Ref<UniqueValuesBySourceMap>;\n filterSuggestionsData: Ref<FilterSuggestionsBySourceMap>;\n filterLabelsInfo: Ref<Record<string, ListOption>>;\n readonlyInputs?: InputNamesByChartType[ChartType][];\n defaultPalette: DefaultPalettes;\n}\n\nexport function factoryStore(\n reactiveState: Reactive<ReactiveState>,\n dataStore: DemoDataStore | null,\n inputGuide: Ref<InputGuide<InputState>>,\n chartData: Ref<PlotDataAndSettings | null>,\n dendroTableData: Ref<Awaited<ReturnType<DendroStateController['createTableData']>> | null>,\n uniqueValuesData: Ref<UniqueValuesBySourceMap>,\n filterSuggestionsData: Ref<FilterSuggestionsBySourceMap>,\n filterLabelsInfo: Ref<Record<string, ListOption>>,\n readonlyInputs?: InputNamesByChartType[ChartType][],\n defaultPalette?: Palette | { categorical?: Palette; continuous?: Palette },\n): Store {\n return {\n reactive: reactiveState,\n loading: reactive({\n initialInputGuide: true,\n initialCharts: true,\n initialDefaults: true,\n inputGuide: false,\n chartData: false,\n chartRendering: false,\n dendroTableData: false,\n }),\n commonHelpersData: {\n primaryGroups: computed(() => calculateDiscreteGroups(\n reactiveState.optionsState,\n uniqueValuesData.value,\n 'primaryGrouping',\n ),\n ),\n secondaryGroups: computed(() => calculateDiscreteGroups(\n reactiveState.optionsState,\n uniqueValuesData.value,\n 'secondaryGrouping',\n ),\n ),\n usedAesInMapping: computed<Record<string, Record<AesType, boolean>>>(() =>\n getUsedAesInMapping(\n reactiveState.chartType,\n reactiveState.template,\n reactiveState.layersSettings,\n reactiveState.statisticsSettings,\n reactiveState.optionsState,\n inputGuide.value,\n ),\n ),\n dendroTableData,\n },\n controller: getControllerByType(reactiveState.chartType),\n columnsDataStore: dataStore,\n inputGuide,\n chartData,\n uniqueValuesData,\n filterSuggestionsData,\n filterLabelsInfo,\n readonlyInputs,\n defaultPalette: {\n categorical: typeof defaultPalette === 'object' && defaultPalette.categorical\n ? defaultPalette.categorical as CategoricalPalette\n : typeof defaultPalette === 'string' ? defaultPalette as CategoricalPalette : DEFAULT_CATEGORICAL_PALETTE,\n continuous: typeof defaultPalette === 'object' && defaultPalette.continuous\n ? defaultPalette.continuous as ContinuousPalette\n : typeof defaultPalette === 'string' ? defaultPalette as ContinuousPalette : DEFAULT_CONTINUOUS_PALETTE,\n },\n };\n}\n\nexport type ComputedStore = ComputedRef<Store>;\n\nexport function provideStore(\n initialState: GraphMakerState,\n dataStoreRef: Ref<DemoDataStore | null>,\n chartType: ChartType,\n defaultOptionsRef: Ref<GraphMakerProps['defaultOptions']>,\n fixedOptionsRef: Ref<GraphMakerProps['fixedOptions']>,\n dataColumnPredicate?: (spec: PColumnSpec) => boolean,\n readonlyInputs?: InputNamesByChartType[ChartType][],\n defaultPalette?: GraphMakerProps['defaultPalette'],\n) {\n console.log('defaultPalette', defaultPalette);\n const reactiveState = createReactiveState(initialState, chartType);\n const controller = getControllerByType(reactiveState.chartType);\n\n const inputGuide = ref<InputGuide<InputState>>(getControllerByType(reactiveState.chartType).getEmptyInputGuide(reactiveState.optionsState));\n const chartData = ref<PlotDataAndSettings | null>(null);\n\n const uniqueValuesData = ref<UniqueValuesBySourceMap>({});\n const filterSuggestionsData = ref<FilterSuggestionsBySourceMap>({});\n const filterLabelsInfo = ref<Record<string, ListOption>>({}); // for auto titles of chart if something selected in filter/tabby\n\n const dendroTableData = ref<Awaited<ReturnType<DendroStateController['createTableData']>> | null>(null);\n\n // toRaw removes Vue proxy from dataStore.pframe (PFrame api)\n const store = computed(() => factoryStore(\n reactiveState,\n toRaw(dataStoreRef.value),\n inputGuide,\n chartData,\n dendroTableData,\n uniqueValuesData,\n filterSuggestionsData,\n filterLabelsInfo,\n readonlyInputs,\n defaultPalette,\n ));\n\n watch(() => dataStoreRef.value, () => {\n filterLabelsInfo.value = {};\n uniqueValuesData.value = {};\n filterSuggestionsData.value = {}; // reset saved data; avoid caching of empty results from old empty pframe\n });\n watch([\n () => dataStoreRef.value,\n () => defaultOptionsRef.value,\n ], async ([ds, defaultOptions]) => {\n if (!defaultOptions || !ds || !store.value.loading.initialDefaults) {\n return;\n }\n store.value.loading.initialDefaults = false; // to avoid multiple calculations, default settings cannot change except after reset\n store.value.loading.initialInputGuide = true; // to show loader on initial loading; changing of reactiveState.optionsState always triggers inputGuide recalculating, so it will be off after inputGuide\n\n const defaultStateMap = copyJSON(reactiveState.optionsState.components);\n const defaultOptionsWithoutUserChanges = defaultOptions.filter((opt) => {\n const res = reactiveState.optionsState.components[opt.inputName]?.selectorStates.length === 0\n || readonlyInputs?.includes(opt.inputName);\n return res;\n });\n if (defaultOptionsWithoutUserChanges.length === 0) {\n return;\n }\n defaultOptionsWithoutUserChanges.forEach((opt) => {\n defaultStateMap[opt.inputName].selectorStates = [];\n });\n const loadedDefaultSources = await loadDefaultSources(ds, defaultOptionsWithoutUserChanges);\n for (const {\n inputName,\n selectedSource,\n filterType,\n selectedFilterValues,\n selectedFilterRange,\n } of loadedDefaultSources) {\n defaultStateMap[inputName].selectorStates.push({\n selectedSource,\n type: filterType,\n selectedFilterValues,\n selectedFilterRange,\n });\n }\n\n reactiveState.optionsState.components = {\n ...reactiveState.optionsState.components,\n ...defaultStateMap,\n };\n }, { immediate: true });\n\n // recalculate input guide - options for every data input, consistency info etc\n const inputGuideCounter = ref(0); // to avoid race condition on async calculations\n watch([\n () => reactiveState.optionsState,\n () => dataStoreRef.value,\n () => fixedOptionsRef.value,\n ], async ([optionsState, ds, fixedOptions]) => {\n inputGuideCounter.value++;\n const counter = inputGuideCounter.value;\n store.value.loading.inputGuide = true;\n const ignoredIds = ds && fixedOptions ? (await loadDefaultSources(ds, fixedOptions, false)).map((item) => item.selectedSource) : [];\n\n // const start = Date.now();\n const nextInputGuide = ds ? await controller.calculateOptions(toRaw(ds), optionsState, ignoredIds, dataColumnPredicate) : controller.getEmptyInputGuide(optionsState);\n // console.log('input guide', Date.now() - start);\n\n if (counter === inputGuideCounter.value) { // race condition check\n inputGuide.value = nextInputGuide;\n\n store.value.loading.inputGuide = false;\n if (store.value.loading.initialInputGuide) { // open default/saved tab only after inputGuide loading\n store.value.loading.initialInputGuide = false;\n const initialTab = initialState.currentTab === undefined ? 'dataMapping' : initialState.currentTab;\n store.value.reactive.currentTab = store.value.reactive.currentTab ?? initialTab;\n }\n }\n }, { immediate: true, deep: true });\n\n // recalculate data for chart rendering (miplots4)\n const chartDataCounter = ref(0); // to avoid race condition on async calculations\n watch(() => inputGuide.value, async (ig) => {\n chartDataCounter.value++;\n const counter = chartDataCounter.value;\n\n const loading = setTimeout(() => {\n store.value.loading.chartData = true;\n }, 300);\n\n const ds = toRaw(dataStoreRef.value);\n // const start = Date.now();\n const nextChartData = await loadDataForPlot(ig, reactiveState, ds, fixedOptionsRef.value);\n clearTimeout(loading);\n\n if (nextChartData && ds) {\n const { uniqueValues, filterSuggestions } = await getUniqueValuesFromReadyChartData(\n nextChartData, ig, reactiveState.optionsState.components, controller, ds, toRaw(filterSuggestionsData.value),\n );\n uniqueValuesData.value = uniqueValues;\n filterSuggestionsData.value = filterSuggestions;\n updateDataBindAes(reactiveState.optionsState, reactiveState.dataBindAes, uniqueValuesData.value);\n }\n filterLabelsInfo.value = ds\n ? await loadFilterLabelsForTitle(\n reactiveState.optionsState.components,\n ig,\n controller,\n ds,\n )\n : {};\n // console.log('chart data', Date.now() - start);\n\n if (counter === chartDataCounter.value) { // race condition check\n chartData.value = nextChartData;\n if (ig.ready) {\n store.value.loading.initialCharts = false;\n }\n store.value.loading.chartData = false;\n }\n }, { immediate: true, deep: true });\n\n // watch data for table, only dendro chart; data is also using for popup by tree node click\n if (reactiveState.chartType === 'dendro') {\n const dendroDataCounter = ref(0); // to avoid race condition on async calculations\n watch([\n () => reactiveState.optionsState as DendroUIState,\n () => dataStoreRef.value,\n () => inputGuide.value.readyData,\n () => fixedOptionsRef.value,\n ], async ([optionsState, dataStore, ready, fixed]) => {\n if (ready && dataStore) {\n dendroDataCounter.value++;\n const counter = dendroDataCounter.value;\n store.value.loading.dendroTableData = true;\n const state = await addFixedOptionsToState(optionsState, dataStore, fixed) as DendroUIState;\n const nextDendroTableData = await (controller as unknown as DendroStateController).createTableData(dataStore, state);\n\n if (dendroDataCounter.value === counter) {\n dendroTableData.value = nextDendroTableData;\n }\n store.value.loading.dendroTableData = false;\n }\n }, { immediate: true });\n }\n\n provide(storeKey, store);\n return store;\n}\n\nexport function useStore() {\n return notEmpty(inject<ComputedStore>(storeKey), 'Empty store');\n}\n"],"names":["getInitialOptionsState","chartType","optionsState","defaultState","copyJSON","getInitialStateByType","optionsStateCopy","createReactiveState","initialData","reactive","deepClone","getInitialTemplate","getInitialStatisticsState","getInitialLayersSettings","getInitialAxesSettings","tabKeys","res","formKey","factoryStore","reactiveState","dataStore","inputGuide","chartData","dendroTableData","uniqueValuesData","filterSuggestionsData","filterLabelsInfo","readonlyInputs","defaultPalette","computed","calculateDiscreteGroups","getUsedAesInMapping","getControllerByType","DEFAULT_CATEGORICAL_PALETTE","DEFAULT_CONTINUOUS_PALETTE","provideStore","initialState","dataStoreRef","defaultOptionsRef","fixedOptionsRef","dataColumnPredicate","controller","ref","store","toRaw","watch","ds","defaultOptions","defaultStateMap","defaultOptionsWithoutUserChanges","opt","_a","loadedDefaultSources","loadDefaultSources","inputName","selectedSource","filterType","selectedFilterValues","selectedFilterRange","inputGuideCounter","fixedOptions","counter","ignoredIds","item","nextInputGuide","initialTab","chartDataCounter","ig","loading","nextChartData","loadDataForPlot","uniqueValues","filterSuggestions","getUniqueValuesFromReadyChartData","updateDataBindAes","loadFilterLabelsForTitle","dendroDataCounter","ready","fixed","state","addFixedOptionsToState","nextDendroTableData","provide","storeKey","useStore","notEmpty","inject"],"mappings":";;;;;;;;;;;;;;;;AAqDA,SAASA,GAAuBC,GAAsBC,GAAsC;AAC1F,QAAMC,IAAeC,EAASC,EAAsBJ,CAAS,CAAC;AAC9D,OAAIC,KAAA,gBAAAA,EAAc,UAASD;AACzB,WAAOE;AAET,QAAMG,IAAmBF,EAASF,CAAY;AAE9C,SAAO;AAAA,IACL,GAAGC;AAAA,IACH,GAAGG;AAAA,IACH,YAAY;AAAA,MACV,GAAGH,EAAa;AAAA,MAChB,GAAGG,EAAiB;AAAA,IAAA;AAAA,EACtB;AAEJ;AAEO,SAASC,GACdC,GACAP,GACyB;AACzB,SAAOQ,EAAS;AAAA,IACd,WAAAR;AAAA;AAAA,IAEA,cAAcD,GAAuBC,GAAWO,EAAY,YAAY;AAAA;AAAA,IAExE,cAAcE,EAAUF,EAAY,YAAY;AAAA;AAAA,IAEhD,UAAUG,EAAmBH,EAAY,UAAUP,CAAS;AAAA,IAC5D,oBAAoBW,EAA0BX,GAAWO,EAAY,kBAAkB;AAAA,IACvF,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D,EAAc,cAAcA,EAAc,aAAaK,EAAiB,KAAK;AAAA,IACjG;AACA,IAAAE,EAAiB,QAAQoB,IACrB,MAAM6B;AAAA,MACNxD,EAAc,aAAa;AAAA,MAC3BgD;AAAA,MACA1B;AAAA,MACAK;AAAA,IAAA,IAEA,CAAA,GAGAe,MAAYK,EAAiB,UAC/B5C,EAAU,QAAQ+C,GACdF,EAAG,UACLxB,EAAM,MAAM,QAAQ,gBAAgB,KAEtCA,EAAM,MAAM,QAAQ,YAAY;AAAA,EAEpC,GAAG,EAAE,WAAW,IAAM,MAAM,IAAM,GAG9BxB,EAAc,cAAc,UAAU;AACxC,UAAMyD,IAAoBlC,EAAI,CAAC;AAC/B,IAAAG,EAAM;AAAA,MACJ,MAAM1B,EAAc;AAAA,MACpB,MAAMkB,EAAa;AAAA,MACnB,MAAMhB,EAAW,MAAM;AAAA,MACvB,MAAMkB,EAAgB;AAAA,IAAA,GACrB,OAAO,CAACrC,GAAckB,GAAWyD,GAAOC,CAAK,MAAM;AACpD,UAAID,KAASzD,GAAW;AACtB,QAAAwD,EAAkB;AAClB,cAAMf,IAAUe,EAAkB;AAClC,QAAAjC,EAAM,MAAM,QAAQ,kBAAkB;AACtC,cAAMoC,IAAQ,MAAMC,EAAuB9E,GAAckB,GAAW0D,CAAK,GACnEG,IAAsB,MAAOxC,EAAgD,gBAAgBrB,GAAW2D,CAAK;AAEnH,QAAIH,EAAkB,UAAUf,MAC9BtC,EAAgB,QAAQ0D,IAE1BtC,EAAM,MAAM,QAAQ,kBAAkB;AAAA,MACxC;AAAA,IACF,GAAG,EAAE,WAAW,IAAM;AAAA,EACxB;AAEA,SAAAuC,EAAQC,GAAUxC,CAAK,GAChBA;AACT;AAEO,SAASyC,KAAW;AACzB,SAAOC,EAASC,EAAsBH,CAAQ,GAAG,aAAa;AAChE;"}
|
|
1
|
+
{"version":3,"file":"store.js","sources":["../src/store.ts"],"sourcesContent":["import { deepClone } from '@milaboratories/helpers';\nimport type {\n ChartType,\n DemoDataStore,\n DendroStateController,\n DendroUIState,\n InputGuide,\n InputNamesByChartType,\n InputState,\n PlotDataAndSettings,\n} from '@milaboratories/pf-plots';\nimport {\n getControllerByType,\n getInitialStateByType,\n} from '@milaboratories/pf-plots';\nimport type { PColumnSpec } from '@platforma-sdk/model';\nimport type { CategoricalPalette, ContinuousPalette, Palette } from './components/AesSettings/types';\nimport type { ComputedRef, Reactive, Ref } from 'vue';\nimport { computed, inject, provide, reactive, ref, toRaw, watch } from 'vue';\nimport type {\n AesType } from './constantsCommon';\nimport {\n getInitialAxesSettings,\n getInitialLayersSettings,\n getInitialStatisticsState,\n getInitialTemplate,\n} from './constantsCommon';\nimport { updateDataBindAes } from './dataBindAes';\nimport { notEmpty } from './helpers';\nimport { storeKey } from './keys';\nimport type {\n DefaultPalettes,\n DendroNodeInfo,\n FilterLabelsInfoBySourceMap,\n FilterSuggestionsBySourceMap,\n GraphMakerProps,\n GraphMakerState,\n ReactiveState, UniqueValuesBySourceMap,\n} from './types';\nimport { loadDefaultSources } from './utils';\nimport { addFixedOptionsToState } from './utils/addFixedOptionsToState';\nimport { calculateDiscreteGroups } from './utils/calculateDiscreteGroups';\nimport { copyJSON } from './utils/copyJSON';\nimport { loadDataForPlot } from './utils/createChartSettingsForRender/composeChartSettings';\nimport { getUsedAesInMapping } from './utils/getUsedAesInMapping';\nimport {\n getUniqueValuesFromReadyChartData,\n loadFilterLabelsForTitle,\n} from './utils/loadUniqueValuesToSave';\nimport type { FormKey } from './forms';\nimport { tabKeys } from './forms';\nimport { DEFAULT_CATEGORICAL_PALETTE, DEFAULT_CONTINUOUS_PALETTE } from './constantsAesthetic';\n\nfunction getInitialOptionsState(chartType: ChartType, optionsState: InputState | undefined) {\n const defaultState = copyJSON(getInitialStateByType(chartType));\n if (optionsState?.type !== chartType) {\n return defaultState;\n }\n const optionsStateCopy = copyJSON(optionsState);\n\n return {\n ...defaultState,\n ...optionsStateCopy,\n components: {\n ...defaultState.components,\n ...optionsStateCopy.components,\n },\n };\n}\n\nexport function createReactiveState(\n initialData: GraphMakerState,\n chartType: ChartType,\n): Reactive<ReactiveState> {\n return reactive({\n chartType: chartType,\n // from pf-plots\n optionsState: getInitialOptionsState(chartType, initialData.optionsState), // contains user selected inputs\n\n dataStateKey: deepClone(initialData.dataStateKey),\n // local form states, updates directly in forms\n template: getInitialTemplate(initialData.template, chartType),\n statisticsSettings: getInitialStatisticsState(chartType, initialData.statisticsSettings),\n layersSettings: getInitialLayersSettings(initialData.layersSettings),\n axesSettings: getInitialAxesSettings(chartType, initialData.axesSettings),\n // common aesthetics data mapped on columns/axes values\n dataBindAes: copyJSON(initialData.dataBindAes ?? {}),\n chartScale: initialData.zoomState ?? 100,\n lassoControlsState: null,\n currentTab: null,\n tabDefaultState: tabKeys().reduce((res, formKey: FormKey) => {\n res[formKey] = {};\n return res;\n }, {} as Record<FormKey, Record<string, boolean>>),\n dendroInfoByClick: null as null | DendroNodeInfo,\n dendroSelectedNodeId: null,\n showTooltipHint: false,\n });\n}\n\nexport interface Store {\n reactive: Reactive<ReactiveState>;\n loading: {\n initialInputGuide: boolean;\n initialCharts: boolean;\n initialDefaults: boolean;\n inputGuide: boolean;\n chartData: boolean;\n chartRendering: boolean;\n dendroTableData: boolean;\n };\n commonHelpersData: {\n primaryGroups: ComputedRef<ReturnType<typeof calculateDiscreteGroups>>;\n secondaryGroups: ComputedRef<ReturnType<typeof calculateDiscreteGroups>>;\n usedAesInMapping: ComputedRef<Record<string, Record<AesType, boolean>>>;\n dendroTableData: Ref<Awaited<ReturnType<DendroStateController['createTableData']>> | null>;\n };\n controller: ReturnType<typeof getControllerByType>;\n columnsDataStore: DemoDataStore | null;\n inputGuide: Ref<InputGuide<InputState>>;\n chartData: Ref<PlotDataAndSettings | null>;\n uniqueValuesData: Ref<UniqueValuesBySourceMap>;\n filterSuggestionsData: Ref<FilterSuggestionsBySourceMap>;\n filterLabelsInfo: Ref<FilterLabelsInfoBySourceMap>;\n readonlyInputs?: InputNamesByChartType[ChartType][];\n defaultPalette: DefaultPalettes;\n}\n\nexport function factoryStore(\n reactiveState: Reactive<ReactiveState>,\n dataStore: DemoDataStore | null,\n inputGuide: Ref<InputGuide<InputState>>,\n chartData: Ref<PlotDataAndSettings | null>,\n dendroTableData: Ref<Awaited<ReturnType<DendroStateController['createTableData']>> | null>,\n uniqueValuesData: Ref<UniqueValuesBySourceMap>,\n filterSuggestionsData: Ref<FilterSuggestionsBySourceMap>,\n filterLabelsInfo: Ref<FilterLabelsInfoBySourceMap>,\n readonlyInputs?: InputNamesByChartType[ChartType][],\n defaultPalette?: Palette | { categorical?: Palette; continuous?: Palette },\n): Store {\n return {\n reactive: reactiveState,\n loading: reactive({\n initialInputGuide: true,\n initialCharts: true,\n initialDefaults: true,\n inputGuide: false,\n chartData: false,\n chartRendering: false,\n dendroTableData: false,\n }),\n commonHelpersData: {\n primaryGroups: computed(() => calculateDiscreteGroups(\n reactiveState.optionsState,\n uniqueValuesData.value,\n 'primaryGrouping',\n ),\n ),\n secondaryGroups: computed(() => calculateDiscreteGroups(\n reactiveState.optionsState,\n uniqueValuesData.value,\n 'secondaryGrouping',\n ),\n ),\n usedAesInMapping: computed<Record<string, Record<AesType, boolean>>>(() =>\n getUsedAesInMapping(\n reactiveState.chartType,\n reactiveState.template,\n reactiveState.layersSettings,\n reactiveState.statisticsSettings,\n reactiveState.optionsState,\n inputGuide.value,\n ),\n ),\n dendroTableData,\n },\n controller: getControllerByType(reactiveState.chartType),\n columnsDataStore: dataStore,\n inputGuide,\n chartData,\n uniqueValuesData,\n filterSuggestionsData,\n filterLabelsInfo,\n readonlyInputs,\n defaultPalette: {\n categorical: typeof defaultPalette === 'object' && defaultPalette.categorical\n ? defaultPalette.categorical as CategoricalPalette\n : typeof defaultPalette === 'string' ? defaultPalette as CategoricalPalette : DEFAULT_CATEGORICAL_PALETTE,\n continuous: typeof defaultPalette === 'object' && defaultPalette.continuous\n ? defaultPalette.continuous as ContinuousPalette\n : typeof defaultPalette === 'string' ? defaultPalette as ContinuousPalette : DEFAULT_CONTINUOUS_PALETTE,\n },\n };\n}\n\nexport type ComputedStore = ComputedRef<Store>;\n\nexport function provideStore(\n initialState: GraphMakerState,\n dataStoreRef: Ref<DemoDataStore | null>,\n chartType: ChartType,\n defaultOptionsRef: Ref<GraphMakerProps['defaultOptions']>,\n fixedOptionsRef: Ref<GraphMakerProps['fixedOptions']>,\n dataColumnPredicate?: (spec: PColumnSpec) => boolean,\n readonlyInputs?: InputNamesByChartType[ChartType][],\n defaultPalette?: GraphMakerProps['defaultPalette'],\n) {\n const reactiveState = createReactiveState(initialState, chartType);\n const controller = getControllerByType(reactiveState.chartType);\n\n const inputGuide = ref<InputGuide<InputState>>(getControllerByType(reactiveState.chartType).getEmptyInputGuide(reactiveState.optionsState));\n const chartData = ref<PlotDataAndSettings | null>(null);\n\n const uniqueValuesData = ref<UniqueValuesBySourceMap>({});\n const filterSuggestionsData = ref<FilterSuggestionsBySourceMap>({});\n const filterLabelsInfo = ref<FilterLabelsInfoBySourceMap>({}); // for auto titles of chart if something selected in filter/tabby\n\n const dendroTableData = ref<Awaited<ReturnType<DendroStateController['createTableData']>> | null>(null);\n\n // toRaw removes Vue proxy from dataStore.pframe (PFrame api)\n const store = computed(() => factoryStore(\n reactiveState,\n toRaw(dataStoreRef.value),\n inputGuide,\n chartData,\n dendroTableData,\n uniqueValuesData,\n filterSuggestionsData,\n filterLabelsInfo,\n readonlyInputs,\n defaultPalette,\n ));\n\n watch(() => dataStoreRef.value, () => {\n filterLabelsInfo.value = {};\n uniqueValuesData.value = {};\n filterSuggestionsData.value = {}; // reset saved data; avoid caching of empty results from old empty pframe\n });\n watch([\n () => dataStoreRef.value,\n () => defaultOptionsRef.value,\n ], async ([ds, defaultOptions]) => {\n if (!defaultOptions || !ds || !store.value.loading.initialDefaults) {\n return;\n }\n store.value.loading.initialDefaults = false; // to avoid multiple calculations, default settings cannot change except after reset\n store.value.loading.initialInputGuide = true; // to show loader on initial loading; changing of reactiveState.optionsState always triggers inputGuide recalculating, so it will be off after inputGuide\n\n const defaultStateMap = copyJSON(reactiveState.optionsState.components);\n const defaultOptionsWithoutUserChanges = defaultOptions.filter((opt) => {\n const res = reactiveState.optionsState.components[opt.inputName]?.selectorStates.length === 0\n || readonlyInputs?.includes(opt.inputName);\n return res;\n });\n if (defaultOptionsWithoutUserChanges.length === 0) {\n return;\n }\n defaultOptionsWithoutUserChanges.forEach((opt) => {\n defaultStateMap[opt.inputName].selectorStates = [];\n });\n const loadedDefaultSources = await loadDefaultSources(ds, defaultOptionsWithoutUserChanges);\n for (const {\n inputName,\n selectedSource,\n filterType,\n selectedFilterValues,\n selectedFilterRange,\n } of loadedDefaultSources) {\n defaultStateMap[inputName].selectorStates.push({\n selectedSource,\n type: filterType,\n selectedFilterValues,\n selectedFilterRange,\n });\n }\n\n reactiveState.optionsState.components = {\n ...reactiveState.optionsState.components,\n ...defaultStateMap,\n };\n }, { immediate: true });\n\n // recalculate input guide - options for every data input, consistency info etc\n const inputGuideCounter = ref(0); // to avoid race condition on async calculations\n watch([\n () => reactiveState.optionsState,\n () => dataStoreRef.value,\n () => fixedOptionsRef.value,\n ], async ([optionsState, ds, fixedOptions]) => {\n inputGuideCounter.value++;\n const counter = inputGuideCounter.value;\n store.value.loading.inputGuide = true;\n const ignoredIds = ds && fixedOptions ? (await loadDefaultSources(ds, fixedOptions, false)).map((item) => item.selectedSource) : [];\n\n // const start = Date.now();\n const nextInputGuide = ds ? await controller.calculateOptions(toRaw(ds), optionsState, ignoredIds, dataColumnPredicate) : controller.getEmptyInputGuide(optionsState);\n // console.log('input guide', Date.now() - start);\n\n if (counter === inputGuideCounter.value) { // race condition check\n inputGuide.value = nextInputGuide;\n\n store.value.loading.inputGuide = false;\n if (store.value.loading.initialInputGuide) { // open default/saved tab only after inputGuide loading\n store.value.loading.initialInputGuide = false;\n const initialTab = initialState.currentTab === undefined ? 'dataMapping' : initialState.currentTab;\n store.value.reactive.currentTab = store.value.reactive.currentTab ?? initialTab;\n }\n }\n }, { immediate: true, deep: true });\n\n // recalculate data for chart rendering (miplots4)\n const chartDataCounter = ref(0); // to avoid race condition on async calculations\n watch(() => inputGuide.value, async (ig) => {\n chartDataCounter.value++;\n const counter = chartDataCounter.value;\n\n const loading = setTimeout(() => {\n store.value.loading.chartData = true;\n }, 300);\n\n const ds = toRaw(dataStoreRef.value);\n // const start = Date.now();\n const nextChartData = await loadDataForPlot(ig, reactiveState, ds, fixedOptionsRef.value);\n clearTimeout(loading);\n\n if (nextChartData && ds) {\n const { uniqueValues, filterSuggestions } = await getUniqueValuesFromReadyChartData(\n nextChartData, ig, reactiveState.optionsState.components, controller, ds, toRaw(filterSuggestionsData.value),\n );\n uniqueValuesData.value = uniqueValues;\n filterSuggestionsData.value = filterSuggestions;\n updateDataBindAes(reactiveState.optionsState, reactiveState.dataBindAes, uniqueValuesData.value);\n }\n filterLabelsInfo.value = ds\n ? await loadFilterLabelsForTitle(\n reactiveState.optionsState.components,\n ig,\n controller,\n ds,\n )\n : {};\n // console.log('chart data', Date.now() - start);\n\n if (counter === chartDataCounter.value) { // race condition check\n chartData.value = nextChartData;\n if (ig.ready) {\n store.value.loading.initialCharts = false;\n }\n store.value.loading.chartData = false;\n }\n }, { immediate: true, deep: true });\n\n // watch data for table, only dendro chart; data is also using for popup by tree node click\n if (reactiveState.chartType === 'dendro') {\n const dendroDataCounter = ref(0); // to avoid race condition on async calculations\n watch([\n () => reactiveState.optionsState as DendroUIState,\n () => dataStoreRef.value,\n () => inputGuide.value.readyData,\n () => fixedOptionsRef.value,\n ], async ([optionsState, dataStore, ready, fixed]) => {\n if (ready && dataStore) {\n dendroDataCounter.value++;\n const counter = dendroDataCounter.value;\n store.value.loading.dendroTableData = true;\n const state = await addFixedOptionsToState(optionsState, dataStore, fixed) as DendroUIState;\n const nextDendroTableData = await (controller as unknown as DendroStateController).createTableData(dataStore, state);\n\n if (dendroDataCounter.value === counter) {\n dendroTableData.value = nextDendroTableData;\n }\n store.value.loading.dendroTableData = false;\n }\n }, { immediate: true });\n }\n\n provide(storeKey, store);\n return store;\n}\n\nexport function useStore() {\n return notEmpty(inject<ComputedStore>(storeKey), 'Empty store');\n}\n"],"names":["getInitialOptionsState","chartType","optionsState","defaultState","copyJSON","getInitialStateByType","optionsStateCopy","createReactiveState","initialData","reactive","deepClone","getInitialTemplate","getInitialStatisticsState","getInitialLayersSettings","getInitialAxesSettings","tabKeys","res","formKey","factoryStore","reactiveState","dataStore","inputGuide","chartData","dendroTableData","uniqueValuesData","filterSuggestionsData","filterLabelsInfo","readonlyInputs","defaultPalette","computed","calculateDiscreteGroups","getUsedAesInMapping","getControllerByType","DEFAULT_CATEGORICAL_PALETTE","DEFAULT_CONTINUOUS_PALETTE","provideStore","initialState","dataStoreRef","defaultOptionsRef","fixedOptionsRef","dataColumnPredicate","controller","ref","store","toRaw","watch","ds","defaultOptions","defaultStateMap","defaultOptionsWithoutUserChanges","opt","_a","loadedDefaultSources","loadDefaultSources","inputName","selectedSource","filterType","selectedFilterValues","selectedFilterRange","inputGuideCounter","fixedOptions","counter","ignoredIds","item","nextInputGuide","initialTab","chartDataCounter","ig","loading","nextChartData","loadDataForPlot","uniqueValues","filterSuggestions","getUniqueValuesFromReadyChartData","updateDataBindAes","loadFilterLabelsForTitle","dendroDataCounter","ready","fixed","state","addFixedOptionsToState","nextDendroTableData","provide","storeKey","useStore","notEmpty","inject"],"mappings":";;;;;;;;;;;;;;;;AAqDA,SAASA,GAAuBC,GAAsBC,GAAsC;AAC1F,QAAMC,IAAeC,EAASC,EAAsBJ,CAAS,CAAC;AAC9D,OAAIC,KAAA,gBAAAA,EAAc,UAASD;AACzB,WAAOE;AAET,QAAMG,IAAmBF,EAASF,CAAY;AAE9C,SAAO;AAAA,IACL,GAAGC;AAAA,IACH,GAAGG;AAAA,IACH,YAAY;AAAA,MACV,GAAGH,EAAa;AAAA,MAChB,GAAGG,EAAiB;AAAA,IAAA;AAAA,EACtB;AAEJ;AAEO,SAASC,GACdC,GACAP,G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xB;AAEA,SAAAuC,EAAQC,GAAUxC,CAAK,GAChBA;AACT;AAEO,SAASyC,KAAW;AACzB,SAAOC,EAASC,EAAsBH,CAAQ,GAAG,aAAa;AAChE;"}
|
package/dist/types.d.ts
CHANGED
|
@@ -127,6 +127,10 @@ export type FilterSuggestionsBySourceMap = Record<string, {
|
|
|
127
127
|
}[];
|
|
128
128
|
overflow: boolean;
|
|
129
129
|
}>;
|
|
130
|
+
export type FilterLabelsInfoBySourceMap = Record<string, Record<string, {
|
|
131
|
+
value: unknown;
|
|
132
|
+
label: string;
|
|
133
|
+
}>>;
|
|
130
134
|
export type GraphStatus = 'notReady' | 'empty' | 'inconsistent' | 'ready' | 'unknownError' | 'knownError' | 'loading';
|
|
131
135
|
export type DefaultPalettes = {
|
|
132
136
|
categorical: CategoricalPalette;
|
|
@@ -117,7 +117,7 @@ export declare function composeBubbleSettings(settings: BubbleSettings, reactive
|
|
|
117
117
|
aggregation?: {
|
|
118
118
|
x?: boolean | undefined;
|
|
119
119
|
y?: boolean | undefined;
|
|
120
|
-
method?: "
|
|
120
|
+
method?: "sum" | "mean" | "median" | "min" | "max" | undefined;
|
|
121
121
|
} | undefined;
|
|
122
122
|
NAValueAs?: number | null | undefined;
|
|
123
123
|
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { DemoDataStore, InputGuide, InputState, PlotDataAndSettings } from '@milaboratories/pf-plots';
|
|
2
2
|
import { DefaultPalettes, GraphMakerProps, ReactiveState, UniqueValuesBySourceMap } from '../../types';
|
|
3
3
|
import { DataByColumns, Settings } from '@milaboratories/miplots4';
|
|
4
|
-
import { ListOption } from '@platforma-sdk/ui-vue';
|
|
5
4
|
export declare function loadDataForPlot(inputGuide: InputGuide<InputState>, reactiveState: ReactiveState, dataStore: DemoDataStore | null, fixedOptions?: GraphMakerProps['fixedOptions']): Promise<PlotDataAndSettings | null>;
|
|
6
|
-
export declare function composeChartSettings(chartData: PlotDataAndSettings | null, inputGuide: InputGuide<InputState>, labelsInfo: UniqueValuesBySourceMap, filterLabelsInfo: Record<string,
|
|
5
|
+
export declare function composeChartSettings(chartData: PlotDataAndSettings | null, inputGuide: InputGuide<InputState>, labelsInfo: UniqueValuesBySourceMap, filterLabelsInfo: Record<string, Record<string, {
|
|
6
|
+
value: unknown;
|
|
7
|
+
label: string;
|
|
8
|
+
}>>, reactiveState: ReactiveState, defaultPalette: DefaultPalettes): null | {
|
|
7
9
|
settings: Settings;
|
|
8
10
|
data: DataByColumns;
|
|
9
11
|
};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { getControllerByType as d } from "@milaboratories/pf-plots";
|
|
2
|
-
import { addFixedOptionsToState as
|
|
3
|
-
import { DEFAULT_HEIGHT_SMALL as y, DEFAULT_HEIGHT as
|
|
4
|
-
import { composeDiscreteSettings as
|
|
5
|
-
import { composeScatterplotSettings as
|
|
2
|
+
import { addFixedOptionsToState as T } from "../addFixedOptionsToState.js";
|
|
3
|
+
import { DEFAULT_HEIGHT_SMALL as y, DEFAULT_HEIGHT as w, DEFAULT_WIDTH_SMALL as b, DEFAULT_WIDTH as C } from "../../constantsCommon.js";
|
|
4
|
+
import { composeDiscreteSettings as H } from "./composeDiscreteSettings.js";
|
|
5
|
+
import { composeScatterplotSettings as a } from "./composeScatterplotSettings.js";
|
|
6
6
|
import { composeScatterplotUmapSettings as D } from "./composeScatterplotUmapSettings.js";
|
|
7
7
|
import { composeHeatmapSettings as E } from "./composeHeatmapSettings.js";
|
|
8
8
|
import { composeDendroSettings as F } from "./composeDendroSettings.js";
|
|
9
|
-
import { composeHistogramSettings as
|
|
10
|
-
import { composeBubbleSettings as
|
|
9
|
+
import { composeHistogramSettings as L } from "./composeHistogramSettings.js";
|
|
10
|
+
import { composeBubbleSettings as A } from "./composeBubbleSettings.js";
|
|
11
11
|
function _(s, n = 0) {
|
|
12
12
|
return {
|
|
13
|
-
width: (n > 0 ? b :
|
|
14
|
-
height: (n > 0 ? y :
|
|
13
|
+
width: (n > 0 ? b : C) * (s / 100),
|
|
14
|
+
height: (n > 0 ? y : w) * (s / 100)
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
17
|
function B(s, n, r, i) {
|
|
@@ -23,24 +23,24 @@ function B(s, n, r, i) {
|
|
|
23
23
|
if (i.title.mode === "custom")
|
|
24
24
|
return { name: i.title.value, show: !0, position: i.title.position };
|
|
25
25
|
if (i.title.mode === "auto") {
|
|
26
|
-
const t = [], p = ((o = n.components) == null ? void 0 : o.tabBy.selectorStates) ?? [],
|
|
26
|
+
const t = [], p = ((o = n.components) == null ? void 0 : o.tabBy.selectorStates) ?? [], e = (((m = n.components) == null ? void 0 : m.filters.selectorStates) ?? []).filter((l) => !p.some((c) => c.selectedSource === l.selectedSource));
|
|
27
27
|
return [
|
|
28
28
|
...p,
|
|
29
|
-
...
|
|
30
|
-
].forEach(({ type:
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
29
|
+
...e
|
|
30
|
+
].forEach(({ type: l, selectedSource: c, selectedFilterValues: h }) => {
|
|
31
|
+
(!l || l === "equals") && h && r[c] && t.push(...h.map((f) => {
|
|
32
|
+
var u, g;
|
|
33
|
+
return ((g = (u = r[c]) == null ? void 0 : u[f]) == null ? void 0 : g.label) ?? String(f);
|
|
34
|
+
}));
|
|
35
35
|
}), { name: t.join(", "), show: !0, position: i.title.position };
|
|
36
36
|
}
|
|
37
37
|
return { name: "", show: !1 };
|
|
38
38
|
}
|
|
39
|
-
async function
|
|
39
|
+
async function K(s, n, r, i) {
|
|
40
40
|
if (!s.ready || r === null)
|
|
41
41
|
return null;
|
|
42
42
|
try {
|
|
43
|
-
const o = d(n.chartType), m = await
|
|
43
|
+
const o = d(n.chartType), m = await T(
|
|
44
44
|
n.optionsState,
|
|
45
45
|
r,
|
|
46
46
|
i
|
|
@@ -53,19 +53,19 @@ async function N(s, n, r, i) {
|
|
|
53
53
|
return console.warn("Cant build chart data"), console.warn(o.message), null;
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
function
|
|
57
|
-
var
|
|
56
|
+
function N(s, n, r, i, o, m) {
|
|
57
|
+
var e;
|
|
58
58
|
if (!n.ready || s === null)
|
|
59
59
|
return null;
|
|
60
60
|
let t = { ...s.settings };
|
|
61
61
|
const p = s.data.byColumns;
|
|
62
|
-
return t.title = B(o.chartType, o.optionsState, i, o.axesSettings), t.size = _(o.chartScale, ((
|
|
62
|
+
return t.title = B(o.chartType, o.optionsState, i, o.axesSettings), t.size = _(o.chartScale, ((e = o.optionsState.components) == null ? void 0 : e.facetBy.selectorStates.length) || 0), t.legend = { show: o.axesSettings.other.showLegend }, o.chartType === "discrete" && (t = H(t, o, r, n, m)), o.chartType === "scatterplot" && (t = a(t, p, o, n, r, m)), o.chartType === "scatterplot-umap" && (t = D(t, p, o, n, r, m)), o.chartType === "heatmap" && (t = E(t, o, m)), o.chartType === "dendro" && (t = F(t, p, o, n, r)), o.chartType === "histogram" && (t = L(t, o, r, m)), o.chartType === "bubble" && (t = A(t, o, m)), {
|
|
63
63
|
settings: t,
|
|
64
64
|
data: s.data.byColumns
|
|
65
65
|
};
|
|
66
66
|
}
|
|
67
67
|
export {
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
N as composeChartSettings,
|
|
69
|
+
K as loadDataForPlot
|
|
70
70
|
};
|
|
71
71
|
//# sourceMappingURL=composeChartSettings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composeChartSettings.js","sources":["../../../src/utils/createChartSettingsForRender/composeChartSettings.ts"],"sourcesContent":["import type {\n ChartType,\n DemoDataStore,\n InputGuide,\n InputState,\n PlotDataAndSettings,\n SelectorStateFilter,\n} from '@milaboratories/pf-plots';\nimport {\n getControllerByType,\n} from '@milaboratories/pf-plots';\nimport type {\n DefaultPalettes,\n GraphMakerProps,\n ReactiveState,\n TitlePosition,\n UniqueValuesBySourceMap,\n} from '../../types';\nimport { addFixedOptionsToState } from '../addFixedOptionsToState';\nimport type {\n AxesState } from '../../constantsCommon';\nimport { DEFAULT_HEIGHT, DEFAULT_HEIGHT_SMALL, DEFAULT_WIDTH, DEFAULT_WIDTH_SMALL,\n} from '../../constantsCommon';\nimport type {\n BubbleSettings,\n DataByColumns,\n DendroSettings,\n DiscreteSettings,\n HeatmapSettings,\n HistogramSettings,\n ScatterplotSettings,\n ScatterplotUmapSettings,\n Settings,\n} from '@milaboratories/miplots4';\nimport { composeDiscreteSettings } from './composeDiscreteSettings';\nimport { composeScatterplotSettings } from './composeScatterplotSettings';\nimport { composeScatterplotUmapSettings } from './composeScatterplotUmapSettings';\nimport { composeHeatmapSettings } from './composeHeatmapSettings';\nimport { composeDendroSettings } from './composeDendroSettings';\nimport { composeHistogramSettings } from './composeHistogramSettings';\nimport { composeBubbleSettings } from './composeBubbleSettings';\
|
|
1
|
+
{"version":3,"file":"composeChartSettings.js","sources":["../../../src/utils/createChartSettingsForRender/composeChartSettings.ts"],"sourcesContent":["import type {\n ChartType,\n DemoDataStore,\n InputGuide,\n InputState,\n PlotDataAndSettings,\n SelectorStateFilter,\n} from '@milaboratories/pf-plots';\nimport {\n getControllerByType,\n} from '@milaboratories/pf-plots';\nimport type {\n DefaultPalettes,\n GraphMakerProps,\n ReactiveState,\n TitlePosition,\n UniqueValuesBySourceMap,\n} from '../../types';\nimport { addFixedOptionsToState } from '../addFixedOptionsToState';\nimport type {\n AxesState } from '../../constantsCommon';\nimport { DEFAULT_HEIGHT, DEFAULT_HEIGHT_SMALL, DEFAULT_WIDTH, DEFAULT_WIDTH_SMALL,\n} from '../../constantsCommon';\nimport type {\n BubbleSettings,\n DataByColumns,\n DendroSettings,\n DiscreteSettings,\n HeatmapSettings,\n HistogramSettings,\n ScatterplotSettings,\n ScatterplotUmapSettings,\n Settings,\n} from '@milaboratories/miplots4';\nimport { composeDiscreteSettings } from './composeDiscreteSettings';\nimport { composeScatterplotSettings } from './composeScatterplotSettings';\nimport { composeScatterplotUmapSettings } from './composeScatterplotUmapSettings';\nimport { composeHeatmapSettings } from './composeHeatmapSettings';\nimport { composeDendroSettings } from './composeDendroSettings';\nimport { composeHistogramSettings } from './composeHistogramSettings';\nimport { composeBubbleSettings } from './composeBubbleSettings';\n\nfunction getChartSizes(chartScale: number, facetByLength = 0) {\n return {\n width: (facetByLength > 0 ? DEFAULT_WIDTH_SMALL : DEFAULT_WIDTH) * (chartScale / 100),\n height: (facetByLength > 0 ? DEFAULT_HEIGHT_SMALL : DEFAULT_HEIGHT) * (chartScale / 100),\n };\n}\n\nfunction getChartTitle(\n chartType: ChartType,\n optionsState: InputState,\n filterLabelsInfo: Record<string, Record<string, { value: unknown; label: string }>>,\n axesSettings: AxesState,\n): {\n name: string;\n show: boolean;\n position?: TitlePosition;\n } {\n if (\n chartType !== 'scatterplot'\n && chartType !== 'scatterplot-umap'\n && chartType !== 'discrete'\n && chartType !== 'heatmap'\n && chartType !== 'histogram'\n && chartType !== 'bubble'\n ) {\n return { name: '', show: false };\n }\n if (axesSettings.title.mode === 'hidden') {\n return { name: '', show: false };\n }\n if (axesSettings.title.mode === 'custom') {\n return { name: axesSettings.title.value, show: true, position: axesSettings.title.position };\n }\n if (axesSettings.title.mode === 'auto') {\n const selectedFilters: string[] = [];\n const tabByStates = (optionsState.components?.tabBy.selectorStates ?? []);\n const filterStates = (optionsState.components?.filters.selectorStates ?? []).filter((state) => !tabByStates.some((tabByState) => tabByState.selectedSource === state.selectedSource));\n\n const usedInTitleStates = [\n ...tabByStates,\n ...filterStates,\n ] as SelectorStateFilter[];\n usedInTitleStates.forEach(({ type, selectedSource, selectedFilterValues }) => {\n if ((!type || type === 'equals') && selectedFilterValues && filterLabelsInfo[selectedSource]) {\n selectedFilters.push(...selectedFilterValues\n .map((selectedFilterValue) => filterLabelsInfo[selectedSource]?.[selectedFilterValue]?.label ?? String(selectedFilterValue)));\n }\n });\n const title = selectedFilters.join(', ');\n return { name: title, show: true, position: axesSettings.title.position };\n }\n return { name: '', show: false };\n}\n\nexport async function loadDataForPlot(\n inputGuide: InputGuide<InputState>,\n reactiveState: ReactiveState,\n dataStore: DemoDataStore | null,\n fixedOptions?: GraphMakerProps['fixedOptions'],\n) {\n if (!inputGuide.ready || dataStore === null) {\n return null;\n }\n try {\n const controller = getControllerByType(reactiveState.chartType);\n const optionsStateWithFixed = await addFixedOptionsToState(\n reactiveState.optionsState,\n dataStore,\n fixedOptions,\n );\n return controller.createDataForPlot(\n dataStore,\n optionsStateWithFixed,\n );\n } catch (err) {\n console.warn('Cant build chart data');\n console.warn((err as Error).message);\n return null;\n }\n}\nexport function composeChartSettings(\n chartData: PlotDataAndSettings | null,\n inputGuide: InputGuide<InputState>,\n labelsInfo: UniqueValuesBySourceMap,\n filterLabelsInfo: Record<string, Record<string, { value: unknown; label: string }>>,\n reactiveState: ReactiveState,\n defaultPalette: DefaultPalettes,\n): null | { settings: Settings; data: DataByColumns } {\n if (!inputGuide.ready || chartData === null) {\n return null;\n }\n\n let settings = { ...chartData.settings };\n const dataByColumns = chartData.data.byColumns;\n settings.title = getChartTitle(reactiveState.chartType, reactiveState.optionsState, filterLabelsInfo, reactiveState.axesSettings);\n settings.size = getChartSizes(reactiveState.chartScale, reactiveState.optionsState.components?.facetBy.selectorStates.length || 0);\n settings.legend = { show: reactiveState.axesSettings.other.showLegend };\n if (reactiveState.chartType === 'discrete') {\n settings = composeDiscreteSettings(settings as DiscreteSettings, reactiveState, labelsInfo, inputGuide, defaultPalette);\n }\n if (reactiveState.chartType === 'scatterplot') {\n settings = composeScatterplotSettings(settings as ScatterplotSettings, dataByColumns, reactiveState, inputGuide, labelsInfo, defaultPalette);\n }\n if (reactiveState.chartType === 'scatterplot-umap') {\n settings = composeScatterplotUmapSettings(settings as ScatterplotUmapSettings, dataByColumns, reactiveState, inputGuide, labelsInfo, defaultPalette);\n }\n if (reactiveState.chartType === 'heatmap') {\n settings = composeHeatmapSettings(settings as HeatmapSettings, reactiveState, defaultPalette);\n }\n if (reactiveState.chartType === 'dendro') {\n settings = composeDendroSettings(settings as DendroSettings, dataByColumns, reactiveState, inputGuide, labelsInfo);\n }\n if (reactiveState.chartType === 'histogram') {\n settings = composeHistogramSettings(settings as HistogramSettings, reactiveState, labelsInfo, defaultPalette);\n }\n if (reactiveState.chartType === 'bubble') {\n settings = composeBubbleSettings(settings as BubbleSettings, reactiveState, defaultPalette);\n }\n return {\n settings: settings as Settings,\n data: chartData.data.byColumns,\n };\n}\n"],"names":["getChartSizes","chartScale","facetByLength","DEFAULT_WIDTH_SMALL","DEFAULT_WIDTH","DEFAULT_HEIGHT_SMALL","DEFAULT_HEIGHT","getChartTitle","chartType","optionsState","filterLabelsInfo","axesSettings","selectedFilters","tabByStates","_a","filterStates","_b","state","tabByState","type","selectedSource","selectedFilterValues","selectedFilterValue","loadDataForPlot","inputGuide","reactiveState","dataStore","fixedOptions","controller","getControllerByType","optionsStateWithFixed","addFixedOptionsToState","err","composeChartSettings","chartData","labelsInfo","defaultPalette","settings","dataByColumns","composeDiscreteSettings","composeScatterplotSettings","composeScatterplotUmapSettings","composeHeatmapSettings","composeDendroSettings","composeHistogramSettings","composeBubbleSettings"],"mappings":";;;;;;;;;;AA0CA,SAASA,EAAcC,GAAoBC,IAAgB,GAAG;AAC5D,SAAO;AAAA,IACL,QAAQA,IAAgB,IAAIC,IAAsBC,MAAkBH,IAAa;AAAA,IACjF,SAASC,IAAgB,IAAIG,IAAuBC,MAAmBL,IAAa;AAAA,EAAA;AAExF;AAEA,SAASM,EACPC,GACAC,GACAC,GACAC,GAKE;;AACF,MACEH,MAAc,iBACXA,MAAc,sBACdA,MAAc,cACdA,MAAc,aACdA,MAAc,eACdA,MAAc;AAEjB,WAAO,EAAE,MAAM,IAAI,MAAM,GAAA;AAE3B,MAAIG,EAAa,MAAM,SAAS;AAC9B,WAAO,EAAE,MAAM,IAAI,MAAM,GAAA;AAE3B,MAAIA,EAAa,MAAM,SAAS;AAC9B,WAAO,EAAE,MAAMA,EAAa,MAAM,OAAO,MAAM,IAAM,UAAUA,EAAa,MAAM,SAAA;AAEpF,M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dC,GACAV,GACAW,GACAzB,GACAe,GACAW,GACoD;;AACpD,MAAI,CAACZ,EAAW,SAASU,MAAc;AACrC,WAAO;AAGT,MAAIG,IAAW,EAAE,GAAGH,EAAU,SAAA;AAC9B,QAAMI,IAAgBJ,EAAU,KAAK;AACrC,SAAAG,EAAS,QAAQ9B,EAAckB,EAAc,WAAWA,EAAc,cAAcf,GAAkBe,EAAc,YAAY,GAChIY,EAAS,OAAOrC,EAAcyB,EAAc,cAAYX,IAAAW,EAAc,aAAa,eAA3B,gBAAAX,EAAuC,QAAQ,eAAe,WAAU,CAAC,GACjIuB,EAAS,SAAS,EAAE,MAAMZ,EAAc,aAAa,MAAM,WAAA,GACvDA,EAAc,cAAc,eAC9BY,IAAWE,EAAwBF,GAA8BZ,GAAeU,GAAYX,GAAYY,CAAc,IAEpHX,EAAc,cAAc,kBAC9BY,IAAWG,EAA2BH,GAAiCC,GAAeb,GAAeD,GAAYW,GAAYC,CAAc,IAEzIX,EAAc,cAAc,uBAC9BY,IAAWI,EAA+BJ,GAAqCC,GAAeb,GAAeD,GAAYW,GAAYC,CAAc,IAEjJX,EAAc,cAAc,cAC9BY,IAAWK,EAAuBL,GAA6BZ,GAAeW,CAAc,IAE1FX,EAAc,cAAc,aAC9BY,IAAWM,EAAsBN,GAA4BC,GAAeb,GAAeD,GAAYW,CAAU,IAE/GV,EAAc,cAAc,gBAC9BY,IAAWO,EAAyBP,GAA+BZ,GAAeU,GAAYC,CAAc,IAE1GX,EAAc,cAAc,aAC9BY,IAAWQ,EAAsBR,GAA4BZ,GAAeW,CAAc,IAErF;AAAA,IACL,UAAAC;AAAA,IACA,MAAMH,EAAU,KAAK;AAAA,EAAA;AAEzB;"}
|
|
@@ -85,7 +85,7 @@ export declare function composeDiscreteSettings(settings: DiscreteSettings, reac
|
|
|
85
85
|
} | undefined;
|
|
86
86
|
} | {
|
|
87
87
|
type: "line";
|
|
88
|
-
pointsValues: "mean" | "median";
|
|
88
|
+
pointsValues: "sum" | "mean" | "median" | "min" | "max";
|
|
89
89
|
aes?: {
|
|
90
90
|
dotShape?: "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "13" | "14" | "15" | "16" | "17" | "18" | "20" | "21" | "22" | "23" | "24" | "25" | {
|
|
91
91
|
type: "primaryGrouping" | "secondaryGrouping";
|
|
@@ -107,7 +107,7 @@ export declare function composeDiscreteSettings(settings: DiscreteSettings, reac
|
|
|
107
107
|
emptyGroupValue?: number | undefined;
|
|
108
108
|
} | {
|
|
109
109
|
type: "errorbar";
|
|
110
|
-
pointsValues: "mean" | "median";
|
|
110
|
+
pointsValues: "sum" | "mean" | "median" | "min" | "max";
|
|
111
111
|
interval: "sd" | "se" | "ci";
|
|
112
112
|
aes?: {
|
|
113
113
|
dotShape?: "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "13" | "14" | "15" | "16" | "17" | "18" | "20" | "21" | "22" | "23" | "24" | "25" | {
|
|
@@ -138,7 +138,7 @@ export declare function composeDiscreteSettings(settings: DiscreteSettings, reac
|
|
|
138
138
|
type: "primaryGrouping" | "secondaryGrouping";
|
|
139
139
|
} | undefined;
|
|
140
140
|
} | undefined;
|
|
141
|
-
height?: "
|
|
141
|
+
height?: "sum" | "mean" | "median" | "min" | "max" | undefined;
|
|
142
142
|
} | {
|
|
143
143
|
type: "stackedBar";
|
|
144
144
|
aes?: {
|
|
@@ -152,7 +152,7 @@ export declare function composeDiscreteSettings(settings: DiscreteSettings, reac
|
|
|
152
152
|
type: "primaryGrouping" | "secondaryGrouping";
|
|
153
153
|
} | undefined;
|
|
154
154
|
} | undefined;
|
|
155
|
-
height?: "
|
|
155
|
+
height?: "sum" | "mean" | "median" | "min" | "max" | undefined;
|
|
156
156
|
normalize?: boolean | undefined;
|
|
157
157
|
} | {
|
|
158
158
|
type: "binnedDots";
|
|
@@ -237,7 +237,7 @@ export declare function composeDiscreteSettings(settings: DiscreteSettings, reac
|
|
|
237
237
|
barsOpacity?: number | undefined;
|
|
238
238
|
areaOpacity?: number | undefined;
|
|
239
239
|
} | undefined;
|
|
240
|
-
height?: "
|
|
240
|
+
height?: "sum" | "mean" | "median" | "min" | "max" | undefined;
|
|
241
241
|
normalize?: boolean | undefined;
|
|
242
242
|
showBars?: boolean | undefined;
|
|
243
243
|
} | {
|
|
@@ -376,6 +376,7 @@ export declare function composeDiscreteSettings(settings: DiscreteSettings, reac
|
|
|
376
376
|
fillColor?: string | undefined;
|
|
377
377
|
}> | undefined;
|
|
378
378
|
allowNullGroup?: boolean | undefined;
|
|
379
|
+
unlimitedGroupsCount?: boolean | undefined;
|
|
379
380
|
} | undefined;
|
|
380
381
|
secondaryGrouping?: {
|
|
381
382
|
columnName: {
|
|
@@ -396,6 +397,7 @@ export declare function composeDiscreteSettings(settings: DiscreteSettings, reac
|
|
|
396
397
|
fillColor?: string | undefined;
|
|
397
398
|
}> | undefined;
|
|
398
399
|
allowNullGroup?: boolean | undefined;
|
|
400
|
+
unlimitedGroupsCount?: boolean | undefined;
|
|
399
401
|
} | undefined;
|
|
400
402
|
orientation?: "vertical" | "horizontal" | undefined;
|
|
401
403
|
};
|
|
@@ -123,7 +123,7 @@ export declare function composeHeatmapSettings(settings: HeatmapSettings, reacti
|
|
|
123
123
|
aggregation?: {
|
|
124
124
|
x?: boolean | undefined;
|
|
125
125
|
y?: boolean | undefined;
|
|
126
|
-
method?: "
|
|
126
|
+
method?: "sum" | "mean" | "median" | "min" | "max" | undefined;
|
|
127
127
|
} | undefined;
|
|
128
128
|
NAValueAs?: number | null | undefined;
|
|
129
129
|
valueType?: "continuous" | "discrete" | undefined;
|
|
@@ -2,8 +2,9 @@ import { ScatterplotSettings, ScatterplotUmapSettings } from '@milaboratories/mi
|
|
|
2
2
|
import { ComponentStateFilter, ComponentStateSimple, InputGuide, InputState, PlotDataAndSettings } from '@milaboratories/pf-plots';
|
|
3
3
|
import { AestheticMappingState } from '../../dataBindAes';
|
|
4
4
|
import { DefaultPalettes, ReactiveState, UniqueValuesBySourceMap } from '../../types';
|
|
5
|
+
import { Palette } from '../../components/AesSettings/types';
|
|
5
6
|
export declare function applyChartInfoFromAnnotations(settings: ScatterplotSettings | ScatterplotUmapSettings, grouping: ComponentStateSimple | ComponentStateFilter, x: ComponentStateSimple | ComponentStateFilter, y: ComponentStateSimple | ComponentStateFilter, inputGuide: InputGuide<InputState>): void;
|
|
6
|
-
export declare function applyInheritedAes(settings: ScatterplotSettings | ScatterplotUmapSettings, grouping: ComponentStateSimple | ComponentStateFilter, shape: ComponentStateSimple | ComponentStateFilter | undefined, uniqueValuesData: UniqueValuesBySourceMap, dataBindAes: AestheticMappingState, defaultPalette:
|
|
7
|
+
export declare function applyInheritedAes(settings: ScatterplotSettings | ScatterplotUmapSettings, grouping: ComponentStateSimple | ComponentStateFilter, shape: ComponentStateSimple | ComponentStateFilter | undefined, uniqueValuesData: UniqueValuesBySourceMap, dataBindAes: AestheticMappingState, defaultPalette: Palette): void;
|
|
7
8
|
export declare function composeScatterplotSettings(settings: ScatterplotSettings, dataByColumns: PlotDataAndSettings['data']['byColumns'], reactiveState: ReactiveState, inputGuide: InputGuide<InputState>, uniqueValuesData: UniqueValuesBySourceMap, defaultPalette: DefaultPalettes): {
|
|
8
9
|
type: "scatterplot";
|
|
9
10
|
title: {
|