@milaboratories/graph-maker 1.1.143 → 1.1.145
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/GraphMaker/index.vue.d.ts.map +1 -1
- package/dist/GraphMaker/index.vue.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/getCells.js +64 -64
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/getCells.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/utils/calculateCaptionTails.js +31 -31
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/utils/calculateCaptionTails.js.map +1 -1
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/ComponentController.js +39 -32
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/ComponentController.js.map +1 -1
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/ControllerBase.js +68 -62
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/ControllerBase.js.map +1 -1
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/dendro.js +5 -5
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/histogram.js +8 -8
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/scatterplot-umap.js +3 -3
- package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/controllersByChartType/scatterplot.js +6 -6
- package/dist/node_modules/@milaboratories/pf-plots/dist/index.js +12 -9
- package/dist/node_modules/@milaboratories/pf-plots/dist/index.js.map +1 -1
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-error-like/dist/{index.js → error_like_shape.js} +1 -1
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-error-like/dist/error_like_shape.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/drivers/blob.js +8 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/drivers/blob.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/data_types.js +63 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/data_types.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/linker_columns.js +152 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/linker_columns.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/spec.js +189 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/spec.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/errors.js +18 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/errors.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/json.js +12 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/json.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/plid.js +7 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/plid.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/ref.js +8 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/ref.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@platforma-sdk/model/dist/components/PlDataTable.js +13 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@platforma-sdk/model/dist/components/PlDataTable.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@platforma-sdk/model/dist/render/util/label.js +89 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@platforma-sdk/model/dist/render/util/label.js.map +1 -0
- package/dist/node_modules/@milaboratories/pf-plots/dist/pframe/ColumnsProvider.js +50 -45
- package/dist/node_modules/@milaboratories/pf-plots/dist/pframe/ColumnsProvider.js.map +1 -1
- package/dist/node_modules/@milaboratories/pf-plots/dist/utils.js +54 -50
- package/dist/node_modules/@milaboratories/pf-plots/dist/utils.js.map +1 -1
- package/package.json +4 -4
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-error-like/dist/index.js.map +0 -1
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/index.js +0 -979
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@milaboratories/pl-model-common/dist/index.js.map +0 -1
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@platforma-sdk/model/dist/index.js +0 -1599
- package/dist/node_modules/@milaboratories/pf-plots/dist/node_modules/@platforma-sdk/model/dist/index.js.map +0 -1
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "../node_modules/@milaboratories/pl-model-common/dist/drivers/blob.js";
|
|
2
|
+
import "../node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/spec.js";
|
|
3
|
+
import "../_virtual/canonicalize.js";
|
|
4
|
+
import "../node_modules/@milaboratories/pl-model-common/dist/plid.js";
|
|
5
|
+
import "../node_modules/@milaboratories/pl-model-common/dist/ref.js";
|
|
6
|
+
import "../node_modules/@platforma-sdk/model/dist/render/util/label.js";
|
|
7
|
+
import { isLabelColumn as H } from "../node_modules/@platforma-sdk/model/dist/components/PlDataTable.js";
|
|
8
|
+
import "../node_modules/@milaboratories/pl-error-like/dist/error_like_shape.js";
|
|
2
9
|
import { DISCRETE_FILTER_KEY as L, SUBSET_FILTER_KEY as q, IS_LINKER_COLUMN as G } from "../constants.js";
|
|
3
10
|
import { columnOrAxisIdFromString as I, isColumnId as B, AxisId as C } from "../spec.js";
|
|
4
11
|
import { getStateCopy as W, getNotAllowedAxes as M, axisMustBeConsumed as X, getColumnOrAxisLabel as R } from "../utils.js";
|
|
5
|
-
var
|
|
6
|
-
const
|
|
12
|
+
var J = Object.defineProperty, Q = (f, e, t) => e in f ? J(f, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : f[e] = t, g = (f, e, t) => Q(f, typeof e != "symbol" ? e + "" : e, t);
|
|
13
|
+
const V = (f) => {
|
|
7
14
|
var e;
|
|
8
15
|
return ((e = f == null ? void 0 : f.annotations) == null ? void 0 : e[G]) === "true";
|
|
9
16
|
}, _ = class K {
|
|
@@ -15,9 +22,9 @@ const Q = (f) => {
|
|
|
15
22
|
dependsOn: s = [],
|
|
16
23
|
parentComponents: c = [],
|
|
17
24
|
annotations: l = {},
|
|
18
|
-
checkSourceBySpec:
|
|
25
|
+
checkSourceBySpec: u
|
|
19
26
|
}) {
|
|
20
|
-
g(this, "componentName"), g(this, "allowedTypes"), g(this, "settings"), g(this, "dependsOn"), g(this, "parentComponents"), g(this, "strictlyDependsOnParents"), g(this, "annotations"), g(this, "checkSourceBySpec"), this.componentName = e, this.allowedTypes = [...t], this.settings = { ...K.DefaultSettings, ...n }, this.dependsOn = [...s], this.parentComponents = [...c], this.strictlyDependsOnParents = i ?? !0, this.annotations = { ...l },
|
|
27
|
+
g(this, "componentName"), g(this, "allowedTypes"), g(this, "settings"), g(this, "dependsOn"), g(this, "parentComponents"), g(this, "strictlyDependsOnParents"), g(this, "annotations"), g(this, "checkSourceBySpec"), this.componentName = e, this.allowedTypes = [...t], this.settings = { ...K.DefaultSettings, ...n }, this.dependsOn = [...s], this.parentComponents = [...c], this.strictlyDependsOnParents = i ?? !0, this.annotations = { ...l }, u && (this.checkSourceBySpec = u);
|
|
21
28
|
}
|
|
22
29
|
get isRequired() {
|
|
23
30
|
return this.settings.required;
|
|
@@ -39,7 +46,7 @@ const Q = (f) => {
|
|
|
39
46
|
const d = C.fromAxisSpec(r).toCanonicalString();
|
|
40
47
|
return s.has(d);
|
|
41
48
|
}
|
|
42
|
-
const
|
|
49
|
+
const u = await Promise.all(
|
|
43
50
|
i.selectorStates.map(async ({ selectedSource: r }) => {
|
|
44
51
|
const d = I(r);
|
|
45
52
|
if (B(d)) {
|
|
@@ -50,7 +57,7 @@ const Q = (f) => {
|
|
|
50
57
|
})
|
|
51
58
|
);
|
|
52
59
|
return i.selectorStates.reduce(
|
|
53
|
-
(r, d, o) => (r[d.selectedSource] =
|
|
60
|
+
(r, d, o) => (r[d.selectedSource] = u[o], r),
|
|
54
61
|
{}
|
|
55
62
|
);
|
|
56
63
|
}
|
|
@@ -78,8 +85,8 @@ const Q = (f) => {
|
|
|
78
85
|
for (const c of i)
|
|
79
86
|
if (B(c)) {
|
|
80
87
|
const l = await e.pFrameProvider.getColumnSpecById(c);
|
|
81
|
-
(n = l == null ? void 0 : l.axesSpec) == null || n.forEach((
|
|
82
|
-
const r = C.fromAxisSpec(
|
|
88
|
+
(n = l == null ? void 0 : l.axesSpec) == null || n.forEach((u) => {
|
|
89
|
+
const r = C.fromAxisSpec(u);
|
|
83
90
|
s.add(r.toCanonicalString());
|
|
84
91
|
});
|
|
85
92
|
}
|
|
@@ -87,7 +94,7 @@ const Q = (f) => {
|
|
|
87
94
|
}
|
|
88
95
|
async getAllowedAxes(e, t) {
|
|
89
96
|
var n, i;
|
|
90
|
-
const s = this.getParentSelectedSources(e, t), c = /* @__PURE__ */ new Set(), l = [],
|
|
97
|
+
const s = this.getParentSelectedSources(e, t), c = /* @__PURE__ */ new Set(), l = [], u = /* @__PURE__ */ new Map();
|
|
91
98
|
for (const r of s)
|
|
92
99
|
if (B(r)) {
|
|
93
100
|
const d = await e.pFrameProvider.getColumnSpecById(r);
|
|
@@ -97,7 +104,7 @@ const Q = (f) => {
|
|
|
97
104
|
continue;
|
|
98
105
|
c.add(p), l.push(o);
|
|
99
106
|
const v = X(o);
|
|
100
|
-
|
|
107
|
+
u.set(p, {
|
|
101
108
|
kind: "axis",
|
|
102
109
|
name: o.name,
|
|
103
110
|
label: await R(e, p, [
|
|
@@ -114,25 +121,25 @@ const Q = (f) => {
|
|
|
114
121
|
});
|
|
115
122
|
}
|
|
116
123
|
}
|
|
117
|
-
return { parentAxes: c, parentAxesList: l, optionsInfo:
|
|
124
|
+
return { parentAxes: c, parentAxesList: l, optionsInfo: u };
|
|
118
125
|
}
|
|
119
|
-
async getOptions(e, t, n, i, s, c, l = /* @__PURE__ */ new Set(),
|
|
126
|
+
async getOptions(e, t, n, i, s, c, l = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Set()) {
|
|
120
127
|
var r, d, o;
|
|
121
128
|
const p = this.settings.multipleSelectors, v = this.settings.required, O = await this.checkStateConsistency(e, t, s);
|
|
122
129
|
if (this.dependsOn.length && this.dependsOn.some((h) => t.components[h].selectorStates.length === 0))
|
|
123
130
|
return { multipleSelectors: p, required: v, stateConsistency: O, options: [], optionsInfo: /* @__PURE__ */ new Map() };
|
|
124
131
|
if (this.strictlyDependsOnParents && !this.settings.isDataComponent && this.parentComponents.some((h) => t.components[h].selectorStates.length === 0))
|
|
125
132
|
return { multipleSelectors: p, required: v, stateConsistency: O, options: [], optionsInfo: /* @__PURE__ */ new Map() };
|
|
126
|
-
const j = this.getParentSelectedSources(e, t), U = (await e.pFrameProvider.getColumns([], !1, this.allowedTypes, void 0, this.annotations)).filter((h) => !i.has(h.toCanonicalString())), { parentAxes: D, parentAxesList: Y, optionsInfo: F } = await this.getAllowedAxes(e, t), z = t.components[this.componentName],
|
|
133
|
+
const j = this.getParentSelectedSources(e, t), U = (await e.pFrameProvider.getColumns([], !1, this.allowedTypes, void 0, this.annotations)).filter((h) => !i.has(h.toCanonicalString())), { parentAxes: D, parentAxesList: Y, optionsInfo: F } = await this.getAllowedAxes(e, t), z = t.components[this.componentName], N = [];
|
|
127
134
|
if (this.settings.axesAllowed)
|
|
128
135
|
for (const h of D) {
|
|
129
136
|
const y = I(h), S = F.get(y.toCanonicalString()), w = this.allowedTypes.includes(S.spec.type), a = Object.entries(this.annotations).every(
|
|
130
|
-
([E,
|
|
137
|
+
([E, m]) => {
|
|
131
138
|
var x;
|
|
132
|
-
return ((x = S.spec.annotations) == null ? void 0 : x[E]) ===
|
|
139
|
+
return ((x = S.spec.annotations) == null ? void 0 : x[E]) === m;
|
|
133
140
|
}
|
|
134
|
-
), A = this.checkSourceBySpec ? this.checkSourceBySpec(S.spec, t) : !0,
|
|
135
|
-
w && a && A &&
|
|
141
|
+
), A = this.checkSourceBySpec ? this.checkSourceBySpec(S.spec, t) : !0, T = !this.settings.homogeneous || !(S != null && S.mustBeConsumed), b = !i.has(h), P = l.has(y.name) || u.has(y.toCanonicalString()), k = z.selectorStates.some((E) => E.selectedSource === h);
|
|
142
|
+
w && a && A && T && b && !P && !k && N.push({ value: h });
|
|
136
143
|
}
|
|
137
144
|
if (this.settings.columnsAllowed) {
|
|
138
145
|
const h = !this.settings.columnsWithExtraAxesAllowed && this.strictlyDependsOnParents;
|
|
@@ -145,23 +152,23 @@ const Q = (f) => {
|
|
|
145
152
|
Y,
|
|
146
153
|
D,
|
|
147
154
|
s
|
|
148
|
-
).map((
|
|
155
|
+
).map((m) => C.fromAxisSpec(m).toCanonicalString()), T = new Set(A);
|
|
149
156
|
if (
|
|
150
157
|
// do not add to available options label columns, or columns that are not fit by custom spec condition, or columns that are not fit by condition for data inputs
|
|
151
|
-
H(a) ||
|
|
152
|
-
const x = C.fromAxisSpec(
|
|
158
|
+
H(a) || V(a) || this.checkSourceBySpec && !this.checkSourceBySpec(a, t) || this.settings.isDataComponent && !c(a) || h && A.length > 0 || j.length && A.length > 0 && !a.axesSpec.some((m) => {
|
|
159
|
+
const x = C.fromAxisSpec(m).toCanonicalString();
|
|
153
160
|
return D.has(x);
|
|
154
161
|
})
|
|
155
162
|
)
|
|
156
163
|
continue;
|
|
157
|
-
const
|
|
158
|
-
if (this.settings.columnsWithExtraAxesAllowed &&
|
|
159
|
-
|
|
164
|
+
const b = ((r = a == null ? void 0 : a.axesSpec) == null ? void 0 : r.map((m) => C.fromAxisSpec(m).toCanonicalString())) ?? [], P = {};
|
|
165
|
+
if (this.settings.columnsWithExtraAxesAllowed && b.forEach((m, x) => {
|
|
166
|
+
T.has(m) && (P[m] = x);
|
|
160
167
|
}), a) {
|
|
161
|
-
const
|
|
168
|
+
const m = n[S] ?? await R(e, y.toCanonicalString(), []), x = {
|
|
162
169
|
kind: "column",
|
|
163
170
|
name: a.name,
|
|
164
|
-
label:
|
|
171
|
+
label: m,
|
|
165
172
|
type: a.valueType,
|
|
166
173
|
spec: a,
|
|
167
174
|
annotations: a.annotations,
|
|
@@ -172,13 +179,13 @@ const Q = (f) => {
|
|
|
172
179
|
};
|
|
173
180
|
F.set(w.toCanonicalString(), x);
|
|
174
181
|
}
|
|
175
|
-
const k = l.has(w.name) ||
|
|
176
|
-
(
|
|
182
|
+
const k = l.has(w.name) || u.has(w.toCanonicalString()), E = t.components[this.componentName].selectorStates.some(
|
|
183
|
+
(m) => m.selectedSource === S
|
|
177
184
|
);
|
|
178
|
-
!k && !E &&
|
|
185
|
+
!k && !E && N.push({ value: S });
|
|
179
186
|
}
|
|
180
187
|
}
|
|
181
|
-
return { multipleSelectors: p, required: v, stateConsistency: O, options:
|
|
188
|
+
return { multipleSelectors: p, required: v, stateConsistency: O, options: N, optionsInfo: F };
|
|
182
189
|
}
|
|
183
190
|
};
|
|
184
191
|
g(_, "DefaultSettings", {
|
|
@@ -191,8 +198,8 @@ g(_, "DefaultSettings", {
|
|
|
191
198
|
columnsWithExtraAxesAllowed: !0,
|
|
192
199
|
dimensionConsumer: !1
|
|
193
200
|
});
|
|
194
|
-
let
|
|
201
|
+
let le = _;
|
|
195
202
|
export {
|
|
196
|
-
|
|
203
|
+
le as ComponentController
|
|
197
204
|
};
|
|
198
205
|
//# sourceMappingURL=ComponentController.js.map
|
package/dist/node_modules/@milaboratories/pf-plots/dist/controllers/ComponentController.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComponentController.js","sources":["../../../../../../node_modules/@milaboratories/pf-plots/src/controllers/ComponentController.ts"],"sourcesContent":["import {isLabelColumn} from '@platforma-sdk/model';\nimport type {\n AxisData,\n ColumnData,\n ComponentGuideSimple,\n ComponentState,\n InputState,\n SelectorState,\n SelectorStateFilter,\n SelectorStateSimple,\n SourceOption,\n} from '../common';\nimport {\n DISCRETE_FILTER_KEY,\n IS_LINKER_COLUMN,\n SUBSET_FILTER_KEY,\n} from '../constants';\nimport type {DataStore} from '../store';\nimport type {ColumnId, ColumnOrAxisIdString} from '../spec';\nimport {AxisId, columnOrAxisIdFromString, isColumnId} from '../spec';\nimport type {AxisSpec, LinkerMap, PColumnSpec, ValueType} from '@milaboratories/pl-model-common';\nimport {axisMustBeConsumed, getColumnOrAxisLabel, getNotAllowedAxes, getStateCopy} from '../utils';\n\nconst isLinkerColumn = (columnSpec:PColumnSpec) => columnSpec?.annotations?.[IS_LINKER_COLUMN] === 'true';\n\ninterface ComponentControllerSettings {\n isDataComponent: boolean; // X, Y, Data source etc.\n multipleSelectors: boolean; // more than 1 selected column in input\n required: boolean;\n homogeneous: boolean;\n axesAllowed: boolean;\n columnsAllowed: boolean;\n columnsWithExtraAxesAllowed: boolean; // can contain column with extra axes with fixed values\n dimensionConsumer: boolean; // remove extra dimension from data-mapping after selecting a heterogeneous axis\n}\n\ninterface FieldControllerOptions<State extends InputState, Field extends keyof State['components']> {\n componentName: Field;\n allowedTypes: ValueType[];\n checkSourceBySpec?: (spec: AxisSpec | PColumnSpec, state: State) => boolean; // for more complicated logic than type is in allowed types and annotation exists\n annotations?: Record<string, string>;\n parentComponents?: (keyof State['components'])[];\n dependsOn?: (keyof State['components'])[];\n strictlyDependsOnParents?: boolean;\n ignoredOptionIds?: string[];\n settings: Partial<ComponentControllerSettings>;\n}\n\nexport class ComponentController<State extends InputState, Field extends keyof State['components']> {\n private static DefaultSettings: ComponentControllerSettings = {\n isDataComponent: false,\n multipleSelectors: false,\n required: false,\n homogeneous: false,\n axesAllowed: false,\n columnsAllowed: true,\n columnsWithExtraAxesAllowed: true,\n dimensionConsumer: false,\n };\n\n readonly componentName: Field;\n readonly allowedTypes: ValueType[];\n readonly settings: ComponentControllerSettings;\n private readonly dependsOn: (keyof State['components'])[];\n private readonly parentComponents: (keyof State['components'])[];\n private readonly strictlyDependsOnParents: boolean;\n private readonly annotations: Record<string, string>;\n private readonly checkSourceBySpec?: (spec: AxisSpec | PColumnSpec, state: State) => boolean;\n\n constructor({\n componentName,\n allowedTypes,\n settings,\n strictlyDependsOnParents,\n dependsOn = [],\n parentComponents = [],\n annotations = {},\n checkSourceBySpec,\n }: FieldControllerOptions<State, Field>) {\n this.componentName = componentName;\n this.allowedTypes = [...allowedTypes];\n this.settings = {...ComponentController.DefaultSettings, ...settings};\n this.dependsOn = [...dependsOn];\n this.parentComponents = [...parentComponents]; // corresponding data components for meta or X for Y in scatterplot\n this.strictlyDependsOnParents = strictlyDependsOnParents ?? true; // meta-inputs are strictly-depending on parents, X by Y (Y by X) - don't\n this.annotations = {...annotations};\n if (checkSourceBySpec) {\n this.checkSourceBySpec = checkSourceBySpec;\n }\n }\n\n get isRequired(): boolean {\n return this.settings.required;\n }\n\n get isDimensionsConsumer(): boolean {\n return this.settings.dimensionConsumer;\n }\n\n addSelected(state: State, selectorState: SelectorStateSimple | SelectorStateFilter) {\n const nextState = getStateCopy(state);\n nextState.components[this.componentName].selectorStates.push(selectorState as SelectorStateFilter);\n\n // ***\n // here should be logic for possibly parent qualifications updating\n // ***\n\n return nextState;\n }\n\n deleteSelected(state: State, selectedSourceStr: ColumnOrAxisIdString) {\n const nextState = getStateCopy(state);\n // ***\n // here should be logic for removing unnecessary qualifications (it can appear when some sources are deleted)\n // ***\n nextState.components[this.componentName].selectorStates = (\n nextState.components[this.componentName].selectorStates as SelectorState[]\n ).filter(item => item.selectedSource !== selectedSourceStr);\n return nextState;\n }\n\n async checkStateConsistency(\n store: DataStore,\n state: State,\n linkerMap: LinkerMap\n ): Promise<Record<string, boolean>> {\n const componentState = state.components[this.componentName as keyof InputState];\n const {parentAxes, parentAxesList} = await this.getAllowedAxes(store, state);\n \n function isAxisInSet(a: AxisSpec) {\n const id = AxisId.fromAxisSpec(a).toCanonicalString();\n return parentAxes.has(id);\n }\n\n const consistencyData = await Promise.all(\n componentState.selectorStates.map(async ({selectedSource}) => {\n const sourceId = columnOrAxisIdFromString(selectedSource);\n // if column selected - check all axes of column\n if (isColumnId(sourceId)) {\n const columnSpec = await store.pFrameProvider.getColumnSpecById(sourceId);\n if (!columnSpec) {\n // if column is not in store - current store and selected column are not consistent\n return false;\n }\n\n const parents = this.parentComponents;\n if (parents.length === 0) {\n return true;\n }\n if ((this.strictlyDependsOnParents && !this.settings.columnsWithExtraAxesAllowed) && !this.settings.isDataComponent) {\n return columnSpec.axesSpec.every(a => isAxisInSet(a));\n } else if (this.settings.columnsWithExtraAxesAllowed && !this.settings.isDataComponent) {\n if (columnSpec.axesSpec.some(a => isAxisInSet(a))) {\n return true;\n }\n\n const notAllowed = getNotAllowedAxes(columnSpec, parentAxesList, parentAxes, linkerMap);\n return notAllowed.length < columnSpec.axesSpec.length;\n } else {\n return parentAxes.size === 0 || columnSpec.axesSpec.some(a => isAxisInSet(a));\n }\n }\n return parentAxes.has(selectedSource);\n })\n );\n return (componentState.selectorStates as (SelectorStateSimple | SelectorStateFilter)[]).reduce(\n (res: Record<string, boolean>, item, idx) => {\n res[item.selectedSource] = consistencyData[idx];\n return res;\n },\n {}\n );\n }\n\n async getProducingAxes(store: DataStore, state: State) {\n const componentState = state.components[this.componentName as keyof InputState];\n const selectedHereIds = componentState.selectorStates.map(s => columnOrAxisIdFromString(s.selectedSource));\n const selectedHereColumnIds = selectedHereIds.filter(id => isColumnId(id));\n\n const axes = new Set<ColumnOrAxisIdString>();\n\n const infoList = await Promise.all(\n selectedHereColumnIds.map(id => {\n return store.pFrameProvider.getColumnSpecById(id);\n })\n );\n\n infoList.forEach(columnSpec => {\n if (columnSpec) {\n columnSpec.axesSpec.forEach(axisSpec => {\n axes.add(AxisId.fromAxisSpec(axisSpec).toCanonicalString());\n });\n }\n });\n return axes;\n }\n\n getParentSelectedSources(store: DataStore, state: State): (ColumnId | AxisId)[] {\n const selectedSources = this.parentComponents.reduce((res: (ColumnId | AxisId)[], item) => {\n const selectedHere = state.components[item].selectorStates.map(s =>\n columnOrAxisIdFromString(s.selectedSource)\n );\n res.push(...selectedHere);\n return res;\n }, []);\n\n // ***\n // consider parent qualifications without selected here\n // ***\n return selectedSources;\n }\n\n async getParentAxes(store: DataStore, state: State) {\n const parentSelectedSources = this.getParentSelectedSources(store, state);\n const axes = new Set<ColumnOrAxisIdString>();\n\n for (const source of parentSelectedSources) {\n if (isColumnId(source)) {\n const columnSpec = await store.pFrameProvider.getColumnSpecById(source);\n columnSpec?.axesSpec?.forEach(spec => {\n const id = AxisId.fromAxisSpec(spec);\n axes.add(id.toCanonicalString());\n });\n }\n }\n return axes;\n }\n\n async getAllowedAxes(store: DataStore, state: State) {\n const parentSelectedSources = this.getParentSelectedSources(store, state);\n const parentAxes = new Set<ColumnOrAxisIdString>();\n const parentAxesList:AxisSpec[] = [];\n const optionsInfo: Map<string, AxisData | ColumnData> = new Map();\n\n for (const source of parentSelectedSources) {\n if (isColumnId(source)) {\n const columnSpec = await store.pFrameProvider.getColumnSpecById(source);\n for (const spec of columnSpec?.axesSpec ?? []) {\n const id = AxisId.fromAxisSpec(spec);\n const idStr = id.toCanonicalString();\n if (parentAxes.has(idStr)) {\n continue;\n }\n parentAxes.add(idStr);\n parentAxesList.push(spec);\n const mustBeConsumed = axisMustBeConsumed(spec); // request unique values only for non-homogenous axes\n optionsInfo.set(idStr, {\n kind: 'axis',\n name: spec.name,\n label: await getColumnOrAxisLabel(store, idStr, [\n source.toCanonicalString(),\n ]),\n type: spec.type,\n mustBeConsumed,\n dividable: false,\n spec,\n annotations: spec.annotations,\n isSubsetFilter: spec.annotations?.[SUBSET_FILTER_KEY] === 'true',\n isDiscreteFilter:\n spec.type === 'String' || spec.annotations?.[DISCRETE_FILTER_KEY] === 'true',\n parentSources: [source.toCanonicalString()],\n });\n }\n }\n }\n\n return {parentAxes, parentAxesList, optionsInfo};\n }\n\n async getOptions(\n store: DataStore,\n state: State,\n labelsMap: Record<string, string>,\n consumedSourcesSet: Set<ColumnOrAxisIdString>,\n linkerMap: LinkerMap,\n dataColumnPredicate: (spec: PColumnSpec) => boolean,\n ignoredNamesSet: Set<string> = new Set(),\n fixedSelectedSet: Set<ColumnOrAxisIdString> = new Set()\n ): Promise<ComponentGuideSimple> {\n const multipleSelectors = this.settings.multipleSelectors;\n const required = this.settings.required;\n const stateConsistency = await this.checkStateConsistency(store, state, linkerMap);\n\n if (this.dependsOn.length && this.dependsOn.some(dep => state.components[dep].selectorStates.length === 0)) {\n return {multipleSelectors, required, stateConsistency, options: [], optionsInfo: new Map()};\n }\n\n if (\n this.strictlyDependsOnParents &&\n !this.settings.isDataComponent &&\n this.parentComponents.some(name => state.components[name].selectorStates.length === 0)\n ) {\n return {multipleSelectors, required, stateConsistency, options: [], optionsInfo: new Map()};\n }\n\n const parentSelectedSources = this.getParentSelectedSources(store, state);\n const allowedColumns = (\n await store.pFrameProvider.getColumns([], false, this.allowedTypes, undefined, this.annotations)\n ).filter(item => !consumedSourcesSet.has(item.toCanonicalString()));\n\n const {parentAxes, parentAxesList, optionsInfo} = await this.getAllowedAxes(store, state);\n\n const thisState: ComponentState = state.components[this.componentName];\n const options: SourceOption[] = [];\n if (this.settings.axesAllowed) {\n for (const idStr of parentAxes) {\n const id = columnOrAxisIdFromString(idStr) as AxisId;\n const axisData = optionsInfo.get(id.toCanonicalString()) as AxisData;\n\n const typeOK = this.allowedTypes.includes(axisData.spec.type);\n const annotationsOK = Object.entries(this.annotations).every(\n ([k, v]) => axisData.spec.annotations?.[k] === v\n );\n const checkBySpecOK = this.checkSourceBySpec ? this.checkSourceBySpec(axisData.spec, state) : true;\n const axisNatureOK = !this.settings.homogeneous || !axisData?.mustBeConsumed;\n const decreasingDimensionsOK = !consumedSourcesSet.has(idStr);\n const ignored = ignoredNamesSet.has(id.name) || fixedSelectedSet.has(id.toCanonicalString());\n const selectedHere = thisState.selectorStates.some(item => item.selectedSource === idStr);\n\n if (typeOK && annotationsOK && checkBySpecOK && axisNatureOK && decreasingDimensionsOK && !ignored && !selectedHere) {\n options.push({value: idStr});\n }\n }\n }\n\n if (this.settings.columnsAllowed) {\n const strictlyCompatible = !this.settings.columnsWithExtraAxesAllowed && this.strictlyDependsOnParents;\n for (const columnId of allowedColumns) {\n const columnIdString = columnId.toCanonicalString();\n const id = columnOrAxisIdFromString(columnIdString);\n\n const columnSpec = await store.pFrameProvider.getColumnSpecById(id);\n if (!columnSpec) {\n continue;\n }\n const extraAxesIds = getNotAllowedAxes(\n columnSpec,\n parentAxesList,\n parentAxes,\n linkerMap\n ).map((axisSpec) => AxisId.fromAxisSpec(axisSpec).toCanonicalString());\n\n const extraAxesSet = new Set(extraAxesIds);\n if (\n // do not add to available options label columns, or columns that are not fit by custom spec condition, or columns that are not fit by condition for data inputs\n isLabelColumn(columnSpec) || isLinkerColumn(columnSpec) ||\n (this.checkSourceBySpec && !this.checkSourceBySpec(columnSpec, state)) ||\n (this.settings.isDataComponent && !dataColumnPredicate(columnSpec)) ||\n strictlyCompatible && extraAxesIds.length > 0 ||\n parentSelectedSources.length && extraAxesIds.length > 0 && !columnSpec.axesSpec.some((axisSpec) => {\n const axisIdStr = AxisId.fromAxisSpec(axisSpec).toCanonicalString();\n return parentAxes.has(axisIdStr);\n })\n ) {\n continue;\n }\n const axesIds = columnSpec?.axesSpec?.map(axisSpec => AxisId.fromAxisSpec(axisSpec).toCanonicalString()) ?? [];\n const extraAxesIndexes:Record<string, number> = {};\n if (this.settings.columnsWithExtraAxesAllowed) {\n axesIds.forEach((id, idx) => {\n if (extraAxesSet.has(id)) {\n extraAxesIndexes[id] = idx;\n }\n });\n }\n if (columnSpec) {\n const label =\n labelsMap[columnIdString] ??\n (await getColumnOrAxisLabel(store, columnId.toCanonicalString(), []));\n const columnInfo: ColumnData = {\n kind: 'column',\n name: columnSpec.name,\n label,\n type: columnSpec.valueType,\n spec: columnSpec,\n annotations: columnSpec.annotations,\n isSubsetFilter: columnSpec.annotations?.[SUBSET_FILTER_KEY] === 'true',\n isDiscreteFilter:\n columnSpec.valueType === 'String' ||\n columnSpec.annotations?.[DISCRETE_FILTER_KEY] === 'true',\n axesToBeFixed: extraAxesIds,\n axesToBeFixedIndexes: extraAxesIndexes,\n };\n optionsInfo.set(id.toCanonicalString(), columnInfo);\n }\n\n const ignored = ignoredNamesSet.has(id.name) || fixedSelectedSet.has(id.toCanonicalString());\n const selectedHere = state.components[this.componentName].selectorStates.some(\n item => item.selectedSource === columnIdString\n );\n if (!ignored && !selectedHere) {\n options.push({value: columnIdString});\n }\n }\n }\n return {multipleSelectors, required, stateConsistency, options, optionsInfo};\n }\n}\n"],"names":["isLinkerColumn","columnSpec","_a","IS_LINKER_COLUMN","_ComponentController","componentName","allowedTypes","settings","strictlyDependsOnParents","dependsOn","parentComponents","annotations","checkSourceBySpec","__publicField","state","selectorState","nextState","getStateCopy","selectedSourceStr","item","store","linkerMap","componentState","parentAxes","parentAxesList","isAxisInSet","a","id","AxisId","consistencyData","selectedSource","sourceId","columnOrAxisIdFromString","isColumnId","C","getNotAllowedAxes","res","idx","selectedHereColumnIds","n","s","axes","axisSpec","selectedHere","parentSelectedSources","source","spec","optionsInfo","idStr","mustBeConsumed","axisMustBeConsumed","getColumnOrAxisLabel","SUBSET_FILTER_KEY","_b","DISCRETE_FILTER_KEY","labelsMap","consumedSourcesSet","dataColumnPredicate","ignoredNamesSet","fixedSelectedSet","multipleSelectors","required","stateConsistency","dep","name","allowedColumns","thisState","options","axisData","typeOK","annotationsOK","k","v","checkBySpecOK","axisNatureOK","decreasingDimensionsOK","ignored","strictlyCompatible","columnId","columnIdString","extraAxesIds","extraAxesSet","isLabelColumn","axisIdStr","axesIds","extraAxesIndexes","label","columnInfo","_c","ComponentController"],"mappings":";;;;;AAuBA,MAAMA,IAAiB,CAACC,MAA2B;;AAAA,WAAAC,IAAAD,KAAA,OAAA,SAAAA,EAAY,gBAAZ,OAAA,SAAAC,EAA0BC,CAAAA,OAAsB;AAAA,GAyBtFC,IAAN,MAAMA,EAAuF;AAAA,EAqBhG,YAAY;AAAA,IACR,eAAAC;AAAAA,IACA,cAAAC;AAAAA,IACA,UAAAC;AAAAA,IACA,0BAAAC;AAAAA,IACA,WAAAC,IAAY,CAAA;AAAA,IACZ,kBAAAC,IAAmB,CAAA;AAAA,IACnB,aAAAC,IAAc,CAAA;AAAA,IACd,mBAAAC;AAAAA,EAAA,GACqC;AAlBhCC,MAAA,MAAA,eAAA,GACAA,EAAA,MAAA,cAAA,GACAA,EAAA,MAAA,UAAA,GACQA,EAAA,MAAA,WAAA,GACAA,EAAA,MAAA,kBAAA,GACAA,EAAA,MAAA,0BAAA,GACAA,EAAA,MAAA,aAAA,GACAA,EAAA,MAAA,mBAAA,GAYb,KAAK,gBAAgBR,GAChB,KAAA,eAAe,CAAC,GAAGC,CAAY,GACpC,KAAK,WAAW,EAAC,GAAGF,EAAoB,iBAAiB,GAAGG,KACvD,KAAA,YAAY,CAAC,GAAGE,CAAS,GACzB,KAAA,mBAAmB,CAAC,GAAGC,CAAgB,GAC5C,KAAK,2BAA2BF,KAA4B,IACvD,KAAA,cAAc,EAAC,GAAGG,KACnBC,MACA,KAAK,oBAAoBA;AAAAA,EAC7B;AAAA,EAGJ,IAAI,aAAsB;AACtB,WAAO,KAAK,SAAS;AAAA,EAAA;AAAA,EAGzB,IAAI,uBAAgC;AAChC,WAAO,KAAK,SAAS;AAAA,EAAA;AAAA,EAGzB,YAAYE,GAAcC,GAA0D;AAC1E,UAAAC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,EAAyBD,CAAAA,OAAuB;AAAA,YAChE,kBACInD,EAAW,cAAc,cACzBuF,IAAAvF,EAAW,gBAAX,OAAA,SAAAuF,EAAyBlC,CAAAA,OAAyB;AAAA,YACtD,eAAe0B;AAAAA,YACf,sBAAsBK;AAAAA,UAAA;AAE1BtC,UAAAA,EAAY,IAAIpB,EAAG,kBAAA,GAAqB4D,CAAU;AAAA,QAAA;AAGhD,cAAAX,IAAUlB,EAAgB,IAAI/B,EAAG,IAAI,KAAKgC,EAAiB,IAAIhC,EAAG,mBAAmB,GACrFgB,IAAe7B,EAAM,WAAW,KAAK,aAAa,EAAE,eAAe;AAAA,UACrE,CAAAK,MAAQA,EAAK,mBAAmB4D;AAAAA,QAAA;AAEhC,SAACH,KAAW,CAACjC,KACbwB,EAAQ,KAAK,EAAC,OAAOY,GAAe;AAAA,MACxC;AAAA,IACJ;AAEJ,WAAO,EAAC,mBAAAnB,GAAmB,UAAAC,GAAU,kBAAAC,GAAkB,SAAAK,GAAS,aAAApB,EAAAA;AAAAA,EAAW;AAEnF;AA5VIlC,EADST,GACM,mBAA+C;AAAA,EAC1D,iBAAiB;AAAA,EACjB,mBAAmB;AAAA,EACnB,UAAU;AAAA,EACV,aAAa;AAAA,EACb,aAAa;AAAA,EACb,gBAAgB;AAAA,EAChB,6BAA6B;AAAA,EAC7B,mBAAmB;AACvB,CAAA;AAVG,IAAMqF,KAANrF;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"ComponentController.js","sources":["../../../../../../node_modules/@milaboratories/pf-plots/src/controllers/ComponentController.ts"],"sourcesContent":["import {isLabelColumn} from '@platforma-sdk/model';\nimport type {\n AxisData,\n ColumnData,\n ComponentGuideSimple,\n ComponentState,\n InputState,\n SelectorState,\n SelectorStateFilter,\n SelectorStateSimple,\n SourceOption,\n} from '../common';\nimport {\n DISCRETE_FILTER_KEY,\n IS_LINKER_COLUMN,\n SUBSET_FILTER_KEY,\n} from '../constants';\nimport type {DataStore} from '../store';\nimport type {ColumnId, ColumnOrAxisIdString} from '../spec';\nimport {AxisId, columnOrAxisIdFromString, isColumnId} from '../spec';\nimport type {AxisSpec, LinkerMap, PColumnSpec, ValueType} from '@milaboratories/pl-model-common';\nimport {axisMustBeConsumed, getColumnOrAxisLabel, getNotAllowedAxes, getStateCopy} from '../utils';\n\nconst isLinkerColumn = (columnSpec:PColumnSpec) => columnSpec?.annotations?.[IS_LINKER_COLUMN] === 'true';\n\ninterface ComponentControllerSettings {\n isDataComponent: boolean; // X, Y, Data source etc.\n multipleSelectors: boolean; // more than 1 selected column in input\n required: boolean;\n homogeneous: boolean;\n axesAllowed: boolean;\n columnsAllowed: boolean;\n columnsWithExtraAxesAllowed: boolean; // can contain column with extra axes with fixed values\n dimensionConsumer: boolean; // remove extra dimension from data-mapping after selecting a heterogeneous axis\n}\n\ninterface FieldControllerOptions<State extends InputState, Field extends keyof State['components']> {\n componentName: Field;\n allowedTypes: ValueType[];\n checkSourceBySpec?: (spec: AxisSpec | PColumnSpec, state: State) => boolean; // for more complicated logic than type is in allowed types and annotation exists\n annotations?: Record<string, string>;\n parentComponents?: (keyof State['components'])[];\n dependsOn?: (keyof State['components'])[];\n strictlyDependsOnParents?: boolean;\n ignoredOptionIds?: string[];\n settings: Partial<ComponentControllerSettings>;\n}\n\nexport class ComponentController<State extends InputState, Field extends keyof State['components']> {\n private static DefaultSettings: ComponentControllerSettings = {\n isDataComponent: false,\n multipleSelectors: false,\n required: false,\n homogeneous: false,\n axesAllowed: false,\n columnsAllowed: true,\n columnsWithExtraAxesAllowed: true,\n dimensionConsumer: false,\n };\n\n readonly componentName: Field;\n readonly allowedTypes: ValueType[];\n readonly settings: ComponentControllerSettings;\n private readonly dependsOn: (keyof State['components'])[];\n private readonly parentComponents: (keyof State['components'])[];\n private readonly strictlyDependsOnParents: boolean;\n private readonly annotations: Record<string, string>;\n private readonly checkSourceBySpec?: (spec: AxisSpec | PColumnSpec, state: State) => boolean;\n\n constructor({\n componentName,\n allowedTypes,\n settings,\n strictlyDependsOnParents,\n dependsOn = [],\n parentComponents = [],\n annotations = {},\n checkSourceBySpec,\n }: FieldControllerOptions<State, Field>) {\n this.componentName = componentName;\n this.allowedTypes = [...allowedTypes];\n this.settings = {...ComponentController.DefaultSettings, ...settings};\n this.dependsOn = [...dependsOn];\n this.parentComponents = [...parentComponents]; // corresponding data components for meta or X for Y in scatterplot\n this.strictlyDependsOnParents = strictlyDependsOnParents ?? true; // meta-inputs are strictly-depending on parents, X by Y (Y by X) - don't\n this.annotations = {...annotations};\n if (checkSourceBySpec) {\n this.checkSourceBySpec = checkSourceBySpec;\n }\n }\n\n get isRequired(): boolean {\n return this.settings.required;\n }\n\n get isDimensionsConsumer(): boolean {\n return this.settings.dimensionConsumer;\n }\n\n addSelected(state: State, selectorState: SelectorStateSimple | SelectorStateFilter) {\n const nextState = getStateCopy(state);\n nextState.components[this.componentName].selectorStates.push(selectorState as SelectorStateFilter);\n\n // ***\n // here should be logic for possibly parent qualifications updating\n // ***\n\n return nextState;\n }\n\n deleteSelected(state: State, selectedSourceStr: ColumnOrAxisIdString) {\n const nextState = getStateCopy(state);\n // ***\n // here should be logic for removing unnecessary qualifications (it can appear when some sources are deleted)\n // ***\n nextState.components[this.componentName].selectorStates = (\n nextState.components[this.componentName].selectorStates as SelectorState[]\n ).filter(item => item.selectedSource !== selectedSourceStr);\n return nextState;\n }\n\n async checkStateConsistency(\n store: DataStore,\n state: State,\n linkerMap: LinkerMap\n ): Promise<Record<string, boolean>> {\n const componentState = state.components[this.componentName as keyof InputState];\n const {parentAxes, parentAxesList} = await this.getAllowedAxes(store, state);\n \n function isAxisInSet(a: AxisSpec) {\n const id = AxisId.fromAxisSpec(a).toCanonicalString();\n return parentAxes.has(id);\n }\n\n const consistencyData = await Promise.all(\n componentState.selectorStates.map(async ({selectedSource}) => {\n const sourceId = columnOrAxisIdFromString(selectedSource);\n // if column selected - check all axes of column\n if (isColumnId(sourceId)) {\n const columnSpec = await store.pFrameProvider.getColumnSpecById(sourceId);\n if (!columnSpec) {\n // if column is not in store - current store and selected column are not consistent\n return false;\n }\n\n const parents = this.parentComponents;\n if (parents.length === 0) {\n return true;\n }\n if ((this.strictlyDependsOnParents && !this.settings.columnsWithExtraAxesAllowed) && !this.settings.isDataComponent) {\n return columnSpec.axesSpec.every(a => isAxisInSet(a));\n } else if (this.settings.columnsWithExtraAxesAllowed && !this.settings.isDataComponent) {\n if (columnSpec.axesSpec.some(a => isAxisInSet(a))) {\n return true;\n }\n\n const notAllowed = getNotAllowedAxes(columnSpec, parentAxesList, parentAxes, linkerMap);\n return notAllowed.length < columnSpec.axesSpec.length;\n } else {\n return parentAxes.size === 0 || columnSpec.axesSpec.some(a => isAxisInSet(a));\n }\n }\n return parentAxes.has(selectedSource);\n })\n );\n return (componentState.selectorStates as (SelectorStateSimple | SelectorStateFilter)[]).reduce(\n (res: Record<string, boolean>, item, idx) => {\n res[item.selectedSource] = consistencyData[idx];\n return res;\n },\n {}\n );\n }\n\n async getProducingAxes(store: DataStore, state: State) {\n const componentState = state.components[this.componentName as keyof InputState];\n const selectedHereIds = componentState.selectorStates.map(s => columnOrAxisIdFromString(s.selectedSource));\n const selectedHereColumnIds = selectedHereIds.filter(id => isColumnId(id));\n\n const axes = new Set<ColumnOrAxisIdString>();\n\n const infoList = await Promise.all(\n selectedHereColumnIds.map(id => {\n return store.pFrameProvider.getColumnSpecById(id);\n })\n );\n\n infoList.forEach(columnSpec => {\n if (columnSpec) {\n columnSpec.axesSpec.forEach(axisSpec => {\n axes.add(AxisId.fromAxisSpec(axisSpec).toCanonicalString());\n });\n }\n });\n return axes;\n }\n\n getParentSelectedSources(store: DataStore, state: State): (ColumnId | AxisId)[] {\n const selectedSources = this.parentComponents.reduce((res: (ColumnId | AxisId)[], item) => {\n const selectedHere = state.components[item].selectorStates.map(s =>\n columnOrAxisIdFromString(s.selectedSource)\n );\n res.push(...selectedHere);\n return res;\n }, []);\n\n // ***\n // consider parent qualifications without selected here\n // ***\n return selectedSources;\n }\n\n async getParentAxes(store: DataStore, state: State) {\n const parentSelectedSources = this.getParentSelectedSources(store, state);\n const axes = new Set<ColumnOrAxisIdString>();\n\n for (const source of parentSelectedSources) {\n if (isColumnId(source)) {\n const columnSpec = await store.pFrameProvider.getColumnSpecById(source);\n columnSpec?.axesSpec?.forEach(spec => {\n const id = AxisId.fromAxisSpec(spec);\n axes.add(id.toCanonicalString());\n });\n }\n }\n return axes;\n }\n\n async getAllowedAxes(store: DataStore, state: State) {\n const parentSelectedSources = this.getParentSelectedSources(store, state);\n const parentAxes = new Set<ColumnOrAxisIdString>();\n const parentAxesList:AxisSpec[] = [];\n const optionsInfo: Map<string, AxisData | ColumnData> = new Map();\n\n for (const source of parentSelectedSources) {\n if (isColumnId(source)) {\n const columnSpec = await store.pFrameProvider.getColumnSpecById(source);\n for (const spec of columnSpec?.axesSpec ?? []) {\n const id = AxisId.fromAxisSpec(spec);\n const idStr = id.toCanonicalString();\n if (parentAxes.has(idStr)) {\n continue;\n }\n parentAxes.add(idStr);\n parentAxesList.push(spec);\n const mustBeConsumed = axisMustBeConsumed(spec); // request unique values only for non-homogenous axes\n optionsInfo.set(idStr, {\n kind: 'axis',\n name: spec.name,\n label: await getColumnOrAxisLabel(store, idStr, [\n source.toCanonicalString(),\n ]),\n type: spec.type,\n mustBeConsumed,\n dividable: false,\n spec,\n annotations: spec.annotations,\n isSubsetFilter: spec.annotations?.[SUBSET_FILTER_KEY] === 'true',\n isDiscreteFilter:\n spec.type === 'String' || spec.annotations?.[DISCRETE_FILTER_KEY] === 'true',\n parentSources: [source.toCanonicalString()],\n });\n }\n }\n }\n\n return {parentAxes, parentAxesList, optionsInfo};\n }\n\n async getOptions(\n store: DataStore,\n state: State,\n labelsMap: Record<string, string>,\n consumedSourcesSet: Set<ColumnOrAxisIdString>,\n linkerMap: LinkerMap,\n dataColumnPredicate: (spec: PColumnSpec) => boolean,\n ignoredNamesSet: Set<string> = new Set(),\n fixedSelectedSet: Set<ColumnOrAxisIdString> = new Set()\n ): Promise<ComponentGuideSimple> {\n const multipleSelectors = this.settings.multipleSelectors;\n const required = this.settings.required;\n const stateConsistency = await this.checkStateConsistency(store, state, linkerMap);\n\n if (this.dependsOn.length && this.dependsOn.some(dep => state.components[dep].selectorStates.length === 0)) {\n return {multipleSelectors, required, stateConsistency, options: [], optionsInfo: new Map()};\n }\n\n if (\n this.strictlyDependsOnParents &&\n !this.settings.isDataComponent &&\n this.parentComponents.some(name => state.components[name].selectorStates.length === 0)\n ) {\n return {multipleSelectors, required, stateConsistency, options: [], optionsInfo: new Map()};\n }\n\n const parentSelectedSources = this.getParentSelectedSources(store, state);\n const allowedColumns = (\n await store.pFrameProvider.getColumns([], false, this.allowedTypes, undefined, this.annotations)\n ).filter(item => !consumedSourcesSet.has(item.toCanonicalString()));\n\n const {parentAxes, parentAxesList, optionsInfo} = await this.getAllowedAxes(store, state);\n\n const thisState: ComponentState = state.components[this.componentName];\n const options: SourceOption[] = [];\n if (this.settings.axesAllowed) {\n for (const idStr of parentAxes) {\n const id = columnOrAxisIdFromString(idStr) as AxisId;\n const axisData = optionsInfo.get(id.toCanonicalString()) as AxisData;\n\n const typeOK = this.allowedTypes.includes(axisData.spec.type);\n const annotationsOK = Object.entries(this.annotations).every(\n ([k, v]) => axisData.spec.annotations?.[k] === v\n );\n const checkBySpecOK = this.checkSourceBySpec ? this.checkSourceBySpec(axisData.spec, state) : true;\n const axisNatureOK = !this.settings.homogeneous || !axisData?.mustBeConsumed;\n const decreasingDimensionsOK = !consumedSourcesSet.has(idStr);\n const ignored = ignoredNamesSet.has(id.name) || fixedSelectedSet.has(id.toCanonicalString());\n const selectedHere = thisState.selectorStates.some(item => item.selectedSource === idStr);\n\n if (typeOK && annotationsOK && checkBySpecOK && axisNatureOK && decreasingDimensionsOK && !ignored && !selectedHere) {\n options.push({value: idStr});\n }\n }\n }\n\n if (this.settings.columnsAllowed) {\n const strictlyCompatible = !this.settings.columnsWithExtraAxesAllowed && this.strictlyDependsOnParents;\n for (const columnId of allowedColumns) {\n const columnIdString = columnId.toCanonicalString();\n const id = columnOrAxisIdFromString(columnIdString);\n\n const columnSpec = await store.pFrameProvider.getColumnSpecById(id);\n if (!columnSpec) {\n continue;\n }\n const extraAxesIds = getNotAllowedAxes(\n columnSpec,\n parentAxesList,\n parentAxes,\n linkerMap\n ).map((axisSpec) => AxisId.fromAxisSpec(axisSpec).toCanonicalString());\n\n const extraAxesSet = new Set(extraAxesIds);\n if (\n // do not add to available options label columns, or columns that are not fit by custom spec condition, or columns that are not fit by condition for data inputs\n isLabelColumn(columnSpec) || isLinkerColumn(columnSpec) ||\n (this.checkSourceBySpec && !this.checkSourceBySpec(columnSpec, state)) ||\n (this.settings.isDataComponent && !dataColumnPredicate(columnSpec)) ||\n strictlyCompatible && extraAxesIds.length > 0 ||\n parentSelectedSources.length && extraAxesIds.length > 0 && !columnSpec.axesSpec.some((axisSpec) => {\n const axisIdStr = AxisId.fromAxisSpec(axisSpec).toCanonicalString();\n return parentAxes.has(axisIdStr);\n })\n ) {\n continue;\n }\n const axesIds = columnSpec?.axesSpec?.map(axisSpec => AxisId.fromAxisSpec(axisSpec).toCanonicalString()) ?? [];\n const extraAxesIndexes:Record<string, number> = {};\n if (this.settings.columnsWithExtraAxesAllowed) {\n axesIds.forEach((id, idx) => {\n if (extraAxesSet.has(id)) {\n extraAxesIndexes[id] = idx;\n }\n });\n }\n if (columnSpec) {\n const label =\n labelsMap[columnIdString] ??\n (await getColumnOrAxisLabel(store, columnId.toCanonicalString(), []));\n const columnInfo: ColumnData = {\n kind: 'column',\n name: columnSpec.name,\n label,\n type: columnSpec.valueType,\n spec: columnSpec,\n annotations: columnSpec.annotations,\n isSubsetFilter: columnSpec.annotations?.[SUBSET_FILTER_KEY] === 'true',\n isDiscreteFilter:\n columnSpec.valueType === 'String' ||\n columnSpec.annotations?.[DISCRETE_FILTER_KEY] === 'true',\n axesToBeFixed: extraAxesIds,\n axesToBeFixedIndexes: extraAxesIndexes,\n };\n optionsInfo.set(id.toCanonicalString(), columnInfo);\n }\n\n const ignored = ignoredNamesSet.has(id.name) || fixedSelectedSet.has(id.toCanonicalString());\n const selectedHere = state.components[this.componentName].selectorStates.some(\n item => item.selectedSource === columnIdString\n );\n if (!ignored && !selectedHere) {\n options.push({value: columnIdString});\n }\n }\n }\n return {multipleSelectors, required, stateConsistency, options, optionsInfo};\n }\n}\n"],"names":["isLinkerColumn","columnSpec","_a","IS_LINKER_COLUMN","_ComponentController","componentName","allowedTypes","settings","strictlyDependsOnParents","dependsOn","parentComponents","annotations","checkSourceBySpec","__publicField","state","selectorState","nextState","getStateCopy","selectedSourceStr","item","store","linkerMap","componentState","parentAxes","parentAxesList","isAxisInSet","a","id","AxisId","consistencyData","selectedSource","sourceId","columnOrAxisIdFromString","isColumnId","C","getNotAllowedAxes","res","idx","selectedHereColumnIds","n","s","axes","axisSpec","selectedHere","parentSelectedSources","source","spec","optionsInfo","idStr","mustBeConsumed","axisMustBeConsumed","getColumnOrAxisLabel","SUBSET_FILTER_KEY","_b","DISCRETE_FILTER_KEY","labelsMap","consumedSourcesSet","dataColumnPredicate","ignoredNamesSet","fixedSelectedSet","multipleSelectors","required","stateConsistency","dep","name","allowedColumns","thisState","options","axisData","typeOK","annotationsOK","k","v","checkBySpecOK","axisNatureOK","decreasingDimensionsOK","ignored","strictlyCompatible","columnId","columnIdString","extraAxesIds","extraAxesSet","isLabelColumn","axisIdStr","axesIds","extraAxesIndexes","label","columnInfo","_c","ComponentController"],"mappings":";;;;;;;;;;;;AAuBA,MAAMA,IAAiB,CAACC,MAA2B;;AAAA,WAAAC,IAAAD,KAAA,OAAA,SAAAA,EAAY,gBAAZ,OAAA,SAAAC,EAA0BC,CAAAA,OAAsB;AAAA,GAyBtFC,IAAN,MAAMA,EAAuF;AAAA,EAqBhG,YAAY;AAAA,IACR,eAAAC;AAAAA,IACA,cAAAC;AAAAA,IACA,UAAAC;AAAAA,IACA,0BAAAC;AAAAA,IACA,WAAAC,IAAY,CAAA;AAAA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AAW,CAACjC,KACbwB,EAAQ,KAAK,EAAC,OAAOY,GAAe;AAAA,MACxC;AAAA,IACJ;AAEJ,WAAO,EAAC,mBAAAnB,GAAmB,UAAAC,GAAU,kBAAAC,GAAkB,SAAAK,GAAS,aAAApB,EAAAA;AAAAA,EAAW;AAEnF;AA5VIlC,EADST,GACM,mBAA+C;AAAA,EAC1D,iBAAiB;AAAA,EACjB,mBAAmB;AAAA,EACnB,UAAU;AAAA,EACV,aAAa;AAAA,EACb,aAAa;AAAA,EACb,gBAAgB;AAAA,EAChB,6BAA6B;AAAA,EAC7B,mBAAmB;AACvB,CAAA;AAVG,IAAMqF,KAANrF;","x_google_ignoreList":[0]}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "../node_modules/@milaboratories/pl-model-common/dist/drivers/blob.js";
|
|
2
|
+
import "../node_modules/@milaboratories/pl-model-common/dist/drivers/pframe/spec/spec.js";
|
|
3
|
+
import "../_virtual/canonicalize.js";
|
|
4
|
+
import "../node_modules/@milaboratories/pl-model-common/dist/plid.js";
|
|
5
|
+
import "../node_modules/@milaboratories/pl-model-common/dist/ref.js";
|
|
6
|
+
import { deriveLabels as P } from "../node_modules/@platforma-sdk/model/dist/render/util/label.js";
|
|
7
|
+
import "../node_modules/@milaboratories/pl-error-like/dist/error_like_shape.js";
|
|
2
8
|
import { DISCRETE_VALUES_KEY as M, HIGH_CARDINALITY as V } from "../constants.js";
|
|
3
9
|
import { columnOrAxisIdFromString as k, isColumnId as L, AxisId as A, ColumnId as T } from "../spec.js";
|
|
4
|
-
import { getStateCopy as D, addSourceInfoToMap as U, getDefaultInfo as j, dataColumnPredicateDefault as
|
|
5
|
-
var
|
|
6
|
-
class
|
|
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 {
|
|
7
13
|
constructor(e, t) {
|
|
8
14
|
F(this, "ignoredOptionIdNames", []), F(this, "dataInputs", []), F(this, "dontAllowUnfilteredHighCardinality", !1), this.simpleComponentControllers = e, this.filterComponentControllers = t;
|
|
9
15
|
}
|
|
@@ -36,17 +42,17 @@ class z {
|
|
|
36
42
|
throw Error(`Unknown input name: ${String(e)}`);
|
|
37
43
|
}
|
|
38
44
|
changeSelected(e, t, n, o) {
|
|
39
|
-
const s = n.components[e].selectorStates, l = s.filter((r) => !o.find((
|
|
40
|
-
let
|
|
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);
|
|
41
47
|
return l.forEach((r) => {
|
|
42
|
-
|
|
48
|
+
a = this.deleteSelected(e, t, a, r);
|
|
43
49
|
}), C.forEach((r) => {
|
|
44
|
-
|
|
50
|
+
a = this.addSelected(e, a, r);
|
|
45
51
|
}), n.components[e].selectorStates = o.map(
|
|
46
52
|
(r) => n.components[e].selectorStates.find(
|
|
47
|
-
(
|
|
53
|
+
(p) => p.selectedSource === r.selectedSource
|
|
48
54
|
)
|
|
49
|
-
).filter(Boolean),
|
|
55
|
+
).filter(Boolean), a;
|
|
50
56
|
}
|
|
51
57
|
switchDividableAxis(e, t) {
|
|
52
58
|
return D(e);
|
|
@@ -72,28 +78,28 @@ class z {
|
|
|
72
78
|
}
|
|
73
79
|
async getSelectedSourcesInfo(e, t, n, o) {
|
|
74
80
|
const s = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Set(), C = [];
|
|
75
|
-
for (const
|
|
76
|
-
for (const r of t.components[
|
|
77
|
-
const
|
|
78
|
-
if (L(
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
const
|
|
82
|
-
l.has(
|
|
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));
|
|
83
89
|
});
|
|
84
90
|
}
|
|
85
91
|
}
|
|
86
|
-
for (const [
|
|
87
|
-
const
|
|
88
|
-
for (const { selectedSource:
|
|
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)
|
|
89
95
|
await U(
|
|
90
96
|
e,
|
|
91
|
-
|
|
92
|
-
n[
|
|
97
|
+
i,
|
|
98
|
+
n[i],
|
|
93
99
|
s,
|
|
94
100
|
C,
|
|
95
101
|
l,
|
|
96
|
-
|
|
102
|
+
p,
|
|
97
103
|
o
|
|
98
104
|
);
|
|
99
105
|
}
|
|
@@ -130,29 +136,29 @@ class z {
|
|
|
130
136
|
return o[l] = s.label, o;
|
|
131
137
|
}, {});
|
|
132
138
|
}
|
|
133
|
-
async calculateOptions(e, t, n = [], o =
|
|
139
|
+
async calculateOptions(e, t, n = [], o = $) {
|
|
134
140
|
var s;
|
|
135
|
-
const l = this.createEmptyComponentsGuide(t), C = this.getConsumedOptionsSet(t),
|
|
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();
|
|
136
142
|
for (const [u, f] of Object.entries(g)) {
|
|
137
143
|
const m = await f.getOptions(
|
|
138
144
|
e,
|
|
139
145
|
t,
|
|
140
|
-
|
|
146
|
+
i,
|
|
141
147
|
C,
|
|
142
|
-
|
|
148
|
+
p,
|
|
143
149
|
o,
|
|
144
|
-
|
|
150
|
+
a,
|
|
145
151
|
r
|
|
146
152
|
);
|
|
147
153
|
this.dataInputs.includes(u) || m.options.forEach((v) => {
|
|
148
154
|
h.add(v.value);
|
|
149
155
|
});
|
|
150
156
|
for (const [v, S] of m.optionsInfo)
|
|
151
|
-
|
|
157
|
+
d.set(v, S);
|
|
152
158
|
l[u] = m;
|
|
153
159
|
}
|
|
154
160
|
const y = (u) => {
|
|
155
|
-
const f =
|
|
161
|
+
const f = d.get(u);
|
|
156
162
|
f && f.kind === "axis" && (f.mustBeConsumed = !0);
|
|
157
163
|
const m = c.get(u);
|
|
158
164
|
m && m.kind === "axis" && (m.mustBeConsumed = !0);
|
|
@@ -188,9 +194,9 @@ class z {
|
|
|
188
194
|
x.add(v);
|
|
189
195
|
});
|
|
190
196
|
}
|
|
191
|
-
const B = await this.isConsistent(e, t,
|
|
197
|
+
const B = await this.isConsistent(e, t, p), I = (u) => {
|
|
192
198
|
const f = k(u).toCanonicalString() ?? u;
|
|
193
|
-
return
|
|
199
|
+
return d.get(f) ?? c.get(f) ?? j(u);
|
|
194
200
|
};
|
|
195
201
|
return {
|
|
196
202
|
components: l,
|
|
@@ -204,25 +210,25 @@ class z {
|
|
|
204
210
|
}
|
|
205
211
|
async getUniqueSourceValuesWithLabels(e, t, n, o, s, l) {
|
|
206
212
|
var C;
|
|
207
|
-
const
|
|
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];
|
|
208
214
|
try {
|
|
209
|
-
const
|
|
210
|
-
if (
|
|
211
|
-
const c =
|
|
212
|
-
return
|
|
215
|
+
const i = p ? JSON.parse(p).map((c) => String(c)) : null;
|
|
216
|
+
if (i) {
|
|
217
|
+
const c = i.map((d) => ({ value: d, label: d }));
|
|
218
|
+
return a(c), { values: c, overflow: !1 };
|
|
213
219
|
}
|
|
214
220
|
} catch {
|
|
215
|
-
console.error(`Parsing error: discrete values annotation ${
|
|
221
|
+
console.error(`Parsing error: discrete values annotation ${p} in ${n}`);
|
|
216
222
|
}
|
|
217
223
|
if (r.kind === "axis") {
|
|
218
|
-
const
|
|
224
|
+
const i = k(n), c = r.parentSources.map(k), d = await G(e, n, r.parentSources);
|
|
219
225
|
let g = [];
|
|
220
|
-
if (
|
|
226
|
+
if (d) {
|
|
221
227
|
s && (g = [{
|
|
222
228
|
type: "bySingleColumnV2",
|
|
223
229
|
column: {
|
|
224
230
|
type: "column",
|
|
225
|
-
id:
|
|
231
|
+
id: d.name
|
|
226
232
|
},
|
|
227
233
|
predicate: {
|
|
228
234
|
operator: "StringIContains",
|
|
@@ -232,35 +238,35 @@ class z {
|
|
|
232
238
|
type: "bySingleColumnV2",
|
|
233
239
|
column: {
|
|
234
240
|
type: "axis",
|
|
235
|
-
id:
|
|
241
|
+
id: i.toPFrameId()
|
|
236
242
|
},
|
|
237
243
|
predicate: {
|
|
238
244
|
operator: "StringIContains",
|
|
239
245
|
substring: l
|
|
240
246
|
}
|
|
241
247
|
}]);
|
|
242
|
-
const { data: x, axesData: B } = await e.pFrameProvider.getSingleColumnData(
|
|
248
|
+
const { data: x, axesData: B } = await e.pFrameProvider.getSingleColumnData(d, g), I = B[i.toCanonicalString()], u = [];
|
|
243
249
|
for (let f = 0; f < Math.min(I.length, o ?? I.length); f++)
|
|
244
250
|
u.push({ value: String(I[f]), label: String(x[f]) });
|
|
245
|
-
return
|
|
251
|
+
return a(u), { values: u, overflow: !(o === void 0 || I.length < o) };
|
|
246
252
|
}
|
|
247
253
|
const h = s ?? l;
|
|
248
254
|
h && (g = [{
|
|
249
255
|
type: "bySingleColumnV2",
|
|
250
256
|
column: {
|
|
251
257
|
type: "axis",
|
|
252
|
-
id:
|
|
258
|
+
id: i.toPFrameId()
|
|
253
259
|
},
|
|
254
260
|
predicate: {
|
|
255
261
|
operator: "StringIContains",
|
|
256
262
|
substring: h
|
|
257
263
|
}
|
|
258
264
|
}]);
|
|
259
|
-
const y = await e.pFrameProvider.getAxisUniqueValues(
|
|
260
|
-
return
|
|
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 };
|
|
261
267
|
}
|
|
262
268
|
if (r.kind === "column") {
|
|
263
|
-
const
|
|
269
|
+
const i = s ?? l, c = k(n), d = i ? [{
|
|
264
270
|
type: "bySingleColumnV2",
|
|
265
271
|
column: {
|
|
266
272
|
type: "column",
|
|
@@ -268,10 +274,10 @@ class z {
|
|
|
268
274
|
},
|
|
269
275
|
predicate: {
|
|
270
276
|
operator: "StringIContains",
|
|
271
|
-
substring:
|
|
277
|
+
substring: i
|
|
272
278
|
}
|
|
273
|
-
}] : [], g = await e.pFrameProvider.getColumnUniqueValues(c, o,
|
|
274
|
-
return
|
|
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 };
|
|
275
281
|
}
|
|
276
282
|
return { values: [], overflow: !1 };
|
|
277
283
|
}
|
|
@@ -303,21 +309,21 @@ class z {
|
|
|
303
309
|
if (!n || !this.readyDataInputs(t))
|
|
304
310
|
return !1;
|
|
305
311
|
let l = !1;
|
|
306
|
-
for (const
|
|
307
|
-
const r = s(
|
|
312
|
+
for (const a of o) {
|
|
313
|
+
const r = s(a);
|
|
308
314
|
if (r && r.kind === "axis" && r.mustBeConsumed) {
|
|
309
315
|
l = !0;
|
|
310
316
|
break;
|
|
311
317
|
}
|
|
312
318
|
}
|
|
313
319
|
let C = !1;
|
|
314
|
-
for (const { selectorStates:
|
|
315
|
-
for (const { selectedSource: r, fixedAxes:
|
|
316
|
-
const
|
|
317
|
-
if (
|
|
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(
|
|
318
324
|
(c) => {
|
|
319
|
-
var
|
|
320
|
-
return ((
|
|
325
|
+
var d;
|
|
326
|
+
return ((d = (p ?? []).find((g) => g.axisSource === c)) == null ? void 0 : d.axisValue) === void 0;
|
|
321
327
|
}
|
|
322
328
|
)) {
|
|
323
329
|
C = !0;
|
|
@@ -327,7 +333,7 @@ class z {
|
|
|
327
333
|
if (C)
|
|
328
334
|
break;
|
|
329
335
|
}
|
|
330
|
-
return this.requiredComponents.every((
|
|
336
|
+
return this.requiredComponents.every((a) => t.components[a].selectorStates.length > 0) && !l && !C;
|
|
331
337
|
}
|
|
332
338
|
async createDataForPlot(e, t) {
|
|
333
339
|
return {
|
|
@@ -337,6 +343,6 @@ class z {
|
|
|
337
343
|
}
|
|
338
344
|
}
|
|
339
345
|
export {
|
|
340
|
-
|
|
346
|
+
ee as ControllerBase
|
|
341
347
|
};
|
|
342
348
|
//# sourceMappingURL=ControllerBase.js.map
|