@milaboratories/graph-maker 1.1.166 → 1.1.167

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/dist/GraphMaker/constantsCommon.d.ts +0 -9
  2. package/dist/GraphMaker/constantsCommon.d.ts.map +1 -1
  3. package/dist/GraphMaker/constantsCommon.js +74 -81
  4. package/dist/GraphMaker/constantsCommon.js.map +1 -1
  5. package/dist/GraphMaker/forms/AxesSettingsForm/DiscreteAxesSettingsForm.vue.js +8 -2
  6. package/dist/GraphMaker/forms/AxesSettingsForm/DiscreteAxesSettingsForm.vue.js.map +1 -1
  7. package/dist/GraphMaker/forms/DataMappingForm/DiscreteForm.vue.js +26 -20
  8. package/dist/GraphMaker/forms/DataMappingForm/DiscreteForm.vue.js.map +1 -1
  9. package/dist/GraphMaker/forms/LayersForm/Layer/scatterplot/Scatter.vue.d.ts.map +1 -1
  10. package/dist/GraphMaker/forms/LayersForm/Layer/scatterplot/Scatter.vue.js +37 -31
  11. package/dist/GraphMaker/forms/LayersForm/Layer/scatterplot/Scatter.vue.js.map +1 -1
  12. package/dist/GraphMaker/forms/LayersForm/Layer/scatterplot-umap/Scatter.vue.js +30 -24
  13. package/dist/GraphMaker/forms/LayersForm/Layer/scatterplot-umap/Scatter.vue.js.map +1 -1
  14. package/dist/GraphMaker/forms/StatisticsForm/DiscreteStatisticsForm.vue.js +33 -27
  15. package/dist/GraphMaker/forms/StatisticsForm/DiscreteStatisticsForm.vue.js.map +1 -1
  16. package/dist/GraphMaker/index.vue.js +8 -2
  17. package/dist/GraphMaker/index.vue.js.map +1 -1
  18. package/dist/GraphMaker/utils/createChartSettingsForRender/composeBubbleSettings.js +22 -16
  19. package/dist/GraphMaker/utils/createChartSettingsForRender/composeBubbleSettings.js.map +1 -1
  20. package/dist/GraphMaker/utils/createChartSettingsForRender/composeDiscreteSettings.js +17 -11
  21. package/dist/GraphMaker/utils/createChartSettingsForRender/composeDiscreteSettings.js.map +1 -1
  22. package/dist/GraphMaker/utils/createChartSettingsForRender/composeHeatmapSettings.js +26 -20
  23. package/dist/GraphMaker/utils/createChartSettingsForRender/composeHeatmapSettings.js.map +1 -1
  24. package/dist/GraphMaker/utils/createChartSettingsForRender/composeHistogramSettings.js +29 -23
  25. package/dist/GraphMaker/utils/createChartSettingsForRender/composeHistogramSettings.js.map +1 -1
  26. package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotSettings.d.ts.map +1 -1
  27. package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotSettings.js +83 -68
  28. package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotSettings.js.map +1 -1
  29. package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotUmapSettings.js +25 -19
  30. package/dist/GraphMaker/utils/createChartSettingsForRender/composeScatterplotUmapSettings.js.map +1 -1
  31. package/dist/GraphMaker/utils/getUsedAesInMapping.js +37 -31
  32. package/dist/GraphMaker/utils/getUsedAesInMapping.js.map +1 -1
  33. package/dist/GraphMaker/utils/loadDefaultSources.d.ts.map +1 -1
  34. package/dist/GraphMaker/utils/loadDefaultSources.js +36 -31
  35. package/dist/GraphMaker/utils/loadDefaultSources.js.map +1 -1
  36. package/dist/_virtual/stringify.js +5 -0
  37. package/dist/_virtual/stringify.js.map +1 -0
  38. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/ComponentController.js +106 -107
  39. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/ComponentController.js.map +1 -1
  40. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/ControllerBase.js +120 -121
  41. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/ControllerBase.js.map +1 -1
  42. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/bubble.js +83 -84
  43. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/bubble.js.map +1 -1
  44. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/dendro.js +4 -4
  45. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/discrete.js +11 -11
  46. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/heatmap.js +123 -124
  47. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/heatmap.js.map +1 -1
  48. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/histogram.js +8 -8
  49. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/scatterplot-umap.js +88 -89
  50. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/scatterplot-umap.js.map +1 -1
  51. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/scatterplot.js +103 -105
  52. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/scatterplot.js.map +1 -1
  53. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/spec.js +148 -119
  54. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/spec.js.map +1 -1
  55. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@platforma-sdk/model/dist/components/PlDataTable.js +4 -4
  56. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@platforma-sdk/model/dist/render/util/label.js +5 -5
  57. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@platforma-sdk/model/node_modules/@milaboratories/pl-model-common/dist/drivers/blob.js +8 -0
  58. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@platforma-sdk/model/node_modules/@milaboratories/pl-model-common/dist/drivers/blob.js.map +1 -0
  59. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@platforma-sdk/model/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/spec.js +182 -0
  60. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@platforma-sdk/model/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/spec.js.map +1 -0
  61. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@platforma-sdk/model/node_modules/@milaboratories/pl-model-common/dist/errors.js +18 -0
  62. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@platforma-sdk/model/node_modules/@milaboratories/pl-model-common/dist/errors.js.map +1 -0
  63. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@platforma-sdk/model/node_modules/@milaboratories/pl-model-common/dist/json.js +12 -0
  64. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@platforma-sdk/model/node_modules/@milaboratories/pl-model-common/dist/json.js.map +1 -0
  65. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@platforma-sdk/model/node_modules/@milaboratories/pl-model-common/dist/plid.js +7 -0
  66. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@platforma-sdk/model/node_modules/@milaboratories/pl-model-common/dist/plid.js.map +1 -0
  67. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@platforma-sdk/model/node_modules/@milaboratories/pl-model-common/dist/ref.js +8 -0
  68. package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@platforma-sdk/model/node_modules/@milaboratories/pl-model-common/dist/ref.js.map +1 -0
  69. package/dist/node_modules/@milaboratories/pf-plots/dist/pframe/ColumnsProvider.js +105 -111
  70. package/dist/node_modules/@milaboratories/pf-plots/dist/pframe/ColumnsProvider.js.map +1 -1
  71. package/dist/node_modules/@milaboratories/pf-plots/dist/utils.js +158 -163
  72. package/dist/node_modules/@milaboratories/pf-plots/dist/utils.js.map +1 -1
  73. package/dist/node_modules/@milaboratories/pl-error-like/dist/error_like_shape.js +36 -0
  74. package/dist/node_modules/@milaboratories/pl-error-like/dist/error_like_shape.js.map +1 -0
  75. package/dist/node_modules/@milaboratories/pl-model-common/dist/drivers/blob.js +8 -0
  76. package/dist/node_modules/@milaboratories/pl-model-common/dist/drivers/blob.js.map +1 -0
  77. package/dist/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/spec.js +52 -0
  78. package/dist/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/spec.js.map +1 -0
  79. package/dist/node_modules/@milaboratories/pl-model-common/dist/plid.js +7 -0
  80. package/dist/node_modules/@milaboratories/pl-model-common/dist/plid.js.map +1 -0
  81. package/dist/node_modules/@milaboratories/pl-model-common/dist/ref.js +8 -0
  82. package/dist/node_modules/@milaboratories/pl-model-common/dist/ref.js.map +1 -0
  83. package/dist/node_modules/@platforma-sdk/model/dist/render/util/label.js +16 -0
  84. package/dist/node_modules/@platforma-sdk/model/dist/render/util/label.js.map +1 -0
  85. package/dist/node_modules/json-stringify-safe/stringify.js +20 -0
  86. package/dist/node_modules/json-stringify-safe/stringify.js.map +1 -0
  87. package/dist/node_modules/zod/lib/index.js +2978 -0
  88. package/dist/node_modules/zod/lib/index.js.map +1 -0
  89. package/package.json +3 -3
  90. package/dist/node_modules/@milaboratories/pf-plots/dist/constants.js +0 -18
  91. package/dist/node_modules/@milaboratories/pf-plots/dist/constants.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"getUsedAesInMapping.js","sources":["../../../src/GraphMaker/utils/getUsedAesInMapping.ts"],"sourcesContent":["import { ChartType, DiscreteUIState, InputGuide, InputState } from '@milaboratories/pf-plots';\nimport {\n AesType, DISCRETE_TEMPLATES_MAP, DiscreteStatisticsState,\n getDefaultLayersSettings,\n getInitialStatisticsState,\n isMappedAes\n} from '../constantsCommon';\nimport { DiscreteLayersTemplate, LayersTemplate } from '../types';\nimport {\n ChartLayerSettings,\n getDiscreteLayersSettings\n} from './index';\n\nfunction checkLayersByType(layers:ChartLayerSettings[], field:'fillColor'|'dotFill'|'lineColor'|'dotShape'|'lineShape', name:string) {\n return layers.some((item) => {\n const value = item?.aes?.[field];\n return isMappedAes(value) && value.type === name\n })\n}\n\nexport function getUsedAesInMapping (\n chartType:ChartType,\n template:LayersTemplate,\n layersSettings: ReturnType<typeof getDefaultLayersSettings>,\n statisticsSettings: ReturnType<typeof getInitialStatisticsState>,\n optionsState: InputState,\n inputGuide: InputGuide<InputState>,\n) {\n const res:Record<string, Record<AesType, boolean>> = {};\n let groupingSources:string[] = [];\n if (chartType === 'discrete') {\n groupingSources = ['primaryGrouping', 'secondaryGrouping'];\n const layers = getDiscreteLayersSettings(\n DISCRETE_TEMPLATES_MAP[template as DiscreteLayersTemplate],\n layersSettings,\n statisticsSettings as DiscreteStatisticsState,\n optionsState as DiscreteUIState,\n inputGuide\n )\n groupingSources.forEach((name) => {\n const source = optionsState.components[name]?.selectorStates[0]?.selectedSource;\n if (source) {\n res[source] = {\n fill: checkLayersByType(layers, 'fillColor', name) || checkLayersByType(layers, 'dotFill', name),\n stroke: checkLayersByType(layers, 'lineColor', name),\n dotShape: checkLayersByType(layers, 'dotShape', name),\n lineType: checkLayersByType(layers, 'lineShape', name),\n size: false,\n }\n }\n });\n }\n if (chartType === 'scatterplot') {\n const grouping = optionsState.components.grouping.selectorStates.map((state) => state.selectedSource)\n const shape = optionsState.components.shape.selectorStates.map((state) => state.selectedSource)\n groupingSources = [...grouping, ...shape]\n groupingSources.forEach((name) => {\n res[name] = {\n fill: name === grouping[0],\n stroke: false,\n dotShape: name === shape[0],\n lineType: false,\n size: false,\n }\n });\n }\n if (chartType === 'scatterplot-umap') {\n groupingSources = optionsState.components.grouping.selectorStates.map((state) => state.selectedSource)\n groupingSources.forEach((name) => {\n res[name] = {\n fill: name === groupingSources[0],\n stroke: false,\n dotShape: false,\n lineType: false,\n size: false,\n }\n });\n }\n if (chartType === 'dendro') {\n const columns:(string|null)[] = [\n optionsState.components.nodeColor.selectorStates[0]?.selectedSource ?? null,\n optionsState.components.nodeShape.selectorStates[0]?.selectedSource ?? null,\n optionsState.components.lineColor.selectorStates[0]?.selectedSource ?? null,\n ];\n groupingSources = columns.filter((value) => value !== null) as string[];\n groupingSources.forEach((name) => {\n res[name] = {\n fill: isMappedAes(layersSettings.dendro.dotFill) && layersSettings.dendro.dotFill.value === name,\n stroke: isMappedAes(layersSettings.dendro.lineColor) && layersSettings.dendro.lineColor.value === name,\n dotShape: isMappedAes(layersSettings.dendro.dotShape) && layersSettings.dendro.dotShape.value === name,\n lineType: false,\n size: false,\n }\n });\n }\n\n if (chartType === 'histogram') {\n const groupingSources = optionsState.components.grouping.selectorStates.map((state) => state.selectedSource);\n groupingSources.forEach((name) => {\n res[name] = {\n fill: name === groupingSources[0],\n stroke: false,\n dotShape: false,\n lineType: false,\n size: false,\n }\n });\n }\n\n return res;\n}\n"],"names":["checkLayersByType","layers","field","name","item","value","_a","isMappedAes","getUsedAesInMapping","chartType","template","layersSettings","statisticsSettings","optionsState","inputGuide","res","groupingSources","getDiscreteLayersSettings","DISCRETE_TEMPLATES_MAP","source","_b","grouping","state","shape","_c"],"mappings":";;;;;AAaA,SAASA,EAAkBC,GAA6BC,GAAgEC,GAAa;AACnI,SAAOF,EAAO,KAAK,CAACG,MAAS;;AAC3B,UAAMC,KAAQC,IAAAF,KAAA,gBAAAA,EAAM,QAAN,gBAAAE,EAAYJ;AAC1B,WAAOK,EAAYF,CAAK,KAAKA,EAAM,SAASF;AAAA,EAC9C,CAAC;AACH;AAEO,SAASK,EACZC,GACAC,GACAC,GACAC,GACAC,GACAC,GACF;;AACA,QAAMC,IAA+C,CAAA;AACrD,MAAIC,IAA2B,CAAA;AAC/B,MAAIP,MAAc,YAAY;AAC5B,IAAAO,IAAkB,CAAC,mBAAmB,mBAAmB;AACzD,UAAMf,IAASgB;AAAA,MACbC,EAAuBR,CAAkC;AAAA,MACzDC;AAAA,MACAC;AAAA,MACAC;AAAA,MACAC;AAAA,IAAA;AAEF,IAAAE,EAAgB,QAAQ,CAACb,MAAS;;AAChC,YAAMgB,KAASC,KAAAd,IAAAO,EAAa,WAAWV,CAAI,MAA5B,gBAAAG,EAA+B,eAAe,OAA9C,gBAAAc,EAAkD;AACjE,MAAID,MACFJ,EAAII,CAAM,IAAI;AAAA,QACZ,MAAM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A,MACvEI,IAAAX,EAAa,WAAW,UAAU,eAAe,CAAC,MAAlD,gBAAAW,EAAqD,mBAAkB;AAAA,EAAA,EAE/C,OAAO,CAACnB,MAAUA,MAAU,IAAI,GAC1DW,EAAgB,QAAQ,CAACb,MAAS;AAChC,IAAAY,EAAIZ,CAAI,IAAI;AAAA,MACV,MAAMI,EAAYI,EAAe,OAAO,OAAO,KAAKA,EAAe,OAAO,QAAQ,UAAUR;AAAA,MAC5F,QAAQI,EAAYI,EAAe,OAAO,SAAS,KAAKA,EAAe,OAAO,UAAU,UAAUR;AAAA,MAClG,UAAUI,EAAYI,EAAe,OAAO,QAAQ,KAAKA,EAAe,OAAO,SAAS,UAAUR;AAAA,MAClG,UAAU;AAAA,MACV,MAAM;AAAA,IAAA;AAAA,EAEV,CAAC,IAGCM,MAAc,aAAa;AAC7B,UAAMO,IAAkBH,EAAa,WAAW,SAAS,eAAe,IAAI,CAACS,MAAUA,EAAM,cAAc;AAC3GN,IAAAA,EAAgB,QAAQ,CAACb,MAAS;AAChC,MAAAY,EAAIZ,CAAI,IAAI;AAAA,QACV,MAAMA,MAASa,EAAgB,CAAC;AAAA,QAChC,QAAQ;AAAA,QACR,UAAU;AAAA,QACV,UAAU;AAAA,QACV,MAAM;AAAA,MAAA;AAAA,IAEV,CAAC;AAAA,EACH;AAEA,SAAOD;AACT;"}
1
+ {"version":3,"file":"getUsedAesInMapping.js","sources":["../../../src/GraphMaker/utils/getUsedAesInMapping.ts"],"sourcesContent":["import { ChartType, DiscreteUIState, InputGuide, InputState } from '@milaboratories/pf-plots';\nimport {\n AesType, DISCRETE_TEMPLATES_MAP, DiscreteStatisticsState,\n getDefaultLayersSettings,\n getInitialStatisticsState,\n isMappedAes\n} from '../constantsCommon';\nimport { DiscreteLayersTemplate, LayersTemplate } from '../types';\nimport {\n ChartLayerSettings,\n getDiscreteLayersSettings\n} from './index';\n\nfunction checkLayersByType(layers:ChartLayerSettings[], field:'fillColor'|'dotFill'|'lineColor'|'dotShape'|'lineShape', name:string) {\n return layers.some((item) => {\n const value = item?.aes?.[field];\n return isMappedAes(value) && value.type === name\n })\n}\n\nexport function getUsedAesInMapping (\n chartType:ChartType,\n template:LayersTemplate,\n layersSettings: ReturnType<typeof getDefaultLayersSettings>,\n statisticsSettings: ReturnType<typeof getInitialStatisticsState>,\n optionsState: InputState,\n inputGuide: InputGuide<InputState>,\n) {\n const res:Record<string, Record<AesType, boolean>> = {};\n let groupingSources:string[] = [];\n if (chartType === 'discrete') {\n groupingSources = ['primaryGrouping', 'secondaryGrouping'];\n const layers = getDiscreteLayersSettings(\n DISCRETE_TEMPLATES_MAP[template as DiscreteLayersTemplate],\n layersSettings,\n statisticsSettings as DiscreteStatisticsState,\n optionsState as DiscreteUIState,\n inputGuide\n )\n groupingSources.forEach((name) => {\n const source = optionsState.components[name]?.selectorStates[0]?.selectedSource;\n if (source) {\n res[source] = {\n fill: checkLayersByType(layers, 'fillColor', name) || checkLayersByType(layers, 'dotFill', name),\n stroke: checkLayersByType(layers, 'lineColor', name),\n dotShape: checkLayersByType(layers, 'dotShape', name),\n lineType: checkLayersByType(layers, 'lineShape', name),\n size: false,\n }\n }\n });\n }\n if (chartType === 'scatterplot') {\n const grouping = optionsState.components.grouping.selectorStates.map((state) => state.selectedSource)\n const shape = optionsState.components.shape.selectorStates.map((state) => state.selectedSource)\n groupingSources = [...grouping, ...shape]\n groupingSources.forEach((name) => {\n res[name] = {\n fill: name === grouping[0],\n stroke: false,\n dotShape: name === shape[0],\n lineType: false,\n size: false,\n }\n });\n }\n if (chartType === 'scatterplot-umap') {\n groupingSources = optionsState.components.grouping.selectorStates.map((state) => state.selectedSource)\n groupingSources.forEach((name) => {\n res[name] = {\n fill: name === groupingSources[0],\n stroke: false,\n dotShape: false,\n lineType: false,\n size: false,\n }\n });\n }\n if (chartType === 'dendro') {\n const columns:(string|null)[] = [\n optionsState.components.nodeColor.selectorStates[0]?.selectedSource ?? null,\n optionsState.components.nodeShape.selectorStates[0]?.selectedSource ?? null,\n optionsState.components.lineColor.selectorStates[0]?.selectedSource ?? null,\n ];\n groupingSources = columns.filter((value) => value !== null) as string[];\n groupingSources.forEach((name) => {\n res[name] = {\n fill: isMappedAes(layersSettings.dendro.dotFill) && layersSettings.dendro.dotFill.value === name,\n stroke: isMappedAes(layersSettings.dendro.lineColor) && layersSettings.dendro.lineColor.value === name,\n dotShape: isMappedAes(layersSettings.dendro.dotShape) && layersSettings.dendro.dotShape.value === name,\n lineType: false,\n size: false,\n }\n });\n }\n\n if (chartType === 'histogram') {\n const groupingSources = optionsState.components.grouping.selectorStates.map((state) => state.selectedSource);\n groupingSources.forEach((name) => {\n res[name] = {\n fill: name === groupingSources[0],\n stroke: false,\n dotShape: false,\n lineType: false,\n size: false,\n }\n });\n }\n\n return res;\n}\n"],"names":["checkLayersByType","layers","field","name","item","value","_a","isMappedAes","getUsedAesInMapping","chartType","template","layersSettings","statisticsSettings","optionsState","inputGuide","res","groupingSources","getDiscreteLayersSettings","DISCRETE_TEMPLATES_MAP","source","_b","grouping","state","shape","_c"],"mappings":";;;;;;;;;;;AAaA,SAASA,EAAkBC,GAA6BC,GAAgEC,GAAa;AACnI,SAAOF,EAAO,KAAK,CAACG,MAAS;;AAC3B,UAAMC,KAAQC,IAAAF,KAAA,gBAAAA,EAAM,QAAN,gBAAAE,EAAYJ;AAC1B,WAAOK,EAAYF,CAAK,KAAKA,EAAM,SAASF;AAAA,EAC9C,CAAC;AACH;AAEO,SAASK,EACZC,GACAC,GACAC,GACAC,GACAC,GACAC,GACF;;AACA,QAAMC,IAA+C,CAAA;AACrD,MAAIC,IAA2B,CAAA;AAC/B,MAAIP,MAAc,YAAY;AAC5B,IAAAO,IAAkB,CAAC,mBAAmB,mBAAmB;AACzD,UAAMf,IAASgB;AAAA,MACbC,EAAuBR,CAAkC;AAAA,MACzDC;AAAA,MACAC;AAAA,MACAC;AAAA,MACAC;AAAA,IAAA;AAEF,IAAAE,EAAgB,QAAQ,CAACb,MAAS;;AAChC,Y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AC,SAAS,CAAC,EAAE,CAAC,CAoF3C"}
@@ -1,71 +1,76 @@
1
1
  import "../../node_modules/@milaboratories/pf-plots/dist/index.js";
2
+ import "../../node_modules/@milaboratories/pl-model-common/dist/drivers/blob.js";
3
+ import { readAnnotation as A, Annotation as R } from "../../node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/spec.js";
4
+ import "../../node_modules/@milaboratories/pl-model-common/dist/plid.js";
5
+ import "../../node_modules/@milaboratories/pl-model-common/dist/ref.js";
6
+ import "../../node_modules/@platforma-sdk/model/dist/render/util/label.js";
7
+ import "../../node_modules/@milaboratories/pl-error-like/dist/error_like_shape.js";
2
8
  import { toRaw as V } from "vue";
3
- import { SUBSET_FILTER_KEY as h } from "../constantsCommon.js";
4
9
  import { AxisId as S } from "../../node_modules/@milaboratories/pf-plots/dist/spec.js";
5
- function w(i, s) {
6
- if (typeof i > "u")
10
+ function T(n, r) {
11
+ if (typeof n > "u")
7
12
  return !0;
8
- const c = Object.keys(i);
9
- return typeof s > "u" ? c.length === 0 : c.every((n) => s[n]);
13
+ const c = Object.keys(n);
14
+ return typeof r > "u" ? c.length === 0 : c.every((i) => r[i]);
10
15
  }
11
- function T(i, s, c, n) {
12
- return (s == null ? void 0 : s[h]) === "true" ? "subset" : n !== void 0 ? "range" : c !== void 0 || i === "Int" || i === "String" ? "equals" : "range";
16
+ function x(n, r, c, i) {
17
+ return r && A(r, R.IsSubset) ? "subset" : i !== void 0 ? "range" : c !== void 0 || n === "Int" || n === "String" ? "equals" : "range";
13
18
  }
14
- async function P(i, s, c = !0) {
15
- const n = [], x = s.filter(({ selectedSource: e }) => "kind" in e && e.kind === "PColumn"), R = s.filter(({ selectedSource: e }) => !("kind" in e && e.kind === "PColumn")), C = [];
16
- for (const { inputName: e, filterType: d, selectedSource: m, selectedFilterValues: o, selectedFilterRange: F } of x) {
17
- const { name: a, valueType: f, annotations: y, domain: p } = m, t = await i.pFrameProvider.findColumnBy(a, f, V(y), V(p)), g = e === "filters" || e === "tabBy" || e === "highlight";
19
+ async function D(n, r, c = !0) {
20
+ const i = [], h = r.filter(({ selectedSource: e }) => "kind" in e && e.kind === "PColumn"), w = r.filter(({ selectedSource: e }) => !("kind" in e && e.kind === "PColumn")), C = [];
21
+ for (const { inputName: e, filterType: d, selectedSource: m, selectedFilterValues: o, selectedFilterRange: y } of h) {
22
+ const { name: s, valueType: f, annotations: F, domain: p } = m, t = await n.pFrameProvider.findColumnBy(s, f, V(F), V(p)), g = e === "filters" || e === "tabBy" || e === "highlight";
18
23
  if (t) {
19
- const l = await i.pFrameProvider.getColumnSpecById(t);
24
+ const a = await n.pFrameProvider.getColumnSpecById(t);
20
25
  if (!g)
21
- n.push({ inputName: e, selectedSource: t.toCanonicalString() });
26
+ i.push({ inputName: e, selectedSource: t.toCanonicalString() });
22
27
  else {
23
- const r = d ?? T(f, l == null ? void 0 : l.annotations, o, F), v = r === "equals" && typeof o > "u" ? [(await i.pFrameProvider.getColumnUniqueValues(t, 1)).values[0]] : o, u = { min: void 0, max: void 0, ...F };
24
- n.push({
28
+ const l = d ?? x(f, a, o, y), v = l === "equals" && typeof o > "u" ? [(await n.pFrameProvider.getColumnUniqueValues(t, 1)).values[0]] : o, u = { min: void 0, max: void 0, ...y };
29
+ i.push({
25
30
  inputName: e,
26
- filterType: r,
31
+ filterType: l,
27
32
  selectedSource: t.toCanonicalString(),
28
33
  selectedFilterValues: v,
29
34
  selectedFilterRange: u
30
35
  });
31
36
  }
32
- C.push(...(l == null ? void 0 : l.axesSpec.map((r) => ({ spec: r, parentColumn: t }))) ?? []);
37
+ C.push(...(a == null ? void 0 : a.axesSpec.map((l) => ({ spec: l, parentColumn: t }))) ?? []);
33
38
  } else
34
39
  console.warn(`Not found column for default option: ${JSON.stringify({ inputName: e, selectedSource: m })}`);
35
40
  }
36
- for (const { inputName: e, selectedSource: d, filterType: m, selectedFilterValues: o, selectedFilterRange: F } of R) {
37
- const a = S.fromAxisSpec(d), f = a.toCanonicalString(), y = e === "filters" || e === "tabBy" || e === "highlight", p = y ? m ?? T(a.type, d == null ? void 0 : d.annotations) : void 0, t = C.find((r) => S.fromAxisSpec(r.spec).toCanonicalString() === f), g = y && p === "equals" && typeof o > "u" && (t != null && t.parentColumn) ? [(await i.pFrameProvider.getAxisUniqueValues(a, [t == null ? void 0 : t.parentColumn], 1)).values[0]] : o, l = { min: void 0, max: void 0, ...F };
38
- if (c || n.push({
41
+ for (const { inputName: e, selectedSource: d, filterType: m, selectedFilterValues: o, selectedFilterRange: y } of w) {
42
+ const s = S.fromAxisSpec(d), f = s.toCanonicalString(), F = e === "filters" || e === "tabBy" || e === "highlight", p = F ? m ?? x(s.type, { annotations: d == null ? void 0 : d.annotations }) : void 0, t = C.find((l) => S.fromAxisSpec(l.spec).toCanonicalString() === f), g = F && p === "equals" && typeof o > "u" && (t != null && t.parentColumn) ? [(await n.pFrameProvider.getAxisUniqueValues(s, [t == null ? void 0 : t.parentColumn], 1)).values[0]] : o, a = { min: void 0, max: void 0, ...y };
43
+ if (c || i.push({
39
44
  inputName: e,
40
45
  filterType: p,
41
46
  selectedSource: f,
42
47
  selectedFilterValues: g,
43
- selectedFilterRange: l
48
+ selectedFilterRange: a
44
49
  }), t)
45
- n.push({
50
+ i.push({
46
51
  inputName: e,
47
52
  filterType: p,
48
53
  selectedSource: f,
49
54
  selectedFilterValues: g,
50
- selectedFilterRange: l
55
+ selectedFilterRange: a
51
56
  });
52
57
  else {
53
- const { spec: r, parentColumn: v } = C.find((u) => a.name === u.spec.name && a.type === u.spec.type && w(a.domain, u.spec.domain)) ?? {};
54
- if (r) {
55
- const u = (e === "filters" || e === "tabBy") && typeof o > "u" ? [(await i.pFrameProvider.getAxisUniqueValues(S.fromAxisSpec(r), [v], 1)).values[0]] : o;
56
- n.push({
58
+ const { spec: l, parentColumn: v } = C.find((u) => s.name === u.spec.name && s.type === u.spec.type && T(s.domain, u.spec.domain)) ?? {};
59
+ if (l) {
60
+ const u = (e === "filters" || e === "tabBy") && typeof o > "u" ? [(await n.pFrameProvider.getAxisUniqueValues(S.fromAxisSpec(l), [v], 1)).values[0]] : o;
61
+ i.push({
57
62
  inputName: e,
58
63
  filterType: p,
59
- selectedSource: S.fromAxisSpec(r).toCanonicalString(),
64
+ selectedSource: S.fromAxisSpec(l).toCanonicalString(),
60
65
  selectedFilterValues: u,
61
- selectedFilterRange: l
66
+ selectedFilterRange: a
62
67
  });
63
68
  }
64
69
  }
65
70
  }
66
- return n;
71
+ return i;
67
72
  }
68
73
  export {
69
- P as loadDefaultSources
74
+ D as loadDefaultSources
70
75
  };
71
76
  //# sourceMappingURL=loadDefaultSources.js.map
@@ -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\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 filterType?: SelectorStateFilter['type']\n selectedFilterRange?: SelectorStateFilter['selectedFilterRange']\n selectedFilterValues?: SelectorStateFilter['selectedFilterValues']\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 selectedFilterValues?: SelectorStateFilter['selectedFilterValues'],\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 (selectedFilterValues !== 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, selectedFilterValues, selectedFilterRange } 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 if (!isFilter) {\n result.push({ inputName, selectedSource: columnId.toCanonicalString()});\n } else {\n const defaultFilterType = filterType ?? getDefaultFilterType(valueType, spec?.annotations, selectedFilterValues, selectedFilterRange);\n const defaultSelectedFilterValue = defaultFilterType === 'equals' && typeof selectedFilterValues === 'undefined'\n ? [(await dataStore.pFrameProvider.getColumnUniqueValues(columnId, 1)).values[0]]\n : selectedFilterValues;\n const defaultFilterRange = {min: undefined, max: undefined, ...selectedFilterRange};\n result.push({\n inputName,\n filterType: defaultFilterType,\n selectedSource: columnId.toCanonicalString(),\n selectedFilterValues: defaultSelectedFilterValue,\n selectedFilterRange: defaultFilterRange as SelectorStateFilter['selectedFilterRange'],\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, selectedFilterValues, 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 defaultSelectedFilterValues = isFilter && defaultFilterType === 'equals' && typeof selectedFilterValues === 'undefined' && columnWithExistingAxis?.parentColumn\n ? [(await dataStore.pFrameProvider.getAxisUniqueValues(axisId, [columnWithExistingAxis?.parentColumn], 1)).values[0]]\n : selectedFilterValues\n const defaultFilterRange = {min: undefined, max: undefined, ...selectedFilterRange};\n\n if (!considerAxisDomains) {\n result.push({\n inputName,\n filterType: defaultFilterType,\n selectedSource: axisSourceStr,\n selectedFilterValues: defaultSelectedFilterValues,\n selectedFilterRange: defaultFilterRange as SelectorStateFilter['selectedFilterRange'],\n });\n }\n if (columnWithExistingAxis) {\n result.push({\n inputName,\n filterType: defaultFilterType,\n selectedSource: axisSourceStr,\n selectedFilterValues: defaultSelectedFilterValues,\n selectedFilterRange: defaultFilterRange as SelectorStateFilter['selectedFilterRange'],\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 selectedFilterValues === 'undefined'\n ? [(await dataStore.pFrameProvider.getAxisUniqueValues(AxisId.fromAxisSpec(allowedCompatibleAxisSpec), [parentColumn as ColumnId], 1)).values[0]]\n : selectedFilterValues\n result.push({\n inputName,\n filterType: defaultFilterType,\n selectedSource: AxisId.fromAxisSpec(allowedCompatibleAxisSpec).toCanonicalString(),\n selectedFilterValues: defaultSelectedFilterValue,\n selectedFilterRange: defaultFilterRange as SelectorStateFilter['selectedFilterRange'],\n });\n }\n }\n }\n\n return result;\n}"],"names":["domainIsCompatible","domain","otherDomain","keys","key","getDefaultFilterType","valueType","annotations","selectedFilterValues","selectedFilterRange","SUBSET_FILTER_KEY","loadDefaultSources","dataStore","defaultOptions","considerAxisDomains","result","defaultColumnStates","selectedSource","defaultAxisStates","allowedAxisSpecs","inputName","filterType","name","columnId","toRaw","isFilter","spec","defaultFilterType","defaultSelectedFilterValue","defaultFilterRange","axisId","AxisId","axisSourceStr","columnWithExistingAxis","el","defaultSelectedFilterValues","allowedCompatibleAxisSpec","parentColumn"],"mappings":";;;;AAqBA,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,MAAyB,UAGzBF,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,GAEl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,MAAc,YAAY,OAAOZ,IAAyB,MACrH,EAAE,MAAMI,EAAU,eAAe,oBAAoBmB,EAAO,aAAaK,CAAyB,GAAG,CAACC,CAAwB,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,IAC9I7B;AACJ,QAAAO,EAAO,KAAK;AAAA,UACV,WAAAK;AAAA,UACA,YAAYO;AAAA,UACZ,gBAAgBI,EAAO,aAAaK,CAAyB,EAAE,kBAAA;AAAA,UAC/D,sBAAsBR;AAAA,UACtB,qBAAqBC;AAAA,QAAA,CACtB;AAAA,MACH;AAAA,IACF;AAAA,EACF;AAEA,SAAOd;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\n} from '@milaboratories/pf-plots';\nimport { PredefinedGraphOption } from '../types';\nimport { Annotation, AxisSpec, PColumnSpec, readAnnotation, ValueType } from '@platforma-sdk/model';\nimport { toRaw } from 'vue';\n\ntype LoadedDefaultOptions<T extends ChartType> = {\n inputName: InputNamesByChartType[T],\n selectedSource: string,\n filterType?: SelectorStateFilter['type']\n selectedFilterRange?: SelectorStateFilter['selectedFilterRange']\n selectedFilterValues?: SelectorStateFilter['selectedFilterValues']\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 spec: PColumnSpec | null,\n selectedFilterValues?: SelectorStateFilter['selectedFilterValues'],\n selectedFilterRange?: Partial<SelectorStateFilter['selectedFilterRange']>\n):SelectorStateFilter['type'] {\n if (spec && readAnnotation(spec, Annotation.IsSubset)) {\n return 'subset';\n }\n if (selectedFilterRange !== undefined) {\n return 'range';\n }\n if (selectedFilterValues !== 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, selectedFilterValues, selectedFilterRange } 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 if (!isFilter) {\n result.push({ inputName, selectedSource: columnId.toCanonicalString()});\n } else {\n const defaultFilterType = filterType ?? getDefaultFilterType(valueType, spec, selectedFilterValues, selectedFilterRange);\n const defaultSelectedFilterValue = defaultFilterType === 'equals' && typeof selectedFilterValues === 'undefined'\n ? [(await dataStore.pFrameProvider.getColumnUniqueValues(columnId, 1)).values[0]]\n : selectedFilterValues;\n const defaultFilterRange = {min: undefined, max: undefined, ...selectedFilterRange};\n result.push({\n inputName,\n filterType: defaultFilterType,\n selectedSource: columnId.toCanonicalString(),\n selectedFilterValues: defaultSelectedFilterValue,\n selectedFilterRange: defaultFilterRange as SelectorStateFilter['selectedFilterRange'],\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, selectedFilterValues, 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, {annotations: selectedSource?.annotations} as PColumnSpec) : undefined;\n\n const columnWithExistingAxis = allowedAxisSpecs.find((el) => AxisId.fromAxisSpec(el.spec).toCanonicalString() === axisSourceStr) ;\n const defaultSelectedFilterValues = isFilter && defaultFilterType === 'equals' && typeof selectedFilterValues === 'undefined' && columnWithExistingAxis?.parentColumn\n ? [(await dataStore.pFrameProvider.getAxisUniqueValues(axisId, [columnWithExistingAxis?.parentColumn], 1)).values[0]]\n : selectedFilterValues\n const defaultFilterRange = {min: undefined, max: undefined, ...selectedFilterRange};\n\n if (!considerAxisDomains) {\n result.push({\n inputName,\n filterType: defaultFilterType,\n selectedSource: axisSourceStr,\n selectedFilterValues: defaultSelectedFilterValues,\n selectedFilterRange: defaultFilterRange as SelectorStateFilter['selectedFilterRange'],\n });\n }\n if (columnWithExistingAxis) {\n result.push({\n inputName,\n filterType: defaultFilterType,\n selectedSource: axisSourceStr,\n selectedFilterValues: defaultSelectedFilterValues,\n selectedFilterRange: defaultFilterRange as SelectorStateFilter['selectedFilterRange'],\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 selectedFilterValues === 'undefined'\n ? [(await dataStore.pFrameProvider.getAxisUniqueValues(AxisId.fromAxisSpec(allowedCompatibleAxisSpec), [parentColumn as ColumnId], 1)).values[0]]\n : selectedFilterValues\n result.push({\n inputName,\n filterType: defaultFilterType,\n selectedSource: AxisId.fromAxisSpec(allowedCompatibleAxisSpec).toCanonicalString(),\n selectedFilterValues: defaultSelectedFilterValue,\n selectedFilterRange: defaultFilterRange as SelectorStateFilter['selectedFilterRange'],\n });\n }\n }\n }\n\n return result;\n}"],"names":["domainIsCompatible","domain","otherDomain","keys","key","getDefaultFilterType","valueType","spec","selectedFilterValues","selectedFilterRange","readAnnotation","Annotation","loadDefaultSources","dataStore","defaultOptions","considerAxisDomains","result","defaultColumnStates","selectedSource","defaultAxisStates","allowedAxisSpecs","inputName","filterType","name","annotations","columnId","toRaw","isFilter","defaultFilterType","defaultSelectedFilterValue","defaultFilterRange","axisId","AxisId","axisSourceStr","columnWithExistingAxis","el","defaultSelectedFilterValues","allowedCompatibleAxisSpec","parentColumn"],"mappings":";;;;;;;;;AAoBA,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,SAAIF,KAAQG,EAAeH,GAAMI,EAAW,QAAQ,IAC3C,WAELF,MAAwB,SACnB,UAELD,MAAyB,UAGzBF,MAAc,SAASA,MAAc,WAChC,WAEF;AACT;AACA,eAAsBM,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;A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Ob,IAAyB,MACrH,EAAE,MAAMK,EAAU,eAAe,oBAAoBmB,EAAO,aAAaK,CAAyB,GAAG,CAACC,CAAwB,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,IAC9I9B;AACJ,QAAAQ,EAAO,KAAK;AAAA,UACV,WAAAK;AAAA,UACA,YAAYO;AAAA,UACZ,gBAAgBI,EAAO,aAAaK,CAAyB,EAAE,kBAAA;AAAA,UAC/D,sBAAsBR;AAAA,UACtB,qBAAqBC;AAAA,QAAA,CACtB;AAAA,MACH;AAAA,IACF;AAAA,EACF;AAEA,SAAOd;AACT;"}
@@ -0,0 +1,5 @@
1
+ var r = { exports: {} };
2
+ export {
3
+ r as __module
4
+ };
5
+ //# sourceMappingURL=stringify.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stringify.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -1,31 +1,31 @@
1
- import "../node_modules/@milaboratories/pl-model-common/dist/drivers/blob.js";
2
- import { getNormalizedAxesList as E } from "../node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/spec.js";
1
+ import "../node_modules/@platforma-sdk/model/node_modules/@milaboratories/pl-model-common/dist/drivers/blob.js";
2
+ import { getNormalizedAxesList as N } from "../node_modules/@platforma-sdk/model/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/spec.js";
3
3
  import "../_virtual/canonicalize.js";
4
- import { LinkerMap as W } from "../node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/linker_columns.js";
5
- import "../node_modules/@milaboratories/pl-model-common/dist/plid.js";
6
- import "../node_modules/@milaboratories/pl-model-common/dist/ref.js";
4
+ import "../node_modules/@platforma-sdk/model/node_modules/@milaboratories/pl-model-common/dist/plid.js";
5
+ import "../node_modules/@platforma-sdk/model/node_modules/@milaboratories/pl-model-common/dist/ref.js";
7
6
  import "../node_modules/@platforma-sdk/model/dist/render/util/label.js";
8
- import { isLabelColumn as U } from "../node_modules/@platforma-sdk/model/dist/components/PlDataTable.js";
7
+ import { isLabelColumn as M } from "../node_modules/@platforma-sdk/model/dist/components/PlDataTable.js";
9
8
  import "../node_modules/@milaboratories/pl-error-like/dist/error_like_shape.js";
10
- import { DISCRETE_FILTER_KEY as F, SUBSET_FILTER_KEY as L, COLUMN_LABEL_KEY as j, IS_LINKER_COLUMN as z } from "../constants.js";
11
- import { columnOrAxisIdFromString as B, isColumnId as T, AxisId as N, ColumnId as H } from "../spec.js";
12
- import { getStateCopy as $, getNotAllowedAxes as Y, axisIsNonHomogenous as Z, getColumnOrAxisLabel as V } from "../utils.js";
13
- var G = Object.defineProperty, J = (d, e, t) => e in d ? G(d, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : d[e] = t, S = (d, e, t) => J(d, typeof e != "symbol" ? e + "" : e, t);
14
- const Q = (d) => {
15
- var e;
16
- return ((e = d == null ? void 0 : d.annotations) == null ? void 0 : e[z]) === "true";
17
- }, q = class M {
9
+ import { columnOrAxisIdFromString as O, isColumnId as P, AxisId as k, ColumnId as W } from "../spec.js";
10
+ import "../node_modules/@milaboratories/pl-model-common/dist/drivers/blob.js";
11
+ import { readAnnotation as A, Annotation as x } from "../node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/spec.js";
12
+ import { LinkerMap as j } from "../node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/linker_columns.js";
13
+ import "../node_modules/@milaboratories/pl-model-common/dist/plid.js";
14
+ import "../node_modules/@milaboratories/pl-model-common/dist/ref.js";
15
+ import { getStateCopy as F, getNotAllowedAxes as z, axisIsNonHomogenous as H, getColumnOrAxisLabel as E } from "../utils.js";
16
+ var K = Object.defineProperty, R = (y, t, e) => t in y ? K(y, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : y[t] = e, g = (y, t, e) => R(y, typeof t != "symbol" ? t + "" : t, e);
17
+ const Q = (y) => A(y, x.IsLinkerColumn) === "true", B = class L {
18
18
  constructor({
19
- componentName: e,
20
- allowedTypes: t,
19
+ componentName: t,
20
+ allowedTypes: e,
21
21
  settings: n,
22
22
  strictlyDependsOnParents: s,
23
23
  dependsOn: i = [],
24
- parentComponents: l = [],
25
- annotations: p = {},
24
+ parentComponents: p = [],
25
+ annotations: m = {},
26
26
  checkSourceBySpec: o
27
27
  }) {
28
- S(this, "componentName"), S(this, "allowedTypes"), S(this, "settings"), S(this, "dependsOn"), S(this, "parentComponents"), S(this, "strictlyDependsOnParents"), S(this, "annotations"), S(this, "checkSourceBySpec"), this.componentName = e, this.allowedTypes = [...t], this.settings = { ...M.DefaultSettings, ...n }, this.dependsOn = [...i], this.parentComponents = [...l], this.strictlyDependsOnParents = s ?? !0, this.annotations = { ...p }, o && (this.checkSourceBySpec = o);
28
+ 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 = t, this.allowedTypes = [...e], this.settings = { ...L.DefaultSettings, ...n }, this.dependsOn = [...i], this.parentComponents = [...p], this.strictlyDependsOnParents = s ?? !0, this.annotations = { ...m }, o && (this.checkSourceBySpec = o);
29
29
  }
30
30
  get isRequired() {
31
31
  return this.settings.required;
@@ -33,73 +33,73 @@ const Q = (d) => {
33
33
  get isDimensionsConsumer() {
34
34
  return this.settings.dimensionConsumer;
35
35
  }
36
- addSelected(e, t) {
37
- const n = $(e);
38
- return n.components[this.componentName].selectorStates.push(t), n;
36
+ addSelected(t, e) {
37
+ const n = F(t);
38
+ return n.components[this.componentName].selectorStates.push(e), n;
39
39
  }
40
- deleteSelected(e, t) {
41
- const n = $(e);
42
- return n.components[this.componentName].selectorStates = n.components[this.componentName].selectorStates.filter((s) => s.selectedSource !== t), n;
40
+ deleteSelected(t, e) {
41
+ const n = F(t);
42
+ return n.components[this.componentName].selectorStates = n.components[this.componentName].selectorStates.filter((s) => s.selectedSource !== e), n;
43
43
  }
44
- getParentSelectedSources(e) {
45
- return this.parentComponents.reduce((t, n) => {
46
- const s = e.components[n].selectorStates.map(
47
- (i) => B(i.selectedSource)
44
+ getParentSelectedSources(t) {
45
+ return this.parentComponents.reduce((e, n) => {
46
+ const s = t.components[n].selectorStates.map(
47
+ (i) => O(i.selectedSource)
48
48
  );
49
- return t.push(...s), t;
49
+ return e.push(...s), e;
50
50
  }, []);
51
51
  }
52
- async getParentsAxes(e, t) {
53
- const n = this.getParentSelectedSources(t), s = /* @__PURE__ */ new Map();
52
+ async getParentsAxes(t, e) {
53
+ const n = this.getParentSelectedSources(e), s = /* @__PURE__ */ new Map();
54
54
  for (const i of n)
55
- if (T(i)) {
56
- const l = await e.pFrameProvider.getColumnSpecById(i);
57
- for (const p of (l == null ? void 0 : l.axesSpec) ?? []) {
58
- const o = N.fromAxisSpec(p).toCanonicalString();
59
- s.has(o) || s.set(o, { parentSource: i.toCanonicalString(), spec: p });
55
+ if (P(i)) {
56
+ const p = await t.pFrameProvider.getColumnSpecById(i);
57
+ for (const m of (p == null ? void 0 : p.axesSpec) ?? []) {
58
+ const o = k.fromAxisSpec(m).toCanonicalString();
59
+ s.has(o) || s.set(o, { parentSource: i.toCanonicalString(), spec: m });
60
60
  }
61
61
  }
62
62
  return s;
63
63
  }
64
- async getParentAndHangingAxes(e, t, n, s) {
65
- const i = await this.getParentsAxes(e, t), l = /* @__PURE__ */ new Map();
64
+ async getParentAndHangingAxes(t, e, n, s) {
65
+ const i = await this.getParentsAxes(t, e), p = /* @__PURE__ */ new Map();
66
66
  if (!this.settings.isDataComponent) {
67
- const p = t.components[this.componentName].selectorStates.map((o) => o.selectedSource);
68
- for (const o of p) {
69
- const u = B(o);
70
- if (!T(u))
67
+ const m = e.components[this.componentName].selectorStates.map((o) => o.selectedSource);
68
+ for (const o of m) {
69
+ const u = O(o);
70
+ if (!P(u))
71
71
  continue;
72
- const m = await e.pFrameProvider.getColumnSpecById(u);
73
- if (!m)
72
+ const l = await t.pFrameProvider.getColumnSpecById(u);
73
+ if (!l)
74
74
  continue;
75
- const g = Y(m, Array.from(i.values()).map((a) => a.spec), n, s);
76
- for (const a of g)
77
- l.set(N.fromAxisSpec(a).toCanonicalString(), { parentSource: o, spec: a });
75
+ const h = z(l, Array.from(i.values()).map((a) => a.spec), n, s);
76
+ for (const a of h)
77
+ p.set(k.fromAxisSpec(a).toCanonicalString(), { parentSource: o, spec: a });
78
78
  }
79
79
  }
80
- return { parentsAxes: i, hangingAxes: l };
80
+ return { parentsAxes: i, hangingAxes: p };
81
81
  }
82
82
  /** Get axes to check available columns compatibility: all parents axes + available with these parent axes linker axes */
83
- getColumnSourceAxes(e, t, n) {
84
- const s = /* @__PURE__ */ new Map(), { parentsAxes: i } = e[this.componentName];
83
+ getColumnSourceAxes(t, e, n) {
84
+ const s = /* @__PURE__ */ new Map(), { parentsAxes: i } = t[this.componentName];
85
85
  for (const o of i)
86
86
  s.set(...o);
87
87
  if (this.settings.isDataComponent)
88
88
  return s;
89
- const l = E(Array.from(i.values()).map((o) => o.spec)), p = E(t.getReachableByLinkersAxesFromAxes(l));
90
- for (const o of p) {
91
- const u = W.getLinkerKeyFromAxisSpec(o), m = t.data.get(u), g = Array.from((m == null ? void 0 : m.linkWith.keys()) ?? []), a = m == null ? void 0 : m.linkWith.get(g[0]);
89
+ const p = N(Array.from(i.values()).map((o) => o.spec)), m = N(e.getReachableByLinkersAxesFromAxes(p));
90
+ for (const o of m) {
91
+ const u = j.getLinkerKeyFromAxisSpec(o), l = e.data.get(u), h = Array.from((l == null ? void 0 : l.linkWith.keys()) ?? []), a = l == null ? void 0 : l.linkWith.get(h[0]);
92
92
  if (a) {
93
- const C = N.fromAxisSpec(o).toCanonicalString(), x = new H({ name: a.columnId, type: a.spec.valueType }).toCanonicalString();
94
- s.set(C, { parentSource: x, spec: o });
93
+ const S = k.fromAxisSpec(o).toCanonicalString(), d = new W({ name: a.columnId, type: a.spec.valueType }).toCanonicalString();
94
+ s.set(S, { parentSource: d, spec: o });
95
95
  }
96
96
  }
97
97
  for (const [o] of i) {
98
- const u = n.get(o), m = Array.from((u == null ? void 0 : u.keys()) ?? []);
99
- if (u && m.length)
100
- for (const g of m) {
101
- const a = u.get(g), C = N.fromAxisSpec(a.spec).toCanonicalString();
102
- s.set(C, { parentSource: a.parentSource, spec: a.spec });
98
+ const u = n.get(o), l = Array.from((u == null ? void 0 : u.keys()) ?? []);
99
+ if (u && l.length)
100
+ for (const h of l) {
101
+ const a = u.get(h), S = k.fromAxisSpec(a.spec).toCanonicalString();
102
+ s.set(S, { parentSource: a.parentSource, spec: a.spec });
103
103
  }
104
104
  }
105
105
  return s;
@@ -107,85 +107,84 @@ const Q = (d) => {
107
107
  /** Allowed: all axes from parent (data) inputs + hanging axes from another (not data) inputs + axes from linkers;
108
108
  * these are all axes that can be in a compatible columns + hanging axes.
109
109
  */
110
- getAllowedAxes(e, t, n) {
111
- const s = this.getColumnSourceAxes(e, t, n);
112
- for (const [i, l] of Object.entries(e))
110
+ getAllowedAxes(t, e, n) {
111
+ const s = this.getColumnSourceAxes(t, e, n);
112
+ for (const [i, p] of Object.entries(t))
113
113
  if (!(i === this.componentName && !this.settings.multipleSelectors))
114
- for (const p of l.hangingAxes)
115
- s.set(...p);
114
+ for (const m of p.hangingAxes)
115
+ s.set(...m);
116
116
  return s;
117
117
  }
118
- checkStateConsistency(e, t) {
119
- return e.components[this.componentName].selectorStates.reduce((n, s) => (n[s.selectedSource] = t.some((i) => i.value === s.selectedSource), n), {});
118
+ checkStateConsistency(t, e) {
119
+ return t.components[this.componentName].selectorStates.reduce((n, s) => (n[s.selectedSource] = e.some((i) => i.value === s.selectedSource), n), {});
120
120
  }
121
- async getOptions(e, t, n, s, i, l, p = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set()) {
122
- var u, m, g, a, C;
123
- const x = this.settings.multipleSelectors, b = this.settings.required, v = /* @__PURE__ */ new Map();
124
- if (this.dependsOn.length && this.dependsOn.some((f) => t.components[f].selectorStates.length === 0))
125
- return { multipleSelectors: x, required: b, stateConsistency: this.checkStateConsistency(t, []), options: [], optionsInfo: v };
126
- if (this.strictlyDependsOnParents && !this.settings.isDataComponent && this.parentComponents.some((f) => t.components[f].selectorStates.length === 0))
127
- return { multipleSelectors: x, required: b, stateConsistency: this.checkStateConsistency(t, []), options: [], optionsInfo: v };
128
- const O = [];
121
+ async getOptions(t, e, n, s, i, p, m = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set()) {
122
+ const u = this.settings.multipleSelectors, l = this.settings.required, h = /* @__PURE__ */ new Map();
123
+ if (this.dependsOn.length && this.dependsOn.some((S) => e.components[S].selectorStates.length === 0))
124
+ return { multipleSelectors: u, required: l, stateConsistency: this.checkStateConsistency(e, []), options: [], optionsInfo: h };
125
+ if (this.strictlyDependsOnParents && !this.settings.isDataComponent && this.parentComponents.some((S) => e.components[S].selectorStates.length === 0))
126
+ return { multipleSelectors: u, required: l, stateConsistency: this.checkStateConsistency(e, []), options: [], optionsInfo: h };
127
+ const a = [];
129
128
  if (this.settings.axesAllowed) {
130
- const f = this.getAllowedAxes(i, n, s);
131
- for (const [y, { spec: c, parentSource: A }] of f.entries()) {
132
- const w = B(y), r = Z(c), I = this.allowedTypes.includes(c.type), k = Object.entries(this.annotations).every(
133
- ([_, K]) => {
134
- var P;
135
- return ((P = c.annotations) == null ? void 0 : P[_]) === K;
129
+ const S = this.getAllowedAxes(i, n, s);
130
+ for (const [d, { spec: c, parentSource: C }] of S.entries()) {
131
+ const w = O(d), r = H(c), D = this.allowedTypes.includes(c.type), v = Object.entries(this.annotations).every(
132
+ ([q, $]) => {
133
+ var I;
134
+ return ((I = c.annotations) == null ? void 0 : I[q]) === $;
136
135
  }
137
- ), D = this.checkSourceBySpec ? this.checkSourceBySpec(c, t) : !0, h = !this.settings.homogeneous || !r, R = p.has(w.name) || o.has(y);
138
- v.set(y, {
136
+ ), b = this.checkSourceBySpec ? this.checkSourceBySpec(c, e) : !0, f = !this.settings.homogeneous || !r, T = m.has(w.name) || o.has(d);
137
+ h.set(d, {
139
138
  kind: "axis",
140
139
  name: c.name,
141
- label: await V(e, y, [A]),
140
+ label: await E(t, d, [C]),
142
141
  type: c.type,
143
142
  mustBeConsumed: !1,
144
143
  dividable: !1,
145
144
  spec: c,
146
145
  annotations: c.annotations,
147
146
  isNonHomogenous: r,
148
- isSubsetFilter: ((u = c.annotations) == null ? void 0 : u[L]) === "true",
149
- isDiscreteFilter: c.type === "String" || ((m = c.annotations) == null ? void 0 : m[F]) === "true",
150
- parentSources: [A]
151
- }), I && k && D && h && !R && O.push({ value: y });
147
+ isSubsetFilter: A(c, x.IsSubset),
148
+ isDiscreteFilter: c.type === "String" || A(c, x.IsDiscreteFilter) === "true",
149
+ parentSources: [C]
150
+ }), D && v && b && f && !T && a.push({ value: d });
152
151
  }
153
152
  }
154
153
  if (this.settings.columnsAllowed) {
155
- const f = await e.pFrameProvider.getColumns([], !1, this.allowedTypes, void 0, this.annotations), y = !this.settings.columnsWithExtraAxesAllowed && this.strictlyDependsOnParents, c = this.getColumnSourceAxes(i, n, s);
156
- for (const A of f) {
157
- const w = A.toCanonicalString(), r = await e.pFrameProvider.getColumnSpecById(A);
154
+ const S = await t.pFrameProvider.getColumns([], !1, this.allowedTypes, void 0, this.annotations), d = !this.settings.columnsWithExtraAxesAllowed && this.strictlyDependsOnParents, c = this.getColumnSourceAxes(i, n, s);
155
+ for (const C of S) {
156
+ const w = C.toCanonicalString(), r = await t.pFrameProvider.getColumnSpecById(C);
158
157
  if (!r)
159
158
  continue;
160
- const I = i[this.componentName].parentsAxes, k = r.axesSpec.map((h) => N.fromAxisSpec(h).toCanonicalString());
159
+ const D = i[this.componentName].parentsAxes, v = r.axesSpec.map((f) => k.fromAxisSpec(f).toCanonicalString());
161
160
  if (
162
161
  // 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
163
- U(r) || Q(r) || this.checkSourceBySpec && !this.checkSourceBySpec(r, t) || this.settings.isDataComponent && !l(r) || y && c.size && k.some((h) => !c.has(h)) || I.size && !(k.some((h) => I.has(h)) || k.every((h) => c.has(h)))
162
+ M(r) || Q(r) || this.checkSourceBySpec && !this.checkSourceBySpec(r, e) || this.settings.isDataComponent && !p(r) || d && c.size && v.some((f) => !c.has(f)) || D.size && !(v.some((f) => D.has(f)) || v.every((f) => c.has(f)))
164
163
  )
165
164
  continue;
166
- const D = {
165
+ const b = {
167
166
  kind: "column",
168
167
  name: r.name,
169
- label: ((g = r.annotations) == null ? void 0 : g[j]) ?? r.name,
168
+ label: A(r, x.Label) ?? r.name,
170
169
  type: r.valueType,
171
170
  spec: r,
172
171
  annotations: r.annotations,
173
- isSubsetFilter: ((a = r.annotations) == null ? void 0 : a[L]) === "true",
174
- isDiscreteFilter: r.valueType === "String" || ((C = r.annotations) == null ? void 0 : C[F]) === "true"
172
+ isSubsetFilter: A(r, x.IsSubset) === "true",
173
+ isDiscreteFilter: r.valueType === "String" || A(r, x.IsDiscreteFilter) === "true"
175
174
  };
176
- v.set(w, D), p.has(A.name) || o.has(w) || O.push({ value: w });
175
+ h.set(w, b), m.has(C.name) || o.has(w) || a.push({ value: w });
177
176
  }
178
177
  }
179
178
  return {
180
- multipleSelectors: x,
181
- required: b,
182
- stateConsistency: this.checkStateConsistency(t, O),
183
- options: O,
184
- optionsInfo: v
179
+ multipleSelectors: u,
180
+ required: l,
181
+ stateConsistency: this.checkStateConsistency(e, a),
182
+ options: a,
183
+ optionsInfo: h
185
184
  };
186
185
  }
187
186
  };
188
- S(q, "DefaultSettings", {
187
+ g(B, "DefaultSettings", {
189
188
  isDataComponent: !1,
190
189
  multipleSelectors: !1,
191
190
  required: !1,
@@ -195,8 +194,8 @@ S(q, "DefaultSettings", {
195
194
  columnsWithExtraAxesAllowed: !0,
196
195
  dimensionConsumer: !1
197
196
  });
198
- let me = q;
197
+ let ae = B;
199
198
  export {
200
- me as ComponentController
199
+ ae as ComponentController
201
200
  };
202
201
  //# sourceMappingURL=ComponentController.js.map