@platforma-sdk/model 1.45.23 → 1.45.26

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.
@@ -8,18 +8,18 @@ import type {
8
8
  PObjectId,
9
9
  } from '@milaboratories/pl-model-common';
10
10
  import {
11
+ Annotation,
11
12
  canonicalizeJson,
13
+ getArrayFromAxisTree,
14
+ getAxesTree,
12
15
  getAxisId,
13
- matchAxisId,
14
16
  getColumnIdAndSpec,
15
- Annotation,
16
- readAnnotation,
17
17
  getNormalizedAxesList,
18
- stringifyJson,
19
- readAnnotationJson,
20
18
  LinkerMap,
21
- getArrayFromAxisTree,
22
- getAxesTree,
19
+ matchAxisId,
20
+ readAnnotation,
21
+ readAnnotationJson,
22
+ stringifyJson,
23
23
  } from '@milaboratories/pl-model-common';
24
24
  import type { PColumnDataUniversal, RenderCtx } from '../render';
25
25
  import { allPColumnsReady, PColumnCollection } from '../render';
@@ -60,7 +60,7 @@ export function isLinkerColumn(column: PColumnSpec): boolean {
60
60
  return !!readAnnotationJson(column, Annotation.IsLinkerColumn);
61
61
  }
62
62
 
63
- function isHiddenFromGraphColumn(column: PColumnSpec): boolean {
63
+ export function isHiddenFromGraphColumn(column: PColumnSpec): boolean {
64
64
  return !!readAnnotationJson(column, Annotation.HideDataFromGraphs);
65
65
  }
66
66
 
@@ -259,10 +259,11 @@ export function createPFrameForGraphs<A, U>(
259
259
  allAxes.set(...item);
260
260
  }
261
261
 
262
+ const blockAxesArr = Array.from(blockAxes.values());
262
263
  // all compatible with block columns but without label columns
263
264
  let compatibleWithoutLabels = (columns.getColumns((spec) => !isHiddenFromGraphColumn(spec) && spec.axesSpec.some((axisSpec) => {
264
265
  const axisId = getAxisId(axisSpec);
265
- return Array.from(blockAxes.values()).some((selectorAxisSpec) => matchAxisId(getAxisId(selectorAxisSpec), axisId));
266
+ return blockAxesArr.some((selectorAxisSpec) => matchAxisId(getAxisId(selectorAxisSpec), axisId));
266
267
  }), { dontWaitAllData: true, overrideLabelAnnotation: false }) ?? []).filter((column) => !isLabelColumn(column.spec));
267
268
 
268
269
  // if at least one column is not yet ready, we can't show the graph
@@ -278,16 +279,17 @@ export function createPFrameForGraphs<A, U>(
278
279
  }
279
280
  }
280
281
 
282
+ const allAxesArr = Array.from(allAxes.values());
281
283
  // extend allowed columns - add columns thad doesn't have axes from block, but have all axes in 'allAxes' list (that means all axes from linkers or from 'hanging' of other selected columns)
282
284
  compatibleWithoutLabels = (columns.getColumns((spec) => !isHiddenFromGraphColumn(spec) && spec.axesSpec.every((axisSpec) => {
283
285
  const axisId = getAxisId(axisSpec);
284
- return Array.from(allAxes.values()).some((selectorAxisSpec) => matchAxisId(getAxisId(selectorAxisSpec), axisId));
286
+ return allAxesArr.some((selectorAxisSpec) => matchAxisId(getAxisId(selectorAxisSpec), axisId));
285
287
  }), { dontWaitAllData: true, overrideLabelAnnotation: false }) ?? []).filter((column) => !isLabelColumn(column.spec));
286
288
 
287
289
  // label columns must be compatible with full set of axes - block axes and axes from compatible columns from result pool
288
290
  const compatibleLabels = (columns.getColumns((spec) => !isHiddenFromGraphColumn(spec) && spec.axesSpec.some((axisSpec) => {
289
291
  const axisId = getAxisId(axisSpec);
290
- return Array.from(allAxes.values()).some((selectorAxisSpec) => matchAxisId(getAxisId(selectorAxisSpec), axisId));
292
+ return allAxesArr.some((selectorAxisSpec) => matchAxisId(getAxisId(selectorAxisSpec), axisId));
291
293
  }), { dontWaitAllData: true, overrideLabelAnnotation: false }) ?? []).filter((column) => isLabelColumn(column.spec));
292
294
 
293
295
  // if at least one column is not yet ready, we can't show the graph
@@ -23,7 +23,7 @@ export type FilterUi = FilterSpec<Extract<
23
23
  | 'isNA'
24
24
  | 'isNotNA';
25
25
  }
26
- >, { id?: number; name?: string; isExpanded?: boolean }>;
26
+ >, { id: number; name?: string; isExpanded?: boolean }>;
27
27
 
28
28
  export type FilterUiType = Exclude<FilterUi, { type: undefined }>['type'];
29
29
 
package/src/render/api.ts CHANGED
@@ -55,7 +55,7 @@ import type { APColumnSelectorWithSplit } from './util/split_selectors';
55
55
  import { patchInSetFilters } from './util/pframe_upgraders';
56
56
  import { allPColumnsReady } from './util/pcolumn_data';
57
57
 
58
- export type PColumnDataUniversal = TreeNodeAccessor | DataInfo<TreeNodeAccessor> | PColumnValues;
58
+ export type PColumnDataUniversal<TreeEntry = TreeNodeAccessor> = TreeEntry | DataInfo<TreeEntry> | PColumnValues;
59
59
 
60
60
  /**
61
61
  * Helper function to match domain objects
@@ -619,7 +619,7 @@ export class RenderCtx<Args, UiState> {
619
619
  }
620
620
 
621
621
  // TODO remove all non-PColumn fields
622
- public createPFrame(def: PFrameDef<PColumnDataUniversal>): PFrameHandle | undefined {
622
+ public createPFrame(def: PFrameDef<PColumn<PColumnDataUniversal>>): PFrameHandle | undefined {
623
623
  this.verifyInlineAndExplicitColumnsSupport(def);
624
624
  if (!allPColumnsReady(def)) return undefined;
625
625
  return this.ctx.createPFrame(
@@ -143,7 +143,7 @@ export interface GlobalCfgRenderCtxMethods<AHandle = AccessorHandle, FHandle = F
143
143
  // PFrame / PTable
144
144
  //
145
145
 
146
- createPFrame(def: PFrameDef<AHandle | PColumnValues | DataInfo<AHandle>>): PFrameHandle;
146
+ createPFrame(def: PFrameDef<PColumn<AHandle | PColumnValues | DataInfo<AHandle>>>): PFrameHandle;
147
147
 
148
148
  createPTable(def: PTableDef<PColumn<AHandle | PColumnValues | DataInfo<AHandle>>>): PTableHandle;
149
149