@platforma-sdk/model 1.45.42 → 1.45.45

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 (67) hide show
  1. package/dist/annotations/converter.cjs +30 -14
  2. package/dist/annotations/converter.cjs.map +1 -1
  3. package/dist/annotations/converter.d.ts.map +1 -1
  4. package/dist/annotations/converter.js +30 -14
  5. package/dist/annotations/converter.js.map +1 -1
  6. package/dist/components/PFrameForGraphs.cjs +12 -27
  7. package/dist/components/PFrameForGraphs.cjs.map +1 -1
  8. package/dist/components/PFrameForGraphs.d.ts +4 -3
  9. package/dist/components/PFrameForGraphs.d.ts.map +1 -1
  10. package/dist/components/PFrameForGraphs.js +12 -28
  11. package/dist/components/PFrameForGraphs.js.map +1 -1
  12. package/dist/filters/converter.cjs +4 -2
  13. package/dist/filters/converter.cjs.map +1 -1
  14. package/dist/filters/converter.d.ts.map +1 -1
  15. package/dist/filters/converter.js +4 -2
  16. package/dist/filters/converter.js.map +1 -1
  17. package/dist/filters/types.d.ts +1 -1
  18. package/dist/filters/types.d.ts.map +1 -1
  19. package/dist/index.cjs +10 -0
  20. package/dist/index.cjs.map +1 -1
  21. package/dist/index.d.ts +1 -0
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +2 -1
  24. package/dist/index.js.map +1 -1
  25. package/dist/internal.cjs.map +1 -1
  26. package/dist/internal.js.map +1 -1
  27. package/dist/package.json.cjs +1 -1
  28. package/dist/package.json.js +1 -1
  29. package/dist/pframe.cjs +11 -5
  30. package/dist/pframe.cjs.map +1 -1
  31. package/dist/pframe.d.ts +1 -0
  32. package/dist/pframe.d.ts.map +1 -1
  33. package/dist/pframe.js +11 -5
  34. package/dist/pframe.js.map +1 -1
  35. package/dist/pframe_utils/index.cjs +294 -0
  36. package/dist/pframe_utils/index.cjs.map +1 -0
  37. package/dist/pframe_utils/index.d.ts +48 -0
  38. package/dist/pframe_utils/index.d.ts.map +1 -0
  39. package/dist/pframe_utils/index.js +285 -0
  40. package/dist/pframe_utils/index.js.map +1 -0
  41. package/dist/render/api.cjs.map +1 -1
  42. package/dist/render/api.d.ts +2 -2
  43. package/dist/render/api.d.ts.map +1 -1
  44. package/dist/render/api.js.map +1 -1
  45. package/dist/render/util/column_collection.cjs.map +1 -1
  46. package/dist/render/util/column_collection.d.ts +11 -6
  47. package/dist/render/util/column_collection.d.ts.map +1 -1
  48. package/dist/render/util/column_collection.js.map +1 -1
  49. package/dist/render/util/pcolumn_data.cjs +10 -6
  50. package/dist/render/util/pcolumn_data.cjs.map +1 -1
  51. package/dist/render/util/pcolumn_data.d.ts +3 -3
  52. package/dist/render/util/pcolumn_data.d.ts.map +1 -1
  53. package/dist/render/util/pcolumn_data.js +10 -6
  54. package/dist/render/util/pcolumn_data.js.map +1 -1
  55. package/package.json +11 -10
  56. package/src/annotations/converter.ts +35 -15
  57. package/src/components/PFrameForGraphs.ts +19 -37
  58. package/src/filters/converter.ts +4 -1
  59. package/src/filters/types.ts +1 -1
  60. package/src/global.d.ts +2 -2
  61. package/src/index.ts +1 -0
  62. package/src/internal.ts +2 -2
  63. package/src/pframe.ts +12 -5
  64. package/src/pframe_utils/index.ts +442 -0
  65. package/src/render/api.ts +6 -4
  66. package/src/render/util/column_collection.ts +13 -5
  67. package/src/render/util/pcolumn_data.ts +15 -10
@@ -3,21 +3,37 @@
3
3
  var ptablerExpressionJs = require('@milaboratories/ptabler-expression-js');
4
4
  var converter = require('../filters/converter.cjs');
5
5
 
6
- function convertFilterSpecsToExpressionSpecs(annotationsUI) {
7
- return annotationsUI
8
- .filter((annotation) => {
9
- // No need to convert empty steps
10
- if (annotation.filter.type == null) {
11
- return false;
12
- }
13
- if (annotation.filter.type === 'or') {
14
- return annotation.filter.filters.length > 0;
15
- }
16
- if (annotation.filter.type === 'and') {
17
- return annotation.filter.filters.length > 0;
18
- }
6
+ function filterPredicate(item) {
7
+ // No need to convert empty steps
8
+ if (item.type == null) {
19
9
  return false;
20
- })
10
+ }
11
+ if (item.type === 'or') {
12
+ return item.filters.length > 0;
13
+ }
14
+ if (item.type === 'and') {
15
+ return item.filters.length > 0;
16
+ }
17
+ return true;
18
+ }
19
+ function filterEmptyPeaces(item) {
20
+ if (item.type === 'or' || item.type === 'and') {
21
+ const filtered = item.filters
22
+ .map(filterEmptyPeaces)
23
+ .filter(filterPredicate);
24
+ return {
25
+ ...item,
26
+ filters: filtered,
27
+ };
28
+ }
29
+ return item;
30
+ }
31
+ function convertFilterSpecsToExpressionSpecs(annotationsUI) {
32
+ const validAnnotationsUI = annotationsUI.map((step) => ({
33
+ label: step.label,
34
+ filter: filterEmptyPeaces(step.filter),
35
+ }));
36
+ return validAnnotationsUI
21
37
  .map((step) => ({
22
38
  type: 'alias',
23
39
  name: step.label.trim(),
@@ -1 +1 @@
1
- {"version":3,"file":"converter.cjs","sources":["../../src/annotations/converter.ts"],"sourcesContent":["import { when } from '@milaboratories/ptabler-expression-js';\nimport { convertFilterUiToExpressionImpl } from '../filters/converter';\nimport type { ExpressionSpec, FilterSpecUi } from './types';\n\nexport function convertFilterSpecsToExpressionSpecs(annotationsUI: FilterSpecUi[]): ExpressionSpec[] {\n return annotationsUI\n .filter((annotation) => {\n // No need to convert empty steps\n if (annotation.filter.type == null) {\n return false;\n }\n\n if (annotation.filter.type === 'or') {\n return annotation.filter.filters.length > 0;\n }\n\n if (annotation.filter.type === 'and') {\n return annotation.filter.filters.length > 0;\n }\n\n return false;\n })\n .map((step): ExpressionSpec => ({\n type: 'alias',\n name: step.label.trim(),\n value: when(convertFilterUiToExpressionImpl(step.filter)).then(true).otherwise(false).toJSON(),\n }));\n}\n"],"names":["when","convertFilterUiToExpressionImpl"],"mappings":";;;;;AAIM,SAAU,mCAAmC,CAAC,aAA6B,EAAA;AAC/E,IAAA,OAAO;AACJ,SAAA,MAAM,CAAC,CAAC,UAAU,KAAI;;QAErB,IAAI,UAAU,CAAC,MAAM,CAAC,IAAI,IAAI,IAAI,EAAE;AAClC,YAAA,OAAO,KAAK;QACd;QAEA,IAAI,UAAU,CAAC,MAAM,CAAC,IAAI,KAAK,IAAI,EAAE;YACnC,OAAO,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC;QAC7C;QAEA,IAAI,UAAU,CAAC,MAAM,CAAC,IAAI,KAAK,KAAK,EAAE;YACpC,OAAO,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC;QAC7C;AAEA,QAAA,OAAO,KAAK;AACd,IAAA,CAAC;AACA,SAAA,GAAG,CAAC,CAAC,IAAI,MAAsB;AAC9B,QAAA,IAAI,EAAE,OAAO;AACb,QAAA,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE;QACvB,KAAK,EAAEA,wBAAI,CAACC,yCAA+B,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE;AAC/F,KAAA,CAAC,CAAC;AACP;;;;"}
1
+ {"version":3,"file":"converter.cjs","sources":["../../src/annotations/converter.ts"],"sourcesContent":["import { when } from '@milaboratories/ptabler-expression-js';\nimport type { FilterSpec } from '../filters';\nimport { convertFilterUiToExpressionImpl } from '../filters/converter';\nimport type { ExpressionSpec, FilterSpecUi } from './types';\n\nfunction filterPredicate(item: FilterSpec): boolean {\n // No need to convert empty steps\n if (item.type == null) {\n return false;\n }\n\n if (item.type === 'or') {\n return item.filters.length > 0;\n }\n\n if (item.type === 'and') {\n return item.filters.length > 0;\n }\n\n return true;\n}\n\nfunction filterEmptyPeaces(item: FilterSpec): FilterSpec {\n if (item.type === 'or' || item.type === 'and') {\n const filtered = item.filters\n .map(filterEmptyPeaces)\n .filter(filterPredicate);\n return {\n ...item,\n filters: filtered,\n };\n }\n\n return item;\n}\n\nexport function convertFilterSpecsToExpressionSpecs(annotationsUI: FilterSpecUi[]): ExpressionSpec[] {\n const validAnnotationsUI = annotationsUI.map((step) => ({\n label: step.label,\n filter: filterEmptyPeaces(step.filter),\n }));\n return validAnnotationsUI\n .map((step): ExpressionSpec => ({\n type: 'alias',\n name: step.label.trim(),\n value: when(convertFilterUiToExpressionImpl(step.filter)).then(true).otherwise(false).toJSON(),\n }));\n}\n"],"names":["when","convertFilterUiToExpressionImpl"],"mappings":";;;;;AAKA,SAAS,eAAe,CAAC,IAAgB,EAAA;;AAEvC,IAAA,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,EAAE;AACrB,QAAA,OAAO,KAAK;IACd;AAEA,IAAA,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,EAAE;AACtB,QAAA,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC;IAChC;AAEA,IAAA,IAAI,IAAI,CAAC,IAAI,KAAK,KAAK,EAAE;AACvB,QAAA,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC;IAChC;AAEA,IAAA,OAAO,IAAI;AACb;AAEA,SAAS,iBAAiB,CAAC,IAAgB,EAAA;AACzC,IAAA,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,IAAI,IAAI,CAAC,IAAI,KAAK,KAAK,EAAE;AAC7C,QAAA,MAAM,QAAQ,GAAG,IAAI,CAAC;aACnB,GAAG,CAAC,iBAAiB;aACrB,MAAM,CAAC,eAAe,CAAC;QAC1B,OAAO;AACL,YAAA,GAAG,IAAI;AACP,YAAA,OAAO,EAAE,QAAQ;SAClB;IACH;AAEA,IAAA,OAAO,IAAI;AACb;AAEM,SAAU,mCAAmC,CAAC,aAA6B,EAAA;IAC/E,MAAM,kBAAkB,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,IAAI,MAAM;QACtD,KAAK,EAAE,IAAI,CAAC,KAAK;AACjB,QAAA,MAAM,EAAE,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC;AACvC,KAAA,CAAC,CAAC;AACH,IAAA,OAAO;AACJ,SAAA,GAAG,CAAC,CAAC,IAAI,MAAsB;AAC9B,QAAA,IAAI,EAAE,OAAO;AACb,QAAA,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE;QACvB,KAAK,EAAEA,wBAAI,CAACC,yCAA+B,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE;AAC/F,KAAA,CAAC,CAAC;AACP;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"converter.d.ts","sourceRoot":"","sources":["../../src/annotations/converter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5D,wBAAgB,mCAAmC,CAAC,aAAa,EAAE,YAAY,EAAE,GAAG,cAAc,EAAE,CAuBnG"}
1
+ {"version":3,"file":"converter.d.ts","sourceRoot":"","sources":["../../src/annotations/converter.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAiC5D,wBAAgB,mCAAmC,CAAC,aAAa,EAAE,YAAY,EAAE,GAAG,cAAc,EAAE,CAWnG"}
@@ -1,21 +1,37 @@
1
1
  import { when } from '@milaboratories/ptabler-expression-js';
2
2
  import { convertFilterUiToExpressionImpl } from '../filters/converter.js';
3
3
 
4
- function convertFilterSpecsToExpressionSpecs(annotationsUI) {
5
- return annotationsUI
6
- .filter((annotation) => {
7
- // No need to convert empty steps
8
- if (annotation.filter.type == null) {
9
- return false;
10
- }
11
- if (annotation.filter.type === 'or') {
12
- return annotation.filter.filters.length > 0;
13
- }
14
- if (annotation.filter.type === 'and') {
15
- return annotation.filter.filters.length > 0;
16
- }
4
+ function filterPredicate(item) {
5
+ // No need to convert empty steps
6
+ if (item.type == null) {
17
7
  return false;
18
- })
8
+ }
9
+ if (item.type === 'or') {
10
+ return item.filters.length > 0;
11
+ }
12
+ if (item.type === 'and') {
13
+ return item.filters.length > 0;
14
+ }
15
+ return true;
16
+ }
17
+ function filterEmptyPeaces(item) {
18
+ if (item.type === 'or' || item.type === 'and') {
19
+ const filtered = item.filters
20
+ .map(filterEmptyPeaces)
21
+ .filter(filterPredicate);
22
+ return {
23
+ ...item,
24
+ filters: filtered,
25
+ };
26
+ }
27
+ return item;
28
+ }
29
+ function convertFilterSpecsToExpressionSpecs(annotationsUI) {
30
+ const validAnnotationsUI = annotationsUI.map((step) => ({
31
+ label: step.label,
32
+ filter: filterEmptyPeaces(step.filter),
33
+ }));
34
+ return validAnnotationsUI
19
35
  .map((step) => ({
20
36
  type: 'alias',
21
37
  name: step.label.trim(),
@@ -1 +1 @@
1
- {"version":3,"file":"converter.js","sources":["../../src/annotations/converter.ts"],"sourcesContent":["import { when } from '@milaboratories/ptabler-expression-js';\nimport { convertFilterUiToExpressionImpl } from '../filters/converter';\nimport type { ExpressionSpec, FilterSpecUi } from './types';\n\nexport function convertFilterSpecsToExpressionSpecs(annotationsUI: FilterSpecUi[]): ExpressionSpec[] {\n return annotationsUI\n .filter((annotation) => {\n // No need to convert empty steps\n if (annotation.filter.type == null) {\n return false;\n }\n\n if (annotation.filter.type === 'or') {\n return annotation.filter.filters.length > 0;\n }\n\n if (annotation.filter.type === 'and') {\n return annotation.filter.filters.length > 0;\n }\n\n return false;\n })\n .map((step): ExpressionSpec => ({\n type: 'alias',\n name: step.label.trim(),\n value: when(convertFilterUiToExpressionImpl(step.filter)).then(true).otherwise(false).toJSON(),\n }));\n}\n"],"names":[],"mappings":";;;AAIM,SAAU,mCAAmC,CAAC,aAA6B,EAAA;AAC/E,IAAA,OAAO;AACJ,SAAA,MAAM,CAAC,CAAC,UAAU,KAAI;;QAErB,IAAI,UAAU,CAAC,MAAM,CAAC,IAAI,IAAI,IAAI,EAAE;AAClC,YAAA,OAAO,KAAK;QACd;QAEA,IAAI,UAAU,CAAC,MAAM,CAAC,IAAI,KAAK,IAAI,EAAE;YACnC,OAAO,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC;QAC7C;QAEA,IAAI,UAAU,CAAC,MAAM,CAAC,IAAI,KAAK,KAAK,EAAE;YACpC,OAAO,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC;QAC7C;AAEA,QAAA,OAAO,KAAK;AACd,IAAA,CAAC;AACA,SAAA,GAAG,CAAC,CAAC,IAAI,MAAsB;AAC9B,QAAA,IAAI,EAAE,OAAO;AACb,QAAA,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE;QACvB,KAAK,EAAE,IAAI,CAAC,+BAA+B,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE;AAC/F,KAAA,CAAC,CAAC;AACP;;;;"}
1
+ {"version":3,"file":"converter.js","sources":["../../src/annotations/converter.ts"],"sourcesContent":["import { when } from '@milaboratories/ptabler-expression-js';\nimport type { FilterSpec } from '../filters';\nimport { convertFilterUiToExpressionImpl } from '../filters/converter';\nimport type { ExpressionSpec, FilterSpecUi } from './types';\n\nfunction filterPredicate(item: FilterSpec): boolean {\n // No need to convert empty steps\n if (item.type == null) {\n return false;\n }\n\n if (item.type === 'or') {\n return item.filters.length > 0;\n }\n\n if (item.type === 'and') {\n return item.filters.length > 0;\n }\n\n return true;\n}\n\nfunction filterEmptyPeaces(item: FilterSpec): FilterSpec {\n if (item.type === 'or' || item.type === 'and') {\n const filtered = item.filters\n .map(filterEmptyPeaces)\n .filter(filterPredicate);\n return {\n ...item,\n filters: filtered,\n };\n }\n\n return item;\n}\n\nexport function convertFilterSpecsToExpressionSpecs(annotationsUI: FilterSpecUi[]): ExpressionSpec[] {\n const validAnnotationsUI = annotationsUI.map((step) => ({\n label: step.label,\n filter: filterEmptyPeaces(step.filter),\n }));\n return validAnnotationsUI\n .map((step): ExpressionSpec => ({\n type: 'alias',\n name: step.label.trim(),\n value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AC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE;AAC/F,KAAA,CAAC,CAAC;AACP;;;;"}
@@ -4,7 +4,6 @@ var plModelCommon = require('@milaboratories/pl-model-common');
4
4
  require('canonicalize');
5
5
  var column_collection = require('../render/util/column_collection.cjs');
6
6
  require('../render/util/label.cjs');
7
- var pcolumn_data = require('../render/util/pcolumn_data.cjs');
8
7
 
9
8
  /** Create id for column copy with added keys in axes domains */
10
9
  const colId = (id, domains) => {
@@ -37,6 +36,9 @@ function getKeysCombinations(idsLists) {
37
36
  function isHiddenFromGraphColumn(column) {
38
37
  return !!plModelCommon.readAnnotationJson(column, plModelCommon.Annotation.HideDataFromGraphs);
39
38
  }
39
+ function isHiddenFromUIColumn(column) {
40
+ return !!plModelCommon.readAnnotationJson(column, plModelCommon.Annotation.HideDataFromUi);
41
+ }
40
42
  function getAvailableWithLinkersAxes(linkerColumns, blockAxes) {
41
43
  const linkerMap = plModelCommon.LinkerMap.fromColumns(linkerColumns.map(plModelCommon.getColumnIdAndSpec));
42
44
  const startKeys = [];
@@ -56,11 +58,7 @@ function getAvailableWithLinkersAxes(linkerColumns, blockAxes) {
56
58
  }
57
59
  /** Add columns with fully compatible axes created from partial compatible ones */
58
60
  function enrichCompatible(blockAxes, columns) {
59
- const result = [];
60
- columns.forEach((column) => {
61
- result.push(...getAdditionalColumnsForColumn(blockAxes, column));
62
- });
63
- return result;
61
+ return columns.flatMap((column) => getAdditionalColumnsForColumn(blockAxes, column));
64
62
  }
65
63
  function getAdditionalColumnsForColumn(blockAxes, column) {
66
64
  const columnAxesIds = column.spec.axesSpec.map(plModelCommon.getAxisId);
@@ -122,6 +120,7 @@ function getAdditionalColumnsForColumn(blockAxes, column) {
122
120
  annotations[plModelCommon.Annotation.Label] = label && labelDomainPart ? label + ' / ' + labelDomainPart : label + labelDomainPart;
123
121
  }
124
122
  return {
123
+ ...column,
125
124
  id: id,
126
125
  spec: {
127
126
  ...column.spec,
@@ -131,7 +130,6 @@ function getAdditionalColumnsForColumn(blockAxes, column) {
131
130
  })),
132
131
  annotations,
133
132
  },
134
- data: column.data,
135
133
  };
136
134
  });
137
135
  return [column, ...additionalColumns];
@@ -149,15 +147,12 @@ function getAdditionalColumnsForColumn(blockAxes, column) {
149
147
  and modified label (with added domain values in case if more than one copy with different domains exist).
150
148
  */
151
149
  function createPFrameForGraphs(ctx, blockColumns) {
150
+ const suitableSpec = (spec) => !isHiddenFromUIColumn(spec) && !isHiddenFromGraphColumn(spec);
152
151
  // if current block doesn't produce own columns then use all columns from result pool
153
152
  if (!blockColumns) {
154
153
  const columns = new column_collection.PColumnCollection();
155
154
  columns.addColumnProvider(ctx.resultPool);
156
- const allColumns = columns.getColumns((spec) => !isHiddenFromGraphColumn(spec), { dontWaitAllData: true, overrideLabelAnnotation: false }) ?? [];
157
- // if at least one column is not yet ready, we can't show the graph
158
- if (!pcolumn_data.allPColumnsReady(allColumns)) {
159
- return undefined;
160
- }
155
+ const allColumns = columns.getUniversalEntries(suitableSpec, { dontWaitAllData: true, overrideLabelAnnotation: false }) ?? [];
161
156
  const allAxes = new Map(allColumns
162
157
  .flatMap((column) => plModelCommon.getNormalizedAxesList(column.spec.axesSpec))
163
158
  .map((axisSpec) => {
@@ -168,9 +163,6 @@ function createPFrameForGraphs(ctx, blockColumns) {
168
163
  const extendedColumns = enrichCompatible(allAxes, allColumns);
169
164
  return ctx.createPFrame(extendedColumns);
170
165
  }
171
- if (!pcolumn_data.allPColumnsReady(blockColumns)) {
172
- return undefined;
173
- }
174
166
  // if current block has its own columns then take from result pool only compatible with them
175
167
  const columns = new column_collection.PColumnCollection();
176
168
  columns.addColumnProvider(ctx.resultPool);
@@ -187,7 +179,7 @@ function createPFrameForGraphs(ctx, blockColumns) {
187
179
  }
188
180
  }
189
181
  // all linker columns always go to pFrame - even it's impossible to use some of them they all are hidden
190
- const linkerColumns = columns.getColumns((spec) => plModelCommon.isLinkerColumn(spec)) ?? [];
182
+ const linkerColumns = columns.getUniversalEntries((spec) => suitableSpec(spec) && plModelCommon.isLinkerColumn(spec)) ?? [];
191
183
  const availableWithLinkersAxes = getAvailableWithLinkersAxes(linkerColumns, blockAxes);
192
184
  // all possible axes from connected linkers
193
185
  for (const item of availableWithLinkersAxes) {
@@ -196,14 +188,10 @@ function createPFrameForGraphs(ctx, blockColumns) {
196
188
  }
197
189
  const blockAxesArr = Array.from(blockAxes.values());
198
190
  // all compatible with block columns but without label columns
199
- let compatibleWithoutLabels = (columns.getColumns((spec) => !isHiddenFromGraphColumn(spec) && spec.axesSpec.some((axisSpec) => {
191
+ let compatibleWithoutLabels = (columns.getUniversalEntries((spec) => suitableSpec(spec) && spec.axesSpec.some((axisSpec) => {
200
192
  const axisId = plModelCommon.getAxisId(axisSpec);
201
193
  return blockAxesArr.some((selectorAxisSpec) => plModelCommon.matchAxisId(plModelCommon.getAxisId(selectorAxisSpec), axisId));
202
194
  }), { dontWaitAllData: true, overrideLabelAnnotation: false }) ?? []).filter((column) => !plModelCommon.isLabelColumn(column.spec));
203
- // if at least one column is not yet ready, we can't show the graph
204
- if (!pcolumn_data.allPColumnsReady(compatibleWithoutLabels)) {
205
- return undefined;
206
- }
207
195
  // extend axes set for label columns request
208
196
  for (const c of compatibleWithoutLabels) {
209
197
  for (const spec of plModelCommon.getNormalizedAxesList(c.spec.axesSpec)) {
@@ -213,19 +201,15 @@ function createPFrameForGraphs(ctx, blockColumns) {
213
201
  }
214
202
  const allAxesArr = Array.from(allAxes.values());
215
203
  // 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)
216
- compatibleWithoutLabels = (columns.getColumns((spec) => !isHiddenFromGraphColumn(spec) && spec.axesSpec.every((axisSpec) => {
204
+ compatibleWithoutLabels = (columns.getUniversalEntries((spec) => suitableSpec(spec) && spec.axesSpec.every((axisSpec) => {
217
205
  const axisId = plModelCommon.getAxisId(axisSpec);
218
206
  return allAxesArr.some((selectorAxisSpec) => plModelCommon.matchAxisId(plModelCommon.getAxisId(selectorAxisSpec), axisId));
219
207
  }), { dontWaitAllData: true, overrideLabelAnnotation: false }) ?? []).filter((column) => !plModelCommon.isLabelColumn(column.spec));
220
208
  // label columns must be compatible with full set of axes - block axes and axes from compatible columns from result pool
221
- const compatibleLabels = (columns.getColumns((spec) => !isHiddenFromGraphColumn(spec) && spec.axesSpec.some((axisSpec) => {
209
+ const compatibleLabels = (columns.getUniversalEntries((spec) => suitableSpec(spec) && spec.axesSpec.some((axisSpec) => {
222
210
  const axisId = plModelCommon.getAxisId(axisSpec);
223
211
  return allAxesArr.some((selectorAxisSpec) => plModelCommon.matchAxisId(plModelCommon.getAxisId(selectorAxisSpec), axisId));
224
212
  }), { dontWaitAllData: true, overrideLabelAnnotation: false }) ?? []).filter((column) => plModelCommon.isLabelColumn(column.spec));
225
- // if at least one column is not yet ready, we can't show the graph
226
- if (!pcolumn_data.allPColumnsReady(compatibleLabels)) {
227
- return undefined;
228
- }
229
213
  const compatible = [...compatibleWithoutLabels, ...compatibleLabels];
230
214
  // additional columns are duplicates with extra fields in domains for compatibility if there are ones with partial match
231
215
  const extendedColumns = enrichCompatible(blockAxes, compatible);
@@ -236,4 +220,5 @@ exports.createPFrameForGraphs = createPFrameForGraphs;
236
220
  exports.enrichCompatible = enrichCompatible;
237
221
  exports.getAvailableWithLinkersAxes = getAvailableWithLinkersAxes;
238
222
  exports.isHiddenFromGraphColumn = isHiddenFromGraphColumn;
223
+ exports.isHiddenFromUIColumn = isHiddenFromUIColumn;
239
224
  //# sourceMappingURL=PFrameForGraphs.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"PFrameForGraphs.cjs","sources":["../../src/components/PFrameForGraphs.ts"],"sourcesContent":["import type {\n AxisId,\n AxisSpecNormalized,\n CanonicalizedJson,\n PColumn,\n PColumnSpec,\n PFrameHandle,\n PObjectId,\n} from '@milaboratories/pl-model-common';\nimport {\n Annotation,\n canonicalizeJson,\n getArrayFromAxisTree,\n getAxesTree,\n getAxisId,\n getColumnIdAndSpec,\n getNormalizedAxesList,\n isLabelColumn,\n isLinkerColumn,\n LinkerMap,\n matchAxisId,\n readAnnotation,\n readAnnotationJson,\n stringifyJson,\n} from '@milaboratories/pl-model-common';\nimport type { PColumnDataUniversal, RenderCtx } from '../render';\nimport { allPColumnsReady, PColumnCollection } from '../render';\n\n/** Create id for column copy with added keys in axes domains */\nconst colId = (id: PObjectId, domains: (Record<string, string> | undefined)[]) => {\n let wid = id.toString();\n domains?.forEach((domain) => {\n if (domain) {\n for (const [k, v] of Object.entries(domain)) {\n wid += k;\n wid += v;\n }\n }\n });\n return wid;\n};\n\n/** All combinations with 1 key from each list */\nfunction getKeysCombinations(idsLists: AxisId[][]) {\n if (!idsLists.length) {\n return [];\n }\n let result: AxisId[][] = [[]];\n idsLists.forEach((list) => {\n const nextResult: AxisId[][] = [];\n list.forEach((key) => {\n nextResult.push(...result.map((resultItem) => [...resultItem, key]));\n });\n result = nextResult;\n });\n return result;\n}\n\nexport function isHiddenFromGraphColumn(column: PColumnSpec): boolean {\n return !!readAnnotationJson(column, Annotation.HideDataFromGraphs);\n}\n\ntype AxesVault = Map<CanonicalizedJson<AxisId>, AxisSpecNormalized>;\n\nexport function getAvailableWithLinkersAxes(\n linkerColumns: PColumn<PColumnDataUniversal>[],\n blockAxes: AxesVault,\n): AxesVault {\n const linkerMap = LinkerMap.fromColumns(linkerColumns.map(getColumnIdAndSpec));\n const startKeys: CanonicalizedJson<AxisId[]>[] = [];\n const blockAxesGrouped: AxisId[][] = [...blockAxes.values()].map((axis) => getArrayFromAxisTree(getAxesTree(axis)).map(getAxisId));\n\n for (const axesGroupBlock of blockAxesGrouped) {\n const matched = linkerMap.keyAxesIds.find(\n (keyIds: AxisId[]) => keyIds.every(\n (keySourceAxis) => axesGroupBlock.find((axisSpecFromBlock) => matchAxisId(axisSpecFromBlock, keySourceAxis)),\n ),\n );\n if (matched) {\n startKeys.push(canonicalizeJson(matched)); // linker column can contain fewer domains than in block's columns, it's fixed on next step in enrichCompatible\n }\n }\n\n const availableKeys = linkerMap.searchAvailableAxesKeys(startKeys);\n const availableAxes = linkerMap.getAxesListFromKeysList([...availableKeys]);\n\n return new Map(availableAxes.map((axisSpec) => {\n const id = getAxisId(axisSpec);\n return [canonicalizeJson(id), axisSpec];\n }));\n}\n/** Add columns with fully compatible axes created from partial compatible ones */\nexport function enrichCompatible(blockAxes: AxesVault, columns: PColumn<PColumnDataUniversal>[]) {\n const result: PColumn<PColumnDataUniversal>[] = [];\n columns.forEach((column) => {\n result.push(...getAdditionalColumnsForColumn(blockAxes, column));\n });\n return result;\n}\n\nfunction getAdditionalColumnsForColumn(\n blockAxes: AxesVault,\n column: PColumn<PColumnDataUniversal>,\n): PColumn<PColumnDataUniversal>[] {\n const columnAxesIds = column.spec.axesSpec.map(getAxisId);\n\n if (columnAxesIds.every((id) => blockAxes.has(canonicalizeJson(id)))) {\n return [column]; // the column is compatible with its own domains without modifications\n }\n\n // options with different possible domains for every axis of secondary column\n const secondaryIdsOptions = columnAxesIds.map((id) => {\n const result = [];\n for (const [_, mainId] of blockAxes) {\n if (matchAxisId(mainId, id) && !matchAxisId(id, mainId)) {\n result.push(mainId);\n }\n }\n return result;\n });\n // all possible combinations of axes with added domains\n const secondaryIdsVariants = getKeysCombinations(secondaryIdsOptions);\n\n // sets of added to column domain fields\n const allAddedDomainValues = new Set<string>();\n const addedNotToAllVariantsDomainValues = new Set<string>();\n const addedByVariantsDomainValues = secondaryIdsVariants.map((idsList) => {\n const addedSet = new Set<string>();\n idsList.map((axisId, idx) => {\n const d1 = column.spec.axesSpec[idx].domain;\n const d2 = axisId.domain;\n Object.entries(d2 ?? {}).forEach(([key, value]) => {\n if (d1?.[key] === undefined) {\n const item = JSON.stringify([key, value]);\n addedSet.add(item);\n allAddedDomainValues.add(item);\n }\n });\n return ({\n ...axisId,\n annotations: column.spec.axesSpec[idx].annotations,\n });\n });\n return addedSet;\n });\n [...allAddedDomainValues].forEach((addedPart) => {\n if (addedByVariantsDomainValues.some((s) => !s.has(addedPart))) {\n addedNotToAllVariantsDomainValues.add(addedPart);\n }\n });\n\n const additionalColumns = secondaryIdsVariants.map((idsList, idx) => {\n const id = colId(column.id, idsList.map((id) => id.domain));\n\n const label = readAnnotation(column.spec, Annotation.Label) ?? '';\n const labelDomainPart = ([...addedByVariantsDomainValues[idx]])\n .filter((str) => addedNotToAllVariantsDomainValues.has(str))\n .sort()\n .map((v) => JSON.parse(v)?.[1]) // use in labels only domain values, but sort them by key to save the same order in all column variants\n .join(' / ');\n\n const annotations: Annotation = {\n ...column.spec.annotations,\n [Annotation.Graph.IsVirtual]: stringifyJson(true),\n };\n if (label || labelDomainPart) {\n annotations[Annotation.Label] = label && labelDomainPart ? label + ' / ' + labelDomainPart : label + labelDomainPart;\n }\n\n return {\n id: id as PObjectId,\n spec: {\n ...column.spec,\n axesSpec: idsList.map((axisId, idx) => ({\n ...axisId,\n annotations: column.spec.axesSpec[idx].annotations,\n })),\n annotations,\n },\n data: column.data,\n };\n });\n\n return [column, ...additionalColumns];\n}\n\n/**\n The aim of createPFrameForGraphs: to create pframe with block’s columns and all compatible columns from result pool\n (including linker columns and all label columns).\n Block’s columns are added to pframe as is.\n Other columns are added basing on set of axes of block’s columns, considering available with linker columns.\n Compatible columns must have at least one axis from block’s axes set. This axis of the compatible column from\n result pool must satisfy matchAxisId (it can have less domain keys than in block’s axis, but without conflicting values\n among existing ones).\n In requests to pframe (calculateTableData) columns must have strictly the same axes. For compatibility in case\n of partially matched axis we add to pframe a copy of this column with modified axis (with filled missed domains)\n and modified label (with added domain values in case if more than one copy with different domains exist).\n */\nexport function createPFrameForGraphs<A, U>(\n ctx: RenderCtx<A, U>,\n blockColumns?: PColumn<PColumnDataUniversal>[],\n): PFrameHandle | undefined {\n // if current block doesn't produce own columns then use all columns from result pool\n if (!blockColumns) {\n const columns = new PColumnCollection();\n columns.addColumnProvider(ctx.resultPool);\n\n const allColumns = columns.getColumns((spec) => !isHiddenFromGraphColumn(spec), { dontWaitAllData: true, overrideLabelAnnotation: false }) ?? [];\n // if at least one column is not yet ready, we can't show the graph\n if (!allPColumnsReady(allColumns)) {\n return undefined;\n }\n\n const allAxes: AxesVault = new Map(allColumns\n .flatMap((column) => getNormalizedAxesList(column.spec.axesSpec))\n .map((axisSpec) => {\n const axisId = getAxisId(axisSpec);\n return [canonicalizeJson(axisId), axisSpec];\n }));\n\n // additional columns are duplicates with extra fields in domains for compatibility if there are ones with partial match\n const extendedColumns = enrichCompatible(allAxes, allColumns);\n\n return ctx.createPFrame(extendedColumns);\n };\n\n if (!allPColumnsReady(blockColumns)) {\n return undefined;\n }\n\n // if current block has its own columns then take from result pool only compatible with them\n const columns = new PColumnCollection();\n columns.addColumnProvider(ctx.resultPool);\n columns.addColumns(blockColumns);\n\n // all possible axes from block columns\n const blockAxes: AxesVault = new Map();\n // axes from block columns and compatible result pool columns\n const allAxes: AxesVault = new Map();\n for (const c of blockColumns) {\n for (const spec of getNormalizedAxesList(c.spec.axesSpec)) {\n const aid = getAxisId(spec);\n blockAxes.set(canonicalizeJson(aid), spec);\n allAxes.set(canonicalizeJson(aid), spec);\n }\n }\n\n // all linker columns always go to pFrame - even it's impossible to use some of them they all are hidden\n const linkerColumns = columns.getColumns((spec) => isLinkerColumn(spec)) ?? [];\n const availableWithLinkersAxes = getAvailableWithLinkersAxes(linkerColumns, blockAxes);\n\n // all possible axes from connected linkers\n for (const item of availableWithLinkersAxes) {\n blockAxes.set(...item);\n allAxes.set(...item);\n }\n\n const blockAxesArr = Array.from(blockAxes.values());\n // all compatible with block columns but without label columns\n let compatibleWithoutLabels = (columns.getColumns((spec) => !isHiddenFromGraphColumn(spec) && spec.axesSpec.some((axisSpec) => {\n const axisId = getAxisId(axisSpec);\n return blockAxesArr.some((selectorAxisSpec) => matchAxisId(getAxisId(selectorAxisSpec), axisId));\n }), { dontWaitAllData: true, overrideLabelAnnotation: false }) ?? []).filter((column) => !isLabelColumn(column.spec));\n\n // if at least one column is not yet ready, we can't show the graph\n if (!allPColumnsReady(compatibleWithoutLabels)) {\n return undefined;\n }\n\n // extend axes set for label columns request\n for (const c of compatibleWithoutLabels) {\n for (const spec of getNormalizedAxesList(c.spec.axesSpec)) {\n const aid = getAxisId(spec);\n allAxes.set(canonicalizeJson(aid), spec);\n }\n }\n\n const allAxesArr = Array.from(allAxes.values());\n // 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)\n compatibleWithoutLabels = (columns.getColumns((spec) => !isHiddenFromGraphColumn(spec) && spec.axesSpec.every((axisSpec) => {\n const axisId = getAxisId(axisSpec);\n return allAxesArr.some((selectorAxisSpec) => matchAxisId(getAxisId(selectorAxisSpec), axisId));\n }), { dontWaitAllData: true, overrideLabelAnnotation: false }) ?? []).filter((column) => !isLabelColumn(column.spec));\n\n // label columns must be compatible with full set of axes - block axes and axes from compatible columns from result pool\n const compatibleLabels = (columns.getColumns((spec) => !isHiddenFromGraphColumn(spec) && spec.axesSpec.some((axisSpec) => {\n const axisId = getAxisId(axisSpec);\n return allAxesArr.some((selectorAxisSpec) => matchAxisId(getAxisId(selectorAxisSpec), axisId));\n }), { dontWaitAllData: true, overrideLabelAnnotation: false }) ?? []).filter((column) => isLabelColumn(column.spec));\n\n // if at least one column is not yet ready, we can't show the graph\n if (!allPColumnsReady(compatibleLabels)) {\n return undefined;\n }\n\n const compatible = [...compatibleWithoutLabels, ...compatibleLabels];\n\n // additional columns are duplicates with extra fields in domains for compatibility if there are ones with partial match\n const extendedColumns = enrichCompatible(blockAxes, compatible);\n\n return ctx.createPFrame(extendedColumns);\n}\n"],"names":["readAnnotationJson","Annotation","LinkerMap","getColumnIdAndSpec","getArrayFromAxisTree","getAxesTree","getAxisId","matchAxisId","canonicalizeJson","readAnnotation","stringifyJson","PColumnCollection","allPColumnsReady","getNormalizedAxesList","isLinkerColumn","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MAAM,GAAGT,uBAAS,CAAC,QAAQ,CAAC;AAClC,QAAA,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC,gBAAgB,KAAKC,yBAAW,CAACD,uBAAS,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC,CAAC;AAChG,IAAA,CAAC,CAAC,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,uBAAuB,EAAE,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE,MAAM,CAAC,CAAC,MAAM,KAAKS,2BAAa,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;;AAGpH,IAAA,IAAI,CAACH,6BAAgB,CAAC,gBAAgB,CAAC,EAAE;AACvC,QAAA,OAAO,SAAS;IAClB;IAEA,MAAM,UAAU,GAAG,CAAC,GAAG,uBAAuB,EAAE,GAAG,gBAAgB,CAAC;;IAGpE,MAAM,eAAe,GAAG,gBAAgB,CAAC,SAAS,EAAE,UAAU,CAAC;AAE/D,IAAA,OAAO,GAAG,CAAC,YAAY,CAAC,eAAe,CAAC;AAC1C;;;;;;;"}
1
+ {"version":3,"file":"PFrameForGraphs.cjs","sources":["../../src/components/PFrameForGraphs.ts"],"sourcesContent":["import type {\n AxisId,\n AxisSpecNormalized,\n CanonicalizedJson,\n PColumn,\n PColumnSpec,\n PFrameHandle,\n PObjectId,\n} from '@milaboratories/pl-model-common';\nimport {\n Annotation,\n canonicalizeJson,\n getArrayFromAxisTree,\n getAxesTree,\n getAxisId,\n getColumnIdAndSpec,\n getNormalizedAxesList,\n isLabelColumn,\n isLinkerColumn,\n LinkerMap,\n matchAxisId,\n readAnnotation,\n readAnnotationJson,\n stringifyJson,\n} from '@milaboratories/pl-model-common';\nimport type { PColumnDataUniversal, PColumnEntryUniversal, PColumnEntryWithLabel, RenderCtx } from '../render';\nimport { PColumnCollection } from '../render';\n\n/** Create id for column copy with added keys in axes domains */\nconst colId = (id: PObjectId, domains: (Record<string, string> | undefined)[]) => {\n let wid = id.toString();\n domains?.forEach((domain) => {\n if (domain) {\n for (const [k, v] of Object.entries(domain)) {\n wid += k;\n wid += v;\n }\n }\n });\n return wid;\n};\n\n/** All combinations with 1 key from each list */\nfunction getKeysCombinations(idsLists: AxisId[][]) {\n if (!idsLists.length) {\n return [];\n }\n let result: AxisId[][] = [[]];\n idsLists.forEach((list) => {\n const nextResult: AxisId[][] = [];\n list.forEach((key) => {\n nextResult.push(...result.map((resultItem) => [...resultItem, key]));\n });\n result = nextResult;\n });\n return result;\n}\n\nexport function isHiddenFromGraphColumn(column: PColumnSpec): boolean {\n return !!readAnnotationJson(column, Annotation.HideDataFromGraphs);\n}\n\nexport function isHiddenFromUIColumn(column: PColumnSpec): boolean {\n return !!readAnnotationJson(column, Annotation.HideDataFromUi);\n}\n\ntype AxesVault = Map<CanonicalizedJson<AxisId>, AxisSpecNormalized>;\n\nexport function getAvailableWithLinkersAxes(\n linkerColumns: (PColumnEntryWithLabel | PColumnEntryUniversal)[],\n blockAxes: AxesVault,\n): AxesVault {\n const linkerMap = LinkerMap.fromColumns(linkerColumns.map(getColumnIdAndSpec));\n const startKeys: CanonicalizedJson<AxisId[]>[] = [];\n const blockAxesGrouped: AxisId[][] = [...blockAxes.values()].map((axis) => getArrayFromAxisTree(getAxesTree(axis)).map(getAxisId));\n\n for (const axesGroupBlock of blockAxesGrouped) {\n const matched = linkerMap.keyAxesIds.find(\n (keyIds: AxisId[]) => keyIds.every(\n (keySourceAxis) => axesGroupBlock.find((axisSpecFromBlock) => matchAxisId(axisSpecFromBlock, keySourceAxis)),\n ),\n );\n if (matched) {\n startKeys.push(canonicalizeJson(matched)); // linker column can contain fewer domains than in block's columns, it's fixed on next step in enrichCompatible\n }\n }\n\n const availableKeys = linkerMap.searchAvailableAxesKeys(startKeys);\n const availableAxes = linkerMap.getAxesListFromKeysList([...availableKeys]);\n\n return new Map(availableAxes.map((axisSpec) => {\n const id = getAxisId(axisSpec);\n return [canonicalizeJson(id), axisSpec];\n }));\n}\n/** Add columns with fully compatible axes created from partial compatible ones */\nexport function enrichCompatible<T extends Omit<PColumn<PColumnDataUniversal>, 'data'>>(blockAxes: AxesVault, columns: T[]): T[] {\n return columns.flatMap((column) => getAdditionalColumnsForColumn(blockAxes, column));\n}\n\nfunction getAdditionalColumnsForColumn<T extends Omit<PColumn<PColumnDataUniversal>, 'data'>>(\n blockAxes: AxesVault,\n column: T,\n): T[] {\n const columnAxesIds = column.spec.axesSpec.map(getAxisId);\n\n if (columnAxesIds.every((id) => blockAxes.has(canonicalizeJson(id)))) {\n return [column]; // the column is compatible with its own domains without modifications\n }\n\n // options with different possible domains for every axis of secondary column\n const secondaryIdsOptions = columnAxesIds.map((id) => {\n const result = [];\n for (const [_, mainId] of blockAxes) {\n if (matchAxisId(mainId, id) && !matchAxisId(id, mainId)) {\n result.push(mainId);\n }\n }\n return result;\n });\n // all possible combinations of axes with added domains\n const secondaryIdsVariants = getKeysCombinations(secondaryIdsOptions);\n\n // sets of added to column domain fields\n const allAddedDomainValues = new Set<string>();\n const addedNotToAllVariantsDomainValues = new Set<string>();\n const addedByVariantsDomainValues = secondaryIdsVariants.map((idsList) => {\n const addedSet = new Set<string>();\n idsList.map((axisId, idx) => {\n const d1 = column.spec.axesSpec[idx].domain;\n const d2 = axisId.domain;\n Object.entries(d2 ?? {}).forEach(([key, value]) => {\n if (d1?.[key] === undefined) {\n const item = JSON.stringify([key, value]);\n addedSet.add(item);\n allAddedDomainValues.add(item);\n }\n });\n return ({\n ...axisId,\n annotations: column.spec.axesSpec[idx].annotations,\n });\n });\n return addedSet;\n });\n [...allAddedDomainValues].forEach((addedPart) => {\n if (addedByVariantsDomainValues.some((s) => !s.has(addedPart))) {\n addedNotToAllVariantsDomainValues.add(addedPart);\n }\n });\n\n const additionalColumns = secondaryIdsVariants.map((idsList, idx) => {\n const id = colId(column.id, idsList.map((id) => id.domain));\n\n const label = readAnnotation(column.spec, Annotation.Label) ?? '';\n const labelDomainPart = ([...addedByVariantsDomainValues[idx]])\n .filter((str) => addedNotToAllVariantsDomainValues.has(str))\n .sort()\n .map((v) => JSON.parse(v)?.[1]) // use in labels only domain values, but sort them by key to save the same order in all column variants\n .join(' / ');\n\n const annotations: Annotation = {\n ...column.spec.annotations,\n [Annotation.Graph.IsVirtual]: stringifyJson(true),\n };\n if (label || labelDomainPart) {\n annotations[Annotation.Label] = label && labelDomainPart ? label + ' / ' + labelDomainPart : label + labelDomainPart;\n }\n\n return {\n ...column,\n id: id as PObjectId,\n spec: {\n ...column.spec,\n axesSpec: idsList.map((axisId, idx) => ({\n ...axisId,\n annotations: column.spec.axesSpec[idx].annotations,\n })),\n annotations,\n },\n };\n });\n\n return [column, ...additionalColumns];\n}\n\n/**\n The aim of createPFrameForGraphs: to create pframe with block’s columns and all compatible columns from result pool\n (including linker columns and all label columns).\n Block’s columns are added to pframe as is.\n Other columns are added basing on set of axes of block’s columns, considering available with linker columns.\n Compatible columns must have at least one axis from block’s axes set. This axis of the compatible column from\n result pool must satisfy matchAxisId (it can have less domain keys than in block’s axis, but without conflicting values\n among existing ones).\n In requests to pframe (calculateTableData) columns must have strictly the same axes. For compatibility in case\n of partially matched axis we add to pframe a copy of this column with modified axis (with filled missed domains)\n and modified label (with added domain values in case if more than one copy with different domains exist).\n */\nexport function createPFrameForGraphs<A, U>(\n ctx: RenderCtx<A, U>,\n blockColumns?: PColumn<PColumnDataUniversal>[],\n): PFrameHandle | undefined {\n const suitableSpec = (spec: PColumnSpec) => !isHiddenFromUIColumn(spec) && !isHiddenFromGraphColumn(spec);\n // if current block doesn't produce own columns then use all columns from result pool\n if (!blockColumns) {\n const columns = new PColumnCollection();\n columns.addColumnProvider(ctx.resultPool);\n const allColumns = columns.getUniversalEntries(suitableSpec, { dontWaitAllData: true, overrideLabelAnnotation: false }) ?? [];\n\n const allAxes: AxesVault = new Map(allColumns\n .flatMap((column) => getNormalizedAxesList(column.spec.axesSpec))\n .map((axisSpec) => {\n const axisId = getAxisId(axisSpec);\n return [canonicalizeJson(axisId), axisSpec];\n }));\n\n // additional columns are duplicates with extra fields in domains for compatibility if there are ones with partial match\n const extendedColumns = enrichCompatible(allAxes, allColumns);\n\n return ctx.createPFrame(extendedColumns);\n };\n\n // if current block has its own columns then take from result pool only compatible with them\n const columns = new PColumnCollection();\n columns.addColumnProvider(ctx.resultPool);\n columns.addColumns(blockColumns);\n\n // all possible axes from block columns\n const blockAxes: AxesVault = new Map();\n // axes from block columns and compatible result pool columns\n const allAxes: AxesVault = new Map();\n for (const c of blockColumns) {\n for (const spec of getNormalizedAxesList(c.spec.axesSpec)) {\n const aid = getAxisId(spec);\n blockAxes.set(canonicalizeJson(aid), spec);\n allAxes.set(canonicalizeJson(aid), spec);\n }\n }\n\n // all linker columns always go to pFrame - even it's impossible to use some of them they all are hidden\n const linkerColumns = columns.getUniversalEntries((spec) => suitableSpec(spec) && isLinkerColumn(spec)) ?? [];\n const availableWithLinkersAxes = getAvailableWithLinkersAxes(linkerColumns, blockAxes);\n\n // all possible axes from connected linkers\n for (const item of availableWithLinkersAxes) {\n blockAxes.set(...item);\n allAxes.set(...item);\n }\n\n const blockAxesArr = Array.from(blockAxes.values());\n // all compatible with block columns but without label columns\n let compatibleWithoutLabels = (columns.getUniversalEntries((spec) => suitableSpec(spec) && spec.axesSpec.some((axisSpec) => {\n const axisId = getAxisId(axisSpec);\n return blockAxesArr.some((selectorAxisSpec) => matchAxisId(getAxisId(selectorAxisSpec), axisId));\n }), { dontWaitAllData: true, overrideLabelAnnotation: false }) ?? []).filter((column) => !isLabelColumn(column.spec));\n\n // extend axes set for label columns request\n for (const c of compatibleWithoutLabels) {\n for (const spec of getNormalizedAxesList(c.spec.axesSpec)) {\n const aid = getAxisId(spec);\n allAxes.set(canonicalizeJson(aid), spec);\n }\n }\n\n const allAxesArr = Array.from(allAxes.values());\n // 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)\n compatibleWithoutLabels = (columns.getUniversalEntries((spec) => suitableSpec(spec) && spec.axesSpec.every((axisSpec) => {\n const axisId = getAxisId(axisSpec);\n return allAxesArr.some((selectorAxisSpec) => matchAxisId(getAxisId(selectorAxisSpec), axisId));\n }), { dontWaitAllData: true, overrideLabelAnnotation: false }) ?? []).filter((column) => !isLabelColumn(column.spec));\n\n // label columns must be compatible with full set of axes - block axes and axes from compatible columns from result pool\n const compatibleLabels = (columns.getUniversalEntries((spec) => suitableSpec(spec) && spec.axesSpec.some((axisSpec) => {\n const axisId = getAxisId(axisSpec);\n return allAxesArr.some((selectorAxisSpec) => matchAxisId(getAxisId(selectorAxisSpec), axisId));\n }), { dontWaitAllData: true, overrideLabelAnnotation: false }) ?? []).filter((column) => isLabelColumn(column.spec));\n\n const compatible = [...compatibleWithoutLabels, ...compatibleLabels];\n\n // additional columns are duplicates with extra fields in domains for compatibility if there are ones with partial match\n const extendedColumns = enrichCompatible(blockAxes, compatible);\n\n return ctx.createPFrame(extendedColumns);\n}\n"],"names":["readAnnotationJson","Annotation","LinkerMap","getColumnIdAndSpec","getArrayFromAxisTree","getAxesTree","getAxisId","matchAxisId","canonicalizeJson","readAnnotation","stringifyJson","PColumnCollection","getNormalizedAxesList","isLinkerColumn","isLabelColumn"],"mappings":";;;;;;;AA4BA;AACA,MAAM,KAAK,GAAG,CAAC,EAAa,EAAE,OAA+C,KAAI;AAC/E,IAAA,IAAI,GAAG,GAAG,EAAE,CAAC,QAAQ,EAAE;AACvB,IAAA,OAAO,EAAE,OAAO,CAAC,CAAC,MAAM,KAAI;QAC1B,IAAI,MAAM,EAAE;AACV,YAAA,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;gBAC3C,GAAG,IAAI,CAAC;gBACR,GAAG,IAAI,CAAC;YACV;QACF;AACF,IAAA,CAAC,CAAC;AACF,IAAA,OAAO,GAAG;AACZ,CAAC;AAED;AACA,SAAS,mBAAmB,CAAC,QAAoB,EAAA;AAC/C,IAAA,IAAI,CAAC,QAAQ,CA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,CAAC,QAAQ,CAAC;AAClC,QAAA,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC,gBAAgB,KAAKC,yBAAW,CAACD,uBAAS,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC,CAAC;AAChG,IAAA,CAAC,CAAC,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,uBAAuB,EAAE,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE,MAAM,CAAC,CAAC,MAAM,KAAK,CAACQ,2BAAa,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;;IAGrH,MAAM,gBAAgB,GAAG,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC,IAAI,KAAK,YAAY,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,QAAQ,KAAI;AACpH,QAAA,MAAM,MAAM,GAAGR,uBAAS,CAAC,QAAQ,CAAC;AAClC,QAAA,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC,gBAAgB,KAAKC,yBAAW,CAACD,uBAAS,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC,CAAC;AAChG,IAAA,CAAC,CAAC,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,uBAAuB,EAAE,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE,MAAM,CAAC,CAAC,MAAM,KAAKQ,2BAAa,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAEpH,MAAM,UAAU,GAAG,CAAC,GAAG,uBAAuB,EAAE,GAAG,gBAAgB,CAAC;;IAGpE,MAAM,eAAe,GAAG,gBAAgB,CAAC,SAAS,EAAE,UAAU,CAAC;AAE/D,IAAA,OAAO,GAAG,CAAC,YAAY,CAAC,eAAe,CAAC;AAC1C;;;;;;;;"}
@@ -1,10 +1,11 @@
1
1
  import type { AxisId, AxisSpecNormalized, CanonicalizedJson, PColumn, PColumnSpec, PFrameHandle } from '@milaboratories/pl-model-common';
2
- import type { PColumnDataUniversal, RenderCtx } from '../render';
2
+ import type { PColumnDataUniversal, PColumnEntryUniversal, PColumnEntryWithLabel, RenderCtx } from '../render';
3
3
  export declare function isHiddenFromGraphColumn(column: PColumnSpec): boolean;
4
+ export declare function isHiddenFromUIColumn(column: PColumnSpec): boolean;
4
5
  type AxesVault = Map<CanonicalizedJson<AxisId>, AxisSpecNormalized>;
5
- export declare function getAvailableWithLinkersAxes(linkerColumns: PColumn<PColumnDataUniversal>[], blockAxes: AxesVault): AxesVault;
6
+ export declare function getAvailableWithLinkersAxes(linkerColumns: (PColumnEntryWithLabel | PColumnEntryUniversal)[], blockAxes: AxesVault): AxesVault;
6
7
  /** Add columns with fully compatible axes created from partial compatible ones */
7
- export declare function enrichCompatible(blockAxes: AxesVault, columns: PColumn<PColumnDataUniversal>[]): PColumn<PColumnDataUniversal>[];
8
+ export declare function enrichCompatible<T extends Omit<PColumn<PColumnDataUniversal>, 'data'>>(blockAxes: AxesVault, columns: T[]): T[];
8
9
  /**
9
10
  The aim of createPFrameForGraphs: to create pframe with block’s columns and all compatible columns from result pool
10
11
  (including linker columns and all label columns).
@@ -1 +1 @@
1
- {"version":3,"file":"PFrameForGraphs.d.ts","sourceRoot":"","sources":["../../src/components/PFrameForGraphs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EACN,kBAAkB,EAClB,iBAAiB,EACjB,OAAO,EACP,WAAW,EACX,YAAY,EAEb,MAAM,iCAAiC,CAAC;AAiBzC,OAAO,KAAK,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAiCjE,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAEpE;AAED,KAAK,SAAS,GAAG,GAAG,CAAC,iBAAiB,CAAC,MAAM,CAAC,EAAE,kBAAkB,CAAC,CAAC;AAEpE,wBAAgB,2BAA2B,CACzC,aAAa,EAAE,OAAO,CAAC,oBAAoB,CAAC,EAAE,EAC9C,SAAS,EAAE,SAAS,GACnB,SAAS,CAuBX;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CAAC,EAAE,CAAC,EACxC,GAAG,EAAE,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,EACpB,YAAY,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,EAAE,GAC7C,YAAY,GAAG,SAAS,CAkF1B"}
@@ -2,7 +2,6 @@ import { readAnnotationJson, Annotation, LinkerMap, getColumnIdAndSpec, getArray
2
2
  import 'canonicalize';
3
3
  import { PColumnCollection } from '../render/util/column_collection.js';
4
4
  import '../render/util/label.js';
5
- import { allPColumnsReady } from '../render/util/pcolumn_data.js';
6
5
 
7
6
  /** Create id for column copy with added keys in axes domains */
8
7
  const colId = (id, domains) => {
@@ -35,6 +34,9 @@ function getKeysCombinations(idsLists) {
35
34
  function isHiddenFromGraphColumn(column) {
36
35
  return !!readAnnotationJson(column, Annotation.HideDataFromGraphs);
37
36
  }
37
+ function isHiddenFromUIColumn(column) {
38
+ return !!readAnnotationJson(column, Annotation.HideDataFromUi);
39
+ }
38
40
  function getAvailableWithLinkersAxes(linkerColumns, blockAxes) {
39
41
  const linkerMap = LinkerMap.fromColumns(linkerColumns.map(getColumnIdAndSpec));
40
42
  const startKeys = [];
@@ -54,11 +56,7 @@ function getAvailableWithLinkersAxes(linkerColumns, blockAxes) {
54
56
  }
55
57
  /** Add columns with fully compatible axes created from partial compatible ones */
56
58
  function enrichCompatible(blockAxes, columns) {
57
- const result = [];
58
- columns.forEach((column) => {
59
- result.push(...getAdditionalColumnsForColumn(blockAxes, column));
60
- });
61
- return result;
59
+ return columns.flatMap((column) => getAdditionalColumnsForColumn(blockAxes, column));
62
60
  }
63
61
  function getAdditionalColumnsForColumn(blockAxes, column) {
64
62
  const columnAxesIds = column.spec.axesSpec.map(getAxisId);
@@ -120,6 +118,7 @@ function getAdditionalColumnsForColumn(blockAxes, column) {
120
118
  annotations[Annotation.Label] = label && labelDomainPart ? label + ' / ' + labelDomainPart : label + labelDomainPart;
121
119
  }
122
120
  return {
121
+ ...column,
123
122
  id: id,
124
123
  spec: {
125
124
  ...column.spec,
@@ -129,7 +128,6 @@ function getAdditionalColumnsForColumn(blockAxes, column) {
129
128
  })),
130
129
  annotations,
131
130
  },
132
- data: column.data,
133
131
  };
134
132
  });
135
133
  return [column, ...additionalColumns];
@@ -147,15 +145,12 @@ function getAdditionalColumnsForColumn(blockAxes, column) {
147
145
  and modified label (with added domain values in case if more than one copy with different domains exist).
148
146
  */
149
147
  function createPFrameForGraphs(ctx, blockColumns) {
148
+ const suitableSpec = (spec) => !isHiddenFromUIColumn(spec) && !isHiddenFromGraphColumn(spec);
150
149
  // if current block doesn't produce own columns then use all columns from result pool
151
150
  if (!blockColumns) {
152
151
  const columns = new PColumnCollection();
153
152
  columns.addColumnProvider(ctx.resultPool);
154
- const allColumns = columns.getColumns((spec) => !isHiddenFromGraphColumn(spec), { dontWaitAllData: true, overrideLabelAnnotation: false }) ?? [];
155
- // if at least one column is not yet ready, we can't show the graph
156
- if (!allPColumnsReady(allColumns)) {
157
- return undefined;
158
- }
153
+ const allColumns = columns.getUniversalEntries(suitableSpec, { dontWaitAllData: true, overrideLabelAnnotation: false }) ?? [];
159
154
  const allAxes = new Map(allColumns
160
155
  .flatMap((column) => getNormalizedAxesList(column.spec.axesSpec))
161
156
  .map((axisSpec) => {
@@ -166,9 +161,6 @@ function createPFrameForGraphs(ctx, blockColumns) {
166
161
  const extendedColumns = enrichCompatible(allAxes, allColumns);
167
162
  return ctx.createPFrame(extendedColumns);
168
163
  }
169
- if (!allPColumnsReady(blockColumns)) {
170
- return undefined;
171
- }
172
164
  // if current block has its own columns then take from result pool only compatible with them
173
165
  const columns = new PColumnCollection();
174
166
  columns.addColumnProvider(ctx.resultPool);
@@ -185,7 +177,7 @@ function createPFrameForGraphs(ctx, blockColumns) {
185
177
  }
186
178
  }
187
179
  // all linker columns always go to pFrame - even it's impossible to use some of them they all are hidden
188
- const linkerColumns = columns.getColumns((spec) => isLinkerColumn(spec)) ?? [];
180
+ const linkerColumns = columns.getUniversalEntries((spec) => suitableSpec(spec) && isLinkerColumn(spec)) ?? [];
189
181
  const availableWithLinkersAxes = getAvailableWithLinkersAxes(linkerColumns, blockAxes);
190
182
  // all possible axes from connected linkers
191
183
  for (const item of availableWithLinkersAxes) {
@@ -194,14 +186,10 @@ function createPFrameForGraphs(ctx, blockColumns) {
194
186
  }
195
187
  const blockAxesArr = Array.from(blockAxes.values());
196
188
  // all compatible with block columns but without label columns
197
- let compatibleWithoutLabels = (columns.getColumns((spec) => !isHiddenFromGraphColumn(spec) && spec.axesSpec.some((axisSpec) => {
189
+ let compatibleWithoutLabels = (columns.getUniversalEntries((spec) => suitableSpec(spec) && spec.axesSpec.some((axisSpec) => {
198
190
  const axisId = getAxisId(axisSpec);
199
191
  return blockAxesArr.some((selectorAxisSpec) => matchAxisId(getAxisId(selectorAxisSpec), axisId));
200
192
  }), { dontWaitAllData: true, overrideLabelAnnotation: false }) ?? []).filter((column) => !isLabelColumn(column.spec));
201
- // if at least one column is not yet ready, we can't show the graph
202
- if (!allPColumnsReady(compatibleWithoutLabels)) {
203
- return undefined;
204
- }
205
193
  // extend axes set for label columns request
206
194
  for (const c of compatibleWithoutLabels) {
207
195
  for (const spec of getNormalizedAxesList(c.spec.axesSpec)) {
@@ -211,24 +199,20 @@ function createPFrameForGraphs(ctx, blockColumns) {
211
199
  }
212
200
  const allAxesArr = Array.from(allAxes.values());
213
201
  // 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)
214
- compatibleWithoutLabels = (columns.getColumns((spec) => !isHiddenFromGraphColumn(spec) && spec.axesSpec.every((axisSpec) => {
202
+ compatibleWithoutLabels = (columns.getUniversalEntries((spec) => suitableSpec(spec) && spec.axesSpec.every((axisSpec) => {
215
203
  const axisId = getAxisId(axisSpec);
216
204
  return allAxesArr.some((selectorAxisSpec) => matchAxisId(getAxisId(selectorAxisSpec), axisId));
217
205
  }), { dontWaitAllData: true, overrideLabelAnnotation: false }) ?? []).filter((column) => !isLabelColumn(column.spec));
218
206
  // label columns must be compatible with full set of axes - block axes and axes from compatible columns from result pool
219
- const compatibleLabels = (columns.getColumns((spec) => !isHiddenFromGraphColumn(spec) && spec.axesSpec.some((axisSpec) => {
207
+ const compatibleLabels = (columns.getUniversalEntries((spec) => suitableSpec(spec) && spec.axesSpec.some((axisSpec) => {
220
208
  const axisId = getAxisId(axisSpec);
221
209
  return allAxesArr.some((selectorAxisSpec) => matchAxisId(getAxisId(selectorAxisSpec), axisId));
222
210
  }), { dontWaitAllData: true, overrideLabelAnnotation: false }) ?? []).filter((column) => isLabelColumn(column.spec));
223
- // if at least one column is not yet ready, we can't show the graph
224
- if (!allPColumnsReady(compatibleLabels)) {
225
- return undefined;
226
- }
227
211
  const compatible = [...compatibleWithoutLabels, ...compatibleLabels];
228
212
  // additional columns are duplicates with extra fields in domains for compatibility if there are ones with partial match
229
213
  const extendedColumns = enrichCompatible(blockAxes, compatible);
230
214
  return ctx.createPFrame(extendedColumns);
231
215
  }
232
216
 
233
- export { createPFrameForGraphs, enrichCompatible, getAvailableWithLinkersAxes, isHiddenFromGraphColumn };
217
+ export { createPFrameForGraphs, enrichCompatible, getAvailableWithLinkersAxes, isHiddenFromGraphColumn, isHiddenFromUIColumn };
234
218
  //# sourceMappingURL=PFrameForGraphs.js.map