@luzmo/dashboard-contents-types 1.0.42 → 1.0.43
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/CHANGELOG.md +6 -0
- package/area-chart/area-chart-options.config.cjs +1 -1
- package/area-chart/area-chart-options.config.cjs.map +1 -1
- package/area-chart/area-chart-options.config.js +12 -7
- package/area-chart/area-chart-options.config.js.map +1 -1
- package/bar-chart/bar-chart-options.config.cjs +1 -1
- package/bar-chart/bar-chart-options.config.cjs.map +1 -1
- package/bar-chart/bar-chart-options.config.js +12 -10
- package/bar-chart/bar-chart-options.config.js.map +1 -1
- package/box-plot/box-plot-options.config.cjs +1 -1
- package/box-plot/box-plot-options.config.cjs.map +1 -1
- package/box-plot/box-plot-options.config.js +24 -19
- package/box-plot/box-plot-options.config.js.map +1 -1
- package/bubble-chart/bubble-chart-options.config.cjs +1 -1
- package/bubble-chart/bubble-chart-options.config.cjs.map +1 -1
- package/bubble-chart/bubble-chart-options.config.js +9 -7
- package/bubble-chart/bubble-chart-options.config.js.map +1 -1
- package/choropleth-map/choropleth-map-options.config.cjs +1 -1
- package/choropleth-map/choropleth-map-options.config.cjs.map +1 -1
- package/choropleth-map/choropleth-map-options.config.js +32 -30
- package/choropleth-map/choropleth-map-options.config.js.map +1 -1
- package/circle-pack-chart/circle-pack-chart-options.config.cjs +1 -1
- package/circle-pack-chart/circle-pack-chart-options.config.cjs.map +1 -1
- package/circle-pack-chart/circle-pack-chart-options.config.js +36 -31
- package/circle-pack-chart/circle-pack-chart-options.config.js.map +1 -1
- package/column-chart/column-chart-options.config.cjs +1 -1
- package/column-chart/column-chart-options.config.cjs.map +1 -1
- package/column-chart/column-chart-options.config.js +12 -10
- package/column-chart/column-chart-options.config.js.map +1 -1
- package/combination-chart/combination-chart-options.config.cjs +1 -1
- package/combination-chart/combination-chart-options.config.cjs.map +1 -1
- package/combination-chart/combination-chart-options.config.js +8 -3
- package/combination-chart/combination-chart-options.config.js.map +1 -1
- package/donut-chart/donut-chart-options.config.cjs +1 -1
- package/donut-chart/donut-chart-options.config.cjs.map +1 -1
- package/donut-chart/donut-chart-options.config.js +8 -4
- package/donut-chart/donut-chart-options.config.js.map +1 -1
- package/funnel-chart/funnel-chart-options.config.cjs +1 -1
- package/funnel-chart/funnel-chart-options.config.cjs.map +1 -1
- package/funnel-chart/funnel-chart-options.config.js +5 -3
- package/funnel-chart/funnel-chart-options.config.js.map +1 -1
- package/heat-table/heat-table-options.config.cjs +1 -1
- package/heat-table/heat-table-options.config.cjs.map +1 -1
- package/heat-table/heat-table-options.config.js +21 -19
- package/heat-table/heat-table-options.config.js.map +1 -1
- package/index.cjs +1 -1
- package/index.js +192 -191
- package/line-chart/line-chart-options.config.cjs +1 -1
- package/line-chart/line-chart-options.config.cjs.map +1 -1
- package/line-chart/line-chart-options.config.js +10 -5
- package/line-chart/line-chart-options.config.js.map +1 -1
- package/ohlc-chart/ohlc-chart-options.config.cjs +1 -1
- package/ohlc-chart/ohlc-chart-options.config.cjs.map +1 -1
- package/ohlc-chart/ohlc-chart-options.config.js +8 -3
- package/ohlc-chart/ohlc-chart-options.config.js.map +1 -1
- package/package.json +1 -1
- package/parallel-coordinates-plot/i18n/parallel-coordinates-plot-options.de.cjs +1 -1
- package/parallel-coordinates-plot/i18n/parallel-coordinates-plot-options.de.cjs.map +1 -1
- package/parallel-coordinates-plot/i18n/parallel-coordinates-plot-options.de.js +2 -1
- package/parallel-coordinates-plot/i18n/parallel-coordinates-plot-options.de.js.map +1 -1
- package/parallel-coordinates-plot/i18n/parallel-coordinates-plot-options.en.cjs +1 -1
- package/parallel-coordinates-plot/i18n/parallel-coordinates-plot-options.en.cjs.map +1 -1
- package/parallel-coordinates-plot/i18n/parallel-coordinates-plot-options.en.js +2 -1
- package/parallel-coordinates-plot/i18n/parallel-coordinates-plot-options.en.js.map +1 -1
- package/parallel-coordinates-plot/i18n/parallel-coordinates-plot-options.es.cjs +1 -1
- package/parallel-coordinates-plot/i18n/parallel-coordinates-plot-options.es.cjs.map +1 -1
- package/parallel-coordinates-plot/i18n/parallel-coordinates-plot-options.es.js +2 -1
- package/parallel-coordinates-plot/i18n/parallel-coordinates-plot-options.es.js.map +1 -1
- package/parallel-coordinates-plot/i18n/parallel-coordinates-plot-options.fr.cjs +1 -1
- package/parallel-coordinates-plot/i18n/parallel-coordinates-plot-options.fr.cjs.map +1 -1
- package/parallel-coordinates-plot/i18n/parallel-coordinates-plot-options.fr.js +2 -1
- package/parallel-coordinates-plot/i18n/parallel-coordinates-plot-options.fr.js.map +1 -1
- package/parallel-coordinates-plot/i18n/parallel-coordinates-plot-options.nl.cjs +1 -1
- package/parallel-coordinates-plot/i18n/parallel-coordinates-plot-options.nl.cjs.map +1 -1
- package/parallel-coordinates-plot/i18n/parallel-coordinates-plot-options.nl.js +2 -1
- package/parallel-coordinates-plot/i18n/parallel-coordinates-plot-options.nl.js.map +1 -1
- package/parallel-coordinates-plot/parallel-coordinates-plot-options.config.cjs +1 -1
- package/parallel-coordinates-plot/parallel-coordinates-plot-options.config.cjs.map +1 -1
- package/parallel-coordinates-plot/parallel-coordinates-plot-options.config.js +25 -20
- package/parallel-coordinates-plot/parallel-coordinates-plot-options.config.js.map +1 -1
- package/pivot-table/pivot-table-options.config.cjs +1 -1
- package/pivot-table/pivot-table-options.config.cjs.map +1 -1
- package/pivot-table/pivot-table-options.config.js +5 -3
- package/pivot-table/pivot-table-options.config.js.map +1 -1
- package/pyramid-chart/pyramid-chart-options.config.cjs +1 -1
- package/pyramid-chart/pyramid-chart-options.config.cjs.map +1 -1
- package/pyramid-chart/pyramid-chart-options.config.js +5 -3
- package/pyramid-chart/pyramid-chart-options.config.js.map +1 -1
- package/sankey-diagram/sankey-diagram-options.config.cjs +1 -1
- package/sankey-diagram/sankey-diagram-options.config.cjs.map +1 -1
- package/sankey-diagram/sankey-diagram-options.config.js +5 -3
- package/sankey-diagram/sankey-diagram-options.config.js.map +1 -1
- package/scatter-plot/scatter-plot-options.config.cjs +1 -1
- package/scatter-plot/scatter-plot-options.config.cjs.map +1 -1
- package/scatter-plot/scatter-plot-options.config.js +10 -5
- package/scatter-plot/scatter-plot-options.config.js.map +1 -1
- package/shared/utils/interactivity-options.config.cjs +2 -0
- package/shared/utils/interactivity-options.config.cjs.map +1 -0
- package/shared/utils/interactivity-options.config.js +56 -0
- package/shared/utils/interactivity-options.config.js.map +1 -0
- package/shared/utils/interactivity-options.i18n.cjs +2 -0
- package/shared/utils/interactivity-options.i18n.cjs.map +1 -0
- package/shared/utils/interactivity-options.i18n.js +42 -0
- package/shared/utils/interactivity-options.i18n.js.map +1 -0
- package/shared/utils/options-loader.cjs +1 -1
- package/shared/utils/options-loader.cjs.map +1 -1
- package/shared/utils/options-loader.js +11 -11
- package/shared/utils/options-loader.js.map +1 -1
- package/src/lib/area-chart/area-chart-options.config.d.ts.map +1 -1
- package/src/lib/bar-chart/bar-chart-options.config.d.ts.map +1 -1
- package/src/lib/box-plot/box-plot-options.config.d.ts.map +1 -1
- package/src/lib/bubble-chart/bubble-chart-options.config.d.ts.map +1 -1
- package/src/lib/choropleth-map/choropleth-map-options.config.d.ts.map +1 -1
- package/src/lib/circle-pack-chart/circle-pack-chart-options.config.d.ts.map +1 -1
- package/src/lib/column-chart/column-chart-options.config.d.ts.map +1 -1
- package/src/lib/combination-chart/combination-chart-options.config.d.ts.map +1 -1
- package/src/lib/donut-chart/donut-chart-options.config.d.ts.map +1 -1
- package/src/lib/funnel-chart/funnel-chart-options.config.d.ts.map +1 -1
- package/src/lib/heat-table/heat-table-options.config.d.ts.map +1 -1
- package/src/lib/line-chart/line-chart-options.config.d.ts.map +1 -1
- package/src/lib/ohlc-chart/ohlc-chart-options.config.d.ts.map +1 -1
- package/src/lib/parallel-coordinates-plot/i18n/parallel-coordinates-plot-options.de.d.ts +3 -0
- package/src/lib/parallel-coordinates-plot/i18n/parallel-coordinates-plot-options.de.d.ts.map +1 -1
- package/src/lib/parallel-coordinates-plot/i18n/parallel-coordinates-plot-options.en.d.ts +3 -0
- package/src/lib/parallel-coordinates-plot/i18n/parallel-coordinates-plot-options.en.d.ts.map +1 -1
- package/src/lib/parallel-coordinates-plot/i18n/parallel-coordinates-plot-options.es.d.ts +3 -0
- package/src/lib/parallel-coordinates-plot/i18n/parallel-coordinates-plot-options.es.d.ts.map +1 -1
- package/src/lib/parallel-coordinates-plot/i18n/parallel-coordinates-plot-options.fr.d.ts +3 -0
- package/src/lib/parallel-coordinates-plot/i18n/parallel-coordinates-plot-options.fr.d.ts.map +1 -1
- package/src/lib/parallel-coordinates-plot/i18n/parallel-coordinates-plot-options.nl.d.ts +3 -0
- package/src/lib/parallel-coordinates-plot/i18n/parallel-coordinates-plot-options.nl.d.ts.map +1 -1
- package/src/lib/parallel-coordinates-plot/parallel-coordinates-plot-options.config.d.ts.map +1 -1
- package/src/lib/pivot-table/pivot-table-options.config.d.ts.map +1 -1
- package/src/lib/pyramid-chart/pyramid-chart-options.config.d.ts.map +1 -1
- package/src/lib/sankey-diagram/sankey-diagram-options.config.d.ts.map +1 -1
- package/src/lib/scatter-plot/scatter-plot-options.config.d.ts.map +1 -1
- package/src/lib/shared/utils/index.d.ts +1 -0
- package/src/lib/shared/utils/index.d.ts.map +1 -1
- package/src/lib/shared/utils/interactivity-options.config.d.ts +15 -0
- package/src/lib/shared/utils/interactivity-options.config.d.ts.map +1 -0
- package/src/lib/shared/utils/interactivity-options.i18n.d.ts +3 -0
- package/src/lib/shared/utils/interactivity-options.i18n.d.ts.map +1 -0
- package/src/lib/sunburst-chart/sunburst-chart-options.config.d.ts.map +1 -1
- package/src/lib/treemap-chart/treemap-chart-options.config.d.ts.map +1 -1
- package/src/lib/wordcloud-chart/wordcloud-chart-options.config.d.ts.map +1 -1
- package/sunburst-chart/sunburst-chart-options.config.cjs +1 -1
- package/sunburst-chart/sunburst-chart-options.config.cjs.map +1 -1
- package/sunburst-chart/sunburst-chart-options.config.js +5 -3
- package/sunburst-chart/sunburst-chart-options.config.js.map +1 -1
- package/treemap-chart/treemap-chart-options.config.cjs +1 -1
- package/treemap-chart/treemap-chart-options.config.cjs.map +1 -1
- package/treemap-chart/treemap-chart-options.config.js +10 -8
- package/treemap-chart/treemap-chart-options.config.js.map +1 -1
- package/wordcloud-chart/wordcloud-chart-options.config.cjs +1 -1
- package/wordcloud-chart/wordcloud-chart-options.config.cjs.map +1 -1
- package/wordcloud-chart/wordcloud-chart-options.config.js +5 -3
- package/wordcloud-chart/wordcloud-chart-options.config.js.map +1 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { getThemeMainColor as e, getThemeMainColorExtraLabelClickAction as t, getThemeMainColorExtraLabelHasClickAction as n, getThemeMainColorResetLabel as r } from "../helpers.js";
|
|
2
2
|
import { createAxesOptionsGroup as i, createManualRangeControls as a } from "../shared/utils/axis-options.config.js";
|
|
3
3
|
import { createInfoTooltipOptionsGroup as o } from "../shared/utils/info-tooltip-options.config.js";
|
|
4
|
-
import {
|
|
4
|
+
import { createInteractivityOptionsGroup as s } from "../shared/utils/interactivity-options.config.js";
|
|
5
|
+
import { getColorMapKeys as c, getColorMaps as l } from "../shared/utils/color/color-palettes.js";
|
|
5
6
|
//#region src/lib/box-plot/box-plot-options.config.ts
|
|
6
|
-
var
|
|
7
|
+
var u = ({ options: e }) => e?.observations?.display === !0, d = [
|
|
7
8
|
{
|
|
8
9
|
key: "general",
|
|
9
10
|
type: "group",
|
|
@@ -148,7 +149,7 @@ var l = ({ options: e }) => e?.observations?.display === !0, u = [
|
|
|
148
149
|
label: "Only outliers",
|
|
149
150
|
default: !1
|
|
150
151
|
},
|
|
151
|
-
visibleIf:
|
|
152
|
+
visibleIf: u
|
|
152
153
|
},
|
|
153
154
|
{
|
|
154
155
|
key: "observations.type",
|
|
@@ -158,7 +159,7 @@ var l = ({ options: e }) => e?.observations?.display === !0, u = [
|
|
|
158
159
|
default: "dot",
|
|
159
160
|
enum: ["dot", "ticks"]
|
|
160
161
|
},
|
|
161
|
-
visibleIf:
|
|
162
|
+
visibleIf: u
|
|
162
163
|
},
|
|
163
164
|
{
|
|
164
165
|
key: "observations.size",
|
|
@@ -170,7 +171,7 @@ var l = ({ options: e }) => e?.observations?.display === !0, u = [
|
|
|
170
171
|
max: 10,
|
|
171
172
|
step: 1
|
|
172
173
|
},
|
|
173
|
-
visibleIf:
|
|
174
|
+
visibleIf: u
|
|
174
175
|
},
|
|
175
176
|
{
|
|
176
177
|
key: "observations.opacity",
|
|
@@ -182,7 +183,7 @@ var l = ({ options: e }) => e?.observations?.display === !0, u = [
|
|
|
182
183
|
max: 1,
|
|
183
184
|
step: .1
|
|
184
185
|
},
|
|
185
|
-
visibleIf:
|
|
186
|
+
visibleIf: u
|
|
186
187
|
},
|
|
187
188
|
{
|
|
188
189
|
key: "observations.jitter",
|
|
@@ -194,7 +195,7 @@ var l = ({ options: e }) => e?.observations?.display === !0, u = [
|
|
|
194
195
|
max: 100,
|
|
195
196
|
step: 1
|
|
196
197
|
},
|
|
197
|
-
visibleIf:
|
|
198
|
+
visibleIf: u
|
|
198
199
|
},
|
|
199
200
|
{
|
|
200
201
|
key: "observations.colorType",
|
|
@@ -204,7 +205,7 @@ var l = ({ options: e }) => e?.observations?.display === !0, u = [
|
|
|
204
205
|
default: "single",
|
|
205
206
|
enum: ["single", "range"]
|
|
206
207
|
},
|
|
207
|
-
visibleIf:
|
|
208
|
+
visibleIf: u
|
|
208
209
|
},
|
|
209
210
|
{
|
|
210
211
|
key: "observations.color",
|
|
@@ -222,7 +223,7 @@ var l = ({ options: e }) => e?.observations?.display === !0, u = [
|
|
|
222
223
|
};
|
|
223
224
|
}
|
|
224
225
|
},
|
|
225
|
-
visibleIf: ({ options: e }) =>
|
|
226
|
+
visibleIf: ({ options: e }) => u({ options: e }) && e?.observations?.colorType === "single"
|
|
226
227
|
},
|
|
227
228
|
{
|
|
228
229
|
key: "observations.colorsType",
|
|
@@ -231,7 +232,7 @@ var l = ({ options: e }) => e?.observations?.display === !0, u = [
|
|
|
231
232
|
label: "Colors type",
|
|
232
233
|
default: "divergent",
|
|
233
234
|
enum: ["sequential", "divergent"],
|
|
234
|
-
calculateValue: ({ options: e }) => e?.observations?.colorsClass === "manual" ? "manual" :
|
|
235
|
+
calculateValue: ({ options: e }) => e?.observations?.colorsClass === "manual" ? "manual" : l()?.[e?.observations?.colorsClass]?.type ?? "divergent",
|
|
235
236
|
toOptions: ({ options: e, value: t }) => {
|
|
236
237
|
if (t === "manual") return {
|
|
237
238
|
...e,
|
|
@@ -242,7 +243,7 @@ var l = ({ options: e }) => e?.observations?.display === !0, u = [
|
|
|
242
243
|
}
|
|
243
244
|
};
|
|
244
245
|
let n = e.observations?.colorsClass;
|
|
245
|
-
return t !==
|
|
246
|
+
return t !== l()?.[e?.observations?.colorsClass]?.type && (n = c(t ?? "divergent")[0]), {
|
|
246
247
|
...e,
|
|
247
248
|
observations: {
|
|
248
249
|
...e.observations,
|
|
@@ -252,7 +253,7 @@ var l = ({ options: e }) => e?.observations?.display === !0, u = [
|
|
|
252
253
|
};
|
|
253
254
|
}
|
|
254
255
|
},
|
|
255
|
-
visibleIf: ({ options: e }) =>
|
|
256
|
+
visibleIf: ({ options: e }) => u({ options: e }) && e?.observations?.colorType === "range"
|
|
256
257
|
},
|
|
257
258
|
{
|
|
258
259
|
key: "observations.colorsClass",
|
|
@@ -261,15 +262,15 @@ var l = ({ options: e }) => e?.observations?.display === !0, u = [
|
|
|
261
262
|
label: "Color palette",
|
|
262
263
|
hideLabel: !0,
|
|
263
264
|
default: ({ options: e }) => {
|
|
264
|
-
let t =
|
|
265
|
-
return
|
|
265
|
+
let t = l()?.[e?.observations?.colorsClass]?.type;
|
|
266
|
+
return c(t ?? "divergent")[0];
|
|
266
267
|
},
|
|
267
268
|
enum: ({ options: e }) => {
|
|
268
|
-
let t =
|
|
269
|
-
return
|
|
269
|
+
let t = l()?.[e?.observations?.colorsClass]?.type;
|
|
270
|
+
return c(t ?? "divergent");
|
|
270
271
|
}
|
|
271
272
|
},
|
|
272
|
-
visibleIf: ({ options: e }) =>
|
|
273
|
+
visibleIf: ({ options: e }) => u({ options: e }) && e?.observations?.colorType === "range" && e?.observations?.colorsClass !== "manual"
|
|
273
274
|
}
|
|
274
275
|
]
|
|
275
276
|
},
|
|
@@ -303,9 +304,13 @@ var l = ({ options: e }) => e?.observations?.display === !0, u = [
|
|
|
303
304
|
default: "variable"
|
|
304
305
|
}
|
|
305
306
|
})),
|
|
306
|
-
o()
|
|
307
|
+
o(),
|
|
308
|
+
s({ brush: {
|
|
309
|
+
default: !1,
|
|
310
|
+
excludesClickActions: !0
|
|
311
|
+
} })
|
|
307
312
|
];
|
|
308
313
|
//#endregion
|
|
309
|
-
export {
|
|
314
|
+
export { d as default };
|
|
310
315
|
|
|
311
316
|
//# sourceMappingURL=box-plot-options.config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"box-plot-options.config.js","names":[],"sources":["../../../../libs/dashboard-contents-types/src/lib/box-plot/box-plot-options.config.ts"],"sourcesContent":["import { type ColorsClassKey, getColorMapKeys, getColorMaps } from '../shared/utils/color/color-palettes';\nimport {\n getThemeMainColor,\n getThemeMainColorExtraLabelClickAction,\n getThemeMainColorExtraLabelHasClickAction,\n getThemeMainColorResetLabel\n} from '../helpers';\nimport { createAxesOptionsGroup, createManualRangeControls } from '../shared/utils/axis-options.config';\nimport { createInfoTooltipOptionsGroup } from '../shared/utils/info-tooltip-options.config';\nimport type { OptionsConfig, OptionsConfigContext } from '../shared/utils/options-config.types';\nimport type { BoxPlotViewOptions } from './box-plot-options';\n\ntype BoxPlotConfigContext = OptionsConfigContext<BoxPlotViewOptions>;\ntype BoxPlotConfigContextWithValue<T> = BoxPlotConfigContext & { value: T };\n\nconst observationsEnabled = ({ options }: BoxPlotConfigContext) => options?.observations?.display === true;\n\nconst boxPlotOptionsConfig: OptionsConfig<BoxPlotConfigContext> = [\n {\n key: 'general',\n type: 'group',\n open: true,\n children: [\n {\n key: 'display.title',\n control: {\n type: 'switch',\n label: 'Title',\n default: true\n }\n },\n {\n key: 'horizontal',\n control: {\n type: 'picker',\n label: 'Display',\n default: 'vertical',\n enum: ['vertical', 'horizontal'],\n parseValue: (value: boolean | null | undefined) => (value ? 'horizontal' : 'vertical'),\n toValue: (value: 'horizontal' | 'vertical') => value === 'horizontal'\n }\n },\n {\n key: 'extentTicks',\n control: {\n type: 'switch',\n label: 'Extent ticks',\n default: true\n }\n }\n ]\n },\n {\n key: 'box',\n type: 'group',\n open: true,\n children: [\n {\n key: 'boxWidth',\n control: {\n type: 'slider',\n label: 'Box width',\n default: 0.9,\n min: 0.1,\n max: 1,\n step: 0.1\n }\n },\n {\n key: 'boxFill',\n control: {\n type: 'color-picker',\n label: 'Box fill',\n default: ({ theme }: BoxPlotConfigContext) => getThemeMainColor(theme),\n extraLabel: ({ options, theme }: BoxPlotConfigContext) =>\n getThemeMainColorResetLabel(options, theme, 'boxFill'),\n extraLabelHasClickAction: ({ options, theme }: BoxPlotConfigContext) =>\n getThemeMainColorExtraLabelHasClickAction(options, theme, 'boxFill'),\n extraLabelClickAction: ({ options, theme }: BoxPlotConfigContext) =>\n getThemeMainColorExtraLabelClickAction(options, theme, 'boxFill')\n }\n },\n {\n key: 'roundedCorners',\n control: {\n type: 'slider',\n label: 'Rounded corners',\n default: ({ theme }: BoxPlotConfigContext) => theme?.itemSpecific?.rounding ?? 8,\n min: 0,\n max: 24,\n step: 1,\n extraLabel: ({ options, theme }: BoxPlotConfigContext) => {\n if (typeof theme?.itemSpecific?.rounding !== 'number') {\n return null;\n }\n\n if (typeof options?.roundedCorners !== 'number') {\n return 'auto';\n }\n\n return 'reset';\n },\n extraLabelHasClickAction: ({ options, theme }: BoxPlotConfigContext) => {\n if (typeof theme?.itemSpecific?.rounding !== 'number' || typeof options?.roundedCorners !== 'number') {\n return false;\n }\n\n return true;\n },\n extraLabelClickAction: ({ options }: BoxPlotConfigContext) => {\n const newOptions = { ...options };\n\n if (newOptions?.roundedCorners !== undefined) {\n delete newOptions.roundedCorners;\n }\n\n return { value: null, options: newOptions };\n }\n }\n },\n {\n key: 'boxStrokeWidth',\n control: {\n type: 'slider',\n label: 'Box stroke width',\n default: 1,\n min: 0,\n max: 5,\n step: 0.5\n }\n },\n {\n key: 'boxStrokeColor',\n control: {\n type: 'color-picker',\n label: 'Box stroke color',\n default: ({ theme }: BoxPlotConfigContext) => getThemeMainColor(theme),\n extraLabel: ({ options, theme }: BoxPlotConfigContext) =>\n getThemeMainColorResetLabel(options, theme, 'boxStrokeColor'),\n extraLabelHasClickAction: ({ options, theme }: BoxPlotConfigContext) =>\n getThemeMainColorExtraLabelHasClickAction(options, theme, 'boxStrokeColor'),\n extraLabelClickAction: ({ options, theme }: BoxPlotConfigContext) =>\n getThemeMainColorExtraLabelClickAction(options, theme, 'boxStrokeColor')\n }\n },\n {\n key: 'medianStrokeWidth',\n control: {\n type: 'slider',\n label: 'Median stroke width',\n default: 2,\n min: 0,\n max: 5,\n step: 0.5\n }\n },\n {\n key: 'medianStrokeColor',\n control: {\n type: 'color-picker',\n label: 'Median stroke color',\n default: '#000000'\n }\n }\n ]\n },\n {\n key: 'observations',\n type: 'group',\n open: true,\n children: [\n {\n key: 'observations.display',\n control: {\n type: 'switch',\n label: 'Show',\n default: false\n }\n },\n {\n key: 'observations.onlyOutliers',\n control: {\n type: 'switch',\n label: 'Only outliers',\n default: false\n },\n visibleIf: observationsEnabled\n },\n {\n key: 'observations.type',\n control: {\n type: 'picker',\n label: 'Type',\n default: 'dot',\n enum: ['dot', 'ticks']\n },\n visibleIf: observationsEnabled\n },\n {\n key: 'observations.size',\n control: {\n type: 'slider',\n label: 'Size',\n default: 3,\n min: 1,\n max: 10,\n step: 1\n },\n visibleIf: observationsEnabled\n },\n {\n key: 'observations.opacity',\n control: {\n type: 'slider',\n label: 'Opacity',\n default: 0.4,\n min: 0.1,\n max: 1,\n step: 0.1\n },\n visibleIf: observationsEnabled\n },\n {\n key: 'observations.jitter',\n control: {\n type: 'slider',\n label: 'Jitter',\n default: 30,\n min: 1,\n max: 100,\n step: 1\n },\n visibleIf: observationsEnabled\n },\n {\n key: 'observations.colorType',\n control: {\n type: 'picker',\n label: 'Color mode',\n default: 'single',\n enum: ['single', 'range']\n },\n visibleIf: observationsEnabled\n },\n {\n key: 'observations.color',\n control: {\n type: 'color-picker',\n label: 'Color',\n default: ({ theme }: BoxPlotConfigContext) => theme?.colors?.[1],\n extraLabel: ({ options, theme }: BoxPlotConfigContext) => {\n if (\n theme?.colors?.[1]\n && options.observations?.color\n && options.observations?.color !== theme?.colors?.[1]\n ) {\n return 'reset';\n }\n\n return null;\n },\n extraLabelHasClickAction: ({ options, theme }: BoxPlotConfigContext) => {\n if (theme?.colors?.[1] && options.observations?.color !== theme?.colors?.[1]) {\n return true;\n }\n\n return false;\n },\n extraLabelClickAction: ({ options, theme }: BoxPlotConfigContext) => {\n const newOptions = { ...options };\n\n if (newOptions.observations) {\n newOptions.observations.color = theme?.colors?.[1];\n }\n\n return {\n value: newOptions.observations?.color,\n options: newOptions\n };\n }\n },\n visibleIf: ({ options }: BoxPlotConfigContext) =>\n observationsEnabled({ options }) && options?.observations?.colorType === 'single'\n },\n {\n key: 'observations.colorsType',\n control: {\n type: 'picker',\n label: 'Colors type',\n default: 'divergent',\n // TODO: add manual when being able to retrieve values from the boxplot\n enum: ['sequential', 'divergent' /* , 'manual' */],\n calculateValue: ({ options }: BoxPlotConfigContext) => {\n if (options?.observations?.colorsClass === 'manual') {\n return 'manual';\n }\n\n const colorMaps = getColorMaps();\n const type = colorMaps?.[options?.observations?.colorsClass as ColorsClassKey]?.type;\n\n return type ?? 'divergent';\n },\n toOptions: ({ options, value }: BoxPlotConfigContextWithValue<'manual' | 'sequential' | 'divergent'>) => {\n if (value === 'manual') {\n return {\n ...options,\n observations: {\n ...options.observations,\n // TODO needed to save the type?\n colorsType: 'manual',\n colorsClass: 'manual'\n }\n };\n }\n\n let colorsClass = options.observations?.colorsClass;\n const colorMaps = getColorMaps();\n const colorClassType = colorMaps?.[options?.observations?.colorsClass as ColorsClassKey]?.type;\n\n if (value !== colorClassType) {\n colorsClass = getColorMapKeys(value ?? 'divergent')[0];\n }\n\n return {\n ...options,\n observations: {\n ...options.observations,\n colorsClass,\n colorsType: value\n }\n };\n }\n },\n visibleIf: ({ options }: BoxPlotConfigContext) =>\n observationsEnabled({ options }) && options?.observations?.colorType === 'range'\n },\n /* TODO: need to be able to retrieve values from the boxplot\n {\n key: 'observations.manualValues.ranges',\n control: {\n type: 'color-range',\n editRangeSize: false,\n noValues: true,\n noAlphaChannel: true,\n label: 'Color ranges',\n hideLabel: true,\n default: () => structuredClone(defaultRangeValues)\n },\n visibleIf: ({ options }: BoxPlotConfigContext) =>\n options?.observations?.colorType === 'range' &&\n options?.observations?.colorsClass === 'manual'\n },\n */\n {\n key: 'observations.colorsClass',\n control: {\n type: 'color-palette-picker',\n label: 'Color palette',\n hideLabel: true,\n default: ({ options }: BoxPlotConfigContext) => {\n const colorMaps = getColorMaps();\n const colorClassType = colorMaps?.[options?.observations?.colorsClass as ColorsClassKey]?.type;\n\n return getColorMapKeys(colorClassType ?? 'divergent')[0];\n },\n enum: ({ options }: BoxPlotConfigContext) => {\n const colorMaps = getColorMaps();\n const colorClassType = colorMaps?.[options?.observations?.colorsClass as ColorsClassKey]?.type;\n\n return getColorMapKeys(colorClassType ?? 'divergent');\n }\n },\n visibleIf: ({ options }: BoxPlotConfigContext) =>\n observationsEnabled({ options })\n && options?.observations?.colorType === 'range'\n && options?.observations?.colorsClass !== 'manual'\n }\n ]\n },\n createAxesOptionsGroup<BoxPlotConfigContext>([\n { axis: 'x', role: 'axis', scale: true, color: true, label: true, tickDensity: true, tickMode: true, gridlines: true },\n { axis: 'y', role: 'axis', scale: true, color: true, label: true, tickDensity: true, tickMode: true, gridlines: true }\n ], createManualRangeControls<BoxPlotConfigContext>({\n rangeKey: 'manualAxisRange',\n labels: {\n range: 'Measure axis range',\n minimum: 'Measure axis minimum',\n maximum: 'Measure axis maximum'\n },\n discriminator: { key: 'measureAxisType', default: 'variable' }\n })),\n createInfoTooltipOptionsGroup<BoxPlotConfigContext>()\n];\n\nexport default boxPlotOptionsConfig;\n"],"mappings":";;;;;AAeA,IAAM,KAAuB,EAAE,iBAAoC,GAAS,cAAc,YAAY,IAEhG,IAA4D;CAChE;EACE,KAAK;EACL,MAAM;EACN,MAAM;EACN,UAAU;GACR;IACE,KAAK;IACL,SAAS;KACP,MAAM;KACN,OAAO;KACP,SAAS;IACX;GACF;GACA;IACE,KAAK;IACL,SAAS;KACP,MAAM;KACN,OAAO;KACP,SAAS;KACT,MAAM,CAAC,YAAY,YAAY;KAC/B,aAAa,MAAuC,IAAQ,eAAe;KAC3E,UAAU,MAAqC,MAAU;IAC3D;GACF;GACA;IACE,KAAK;IACL,SAAS;KACP,MAAM;KACN,OAAO;KACP,SAAS;IACX;GACF;EACF;CACF;CACA;EACE,KAAK;EACL,MAAM;EACN,MAAM;EACN,UAAU;GACR;IACE,KAAK;IACL,SAAS;KACP,MAAM;KACN,OAAO;KACP,SAAS;KACT,KAAK;KACL,KAAK;KACL,MAAM;IACR;GACF;GACA;IACE,KAAK;IACL,SAAS;KACP,MAAM;KACN,OAAO;KACP,UAAU,EAAE,eAAkC,EAAkB,CAAK;KACrE,aAAa,EAAE,YAAS,eACtB,EAA4B,GAAS,GAAO,SAAS;KACvD,2BAA2B,EAAE,YAAS,eACpC,EAA0C,GAAS,GAAO,SAAS;KACrE,wBAAwB,EAAE,YAAS,eACjC,EAAuC,GAAS,GAAO,SAAS;IACpE;GACF;GACA;IACE,KAAK;IACL,SAAS;KACP,MAAM;KACN,OAAO;KACP,UAAU,EAAE,eAAkC,GAAO,cAAc,YAAY;KAC/E,KAAK;KACL,KAAK;KACL,MAAM;KACN,aAAa,EAAE,YAAS,eAClB,OAAO,GAAO,cAAc,YAAa,WAIzC,OAAO,GAAS,kBAAmB,WAIhC,UAHE,SAJA;KASX,2BAA2B,EAAE,YAAS,eAChC,OAAO,GAAO,cAAc,YAAa,YAAY,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cAAc,YAA8B,EAAE,SAGxF,IAAc,EAAgB,KAAS,WAAW,CAAC,CAAC,KAG/C;OACL,GAAG;OACH,cAAc;QACZ,GAAG,EAAQ;QACX;QACA,YAAY;OACd;MACF;KACF;IACF;IACA,YAAY,EAAE,iBACZ,EAAoB,EAAE,WAAQ,CAAC,KAAK,GAAS,cAAc,cAAc;GAC7E;GAkBA;IACE,KAAK;IACL,SAAS;KACP,MAAM;KACN,OAAO;KACP,WAAW;KACX,UAAU,EAAE,iBAAoC;MAE9C,IAAM,IADY,EACK,CAAA,GAAY,GAAS,cAAc,YAA8B,EAAE;MAE1F,OAAO,EAAgB,KAAkB,WAAW,CAAC,CAAC;KACxD;KACA,OAAO,EAAE,iBAAoC;MAE3C,IAAM,IADY,EACK,CAAA,GAAY,GAAS,cAAc,YAA8B,EAAE;MAE1F,OAAO,EAAgB,KAAkB,WAAW;KACtD;IACF;IACA,YAAY,EAAE,iBACZ,EAAoB,EAAE,WAAQ,CAAC,KAC5B,GAAS,cAAc,cAAc,WACrC,GAAS,cAAc,gBAAgB;GAC9C;EACF;CACF;CACA,EAA6C,CAC3C;EAAE,MAAM;EAAK,MAAM;EAAQ,OAAO;EAAM,OAAO;EAAM,OAAO;EAAM,aAAa;EAAM,UAAU;EAAM,WAAW;CAAK,GACrH;EAAE,MAAM;EAAK,MAAM;EAAQ,OAAO;EAAM,OAAO;EAAM,OAAO;EAAM,aAAa;EAAM,UAAU;EAAM,WAAW;CAAK,CACvH,GAAG,EAAgD;EACjD,UAAU;EACV,QAAQ;GACN,OAAO;GACP,SAAS;GACT,SAAS;EACX;EACA,eAAe;GAAE,KAAK;GAAmB,SAAS;EAAW;CAC/D,CAAC,CAAC;CACF,EAAoD;AACtD"}
|
|
1
|
+
{"version":3,"file":"box-plot-options.config.js","names":[],"sources":["../../../../libs/dashboard-contents-types/src/lib/box-plot/box-plot-options.config.ts"],"sourcesContent":["import { type ColorsClassKey, getColorMapKeys, getColorMaps } from '../shared/utils/color/color-palettes';\nimport {\n getThemeMainColor,\n getThemeMainColorExtraLabelClickAction,\n getThemeMainColorExtraLabelHasClickAction,\n getThemeMainColorResetLabel\n} from '../helpers';\nimport { createAxesOptionsGroup, createManualRangeControls } from '../shared/utils/axis-options.config';\nimport { createInfoTooltipOptionsGroup } from '../shared/utils/info-tooltip-options.config';\nimport { createInteractivityOptionsGroup } from '../shared/utils/interactivity-options.config';\nimport type { OptionsConfig, OptionsConfigContext } from '../shared/utils/options-config.types';\nimport type { BoxPlotViewOptions } from './box-plot-options';\n\ntype BoxPlotConfigContext = OptionsConfigContext<BoxPlotViewOptions>;\ntype BoxPlotConfigContextWithValue<T> = BoxPlotConfigContext & { value: T };\n\nconst observationsEnabled = ({ options }: BoxPlotConfigContext) => options?.observations?.display === true;\n\nconst boxPlotOptionsConfig: OptionsConfig<BoxPlotConfigContext> = [\n {\n key: 'general',\n type: 'group',\n open: true,\n children: [\n {\n key: 'display.title',\n control: {\n type: 'switch',\n label: 'Title',\n default: true\n }\n },\n {\n key: 'horizontal',\n control: {\n type: 'picker',\n label: 'Display',\n default: 'vertical',\n enum: ['vertical', 'horizontal'],\n parseValue: (value: boolean | null | undefined) => (value ? 'horizontal' : 'vertical'),\n toValue: (value: 'horizontal' | 'vertical') => value === 'horizontal'\n }\n },\n {\n key: 'extentTicks',\n control: {\n type: 'switch',\n label: 'Extent ticks',\n default: true\n }\n }\n ]\n },\n {\n key: 'box',\n type: 'group',\n open: true,\n children: [\n {\n key: 'boxWidth',\n control: {\n type: 'slider',\n label: 'Box width',\n default: 0.9,\n min: 0.1,\n max: 1,\n step: 0.1\n }\n },\n {\n key: 'boxFill',\n control: {\n type: 'color-picker',\n label: 'Box fill',\n default: ({ theme }: BoxPlotConfigContext) => getThemeMainColor(theme),\n extraLabel: ({ options, theme }: BoxPlotConfigContext) =>\n getThemeMainColorResetLabel(options, theme, 'boxFill'),\n extraLabelHasClickAction: ({ options, theme }: BoxPlotConfigContext) =>\n getThemeMainColorExtraLabelHasClickAction(options, theme, 'boxFill'),\n extraLabelClickAction: ({ options, theme }: BoxPlotConfigContext) =>\n getThemeMainColorExtraLabelClickAction(options, theme, 'boxFill')\n }\n },\n {\n key: 'roundedCorners',\n control: {\n type: 'slider',\n label: 'Rounded corners',\n default: ({ theme }: BoxPlotConfigContext) => theme?.itemSpecific?.rounding ?? 8,\n min: 0,\n max: 24,\n step: 1,\n extraLabel: ({ options, theme }: BoxPlotConfigContext) => {\n if (typeof theme?.itemSpecific?.rounding !== 'number') {\n return null;\n }\n\n if (typeof options?.roundedCorners !== 'number') {\n return 'auto';\n }\n\n return 'reset';\n },\n extraLabelHasClickAction: ({ options, theme }: BoxPlotConfigContext) => {\n if (typeof theme?.itemSpecific?.rounding !== 'number' || typeof options?.roundedCorners !== 'number') {\n return false;\n }\n\n return true;\n },\n extraLabelClickAction: ({ options }: BoxPlotConfigContext) => {\n const newOptions = { ...options };\n\n if (newOptions?.roundedCorners !== undefined) {\n delete newOptions.roundedCorners;\n }\n\n return { value: null, options: newOptions };\n }\n }\n },\n {\n key: 'boxStrokeWidth',\n control: {\n type: 'slider',\n label: 'Box stroke width',\n default: 1,\n min: 0,\n max: 5,\n step: 0.5\n }\n },\n {\n key: 'boxStrokeColor',\n control: {\n type: 'color-picker',\n label: 'Box stroke color',\n default: ({ theme }: BoxPlotConfigContext) => getThemeMainColor(theme),\n extraLabel: ({ options, theme }: BoxPlotConfigContext) =>\n getThemeMainColorResetLabel(options, theme, 'boxStrokeColor'),\n extraLabelHasClickAction: ({ options, theme }: BoxPlotConfigContext) =>\n getThemeMainColorExtraLabelHasClickAction(options, theme, 'boxStrokeColor'),\n extraLabelClickAction: ({ options, theme }: BoxPlotConfigContext) =>\n getThemeMainColorExtraLabelClickAction(options, theme, 'boxStrokeColor')\n }\n },\n {\n key: 'medianStrokeWidth',\n control: {\n type: 'slider',\n label: 'Median stroke width',\n default: 2,\n min: 0,\n max: 5,\n step: 0.5\n }\n },\n {\n key: 'medianStrokeColor',\n control: {\n type: 'color-picker',\n label: 'Median stroke color',\n default: '#000000'\n }\n }\n ]\n },\n {\n key: 'observations',\n type: 'group',\n open: true,\n children: [\n {\n key: 'observations.display',\n control: {\n type: 'switch',\n label: 'Show',\n default: false\n }\n },\n {\n key: 'observations.onlyOutliers',\n control: {\n type: 'switch',\n label: 'Only outliers',\n default: false\n },\n visibleIf: observationsEnabled\n },\n {\n key: 'observations.type',\n control: {\n type: 'picker',\n label: 'Type',\n default: 'dot',\n enum: ['dot', 'ticks']\n },\n visibleIf: observationsEnabled\n },\n {\n key: 'observations.size',\n control: {\n type: 'slider',\n label: 'Size',\n default: 3,\n min: 1,\n max: 10,\n step: 1\n },\n visibleIf: observationsEnabled\n },\n {\n key: 'observations.opacity',\n control: {\n type: 'slider',\n label: 'Opacity',\n default: 0.4,\n min: 0.1,\n max: 1,\n step: 0.1\n },\n visibleIf: observationsEnabled\n },\n {\n key: 'observations.jitter',\n control: {\n type: 'slider',\n label: 'Jitter',\n default: 30,\n min: 1,\n max: 100,\n step: 1\n },\n visibleIf: observationsEnabled\n },\n {\n key: 'observations.colorType',\n control: {\n type: 'picker',\n label: 'Color mode',\n default: 'single',\n enum: ['single', 'range']\n },\n visibleIf: observationsEnabled\n },\n {\n key: 'observations.color',\n control: {\n type: 'color-picker',\n label: 'Color',\n default: ({ theme }: BoxPlotConfigContext) => theme?.colors?.[1],\n extraLabel: ({ options, theme }: BoxPlotConfigContext) => {\n if (\n theme?.colors?.[1]\n && options.observations?.color\n && options.observations?.color !== theme?.colors?.[1]\n ) {\n return 'reset';\n }\n\n return null;\n },\n extraLabelHasClickAction: ({ options, theme }: BoxPlotConfigContext) => {\n if (theme?.colors?.[1] && options.observations?.color !== theme?.colors?.[1]) {\n return true;\n }\n\n return false;\n },\n extraLabelClickAction: ({ options, theme }: BoxPlotConfigContext) => {\n const newOptions = { ...options };\n\n if (newOptions.observations) {\n newOptions.observations.color = theme?.colors?.[1];\n }\n\n return {\n value: newOptions.observations?.color,\n options: newOptions\n };\n }\n },\n visibleIf: ({ options }: BoxPlotConfigContext) =>\n observationsEnabled({ options }) && options?.observations?.colorType === 'single'\n },\n {\n key: 'observations.colorsType',\n control: {\n type: 'picker',\n label: 'Colors type',\n default: 'divergent',\n // TODO: add manual when being able to retrieve values from the boxplot\n enum: ['sequential', 'divergent' /* , 'manual' */],\n calculateValue: ({ options }: BoxPlotConfigContext) => {\n if (options?.observations?.colorsClass === 'manual') {\n return 'manual';\n }\n\n const colorMaps = getColorMaps();\n const type = colorMaps?.[options?.observations?.colorsClass as ColorsClassKey]?.type;\n\n return type ?? 'divergent';\n },\n toOptions: ({ options, value }: BoxPlotConfigContextWithValue<'manual' | 'sequential' | 'divergent'>) => {\n if (value === 'manual') {\n return {\n ...options,\n observations: {\n ...options.observations,\n // TODO needed to save the type?\n colorsType: 'manual',\n colorsClass: 'manual'\n }\n };\n }\n\n let colorsClass = options.observations?.colorsClass;\n const colorMaps = getColorMaps();\n const colorClassType = colorMaps?.[options?.observations?.colorsClass as ColorsClassKey]?.type;\n\n if (value !== colorClassType) {\n colorsClass = getColorMapKeys(value ?? 'divergent')[0];\n }\n\n return {\n ...options,\n observations: {\n ...options.observations,\n colorsClass,\n colorsType: value\n }\n };\n }\n },\n visibleIf: ({ options }: BoxPlotConfigContext) =>\n observationsEnabled({ options }) && options?.observations?.colorType === 'range'\n },\n /* TODO: need to be able to retrieve values from the boxplot\n {\n key: 'observations.manualValues.ranges',\n control: {\n type: 'color-range',\n editRangeSize: false,\n noValues: true,\n noAlphaChannel: true,\n label: 'Color ranges',\n hideLabel: true,\n default: () => structuredClone(defaultRangeValues)\n },\n visibleIf: ({ options }: BoxPlotConfigContext) =>\n options?.observations?.colorType === 'range' &&\n options?.observations?.colorsClass === 'manual'\n },\n */\n {\n key: 'observations.colorsClass',\n control: {\n type: 'color-palette-picker',\n label: 'Color palette',\n hideLabel: true,\n default: ({ options }: BoxPlotConfigContext) => {\n const colorMaps = getColorMaps();\n const colorClassType = colorMaps?.[options?.observations?.colorsClass as ColorsClassKey]?.type;\n\n return getColorMapKeys(colorClassType ?? 'divergent')[0];\n },\n enum: ({ options }: BoxPlotConfigContext) => {\n const colorMaps = getColorMaps();\n const colorClassType = colorMaps?.[options?.observations?.colorsClass as ColorsClassKey]?.type;\n\n return getColorMapKeys(colorClassType ?? 'divergent');\n }\n },\n visibleIf: ({ options }: BoxPlotConfigContext) =>\n observationsEnabled({ options })\n && options?.observations?.colorType === 'range'\n && options?.observations?.colorsClass !== 'manual'\n }\n ]\n },\n createAxesOptionsGroup<BoxPlotConfigContext>([\n { axis: 'x', role: 'axis', scale: true, color: true, label: true, tickDensity: true, tickMode: true, gridlines: true },\n { axis: 'y', role: 'axis', scale: true, color: true, label: true, tickDensity: true, tickMode: true, gridlines: true }\n ], createManualRangeControls<BoxPlotConfigContext>({\n rangeKey: 'manualAxisRange',\n labels: {\n range: 'Measure axis range',\n minimum: 'Measure axis minimum',\n maximum: 'Measure axis maximum'\n },\n discriminator: { key: 'measureAxisType', default: 'variable' }\n })),\n createInfoTooltipOptionsGroup<BoxPlotConfigContext>(),\n createInteractivityOptionsGroup<BoxPlotConfigContext>({ brush: { default: false, excludesClickActions: true } })\n];\n\nexport default boxPlotOptionsConfig;\n"],"mappings":";;;;;;AAgBA,IAAM,KAAuB,EAAE,iBAAoC,GAAS,cAAc,YAAY,IAEhG,IAA4D;CAChE;EACE,KAAK;EACL,MAAM;EACN,MAAM;EACN,UAAU;GACR;IACE,KAAK;IACL,SAAS;KACP,MAAM;KACN,OAAO;KACP,SAAS;IACX;GACF;GACA;IACE,KAAK;IACL,SAAS;KACP,MAAM;KACN,OAAO;KACP,SAAS;KACT,MAAM,CAAC,YAAY,YAAY;KAC/B,aAAa,MAAuC,IAAQ,eAAe;KAC3E,UAAU,MAAqC,MAAU;IAC3D;GACF;GACA;IACE,KAAK;IACL,SAAS;KACP,MAAM;KACN,OAAO;KACP,SAAS;IACX;GACF;EACF;CACF;CACA;EACE,KAAK;EACL,MAAM;EACN,MAAM;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E;GACF;GACA;IACE,KAAK;IACL,SAAS;KACP,MAAM;KACN,OAAO;KACP,SAAS;KACT,KAAK;KACL,KAAK;KACL,MAAM;IACR;GACF;GACA;IACE,KAAK;IACL,SAAS;KACP,MAAM;KACN,OAAO;KACP,SAAS;IACX;GACF;EACF;CACF;CACA;EACE,KAAK;EACL,MAAM;EACN,MAAM;EACN,UAAU;GACR;IACE,KAAK;IACL,SAAS;KACP,MAAM;KACN,OAAO;KACP,SAAS;IACX;GACF;GACA;IACE,KAAK;IACL,SAAS;KACP,MAAM;KACN,OAAO;KACP,SAAS;IACX;IACA,WAAW;GACb;GACA;IACE,KAAK;IACL,SAAS;KACP,MAAM;KACN,OAAO;KACP,SAAS;KACT,MAAM,CAAC,OAAO,OAAO;IACvB;IACA,WAAW;GACb;GACA;IACE,KAAK;IACL,SAAS;KACP,MAAM;KACN,OAAO;KACP,SAAS;KACT,KAAK;KACL,KAAK;KACL,MAAM;IACR;IACA,WAAW;GACb;GACA;IACE,KAAK;IACL,SAAS;KACP,MAAM;KACN,OAAO;KACP,SAAS;KACT,KAAK;KACL,KAAK;KACL,MAAM;IACR;IACA,WAAW;GACb;GACA;IACE,KAAK;IACL,SAAS;KACP,MAAM;KACN,OAAO;KACP,SAAS;KACT,KAAK;KACL,KAAK;KACL,MAAM;IACR;IACA,WAAW;GACb;GACA;IACE,KAAK;IACL,SAAS;KACP,MAAM;KACN,OAAO;KACP,SAAS;KACT,MAAM,CAAC,UAAU,OAAO;IAC1B;IACA,WAAW;GACb;GACA;IACE,KAAK;IACL,SAAS;KACP,MAAM;KACN,OAAO;KACP,UAAU,EAAE,eAAkC,GAAO,SAAS;KAC9D,aAAa,EAAE,YAAS,eAEpB,GAAO,SAAS,MACb,EAAQ,cAAc,SACtB,EAAQ,cAAc,UAAU,GAAO,SAAS,KAE5C,UAGF;KAET,2BAA2B,EAAE,YAAS,eACpC,GAAI,GAAO,SAAS,MAAM,EAAQ,cAAc,UAAU,GAAO,SAAS;KAM5E,wB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,EAAE,iBACZ,EAAoB,EAAE,WAAQ,CAAC,KAC5B,GAAS,cAAc,cAAc,WACrC,GAAS,cAAc,gBAAgB;GAC9C;EACF;CACF;CACA,EAA6C,CAC3C;EAAE,MAAM;EAAK,MAAM;EAAQ,OAAO;EAAM,OAAO;EAAM,OAAO;EAAM,aAAa;EAAM,UAAU;EAAM,WAAW;CAAK,GACrH;EAAE,MAAM;EAAK,MAAM;EAAQ,OAAO;EAAM,OAAO;EAAM,OAAO;EAAM,aAAa;EAAM,UAAU;EAAM,WAAW;CAAK,CACvH,GAAG,EAAgD;EACjD,UAAU;EACV,QAAQ;GACN,OAAO;GACP,SAAS;GACT,SAAS;EACX;EACA,eAAe;GAAE,KAAK;GAAmB,SAAS;EAAW;CAC/D,CAAC,CAAC;CACF,EAAoD;CACpD,EAAsD,EAAE,OAAO;EAAE,SAAS;EAAO,sBAAsB;CAAK,EAAE,CAAC;AACjH"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("../helpers.cjs"),t=require("../shared/utils/info-tooltip-options.config.cjs");var
|
|
1
|
+
const e=require("../helpers.cjs"),t=require("../shared/utils/info-tooltip-options.config.cjs"),n=require("../shared/utils/interactivity-options.config.cjs");var r=({slots:e})=>Array.isArray(e)&&e?.length>0?(e?.find(e=>e?.name===`color`)?.content?.length??0)>0:!1,i=({slots:e})=>Array.isArray(e)&&e?.length>0?!((e?.find(e=>e?.name===`color`)?.content?.length??0)>0):!0,a=[{key:`general`,type:`group`,open:!0,children:[{key:`display.title`,control:{type:`switch`,label:`Title`,default:!0}},{key:`display.legend`,control:{type:`switch`,label:`Legend`,default:!0},visibleIf:r},{key:`display.bubbleLabels`,control:{type:`switch`,label:`Show labels`,tooltip:`If enough room available`,default:!0}},{key:`display.bubbleValues`,control:{type:`picker`,label:`Show values`,tooltip:`If enough room available`,default:`none`,enum:[`none`,`percentage`,`absolute`]}},{key:`categories.colored`,control:{type:`switch`,label:`Bubble color by category`,default:!0},visibleIf:i},{key:`color`,control:{type:`color-picker`,label:`Bubble color`,default:({theme:t})=>e.getThemeMainColor(t),extraLabel:({options:t,theme:n})=>e.getThemeMainColorResetLabel(t,n,`color`),extraLabelHasClickAction:({options:t,theme:n})=>e.getThemeMainColorExtraLabelHasClickAction(t,n,`color`),extraLabelClickAction:({options:t,theme:n})=>e.getThemeMainColorExtraLabelClickAction(t,n,`color`)},visibleIf:({options:e,slots:t})=>e?.categories?.colored===!1&&i({slots:t})}]},{key:`legend`,type:`group`,open:!1,children:[{key:`legend.position`,control:{label:`Position`,type:`position-picker`,default:`topRight`,enum:[`topLeft`,`top`,`topRight`,`right`,`bottomRight`,`bottom`,`bottomLeft`,`left`]}},{key:`legend.customOrder`,control:{label:`Custom order`,description:`Drag items in the chart legend to set the order.`,type:`switch`,default:!1}},{key:`interactivity.legendReorder`,control:{label:`Allow viewers to reorder`,type:`switch`,default:!1},visibleIf:({options:e})=>e?.legend?.customOrder===!0}],visibleIf:r},t.createInfoTooltipOptionsGroup(),n.createInteractivityOptionsGroup({select:{default:!0}})];exports.default=a;
|
|
2
2
|
//# sourceMappingURL=bubble-chart-options.config.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bubble-chart-options.config.cjs","names":[],"sources":["../../../../libs/dashboard-contents-types/src/lib/bubble-chart/bubble-chart-options.config.ts"],"sourcesContent":["import {\n getThemeMainColor,\n getThemeMainColorExtraLabelClickAction,\n getThemeMainColorExtraLabelHasClickAction,\n getThemeMainColorResetLabel\n} from '../helpers';\nimport { createInfoTooltipOptionsGroup } from '../shared/utils/info-tooltip-options.config';\nimport type { OptionsConfig, OptionsConfigContext } from '../shared/utils/options-config.types';\nimport type { BubbleChartViewOptions } from './bubble-chart-options';\n\ntype BubbleChartConfigContext = OptionsConfigContext<BubbleChartViewOptions>;\n\nconst hasLegend = ({ slots }: Pick<BubbleChartConfigContext, 'slots'>) => {\n if (Array.isArray(slots) && slots?.length > 0) {\n return (slots?.find((s) => s?.name === 'color')?.content?.length ?? 0) > 0;\n }\n\n return false;\n};\n\nconst hasNoLegend = ({ slots }: Pick<BubbleChartConfigContext, 'slots'>) => {\n if (Array.isArray(slots) && slots?.length > 0) {\n return !((slots?.find((s) => s?.name === 'color')?.content?.length ?? 0) > 0);\n }\n\n return true;\n};\n\nconst bubbleChartOptionsConfig: OptionsConfig<BubbleChartConfigContext> = [\n {\n key: 'general',\n type: 'group',\n open: true,\n children: [\n {\n key: 'display.title',\n control: {\n type: 'switch',\n label: 'Title',\n default: true\n }\n },\n {\n key: 'display.legend',\n control: {\n type: 'switch',\n label: 'Legend',\n default: true\n },\n visibleIf: hasLegend\n },\n {\n key: 'display.bubbleLabels',\n control: {\n type: 'switch',\n label: 'Show labels',\n tooltip: 'If enough room available',\n default: true\n }\n },\n {\n key: 'display.bubbleValues',\n control: {\n type: 'picker',\n label: 'Show values',\n tooltip: 'If enough room available',\n default: 'none',\n enum: ['none', 'percentage', 'absolute']\n }\n },\n {\n key: 'categories.colored',\n control: {\n type: 'switch',\n label: 'Bubble color by category',\n default: true\n },\n visibleIf: hasNoLegend\n },\n {\n key: 'color',\n control: {\n type: 'color-picker',\n label: 'Bubble color',\n default: ({ theme }: BubbleChartConfigContext) => getThemeMainColor(theme),\n extraLabel: ({ options, theme }: BubbleChartConfigContext) => getThemeMainColorResetLabel(options, theme, 'color'),\n extraLabelHasClickAction: ({ options, theme }: BubbleChartConfigContext) =>\n getThemeMainColorExtraLabelHasClickAction(options, theme, 'color'),\n extraLabelClickAction: ({ options, theme }: BubbleChartConfigContext) =>\n getThemeMainColorExtraLabelClickAction(options, theme, 'color')\n },\n visibleIf: ({ options, slots }: BubbleChartConfigContext) => options?.categories?.colored === false && hasNoLegend({ slots })\n }\n ]\n },\n {\n key: 'legend',\n type: 'group',\n open: false,\n children: [\n {\n key: 'legend.position',\n control: {\n label: 'Position',\n type: 'position-picker',\n default: 'topRight',\n enum: ['topLeft', 'top', 'topRight', 'right', 'bottomRight', 'bottom', 'bottomLeft', 'left']\n }\n },\n {\n key: 'legend.customOrder',\n control: {\n label: 'Custom order',\n description: 'Drag items in the chart legend to set the order.',\n type: 'switch',\n default: false\n }\n },\n {\n key: 'interactivity.legendReorder',\n control: {\n label: 'Allow viewers to reorder',\n type: 'switch',\n default: false\n },\n visibleIf: ({ options }: BubbleChartConfigContext) => options?.legend?.customOrder === true\n }\n ],\n visibleIf: hasLegend\n },\n createInfoTooltipOptionsGroup<BubbleChartConfigContext>()\n];\n\nexport default bubbleChartOptionsConfig;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"bubble-chart-options.config.cjs","names":[],"sources":["../../../../libs/dashboard-contents-types/src/lib/bubble-chart/bubble-chart-options.config.ts"],"sourcesContent":["import {\n getThemeMainColor,\n getThemeMainColorExtraLabelClickAction,\n getThemeMainColorExtraLabelHasClickAction,\n getThemeMainColorResetLabel\n} from '../helpers';\nimport { createInfoTooltipOptionsGroup } from '../shared/utils/info-tooltip-options.config';\nimport { createInteractivityOptionsGroup } from '../shared/utils/interactivity-options.config';\nimport type { OptionsConfig, OptionsConfigContext } from '../shared/utils/options-config.types';\nimport type { BubbleChartViewOptions } from './bubble-chart-options';\n\ntype BubbleChartConfigContext = OptionsConfigContext<BubbleChartViewOptions>;\n\nconst hasLegend = ({ slots }: Pick<BubbleChartConfigContext, 'slots'>) => {\n if (Array.isArray(slots) && slots?.length > 0) {\n return (slots?.find((s) => s?.name === 'color')?.content?.length ?? 0) > 0;\n }\n\n return false;\n};\n\nconst hasNoLegend = ({ slots }: Pick<BubbleChartConfigContext, 'slots'>) => {\n if (Array.isArray(slots) && slots?.length > 0) {\n return !((slots?.find((s) => s?.name === 'color')?.content?.length ?? 0) > 0);\n }\n\n return true;\n};\n\nconst bubbleChartOptionsConfig: OptionsConfig<BubbleChartConfigContext> = [\n {\n key: 'general',\n type: 'group',\n open: true,\n children: [\n {\n key: 'display.title',\n control: {\n type: 'switch',\n label: 'Title',\n default: true\n }\n },\n {\n key: 'display.legend',\n control: {\n type: 'switch',\n label: 'Legend',\n default: true\n },\n visibleIf: hasLegend\n },\n {\n key: 'display.bubbleLabels',\n control: {\n type: 'switch',\n label: 'Show labels',\n tooltip: 'If enough room available',\n default: true\n }\n },\n {\n key: 'display.bubbleValues',\n control: {\n type: 'picker',\n label: 'Show values',\n tooltip: 'If enough room available',\n default: 'none',\n enum: ['none', 'percentage', 'absolute']\n }\n },\n {\n key: 'categories.colored',\n control: {\n type: 'switch',\n label: 'Bubble color by category',\n default: true\n },\n visibleIf: hasNoLegend\n },\n {\n key: 'color',\n control: {\n type: 'color-picker',\n label: 'Bubble color',\n default: ({ theme }: BubbleChartConfigContext) => getThemeMainColor(theme),\n extraLabel: ({ options, theme }: BubbleChartConfigContext) => getThemeMainColorResetLabel(options, theme, 'color'),\n extraLabelHasClickAction: ({ options, theme }: BubbleChartConfigContext) =>\n getThemeMainColorExtraLabelHasClickAction(options, theme, 'color'),\n extraLabelClickAction: ({ options, theme }: BubbleChartConfigContext) =>\n getThemeMainColorExtraLabelClickAction(options, theme, 'color')\n },\n visibleIf: ({ options, slots }: BubbleChartConfigContext) => options?.categories?.colored === false && hasNoLegend({ slots })\n }\n ]\n },\n {\n key: 'legend',\n type: 'group',\n open: false,\n children: [\n {\n key: 'legend.position',\n control: {\n label: 'Position',\n type: 'position-picker',\n default: 'topRight',\n enum: ['topLeft', 'top', 'topRight', 'right', 'bottomRight', 'bottom', 'bottomLeft', 'left']\n }\n },\n {\n key: 'legend.customOrder',\n control: {\n label: 'Custom order',\n description: 'Drag items in the chart legend to set the order.',\n type: 'switch',\n default: false\n }\n },\n {\n key: 'interactivity.legendReorder',\n control: {\n label: 'Allow viewers to reorder',\n type: 'switch',\n default: false\n },\n visibleIf: ({ options }: BubbleChartConfigContext) => options?.legend?.customOrder === true\n }\n ],\n visibleIf: hasLegend\n },\n createInfoTooltipOptionsGroup<BubbleChartConfigContext>(),\n createInteractivityOptionsGroup<BubbleChartConfigContext>({ select: { default: true } })\n];\n\nexport default bubbleChartOpt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,GACN,SAAU,CACR,CACE,IAAK,kBACL,QAAS,CACP,MAAO,WACP,KAAM,kBACN,QAAS,WACT,KAAM,CAAC,UAAW,MAAO,WAAY,QAAS,cAAe,SAAU,aAAc,MAAM,CAC7F,CACF,EACA,CACE,IAAK,qBACL,QAAS,CACP,MAAO,eACP,YAAa,mDACb,KAAM,SACN,QAAS,EACX,CACF,EACA,CACE,IAAK,8BACL,QAAS,CACP,MAAO,2BACP,KAAM,SACN,QAAS,EACX,EACA,WAAY,CAAE,aAAwC,GAAS,QAAQ,cAAgB,EACzF,CACF,EACA,UAAW,CACb,EACA,EAAA,8BAAwD,EACxD,EAAA,gCAA0D,CAAE,OAAQ,CAAE,QAAS,EAAK,CAAE,CAAC,CACzF"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { getThemeMainColor as e, getThemeMainColorExtraLabelClickAction as t, getThemeMainColorExtraLabelHasClickAction as n, getThemeMainColorResetLabel as r } from "../helpers.js";
|
|
2
2
|
import { createInfoTooltipOptionsGroup as i } from "../shared/utils/info-tooltip-options.config.js";
|
|
3
|
+
import { createInteractivityOptionsGroup as a } from "../shared/utils/interactivity-options.config.js";
|
|
3
4
|
//#region src/lib/bubble-chart/bubble-chart-options.config.ts
|
|
4
|
-
var
|
|
5
|
+
var o = ({ slots: e }) => Array.isArray(e) && e?.length > 0 ? (e?.find((e) => e?.name === "color")?.content?.length ?? 0) > 0 : !1, s = ({ slots: e }) => Array.isArray(e) && e?.length > 0 ? !((e?.find((e) => e?.name === "color")?.content?.length ?? 0) > 0) : !0, c = [
|
|
5
6
|
{
|
|
6
7
|
key: "general",
|
|
7
8
|
type: "group",
|
|
@@ -22,7 +23,7 @@ var a = ({ slots: e }) => Array.isArray(e) && e?.length > 0 ? (e?.find((e) => e?
|
|
|
22
23
|
label: "Legend",
|
|
23
24
|
default: !0
|
|
24
25
|
},
|
|
25
|
-
visibleIf:
|
|
26
|
+
visibleIf: o
|
|
26
27
|
},
|
|
27
28
|
{
|
|
28
29
|
key: "display.bubbleLabels",
|
|
@@ -54,7 +55,7 @@ var a = ({ slots: e }) => Array.isArray(e) && e?.length > 0 ? (e?.find((e) => e?
|
|
|
54
55
|
label: "Bubble color by category",
|
|
55
56
|
default: !0
|
|
56
57
|
},
|
|
57
|
-
visibleIf:
|
|
58
|
+
visibleIf: s
|
|
58
59
|
},
|
|
59
60
|
{
|
|
60
61
|
key: "color",
|
|
@@ -66,7 +67,7 @@ var a = ({ slots: e }) => Array.isArray(e) && e?.length > 0 ? (e?.find((e) => e?
|
|
|
66
67
|
extraLabelHasClickAction: ({ options: e, theme: t }) => n(e, t, "color"),
|
|
67
68
|
extraLabelClickAction: ({ options: e, theme: n }) => t(e, n, "color")
|
|
68
69
|
},
|
|
69
|
-
visibleIf: ({ options: e, slots: t }) => e?.categories?.colored === !1 &&
|
|
70
|
+
visibleIf: ({ options: e, slots: t }) => e?.categories?.colored === !1 && s({ slots: t })
|
|
70
71
|
}
|
|
71
72
|
]
|
|
72
73
|
},
|
|
@@ -112,11 +113,12 @@ var a = ({ slots: e }) => Array.isArray(e) && e?.length > 0 ? (e?.find((e) => e?
|
|
|
112
113
|
visibleIf: ({ options: e }) => e?.legend?.customOrder === !0
|
|
113
114
|
}
|
|
114
115
|
],
|
|
115
|
-
visibleIf:
|
|
116
|
+
visibleIf: o
|
|
116
117
|
},
|
|
117
|
-
i()
|
|
118
|
+
i(),
|
|
119
|
+
a({ select: { default: !0 } })
|
|
118
120
|
];
|
|
119
121
|
//#endregion
|
|
120
|
-
export {
|
|
122
|
+
export { c as default };
|
|
121
123
|
|
|
122
124
|
//# sourceMappingURL=bubble-chart-options.config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bubble-chart-options.config.js","names":[],"sources":["../../../../libs/dashboard-contents-types/src/lib/bubble-chart/bubble-chart-options.config.ts"],"sourcesContent":["import {\n getThemeMainColor,\n getThemeMainColorExtraLabelClickAction,\n getThemeMainColorExtraLabelHasClickAction,\n getThemeMainColorResetLabel\n} from '../helpers';\nimport { createInfoTooltipOptionsGroup } from '../shared/utils/info-tooltip-options.config';\nimport type { OptionsConfig, OptionsConfigContext } from '../shared/utils/options-config.types';\nimport type { BubbleChartViewOptions } from './bubble-chart-options';\n\ntype BubbleChartConfigContext = OptionsConfigContext<BubbleChartViewOptions>;\n\nconst hasLegend = ({ slots }: Pick<BubbleChartConfigContext, 'slots'>) => {\n if (Array.isArray(slots) && slots?.length > 0) {\n return (slots?.find((s) => s?.name === 'color')?.content?.length ?? 0) > 0;\n }\n\n return false;\n};\n\nconst hasNoLegend = ({ slots }: Pick<BubbleChartConfigContext, 'slots'>) => {\n if (Array.isArray(slots) && slots?.length > 0) {\n return !((slots?.find((s) => s?.name === 'color')?.content?.length ?? 0) > 0);\n }\n\n return true;\n};\n\nconst bubbleChartOptionsConfig: OptionsConfig<BubbleChartConfigContext> = [\n {\n key: 'general',\n type: 'group',\n open: true,\n children: [\n {\n key: 'display.title',\n control: {\n type: 'switch',\n label: 'Title',\n default: true\n }\n },\n {\n key: 'display.legend',\n control: {\n type: 'switch',\n label: 'Legend',\n default: true\n },\n visibleIf: hasLegend\n },\n {\n key: 'display.bubbleLabels',\n control: {\n type: 'switch',\n label: 'Show labels',\n tooltip: 'If enough room available',\n default: true\n }\n },\n {\n key: 'display.bubbleValues',\n control: {\n type: 'picker',\n label: 'Show values',\n tooltip: 'If enough room available',\n default: 'none',\n enum: ['none', 'percentage', 'absolute']\n }\n },\n {\n key: 'categories.colored',\n control: {\n type: 'switch',\n label: 'Bubble color by category',\n default: true\n },\n visibleIf: hasNoLegend\n },\n {\n key: 'color',\n control: {\n type: 'color-picker',\n label: 'Bubble color',\n default: ({ theme }: BubbleChartConfigContext) => getThemeMainColor(theme),\n extraLabel: ({ options, theme }: BubbleChartConfigContext) => getThemeMainColorResetLabel(options, theme, 'color'),\n extraLabelHasClickAction: ({ options, theme }: BubbleChartConfigContext) =>\n getThemeMainColorExtraLabelHasClickAction(options, theme, 'color'),\n extraLabelClickAction: ({ options, theme }: BubbleChartConfigContext) =>\n getThemeMainColorExtraLabelClickAction(options, theme, 'color')\n },\n visibleIf: ({ options, slots }: BubbleChartConfigContext) => options?.categories?.colored === false && hasNoLegend({ slots })\n }\n ]\n },\n {\n key: 'legend',\n type: 'group',\n open: false,\n children: [\n {\n key: 'legend.position',\n control: {\n label: 'Position',\n type: 'position-picker',\n default: 'topRight',\n enum: ['topLeft', 'top', 'topRight', 'right', 'bottomRight', 'bottom', 'bottomLeft', 'left']\n }\n },\n {\n key: 'legend.customOrder',\n control: {\n label: 'Custom order',\n description: 'Drag items in the chart legend to set the order.',\n type: 'switch',\n default: false\n }\n },\n {\n key: 'interactivity.legendReorder',\n control: {\n label: 'Allow viewers to reorder',\n type: 'switch',\n default: false\n },\n visibleIf: ({ options }: BubbleChartConfigContext) => options?.legend?.customOrder === true\n }\n ],\n visibleIf: hasLegend\n },\n createInfoTooltipOptionsGroup<BubbleChartConfigContext>()\n];\n\nexport default bubbleChartOptionsConfig;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"bubble-chart-options.config.js","names":[],"sources":["../../../../libs/dashboard-contents-types/src/lib/bubble-chart/bubble-chart-options.config.ts"],"sourcesContent":["import {\n getThemeMainColor,\n getThemeMainColorExtraLabelClickAction,\n getThemeMainColorExtraLabelHasClickAction,\n getThemeMainColorResetLabel\n} from '../helpers';\nimport { createInfoTooltipOptionsGroup } from '../shared/utils/info-tooltip-options.config';\nimport { createInteractivityOptionsGroup } from '../shared/utils/interactivity-options.config';\nimport type { OptionsConfig, OptionsConfigContext } from '../shared/utils/options-config.types';\nimport type { BubbleChartViewOptions } from './bubble-chart-options';\n\ntype BubbleChartConfigContext = OptionsConfigContext<BubbleChartViewOptions>;\n\nconst hasLegend = ({ slots }: Pick<BubbleChartConfigContext, 'slots'>) => {\n if (Array.isArray(slots) && slots?.length > 0) {\n return (slots?.find((s) => s?.name === 'color')?.content?.length ?? 0) > 0;\n }\n\n return false;\n};\n\nconst hasNoLegend = ({ slots }: Pick<BubbleChartConfigContext, 'slots'>) => {\n if (Array.isArray(slots) && slots?.length > 0) {\n return !((slots?.find((s) => s?.name === 'color')?.content?.length ?? 0) > 0);\n }\n\n return true;\n};\n\nconst bubbleChartOptionsConfig: OptionsConfig<BubbleChartConfigContext> = [\n {\n key: 'general',\n type: 'group',\n open: true,\n children: [\n {\n key: 'display.title',\n control: {\n type: 'switch',\n label: 'Title',\n default: true\n }\n },\n {\n key: 'display.legend',\n control: {\n type: 'switch',\n label: 'Legend',\n default: true\n },\n visibleIf: hasLegend\n },\n {\n key: 'display.bubbleLabels',\n control: {\n type: 'switch',\n label: 'Show labels',\n tooltip: 'If enough room available',\n default: true\n }\n },\n {\n key: 'display.bubbleValues',\n control: {\n type: 'picker',\n label: 'Show values',\n tooltip: 'If enough room available',\n default: 'none',\n enum: ['none', 'percentage', 'absolute']\n }\n },\n {\n key: 'categories.colored',\n control: {\n type: 'switch',\n label: 'Bubble color by category',\n default: true\n },\n visibleIf: hasNoLegend\n },\n {\n key: 'color',\n control: {\n type: 'color-picker',\n label: 'Bubble color',\n default: ({ theme }: BubbleChartConfigContext) => getThemeMainColor(theme),\n extraLabel: ({ options, theme }: BubbleChartConfigContext) => getThemeMainColorResetLabel(options, theme, 'color'),\n extraLabelHasClickAction: ({ options, theme }: BubbleChartConfigContext) =>\n getThemeMainColorExtraLabelHasClickAction(options, theme, 'color'),\n extraLabelClickAction: ({ options, theme }: BubbleChartConfigContext) =>\n getThemeMainColorExtraLabelClickAction(options, theme, 'color')\n },\n visibleIf: ({ options, slots }: BubbleChartConfigContext) => options?.categories?.colored === false && hasNoLegend({ slots })\n }\n ]\n },\n {\n key: 'legend',\n type: 'group',\n open: false,\n children: [\n {\n key: 'legend.position',\n control: {\n label: 'Position',\n type: 'position-picker',\n default: 'topRight',\n enum: ['topLeft', 'top', 'topRight', 'right', 'bottomRight', 'bottom', 'bottomLeft', 'left']\n }\n },\n {\n key: 'legend.customOrder',\n control: {\n label: 'Custom order',\n description: 'Drag items in the chart legend to set the order.',\n type: 'switch',\n default: false\n }\n },\n {\n key: 'interactivity.legendReorder',\n control: {\n label: 'Allow viewers to reorder',\n type: 'switch',\n default: false\n },\n visibleIf: ({ options }: BubbleChartConfigContext) => options?.legend?.customOrder === true\n }\n ],\n visibleIf: hasLegend\n },\n createInfoTooltipOptionsGroup<BubbleChartConfigContext>(),\n createInteractivityOptionsGroup<BubbleChartConfigContext>({ select: { default: true } })\n];\n\nexport default bubbleChartOptionsConfig;\n"],"mappings":";;;;AAaA,IAAM,KAAa,EAAE,eACf,MAAM,QAAQ,CAAK,KAAK,GAAO,SAAS,KAClC,GAAO,MAAM,MAAM,GAAG,SAAS,OAAO,CAAC,EAAE,SAAS,UAAU,KAAK,IAGpE,IAGH,KAAe,EAAE,eACjB,MAAM,QAAQ,CAAK,KAAK,GAAO,SAAS,IACnC,GAAG,GAAO,MAAM,MAAM,GAAG,SAAS,OAAO,CAAC,EAAE,SAAS,UAAU,KAAK,KAGtE,IAGH,IAAoE;CACxE;EACE,KAAK;EACL,MAAM;EACN,MAAM;EACN,UAAU;GACR;IACE,KAAK;IACL,SAAS;KACP,MAAM;KACN,OAAO;KACP,SAAS;IACX;GACF;GACA;IACE,KAAK;IACL,SAAS;KACP,MAAM;KACN,OAAO;KACP,SAAS;IACX;IACA,WAAW;GACb;GACA;IACE,KAAK;IACL,SAAS;KACP,MAAM;KACN,OAAO;KACP,SAAS;KACT,SAAS;IACX;GACF;GACA;IACE,KAAK;IACL,SAAS;KACP,MAAM;KACN,OAAO;KACP,SAAS;KACT,SAAS;KACT,MAAM;MAAC;MAAQ;MAAc;KAAU;IACzC;GACF;GACA;IACE,KAAK;IACL,SAAS;KACP,MAAM;KACN,OAAO;KACP,SAAS;IACX;IACA,WAAW;GACb;GACA;IACE,KAAK;IACL,SAAS;KACP,MAAM;KACN,OAAO;KACP,UAAU,EAAE,eAAsC,EAAkB,CAAK;KACzE,aAAa,EAAE,YAAS,eAAsC,EAA4B,GAAS,GAAO,OAAO;KACjH,2BAA2B,EAAE,YAAS,eACpC,EAA0C,GAAS,GAAO,OAAO;KACnE,wBAAwB,EAAE,YAAS,eACjC,EAAuC,GAAS,GAAO,OAAO;IAClE;IACA,YAAY,EAAE,YAAS,eAAsC,GAAS,YAAY,YAAY,MAAS,EAAY,EAAE,SAAM,CAAC;GAC9H;EACF;CACF;CACA;EACE,KAAK;EACL,MAAM;EACN,MAAM;EACN,UAAU;GACR;IACE,KAAK;IACL,SAAS;KACP,OAAO;KACP,MAAM;KACN,SAAS;KACT,MAAM;MAAC;MAAW;MAAO;MAAY;MAAS;MAAe;MAAU;MAAc;KAAM;IAC7F;GACF;GACA;IACE,KAAK;IACL,SAAS;KACP,OAAO;KACP,aAAa;KACb,MAAM;KACN,SAAS;IACX;GACF;GACA;IACE,KAAK;IACL,SAAS;KACP,OAAO;KACP,MAAM;KACN,SAAS;IACX;IACA,YAAY,EAAE,iBAAwC,GAAS,QAAQ,gBAAgB;GACzF;EACF;EACA,WAAW;CACb;CACA,EAAwD;CACxD,EAA0D,EAAE,QAAQ,EAAE,SAAS,GAAK,EAAE,CAAC;AACzF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("../shared/utils/info-tooltip-options.config.cjs"),t=require("../shared/utils/color/color-palettes.cjs"),
|
|
1
|
+
const e=require("../shared/utils/info-tooltip-options.config.cjs"),t=require("../shared/utils/interactivity-options.config.cjs"),n=require("../shared/utils/color/color-palettes.cjs"),r=require("../shared/utils/map-tile-providers.cjs"),i=require("../shared/utils/color-range-utils.cjs");var a=(e,t)=>{let r=`colors${t}`;return n.getColorMaps()[e]?.[r]},o=[{key:`general`,type:`group`,open:!0,children:[{key:`display.title`,control:{type:`switch`,label:`Title`,default:!0}},{key:`display.legend`,control:{type:`switch`,label:`Legend`,default:!0}}]},{key:`map`,type:`group`,open:!0,children:[{key:`enabled.zoom`,control:{type:`switch`,label:`Zoom`,default:!0}},{key:`enabled.pan`,control:{type:`switch`,label:`Pan`,default:!0}},{key:`enabled.pitchBearing`,control:{type:`switch`,label:`Pitch & Rotate`,tooltip:`Use ctrl + drag`,default:!1}},{type:`divider`},{key:`vectorTileProvider`,control:{type:`picker`,label:`Map style`,default:`Basic`,enum:[`No Tiles`,`Basic`,`Bright`,`Dark`,`Fiord`,`Liberty`,`Pastel`,`Positron`,`Streets`,`Toner`,`Topographique`,`Voyager`,`3D buildings`],parseValue:e=>e?.name||`Basic`,toValue:e=>r.mapVectorTileProviders[e]??{}}}]},{key:`colors`,type:`group`,open:!0,children:[{key:`opacity`,control:{type:`slider`,label:`Opacity`,default:.85,min:.2,max:1,step:.01}},{key:`colorsClassType`,control:{type:`picker`,label:`Colors type`,default:`sequential`,enum:[`sequential`,`divergent`,`manual`],calculateValue:({options:e})=>e?.colorsClass===`manual`?`manual`:n.getColorMaps()?.[e?.colorsClass]?.type??`sequential`,toOptions:({options:e,value:t})=>{let r=e?.colorsClass??`PuBu`,a=e?.numberClasses??5,o=i.toRangesWithValue(e?.manualValues?.ranges),s=r===`manual`?`manual`:r,c;t===`manual`?c=`manual`:t!==n.getColorMaps()?.[e?.colorsClass]?.type&&(c=n.getColorMapKeys(t??`sequential`)[0]);let l={...e,colorsClass:c};if(t===`manual`||e?.classification===`manual`){let e=i.calculateManualRanges(a,t===`manual`?s:c,o);l.manualValues={...l.manualValues,ranges:i.toRangesWithVal(e)}}else delete l?.manualValues?.ranges;return l}}},{key:`colorsClass`,control:{type:`color-palette-picker`,label:`Color palette`,hideLabel:!0,default:({options:e})=>{let t=n.getColorMaps()?.[e?.colorsClass]?.type;return n.getColorMapKeys(t??`sequential`)[0]},enum:({options:e})=>{let t=n.getColorMaps()?.[e?.colorsClass]?.type;return n.getColorMapKeys(t??`sequential`)},toOptions:({options:e,value:t})=>{let n={...e,colorsClass:t};if(e?.classification===`manual`){let r=a(t,e?.numberClasses??5);n.manualValues={...n.manualValues,ranges:e?.manualValues?.ranges?.map(e=>({...e,color:typeof e.val==`number`?r?.[e.val]:void 0}))}}return n}},visibleIf:({options:e})=>e?.colorsClass!==`manual`},{key:`manualValues.ranges`,control:{type:`color-range`,editRangeSize:!1,debounce:500,noValues:!0,noAlphaChannel:!0,label:`Manual range colors`,hideLabel:!0},calculateValue:({options:e})=>i.calculateManualRanges(e?.numberClasses,e?.colorsClass,i.toRangesWithValue(e?.manualValues?.ranges)),toOptions:({options:e,value:t})=>({...e,manualValues:{...e.manualValues,ranges:i.toRangesWithVal(t)}}),visibleIf:({options:e})=>e?.colorsClass===`manual`}]},{key:`classification`,type:`group`,open:!0,children:[{key:`numberClasses`,control:{type:`picker`,label:`Number of classes`,default:`5`,enum:[`3`,`4`,`5`,`6`,`7`,`8`,`9`],parseValue:e=>e?.toString()??`5`,toOptions:({options:e,value:t})=>{let n=Number.parseInt(t,10)||5,r={...e,numberClasses:n};if(e?.classification===`manual`||e?.colorsClass===`manual`){let n=i.calculateManualRanges(t,e?.colorsClass,i.toRangesWithValue(e?.manualValues?.ranges));r.manualValues={...r.manualValues,ranges:i.toRangesWithVal(n)}}return r}}},{key:`classification`,control:{type:`picker`,label:`Method`,default:`interval`,enum:[`interval`,`manual`,`quantile`,`continuous`],toOptions:({options:e,value:t})=>{let n={...e,classification:t};if(t===`manual`||e?.colorsClass===`manual`){let t=i.calculateManualRanges(e?.numberClasses,e?.colorsClass,i.toRangesWithValue(e?.manualValues?.ranges));n.manualValues={...n.manualValues,ranges:i.toRangesWithVal(t)}}else delete n?.manualValues?.ranges;return n}}},{key:`manualValues.rangesValues`,control:{type:`color-range`,editRangeSize:!1,debounce:500,noValues:!1,readOnlyColorPicker:!0,label:`Manual range values`,hideLabel:!0,calculateValue:({options:e})=>i.calculateManualRanges(e?.numberClasses,e?.colorsClass,i.toRangesWithValue(e?.manualValues?.ranges)),toOptions:({options:e,value:t})=>({...e,manualValues:{...e.manualValues,ranges:i.toRangesWithVal(t)}})},visibleIf:({options:e})=>e?.classification===`manual`}]},{key:`legend`,type:`group`,open:!1,children:[{key:`legend.type`,control:{type:`picker`,label:`Type`,default:`bar`,enum:[`bar`,`list`]}},{key:`legend.size`,control:{type:`radio-button-group`,label:`Size`,default:`M`,enum:[`S`,`M`,`L`]}},{key:`legend.position`,control:{type:`position-picker`,label:`Position`,default:`bottomLeft`,enum:[`topLeft`,`top`,`topRight`,`right`,`bottomRight`,`bottom`,`bottomLeft`,`left`]}}],visibleIf:({options:e})=>e?.display?.legend===!0},e.createInfoTooltipOptionsGroup(),t.createInteractivityOptionsGroup({select:{default:!0}})];exports.default=o;
|
|
2
2
|
//# sourceMappingURL=choropleth-map-options.config.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"choropleth-map-options.config.cjs","names":[],"sources":["../../../../libs/dashboard-contents-types/src/lib/choropleth-map/choropleth-map-options.config.ts"],"sourcesContent":["import { type ColorValue, type ColorsClassKey, type ColorsType, getColorMapKeys, getColorMaps } from '../shared/utils/color/color-palettes';\nimport { mapVectorTileProviders } from '../shared/utils/map-tile-providers';\nimport { calculateManualRanges, toRangesWithVal, toRangesWithValue } from '../shared/utils/color-range-utils';\nimport type { ManualValuesRange } from '../shared/types/ranges';\nimport { createInfoTooltipOptionsGroup } from '../shared/utils/info-tooltip-options.config';\nimport type { OptionsConfig, OptionsConfigContext } from '../shared/utils/options-config.types';\nimport type { ChoroplethMapViewOptions } from './choropleth-map-options';\n\ntype ChoroplethMapConfigContext = OptionsConfigContext<ChoroplethMapViewOptions>;\ntype ChoroplethMapConfigContextWithValue<T> = ChoroplethMapConfigContext & { value: T };\ntype ColorCountKey = Exclude<keyof ColorValue, 'type'>;\n\nconst getColorClassColors = (colorClass: ColorsClassKey, numberClasses: number): string[] | undefined => {\n const key = `colors${numberClasses}` as ColorCountKey;\n\n return getColorMaps()[colorClass]?.[key];\n};\n\nconst choroplethMapOptionsConfig: OptionsConfig<ChoroplethMapConfigContext> = [\n {\n key: 'general',\n type: 'group',\n open: true,\n children: [\n {\n key: 'display.title',\n control: {\n type: 'switch',\n label: 'Title',\n default: true\n }\n },\n {\n key: 'display.legend',\n control: {\n type: 'switch',\n label: 'Legend',\n default: true\n }\n }\n ]\n },\n {\n key: 'map',\n type: 'group',\n open: true,\n children: [\n {\n key: 'enabled.zoom',\n control: {\n type: 'switch',\n label: 'Zoom',\n default: true\n }\n },\n /* {\n key: 'zoomRange',\n control: {\n type: 'range',\n label: 'Zoom range',\n default: [5, 18],\n min: 1,\n max: 22,\n step: 1\n },\n visibleIf: ({ options }: ChoroplethMapConfigContext) => options?.enabled?.zoom === true\n }, */\n {\n key: 'enabled.pan',\n control: {\n type: 'switch',\n label: 'Pan',\n default: true\n }\n },\n {\n key: 'enabled.pitchBearing',\n control: {\n type: 'switch',\n label: 'Pitch & Rotate',\n tooltip: 'Use ctrl + drag',\n default: false\n }\n },\n {\n type: 'divider'\n },\n {\n key: 'vectorTileProvider',\n control: {\n type: 'picker',\n label: 'Map style',\n default: 'Basic',\n enum: [\n 'No Tiles',\n 'Basic',\n 'Bright',\n 'Dark',\n 'Fiord',\n 'Liberty',\n 'Pastel',\n 'Positron',\n 'Streets',\n 'Toner',\n 'Topographique',\n 'Voyager',\n '3D buildings'\n ],\n parseValue: (value: { name?: string } | null | undefined) => value?.name || 'Basic',\n toValue: (value: string) => mapVectorTileProviders[value as keyof typeof mapVectorTileProviders] ?? {}\n }\n }\n ]\n },\n {\n key: 'colors',\n type: 'group',\n open: true,\n children: [\n {\n key: 'opacity',\n control: {\n type: 'slider',\n label: 'Opacity',\n default: 0.85,\n min: 0.2,\n max: 1,\n step: 0.01\n }\n },\n {\n key: 'colorsClassType',\n control: {\n type: 'picker',\n label: 'Colors type',\n default: 'sequential',\n enum: ['sequential', 'divergent', 'manual'],\n calculateValue: ({ options }: ChoroplethMapConfigContext) => {\n if (options?.colorsClass === 'manual') {\n return 'manual';\n }\n\n const colorMaps = getColorMaps();\n const type = colorMaps?.[options?.colorsClass as ColorsClassKey]?.type;\n\n return type ?? 'sequential';\n },\n toOptions: ({ options, value }: ChoroplethMapConfigContextWithValue<ColorsType>) => {\n const previousColorsClassValue = options?.colorsClass ?? 'PuBu';\n const numberClassesValue = options?.numberClasses ?? 5;\n const previousRanges = toRangesWithValue(options?.manualValues?.ranges);\n const useColorsClassToGenerate = previousColorsClassValue === 'manual' ? 'manual' : previousColorsClassValue;\n\n let newColorsClass;\n\n if (value === 'manual') {\n newColorsClass = 'manual';\n }\n else {\n const colorMaps = getColorMaps();\n const colorClassType = colorMaps?.[options?.colorsClass as ColorsClassKey]?.type;\n\n if (value !== colorClassType) {\n newColorsClass = getColorMapKeys(value ?? 'sequential')[0];\n }\n }\n\n const newOptions = { ...options, colorsClass: newColorsClass };\n\n if (value === 'manual' || options?.classification === 'manual') {\n const manualRanges = calculateManualRanges(\n numberClassesValue,\n value === 'manual' ? useColorsClassToGenerate : newColorsClass,\n previousRanges\n );\n\n newOptions.manualValues = {\n ...newOptions.manualValues,\n ranges: toRangesWithVal(manualRanges)\n };\n }\n else {\n delete newOptions?.manualValues?.ranges;\n }\n\n return newOptions;\n }\n }\n },\n {\n key: 'colorsClass',\n control: {\n type: 'color-palette-picker',\n label: 'Color palette',\n hideLabel: true,\n default: ({ options }: ChoroplethMapConfigContext) => {\n const colorMaps = getColorMaps();\n const colorClassType = colorMaps?.[options?.colorsClass as ColorsClassKey]?.type;\n\n return getColorMapKeys(colorClassType ?? 'sequential')[0];\n },\n enum: ({ options }: ChoroplethMapConfigContext) => {\n const colorMaps = getColorMaps();\n const colorClassType = colorMaps?.[options?.colorsClass as ColorsClassKey]?.type;\n\n return getColorMapKeys(colorClassType ?? 'sequential');\n },\n toOptions: ({ options, value }: ChoroplethMapConfigContextWithValue<ColorsClassKey>) => {\n const newOptions = { ...options, colorsClass: value };\n\n if (options?.classification === 'manual') {\n const newColors = getColorClassColors(value, options?.numberClasses ?? 5);\n\n newOptions.manualValues = {\n ...newOptions.manualValues,\n ranges: options?.manualValues?.ranges?.map((range: ManualValuesRange) => ({\n ...range,\n color: typeof range.val === 'number' ? newColors?.[range.val] : undefined\n }))\n };\n }\n\n return newOptions;\n }\n },\n visibleIf: ({ options }: ChoroplethMapConfigContext) => options?.colorsClass !== 'manual'\n },\n {\n key: 'manualValues.ranges',\n control: {\n type: 'color-range',\n editRangeSize: false,\n debounce: 500,\n noValues: true,\n noAlphaChannel: true,\n label: 'Manual range colors',\n hideLabel: true\n },\n calculateValue: ({ options }: ChoroplethMapConfigContext) =>\n calculateManualRanges(options?.numberClasses, options?.colorsClass, toRangesWithValue(options?.manualValues?.ranges)),\n toOptions: ({ options, value }: ChoroplethMapConfigContextWithValue<ManualValuesRange[]>) => ({\n ...options,\n manualValues: {\n ...options.manualValues,\n ranges: toRangesWithVal(value)\n }\n }),\n visibleIf: ({ options }: ChoroplethMapConfigContext) => options?.colorsClass === 'manual'\n }\n ]\n },\n {\n key: 'classification',\n type: 'group',\n open: true,\n children: [\n {\n key: 'numberClasses',\n control: {\n type: 'picker',\n label: 'Number of classes',\n default: '5',\n enum: ['3', '4', '5', '6', '7', '8', '9'],\n parseValue: (value: string | number | null | undefined) => value?.toString() ?? '5',\n toOptions: ({ options, value }: ChoroplethMapConfigContextWithValue<string>) => {\n const numValue = Number.parseInt(value, 10) || 5;\n\n const newOptions = { ...options, numberClasses: numValue };\n\n if (options?.classification === 'manual' || options?.colorsClass === 'manual') {\n const manualRanges = calculateManualRanges(value, options?.colorsClass, toRangesWithValue(options?.manualValues?.ranges));\n\n newOptions.manualValues = {\n ...newOptions.manualValues,\n ranges: toRangesWithVal(manualRanges)\n };\n }\n\n return newOptions;\n }\n }\n },\n {\n key: 'classification',\n control: {\n type: 'picker',\n label: 'Method',\n default: 'interval',\n // TODO: add manual when being able to retrieve values from the choropleth map\n enum: ['interval', 'manual', 'quantile', 'continuous'],\n toOptions: ({ options, value }: ChoroplethMapConfigContextWithValue<'interval' | 'manual' | 'quantile' | 'continuous'>) => {\n const newOptions = { ...options, classification: value };\n\n if (value === 'manual' || options?.colorsClass === 'manual') {\n const manualRanges = calculateManualRanges(\n options?.numberClasses,\n options?.colorsClass,\n toRangesWithValue(options?.manualValues?.ranges)\n );\n\n newOptions.manualValues = {\n ...newOptions.manualValues,\n ranges: toRangesWithVal(manualRanges)\n };\n }\n else {\n delete newOptions?.manualValues?.ranges;\n }\n\n return newOptions;\n }\n }\n },\n {\n key: 'manualValues.rangesValues',\n control: {\n type: 'color-range',\n editRangeSize: false,\n debounce: 500,\n noValues: false,\n readOnlyColorPicker: true,\n label: 'Manual range values',\n hideLabel: true,\n calculateValue: ({ options }: ChoroplethMapConfigContext) =>\n calculateManualRanges(options?.numberClasses, options?.colorsClass, toRangesWithValue(options?.manualValues?.ranges)),\n toOptions: ({ options, value }: ChoroplethMapConfigContextWithValue<ManualValuesRange[]>) => ({\n ...options,\n manualValues: {\n ...options.manualValues,\n ranges: toRangesWithVal(value)\n }\n })\n },\n visibleIf: ({ options }: ChoroplethMapConfigContext) => options?.classification === 'manual'\n }\n ]\n },\n {\n key: 'legend',\n type: 'group',\n open: false,\n children: [\n {\n key: 'legend.type',\n control: {\n type: 'picker',\n label: 'Type',\n default: 'bar',\n enum: ['bar', 'list']\n }\n },\n {\n key: 'legend.size',\n control: {\n type: 'radio-button-group',\n label: 'Size',\n default: 'M',\n enum: ['S', 'M', 'L']\n }\n },\n {\n key: 'legend.position',\n control: {\n type: 'position-picker',\n label: 'Position',\n default: 'bottomLeft',\n enum: ['topLeft', 'top', 'topRight', 'right', 'bottomRight', 'bottom', 'bottomLeft', 'left']\n }\n }\n ],\n visibleIf: ({ options }: ChoroplethMapConfigContext) => options?.display?.legend === true\n },\n createInfoTooltipOptionsGroup<ChoroplethMapConfigContext>()\n];\n\nexport default choroplethMapOptionsConfig;\n"],"mappings":"gOAYA,IAAM,GAAuB,EAA4B,IAAgD,CACvG,IAAM,EAAM,SAAS,IAErB,OAAO,EAAA,aAAa,CAAC,CAAC,EAAW,GAAG,EACtC,EAEM,EAAwE,CAC5E,CACE,IAAK,UACL,KAAM,QACN,KAAM,GACN,SAAU,CACR,CACE,IAAK,gBACL,QAAS,CACP,KAAM,SACN,MAAO,QACP,QAAS,EACX,CACF,EACA,CACE,IAAK,iBACL,QAAS,CACP,KAAM,SACN,MAAO,SACP,QAAS,EACX,CACF,CACF,CACF,EACA,CACE,IAAK,MACL,KAAM,QACN,KAAM,GACN,SAAU,CACR,CACE,IAAK,eACL,QAAS,CACP,KAAM,SACN,MAAO,OACP,QAAS,EACX,CACF,EAaA,CACE,IAAK,cACL,QAAS,CACP,KAAM,SACN,MAAO,MACP,QAAS,EACX,CACF,EACA,CACE,IAAK,uBACL,QAAS,CACP,KAAM,SACN,MAAO,iBACP,QAAS,kBACT,QAAS,EACX,CACF,EACA,CACE,KAAM,SACR,EACA,CACE,IAAK,qBACL,QAAS,CACP,KAAM,SACN,MAAO,YACP,QAAS,QACT,KAAM,CACJ,WACA,QACA,SACA,OACA,QACA,UACA,SACA,WACA,UACA,QACA,gBACA,UACA,cACF,EACA,WAAa,GAAgD,GAAO,MAAQ,QAC5E,QAAU,GAAkB,EAAA,uBAAuB,IAAiD,CAAC,CACvG,CACF,CACF,CACF,EACA,CACE,IAAK,SACL,KAAM,QACN,KAAM,GACN,SAAU,CACR,CACE,IAAK,UACL,QAAS,CACP,KAAM,SACN,MAAO,UACP,QAAS,IACT,IAAK,GACL,IAAK,EACL,KAAM,GACR,CACF,EACA,CACE,IAAK,kBACL,QAAS,CACP,KAAM,SACN,MAAO,cACP,QAAS,aACT,KAAM,CAAC,aAAc,YAAa,QAAQ,EAC1C,gBAAiB,CAAE,aACb,GAAS,cAAgB,SACpB,SAGS,EAAA,aACL,CAAA,GAAY,GAAS,YAA8B,EAAE,MAEnD,aAEjB,WAAY,CAAE,UAAS,WAA6D,CAClF,IAAM,EAA2B,GAAS,aAAe,OACnD,EAAqB,GAAS,eAAiB,EAC/C,EAAiB,EAAA,kBAAkB,GAAS,cAAc,MAAM,EAChE,EAA2B,IAA6B,SAAW,SAAW,EAEhF,EAEA,IAAU,SACZ,E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W,aACd,OAAQ,EAAA,gBAAgB,CAAY,CACtC,CACF,MAEE,OAAO,GAAY,cAAc,OAGnC,OAAO,CACT,CACF,CACF,EACA,CACE,IAAK,4BACL,QAAS,CACP,KAAM,cACN,cAAe,GACf,SAAU,IACV,SAAU,GACV,oBAAqB,GACrB,MAAO,sBACP,UAAW,GACX,gBAAiB,CAAE,aACjB,EAAA,sBAAsB,GAAS,cAAe,GAAS,YAAa,EAAA,kBAAkB,GAAS,cAAc,MAAM,CAAC,EACtH,WAAY,CAAE,UAAS,YAAuE,CAC5F,GAAG,EACH,aAAc,CACZ,GAAG,EAAQ,aACX,OAAQ,EAAA,gBAAgB,CAAK,CAC/B,CACF,EACF,EACA,WAAY,CAAE,aAA0C,GAAS,iBAAmB,QACtF,CACF,CACF,EACA,CACE,IAAK,SACL,KAAM,QACN,KAAM,GACN,SAAU,CACR,CACE,IAAK,cACL,QAAS,CACP,KAAM,SACN,MAAO,OACP,QAAS,MACT,KAAM,CAAC,MAAO,MAAM,CACtB,CACF,EACA,CACE,IAAK,cACL,QAAS,CACP,KAAM,qBACN,MAAO,OACP,QAAS,IACT,KAAM,CAAC,IAAK,IAAK,GAAG,CACtB,CACF,EACA,CACE,IAAK,kBACL,QAAS,CACP,KAAM,kBACN,MAAO,WACP,QAAS,aACT,KAAM,CAAC,UAAW,MAAO,WAAY,QAAS,cAAe,SAAU,aAAc,MAAM,CAC7F,CACF,CACF,EACA,WAAY,CAAE,aAA0C,GAAS,SAAS,SAAW,EACvF,EACA,EAAA,8BAA0D,CAC5D"}
|
|
1
|
+
{"version":3,"file":"choropleth-map-options.config.cjs","names":[],"sources":["../../../../libs/dashboard-contents-types/src/lib/choropleth-map/choropleth-map-options.config.ts"],"sourcesContent":["import { type ColorValue, type ColorsClassKey, type ColorsType, getColorMapKeys, getColorMaps } from '../shared/utils/color/color-palettes';\nimport { mapVectorTileProviders } from '../shared/utils/map-tile-providers';\nimport { calculateManualRanges, toRangesWithVal, toRangesWithValue } from '../shared/utils/color-range-utils';\nimport type { ManualValuesRange } from '../shared/types/ranges';\nimport { createInfoTooltipOptionsGroup } from '../shared/utils/info-tooltip-options.config';\nimport { createInteractivityOptionsGroup } from '../shared/utils/interactivity-options.config';\nimport type { OptionsConfig, OptionsConfigContext } from '../shared/utils/options-config.types';\nimport type { ChoroplethMapViewOptions } from './choropleth-map-options';\n\ntype ChoroplethMapConfigContext = OptionsConfigContext<ChoroplethMapViewOptions>;\ntype ChoroplethMapConfigContextWithValue<T> = ChoroplethMapConfigContext & { value: T };\ntype ColorCountKey = Exclude<keyof ColorValue, 'type'>;\n\nconst getColorClassColors = (colorClass: ColorsClassKey, numberClasses: number): string[] | undefined => {\n const key = `colors${numberClasses}` as ColorCountKey;\n\n return getColorMaps()[colorClass]?.[key];\n};\n\nconst choroplethMapOptionsConfig: OptionsConfig<ChoroplethMapConfigContext> = [\n {\n key: 'general',\n type: 'group',\n open: true,\n children: [\n {\n key: 'display.title',\n control: {\n type: 'switch',\n label: 'Title',\n default: true\n }\n },\n {\n key: 'display.legend',\n control: {\n type: 'switch',\n label: 'Legend',\n default: true\n }\n }\n ]\n },\n {\n key: 'map',\n type: 'group',\n open: true,\n children: [\n {\n key: 'enabled.zoom',\n control: {\n type: 'switch',\n label: 'Zoom',\n default: true\n }\n },\n /* {\n key: 'zoomRange',\n control: {\n type: 'range',\n label: 'Zoom range',\n default: [5, 18],\n min: 1,\n max: 22,\n step: 1\n },\n visibleIf: ({ options }: ChoroplethMapConfigContext) => options?.enabled?.zoom === true\n }, */\n {\n key: 'enabled.pan',\n control: {\n type: 'switch',\n label: 'Pan',\n default: true\n }\n },\n {\n key: 'enabled.pitchBearing',\n control: {\n type: 'switch',\n label: 'Pitch & Rotate',\n tooltip: 'Use ctrl + drag',\n default: false\n }\n },\n {\n type: 'divider'\n },\n {\n key: 'vectorTileProvider',\n control: {\n type: 'picker',\n label: 'Map style',\n default: 'Basic',\n enum: [\n 'No Tiles',\n 'Basic',\n 'Bright',\n 'Dark',\n 'Fiord',\n 'Liberty',\n 'Pastel',\n 'Positron',\n 'Streets',\n 'Toner',\n 'Topographique',\n 'Voyager',\n '3D buildings'\n ],\n parseValue: (value: { name?: string } | null | undefined) => value?.name || 'Basic',\n toValue: (value: string) => mapVectorTileProviders[value as keyof typeof mapVectorTileProviders] ?? {}\n }\n }\n ]\n },\n {\n key: 'colors',\n type: 'group',\n open: true,\n children: [\n {\n key: 'opacity',\n control: {\n type: 'slider',\n label: 'Opacity',\n default: 0.85,\n min: 0.2,\n max: 1,\n step: 0.01\n }\n },\n {\n key: 'colorsClassType',\n control: {\n type: 'picker',\n label: 'Colors type',\n default: 'sequential',\n enum: ['sequential', 'divergent', 'manual'],\n calculateValue: ({ options }: ChoroplethMapConfigContext) => {\n if (options?.colorsClass === 'manual') {\n return 'manual';\n }\n\n const colorMaps = getColorMaps();\n const type = colorMaps?.[options?.colorsClass as ColorsClassKey]?.type;\n\n return type ?? 'sequential';\n },\n toOptions: ({ options, value }: ChoroplethMapConfigContextWithValue<ColorsType>) => {\n const previousColorsClassValue = options?.colorsClass ?? 'PuBu';\n const numberClassesValue = options?.numberClasses ?? 5;\n const previousRanges = toRangesWithValue(options?.manualValues?.ranges);\n const useColorsClassToGenerate = previousColorsClassValue === 'manual' ? 'manual' : previousColorsClassValue;\n\n let newColorsClass;\n\n if (value === 'manual') {\n newColorsClass = 'manual';\n }\n else {\n const colorMaps = getColorMaps();\n const colorClassType = colorMaps?.[options?.colorsClass as ColorsClassKey]?.type;\n\n if (value !== colorClassType) {\n newColorsClass = getColorMapKeys(value ?? 'sequential')[0];\n }\n }\n\n const newOptions = { ...options, colorsClass: newColorsClass };\n\n if (value === 'manual' || options?.classification === 'manual') {\n const manualRanges = calculateManualRanges(\n numberClassesValue,\n value === 'manual' ? useColorsClassToGenerate : newColorsClass,\n previousRanges\n );\n\n newOptions.manualValues = {\n ...newOptions.manualValues,\n ranges: toRangesWithVal(manualRanges)\n };\n }\n else {\n delete newOptions?.manualValues?.ranges;\n }\n\n return newOptions;\n }\n }\n },\n {\n key: 'colorsClass',\n control: {\n type: 'color-palette-picker',\n label: 'Color palette',\n hideLabel: true,\n default: ({ options }: ChoroplethMapConfigContext) => {\n const colorMaps = getColorMaps();\n const colorClassType = colorMaps?.[options?.colorsClass as ColorsClassKey]?.type;\n\n return getColorMapKeys(colorClassType ?? 'sequential')[0];\n },\n enum: ({ options }: ChoroplethMapConfigContext) => {\n const colorMaps = getColorMaps();\n const colorClassType = colorMaps?.[options?.colorsClass as ColorsClassKey]?.type;\n\n return getColorMapKeys(colorClassType ?? 'sequential');\n },\n toOptions: ({ options, value }: ChoroplethMapConfigContextWithValue<ColorsClassKey>) => {\n const newOptions = { ...options, colorsClass: value };\n\n if (options?.classification === 'manual') {\n const newColors = getColorClassColors(value, options?.numberClasses ?? 5);\n\n newOptions.manualValues = {\n ...newOptions.manualValues,\n ranges: options?.manualValues?.ranges?.map((range: ManualValuesRange) => ({\n ...range,\n color: typeof range.val === 'number' ? newColors?.[range.val] : undefined\n }))\n };\n }\n\n return newOptions;\n }\n },\n visibleIf: ({ options }: ChoroplethMapConfigContext) => options?.colorsClass !== 'manual'\n },\n {\n key: 'manualValues.ranges',\n control: {\n type: 'color-range',\n editRangeSize: false,\n debounce: 500,\n noValues: true,\n noAlphaChannel: true,\n label: 'Manual range colors',\n hideLabel: true\n },\n calculateValue: ({ options }: ChoroplethMapConfigContext) =>\n calculateManualRanges(options?.numberClasses, options?.colorsClass, toRangesWithValue(options?.manualValues?.ranges)),\n toOptions: ({ options, value }: ChoroplethMapConfigContextWithValue<ManualValuesRange[]>) => ({\n ...options,\n manualValues: {\n ...options.manualValues,\n ranges: toRangesWithVal(value)\n }\n }),\n visibleIf: ({ options }: ChoroplethMapConfigContext) => options?.colorsClass === 'manual'\n }\n ]\n },\n {\n key: 'classification',\n type: 'group',\n open: true,\n children: [\n {\n key: 'numberClasses',\n control: {\n type: 'picker',\n label: 'Number of classes',\n default: '5',\n enum: ['3', '4', '5', '6', '7', '8', '9'],\n parseValue: (value: string | number | null | undefined) => value?.toString() ?? '5',\n toOptions: ({ options, value }: ChoroplethMapConfigContextWithValue<string>) => {\n const numValue = Number.parseInt(value, 10) || 5;\n\n const newOptions = { ...options, numberClasses: numValue };\n\n if (options?.classification === 'manual' || options?.colorsClass === 'manual') {\n const manualRanges = calculateManualRanges(value, options?.colorsClass, toRangesWithValue(options?.manualValues?.ranges));\n\n newOptions.manualValues = {\n ...newOptions.manualValues,\n ranges: toRangesWithVal(manualRanges)\n };\n }\n\n return newOptions;\n }\n }\n },\n {\n key: 'classification',\n control: {\n type: 'picker',\n label: 'Method',\n default: 'interval',\n // TODO: add manual when being able to retrieve values from the choropleth map\n enum: ['interval', 'manual', 'quantile', 'continuous'],\n toOptions: ({ options, value }: ChoroplethMapConfigContextWithValue<'interval' | 'manual' | 'quantile' | 'continuous'>) => {\n const newOptions = { ...options, classification: value };\n\n if (value === 'manual' || options?.colorsClass === 'manual') {\n const manualRanges = calculateManualRanges(\n options?.numberClasses,\n options?.colorsClass,\n toRangesWithValue(options?.manualValues?.ranges)\n );\n\n newOptions.manualValues = {\n ...newOptions.manualValues,\n ranges: toRangesWithVal(manualRanges)\n };\n }\n else {\n delete newOptions?.manualValues?.ranges;\n }\n\n return newOptions;\n }\n }\n },\n {\n key: 'manualValues.rangesValues',\n control: {\n type: 'color-range',\n editRangeSize: false,\n debounce: 500,\n noValues: false,\n readOnlyColorPicker: true,\n label: 'Manual range values',\n hideLabel: true,\n calculateValue: ({ options }: ChoroplethMapConfigContext) =>\n calculateManualRanges(options?.numberClasses, options?.colorsClass, toRangesWithValue(options?.manualValues?.ranges)),\n toOptions: ({ options, value }: ChoroplethMapConfigContextWithValue<ManualValuesRange[]>) => ({\n ...options,\n manualValues: {\n ...options.manualValues,\n ranges: toRangesWithVal(value)\n }\n })\n },\n visibleIf: ({ options }: ChoroplethMapConfigContext) => options?.classification === 'manual'\n }\n ]\n },\n {\n key: 'legend',\n type: 'group',\n open: false,\n children: [\n {\n key: 'legend.type',\n control: {\n type: 'picker',\n label: 'Type',\n default: 'bar',\n enum: ['bar', 'list']\n }\n },\n {\n key: 'legend.size',\n control: {\n type: 'radio-button-group',\n label: 'Size',\n default: 'M',\n enum: ['S', 'M', 'L']\n }\n },\n {\n key: 'legend.position',\n control: {\n type: 'position-picker',\n label: 'Position',\n default: 'bottomLeft',\n enum: ['topLeft', 'top', 'topRight', 'right', 'bottomRight', 'bottom', 'bottomLeft', 'left']\n }\n }\n ],\n visibleIf: ({ options }: ChoroplethMapConfigContext) => options?.display?.legend === true\n },\n createInfoTooltipOptionsGroup<ChoroplethMapConfigContext>(),\n createInteractivityOptionsGroup<ChoroplethMapConfigContext>({ select: { default: true } })\n];\n\nexport default choroplethMapOptionsConfig;\n"],"mappings":"8RAaA,IAAM,GAAuB,EAA4B,IAAgD,CACvG,IAAM,EAAM,SAAS,IAErB,OAAO,EAAA,aAAa,CAAC,CAAC,EAAW,GAAG,EACtC,EAEM,EAAwE,CAC5E,CACE,IAAK,UACL,KAAM,QACN,KAAM,GACN,SAAU,CACR,CACE,IAAK,gBACL,QAAS,CACP,KAAM,SACN,MAAO,QACP,QAAS,EACX,CACF,EACA,CACE,IAAK,iBACL,QAAS,CACP,KAAM,SACN,MAAO,SACP,QAAS,EACX,CACF,CACF,CACF,EACA,CACE,IAAK,MACL,KAAM,QACN,KAAM,GACN,SAAU,CACR,CACE,IAAK,eACL,QAAS,CACP,KAAM,SACN,MAAO,OACP,QAAS,EACX,CACF,EAaA,CACE,IAAK,cACL,QAAS,CACP,KAAM,SACN,MAAO,MACP,QAAS,EACX,CACF,EACA,CACE,IAAK,uBACL,QAAS,CACP,KAAM,SACN,MAAO,iBACP,QAAS,kBACT,QAAS,EACX,CACF,EACA,CACE,KAAM,SACR,EACA,CACE,IAAK,qBACL,QAAS,CACP,KAAM,SACN,MAAO,YACP,QAAS,QACT,KAAM,CACJ,WACA,QACA,SACA,OACA,QACA,UACA,SACA,WACA,UACA,QACA,gBACA,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