@milaboratories/graph-maker 1.1.143 → 1.1.145
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/GraphMaker/index.vue.d.ts.map +1 -1
- package/dist/GraphMaker/index.vue.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/getCells.js +64 -64
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/getCells.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/utils/calculateCaptionTails.js +31 -31
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/utils/calculateCaptionTails.js.map +1 -1
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/ComponentController.js +39 -32
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/ComponentController.js.map +1 -1
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/ControllerBase.js +68 -62
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/ControllerBase.js.map +1 -1
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/dendro.js +5 -5
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/histogram.js +8 -8
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/scatterplot-umap.js +3 -3
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/scatterplot.js +6 -6
- package/dist/node_modules/@milaboratories/pf-plots/dist/index.js +12 -9
- package/dist/node_modules/@milaboratories/pf-plots/dist/index.js.map +1 -1
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-error-like/dist/{index.js → error_like_shape.js} +1 -1
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-error-like/dist/error_like_shape.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/drivers/blob.js +8 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/drivers/blob.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/data_types.js +63 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/data_types.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/linker_columns.js +152 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/linker_columns.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/spec.js +189 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/spec.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/errors.js +18 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/errors.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/json.js +12 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/json.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/plid.js +7 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/plid.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/ref.js +8 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/ref.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@platforma-sdk/model/dist/components/PlDataTable.js +13 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@platforma-sdk/model/dist/components/PlDataTable.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@platforma-sdk/model/dist/render/util/label.js +89 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@platforma-sdk/model/dist/render/util/label.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/pframe/ColumnsProvider.js +50 -45
- package/dist/node_modules/@milaboratories/pf-plots/dist/pframe/ColumnsProvider.js.map +1 -1
- package/dist/node_modules/@milaboratories/pf-plots/dist/utils.js +54 -50
- package/dist/node_modules/@milaboratories/pf-plots/dist/utils.js.map +1 -1
- package/package.json +4 -4
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-error-like/dist/index.js.map +0 -1
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/index.js +0 -979
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/index.js.map +0 -1
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@platforma-sdk/model/dist/index.js +0 -1599
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@platforma-sdk/model/dist/index.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ControllerBase.js","sources":["../../../../../../node_modules/@milaboratories/pf-plots/src/controllers/ControllerBase.ts"],"sourcesContent":["import {\n AxisSpec,\n LinkerMap,\n PColumnSpec,\n PObjectId,\n PTableRecordSingleValueFilterV2\n} from '@milaboratories/pl-model-common';\nimport {deriveLabels} from '@platforma-sdk/model';\nimport type {\n AxisData,\n ColumnData,\n ComponentGuideFilter,\n ComponentGuideSimple,\n ComponentsGuide,\n DataByColumns,\n FilterComponentControllers,\n FilterComponents,\n InputGuide,\n InputState,\n SelectorState,\n SelectorStateFilter,\n SelectorStateSimple,\n SimpleComponentControllers,\n SimpleComponents,\n} from '../common';\nimport { DISCRETE_VALUES_KEY, HIGH_CARDINALITY } from '../constants';\nimport { PValue } from '../store';\nimport type { DataStore } from '../store';\nimport type { ColumnOrAxisIdString } from '../spec';\nimport { AxisId, ColumnId, columnOrAxisIdFromString, isColumnId } from '../spec';\nimport {\n addSourceInfoToMap,\n createLinkerMap,\n dataColumnPredicateDefault,\n getColumnOrAxisValueLabelsId,\n getDefaultInfo,\n getStateCopy,\n} from '../utils';\nimport { ComponentController } from './ComponentController';\n\ntype InputOptionsUnion<State extends InputState> = Record<\n SimpleComponents<State> | FilterComponents<State>,\n ComponentGuideSimple | ComponentGuideFilter\n>;\nexport interface Controller<State extends InputState> {\n calculateOptions(\n store: DataStore,\n state: State,\n fixedIds?: string[],\n dataColumnPredicate?: (spec: PColumnSpec) => boolean\n ): Promise<InputGuide<State>>;\n\n getUniqueSourceValuesWithLabels(\n store: DataStore,\n inputGuide: InputGuide<State>,\n selectedSource: ColumnOrAxisIdString,\n limit?:number,\n searchQuery?: string,\n searchQueryByValue?: string,\n ): Promise<{\n values: {\n value: string;\n label: string;\n }[],\n overflow: boolean;\n }>;\n\n getEmptyInputGuide(state: State): InputGuide<State>;\n\n createDataForPlot(store: DataStore, state: State): Promise<PlotDataAndSettings>;\n\n changeSelected(\n inputName: keyof State['components'],\n store: DataStore,\n state: State,\n nextSelectorStates: SelectorStateFilter[] | SelectorStateSimple[]\n ): State;\n}\n\nexport interface PlotDataAndSettings {\n data: {\n byColumns: DataByColumns,\n axesData?: Record<string, PValue[]>\n };\n settings: Record<string, unknown>;\n}\n\nexport abstract class ControllerBase<State extends InputState> implements Controller<State> {\n readonly ignoredOptionIdNames: string[] = [];\n readonly dataInputs: string[] = [];\n readonly dontAllowUnfilteredHighCardinality: boolean = false;\n\n protected constructor(\n readonly simpleComponentControllers: SimpleComponentControllers<State>,\n readonly filterComponentControllers: FilterComponentControllers<State>\n ) {}\n\n get requiredComponents(): (keyof State['components'])[] {\n const components: (keyof State['components'])[] = [];\n for (const componentName of Object.keys(this.simpleComponentControllers) as SimpleComponents<State>[]) {\n if (this.simpleComponentControllers[componentName].isRequired) {\n components.push(componentName);\n }\n }\n return components;\n }\n\n get dimensionsConsumerComponents(): (keyof State['components'])[] {\n const components: (keyof State['components'])[] = [];\n for (const componentName of Object.keys(this.simpleComponentControllers) as SimpleComponents<State>[]) {\n if (this.simpleComponentControllers[componentName].isDimensionsConsumer) {\n components.push(componentName);\n }\n }\n for (const componentName of Object.keys(this.filterComponentControllers) as FilterComponents<State>[]) {\n if (this.filterComponentControllers[componentName].isDimensionsConsumer) {\n components.push(componentName);\n }\n }\n return components;\n }\n\n addSelected(\n inputName: keyof State['components'],\n state: State,\n selectorState: SelectorStateFilter | SelectorStateSimple\n ) {\n if (inputName in this.simpleComponentControllers) {\n return (\n this.simpleComponentControllers[\n inputName as keyof typeof this.simpleComponentControllers\n ] as ComponentController<State, typeof inputName>\n ).addSelected(state, selectorState);\n }\n if (inputName in this.filterComponentControllers) {\n return (\n this.filterComponentControllers[\n inputName as keyof typeof this.filterComponentControllers\n ] as ComponentController<State, typeof inputName>\n ).addSelected(state, selectorState);\n }\n throw Error(`Unknown input name: ${String(inputName)}`);\n }\n\n deleteSelected(\n inputName: keyof State['components'],\n store: DataStore,\n state: State,\n selectorState: SelectorStateFilter | SelectorStateSimple\n ) {\n if (inputName in this.simpleComponentControllers) {\n return (\n this.simpleComponentControllers[\n inputName as keyof typeof this.simpleComponentControllers\n ] as ComponentController<State, typeof inputName>\n ).deleteSelected(state, selectorState.selectedSource);\n }\n if (inputName in this.filterComponentControllers) {\n return (\n this.filterComponentControllers[\n inputName as keyof typeof this.filterComponentControllers\n ] as ComponentController<State, typeof inputName>\n ).deleteSelected(state, selectorState.selectedSource);\n }\n throw Error(`Unknown input name: ${String(inputName)}`);\n }\n\n changeSelected(\n inputName: keyof State['components'],\n store: DataStore,\n state: State,\n nextSelectorStates: SelectorState[]\n ) {\n const currentStates: SelectorState[] = state.components[inputName].selectorStates;\n const deletedStates = currentStates.filter(currentState => {\n return !nextSelectorStates.find(s => s.selectedSource === currentState.selectedSource);\n });\n const addedStates = nextSelectorStates.filter(nextState => {\n return !currentStates.find(s => s.selectedSource === nextState.selectedSource);\n });\n let nextState = getStateCopy(state);\n deletedStates.forEach(selectorState => {\n nextState = this.deleteSelected(inputName, store, nextState, selectorState);\n });\n addedStates.forEach(selectorState => {\n nextState = this.addSelected(inputName, nextState, selectorState);\n });\n // reorder\n state.components[inputName].selectorStates = nextSelectorStates\n .map(st =>\n (state.components[inputName].selectorStates as SelectorState[]).find(\n s => s.selectedSource === st.selectedSource\n )\n )\n .filter(Boolean) as SelectorStateFilter[] | SelectorStateSimple[];\n return nextState;\n }\n\n switchDividableAxis(state: State, axis: AxisId): State {\n // ***\n // logic for axis dividing/collapsing\n // ***\n return getStateCopy(state);\n }\n\n async getMustBeConsumedAxes(store: DataStore, state: State): Promise<Set<ColumnOrAxisIdString>> {\n return Promise.resolve(new Set());\n }\n\n private createEmptyComponentsGuide(state: State): InputOptionsUnion<State> {\n return Object.fromEntries(\n Object.entries(state.components).map(\n ([key, value]): [string, ComponentGuideSimple | ComponentGuideFilter] => {\n return [\n key,\n {\n options: [],\n optionsInfo: new Map(),\n stateConsistency: {},\n required: false,\n multipleSelectors: false,\n },\n ];\n }\n )\n ) as InputOptionsUnion<State>;\n }\n\n async getSelectedSourcesInfo(\n store: DataStore,\n state: State,\n labelsMap: Record<string, string>,\n linkerMap: LinkerMap\n ): Promise<Map<ColumnOrAxisIdString, AxisData | ColumnData>> {\n const result: Map<ColumnOrAxisIdString, AxisData> = new Map();\n\n const dataAxes = new Set<string>();\n const dataAxesList: AxisSpec[] = [];\n for (const inputName of this.dataInputs) {\n for (const selectorState of state.components[inputName].selectorStates) {\n const id = columnOrAxisIdFromString(selectorState.selectedSource);\n if (isColumnId(id)) {\n const columnSpec = await store.pFrameProvider.getColumnSpecById(id);\n if (columnSpec) {\n columnSpec.axesSpec.forEach(axisSpec => {\n const idStr = AxisId.fromAxisSpec(axisSpec).toCanonicalString();\n if (!dataAxes.has(idStr)) {\n dataAxes.add(idStr);\n dataAxesList.push(axisSpec);\n }\n });\n }\n }\n }\n }\n for (const [inputName , {selectorStates}] of Object.entries(state.components)) {\n const component = this.simpleComponentControllers[inputName as keyof typeof this.simpleComponentControllers]\n ?? this.filterComponentControllers[inputName as keyof typeof this.filterComponentControllers] as ComponentController<State, typeof inputName>;\n const fixedAxesAllowed = component.settings.columnsWithExtraAxesAllowed;\n for (const {selectedSource} of selectorStates) {\n await addSourceInfoToMap(\n store,\n selectedSource,\n labelsMap[selectedSource],\n result,\n dataAxesList,\n dataAxes,\n fixedAxesAllowed,\n linkerMap\n );\n }\n }\n return result;\n }\n\n getEmptyInputGuide(state: State): InputGuide<State> {\n return {\n components: this.createEmptyComponentsGuide(state) as ComponentsGuide<State['components']>,\n getSourceInfo: (sourceIdStr: ColumnOrAxisIdString) => getDefaultInfo(sourceIdStr),\n freeOptionsSet: new Set(),\n axesToBeFixedSet: new Set(),\n readyData: false,\n ready: false,\n consistent: true,\n };\n }\n\n getConsumedOptionsSet(state: State) {\n const consumedSourcesSet: Set<ColumnOrAxisIdString> = new Set();\n for (const componentName of this.dimensionsConsumerComponents) {\n for (const {selectedSource} of state.components[componentName].selectorStates) {\n consumedSourcesSet.add(selectedSource);\n }\n }\n return consumedSourcesSet;\n }\n\n async getLabelsMap(store: DataStore, state: State) {\n const availableColumns = await store.pFrameProvider.getColumnsFull(\n this.dataInputs.reduce((res: (ColumnId | AxisId)[], inputName) => {\n const componentState = state.components[inputName];\n const sources = componentState.selectorStates.map(st => columnOrAxisIdFromString(st.selectedSource));\n return res.concat(sources);\n }, []),\n false\n );\n return deriveLabels(availableColumns, el => el.spec).reduce((res: Record<string, string>, el) => {\n const id = new ColumnId({name: el.value.columnId, type: el.value.spec.valueType}).toCanonicalString();\n res[id] = el.label;\n return res;\n }, {});\n }\n\n async calculateOptions(\n store: DataStore,\n state: State,\n fixedIds: string[] = [],\n dataColumnPredicate = dataColumnPredicateDefault\n ): Promise<InputGuide<State>> {\n // creating empty options object corresponding to the provided state\n const resultComponentsGuide: InputOptionsUnion<State> = this.createEmptyComponentsGuide(state);\n\n // set of columns and axes that selected in consumer-dimensions components\n const consumedSourcesSet = this.getConsumedOptionsSet(state);\n // for trees block - to ignore treeId and donorId in the interface\n const ignoredNamesSet = new Set<string>(this.ignoredOptionIdNames);\n const fixedSelectedSet = new Set<ColumnOrAxisIdString>(fixedIds);\n\n const linkerMap = await createLinkerMap(store)\n\n const labelsMap = await this.getLabelsMap(store, state); // improved labels with name separation for different columns with the same name; for axes - name from spec or labels column\n const selectedColumnsOrAxesInfo = await this.getSelectedSourcesInfo(store, state, labelsMap, linkerMap);\n const optionsInfo: Map<ColumnOrAxisIdString, ColumnData | AxisData> = new Map();\n\n const allControllers = {...this.simpleComponentControllers, ...this.filterComponentControllers};\n const freeOptionsSet = new Set<ColumnOrAxisIdString>();\n for (const [name, componentController] of Object.entries(allControllers)) {\n const options = await (\n componentController as ComponentController<State, SimpleComponents<State> | FilterComponents<State>>\n ).getOptions(\n store,\n state,\n labelsMap,\n consumedSourcesSet,\n linkerMap,\n dataColumnPredicate,\n ignoredNamesSet,\n fixedSelectedSet\n );\n if (!this.dataInputs.includes(name as string)) {\n options.options.forEach(item => {\n freeOptionsSet.add(item.value);\n });\n }\n for (const [key, v] of options.optionsInfo) {\n optionsInfo.set(key, v);\n }\n resultComponentsGuide[name as keyof InputOptionsUnion<State>] =\n options as (typeof resultComponentsGuide)[keyof InputOptionsUnion<State>];\n }\n\n const markMustBeConsumed = (id: string) => {\n const option = optionsInfo.get(id);\n if (option && option.kind === 'axis') {\n option.mustBeConsumed = true;\n }\n const selected = selectedColumnsOrAxesInfo.get(id);\n if (selected && selected.kind === 'axis') {\n selected.mustBeConsumed = true;\n }\n };\n // axes from heatmap data column, to make visible what axes should be; hanging axes from scatterplot\n const mustBeConsumedAxes = await this.getMustBeConsumedAxes(store, state);\n for (const id of mustBeConsumedAxes) {\n markMustBeConsumed(id);\n }\n\n if (this.dontAllowUnfilteredHighCardinality) {\n // Axes marked 'high cardinality' should be in the filter. Or some column that has this axis should be in the filter.\n // If not - they are marked 'mustBeConsumed'.\n // But also they can be anywhere else.\n const isHighCardinality = (spec: AxisSpec) => spec?.annotations?.[HIGH_CARDINALITY] === 'true';\n const consumedHighCardinalityAxes =\n state.components['filters']?.selectorStates.reduce((consumed: Set<string>, s) => {\n const info = selectedColumnsOrAxesInfo.get(s.selectedSource);\n if (info?.kind === 'column') {\n const axes = info.spec.axesSpec.filter(isHighCardinality);\n axes.forEach(spec => consumed.add(AxisId.fromAxisSpec(spec).toCanonicalString()));\n }\n if (info?.kind === 'axis' && isHighCardinality(info.spec)) {\n consumed.add(AxisId.fromAxisSpec(info.spec).toCanonicalString());\n }\n return consumed;\n }, new Set<string>()) ?? new Set<string>();\n this.dataInputs.forEach(inputName => {\n for (const {selectedSource} of state.components[inputName].selectorStates) {\n const info = selectedColumnsOrAxesInfo.get(selectedSource);\n if (info?.kind === 'column') {\n const axes = info.spec.axesSpec.filter(isHighCardinality);\n axes.forEach(spec => {\n const idStr = AxisId.fromAxisSpec(spec).toCanonicalString();\n if (!freeOptionsSet.has(idStr) && !consumedHighCardinalityAxes.has(idStr)) {\n // return axis to the list of free axis if it is selected somewhere, but nothing with this axis is in the filters\n freeOptionsSet.add(idStr);\n }\n if (!consumedHighCardinalityAxes.has(idStr)) {\n markMustBeConsumed(idStr);\n }\n });\n }\n if (info?.kind === 'axis' && isHighCardinality(info.spec)) {\n const idStr = AxisId.fromAxisSpec(info.spec).toCanonicalString();\n if (!freeOptionsSet.has(idStr)) {\n freeOptionsSet.add(idStr);\n }\n if (!consumedHighCardinalityAxes.has(idStr)) {\n markMustBeConsumed(idStr);\n }\n }\n }\n });\n }\n\n const axesToBeFixedSet = new Set<ColumnOrAxisIdString>();\n for (const {selectorStates} of Object.values(state.components)) {\n for (const {selectedSource} of selectorStates) {\n const info = selectedColumnsOrAxesInfo.get(selectedSource);\n if (info && info.kind === 'column') {\n info.axesToBeFixed.forEach(axisIdStr => {\n axesToBeFixedSet.add(axisIdStr);\n });\n }\n }\n }\n\n const consistent = await this.isConsistent(store, state, linkerMap);\n const getSourceInfo = (sourceIdStr: ColumnOrAxisIdString) => {\n const id = columnOrAxisIdFromString(sourceIdStr).toCanonicalString() ?? sourceIdStr;\n return optionsInfo.get(id) ?? selectedColumnsOrAxesInfo.get(id) ?? getDefaultInfo(sourceIdStr);\n };\n return {\n components: resultComponentsGuide as ComponentsGuide<State['components']>,\n getSourceInfo,\n freeOptionsSet,\n axesToBeFixedSet,\n readyData: this.readyDataInputs(state),\n ready: this.readyForPlotBuilding(store, state, consistent, freeOptionsSet, getSourceInfo),\n consistent,\n };\n }\n\n async getUniqueSourceValuesWithLabels(\n store: DataStore,\n inputGuide: InputGuide<State>,\n selectedSource: ColumnOrAxisIdString,\n limit?:number,\n searchQuery?: string, // search by labels if axis labels exist\n searchQueryValue?: string // search by value, not by label\n ): Promise<{\n values: {\n value: string;\n label: string;\n }[],\n overflow: boolean;\n }> {\n const sortValues = (values:{value:string, label:string}[]) => values.sort((a, b) => a.label.localeCompare(b.label, 'en', {numeric: true}))\n const info = inputGuide.getSourceInfo(selectedSource);\n const discreteValuesStr = info.annotations?.[DISCRETE_VALUES_KEY];\n\n // if column's annotation contains discrete values - take them from it\n try {\n const discreteValues: string[] | null = discreteValuesStr\n ? (JSON.parse(discreteValuesStr) as (string | number)[]).map(v => String(v))\n : null;\n if (discreteValues) {\n const values = discreteValues.map(v => ({value: v, label: v}));\n sortValues(values);\n return {values, overflow: false};\n }\n } catch (err) {\n console.error(`Parsing error: discrete values annotation ${discreteValuesStr} in ${selectedSource}`)\n }\n\n // consider label column for axis\n if (info.kind === 'axis') {\n const axisId = columnOrAxisIdFromString(selectedSource) as AxisId;\n const parentSources = info.parentSources.map(columnOrAxisIdFromString) as ColumnId[];\n const labelsColumnId = await getColumnOrAxisValueLabelsId(store, selectedSource, info.parentSources);\n let filters:PTableRecordSingleValueFilterV2[] = [];\n if (labelsColumnId) {\n if (searchQuery) {\n filters = [{\n type: 'bySingleColumnV2',\n column: {\n type: 'column',\n id: labelsColumnId.name as PObjectId\n },\n predicate: {\n operator: 'StringIContains',\n substring: searchQuery\n }\n }];\n }\n if (searchQueryValue) {\n filters = [{\n type: 'bySingleColumnV2',\n column: {\n type: 'axis',\n id: axisId.toPFrameId()\n },\n predicate: {\n operator: 'StringIContains',\n substring: searchQueryValue\n }\n }];\n }\n const {data: dataValues, axesData} = await store.pFrameProvider.getSingleColumnData(labelsColumnId, filters);\n const axisKeys = axesData[axisId.toCanonicalString()];\n const values:{value: string, label: string}[] = [];\n for (let i = 0; i < Math.min(axisKeys.length, limit ?? axisKeys.length); i++) {\n values.push({value: String(axisKeys[i]), label: String(dataValues[i])});\n }\n sortValues(values);\n return {values, overflow: !(limit === undefined || axisKeys.length < limit)};\n }\n const searchInLabelsOrValue = searchQuery ?? searchQueryValue;\n if (searchInLabelsOrValue) {\n filters = [{\n type: 'bySingleColumnV2',\n column: {\n type: 'axis',\n id: axisId.toPFrameId()\n },\n predicate: {\n operator: 'StringIContains',\n substring: searchInLabelsOrValue\n }\n }];\n }\n const response = await store.pFrameProvider.getAxisUniqueValues(axisId, [parentSources[0]], limit, filters);\n const values = response.values.map(v => ({value: String(v), label: String(v)}));\n sortValues(values);\n return {values, overflow: response.overflow};\n }\n if (info.kind === 'column') {\n const searchInLabelsOrValue = searchQuery ?? searchQueryValue;\n const columnId = columnOrAxisIdFromString(selectedSource) as ColumnId;\n const filters:PTableRecordSingleValueFilterV2[] = searchInLabelsOrValue ? [{\n type: 'bySingleColumnV2',\n column: {\n type: 'column',\n id: columnId.name as PObjectId\n },\n predicate: {\n operator: 'StringIContains',\n substring: searchInLabelsOrValue\n }\n }] : [];\n const response = await store.pFrameProvider.getColumnUniqueValues(columnId, limit, filters);\n const values = response.values.map(v => ({value: String(v), label: String(v)}));\n sortValues(values);\n return {values, overflow: response.overflow};\n }\n return {values: [], overflow: false};\n }\n\n async checkStateConsistency(\n store: DataStore,\n state: State,\n linkerMap: LinkerMap\n ): Promise<Map<keyof State['components'], Record<string, boolean>>> {\n const result: Map<keyof State['components'], Record<string, boolean>> = new Map();\n for (const component of Object.keys(this.simpleComponentControllers) as SimpleComponents<State>[]) {\n result.set(\n component as keyof State['components'],\n await this.simpleComponentControllers[component].checkStateConsistency(store, state, linkerMap)\n );\n }\n for (const component of Object.keys(this.filterComponentControllers) as FilterComponents<State>[]) {\n result.set(\n component as keyof State['components'],\n await this.filterComponentControllers[component].checkStateConsistency(store, state, linkerMap)\n );\n }\n return result;\n }\n\n async isConsistent(store: DataStore, state: State, linkerMap: LinkerMap): Promise<boolean> {\n const consistency = await this.checkStateConsistency(store, state, linkerMap);\n for (const value of consistency.values()) {\n if (Object.values(value).some(item => !item)) {\n return false;\n }\n }\n return true;\n }\n\n readyDataInputs(state: State): boolean {\n return this.dataInputs.every(name => state.components[name].selectorStates.length > 0);\n }\n\n readyForPlotBuilding(\n store: DataStore,\n state: State,\n consistent: boolean,\n freeOptionsSet: Set<ColumnOrAxisIdString>,\n getSourceInfo: (id: ColumnOrAxisIdString) => ColumnData | AxisData\n ): boolean {\n if (!consistent || !this.readyDataInputs(state)) {\n return false;\n }\n let hasFreeDimensions: boolean = false;\n for (const optionId of freeOptionsSet) {\n const info = getSourceInfo(optionId);\n if (info && info.kind === 'axis' && info.mustBeConsumed) {\n hasFreeDimensions = true;\n break;\n }\n }\n let hasNotSelectedAxisToBeFixed: boolean = false;\n for (const {selectorStates} of Object.values(state.components)) {\n for (const {selectedSource, fixedAxes} of selectorStates) {\n const info = getSourceInfo(selectedSource);\n if (\n info &&\n info.kind === 'column' &&\n info.axesToBeFixed.some(\n id => (fixedAxes ?? []).find(el => el.axisSource === id)?.axisValue === undefined\n )\n ) {\n hasNotSelectedAxisToBeFixed = true;\n break;\n }\n }\n if (hasNotSelectedAxisToBeFixed) {\n break;\n }\n }\n return (\n this.requiredComponents.every(name => state.components[name].selectorStates.length > 0) &&\n !hasFreeDimensions &&\n !hasNotSelectedAxisToBeFixed\n );\n }\n\n abstract createDataByColumns(store: DataStore, state: State): Promise<PlotDataAndSettings['data']>;\n\n abstract createChartSettings(store: DataStore, state: State): Promise<PlotDataAndSettings['settings']>;\n\n async createDataForPlot(store: DataStore, state: State): Promise<PlotDataAndSettings> {\n return {\n data: await this.createDataByColumns(store, state),\n settings: await this.createChartSettings(store, state),\n };\n }\n}\n"],"names":["ControllerBase","simpleComponentControllers","filterComponentControllers","__publicField","components","componentName","inputName","state","selectorState","store","nextSelectorStates","currentStates","deletedStates","currentState","s","addedStates","nextState","h","getStateCopy","st","axis","key","value","labelsMap","linkerMap","result","dataAxes","dataAxesList","id","columnOrAxisIdFromString","isColumnId","columnSpec","axisSpec","idStr","AxisId","selectorStates","fixedAxesAllowed","selectedSource","addSourceInfoToMap","sourceIdStr","getDefaultInfo","consumedSourcesSet","availableColumns","res","sources","a","deriveLabels","el","ColumnId","fixedIds","dataColumnPredicate","dataColumnPredicateDefault","resultComponentsGuide","ignoredNamesSet","fixedSelectedSet","createLinkerMap","selectedColumnsOrAxesInfo","optionsInfo","allControllers","freeOptionsSet","name","componentController","options","item","v","markMustBeConsumed","option","selected","mustBeConsumedAxes","isHighCardinality","spec","_a","HIGH_CARDINALITY","consumedHighCardinalityAxes","consumed","info","axesToBeFixedSet","axisIdStr","consistent","getSourceInfo","inputGuide","limit","searchQuery","searchQueryValue","sortValues","values","b","discreteValuesStr","DISCRETE_VALUES_KEY","discreteValues","axisId","parentSources","labelsColumnId","getColumnOrAxisValueLabelsId","filters","dataValues","axesData","axisKeys","i","searchInLabelsOrValue","response","w","columnId","component","consistency","hasFreeDimensions","optionId","hasNotSelectedAxisToBeFixed","fixedAxes","S"],"mappings":";;;;;AAuFO,MAAeA,EAAsE;AAAA,EAK9E,YACGC,GACAC,GACX;AAPOC,MAAA,8BAAiC,EAAC,GAClCA,EAAA,oBAAuB,EAAC,GACxBA,EAAA,MAAA,sCAA8C,EA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iBAAW,EAAC,gBAAA8B,GAAgB,WAAAuE,EAAAA,KAAczE,GAAgB;AAChD,cAAAwC,IAAOI,EAAc1C,CAAc;AACzC,YACIsC,KACAA,EAAK,SAAS,YACdA,EAAK,cAAc;AAAA,UACf,CAAA/C,MAAA;;AAAO,qBAAA2C,KAAAqC,KAAa,CAAA,GAAI,KAAK,CAAAC,MAAM9D,EAAG,eAAenB,CAAE,MAAhD,OAAA,SAAA2C,EAAmD,eAAc;AAAA,UAAA;AAAA,QAAA,GAE9E;AACgCoC,cAAA;AAC9B;AAAA,QAAA;AAAA,MACJ;AAEJ,UAAIA;AACA;AAAA,IACJ;AAEJ,WACI,KAAK,mBAAmB,MAAM,CAAA/C,MAAQrD,EAAM,WAAWqD,CAAI,EAAE,eAAe,SAAS,CAAC,KACtF,CAAC6C,KACD,CAACE;AAAAA,EAAA;AAAA,EAQT,MAAM,kBAAkBlG,GAAkBF,GAA4C;AAC3E,WAAA;AAAA,MACH,MAAM,MAAM,KAAK,oBAAoBE,GAAOF,CAAK;AAAA,MACjD,UAAU,MAAM,KAAK,oBAAoBE,GAAOF,CAAK;AAAA,IAAA;AAAA,EACzD;AAER;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"ControllerBase.js","sources":["../../../../../../node_modules/@milaboratories/pf-plots/src/controllers/ControllerBase.ts"],"sourcesContent":["import {\n AxisSpec,\n LinkerMap,\n PColumnSpec,\n PObjectId,\n PTableRecordSingleValueFilterV2\n} from '@milaboratories/pl-model-common';\nimport {deriveLabels} from '@platforma-sdk/model';\nimport type {\n AxisData,\n ColumnData,\n ComponentGuideFilter,\n ComponentGuideSimple,\n ComponentsGuide,\n DataByColumns,\n FilterComponentControllers,\n FilterComponents,\n InputGuide,\n InputState,\n SelectorState,\n SelectorStateFilter,\n SelectorStateSimple,\n SimpleComponentControllers,\n SimpleComponents,\n} from '../common';\nimport { DISCRETE_VALUES_KEY, HIGH_CARDINALITY } from '../constants';\nimport { PValue } from '../store';\nimport type { DataStore } from '../store';\nimport type { ColumnOrAxisIdString } from '../spec';\nimport { AxisId, ColumnId, columnOrAxisIdFromString, isColumnId } from '../spec';\nimport {\n addSourceInfoToMap,\n createLinkerMap,\n dataColumnPredicateDefault,\n getColumnOrAxisValueLabelsId,\n getDefaultInfo,\n getStateCopy,\n} from '../utils';\nimport { ComponentController } from './ComponentController';\n\ntype InputOptionsUnion<State extends InputState> = Record<\n SimpleComponents<State> | FilterComponents<State>,\n ComponentGuideSimple | ComponentGuideFilter\n>;\nexport interface Controller<State extends InputState> {\n calculateOptions(\n store: DataStore,\n state: State,\n fixedIds?: string[],\n dataColumnPredicate?: (spec: PColumnSpec) => boolean\n ): Promise<InputGuide<State>>;\n\n getUniqueSourceValuesWithLabels(\n store: DataStore,\n inputGuide: InputGuide<State>,\n selectedSource: ColumnOrAxisIdString,\n limit?:number,\n searchQuery?: string,\n searchQueryByValue?: string,\n ): Promise<{\n values: {\n value: string;\n label: string;\n }[],\n overflow: boolean;\n }>;\n\n getEmptyInputGuide(state: State): InputGuide<State>;\n\n createDataForPlot(store: DataStore, state: State): Promise<PlotDataAndSettings>;\n\n changeSelected(\n inputName: keyof State['components'],\n store: DataStore,\n state: State,\n nextSelectorStates: SelectorStateFilter[] | SelectorStateSimple[]\n ): State;\n}\n\nexport interface PlotDataAndSettings {\n data: {\n byColumns: DataByColumns,\n axesData?: Record<string, PValue[]>\n };\n settings: Record<string, unknown>;\n}\n\nexport abstract class ControllerBase<State extends InputState> implements Controller<State> {\n readonly ignoredOptionIdNames: string[] = [];\n readonly dataInputs: string[] = [];\n readonly dontAllowUnfilteredHighCardinality: boolean = false;\n\n protected constructor(\n readonly simpleComponentControllers: SimpleComponentControllers<State>,\n readonly filterComponentControllers: FilterComponentControllers<State>\n ) {}\n\n get requiredComponents(): (keyof State['components'])[] {\n const components: (keyof State['components'])[] = [];\n for (const componentName of Object.keys(this.simpleComponentControllers) as SimpleComponents<State>[]) {\n if (this.simpleComponentControllers[componentName].isRequired) {\n components.push(componentName);\n }\n }\n return components;\n }\n\n get dimensionsConsumerComponents(): (keyof State['components'])[] {\n const components: (keyof State['components'])[] = [];\n for (const componentName of Object.keys(this.simpleComponentControllers) as SimpleComponents<State>[]) {\n if (this.simpleComponentControllers[componentName].isDimensionsConsumer) {\n components.push(componentName);\n }\n }\n for (const componentName of Object.keys(this.filterComponentControllers) as FilterComponents<State>[]) {\n if (this.filterComponentControllers[componentName].isDimensionsConsumer) {\n components.push(componentName);\n }\n }\n return components;\n }\n\n addSelected(\n inputName: keyof State['components'],\n state: State,\n selectorState: SelectorStateFilter | SelectorStateSimple\n ) {\n if (inputName in this.simpleComponentControllers) {\n return (\n this.simpleComponentControllers[\n inputName as keyof typeof this.simpleComponentControllers\n ] as ComponentController<State, typeof inputName>\n ).addSelected(state, selectorState);\n }\n if (inputName in this.filterComponentControllers) {\n return (\n this.filterComponentControllers[\n inputName as keyof typeof this.filterComponentControllers\n ] as ComponentController<State, typeof inputName>\n ).addSelected(state, selectorState);\n }\n throw Error(`Unknown input name: ${String(inputName)}`);\n }\n\n deleteSelected(\n inputName: keyof State['components'],\n store: DataStore,\n state: State,\n selectorState: SelectorStateFilter | SelectorStateSimple\n ) {\n if (inputName in this.simpleComponentControllers) {\n return (\n this.simpleComponentControllers[\n inputName as keyof typeof this.simpleComponentControllers\n ] as ComponentController<State, typeof inputName>\n ).deleteSelected(state, selectorState.selectedSource);\n }\n if (inputName in this.filterComponentControllers) {\n return (\n this.filterComponentControllers[\n inputName as keyof typeof this.filterComponentControllers\n ] as ComponentController<State, typeof inputName>\n ).deleteSelected(state, selectorState.selectedSource);\n }\n throw Error(`Unknown input name: ${String(inputName)}`);\n }\n\n changeSelected(\n inputName: keyof State['components'],\n store: DataStore,\n state: State,\n nextSelectorStates: SelectorState[]\n ) {\n const currentStates: SelectorState[] = state.components[inputName].selectorStates;\n const deletedStates = currentStates.filter(currentState => {\n return !nextSelectorStates.find(s => s.selectedSource === currentState.selectedSource);\n });\n const addedStates = nextSelectorStates.filter(nextState => {\n return !currentStates.find(s => s.selectedSource === nextState.selectedSource);\n });\n let nextState = getStateCopy(state);\n deletedStates.forEach(selectorState => {\n nextState = this.deleteSelected(inputName, store, nextState, selectorState);\n });\n addedStates.forEach(selectorState => {\n nextState = this.addSelected(inputName, nextState, selectorState);\n });\n // reorder\n state.components[inputName].selectorStates = nextSelectorStates\n .map(st =>\n (state.components[inputName].selectorStates as SelectorState[]).find(\n s => s.selectedSource === st.selectedSource\n )\n )\n .filter(Boolean) as SelectorStateFilter[] | SelectorStateSimple[];\n return nextState;\n }\n\n switchDividableAxis(state: State, axis: AxisId): State {\n // ***\n // logic for axis dividing/collapsing\n // ***\n return getStateCopy(state);\n }\n\n async getMustBeConsumedAxes(store: DataStore, state: State): Promise<Set<ColumnOrAxisIdString>> {\n return Promise.resolve(new Set());\n }\n\n private createEmptyComponentsGuide(state: State): InputOptionsUnion<State> {\n return Object.fromEntries(\n Object.entries(state.components).map(\n ([key, value]): [string, ComponentGuideSimple | ComponentGuideFilter] => {\n return [\n key,\n {\n options: [],\n optionsInfo: new Map(),\n stateConsistency: {},\n required: false,\n multipleSelectors: false,\n },\n ];\n }\n )\n ) as InputOptionsUnion<State>;\n }\n\n async getSelectedSourcesInfo(\n store: DataStore,\n state: State,\n labelsMap: Record<string, string>,\n linkerMap: LinkerMap\n ): Promise<Map<ColumnOrAxisIdString, AxisData | ColumnData>> {\n const result: Map<ColumnOrAxisIdString, AxisData> = new Map();\n\n const dataAxes = new Set<string>();\n const dataAxesList: AxisSpec[] = [];\n for (const inputName of this.dataInputs) {\n for (const selectorState of state.components[inputName].selectorStates) {\n const id = columnOrAxisIdFromString(selectorState.selectedSource);\n if (isColumnId(id)) {\n const columnSpec = await store.pFrameProvider.getColumnSpecById(id);\n if (columnSpec) {\n columnSpec.axesSpec.forEach(axisSpec => {\n const idStr = AxisId.fromAxisSpec(axisSpec).toCanonicalString();\n if (!dataAxes.has(idStr)) {\n dataAxes.add(idStr);\n dataAxesList.push(axisSpec);\n }\n });\n }\n }\n }\n }\n for (const [inputName , {selectorStates}] of Object.entries(state.components)) {\n const component = this.simpleComponentControllers[inputName as keyof typeof this.simpleComponentControllers]\n ?? this.filterComponentControllers[inputName as keyof typeof this.filterComponentControllers] as ComponentController<State, typeof inputName>;\n const fixedAxesAllowed = component.settings.columnsWithExtraAxesAllowed;\n for (const {selectedSource} of selectorStates) {\n await addSourceInfoToMap(\n store,\n selectedSource,\n labelsMap[selectedSource],\n result,\n dataAxesList,\n dataAxes,\n fixedAxesAllowed,\n linkerMap\n );\n }\n }\n return result;\n }\n\n getEmptyInputGuide(state: State): InputGuide<State> {\n return {\n components: this.createEmptyComponentsGuide(state) as ComponentsGuide<State['components']>,\n getSourceInfo: (sourceIdStr: ColumnOrAxisIdString) => getDefaultInfo(sourceIdStr),\n freeOptionsSet: new Set(),\n axesToBeFixedSet: new Set(),\n readyData: false,\n ready: false,\n consistent: true,\n };\n }\n\n getConsumedOptionsSet(state: State) {\n const consumedSourcesSet: Set<ColumnOrAxisIdString> = new Set();\n for (const componentName of this.dimensionsConsumerComponents) {\n for (const {selectedSource} of state.components[componentName].selectorStates) {\n consumedSourcesSet.add(selectedSource);\n }\n }\n return consumedSourcesSet;\n }\n\n async getLabelsMap(store: DataStore, state: State) {\n const availableColumns = await store.pFrameProvider.getColumnsFull(\n this.dataInputs.reduce((res: (ColumnId | AxisId)[], inputName) => {\n const componentState = state.components[inputName];\n const sources = componentState.selectorStates.map(st => columnOrAxisIdFromString(st.selectedSource));\n return res.concat(sources);\n }, []),\n false\n );\n return deriveLabels(availableColumns, el => el.spec).reduce((res: Record<string, string>, el) => {\n const id = new ColumnId({name: el.value.columnId, type: el.value.spec.valueType}).toCanonicalString();\n res[id] = el.label;\n return res;\n }, {});\n }\n\n async calculateOptions(\n store: DataStore,\n state: State,\n fixedIds: string[] = [],\n dataColumnPredicate = dataColumnPredicateDefault\n ): Promise<InputGuide<State>> {\n // creating empty options object corresponding to the provided state\n const resultComponentsGuide: InputOptionsUnion<State> = this.createEmptyComponentsGuide(state);\n\n // set of columns and axes that selected in consumer-dimensions components\n const consumedSourcesSet = this.getConsumedOptionsSet(state);\n // for trees block - to ignore treeId and donorId in the interface\n const ignoredNamesSet = new Set<string>(this.ignoredOptionIdNames);\n const fixedSelectedSet = new Set<ColumnOrAxisIdString>(fixedIds);\n\n const linkerMap = await createLinkerMap(store)\n\n const labelsMap = await this.getLabelsMap(store, state); // improved labels with name separation for different columns with the same name; for axes - name from spec or labels column\n const selectedColumnsOrAxesInfo = await this.getSelectedSourcesInfo(store, state, labelsMap, linkerMap);\n const optionsInfo: Map<ColumnOrAxisIdString, ColumnData | AxisData> = new Map();\n\n const allControllers = {...this.simpleComponentControllers, ...this.filterComponentControllers};\n const freeOptionsSet = new Set<ColumnOrAxisIdString>();\n for (const [name, componentController] of Object.entries(allControllers)) {\n const options = await (\n componentController as ComponentController<State, SimpleComponents<State> | FilterComponents<State>>\n ).getOptions(\n store,\n state,\n labelsMap,\n consumedSourcesSet,\n linkerMap,\n dataColumnPredicate,\n ignoredNamesSet,\n fixedSelectedSet\n );\n if (!this.dataInputs.includes(name as string)) {\n options.options.forEach(item => {\n freeOptionsSet.add(item.value);\n });\n }\n for (const [key, v] of options.optionsInfo) {\n optionsInfo.set(key, v);\n }\n resultComponentsGuide[name as keyof InputOptionsUnion<State>] =\n options as (typeof resultComponentsGuide)[keyof InputOptionsUnion<State>];\n }\n\n const markMustBeConsumed = (id: string) => {\n const option = optionsInfo.get(id);\n if (option && option.kind === 'axis') {\n option.mustBeConsumed = true;\n }\n const selected = selectedColumnsOrAxesInfo.get(id);\n if (selected && selected.kind === 'axis') {\n selected.mustBeConsumed = true;\n }\n };\n // axes from heatmap data column, to make visible what axes should be; hanging axes from scatterplot\n const mustBeConsumedAxes = await this.getMustBeConsumedAxes(store, state);\n for (const id of mustBeConsumedAxes) {\n markMustBeConsumed(id);\n }\n\n if (this.dontAllowUnfilteredHighCardinality) {\n // Axes marked 'high cardinality' should be in the filter. Or some column that has this axis should be in the filter.\n // If not - they are marked 'mustBeConsumed'.\n // But also they can be anywhere else.\n const isHighCardinality = (spec: AxisSpec) => spec?.annotations?.[HIGH_CARDINALITY] === 'true';\n const consumedHighCardinalityAxes =\n state.components['filters']?.selectorStates.reduce((consumed: Set<string>, s) => {\n const info = selectedColumnsOrAxesInfo.get(s.selectedSource);\n if (info?.kind === 'column') {\n const axes = info.spec.axesSpec.filter(isHighCardinality);\n axes.forEach(spec => consumed.add(AxisId.fromAxisSpec(spec).toCanonicalString()));\n }\n if (info?.kind === 'axis' && isHighCardinality(info.spec)) {\n consumed.add(AxisId.fromAxisSpec(info.spec).toCanonicalString());\n }\n return consumed;\n }, new Set<string>()) ?? new Set<string>();\n this.dataInputs.forEach(inputName => {\n for (const {selectedSource} of state.components[inputName].selectorStates) {\n const info = selectedColumnsOrAxesInfo.get(selectedSource);\n if (info?.kind === 'column') {\n const axes = info.spec.axesSpec.filter(isHighCardinality);\n axes.forEach(spec => {\n const idStr = AxisId.fromAxisSpec(spec).toCanonicalString();\n if (!freeOptionsSet.has(idStr) && !consumedHighCardinalityAxes.has(idStr)) {\n // return axis to the list of free axis if it is selected somewhere, but nothing with this axis is in the filters\n freeOptionsSet.add(idStr);\n }\n if (!consumedHighCardinalityAxes.has(idStr)) {\n markMustBeConsumed(idStr);\n }\n });\n }\n if (info?.kind === 'axis' && isHighCardinality(info.spec)) {\n const idStr = AxisId.fromAxisSpec(info.spec).toCanonicalString();\n if (!freeOptionsSet.has(idStr)) {\n freeOptionsSet.add(idStr);\n }\n if (!consumedHighCardinalityAxes.has(idStr)) {\n markMustBeConsumed(idStr);\n }\n }\n }\n });\n }\n\n const axesToBeFixedSet = new Set<ColumnOrAxisIdString>();\n for (const {selectorStates} of Object.values(state.components)) {\n for (const {selectedSource} of selectorStates) {\n const info = selectedColumnsOrAxesInfo.get(selectedSource);\n if (info && info.kind === 'column') {\n info.axesToBeFixed.forEach(axisIdStr => {\n axesToBeFixedSet.add(axisIdStr);\n });\n }\n }\n }\n\n const consistent = await this.isConsistent(store, state, linkerMap);\n const getSourceInfo = (sourceIdStr: ColumnOrAxisIdString) => {\n const id = columnOrAxisIdFromString(sourceIdStr).toCanonicalString() ?? sourceIdStr;\n return optionsInfo.get(id) ?? selectedColumnsOrAxesInfo.get(id) ?? getDefaultInfo(sourceIdStr);\n };\n return {\n components: resultComponentsGuide as ComponentsGuide<State['components']>,\n getSourceInfo,\n freeOptionsSet,\n axesToBeFixedSet,\n readyData: this.readyDataInputs(state),\n ready: this.readyForPlotBuilding(store, state, consistent, freeOptionsSet, getSourceInfo),\n consistent,\n };\n }\n\n async getUniqueSourceValuesWithLabels(\n store: DataStore,\n inputGuide: InputGuide<State>,\n selectedSource: ColumnOrAxisIdString,\n limit?:number,\n searchQuery?: string, // search by labels if axis labels exist\n searchQueryValue?: string // search by value, not by label\n ): Promise<{\n values: {\n value: string;\n label: string;\n }[],\n overflow: boolean;\n }> {\n const sortValues = (values:{value:string, label:string}[]) => values.sort((a, b) => a.label.localeCompare(b.label, 'en', {numeric: true}))\n const info = inputGuide.getSourceInfo(selectedSource);\n const discreteValuesStr = info.annotations?.[DISCRETE_VALUES_KEY];\n\n // if column's annotation contains discrete values - take them from it\n try {\n const discreteValues: string[] | null = discreteValuesStr\n ? (JSON.parse(discreteValuesStr) as (string | number)[]).map(v => String(v))\n : null;\n if (discreteValues) {\n const values = discreteValues.map(v => ({value: v, label: v}));\n sortValues(values);\n return {values, overflow: false};\n }\n } catch (err) {\n console.error(`Parsing error: discrete values annotation ${discreteValuesStr} in ${selectedSource}`)\n }\n\n // consider label column for axis\n if (info.kind === 'axis') {\n const axisId = columnOrAxisIdFromString(selectedSource) as AxisId;\n const parentSources = info.parentSources.map(columnOrAxisIdFromString) as ColumnId[];\n const labelsColumnId = await getColumnOrAxisValueLabelsId(store, selectedSource, info.parentSources);\n let filters:PTableRecordSingleValueFilterV2[] = [];\n if (labelsColumnId) {\n if (searchQuery) {\n filters = [{\n type: 'bySingleColumnV2',\n column: {\n type: 'column',\n id: labelsColumnId.name as PObjectId\n },\n predicate: {\n operator: 'StringIContains',\n substring: searchQuery\n }\n }];\n }\n if (searchQueryValue) {\n filters = [{\n type: 'bySingleColumnV2',\n column: {\n type: 'axis',\n id: axisId.toPFrameId()\n },\n predicate: {\n operator: 'StringIContains',\n substring: searchQueryValue\n }\n }];\n }\n const {data: dataValues, axesData} = await store.pFrameProvider.getSingleColumnData(labelsColumnId, filters);\n const axisKeys = axesData[axisId.toCanonicalString()];\n const values:{value: string, label: string}[] = [];\n for (let i = 0; i < Math.min(axisKeys.length, limit ?? axisKeys.length); i++) {\n values.push({value: String(axisKeys[i]), label: String(dataValues[i])});\n }\n sortValues(values);\n return {values, overflow: !(limit === undefined || axisKeys.length < limit)};\n }\n const searchInLabelsOrValue = searchQuery ?? searchQueryValue;\n if (searchInLabelsOrValue) {\n filters = [{\n type: 'bySingleColumnV2',\n column: {\n type: 'axis',\n id: axisId.toPFrameId()\n },\n predicate: {\n operator: 'StringIContains',\n substring: searchInLabelsOrValue\n }\n }];\n }\n const response = await store.pFrameProvider.getAxisUniqueValues(axisId, [parentSources[0]], limit, filters);\n const values = response.values.map(v => ({value: String(v), label: String(v)}));\n sortValues(values);\n return {values, overflow: response.overflow};\n }\n if (info.kind === 'column') {\n const searchInLabelsOrValue = searchQuery ?? searchQueryValue;\n const columnId = columnOrAxisIdFromString(selectedSource) as ColumnId;\n const filters:PTableRecordSingleValueFilterV2[] = searchInLabelsOrValue ? [{\n type: 'bySingleColumnV2',\n column: {\n type: 'column',\n id: columnId.name as PObjectId\n },\n predicate: {\n operator: 'StringIContains',\n substring: searchInLabelsOrValue\n }\n }] : [];\n const response = await store.pFrameProvider.getColumnUniqueValues(columnId, limit, filters);\n const values = response.values.map(v => ({value: String(v), label: String(v)}));\n sortValues(values);\n return {values, overflow: response.overflow};\n }\n return {values: [], overflow: false};\n }\n\n async checkStateConsistency(\n store: DataStore,\n state: State,\n linkerMap: LinkerMap\n ): Promise<Map<keyof State['components'], Record<string, boolean>>> {\n const result: Map<keyof State['components'], Record<string, boolean>> = new Map();\n for (const component of Object.keys(this.simpleComponentControllers) as SimpleComponents<State>[]) {\n result.set(\n component as keyof State['components'],\n await this.simpleComponentControllers[component].checkStateConsistency(store, state, linkerMap)\n );\n }\n for (const component of Object.keys(this.filterComponentControllers) as FilterComponents<State>[]) {\n result.set(\n component as keyof State['components'],\n await this.filterComponentControllers[component].checkStateConsistency(store, state, linkerMap)\n );\n }\n return result;\n }\n\n async isConsistent(store: DataStore, state: State, linkerMap: LinkerMap): Promise<boolean> {\n const consistency = await this.checkStateConsistency(store, state, linkerMap);\n for (const value of consistency.values()) {\n if (Object.values(value).some(item => !item)) {\n return false;\n }\n }\n return true;\n }\n\n readyDataInputs(state: State): boolean {\n return this.dataInputs.every(name => state.components[name].selectorStates.length > 0);\n }\n\n readyForPlotBuilding(\n store: DataStore,\n state: State,\n consistent: boolean,\n freeOptionsSet: Set<ColumnOrAxisIdString>,\n getSourceInfo: (id: ColumnOrAxisIdString) => ColumnData | AxisData\n ): boolean {\n if (!consistent || !this.readyDataInputs(state)) {\n return false;\n }\n let hasFreeDimensions: boolean = false;\n for (const optionId of freeOptionsSet) {\n const info = getSourceInfo(optionId);\n if (info && info.kind === 'axis' && info.mustBeConsumed) {\n hasFreeDimensions = true;\n break;\n }\n }\n let hasNotSelectedAxisToBeFixed: boolean = false;\n for (const {selectorStates} of Object.values(state.components)) {\n for (const {selectedSource, fixedAxes} of selectorStates) {\n const info = getSourceInfo(selectedSource);\n if (\n info &&\n info.kind === 'column' &&\n info.axesToBeFixed.some(\n id => (fixedAxes ?? []).find(el => el.axisSource === id)?.axisValue === undefined\n )\n ) {\n hasNotSelectedAxisToBeFixed = true;\n break;\n }\n }\n if (hasNotSelectedAxisToBeFixed) {\n break;\n }\n }\n return (\n this.requiredComponents.every(name => state.components[name].selectorStates.length > 0) &&\n !hasFreeDimensions &&\n !hasNotSelectedAxisToBeFixed\n );\n }\n\n abstract createDataByColumns(store: DataStore, state: State): Promise<PlotDataAndSettings['data']>;\n\n abstract createChartSettings(store: DataStore, state: State): Promise<PlotDataAndSettings['settings']>;\n\n async createDataForPlot(store: DataStore, state: State): Promise<PlotDataAndSettings> {\n return {\n data: await this.createDataByColumns(store, state),\n settings: await this.createChartSettings(store, state),\n };\n }\n}\n"],"names":["ControllerBase","simpleComponentControllers","filterComponentControllers","__publicField","components","componentName","inputName","state","selectorState","store","nextSelectorStates","currentStates","deletedStates","currentState","s","addedStates","nextState","h","getStateCopy","st","axis","key","value","labelsMap","linkerMap","result","dataAxes","dataAxesList","id","columnOrAxisIdFromString","isColumnId","columnSpec","axisSpec","idStr","AxisId","selectorStates","fixedAxesAllowed","selectedSource","addSourceInfoToMap","sourceIdStr","getDefaultInfo","consumedSourcesSet","availableColumns","res","sources","a","deriveLabels","el","ColumnId","fixedIds","dataColumnPredicate","dataColumnPredicateDefault","resultComponentsGuide","ignoredNamesSet","fixedSelectedSet","createLinkerMap","selectedColumnsOrAxesInfo","optionsInfo","allControllers","freeOptionsSet","name","componentController","options","item","v","markMustBeConsumed","option","selected","mustBeConsumedAxes","isHighCardinality","spec","_a","HIGH_CARDINALITY","consumedHighCardinalityAxes","consumed","info","axesToBeFixedSet","axisIdStr","consistent","getSourceInfo","inputGuide","limit","searchQuery","searchQueryValue","sortValues","values","b","discreteValuesStr","DISCRETE_VALUES_KEY","discreteValues","axisId","parentSources","labelsColumnId","getColumnOrAxisValueLabelsId","filters","dataValues","axesData","axisKeys","i","searchInLabelsOrValue","response","w","columnId","component","consistency","hasFreeDimensions","optionId","hasNotSelectedAxisToBeFixed","fixedAxes","S"],"mappings":";;;;;;;;;;;AAuFO,MAAeA,GAAsE;AAAA,EAK9E,YACGC,GACAC,GACX;AAPOC,MAAA,8BAAiC,EAAC,GAClCA,EAAA,oBAAuB,EAAC,GACxBA,EAAA,MAAA,sCAA8C,EAAA,GAG1C,KAAA,6BAAAF,GACA,KAAA,6BAAA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gB;AAChD,cAAAwC,IAAOI,EAAc1C,CAAc;AACzC,YACIsC,KACAA,EAAK,SAAS,YACdA,EAAK,cAAc;AAAA,UACf,CAAA/C,MAAA;;AAAO,qBAAA2C,KAAAqC,KAAa,CAAA,GAAI,KAAK,CAAAC,MAAM9D,EAAG,eAAenB,CAAE,MAAhD,OAAA,SAAA2C,EAAmD,eAAc;AAAA,UAAA;AAAA,QAAA,GAE9E;AACgCoC,cAAA;AAC9B;AAAA,QAAA;AAAA,MACJ;AAEJ,UAAIA;AACA;AAAA,IACJ;AAEJ,WACI,KAAK,mBAAmB,MAAM,CAAA/C,MAAQrD,EAAM,WAAWqD,CAAI,EAAE,eAAe,SAAS,CAAC,KACtF,CAAC6C,KACD,CAACE;AAAAA,EAAA;AAAA,EAQT,MAAM,kBAAkBlG,GAAkBF,GAA4C;AAC3E,WAAA;AAAA,MACH,MAAM,MAAM,KAAK,oBAAoBE,GAAOF,CAAK;AAAA,MACjD,UAAU,MAAM,KAAK,oBAAoBE,GAAOF,CAAK;AAAA,IAAA;AAAA,EACzD;AAER;","x_google_ignoreList":[0]}
|
package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/dendro.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import q from "../../_virtual/canonicalize.js";
|
|
2
|
-
import { ControllerBase as
|
|
2
|
+
import { ControllerBase as $ } from "../ControllerBase.js";
|
|
3
3
|
import { ComponentController as r } from "../ComponentController.js";
|
|
4
4
|
import { columnOrAxisIdFromString as c, isColumnId as h } from "../../spec.js";
|
|
5
|
-
import { createLinkerMap as
|
|
5
|
+
import { createLinkerMap as G, getFiltersFromStates as B, getAxesSpecsFromSources as V, getLinkerColumnsForSource as z, getColumnOrAxisValueLabelsId as N, getColumnOrAxisLabel as x } from "../../utils.js";
|
|
6
6
|
var k = Object.defineProperty, M = (O, t, e) => t in O ? k(O, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : O[t] = e, j = (O, t, e) => M(O, t + "", e);
|
|
7
7
|
const F = "pl7.app/dendrogram/nodeId", W = "id", K = {
|
|
8
8
|
type: "dendro",
|
|
@@ -25,7 +25,7 @@ const F = "pl7.app/dendrogram/nodeId", W = "id", K = {
|
|
|
25
25
|
},
|
|
26
26
|
dividedAxes: {}
|
|
27
27
|
};
|
|
28
|
-
class Q extends
|
|
28
|
+
class Q extends $ {
|
|
29
29
|
constructor() {
|
|
30
30
|
super(
|
|
31
31
|
{
|
|
@@ -219,13 +219,13 @@ class Q extends G {
|
|
|
219
219
|
const d = {}, S = (A = e.components.value.selectorStates[0]) == null ? void 0 : A.selectedSource, w = c(S);
|
|
220
220
|
if (!S || !h(w))
|
|
221
221
|
throw Error("Value column is not valid");
|
|
222
|
-
const b = await
|
|
222
|
+
const b = await G(t), g = B([
|
|
223
223
|
...e.components.filters.selectorStates,
|
|
224
224
|
...e.components.tabBy.selectorStates
|
|
225
225
|
]), y = [
|
|
226
226
|
...e.components.filters.selectorStates.map((n) => c(n.selectedSource)),
|
|
227
227
|
...e.components.tabBy.selectorStates.map((n) => c(n.selectedSource))
|
|
228
|
-
].filter(h), u = [S], T = await
|
|
228
|
+
].filter(h), u = [S], T = await V(t, u), D = [], i = [], p = [], f = [e.components.value], v = [
|
|
229
229
|
e.components.tableContent,
|
|
230
230
|
// next components can content data mapped on tree
|
|
231
231
|
e.components.labels,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import E from "../../_virtual/canonicalize.js";
|
|
2
|
-
import { ControllerBase as
|
|
2
|
+
import { ControllerBase as V } from "../ControllerBase.js";
|
|
3
3
|
import { ComponentController as d } from "../ComponentController.js";
|
|
4
4
|
import { columnOrAxisIdFromString as w, isColumnId as y } from "../../spec.js";
|
|
5
|
-
import { checkSourceBySpecForFilters as
|
|
6
|
-
var H = Object.defineProperty, U = (l, e, t) => e in l ? H(l, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[e] = t,
|
|
7
|
-
const
|
|
5
|
+
import { checkSourceBySpecForFilters as N, createLinkerMap as T, getFiltersFromStates as k, getAxesSpecsFromSources as P, getLinkerColumnsForSource as I, getColumnOrAxisValueLabelsId as b, getColumnOrAxisLabel as F } from "../../utils.js";
|
|
6
|
+
var H = Object.defineProperty, U = (l, e, t) => e in l ? H(l, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[e] = t, $ = (l, e, t) => U(l, e + "", t);
|
|
7
|
+
const W = {
|
|
8
8
|
type: "histogram",
|
|
9
9
|
components: {
|
|
10
10
|
value: { type: "simple", selectorStates: [] },
|
|
@@ -15,7 +15,7 @@ const $ = {
|
|
|
15
15
|
},
|
|
16
16
|
dividedAxes: {}
|
|
17
17
|
};
|
|
18
|
-
class G extends
|
|
18
|
+
class G extends V {
|
|
19
19
|
constructor() {
|
|
20
20
|
super(
|
|
21
21
|
{
|
|
@@ -63,7 +63,7 @@ class G extends N {
|
|
|
63
63
|
dimensionConsumer: !0,
|
|
64
64
|
multipleSelectors: !0
|
|
65
65
|
},
|
|
66
|
-
checkSourceBySpec:
|
|
66
|
+
checkSourceBySpec: N
|
|
67
67
|
}),
|
|
68
68
|
tabBy: new d({
|
|
69
69
|
componentName: "tabBy",
|
|
@@ -77,7 +77,7 @@ class G extends N {
|
|
|
77
77
|
}
|
|
78
78
|
})
|
|
79
79
|
}
|
|
80
|
-
),
|
|
80
|
+
), $(this, "dataInputs", ["value"]);
|
|
81
81
|
}
|
|
82
82
|
async createDataByColumns(e, t) {
|
|
83
83
|
var i;
|
|
@@ -165,6 +165,6 @@ class G extends N {
|
|
|
165
165
|
}
|
|
166
166
|
export {
|
|
167
167
|
G as HistogramStateController,
|
|
168
|
-
|
|
168
|
+
W as InitialHistogramState
|
|
169
169
|
};
|
|
170
170
|
//# sourceMappingURL=histogram.js.map
|
|
@@ -4,7 +4,7 @@ import { FORMAT as T } from "../../constants.js";
|
|
|
4
4
|
import { ControllerBase as X } from "../ControllerBase.js";
|
|
5
5
|
import { ComponentController as c } from "../ComponentController.js";
|
|
6
6
|
import { columnOrAxisIdFromString as S, AxisId as N, isColumnId as C } from "../../spec.js";
|
|
7
|
-
import { checkSourceBySpecForFilters as k, createLinkerMap as Y, getFiltersFromStates as
|
|
7
|
+
import { checkSourceBySpecForFilters as k, createLinkerMap as Y, getFiltersFromStates as $, getAxesSpecsFromSources as j, getLinkerColumnsForSource as E, getColumnOrAxisValueLabelsId as O, createHighlightColumn as H, getColumnOrAxisLabel as D, getColumnOrAxisSpec as z } from "../../utils.js";
|
|
8
8
|
var J = Object.defineProperty, Q = (h, t, e) => t in h ? J(h, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : h[t] = e, R = (h, t, e) => Q(h, t + "", e);
|
|
9
9
|
const oe = {
|
|
10
10
|
type: "scatterplot-umap",
|
|
@@ -173,10 +173,10 @@ class ne extends X {
|
|
|
173
173
|
}, d = await Y(t), n = [
|
|
174
174
|
...e.components.filters.selectorStates,
|
|
175
175
|
...e.components.tabBy.selectorStates
|
|
176
|
-
], w =
|
|
176
|
+
], w = $(n), I = n.map((i) => S(i.selectedSource)).filter(C), b = [a, r].filter(C).map((i) => i.toCanonicalString());
|
|
177
177
|
if (b.length === 0)
|
|
178
178
|
throw Error("One of X and Y should be a column");
|
|
179
|
-
const B = await
|
|
179
|
+
const B = await j(t, b), P = [a, r, ...I], f = [], F = [[], []], A = [], v = [];
|
|
180
180
|
for (const { selectedSource: i, fixedAxes: s } of n)
|
|
181
181
|
v.push(...await E(
|
|
182
182
|
t,
|
|
@@ -4,7 +4,7 @@ import { FORMAT as T } from "../../constants.js";
|
|
|
4
4
|
import { ControllerBase as V } from "../ControllerBase.js";
|
|
5
5
|
import { ComponentController as p } from "../ComponentController.js";
|
|
6
6
|
import { columnOrAxisIdFromString as u, AxisId as N, isColumnId as b } from "../../spec.js";
|
|
7
|
-
import { checkSourceBySpecForFilters as k, createLinkerMap as X, getFiltersFromStates as Y, getAxesSpecsFromSources as H, getLinkerColumnsForSource as
|
|
7
|
+
import { checkSourceBySpecForFilters as k, createLinkerMap as X, getFiltersFromStates as Y, getAxesSpecsFromSources as H, getLinkerColumnsForSource as $, getColumnOrAxisValueLabelsId as D, createHighlightColumn as J, getColumnOrAxisLabel as I, getColumnOrAxisSpec as z } from "../../utils.js";
|
|
8
8
|
var Q = Object.defineProperty, R = (h, t, e) => t in h ? Q(h, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : h[t] = e, U = (h, t, e) => R(h, t + "", e);
|
|
9
9
|
const oe = {
|
|
10
10
|
type: "scatterplot",
|
|
@@ -187,7 +187,7 @@ class ne extends V {
|
|
|
187
187
|
throw Error("One of X and Y should be a column");
|
|
188
188
|
const L = await H(t, A), F = [r, i, ...P], f = [], B = [[], []], O = [], v = [];
|
|
189
189
|
for (const { selectedSource: s, fixedAxes: a } of n)
|
|
190
|
-
v.push(...await
|
|
190
|
+
v.push(...await $(
|
|
191
191
|
t,
|
|
192
192
|
y,
|
|
193
193
|
L,
|
|
@@ -208,8 +208,8 @@ class ne extends V {
|
|
|
208
208
|
for (const s of o)
|
|
209
209
|
for (const { selectedSource: a, fixedAxes: C } of s.selectorStates) {
|
|
210
210
|
f.push(u(a)), O.push(
|
|
211
|
-
(C ?? []).map(({ axisIdx:
|
|
212
|
-
), v.push(...await
|
|
211
|
+
(C ?? []).map(({ axisIdx: E, axisValue: q }) => ({ idx: E, value: q }))
|
|
212
|
+
), v.push(...await $(
|
|
213
213
|
t,
|
|
214
214
|
y,
|
|
215
215
|
L,
|
|
@@ -275,7 +275,7 @@ class ne extends V {
|
|
|
275
275
|
), B = await Promise.all(
|
|
276
276
|
e.components.tooltipContent.selectorStates.map(async (o) => {
|
|
277
277
|
var l;
|
|
278
|
-
const s = o.selectedSource, a = u(s), C = await D(t, s, n) ?? a, x = await
|
|
278
|
+
const s = o.selectedSource, a = u(s), C = await D(t, s, n) ?? a, x = await z(t, s, n);
|
|
279
279
|
return {
|
|
280
280
|
type: "column",
|
|
281
281
|
label: await I(t, s, n) || s,
|
|
@@ -287,7 +287,7 @@ class ne extends V {
|
|
|
287
287
|
);
|
|
288
288
|
let O;
|
|
289
289
|
if (e.components.label.selectorStates.length) {
|
|
290
|
-
const o = e.components.label.selectorStates[0].selectedSource, l = await
|
|
290
|
+
const o = e.components.label.selectorStates[0].selectedSource, l = await z(t, o, n);
|
|
291
291
|
O = {
|
|
292
292
|
type: "column",
|
|
293
293
|
value: o,
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { BubbleStateController as a, InitialBubbleState as r } from "./controllers/controllersByChartType/bubble.js";
|
|
2
2
|
import { DendroStateController as o, InitialDendroState as l } from "./controllers/controllersByChartType/dendro.js";
|
|
3
|
-
import { DiscreteStateController as
|
|
3
|
+
import { DiscreteStateController as i, InitialDiscreteState as n } from "./controllers/controllersByChartType/discrete.js";
|
|
4
4
|
import { HeatmapStateController as s, InitialHeatmapState as p } from "./controllers/controllersByChartType/heatmap.js";
|
|
5
5
|
import { HistogramStateController as m, InitialHistogramState as S } from "./controllers/controllersByChartType/histogram.js";
|
|
6
6
|
import { ScatterplotStateController as c, InitialScatterplotState as C } from "./controllers/controllersByChartType/scatterplot.js";
|
|
7
7
|
import { ScatterplotUmapStateController as b, InitialScatterplotUmapState as u } from "./controllers/controllersByChartType/scatterplot-umap.js";
|
|
8
8
|
import "./_virtual/canonicalize.js";
|
|
9
9
|
import "./_virtual/lodash.js";
|
|
10
|
-
import "./node_modules/@milaboratories/pl-model-common/dist/
|
|
10
|
+
import "./node_modules/@milaboratories/pl-model-common/dist/drivers/blob.js";
|
|
11
|
+
import "./node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/spec.js";
|
|
12
|
+
import "./node_modules/@milaboratories/pl-model-common/dist/plid.js";
|
|
13
|
+
import "./node_modules/@milaboratories/pl-model-common/dist/ref.js";
|
|
11
14
|
const e = {
|
|
12
15
|
controllers: {
|
|
13
|
-
discrete: new
|
|
16
|
+
discrete: new i(),
|
|
14
17
|
scatterplot: new c(),
|
|
15
18
|
"scatterplot-umap": new b(),
|
|
16
19
|
heatmap: new s(),
|
|
@@ -19,7 +22,7 @@ const e = {
|
|
|
19
22
|
bubble: new a()
|
|
20
23
|
},
|
|
21
24
|
initialStates: {
|
|
22
|
-
discrete:
|
|
25
|
+
discrete: n,
|
|
23
26
|
scatterplot: C,
|
|
24
27
|
"scatterplot-umap": u,
|
|
25
28
|
heatmap: p,
|
|
@@ -28,19 +31,19 @@ const e = {
|
|
|
28
31
|
bubble: r
|
|
29
32
|
}
|
|
30
33
|
};
|
|
31
|
-
function
|
|
34
|
+
function j(t) {
|
|
32
35
|
return e.controllers[t];
|
|
33
36
|
}
|
|
34
|
-
function
|
|
37
|
+
function q(t) {
|
|
35
38
|
return e.initialStates[t];
|
|
36
39
|
}
|
|
37
40
|
export {
|
|
38
41
|
a as BubbleStateController,
|
|
39
42
|
o as DendroStateController,
|
|
40
|
-
|
|
43
|
+
i as DiscreteStateController,
|
|
41
44
|
s as HeatmapStateController,
|
|
42
45
|
c as ScatterplotStateController,
|
|
43
|
-
|
|
44
|
-
|
|
46
|
+
j as getControllerByType,
|
|
47
|
+
q as getInitialStateByType
|
|
45
48
|
};
|
|
46
49
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../node_modules/@milaboratories/pf-plots/src/index.ts"],"sourcesContent":["import type {\n AxisData,\n ChartType,\n ColumnData,\n ColumnOrAxisData,\n ComponentGuideFilter,\n ComponentGuideSimple,\n ComponentStateFilter,\n ComponentStateSimple,\n InputGuide,\n InputState,\n InputStateParent,\n SelectorStateFilter,\n SelectorStateSimple,\n SourceOption,\n} from './common';\nimport type { Controller, PlotDataAndSettings } from './controllers/ControllerBase';\nimport { BubbleStateController, BubbleUIState, InitialBubbleState } from './controllers/controllersByChartType/bubble';\nimport type { DendroUIState } from './controllers/controllersByChartType/dendro';\nimport { DendroStateController, InitialDendroState } from './controllers/controllersByChartType/dendro';\nimport type { DiscreteUIState } from './controllers/controllersByChartType/discrete';\nimport { DiscreteStateController, InitialDiscreteState } from './controllers/controllersByChartType/discrete';\nimport type { HeatmapUIState } from './controllers/controllersByChartType/heatmap';\nimport { HeatmapStateController, InitialHeatmapState } from './controllers/controllersByChartType/heatmap';\nimport {\n HistogramStateController,\n HistogramUIState,\n InitialHistogramState,\n} from './controllers/controllersByChartType/histogram';\nimport type { ScatterplotUIState } from './controllers/controllersByChartType/scatterplot';\nimport { InitialScatterplotState, ScatterplotStateController } from './controllers/controllersByChartType/scatterplot';\nimport {\n InitialScatterplotUmapState,\n ScatterplotUmapStateController,\n ScatterplotUmapUIState,\n} from './controllers/controllersByChartType/scatterplot-umap';\nimport { DemoDataStore } from './demoStore';\nimport type { ColumnOrAxisIdString } from './spec';\nimport { AxisId, ColumnId, columnOrAxisIdFromString, isColumnId } from './spec';\nimport { PValue } from './store';\nimport type {AxisSpec, PColumnSpec} from '@milaboratories/pl-model-common';\n\nconst PfPlots = {\n controllers: {\n discrete: new DiscreteStateController(),\n scatterplot: new ScatterplotStateController(),\n 'scatterplot-umap': new ScatterplotUmapStateController(),\n heatmap: new HeatmapStateController(),\n dendro: new DendroStateController(),\n histogram: new HistogramStateController(),\n bubble: new BubbleStateController(),\n },\n initialStates: {\n discrete: InitialDiscreteState,\n scatterplot: InitialScatterplotState,\n 'scatterplot-umap': InitialScatterplotUmapState,\n heatmap: InitialHeatmapState,\n dendro: InitialDendroState,\n histogram: InitialHistogramState,\n bubble: InitialBubbleState,\n },\n};\n\nexport function getControllerByType<C extends ChartType>(chartType: C): Controller<InputStateParent<C>> {\n return PfPlots.controllers[chartType] as unknown as Controller<InputStateParent<C>>;\n}\n\nexport function getInitialStateByType<C extends ChartType>(chartType: C): InputStateParent<C> {\n return PfPlots.initialStates[chartType] as unknown as InputStateParent<C>;\n}\n\ntype InputNamesByChartType = {\n [K in ChartType]: K extends 'discrete' ?\n keyof DiscreteUIState['components'] : K extends 'heatmap' ?\n keyof HeatmapUIState['components'] : K extends 'dendro' ?\n keyof DendroUIState['components'] : K extends 'scatterplot' ?\n keyof ScatterplotUIState['components'] : K extends 'scatterplot-umap' ?\n keyof ScatterplotUmapUIState['components'] : K extends 'histogram' ?\n keyof HistogramUIState['components'] : K extends 'bubble' ?\n keyof BubbleUIState['components'] : never\n}\n\nexport {\n AxisData, AxisId, AxisSpec, BubbleStateController, ChartType, ColumnData, ColumnId, ColumnOrAxisData, columnOrAxisIdFromString, ColumnOrAxisIdString, ComponentGuideFilter,\n ComponentGuideSimple,\n ComponentStateFilter,\n ComponentStateSimple, Controller, DemoDataStore, DendroStateController, DendroUIState, DiscreteStateController, DiscreteUIState, HeatmapStateController, HeatmapUIState, InputGuide,\n InputState,\n InputStateParent, isColumnId, PColumnSpec, PlotDataAndSettings, ScatterplotStateController, ScatterplotUIState, SelectorStateFilter,\n SelectorStateSimple,\n SourceOption, type BubbleUIState, type HistogramUIState, type InputNamesByChartType, type PValue, type ScatterplotUmapUIState\n};\n"],"names":["PfPlots","DiscreteStateController","ScatterplotStateController","ScatterplotUmapStateController","HeatmapStateController","DendroStateController","HistogramStateController","BubbleStateController","InitialDiscreteState","InitialScatterplotState","InitialScatterplotUmapState","InitialHeatmapState","InitialDendroState","InitialHistogramState","InitialBubbleState","getControllerByType","chartType","getInitialStateByType"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../node_modules/@milaboratories/pf-plots/src/index.ts"],"sourcesContent":["import type {\n AxisData,\n ChartType,\n ColumnData,\n ColumnOrAxisData,\n ComponentGuideFilter,\n ComponentGuideSimple,\n ComponentStateFilter,\n ComponentStateSimple,\n InputGuide,\n InputState,\n InputStateParent,\n SelectorStateFilter,\n SelectorStateSimple,\n SourceOption,\n} from './common';\nimport type { Controller, PlotDataAndSettings } from './controllers/ControllerBase';\nimport { BubbleStateController, BubbleUIState, InitialBubbleState } from './controllers/controllersByChartType/bubble';\nimport type { DendroUIState } from './controllers/controllersByChartType/dendro';\nimport { DendroStateController, InitialDendroState } from './controllers/controllersByChartType/dendro';\nimport type { DiscreteUIState } from './controllers/controllersByChartType/discrete';\nimport { DiscreteStateController, InitialDiscreteState } from './controllers/controllersByChartType/discrete';\nimport type { HeatmapUIState } from './controllers/controllersByChartType/heatmap';\nimport { HeatmapStateController, InitialHeatmapState } from './controllers/controllersByChartType/heatmap';\nimport {\n HistogramStateController,\n HistogramUIState,\n InitialHistogramState,\n} from './controllers/controllersByChartType/histogram';\nimport type { ScatterplotUIState } from './controllers/controllersByChartType/scatterplot';\nimport { InitialScatterplotState, ScatterplotStateController } from './controllers/controllersByChartType/scatterplot';\nimport {\n InitialScatterplotUmapState,\n ScatterplotUmapStateController,\n ScatterplotUmapUIState,\n} from './controllers/controllersByChartType/scatterplot-umap';\nimport { DemoDataStore } from './demoStore';\nimport type { ColumnOrAxisIdString } from './spec';\nimport { AxisId, ColumnId, columnOrAxisIdFromString, isColumnId } from './spec';\nimport { PValue } from './store';\nimport type {AxisSpec, PColumnSpec} from '@milaboratories/pl-model-common';\n\nconst PfPlots = {\n controllers: {\n discrete: new DiscreteStateController(),\n scatterplot: new ScatterplotStateController(),\n 'scatterplot-umap': new ScatterplotUmapStateController(),\n heatmap: new HeatmapStateController(),\n dendro: new DendroStateController(),\n histogram: new HistogramStateController(),\n bubble: new BubbleStateController(),\n },\n initialStates: {\n discrete: InitialDiscreteState,\n scatterplot: InitialScatterplotState,\n 'scatterplot-umap': InitialScatterplotUmapState,\n heatmap: InitialHeatmapState,\n dendro: InitialDendroState,\n histogram: InitialHistogramState,\n bubble: InitialBubbleState,\n },\n};\n\nexport function getControllerByType<C extends ChartType>(chartType: C): Controller<InputStateParent<C>> {\n return PfPlots.controllers[chartType] as unknown as Controller<InputStateParent<C>>;\n}\n\nexport function getInitialStateByType<C extends ChartType>(chartType: C): InputStateParent<C> {\n return PfPlots.initialStates[chartType] as unknown as InputStateParent<C>;\n}\n\ntype InputNamesByChartType = {\n [K in ChartType]: K extends 'discrete' ?\n keyof DiscreteUIState['components'] : K extends 'heatmap' ?\n keyof HeatmapUIState['components'] : K extends 'dendro' ?\n keyof DendroUIState['components'] : K extends 'scatterplot' ?\n keyof ScatterplotUIState['components'] : K extends 'scatterplot-umap' ?\n keyof ScatterplotUmapUIState['components'] : K extends 'histogram' ?\n keyof HistogramUIState['components'] : K extends 'bubble' ?\n keyof BubbleUIState['components'] : never\n}\n\nexport {\n AxisData, AxisId, AxisSpec, BubbleStateController, ChartType, ColumnData, ColumnId, ColumnOrAxisData, columnOrAxisIdFromString, ColumnOrAxisIdString, ComponentGuideFilter,\n ComponentGuideSimple,\n ComponentStateFilter,\n ComponentStateSimple, Controller, DemoDataStore, DendroStateController, DendroUIState, DiscreteStateController, DiscreteUIState, HeatmapStateController, HeatmapUIState, InputGuide,\n InputState,\n InputStateParent, isColumnId, PColumnSpec, PlotDataAndSettings, ScatterplotStateController, ScatterplotUIState, SelectorStateFilter,\n SelectorStateSimple,\n SourceOption, type BubbleUIState, type HistogramUIState, type InputNamesByChartType, type PValue, type ScatterplotUmapUIState\n};\n"],"names":["PfPlots","DiscreteStateController","ScatterplotStateController","ScatterplotUmapStateController","HeatmapStateController","DendroStateController","HistogramStateController","BubbleStateController","InitialDiscreteState","InitialScatterplotState","InitialScatterplotUmapState","InitialHeatmapState","InitialDendroState","InitialHistogramState","InitialBubbleState","getControllerByType","chartType","getInitialStateByType"],"mappings":";;;;;;;;;;;;;AA0CA,MAAMA,IAAU;AAAA,EACZ,aAAa;AAAA,IACT,UAAU,IAAIC,EAAAA;AAAAA,IACd,aAAa,IAAIC,EAAAA;AAAAA,IACjB,oBAAoB,IAAIC,EAAAA;AAAAA,IACxB,SAAS,IAAIC,EAAAA;AAAAA,IACb,QAAQ,IAAIC,EAAAA;AAAAA,IACZ,WAAW,IAAIC,EAAAA;AAAAA,IACf,QAAQ,IAAIC,EAAAA;AAAAA,EAAsB;AAAA,EAEtC,eAAe;AAAA,IACX,UAAUC;AAAAA,IACV,aAAaC;AAAAA,IACb,oBAAoBC;AAAAA,IACpB,SAASC;AAAAA,IACT,QAAQC;AAAAA,IACR,WAAWC;AAAAA,IACX,QAAQC;AAAAA,EAAA;AAEhB;AAEO,SAASC,EAAyCC,GAA+C;AAC7F,SAAAhB,EAAQ,YAAYgB,CAAS;AACxC;AAEO,SAASC,EAA2CD,GAAmC;AACnF,SAAAhB,EAAQ,cAAcgB,CAAS;AAC1C;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error_like_shape.js","sources":["../../../../../../../../../node_modules/@milaboratories/pf-plots/node_modules/@milaboratories/pl-error-like/src/error_like_shape.ts"],"sourcesContent":["import stringify from 'json-stringify-safe';\nimport { z } from 'zod';\n\n// We want to define StandardErrorLike and PlErrorLike, it's a way to define recursive types in zod.\n// https://zod.dev/?id=recursive-types\n// We need zod to parse error strings into these objects for keeping new UI and old blocks compatible.\n\nexport const BasePlErrorLike = z.object({\n type: z.literal('PlError'),\n name: z.string(),\n message: z.string(),\n /** The message with all details needed for SDK developers. */\n fullMessage: z.string().optional(),\n stack: z.string().optional(),\n});\n\n/** Known Pl backend and ML errors. */\nexport type PlErrorLike = z.infer<typeof BasePlErrorLike> & {\n cause?: ErrorLike;\n errors?: ErrorLike[];\n};\n\nexport const PlErrorLike: z.ZodType<PlErrorLike> = BasePlErrorLike.extend({\n cause: z.lazy(() => ErrorLike).optional(),\n errors: z.lazy(() => ErrorLike.array()).optional(),\n});\n\nconst BaseStandardErrorLike = z.object({\n type: z.literal('StandardError'),\n name: z.string(),\n message: z.string(),\n stack: z.string().optional(),\n});\n\n/** Others unknown errors that could be thrown by the client. */\nexport type StandardErrorLike = z.infer<typeof BaseStandardErrorLike> & {\n cause?: ErrorLike;\n errors?: ErrorLike[];\n};\n\nexport const StandardErrorLike: z.ZodType<StandardErrorLike> = BaseStandardErrorLike.extend({\n cause: z.lazy(() => ErrorLike).optional(),\n errors: z.lazy(() => ErrorLike.array()).optional(),\n});\n\nexport const ErrorLike = z.union([StandardErrorLike, PlErrorLike]);\nexport type ErrorLike = z.infer<typeof ErrorLike>;\n\n/** Converts everything into ErrorLike. */\nexport function ensureErrorLike(error: unknown): ErrorLike {\n const result = ErrorShape.safeParse(error);\n\n if (result.success) {\n const err = result.data;\n\n if (err.name === 'PlQuickJSError'\n || err.name === 'PlErrorReport'\n || err.name === 'PlInternalError'\n || err.name === 'PlTengoError'\n || err.name === 'PlRunnerError'\n || err.name === 'PlMonetizationError') {\n return {\n type: 'PlError',\n name: err.name,\n message: err.message,\n fullMessage: err.fullMessage ?? undefined,\n stack: err.stack ?? undefined,\n cause: err.cause ? ensureErrorLike(err.cause) : undefined,\n errors: err.errors ? err.errors.map(ensureErrorLike) : undefined,\n };\n }\n\n return {\n type: 'StandardError',\n name: err.name,\n message: err.message,\n stack: err.stack ?? undefined,\n cause: err.cause ? ensureErrorLike(err.cause) : undefined,\n errors: err.errors ? err.errors.map(ensureErrorLike) : undefined,\n };\n }\n\n return {\n type: 'StandardError',\n name: 'Error',\n // Stringify without circular dependencies.\n // Maps (and sets?) will be converted to empty json objects,\n // if this is a problem, we should change the library,\n // but the new library must work in all QuickJS, UI and Node.js like this one.\n message: stringify(error),\n };\n}\n\n/** Tries to parse strings into ErrorLike. It's needed for keeping old blocks compatible with new UI. */\nexport function parseErrorLikeSafe(err: string): {\n success: true;\n data: ErrorLike;\n} | {\n success: false;\n error: Error;\n} {\n try {\n return ErrorLike.safeParse(JSON.parse(err));\n } catch (e) {\n return { success: false, error: new Error(`parseErrorLikeSafe: could not parse JSON: ${err}, ${String(e)}`) };\n }\n}\n\n// We want to define ErrorShape schema just to parse it above, it's a way to define recursive types in zod.\n// https://zod.dev/?id=recursive-types\n\nconst baseErrorShape = z.object({\n name: z.string(),\n message: z.string(),\n fullMessage: z.string().optional(),\n stack: z.string().optional(),\n});\n\ntype ErrorShape = z.infer<typeof baseErrorShape> & {\n cause?: ErrorShape;\n errors?: ErrorShape[];\n};\n\nconst ErrorShape: z.ZodType<ErrorShape> = baseErrorShape.extend({\n cause: z.lazy(() => ErrorShape).optional(),\n errors: z.lazy(() => ErrorShape.array()).optional(),\n});\n"],"names":["BasePlErrorLike","z","PlErrorLike","ErrorLike","BaseStandardErrorLike","StandardErrorLike","baseErrorShape","ErrorShape"],"mappings":";;AAOO,MAAMA,IAAkBC,EAAE,OAAO;AAAA,EACtC,MAAMA,EAAE,QAAQ,SAAS;AAAA,EACzB,MAAMA,EAAE,OAAA;AAAA,EACR,SAASA,EAAE,OAAA;AAAA;AAAA,EAEX,aAAaA,EAAE,OAAA,EAAS,SAAA;AAAA,EACxB,OAAOA,EAAE,OAAA,EAAS,SAAA;AACnB,CAAA,GAQYC,IAAsCF,EAAgB,OAAO;AAAA,EACxE,OAAOC,EAAE,KAAK,MAAME,CAAS,EAAE,SAAA;AAAA,EAC/B,QAAQF,EAAE,KAAK,MAAME,EAAU,MAAA,CAAO,EAAE,SAAA;AACzC,CAAA,GAEKC,IAAwBH,EAAE,OAAO;AAAA,EACrC,MAAMA,EAAE,QAAQ,eAAe;AAAA,EAC/B,MAAMA,EAAE,OAAA;AAAA,EACR,SAASA,EAAE,OAAA;AAAA,EACX,OAAOA,EAAE,OAAA,EAAS,SAAA;AACnB,CAAA,GAQYI,IAAkDD,EAAsB,OAAO;AAAA,EAC1F,OAAOH,EAAE,KAAK,MAAME,CAAS,EAAE,SAAA;AAAA,EAC/B,QAAQF,EAAE,KAAK,MAAME,EAAU,MAAA,CAAO,EAAE,SAAA;AACzC,CAAA,GAEYA,IAAYF,EAAE,MAAM,CAACI,GAAmBH,CAAW,CAAC,GAkE3DI,IAAiBL,EAAE,OAAO;AAAA,EAC9B,MAAMA,EAAE,OAAA;AAAA,EACR,SAASA,EAAE,OAAA;AAAA,EACX,aAAaA,EAAE,OAAA,EAAS,SAAA;AAAA,EACxB,OAAOA,EAAE,OAAA,EAAS,SAAA;AACnB,CAAA,GAOKM,IAAoCD,EAAe,OAAO;AAAA,EAC9D,OAAOL,EAAE,KAAK,MAAMM,CAAU,EAAE,SAAA;AAAA,EAChC,QAAQN,EAAE,KAAK,MAAMM,EAAW,MAAA,CAAO,EAAE,SAAA;AAC1C,CAAA;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blob.js","sources":["../../../../../../../../../../node_modules/@milaboratories/pf-plots/node_modules/@milaboratories/pl-model-common/src/drivers/blob.ts"],"sourcesContent":["import type { Branded } from '../branding';\nimport { z } from 'zod';\n\n/** Handle of locally downloaded blob. This handle is issued only after the\n * blob's content is downloaded locally, and ready for quick access. */\nexport type LocalBlobHandle = Branded<string, 'LocalBlobHandle'>;\n\n/** Handle of remote blob. This handle is issued as soon as the data becomes\n * available on the remote server. */\nexport type RemoteBlobHandle = Branded<string, 'RemoteBlobHandle'>;\n\n/** Being configured inside the output structure provides information about\n * blob's content and means to retrieve it when needed. */\nexport interface BlobHandleAndSize<\n H extends LocalBlobHandle | RemoteBlobHandle = | LocalBlobHandle\n | RemoteBlobHandle,\n> {\n /** Handle to retrieve block content using {@link BlobDriver.getContent()} */\n readonly handle: H;\n\n /** Blob size in bytes. */\n readonly size: number;\n}\n\n/** Range in bytes, from should be less or equal than to. */\nexport const RangeBytes = z.object({\n /** Included left border. */\n from: z.number(),\n /** Excluded right border. */\n to: z.number(),\n});\n\nexport type RangeBytes = z.infer<typeof RangeBytes>;\n\nexport function newRangeBytesOpt(from?: number, to?: number): RangeBytes | undefined {\n if (from == undefined || to == undefined) {\n return undefined;\n }\n\n return { from, to };\n}\n\nexport function validateRangeBytes(range: RangeBytes, errMsg: string) {\n if (range.from < 0 || range.to < 0 || range.from >= range.to) {\n throw new Error(`${errMsg}: invalid bytes range: ${range}`);\n }\n}\n\n/** Being configured inside the output structure provides information about\n * locally downloaded blob and means to retrieve it's content when needed. This\n * structure is created only after the blob's content is downloaded locally, and\n * ready for quick access. */\nexport type LocalBlobHandleAndSize = BlobHandleAndSize<LocalBlobHandle>;\n\n/** Being configured inside the output structure provides information about\n * remote blob and means to retrieve it's content when needed. This structure\n * is created as soon as remote blob becomes available. */\nexport type RemoteBlobHandleAndSize = BlobHandleAndSize<RemoteBlobHandle>;\n\n/** Defines API of blob driver as it is seen from the block UI code. */\nexport interface BlobDriver {\n /** Given the blob handle returns its content. Depending on the handle type,\n * content will be served from locally downloaded file, or directly from\n * remote platforma storage. */\n getContent(handle: LocalBlobHandle | RemoteBlobHandle, range?: RangeBytes): Promise<Uint8Array>;\n}\n"],"names":["z"],"mappings":";AAyB0BA,EAAE,OAAO;AAAA;AAAA,EAEjC,MAAMA,EAAE,OAAA;AAAA;AAAA,EAER,IAAIA,EAAE,OAAA;AACP,CAAA;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { ValueType as a } from "./spec/spec.js";
|
|
2
|
+
function o(r, e) {
|
|
3
|
+
const t = Math.floor(e / 8), n = 1 << 7 - e % 8;
|
|
4
|
+
return (r[t] & n) > 0;
|
|
5
|
+
}
|
|
6
|
+
function s(r, e) {
|
|
7
|
+
return o(r.absent, e);
|
|
8
|
+
}
|
|
9
|
+
function c(r, e) {
|
|
10
|
+
if (r.isNA)
|
|
11
|
+
return o(r.isNA, e);
|
|
12
|
+
const t = r.type, n = r.data[e];
|
|
13
|
+
switch (t) {
|
|
14
|
+
case a.Int:
|
|
15
|
+
return n === -2147483648;
|
|
16
|
+
case a.Long:
|
|
17
|
+
return n === -9007199254740991n;
|
|
18
|
+
case a.Float:
|
|
19
|
+
return Number.isNaN(n);
|
|
20
|
+
case a.Double:
|
|
21
|
+
return Number.isNaN(n);
|
|
22
|
+
case a.String:
|
|
23
|
+
return n === null;
|
|
24
|
+
case a.Bytes:
|
|
25
|
+
return n === null;
|
|
26
|
+
default:
|
|
27
|
+
throw Error(`unsupported data type: ${t}`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
const i = { type: "absent" }, l = null;
|
|
31
|
+
function p(r, e, t) {
|
|
32
|
+
const n = r.type;
|
|
33
|
+
if (n === a.Bytes)
|
|
34
|
+
throw Error("Bytes not yet supported");
|
|
35
|
+
if (t && "dataType" in t && t.dataType !== void 0 && t.dataType !== n)
|
|
36
|
+
throw Error(`expected column of type ${t.dataType}, got ${n}`);
|
|
37
|
+
if (s(r, e))
|
|
38
|
+
return (t == null ? void 0 : t.absent) !== void 0 ? t.absent : i;
|
|
39
|
+
if (c(r, e))
|
|
40
|
+
return (t == null ? void 0 : t.na) !== void 0 ? t.na : l;
|
|
41
|
+
const u = r.data[e];
|
|
42
|
+
switch (n) {
|
|
43
|
+
case a.Int:
|
|
44
|
+
return u;
|
|
45
|
+
case a.Long:
|
|
46
|
+
return Number(u);
|
|
47
|
+
case a.Float:
|
|
48
|
+
return u;
|
|
49
|
+
case a.Double:
|
|
50
|
+
return u;
|
|
51
|
+
case a.String:
|
|
52
|
+
return u;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function y(r, e, t) {
|
|
56
|
+
return p(r, e, t);
|
|
57
|
+
}
|
|
58
|
+
export {
|
|
59
|
+
i as PTableAbsent,
|
|
60
|
+
l as PTableNA,
|
|
61
|
+
y as pTableValue
|
|
62
|
+
};
|
|
63
|
+
//# sourceMappingURL=data_types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data_types.js","sources":["../../../../../../../../../../../node_modules/@milaboratories/pf-plots/node_modules/@milaboratories/pl-model-common/src/drivers/pframe/data_types.ts"],"sourcesContent":["import type { Branded } from '../../branding';\nimport { ValueType } from './spec/spec';\n\nexport type PVectorDataInt = Int32Array;\nexport type PVectorDataLong = BigInt64Array;\nexport type PVectorDataFloat = Float32Array;\nexport type PVectorDataDouble = Float64Array;\nexport type PVectorDataString = (null | string)[];\nexport type PVectorDataBytes = (null | Uint8Array)[];\nexport type PVectorDataTyped<DataType extends ValueType> =\n DataType extends typeof ValueType.Int ? PVectorDataInt :\n DataType extends typeof ValueType.Long ? PVectorDataLong :\n DataType extends typeof ValueType.Float ? PVectorDataFloat :\n DataType extends typeof ValueType.Double ? PVectorDataDouble :\n DataType extends typeof ValueType.String ? PVectorDataString :\n DataType extends typeof ValueType.Bytes ? PVectorDataBytes :\n never;\nexport type PVectorData = PVectorDataTyped<ValueType>;\n\nexport type PTableVectorTyped<DataType extends ValueType> = {\n /** Stored data type */\n readonly type: DataType;\n\n /** Values for present positions, absent positions have NA values */\n readonly data: PVectorDataTyped<DataType>;\n\n /**\n * Encoded bit array marking some elements of this vector as NA,\n * call {@link bitSet} to read the data.\n * In old desktop versions NA values are encoded as magic values in data array.\n * */\n readonly isNA?: Uint8Array;\n\n /**\n * Encoded bit array marking some elements of this vector as absent,\n * call {@link bitSet} to read the data.\n * */\n readonly absent: Uint8Array;\n};\n/** Table column data in comparison to the data stored in a separate PColumn\n * may have some of the values \"absent\", i.e. as a result of missing record in\n * outer join operation. This information is encoded in {@link absent} field. */\nexport type PTableVector = PTableVectorTyped<ValueType>;\n\nfunction isBitSet(bitVector: Uint8Array, offset: number): boolean {\n const chunkIndex = Math.floor(offset / 8);\n const mask = 1 << (7 - (offset % 8));\n return (bitVector[chunkIndex] & mask) > 0;\n}\n\nfunction isValueAbsent(vector: PTableVector, row: number): boolean {\n return isBitSet(vector.absent, row);\n}\n\nfunction isValueNA(vector: PTableVector, row: number): boolean {\n if (vector.isNA) return isBitSet(vector.isNA, row);\n\n // Check for legacy magic values to support old desktop versions\n const valueType = vector.type;\n const value = vector.data[row];\n switch (valueType) {\n case ValueType.Int:\n return (value as PVectorDataInt[number]) === -2147483648;\n case ValueType.Long:\n return (value as PVectorDataLong[number]) === -9007199254740991n;\n case ValueType.Float:\n return Number.isNaN((value as PVectorDataFloat[number]));\n case ValueType.Double:\n return Number.isNaN((value as PVectorDataDouble[number]));\n case ValueType.String:\n return (value as PVectorDataString[number]) === null;\n case ValueType.Bytes:\n return (value as PVectorDataBytes[number]) === null;\n default:\n throw Error(`unsupported data type: ${valueType satisfies never}`);\n }\n}\n\nexport const PTableAbsent = { type: 'absent' } as const;\nexport type PTableAbsent = typeof PTableAbsent;\n\n/** Type guard for absent value */\nexport function isPTableAbsent(value: unknown): value is PTableAbsent {\n return typeof value === 'object' && value !== null && 'type' in value && value.type === 'absent';\n}\n\nexport const PTableNA = null;\nexport type PTableNA = typeof PTableNA;\n\n/** Type guard for NA value */\nexport function isPTableNA(value: unknown): value is PTableNA {\n return value === PTableNA;\n}\n\nexport type ValueTypeSupported = Exclude<ValueType, typeof ValueType.Bytes>;\n\nexport type PTableValueInt = number;\nexport type PTableValueLong = number;\nexport type PTableValueFloat = number;\nexport type PTableValueDouble = number;\nexport type PTableValueString = string;\nexport type PTableValueData<DataType extends ValueTypeSupported> =\n DataType extends typeof ValueType.Int ? PTableValueInt :\n DataType extends typeof ValueType.Long ? PTableValueLong :\n DataType extends typeof ValueType.Float ? PTableValueFloat :\n DataType extends typeof ValueType.Double ? PTableValueDouble :\n DataType extends typeof ValueType.String ? PTableValueString :\n never;\nexport type PTableValueDataBranded<DataType extends ValueTypeSupported> = Branded<PTableValueData<DataType>, DataType>;\nexport type PTableValue<\n Absent = PTableAbsent,\n NA = PTableNA,\n DataType extends ValueTypeSupported = ValueTypeSupported,\n> = Absent | NA | PTableValueData<DataType>;\nexport type PTableValueBranded<\n Absent = PTableAbsent,\n NA = PTableNA,\n DataType extends ValueTypeSupported = ValueTypeSupported,\n> = Absent | NA | PTableValueDataBranded<DataType>;\n\nexport type PTableValueAxis<\n Absent = PTableAbsent,\n DataType extends ValueTypeSupported = ValueTypeSupported,\n> = PTableValue<Absent, never, DataType>;\n\nexport function isPTableValueAxis<Absent, NA, DataType extends ValueTypeSupported>(\n value: PTableValue<Absent, NA, DataType>,\n isNA: (value: PTableValue<Absent, NA, DataType>) => value is NA,\n): value is PTableValueAxis<Absent, DataType>;\nexport function isPTableValueAxis<Absent, DataType extends ValueTypeSupported>(\n value: PTableValue<Absent, PTableNA, DataType>,\n): value is PTableValueAxis<Absent, DataType>;\nexport function isPTableValueAxis<\n Absent = PTableAbsent,\n NA = PTableNA,\n DataType extends ValueTypeSupported = ValueTypeSupported,\n>(\n value: PTableValue<Absent, NA, DataType>,\n isNA?: (value: PTableValue<Absent, NA, DataType>) => value is NA,\n): value is PTableValueAxis<Absent, DataType> {\n return !(isNA ? isNA(value) : isPTableNA(value));\n}\n\nfunction pTableValueImpl<\n FillAbsent = PTableAbsent,\n FillNA = PTableNA,\n DataType extends ValueType = ValueTypeSupported,\n>(\n column: PTableVectorTyped<ValueType>,\n row: number,\n options?: {\n absent?: FillAbsent;\n na?: FillNA;\n dataType?: DataType;\n },\n) {\n const valueType = column.type;\n if (valueType === ValueType.Bytes) {\n throw Error('Bytes not yet supported');\n }\n\n if (options && 'dataType' in options && options.dataType !== undefined && options.dataType !== valueType) {\n throw Error(`expected column of type ${options.dataType}, got ${valueType}`);\n }\n\n if (isValueAbsent(column, row)) {\n return options?.absent !== undefined ? options.absent : PTableAbsent;\n }\n\n if (isValueNA(column, row)) {\n return options?.na !== undefined ? options.na : PTableNA;\n }\n\n const value = column.data[row]!;\n switch (valueType) {\n case ValueType.Int:\n return value as PVectorDataInt[number];\n case ValueType.Long:\n return Number(value as PVectorDataLong[number]);\n case ValueType.Float:\n return value as PVectorDataFloat[number];\n case ValueType.Double:\n return value as PVectorDataDouble[number];\n case ValueType.String:\n return (value as PVectorDataString[number])!;\n }\n}\n\n/** Read PTableValue from PTable column at specified row */\nexport function pTableValue<DataType extends ValueType>(\n column: PTableVectorTyped<DataType>,\n row: number,\n): DataType extends ValueTypeSupported ? PTableValue<PTableAbsent, PTableNA, DataType> : never;\nexport function pTableValue<FillAbsent, DataType extends ValueType>(\n column: PTableVectorTyped<DataType>,\n row: number,\n options: {\n absent: FillAbsent;\n }\n): DataType extends ValueTypeSupported ? PTableValue<FillAbsent, PTableNA, DataType> : never;\nexport function pTableValue<FillNA, DataType extends ValueType>(\n column: PTableVectorTyped<DataType>,\n row: number,\n options: {\n na: FillNA;\n }\n): DataType extends ValueTypeSupported ? PTableValue<PTableAbsent, FillNA, DataType> : never;\nexport function pTableValue<FillNA, FillAbsent, DataType extends ValueType>(\n column: PTableVectorTyped<DataType>,\n row: number,\n options: {\n absent: FillAbsent;\n na: FillNA;\n }\n): DataType extends ValueTypeSupported ? PTableValue<FillAbsent, FillNA, DataType> : never;\nexport function pTableValue<FillAbsent, DataType extends ValueTypeSupported>(\n column: PTableVectorTyped<ValueType>,\n row: number,\n options: {\n absent: FillAbsent;\n dataType: DataType;\n }\n): PTableValue<FillAbsent, PTableNA>;\nexport function pTableValue<FillNA, DataType extends ValueTypeSupported>(\n column: PTableVectorTyped<ValueType>,\n row: number,\n options: {\n na: FillNA;\n dataType: DataType;\n }\n): PTableValue<PTableAbsent, FillNA, DataType>;\nexport function pTableValue<FillNA, FillAbsent, DataType extends ValueTypeSupported>(\n column: PTableVectorTyped<ValueType>,\n row: number,\n options: {\n absent: FillAbsent;\n na: FillNA;\n dataType: DataType;\n }\n): PTableValue<FillAbsent, FillNA, DataType>;\nexport function pTableValue<\n FillAbsent = PTableAbsent,\n FillNA = PTableNA,\n DataType extends ValueType = ValueTypeSupported,\n>(\n column: PTableVectorTyped<ValueType>,\n row: number,\n options?: {\n absent?: FillAbsent;\n na?: FillNA;\n dataType?: DataType;\n },\n) {\n return pTableValueImpl(column, row, options);\n}\n\nexport function pTableValueBranded<DataType extends ValueType>(\n column: PTableVectorTyped<DataType>,\n row: number,\n): DataType extends ValueTypeSupported ? PTableValueBranded<PTableAbsent, PTableNA, DataType> : never;\nexport function pTableValueBranded<FillAbsent, DataType extends ValueType>(\n column: PTableVectorTyped<DataType>,\n row: number,\n options: {\n absent: FillAbsent;\n }\n): DataType extends ValueTypeSupported ? PTableValueBranded<FillAbsent, PTableNA, DataType> : never;\nexport function pTableValueBranded<FillNA, DataType extends ValueType>(\n column: PTableVectorTyped<DataType>,\n row: number,\n options: {\n na: FillNA;\n }\n): DataType extends ValueTypeSupported ? PTableValueBranded<PTableAbsent, FillNA, DataType> : never;\nexport function pTableValueBranded<FillNA, FillAbsent, DataType extends ValueType>(\n column: PTableVectorTyped<DataType>,\n row: number,\n options: {\n absent: FillAbsent;\n na: FillNA;\n }\n): DataType extends ValueTypeSupported ? PTableValueBranded<FillAbsent, FillNA, DataType> : never;\nexport function pTableValueBranded<FillAbsent, DataType extends ValueTypeSupported>(\n column: PTableVectorTyped<ValueType>,\n row: number,\n options: {\n absent: FillAbsent;\n dataType: DataType;\n }\n): PTableValueBranded<FillAbsent, PTableNA>;\nexport function pTableValueBranded<FillNA, DataType extends ValueTypeSupported>(\n column: PTableVectorTyped<ValueType>,\n row: number,\n options: {\n na: FillNA;\n dataType: DataType;\n }\n): PTableValueBranded<PTableAbsent, FillNA, DataType>;\nexport function pTableValueBranded<FillNA, FillAbsent, DataType extends ValueTypeSupported>(\n column: PTableVectorTyped<ValueType>,\n row: number,\n options: {\n absent: FillAbsent;\n na: FillNA;\n dataType: DataType;\n }\n): PTableValueBranded<FillAbsent, FillNA, DataType>;\nexport function pTableValueBranded<\n FillAbsent = PTableAbsent,\n FillNA = PTableNA,\n DataType extends ValueType = ValueTypeSupported,\n>(\n column: PTableVectorTyped<ValueType>,\n row: number,\n options?: {\n absent?: FillAbsent;\n na?: FillNA;\n dataType?: DataType;\n },\n) {\n return pTableValueImpl(column, row, options);\n}\n\n/** Used in requests to partially retrieve table's data */\nexport type TableRange = {\n /** Index of the first record to retrieve */\n readonly offset: number;\n\n /** Block length */\n readonly length: number;\n};\n\n/** Unified information about table shape */\nexport type PTableShape = {\n /** Number of unified table columns, including all axes and PColumn values */\n columns: number;\n\n /** Number of rows */\n rows: number;\n};\n"],"names":["isBitSet","bitVector","offset","chunkIndex","mask","isValueAbsent","vector","row","isValueNA","valueType","value","ValueType","PTableAbsent","PTableNA","pTableValueImpl","column","options","pTableValue"],"mappings":";AA4CA,SAASA,EAASC,GAAuBC,GAAc;AACrD,QAAMC,IAAa,KAAK,MAAMD,IAAS,CAAC,GAClCE,IAAO,KAAM,IAAKF,IAAS;AACjC,UAAQD,EAAUE,CAAU,IAAIC,KAA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