@milaboratories/graph-maker 1.1.150 → 1.1.152

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 (98) hide show
  1. package/dist/GraphMaker/components/AesSettings/AesDataMappingDiscrete.vue.d.ts.map +1 -1
  2. package/dist/GraphMaker/components/AesSettings/AesDataMappingDiscrete.vue.js +2 -1
  3. package/dist/GraphMaker/components/AesSettings/AesDataMappingDiscrete.vue.js.map +1 -1
  4. package/dist/GraphMaker/components/Chart.vue.js +3 -3
  5. package/dist/GraphMaker/components/Chart.vue.js.map +1 -1
  6. package/dist/GraphMaker/components/DragAndDrop/DnDBasketChip.vue.d.ts +3 -12
  7. package/dist/GraphMaker/components/DragAndDrop/DnDBasketChip.vue.d.ts.map +1 -1
  8. package/dist/GraphMaker/components/DragAndDrop/DnDBasketChip.vue.js +42 -85
  9. package/dist/GraphMaker/components/DragAndDrop/DnDBasketChip.vue.js.map +1 -1
  10. package/dist/GraphMaker/components/DragAndDrop/DnDRangeChip.vue.d.ts +1 -9
  11. package/dist/GraphMaker/components/DragAndDrop/DnDRangeChip.vue.d.ts.map +1 -1
  12. package/dist/GraphMaker/components/DragAndDrop/DnDRangeChip.vue.js +44 -89
  13. package/dist/GraphMaker/components/DragAndDrop/DnDRangeChip.vue.js.map +1 -1
  14. package/dist/GraphMaker/components/DragAndDrop/DndBasket.vue.d.ts +1 -3
  15. package/dist/GraphMaker/components/DragAndDrop/DndBasket.vue.d.ts.map +1 -1
  16. package/dist/GraphMaker/components/DragAndDrop/DndBasket.vue.js +68 -86
  17. package/dist/GraphMaker/components/DragAndDrop/DndBasket.vue.js.map +1 -1
  18. package/dist/GraphMaker/components/DragAndDrop/DndDoubleChip.vue.d.ts +7 -11
  19. package/dist/GraphMaker/components/DragAndDrop/DndDoubleChip.vue.d.ts.map +1 -1
  20. package/dist/GraphMaker/components/DragAndDrop/DndDoubleChip.vue.js +48 -91
  21. package/dist/GraphMaker/components/DragAndDrop/DndDoubleChip.vue.js.map +1 -1
  22. package/dist/GraphMaker/components/DragAndDrop/types.d.ts +1 -21
  23. package/dist/GraphMaker/components/DragAndDrop/types.d.ts.map +1 -1
  24. package/dist/GraphMaker/components/PlColorSliderThumb.vue.js +18 -18
  25. package/dist/GraphMaker/components/PlColorSliderThumb.vue.js.map +1 -1
  26. package/dist/GraphMaker/constantsCommon.d.ts +0 -1
  27. package/dist/GraphMaker/constantsCommon.d.ts.map +1 -1
  28. package/dist/GraphMaker/constantsCommon.js +95 -95
  29. package/dist/GraphMaker/constantsCommon.js.map +1 -1
  30. package/dist/GraphMaker/forms/DataMappingForm/DendroForm.vue.d.ts.map +1 -1
  31. package/dist/GraphMaker/forms/DataMappingForm/DendroForm.vue.js +128 -166
  32. package/dist/GraphMaker/forms/DataMappingForm/DendroForm.vue.js.map +1 -1
  33. package/dist/GraphMaker/forms/DataMappingForm/useBaskets.d.ts.map +1 -1
  34. package/dist/GraphMaker/forms/DataMappingForm/useBaskets.js +93 -131
  35. package/dist/GraphMaker/forms/DataMappingForm/useBaskets.js.map +1 -1
  36. package/dist/GraphMaker/forms/DataMappingForm/utils.d.ts +1 -1
  37. package/dist/GraphMaker/forms/DataMappingForm/utils.d.ts.map +1 -1
  38. package/dist/GraphMaker/forms/DataMappingForm/utils.js +79 -155
  39. package/dist/GraphMaker/forms/DataMappingForm/utils.js.map +1 -1
  40. package/dist/GraphMaker/forms/index.js +2 -2
  41. package/dist/GraphMaker/forms/index.js.map +1 -1
  42. package/dist/GraphMaker/icons/StackedAreaIcon.vue.d.ts +3 -0
  43. package/dist/GraphMaker/icons/StackedAreaIcon.vue.d.ts.map +1 -0
  44. package/dist/GraphMaker/icons/StackedAreaIcon.vue.js +19 -0
  45. package/dist/GraphMaker/icons/StackedAreaIcon.vue.js.map +1 -0
  46. package/dist/GraphMaker/index.vue.js +1 -1
  47. package/dist/GraphMaker/store.d.ts.map +1 -1
  48. package/dist/GraphMaker/store.js +43 -45
  49. package/dist/GraphMaker/store.js.map +1 -1
  50. package/dist/GraphMaker/types.d.ts +1 -1
  51. package/dist/GraphMaker/types.d.ts.map +1 -1
  52. package/dist/GraphMaker/utils/addFixedOptionsToState.js +2 -2
  53. package/dist/GraphMaker/utils/addFixedOptionsToState.js.map +1 -1
  54. package/dist/GraphMaker/utils/createChartSettingsForRender/composeChartSettings.js +25 -25
  55. package/dist/GraphMaker/utils/createChartSettingsForRender/composeChartSettings.js.map +1 -1
  56. package/dist/GraphMaker/utils/loadDefaultSources.d.ts +2 -3
  57. package/dist/GraphMaker/utils/loadDefaultSources.d.ts.map +1 -1
  58. package/dist/GraphMaker/utils/loadDefaultSources.js +47 -51
  59. package/dist/GraphMaker/utils/loadDefaultSources.js.map +1 -1
  60. package/dist/GraphMaker/utils/loadUniqueValuesToSave.d.ts.map +1 -1
  61. package/dist/GraphMaker/utils/loadUniqueValuesToSave.js +39 -41
  62. package/dist/GraphMaker/utils/loadUniqueValuesToSave.js.map +1 -1
  63. package/dist/lib.js +1 -1
  64. package/dist/node_modules/@milaboratories/helpers/dist/objects.js +33 -0
  65. package/dist/node_modules/@milaboratories/helpers/dist/objects.js.map +1 -0
  66. package/dist/node_modules/@milaboratories/helpers/dist/utils.js +12 -0
  67. package/dist/node_modules/@milaboratories/helpers/dist/utils.js.map +1 -0
  68. package/dist/node_modules/@milaboratories/pf-plots/dist/constants.js +6 -5
  69. package/dist/node_modules/@milaboratories/pf-plots/dist/constants.js.map +1 -1
  70. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/ComponentController.js +146 -149
  71. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/ComponentController.js.map +1 -1
  72. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/ControllerBase.js +168 -221
  73. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/ControllerBase.js.map +1 -1
  74. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/bubble.js +95 -102
  75. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/bubble.js.map +1 -1
  76. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/dendro.js +145 -156
  77. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/dendro.js.map +1 -1
  78. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/discrete.js +68 -75
  79. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/discrete.js.map +1 -1
  80. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/heatmap.js +154 -159
  81. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/heatmap.js.map +1 -1
  82. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/histogram.js +48 -55
  83. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/histogram.js.map +1 -1
  84. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/scatterplot-umap.js +114 -122
  85. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/scatterplot-umap.js.map +1 -1
  86. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/scatterplot.js +111 -119
  87. package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/scatterplot.js.map +1 -1
  88. package/dist/node_modules/@milaboratories/pf-plots/dist/index.js +4 -4
  89. package/dist/node_modules/@milaboratories/pf-plots/dist/pframe/ColumnsProvider.js +70 -69
  90. package/dist/node_modules/@milaboratories/pf-plots/dist/pframe/ColumnsProvider.js.map +1 -1
  91. package/dist/node_modules/@milaboratories/pf-plots/dist/spec.js +2 -2
  92. package/dist/node_modules/@milaboratories/pf-plots/dist/spec.js.map +1 -1
  93. package/dist/node_modules/@milaboratories/pf-plots/dist/utils.js +184 -183
  94. package/dist/node_modules/@milaboratories/pf-plots/dist/utils.js.map +1 -1
  95. package/dist/node_modules/@vueuse/shared/index.js.map +1 -1
  96. package/package.json +4 -4
  97. package/dist/node_modules/@milaboratories/helpers/dist/index.js +0 -372
  98. package/dist/node_modules/@milaboratories/helpers/dist/index.js.map +0 -1
@@ -1,69 +1,52 @@
1
+ import { DISCRETE_VALUES_KEY as E, HIGH_CARDINALITY as D } from "../constants.js";
2
+ import { AxisId as b, columnOrAxisIdFromString as A } from "../spec.js";
3
+ import { getStateCopy as k, getDefaultInfo as O, dataColumnPredicateDefault as B, createLinkerMap as P, createMultipliesByMap as j, getColumnOrAxisValueLabelsId as M } from "../utils.js";
1
4
  import "../node_modules/@milaboratories/pl-model-common/dist/drivers/blob.js";
2
5
  import "../node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/spec.js";
3
6
  import "../_virtual/canonicalize.js";
4
7
  import "../node_modules/@milaboratories/pl-model-common/dist/plid.js";
5
8
  import "../node_modules/@milaboratories/pl-model-common/dist/ref.js";
6
- import { deriveLabels as P } from "../node_modules/@platforma-sdk/model/dist/render/util/label.js";
9
+ import { deriveLabels as F } from "../node_modules/@platforma-sdk/model/dist/render/util/label.js";
7
10
  import "../node_modules/@milaboratories/pl-error-like/dist/error_like_shape.js";
8
- import { DISCRETE_VALUES_KEY as M, HIGH_CARDINALITY as V } from "../constants.js";
9
- import { columnOrAxisIdFromString as k, isColumnId as L, AxisId as A, ColumnId as T } from "../spec.js";
10
- import { getStateCopy as D, addSourceInfoToMap as U, getDefaultInfo as j, dataColumnPredicateDefault as $, createLinkerMap as q, getColumnOrAxisValueLabelsId as G } from "../utils.js";
11
- var H = Object.defineProperty, N = (b, e, t) => e in b ? H(b, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : b[e] = t, F = (b, e, t) => N(b, typeof e != "symbol" ? e + "" : e, t);
12
- class ee {
11
+ var H = Object.defineProperty, V = (h, e, t) => e in h ? H(h, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : h[e] = t, x = (h, e, t) => V(h, typeof e != "symbol" ? e + "" : e, t);
12
+ class W {
13
13
  constructor(e, t) {
14
- F(this, "ignoredOptionIdNames", []), F(this, "dataInputs", []), F(this, "dontAllowUnfilteredHighCardinality", !1), this.simpleComponentControllers = e, this.filterComponentControllers = t;
14
+ x(this, "ignoredOptionIdNames", []), x(this, "dataInputs", []), x(this, "dontAllowUnfilteredHighCardinality", !1), x(this, "allowHangingAxes", !1), this.simpleComponentControllers = e, this.filterComponentControllers = t;
15
15
  }
16
- get requiredComponents() {
17
- const e = [];
18
- for (const t of Object.keys(this.simpleComponentControllers))
19
- this.simpleComponentControllers[t].isRequired && e.push(t);
20
- return e;
21
- }
22
- get dimensionsConsumerComponents() {
23
- const e = [];
24
- for (const t of Object.keys(this.simpleComponentControllers))
25
- this.simpleComponentControllers[t].isDimensionsConsumer && e.push(t);
26
- for (const t of Object.keys(this.filterComponentControllers))
27
- this.filterComponentControllers[t].isDimensionsConsumer && e.push(t);
28
- return e;
29
- }
30
- addSelected(e, t, n) {
16
+ addSelected(e, t, o) {
31
17
  if (e in this.simpleComponentControllers)
32
- return this.simpleComponentControllers[e].addSelected(t, n);
18
+ return this.simpleComponentControllers[e].addSelected(t, o);
33
19
  if (e in this.filterComponentControllers)
34
- return this.filterComponentControllers[e].addSelected(t, n);
20
+ return this.filterComponentControllers[e].addSelected(t, o);
35
21
  throw Error(`Unknown input name: ${String(e)}`);
36
22
  }
37
- deleteSelected(e, t, n, o) {
23
+ deleteSelected(e, t, o, r) {
38
24
  if (e in this.simpleComponentControllers)
39
- return this.simpleComponentControllers[e].deleteSelected(n, o.selectedSource);
25
+ return this.simpleComponentControllers[e].deleteSelected(o, r.selectedSource);
40
26
  if (e in this.filterComponentControllers)
41
- return this.filterComponentControllers[e].deleteSelected(n, o.selectedSource);
27
+ return this.filterComponentControllers[e].deleteSelected(o, r.selectedSource);
42
28
  throw Error(`Unknown input name: ${String(e)}`);
43
29
  }
44
- changeSelected(e, t, n, o) {
45
- const s = n.components[e].selectorStates, l = s.filter((r) => !o.find((p) => p.selectedSource === r.selectedSource)), C = o.filter((r) => !s.find((p) => p.selectedSource === r.selectedSource));
46
- let a = D(n);
47
- return l.forEach((r) => {
48
- a = this.deleteSelected(e, t, a, r);
49
- }), C.forEach((r) => {
50
- a = this.addSelected(e, a, r);
51
- }), n.components[e].selectorStates = o.map(
52
- (r) => n.components[e].selectorStates.find(
53
- (p) => p.selectedSource === r.selectedSource
30
+ changeSelected(e, t, o, r) {
31
+ const n = o.components[e].selectorStates, c = n.filter((s) => !r.find((a) => a.selectedSource === s.selectedSource)), u = r.filter((s) => !n.find((a) => a.selectedSource === s.selectedSource));
32
+ let p = k(o);
33
+ return c.forEach((s) => {
34
+ p = this.deleteSelected(e, t, p, s);
35
+ }), u.forEach((s) => {
36
+ p = this.addSelected(e, p, s);
37
+ }), o.components[e].selectorStates = r.map(
38
+ (s) => o.components[e].selectorStates.find(
39
+ (a) => a.selectedSource === s.selectedSource
54
40
  )
55
- ).filter(Boolean), a;
41
+ ).filter(Boolean), p;
56
42
  }
57
43
  switchDividableAxis(e, t) {
58
- return D(e);
59
- }
60
- async getMustBeConsumedAxes(e, t) {
61
- return Promise.resolve(/* @__PURE__ */ new Set());
44
+ return k(e);
62
45
  }
63
46
  createEmptyComponentsGuide(e) {
64
47
  return Object.fromEntries(
65
48
  Object.entries(e.components).map(
66
- ([t, n]) => [
49
+ ([t, o]) => [
67
50
  t,
68
51
  {
69
52
  options: [],
@@ -76,41 +59,11 @@ class ee {
76
59
  )
77
60
  );
78
61
  }
79
- async getSelectedSourcesInfo(e, t, n, o) {
80
- const s = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Set(), C = [];
81
- for (const a of this.dataInputs)
82
- for (const r of t.components[a].selectorStates) {
83
- const p = k(r.selectedSource);
84
- if (L(p)) {
85
- const i = await e.pFrameProvider.getColumnSpecById(p);
86
- i && i.axesSpec.forEach((c) => {
87
- const d = A.fromAxisSpec(c).toCanonicalString();
88
- l.has(d) || (l.add(d), C.push(c));
89
- });
90
- }
91
- }
92
- for (const [a, { selectorStates: r }] of Object.entries(t.components)) {
93
- const p = (this.simpleComponentControllers[a] ?? this.filterComponentControllers[a]).settings.columnsWithExtraAxesAllowed;
94
- for (const { selectedSource: i } of r)
95
- await U(
96
- e,
97
- i,
98
- n[i],
99
- s,
100
- C,
101
- l,
102
- p,
103
- o
104
- );
105
- }
106
- return s;
107
- }
108
62
  getEmptyInputGuide(e) {
109
63
  return {
110
64
  components: this.createEmptyComponentsGuide(e),
111
- getSourceInfo: (t) => j(t),
112
- freeOptionsSet: /* @__PURE__ */ new Set(),
113
- axesToBeFixedSet: /* @__PURE__ */ new Set(),
65
+ getSourceInfo: (t) => O(t),
66
+ fullOptionsSet: /* @__PURE__ */ new Set(),
114
67
  readyData: !1,
115
68
  ready: !1,
116
69
  consistent: !0
@@ -118,123 +71,136 @@ class ee {
118
71
  }
119
72
  getConsumedOptionsSet(e) {
120
73
  const t = /* @__PURE__ */ new Set();
121
- for (const n of this.dimensionsConsumerComponents)
122
- for (const { selectedSource: o } of e.components[n].selectorStates)
123
- t.add(o);
74
+ for (const o of Object.keys(this.simpleComponentControllers))
75
+ if (this.simpleComponentControllers[o].isDimensionsConsumer)
76
+ for (const { selectedSource: r } of e.components[o].selectorStates)
77
+ t.add(r);
78
+ for (const o of Object.keys(this.filterComponentControllers))
79
+ if (this.filterComponentControllers[o].isDimensionsConsumer)
80
+ for (const { selectedSource: r, type: n, selectedFilterValues: c } of e.components[o].selectorStates)
81
+ n === "equals" && (c == null ? void 0 : c.length) === 1 && t.add(r);
124
82
  return t;
125
83
  }
126
- async getLabelsMap(e, t) {
127
- const n = await e.pFrameProvider.getColumnsFull(
128
- this.dataInputs.reduce((o, s) => {
129
- const l = t.components[s].selectorStates.map((C) => k(C.selectedSource));
130
- return o.concat(l);
131
- }, []),
132
- !1
133
- );
134
- return P(n, (o) => o.spec).reduce((o, s) => {
135
- const l = new T({ name: s.value.columnId, type: s.value.spec.valueType }).toCanonicalString();
136
- return o[l] = s.label, o;
137
- }, {});
84
+ async getParentAndHangingAxesByInputs(e, t, o, r) {
85
+ const n = { ...this.simpleComponentControllers, ...this.filterComponentControllers }, c = {};
86
+ for (const [u, p] of Object.entries(n))
87
+ c[u] = await p.getParentAndHangingAxes(e, t, o, r);
88
+ return c;
138
89
  }
139
- async calculateOptions(e, t, n = [], o = $) {
140
- var s;
141
- const l = this.createEmptyComponentsGuide(t), C = this.getConsumedOptionsSet(t), a = new Set(this.ignoredOptionIdNames), r = new Set(n), p = await q(e), i = await this.getLabelsMap(e, t), c = await this.getSelectedSourcesInfo(e, t, i, p), d = /* @__PURE__ */ new Map(), g = { ...this.simpleComponentControllers, ...this.filterComponentControllers }, h = /* @__PURE__ */ new Set();
142
- for (const [u, f] of Object.entries(g)) {
143
- const m = await f.getOptions(
144
- e,
145
- t,
146
- i,
147
- C,
148
- p,
149
- o,
150
- a,
151
- r
152
- );
153
- this.dataInputs.includes(u) || m.options.forEach((v) => {
154
- h.add(v.value);
155
- });
156
- for (const [v, S] of m.optionsInfo)
157
- d.set(v, S);
158
- l[u] = m;
90
+ /** Depends on chart type. */
91
+ getMustBeConsumedAxes(e, t) {
92
+ return /* @__PURE__ */ new Set();
93
+ }
94
+ /** Axes that go to the "Drag to build the chart" section.
95
+ * If some of them is not moved to 'filters', 'tabBy' or 'facetBy' (dimension reducers) chart can't be rendered */
96
+ markMustBeConsumedAxes(e, t, o, r) {
97
+ var n;
98
+ const c = this.getConsumedOptionsSet(e), u = (s) => {
99
+ const a = t.get(s);
100
+ a && a.kind === "axis" && (a.mustBeConsumed = !0);
101
+ }, p = this.getMustBeConsumedAxes(e, t);
102
+ for (const s of p)
103
+ c.has(s) || u(s);
104
+ this.allowHangingAxes || Object.entries(r).forEach(([s, { hangingAxes: a }]) => {
105
+ for (const i of a.keys())
106
+ c.has(i) || u(i);
107
+ });
108
+ for (const s of o) {
109
+ const a = t.get(s);
110
+ (a == null ? void 0 : a.kind) === "axis" && a.isNonHomogenous && !c.has(s) && u(s);
159
111
  }
160
- const y = (u) => {
161
- const f = d.get(u);
162
- f && f.kind === "axis" && (f.mustBeConsumed = !0);
163
- const m = c.get(u);
164
- m && m.kind === "axis" && (m.mustBeConsumed = !0);
165
- }, E = await this.getMustBeConsumedAxes(e, t);
166
- for (const u of E)
167
- y(u);
168
112
  if (this.dontAllowUnfilteredHighCardinality) {
169
- const u = (m) => {
170
- var v;
171
- return ((v = m == null ? void 0 : m.annotations) == null ? void 0 : v[V]) === "true";
172
- }, f = ((s = t.components.filters) == null ? void 0 : s.selectorStates.reduce((m, v) => {
173
- const S = c.get(v.selectedSource);
174
- return (S == null ? void 0 : S.kind) === "column" && S.spec.axesSpec.filter(u).forEach((w) => m.add(A.fromAxisSpec(w).toCanonicalString())), (S == null ? void 0 : S.kind) === "axis" && u(S.spec) && m.add(A.fromAxisSpec(S.spec).toCanonicalString()), m;
113
+ const s = (i) => {
114
+ var m;
115
+ return ((m = i == null ? void 0 : i.annotations) == null ? void 0 : m[D]) === "true";
116
+ }, a = ((n = e.components.filters) == null ? void 0 : n.selectorStates.reduce((i, m) => {
117
+ const l = t.get(m.selectedSource);
118
+ return (l == null ? void 0 : l.kind) === "column" && l.spec.axesSpec.filter(s).forEach((d) => i.add(b.fromAxisSpec(d).toCanonicalString())), (l == null ? void 0 : l.kind) === "axis" && s(l.spec) && i.add(b.fromAxisSpec(l.spec).toCanonicalString()), i;
175
119
  }, /* @__PURE__ */ new Set())) ?? /* @__PURE__ */ new Set();
176
- this.dataInputs.forEach((m) => {
177
- for (const { selectedSource: v } of t.components[m].selectorStates) {
178
- const S = c.get(v);
179
- if ((S == null ? void 0 : S.kind) === "column" && S.spec.axesSpec.filter(u).forEach((w) => {
180
- const O = A.fromAxisSpec(w).toCanonicalString();
181
- !h.has(O) && !f.has(O) && h.add(O), f.has(O) || y(O);
182
- }), (S == null ? void 0 : S.kind) === "axis" && u(S.spec)) {
183
- const w = A.fromAxisSpec(S.spec).toCanonicalString();
184
- h.has(w) || h.add(w), f.has(w) || y(w);
120
+ this.dataInputs.forEach((i) => {
121
+ for (const { selectedSource: m } of e.components[i].selectorStates) {
122
+ const l = t.get(m);
123
+ if ((l == null ? void 0 : l.kind) === "column" && l.spec.axesSpec.filter(s).forEach((d) => {
124
+ const f = b.fromAxisSpec(d).toCanonicalString();
125
+ a.has(f) || u(f);
126
+ }), (l == null ? void 0 : l.kind) === "axis" && s(l.spec)) {
127
+ const d = b.fromAxisSpec(l.spec).toCanonicalString();
128
+ a.has(d) || u(d);
185
129
  }
186
130
  }
187
131
  });
188
132
  }
189
- const x = /* @__PURE__ */ new Set();
190
- for (const { selectorStates: u } of Object.values(t.components))
191
- for (const { selectedSource: f } of u) {
192
- const m = c.get(f);
193
- m && m.kind === "column" && m.axesToBeFixed.forEach((v) => {
194
- x.add(v);
195
- });
196
- }
197
- const B = await this.isConsistent(e, t, p), I = (u) => {
198
- const f = k(u).toCanonicalString() ?? u;
199
- return d.get(f) ?? c.get(f) ?? j(u);
200
- };
133
+ }
134
+ setColumnLabels(e, t) {
135
+ const o = [...e].filter((n) => {
136
+ var c;
137
+ return ((c = t.get(n)) == null ? void 0 : c.kind) === "column";
138
+ }), r = F(o, (n) => t.get(n).spec);
139
+ o.forEach((n, c) => {
140
+ t.get(n).label = r[c].label;
141
+ });
142
+ }
143
+ /** Calculates information for data-mapping interface:
144
+ * options for every input (basket),
145
+ * information for every option (label, value type, must be consumed etc),
146
+ * information about full data-mapping state (ready to data loading and rendering or not, contains inconsistency or not) */
147
+ async calculateOptions(e, t, o = [], r = B) {
148
+ const n = this.createEmptyComponentsGuide(t), c = new Set(this.ignoredOptionIdNames), u = new Set(o), p = await P(e), s = await j(e), a = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Set(), m = await this.getParentAndHangingAxesByInputs(e, t, p, s), l = { ...this.simpleComponentControllers, ...this.filterComponentControllers };
149
+ for (const [C, y] of Object.entries(l)) {
150
+ const S = await y.getOptions(
151
+ e,
152
+ t,
153
+ p,
154
+ s,
155
+ m,
156
+ r,
157
+ c,
158
+ u
159
+ );
160
+ for (const g of S.options)
161
+ i.add(g.value);
162
+ for (const g of S.optionsInfo)
163
+ a.set(...g);
164
+ n[C] = S;
165
+ }
166
+ this.markMustBeConsumedAxes(t, a, i, m), this.setColumnLabels(i, a);
167
+ const d = this.isConsistent(t, n), f = (C) => a.get(C) ?? O(C);
201
168
  return {
202
- components: l,
203
- getSourceInfo: I,
204
- freeOptionsSet: h,
205
- axesToBeFixedSet: x,
169
+ components: n,
170
+ getSourceInfo: f,
171
+ fullOptionsSet: i,
206
172
  readyData: this.readyDataInputs(t),
207
- ready: this.readyForPlotBuilding(e, t, B, h, I),
208
- consistent: B
173
+ ready: this.readyForPlotBuilding(t, d, i, f),
174
+ consistent: d
209
175
  };
210
176
  }
211
- async getUniqueSourceValuesWithLabels(e, t, n, o, s, l) {
212
- var C;
213
- const a = (i) => i.sort((c, d) => c.label.localeCompare(d.label, "en", { numeric: !0 })), r = t.getSourceInfo(n), p = (C = r.annotations) == null ? void 0 : C[M];
177
+ async getUniqueSourceValuesWithLabels(e, t, o, r, n, c) {
178
+ var u;
179
+ const p = (i) => i.sort((m, l) => m.label.localeCompare(l.label, "en", { numeric: !0 })), s = t.getSourceInfo(o), a = (u = s.annotations) == null ? void 0 : u[E];
214
180
  try {
215
- const i = p ? JSON.parse(p).map((c) => String(c)) : null;
181
+ const i = a ? JSON.parse(a).map((m) => String(m)) : null;
216
182
  if (i) {
217
- const c = i.map((d) => ({ value: d, label: d }));
218
- return a(c), { values: c, overflow: !1 };
183
+ const m = i.map((l) => ({ value: l, label: l }));
184
+ return p(m), { values: m, overflow: !1 };
219
185
  }
220
186
  } catch {
221
- console.error(`Parsing error: discrete values annotation ${p} in ${n}`);
187
+ console.error(`Parsing error: discrete values annotation ${a} in ${o}`);
222
188
  }
223
- if (r.kind === "axis") {
224
- const i = k(n), c = r.parentSources.map(k), d = await G(e, n, r.parentSources);
225
- let g = [];
226
- if (d) {
227
- s && (g = [{
189
+ if (s.kind === "axis") {
190
+ const i = A(o), m = s.parentSources.map(A), l = await M(e, o, s.parentSources);
191
+ let d = [];
192
+ if (l) {
193
+ n && (d = [{
228
194
  type: "bySingleColumnV2",
229
195
  column: {
230
196
  type: "column",
231
- id: d.name
197
+ id: l.name
232
198
  },
233
199
  predicate: {
234
200
  operator: "StringIContains",
235
- substring: s
201
+ substring: n
236
202
  }
237
- }]), l && (g = [{
203
+ }]), c && (d = [{
238
204
  type: "bySingleColumnV2",
239
205
  column: {
240
206
  type: "axis",
@@ -242,16 +208,16 @@ class ee {
242
208
  },
243
209
  predicate: {
244
210
  operator: "StringIContains",
245
- substring: l
211
+ substring: c
246
212
  }
247
213
  }]);
248
- const { data: x, axesData: B } = await e.pFrameProvider.getSingleColumnData(d, g), I = B[i.toCanonicalString()], u = [];
249
- for (let f = 0; f < Math.min(I.length, o ?? I.length); f++)
250
- u.push({ value: String(I[f]), label: String(x[f]) });
251
- return a(u), { values: u, overflow: !(o === void 0 || I.length < o) };
214
+ const { data: S, axesData: g } = await e.pFrameProvider.getSingleColumnData(l, d), v = g[i.toCanonicalString()], I = [];
215
+ for (let w = 0; w < Math.min(v.length, r ?? v.length); w++)
216
+ I.push({ value: String(v[w]), label: String(S[w]) });
217
+ return p(I), { values: I, overflow: !(r === void 0 || v.length < r) };
252
218
  }
253
- const h = s ?? l;
254
- h && (g = [{
219
+ const f = n ?? c;
220
+ f && (d = [{
255
221
  type: "bySingleColumnV2",
256
222
  column: {
257
223
  type: "axis",
@@ -259,81 +225,62 @@ class ee {
259
225
  },
260
226
  predicate: {
261
227
  operator: "StringIContains",
262
- substring: h
228
+ substring: f
263
229
  }
264
230
  }]);
265
- const y = await e.pFrameProvider.getAxisUniqueValues(i, [c[0]], o, g), E = y.values.map((x) => ({ value: String(x), label: String(x) }));
266
- return a(E), { values: E, overflow: y.overflow };
231
+ const C = await e.pFrameProvider.getAxisUniqueValues(i, [m[0]], r, d), y = C.values.map((S) => ({ value: String(S), label: String(S) }));
232
+ return p(y), { values: y, overflow: C.overflow };
267
233
  }
268
- if (r.kind === "column") {
269
- const i = s ?? l, c = k(n), d = i ? [{
234
+ if (s.kind === "column") {
235
+ const i = n ?? c, m = A(o), l = i ? [{
270
236
  type: "bySingleColumnV2",
271
237
  column: {
272
238
  type: "column",
273
- id: c.name
239
+ id: m.name
274
240
  },
275
241
  predicate: {
276
242
  operator: "StringIContains",
277
243
  substring: i
278
244
  }
279
- }] : [], g = await e.pFrameProvider.getColumnUniqueValues(c, o, d), h = g.values.map((y) => ({ value: String(y), label: String(y) }));
280
- return a(h), { values: h, overflow: g.overflow };
245
+ }] : [], d = await e.pFrameProvider.getColumnUniqueValues(m, r, l), f = d.values.map((C) => ({ value: String(C), label: String(C) }));
246
+ return p(f), { values: f, overflow: d.overflow };
281
247
  }
282
248
  return { values: [], overflow: !1 };
283
249
  }
284
- async checkStateConsistency(e, t, n) {
285
- const o = /* @__PURE__ */ new Map();
286
- for (const s of Object.keys(this.simpleComponentControllers))
287
- o.set(
288
- s,
289
- await this.simpleComponentControllers[s].checkStateConsistency(e, t, n)
290
- );
291
- for (const s of Object.keys(this.filterComponentControllers))
250
+ checkStateConsistency(e, t) {
251
+ const o = /* @__PURE__ */ new Map(), r = { ...this.simpleComponentControllers, ...this.filterComponentControllers };
252
+ for (const n of Object.keys(r))
292
253
  o.set(
293
- s,
294
- await this.filterComponentControllers[s].checkStateConsistency(e, t, n)
254
+ n,
255
+ r[n].checkStateConsistency(e, t[n].options)
295
256
  );
296
257
  return o;
297
258
  }
298
- async isConsistent(e, t, n) {
299
- const o = await this.checkStateConsistency(e, t, n);
300
- for (const s of o.values())
301
- if (Object.values(s).some((l) => !l))
259
+ isConsistent(e, t) {
260
+ const o = this.checkStateConsistency(e, t);
261
+ for (const r of o.values())
262
+ if (Object.values(r).some((n) => !n))
302
263
  return !1;
303
264
  return !0;
304
265
  }
305
266
  readyDataInputs(e) {
306
267
  return this.dataInputs.every((t) => e.components[t].selectorStates.length > 0);
307
268
  }
308
- readyForPlotBuilding(e, t, n, o, s) {
309
- if (!n || !this.readyDataInputs(t))
269
+ readyForPlotBuilding(e, t, o, r) {
270
+ if (!t || !this.readyDataInputs(e))
310
271
  return !1;
311
- let l = !1;
312
- for (const a of o) {
313
- const r = s(a);
314
- if (r && r.kind === "axis" && r.mustBeConsumed) {
315
- l = !0;
272
+ let n = !1;
273
+ for (const u of o) {
274
+ const p = r(u);
275
+ if (p && p.kind === "axis" && p.mustBeConsumed) {
276
+ n = !0;
316
277
  break;
317
278
  }
318
279
  }
319
- let C = !1;
320
- for (const { selectorStates: a } of Object.values(t.components)) {
321
- for (const { selectedSource: r, fixedAxes: p } of a) {
322
- const i = s(r);
323
- if (i && i.kind === "column" && i.axesToBeFixed.some(
324
- (c) => {
325
- var d;
326
- return ((d = (p ?? []).find((g) => g.axisSource === c)) == null ? void 0 : d.axisValue) === void 0;
327
- }
328
- )) {
329
- C = !0;
330
- break;
331
- }
332
- }
333
- if (C)
334
- break;
335
- }
336
- return this.requiredComponents.every((a) => t.components[a].selectorStates.length > 0) && !l && !C;
280
+ const c = [];
281
+ for (const u of Object.keys(this.simpleComponentControllers))
282
+ this.simpleComponentControllers[u].isRequired && c.push(u);
283
+ return c.every((u) => e.components[u].selectorStates.length > 0) && !n;
337
284
  }
338
285
  async createDataForPlot(e, t) {
339
286
  return {
@@ -343,6 +290,6 @@ class ee {
343
290
  }
344
291
  }
345
292
  export {
346
- ee as ControllerBase
293
+ W as ControllerBase
347
294
  };
348
295
  //# sourceMappingURL=ControllerBase.js.map