@milaboratories/graph-maker 1.1.192 → 1.1.194
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/constantsAesthetic.d.ts +0 -1
- package/dist/constantsAesthetic.js +16 -17
- package/dist/constantsAesthetic.js.map +1 -1
- package/dist/constantsCommon.d.ts +4 -0
- package/dist/constantsCommon.js +21 -17
- package/dist/constantsCommon.js.map +1 -1
- package/dist/dataBindAes.d.ts +5 -5
- package/dist/dataBindAes.js +110 -110
- package/dist/dataBindAes.js.map +1 -1
- package/dist/forms/AxesSettingsForm/DiscreteAxesSettingsForm.vue.js +154 -144
- package/dist/forms/AxesSettingsForm/DiscreteAxesSettingsForm.vue.js.map +1 -1
- package/dist/forms/AxesSettingsForm/HeatmapAxesSettingsForm.vue.js +263 -193
- package/dist/forms/AxesSettingsForm/HeatmapAxesSettingsForm.vue.js.map +1 -1
- package/dist/forms/LayersForm/AesSelector.vue.js +59 -59
- package/dist/forms/LayersForm/AesSelector.vue.js.map +1 -1
- package/dist/forms/LayersForm/Layer/Bubble.vue.js +41 -41
- package/dist/forms/LayersForm/Layer/Bubble.vue.js.map +1 -1
- package/dist/forms/LayersForm/Layer/heatmap/Heatmap.vue.js +35 -35
- package/dist/forms/LayersForm/Layer/heatmap/Heatmap.vue.js.map +1 -1
- package/dist/forms/LayersForm/Layer/heatmap/HeatmapAnnotations.vue.js +31 -31
- package/dist/forms/LayersForm/Layer/heatmap/HeatmapAnnotations.vue.js.map +1 -1
- package/dist/forms/LayersForm/Layer/heatmap/HeatmapClustered.vue.js +35 -35
- package/dist/forms/LayersForm/Layer/heatmap/HeatmapClustered.vue.js.map +1 -1
- package/dist/index.vue.js +94 -90
- package/dist/index.vue.js.map +1 -1
- package/dist/store.d.ts +8 -3
- package/dist/store.js +129 -123
- package/dist/store.js.map +1 -1
- package/dist/types.d.ts +9 -0
- package/dist/utils/createChartSettingsForRender/composeBubbleSettings.d.ts +2 -2
- package/dist/utils/createChartSettingsForRender/composeBubbleSettings.js +11 -11
- package/dist/utils/createChartSettingsForRender/composeBubbleSettings.js.map +1 -1
- package/dist/utils/createChartSettingsForRender/composeChartSettings.d.ts +2 -2
- package/dist/utils/createChartSettingsForRender/composeChartSettings.js +28 -28
- package/dist/utils/createChartSettingsForRender/composeChartSettings.js.map +1 -1
- package/dist/utils/createChartSettingsForRender/composeDendroSettings.js +23 -20
- package/dist/utils/createChartSettingsForRender/composeDendroSettings.js.map +1 -1
- package/dist/utils/createChartSettingsForRender/composeDiscreteSettings.d.ts +2 -2
- package/dist/utils/createChartSettingsForRender/composeDiscreteSettings.js +20 -18
- package/dist/utils/createChartSettingsForRender/composeDiscreteSettings.js.map +1 -1
- package/dist/utils/createChartSettingsForRender/composeHeatmapSettings.d.ts +2 -2
- package/dist/utils/createChartSettingsForRender/composeHeatmapSettings.js +28 -28
- package/dist/utils/createChartSettingsForRender/composeHeatmapSettings.js.map +1 -1
- package/dist/utils/createChartSettingsForRender/composeHistogramSettings.d.ts +2 -2
- package/dist/utils/createChartSettingsForRender/composeHistogramSettings.js +11 -10
- package/dist/utils/createChartSettingsForRender/composeHistogramSettings.js.map +1 -1
- package/dist/utils/createChartSettingsForRender/composeScatterplotSettings.d.ts +3 -3
- package/dist/utils/createChartSettingsForRender/composeScatterplotSettings.js +71 -68
- package/dist/utils/createChartSettingsForRender/composeScatterplotSettings.js.map +1 -1
- package/dist/utils/createChartSettingsForRender/composeScatterplotUmapSettings.d.ts +2 -2
- package/dist/utils/createChartSettingsForRender/composeScatterplotUmapSettings.js +19 -18
- package/dist/utils/createChartSettingsForRender/composeScatterplotUmapSettings.js.map +1 -1
- package/dist/utils/createChartSettingsForRender/getAxesDataFromForms.js +27 -27
- package/dist/utils/createChartSettingsForRender/getAxesDataFromForms.js.map +1 -1
- package/dist/utils/createChartSettingsForRender/getLayersDataFromForms.d.ts +1 -1
- package/dist/utils/createChartSettingsForRender/getLayersDataFromForms.js +37 -37
- package/dist/utils/createChartSettingsForRender/getLayersDataFromForms.js.map +1 -1
- package/package.json +2 -2
package/dist/index.vue.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.vue.js","sources":["../src/index.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type {\n ChartInterface,\n DataByColumns,\n ErrorInfo,\n LassoControlsState,\n Settings,\n} from '@milaboratories/miplots4';\nimport {\n MiPlots,\n} from '@milaboratories/miplots4';\nimport type {\n ChartType,\n PlotDataAndSettings,\n} from '@milaboratories/pf-plots';\nimport {\n DemoDataStore, getInitialStateByType,\n} from '@milaboratories/pf-plots';\nimport type { AxisSpec, PFrameDriver, PlSelectionModel, PTableKey } from '@platforma-sdk/model';\nimport { watchDebounced } from '@vueuse/core';\nimport canonicalize from 'canonicalize';\nimport { computed, onMounted, onUnmounted, ref, shallowRef, toRaw, useSlots, watch } from 'vue';\nimport './assets/ui.scss';\nimport Chart from './components/Chart.vue';\nimport Loading from './components/Loading.vue';\nimport PanelModal from './components/PanelModal.vue';\nimport VTabs from './components/SettingsTabs/index.vue';\nimport TransitionSlidePanel from './components/TransitionSlidePanel.vue';\nimport ChartErrorNotificationAlert from './components/ChartErrorNotificationAlert.vue';\nimport { useSettingsForm } from './forms';\nimport { createReactiveState, provideStore } from './store';\nimport type { DendroNodeInfo, GraphMakerProps, GraphMakerState, GraphStatus } from './types';\nimport { composeChartSettings, saveToFile } from './utils';\nimport { copyJSON } from './utils/copyJSON';\n\nconst _emit = defineEmits(['delete-this-graph', 'tooltip-btn-click']);\n\nconst graphMakerState = defineModel<GraphMakerState>({ required: true });\nconst selectionState = defineModel<PlSelectionModel>('selection');\n\nconst props = defineProps<GraphMakerProps>();\n\ndefineExpose({\n /**\n reset() will update data-mapping, axis-settings, layers-settings with the state that is in v-model at the moment.\n In other cases editing of v-model fields doesn't make any impact to graphs and interface.\n Besides, after reset default-options will be applied again. You can use reset to apply new default-options.\n */\n reset,\n /**\n Apply new defaults without resetting all the state\n */\n resetDefaults,\n});\n\nconst dataStore = ref<DemoDataStore | null>(null);\n\nwatch(() => props.pFrame, (pframeValue) => {\n if (!pframeValue) {\n return;\n }\n const driver = ('platforma' in window) ? window.platforma?.pFrameDriver as PFrameDriver : props.driver;\n if (!driver) {\n throw new Error('PFrame driver is missing');\n }\n dataStore.value = new DemoDataStore(\n pframeValue,\n driver,\n props.labelsModifier,\n );\n}, { immediate: true });\n\n// fixed options can be updated outside, other settings only inside from chart settings interface, so we don't watching other settings\nconst fixedOptions = ref<typeof props.fixedOptions>(props.fixedOptions ?? []);\nwatch(() => props.fixedOptions, (value, oldValue) => {\n if (\n (value && oldValue && JSON.stringify(value) !== JSON.stringify(oldValue))\n || (value && !oldValue)\n || (oldValue && !value)\n ) {\n fixedOptions.value = value;\n }\n}, { deep: true });\nconst defaultOptions = ref<typeof props.defaultOptions>(props.defaultOptions);\n\nconst state = provideStore(\n toRaw(graphMakerState.value),\n dataStore,\n props.chartType,\n defaultOptions,\n fixedOptions,\n props.dataColumnPredicate,\n props.readonlyInputs,\n);\n\nfunction reset() {\n const nextReactiveState = createReactiveState(\n toRaw(graphMakerState.value),\n props.chartType,\n );\n Object.assign(state.value.reactive, nextReactiveState);\n Object.assign(state.value.loading, {\n initialInputGuide: true,\n initialCharts: true,\n initialDefaults: true,\n inputGuide: false,\n chartData: false,\n });\n defaultOptions.value = props.defaultOptions;\n}\n\nfunction resetDefaults() {\n Object.assign(state.value.loading, {\n initialInputGuide: true,\n initialCharts: true,\n initialDefaults: true,\n inputGuide: false,\n chartData: false,\n });\n defaultOptions.value = props.defaultOptions ? [...props.defaultOptions] as typeof props.defaultOptions : [];\n}\n\nconst prevDataKey = computed(() => state.value.reactive.dataStateKey);\nwatch(() => canonicalize(props.dataStateKey), (keyValue) => {\n if ((keyValue !== undefined || prevDataKey.value !== undefined) && prevDataKey.value !== keyValue) {\n graphMakerState.value.optionsState = copyJSON(getInitialStateByType(props.chartType));\n const nextReactiveState = createReactiveState(toRaw(graphMakerState.value), props.chartType);\n Object.assign(state.value.reactive, nextReactiveState);\n Object.assign(state.value.loading, {\n initialInputGuide: true,\n initialCharts: true,\n initialDefaults: true,\n inputGuide: false,\n chartData: false,\n });\n defaultOptions.value = props.defaultOptions ? [...props.defaultOptions] as typeof props.defaultOptions : []; // to trigger watch on defaults\n }\n state.value.reactive.dataStateKey = keyValue;\n}, { deep: true, immediate: true });\n\nconst currentForm = computed(() => useSettingsForm(state.value.reactive.currentTab));\n\nconst chartRef = shallowRef<ChartInterface | null>(null);\nconst chartCalculatedDataRef = ref<Record<string, unknown> | null>(null);\nconst chartError = ref(false);\nconst chartErrorInfo = ref<ErrorInfo | null>(null);\n\nconst graphStatus = computed<GraphStatus>((previuosStatus) => {\n const inputGuide = state.value.inputGuide.value;\n const chartData = state.value.chartData.value;\n if (!inputGuide.consistent) {\n return 'inconsistent';\n }\n if (!inputGuide.ready) {\n return 'notReady';\n }\n if (chartData && Object.values(chartData.data.byColumns.values)[0]?.length === 0) {\n return 'empty';\n }\n if (chartError.value) {\n return chartErrorInfo.value?.type === 'unknownError' ? 'unknownError' : 'knownError';\n }\n if ((state.value.loading.initialCharts || (previuosStatus !== 'ready' && state.value.loading.chartData) || state.value.loading.chartRendering)) {\n return 'loading';\n }\n return 'ready';\n});\nfunction onTreeNodeClick(d: DendroNodeInfo) {\n state.value.reactive.dendroSelectedNodeId = d?.info[0]?.id as number;\n state.value.reactive.dendroInfoByClick = d;\n}\n\nfunction onTooltipHintSwitch(v: boolean) {\n state.value.reactive.showTooltipHint = v;\n}\n\nfunction onLassoPolygonUpdate(dotIndexes: number[], polygons: { points: [number, number][]; closed: boolean }[]) {\n graphMakerState.value = {\n ...graphMakerState.value,\n selectedPolygons: polygons,\n };\n\n const axesData = state.value.chartData.value?.data?.axesData;\n if (dotIndexes.length === 0 || !axesData) {\n selectionState.value = { axesSpec: [], selectedKeys: [] };\n return;\n }\n\n const axisKeys = Object.keys(axesData);\n const inputGuide = state.value.inputGuide.value;\n selectionState.value = {\n axesSpec: axisKeys.map((axisKey) => inputGuide.getSourceInfo(axisKey).spec as AxisSpec),\n selectedKeys: dotIndexes.map((idx) => axisKeys.map((axisKey) => axesData[axisKey][idx]) as PTableKey),\n };\n}\n\nfunction onLassoStateChange(v: LassoControlsState) {\n state.value.reactive.lassoControlsState = v;\n}\nlet chartRenderingInProgress: ReturnType<typeof setTimeout> | null = null;\nfunction onLoadingStateChange(v: boolean) {\n if (v) {\n chartRenderingInProgress = setTimeout(() => {\n state.value.loading.chartRendering = true;\n }, 1000);\n } else {\n if (chartRenderingInProgress) {\n clearTimeout(chartRenderingInProgress);\n }\n state.value.loading.chartRendering = false;\n }\n}\nconst graphEventHandlers: Record<ChartType, unknown> = {\n 'dendro': [onTreeNodeClick],\n 'scatterplot-umap': {\n onPolygonUpdate: onLassoPolygonUpdate,\n onTooltipHintSwitch,\n onLassoControlsStateUpdate: onLassoStateChange,\n },\n 'discrete': [onTooltipHintSwitch],\n 'scatterplot': {\n onPolygonUpdate: onLassoPolygonUpdate,\n onTooltipHintSwitch,\n onLassoControlsStateUpdate: onLassoStateChange,\n },\n 'histogram': [onTooltipHintSwitch],\n 'heatmap': { onTooltipHintSwitch, onLoadingChange: onLoadingStateChange },\n 'bubble': [onTooltipHintSwitch],\n};\nfunction updateChart(value: { data: PlotDataAndSettings['data']['byColumns']; settings: PlotDataAndSettings['settings'] } | null) {\n // if dataByColumns exists but columns has no data - show empty chart\n if (value && Object.values(value.data.values)[0]?.length > 0) {\n // console.log('value.dataByColumns', toRaw(value.data));\n // console.log('value.settings', toRaw(value.settings));\n if (chartRef.value) {\n chartRef.value.updateSettingsAndData(toRaw(value.data), toRaw(value.settings) as Settings);\n } else {\n const htmlNode = document.getElementById('chartSvgContainer');\n if (htmlNode) {\n chartRef.value = MiPlots.newPlot(toRaw(value.data), toRaw(value.settings) as Settings, graphEventHandlers[value.settings.type as ChartType]);\n if (value.settings.type === 'scatterplot-umap') {\n // set default polygons (from props)\n chartRef.value.updateChartState('polygon', graphMakerState.value.selectedPolygons ?? []);\n }\n chartRef.value.mount(htmlNode);\n }\n }\n // calculated by chart renderer data, tree hierarchy for example\n chartCalculatedDataRef.value = chartRef.value?.calculatedData ? { ...chartRef.value.calculatedData } : null;\n chartError.value = chartRef.value?.hasError ?? false;\n chartErrorInfo.value = chartRef.value?.errorInfo ?? null;\n } else {\n chartRef.value?.unmount();\n chartRef.value = null;\n chartErrorInfo.value = null;\n }\n}\n\nwatch(() => graphStatus.value, (v) => {\n if (v === 'notReady') {\n chartRef.value?.unmount();\n chartRef.value = null;\n }\n});\n\nconst chartDataForRender = shallowRef<{ settings: Settings; data: DataByColumns } | null>(null);\nwatch([\n () => state.value.chartData.value,\n], ([chartData]) => {\n chartDataForRender.value = composeChartSettings(\n toRaw(chartData),\n toRaw(state.value.inputGuide.value),\n toRaw(state.value.uniqueValuesData.value),\n toRaw(state.value.filterLabelsInfo.value),\n toRaw(state.value.reactive),\n );\n});\nwatch([\n () => state.value.reactive.template,\n () => state.value.reactive.layersSettings,\n () => state.value.reactive.axesSettings,\n () => state.value.reactive.statisticsSettings,\n () => state.value.reactive.dataBindAes,\n () => state.value.reactive.chartScale,\n], () => {\n chartDataForRender.value = composeChartSettings(\n toRaw(state.value.chartData.value),\n toRaw(state.value.inputGuide.value),\n toRaw(state.value.uniqueValuesData.value),\n toRaw(state.value.filterLabelsInfo.value),\n toRaw(state.value.reactive),\n );\n}, { deep: true });\n\nwatch(() => chartDataForRender.value, (chartData) => {\n updateChart(chartData);\n});\nonMounted(() => {\n updateChart(null);\n});\nonUnmounted(() => {\n chartRef.value?.unmount();\n});\n\nwatchDebounced(() => state.value.reactive.optionsState, (v) => {\n graphMakerState.value = {\n ...graphMakerState.value,\n optionsState: copyJSON(v),\n };\n}, { deep: true, debounce: 1000 });\nwatchDebounced(() => state.value.reactive.statisticsSettings, (v) => {\n graphMakerState.value = {\n ...graphMakerState.value,\n statisticsSettings: copyJSON(v),\n };\n}, { deep: true, debounce: 1000 });\nwatchDebounced(() => state.value.reactive.axesSettings, (v) => {\n graphMakerState.value = {\n ...graphMakerState.value,\n axesSettings: copyJSON(v),\n };\n}, { deep: true, debounce: 1000 });\nwatchDebounced(() => state.value.reactive.layersSettings, (v) => {\n graphMakerState.value = {\n ...graphMakerState.value,\n layersSettings: copyJSON(v),\n };\n}, { deep: true, debounce: 1000 });\nwatchDebounced(() => state.value.reactive.dataBindAes, (v) => {\n graphMakerState.value = {\n ...graphMakerState.value,\n dataBindAes: copyJSON(v),\n };\n}, { deep: true, debounce: 1000 });\n\nwatchDebounced([\n () => state.value.reactive.chartScale,\n () => state.value.reactive.template,\n () => state.value.reactive.currentTab,\n], ([zoomState, template, currentTab]) => {\n graphMakerState.value = {\n ...graphMakerState.value,\n zoomState,\n template,\n currentTab,\n };\n}, { debounce: 1000 });\n\nwatch(() => state.value.reactive.dataStateKey, (dataStateKey) => {\n graphMakerState.value = {\n ...graphMakerState.value,\n dataStateKey,\n };\n}, { immediate: true });\n\nwatch(() => graphMakerState.value.currentTab, (v) => {\n state.value.reactive.currentTab = v === undefined ? 'dataMapping' : v;\n});\n\nwatch(() => graphMakerState.value?.layersSettings?.dendro?.showTable, (v) => {\n state.value.reactive.layersSettings.dendro.showTable = v ?? false;\n});\n\nfunction onExport() {\n saveToFile(\n new Blob([\n chartRef.value?.export() ?? '',\n ]),\n 'chart.svg',\n );\n}\n\nfunction updateGraphTitle(nextTitle: string) {\n graphMakerState.value = {\n ...graphMakerState.value,\n title: nextTitle,\n };\n}\n\nfunction selectTreeNode(id: number | null) {\n state.value.reactive.dendroSelectedNodeId = id;\n chartRef.value?.updateChartState('selectedNode', id);\n}\n\nconst slots = useSlots();\n\nconst hasAnnotationsSlot = computed(() => Boolean(slots.annotationsSlot));\nconst hasSettingsSlot = computed(() => Boolean(slots.settingsSlot));\nconst hasLogSlot = computed(() => Boolean(slots.logSlot));\n\n</script>\n\n<template>\n <div class=\"graph-maker\">\n <div class=\"graph-maker__main-pane\">\n <Chart\n :graph-status=\"graphStatus\" :graphTitle=\"graphMakerState.title\" :chartData=\"chartCalculatedDataRef\"\n :chart-ref=\"chartRef\" :error-info=\"chartErrorInfo\" :dendroTooltipButton=\"tooltipButton\"\n @graph-title-update=\"updateGraphTitle\" @dendro-node-select=\"selectTreeNode\"\n @dendro-tooltip-btn-click=\"(id: string) => $emit('tooltip-btn-click', id)\"\n >\n <slot name=\"titleLineSlot\" />\n </Chart>\n <Loading v-if=\"state.loading.initialInputGuide\" :top=\"67\" :left=\"12\" :right=\"12\" :bottom=\"12\" />\n <TransitionSlidePanel v-if=\"!state.loading.initialInputGuide\" id=\"graph-settings-modal\">\n <PanelModal v-if=\"state.reactive.currentTab\" @close=\"state.reactive.currentTab = null\">\n <component :is=\"currentForm.value\">\n <slot v-if=\"state.reactive.currentTab === 'annotations'\" name=\"annotationsSlot\" />\n <slot v-if=\"state.reactive.currentTab === 'settings'\" name=\"settingsSlot\" />\n <slot v-if=\"state.reactive.currentTab === 'log'\" name=\"logSlot\" />\n </component>\n </PanelModal>\n </TransitionSlidePanel>\n </div>\n <VTabs\n v-model=\"state.reactive.currentTab\" :chart-type=\"state.reactive.chartType\" :graph-status=\"graphStatus\"\n :allowDeleting=\"allowChartDeleting\" :hasAnnotationsSlot=\"hasAnnotationsSlot\" :hasSettingsSlot=\"hasSettingsSlot\"\n :hasLogSlot=\"hasLogSlot\" :initialLoading=\"state.loading.initialInputGuide\" @export=\"onExport\"\n @delete=\"$emit('delete-this-graph')\"\n />\n <ChartErrorNotificationAlert v-if=\"chartErrorInfo?.type === 'unknownError'\" :errorInfo=\"chartErrorInfo\" />\n </div>\n</template>\n"],"names":["graphMakerState","_useModel","selectionState","__props","props","__expose","reset","resetDefaults","dataStore","ref","watch","pframeValue","driver","_a","DemoDataStore","fixedOptions","value","oldValue","defaultOptions","state","provideStore","toRaw","nextReactiveState","createReactiveState","prevDataKey","computed","canonicalize","keyValue","copyJSON","getInitialStateByType","currentForm","useSettingsForm","chartRef","shallowRef","chartCalculatedDataRef","chartError","chartErrorInfo","graphStatus","previuosStatus","inputGuide","chartData","_b","onTreeNodeClick","d","onTooltipHintSwitch","v","onLassoPolygonUpdate","dotIndexes","polygons","axesData","axisKeys","axisKey","idx","onLassoStateChange","chartRenderingInProgress","onLoadingStateChange","graphEventHandlers","updateChart","htmlNode","MiPlots","_c","_d","_e","chartDataForRender","composeChartSettings","onMounted","onUnmounted","watchDebounced","zoomState","template","currentTab","dataStateKey","onExport","saveToFile","updateGraphTitle","nextTitle","selectTreeNode","id","slots","useSlots","hasAnnotationsSlot","hasSettingsSlot","hasLogSlot","_openBlock","_createElementBlock","_hoisted_1","_createElementVNode","_hoisted_2","_createVNode","Chart","_cache","$emit","_renderSlot","_ctx","_unref","_createBlock","Loading","TransitionSlidePanel","PanelModal","$event","_resolveDynamicComponent","VTabs","ChartErrorNotificationAlert"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,UAAMA,IAAkBC,iBAA+C,GACjEC,IAAiBD,EAA6BE,GAAC,WAAW,GAE1DC,IAAQD;AAEd,IAAAE,EAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAMX,OAAAC;AAAA;AAAA;AAAA;AAAA,MAIA,eAAAC;AAAA,IAAA,CACD;AAED,UAAMC,IAAYC,EAA0B,IAAI;AAEhD,IAAAC,EAAM,MAAMN,EAAM,QAAQ,CAACO,MAAgB;;AACzC,UAAI,CAACA;AACH;AAEF,YAAMC,IAAU,eAAe,UAAUC,IAAA,OAAO,cAAP,gBAAAA,EAAkB,eAA+BT,EAAM;AAChG,UAAI,CAACQ;AACH,cAAM,IAAI,MAAM,0BAA0B;AAE5C,MAAAJ,EAAU,QAAQ,IAAIM;AAAA,QACpBH;AAAA,QACAC;AAAA,QACAR,EAAM;AAAA,MAAA;AAAA,IAEV,GAAG,EAAE,WAAW,IAAM;AAGtB,UAAMW,IAAeN,EAA+BL,EAAM,gBAAgB,CAAA,CAAE;AAC5E,IAAAM,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AAA,EAAM,SAAS,aAAU;AAAA,cAAA;2BAC5E,MAIY;AAAA,wBAJZ4E,EAIYK,GAJItE,EAAA,MAAY,KAAK,GAAA,MAAA;AAAA,+BAC/B,MAAkF;AAAA,sBAAtEgE,EAAA3E,CAAA,EAAM,SAAS,eAAU,gBAArCyE,EAAkFC,EAAA,QAAA,mBAAA,EAAA,KAAA,EAAA,CAAA;sBACtEC,EAAA3E,CAAA,EAAM,SAAS,eAAU,aAArCyE,EAA4EC,EAAA,QAAA,gBAAA,EAAA,KAAA,EAAA,CAAA;sBAChEC,EAAA3E,CAAA,EAAM,SAAS,eAAU,QAArCyE,EAAkEC,EAAA,QAAA,WAAA,EAAA,KAAA,EAAA,CAAA;;;;;;;;;;;QAK1EL,EAKEa,IAAA;AAAA,sBAJSP,EAAA3E,CAAA,EAAM,SAAS;AAAA,wDAAf2E,EAAA3E,CAAA,EAAM,SAAS,aAAUgF;AAAA,UAAG,cAAYL,EAAA3E,CAAA,EAAM,SAAS;AAAA,UAAY,gBAAckB,EAAA;AAAA,UACzF,eAAelC,EAAA;AAAA,UAAqB,oBAAoB6E,GAAA;AAAA,UAAqB,iBAAiBC,GAAA;AAAA,UAC9F,YAAYC,GAAA;AAAA,UAAa,gBAAgBY,EAAA3E,CAAA,EAAM,QAAQ;AAAA,UAAoB,UAAAqD;AAAA,UAC3E,iCAAQmB,EAAAA,MAAK,mBAAA;AAAA,QAAA;UAEmB9E,IAAAuB,EAAA,UAAA,gBAAAvB,EAAgB,UAAI,uBAAvDkF,EAA0GO,IAAA;AAAA;UAA7B,WAAWlE,EAAA;AAAA,QAAA;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.vue.js","sources":["../src/index.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport type {\n ChartInterface,\n DataByColumns,\n ErrorInfo,\n LassoControlsState,\n Settings,\n} from '@milaboratories/miplots4';\nimport {\n MiPlots,\n} from '@milaboratories/miplots4';\nimport type {\n ChartType,\n PlotDataAndSettings,\n} from '@milaboratories/pf-plots';\nimport {\n DemoDataStore, getInitialStateByType,\n} from '@milaboratories/pf-plots';\nimport type { AxisSpec, PFrameDriver, PlSelectionModel, PTableKey } from '@platforma-sdk/model';\nimport { watchDebounced } from '@vueuse/core';\nimport canonicalize from 'canonicalize';\nimport { computed, onMounted, onUnmounted, ref, shallowRef, toRaw, useSlots, watch } from 'vue';\nimport './assets/ui.scss';\nimport Chart from './components/Chart.vue';\nimport Loading from './components/Loading.vue';\nimport PanelModal from './components/PanelModal.vue';\nimport VTabs from './components/SettingsTabs/index.vue';\nimport TransitionSlidePanel from './components/TransitionSlidePanel.vue';\nimport ChartErrorNotificationAlert from './components/ChartErrorNotificationAlert.vue';\nimport { useSettingsForm } from './forms';\nimport { createReactiveState, provideStore } from './store';\nimport type { DendroNodeInfo, GraphMakerProps, GraphMakerState, GraphStatus } from './types';\nimport { composeChartSettings, saveToFile } from './utils';\nimport { copyJSON } from './utils/copyJSON';\n\nconst _emit = defineEmits(['delete-this-graph', 'tooltip-btn-click']);\n\nconst graphMakerState = defineModel<GraphMakerState>({ required: true });\nconst selectionState = defineModel<PlSelectionModel>('selection');\n\nconst props = defineProps<GraphMakerProps>();\n\ndefineExpose({\n /**\n reset() will update data-mapping, axis-settings, layers-settings with the state that is in v-model at the moment.\n In other cases editing of v-model fields doesn't make any impact to graphs and interface.\n Besides, after reset default-options will be applied again. You can use reset to apply new default-options.\n */\n reset,\n /**\n Apply new defaults without resetting all the state\n */\n resetDefaults,\n});\n\nconst dataStore = ref<DemoDataStore | null>(null);\n\nwatch(() => props.pFrame, (pframeValue) => {\n if (!pframeValue) {\n return;\n }\n const driver = ('platforma' in window) ? window.platforma?.pFrameDriver as PFrameDriver : props.driver;\n if (!driver) {\n throw new Error('PFrame driver is missing');\n }\n dataStore.value = new DemoDataStore(\n pframeValue,\n driver,\n props.labelsModifier,\n );\n}, { immediate: true });\n\n// fixed options can be updated outside, other settings only inside from chart settings interface, so we don't watching other settings\nconst fixedOptions = ref<typeof props.fixedOptions>(props.fixedOptions ?? []);\nwatch(() => props.fixedOptions, (value, oldValue) => {\n if (\n (value && oldValue && JSON.stringify(value) !== JSON.stringify(oldValue))\n || (value && !oldValue)\n || (oldValue && !value)\n ) {\n fixedOptions.value = value;\n }\n}, { deep: true });\nconst defaultOptions = ref<typeof props.defaultOptions>(props.defaultOptions);\n\nconst state = provideStore(\n toRaw(graphMakerState.value),\n dataStore,\n props.chartType,\n defaultOptions,\n fixedOptions,\n props.dataColumnPredicate,\n props.readonlyInputs,\n props.defaultPalette,\n);\n\nfunction reset() {\n const nextReactiveState = createReactiveState(\n toRaw(graphMakerState.value),\n props.chartType,\n );\n Object.assign(state.value.reactive, nextReactiveState);\n Object.assign(state.value.loading, {\n initialInputGuide: true,\n initialCharts: true,\n initialDefaults: true,\n inputGuide: false,\n chartData: false,\n });\n defaultOptions.value = props.defaultOptions;\n}\n\nfunction resetDefaults() {\n Object.assign(state.value.loading, {\n initialInputGuide: true,\n initialCharts: true,\n initialDefaults: true,\n inputGuide: false,\n chartData: false,\n });\n defaultOptions.value = props.defaultOptions ? [...props.defaultOptions] as typeof props.defaultOptions : [];\n}\n\nconst prevDataKey = computed(() => state.value.reactive.dataStateKey);\nwatch(() => canonicalize(props.dataStateKey), (keyValue) => {\n if ((keyValue !== undefined || prevDataKey.value !== undefined) && prevDataKey.value !== keyValue) {\n graphMakerState.value.optionsState = copyJSON(getInitialStateByType(props.chartType));\n const nextReactiveState = createReactiveState(toRaw(graphMakerState.value), props.chartType);\n Object.assign(state.value.reactive, nextReactiveState);\n Object.assign(state.value.loading, {\n initialInputGuide: true,\n initialCharts: true,\n initialDefaults: true,\n inputGuide: false,\n chartData: false,\n });\n defaultOptions.value = props.defaultOptions ? [...props.defaultOptions] as typeof props.defaultOptions : []; // to trigger watch on defaults\n }\n state.value.reactive.dataStateKey = keyValue;\n}, { deep: true, immediate: true });\n\nconst currentForm = computed(() => useSettingsForm(state.value.reactive.currentTab));\n\nconst chartRef = shallowRef<ChartInterface | null>(null);\nconst chartCalculatedDataRef = ref<Record<string, unknown> | null>(null);\nconst chartError = ref(false);\nconst chartErrorInfo = ref<ErrorInfo | null>(null);\n\nconst graphStatus = computed<GraphStatus>((previuosStatus) => {\n const inputGuide = state.value.inputGuide.value;\n const chartData = state.value.chartData.value;\n if (!inputGuide.consistent) {\n return 'inconsistent';\n }\n if (!inputGuide.ready) {\n return 'notReady';\n }\n if (chartData && Object.values(chartData.data.byColumns.values)[0]?.length === 0) {\n return 'empty';\n }\n if (chartError.value) {\n return chartErrorInfo.value?.type === 'unknownError' ? 'unknownError' : 'knownError';\n }\n if ((state.value.loading.initialCharts || (previuosStatus !== 'ready' && state.value.loading.chartData) || state.value.loading.chartRendering)) {\n return 'loading';\n }\n return 'ready';\n});\nfunction onTreeNodeClick(d: DendroNodeInfo) {\n state.value.reactive.dendroSelectedNodeId = d?.info[0]?.id as number;\n state.value.reactive.dendroInfoByClick = d;\n}\n\nfunction onTooltipHintSwitch(v: boolean) {\n state.value.reactive.showTooltipHint = v;\n}\n\nfunction onLassoPolygonUpdate(dotIndexes: number[], polygons: { points: [number, number][]; closed: boolean }[]) {\n graphMakerState.value = {\n ...graphMakerState.value,\n selectedPolygons: polygons,\n };\n\n const axesData = state.value.chartData.value?.data?.axesData;\n if (dotIndexes.length === 0 || !axesData) {\n selectionState.value = { axesSpec: [], selectedKeys: [] };\n return;\n }\n\n const axisKeys = Object.keys(axesData);\n const inputGuide = state.value.inputGuide.value;\n selectionState.value = {\n axesSpec: axisKeys.map((axisKey) => inputGuide.getSourceInfo(axisKey).spec as AxisSpec),\n selectedKeys: dotIndexes.map((idx) => axisKeys.map((axisKey) => axesData[axisKey][idx]) as PTableKey),\n };\n}\n\nfunction onLassoStateChange(v: LassoControlsState) {\n state.value.reactive.lassoControlsState = v;\n}\nlet chartRenderingInProgress: ReturnType<typeof setTimeout> | null = null;\nfunction onLoadingStateChange(v: boolean) {\n if (v) {\n chartRenderingInProgress = setTimeout(() => {\n state.value.loading.chartRendering = true;\n }, 1000);\n } else {\n if (chartRenderingInProgress) {\n clearTimeout(chartRenderingInProgress);\n }\n state.value.loading.chartRendering = false;\n }\n}\nconst graphEventHandlers: Record<ChartType, unknown> = {\n 'dendro': [onTreeNodeClick],\n 'scatterplot-umap': {\n onPolygonUpdate: onLassoPolygonUpdate,\n onTooltipHintSwitch,\n onLassoControlsStateUpdate: onLassoStateChange,\n },\n 'discrete': [onTooltipHintSwitch],\n 'scatterplot': {\n onPolygonUpdate: onLassoPolygonUpdate,\n onTooltipHintSwitch,\n onLassoControlsStateUpdate: onLassoStateChange,\n },\n 'histogram': [onTooltipHintSwitch],\n 'heatmap': { onTooltipHintSwitch, onLoadingChange: onLoadingStateChange },\n 'bubble': [onTooltipHintSwitch],\n};\nfunction updateChart(value: { data: PlotDataAndSettings['data']['byColumns']; settings: PlotDataAndSettings['settings'] } | null) {\n // if dataByColumns exists but columns has no data - show empty chart\n if (value && Object.values(value.data.values)[0]?.length > 0) {\n // console.log('value.dataByColumns', toRaw(value.data));\n // console.log('value.settings', toRaw(value.settings));\n if (chartRef.value) {\n chartRef.value.updateSettingsAndData(toRaw(value.data), toRaw(value.settings) as Settings);\n } else {\n const htmlNode = document.getElementById('chartSvgContainer');\n if (htmlNode) {\n chartRef.value = MiPlots.newPlot(toRaw(value.data), toRaw(value.settings) as Settings, graphEventHandlers[value.settings.type as ChartType]);\n if (value.settings.type === 'scatterplot-umap') {\n // set default polygons (from props)\n chartRef.value.updateChartState('polygon', graphMakerState.value.selectedPolygons ?? []);\n }\n chartRef.value.mount(htmlNode);\n }\n }\n // calculated by chart renderer data, tree hierarchy for example\n chartCalculatedDataRef.value = chartRef.value?.calculatedData ? { ...chartRef.value.calculatedData } : null;\n chartError.value = chartRef.value?.hasError ?? false;\n chartErrorInfo.value = chartRef.value?.errorInfo ?? null;\n } else {\n chartRef.value?.unmount();\n chartRef.value = null;\n chartErrorInfo.value = null;\n }\n}\n\nwatch(() => graphStatus.value, (v) => {\n if (v === 'notReady') {\n chartRef.value?.unmount();\n chartRef.value = null;\n }\n});\n\nconst chartDataForRender = shallowRef<{ settings: Settings; data: DataByColumns } | null>(null);\nwatch([\n () => state.value.chartData.value,\n], ([chartData]) => {\n chartDataForRender.value = composeChartSettings(\n toRaw(chartData),\n toRaw(state.value.inputGuide.value),\n toRaw(state.value.uniqueValuesData.value),\n toRaw(state.value.filterLabelsInfo.value),\n toRaw(state.value.reactive),\n toRaw(state.value.defaultPalette),\n );\n});\nwatch([\n () => state.value.reactive.template,\n () => state.value.reactive.layersSettings,\n () => state.value.reactive.axesSettings,\n () => state.value.reactive.statisticsSettings,\n () => state.value.reactive.dataBindAes,\n () => state.value.reactive.chartScale,\n], () => {\n chartDataForRender.value = composeChartSettings(\n toRaw(state.value.chartData.value),\n toRaw(state.value.inputGuide.value),\n toRaw(state.value.uniqueValuesData.value),\n toRaw(state.value.filterLabelsInfo.value),\n toRaw(state.value.reactive),\n toRaw(state.value.defaultPalette),\n );\n}, { deep: true });\n\nwatch(() => chartDataForRender.value, (chartData) => {\n updateChart(chartData);\n});\nonMounted(() => {\n updateChart(null);\n});\nonUnmounted(() => {\n chartRef.value?.unmount();\n});\n\nwatchDebounced(() => state.value.reactive.optionsState, (v) => {\n graphMakerState.value = {\n ...graphMakerState.value,\n optionsState: copyJSON(v),\n };\n}, { deep: true, debounce: 1000 });\nwatchDebounced(() => state.value.reactive.statisticsSettings, (v) => {\n graphMakerState.value = {\n ...graphMakerState.value,\n statisticsSettings: copyJSON(v),\n };\n}, { deep: true, debounce: 1000 });\nwatchDebounced(() => state.value.reactive.axesSettings, (v) => {\n graphMakerState.value = {\n ...graphMakerState.value,\n axesSettings: copyJSON(v),\n };\n}, { deep: true, debounce: 1000 });\nwatchDebounced(() => state.value.reactive.layersSettings, (v) => {\n graphMakerState.value = {\n ...graphMakerState.value,\n layersSettings: copyJSON(v),\n };\n}, { deep: true, debounce: 1000 });\nwatchDebounced(() => state.value.reactive.dataBindAes, (v) => {\n graphMakerState.value = {\n ...graphMakerState.value,\n dataBindAes: copyJSON(v),\n };\n}, { deep: true, debounce: 1000 });\n\nwatchDebounced([\n () => state.value.reactive.chartScale,\n () => state.value.reactive.template,\n () => state.value.reactive.currentTab,\n], ([zoomState, template, currentTab]) => {\n graphMakerState.value = {\n ...graphMakerState.value,\n zoomState,\n template,\n currentTab,\n };\n}, { debounce: 1000 });\n\nwatch(() => state.value.reactive.dataStateKey, (dataStateKey) => {\n graphMakerState.value = {\n ...graphMakerState.value,\n dataStateKey,\n };\n}, { immediate: true });\n\nwatch(() => graphMakerState.value.currentTab, (v) => {\n state.value.reactive.currentTab = v === undefined ? 'dataMapping' : v;\n});\n\nwatch(() => graphMakerState.value?.layersSettings?.dendro?.showTable, (v) => {\n state.value.reactive.layersSettings.dendro.showTable = v ?? false;\n});\n\nfunction onExport() {\n saveToFile(\n new Blob([\n chartRef.value?.export() ?? '',\n ]),\n 'chart.svg',\n );\n}\n\nfunction updateGraphTitle(nextTitle: string) {\n graphMakerState.value = {\n ...graphMakerState.value,\n title: nextTitle,\n };\n}\n\nfunction selectTreeNode(id: number | null) {\n state.value.reactive.dendroSelectedNodeId = id;\n chartRef.value?.updateChartState('selectedNode', id);\n}\n\nconst slots = useSlots();\n\nconst hasAnnotationsSlot = computed(() => Boolean(slots.annotationsSlot));\nconst hasSettingsSlot = computed(() => Boolean(slots.settingsSlot));\nconst hasLogSlot = computed(() => Boolean(slots.logSlot));\n\n</script>\n\n<template>\n <div class=\"graph-maker\">\n <div class=\"graph-maker__main-pane\">\n <Chart\n :graph-status=\"graphStatus\" :graphTitle=\"graphMakerState.title\" :chartData=\"chartCalculatedDataRef\"\n :chart-ref=\"chartRef\" :error-info=\"chartErrorInfo\" :dendroTooltipButton=\"tooltipButton\"\n @graph-title-update=\"updateGraphTitle\" @dendro-node-select=\"selectTreeNode\"\n @dendro-tooltip-btn-click=\"(id: string) => $emit('tooltip-btn-click', id)\"\n >\n <slot name=\"titleLineSlot\" />\n </Chart>\n <Loading v-if=\"state.loading.initialInputGuide\" :top=\"67\" :left=\"12\" :right=\"12\" :bottom=\"12\" />\n <TransitionSlidePanel v-if=\"!state.loading.initialInputGuide\" id=\"graph-settings-modal\">\n <PanelModal v-if=\"state.reactive.currentTab\" @close=\"state.reactive.currentTab = null\">\n <component :is=\"currentForm.value\">\n <slot v-if=\"state.reactive.currentTab === 'annotations'\" name=\"annotationsSlot\" />\n <slot v-if=\"state.reactive.currentTab === 'settings'\" name=\"settingsSlot\" />\n <slot v-if=\"state.reactive.currentTab === 'log'\" name=\"logSlot\" />\n </component>\n </PanelModal>\n </TransitionSlidePanel>\n </div>\n <VTabs\n v-model=\"state.reactive.currentTab\" :chart-type=\"state.reactive.chartType\" :graph-status=\"graphStatus\"\n :allowDeleting=\"allowChartDeleting\" :hasAnnotationsSlot=\"hasAnnotationsSlot\" :hasSettingsSlot=\"hasSettingsSlot\"\n :hasLogSlot=\"hasLogSlot\" :initialLoading=\"state.loading.initialInputGuide\" @export=\"onExport\"\n @delete=\"$emit('delete-this-graph')\"\n />\n <ChartErrorNotificationAlert v-if=\"chartErrorInfo?.type === 'unknownError'\" :errorInfo=\"chartErrorInfo\" />\n </div>\n</template>\n"],"names":["graphMakerState","_useModel","selectionState","__props","props","__expose","reset","resetDefaults","dataStore","ref","watch","pframeValue","driver","_a","DemoDataStore","fixedOptions","value","oldValue","defaultOptions","state","provideStore","toRaw","nextReactiveState","createReactiveState","prevDataKey","computed","canonicalize","keyValue","copyJSON","getInitialStateByType","currentForm","useSettingsForm","chartRef","shallowRef","chartCalculatedDataRef","chartError","chartErrorInfo","graphStatus","previuosStatus","inputGuide","chartData","_b","onTreeNodeClick","d","onTooltipHintSwitch","v","onLassoPolygonUpdate","dotIndexes","polygons","axesData","axisKeys","axisKey","idx","onLassoStateChange","chartRenderingInProgress","onLoadingStateChange","graphEventHandlers","updateChart","htmlNode","MiPlots","_c","_d","_e","chartDataForRender","composeChartSettings","onMounted","onUnmounted","watchDebounced","zoomState","template","currentTab","dataStateKey","onExport","saveToFile","updateGraphTitle","nextTitle","selectTreeNode","id","slots","useSlots","hasAnnotationsSlot","hasSettingsSlot","hasLogSlot","_openBlock","_createElementBlock","_hoisted_1","_createElementVNode","_hoisted_2","_createVNode","Chart","_cache","$emit","_renderSlot","_ctx","_unref","_createBlock","Loading","TransitionSlidePanel","PanelModal","$event","_resolveDynamicComponent","VTabs","ChartErrorNotificationAlert"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,UAAMA,IAAkBC,iBAA+C,GACjEC,IAAiBD,EAA6BE,GAAC,WAAW,GAE1DC,IAAQD;AAEd,IAAAE,EAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAMX,OAAAC;AAAA;AAAA;AAAA;AAAA,MAIA,eAAAC;AAAA,IAAA,CACD;AAED,UAAMC,IAAYC,EAA0B,IAAI;AAEhD,IAAAC,EAAM,MAAMN,EAAM,QAAQ,CAACO,MAAgB;;AACzC,UAAI,CAACA;AACH;AAEF,YAAMC,IAAU,eAAe,UAAUC,IAAA,OAAO,cAAP,gBAAAA,EAAkB,eAA+BT,EAAM;AAChG,UAAI,CAACQ;AACH,cAAM,IAAI,MAAM,0BAA0B;AAE5C,MAAAJ,EAAU,QAAQ,IAAIM;AAAA,QACpBH;AAAA,QACAC;AAAA,QACAR,EAAM;AAAA,MAAA;AAAA,IAEV,GAAG,EAAE,WAAW,IAAM;AAGtB,UAAMW,IAAeN,EAA+BL,EAAM,gBAAgB,CAAA,CAAE;AAC5E,IAAAM,EAAM,MAAMN,EAAM,cAAc,CAACY,GAAOC,MAAa;AACnD,OACGD,KAASC,KAAY,KAAK,UAAUD,CAAK,MAAM,KAAK,UAAUC,CAAQ,KACnED,KAAS,CAACC,KACVA,KAAY,CAACD,OAEjBD,EAAa,QAAQC;AAAA,IAEzB,GAAG,EAAE,MAAM,IAAM;AACjB,UAAME,IAAiBT,EAAiCL,EAAM,cAAc,GAEtEe,IAA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AAM,SAAS,eAAU,gBAArCyE,EAAkFC,EAAA,QAAA,mBAAA,EAAA,KAAA,EAAA,CAAA;sBACtEC,EAAA3E,CAAA,EAAM,SAAS,eAAU,aAArCyE,EAA4EC,EAAA,QAAA,gBAAA,EAAA,KAAA,EAAA,CAAA;sBAChEC,EAAA3E,CAAA,EAAM,SAAS,eAAU,QAArCyE,EAAkEC,EAAA,QAAA,WAAA,EAAA,KAAA,EAAA,CAAA;;;;;;;;;;;QAK1EL,EAKEa,IAAA;AAAA,sBAJSP,EAAA3E,CAAA,EAAM,SAAS;AAAA,wDAAf2E,EAAA3E,CAAA,EAAM,SAAS,aAAUgF;AAAA,UAAG,cAAYL,EAAA3E,CAAA,EAAM,SAAS;AAAA,UAAY,gBAAckB,EAAA;AAAA,UACzF,eAAelC,EAAA;AAAA,UAAqB,oBAAoB6E,GAAA;AAAA,UAAqB,iBAAiBC,GAAA;AAAA,UAC9F,YAAYC,GAAA;AAAA,UAAa,gBAAgBY,EAAA3E,CAAA,EAAM,QAAQ;AAAA,UAAoB,UAAAqD;AAAA,UAC3E,iCAAQmB,EAAAA,MAAK,mBAAA;AAAA,QAAA;UAEmB9E,IAAAuB,EAAA,UAAA,gBAAAvB,EAAgB,UAAI,uBAAvDkF,EAA0GO,IAAA;AAAA;UAA7B,WAAWlE,EAAA;AAAA,QAAA;;;;;"}
|
package/dist/store.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { ChartType, DemoDataStore, DendroStateController, InputGuide, InputNamesByChartType, InputState, PlotDataAndSettings, getControllerByType } from '@milaboratories/pf-plots';
|
|
2
2
|
import { PColumnSpec } from '@platforma-sdk/model';
|
|
3
3
|
import { ListOption } from '@platforma-sdk/ui-vue';
|
|
4
|
+
import { Palette } from './components/AesSettings/types';
|
|
4
5
|
import { ComputedRef, Reactive, Ref } from 'vue';
|
|
5
6
|
import { AesType } from './constantsCommon';
|
|
6
|
-
import { FilterSuggestionsBySourceMap, GraphMakerProps, GraphMakerState, ReactiveState, UniqueValuesBySourceMap } from './types';
|
|
7
|
+
import { DefaultPalettes, FilterSuggestionsBySourceMap, GraphMakerProps, GraphMakerState, ReactiveState, UniqueValuesBySourceMap } from './types';
|
|
7
8
|
import { calculateDiscreteGroups } from './utils/calculateDiscreteGroups';
|
|
8
9
|
export declare function createReactiveState(initialData: GraphMakerState, chartType: ChartType): Reactive<ReactiveState>;
|
|
9
10
|
export interface Store {
|
|
@@ -31,8 +32,12 @@ export interface Store {
|
|
|
31
32
|
filterSuggestionsData: Ref<FilterSuggestionsBySourceMap>;
|
|
32
33
|
filterLabelsInfo: Ref<Record<string, ListOption>>;
|
|
33
34
|
readonlyInputs?: InputNamesByChartType[ChartType][];
|
|
35
|
+
defaultPalette: DefaultPalettes;
|
|
34
36
|
}
|
|
35
|
-
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<Record<string, ListOption>>, readonlyInputs?: InputNamesByChartType[ChartType][]
|
|
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<Record<string, ListOption>>, readonlyInputs?: InputNamesByChartType[ChartType][], defaultPalette?: Palette | {
|
|
38
|
+
categorical?: Palette;
|
|
39
|
+
continuous?: Palette;
|
|
40
|
+
}): Store;
|
|
36
41
|
export type ComputedStore = ComputedRef<Store>;
|
|
37
|
-
export declare function provideStore(initialState: GraphMakerState, dataStoreRef: Ref<DemoDataStore | null>, chartType: ChartType, defaultOptionsRef: Ref<GraphMakerProps['defaultOptions']>, fixedOptionsRef: Ref<GraphMakerProps['fixedOptions']>, dataColumnPredicate?: (spec: PColumnSpec) => boolean, readonlyInputs?: InputNamesByChartType[ChartType][]): ComputedRef<Store>;
|
|
42
|
+
export declare function provideStore(initialState: GraphMakerState, dataStoreRef: Ref<DemoDataStore | null>, chartType: ChartType, defaultOptionsRef: Ref<GraphMakerProps['defaultOptions']>, fixedOptionsRef: Ref<GraphMakerProps['fixedOptions']>, dataColumnPredicate?: (spec: PColumnSpec) => boolean, readonlyInputs?: InputNamesByChartType[ChartType][], defaultPalette?: GraphMakerProps['defaultPalette']): ComputedRef<Store>;
|
|
38
43
|
export declare function useStore(): ComputedStore;
|
package/dist/store.js
CHANGED
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
import { deepClone as
|
|
2
|
-
import { getControllerByType as
|
|
3
|
-
import { ref as d, computed as I, toRaw as
|
|
4
|
-
import { getInitialAxesSettings as
|
|
5
|
-
import { updateDataBindAes as
|
|
6
|
-
import { notEmpty as
|
|
7
|
-
import { storeKey as
|
|
8
|
-
import "./constantsAesthetic.js";
|
|
9
|
-
import { loadDataForPlot as
|
|
10
|
-
import { calculateDiscreteGroups as
|
|
11
|
-
import { addFixedOptionsToState as
|
|
12
|
-
import { loadDefaultSources as
|
|
13
|
-
import { copyJSON as
|
|
14
|
-
import { getUsedAesInMapping as
|
|
15
|
-
import { getUniqueValuesFromReadyChartData as
|
|
16
|
-
import { tabKeys as
|
|
17
|
-
function
|
|
18
|
-
const
|
|
1
|
+
import { deepClone as j } from "@milaboratories/helpers";
|
|
2
|
+
import { getControllerByType as L, getInitialStateByType as H } from "@milaboratories/pf-plots";
|
|
3
|
+
import { ref as d, computed as I, toRaw as C, watch as T, provide as V, reactive as K, inject as k } from "vue";
|
|
4
|
+
import { getInitialAxesSettings as q, getInitialLayersSettings as z, getInitialStatisticsState as J, getInitialTemplate as W } from "./constantsCommon.js";
|
|
5
|
+
import { updateDataBindAes as Q } from "./dataBindAes.js";
|
|
6
|
+
import { notEmpty as X } from "./helpers.js";
|
|
7
|
+
import { storeKey as M } from "./keys.js";
|
|
8
|
+
import { DEFAULT_CONTINUOUS_PALETTE as Y, DEFAULT_CATEGORICAL_PALETTE as Z } from "./constantsAesthetic.js";
|
|
9
|
+
import { loadDataForPlot as $ } from "./utils/createChartSettingsForRender/composeChartSettings.js";
|
|
10
|
+
import { calculateDiscreteGroups as U } from "./utils/calculateDiscreteGroups.js";
|
|
11
|
+
import { addFixedOptionsToState as R } from "./utils/addFixedOptionsToState.js";
|
|
12
|
+
import { loadDefaultSources as x } from "./utils/loadDefaultSources.js";
|
|
13
|
+
import { copyJSON as A } from "./utils/copyJSON.js";
|
|
14
|
+
import { getUsedAesInMapping as P } from "./utils/getUsedAesInMapping.js";
|
|
15
|
+
import { getUniqueValuesFromReadyChartData as tt, loadFilterLabelsForTitle as et } from "./utils/loadUniqueValuesToSave.js";
|
|
16
|
+
import { tabKeys as at } from "./forms/index.js";
|
|
17
|
+
function ot(t, e) {
|
|
18
|
+
const l = A(H(t));
|
|
19
19
|
if ((e == null ? void 0 : e.type) !== t)
|
|
20
|
-
return
|
|
21
|
-
const
|
|
20
|
+
return l;
|
|
21
|
+
const g = A(e);
|
|
22
22
|
return {
|
|
23
|
-
...
|
|
24
|
-
...
|
|
23
|
+
...l,
|
|
24
|
+
...g,
|
|
25
25
|
components: {
|
|
26
|
-
...
|
|
27
|
-
...
|
|
26
|
+
...l.components,
|
|
27
|
+
...g.components
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
|
-
function
|
|
32
|
-
return
|
|
31
|
+
function nt(t, e) {
|
|
32
|
+
return K({
|
|
33
33
|
chartType: e,
|
|
34
34
|
// from pf-plots
|
|
35
|
-
optionsState:
|
|
35
|
+
optionsState: ot(e, t.optionsState),
|
|
36
36
|
// contains user selected inputs
|
|
37
|
-
dataStateKey:
|
|
37
|
+
dataStateKey: j(t.dataStateKey),
|
|
38
38
|
// local form states, updates directly in forms
|
|
39
|
-
template:
|
|
40
|
-
statisticsSettings:
|
|
41
|
-
layersSettings:
|
|
42
|
-
axesSettings:
|
|
39
|
+
template: W(t.template, e),
|
|
40
|
+
statisticsSettings: J(e, t.statisticsSettings),
|
|
41
|
+
layersSettings: z(t.layersSettings),
|
|
42
|
+
axesSettings: q(e, t.axesSettings),
|
|
43
43
|
// common aesthetics data mapped on columns/axes values
|
|
44
|
-
dataBindAes:
|
|
44
|
+
dataBindAes: A(t.dataBindAes ?? {}),
|
|
45
45
|
chartScale: t.zoomState ?? 100,
|
|
46
46
|
lassoControlsState: null,
|
|
47
47
|
currentTab: null,
|
|
48
|
-
tabDefaultState:
|
|
48
|
+
tabDefaultState: at().reduce((l, g) => (l[g] = {}, l), {}),
|
|
49
49
|
dendroInfoByClick: null,
|
|
50
50
|
dendroSelectedNodeId: null,
|
|
51
51
|
showTooltipHint: !1
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
|
-
function
|
|
54
|
+
function it(t, e, l, g, S, y, f, D, a, o) {
|
|
55
55
|
return {
|
|
56
56
|
reactive: t,
|
|
57
|
-
loading:
|
|
57
|
+
loading: K({
|
|
58
58
|
initialInputGuide: !0,
|
|
59
59
|
initialCharts: !0,
|
|
60
60
|
initialDefaults: !0,
|
|
@@ -65,155 +65,161 @@ function at(t, e, u, m, S, y, v, a, f) {
|
|
|
65
65
|
}),
|
|
66
66
|
commonHelpersData: {
|
|
67
67
|
primaryGroups: I(
|
|
68
|
-
() =>
|
|
68
|
+
() => U(
|
|
69
69
|
t.optionsState,
|
|
70
70
|
y.value,
|
|
71
71
|
"primaryGrouping"
|
|
72
72
|
)
|
|
73
73
|
),
|
|
74
74
|
secondaryGroups: I(
|
|
75
|
-
() =>
|
|
75
|
+
() => U(
|
|
76
76
|
t.optionsState,
|
|
77
77
|
y.value,
|
|
78
78
|
"secondaryGrouping"
|
|
79
79
|
)
|
|
80
80
|
),
|
|
81
81
|
usedAesInMapping: I(
|
|
82
|
-
() =>
|
|
82
|
+
() => P(
|
|
83
83
|
t.chartType,
|
|
84
84
|
t.template,
|
|
85
85
|
t.layersSettings,
|
|
86
86
|
t.statisticsSettings,
|
|
87
87
|
t.optionsState,
|
|
88
|
-
|
|
88
|
+
l.value
|
|
89
89
|
)
|
|
90
90
|
),
|
|
91
91
|
dendroTableData: S
|
|
92
92
|
},
|
|
93
|
-
controller:
|
|
93
|
+
controller: L(t.chartType),
|
|
94
94
|
columnsDataStore: e,
|
|
95
|
-
inputGuide:
|
|
96
|
-
chartData:
|
|
95
|
+
inputGuide: l,
|
|
96
|
+
chartData: g,
|
|
97
97
|
uniqueValuesData: y,
|
|
98
|
-
filterSuggestionsData:
|
|
99
|
-
filterLabelsInfo:
|
|
100
|
-
readonlyInputs:
|
|
98
|
+
filterSuggestionsData: f,
|
|
99
|
+
filterLabelsInfo: D,
|
|
100
|
+
readonlyInputs: a,
|
|
101
|
+
defaultPalette: {
|
|
102
|
+
categorical: typeof o == "object" && o.categorical ? o.categorical : typeof o == "string" ? o : Z,
|
|
103
|
+
continuous: typeof o == "object" && o.continuous ? o.continuous : typeof o == "string" ? o : Y
|
|
104
|
+
}
|
|
101
105
|
};
|
|
102
106
|
}
|
|
103
|
-
function
|
|
104
|
-
|
|
107
|
+
function bt(t, e, l, g, S, y, f, D) {
|
|
108
|
+
console.log("defaultPalette", D);
|
|
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(
|
|
105
110
|
a,
|
|
106
|
-
|
|
107
|
-
D,
|
|
108
|
-
N,
|
|
109
|
-
x,
|
|
111
|
+
C(e.value),
|
|
110
112
|
h,
|
|
113
|
+
N,
|
|
114
|
+
B,
|
|
111
115
|
b,
|
|
112
|
-
|
|
113
|
-
|
|
116
|
+
G,
|
|
117
|
+
E,
|
|
118
|
+
f,
|
|
119
|
+
D
|
|
114
120
|
));
|
|
115
121
|
T(() => e.value, () => {
|
|
116
|
-
|
|
122
|
+
E.value = {}, b.value = {}, G.value = {};
|
|
117
123
|
}), T([
|
|
118
124
|
() => e.value,
|
|
119
|
-
() =>
|
|
120
|
-
], async ([
|
|
121
|
-
if (!
|
|
125
|
+
() => g.value
|
|
126
|
+
], async ([i, c]) => {
|
|
127
|
+
if (!c || !i || !n.value.loading.initialDefaults)
|
|
122
128
|
return;
|
|
123
|
-
|
|
124
|
-
const
|
|
125
|
-
var
|
|
126
|
-
return ((
|
|
129
|
+
n.value.loading.initialDefaults = !1, n.value.loading.initialInputGuide = !0;
|
|
130
|
+
const s = A(a.optionsState.components), r = c.filter((u) => {
|
|
131
|
+
var v;
|
|
132
|
+
return ((v = a.optionsState.components[u.inputName]) == null ? void 0 : v.selectorStates.length) === 0 || (f == null ? void 0 : f.includes(u.inputName));
|
|
127
133
|
});
|
|
128
|
-
if (
|
|
134
|
+
if (r.length === 0)
|
|
129
135
|
return;
|
|
130
|
-
|
|
131
|
-
|
|
136
|
+
r.forEach((u) => {
|
|
137
|
+
s[u.inputName].selectorStates = [];
|
|
132
138
|
});
|
|
133
|
-
const
|
|
139
|
+
const m = await x(i, r);
|
|
134
140
|
for (const {
|
|
135
|
-
inputName:
|
|
136
|
-
selectedSource:
|
|
137
|
-
filterType:
|
|
138
|
-
selectedFilterValues:
|
|
139
|
-
selectedFilterRange:
|
|
140
|
-
} of
|
|
141
|
-
|
|
142
|
-
selectedSource:
|
|
143
|
-
type:
|
|
144
|
-
selectedFilterValues:
|
|
145
|
-
selectedFilterRange:
|
|
141
|
+
inputName: u,
|
|
142
|
+
selectedSource: p,
|
|
143
|
+
filterType: v,
|
|
144
|
+
selectedFilterValues: O,
|
|
145
|
+
selectedFilterRange: _
|
|
146
|
+
} of m)
|
|
147
|
+
s[u].selectorStates.push({
|
|
148
|
+
selectedSource: p,
|
|
149
|
+
type: v,
|
|
150
|
+
selectedFilterValues: O,
|
|
151
|
+
selectedFilterRange: _
|
|
146
152
|
});
|
|
147
153
|
a.optionsState.components = {
|
|
148
154
|
...a.optionsState.components,
|
|
149
|
-
...
|
|
155
|
+
...s
|
|
150
156
|
};
|
|
151
157
|
}, { immediate: !0 });
|
|
152
|
-
const
|
|
158
|
+
const w = d(0);
|
|
153
159
|
T([
|
|
154
160
|
() => a.optionsState,
|
|
155
161
|
() => e.value,
|
|
156
162
|
() => S.value
|
|
157
|
-
], async ([
|
|
158
|
-
|
|
159
|
-
const
|
|
160
|
-
|
|
161
|
-
const
|
|
162
|
-
if (
|
|
163
|
-
|
|
164
|
-
const
|
|
165
|
-
|
|
163
|
+
], async ([i, c, s]) => {
|
|
164
|
+
w.value++;
|
|
165
|
+
const r = w.value;
|
|
166
|
+
n.value.loading.inputGuide = !0;
|
|
167
|
+
const m = c && s ? (await x(c, s, !1)).map((p) => p.selectedSource) : [], u = c ? await o.calculateOptions(C(c), i, m, y) : o.getEmptyInputGuide(i);
|
|
168
|
+
if (r === w.value && (h.value = u, n.value.loading.inputGuide = !1, n.value.loading.initialInputGuide)) {
|
|
169
|
+
n.value.loading.initialInputGuide = !1;
|
|
170
|
+
const p = t.currentTab === void 0 ? "dataMapping" : t.currentTab;
|
|
171
|
+
n.value.reactive.currentTab = n.value.reactive.currentTab ?? p;
|
|
166
172
|
}
|
|
167
173
|
}, { immediate: !0, deep: !0 });
|
|
168
|
-
const
|
|
169
|
-
if (T(() =>
|
|
170
|
-
|
|
171
|
-
const
|
|
172
|
-
|
|
173
|
-
}, 300),
|
|
174
|
-
if (clearTimeout(
|
|
175
|
-
const { uniqueValues:
|
|
176
|
-
|
|
177
|
-
|
|
174
|
+
const F = d(0);
|
|
175
|
+
if (T(() => h.value, async (i) => {
|
|
176
|
+
F.value++;
|
|
177
|
+
const c = F.value, s = setTimeout(() => {
|
|
178
|
+
n.value.loading.chartData = !0;
|
|
179
|
+
}, 300), r = C(e.value), m = await $(i, a, r, S.value);
|
|
180
|
+
if (clearTimeout(s), m && r) {
|
|
181
|
+
const { uniqueValues: u, filterSuggestions: p } = await tt(
|
|
182
|
+
m,
|
|
183
|
+
i,
|
|
178
184
|
a.optionsState.components,
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
G
|
|
185
|
+
o,
|
|
186
|
+
r,
|
|
187
|
+
C(G.value)
|
|
182
188
|
);
|
|
183
|
-
|
|
189
|
+
b.value = u, G.value = p, Q(a.optionsState, a.dataBindAes, b.value);
|
|
184
190
|
}
|
|
185
|
-
|
|
191
|
+
E.value = r ? await et(
|
|
186
192
|
a.optionsState.components,
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
) : {},
|
|
193
|
+
i,
|
|
194
|
+
o,
|
|
195
|
+
r
|
|
196
|
+
) : {}, c === F.value && (N.value = m, i.ready && (n.value.loading.initialCharts = !1), n.value.loading.chartData = !1);
|
|
191
197
|
}, { immediate: !0, deep: !0 }), a.chartType === "dendro") {
|
|
192
|
-
const
|
|
198
|
+
const i = d(0);
|
|
193
199
|
T([
|
|
194
200
|
() => a.optionsState,
|
|
195
201
|
() => e.value,
|
|
196
|
-
() =>
|
|
202
|
+
() => h.value.readyData,
|
|
197
203
|
() => S.value
|
|
198
|
-
], async ([
|
|
199
|
-
if (
|
|
200
|
-
|
|
201
|
-
const
|
|
202
|
-
|
|
203
|
-
const
|
|
204
|
-
|
|
204
|
+
], async ([c, s, r, m]) => {
|
|
205
|
+
if (r && s) {
|
|
206
|
+
i.value++;
|
|
207
|
+
const u = i.value;
|
|
208
|
+
n.value.loading.dendroTableData = !0;
|
|
209
|
+
const p = await R(c, s, m), v = await o.createTableData(s, p);
|
|
210
|
+
i.value === u && (B.value = v), n.value.loading.dendroTableData = !1;
|
|
205
211
|
}
|
|
206
212
|
}, { immediate: !0 });
|
|
207
213
|
}
|
|
208
|
-
return
|
|
214
|
+
return V(M, n), n;
|
|
209
215
|
}
|
|
210
|
-
function
|
|
211
|
-
return
|
|
216
|
+
function Gt() {
|
|
217
|
+
return X(k(M), "Empty store");
|
|
212
218
|
}
|
|
213
219
|
export {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
220
|
+
nt as createReactiveState,
|
|
221
|
+
it as factoryStore,
|
|
222
|
+
bt as provideStore,
|
|
223
|
+
Gt as useStore
|
|
218
224
|
};
|
|
219
225
|
//# sourceMappingURL=store.js.map
|
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 { 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 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';\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}\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): 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 };\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) {\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 ));\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","computed","calculateDiscreteGroups","getUsedAesInMapping","getControllerByType","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":";;;;;;;;;;;;;;;;AAkDA,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,UAAU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AAU,QAAQ4C,GACdF,EAAG,UACLxB,EAAM,MAAM,QAAQ,gBAAgB,KAEtCA,EAAM,MAAM,QAAQ,YAAY;AAAA,EAEpC,GAAG,EAAE,WAAW,IAAM,MAAM,IAAM,GAG9BrB,EAAc,cAAc,UAAU;AACxC,UAAMsD,IAAoBlC,EAAI,CAAC;AAC/B,IAAAG,EAAM;AAAA,MACJ,MAAMvB,EAAc;AAAA,MACpB,MAAMe,EAAa;AAAA,MACnB,MAAMb,EAAW,MAAM;AAAA,MACvB,MAAMe,EAAgB;AAAA,IAAA,GACrB,OAAO,CAAClC,GAAckB,GAAWsD,GAAOC,CAAK,MAAM;AACpD,UAAID,KAAStD,GAAW;AACtB,QAAAqD,EAAkB;AAClB,cAAMf,IAAUe,EAAkB;AAClC,QAAAjC,EAAM,MAAM,QAAQ,kBAAkB;AACtC,cAAMoC,IAAQ,MAAMC,EAAuB3E,GAAckB,GAAWuD,CAAK,GACnEG,IAAsB,MAAOxC,EAAgD,gBAAgBlB,GAAWwD,CAAK;AAEnH,QAAIH,EAAkB,UAAUf,MAC9BnC,EAAgB,QAAQuD,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 { 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,oB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