@milaboratories/graph-maker 1.1.140 → 1.1.141
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.js +24 -23
- package/dist/GraphMaker/index.vue.js.map +1 -1
- package/dist/GraphMaker/store.js +9 -9
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotSettings.d.ts.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotSettings.js +54 -52
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotSettings.js.map +1 -1
- package/dist/GraphMaker/utils/loadDefaultSources.js +4 -3
- package/dist/GraphMaker/utils/loadDefaultSources.js.map +1 -1
- package/dist/_virtual/_commonjsHelpers.js +3 -5
- package/dist/_virtual/_commonjsHelpers.js.map +1 -1
- package/dist/node_modules/@milaboratories/pf-plots/dist/_virtual/_commonjsHelpers.js +9 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/_virtual/_commonjsHelpers.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/_virtual/canonicalize.js +8 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/_virtual/canonicalize.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/_virtual/lodash.js +8 -0
- package/dist/{_virtual → node_modules/@milaboratories/pf-plots/dist/_virtual}/lodash.js.map +1 -1
- package/dist/{_virtual/lodash.js → node_modules/@milaboratories/pf-plots/dist/_virtual/lodash2.js} +1 -1
- package/dist/node_modules/@milaboratories/pf-plots/dist/_virtual/lodash2.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/_virtual/stringify.js +3 -0
- package/dist/{_virtual → node_modules/@milaboratories/pf-plots/dist/_virtual}/stringify.js.map +1 -1
- package/dist/{_virtual/stringify.js → node_modules/@milaboratories/pf-plots/dist/_virtual/stringify2.js} +1 -1
- package/dist/node_modules/@milaboratories/pf-plots/dist/_virtual/stringify2.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/constants.js +15 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/constants.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/ComponentController.js +198 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/ComponentController.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/ControllerBase.js +342 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/ControllerBase.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/bubble.js +278 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/bubble.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/dendro.js +453 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/dendro.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/discrete.js +203 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/discrete.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/heatmap.js +432 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/heatmap.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/histogram.js +170 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/histogram.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/scatterplot-umap.js +315 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/scatterplot-umap.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/scatterplot.js +323 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/scatterplot.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/demoStore.js +11 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/demoStore.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/index.js +36 -3426
- package/dist/node_modules/@milaboratories/pf-plots/dist/index.js.map +1 -1
- package/dist/node_modules/@milaboratories/{pl-error-like → pf-plots/dist/node_modules/@milaboratories/pl-error-like}/dist/index.js +1 -1
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-error-like/dist/index.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/index.js +979 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/index.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@platforma-sdk/model/dist/index.js +1599 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@platforma-sdk/model/dist/index.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/canonicalize/lib/canonicalize.js +19 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/canonicalize/lib/canonicalize.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/json-stringify-safe/stringify.js +26 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/json-stringify-safe/stringify.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/lodash/lodash.js +3678 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/lodash/lodash.js.map +1 -0
- package/dist/node_modules/{zod → @milaboratories/pf-plots/dist/node_modules/zod}/lib/index.js +1141 -1141
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/zod/lib/index.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/pframe/ColumnsProvider.js +247 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/pframe/ColumnsProvider.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/spec.js +62 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/spec.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/utils.js +286 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/utils.js.map +1 -0
- package/package.json +2 -2
- package/dist/node_modules/@milaboratories/pl-error-like/dist/index.js.map +0 -1
- package/dist/node_modules/@milaboratories/pl-model-common/dist/index.js +0 -584
- package/dist/node_modules/@milaboratories/pl-model-common/dist/index.js.map +0 -1
- package/dist/node_modules/@platforma-sdk/model/dist/index.js +0 -1559
- package/dist/node_modules/@platforma-sdk/model/dist/index.js.map +0 -1
- package/dist/node_modules/json-stringify-safe/stringify.js +0 -20
- package/dist/node_modules/json-stringify-safe/stringify.js.map +0 -1
- package/dist/node_modules/lodash/lodash.js +0 -3678
- package/dist/node_modules/lodash/lodash.js.map +0 -1
- package/dist/node_modules/zod/lib/index.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadDefaultSources.js","sources":["../../../src/GraphMaker/utils/loadDefaultSources.ts"],"sourcesContent":["import {\n AxisId,\n ChartType,\n ColumnId,\n DemoDataStore,\n InputNamesByChartType,\n SelectorStateFilter, SelectorStateSimple\n} from '@milaboratories/pf-plots';\nimport { PredefinedGraphOption } from '../types';\nimport { AxisSpec, PColumnSpec, ValueType } from '@platforma-sdk/model';\nimport { toRaw } from 'vue';\nimport { SUBSET_FILTER_KEY } from '../constantsCommon';\n\ntype LoadedDefaultOptions<T extends ChartType> = {\n inputName: InputNamesByChartType[T],\n selectedSource: string,\n fixedAxes: SelectorStateSimple['fixedAxes'],\n filterType?: SelectorStateFilter['type']\n selectedFilterRange?: SelectorStateFilter['selectedFilterRange']\n selectedFilterValue?: SelectorStateFilter['selectedFilterValue']\n}\n\nfunction domainIsCompatible(domain?:Record<string, string>, otherDomain?:Record<string, string>):boolean {\n if (typeof domain === 'undefined') {\n return true;\n }\n const keys = Object.keys(domain);\n if (typeof otherDomain === 'undefined') {\n return keys.length === 0;\n }\n return keys.every((key) => otherDomain[key]);\n}\n\nfunction getDefaultFilterType(\n valueType:ValueType,\n annotations?:Record<string, string>,\n selectedFilterValue?: SelectorStateFilter['selectedFilterValue'],\n selectedFilterRange?: Partial<SelectorStateFilter['selectedFilterRange']>\n):SelectorStateFilter['type'] {\n if (annotations?.[SUBSET_FILTER_KEY] === 'true') {\n return 'subset';\n }\n if (selectedFilterRange !== undefined) {\n return 'range';\n }\n if (selectedFilterValue !== undefined) {\n return 'equals';\n }\n if (valueType === 'Int' || valueType === 'String') {\n return 'equals';\n }\n return 'range';\n}\nexport async function loadDefaultSources (\n dataStore:DemoDataStore,\n defaultOptions:PredefinedGraphOption<ChartType>[],\n considerAxisDomains = true,\n):Promise<LoadedDefaultOptions<ChartType>[]> {\n const result:LoadedDefaultOptions<ChartType>[] = []\n const defaultColumnStates = defaultOptions.filter(({ selectedSource }) => 'kind' in selectedSource && selectedSource.kind === 'PColumn');\n const defaultAxisStates = defaultOptions.filter(({ selectedSource }) => !('kind' in selectedSource && selectedSource.kind === 'PColumn'));\n\n const allowedAxisSpecs = [] as {spec: AxisSpec, parentColumn:ColumnId}[]; // if default options contain axes - they should be in other default columns\n\n for (const { inputName, filterType, selectedSource, selectedFilterValue, selectedFilterRange, fixedAxes } of defaultColumnStates) {\n const { name, valueType, annotations, domain } = selectedSource as PColumnSpec;\n const columnId = await dataStore.pFrameProvider.findColumnBy(name, valueType, toRaw(annotations), toRaw(domain));\n const isFilter = inputName === 'filters' || inputName === 'tabBy' || inputName === 'highlight';\n if (columnId) {\n const spec = await dataStore.pFrameProvider.getColumnSpecById(columnId);\n const fixedAxesFilled:SelectorStateSimple['fixedAxes'] = spec && fixedAxes ? fixedAxes.map((el) => ({axisIdx: el.axisIdx, axisValue: el.axisValue, axisSource: AxisId.fromAxisSpec(spec?.axesSpec[el.axisIdx]).toCanonicalString()})) : [];\n if (!isFilter) {\n result.push({ inputName, selectedSource: columnId.toCanonicalString(), fixedAxes: fixedAxesFilled});\n } else {\n const defaultFilterType = filterType ?? getDefaultFilterType(valueType, spec?.annotations, selectedFilterValue, selectedFilterRange);\n const defaultSelectedFilterValue = defaultFilterType === 'equals' && typeof selectedFilterValue === 'undefined'\n ? (await dataStore.pFrameProvider.getColumnUniqueValues(columnId, 1)).values[0]\n : selectedFilterValue;\n const defaultFilterRange = {min: undefined, max: undefined, ...selectedFilterRange};\n result.push({\n inputName,\n filterType: defaultFilterType,\n selectedSource: columnId.toCanonicalString(),\n selectedFilterValue: defaultSelectedFilterValue,\n selectedFilterRange: defaultFilterRange as SelectorStateFilter['selectedFilterRange'],\n fixedAxes: fixedAxesFilled\n });\n }\n\n allowedAxisSpecs.push(...spec?.axesSpec.map((spec) => ({spec, parentColumn:columnId})) ?? []);\n } else {\n console.warn(`Not found column for default option: ${JSON.stringify({inputName, selectedSource})}`)\n }\n }\n for (const { inputName, selectedSource, filterType, selectedFilterValue, selectedFilterRange } of defaultAxisStates) {\n const axisId = AxisId.fromAxisSpec(selectedSource as AxisSpec);\n const axisSourceStr = axisId.toCanonicalString();\n const isFilter = inputName === 'filters' || inputName === 'tabBy' || inputName === 'highlight';\n const defaultFilterType = isFilter ? filterType ?? getDefaultFilterType(axisId.type, selectedSource?.annotations) : undefined;\n\n const columnWithExistingAxis = allowedAxisSpecs.find((el) => AxisId.fromAxisSpec(el.spec).toCanonicalString() === axisSourceStr) ;\n const defaultSelectedFilterValue = isFilter && defaultFilterType === 'equals' && typeof selectedFilterValue === 'undefined' && columnWithExistingAxis?.parentColumn\n ? (await dataStore.pFrameProvider.getAxisUniqueValues(axisId, [columnWithExistingAxis?.parentColumn], 1)).values[0]\n : selectedFilterValue\n const defaultFilterRange = {min: undefined, max: undefined, ...selectedFilterRange};\n\n if (!considerAxisDomains) {\n result.push({\n inputName,\n filterType: defaultFilterType,\n selectedSource: axisSourceStr,\n selectedFilterValue: defaultSelectedFilterValue,\n selectedFilterRange: defaultFilterRange as SelectorStateFilter['selectedFilterRange'],\n fixedAxes: []\n });\n }\n if (columnWithExistingAxis) {\n result.push({\n inputName,\n filterType: defaultFilterType,\n selectedSource: axisSourceStr,\n selectedFilterValue: defaultSelectedFilterValue,\n selectedFilterRange: defaultFilterRange as SelectorStateFilter['selectedFilterRange'],\n fixedAxes: []\n });\n } else {\n const { spec: allowedCompatibleAxisSpec, parentColumn } = allowedAxisSpecs.find((el) => {\n return axisId.name === el.spec.name && axisId.type === el.spec.type && domainIsCompatible(axisId.domain, el.spec.domain);\n }) ?? {};\n if (allowedCompatibleAxisSpec) {\n const defaultSelectedFilterValue = (inputName === 'filters' || inputName === 'tabBy') && typeof selectedFilterValue === 'undefined'\n ? (await dataStore.pFrameProvider.getAxisUniqueValues(AxisId.fromAxisSpec(allowedCompatibleAxisSpec), [parentColumn as ColumnId], 1)).values[0]\n : selectedFilterValue\n result.push({\n inputName,\n filterType: defaultFilterType,\n selectedSource: AxisId.fromAxisSpec(allowedCompatibleAxisSpec).toCanonicalString(),\n selectedFilterValue: defaultSelectedFilterValue,\n selectedFilterRange: defaultFilterRange as SelectorStateFilter['selectedFilterRange'],\n fixedAxes: []\n });\n }\n }\n }\n\n return result;\n}"],"names":["domainIsCompatible","domain","otherDomain","keys","key","getDefaultFilterType","valueType","annotations","selectedFilterValue","selectedFilterRange","SUBSET_FILTER_KEY","loadDefaultSources","dataStore","defaultOptions","considerAxisDomains","result","defaultColumnStates","selectedSource","defaultAxisStates","allowedAxisSpecs","inputName","filterType","fixedAxes","name","columnId","toRaw","isFilter","spec","fixedAxesFilled","el","AxisId","defaultFilterType","defaultSelectedFilterValue","defaultFilterRange","axisId","axisSourceStr","columnWithExistingAxis","allowedCompatibleAxisSpec","parentColumn"],"mappings":";;;AAsBA,SAASA,EAAmBC,GAAgCC,GAA6C;AACvG,MAAI,OAAOD,IAAW;AACpB,WAAO;AAET,QAAME,IAAO,OAAO,KAAKF,CAAM;AAC/B,SAAI,OAAOC,IAAgB,MAClBC,EAAK,WAAW,IAElBA,EAAK,MAAM,CAACC,MAAQ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gBAAAA,EAAwB,YAAY,GAAG,CAAC,GAAG,OAAO,CAAC,IAChH5B,GACEyB,IAAqB,EAAC,KAAK,QAAW,KAAK,QAAW,GAAGxB,EAAA;AAY/D,QAVKK,KACHC,EAAO,KAAK;AAAA,MACV,WAAAK;AAAA,MACA,YAAYW;AAAA,MACZ,gBAAgBI;AAAA,MAChB,qBAAqBH;AAAA,MACrB,qBAAqBC;AAAA,MACrB,WAAW,CAAA;AAAA,IAAC,CACb,GAECG;AACF,MAAArB,EAAO,KAAK;AAAA,QACV,WAAAK;AAAA,QACA,YAAYW;AAAA,QACZ,gBAAgBI;AAAA,QAChB,qBAAqBH;AAAA,QACrB,qBAAqBC;AAAA,QACrB,WAAW,CAAA;AAAA,MAAC,CACb;AAAA,SACI;AACL,YAAM,EAAE,MAAMI,GAA2B,cAAAC,EAAA,IAAiBnB,EAAiB,KAAK,CAACU,MACxEK,EAAO,SAASL,EAAG,KAAK,QAAQK,EAAO,SAASL,EAAG,KAAK,QAAQ7B,EAAmBkC,EAAO,QAAQL,EAAG,KAAK,MAAM,CACxH,KAAK,CAAA;AACN,UAAIQ,GAA2B;AAC7B,cAAML,KAA8BZ,MAAc,aAAaA,MAAc,YAAY,OAAOZ,IAAwB,OACnH,MAAMI,EAAU,eAAe,oBAAoBkB,EAAO,aAAaO,CAAyB,GAAG,CAACC,CAAwB,GAAG,CAAC,GAAG,OAAO,CAAC,IAC5I9B;AACJ,QAAAO,EAAO,KAAK;AAAA,UACV,WAAAK;AAAA,UACA,YAAYW;AAAA,UACZ,gBAAgBD,EAAO,aAAaO,CAAyB,EAAE,kBAAA;AAAA,UAC/D,qBAAqBL;AAAAA,UACrB,qBAAqBC;AAAA,UACrB,WAAW,CAAA;AAAA,QAAC,CACb;AAAA,MACH;AAAA,IACF;AAAA,EACF;AAEA,SAAOlB;AACT;"}
|
|
1
|
+
{"version":3,"file":"loadDefaultSources.js","sources":["../../../src/GraphMaker/utils/loadDefaultSources.ts"],"sourcesContent":["import {\n AxisId,\n ChartType,\n ColumnId,\n DemoDataStore,\n InputNamesByChartType,\n SelectorStateFilter, SelectorStateSimple\n} from '@milaboratories/pf-plots';\nimport { PredefinedGraphOption } from '../types';\nimport { AxisSpec, PColumnSpec, ValueType } from '@platforma-sdk/model';\nimport { toRaw } from 'vue';\nimport { SUBSET_FILTER_KEY } from '../constantsCommon';\n\ntype LoadedDefaultOptions<T extends ChartType> = {\n inputName: InputNamesByChartType[T],\n selectedSource: string,\n fixedAxes: SelectorStateSimple['fixedAxes'],\n filterType?: SelectorStateFilter['type']\n selectedFilterRange?: SelectorStateFilter['selectedFilterRange']\n selectedFilterValue?: SelectorStateFilter['selectedFilterValue']\n}\n\nfunction domainIsCompatible(domain?:Record<string, string>, otherDomain?:Record<string, string>):boolean {\n if (typeof domain === 'undefined') {\n return true;\n }\n const keys = Object.keys(domain);\n if (typeof otherDomain === 'undefined') {\n return keys.length === 0;\n }\n return keys.every((key) => otherDomain[key]);\n}\n\nfunction getDefaultFilterType(\n valueType:ValueType,\n annotations?:Record<string, string>,\n selectedFilterValue?: SelectorStateFilter['selectedFilterValue'],\n selectedFilterRange?: Partial<SelectorStateFilter['selectedFilterRange']>\n):SelectorStateFilter['type'] {\n if (annotations?.[SUBSET_FILTER_KEY] === 'true') {\n return 'subset';\n }\n if (selectedFilterRange !== undefined) {\n return 'range';\n }\n if (selectedFilterValue !== undefined) {\n return 'equals';\n }\n if (valueType === 'Int' || valueType === 'String') {\n return 'equals';\n }\n return 'range';\n}\nexport async function loadDefaultSources (\n dataStore:DemoDataStore,\n defaultOptions:PredefinedGraphOption<ChartType>[],\n considerAxisDomains = true,\n):Promise<LoadedDefaultOptions<ChartType>[]> {\n const result:LoadedDefaultOptions<ChartType>[] = []\n const defaultColumnStates = defaultOptions.filter(({ selectedSource }) => 'kind' in selectedSource && selectedSource.kind === 'PColumn');\n const defaultAxisStates = defaultOptions.filter(({ selectedSource }) => !('kind' in selectedSource && selectedSource.kind === 'PColumn'));\n\n const allowedAxisSpecs = [] as {spec: AxisSpec, parentColumn:ColumnId}[]; // if default options contain axes - they should be in other default columns\n\n for (const { inputName, filterType, selectedSource, selectedFilterValue, selectedFilterRange, fixedAxes } of defaultColumnStates) {\n const { name, valueType, annotations, domain } = selectedSource as PColumnSpec;\n const columnId = await dataStore.pFrameProvider.findColumnBy(name, valueType, toRaw(annotations), toRaw(domain));\n const isFilter = inputName === 'filters' || inputName === 'tabBy' || inputName === 'highlight';\n if (columnId) {\n const spec = await dataStore.pFrameProvider.getColumnSpecById(columnId);\n const fixedAxesFilled:SelectorStateSimple['fixedAxes'] = spec && fixedAxes ? fixedAxes.map((el) => ({axisIdx: el.axisIdx, axisValue: el.axisValue, axisSource: AxisId.fromAxisSpec(spec?.axesSpec[el.axisIdx]).toCanonicalString()})) : [];\n if (!isFilter) {\n result.push({ inputName, selectedSource: columnId.toCanonicalString(), fixedAxes: fixedAxesFilled});\n } else {\n const defaultFilterType = filterType ?? getDefaultFilterType(valueType, spec?.annotations, selectedFilterValue, selectedFilterRange);\n const defaultSelectedFilterValue = defaultFilterType === 'equals' && typeof selectedFilterValue === 'undefined'\n ? (await dataStore.pFrameProvider.getColumnUniqueValues(columnId, 1)).values[0]\n : selectedFilterValue;\n const defaultFilterRange = {min: undefined, max: undefined, ...selectedFilterRange};\n result.push({\n inputName,\n filterType: defaultFilterType,\n selectedSource: columnId.toCanonicalString(),\n selectedFilterValue: defaultSelectedFilterValue,\n selectedFilterRange: defaultFilterRange as SelectorStateFilter['selectedFilterRange'],\n fixedAxes: fixedAxesFilled\n });\n }\n\n allowedAxisSpecs.push(...spec?.axesSpec.map((spec) => ({spec, parentColumn:columnId})) ?? []);\n } else {\n console.warn(`Not found column for default option: ${JSON.stringify({inputName, selectedSource})}`)\n }\n }\n for (const { inputName, selectedSource, filterType, selectedFilterValue, selectedFilterRange } of defaultAxisStates) {\n const axisId = AxisId.fromAxisSpec(selectedSource as AxisSpec);\n const axisSourceStr = axisId.toCanonicalString();\n const isFilter = inputName === 'filters' || inputName === 'tabBy' || inputName === 'highlight';\n const defaultFilterType = isFilter ? filterType ?? getDefaultFilterType(axisId.type, selectedSource?.annotations) : undefined;\n\n const columnWithExistingAxis = allowedAxisSpecs.find((el) => AxisId.fromAxisSpec(el.spec).toCanonicalString() === axisSourceStr) ;\n const defaultSelectedFilterValue = isFilter && defaultFilterType === 'equals' && typeof selectedFilterValue === 'undefined' && columnWithExistingAxis?.parentColumn\n ? (await dataStore.pFrameProvider.getAxisUniqueValues(axisId, [columnWithExistingAxis?.parentColumn], 1)).values[0]\n : selectedFilterValue\n const defaultFilterRange = {min: undefined, max: undefined, ...selectedFilterRange};\n\n if (!considerAxisDomains) {\n result.push({\n inputName,\n filterType: defaultFilterType,\n selectedSource: axisSourceStr,\n selectedFilterValue: defaultSelectedFilterValue,\n selectedFilterRange: defaultFilterRange as SelectorStateFilter['selectedFilterRange'],\n fixedAxes: []\n });\n }\n if (columnWithExistingAxis) {\n result.push({\n inputName,\n filterType: defaultFilterType,\n selectedSource: axisSourceStr,\n selectedFilterValue: defaultSelectedFilterValue,\n selectedFilterRange: defaultFilterRange as SelectorStateFilter['selectedFilterRange'],\n fixedAxes: []\n });\n } else {\n const { spec: allowedCompatibleAxisSpec, parentColumn } = allowedAxisSpecs.find((el) => {\n return axisId.name === el.spec.name && axisId.type === el.spec.type && domainIsCompatible(axisId.domain, el.spec.domain);\n }) ?? {};\n if (allowedCompatibleAxisSpec) {\n const defaultSelectedFilterValue = (inputName === 'filters' || inputName === 'tabBy') && typeof selectedFilterValue === 'undefined'\n ? (await dataStore.pFrameProvider.getAxisUniqueValues(AxisId.fromAxisSpec(allowedCompatibleAxisSpec), [parentColumn as ColumnId], 1)).values[0]\n : selectedFilterValue\n result.push({\n inputName,\n filterType: defaultFilterType,\n selectedSource: AxisId.fromAxisSpec(allowedCompatibleAxisSpec).toCanonicalString(),\n selectedFilterValue: defaultSelectedFilterValue,\n selectedFilterRange: defaultFilterRange as SelectorStateFilter['selectedFilterRange'],\n fixedAxes: []\n });\n }\n }\n }\n\n return result;\n}"],"names":["domainIsCompatible","domain","otherDomain","keys","key","getDefaultFilterType","valueType","annotations","selectedFilterValue","selectedFilterRange","SUBSET_FILTER_KEY","loadDefaultSources","dataStore","defaultOptions","considerAxisDomains","result","defaultColumnStates","selectedSource","defaultAxisStates","allowedAxisSpecs","inputName","filterType","fixedAxes","name","columnId","toRaw","isFilter","spec","fixedAxesFilled","el","AxisId","defaultFilterType","defaultSelectedFilterValue","defaultFilterRange","axisId","axisSourceStr","columnWithExistingAxis","allowedCompatibleAxisSpec","parentColumn"],"mappings":";;;;AAsBA,SAASA,EAAmBC,GAAgCC,GAA6C;AACvG,MAAI,OAAOD,IAAW;AACpB,WAAO;AAET,QAAME,IAAO,OAAO,KAAKF,CAAM;AAC/B,SAAI,OAAOC,IAAgB,MAClBC,EAAK,WAAW,IAElBA,EAAK,MAAM,CAACC,MAAQF,EAAYE,CAAG,CAAC;AAC7C;AAEA,SAASC,EACPC,GACAC,GACAC,GACAC,GAC4B;AAC5B,UAAIF,KAAA,gBAAAA,EAAcG,QAAuB,SAChC,WAELD,MAAwB,SACnB,UAELD,MAAwB,UAGxBF,MAAc,SAASA,MAAc,WAChC,WAEF;AACT;AACA,eAAsBK,EACpBC,GACAC,GACAC,IAAsB,IACqB;AAC3C,QAAMC,IAA2C,CAAA,GAC3CC,IAAsBH,EAAe,OAAO,CAAC,EAAE,gBAAAI,QAAqB,UAAUA,KAAkBA,EAAe,SAAS,SAAS,GACjIC,IAAoBL,EAAe,OAAO,CAAC,EAAE,gBAAAI,EAAA,MAAqB,EAAE,UAAUA,KAAkBA,EAAe,SAAS,UAAU,GAElIE,IAAmB,CAAA;AAEzB,aAAW,EAAE,WAAAC,GAAW,YAAAC,GAAY,gBAAAJ,GAAgB,qBAAAT,GAAqB,qBAAAC,GAAqB,WAAAa,EAAA,KAAeN,GAAqB;AAChI,UAAM,EAAE,MAAAO,GAAM,WAAAjB,GAAW,aAAAC,GAAa,QAA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H,KAAK,CAAA;AACN,UAAIQ,GAA2B;AAC7B,cAAML,KAA8BZ,MAAc,aAAaA,MAAc,YAAY,OAAOZ,IAAwB,OACnH,MAAMI,EAAU,eAAe,oBAAoBkB,EAAO,aAAaO,CAAyB,GAAG,CAACC,CAAwB,GAAG,CAAC,GAAG,OAAO,CAAC,IAC5I9B;AACJ,QAAAO,EAAO,KAAK;AAAA,UACV,WAAAK;AAAA,UACA,YAAYW;AAAA,UACZ,gBAAgBD,EAAO,aAAaO,CAAyB,EAAE,kBAAA;AAAA,UAC/D,qBAAqBL;AAAAA,UACrB,qBAAqBC;AAAA,UACrB,WAAW,CAAA;AAAA,QAAC,CACb;AAAA,MACH;AAAA,IACF;AAAA,EACF;AAEA,SAAOlB;AACT;"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
1
|
+
function e(t) {
|
|
2
|
+
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
4
3
|
}
|
|
5
4
|
export {
|
|
6
|
-
|
|
7
|
-
l as getDefaultExportFromCjs
|
|
5
|
+
e as getDefaultExportFromCjs
|
|
8
6
|
};
|
|
9
7
|
//# sourceMappingURL=_commonjsHelpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_commonjsHelpers.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"_commonjsHelpers.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
var l = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
2
|
+
function t(o) {
|
|
3
|
+
return o && o.__esModule && Object.prototype.hasOwnProperty.call(o, "default") ? o.default : o;
|
|
4
|
+
}
|
|
5
|
+
export {
|
|
6
|
+
l as commonjsGlobal,
|
|
7
|
+
t as getDefaultExportFromCjs
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=_commonjsHelpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_commonjsHelpers.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { getDefaultExportFromCjs as r } from "./_commonjsHelpers.js";
|
|
2
|
+
import { __require as t } from "../node_modules/canonicalize/lib/canonicalize.js";
|
|
3
|
+
var o = t();
|
|
4
|
+
const m = /* @__PURE__ */ r(o);
|
|
5
|
+
export {
|
|
6
|
+
m as default
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=canonicalize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canonicalize.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lodash.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lodash.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lodash2.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
package/dist/{_virtual → node_modules/@milaboratories/pf-plots/dist/_virtual}/stringify.js.map
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stringify.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"stringify.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stringify2.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const p = "pl7.app/axisNature", a = "pl7.app/label", s = "pl7.app/columnAsAxis/name", l = "pl7.app/columnAsAxis/domain", E = "pl7.app/isSubset", _ = "pl7.app/isDiscreteFilter", i = "pl7.app/discreteValues", A = "pl7.app/graph/axis/highCardinality", L = "pl7.app/graph/isVirtual", I = "pl7.app/isLinkerColumn", e = "pl7.app/format";
|
|
2
|
+
export {
|
|
3
|
+
p as AXIS_NATURE_KEY,
|
|
4
|
+
l as COLUMN_DOMAIN_KEY,
|
|
5
|
+
a as COLUMN_LABEL_KEY,
|
|
6
|
+
s as COLUMN_NAME_KEY,
|
|
7
|
+
_ as DISCRETE_FILTER_KEY,
|
|
8
|
+
i as DISCRETE_VALUES_KEY,
|
|
9
|
+
e as FORMAT,
|
|
10
|
+
A as HIGH_CARDINALITY,
|
|
11
|
+
I as IS_LINKER_COLUMN,
|
|
12
|
+
L as IS_VIRTUAL_COLUMN,
|
|
13
|
+
E as SUBSET_FILTER_KEY
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../../../../../node_modules/@milaboratories/pf-plots/src/constants.ts"],"sourcesContent":["export const AXIS_NATURE_KEY = 'pl7.app/axisNature';\nexport const COLUMN_LABEL_KEY = 'pl7.app/label';\n\nexport const COLUMN_NAME_KEY = 'pl7.app/columnAsAxis/name';\nexport const COLUMN_DOMAIN_KEY = 'pl7.app/columnAsAxis/domain';\nexport const SUBSET_FILTER_KEY = 'pl7.app/isSubset';\nexport const DISCRETE_FILTER_KEY = 'pl7.app/isDiscreteFilter';\nexport const DISCRETE_VALUES_KEY = 'pl7.app/discreteValues';\nexport const MIN_VALUE_KEY = 'pl7.app/min';\nexport const MAX_VALUE_KEY = 'pl7.app/max';\n\nexport const HIGH_CARDINALITY = 'pl7.app/graph/axis/highCardinality';\nexport const IS_VIRTUAL_COLUMN = 'pl7.app/graph/isVirtual'; // duplicate of metadata-column enriched domain keys for compatibility with other column\nexport const IS_LINKER_COLUMN = 'pl7.app/isLinkerColumn';\n\nexport const FORMAT = 'pl7.app/format';\n"],"names":["AXIS_NATURE_KEY","COLUMN_LABEL_KEY","COLUMN_NAME_KEY","COLUMN_DOMAIN_KEY","SUBSET_FILTER_KEY","DISCRETE_FILTER_KEY","DISCRETE_VALUES_KEY","HIGH_CARDINALITY","IS_VIRTUAL_COLUMN","IS_LINKER_COLUMN","FORMAT"],"mappings":"AAAO,MAAMA,IAAkB,sBAClBC,IAAmB,iBAEnBC,IAAkB,6BAClBC,IAAoB,+BACpBC,IAAoB,oBACpBC,IAAsB,4BACtBC,IAAsB,0BAItBC,IAAmB,sCACnBC,IAAoB,2BACpBC,IAAmB,0BAEnBC,IAAS;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { isLabelColumn as H } from "../node_modules/@platforma-sdk/model/dist/index.js";
|
|
2
|
+
import { DISCRETE_FILTER_KEY as L, SUBSET_FILTER_KEY as q, IS_LINKER_COLUMN as G } from "../constants.js";
|
|
3
|
+
import { columnOrAxisIdFromString as I, isColumnId as B, AxisId as C } from "../spec.js";
|
|
4
|
+
import { getStateCopy as W, getNotAllowedAxes as M, axisMustBeConsumed as X, getColumnOrAxisLabel as R } from "../utils.js";
|
|
5
|
+
var $ = Object.defineProperty, J = (f, e, t) => e in f ? $(f, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : f[e] = t, g = (f, e, t) => J(f, typeof e != "symbol" ? e + "" : e, t);
|
|
6
|
+
const Q = (f) => {
|
|
7
|
+
var e;
|
|
8
|
+
return ((e = f == null ? void 0 : f.annotations) == null ? void 0 : e[G]) === "true";
|
|
9
|
+
}, _ = class K {
|
|
10
|
+
constructor({
|
|
11
|
+
componentName: e,
|
|
12
|
+
allowedTypes: t,
|
|
13
|
+
settings: n,
|
|
14
|
+
strictlyDependsOnParents: i,
|
|
15
|
+
dependsOn: s = [],
|
|
16
|
+
parentComponents: c = [],
|
|
17
|
+
annotations: l = {},
|
|
18
|
+
checkSourceBySpec: m
|
|
19
|
+
}) {
|
|
20
|
+
g(this, "componentName"), g(this, "allowedTypes"), g(this, "settings"), g(this, "dependsOn"), g(this, "parentComponents"), g(this, "strictlyDependsOnParents"), g(this, "annotations"), g(this, "checkSourceBySpec"), this.componentName = e, this.allowedTypes = [...t], this.settings = { ...K.DefaultSettings, ...n }, this.dependsOn = [...s], this.parentComponents = [...c], this.strictlyDependsOnParents = i ?? !0, this.annotations = { ...l }, m && (this.checkSourceBySpec = m);
|
|
21
|
+
}
|
|
22
|
+
get isRequired() {
|
|
23
|
+
return this.settings.required;
|
|
24
|
+
}
|
|
25
|
+
get isDimensionsConsumer() {
|
|
26
|
+
return this.settings.dimensionConsumer;
|
|
27
|
+
}
|
|
28
|
+
addSelected(e, t) {
|
|
29
|
+
const n = W(e);
|
|
30
|
+
return n.components[this.componentName].selectorStates.push(t), n;
|
|
31
|
+
}
|
|
32
|
+
deleteSelected(e, t) {
|
|
33
|
+
const n = W(e);
|
|
34
|
+
return n.components[this.componentName].selectorStates = n.components[this.componentName].selectorStates.filter((i) => i.selectedSource !== t), n;
|
|
35
|
+
}
|
|
36
|
+
async checkStateConsistency(e, t, n) {
|
|
37
|
+
const i = t.components[this.componentName], { parentAxes: s, parentAxesList: c } = await this.getAllowedAxes(e, t);
|
|
38
|
+
function l(r) {
|
|
39
|
+
const d = C.fromAxisSpec(r).toCanonicalString();
|
|
40
|
+
return s.has(d);
|
|
41
|
+
}
|
|
42
|
+
const m = await Promise.all(
|
|
43
|
+
i.selectorStates.map(async ({ selectedSource: r }) => {
|
|
44
|
+
const d = I(r);
|
|
45
|
+
if (B(d)) {
|
|
46
|
+
const o = await e.pFrameProvider.getColumnSpecById(d);
|
|
47
|
+
return o ? this.parentComponents.length === 0 ? !0 : this.strictlyDependsOnParents && !this.settings.columnsWithExtraAxesAllowed && !this.settings.isDataComponent ? o.axesSpec.every((p) => l(p)) : this.settings.columnsWithExtraAxesAllowed && !this.settings.isDataComponent ? o.axesSpec.some((p) => l(p)) ? !0 : M(o, c, s, n).length < o.axesSpec.length : s.size === 0 || o.axesSpec.some((p) => l(p)) : !1;
|
|
48
|
+
}
|
|
49
|
+
return s.has(r);
|
|
50
|
+
})
|
|
51
|
+
);
|
|
52
|
+
return i.selectorStates.reduce(
|
|
53
|
+
(r, d, o) => (r[d.selectedSource] = m[o], r),
|
|
54
|
+
{}
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
async getProducingAxes(e, t) {
|
|
58
|
+
const n = t.components[this.componentName].selectorStates.map((s) => I(s.selectedSource)).filter((s) => B(s)), i = /* @__PURE__ */ new Set();
|
|
59
|
+
return (await Promise.all(
|
|
60
|
+
n.map((s) => e.pFrameProvider.getColumnSpecById(s))
|
|
61
|
+
)).forEach((s) => {
|
|
62
|
+
s && s.axesSpec.forEach((c) => {
|
|
63
|
+
i.add(C.fromAxisSpec(c).toCanonicalString());
|
|
64
|
+
});
|
|
65
|
+
}), i;
|
|
66
|
+
}
|
|
67
|
+
getParentSelectedSources(e, t) {
|
|
68
|
+
return this.parentComponents.reduce((n, i) => {
|
|
69
|
+
const s = t.components[i].selectorStates.map(
|
|
70
|
+
(c) => I(c.selectedSource)
|
|
71
|
+
);
|
|
72
|
+
return n.push(...s), n;
|
|
73
|
+
}, []);
|
|
74
|
+
}
|
|
75
|
+
async getParentAxes(e, t) {
|
|
76
|
+
var n;
|
|
77
|
+
const i = this.getParentSelectedSources(e, t), s = /* @__PURE__ */ new Set();
|
|
78
|
+
for (const c of i)
|
|
79
|
+
if (B(c)) {
|
|
80
|
+
const l = await e.pFrameProvider.getColumnSpecById(c);
|
|
81
|
+
(n = l == null ? void 0 : l.axesSpec) == null || n.forEach((m) => {
|
|
82
|
+
const r = C.fromAxisSpec(m);
|
|
83
|
+
s.add(r.toCanonicalString());
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
return s;
|
|
87
|
+
}
|
|
88
|
+
async getAllowedAxes(e, t) {
|
|
89
|
+
var n, i;
|
|
90
|
+
const s = this.getParentSelectedSources(e, t), c = /* @__PURE__ */ new Set(), l = [], m = /* @__PURE__ */ new Map();
|
|
91
|
+
for (const r of s)
|
|
92
|
+
if (B(r)) {
|
|
93
|
+
const d = await e.pFrameProvider.getColumnSpecById(r);
|
|
94
|
+
for (const o of (d == null ? void 0 : d.axesSpec) ?? []) {
|
|
95
|
+
const p = C.fromAxisSpec(o).toCanonicalString();
|
|
96
|
+
if (c.has(p))
|
|
97
|
+
continue;
|
|
98
|
+
c.add(p), l.push(o);
|
|
99
|
+
const v = X(o);
|
|
100
|
+
m.set(p, {
|
|
101
|
+
kind: "axis",
|
|
102
|
+
name: o.name,
|
|
103
|
+
label: await R(e, p, [
|
|
104
|
+
r.toCanonicalString()
|
|
105
|
+
]),
|
|
106
|
+
type: o.type,
|
|
107
|
+
mustBeConsumed: v,
|
|
108
|
+
dividable: !1,
|
|
109
|
+
spec: o,
|
|
110
|
+
annotations: o.annotations,
|
|
111
|
+
isSubsetFilter: ((n = o.annotations) == null ? void 0 : n[q]) === "true",
|
|
112
|
+
isDiscreteFilter: o.type === "String" || ((i = o.annotations) == null ? void 0 : i[L]) === "true",
|
|
113
|
+
parentSources: [r.toCanonicalString()]
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return { parentAxes: c, parentAxesList: l, optionsInfo: m };
|
|
118
|
+
}
|
|
119
|
+
async getOptions(e, t, n, i, s, c, l = /* @__PURE__ */ new Set(), m = /* @__PURE__ */ new Set()) {
|
|
120
|
+
var r, d, o;
|
|
121
|
+
const p = this.settings.multipleSelectors, v = this.settings.required, O = await this.checkStateConsistency(e, t, s);
|
|
122
|
+
if (this.dependsOn.length && this.dependsOn.some((h) => t.components[h].selectorStates.length === 0))
|
|
123
|
+
return { multipleSelectors: p, required: v, stateConsistency: O, options: [], optionsInfo: /* @__PURE__ */ new Map() };
|
|
124
|
+
if (this.strictlyDependsOnParents && !this.settings.isDataComponent && this.parentComponents.some((h) => t.components[h].selectorStates.length === 0))
|
|
125
|
+
return { multipleSelectors: p, required: v, stateConsistency: O, options: [], optionsInfo: /* @__PURE__ */ new Map() };
|
|
126
|
+
const j = this.getParentSelectedSources(e, t), U = (await e.pFrameProvider.getColumns([], !1, this.allowedTypes, void 0, this.annotations)).filter((h) => !i.has(h.toCanonicalString())), { parentAxes: D, parentAxesList: Y, optionsInfo: F } = await this.getAllowedAxes(e, t), z = t.components[this.componentName], b = [];
|
|
127
|
+
if (this.settings.axesAllowed)
|
|
128
|
+
for (const h of D) {
|
|
129
|
+
const y = I(h), S = F.get(y.toCanonicalString()), w = this.allowedTypes.includes(S.spec.type), a = Object.entries(this.annotations).every(
|
|
130
|
+
([E, u]) => {
|
|
131
|
+
var x;
|
|
132
|
+
return ((x = S.spec.annotations) == null ? void 0 : x[E]) === u;
|
|
133
|
+
}
|
|
134
|
+
), A = this.checkSourceBySpec ? this.checkSourceBySpec(S.spec, t) : !0, N = !this.settings.homogeneous || !(S != null && S.mustBeConsumed), T = !i.has(h), P = l.has(y.name) || m.has(y.toCanonicalString()), k = z.selectorStates.some((E) => E.selectedSource === h);
|
|
135
|
+
w && a && A && N && T && !P && !k && b.push({ value: h });
|
|
136
|
+
}
|
|
137
|
+
if (this.settings.columnsAllowed) {
|
|
138
|
+
const h = !this.settings.columnsWithExtraAxesAllowed && this.strictlyDependsOnParents;
|
|
139
|
+
for (const y of U) {
|
|
140
|
+
const S = y.toCanonicalString(), w = I(S), a = await e.pFrameProvider.getColumnSpecById(w);
|
|
141
|
+
if (!a)
|
|
142
|
+
continue;
|
|
143
|
+
const A = M(
|
|
144
|
+
a,
|
|
145
|
+
Y,
|
|
146
|
+
D,
|
|
147
|
+
s
|
|
148
|
+
).map((u) => C.fromAxisSpec(u).toCanonicalString()), N = new Set(A);
|
|
149
|
+
if (
|
|
150
|
+
// do not add to available options label columns, or columns that are not fit by custom spec condition, or columns that are not fit by condition for data inputs
|
|
151
|
+
H(a) || Q(a) || this.checkSourceBySpec && !this.checkSourceBySpec(a, t) || this.settings.isDataComponent && !c(a) || h && A.length > 0 || j.length && A.length > 0 && !a.axesSpec.some((u) => {
|
|
152
|
+
const x = C.fromAxisSpec(u).toCanonicalString();
|
|
153
|
+
return D.has(x);
|
|
154
|
+
})
|
|
155
|
+
)
|
|
156
|
+
continue;
|
|
157
|
+
const T = ((r = a == null ? void 0 : a.axesSpec) == null ? void 0 : r.map((u) => C.fromAxisSpec(u).toCanonicalString())) ?? [], P = {};
|
|
158
|
+
if (this.settings.columnsWithExtraAxesAllowed && T.forEach((u, x) => {
|
|
159
|
+
N.has(u) && (P[u] = x);
|
|
160
|
+
}), a) {
|
|
161
|
+
const u = n[S] ?? await R(e, y.toCanonicalString(), []), x = {
|
|
162
|
+
kind: "column",
|
|
163
|
+
name: a.name,
|
|
164
|
+
label: u,
|
|
165
|
+
type: a.valueType,
|
|
166
|
+
spec: a,
|
|
167
|
+
annotations: a.annotations,
|
|
168
|
+
isSubsetFilter: ((d = a.annotations) == null ? void 0 : d[q]) === "true",
|
|
169
|
+
isDiscreteFilter: a.valueType === "String" || ((o = a.annotations) == null ? void 0 : o[L]) === "true",
|
|
170
|
+
axesToBeFixed: A,
|
|
171
|
+
axesToBeFixedIndexes: P
|
|
172
|
+
};
|
|
173
|
+
F.set(w.toCanonicalString(), x);
|
|
174
|
+
}
|
|
175
|
+
const k = l.has(w.name) || m.has(w.toCanonicalString()), E = t.components[this.componentName].selectorStates.some(
|
|
176
|
+
(u) => u.selectedSource === S
|
|
177
|
+
);
|
|
178
|
+
!k && !E && b.push({ value: S });
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
return { multipleSelectors: p, required: v, stateConsistency: O, options: b, optionsInfo: F };
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
g(_, "DefaultSettings", {
|
|
185
|
+
isDataComponent: !1,
|
|
186
|
+
multipleSelectors: !1,
|
|
187
|
+
required: !1,
|
|
188
|
+
homogeneous: !1,
|
|
189
|
+
axesAllowed: !1,
|
|
190
|
+
columnsAllowed: !0,
|
|
191
|
+
columnsWithExtraAxesAllowed: !0,
|
|
192
|
+
dimensionConsumer: !1
|
|
193
|
+
});
|
|
194
|
+
let se = _;
|
|
195
|
+
export {
|
|
196
|
+
se as ComponentController
|
|
197
|
+
};
|
|
198
|
+
//# sourceMappingURL=ComponentController.js.map
|
package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/ComponentController.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ComponentController.js","sources":["../../../../../../node_modules/@milaboratories/pf-plots/src/controllers/ComponentController.ts"],"sourcesContent":["import {isLabelColumn} from '@platforma-sdk/model';\nimport type {\n AxisData,\n ColumnData,\n ComponentGuideSimple,\n ComponentState,\n InputState,\n SelectorState,\n SelectorStateFilter,\n SelectorStateSimple,\n SourceOption,\n} from '../common';\nimport {\n DISCRETE_FILTER_KEY,\n IS_LINKER_COLUMN,\n SUBSET_FILTER_KEY,\n} from '../constants';\nimport type {DataStore} from '../store';\nimport type {ColumnId, ColumnOrAxisIdString} from '../spec';\nimport {AxisId, columnOrAxisIdFromString, isColumnId} from '../spec';\nimport type {AxisSpec, LinkerMap, PColumnSpec, ValueType} from '@milaboratories/pl-model-common';\nimport {axisMustBeConsumed, getColumnOrAxisLabel, getNotAllowedAxes, getStateCopy} from '../utils';\n\nconst isLinkerColumn = (columnSpec:PColumnSpec) => columnSpec?.annotations?.[IS_LINKER_COLUMN] === 'true';\n\ninterface ComponentControllerSettings {\n isDataComponent: boolean; // X, Y, Data source etc.\n multipleSelectors: boolean; // more than 1 selected column in input\n required: boolean;\n homogeneous: boolean;\n axesAllowed: boolean;\n columnsAllowed: boolean;\n columnsWithExtraAxesAllowed: boolean; // can contain column with extra axes with fixed values\n dimensionConsumer: boolean; // remove extra dimension from data-mapping after selecting a heterogeneous axis\n}\n\ninterface FieldControllerOptions<State extends InputState, Field extends keyof State['components']> {\n componentName: Field;\n allowedTypes: ValueType[];\n checkSourceBySpec?: (spec: AxisSpec | PColumnSpec, state: State) => boolean; // for more complicated logic than type is in allowed types and annotation exists\n annotations?: Record<string, string>;\n parentComponents?: (keyof State['components'])[];\n dependsOn?: (keyof State['components'])[];\n strictlyDependsOnParents?: boolean;\n ignoredOptionIds?: string[];\n settings: Partial<ComponentControllerSettings>;\n}\n\nexport class ComponentController<State extends InputState, Field extends keyof State['components']> {\n private static DefaultSettings: ComponentControllerSettings = {\n isDataComponent: false,\n multipleSelectors: false,\n required: false,\n homogeneous: false,\n axesAllowed: false,\n columnsAllowed: true,\n columnsWithExtraAxesAllowed: true,\n dimensionConsumer: false,\n };\n\n readonly componentName: Field;\n readonly allowedTypes: ValueType[];\n readonly settings: ComponentControllerSettings;\n private readonly dependsOn: (keyof State['components'])[];\n private readonly parentComponents: (keyof State['components'])[];\n private readonly strictlyDependsOnParents: boolean;\n private readonly annotations: Record<string, string>;\n private readonly checkSourceBySpec?: (spec: AxisSpec | PColumnSpec, state: State) => boolean;\n\n constructor({\n componentName,\n allowedTypes,\n settings,\n strictlyDependsOnParents,\n dependsOn = [],\n parentComponents = [],\n annotations = {},\n checkSourceBySpec,\n }: FieldControllerOptions<State, Field>) {\n this.componentName = componentName;\n this.allowedTypes = [...allowedTypes];\n this.settings = {...ComponentController.DefaultSettings, ...settings};\n this.dependsOn = [...dependsOn];\n this.parentComponents = [...parentComponents]; // corresponding data components for meta or X for Y in scatterplot\n this.strictlyDependsOnParents = strictlyDependsOnParents ?? true; // meta-inputs are strictly-depending on parents, X by Y (Y by X) - don't\n this.annotations = {...annotations};\n if (checkSourceBySpec) {\n this.checkSourceBySpec = checkSourceBySpec;\n }\n }\n\n get isRequired(): boolean {\n return this.settings.required;\n }\n\n get isDimensionsConsumer(): boolean {\n return this.settings.dimensionConsumer;\n }\n\n addSelected(state: State, selectorState: SelectorStateSimple | SelectorStateFilter) {\n const nextState = getStateCopy(state);\n nextState.components[this.componentName].selectorStates.push(selectorState as SelectorStateFilter);\n\n // ***\n // here should be logic for possibly parent qualifications updating\n // ***\n\n return nextState;\n }\n\n deleteSelected(state: State, selectedSourceStr: ColumnOrAxisIdString) {\n const nextState = getStateCopy(state);\n // ***\n // here should be logic for removing unnecessary qualifications (it can appear when some sources are deleted)\n // ***\n nextState.components[this.componentName].selectorStates = (\n nextState.components[this.componentName].selectorStates as SelectorState[]\n ).filter(item => item.selectedSource !== selectedSourceStr);\n return nextState;\n }\n\n async checkStateConsistency(\n store: DataStore,\n state: State,\n linkerMap: LinkerMap\n ): Promise<Record<string, boolean>> {\n const componentState = state.components[this.componentName as keyof InputState];\n const {parentAxes, parentAxesList} = await this.getAllowedAxes(store, state);\n \n function isAxisInSet(a: AxisSpec) {\n const id = AxisId.fromAxisSpec(a).toCanonicalString();\n return parentAxes.has(id);\n }\n\n const consistencyData = await Promise.all(\n componentState.selectorStates.map(async ({selectedSource}) => {\n const sourceId = columnOrAxisIdFromString(selectedSource);\n // if column selected - check all axes of column\n if (isColumnId(sourceId)) {\n const columnSpec = await store.pFrameProvider.getColumnSpecById(sourceId);\n if (!columnSpec) {\n // if column is not in store - current store and selected column are not consistent\n return false;\n }\n\n const parents = this.parentComponents;\n if (parents.length === 0) {\n return true;\n }\n if ((this.strictlyDependsOnParents && !this.settings.columnsWithExtraAxesAllowed) && !this.settings.isDataComponent) {\n return columnSpec.axesSpec.every(a => isAxisInSet(a));\n } else if (this.settings.columnsWithExtraAxesAllowed && !this.settings.isDataComponent) {\n if (columnSpec.axesSpec.some(a => isAxisInSet(a))) {\n return true;\n }\n\n const notAllowed = getNotAllowedAxes(columnSpec, parentAxesList, parentAxes, linkerMap);\n return notAllowed.length < columnSpec.axesSpec.length;\n } else {\n return parentAxes.size === 0 || columnSpec.axesSpec.some(a => isAxisInSet(a));\n }\n }\n return parentAxes.has(selectedSource);\n })\n );\n return (componentState.selectorStates as (SelectorStateSimple | SelectorStateFilter)[]).reduce(\n (res: Record<string, boolean>, item, idx) => {\n res[item.selectedSource] = consistencyData[idx];\n return res;\n },\n {}\n );\n }\n\n async getProducingAxes(store: DataStore, state: State) {\n const componentState = state.components[this.componentName as keyof InputState];\n const selectedHereIds = componentState.selectorStates.map(s => columnOrAxisIdFromString(s.selectedSource));\n const selectedHereColumnIds = selectedHereIds.filter(id => isColumnId(id));\n\n const axes = new Set<ColumnOrAxisIdString>();\n\n const infoList = await Promise.all(\n selectedHereColumnIds.map(id => {\n return store.pFrameProvider.getColumnSpecById(id);\n })\n );\n\n infoList.forEach(columnSpec => {\n if (columnSpec) {\n columnSpec.axesSpec.forEach(axisSpec => {\n axes.add(AxisId.fromAxisSpec(axisSpec).toCanonicalString());\n });\n }\n });\n return axes;\n }\n\n getParentSelectedSources(store: DataStore, state: State): (ColumnId | AxisId)[] {\n const selectedSources = this.parentComponents.reduce((res: (ColumnId | AxisId)[], item) => {\n const selectedHere = state.components[item].selectorStates.map(s =>\n columnOrAxisIdFromString(s.selectedSource)\n );\n res.push(...selectedHere);\n return res;\n }, []);\n\n // ***\n // consider parent qualifications without selected here\n // ***\n return selectedSources;\n }\n\n async getParentAxes(store: DataStore, state: State) {\n const parentSelectedSources = this.getParentSelectedSources(store, state);\n const axes = new Set<ColumnOrAxisIdString>();\n\n for (const source of parentSelectedSources) {\n if (isColumnId(source)) {\n const columnSpec = await store.pFrameProvider.getColumnSpecById(source);\n columnSpec?.axesSpec?.forEach(spec => {\n const id = AxisId.fromAxisSpec(spec);\n axes.add(id.toCanonicalString());\n });\n }\n }\n return axes;\n }\n\n async getAllowedAxes(store: DataStore, state: State) {\n const parentSelectedSources = this.getParentSelectedSources(store, state);\n const parentAxes = new Set<ColumnOrAxisIdString>();\n const parentAxesList:AxisSpec[] = [];\n const optionsInfo: Map<string, AxisData | ColumnData> = new Map();\n\n for (const source of parentSelectedSources) {\n if (isColumnId(source)) {\n const columnSpec = await store.pFrameProvider.getColumnSpecById(source);\n for (const spec of columnSpec?.axesSpec ?? []) {\n const id = AxisId.fromAxisSpec(spec);\n const idStr = id.toCanonicalString();\n if (parentAxes.has(idStr)) {\n continue;\n }\n parentAxes.add(idStr);\n parentAxesList.push(spec);\n const mustBeConsumed = axisMustBeConsumed(spec); // request unique values only for non-homogenous axes\n optionsInfo.set(idStr, {\n kind: 'axis',\n name: spec.name,\n label: await getColumnOrAxisLabel(store, idStr, [\n source.toCanonicalString(),\n ]),\n type: spec.type,\n mustBeConsumed,\n dividable: false,\n spec,\n annotations: spec.annotations,\n isSubsetFilter: spec.annotations?.[SUBSET_FILTER_KEY] === 'true',\n isDiscreteFilter:\n spec.type === 'String' || spec.annotations?.[DISCRETE_FILTER_KEY] === 'true',\n parentSources: [source.toCanonicalString()],\n });\n }\n }\n }\n\n return {parentAxes, parentAxesList, optionsInfo};\n }\n\n async getOptions(\n store: DataStore,\n state: State,\n labelsMap: Record<string, string>,\n consumedSourcesSet: Set<ColumnOrAxisIdString>,\n linkerMap: LinkerMap,\n dataColumnPredicate: (spec: PColumnSpec) => boolean,\n ignoredNamesSet: Set<string> = new Set(),\n fixedSelectedSet: Set<ColumnOrAxisIdString> = new Set()\n ): Promise<ComponentGuideSimple> {\n const multipleSelectors = this.settings.multipleSelectors;\n const required = this.settings.required;\n const stateConsistency = await this.checkStateConsistency(store, state, linkerMap);\n\n if (this.dependsOn.length && this.dependsOn.some(dep => state.components[dep].selectorStates.length === 0)) {\n return {multipleSelectors, required, stateConsistency, options: [], optionsInfo: new Map()};\n }\n\n if (\n this.strictlyDependsOnParents &&\n !this.settings.isDataComponent &&\n this.parentComponents.some(name => state.components[name].selectorStates.length === 0)\n ) {\n return {multipleSelectors, required, stateConsistency, options: [], optionsInfo: new Map()};\n }\n\n const parentSelectedSources = this.getParentSelectedSources(store, state);\n const allowedColumns = (\n await store.pFrameProvider.getColumns([], false, this.allowedTypes, undefined, this.annotations)\n ).filter(item => !consumedSourcesSet.has(item.toCanonicalString()));\n\n const {parentAxes, parentAxesList, optionsInfo} = await this.getAllowedAxes(store, state);\n\n const thisState: ComponentState = state.components[this.componentName];\n const options: SourceOption[] = [];\n if (this.settings.axesAllowed) {\n for (const idStr of parentAxes) {\n const id = columnOrAxisIdFromString(idStr) as AxisId;\n const axisData = optionsInfo.get(id.toCanonicalString()) as AxisData;\n\n const typeOK = this.allowedTypes.includes(axisData.spec.type);\n const annotationsOK = Object.entries(this.annotations).every(\n ([k, v]) => axisData.spec.annotations?.[k] === v\n );\n const checkBySpecOK = this.checkSourceBySpec ? this.checkSourceBySpec(axisData.spec, state) : true;\n const axisNatureOK = !this.settings.homogeneous || !axisData?.mustBeConsumed;\n const decreasingDimensionsOK = !consumedSourcesSet.has(idStr);\n const ignored = ignoredNamesSet.has(id.name) || fixedSelectedSet.has(id.toCanonicalString());\n const selectedHere = thisState.selectorStates.some(item => item.selectedSource === idStr);\n\n if (typeOK && annotationsOK && checkBySpecOK && axisNatureOK && decreasingDimensionsOK && !ignored && !selectedHere) {\n options.push({value: idStr});\n }\n }\n }\n\n if (this.settings.columnsAllowed) {\n const strictlyCompatible = !this.settings.columnsWithExtraAxesAllowed && this.strictlyDependsOnParents;\n for (const columnId of allowedColumns) {\n const columnIdString = columnId.toCanonicalString();\n const id = columnOrAxisIdFromString(columnIdString);\n\n const columnSpec = await store.pFrameProvider.getColumnSpecById(id);\n if (!columnSpec) {\n continue;\n }\n const extraAxesIds = getNotAllowedAxes(\n columnSpec,\n parentAxesList,\n parentAxes,\n linkerMap\n ).map((axisSpec) => AxisId.fromAxisSpec(axisSpec).toCanonicalString());\n\n const extraAxesSet = new Set(extraAxesIds);\n if (\n // do not add to available options label columns, or columns that are not fit by custom spec condition, or columns that are not fit by condition for data inputs\n isLabelColumn(columnSpec) || isLinkerColumn(columnSpec) ||\n (this.checkSourceBySpec && !this.checkSourceBySpec(columnSpec, state)) ||\n (this.settings.isDataComponent && !dataColumnPredicate(columnSpec)) ||\n strictlyCompatible && extraAxesIds.length > 0 ||\n parentSelectedSources.length && extraAxesIds.length > 0 && !columnSpec.axesSpec.some((axisSpec) => {\n const axisIdStr = AxisId.fromAxisSpec(axisSpec).toCanonicalString();\n return parentAxes.has(axisIdStr);\n })\n ) {\n continue;\n }\n const axesIds = columnSpec?.axesSpec?.map(axisSpec => AxisId.fromAxisSpec(axisSpec).toCanonicalString()) ?? [];\n const extraAxesIndexes:Record<string, number> = {};\n if (this.settings.columnsWithExtraAxesAllowed) {\n axesIds.forEach((id, idx) => {\n if (extraAxesSet.has(id)) {\n extraAxesIndexes[id] = idx;\n }\n });\n }\n if (columnSpec) {\n const label =\n labelsMap[columnIdString] ??\n (await getColumnOrAxisLabel(store, columnId.toCanonicalString(), []));\n const columnInfo: ColumnData = {\n kind: 'column',\n name: columnSpec.name,\n label,\n type: columnSpec.valueType,\n spec: columnSpec,\n annotations: columnSpec.annotations,\n isSubsetFilter: columnSpec.annotations?.[SUBSET_FILTER_KEY] === 'true',\n isDiscreteFilter:\n columnSpec.valueType === 'String' ||\n columnSpec.annotations?.[DISCRETE_FILTER_KEY] === 'true',\n axesToBeFixed: extraAxesIds,\n axesToBeFixedIndexes: extraAxesIndexes,\n };\n optionsInfo.set(id.toCanonicalString(), columnInfo);\n }\n\n const ignored = ignoredNamesSet.has(id.name) || fixedSelectedSet.has(id.toCanonicalString());\n const selectedHere = state.components[this.componentName].selectorStates.some(\n item => item.selectedSource === columnIdString\n );\n if (!ignored && !selectedHere) {\n options.push({value: columnIdString});\n }\n }\n }\n return {multipleSelectors, required, stateConsistency, options, optionsInfo};\n }\n}\n"],"names":["isLinkerColumn","columnSpec","_a","IS_LINKER_COLUMN","_ComponentController","componentName","allowedTypes","settings","strictlyDependsOnParents","dependsOn","parentComponents","annotations","checkSourceBySpec","__publicField","state","selectorState","nextState","getStateCopy","selectedSourceStr","item","store","linkerMap","componentState","parentAxes","parentAxesList","isAxisInSet","a","id","AxisId","consistencyData","selectedSource","sourceId","columnOrAxisIdFromString","isColumnId","C","getNotAllowedAxes","res","idx","selectedHereColumnIds","n","s","axes","axisSpec","selectedHere","parentSelectedSources","source","spec","optionsInfo","idStr","mustBeConsumed","axisMustBeConsumed","getColumnOrAxisLabel","SUBSET_FILTER_KEY","_b","DISCRETE_FILTER_KEY","labelsMap","consumedSourcesSet","dataColumnPredicate","ignoredNamesSet","fixedSelectedSet","multipleSelectors","required","stateConsistency","dep","name","allowedColumns","thisState","options","axisData","typeOK","annotationsOK","k","v","checkBySpecOK","axisNatureOK","decreasingDimensionsOK","ignored","strictlyCompatible","columnId","columnIdString","extraAxesIds","extraAxesSet","isLabelColumn","axisIdStr","axesIds","extraAxesIndexes","label","columnInfo","_c","ComponentController"],"mappings":";;;;;AAuBA,MAAMA,IAAiB,CAACC,MAA2B;;AAAA,WAAAC,IAAAD,KAAA,OAAA,SAAAA,EAAY,gBAAZ,OAAA,SAAAC,EAA0BC,CAAAA,OAAsB;AAAA,GAyBtFC,IAAN,MAAMA,EAAuF;AAAA,EAqBhG,YAAY;AAAA,IACR,eAAAC;AAAAA,IACA,cAAAC;AAAAA,IACA,UAAAC;AAAAA,IACA,0BAAAC;AAAAA,IACA,WAAAC,IAAY,CAAA;AAAA,IACZ,kBAAAC,IAAmB,CAAA;AAAA,IACnB,aAAAC,IAAc,CAAA;AAAA,IACd,mBAAAC;AAAAA,EAAA,GACqC;AAlBhCC,MAAA,MAAA,eAAA,GACAA,EAAA,MAAA,cAAA,GACAA,EAAA,MAAA,UAAA,GACQA,EAAA,MAAA,WAAA,GACAA,EAAA,MAAA,kBAAA,GACAA,EAAA,MAAA,0BAAA,GACAA,EAAA,MAAA,aAAA,GACAA,EAAA,MAAA,mBAAA,GAYb,KAAK,gBAAgBR,GAChB,KAAA,eAAe,CAAC,GAAGC,CAAY,GACpC,KAAK,WAAW,EAAC,GAAGF,EAAoB,iBAAiB,GAAGG,KACvD,KAAA,YAAY,CAAC,GAAGE,CAAS,GACzB,KAAA,mBAAmB,CAAC,GAAGC,CAAgB,GAC5C,KAAK,2BAA2BF,KAA4B,IACvD,KAAA,cAAc,EAAC,GAAGG,KACnBC,MACA,KAAK,oBAAoBA;AAAAA,EAC7B;AAAA,EAGJ,IAAI,aAAsB;AACtB,WAAO,KAAK,SAAS;AA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