@milaboratories/graph-maker 1.1.148 → 1.1.150

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 (25) hide show
  1. package/dist/GraphMaker/components/AesSettings/AesDataMappingDiscrete.vue.d.ts +1 -0
  2. package/dist/GraphMaker/components/AesSettings/AesDataMappingDiscrete.vue.d.ts.map +1 -1
  3. package/dist/GraphMaker/components/AesSettings/AesDataMappingDiscrete.vue.js +97 -95
  4. package/dist/GraphMaker/components/AesSettings/AesDataMappingDiscrete.vue.js.map +1 -1
  5. package/dist/GraphMaker/dataBindAes.js +44 -44
  6. package/dist/GraphMaker/dataBindAes.js.map +1 -1
  7. package/dist/GraphMaker/forms/AxesSettingsForm/DiscreteAxesSettingsForm.vue.d.ts.map +1 -1
  8. package/dist/GraphMaker/forms/AxesSettingsForm/DiscreteAxesSettingsForm.vue.js +111 -109
  9. package/dist/GraphMaker/forms/AxesSettingsForm/DiscreteAxesSettingsForm.vue.js.map +1 -1
  10. package/dist/GraphMaker/forms/LayersForm/AesSelector.vue.d.ts.map +1 -1
  11. package/dist/GraphMaker/forms/LayersForm/AesSelector.vue.js +84 -83
  12. package/dist/GraphMaker/forms/LayersForm/AesSelector.vue.js.map +1 -1
  13. package/dist/GraphMaker/index.vue.js +33 -33
  14. package/dist/GraphMaker/index.vue.js.map +1 -1
  15. package/dist/GraphMaker/utils/createChartSettingsForRender/composeDiscreteSettings.d.ts.map +1 -1
  16. package/dist/GraphMaker/utils/createChartSettingsForRender/composeDiscreteSettings.js +25 -33
  17. package/dist/GraphMaker/utils/createChartSettingsForRender/composeDiscreteSettings.js.map +1 -1
  18. package/dist/GraphMaker/utils/loadUniqueValuesToSave.d.ts.map +1 -1
  19. package/dist/GraphMaker/utils/loadUniqueValuesToSave.js +23 -23
  20. package/dist/GraphMaker/utils/loadUniqueValuesToSave.js.map +1 -1
  21. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/components/layers/StackedAreaElement.js +49 -49
  22. package/dist/node_modules/@milaboratories/miplots4/dist/discrete/components/layers/StackedAreaElement.js.map +1 -1
  23. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/createLegendInfo.js +18 -18
  24. package/dist/node_modules/@milaboratories/miplots4/dist/scatterplot/utils/createLegendInfo.js.map +1 -1
  25. package/package.json +2 -2
@@ -1,10 +1,10 @@
1
- import { defineComponent as Q, computed as c, ref as b, watch as Z, createElementBlock as _, openBlock as y, Fragment as q, createElementVNode as O, createBlock as g, createCommentVNode as S, createVNode as B, withModifiers as ee, unref as te, withCtx as R, normalizeClass as le } from "vue";
1
+ import { defineComponent as Z, computed as c, ref as b, watch as _, createElementBlock as q, openBlock as y, Fragment as ee, createElementVNode as O, createBlock as g, createCommentVNode as S, createVNode as B, withModifiers as te, unref as w, withCtx as R, normalizeClass as le } from "vue";
2
2
  import { PlDropdown as ae } from "@platforma-sdk/ui-vue";
3
3
  import { createDefaultMapping as oe, createContinuousMappingFromPalette as ue } from "../../dataBindAes.js";
4
4
  import { FIXED_COLORS as A, DEFAULT_LINE_TYPE as ie, DEFAULT_DOT_SHAPE as ne, FIXED_LINE_TYPES as se, FIXES_DOT_SHAPES as re, DEFAULT_CONTINUOUS_PALETTE as pe } from "../../constantsAesthetic.js";
5
5
  import de from "../../components/AesButton.vue.js";
6
6
  import { useStore as ve } from "../../store.js";
7
- import { isMappedAes as x } from "../../constantsCommon.js";
7
+ import { isMappedAes as L } from "../../constantsCommon.js";
8
8
  import fe from "../../components/Popup.vue.js";
9
9
  import me from "../../components/AesSettings/FixedColorsList.vue.js";
10
10
  import ce from "../../components/AesSettings/FixedDotShapeList.vue.js";
@@ -12,7 +12,7 @@ import ye from "../../components/AesSettings/FixedLineTypeList.vue.js";
12
12
  import ge from "../../components/AesSettings/FormWrapper.vue.js";
13
13
  import Se from "../../components/AesSettings/AesDataMappingDiscrete.vue.js";
14
14
  import Te from "../../components/AesSettings/AesDataMappingContinuous.vue.js";
15
- const Ee = { class: "aes-input-row" }, he = /* @__PURE__ */ Q({
15
+ const Ee = { class: "aes-input-row" }, Ne = /* @__PURE__ */ Z({
16
16
  __name: "AesSelector",
17
17
  props: {
18
18
  label: {},
@@ -25,9 +25,9 @@ const Ee = { class: "aes-input-row" }, he = /* @__PURE__ */ Q({
25
25
  disabled: { type: Boolean }
26
26
  },
27
27
  emits: ["aes-update", "aes-selector-close"],
28
- setup(L, { emit: M }) {
29
- var h, N;
30
- const n = L, f = ve(), u = c(() => f.value.reactive.chartType), D = M, W = {
28
+ setup(M, { emit: W }) {
29
+ var U, P;
30
+ const s = M, r = ve(), o = c(() => r.value.reactive.chartType), D = W, X = {
31
31
  discrete: ["primaryGrouping", "secondaryGrouping"],
32
32
  scatterplot: ["grouping"],
33
33
  "scatterplot-umap": ["grouping"],
@@ -35,14 +35,14 @@ const Ee = { class: "aes-input-row" }, he = /* @__PURE__ */ Q({
35
35
  heatmap: [],
36
36
  histogram: ["grouping"],
37
37
  bubble: []
38
- }, H = n.possibleAesSourceInputs ?? W[u.value], Y = c(
39
- () => f.value.commonHelpersData.usedAesInMapping.value
38
+ }, G = s.possibleAesSourceInputs ?? X[o.value], Y = c(
39
+ () => r.value.commonHelpersData.usedAesInMapping.value
40
40
  );
41
41
  function V(t) {
42
- return typeof t == "string" ? t : u.value === "scatterplot" ? `grouping_${t.value}` : u.value === "dendro" ? `${t.type}_${t.value}` : t.type;
42
+ return typeof t == "string" ? t : o.value === "scatterplot" ? `grouping_${t.value}` : o.value === "dendro" ? `${t.type}_${t.value}` : t.type;
43
43
  }
44
- const s = b(
45
- x(n.selected) ? V(n.selected) : "fix"
44
+ const n = b(
45
+ L(s.selected) ? V(s.selected) : "fix"
46
46
  ), z = {
47
47
  fill: A[0].color,
48
48
  stroke: A[0].color,
@@ -50,132 +50,132 @@ const Ee = { class: "aes-input-row" }, he = /* @__PURE__ */ Q({
50
50
  lineType: ie,
51
51
  size: ""
52
52
  // temporary
53
- }, X = c(() => f.value.inputGuide.value), K = c(() => f.value.uniqueValuesData.value), w = /* @__PURE__ */ new Set([
53
+ }, K = c(() => r.value.inputGuide.value), j = c(() => r.value.uniqueValuesData.value), H = /* @__PURE__ */ new Set([
54
54
  "scatterplot",
55
55
  "scatterplot-umap",
56
56
  "heatmap"
57
- ]), r = c(() => {
58
- const t = {}, e = f.value.reactive.optionsState.components;
59
- function p(a, l) {
60
- const o = X.value.getSourceInfo(l), d = K.value[l], E = (d == null ? void 0 : d.list) ?? [], v = (d == null ? void 0 : d.labels) ?? {}, $ = V({ type: a, value: l });
61
- if (w.has(u.value) && o.type === "String" || !w.has(u.value)) {
62
- const C = f.value.reactive.dataBindAes[l] ?? oe(E);
57
+ ]), p = c(() => {
58
+ const t = {}, e = r.value.reactive.optionsState.components;
59
+ function d(a, l) {
60
+ const u = K.value.getSourceInfo(l), v = j.value[l], E = (v == null ? void 0 : v.list) ?? [], f = (v == null ? void 0 : v.labels) ?? {}, $ = V({ type: a, value: l });
61
+ if (H.has(o.value) && u.type === "String" || !H.has(o.value)) {
62
+ const C = r.value.reactive.dataBindAes[l] ?? oe(E);
63
63
  t[$] = {
64
64
  type: "dataCategorical",
65
65
  value: $,
66
66
  initialData: C,
67
67
  inputName: a,
68
68
  selectedSource: l,
69
- selectedSourceInfo: o,
69
+ selectedSourceInfo: u,
70
70
  selectedSourceValues: E,
71
71
  labels: C.order.reduce(
72
- (P, k) => (P[k] = v[k] ?? String(k), P),
72
+ (h, k) => (h[k] = f[k] ?? String(k), h),
73
73
  {}
74
74
  )
75
75
  };
76
76
  } else {
77
- const C = f.value.reactive.dataBindAes[l] ?? ue(pe);
77
+ const C = r.value.reactive.dataBindAes[l] ?? ue(pe);
78
78
  t[$] = {
79
79
  type: "dataContinuous",
80
80
  value: $,
81
81
  initialData: C,
82
82
  inputName: a,
83
83
  selectedSource: l,
84
- selectedSourceInfo: o,
84
+ selectedSourceInfo: u,
85
85
  selectedSourceValues: E
86
86
  };
87
87
  }
88
88
  }
89
- return H.forEach((a) => {
89
+ return G.forEach((a) => {
90
90
  var l;
91
- (l = e == null ? void 0 : e[a]) != null && l.selectorStates.length && e[a].selectorStates.forEach(({ selectedSource: o }) => {
92
- p(a, o);
91
+ (l = e == null ? void 0 : e[a]) != null && l.selectorStates.length && e[a].selectorStates.forEach(({ selectedSource: u }) => {
92
+ d(a, u);
93
93
  });
94
- }), n.withoutFixed || (t.fix = {
94
+ }), s.withoutFixed || (t.fix = {
95
95
  type: "fix",
96
96
  value: "fix",
97
- initialData: x(n.selected) ? z[n.type] : n.selected
97
+ initialData: L(s.selected) ? z[s.type] : s.selected
98
98
  }), t;
99
99
  }), i = c(
100
- () => r.value[s.value] ?? null
100
+ () => p.value[n.value] ?? null
101
101
  );
102
- function j(t, e) {
103
- var p, a, l, o;
104
- return t.type === "fix" ? "Fixed" : e === t.value ? `${(p = t.selectedSourceInfo) == null ? void 0 : p.label}` : u.value === "discrete" ? `${t.value === "primaryGrouping" ? "Primary" : "Secondary"} grouping: ${(a = t.selectedSourceInfo) == null ? void 0 : a.label}` : u.value === "scatterplot" || u.value === "dendro" ? `Grouping: ${(l = t.selectedSourceInfo) == null ? void 0 : l.label}` : ((o = t.selectedSourceInfo) == null ? void 0 : o.label) ?? "";
102
+ function J(t, e) {
103
+ var d, a, l, u;
104
+ return t.type === "fix" ? "Fixed" : e === t.value ? `${(d = t.selectedSourceInfo) == null ? void 0 : d.label}` : o.value === "discrete" ? `${t.value === "primaryGrouping" ? "Primary" : "Secondary"} grouping: ${(a = t.selectedSourceInfo) == null ? void 0 : a.label}` : o.value === "scatterplot" || o.value === "dendro" ? `Grouping: ${(l = t.selectedSourceInfo) == null ? void 0 : l.label}` : ((u = t.selectedSourceInfo) == null ? void 0 : u.label) ?? "";
105
105
  }
106
- const U = c(() => {
107
- const t = [], e = f.value.reactive.optionsState.components;
108
- function p(a, l) {
109
- const o = V({
106
+ const x = c(() => {
107
+ const t = [], e = r.value.reactive.optionsState.components;
108
+ function d(a, l) {
109
+ const u = V({
110
110
  type: a === "shape" ? "grouping" : a,
111
111
  value: l
112
112
  });
113
- r.value[o] && t.push({
114
- text: j(r.value[o], s.value),
115
- value: o
113
+ p.value[u] && t.push({
114
+ text: J(p.value[u], n.value),
115
+ value: u
116
116
  });
117
117
  }
118
- if (H.forEach((a) => {
118
+ if (G.forEach((a) => {
119
119
  var l;
120
- (l = e == null ? void 0 : e[a]) != null && l.selectorStates.length && e[a].selectorStates.forEach(({ selectedSource: o }) => {
121
- p(a, o);
120
+ (l = e == null ? void 0 : e[a]) != null && l.selectorStates.length && e[a].selectorStates.forEach(({ selectedSource: u }) => {
121
+ d(a, u);
122
122
  });
123
- }), !r.value[s.value]) {
123
+ }), !p.value[n.value]) {
124
124
  let a = "Not consistent (grouping)";
125
- u.value === "discrete" && (a = `${s.value === "primaryGrouping" ? "Primary" : "Secondary"} grouping (not selected)`), t.push({ text: a, value: s.value });
125
+ o.value === "discrete" && (a = `${n.value === "primaryGrouping" ? "Primary" : "Secondary"} grouping (not selected)`), t.push({ text: a, value: n.value });
126
126
  }
127
- return n.withoutFixed || t.push({ text: "Fixed", value: "fix" }), t;
127
+ return s.withoutFixed || t.push({ text: "Fixed", value: "fix" }), t;
128
128
  }), T = b(!1), m = b(
129
- r.value.fix ? r.value.fix.initialData : null
129
+ p.value.fix ? p.value.fix.initialData : null
130
130
  ), F = b(
131
- ((h = i.value) == null ? void 0 : h.type) === "dataCategorical" ? i.value.initialData : null
131
+ ((U = i.value) == null ? void 0 : U.type) === "dataCategorical" ? i.value.initialData : null
132
132
  ), I = b(
133
- ((N = i.value) == null ? void 0 : N.type) === "dataContinuous" ? i.value.initialData : null
133
+ ((P = i.value) == null ? void 0 : P.type) === "dataContinuous" ? i.value.initialData : null
134
134
  );
135
- Z(
136
- () => s.value,
135
+ _(
136
+ () => n.value,
137
137
  (t) => {
138
- const e = r.value[t];
138
+ const e = p.value[t];
139
139
  e.type === "fix" ? D("aes-update", m.value, e) : e.type === "dataCategorical" ? (F.value = e.initialData, D("aes-update", e.initialData, e)) : e.type === "dataContinuous" && (I.value = e.initialData, D("aes-update", e.initialData, e));
140
140
  }
141
141
  );
142
- const G = b(), J = c(() => {
143
- if (n.type === "lineType")
142
+ const N = b(), Q = c(() => {
143
+ if (s.type === "lineType")
144
144
  return se.length * 32 + 16 * 2;
145
- if (n.type === "dotShape")
145
+ if (s.type === "dotShape")
146
146
  return Math.ceil(re.length / 6) * 36 + 20 * 2;
147
- if (n.type === "fill" || n.type === "stroke")
147
+ if (s.type === "fill" || s.type === "stroke")
148
148
  return Math.ceil(A.length / 6) * 36 + 20 * 2;
149
149
  });
150
150
  return (t, e) => {
151
- var p, a;
152
- return y(), _(q, null, [
151
+ var d, a;
152
+ return y(), q(ee, null, [
153
153
  O("div", Ee, [
154
154
  O("div", {
155
155
  class: "aes-input-select",
156
- onClick: e[1] || (e[1] = ee(() => {
156
+ onClick: e[1] || (e[1] = te(() => {
157
157
  }, ["stop"]))
158
158
  }, [
159
- B(te(ae), {
160
- disabled: t.disabled || U.value.length < 2,
159
+ B(w(ae), {
160
+ disabled: t.disabled || x.value.length < 2,
161
161
  label: t.label,
162
- options: U.value,
163
- modelValue: s.value,
164
- "onUpdate:modelValue": e[0] || (e[0] = (l) => s.value = l)
162
+ options: x.value,
163
+ modelValue: n.value,
164
+ "onUpdate:modelValue": e[0] || (e[0] = (l) => n.value = l)
165
165
  }, null, 8, ["disabled", "label", "options", "modelValue"])
166
166
  ]),
167
167
  B(de, {
168
168
  data: {
169
- type: s.value === "fix" ? t.type : "data",
170
- value: s.value === "fix" ? t.type === "size" ? Number(t.selected) : t.selected : null
169
+ type: n.value === "fix" ? t.type : "data",
170
+ value: n.value === "fix" ? t.type === "size" ? Number(t.selected) : t.selected : null
171
171
  },
172
172
  onClick: e[2] || (e[2] = (l) => T.value = !T.value),
173
- onRef: e[3] || (e[3] = (l) => G.value = l)
173
+ onRef: e[3] || (e[3] = (l) => N.value = l)
174
174
  }, null, 8, ["data"]),
175
- s.value === "fix" && T.value && m.value ? (y(), g(fe, {
175
+ n.value === "fix" && T.value && m.value ? (y(), g(fe, {
176
176
  key: 0,
177
- height: J.value,
178
- targetRef: G.value,
177
+ height: Q.value,
178
+ targetRef: N.value,
179
179
  "onPopup:close": e[10] || (e[10] = (l) => T.value = !1)
180
180
  }, {
181
181
  default: R(() => [
@@ -188,7 +188,7 @@ const Ee = { class: "aes-input-row" }, he = /* @__PURE__ */ Q({
188
188
  modelValue: m.value,
189
189
  "onUpdate:modelValue": [
190
190
  e[4] || (e[4] = (l) => m.value = l),
191
- e[5] || (e[5] = (l) => t.$emit("aes-update", l, r.value.fix))
191
+ e[5] || (e[5] = (l) => t.$emit("aes-update", l, p.value.fix))
192
192
  ]
193
193
  }, null, 8, ["color-using", "modelValue"])) : S("", !0),
194
194
  t.type === "dotShape" ? (y(), g(ce, {
@@ -196,7 +196,7 @@ const Ee = { class: "aes-input-row" }, he = /* @__PURE__ */ Q({
196
196
  modelValue: m.value,
197
197
  "onUpdate:modelValue": [
198
198
  e[6] || (e[6] = (l) => m.value = l),
199
- e[7] || (e[7] = (l) => t.$emit("aes-update", l, r.value.fix))
199
+ e[7] || (e[7] = (l) => t.$emit("aes-update", l, p.value.fix))
200
200
  ]
201
201
  }, null, 8, ["modelValue"])) : S("", !0),
202
202
  t.type === "lineType" ? (y(), g(ye, {
@@ -204,7 +204,7 @@ const Ee = { class: "aes-input-row" }, he = /* @__PURE__ */ Q({
204
204
  modelValue: m.value,
205
205
  "onUpdate:modelValue": [
206
206
  e[8] || (e[8] = (l) => m.value = l),
207
- e[9] || (e[9] = (l) => t.$emit("aes-update", l, r.value.fix))
207
+ e[9] || (e[9] = (l) => t.$emit("aes-update", l, p.value.fix))
208
208
  ]
209
209
  }, null, 8, ["modelValue"])) : S("", !0)
210
210
  ], 2)
@@ -212,35 +212,36 @@ const Ee = { class: "aes-input-row" }, he = /* @__PURE__ */ Q({
212
212
  _: 1
213
213
  }, 8, ["height", "targetRef"])) : S("", !0)
214
214
  ]),
215
- (((p = i.value) == null ? void 0 : p.type) === "dataCategorical" && F.value || ((a = i.value) == null ? void 0 : a.type) === "dataContinuous" && I.value) && T.value ? (y(), g(ge, {
215
+ (((d = i.value) == null ? void 0 : d.type) === "dataCategorical" && F.value || ((a = i.value) == null ? void 0 : a.type) === "dataContinuous" && I.value) && T.value ? (y(), g(ge, {
216
216
  key: 0,
217
217
  title: t.formTitle,
218
218
  "back-title": t.formBackTitle,
219
219
  "onForm:close": e[15] || (e[15] = (l) => T.value = !1)
220
220
  }, {
221
221
  default: R(() => {
222
- var l, o, d, E;
222
+ var l, u, v, E;
223
223
  return [
224
224
  ((l = i.value) == null ? void 0 : l.type) === "dataCategorical" && F.value ? (y(), g(Se, {
225
225
  key: 0,
226
226
  "column-value-labels": i.value.labels,
227
- "data-column-label": ((o = i.value.selectedSourceInfo) == null ? void 0 : o.label) ?? "",
227
+ "data-column-label": ((u = i.value.selectedSourceInfo) == null ? void 0 : u.label) ?? "",
228
228
  "used-aes-in-mapping": Y.value[i.value.selectedSource],
229
- "allow-hiding": u.value === "discrete",
230
- "allow-reordering": u.value === "discrete" || u.value === "histogram" || u.value === "scatterplot" || u.value === "scatterplot-umap",
229
+ "allow-hiding": o.value === "discrete",
230
+ "allow-reordering": o.value === "discrete" || o.value === "histogram" || o.value === "scatterplot" || o.value === "scatterplot-umap",
231
+ "allow-null-option": o.value === "discrete" && (n.value === "primaryGrouping" && w(r).reactive.axesSettings.axisX.allowNullPrimaryGroups || n.value === "secondaryGrouping" && w(r).reactive.axesSettings.axisX.allowNullSecondaryGroups) || o.value === "scatterplot" || o.value === "scatterplot-umap",
231
232
  modelValue: F.value,
232
233
  "onUpdate:modelValue": [
233
- e[11] || (e[11] = (v) => F.value = v),
234
- e[12] || (e[12] = (v) => t.$emit("aes-update", v, i.value))
234
+ e[11] || (e[11] = (f) => F.value = f),
235
+ e[12] || (e[12] = (f) => t.$emit("aes-update", f, i.value))
235
236
  ]
236
- }, null, 8, ["column-value-labels", "data-column-label", "used-aes-in-mapping", "allow-hiding", "allow-reordering", "modelValue"])) : S("", !0),
237
- ((d = i.value) == null ? void 0 : d.type) === "dataContinuous" && I.value ? (y(), g(Te, {
237
+ }, null, 8, ["column-value-labels", "data-column-label", "used-aes-in-mapping", "allow-hiding", "allow-reordering", "allow-null-option", "modelValue"])) : S("", !0),
238
+ ((v = i.value) == null ? void 0 : v.type) === "dataContinuous" && I.value ? (y(), g(Te, {
238
239
  key: 1,
239
240
  "data-column-label": ((E = i.value.selectedSourceInfo) == null ? void 0 : E.label) ?? "",
240
241
  modelValue: I.value,
241
242
  "onUpdate:modelValue": [
242
- e[13] || (e[13] = (v) => I.value = v),
243
- e[14] || (e[14] = (v) => t.$emit("aes-update", v, i.value))
243
+ e[13] || (e[13] = (f) => I.value = f),
244
+ e[14] || (e[14] = (f) => t.$emit("aes-update", f, i.value))
244
245
  ]
245
246
  }, null, 8, ["data-column-label", "modelValue"])) : S("", !0)
246
247
  ];
@@ -252,6 +253,6 @@ const Ee = { class: "aes-input-row" }, he = /* @__PURE__ */ Q({
252
253
  }
253
254
  });
254
255
  export {
255
- he as default
256
+ Ne as default
256
257
  };
257
258
  //# sourceMappingURL=AesSelector.vue.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AesSelector.vue.js","sources":["../../../../src/GraphMaker/forms/LayersForm/AesSelector.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { ref, computed, watch } from 'vue';\nimport { PlDropdown } from '@platforma-sdk/ui-vue';\nimport {\n AestheticMappingCategorical, AestheticMappingContinuous, createContinuousMappingFromPalette,\n createDefaultMapping\n} from '../../dataBindAes';\nimport {\n AesOption,\n DotShape,\n LineType\n} from '../../components/AesSettings/types';\nimport {\n DEFAULT_CONTINUOUS_PALETTE,\n DEFAULT_DOT_SHAPE,\n DEFAULT_LINE_TYPE,\n FIXED_COLORS,\n FIXED_LINE_TYPES,\n FIXES_DOT_SHAPES\n} from '../../constantsAesthetic';\nimport AesButton, { type AesButtonProps } from '../../components/AesButton.vue';\nimport { useStore } from '../../store';\nimport { AesType, isMappedAes, MappingLink } from '../../constantsCommon';\nimport Popup from '../../components/Popup.vue';\nimport FixedColorsList from '../../components/AesSettings/FixedColorsList.vue';\nimport FixedDotShapeList from '../../components/AesSettings/FixedDotShapeList.vue';\nimport FixedLineTypeList from '../../components/AesSettings/FixedLineTypeList.vue';\nimport FormWrapper from '../../components/AesSettings/FormWrapper.vue';\nimport AesDataMappingDiscrete from '../../components/AesSettings/AesDataMappingDiscrete.vue';\nimport AesDataMappingContinuous from '../../components/AesSettings/AesDataMappingContinuous.vue';\nimport { ChartType } from '@milaboratories/pf-plots';\n\nconst props = defineProps<{\n label: string;\n type: AesType;\n selected: string | MappingLink;\n formTitle: string;\n formBackTitle: string;\n possibleAesSourceInputs?: string[];\n withoutFixed?: boolean;\n disabled?: boolean;\n}>();\n\nconst store = useStore();\nconst chartType = computed(() => store.value.reactive.chartType);\nconst emit = defineEmits(['aes-update', 'aes-selector-close']);\n\nconst DEFAULT_AES_INPUTS: Record<ChartType, string[]> = {\n discrete: ['primaryGrouping', 'secondaryGrouping'],\n scatterplot: ['grouping'],\n 'scatterplot-umap': ['grouping'],\n dendro: [],\n heatmap: [],\n histogram: ['grouping'],\n bubble: []\n};\nconst possibleAesSourceInputs = props.possibleAesSourceInputs ?? DEFAULT_AES_INPUTS[chartType.value];\nconst usedAesInMapping = computed(\n () => {\n const v = store.value.commonHelpersData.usedAesInMapping.value;\n return v;\n }\n);\n\nfunction getKeyFromSelectedType(value: MappingLink | string) {\n if (typeof value === 'string') {\n return value;\n }\n if (chartType.value === 'scatterplot') {\n return `grouping_${value.value}`;\n }\n if (chartType.value === 'dendro') {\n return `${value.type}_${value.value}`;\n }\n return value.type;\n}\n\nconst selectedType = ref(\n isMappedAes(props.selected) ? getKeyFromSelectedType(props.selected) : 'fix'\n);\nconst DEFAULT_BY_TYPES: Record<AesType, string | DotShape | LineType> = {\n fill: FIXED_COLORS[0].color,\n stroke: FIXED_COLORS[0].color,\n dotShape: DEFAULT_DOT_SHAPE,\n lineType: DEFAULT_LINE_TYPE,\n size: '' // temporary\n};\n\nconst inputGuide = computed(() => store.value.inputGuide.value);\nconst labelsInfo = computed(() => store.value.uniqueValuesData.value);\n\nconst chartTypesWithContinuousColors = new Set<ChartType>([\n 'scatterplot', 'scatterplot-umap', 'heatmap'\n]);\n\nconst optionsInfo = computed(() => {\n const res: Record<string, AesOption> = {};\n const inputStateMap = store.value.reactive.optionsState.components;\n\n function addInfo(name: string, source: string) {\n const selectedSourceInfo = inputGuide.value.getSourceInfo(source);\n const uniqueValuesItem = labelsInfo.value[source];\n const uniqueValues = uniqueValuesItem?.list ?? [];\n const valueLabels = uniqueValuesItem?.labels ?? {};\n const key = getKeyFromSelectedType({ type: name, value: source });\n if (\n chartTypesWithContinuousColors.has(chartType.value) && selectedSourceInfo.type === 'String' ||\n !chartTypesWithContinuousColors.has(chartType.value)\n ) {\n const mapping = (store.value.reactive.dataBindAes[source] ?? createDefaultMapping(uniqueValues)) as AestheticMappingCategorical;\n res[key] = {\n type: 'dataCategorical',\n value: key,\n initialData: mapping,\n inputName: name,\n selectedSource: source,\n selectedSourceInfo,\n selectedSourceValues: uniqueValues,\n labels: mapping.order.reduce(\n (res: Record<string, string>, v: string | number) => {\n res[v] = valueLabels[v] ?? String(v);\n return res;\n },\n {}\n )\n };\n } else {\n const mapping = (store.value.reactive.dataBindAes[source] ?? createContinuousMappingFromPalette(DEFAULT_CONTINUOUS_PALETTE)) as AestheticMappingContinuous;\n res[key] = {\n type: 'dataContinuous',\n value: key,\n initialData: mapping,\n inputName: name,\n selectedSource: source,\n selectedSourceInfo,\n selectedSourceValues: uniqueValues\n };\n }\n }\n\n possibleAesSourceInputs.forEach((name) => {\n if (inputStateMap?.[name]?.selectorStates.length) {\n inputStateMap[name].selectorStates.forEach(({ selectedSource }) => {\n addInfo(name, selectedSource);\n });\n }\n });\n\n if (!props.withoutFixed) {\n res['fix'] = {\n type: 'fix',\n value: 'fix',\n initialData: isMappedAes(props.selected)\n ? DEFAULT_BY_TYPES[props.type]\n : props.selected\n };\n }\n return res;\n});\n\nconst option = computed<AesOption | null>(\n () => optionsInfo.value[selectedType.value] ?? null\n);\n\nfunction getTitle(option: AesOption, selected: string) {\n if (option.type === 'fix') {\n return 'Fixed';\n }\n if (selected === option.value) {\n return `${option.selectedSourceInfo?.label}`;\n }\n if (chartType.value === 'discrete') {\n return `${\n option.value === 'primaryGrouping' ? 'Primary' : 'Secondary'\n } grouping: ${option.selectedSourceInfo?.label}`;\n }\n if (chartType.value === 'scatterplot' || chartType.value === 'dendro') {\n return `Grouping: ${option.selectedSourceInfo?.label}`;\n }\n return option.selectedSourceInfo?.label ?? '';\n}\n\nconst typeOptions = computed(() => {\n const options = [];\n const inputStateMap = store.value.reactive.optionsState.components;\n\n function addOption(name: string, source: string) {\n const key = getKeyFromSelectedType({\n type: name === 'shape' ? 'grouping' : name,\n value: source\n });\n if (optionsInfo.value[key]) {\n options.push({\n text: getTitle(optionsInfo.value[key], selectedType.value),\n value: key\n });\n }\n }\n\n possibleAesSourceInputs.forEach((name) => {\n if (inputStateMap?.[name]?.selectorStates.length) {\n inputStateMap[name].selectorStates.forEach(({ selectedSource }) => {\n addOption(name, selectedSource);\n });\n }\n });\n if (!optionsInfo.value[selectedType.value]) {\n let text = 'Not consistent (grouping)';\n if (chartType.value === 'discrete') {\n text = `${\n selectedType.value === 'primaryGrouping' ? 'Primary' : 'Secondary'\n } grouping (not selected)`;\n }\n options.push({ text, value: selectedType.value });\n }\n if (!props.withoutFixed) {\n options.push({ text: 'Fixed', value: 'fix' });\n }\n return options;\n});\n\nconst openForm = ref(false);\n\nconst defaultFixed = ref(\n optionsInfo.value['fix']\n ? (optionsInfo.value['fix'].initialData as string)\n : null\n);\nconst defaultMappingCategorical = ref(\n option.value?.type === 'dataCategorical'\n ? (option.value.initialData as AestheticMappingCategorical)\n : null\n);\n\nconst defaultMappingContinuous = ref(\n option.value?.type === 'dataContinuous'\n ? (option.value.initialData as AestheticMappingContinuous)\n : null\n);\nwatch(\n () => selectedType.value,\n (value) => {\n const option = optionsInfo.value[value];\n if (option.type === 'fix') {\n emit('aes-update', defaultFixed.value, option);\n } else if (option.type === 'dataCategorical') {\n defaultMappingCategorical.value = option.initialData;\n emit('aes-update', option.initialData, option);\n } else if (option.type === 'dataContinuous') {\n defaultMappingContinuous.value = option.initialData;\n emit('aes-update', option.initialData, option);\n }\n }\n);\n\nconst aesButtonRef = ref();\n\n//TODO: move to utils\nconst popupHeight = computed(() => {\n if (props.type === 'lineType') {\n const ROW_HEIGHT = 32;\n const OFFSET = 16;\n return FIXED_LINE_TYPES.length * ROW_HEIGHT + OFFSET * 2;\n }\n if (props.type === 'dotShape') {\n const ROW_HEIGHT = 36;\n const OFFSET = 20;\n return Math.ceil(FIXES_DOT_SHAPES.length / 6) * ROW_HEIGHT + OFFSET * 2;\n }\n if (props.type === 'fill' || props.type === 'stroke') {\n const ROW_HEIGHT = 36;\n const OFFSET = 20;\n return Math.ceil(FIXED_COLORS.length / 6) * ROW_HEIGHT + OFFSET * 2;\n }\n});\n\n</script>\n\n<template>\n <div class=\"aes-input-row\">\n <div class=\"aes-input-select\" @click.stop>\n <pl-dropdown\n :disabled=\"disabled || typeOptions.length < 2\"\n :label=\"label\"\n :options=\"typeOptions\"\n v-model=\"selectedType\"\n />\n </div>\n <aes-button\n :data=\"{\n type: selectedType === 'fix' ? type : 'data',\n value: selectedType === 'fix' ? type === 'size' ? Number(selected) : selected as string : null\n } as AesButtonProps['data']\"\n @click=\"openForm = !openForm\"\n @ref=\"(el:Element) => (aesButtonRef = el)\"\n />\n <popup\n v-if=\"selectedType === 'fix' && openForm && defaultFixed\"\n :height=\"popupHeight\"\n :targetRef=\"aesButtonRef\"\n @popup:close=\"openForm = false\"\n >\n <div\n class=\"fixed-aes-list\"\n :class=\"{ 'fixed-aes-list__rows': type === 'lineType' }\"\n >\n <fixed-colors-list\n v-if=\"type === 'fill' || type === 'stroke'\"\n :color-using=\"type\"\n v-model=\"defaultFixed\"\n @update:modelValue=\"\n (value:string) => $emit('aes-update', value, optionsInfo['fix'])\n \"\n />\n <fixed-dot-shape-list\n v-if=\"type === 'dotShape'\"\n v-model=\"defaultFixed\"\n @update:modelValue=\"\n (value:DotShape) => $emit('aes-update', value, optionsInfo['fix'])\n \"\n />\n <fixed-line-type-list\n v-if=\"type === 'lineType'\"\n v-model=\"defaultFixed\"\n @update:modelValue=\"\n (value:LineType) => $emit('aes-update', value, optionsInfo['fix'])\n \"\n />\n </div>\n </popup>\n </div>\n <template v-if=\"(\n (option?.type === 'dataCategorical' && defaultMappingCategorical) ||\n (option?.type === 'dataContinuous' && defaultMappingContinuous)) && openForm\">\n <form-wrapper\n :title=\"formTitle\"\n :back-title=\"formBackTitle\"\n @form:close=\"openForm = false\"\n >\n <aes-data-mapping-discrete\n v-if=\"option?.type === 'dataCategorical' && defaultMappingCategorical\"\n :column-value-labels=\"option.labels\"\n :data-column-label=\"option.selectedSourceInfo?.label ?? ''\"\n :used-aes-in-mapping=\"usedAesInMapping[option.selectedSource]\"\n :allow-hiding=\"chartType === 'discrete'\"\n :allow-reordering=\"chartType === 'discrete' || chartType === 'histogram' || chartType === 'scatterplot' || chartType === 'scatterplot-umap'\"\n v-model=\"defaultMappingCategorical\"\n @update:modelValue=\"(value:AestheticMappingCategorical) => $emit('aes-update', value, option)\"\n />\n <aes-data-mapping-continuous\n v-if=\"option?.type === 'dataContinuous' && defaultMappingContinuous\"\n :data-column-label=\"option.selectedSourceInfo?.label ?? ''\"\n v-model=\"defaultMappingContinuous\"\n @update:modelValue=\"(value:AestheticMappingContinuous) => $emit('aes-update', value, option)\"\n />\n </form-wrapper>\n </template>\n</template>\n"],"names":["props","__props","store","useStore","chartType","computed","emit","__emit","DEFAULT_AES_INPUTS","possibleAesSourceInputs","usedAesInMapping","getKeyFromSelectedType","value","selectedType","ref","isMappedAes","DEFAULT_BY_TYPES","FIXED_COLORS","DEFAULT_DOT_SHAPE","DEFAULT_LINE_TYPE","inputGuide","labelsInfo","chartTypesWithContinuousColors","optionsInfo","res","inputStateMap","addInfo","name","source","selectedSourceInfo","uniqueValuesItem","uniqueValues","valueLabels","key","mapping","createDefaultMapping","v","createContinuousMappingFromPalette","DEFAULT_CONTINUOUS_PALETTE","_a","selectedSource","option","getTitle","selected","typeOptions","options","addOption","text","openForm","defaultFixed","defaultMappingCategorical","defaultMappingContinuous","_b","watch","aesButtonRef","popupHeight","FIXED_LINE_TYPES","FIXES_DOT_SHAPES"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,UAAMA,IAAQC,GAWRC,IAAQC,GAAA,GACRC,IAAYC,EAAS,MAAMH,EAAM,MAAM,SAAS,SAAS,GACzDI,IAAOC,GAEPC,IAAkD;AAAA,MACtD,UAAU,CAAC,mBAAmB,mBAAmB;AAAA,MACjD,aAAa,CAAC,UAAU;AAAA,MACxB,oBAAoB,CAAC,UAAU;AAAA,MAC/B,QAAQ,CAAA;AAAA,MACR,SAAS,CAAA;AAAA,MACT,WAAW,CAAC,UAAU;AAAA,MACtB,QAAQ,CAAA;AAAA,IAAC,GAELC,IAA0BT,EAAM,2BAA2BQ,EAAmBJ,EAAU,KAAK,GAC7FM,IAAmBL;AAAA,MACvB,MACYH,EAAM,MAAM,kBAAkB,iBAAiB;AAAA,IAE3D;AAGF,aAASS,EAAuBC,GAA6B;AAC3D,aAAI,OAAOA,KAAU,WACZA,IAELR,EAAU,UAAU,gBACf,YAAYQ,EAAM,KAAK,KAE5BR,EAAU,UAAU,WACf,GAAGQ,EAAM,IAAI,IAAIA,EAAM,KAAK,KAE9BA,EAAM;AAAA,IACf;AAEA,UAAMC,IAAeC;AAAA,MACnBC,EAAYf,EAAM,QAAQ,IAAIW,EAAuBX,EAAM,QAAQ,IAAI;AAAA,IAAA,GAEnEgB,IAAkE;AAAA,MACtE,MAAMC,EAAa,CAAC,EAAE;AAAA,MACtB,QAAQA,EAAa,CAAC,EAAE;AAAA,MACxB,UAA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,IAAAY;AAAA,MACE,MAAMxC,EAAa;AAAA,MACnB,CAACD,MAAU;AACT,cAAM6B,IAASlB,EAAY,MAAMX,CAAK;AACtC,QAAI6B,EAAO,SAAS,QAClBnC,EAAK,cAAc2C,EAAa,OAAOR,CAAM,IACpCA,EAAO,SAAS,qBACzBS,EAA0B,QAAQT,EAAO,aACzCnC,EAAK,cAAcmC,EAAO,aAAaA,CAAM,KACpCA,EAAO,SAAS,qBACzBU,EAAyB,QAAQV,EAAO,aACxCnC,EAAK,cAAcmC,EAAO,aAAaA,CAAM;AAAA,MAEjD;AAAA,IAAA;AAGF,UAAMa,IAAexC,EAAA,GAGfyC,IAAclD,EAAS,MAAM;AACjC,UAAIL,EAAM,SAAS;AAGjB,eAAOwD,GAAiB,SAAS,KAAa,KAAS;AAEzD,UAAIxD,EAAM,SAAS;AAGjB,eAAO,KAAK,KAAKyD,GAAiB,SAAS,CAAC,IAAI,KAAa,KAAS;AAExE,UAAIzD,EAAM,SAAS,UAAUA,EAAM,SAAS;AAG1C,eAAO,KAAK,KAAKiB,EAAa,SAAS,CAAC,IAAI,KAAa,KAAS;AAAA,IAEtE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"AesSelector.vue.js","sources":["../../../../src/GraphMaker/forms/LayersForm/AesSelector.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { ref, computed, watch } from 'vue';\nimport { PlDropdown } from '@platforma-sdk/ui-vue';\nimport {\n AestheticMappingCategorical, AestheticMappingContinuous, createContinuousMappingFromPalette,\n createDefaultMapping\n} from '../../dataBindAes';\nimport {\n AesOption,\n DotShape,\n LineType\n} from '../../components/AesSettings/types';\nimport {\n DEFAULT_CONTINUOUS_PALETTE,\n DEFAULT_DOT_SHAPE,\n DEFAULT_LINE_TYPE,\n FIXED_COLORS,\n FIXED_LINE_TYPES,\n FIXES_DOT_SHAPES\n} from '../../constantsAesthetic';\nimport AesButton, { type AesButtonProps } from '../../components/AesButton.vue';\nimport { useStore } from '../../store';\nimport { AesType, isMappedAes, MappingLink } from '../../constantsCommon';\nimport Popup from '../../components/Popup.vue';\nimport FixedColorsList from '../../components/AesSettings/FixedColorsList.vue';\nimport FixedDotShapeList from '../../components/AesSettings/FixedDotShapeList.vue';\nimport FixedLineTypeList from '../../components/AesSettings/FixedLineTypeList.vue';\nimport FormWrapper from '../../components/AesSettings/FormWrapper.vue';\nimport AesDataMappingDiscrete from '../../components/AesSettings/AesDataMappingDiscrete.vue';\nimport AesDataMappingContinuous from '../../components/AesSettings/AesDataMappingContinuous.vue';\nimport { ChartType } from '@milaboratories/pf-plots';\n\nconst props = defineProps<{\n label: string;\n type: AesType;\n selected: string | MappingLink;\n formTitle: string;\n formBackTitle: string;\n possibleAesSourceInputs?: string[];\n withoutFixed?: boolean;\n disabled?: boolean;\n}>();\n\nconst store = useStore();\nconst chartType = computed(() => store.value.reactive.chartType);\nconst emit = defineEmits(['aes-update', 'aes-selector-close']);\n\nconst DEFAULT_AES_INPUTS: Record<ChartType, string[]> = {\n discrete: ['primaryGrouping', 'secondaryGrouping'],\n scatterplot: ['grouping'],\n 'scatterplot-umap': ['grouping'],\n dendro: [],\n heatmap: [],\n histogram: ['grouping'],\n bubble: []\n};\nconst possibleAesSourceInputs = props.possibleAesSourceInputs ?? DEFAULT_AES_INPUTS[chartType.value];\nconst usedAesInMapping = computed(\n () => {\n const v = store.value.commonHelpersData.usedAesInMapping.value;\n return v;\n }\n);\n\nfunction getKeyFromSelectedType(value: MappingLink | string) {\n if (typeof value === 'string') {\n return value;\n }\n if (chartType.value === 'scatterplot') {\n return `grouping_${value.value}`;\n }\n if (chartType.value === 'dendro') {\n return `${value.type}_${value.value}`;\n }\n return value.type;\n}\n\nconst selectedType = ref(\n isMappedAes(props.selected) ? getKeyFromSelectedType(props.selected) : 'fix'\n);\nconst DEFAULT_BY_TYPES: Record<AesType, string | DotShape | LineType> = {\n fill: FIXED_COLORS[0].color,\n stroke: FIXED_COLORS[0].color,\n dotShape: DEFAULT_DOT_SHAPE,\n lineType: DEFAULT_LINE_TYPE,\n size: '' // temporary\n};\n\nconst inputGuide = computed(() => store.value.inputGuide.value);\nconst labelsInfo = computed(() => store.value.uniqueValuesData.value);\n\nconst chartTypesWithContinuousColors = new Set<ChartType>([\n 'scatterplot', 'scatterplot-umap', 'heatmap'\n]);\n\nconst optionsInfo = computed(() => {\n const res: Record<string, AesOption> = {};\n const inputStateMap = store.value.reactive.optionsState.components;\n\n function addInfo(name: string, source: string) {\n const selectedSourceInfo = inputGuide.value.getSourceInfo(source);\n const uniqueValuesItem = labelsInfo.value[source];\n const uniqueValues = uniqueValuesItem?.list ?? [];\n const valueLabels = uniqueValuesItem?.labels ?? {};\n const key = getKeyFromSelectedType({ type: name, value: source });\n if (\n chartTypesWithContinuousColors.has(chartType.value) && selectedSourceInfo.type === 'String' ||\n !chartTypesWithContinuousColors.has(chartType.value)\n ) {\n const mapping = (store.value.reactive.dataBindAes[source] ?? createDefaultMapping(uniqueValues)) as AestheticMappingCategorical;\n res[key] = {\n type: 'dataCategorical',\n value: key,\n initialData: mapping,\n inputName: name,\n selectedSource: source,\n selectedSourceInfo,\n selectedSourceValues: uniqueValues,\n labels: mapping.order.reduce(\n (res: Record<string, string>, v: string | number) => {\n res[v] = valueLabels[v] ?? String(v);\n return res;\n },\n {}\n )\n };\n } else {\n const mapping = (store.value.reactive.dataBindAes[source] ?? createContinuousMappingFromPalette(DEFAULT_CONTINUOUS_PALETTE)) as AestheticMappingContinuous;\n res[key] = {\n type: 'dataContinuous',\n value: key,\n initialData: mapping,\n inputName: name,\n selectedSource: source,\n selectedSourceInfo,\n selectedSourceValues: uniqueValues\n };\n }\n }\n\n possibleAesSourceInputs.forEach((name) => {\n if (inputStateMap?.[name]?.selectorStates.length) {\n inputStateMap[name].selectorStates.forEach(({ selectedSource }) => {\n addInfo(name, selectedSource);\n });\n }\n });\n\n if (!props.withoutFixed) {\n res['fix'] = {\n type: 'fix',\n value: 'fix',\n initialData: isMappedAes(props.selected)\n ? DEFAULT_BY_TYPES[props.type]\n : props.selected\n };\n }\n return res;\n});\n\nconst option = computed<AesOption | null>(\n () => optionsInfo.value[selectedType.value] ?? null\n);\n\nfunction getTitle(option: AesOption, selected: string) {\n if (option.type === 'fix') {\n return 'Fixed';\n }\n if (selected === option.value) {\n return `${option.selectedSourceInfo?.label}`;\n }\n if (chartType.value === 'discrete') {\n return `${\n option.value === 'primaryGrouping' ? 'Primary' : 'Secondary'\n } grouping: ${option.selectedSourceInfo?.label}`;\n }\n if (chartType.value === 'scatterplot' || chartType.value === 'dendro') {\n return `Grouping: ${option.selectedSourceInfo?.label}`;\n }\n return option.selectedSourceInfo?.label ?? '';\n}\n\nconst typeOptions = computed(() => {\n const options = [];\n const inputStateMap = store.value.reactive.optionsState.components;\n\n function addOption(name: string, source: string) {\n const key = getKeyFromSelectedType({\n type: name === 'shape' ? 'grouping' : name,\n value: source\n });\n if (optionsInfo.value[key]) {\n options.push({\n text: getTitle(optionsInfo.value[key], selectedType.value),\n value: key\n });\n }\n }\n\n possibleAesSourceInputs.forEach((name) => {\n if (inputStateMap?.[name]?.selectorStates.length) {\n inputStateMap[name].selectorStates.forEach(({ selectedSource }) => {\n addOption(name, selectedSource);\n });\n }\n });\n if (!optionsInfo.value[selectedType.value]) {\n let text = 'Not consistent (grouping)';\n if (chartType.value === 'discrete') {\n text = `${\n selectedType.value === 'primaryGrouping' ? 'Primary' : 'Secondary'\n } grouping (not selected)`;\n }\n options.push({ text, value: selectedType.value });\n }\n if (!props.withoutFixed) {\n options.push({ text: 'Fixed', value: 'fix' });\n }\n return options;\n});\n\nconst openForm = ref(false);\n\nconst defaultFixed = ref(\n optionsInfo.value['fix']\n ? (optionsInfo.value['fix'].initialData as string)\n : null\n);\nconst defaultMappingCategorical = ref(\n option.value?.type === 'dataCategorical'\n ? (option.value.initialData as AestheticMappingCategorical)\n : null\n);\n\nconst defaultMappingContinuous = ref(\n option.value?.type === 'dataContinuous'\n ? (option.value.initialData as AestheticMappingContinuous)\n : null\n);\nwatch(\n () => selectedType.value,\n (value) => {\n const option = optionsInfo.value[value];\n if (option.type === 'fix') {\n emit('aes-update', defaultFixed.value, option);\n } else if (option.type === 'dataCategorical') {\n defaultMappingCategorical.value = option.initialData;\n emit('aes-update', option.initialData, option);\n } else if (option.type === 'dataContinuous') {\n defaultMappingContinuous.value = option.initialData;\n emit('aes-update', option.initialData, option);\n }\n }\n);\n\nconst aesButtonRef = ref();\n\n//TODO: move to utils\nconst popupHeight = computed(() => {\n if (props.type === 'lineType') {\n const ROW_HEIGHT = 32;\n const OFFSET = 16;\n return FIXED_LINE_TYPES.length * ROW_HEIGHT + OFFSET * 2;\n }\n if (props.type === 'dotShape') {\n const ROW_HEIGHT = 36;\n const OFFSET = 20;\n return Math.ceil(FIXES_DOT_SHAPES.length / 6) * ROW_HEIGHT + OFFSET * 2;\n }\n if (props.type === 'fill' || props.type === 'stroke') {\n const ROW_HEIGHT = 36;\n const OFFSET = 20;\n return Math.ceil(FIXED_COLORS.length / 6) * ROW_HEIGHT + OFFSET * 2;\n }\n});\n\n</script>\n\n<template>\n <div class=\"aes-input-row\">\n <div class=\"aes-input-select\" @click.stop>\n <pl-dropdown\n :disabled=\"disabled || typeOptions.length < 2\"\n :label=\"label\"\n :options=\"typeOptions\"\n v-model=\"selectedType\"\n />\n </div>\n <aes-button\n :data=\"{\n type: selectedType === 'fix' ? type : 'data',\n value: selectedType === 'fix' ? type === 'size' ? Number(selected) : selected as string : null\n } as AesButtonProps['data']\"\n @click=\"openForm = !openForm\"\n @ref=\"(el:Element) => (aesButtonRef = el)\"\n />\n <popup\n v-if=\"selectedType === 'fix' && openForm && defaultFixed\"\n :height=\"popupHeight\"\n :targetRef=\"aesButtonRef\"\n @popup:close=\"openForm = false\"\n >\n <div\n class=\"fixed-aes-list\"\n :class=\"{ 'fixed-aes-list__rows': type === 'lineType' }\"\n >\n <fixed-colors-list\n v-if=\"type === 'fill' || type === 'stroke'\"\n :color-using=\"type\"\n v-model=\"defaultFixed\"\n @update:modelValue=\"\n (value:string) => $emit('aes-update', value, optionsInfo['fix'])\n \"\n />\n <fixed-dot-shape-list\n v-if=\"type === 'dotShape'\"\n v-model=\"defaultFixed\"\n @update:modelValue=\"\n (value:DotShape) => $emit('aes-update', value, optionsInfo['fix'])\n \"\n />\n <fixed-line-type-list\n v-if=\"type === 'lineType'\"\n v-model=\"defaultFixed\"\n @update:modelValue=\"\n (value:LineType) => $emit('aes-update', value, optionsInfo['fix'])\n \"\n />\n </div>\n </popup>\n </div>\n <template v-if=\"(\n (option?.type === 'dataCategorical' && defaultMappingCategorical) ||\n (option?.type === 'dataContinuous' && defaultMappingContinuous)) && openForm\">\n <form-wrapper\n :title=\"formTitle\"\n :back-title=\"formBackTitle\"\n @form:close=\"openForm = false\"\n >\n <aes-data-mapping-discrete\n v-if=\"option?.type === 'dataCategorical' && defaultMappingCategorical\"\n :column-value-labels=\"option.labels\"\n :data-column-label=\"option.selectedSourceInfo?.label ?? ''\"\n :used-aes-in-mapping=\"usedAesInMapping[option.selectedSource]\"\n :allow-hiding=\"chartType === 'discrete'\"\n :allow-reordering=\"chartType === 'discrete' || chartType === 'histogram' || chartType === 'scatterplot' || chartType === 'scatterplot-umap'\"\n :allow-null-option=\"chartType === 'discrete' && (\n selectedType === 'primaryGrouping' && store.reactive.axesSettings.axisX.allowNullPrimaryGroups ||\n selectedType === 'secondaryGrouping' && store.reactive.axesSettings.axisX.allowNullSecondaryGroups\n ) || chartType === 'scatterplot' || chartType === 'scatterplot-umap'\"\n v-model=\"defaultMappingCategorical\"\n @update:modelValue=\"(value:AestheticMappingCategorical) => $emit('aes-update', value, option)\"\n />\n <aes-data-mapping-continuous\n v-if=\"option?.type === 'dataContinuous' && defaultMappingContinuous\"\n :data-column-label=\"option.selectedSourceInfo?.label ?? ''\"\n v-model=\"defaultMappingContinuous\"\n @update:modelValue=\"(value:AestheticMappingContinuous) => $emit('aes-update', value, option)\"\n />\n </form-wrapper>\n </template>\n</template>\n"],"names":["props","__props","store","useStore","chartType","computed","emit","__emit","DEFAULT_AES_INPUTS","possibleAesSourceInputs","usedAesInMapping","getKeyFromSelectedType","value","selectedType","ref","isMappedAes","DEFAULT_BY_TYPES","FIXED_COLORS","DEFAULT_DOT_SHAPE","DEFAULT_LINE_TYPE","inputGuide","labelsInfo","chartTypesWithContinuousColors","optionsInfo","res","inputStateMap","addInfo","name","source","selectedSourceInfo","uniqueValuesItem","uniqueValues","valueLabels","key","mapping","createDefaultMapping","v","createContinuousMappingFromPalette","DEFAULT_CONTINUOUS_PALETTE","_a","selectedSource","option","getTitle","selected","typeOptions","options","addOption","text","openForm","defaultFixed","defaultMappingCategorical","defaultMappingContinuous","_b","watch","aesButtonRef","popupHeight","FIXED_LINE_TYPES","FIXES_DOT_SHAPES"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,UAAMA,IAAQC,GAWRC,IAAQC,GAAA,GACRC,IAAYC,EAAS,MAAMH,EAAM,MAAM,SAAS,SAAS,GACzDI,IAAOC,GAEPC,IAAkD;AAAA,MACtD,UAAU,CAAC,mBAAmB,mBAAmB;AAAA,MACjD,aAAa,CAAC,UAAU;AAAA,MACxB,oBAAoB,CAAC,UAAU;AAAA,MAC/B,QAAQ,CAAA;AAAA,MACR,SAAS,CAAA;AAAA,MACT,WAAW,CAAC,UAAU;AAAA,MACtB,QAAQ,CAAA;AAAA,IAAC,GAELC,IAA0BT,EAAM,2BAA2BQ,EAAmBJ,EAAU,KAAK,GAC7FM,IAAmBL;AAAA,MACvB,MACYH,EAAM,MAAM,kBAAkB,iBAAiB;AAAA,IAE3D;AAGF,aAASS,EAAuBC,GAA6B;AAC3D,aAAI,OAAOA,KAAU,WACZA,IAELR,EAAU,UAAU,gBACf,YAAYQ,EAAM,KAAK,KAE5BR,EAAU,UAAU,WACf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