@datawheel/data-explorer 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +1761 -1281
- package/package.json +7 -1
package/dist/main.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { keyframes, createStyles,
|
|
2
|
-
import { useClipboard, useClickOutside, useFullscreen, useDebouncedValue } from '@mantine/hooks';
|
|
1
|
+
import { keyframes, createStyles, Select, rem, Flex, Title, Text, Group, Button, Box, Anchor, Input, Stack, SimpleGrid, ScrollArea, Table, MultiSelect, Center, Alert, Loader, Modal, NumberInput, Menu, ActionIcon, useMantineTheme, MantineProvider, Paper, useComponentDefaultProps, Switch, ThemeIcon, Tooltip, Tabs, CloseButton, Drawer, Checkbox, UnstyledButton, TextInput, Accordion, Popover, Divider } from '@mantine/core';
|
|
2
|
+
import { useClipboard, useClickOutside, useFullscreen, useMediaQuery, useDebouncedValue, useDisclosure } from '@mantine/hooks';
|
|
3
3
|
import { Prism } from '@mantine/prism';
|
|
4
|
-
import { IconWorld, IconExternalLink, IconClipboard, IconAlertCircle, IconAlertTriangle,
|
|
5
|
-
import * as
|
|
6
|
-
import
|
|
4
|
+
import { IconWorld, IconExternalLink, IconClipboard, IconAlertCircle, IconAlertTriangle, IconSettings, IconMathGreater, IconMathLower, IconArrowsLeftRight, IconCopy, IconDownload, IconDotsVertical, IconArrowsMinimize, IconArrowsMaximize, IconInfoCircleFilled, IconTrash, IconSearch, IconPhotoDown, IconVectorTriangle, IconStack3, IconFilterOff, IconFilter, IconArrowsSort, IconSortDescendingNumbers, IconSortDescendingLetters, IconSortAscendingNumbers, IconSortAscendingLetters, IconLanguage } from '@tabler/icons-react';
|
|
5
|
+
import * as React10 from 'react';
|
|
6
|
+
import React10__default, { createContext, forwardRef, useMemo, useCallback, useContext, useState, useEffect, useRef, Suspense } from 'react';
|
|
7
7
|
import { translationFactory } from '@datawheel/use-translation';
|
|
8
8
|
import { translationDict, generateCharts, createChartConfig } from '@datawheel/vizbuilder';
|
|
9
9
|
import { createSlice, createSelector, combineReducers, bindActionCreators, configureStore } from '@reduxjs/toolkit';
|
|
@@ -12,8 +12,10 @@ import ISO6391 from 'iso-639-1';
|
|
|
12
12
|
import { TesseractDataSource, Format, Client, Measure, Level, Comparison } from '@datawheel/olap-client';
|
|
13
13
|
import formUrlEncode from 'form-urlencoded';
|
|
14
14
|
import formUrlDecode from 'form-urldecoded';
|
|
15
|
-
import {
|
|
15
|
+
import { MRT_ProgressBar, flexRender, MRT_TableBodyCell, MRT_ToolbarAlertBanner, useMantineReactTable, MantineReactTable, MRT_TablePagination } from 'mantine-react-table';
|
|
16
16
|
import { formatAbbreviate, format } from 'd3plus-format';
|
|
17
|
+
import { QueryClient, QueryClientProvider, useQuery } from '@tanstack/react-query';
|
|
18
|
+
import debounce from 'lodash.debounce';
|
|
17
19
|
import { matchSorter } from 'match-sorter';
|
|
18
20
|
import yn from 'yn';
|
|
19
21
|
import { BarChart, Donut, Geomap, LinePlot, Pie, StackedArea, Treemap } from 'd3plus-react';
|
|
@@ -197,7 +199,11 @@ var defaultTranslation = {
|
|
|
197
199
|
action_download: "Download",
|
|
198
200
|
action_open: "Open",
|
|
199
201
|
action_reload: "Reload",
|
|
202
|
+
sidebar: {
|
|
203
|
+
dataset: "Select Dataset"
|
|
204
|
+
},
|
|
200
205
|
comparison: {
|
|
206
|
+
BT: "Between",
|
|
201
207
|
EQ: "Equal to",
|
|
202
208
|
GT: "Greater than",
|
|
203
209
|
GTE: "Equal or greater than",
|
|
@@ -233,12 +239,15 @@ var defaultTranslation = {
|
|
|
233
239
|
action_clear: "Clear query",
|
|
234
240
|
action_clear_description: "Clear all parameters from your current query",
|
|
235
241
|
action_execute: "Execute query",
|
|
242
|
+
add_columns: "Add columns",
|
|
236
243
|
column_title: "Parameters",
|
|
237
244
|
current_endpoint: "Current endpoint: {{label}}",
|
|
238
245
|
dimmenu_abbrjoint: ": ",
|
|
239
246
|
dimmenu_dimension: "{{dimension}}",
|
|
240
247
|
dimmenu_hierarchy: "{{abbr}}",
|
|
241
248
|
dimmenu_level: "{{abbr}}",
|
|
249
|
+
filter_mode: "Filter Mode",
|
|
250
|
+
filter_by: "Filter by {{name}}",
|
|
242
251
|
error_no_cut_selected_detail: "You can add data filters based on selected drilldowns.",
|
|
243
252
|
error_no_cut_selected_title: "No cuts added",
|
|
244
253
|
error_no_dimension_selected_detail: "You must add at least one drilldown.",
|
|
@@ -253,11 +262,15 @@ var defaultTranslation = {
|
|
|
253
262
|
label_boolean_nonempty: "Only return non-empty data",
|
|
254
263
|
label_boolean_parents: "Include parent levels",
|
|
255
264
|
label_boolean_sparse: "Optimize sparse results",
|
|
265
|
+
label_clear: "Clear",
|
|
256
266
|
label_cube: "Cube",
|
|
257
267
|
label_cuts_filterby_id: "IDs",
|
|
258
268
|
label_cuts_filterby_name: "Names",
|
|
259
269
|
label_cuts_filterby_any: "Any",
|
|
260
|
-
|
|
270
|
+
label_fullscreen: "Full screen",
|
|
271
|
+
label_locale: "Language",
|
|
272
|
+
label_search: "Search",
|
|
273
|
+
label_no_results: "No results",
|
|
261
274
|
label_dataset: "Select Dataset",
|
|
262
275
|
label_localeoption: "{{nativeName}}",
|
|
263
276
|
label_measure: "Measure",
|
|
@@ -378,13 +391,13 @@ function DebugView(props) {
|
|
|
378
391
|
const { copy, copied } = useClipboard({ timeout: 1e3 });
|
|
379
392
|
const copyHandler = useCallback(() => copy(url), [url]);
|
|
380
393
|
const openHandler = useCallback(() => window.open(url, "_blank"), [url]);
|
|
381
|
-
const jssourceLabel = /* @__PURE__ */
|
|
394
|
+
const jssourceLabel = /* @__PURE__ */ React10__default.createElement(Box, { component: "span" }, t("debug_view.jssource_prefix"), /* @__PURE__ */ React10__default.createElement(Anchor, { href: "https://www.npmjs.com/package/@datawheel/olap-client" }, "olap-client"), t("debug_view.jssource_suffix"));
|
|
382
395
|
const headers = useMemo(() => {
|
|
383
396
|
const headers2 = Object.entries(props.result.headers || {});
|
|
384
397
|
if (headers2.length === 0) return null;
|
|
385
|
-
return /* @__PURE__ */
|
|
398
|
+
return /* @__PURE__ */ React10__default.createElement(Input.Wrapper, { label: t("debug_view.httpheaders") }, /* @__PURE__ */ React10__default.createElement(Box, { component: "dl", sx: { fontFamily: "monospace", overflowWrap: "break-word" } }, headers2.map((entry) => /* @__PURE__ */ React10__default.createElement(React10__default.Fragment, { key: entry[0] }, /* @__PURE__ */ React10__default.createElement(Text, { component: "dt", fw: "bold", fz: "sm" }, entry[0]), /* @__PURE__ */ React10__default.createElement(Text, { component: "dd", c: "#5c940d", fz: "sm" }, entry[1])))));
|
|
386
399
|
}, [props.result.headers]);
|
|
387
|
-
return /* @__PURE__ */
|
|
400
|
+
return /* @__PURE__ */ React10__default.createElement(Box, { id: "query-results-debug-view" }, /* @__PURE__ */ React10__default.createElement(Stack, { spacing: "md", px: "md", py: "sm" }, url && /* @__PURE__ */ React10__default.createElement(Input.Wrapper, { label: t("debug_view.url_logiclayer") }, /* @__PURE__ */ React10__default.createElement(Group, { noWrap: true, spacing: "xs" }, /* @__PURE__ */ React10__default.createElement(Input, { icon: /* @__PURE__ */ React10__default.createElement(IconWorld, null), readOnly: true, rightSectionWidth: "auto", value: url, w: "100%" }), /* @__PURE__ */ React10__default.createElement(Button.Group, null, /* @__PURE__ */ React10__default.createElement(Button, { leftIcon: /* @__PURE__ */ React10__default.createElement(IconExternalLink, null), onClick: openHandler, variant: "default" }, t("action_open")), /* @__PURE__ */ React10__default.createElement(Button, { leftIcon: /* @__PURE__ */ React10__default.createElement(IconClipboard, null), onClick: copyHandler, variant: "default" }, copied ? t("action_copy_done") : t("action_copy"))))), /* @__PURE__ */ React10__default.createElement(SimpleGrid, { cols: 2 }, sourceCall && /* @__PURE__ */ React10__default.createElement(Input.Wrapper, { label: jssourceLabel }, /* @__PURE__ */ React10__default.createElement(Prism, { language: "javascript", styles: { line: { boxSizing: "border-box" } } }, sourceCall)), headers)));
|
|
388
401
|
}
|
|
389
402
|
|
|
390
403
|
// src/components/Explorer.tsx
|
|
@@ -493,7 +506,7 @@ function describeData(cube, params, data) {
|
|
|
493
506
|
return drilldowns.find((item) => item.uniqueName === name4) || measures.find((item) => item.name === name4) || drilldowns.find((item) => item.name === name4) || drilldowns.find((item) => item.uniqueName === nameWoId) || measures.find((item) => item.name === nameWoId) || drilldowns.find((item) => item.name === nameWoId);
|
|
494
507
|
};
|
|
495
508
|
return Object.fromEntries(
|
|
496
|
-
filterMap(Object.keys(data[0]), (key) => {
|
|
509
|
+
filterMap(Object.keys(data[0] || {}), (key) => {
|
|
497
510
|
const entity = entityFinder(key);
|
|
498
511
|
if (!entity) return null;
|
|
499
512
|
const typeSet = new Set(data.map((item) => typeof item[key]));
|
|
@@ -567,16 +580,6 @@ function parseName(name4) {
|
|
|
567
580
|
}
|
|
568
581
|
return levelArrayToRef(name4);
|
|
569
582
|
}
|
|
570
|
-
function safeRegExp(pattern, flags) {
|
|
571
|
-
let regex;
|
|
572
|
-
try {
|
|
573
|
-
regex = new RegExp(pattern, flags);
|
|
574
|
-
} catch (e) {
|
|
575
|
-
pattern = pattern.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&");
|
|
576
|
-
regex = new RegExp(pattern, flags);
|
|
577
|
-
}
|
|
578
|
-
return regex;
|
|
579
|
-
}
|
|
580
583
|
function splitName(name4) {
|
|
581
584
|
const nameParts = name4.indexOf("].[") > -1 ? name4.replace(/^\[|\]$/g, "").split("].[") : name4.split(".");
|
|
582
585
|
if (nameParts.length === 1) {
|
|
@@ -627,7 +630,7 @@ function buildQueryParams(props) {
|
|
|
627
630
|
isPreview: props.isPreview || false,
|
|
628
631
|
locale: props.locale || "",
|
|
629
632
|
measures: props.measures || {},
|
|
630
|
-
pagiLimit: props.pagiLimit || props.limitAmount || props.limit ||
|
|
633
|
+
pagiLimit: props.pagiLimit || props.limitAmount || props.limit || 100,
|
|
631
634
|
pagiOffset: props.pagiOffset || props.limitOffset || props.offset || 0,
|
|
632
635
|
sortDir: props.sortDir || props.sortDirection || props.sortOrder || props.order || "desc",
|
|
633
636
|
sortKey: props.sortKey || props.sortProperty || ""
|
|
@@ -1100,7 +1103,7 @@ var selectCutMap = createSelector(
|
|
|
1100
1103
|
(params) => params.cuts
|
|
1101
1104
|
);
|
|
1102
1105
|
createSelector(selectCutMap, getKeys);
|
|
1103
|
-
createSelector(selectCutMap, getValues);
|
|
1106
|
+
var selectCutItems = createSelector(selectCutMap, getValues);
|
|
1104
1107
|
var selectDrilldownMap = createSelector(
|
|
1105
1108
|
selectCurrentQueryParams,
|
|
1106
1109
|
(params) => params.drilldowns
|
|
@@ -1112,7 +1115,7 @@ var selectFilterMap = createSelector(
|
|
|
1112
1115
|
(params) => params.filters
|
|
1113
1116
|
);
|
|
1114
1117
|
createSelector(selectFilterMap, getKeys);
|
|
1115
|
-
createSelector(selectFilterMap, getValues);
|
|
1118
|
+
var selectFilterItems = createSelector(selectFilterMap, getValues);
|
|
1116
1119
|
var selectMeasureMap = createSelector(
|
|
1117
1120
|
selectCurrentQueryParams,
|
|
1118
1121
|
(params) => params.measures
|
|
@@ -1127,7 +1130,7 @@ var selectIsPreviewMode = createSelector(
|
|
|
1127
1130
|
selectCurrentQueryParams,
|
|
1128
1131
|
(params) => params.isPreview
|
|
1129
1132
|
);
|
|
1130
|
-
createSelector(
|
|
1133
|
+
var selectPaginationParams = createSelector(
|
|
1131
1134
|
selectCurrentQueryParams,
|
|
1132
1135
|
(params) => ({ limit: params.pagiLimit || 0, offset: params.pagiOffset || 0 })
|
|
1133
1136
|
);
|
|
@@ -1190,9 +1193,6 @@ var loadingActions = {
|
|
|
1190
1193
|
return { type: `${name3}/setLoadingState:${status}`, payload: message };
|
|
1191
1194
|
}
|
|
1192
1195
|
};
|
|
1193
|
-
function selectLoadingState(state) {
|
|
1194
|
-
return state[name3];
|
|
1195
|
-
}
|
|
1196
1196
|
function isFetchingAction(action) {
|
|
1197
1197
|
return action.type.endsWith(`:${LOADINGSTATUS.FETCHING}`);
|
|
1198
1198
|
}
|
|
@@ -1288,12 +1288,7 @@ function serializeStateToSearchParams(query) {
|
|
|
1288
1288
|
return [stringifyName(item)].concat(item.members).join(",");
|
|
1289
1289
|
}
|
|
1290
1290
|
function serializeDrilldown(item) {
|
|
1291
|
-
return [stringifyName(item)].concat(
|
|
1292
|
-
filterMap(
|
|
1293
|
-
item.properties,
|
|
1294
|
-
(prop) => isActiveItem(prop) ? prop.name : null
|
|
1295
|
-
)
|
|
1296
|
-
).join(",");
|
|
1291
|
+
return [stringifyName(item)].concat(filterMap(item.properties, (prop) => isActiveItem(prop) ? prop.name : null)).join(",");
|
|
1297
1292
|
}
|
|
1298
1293
|
function serializeFilter(item) {
|
|
1299
1294
|
const conditions = filterMap(
|
|
@@ -1357,9 +1352,9 @@ function parseStateFromSearchParams(query) {
|
|
|
1357
1352
|
}
|
|
1358
1353
|
function parseFilter(item) {
|
|
1359
1354
|
const [measure, ...comparisons] = item.split(",");
|
|
1360
|
-
const conditionOne = comparisons.slice(
|
|
1361
|
-
const conditionTwo = comparisons.length > 2 ? comparisons.slice(
|
|
1362
|
-
const joint = comparisons.length > 2 ? comparisons[
|
|
1355
|
+
const conditionOne = comparisons.slice(0, 3);
|
|
1356
|
+
const conditionTwo = comparisons.length > 2 ? comparisons.slice(3, 5) : void 0;
|
|
1357
|
+
const joint = comparisons.length > 2 ? comparisons[2] : void 0;
|
|
1363
1358
|
return buildFilter({
|
|
1364
1359
|
active: true,
|
|
1365
1360
|
measure,
|
|
@@ -1425,10 +1420,10 @@ function SettingsProvider(props) {
|
|
|
1425
1420
|
panels: props.panels,
|
|
1426
1421
|
previewLimit: props.previewLimit || 50
|
|
1427
1422
|
}), [props.formatters, props.previewLimit]);
|
|
1428
|
-
return /* @__PURE__ */
|
|
1423
|
+
return /* @__PURE__ */ React10__default.createElement(ContextProvider, { value }, props.children);
|
|
1429
1424
|
}
|
|
1430
1425
|
function SettingsConsumer(props) {
|
|
1431
|
-
return /* @__PURE__ */
|
|
1426
|
+
return /* @__PURE__ */ React10__default.createElement(ContextConsumer, null, useCallback((context) => {
|
|
1432
1427
|
if (context === void 0) {
|
|
1433
1428
|
throw new Error("SettingsConsumer must be used within a SettingsProvider.");
|
|
1434
1429
|
}
|
|
@@ -1474,6 +1469,14 @@ function applyQueryParams(query, params, settings) {
|
|
|
1474
1469
|
Object.values(params.cuts).forEach((item) => {
|
|
1475
1470
|
isActiveCut(item) && query.addCut(item, item.members);
|
|
1476
1471
|
});
|
|
1472
|
+
Object.values(params.filters).forEach((item) => {
|
|
1473
|
+
isActiveItem(item) && query.addFilter(
|
|
1474
|
+
item.measure,
|
|
1475
|
+
item.conditionOne,
|
|
1476
|
+
item.joint && item.conditionTwo ? item.joint : "",
|
|
1477
|
+
item.joint && item.conditionTwo ? item.conditionTwo : ""
|
|
1478
|
+
);
|
|
1479
|
+
});
|
|
1477
1480
|
Object.values(params.drilldowns).forEach((item) => {
|
|
1478
1481
|
if (!isActiveItem(item)) return;
|
|
1479
1482
|
query.addDrilldown(item);
|
|
@@ -1541,6 +1544,16 @@ function extractQueryParams(query) {
|
|
|
1541
1544
|
|
|
1542
1545
|
// src/state/utils.ts
|
|
1543
1546
|
init_esm_shims();
|
|
1547
|
+
var createCutHandler = (cuts, level, dispatch) => {
|
|
1548
|
+
const cutItem = Object.values(cuts).find((cut) => {
|
|
1549
|
+
return cut.uniqueName === level.uniqueName;
|
|
1550
|
+
});
|
|
1551
|
+
if (!cutItem) {
|
|
1552
|
+
const cutItem2 = buildCut({ ...level, key: level.uniqueName, members: [] });
|
|
1553
|
+
cutItem2.active = false;
|
|
1554
|
+
dispatch(actions.updateCut(cutItem2));
|
|
1555
|
+
}
|
|
1556
|
+
};
|
|
1544
1557
|
function calcMaxMemberCount(query, params, dispatch) {
|
|
1545
1558
|
const ds = query.cube.datasource;
|
|
1546
1559
|
ds.axiosInstance.defaults.responseType = void 0;
|
|
@@ -1550,28 +1563,24 @@ function calcMaxMemberCount(query, params, dispatch) {
|
|
|
1550
1563
|
});
|
|
1551
1564
|
const memberLengths = query.getParam("drilldowns").map(
|
|
1552
1565
|
(level) => Level.isLevel(level) ? drills[level.uniqueName] || ds.fetchMembers(level).then(async (members) => {
|
|
1553
|
-
const {
|
|
1554
|
-
const
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
const ddd = { ...dd, key: dd.fullName, dimType: dimension.dimensionType, memberCount: members.length, members };
|
|
1568
|
-
dispatch(actions.updateDrilldown(ddd));
|
|
1566
|
+
const { dimension } = level;
|
|
1567
|
+
const drilldown = Object.values(params.drilldowns).find(
|
|
1568
|
+
(d) => d.uniqueName === level.uniqueName
|
|
1569
|
+
);
|
|
1570
|
+
if (drilldown) {
|
|
1571
|
+
const ddd = {
|
|
1572
|
+
...drilldown,
|
|
1573
|
+
dimType: dimension.dimensionType,
|
|
1574
|
+
memberCount: members.length,
|
|
1575
|
+
members
|
|
1576
|
+
};
|
|
1577
|
+
dispatch(actions.updateDrilldown(ddd));
|
|
1578
|
+
createCutHandler(params.cuts, ddd, dispatch);
|
|
1579
|
+
}
|
|
1569
1580
|
return members.length;
|
|
1570
1581
|
}) : Promise.resolve(1)
|
|
1571
1582
|
);
|
|
1572
|
-
return Promise.all(memberLengths).then(
|
|
1573
|
-
(lengths) => lengths.reduce((prev, curr) => prev * curr)
|
|
1574
|
-
);
|
|
1583
|
+
return Promise.all(memberLengths).then((lengths) => lengths.reduce((prev, curr) => prev * curr));
|
|
1575
1584
|
}
|
|
1576
1585
|
function hydrateDrilldownProperties(cube, drilldownItem) {
|
|
1577
1586
|
const activeProperties = filterMap(
|
|
@@ -1585,17 +1594,98 @@ function hydrateDrilldownProperties(cube, drilldownItem) {
|
|
|
1585
1594
|
fullName: level.fullName,
|
|
1586
1595
|
uniqueName: level.uniqueName,
|
|
1587
1596
|
dimType: level.dimension.dimensionType,
|
|
1588
|
-
properties: level.properties.map(
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1597
|
+
properties: level.properties.map(
|
|
1598
|
+
(property) => buildProperty({
|
|
1599
|
+
active: activeProperties.includes(property.name),
|
|
1600
|
+
level: level.uniqueName,
|
|
1601
|
+
name: property.name,
|
|
1602
|
+
uniqueName: property.uniqueName
|
|
1603
|
+
})
|
|
1604
|
+
)
|
|
1594
1605
|
});
|
|
1595
1606
|
}
|
|
1596
1607
|
}
|
|
1597
1608
|
return drilldownItem;
|
|
1598
1609
|
}
|
|
1610
|
+
function deriveDrilldowns(dimensions) {
|
|
1611
|
+
const drilldowns = [];
|
|
1612
|
+
const findDefaultHierarchy = (d) => d.hierarchies.find((h) => h.name === d.defaultHierarchy);
|
|
1613
|
+
const timeDim = dimensions.find((d) => d.dimensionType === "time");
|
|
1614
|
+
if (timeDim) {
|
|
1615
|
+
const timeDrilldown = findDefaultHierarchy(timeDim).levels[0];
|
|
1616
|
+
drilldowns.push(timeDrilldown);
|
|
1617
|
+
}
|
|
1618
|
+
for (const dim of dimensions) {
|
|
1619
|
+
if (dim.type !== "time" && drilldowns.length < 4) {
|
|
1620
|
+
const { levels } = findDefaultHierarchy(dim);
|
|
1621
|
+
const levelIndex = dim.type === "geo" ? levels.length - 1 : 0;
|
|
1622
|
+
drilldowns.push(levels[levelIndex]);
|
|
1623
|
+
}
|
|
1624
|
+
}
|
|
1625
|
+
return drilldowns;
|
|
1626
|
+
}
|
|
1627
|
+
|
|
1628
|
+
// src/state/selectors.js
|
|
1629
|
+
init_esm_shims();
|
|
1630
|
+
var selectOlapCube = createSelector(
|
|
1631
|
+
[selectOlapCubeMap, selectCubeName],
|
|
1632
|
+
(cubeMap, cubeName) => cubeName in cubeMap ? cubeMap[cubeName] : void 0
|
|
1633
|
+
);
|
|
1634
|
+
var selectOlapMeasureItems = createSelector(
|
|
1635
|
+
selectOlapCube,
|
|
1636
|
+
(cube) => cube ? cube.measures : []
|
|
1637
|
+
);
|
|
1638
|
+
var selectOlapMeasureMap = createSelector(
|
|
1639
|
+
selectOlapMeasureItems,
|
|
1640
|
+
(measures) => Object.fromEntries(measures.map((item) => [item.name, item]))
|
|
1641
|
+
);
|
|
1642
|
+
var selectOlapDimensionItems = createSelector(
|
|
1643
|
+
selectOlapCube,
|
|
1644
|
+
(cube) => !cube ? [] : cube.dimensions.map((dim) => ({
|
|
1645
|
+
item: {
|
|
1646
|
+
...dim,
|
|
1647
|
+
hierarchies: dim.hierarchies.slice().map((hierarchy) => {
|
|
1648
|
+
hierarchy.levels.slice().sort(
|
|
1649
|
+
(a, b) => getOrderValue(a) - getOrderValue(b)
|
|
1650
|
+
);
|
|
1651
|
+
return hierarchy;
|
|
1652
|
+
}).sort(
|
|
1653
|
+
(a, b) => getOrderValue(a) - getOrderValue(b)
|
|
1654
|
+
)
|
|
1655
|
+
},
|
|
1656
|
+
count: dim.hierarchies.reduce((acc, hie) => acc + hie.levels.length, 0),
|
|
1657
|
+
alpha: dim.hierarchies.reduce((acc, hie) => acc.concat(hie.name, "-"), "")
|
|
1658
|
+
})).sort(
|
|
1659
|
+
(a, b) => getOrderValue(a.item) - getOrderValue(b.item) || b.count - a.count || a.alpha.localeCompare(b.alpha)
|
|
1660
|
+
).map((i) => i.item)
|
|
1661
|
+
);
|
|
1662
|
+
createSelector(
|
|
1663
|
+
selectOlapDimensionItems,
|
|
1664
|
+
(dimensions) => Object.fromEntries(dimensions.map((item) => [item.name, item]))
|
|
1665
|
+
);
|
|
1666
|
+
createSelector(
|
|
1667
|
+
selectOlapCube,
|
|
1668
|
+
(cube) => !cube ? {} : Object.fromEntries(
|
|
1669
|
+
cube.dimensions.flatMap(
|
|
1670
|
+
(dim) => dim.hierarchies.flatMap(
|
|
1671
|
+
(hie) => hie.levels.map((lvl) => {
|
|
1672
|
+
const fullName = [dim.name, hie.name, lvl.name].join(".");
|
|
1673
|
+
return tuple(fullName, triad(dim, hie, lvl));
|
|
1674
|
+
})
|
|
1675
|
+
)
|
|
1676
|
+
)
|
|
1677
|
+
)
|
|
1678
|
+
);
|
|
1679
|
+
createSelector(
|
|
1680
|
+
selectOlapDimensionItems,
|
|
1681
|
+
(dimensions) => dimensions.find(
|
|
1682
|
+
(d) => d.dimensionType === "time" || d.name === "Year" || d.name === "Date"
|
|
1683
|
+
)
|
|
1684
|
+
);
|
|
1685
|
+
var selectSerializedParams = createSelector(
|
|
1686
|
+
selectCurrentQueryParams,
|
|
1687
|
+
serializePermalink
|
|
1688
|
+
);
|
|
1599
1689
|
|
|
1600
1690
|
// src/state/thunks.ts
|
|
1601
1691
|
function willDownloadQuery(format2) {
|
|
@@ -1608,15 +1698,14 @@ function willDownloadQuery(format2) {
|
|
|
1608
1698
|
const axios = olapClient.datasource.axiosInstance;
|
|
1609
1699
|
return olapClient.getCube(params.cube).then((cube) => {
|
|
1610
1700
|
const filename = `${cube.name}_${(/* @__PURE__ */ new Date()).toISOString()}`;
|
|
1611
|
-
const
|
|
1701
|
+
const queryParams = { ...params, pagiLimit: 0, pagiOffset: 0 };
|
|
1702
|
+
const query = applyQueryParams(cube.query, queryParams, { previewLimit }).setFormat(format2);
|
|
1612
1703
|
const dataURL = query.toString("logiclayer").replace(olapClient.datasource.serverUrl, "");
|
|
1613
1704
|
return Promise.all([
|
|
1614
1705
|
axios({ url: dataURL, responseType: "blob" }).then((response) => response.data),
|
|
1615
1706
|
calcMaxMemberCount(query, params).then((maxRows) => {
|
|
1616
1707
|
if (maxRows > 5e4) {
|
|
1617
|
-
dispatch(
|
|
1618
|
-
loadingActions.setLoadingMessage({ type: "HEAVY_QUERY", rows: maxRows })
|
|
1619
|
-
);
|
|
1708
|
+
dispatch(loadingActions.setLoadingMessage({ type: "HEAVY_QUERY", rows: maxRows }));
|
|
1620
1709
|
}
|
|
1621
1710
|
})
|
|
1622
1711
|
]).then((result) => ({
|
|
@@ -1627,43 +1716,55 @@ function willDownloadQuery(format2) {
|
|
|
1627
1716
|
});
|
|
1628
1717
|
};
|
|
1629
1718
|
}
|
|
1630
|
-
function willExecuteQuery() {
|
|
1719
|
+
function willExecuteQuery({ limit, offset } = {}) {
|
|
1631
1720
|
return (dispatch, getState, { olapClient, previewLimit }) => {
|
|
1632
1721
|
const state = getState();
|
|
1633
1722
|
const params = selectCurrentQueryParams(state);
|
|
1634
1723
|
const endpoint = selectServerEndpoint(state);
|
|
1724
|
+
const isPrefetch = limit && offset;
|
|
1725
|
+
const allParams = isPrefetch ? { ...params, pagiLimit: limit, pagiOffset: offset } : params;
|
|
1726
|
+
const { result: currentResult } = selectCurrentQueryItem(state);
|
|
1635
1727
|
if (!isValidQuery(params)) return Promise.resolve();
|
|
1636
1728
|
return olapClient.getCube(params.cube).then((cube) => {
|
|
1637
|
-
const query = applyQueryParams(cube.query,
|
|
1729
|
+
const query = applyQueryParams(cube.query, allParams, { previewLimit });
|
|
1638
1730
|
return Promise.all([
|
|
1639
1731
|
olapClient.execQuery(query, endpoint),
|
|
1640
|
-
calcMaxMemberCount(query,
|
|
1732
|
+
calcMaxMemberCount(query, allParams, dispatch).then((maxRows) => {
|
|
1641
1733
|
if (maxRows > 5e4) {
|
|
1642
1734
|
dispatch(loadingActions.setLoadingMessage({ type: "HEAVY_QUERY", rows: maxRows }));
|
|
1643
1735
|
}
|
|
1644
1736
|
})
|
|
1645
|
-
]).then(
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1737
|
+
]).then(
|
|
1738
|
+
(result) => {
|
|
1739
|
+
const [aggregation] = result;
|
|
1740
|
+
!isPrefetch && dispatch(
|
|
1741
|
+
queriesActions.updateResult({
|
|
1742
|
+
data: aggregation.data,
|
|
1743
|
+
types: aggregation.data.length ? describeData(cube.toJSON(), params, aggregation.data) : currentResult.types,
|
|
1744
|
+
headers: { ...aggregation.headers },
|
|
1745
|
+
sourceCall: query.toSource(),
|
|
1746
|
+
status: aggregation.status || 500,
|
|
1747
|
+
url: query.toString(endpoint)
|
|
1748
|
+
})
|
|
1749
|
+
);
|
|
1750
|
+
return {
|
|
1649
1751
|
data: aggregation.data,
|
|
1650
|
-
types: describeData(cube.toJSON(), params, aggregation.data)
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
});
|
|
1752
|
+
types: aggregation.data.length ? describeData(cube.toJSON(), params, aggregation.data) : currentResult.types
|
|
1753
|
+
};
|
|
1754
|
+
},
|
|
1755
|
+
(error) => {
|
|
1756
|
+
var _a, _b;
|
|
1757
|
+
dispatch(
|
|
1758
|
+
queriesActions.updateResult({
|
|
1759
|
+
data: [],
|
|
1760
|
+
types: {},
|
|
1761
|
+
error: error.message,
|
|
1762
|
+
status: (_b = (_a = error == null ? void 0 : error.response) == null ? void 0 : _a.status) != null ? _b : 500,
|
|
1763
|
+
url: query.toString(endpoint)
|
|
1764
|
+
})
|
|
1765
|
+
);
|
|
1766
|
+
}
|
|
1767
|
+
);
|
|
1667
1768
|
});
|
|
1668
1769
|
};
|
|
1669
1770
|
}
|
|
@@ -1695,11 +1796,15 @@ function willHydrateParams(suggestedCube) {
|
|
|
1695
1796
|
Object.keys(cubeMap)[0]
|
|
1696
1797
|
);
|
|
1697
1798
|
return olapClient.getCube(cubeName).then((cube) => {
|
|
1698
|
-
const resolvedMeasures = cube.measures.map(
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1799
|
+
const resolvedMeasures = cube.measures.map(
|
|
1800
|
+
(measure) => buildMeasure(
|
|
1801
|
+
measureItems[measure.name] || {
|
|
1802
|
+
active: false,
|
|
1803
|
+
key: measure.name,
|
|
1804
|
+
name: measure.name
|
|
1805
|
+
}
|
|
1806
|
+
)
|
|
1807
|
+
);
|
|
1703
1808
|
const resolvedDrilldowns = filterMap(
|
|
1704
1809
|
Object.values(params.drilldowns),
|
|
1705
1810
|
(item) => hydrateDrilldownProperties(cube, item) || null
|
|
@@ -1724,6 +1829,7 @@ function willHydrateParams(suggestedCube) {
|
|
|
1724
1829
|
}
|
|
1725
1830
|
function willParseQueryUrl(url) {
|
|
1726
1831
|
return (dispatch, getState, { olapClient }) => olapClient.parseQueryURL(url.toString(), { anyServer: true }).then((query) => {
|
|
1832
|
+
extractQueryParams(query);
|
|
1727
1833
|
const queryItem = buildQuery({
|
|
1728
1834
|
params: extractQueryParams(query)
|
|
1729
1835
|
});
|
|
@@ -1748,11 +1854,14 @@ function willRequestQuery() {
|
|
|
1748
1854
|
const params = selectCurrentQueryParams(state);
|
|
1749
1855
|
if (!isValidQuery(params)) return Promise.resolve();
|
|
1750
1856
|
dispatch(loadingActions.setLoadingState("FETCHING"));
|
|
1751
|
-
return dispatch(willExecuteQuery()).then(
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1857
|
+
return dispatch(willExecuteQuery()).then(
|
|
1858
|
+
() => {
|
|
1859
|
+
dispatch(loadingActions.setLoadingState("SUCCESS"));
|
|
1860
|
+
},
|
|
1861
|
+
(error) => {
|
|
1862
|
+
dispatch(loadingActions.setLoadingState("FAILURE", error.message));
|
|
1863
|
+
}
|
|
1864
|
+
);
|
|
1756
1865
|
};
|
|
1757
1866
|
}
|
|
1758
1867
|
function willSetCube(cubeName) {
|
|
@@ -1764,15 +1873,22 @@ function willSetCube(cubeName) {
|
|
|
1764
1873
|
(item) => item.active ? item.name : null
|
|
1765
1874
|
);
|
|
1766
1875
|
return olapClient.getCube(cubeName).then((cube) => {
|
|
1767
|
-
const measures = filterMap(
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1876
|
+
const measures = filterMap(
|
|
1877
|
+
cube.measures,
|
|
1878
|
+
(measure) => buildMeasure({
|
|
1879
|
+
active: currentActiveMeasures.includes(measure.name),
|
|
1880
|
+
key: measure.name,
|
|
1881
|
+
name: measure.name
|
|
1882
|
+
})
|
|
1883
|
+
);
|
|
1884
|
+
dispatch(
|
|
1885
|
+
queriesActions.updateCube({
|
|
1886
|
+
cube: cube.name,
|
|
1887
|
+
measures: keyBy(measures, (item) => item.key)
|
|
1888
|
+
})
|
|
1889
|
+
);
|
|
1890
|
+
const dimensions = selectOlapDimensionItems(getState());
|
|
1891
|
+
return { cube, measures, dimensions };
|
|
1776
1892
|
});
|
|
1777
1893
|
};
|
|
1778
1894
|
}
|
|
@@ -1780,23 +1896,30 @@ function willSetupClient(serverConfig) {
|
|
|
1780
1896
|
return (dispatch, getState, { olapClient: client }) => Client.dataSourceFromURL(serverConfig).then((datasource) => {
|
|
1781
1897
|
client.setDataSource(datasource);
|
|
1782
1898
|
return client.checkStatus();
|
|
1783
|
-
}).then(
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1899
|
+
}).then(
|
|
1900
|
+
(serverInfo) => {
|
|
1901
|
+
dispatch(
|
|
1902
|
+
serverActions.updateServer({
|
|
1903
|
+
online: serverInfo.online,
|
|
1904
|
+
software: serverInfo.software,
|
|
1905
|
+
url: serverInfo.url,
|
|
1906
|
+
version: serverInfo.version,
|
|
1907
|
+
endpoint: serverInfo.software === TesseractDataSource.softwareName ? "logiclayer" : "aggregate"
|
|
1908
|
+
})
|
|
1909
|
+
);
|
|
1910
|
+
},
|
|
1911
|
+
(error) => {
|
|
1912
|
+
dispatch(
|
|
1913
|
+
serverActions.updateServer({
|
|
1914
|
+
online: false,
|
|
1915
|
+
software: "",
|
|
1916
|
+
url: error.config.url,
|
|
1917
|
+
version: ""
|
|
1918
|
+
})
|
|
1919
|
+
);
|
|
1920
|
+
throw error;
|
|
1921
|
+
}
|
|
1922
|
+
);
|
|
1800
1923
|
}
|
|
1801
1924
|
|
|
1802
1925
|
// src/state/index.ts
|
|
@@ -1812,7 +1935,7 @@ init_esm_shims();
|
|
|
1812
1935
|
|
|
1813
1936
|
// src/hooks/setup.js
|
|
1814
1937
|
init_esm_shims();
|
|
1815
|
-
function useSetup(serverConfig, locale) {
|
|
1938
|
+
function useSetup(serverConfig, locale, defaultCube) {
|
|
1816
1939
|
const actions2 = useActions();
|
|
1817
1940
|
const [done, setDone] = useState(false);
|
|
1818
1941
|
const cleanLocale = useMemo(
|
|
@@ -1845,20 +1968,23 @@ function useSetup(serverConfig, locale) {
|
|
|
1845
1968
|
query = buildQuery({ params: { ...historyState } });
|
|
1846
1969
|
}
|
|
1847
1970
|
if (!query || !hasOwnProperty(cubeMap, query.params.cube)) {
|
|
1848
|
-
const
|
|
1849
|
-
return actions2.willHydrateParams(
|
|
1971
|
+
const cube = defaultCube && hasOwnProperty(cubeMap, defaultCube) ? defaultCube : Object.keys(cubeMap)[0];
|
|
1972
|
+
return actions2.willHydrateParams(cube);
|
|
1850
1973
|
}
|
|
1851
1974
|
query.params.locale = query.params.locale || cleanLocale[0];
|
|
1852
1975
|
actions2.resetQueries({ [query.key]: query });
|
|
1853
|
-
return actions2.willHydrateParams()
|
|
1854
|
-
}).then(
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1976
|
+
return actions2.willHydrateParams();
|
|
1977
|
+
}).then(
|
|
1978
|
+
() => {
|
|
1979
|
+
actions2.setLoadingState("SUCCESS");
|
|
1980
|
+
setDone(true);
|
|
1981
|
+
},
|
|
1982
|
+
(error) => {
|
|
1983
|
+
console.dir("There was an error during setup:", error);
|
|
1984
|
+
actions2.setLoadingState("FAILURE", error.message);
|
|
1985
|
+
setDone(true);
|
|
1986
|
+
}
|
|
1987
|
+
);
|
|
1862
1988
|
}, [serverConfig]);
|
|
1863
1989
|
return done;
|
|
1864
1990
|
}
|
|
@@ -1913,7 +2039,7 @@ var defaultProps = {
|
|
|
1913
2039
|
function AnimatedCube(props) {
|
|
1914
2040
|
const { color, shade } = useComponentDefaultProps(AnimatedCube.displayName, defaultProps, props);
|
|
1915
2041
|
const { classes, cx } = useStyles({ color, shade });
|
|
1916
|
-
return /* @__PURE__ */
|
|
2042
|
+
return /* @__PURE__ */ React10__default.createElement(
|
|
1917
2043
|
"svg",
|
|
1918
2044
|
{
|
|
1919
2045
|
className: cx("dataex-Anicube-root", classes.root),
|
|
@@ -1921,12 +2047,12 @@ function AnimatedCube(props) {
|
|
|
1921
2047
|
viewBox: "0 0 256 256",
|
|
1922
2048
|
height: props.size || 256
|
|
1923
2049
|
},
|
|
1924
|
-
/* @__PURE__ */
|
|
1925
|
-
/* @__PURE__ */
|
|
1926
|
-
/* @__PURE__ */
|
|
1927
|
-
/* @__PURE__ */
|
|
1928
|
-
/* @__PURE__ */
|
|
1929
|
-
/* @__PURE__ */
|
|
2050
|
+
/* @__PURE__ */ React10__default.createElement("path", { className: cx("dataex-Anicube-side", classes.side, "a"), d: "M128 128v128l111 -64v-128l-111 64z" }),
|
|
2051
|
+
/* @__PURE__ */ React10__default.createElement("path", { className: cx("dataex-Anicube-side", classes.side, "b"), d: "M128 128l111 -64l-111 -64l-111 64l111 64z" }),
|
|
2052
|
+
/* @__PURE__ */ React10__default.createElement("path", { className: cx("dataex-Anicube-side", classes.side, "c"), d: "M128 128l-111 -64v128l111 64v-128z" }),
|
|
2053
|
+
/* @__PURE__ */ React10__default.createElement("path", { className: cx("dataex-Anicube-side", classes.side, "a"), d: "M128 128v-64l-55 32v64l55 -32z" }),
|
|
2054
|
+
/* @__PURE__ */ React10__default.createElement("path", { className: cx("dataex-Anicube-side", classes.side, "b"), d: "M128 128l-55 32l55 32l55 -32l-55 -32z" }),
|
|
2055
|
+
/* @__PURE__ */ React10__default.createElement("path", { className: cx("dataex-Anicube-side", classes.side, "c"), d: "M128 128l55 32v-64l-55 -32v64z" })
|
|
1930
2056
|
);
|
|
1931
2057
|
}
|
|
1932
2058
|
AnimatedCube.displayName = "DataExplorer/Anicube";
|
|
@@ -1934,68 +2060,6 @@ AnimatedCube.displayName = "DataExplorer/Anicube";
|
|
|
1934
2060
|
// src/components/ExplorerResults.tsx
|
|
1935
2061
|
init_esm_shims();
|
|
1936
2062
|
|
|
1937
|
-
// src/state/selectors.js
|
|
1938
|
-
init_esm_shims();
|
|
1939
|
-
var selectOlapCube = createSelector(
|
|
1940
|
-
[selectOlapCubeMap, selectCubeName],
|
|
1941
|
-
(cubeMap, cubeName) => cubeName in cubeMap ? cubeMap[cubeName] : void 0
|
|
1942
|
-
);
|
|
1943
|
-
var selectOlapMeasureItems = createSelector(
|
|
1944
|
-
selectOlapCube,
|
|
1945
|
-
(cube) => cube ? cube.measures : []
|
|
1946
|
-
);
|
|
1947
|
-
var selectOlapMeasureMap = createSelector(
|
|
1948
|
-
selectOlapMeasureItems,
|
|
1949
|
-
(measures) => Object.fromEntries(measures.map((item) => [item.name, item]))
|
|
1950
|
-
);
|
|
1951
|
-
var selectOlapDimensionItems = createSelector(
|
|
1952
|
-
selectOlapCube,
|
|
1953
|
-
(cube) => !cube ? [] : cube.dimensions.map((dim) => ({
|
|
1954
|
-
item: {
|
|
1955
|
-
...dim,
|
|
1956
|
-
hierarchies: dim.hierarchies.slice().map((hierarchy) => {
|
|
1957
|
-
hierarchy.levels.slice().sort(
|
|
1958
|
-
(a, b) => getOrderValue(a) - getOrderValue(b)
|
|
1959
|
-
);
|
|
1960
|
-
return hierarchy;
|
|
1961
|
-
}).sort(
|
|
1962
|
-
(a, b) => getOrderValue(a) - getOrderValue(b)
|
|
1963
|
-
)
|
|
1964
|
-
},
|
|
1965
|
-
count: dim.hierarchies.reduce((acc, hie) => acc + hie.levels.length, 0),
|
|
1966
|
-
alpha: dim.hierarchies.reduce((acc, hie) => acc.concat(hie.name, "-"), "")
|
|
1967
|
-
})).sort(
|
|
1968
|
-
(a, b) => getOrderValue(a.item) - getOrderValue(b.item) || b.count - a.count || a.alpha.localeCompare(b.alpha)
|
|
1969
|
-
).map((i) => i.item)
|
|
1970
|
-
);
|
|
1971
|
-
createSelector(
|
|
1972
|
-
selectOlapDimensionItems,
|
|
1973
|
-
(dimensions) => Object.fromEntries(dimensions.map((item) => [item.name, item]))
|
|
1974
|
-
);
|
|
1975
|
-
createSelector(
|
|
1976
|
-
selectOlapCube,
|
|
1977
|
-
(cube) => !cube ? {} : Object.fromEntries(
|
|
1978
|
-
cube.dimensions.flatMap(
|
|
1979
|
-
(dim) => dim.hierarchies.flatMap(
|
|
1980
|
-
(hie) => hie.levels.map((lvl) => {
|
|
1981
|
-
const fullName = [dim.name, hie.name, lvl.name].join(".");
|
|
1982
|
-
return tuple(fullName, triad(dim, hie, lvl));
|
|
1983
|
-
})
|
|
1984
|
-
)
|
|
1985
|
-
)
|
|
1986
|
-
)
|
|
1987
|
-
);
|
|
1988
|
-
createSelector(
|
|
1989
|
-
selectOlapDimensionItems,
|
|
1990
|
-
(dimensions) => dimensions.find(
|
|
1991
|
-
(d) => d.dimensionType === "time" || d.name === "Year" || d.name === "Date"
|
|
1992
|
-
)
|
|
1993
|
-
);
|
|
1994
|
-
var selectSerializedParams = createSelector(
|
|
1995
|
-
selectCurrentQueryParams,
|
|
1996
|
-
serializePermalink
|
|
1997
|
-
);
|
|
1998
|
-
|
|
1999
2063
|
// src/components/PreviewModeSwitch.jsx
|
|
2000
2064
|
init_esm_shims();
|
|
2001
2065
|
var PreviewModeSwitch = (props) => {
|
|
@@ -2011,17 +2075,17 @@ var PreviewModeSwitch = (props) => {
|
|
|
2011
2075
|
const onClickLoadAllResults = useCallback(() => {
|
|
2012
2076
|
actions2.updateIsPreview(!isPreviewMode);
|
|
2013
2077
|
}, [isPreviewMode]);
|
|
2014
|
-
const target = /* @__PURE__ */
|
|
2078
|
+
const target = /* @__PURE__ */ React10__default.createElement(
|
|
2015
2079
|
Switch,
|
|
2016
2080
|
{
|
|
2017
2081
|
checked: !isPreviewMode,
|
|
2018
2082
|
styles: { label: { display: "flex", alignContent: "center", gap: "0.25rem" } },
|
|
2019
|
-
label: /* @__PURE__ */
|
|
2083
|
+
label: /* @__PURE__ */ React10__default.createElement(React10__default.Fragment, null, t("params.label_boolean_full_results"), withTooltip && /* @__PURE__ */ React10__default.createElement(ThemeIcon, { variant: "subtle", size: "sm" }, /* @__PURE__ */ React10__default.createElement(IconInfoCircleFilled, null))),
|
|
2020
2084
|
onChange: onClickLoadAllResults
|
|
2021
2085
|
}
|
|
2022
2086
|
);
|
|
2023
2087
|
if (!withTooltip) return target;
|
|
2024
|
-
return /* @__PURE__ */
|
|
2088
|
+
return /* @__PURE__ */ React10__default.createElement(
|
|
2025
2089
|
Tooltip,
|
|
2026
2090
|
{
|
|
2027
2091
|
events: {
|
|
@@ -2034,7 +2098,7 @@ var PreviewModeSwitch = (props) => {
|
|
|
2034
2098
|
withArrow: true,
|
|
2035
2099
|
withinPortal: true
|
|
2036
2100
|
},
|
|
2037
|
-
/* @__PURE__ */
|
|
2101
|
+
/* @__PURE__ */ React10__default.createElement("div", null, target)
|
|
2038
2102
|
);
|
|
2039
2103
|
};
|
|
2040
2104
|
|
|
@@ -2099,59 +2163,50 @@ function useFormatter(measures) {
|
|
|
2099
2163
|
// src/components/icons/index.tsx
|
|
2100
2164
|
init_esm_shims();
|
|
2101
2165
|
function IconChevronLeft() {
|
|
2102
|
-
return /* @__PURE__ */
|
|
2166
|
+
return /* @__PURE__ */ React10__default.createElement("svg", { width: "9", height: "13", viewBox: "0 0 6 11", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ React10__default.createElement("path", { d: "M5.5 1L1 5.5L5.5 10", stroke: "black", strokeLinecap: "round" }));
|
|
2103
2167
|
}
|
|
2104
2168
|
function IconChevronRight() {
|
|
2105
|
-
return /* @__PURE__ */
|
|
2169
|
+
return /* @__PURE__ */ React10__default.createElement("svg", { width: "9", height: "13", viewBox: "0 0 7 11", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ React10__default.createElement("path", { d: "M1 10L5.5 5.5L1 1", stroke: "black", strokeLinecap: "round" }));
|
|
2106
2170
|
}
|
|
2107
2171
|
function DataSetSVG() {
|
|
2108
|
-
return /* @__PURE__ */
|
|
2109
|
-
"
|
|
2110
|
-
{
|
|
2111
|
-
d: "M3.33325 5C3.33325 5.66304 4.03563 6.29893 5.28587 6.76777C6.53612 7.23661 8.23181 7.5 9.99992 7.5C11.768 7.5 13.4637 7.23661 14.714 6.76777C15.9642 6.29893 16.6666 5.66304 16.6666 5C16.6666 4.33696 15.9642 3.70107 14.714 3.23223C13.4637 2.76339 11.768 2.5 9.99992 2.5C8.23181 2.5 6.53612 2.76339 5.28587 3.23223C4.03563 3.70107 3.33325 4.33696 3.33325 5Z",
|
|
2112
|
-
stroke: "#212529",
|
|
2113
|
-
strokeLinecap: "round",
|
|
2114
|
-
strokeLinejoin: "round"
|
|
2115
|
-
}
|
|
2116
|
-
), /* @__PURE__ */ React13__default.createElement(
|
|
2117
|
-
"path",
|
|
2118
|
-
{
|
|
2119
|
-
d: "M3.33325 5V10C3.33325 10.663 4.03563 11.2989 5.28587 11.7678C6.53612 12.2366 8.23181 12.5 9.99992 12.5C11.768 12.5 13.4637 12.2366 14.714 11.7678C15.9642 11.2989 16.6666 10.663 16.6666 10V5",
|
|
2120
|
-
stroke: "#212529",
|
|
2121
|
-
strokeLinecap: "round",
|
|
2122
|
-
strokeLinejoin: "round"
|
|
2123
|
-
}
|
|
2124
|
-
), /* @__PURE__ */ React13__default.createElement(
|
|
2125
|
-
"path",
|
|
2126
|
-
{
|
|
2127
|
-
d: "M3.33325 10V15C3.33325 15.663 4.03563 16.2989 5.28587 16.7678C6.53612 17.2366 8.23181 17.5 9.99992 17.5C11.768 17.5 13.4637 17.2366 14.714 16.7678C15.9642 16.2989 16.6666 15.663 16.6666 15V10",
|
|
2128
|
-
stroke: "#212529",
|
|
2129
|
-
strokeLinecap: "round",
|
|
2130
|
-
strokeLinejoin: "round"
|
|
2131
|
-
}
|
|
2132
|
-
));
|
|
2133
|
-
}
|
|
2134
|
-
function HomeSVG() {
|
|
2135
|
-
return /* @__PURE__ */ React13__default.createElement("svg", { width: "22", height: "24", viewBox: "0 0 16 18", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ React13__default.createElement(
|
|
2136
|
-
"path",
|
|
2137
|
-
{
|
|
2138
|
-
d: "M2 16H5V10H11V16H14V7L8 2.5L2 7V16ZM0 18V6L8 0L16 6V18H9V12H7V18H0Z",
|
|
2139
|
-
fill: "#545454"
|
|
2140
|
-
}
|
|
2141
|
-
));
|
|
2142
|
-
}
|
|
2143
|
-
function PlusSVG() {
|
|
2144
|
-
const theme = useMantineTheme();
|
|
2145
|
-
return /* @__PURE__ */ React13__default.createElement("svg", { width: "35", height: "37", viewBox: "0 0 26 29", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ React13__default.createElement("circle", { cx: "13", cy: "12", r: "12", fill: theme.colors[theme.primaryColor][5] }), /* @__PURE__ */ React13__default.createElement(
|
|
2146
|
-
"path",
|
|
2172
|
+
return /* @__PURE__ */ React10__default.createElement(
|
|
2173
|
+
"svg",
|
|
2147
2174
|
{
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2175
|
+
width: "25",
|
|
2176
|
+
height: "25",
|
|
2177
|
+
viewBox: "0 0 20 20",
|
|
2178
|
+
fill: "none",
|
|
2179
|
+
stroke: "currentColor",
|
|
2180
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
2181
|
+
},
|
|
2182
|
+
/* @__PURE__ */ React10__default.createElement(
|
|
2183
|
+
"path",
|
|
2184
|
+
{
|
|
2185
|
+
d: "M3.33325 5C3.33325 5.66304 4.03563 6.29893 5.28587 6.76777C6.53612 7.23661 8.23181 7.5 9.99992 7.5C11.768 7.5 13.4637 7.23661 14.714 6.76777C15.9642 6.29893 16.6666 5.66304 16.6666 5C16.6666 4.33696 15.9642 3.70107 14.714 3.23223C13.4637 2.76339 11.768 2.5 9.99992 2.5C8.23181 2.5 6.53612 2.76339 5.28587 3.23223C4.03563 3.70107 3.33325 4.33696 3.33325 5Z",
|
|
2186
|
+
strokeLinecap: "round",
|
|
2187
|
+
strokeLinejoin: "round"
|
|
2188
|
+
}
|
|
2189
|
+
),
|
|
2190
|
+
/* @__PURE__ */ React10__default.createElement(
|
|
2191
|
+
"path",
|
|
2192
|
+
{
|
|
2193
|
+
d: "M3.33325 5V10C3.33325 10.663 4.03563 11.2989 5.28587 11.7678C6.53612 12.2366 8.23181 12.5 9.99992 12.5C11.768 12.5 13.4637 12.2366 14.714 11.7678C15.9642 11.2989 16.6666 10.663 16.6666 10V5",
|
|
2194
|
+
strokeLinecap: "round",
|
|
2195
|
+
strokeLinejoin: "round"
|
|
2196
|
+
}
|
|
2197
|
+
),
|
|
2198
|
+
/* @__PURE__ */ React10__default.createElement(
|
|
2199
|
+
"path",
|
|
2200
|
+
{
|
|
2201
|
+
d: "M3.33325 10V15C3.33325 15.663 4.03563 16.2989 5.28587 16.7678C6.53612 17.2366 8.23181 17.5 9.99992 17.5C11.768 17.5 13.4637 17.2366 14.714 16.7678C15.9642 16.2989 16.6666 15.663 16.6666 15V10",
|
|
2202
|
+
strokeLinecap: "round",
|
|
2203
|
+
strokeLinejoin: "round"
|
|
2204
|
+
}
|
|
2205
|
+
)
|
|
2206
|
+
);
|
|
2152
2207
|
}
|
|
2153
2208
|
function StackSVG() {
|
|
2154
|
-
return /* @__PURE__ */
|
|
2209
|
+
return /* @__PURE__ */ React10__default.createElement(
|
|
2155
2210
|
"svg",
|
|
2156
2211
|
{
|
|
2157
2212
|
width: "15",
|
|
@@ -2160,12 +2215,12 @@ function StackSVG() {
|
|
|
2160
2215
|
fill: "currentColor",
|
|
2161
2216
|
xmlns: "http://www.w3.org/2000/svg"
|
|
2162
2217
|
},
|
|
2163
|
-
/* @__PURE__ */
|
|
2164
|
-
/* @__PURE__ */
|
|
2218
|
+
/* @__PURE__ */ React10__default.createElement("path", { d: "M14 3.38826C14 1.87066 10.7949 0.588257 7 0.588257C3.20513 0.588257 0 1.87066 0 3.38826V4.78826C0 6.30586 3.20513 7.58826 7 7.58826C10.7949 7.58826 14 6.30586 14 4.78826V3.38826ZM7 12.4883C3.20513 12.4883 0 11.2059 0 9.68826V11.7883C0 13.3059 3.20513 14.5883 7 14.5883C10.7949 14.5883 14 13.3059 14 11.7883V9.68826C14 11.2059 10.7949 12.4883 7 12.4883Z" }),
|
|
2219
|
+
/* @__PURE__ */ React10__default.createElement("path", { d: "M14 6.18823C14 7.70583 10.7949 8.98823 7 8.98823C3.20513 8.98823 0 7.70583 0 6.18823V8.28823C0 9.80583 3.20513 11.0882 7 11.0882C10.7949 11.0882 14 9.80583 14 8.28823V6.18823Z" })
|
|
2165
2220
|
);
|
|
2166
2221
|
}
|
|
2167
2222
|
function BarsSVG() {
|
|
2168
|
-
return /* @__PURE__ */
|
|
2223
|
+
return /* @__PURE__ */ React10__default.createElement(
|
|
2169
2224
|
"svg",
|
|
2170
2225
|
{
|
|
2171
2226
|
width: "15",
|
|
@@ -2174,301 +2229,82 @@ function BarsSVG() {
|
|
|
2174
2229
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2175
2230
|
fill: "currentColor"
|
|
2176
2231
|
},
|
|
2177
|
-
/* @__PURE__ */
|
|
2232
|
+
/* @__PURE__ */ React10__default.createElement("path", { d: "M3.78947 9.6H0.631579V4.8H3.78947V9.6ZM7.57895 9.6H4.42105V2.4H7.57895V9.6ZM11.3684 9.6H8.21053V0H11.3684V9.6ZM12 12H0V10.8H12V12Z" })
|
|
2178
2233
|
);
|
|
2179
2234
|
}
|
|
2180
2235
|
function SearchSVG() {
|
|
2181
|
-
return /* @__PURE__ */
|
|
2236
|
+
return /* @__PURE__ */ React10__default.createElement("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ React10__default.createElement("g", { clipPath: "url(#clip0_905_15769)" }, /* @__PURE__ */ React10__default.createElement(
|
|
2237
|
+
"path",
|
|
2238
|
+
{
|
|
2239
|
+
d: "M2.25 7.5C2.25 8.18944 2.3858 8.87213 2.64963 9.50909C2.91347 10.146 3.30018 10.7248 3.78769 11.2123C4.2752 11.6998 4.85395 12.0865 5.49091 12.3504C6.12787 12.6142 6.81056 12.75 7.5 12.75C8.18944 12.75 8.87213 12.6142 9.50909 12.3504C10.146 12.0865 10.7248 11.6998 11.2123 11.2123C11.6998 10.7248 12.0865 10.146 12.3504 9.50909C12.6142 8.87213 12.75 8.18944 12.75 7.5C12.75 6.81056 12.6142 6.12787 12.3504 5.49091C12.0865 4.85395 11.6998 4.2752 11.2123 3.78769C10.7248 3.30018 10.146 2.91347 9.50909 2.64963C8.87213 2.3858 8.18944 2.25 7.5 2.25C6.81056 2.25 6.12787 2.3858 5.49091 2.64963C4.85395 2.91347 4.2752 3.30018 3.78769 3.78769C3.30018 4.2752 2.91347 4.85395 2.64963 5.49091C2.3858 6.12787 2.25 6.81056 2.25 7.5Z",
|
|
2240
|
+
stroke: "black",
|
|
2241
|
+
strokeLinecap: "round",
|
|
2242
|
+
strokeLinejoin: "round"
|
|
2243
|
+
}
|
|
2244
|
+
), /* @__PURE__ */ React10__default.createElement(
|
|
2245
|
+
"path",
|
|
2246
|
+
{
|
|
2247
|
+
d: "M15.75 15.75L11.25 11.25",
|
|
2248
|
+
stroke: "black",
|
|
2249
|
+
strokeLinecap: "round",
|
|
2250
|
+
strokeLinejoin: "round"
|
|
2251
|
+
}
|
|
2252
|
+
)), /* @__PURE__ */ React10__default.createElement("defs", null, /* @__PURE__ */ React10__default.createElement("clipPath", { id: "clip0_905_15769" }, /* @__PURE__ */ React10__default.createElement("rect", { width: "18", height: "18", fill: "white" }))));
|
|
2182
2253
|
}
|
|
2183
2254
|
function FullScreenSVG() {
|
|
2184
|
-
return /* @__PURE__ */
|
|
2185
|
-
|
|
2186
|
-
function ClearSVG() {
|
|
2187
|
-
return /* @__PURE__ */ React13__default.createElement("svg", { width: "17", height: "16", viewBox: "0 0 17 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ React13__default.createElement("g", { "clip-path": "url(#clip0_1545_1134)" }, /* @__PURE__ */ React13__default.createElement("path", { d: "M13.4072 10.6882C13.9751 9.56054 14.172 8.28312 13.9697 7.03754C13.7675 5.79196 13.1766 4.64164 12.2808 3.75013C11.3851 2.85861 10.2303 2.27129 8.98048 2.07166C7.73068 1.87204 6.44956 2.07028 5.31928 2.63819M3.7671 3.75952C2.63879 4.88519 2.00527 6.41157 2.0059 8.00288C2.00652 9.59419 2.64125 11.1201 3.77044 12.2449C4.89964 13.3696 6.4308 14.0012 8.02709 14.0006C9.62339 13.9999 11.1541 13.3672 12.2824 12.2415", stroke: "black", "stroke-linecap": "round", "stroke-linejoin": "round" }), /* @__PURE__ */ React13__default.createElement("path", { d: "M2.00626 2L14.0439 14", stroke: "black", "stroke-linecap": "round", "stroke-linejoin": "round" })), /* @__PURE__ */ React13__default.createElement("defs", null, /* @__PURE__ */ React13__default.createElement("clipPath", { id: "clip0_1545_1134" }, /* @__PURE__ */ React13__default.createElement("rect", { width: "16.0501", height: "16", fill: "white" }))));
|
|
2188
|
-
}
|
|
2189
|
-
|
|
2190
|
-
// src/components/OptionsMenu.tsx
|
|
2191
|
-
init_esm_shims();
|
|
2192
|
-
|
|
2193
|
-
// src/components/MenuDimension.jsx
|
|
2194
|
-
init_esm_shims();
|
|
2195
|
-
|
|
2196
|
-
// src/utils/format.js
|
|
2197
|
-
init_esm_shims();
|
|
2198
|
-
function abbreviateFullName(nameParts, joint = "/") {
|
|
2199
|
-
if (!nameParts) {
|
|
2200
|
-
return "";
|
|
2201
|
-
}
|
|
2202
|
-
if (typeof nameParts === "string") {
|
|
2203
|
-
nameParts = splitName(nameParts);
|
|
2204
|
-
}
|
|
2205
|
-
const target = [];
|
|
2206
|
-
let n = nameParts.length;
|
|
2207
|
-
while (n--) {
|
|
2208
|
-
const token = nameParts[n];
|
|
2209
|
-
if (target.indexOf(token) === -1) {
|
|
2210
|
-
target.unshift(token);
|
|
2211
|
-
}
|
|
2212
|
-
}
|
|
2213
|
-
return target.join(joint);
|
|
2214
|
-
}
|
|
2215
|
-
|
|
2216
|
-
// src/components/MenuDimension.jsx
|
|
2217
|
-
var DimensionMenu = (props) => {
|
|
2218
|
-
const dimensions = useSelector$1(selectOlapDimensionItems) || [];
|
|
2219
|
-
const locale = useSelector$1(selectLocale);
|
|
2220
|
-
const options = useMemo(
|
|
2221
|
-
() => dimensions.map((dim) => /* @__PURE__ */ React13__default.createElement(
|
|
2222
|
-
DimensionMenuItem,
|
|
2223
|
-
{
|
|
2224
|
-
dimension: dim,
|
|
2225
|
-
locale: locale.code,
|
|
2226
|
-
isMediumScreen: props.isMediumScreen,
|
|
2227
|
-
key: dim.uri,
|
|
2228
|
-
onItemSelect: props.onItemSelect,
|
|
2229
|
-
selectedItems: props.selectedItems
|
|
2230
|
-
}
|
|
2231
|
-
)),
|
|
2232
|
-
[dimensions, props.selectedItems, props.onItemSelect]
|
|
2233
|
-
);
|
|
2234
|
-
return /* @__PURE__ */ React13__default.createElement(Menu, null, options);
|
|
2235
|
-
};
|
|
2236
|
-
var DimensionMenuItem = (props) => {
|
|
2237
|
-
const { dimension, locale, isMediumScreen, onItemSelect, selectedItems } = props;
|
|
2238
|
-
const { translate: t } = useTranslation();
|
|
2239
|
-
const label = useMemo(
|
|
2240
|
-
() => t("params.dimmenu_dimension", {
|
|
2241
|
-
dimension: getCaption(dimension, locale)
|
|
2242
|
-
}),
|
|
2243
|
-
[locale, dimension]
|
|
2244
|
-
);
|
|
2245
|
-
const isChildSubMenu = dimension.hierarchies.length !== 1;
|
|
2246
|
-
const options = dimension.hierarchies.map((hie) => /* @__PURE__ */ React13__default.createElement(
|
|
2247
|
-
HierarchyMenuItem,
|
|
2255
|
+
return /* @__PURE__ */ React10__default.createElement("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ React10__default.createElement("g", { clipPath: "url(#clip0_905_15763)" }, /* @__PURE__ */ React10__default.createElement(
|
|
2256
|
+
"path",
|
|
2248
2257
|
{
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
key: hie.uri,
|
|
2254
|
-
locale,
|
|
2255
|
-
onItemSelect,
|
|
2256
|
-
selectedItems
|
|
2258
|
+
d: "M3.33325 6.66668V5.00001C3.33325 4.55798 3.50885 4.13406 3.82141 3.8215C4.13397 3.50894 4.55789 3.33334 4.99992 3.33334H6.66659",
|
|
2259
|
+
stroke: "black",
|
|
2260
|
+
strokeLinecap: "round",
|
|
2261
|
+
strokeLinejoin: "round"
|
|
2257
2262
|
}
|
|
2258
|
-
)
|
|
2259
|
-
|
|
2260
|
-
return options[0];
|
|
2261
|
-
}
|
|
2262
|
-
return /* @__PURE__ */ React13__default.createElement(Menu, { key: dimension.uri, position: "left", shadow: "md", withArrow: true }, /* @__PURE__ */ React13__default.createElement(Menu.Target, null, /* @__PURE__ */ React13__default.createElement(UnstyledButton, { component: "span" }, /* @__PURE__ */ React13__default.createElement(
|
|
2263
|
-
Menu.Item,
|
|
2263
|
+
), /* @__PURE__ */ React10__default.createElement(
|
|
2264
|
+
"path",
|
|
2264
2265
|
{
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
}
|
|
2270
|
-
})
|
|
2271
|
-
},
|
|
2272
|
-
/* @__PURE__ */ React13__default.createElement(Group, { noWrap: true, position: "apart" }, /* @__PURE__ */ React13__default.createElement(Text, null, label), /* @__PURE__ */ React13__default.createElement(IconChevronRight$1, { stroke: 1.5, size: 16 }))
|
|
2273
|
-
))), /* @__PURE__ */ React13__default.createElement(Menu.Dropdown, null, /* @__PURE__ */ React13__default.createElement(Menu, null, options)));
|
|
2274
|
-
};
|
|
2275
|
-
var HierarchyMenuItem = (props) => {
|
|
2276
|
-
const { dimension, hierarchy, locale, onItemSelect, selectedItems } = props;
|
|
2277
|
-
const { translate: t } = useTranslation();
|
|
2278
|
-
const label = useMemo(() => {
|
|
2279
|
-
const captions = [getCaption(dimension, locale), getCaption(hierarchy, locale)];
|
|
2280
|
-
if (props.isSubMenu) {
|
|
2281
|
-
return captions[1];
|
|
2266
|
+
d: "M3.33325 13.3333V15C3.33325 15.442 3.50885 15.866 3.82141 16.1785C4.13397 16.4911 4.55789 16.6667 4.99992 16.6667H6.66659",
|
|
2267
|
+
stroke: "black",
|
|
2268
|
+
strokeLinecap: "round",
|
|
2269
|
+
strokeLinejoin: "round"
|
|
2282
2270
|
}
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
dimension: captions[0],
|
|
2286
|
-
hierarchy: captions[1]
|
|
2287
|
-
});
|
|
2288
|
-
}, [locale, dimension, hierarchy, props.isSubMenu]);
|
|
2289
|
-
const isChildSubMenu = hierarchy.levels.length !== 1;
|
|
2290
|
-
const options = hierarchy.levels.map((lvl) => /* @__PURE__ */ React13__default.createElement(
|
|
2291
|
-
LevelMenuItem,
|
|
2271
|
+
), /* @__PURE__ */ React10__default.createElement(
|
|
2272
|
+
"path",
|
|
2292
2273
|
{
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
level: lvl,
|
|
2298
|
-
locale,
|
|
2299
|
-
onItemSelect,
|
|
2300
|
-
selectedItems
|
|
2274
|
+
d: "M13.3333 3.33334H14.9999C15.4419 3.33334 15.8659 3.50894 16.1784 3.8215C16.491 4.13406 16.6666 4.55798 16.6666 5.00001V6.66668",
|
|
2275
|
+
stroke: "black",
|
|
2276
|
+
strokeLinecap: "round",
|
|
2277
|
+
strokeLinejoin: "round"
|
|
2301
2278
|
}
|
|
2302
|
-
)
|
|
2303
|
-
|
|
2304
|
-
return options[0];
|
|
2305
|
-
}
|
|
2306
|
-
return /* @__PURE__ */ React13__default.createElement(Menu, { key: hierarchy.uri, position: "left", shadow: "md", withArrow: true }, /* @__PURE__ */ React13__default.createElement(Menu.Target, null, /* @__PURE__ */ React13__default.createElement(UnstyledButton, { component: "span" }, /* @__PURE__ */ React13__default.createElement(
|
|
2307
|
-
Menu.Item,
|
|
2279
|
+
), /* @__PURE__ */ React10__default.createElement(
|
|
2280
|
+
"path",
|
|
2308
2281
|
{
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
}
|
|
2314
|
-
})
|
|
2315
|
-
},
|
|
2316
|
-
/* @__PURE__ */ React13__default.createElement(Group, { noWrap: true, position: "apart" }, /* @__PURE__ */ React13__default.createElement(Text, null, label), /* @__PURE__ */ React13__default.createElement(IconChevronRight$1, { stroke: 1.5, size: 16 }))
|
|
2317
|
-
))), /* @__PURE__ */ React13__default.createElement(Menu.Dropdown, null, /* @__PURE__ */ React13__default.createElement(Menu, null, options)));
|
|
2318
|
-
};
|
|
2319
|
-
var LevelMenuItem = (props) => {
|
|
2320
|
-
const { dimension, hierarchy, level, locale } = props;
|
|
2321
|
-
const { translate: t } = useTranslation();
|
|
2322
|
-
const label = useMemo(() => {
|
|
2323
|
-
const captions = [
|
|
2324
|
-
getCaption(dimension, locale),
|
|
2325
|
-
getCaption(hierarchy, locale),
|
|
2326
|
-
getCaption(level, locale)
|
|
2327
|
-
];
|
|
2328
|
-
if (props.isSubMenu) {
|
|
2329
|
-
return captions[2];
|
|
2282
|
+
d: "M13.3333 16.6667H14.9999C15.4419 16.6667 15.8659 16.4911 16.1784 16.1785C16.491 15.866 16.6666 15.442 16.6666 15V13.3333",
|
|
2283
|
+
stroke: "black",
|
|
2284
|
+
strokeLinecap: "round",
|
|
2285
|
+
strokeLinejoin: "round"
|
|
2330
2286
|
}
|
|
2331
|
-
|
|
2332
|
-
abbr: abbreviateFullName(captions, t("params.dimmenu_abbrjoint")),
|
|
2333
|
-
dimension: captions[0],
|
|
2334
|
-
hierarchy: captions[1],
|
|
2335
|
-
level: captions[2]
|
|
2336
|
-
});
|
|
2337
|
-
}, [locale, dimension, hierarchy, level, props.isSubMenu]);
|
|
2338
|
-
return /* @__PURE__ */ React13__default.createElement(
|
|
2339
|
-
Menu.Item,
|
|
2340
|
-
{
|
|
2341
|
-
disabled: props.selectedItems.includes(stringifyName(level)),
|
|
2342
|
-
icon: /* @__PURE__ */ React13__default.createElement(IconStack, null),
|
|
2343
|
-
key: level.uri,
|
|
2344
|
-
miw: 200,
|
|
2345
|
-
onClick: () => props.onItemSelect(level, hierarchy, dimension),
|
|
2346
|
-
sx: (theme) => ({
|
|
2347
|
-
[theme.fn.smallerThan("md")]: {
|
|
2348
|
-
maxWidth: 200
|
|
2349
|
-
}
|
|
2350
|
-
})
|
|
2351
|
-
},
|
|
2352
|
-
label
|
|
2353
|
-
);
|
|
2354
|
-
};
|
|
2355
|
-
|
|
2356
|
-
// src/components/MeasuresMenu.tsx
|
|
2357
|
-
init_esm_shims();
|
|
2358
|
-
function MeasuresMenu(props) {
|
|
2359
|
-
const actions2 = useActions();
|
|
2360
|
-
const { code: locale } = useSelector$1(selectLocale);
|
|
2361
|
-
const itemMap = useSelector$1(selectMeasureMap);
|
|
2362
|
-
useSelector$1(selectOlapMeasureMap);
|
|
2363
|
-
const measures = useSelector$1(selectOlapMeasureItems);
|
|
2364
|
-
const [filter, setFilter] = useState("");
|
|
2365
|
-
useTranslation();
|
|
2366
|
-
const { children } = props;
|
|
2367
|
-
const filteredItems = useMemo(() => {
|
|
2368
|
-
const query = filter ? safeRegExp(filter, "i") : null;
|
|
2369
|
-
return filterMap(measures, (measure) => {
|
|
2370
|
-
if (query && !query.test(getCaption(measure, locale))) {
|
|
2371
|
-
return null;
|
|
2372
|
-
}
|
|
2373
|
-
return itemMap[measure.name] || buildMeasure({ active: false, ...measure });
|
|
2374
|
-
});
|
|
2375
|
-
}, [itemMap, measures, filter, locale]);
|
|
2376
|
-
const activeItems = filteredItems.filter(isActiveItem);
|
|
2377
|
-
const options = filteredItems.map((item) => /* @__PURE__ */ React13__default.createElement(
|
|
2378
|
-
Menu.Item,
|
|
2379
|
-
{
|
|
2380
|
-
disabled: activeItems.map((active) => active.name).includes(item.name),
|
|
2381
|
-
key: item.name,
|
|
2382
|
-
onClick: () => {
|
|
2383
|
-
actions2.updateMeasure({ ...item, active: !item.active });
|
|
2384
|
-
actions2.willRequestQuery();
|
|
2385
|
-
}
|
|
2386
|
-
},
|
|
2387
|
-
item.name
|
|
2388
|
-
));
|
|
2389
|
-
return /* @__PURE__ */ React13__default.createElement(Menu, { position: "left" }, /* @__PURE__ */ React13__default.createElement(Menu.Target, null, /* @__PURE__ */ React13__default.createElement(UnstyledButton, { component: "span" }, /* @__PURE__ */ React13__default.createElement(
|
|
2390
|
-
Menu.Item,
|
|
2391
|
-
{
|
|
2392
|
-
icon: /* @__PURE__ */ React13__default.createElement(IconStack3, null),
|
|
2393
|
-
sx: (theme) => ({
|
|
2394
|
-
[theme.fn.smallerThan("md")]: {
|
|
2395
|
-
maxWidth: 200
|
|
2396
|
-
}
|
|
2397
|
-
})
|
|
2398
|
-
},
|
|
2399
|
-
/* @__PURE__ */ React13__default.createElement(Group, { noWrap: true, position: "apart" }, /* @__PURE__ */ React13__default.createElement(Text, null, children), /* @__PURE__ */ React13__default.createElement(IconChevronRight$1, { stroke: 1.5, size: 16 }))
|
|
2400
|
-
))), /* @__PURE__ */ React13__default.createElement(Menu.Dropdown, null, options));
|
|
2287
|
+
)), /* @__PURE__ */ React10__default.createElement("defs", null, /* @__PURE__ */ React10__default.createElement("clipPath", { id: "clip0_905_15763" }, /* @__PURE__ */ React10__default.createElement("rect", { width: "20", height: "20", fill: "white" }))));
|
|
2401
2288
|
}
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
const items = useSelector$1(selectDrilldownItems);
|
|
2406
|
-
const dimensions = useSelector$1(selectOlapDimensionItems);
|
|
2407
|
-
const { willRequestQuery: willRequestQuery2 } = useActions();
|
|
2408
|
-
const createHandler = useCallback(
|
|
2409
|
-
(level) => {
|
|
2410
|
-
const drilldownItem = buildDrilldown({ ...level, key: level.fullName });
|
|
2411
|
-
actions2.updateDrilldown(drilldownItem);
|
|
2412
|
-
actions2.willFetchMembers({ ...level, level: level.name }).then((members) => {
|
|
2413
|
-
const dimension = dimensions.find((dim) => dim.name === level.dimension);
|
|
2414
|
-
if (!dimension) return;
|
|
2415
|
-
actions2.updateDrilldown({
|
|
2416
|
-
...drilldownItem,
|
|
2417
|
-
dimType: dimension.dimensionType,
|
|
2418
|
-
memberCount: members.length,
|
|
2419
|
-
members
|
|
2420
|
-
});
|
|
2421
|
-
}).then(() => willRequestQuery2());
|
|
2422
|
-
},
|
|
2423
|
-
[dimensions]
|
|
2424
|
-
);
|
|
2425
|
-
return /* @__PURE__ */ React13__default.createElement(
|
|
2426
|
-
Menu,
|
|
2289
|
+
function ClearSVG() {
|
|
2290
|
+
return /* @__PURE__ */ React10__default.createElement("svg", { width: "17", height: "16", viewBox: "0 0 17 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ React10__default.createElement("g", { clipPath: "url(#clip0_1545_1134)" }, /* @__PURE__ */ React10__default.createElement(
|
|
2291
|
+
"path",
|
|
2427
2292
|
{
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
/* @__PURE__ */ React13__default.createElement(Menu.Target, null, /* @__PURE__ */ React13__default.createElement(ActionIcon, { size: "xl", id: "icon-icon-plus" }, children)),
|
|
2436
|
-
/* @__PURE__ */ React13__default.createElement(Menu.Dropdown, null, /* @__PURE__ */ React13__default.createElement(MeasuresMenu_default, null, "Metrics"), /* @__PURE__ */ React13__default.createElement(NestedMenu, { selectedItems: items, onItemSelect: createHandler }, "Dimensions"))
|
|
2437
|
-
);
|
|
2438
|
-
}
|
|
2439
|
-
function NestedMenu({ selectedItems, children, onItemSelect }) {
|
|
2440
|
-
return /* @__PURE__ */ React13__default.createElement(
|
|
2441
|
-
Menu,
|
|
2293
|
+
d: "M13.4072 10.6882C13.9751 9.56054 14.172 8.28312 13.9697 7.03754C13.7675 5.79196 13.1766 4.64164 12.2808 3.75013C11.3851 2.85861 10.2303 2.27129 8.98048 2.07166C7.73068 1.87204 6.44956 2.07028 5.31928 2.63819M3.7671 3.75952C2.63879 4.88519 2.00527 6.41157 2.0059 8.00288C2.00652 9.59419 2.64125 11.1201 3.77044 12.2449C4.89964 13.3696 6.4308 14.0012 8.02709 14.0006C9.62339 13.9999 11.1541 13.3672 12.2824 12.2415",
|
|
2294
|
+
stroke: "black",
|
|
2295
|
+
strokeLinecap: "round",
|
|
2296
|
+
strokeLinejoin: "round"
|
|
2297
|
+
}
|
|
2298
|
+
), /* @__PURE__ */ React10__default.createElement(
|
|
2299
|
+
"path",
|
|
2442
2300
|
{
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
},
|
|
2450
|
-
/* @__PURE__ */ React13__default.createElement(Menu.Target, null, /* @__PURE__ */ React13__default.createElement(UnstyledButton, { component: "span" }, /* @__PURE__ */ React13__default.createElement(
|
|
2451
|
-
Menu.Item,
|
|
2452
|
-
{
|
|
2453
|
-
icon: /* @__PURE__ */ React13__default.createElement(IconStack2, null),
|
|
2454
|
-
sx: (theme) => ({
|
|
2455
|
-
[theme.fn.smallerThan("md")]: {
|
|
2456
|
-
maxWidth: 200
|
|
2457
|
-
}
|
|
2458
|
-
})
|
|
2459
|
-
},
|
|
2460
|
-
/* @__PURE__ */ React13__default.createElement(Group, { noWrap: true, position: "apart" }, /* @__PURE__ */ React13__default.createElement(Text, null, children), /* @__PURE__ */ React13__default.createElement(IconChevronRight$1, { stroke: 1.5, size: 16 }))
|
|
2461
|
-
))),
|
|
2462
|
-
/* @__PURE__ */ React13__default.createElement(Menu.Dropdown, null, /* @__PURE__ */ React13__default.createElement(
|
|
2463
|
-
DimensionMenu,
|
|
2464
|
-
{
|
|
2465
|
-
selectedItems: selectedItems.map(stringifyName),
|
|
2466
|
-
onItemSelect
|
|
2467
|
-
}
|
|
2468
|
-
))
|
|
2469
|
-
);
|
|
2301
|
+
d: "M2.00626 2L14.0439 14",
|
|
2302
|
+
stroke: "black",
|
|
2303
|
+
strokeLinecap: "round",
|
|
2304
|
+
strokeLinejoin: "round"
|
|
2305
|
+
}
|
|
2306
|
+
)), /* @__PURE__ */ React10__default.createElement("defs", null, /* @__PURE__ */ React10__default.createElement("clipPath", { id: "clip0_1545_1134" }, /* @__PURE__ */ React10__default.createElement("rect", { width: "16.0501", height: "16", fill: "white" }))));
|
|
2470
2307
|
}
|
|
2471
|
-
var OptionsMenu_default = OptionsMenu;
|
|
2472
2308
|
|
|
2473
2309
|
// src/components/TableFooter.tsx
|
|
2474
2310
|
init_esm_shims();
|
|
@@ -2476,14 +2312,14 @@ init_esm_shims();
|
|
|
2476
2312
|
// src/hooks/useAsync.tsx
|
|
2477
2313
|
init_esm_shims();
|
|
2478
2314
|
function useSafeDispatch(dispatch) {
|
|
2479
|
-
const mounted =
|
|
2480
|
-
|
|
2315
|
+
const mounted = React10.useRef(false);
|
|
2316
|
+
React10.useLayoutEffect(() => {
|
|
2481
2317
|
mounted.current = true;
|
|
2482
2318
|
return () => {
|
|
2483
2319
|
mounted.current = false;
|
|
2484
2320
|
};
|
|
2485
2321
|
}, []);
|
|
2486
|
-
return
|
|
2322
|
+
return React10.useCallback(
|
|
2487
2323
|
(...args) => {
|
|
2488
2324
|
if (mounted.current) {
|
|
2489
2325
|
dispatch(...args);
|
|
@@ -2494,11 +2330,11 @@ function useSafeDispatch(dispatch) {
|
|
|
2494
2330
|
}
|
|
2495
2331
|
var defaultInitialState = { status: "idle", data: null, error: null };
|
|
2496
2332
|
function useAsync(initialState4) {
|
|
2497
|
-
const initialStateRef =
|
|
2333
|
+
const initialStateRef = React10.useRef({
|
|
2498
2334
|
...defaultInitialState,
|
|
2499
2335
|
...initialState4
|
|
2500
2336
|
});
|
|
2501
|
-
const [state, dispatch] =
|
|
2337
|
+
const [state, dispatch] = React10.useReducer(
|
|
2502
2338
|
(state2, action) => {
|
|
2503
2339
|
switch (action.type) {
|
|
2504
2340
|
case "idle":
|
|
@@ -2516,16 +2352,16 @@ function useAsync(initialState4) {
|
|
|
2516
2352
|
initialStateRef.current
|
|
2517
2353
|
);
|
|
2518
2354
|
const safeDispatch = useSafeDispatch(dispatch);
|
|
2519
|
-
const setData =
|
|
2355
|
+
const setData = React10.useCallback(
|
|
2520
2356
|
(data) => safeDispatch({ type: "resolved", data }),
|
|
2521
2357
|
[safeDispatch]
|
|
2522
2358
|
);
|
|
2523
|
-
const setError =
|
|
2359
|
+
const setError = React10.useCallback(
|
|
2524
2360
|
(error) => safeDispatch({ type: "rejected", error }),
|
|
2525
2361
|
[safeDispatch]
|
|
2526
2362
|
);
|
|
2527
|
-
const reset =
|
|
2528
|
-
const run =
|
|
2363
|
+
const reset = React10.useCallback(() => safeDispatch({ type: "idle" }), [safeDispatch]);
|
|
2364
|
+
const run = React10.useCallback(
|
|
2529
2365
|
(promise) => {
|
|
2530
2366
|
if (!promise || !promise.then) {
|
|
2531
2367
|
throw new Error(
|
|
@@ -2566,7 +2402,7 @@ init_esm_shims();
|
|
|
2566
2402
|
function CubeAnnotation(props) {
|
|
2567
2403
|
const { annotation, item, locale, ...textProps } = props;
|
|
2568
2404
|
const content = getAnnotation(item, annotation, locale);
|
|
2569
|
-
return content ? /* @__PURE__ */
|
|
2405
|
+
return content ? /* @__PURE__ */ React10__default.createElement(Text, { component: "p", ...textProps }, content) : null;
|
|
2570
2406
|
}
|
|
2571
2407
|
function CubeSourceAnchor(props) {
|
|
2572
2408
|
const { item, locale, ...textProps } = props;
|
|
@@ -2574,12 +2410,12 @@ function CubeSourceAnchor(props) {
|
|
|
2574
2410
|
const srcName = getAnnotation(item, "source_name", locale);
|
|
2575
2411
|
const srcLink = getAnnotation(item, "source_link", locale);
|
|
2576
2412
|
if (!srcName) return null;
|
|
2577
|
-
return /* @__PURE__ */
|
|
2413
|
+
return /* @__PURE__ */ React10__default.createElement(Text, { component: "p", ...textProps }, `${t("params.label_source")}: `, srcLink ? /* @__PURE__ */ React10__default.createElement(Anchor, { href: srcLink }, srcName) : /* @__PURE__ */ React10__default.createElement(Text, { span: true }, srcName));
|
|
2578
2414
|
}
|
|
2579
2415
|
function CubeSource() {
|
|
2580
2416
|
const selectedItem = useSelector$1(selectOlapCube);
|
|
2581
2417
|
const { code: locale } = useSelector$1(selectLocale);
|
|
2582
|
-
return selectedItem && /* @__PURE__ */
|
|
2418
|
+
return selectedItem && /* @__PURE__ */ React10__default.createElement(Text, { sx: { "& p": { margin: 0 } } }, /* @__PURE__ */ React10__default.createElement(
|
|
2583
2419
|
CubeAnnotation,
|
|
2584
2420
|
{
|
|
2585
2421
|
annotation: "description",
|
|
@@ -2587,7 +2423,7 @@ function CubeSource() {
|
|
|
2587
2423
|
item: selectedItem,
|
|
2588
2424
|
locale
|
|
2589
2425
|
}
|
|
2590
|
-
), /* @__PURE__ */
|
|
2426
|
+
), /* @__PURE__ */ React10__default.createElement(CubeSourceAnchor, { item: selectedItem, locale, fz: "xs" }), /* @__PURE__ */ React10__default.createElement(
|
|
2591
2427
|
CubeAnnotation,
|
|
2592
2428
|
{
|
|
2593
2429
|
annotation: "source_description",
|
|
@@ -2601,28 +2437,39 @@ function CubeSource() {
|
|
|
2601
2437
|
|
|
2602
2438
|
// src/components/TableFooter.tsx
|
|
2603
2439
|
function TableFooter(props) {
|
|
2604
|
-
const { result, table } = props;
|
|
2440
|
+
const { result, table, data = [] } = props;
|
|
2605
2441
|
const { translate: t } = useTranslation();
|
|
2606
2442
|
const { url } = result;
|
|
2607
2443
|
const { copy, copied } = useClipboard({ timeout: 1e3 });
|
|
2608
2444
|
const copyHandler = useCallback(() => copy(url), [url]);
|
|
2609
|
-
return /* @__PURE__ */
|
|
2445
|
+
return /* @__PURE__ */ React10__default.createElement(Box, { w: "100%", sx: { flex: "0 0 70px" } }, /* @__PURE__ */ React10__default.createElement(
|
|
2446
|
+
Flex,
|
|
2447
|
+
{
|
|
2448
|
+
p: "md",
|
|
2449
|
+
justify: "space-between",
|
|
2450
|
+
align: "flex-end",
|
|
2451
|
+
direction: { base: "column-reverse", md: "row" },
|
|
2452
|
+
gap: "sm"
|
|
2453
|
+
},
|
|
2454
|
+
/* @__PURE__ */ React10__default.createElement(CubeSource, null),
|
|
2455
|
+
/* @__PURE__ */ React10__default.createElement(Group, { position: "right", spacing: "sm" }, /* @__PURE__ */ React10__default.createElement(Text, { c: "dimmed" }, t("results.count_rows", { n: data.length })), /* @__PURE__ */ React10__default.createElement(MRT_TablePagination, { table }), /* @__PURE__ */ React10__default.createElement(ApiAndCsvButtons, { copied, copyHandler, url }))
|
|
2456
|
+
));
|
|
2610
2457
|
}
|
|
2611
2458
|
var ApiAndCsvButtons = (props) => {
|
|
2612
2459
|
const { copied, copyHandler, url } = props;
|
|
2613
2460
|
const { translate: t } = useTranslation();
|
|
2614
|
-
return /* @__PURE__ */
|
|
2461
|
+
return /* @__PURE__ */ React10__default.createElement(Box, { id: "query-results-debug-view" }, /* @__PURE__ */ React10__default.createElement(Group, { spacing: "xs" }, url && /* @__PURE__ */ React10__default.createElement(
|
|
2615
2462
|
Button,
|
|
2616
2463
|
{
|
|
2617
2464
|
variant: "filled",
|
|
2618
2465
|
color: "dark",
|
|
2619
|
-
leftIcon: /* @__PURE__ */
|
|
2466
|
+
leftIcon: /* @__PURE__ */ React10__default.createElement(IconCopy, { size: 20 }),
|
|
2620
2467
|
sx: { height: 30, backgroundColor: "#5A5A5A" },
|
|
2621
2468
|
onClick: copyHandler
|
|
2622
2469
|
},
|
|
2623
2470
|
copied ? t("action_copy_done") : t("action_copy"),
|
|
2624
2471
|
" API"
|
|
2625
|
-
), /* @__PURE__ */
|
|
2472
|
+
), /* @__PURE__ */ React10__default.createElement(DownloadQuery, null)));
|
|
2626
2473
|
};
|
|
2627
2474
|
var DownloadQuery = () => {
|
|
2628
2475
|
const actions2 = useActions();
|
|
@@ -2633,12 +2480,12 @@ var DownloadQuery = () => {
|
|
|
2633
2480
|
const components = [];
|
|
2634
2481
|
if (csv) {
|
|
2635
2482
|
components.push(
|
|
2636
|
-
/* @__PURE__ */
|
|
2483
|
+
/* @__PURE__ */ React10__default.createElement(
|
|
2637
2484
|
ButtonDownload,
|
|
2638
2485
|
{
|
|
2639
2486
|
variant: "filled",
|
|
2640
2487
|
color: "dark",
|
|
2641
|
-
leftIcon: /* @__PURE__ */
|
|
2488
|
+
leftIcon: /* @__PURE__ */ React10__default.createElement(IconDownload, { size: 20 }),
|
|
2642
2489
|
sx: { height: 30, backgroundColor: "#5A5A5A" },
|
|
2643
2490
|
key: csv,
|
|
2644
2491
|
provider: () => actions2.willDownloadQuery(csv)
|
|
@@ -2647,10 +2494,10 @@ var DownloadQuery = () => {
|
|
|
2647
2494
|
)
|
|
2648
2495
|
);
|
|
2649
2496
|
}
|
|
2650
|
-
if (components.length === 0 ||
|
|
2497
|
+
if (components.length === 0 || result.data.length === 0) {
|
|
2651
2498
|
return null;
|
|
2652
2499
|
}
|
|
2653
|
-
return /* @__PURE__ */
|
|
2500
|
+
return /* @__PURE__ */ React10__default.createElement(Box, { id: "button-group-download-results" }, /* @__PURE__ */ React10__default.createElement(Group, { spacing: "xs" }, components, /* @__PURE__ */ React10__default.createElement(MenuOpts, { formats: formats.filter((f) => f !== "csv") })));
|
|
2654
2501
|
};
|
|
2655
2502
|
var mimeTypes = {
|
|
2656
2503
|
csv: "text/csv",
|
|
@@ -2696,12 +2543,12 @@ function useDownload(props) {
|
|
|
2696
2543
|
var ButtonDownload = (props) => {
|
|
2697
2544
|
const { provider, ...buttonProps } = props;
|
|
2698
2545
|
const { onClick, isLoading } = useDownload({ provider });
|
|
2699
|
-
return /* @__PURE__ */
|
|
2546
|
+
return /* @__PURE__ */ React10__default.createElement(Button, { ...buttonProps, onClick, loading: isLoading }, /* @__PURE__ */ React10__default.createElement(Text, { fz: "sm" }, props.children));
|
|
2700
2547
|
};
|
|
2701
2548
|
var ItemDownload = (props) => {
|
|
2702
2549
|
const { provider, icon, setOpened, ...itemProps } = props;
|
|
2703
2550
|
const { onClick, isLoading } = useDownload({ provider });
|
|
2704
|
-
return /* @__PURE__ */
|
|
2551
|
+
return /* @__PURE__ */ React10__default.createElement(
|
|
2705
2552
|
Menu.Item,
|
|
2706
2553
|
{
|
|
2707
2554
|
...itemProps,
|
|
@@ -2713,7 +2560,7 @@ var ItemDownload = (props) => {
|
|
|
2713
2560
|
});
|
|
2714
2561
|
}
|
|
2715
2562
|
},
|
|
2716
|
-
/* @__PURE__ */
|
|
2563
|
+
/* @__PURE__ */ React10__default.createElement(Text, { fz: "sm" }, props.children)
|
|
2717
2564
|
);
|
|
2718
2565
|
};
|
|
2719
2566
|
function MenuOpts({ formats }) {
|
|
@@ -2722,20 +2569,20 @@ function MenuOpts({ formats }) {
|
|
|
2722
2569
|
const [opened, setOpened] = useState(false);
|
|
2723
2570
|
const ref = useClickOutside(() => setOpened(false));
|
|
2724
2571
|
const buttons = useMemo(
|
|
2725
|
-
() => formats.map((format2) => /* @__PURE__ */
|
|
2572
|
+
() => formats.map((format2) => /* @__PURE__ */ React10__default.createElement(
|
|
2726
2573
|
ItemDownload,
|
|
2727
2574
|
{
|
|
2728
2575
|
component: "a",
|
|
2729
2576
|
key: format2,
|
|
2730
2577
|
provider: () => actions2.willDownloadQuery(format2),
|
|
2731
|
-
icon: (loading) => loading ? /* @__PURE__ */
|
|
2578
|
+
icon: (loading) => loading ? /* @__PURE__ */ React10__default.createElement(Loader, { size: 15 }) : /* @__PURE__ */ React10__default.createElement(IconDownload, { size: 15 }),
|
|
2732
2579
|
setOpened
|
|
2733
2580
|
},
|
|
2734
|
-
/* @__PURE__ */
|
|
2581
|
+
/* @__PURE__ */ React10__default.createElement(Text, { size: "xs" }, t(`formats.${format2}`))
|
|
2735
2582
|
)),
|
|
2736
2583
|
[formats]
|
|
2737
2584
|
);
|
|
2738
|
-
return /* @__PURE__ */
|
|
2585
|
+
return /* @__PURE__ */ React10__default.createElement(Menu, { shadow: "md", width: 200, opened }, /* @__PURE__ */ React10__default.createElement(Menu.Target, null, /* @__PURE__ */ React10__default.createElement(
|
|
2739
2586
|
ActionIcon,
|
|
2740
2587
|
{
|
|
2741
2588
|
onClick: () => setOpened((o) => !o),
|
|
@@ -2746,8 +2593,8 @@ function MenuOpts({ formats }) {
|
|
|
2746
2593
|
minWidth: 0
|
|
2747
2594
|
}
|
|
2748
2595
|
},
|
|
2749
|
-
/* @__PURE__ */
|
|
2750
|
-
)), /* @__PURE__ */
|
|
2596
|
+
/* @__PURE__ */ React10__default.createElement(IconDotsVertical, { size: "0.8rem" })
|
|
2597
|
+
)), /* @__PURE__ */ React10__default.createElement(Menu.Dropdown, null, /* @__PURE__ */ React10__default.createElement(Menu.Label, null, t("params.title_downloaddata")), /* @__PURE__ */ React10__default.createElement("div", { ref }, buttons)));
|
|
2751
2598
|
}
|
|
2752
2599
|
var TableFooter_default = TableFooter;
|
|
2753
2600
|
|
|
@@ -2760,9 +2607,9 @@ var CustomActionIcon = ({
|
|
|
2760
2607
|
children,
|
|
2761
2608
|
label
|
|
2762
2609
|
}) => {
|
|
2763
|
-
const [popoverOpened, setPopoverOpened] =
|
|
2764
|
-
const actionIcon = /* @__PURE__ */
|
|
2765
|
-
return showTooltip ? /* @__PURE__ */
|
|
2610
|
+
const [popoverOpened, setPopoverOpened] = React10__default.useState(false);
|
|
2611
|
+
const actionIcon = /* @__PURE__ */ React10__default.createElement(ActionIcon, { disabled, size: 25, ml: 5, onClick }, children);
|
|
2612
|
+
return showTooltip ? /* @__PURE__ */ React10__default.createElement("div", { onMouseEnter: () => setPopoverOpened(true), onMouseLeave: () => setPopoverOpened(false) }, /* @__PURE__ */ React10__default.createElement(
|
|
2766
2613
|
Popover,
|
|
2767
2614
|
{
|
|
2768
2615
|
width: 200,
|
|
@@ -2782,133 +2629,651 @@ var CustomActionIcon = ({
|
|
|
2782
2629
|
}
|
|
2783
2630
|
})
|
|
2784
2631
|
},
|
|
2785
|
-
/* @__PURE__ */
|
|
2786
|
-
/* @__PURE__ */
|
|
2632
|
+
/* @__PURE__ */ React10__default.createElement(Popover.Target, null, actionIcon),
|
|
2633
|
+
/* @__PURE__ */ React10__default.createElement(Popover.Dropdown, null, /* @__PURE__ */ React10__default.createElement(Text, { size: "xs" }, label))
|
|
2787
2634
|
)) : actionIcon;
|
|
2788
2635
|
};
|
|
2789
2636
|
var CustomActionIcon_default = CustomActionIcon;
|
|
2790
2637
|
|
|
2791
|
-
// src/components/
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
if (entity._type === "level") {
|
|
2800
|
-
if (entity.fullName) {
|
|
2801
|
-
const drilldown = drilldowns[entity.fullName];
|
|
2802
|
-
actions2.updateDrilldown({ ...drilldown, active: false });
|
|
2803
|
-
}
|
|
2804
|
-
}
|
|
2805
|
-
actions2.willRequestQuery();
|
|
2806
|
-
};
|
|
2807
|
-
function showTrashIcon(columns, type) {
|
|
2808
|
-
const result = columns.filter((c) => c.entityType === type);
|
|
2809
|
-
return result.length > 1;
|
|
2810
|
-
}
|
|
2811
|
-
var getActionIcon = (entityType) => {
|
|
2812
|
-
if (entityType === "measure") {
|
|
2813
|
-
return /* @__PURE__ */ React13__default.createElement(ActionIcon, { size: "md", color: "red" }, /* @__PURE__ */ React13__default.createElement(BarsSVG, null));
|
|
2814
|
-
} else if (entityType === "level") {
|
|
2815
|
-
return /* @__PURE__ */ React13__default.createElement(ActionIcon, { size: "md", color: "blue" }, /* @__PURE__ */ React13__default.createElement(StackSVG, null));
|
|
2816
|
-
}
|
|
2817
|
-
};
|
|
2818
|
-
var getEntityText = (entityType) => {
|
|
2819
|
-
switch (entityType) {
|
|
2820
|
-
case "measure":
|
|
2821
|
-
return "Metric";
|
|
2822
|
-
case "level":
|
|
2823
|
-
return "Dimension";
|
|
2824
|
-
default:
|
|
2825
|
-
return "";
|
|
2826
|
-
}
|
|
2827
|
-
};
|
|
2828
|
-
var getColumnFilterOption = (entityType) => {
|
|
2829
|
-
switch (entityType) {
|
|
2830
|
-
case "measure":
|
|
2831
|
-
return { columnFilterModeOptions: ["between", "greaterThan", "lessThan"] };
|
|
2832
|
-
case "level":
|
|
2833
|
-
return { columnFilterModeOptions: true };
|
|
2834
|
-
default:
|
|
2835
|
-
return { columnFilterModeOptions: true };
|
|
2638
|
+
// src/components/DrawerMenu.tsx
|
|
2639
|
+
init_esm_shims();
|
|
2640
|
+
|
|
2641
|
+
// src/utils/format.js
|
|
2642
|
+
init_esm_shims();
|
|
2643
|
+
function abbreviateFullName(nameParts, joint = "/") {
|
|
2644
|
+
if (!nameParts) {
|
|
2645
|
+
return "";
|
|
2836
2646
|
}
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
const dd = data[0];
|
|
2840
|
-
if (dd[key + " ID"]) {
|
|
2841
|
-
return (member) => `${member.caption} ${member.key}`;
|
|
2647
|
+
if (typeof nameParts === "string") {
|
|
2648
|
+
nameParts = splitName(nameParts);
|
|
2842
2649
|
}
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
if (result.filterVariant === "multi-select") {
|
|
2850
|
-
if (entity._type === "level") {
|
|
2851
|
-
if (entity.fullName) {
|
|
2852
|
-
const dd = Object.keys(drilldowns).reduce(
|
|
2853
|
-
(prev, key) => ({ ...prev, [drilldowns[key].fullName]: drilldowns[key] }),
|
|
2854
|
-
{}
|
|
2855
|
-
);
|
|
2856
|
-
const drilldwonData = dd[entity.fullName];
|
|
2857
|
-
if (drilldwonData && drilldwonData.members) {
|
|
2858
|
-
const getmemberFilterValue = getMemberFilterFn(data, columnKey);
|
|
2859
|
-
result = Object.assign({}, result, {
|
|
2860
|
-
mantineFilterMultiSelectProps: {
|
|
2861
|
-
data: drilldwonData.members.map(getmemberFilterValue)
|
|
2862
|
-
},
|
|
2863
|
-
filterFn: (row, id, filterValue) => {
|
|
2864
|
-
if (filterValue.length) {
|
|
2865
|
-
const rowValue = row.getValue(id);
|
|
2866
|
-
if (typeof rowValue === "object") {
|
|
2867
|
-
return filterValue.includes(String(rowValue.value + " " + rowValue.id));
|
|
2868
|
-
}
|
|
2869
|
-
return filterValue.includes(String(rowValue));
|
|
2870
|
-
}
|
|
2871
|
-
return true;
|
|
2872
|
-
}
|
|
2873
|
-
});
|
|
2874
|
-
}
|
|
2875
|
-
}
|
|
2650
|
+
const target = [];
|
|
2651
|
+
let n = nameParts.length;
|
|
2652
|
+
while (n--) {
|
|
2653
|
+
const token = nameParts[n];
|
|
2654
|
+
if (target.indexOf(token) === -1) {
|
|
2655
|
+
target.unshift(token);
|
|
2876
2656
|
}
|
|
2877
2657
|
}
|
|
2878
|
-
return
|
|
2658
|
+
return target.join(joint);
|
|
2879
2659
|
}
|
|
2880
|
-
function
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2660
|
+
function AddColumnsDrawer() {
|
|
2661
|
+
const [opened, { open, close: close2 }] = useDisclosure(false);
|
|
2662
|
+
const { translate: t } = useTranslation();
|
|
2663
|
+
const theme = useMantineTheme();
|
|
2664
|
+
const smallerThanMd = useMediaQuery(`(max-width: ${theme.breakpoints.md})`);
|
|
2665
|
+
return /* @__PURE__ */ React10__default.createElement(React10__default.Fragment, null, /* @__PURE__ */ React10__default.createElement(
|
|
2666
|
+
Drawer,
|
|
2667
|
+
{
|
|
2668
|
+
opened,
|
|
2669
|
+
position: "right",
|
|
2670
|
+
onClose: close2,
|
|
2671
|
+
title: /* @__PURE__ */ React10__default.createElement(Group, null, /* @__PURE__ */ React10__default.createElement(IconStack3, { size: "1rem" }), /* @__PURE__ */ React10__default.createElement(Text, { fw: 700 }, t("params.add_columns"))),
|
|
2672
|
+
styles: (t2) => ({
|
|
2673
|
+
inner: {
|
|
2674
|
+
position: "absolute",
|
|
2675
|
+
inset: 0
|
|
2676
|
+
},
|
|
2677
|
+
header: {
|
|
2678
|
+
background: "transparent"
|
|
2679
|
+
},
|
|
2680
|
+
content: {
|
|
2681
|
+
backgroundColor: t2.colorScheme === "dark" ? t2.colors.dark[8] : t2.colors.gray[1]
|
|
2682
|
+
}
|
|
2683
|
+
}),
|
|
2684
|
+
overlayProps: {
|
|
2685
|
+
opacity: 0.1
|
|
2686
|
+
},
|
|
2687
|
+
withinPortal: false
|
|
2688
|
+
},
|
|
2689
|
+
/* @__PURE__ */ React10__default.createElement(MeasuresOptions, null),
|
|
2690
|
+
/* @__PURE__ */ React10__default.createElement(DrillDownOptions, null)
|
|
2691
|
+
), /* @__PURE__ */ React10__default.createElement(Group, { position: "center" }, smallerThanMd ? /* @__PURE__ */ React10__default.createElement(ActionIcon, { onClick: open, size: "md", variant: "filled", color: theme.primaryColor }, /* @__PURE__ */ React10__default.createElement(IconStack3, { size: "0.75rem" })) : /* @__PURE__ */ React10__default.createElement(Button, { leftIcon: /* @__PURE__ */ React10__default.createElement(IconStack3, { size: "1rem" }), onClick: open, m: "md", size: "xs" }, t("params.add_columns"))));
|
|
2889
2692
|
}
|
|
2890
|
-
function
|
|
2891
|
-
|
|
2892
|
-
result,
|
|
2893
|
-
columnFilter = () => true,
|
|
2894
|
-
columnSorting = () => 0,
|
|
2895
|
-
...mantineTableProps
|
|
2896
|
-
}) {
|
|
2897
|
-
const { types } = result;
|
|
2898
|
-
const { locale, measures, drilldowns } = useSelector$1(selectCurrentQueryParams);
|
|
2693
|
+
function DrillDownOptions() {
|
|
2694
|
+
const locale = useSelector$1(selectLocale);
|
|
2899
2695
|
const actions2 = useActions();
|
|
2900
|
-
const
|
|
2901
|
-
|
|
2902
|
-
|
|
2696
|
+
const selectedDimensions = useSelector$1(selectDrilldownItems);
|
|
2697
|
+
const dimensions = useSelector$1(selectOlapDimensionItems) || [];
|
|
2698
|
+
const createCutHandler2 = React10__default.useCallback((level) => {
|
|
2699
|
+
const cutItem = buildCut({ ...level, key: level.fullName, members: [] });
|
|
2700
|
+
cutItem.active = false;
|
|
2701
|
+
actions2.updateCut(cutItem);
|
|
2702
|
+
}, []);
|
|
2703
|
+
useCallback(
|
|
2704
|
+
(level) => {
|
|
2705
|
+
var _a;
|
|
2706
|
+
const drilldownItem = (_a = selectedDimensions.find((item) => item.uniqueName === level.uniqueName)) != null ? _a : buildDrilldown({ ...level });
|
|
2707
|
+
createCutHandler2(level);
|
|
2708
|
+
actions2.updateDrilldown(drilldownItem);
|
|
2709
|
+
actions2.willFetchMembers({ ...level, level: level.name }).then((members) => {
|
|
2710
|
+
const dimension = dimensions.find((dim) => dim.name === level.dimension);
|
|
2711
|
+
if (!dimension) return;
|
|
2712
|
+
actions2.updateDrilldown({
|
|
2713
|
+
...drilldownItem,
|
|
2714
|
+
dimType: dimension.dimensionType,
|
|
2715
|
+
memberCount: members.length,
|
|
2716
|
+
members
|
|
2717
|
+
});
|
|
2718
|
+
});
|
|
2719
|
+
},
|
|
2720
|
+
[dimensions]
|
|
2721
|
+
);
|
|
2722
|
+
const activeItems = selectedDimensions.filter((i) => i.active);
|
|
2723
|
+
const options = useMemo(
|
|
2724
|
+
() => dimensions.map((dimension) => /* @__PURE__ */ React10__default.createElement(
|
|
2725
|
+
DimensionItem,
|
|
2726
|
+
{
|
|
2727
|
+
dimension,
|
|
2728
|
+
locale: locale.code,
|
|
2729
|
+
key: dimension.uri,
|
|
2730
|
+
activeItems
|
|
2731
|
+
}
|
|
2732
|
+
)),
|
|
2733
|
+
[dimensions, activeItems, createCutHandler2]
|
|
2734
|
+
);
|
|
2735
|
+
return options;
|
|
2736
|
+
}
|
|
2737
|
+
function DimensionItem({ dimension, locale, activeItems }) {
|
|
2738
|
+
const isChildSubMenu = dimension.hierarchies.length !== 1;
|
|
2739
|
+
const options = dimension.hierarchies.map((hie) => /* @__PURE__ */ React10__default.createElement(
|
|
2740
|
+
HierarchyItem,
|
|
2741
|
+
{
|
|
2742
|
+
dimension,
|
|
2743
|
+
hierarchy: hie,
|
|
2744
|
+
isSubMenu: isChildSubMenu,
|
|
2745
|
+
key: hie.uri,
|
|
2746
|
+
locale,
|
|
2747
|
+
activeItems
|
|
2748
|
+
}
|
|
2749
|
+
));
|
|
2750
|
+
if (!isChildSubMenu) {
|
|
2751
|
+
return options[0];
|
|
2752
|
+
}
|
|
2753
|
+
return options;
|
|
2754
|
+
}
|
|
2755
|
+
function HierarchyItem({ dimension, hierarchy, isSubMenu, locale, activeItems }) {
|
|
2756
|
+
const { translate: t } = useTranslation();
|
|
2757
|
+
useMemo(() => {
|
|
2758
|
+
const captions = [getCaption(dimension, locale), getCaption(hierarchy, locale)];
|
|
2759
|
+
if (isSubMenu) {
|
|
2760
|
+
return captions[1];
|
|
2761
|
+
}
|
|
2762
|
+
return t("params.dimmenu_hierarchy", {
|
|
2763
|
+
abbr: abbreviateFullName(captions, t("params.dimmenu_abbrjoint")),
|
|
2764
|
+
dimension: captions[0],
|
|
2765
|
+
hierarchy: captions[1]
|
|
2766
|
+
});
|
|
2767
|
+
}, [locale, dimension, hierarchy, isSubMenu]);
|
|
2768
|
+
const isChildSubMenu = hierarchy.levels.length !== 1;
|
|
2769
|
+
const options = hierarchy.levels.map((lvl) => /* @__PURE__ */ React10__default.createElement(
|
|
2770
|
+
LevelItem,
|
|
2771
|
+
{
|
|
2772
|
+
dimension,
|
|
2773
|
+
hierarchy,
|
|
2774
|
+
isSubMenu: isChildSubMenu,
|
|
2775
|
+
key: lvl.uri,
|
|
2776
|
+
level: lvl,
|
|
2777
|
+
locale,
|
|
2778
|
+
activeItems
|
|
2779
|
+
}
|
|
2780
|
+
));
|
|
2781
|
+
if (!isChildSubMenu) {
|
|
2782
|
+
return options[0];
|
|
2783
|
+
}
|
|
2784
|
+
return options;
|
|
2785
|
+
}
|
|
2786
|
+
function LevelItem({ dimension, hierarchy, isSubMenu, level, locale, activeItems }) {
|
|
2787
|
+
const [activeFilter, setActiveFilter] = useState(false);
|
|
2788
|
+
const { translate: t } = useTranslation();
|
|
2789
|
+
const actions2 = useActions();
|
|
2790
|
+
const cutItems = useSelector$1(selectCutItems);
|
|
2791
|
+
const dimensions = useSelector$1(selectOlapDimensionItems);
|
|
2792
|
+
const drilldowns = useSelector$1(selectDrilldownMap);
|
|
2793
|
+
const label = useMemo(() => {
|
|
2794
|
+
const captions = [
|
|
2795
|
+
getCaption(dimension, locale),
|
|
2796
|
+
getCaption(hierarchy, locale),
|
|
2797
|
+
getCaption(level, locale)
|
|
2798
|
+
];
|
|
2799
|
+
if (isSubMenu) {
|
|
2800
|
+
return captions[2];
|
|
2801
|
+
}
|
|
2802
|
+
return t("params.dimmenu_level", {
|
|
2803
|
+
abbr: abbreviateFullName(captions, t("params.dimmenu_abbrjoint")),
|
|
2804
|
+
dimension: captions[0],
|
|
2805
|
+
hierarchy: captions[1],
|
|
2806
|
+
level: captions[2]
|
|
2807
|
+
});
|
|
2808
|
+
}, [locale, dimension, hierarchy, level, isSubMenu]);
|
|
2809
|
+
const createCutHandler2 = React10__default.useCallback((level2) => {
|
|
2810
|
+
const cutItem = buildCut({ ...level2, members: [], key: level2.fullName });
|
|
2811
|
+
cutItem.active = false;
|
|
2812
|
+
actions2.updateCut(cutItem);
|
|
2813
|
+
}, []);
|
|
2814
|
+
function createDrilldown(level2, cuts) {
|
|
2815
|
+
const drilldown = buildDrilldown({ ...level2, key: stringifyName(level2), active: false });
|
|
2816
|
+
actions2.updateDrilldown(drilldown);
|
|
2817
|
+
const cut2 = cuts.find((cut3) => cut3.uniqueName === drilldown.uniqueName);
|
|
2818
|
+
if (!cut2) {
|
|
2819
|
+
createCutHandler2({ ...level2, key: stringifyName(level2) });
|
|
2820
|
+
}
|
|
2821
|
+
actions2.willFetchMembers({ ...level2, level: level2.name }).then((members) => {
|
|
2822
|
+
const dimension2 = dimensions.find((dim) => dim.name === level2.dimension);
|
|
2823
|
+
if (!dimension2) return;
|
|
2824
|
+
actions2.updateDrilldown({
|
|
2825
|
+
...drilldown,
|
|
2826
|
+
dimType: dimension2.dimensionType,
|
|
2827
|
+
memberCount: members.length,
|
|
2828
|
+
members
|
|
2829
|
+
});
|
|
2830
|
+
});
|
|
2831
|
+
return drilldown;
|
|
2832
|
+
}
|
|
2833
|
+
const currentDrilldown = drilldowns[stringifyName(level)] || createDrilldown(level, cutItems);
|
|
2834
|
+
const cut = cutItems.find((cut2) => {
|
|
2835
|
+
return cut2.uniqueName === currentDrilldown.uniqueName;
|
|
2836
|
+
});
|
|
2837
|
+
const updatecutHandler = React10__default.useCallback((item, members) => {
|
|
2838
|
+
actions2.updateCut({ ...item, members });
|
|
2839
|
+
}, []);
|
|
2840
|
+
const checked = activeItems.map(stringifyName).includes(stringifyName(level));
|
|
2841
|
+
return /* @__PURE__ */ React10__default.createElement(React10__default.Fragment, null, /* @__PURE__ */ React10__default.createElement(Group, { mt: "sm", position: "apart", key: level.uri, noWrap: true }, /* @__PURE__ */ React10__default.createElement(
|
|
2842
|
+
Checkbox,
|
|
2843
|
+
{
|
|
2844
|
+
onChange: () => {
|
|
2845
|
+
if (cut) {
|
|
2846
|
+
const active = checked ? false : cut.members.length ? true : false;
|
|
2847
|
+
actions2.updateCut({ ...cut, active });
|
|
2848
|
+
}
|
|
2849
|
+
actions2.updateDrilldown({ ...currentDrilldown, active: !currentDrilldown.active });
|
|
2850
|
+
},
|
|
2851
|
+
checked,
|
|
2852
|
+
label,
|
|
2853
|
+
size: "xs"
|
|
2854
|
+
}
|
|
2855
|
+
), /* @__PURE__ */ React10__default.createElement(Group, null, /* @__PURE__ */ React10__default.createElement(ActionIcon, { size: "sm", onClick: () => setActiveFilter((value) => !value) }, activeFilter ? /* @__PURE__ */ React10__default.createElement(IconFilterOff, null) : /* @__PURE__ */ React10__default.createElement(IconFilter, null)), /* @__PURE__ */ React10__default.createElement(ThemeIcon, { size: "xs", color: "gray", variant: "light", bg: "transparent" }, /* @__PURE__ */ React10__default.createElement(StackSVG, null)))), activeFilter && /* @__PURE__ */ React10__default.createElement(Box, { pt: "md" }, /* @__PURE__ */ React10__default.createElement(
|
|
2856
|
+
MultiSelect,
|
|
2857
|
+
{
|
|
2858
|
+
sx: { flex: "1 1 100%" },
|
|
2859
|
+
searchable: true,
|
|
2860
|
+
onChange: (value) => {
|
|
2861
|
+
if (cut) {
|
|
2862
|
+
if (currentDrilldown.active && !cut.active) {
|
|
2863
|
+
updatecutHandler({ ...cut, active: true }, value);
|
|
2864
|
+
} else {
|
|
2865
|
+
updatecutHandler(cut, value);
|
|
2866
|
+
}
|
|
2867
|
+
}
|
|
2868
|
+
},
|
|
2869
|
+
placeholder: `Filter by ${label}`,
|
|
2870
|
+
value: (cut == null ? void 0 : cut.members) || [],
|
|
2871
|
+
data: currentDrilldown.members.map((m) => ({
|
|
2872
|
+
value: String(m.key),
|
|
2873
|
+
label: m.caption ? `${m.caption} ${m.key}` : m.name
|
|
2874
|
+
})),
|
|
2875
|
+
clearable: true,
|
|
2876
|
+
nothingFound: "Nothing found"
|
|
2877
|
+
}
|
|
2878
|
+
)));
|
|
2879
|
+
}
|
|
2880
|
+
function getFilterfnKey(type) {
|
|
2881
|
+
switch (type) {
|
|
2882
|
+
case "greaterThan":
|
|
2883
|
+
return "GT";
|
|
2884
|
+
case "lessThan":
|
|
2885
|
+
return "LT";
|
|
2886
|
+
case "between":
|
|
2887
|
+
return "BT";
|
|
2888
|
+
default:
|
|
2889
|
+
return "Not Found";
|
|
2890
|
+
}
|
|
2891
|
+
}
|
|
2892
|
+
function getFilterFn(filter) {
|
|
2893
|
+
if (filter.conditionOne && filter.conditionTwo) {
|
|
2894
|
+
if (filter.conditionOne[0] === Comparison.GTE && filter.conditionTwo[0] === Comparison.LTE) {
|
|
2895
|
+
return "between";
|
|
2896
|
+
}
|
|
2897
|
+
}
|
|
2898
|
+
if (filter.conditionOne[0] === Comparison.GTE || filter.conditionOne[0] === Comparison.GT) {
|
|
2899
|
+
return "greaterThan";
|
|
2900
|
+
}
|
|
2901
|
+
if (filter.conditionOne[0] === Comparison.LTE) {
|
|
2902
|
+
return "lessThan";
|
|
2903
|
+
}
|
|
2904
|
+
}
|
|
2905
|
+
function getFilterValue(filter) {
|
|
2906
|
+
const filterFn = getFilterFn(filter);
|
|
2907
|
+
const isBetween = filterFn === "between";
|
|
2908
|
+
if (isBetween && filter.conditionTwo) {
|
|
2909
|
+
return [filter.conditionOne[2], filter.conditionTwo[2]];
|
|
2910
|
+
}
|
|
2911
|
+
return filter.conditionOne[2];
|
|
2912
|
+
}
|
|
2913
|
+
function isNotValid(value) {
|
|
2914
|
+
return value === null || value === void 0 || Number.isNaN(value);
|
|
2915
|
+
}
|
|
2916
|
+
function NumberInputComponent({ text, filter }) {
|
|
2917
|
+
const actions2 = useActions();
|
|
2918
|
+
function getFilterValue2(filter2) {
|
|
2919
|
+
return isNotValid(filter2.conditionOne[2]) || filter2.conditionOne[2] === 0 ? "" : filter2.conditionOne[2];
|
|
2920
|
+
}
|
|
2921
|
+
function onInputChange({ filter: filter2, value }) {
|
|
2922
|
+
const isEmpty = value === "";
|
|
2923
|
+
const conditions = getFiltersConditions(getFilterFn(filter2) || "greaterThan", [Number(value)]) || {};
|
|
2924
|
+
const active = isEmpty ? false : true;
|
|
2925
|
+
actions2.updateFilter(buildFilter({ ...filter2, active, ...conditions }));
|
|
2926
|
+
}
|
|
2927
|
+
return /* @__PURE__ */ React10__default.createElement(
|
|
2928
|
+
NumberInput,
|
|
2929
|
+
{
|
|
2930
|
+
description: text,
|
|
2931
|
+
placeholder: text,
|
|
2932
|
+
value: getFilterValue2(filter),
|
|
2933
|
+
onChange: (value) => onInputChange({ filter, value }),
|
|
2934
|
+
sx: { flex: "1 1 auto" },
|
|
2935
|
+
size: "xs"
|
|
2936
|
+
}
|
|
2937
|
+
);
|
|
2938
|
+
}
|
|
2939
|
+
function MinMax({ filter, ...rest }) {
|
|
2940
|
+
const actions2 = useActions();
|
|
2941
|
+
function onInputChangeMinMax(props) {
|
|
2942
|
+
const { filter: filter2, min: min2, max: max2 } = props;
|
|
2943
|
+
const conditions = getFiltersConditions(getFilterFn(filter2) || "greaterThan", [Number(min2), Number(max2)]) || {};
|
|
2944
|
+
const active = Boolean(min2) && Boolean(max2);
|
|
2945
|
+
actions2.updateFilter(buildFilter({ ...filter2, active, ...conditions }));
|
|
2946
|
+
}
|
|
2947
|
+
function getFilterValue2(condition) {
|
|
2948
|
+
if (condition) {
|
|
2949
|
+
return isNotValid(condition[2]) || condition[2] === 0 ? "" : condition[2];
|
|
2950
|
+
}
|
|
2951
|
+
return "";
|
|
2952
|
+
}
|
|
2953
|
+
const min = getFilterValue2(filter.conditionOne);
|
|
2954
|
+
const max = getFilterValue2(filter.conditionTwo);
|
|
2955
|
+
return /* @__PURE__ */ React10__default.createElement(Flex, { gap: "xs" }, /* @__PURE__ */ React10__default.createElement(
|
|
2956
|
+
NumberInput,
|
|
2957
|
+
{
|
|
2958
|
+
placeholder: "Min",
|
|
2959
|
+
description: "Min",
|
|
2960
|
+
value: min,
|
|
2961
|
+
onChange: (value) => onInputChangeMinMax({ filter, min: value, max }),
|
|
2962
|
+
...rest
|
|
2963
|
+
}
|
|
2964
|
+
), /* @__PURE__ */ React10__default.createElement(
|
|
2965
|
+
NumberInput,
|
|
2966
|
+
{
|
|
2967
|
+
placeholder: "Max",
|
|
2968
|
+
description: "Max",
|
|
2969
|
+
value: max,
|
|
2970
|
+
onChange: (value) => onInputChangeMinMax({ filter, min, max: value }),
|
|
2971
|
+
...rest
|
|
2972
|
+
}
|
|
2973
|
+
));
|
|
2974
|
+
}
|
|
2975
|
+
function FilterFnsMenu({ filter }) {
|
|
2976
|
+
const actions2 = useActions();
|
|
2977
|
+
const { translate: t } = useTranslation();
|
|
2978
|
+
return /* @__PURE__ */ React10__default.createElement(React10__default.Fragment, null, /* @__PURE__ */ React10__default.createElement(Menu, { shadow: "md", width: 200 }, /* @__PURE__ */ React10__default.createElement(Menu.Target, null, /* @__PURE__ */ React10__default.createElement(ActionIcon, { size: "xs" }, /* @__PURE__ */ React10__default.createElement(IconSettings, null))), /* @__PURE__ */ React10__default.createElement(Menu.Dropdown, null, /* @__PURE__ */ React10__default.createElement(Menu.Label, null, t("params.filter_mode")), /* @__PURE__ */ React10__default.createElement(
|
|
2979
|
+
Menu.Item,
|
|
2980
|
+
{
|
|
2981
|
+
icon: /* @__PURE__ */ React10__default.createElement(IconMathGreater, { size: 14 }),
|
|
2982
|
+
onClick: () => {
|
|
2983
|
+
const conditions = getFiltersConditions("greaterThan", [0]) || {};
|
|
2984
|
+
actions2.updateFilter(buildFilter({ ...filter, ...conditions, active: false }));
|
|
2985
|
+
}
|
|
2986
|
+
},
|
|
2987
|
+
t("comparison.GT")
|
|
2988
|
+
), /* @__PURE__ */ React10__default.createElement(
|
|
2989
|
+
Menu.Item,
|
|
2990
|
+
{
|
|
2991
|
+
icon: /* @__PURE__ */ React10__default.createElement(IconMathLower, { size: 14 }),
|
|
2992
|
+
onClick: () => {
|
|
2993
|
+
const conditions = getFiltersConditions("lessThan", [0]) || {};
|
|
2994
|
+
actions2.updateFilter(buildFilter({ ...filter, ...conditions, active: false }));
|
|
2995
|
+
}
|
|
2996
|
+
},
|
|
2997
|
+
t("comparison.LT")
|
|
2998
|
+
), /* @__PURE__ */ React10__default.createElement(
|
|
2999
|
+
Menu.Item,
|
|
3000
|
+
{
|
|
3001
|
+
icon: /* @__PURE__ */ React10__default.createElement(IconArrowsLeftRight, { size: 14 }),
|
|
3002
|
+
onClick: () => {
|
|
3003
|
+
const conditions = getFiltersConditions("between", [0, 0]) || {};
|
|
3004
|
+
actions2.updateFilter(buildFilter({ ...filter, ...conditions, active: false }));
|
|
3005
|
+
}
|
|
3006
|
+
},
|
|
3007
|
+
t("comparison.BT")
|
|
3008
|
+
))));
|
|
3009
|
+
}
|
|
3010
|
+
function MeasuresOptions() {
|
|
3011
|
+
useSelector$1(selectLocale);
|
|
3012
|
+
useTranslation();
|
|
3013
|
+
const itemMap = useSelector$1(selectMeasureMap);
|
|
3014
|
+
const filtersMap = useSelector$1(selectFilterMap);
|
|
3015
|
+
const filtersItems = useSelector$1(selectFilterItems);
|
|
3016
|
+
const measures = useSelector$1(selectOlapMeasureItems);
|
|
3017
|
+
const actions2 = useActions();
|
|
3018
|
+
function handlerCreateMeasure(data) {
|
|
3019
|
+
const measure = buildMeasure(data);
|
|
3020
|
+
actions2.updateMeasure(measure);
|
|
3021
|
+
return measure;
|
|
3022
|
+
}
|
|
3023
|
+
function handlerCreateFilter(data) {
|
|
3024
|
+
const filter = buildFilter(data);
|
|
3025
|
+
actions2.updateFilter(filter);
|
|
3026
|
+
return filter;
|
|
3027
|
+
}
|
|
3028
|
+
const filteredItems = useMemo(() => {
|
|
3029
|
+
return filterMap(measures, (m) => {
|
|
3030
|
+
const measure = itemMap[m.name] || handlerCreateMeasure({ ...m, active: false });
|
|
3031
|
+
const foundFilter = filtersMap[m.name] || filtersItems.find((f) => f.measure === measure.name);
|
|
3032
|
+
const filter = foundFilter || handlerCreateFilter({
|
|
3033
|
+
measure: measure.name,
|
|
3034
|
+
active: false,
|
|
3035
|
+
key: measure.name
|
|
3036
|
+
});
|
|
3037
|
+
return { measure, filter };
|
|
3038
|
+
});
|
|
3039
|
+
}, [itemMap, measures, filtersMap, filtersItems]);
|
|
3040
|
+
const activeItems = filteredItems.filter((f) => isActiveItem(f.measure));
|
|
3041
|
+
const options = filteredItems.map(({ measure, filter }) => {
|
|
3042
|
+
return /* @__PURE__ */ React10__default.createElement(FilterItem4, { measure, filter, activeItems });
|
|
3043
|
+
});
|
|
3044
|
+
return options;
|
|
3045
|
+
}
|
|
3046
|
+
function FilterItem4({
|
|
3047
|
+
measure,
|
|
3048
|
+
filter,
|
|
3049
|
+
activeItems
|
|
3050
|
+
}) {
|
|
3051
|
+
const [activeFilter, setActiveFilter] = useState(false);
|
|
3052
|
+
const { translate: t } = useTranslation();
|
|
3053
|
+
const filterFn = getFilterFn(filter);
|
|
3054
|
+
const text = t(`comparison.${getFilterfnKey(filterFn)}`);
|
|
3055
|
+
const isBetween = filterFn === "between";
|
|
3056
|
+
const checked = activeItems.map((active) => active.measure.name).includes(measure.name);
|
|
3057
|
+
const actions2 = useActions();
|
|
3058
|
+
return /* @__PURE__ */ React10__default.createElement(Box, { key: measure.name }, /* @__PURE__ */ React10__default.createElement(Group, { mt: "sm", position: "apart" }, /* @__PURE__ */ React10__default.createElement(
|
|
3059
|
+
Checkbox,
|
|
3060
|
+
{
|
|
3061
|
+
onChange: () => {
|
|
3062
|
+
actions2.updateMeasure({ ...measure, active: !measure.active });
|
|
3063
|
+
actions2.updateFilter({ ...filter, active: checked ? false : true });
|
|
3064
|
+
},
|
|
3065
|
+
checked,
|
|
3066
|
+
label: measure.name,
|
|
3067
|
+
size: "xs"
|
|
3068
|
+
}
|
|
3069
|
+
), /* @__PURE__ */ React10__default.createElement(Group, null, activeFilter && /* @__PURE__ */ React10__default.createElement(FilterFnsMenu, { filter }), /* @__PURE__ */ React10__default.createElement(ActionIcon, { size: "xs", onClick: () => setActiveFilter((value) => !value) }, activeFilter ? /* @__PURE__ */ React10__default.createElement(IconFilterOff, null) : /* @__PURE__ */ React10__default.createElement(IconFilter, null)), /* @__PURE__ */ React10__default.createElement(ThemeIcon, { size: "xs", color: "gray", variant: "light", bg: "transparent" }, /* @__PURE__ */ React10__default.createElement(BarsSVG, null)))), activeFilter && /* @__PURE__ */ React10__default.createElement(Box, { pt: "md" }, isBetween ? /* @__PURE__ */ React10__default.createElement(MinMax, { filter }) : /* @__PURE__ */ React10__default.createElement(NumberInputComponent, { text, filter })));
|
|
3070
|
+
}
|
|
3071
|
+
var DrawerMenu_default = AddColumnsDrawer;
|
|
3072
|
+
var removeColumn = (actions2, entity, measures, drilldowns) => {
|
|
3073
|
+
if (entity._type === "measure") {
|
|
3074
|
+
if (entity.name) {
|
|
3075
|
+
const measure = measures.find((d) => d.name === entity.name);
|
|
3076
|
+
measure && actions2.updateMeasure({ ...measure, active: false });
|
|
3077
|
+
}
|
|
3078
|
+
}
|
|
3079
|
+
if (entity._type === "level") {
|
|
3080
|
+
const drilldown = drilldowns.find((d) => d.uniqueName === (entity == null ? void 0 : entity.uniqueName));
|
|
3081
|
+
drilldown && actions2.updateDrilldown({ ...drilldown, active: false });
|
|
3082
|
+
}
|
|
3083
|
+
};
|
|
3084
|
+
function showTrashIcon(columns, type) {
|
|
3085
|
+
const result = columns.filter((c) => c.entityType === type);
|
|
3086
|
+
return result.length > 1;
|
|
3087
|
+
}
|
|
3088
|
+
var getActionIcon = (entityType) => {
|
|
3089
|
+
if (entityType === "measure") {
|
|
3090
|
+
return /* @__PURE__ */ React10__default.createElement(ActionIcon, { size: "md", color: "red" }, /* @__PURE__ */ React10__default.createElement(BarsSVG, null));
|
|
3091
|
+
} else if (entityType === "level") {
|
|
3092
|
+
return /* @__PURE__ */ React10__default.createElement(ActionIcon, { size: "md", color: "blue" }, /* @__PURE__ */ React10__default.createElement(StackSVG, null));
|
|
3093
|
+
}
|
|
3094
|
+
};
|
|
3095
|
+
var getEntityText = (entityType) => {
|
|
3096
|
+
switch (entityType) {
|
|
3097
|
+
case "measure":
|
|
3098
|
+
return "Metric";
|
|
3099
|
+
case "level":
|
|
3100
|
+
return "Dimension";
|
|
3101
|
+
default:
|
|
3102
|
+
return "";
|
|
3103
|
+
}
|
|
3104
|
+
};
|
|
3105
|
+
function getMantineFilterMultiSelectProps(isId, isNumeric, range) {
|
|
3106
|
+
let result = {};
|
|
3107
|
+
const filterVariant = !isId && !isNumeric && (!range || range && range[1] - range[0] <= 100) ? "multi-select" : "text";
|
|
3108
|
+
result = Object.assign({}, result, { filterVariant });
|
|
3109
|
+
return result;
|
|
3110
|
+
}
|
|
3111
|
+
function getSortIcon(value, entityType) {
|
|
3112
|
+
switch (value) {
|
|
3113
|
+
case "asc":
|
|
3114
|
+
return entityType === "measure" ? /* @__PURE__ */ React10__default.createElement(IconSortAscendingNumbers, null) : /* @__PURE__ */ React10__default.createElement(IconSortAscendingLetters, null);
|
|
3115
|
+
case "desc":
|
|
3116
|
+
return entityType === "measure" ? /* @__PURE__ */ React10__default.createElement(IconSortDescendingNumbers, null) : /* @__PURE__ */ React10__default.createElement(IconSortDescendingLetters, null);
|
|
3117
|
+
default:
|
|
3118
|
+
return /* @__PURE__ */ React10__default.createElement(IconArrowsSort, null);
|
|
3119
|
+
}
|
|
3120
|
+
}
|
|
3121
|
+
function getFiltersConditions(fn, value) {
|
|
3122
|
+
var _a;
|
|
3123
|
+
const comparisonMap = /* @__PURE__ */ new Map([
|
|
3124
|
+
[
|
|
3125
|
+
"greaterThan",
|
|
3126
|
+
(value2) => ({
|
|
3127
|
+
conditionOne: [Comparison.GTE, String(value2[0]), Number(value2[0])],
|
|
3128
|
+
conditionTwo: [Comparison.GT, "0", 0]
|
|
3129
|
+
})
|
|
3130
|
+
],
|
|
3131
|
+
[
|
|
3132
|
+
"lessThan",
|
|
3133
|
+
(value2) => ({
|
|
3134
|
+
conditionOne: [Comparison.LTE, String(value2[0]), Number(value2[0])],
|
|
3135
|
+
conditionTwo: [Comparison.GT, "0", 0]
|
|
3136
|
+
})
|
|
3137
|
+
],
|
|
3138
|
+
[
|
|
3139
|
+
"between",
|
|
3140
|
+
(values) => {
|
|
3141
|
+
const [min, max] = values;
|
|
3142
|
+
return {
|
|
3143
|
+
conditionOne: [Comparison.GTE, String(min), Number(min)],
|
|
3144
|
+
conditionTwo: [Comparison.LTE, String(max), Number(max)],
|
|
3145
|
+
joint: "and"
|
|
3146
|
+
};
|
|
3147
|
+
}
|
|
3148
|
+
]
|
|
3149
|
+
]);
|
|
3150
|
+
return (_a = comparisonMap.get(fn)) == null ? void 0 : _a(value);
|
|
3151
|
+
}
|
|
3152
|
+
function useTableData({ offset, limit, columns, filters, cuts }) {
|
|
3153
|
+
const normalizedFilters = filters.map((filter) => ({
|
|
3154
|
+
id: filter.measure,
|
|
3155
|
+
value: getFilterValue(filter)
|
|
3156
|
+
// fn: getFilterFn(filter)
|
|
3157
|
+
}));
|
|
3158
|
+
const normalizedCuts = cuts.map((cut) => ({ id: cut.uniqueName, members: cut.members }));
|
|
3159
|
+
const filterKey = JSON.stringify(normalizedFilters);
|
|
3160
|
+
const cutKey = JSON.stringify(normalizedCuts);
|
|
3161
|
+
const actions2 = useActions();
|
|
3162
|
+
const columnsStr = JSON.stringify(columns.sort());
|
|
3163
|
+
const page = offset;
|
|
3164
|
+
const [filterKeydebouced, setDebouncedTerm] = useState([
|
|
3165
|
+
limit,
|
|
3166
|
+
offset,
|
|
3167
|
+
columnsStr,
|
|
3168
|
+
filterKey,
|
|
3169
|
+
cutKey,
|
|
3170
|
+
page
|
|
3171
|
+
]);
|
|
3172
|
+
useEffect(() => {
|
|
3173
|
+
const handler = debounce(() => {
|
|
3174
|
+
const term = [limit, offset, columnsStr, filterKey, cutKey, page];
|
|
3175
|
+
setDebouncedTerm(term);
|
|
3176
|
+
}, 700);
|
|
3177
|
+
handler();
|
|
3178
|
+
return () => handler.cancel();
|
|
3179
|
+
}, [columnsStr, offset, filterKey, cutKey, page]);
|
|
3180
|
+
return useQuery({
|
|
3181
|
+
queryKey: ["table", filterKeydebouced],
|
|
3182
|
+
queryFn: () => {
|
|
3183
|
+
return actions2.willExecuteQuery().then((res) => {
|
|
3184
|
+
const { data, types } = res;
|
|
3185
|
+
return { data: data != null ? data : [], types };
|
|
3186
|
+
});
|
|
3187
|
+
},
|
|
3188
|
+
staleTime: 3e5,
|
|
3189
|
+
enabled: !!filterKeydebouced
|
|
3190
|
+
});
|
|
3191
|
+
}
|
|
3192
|
+
function useTable({
|
|
3193
|
+
cube,
|
|
3194
|
+
result,
|
|
3195
|
+
columnFilter = () => true,
|
|
3196
|
+
columnSorting = () => 0,
|
|
3197
|
+
...mantineTableProps
|
|
3198
|
+
}) {
|
|
3199
|
+
const { types } = result;
|
|
3200
|
+
const filterItems = useSelector$1(selectFilterItems);
|
|
3201
|
+
const filtersMap = useSelector$1(selectFilterMap);
|
|
3202
|
+
const measuresOlap = useSelector$1(selectOlapMeasureItems);
|
|
3203
|
+
const measuresMap = useSelector$1(selectMeasureMap);
|
|
3204
|
+
const drilldowns = useSelector$1(selectDrilldownItems);
|
|
3205
|
+
const measures = useSelector$1(selectMeasureItems);
|
|
3206
|
+
const actions2 = useActions();
|
|
3207
|
+
const itemsCuts = useSelector$1(selectCutItems);
|
|
3208
|
+
const { limit, offset } = useSelector$1(selectPaginationParams);
|
|
3209
|
+
const [pagination, setPagination] = useState({
|
|
3210
|
+
pageIndex: offset,
|
|
3211
|
+
pageSize: limit
|
|
3212
|
+
});
|
|
3213
|
+
const finalUniqueKeys = useMemo(
|
|
3214
|
+
() => [
|
|
3215
|
+
...measures.map((m) => m.active ? m.name : null),
|
|
3216
|
+
...drilldowns.map((d) => d.active ? d.uniqueName : null)
|
|
3217
|
+
].filter((a) => a !== null),
|
|
3218
|
+
[measures, drilldowns]
|
|
2903
3219
|
);
|
|
2904
|
-
|
|
3220
|
+
function handlerCreateMeasure(data2) {
|
|
3221
|
+
const measure = buildMeasure(data2);
|
|
3222
|
+
actions2.updateMeasure(measure);
|
|
3223
|
+
return measure;
|
|
3224
|
+
}
|
|
3225
|
+
function handlerCreateFilter(data2) {
|
|
3226
|
+
const filter = buildFilter(data2);
|
|
3227
|
+
actions2.updateFilter(filter);
|
|
3228
|
+
return filter;
|
|
3229
|
+
}
|
|
3230
|
+
useMemo(() => {
|
|
3231
|
+
return filterMap(measuresOlap, (m) => {
|
|
3232
|
+
const measure = measuresMap[m.name] || handlerCreateMeasure({ ...m, active: false });
|
|
3233
|
+
const foundFilter = filtersMap[m.name] || filterItems.find((f) => f.measure === measure.name);
|
|
3234
|
+
const filter = foundFilter || handlerCreateFilter({
|
|
3235
|
+
measure: measure.name,
|
|
3236
|
+
active: false,
|
|
3237
|
+
key: measure.name
|
|
3238
|
+
});
|
|
3239
|
+
return { measure, filter };
|
|
3240
|
+
});
|
|
3241
|
+
}, [measuresMap, measuresOlap, filtersMap, filterItems]);
|
|
3242
|
+
const { isLoading, isFetching, isError, data } = useTableData({
|
|
3243
|
+
offset,
|
|
3244
|
+
limit,
|
|
3245
|
+
columns: finalUniqueKeys,
|
|
3246
|
+
filters: filterItems.filter(isActiveItem),
|
|
3247
|
+
cuts: itemsCuts.filter(isActiveCut)
|
|
3248
|
+
});
|
|
3249
|
+
const tableData = (data == null ? void 0 : data.data) || [];
|
|
3250
|
+
const tableTypes = (data == null ? void 0 : data.types) || types;
|
|
3251
|
+
const finalKeys = Object.values(tableTypes).filter((t2) => !t2.isId).filter(columnFilter).sort(columnSorting);
|
|
3252
|
+
const totalRowCount = result.data.length === limit ? limit * 10 : result.data.length;
|
|
3253
|
+
const fetchedTableData = tableData != null ? tableData : [];
|
|
3254
|
+
useEffect(() => {
|
|
3255
|
+
actions2.updatePagination({
|
|
3256
|
+
limit: pagination.pageSize,
|
|
3257
|
+
offset: pagination.pageIndex * pagination.pageSize
|
|
3258
|
+
});
|
|
3259
|
+
}, [pagination]);
|
|
2905
3260
|
const { translate: t } = useTranslation();
|
|
2906
3261
|
const { currentFormats, getAvailableKeys, getFormatter, getFormatterKey, setFormat } = useFormatter(
|
|
2907
3262
|
cube.measures
|
|
2908
3263
|
);
|
|
2909
|
-
const finalKeys = Object.values(types).filter((t2) => !t2.isId).filter(columnFilter).sort(columnSorting);
|
|
2910
3264
|
const columns = useMemo(() => {
|
|
2911
|
-
|
|
3265
|
+
const indexColumn = {
|
|
3266
|
+
id: "#",
|
|
3267
|
+
Header: "#",
|
|
3268
|
+
Cell: ({ row }) => row.index + 1,
|
|
3269
|
+
minWidth: 50,
|
|
3270
|
+
maxWidth: 50,
|
|
3271
|
+
width: 50,
|
|
3272
|
+
maxSize: 50,
|
|
3273
|
+
size: 50
|
|
3274
|
+
};
|
|
3275
|
+
const columnsDef = finalKeys.map((column) => {
|
|
3276
|
+
var _a;
|
|
2912
3277
|
const {
|
|
2913
3278
|
entity,
|
|
2914
3279
|
entityType,
|
|
@@ -2918,21 +3283,11 @@ function useTable({
|
|
|
2918
3283
|
range,
|
|
2919
3284
|
isId
|
|
2920
3285
|
} = column;
|
|
2921
|
-
const isNumeric = valueType === "number";
|
|
3286
|
+
const isNumeric = valueType === "number" && columnKey !== "Year";
|
|
2922
3287
|
const formatterKey = getFormatterKey(columnKey) || (isNumeric ? "Decimal" : "identity");
|
|
2923
3288
|
const formatter = getFormatter(formatterKey);
|
|
2924
|
-
const
|
|
2925
|
-
const mantineFilterVariantObject = getMantineFilterMultiSelectProps(
|
|
2926
|
-
isId,
|
|
2927
|
-
isNumeric,
|
|
2928
|
-
range,
|
|
2929
|
-
entity,
|
|
2930
|
-
drilldowns,
|
|
2931
|
-
data,
|
|
2932
|
-
columnKey
|
|
2933
|
-
);
|
|
3289
|
+
const mantineFilterVariantObject = getMantineFilterMultiSelectProps(isId, isNumeric, range);
|
|
2934
3290
|
return {
|
|
2935
|
-
...filterOption,
|
|
2936
3291
|
...mantineFilterVariantObject,
|
|
2937
3292
|
entityType,
|
|
2938
3293
|
header,
|
|
@@ -2946,10 +3301,8 @@ function useTable({
|
|
|
2946
3301
|
}
|
|
2947
3302
|
return 0;
|
|
2948
3303
|
},
|
|
2949
|
-
getFilterValue: () => {
|
|
2950
|
-
},
|
|
2951
3304
|
Header: ({ column: column2 }) => {
|
|
2952
|
-
return /* @__PURE__ */
|
|
3305
|
+
return /* @__PURE__ */ React10__default.createElement(Box, { mb: rem(5) }, /* @__PURE__ */ React10__default.createElement(Flex, { justify: "center", align: "center" }, /* @__PURE__ */ React10__default.createElement(Box, { sx: { flexGrow: 1 } }, /* @__PURE__ */ React10__default.createElement(Flex, { gap: "xs", align: "center" }, getActionIcon(entityType), /* @__PURE__ */ React10__default.createElement(Text, { size: "sm" }, column2.columnDef.header), /* @__PURE__ */ React10__default.createElement(
|
|
2953
3306
|
ActionIcon,
|
|
2954
3307
|
{
|
|
2955
3308
|
key: `sort-${column2.columnDef.header}`,
|
|
@@ -2958,7 +3311,7 @@ function useTable({
|
|
|
2958
3311
|
onClick: column2.getToggleSortingHandler()
|
|
2959
3312
|
},
|
|
2960
3313
|
getSortIcon(column2.getIsSorted(), entityType)
|
|
2961
|
-
))
|
|
3314
|
+
))), /* @__PURE__ */ React10__default.createElement(
|
|
2962
3315
|
CustomActionIcon_default,
|
|
2963
3316
|
{
|
|
2964
3317
|
label: `At least one ${getEntityText(entityType)} is required.`,
|
|
@@ -2969,18 +3322,17 @@ function useTable({
|
|
|
2969
3322
|
size: 25,
|
|
2970
3323
|
ml: rem(5)
|
|
2971
3324
|
},
|
|
2972
|
-
/* @__PURE__ */
|
|
3325
|
+
/* @__PURE__ */ React10__default.createElement(IconTrash, null)
|
|
2973
3326
|
)));
|
|
2974
3327
|
},
|
|
2975
|
-
size: isId ? 80 : void 0,
|
|
2976
3328
|
formatter,
|
|
2977
3329
|
formatterKey,
|
|
2978
|
-
id:
|
|
3330
|
+
id: (_a = entity.uniqueName) != null ? _a : entity.name,
|
|
2979
3331
|
dataType: valueType,
|
|
2980
3332
|
accessorFn: (item) => item[columnKey],
|
|
2981
3333
|
Cell: isNumeric ? ({ cell }) => formatter(cell.getValue()) : ({ cell, renderedCellValue, row }) => {
|
|
2982
3334
|
const cellId = row.original[`${cell.column.id} ID`];
|
|
2983
|
-
return /* @__PURE__ */
|
|
3335
|
+
return /* @__PURE__ */ React10__default.createElement(Flex, { justify: "space-between", sx: { width: "100%", maxWidth: 400 }, gap: "sm" }, /* @__PURE__ */ React10__default.createElement(
|
|
2984
3336
|
Text,
|
|
2985
3337
|
{
|
|
2986
3338
|
size: "sm",
|
|
@@ -2991,14 +3343,18 @@ function useTable({
|
|
|
2991
3343
|
}
|
|
2992
3344
|
},
|
|
2993
3345
|
renderedCellValue
|
|
2994
|
-
), /* @__PURE__ */
|
|
3346
|
+
), /* @__PURE__ */ React10__default.createElement(Box, null, cellId && /* @__PURE__ */ React10__default.createElement(Text, { color: "dimmed" }, cellId)));
|
|
2995
3347
|
}
|
|
2996
3348
|
};
|
|
2997
3349
|
});
|
|
2998
|
-
|
|
3350
|
+
return columnsDef.length ? [indexColumn, ...columnsDef] : [];
|
|
3351
|
+
}, [currentFormats, tableData, tableTypes, drilldowns, measures]);
|
|
2999
3352
|
const constTableProps = useMemo(
|
|
3000
3353
|
() => ({
|
|
3001
|
-
|
|
3354
|
+
mantineToolbarAlertBannerProps: isError ? {
|
|
3355
|
+
color: "red",
|
|
3356
|
+
children: "Error loading data."
|
|
3357
|
+
} : void 0,
|
|
3002
3358
|
enableColumnFilterModes: true,
|
|
3003
3359
|
enableColumnResizing: true,
|
|
3004
3360
|
enableDensityToggle: false,
|
|
@@ -3008,27 +3364,10 @@ function useTable({
|
|
|
3008
3364
|
showRowsPerPage: false
|
|
3009
3365
|
},
|
|
3010
3366
|
paginationDisplayMode: "pages",
|
|
3011
|
-
enableRowNumbers: true,
|
|
3012
|
-
rowNumberMode: "static",
|
|
3013
|
-
displayColumnDefOptions: {
|
|
3014
|
-
"mrt-row-numbers": {
|
|
3015
|
-
size: 10,
|
|
3016
|
-
maxSize: 25,
|
|
3017
|
-
enableOrdering: true,
|
|
3018
|
-
mantineTableBodyCellProps: {
|
|
3019
|
-
sx: (t2) => ({
|
|
3020
|
-
fontSize: t2.fontSizes.sm,
|
|
3021
|
-
color: t2.colors.gray[6]
|
|
3022
|
-
})
|
|
3023
|
-
}
|
|
3024
|
-
}
|
|
3025
|
-
},
|
|
3026
3367
|
enableRowVirtualization: false,
|
|
3027
|
-
|
|
3368
|
+
globalFilterFn: "contains",
|
|
3028
3369
|
initialState: {
|
|
3029
|
-
density: "xs"
|
|
3030
|
-
showColumnFilters: true,
|
|
3031
|
-
pagination: { pageSize: 100, pageIndex: 0 }
|
|
3370
|
+
density: "xs"
|
|
3032
3371
|
},
|
|
3033
3372
|
mantineBottomToolbarProps: {
|
|
3034
3373
|
id: "query-results-table-view-footer"
|
|
@@ -3036,8 +3375,9 @@ function useTable({
|
|
|
3036
3375
|
mantineTableProps: {
|
|
3037
3376
|
sx: {
|
|
3038
3377
|
"& td": {
|
|
3039
|
-
padding: "7px 10px!important"
|
|
3040
|
-
}
|
|
3378
|
+
padding: "7px 10px !important"
|
|
3379
|
+
},
|
|
3380
|
+
tableLayout: "fixed"
|
|
3041
3381
|
},
|
|
3042
3382
|
withColumnBorders: true
|
|
3043
3383
|
},
|
|
@@ -3068,12 +3408,12 @@ function useTable({
|
|
|
3068
3408
|
}
|
|
3069
3409
|
},
|
|
3070
3410
|
renderBottomToolbar() {
|
|
3071
|
-
const [isOpen, setIsOpen] = useState(
|
|
3411
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
3072
3412
|
if (!isOpen) return null;
|
|
3073
|
-
return /* @__PURE__ */
|
|
3413
|
+
return /* @__PURE__ */ React10__default.createElement(
|
|
3074
3414
|
Alert,
|
|
3075
3415
|
{
|
|
3076
|
-
icon: /* @__PURE__ */
|
|
3416
|
+
icon: /* @__PURE__ */ React10__default.createElement(IconAlertCircle, { size: "1rem" }),
|
|
3077
3417
|
color: "yellow",
|
|
3078
3418
|
withCloseButton: true,
|
|
3079
3419
|
onClose: () => setIsOpen(false)
|
|
@@ -3082,30 +3422,41 @@ function useTable({
|
|
|
3082
3422
|
);
|
|
3083
3423
|
}
|
|
3084
3424
|
}),
|
|
3085
|
-
[
|
|
3425
|
+
[isError]
|
|
3086
3426
|
);
|
|
3087
3427
|
const table = useMantineReactTable({
|
|
3088
3428
|
columns,
|
|
3089
|
-
data,
|
|
3429
|
+
data: fetchedTableData,
|
|
3430
|
+
onPaginationChange: setPagination,
|
|
3090
3431
|
enableHiding: false,
|
|
3432
|
+
manualFiltering: true,
|
|
3433
|
+
manualPagination: true,
|
|
3434
|
+
manualSorting: false,
|
|
3435
|
+
rowCount: totalRowCount,
|
|
3436
|
+
state: {
|
|
3437
|
+
isLoading: isLoading || isFetching || data === void 0,
|
|
3438
|
+
pagination,
|
|
3439
|
+
showAlertBanner: isError,
|
|
3440
|
+
showProgressBars: isFetching || isLoading
|
|
3441
|
+
},
|
|
3091
3442
|
...constTableProps,
|
|
3092
3443
|
...mantineTableProps
|
|
3093
3444
|
});
|
|
3094
|
-
return { table };
|
|
3445
|
+
return { table, isError, isLoading, data: fetchedTableData };
|
|
3095
3446
|
}
|
|
3096
|
-
function TableView({ table, result }) {
|
|
3097
|
-
|
|
3098
|
-
|
|
3447
|
+
function TableView({ table, result, isError, isLoading, data }) {
|
|
3448
|
+
const isData = Boolean(table.getRowModel().rows.length);
|
|
3449
|
+
return /* @__PURE__ */ React10__default.createElement(Box, { sx: { height: "100%" } }, /* @__PURE__ */ React10__default.createElement(Flex, { direction: "column", justify: "space-between", sx: { height: "100%", flex: "1 1 auto" } }, /* @__PURE__ */ React10__default.createElement(MRT_ProgressBar, { isTopToolbar: false, table }), /* @__PURE__ */ React10__default.createElement(
|
|
3450
|
+
ScrollArea,
|
|
3099
3451
|
{
|
|
3452
|
+
h: isData ? "100%" : "auto",
|
|
3100
3453
|
sx: {
|
|
3101
3454
|
flex: "1 1 auto",
|
|
3102
|
-
height: "100%",
|
|
3103
|
-
maxHeight: "calc(100vh - 70px)",
|
|
3104
3455
|
position: "relative",
|
|
3105
|
-
|
|
3456
|
+
overflow: "scroll"
|
|
3106
3457
|
}
|
|
3107
3458
|
},
|
|
3108
|
-
/* @__PURE__ */
|
|
3459
|
+
/* @__PURE__ */ React10__default.createElement(
|
|
3109
3460
|
Table,
|
|
3110
3461
|
{
|
|
3111
3462
|
captionSide: "top",
|
|
@@ -3117,85 +3468,57 @@ function TableView({ table, result }) {
|
|
|
3117
3468
|
withBorder: true,
|
|
3118
3469
|
withColumnBorders: true
|
|
3119
3470
|
},
|
|
3120
|
-
/* @__PURE__ */
|
|
3471
|
+
/* @__PURE__ */ React10__default.createElement(
|
|
3121
3472
|
Box,
|
|
3122
3473
|
{
|
|
3123
3474
|
component: "thead",
|
|
3124
3475
|
sx: {
|
|
3125
3476
|
position: "relative",
|
|
3126
|
-
top: 0
|
|
3477
|
+
top: 0,
|
|
3478
|
+
zIndex: 10
|
|
3127
3479
|
}
|
|
3128
3480
|
},
|
|
3129
|
-
table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */
|
|
3130
|
-
var _a
|
|
3481
|
+
table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ React10__default.createElement(Box, { component: "tr", key: headerGroup.id, sx: { fontWeight: "normal" } }, headerGroup.headers.map((header) => {
|
|
3482
|
+
var _a;
|
|
3131
3483
|
const column = table.getColumn(header.id);
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
backgroundColor: theme.colorScheme === "dark" ? theme.colors.dark[7] : theme.colors.gray[0],
|
|
3169
|
-
display: "table-cell"
|
|
3170
|
-
})
|
|
3171
|
-
},
|
|
3172
|
-
/* @__PURE__ */ React13__default.createElement(Box, null, header.isPlaceholder ? null : flexRender(
|
|
3173
|
-
(_b = header.column.columnDef.Header) != null ? _b : header.column.columnDef.header,
|
|
3174
|
-
header.getContext()
|
|
3175
|
-
))
|
|
3176
|
-
));
|
|
3177
|
-
}
|
|
3178
|
-
}), /* @__PURE__ */ React13__default.createElement(
|
|
3179
|
-
Box,
|
|
3180
|
-
{
|
|
3181
|
-
component: "th",
|
|
3182
|
-
key: "placeholder",
|
|
3183
|
-
sx: (theme) => ({
|
|
3184
|
-
backgroundColor: theme.colorScheme === "dark" ? theme.colors.dark[7] : theme.colors.gray[0],
|
|
3185
|
-
align: "center",
|
|
3186
|
-
height: 60,
|
|
3187
|
-
paddingBottom: 10,
|
|
3188
|
-
width: 20,
|
|
3189
|
-
position: "sticky",
|
|
3190
|
-
top: 0,
|
|
3191
|
-
display: "table-cell",
|
|
3192
|
-
textAlign: "center"
|
|
3193
|
-
})
|
|
3194
|
-
},
|
|
3195
|
-
/* @__PURE__ */ React13__default.createElement(OptionsMenu_default, null, /* @__PURE__ */ React13__default.createElement(PlusSVG, null))
|
|
3196
|
-
)))
|
|
3484
|
+
const isNumeric = column.columnDef.dataType === "number";
|
|
3485
|
+
const isRowIndex = column.id === "#";
|
|
3486
|
+
const base = (theme) => ({
|
|
3487
|
+
backgroundColor: theme.colorScheme === "dark" ? theme.colors.dark[7] : theme.colors.gray[0],
|
|
3488
|
+
align: isNumeric ? "right" : "left",
|
|
3489
|
+
height: 60,
|
|
3490
|
+
paddingBottom: 10,
|
|
3491
|
+
minWidth: 210,
|
|
3492
|
+
width: 300,
|
|
3493
|
+
maxWidth: 450,
|
|
3494
|
+
position: "sticky",
|
|
3495
|
+
fontSize: theme.fontSizes.sm,
|
|
3496
|
+
top: 0,
|
|
3497
|
+
display: "table-cell"
|
|
3498
|
+
});
|
|
3499
|
+
const index = (theme) => ({
|
|
3500
|
+
...base(theme),
|
|
3501
|
+
minWidth: 10,
|
|
3502
|
+
width: 10,
|
|
3503
|
+
maxWidth: 10,
|
|
3504
|
+
size: 10
|
|
3505
|
+
});
|
|
3506
|
+
return /* @__PURE__ */ React10__default.createElement(
|
|
3507
|
+
Box,
|
|
3508
|
+
{
|
|
3509
|
+
component: "th",
|
|
3510
|
+
key: header.id,
|
|
3511
|
+
sx: (theme) => isRowIndex ? index(theme) : base(theme)
|
|
3512
|
+
},
|
|
3513
|
+
header.isPlaceholder ? null : flexRender(
|
|
3514
|
+
(_a = header.column.columnDef.Header) != null ? _a : header.column.columnDef.header,
|
|
3515
|
+
header.getContext()
|
|
3516
|
+
),
|
|
3517
|
+
!isRowIndex && /* @__PURE__ */ React10__default.createElement(ColumnFilterCell, { isNumeric, header, table })
|
|
3518
|
+
);
|
|
3519
|
+
})))
|
|
3197
3520
|
),
|
|
3198
|
-
/* @__PURE__ */
|
|
3521
|
+
isData && /* @__PURE__ */ React10__default.createElement(Box, { component: "tbody" }, table.getRowModel().rows.map((row) => /* @__PURE__ */ React10__default.createElement("tr", { key: row.id }, row.getVisibleCells().map((cell) => /* @__PURE__ */ React10__default.createElement(
|
|
3199
3522
|
MRT_TableBodyCell,
|
|
3200
3523
|
{
|
|
3201
3524
|
key: cell.id,
|
|
@@ -3204,25 +3527,96 @@ function TableView({ table, result }) {
|
|
|
3204
3527
|
table
|
|
3205
3528
|
}
|
|
3206
3529
|
)))))
|
|
3207
|
-
)
|
|
3208
|
-
|
|
3530
|
+
),
|
|
3531
|
+
!isData && !isError && !isLoading && /* @__PURE__ */ React10__default.createElement(NoRecords, null)
|
|
3532
|
+
), /* @__PURE__ */ React10__default.createElement(MRT_ToolbarAlertBanner, { stackAlertBanner: true, table }), /* @__PURE__ */ React10__default.createElement(TableFooter_default, { table, data, result })));
|
|
3533
|
+
}
|
|
3534
|
+
var ColumnFilterCell = ({
|
|
3535
|
+
header,
|
|
3536
|
+
isNumeric
|
|
3537
|
+
}) => {
|
|
3538
|
+
const filterVariant = header.column.columnDef.filterVariant;
|
|
3539
|
+
const isMulti = filterVariant === "multi-select";
|
|
3540
|
+
if (isMulti) {
|
|
3541
|
+
return /* @__PURE__ */ React10__default.createElement(MultiFilter, { header });
|
|
3542
|
+
}
|
|
3543
|
+
if (isNumeric) {
|
|
3544
|
+
return /* @__PURE__ */ React10__default.createElement(NumericFilter, { header });
|
|
3545
|
+
}
|
|
3546
|
+
};
|
|
3547
|
+
function NumericFilter({ header }) {
|
|
3548
|
+
const filters = useSelector$1(selectFilterItems);
|
|
3549
|
+
const { translate: t } = useTranslation();
|
|
3550
|
+
const filter = filters.find((f) => f.measure === header.column.id);
|
|
3551
|
+
if (filter) {
|
|
3552
|
+
const filterFn = getFilterFn(filter);
|
|
3553
|
+
const text = t(`comparison.${getFilterfnKey(filterFn)}`);
|
|
3554
|
+
const isBetween = filterFn === "between";
|
|
3555
|
+
return /* @__PURE__ */ React10__default.createElement(Flex, { gap: "xs", style: { fontWeight: "normal" } }, /* @__PURE__ */ React10__default.createElement(Box, { sx: { flex: "1 1 auto" } }, isBetween ? /* @__PURE__ */ React10__default.createElement(MinMax, { filter, hideControls: true }) : /* @__PURE__ */ React10__default.createElement(NumberInputComponent, { text, filter })), /* @__PURE__ */ React10__default.createElement(Box, { sx: { alignSelf: "flex-end" } }, /* @__PURE__ */ React10__default.createElement(FilterFnsMenu, { filter })));
|
|
3556
|
+
}
|
|
3557
|
+
}
|
|
3558
|
+
function MultiFilter({ header }) {
|
|
3559
|
+
const { translate: t } = useTranslation();
|
|
3560
|
+
const cutItems = useSelector$1(selectCutItems);
|
|
3561
|
+
const drilldownItems = useSelector$1(selectDrilldownItems);
|
|
3562
|
+
const label = header.column.id;
|
|
3563
|
+
const drilldown = drilldownItems.find((c) => c.uniqueName === header.column.id);
|
|
3564
|
+
const actions2 = useActions();
|
|
3565
|
+
const cut = cutItems.find((cut2) => {
|
|
3566
|
+
return cut2.uniqueName === (drilldown == null ? void 0 : drilldown.uniqueName);
|
|
3567
|
+
});
|
|
3568
|
+
const updatecutHandler = React10__default.useCallback((item, members) => {
|
|
3569
|
+
actions2.updateCut({ ...item, members });
|
|
3570
|
+
}, []);
|
|
3571
|
+
return drilldown && cut && /* @__PURE__ */ React10__default.createElement(Box, { pt: "md", style: { fontWeight: "normal" } }, /* @__PURE__ */ React10__default.createElement(
|
|
3572
|
+
MultiSelect,
|
|
3573
|
+
{
|
|
3574
|
+
sx: { flex: "1 1 100%" },
|
|
3575
|
+
searchable: true,
|
|
3576
|
+
onChange: (value) => {
|
|
3577
|
+
updatecutHandler({ ...cut, active: true }, value);
|
|
3578
|
+
},
|
|
3579
|
+
placeholder: t("params.filter_by", { name: label }),
|
|
3580
|
+
value: cut.members || [],
|
|
3581
|
+
data: drilldown.members.map((m) => ({
|
|
3582
|
+
value: String(m.key),
|
|
3583
|
+
label: m.caption ? `${m.caption} (${m.key})` : m.name
|
|
3584
|
+
})),
|
|
3585
|
+
clearButtonProps: { "aria-label": "Clear selection" },
|
|
3586
|
+
clearable: true,
|
|
3587
|
+
nothingFound: "Nothing found",
|
|
3588
|
+
size: "xs"
|
|
3589
|
+
}
|
|
3590
|
+
));
|
|
3209
3591
|
}
|
|
3592
|
+
var NoRecords = () => {
|
|
3593
|
+
return /* @__PURE__ */ React10__default.createElement(Center, { style: { height: "calc(100% - 210px)" } }, /* @__PURE__ */ React10__default.createElement(Text, { size: "xl", color: "gray", italic: true }, "No records to display."));
|
|
3594
|
+
};
|
|
3210
3595
|
TableView.displayName = "TesseractExplorer:TableView";
|
|
3211
3596
|
|
|
3212
3597
|
// src/components/Toolbar.tsx
|
|
3213
3598
|
init_esm_shims();
|
|
3214
3599
|
var toolbarSx = (t) => ({
|
|
3215
3600
|
background: t.colorScheme === "dark" ? t.black : t.white,
|
|
3216
|
-
borderRadius: t.radius.xl
|
|
3601
|
+
borderRadius: t.radius.xl,
|
|
3602
|
+
height: "fit-content"
|
|
3217
3603
|
});
|
|
3218
3604
|
function ToolbarButton({ icon, label, onClick = () => void 0 }) {
|
|
3219
|
-
return /* @__PURE__ */
|
|
3605
|
+
return /* @__PURE__ */ React10__default.createElement(
|
|
3606
|
+
UnstyledButton,
|
|
3607
|
+
{
|
|
3608
|
+
onClick,
|
|
3609
|
+
py: { base: "0.2rem", md: 0 },
|
|
3610
|
+
sx: (t) => ({ "& svg path": { stroke: t.colorScheme === "dark" ? "white" : "black" } })
|
|
3611
|
+
},
|
|
3612
|
+
/* @__PURE__ */ React10__default.createElement(Group, { spacing: "xs", noWrap: true }, icon, /* @__PURE__ */ React10__default.createElement(Text, { size: "sm" }, label))
|
|
3613
|
+
);
|
|
3220
3614
|
}
|
|
3221
3615
|
function ToolbarSearch({ table }) {
|
|
3616
|
+
const { translate: t } = useTranslation();
|
|
3222
3617
|
const { setShowGlobalFilter, setGlobalFilter } = table;
|
|
3223
|
-
const {
|
|
3618
|
+
const { showGlobalFilter } = table.getState();
|
|
3224
3619
|
const inputRef = useRef(null);
|
|
3225
|
-
useState(false);
|
|
3226
3620
|
const [query, setQuery] = useState(table.getState().globalFilter);
|
|
3227
3621
|
const [debouncedQuery] = useDebouncedValue(query, 200);
|
|
3228
3622
|
useEffect(() => {
|
|
@@ -3239,30 +3633,24 @@ function ToolbarSearch({ table }) {
|
|
|
3239
3633
|
return (_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
3240
3634
|
}, 100);
|
|
3241
3635
|
};
|
|
3242
|
-
return /* @__PURE__ */
|
|
3636
|
+
return /* @__PURE__ */ React10__default.createElement(Flex, { justify: "flex-start", direction: { base: "column", md: "row" }, gap: "xs" }, /* @__PURE__ */ React10__default.createElement(ToolbarButton, { icon: /* @__PURE__ */ React10__default.createElement(ClearSVG, null), label: t("params.label_clear"), onClick: handleClear }), /* @__PURE__ */ React10__default.createElement(
|
|
3243
3637
|
ToolbarButton,
|
|
3244
3638
|
{
|
|
3245
|
-
icon: /* @__PURE__ */
|
|
3246
|
-
label: "
|
|
3247
|
-
onClick: handleClear
|
|
3248
|
-
}
|
|
3249
|
-
), /* @__PURE__ */ React13__default.createElement(
|
|
3250
|
-
ToolbarButton,
|
|
3251
|
-
{
|
|
3252
|
-
icon: /* @__PURE__ */ React13__default.createElement(SearchSVG, null),
|
|
3253
|
-
label: "Search",
|
|
3639
|
+
icon: /* @__PURE__ */ React10__default.createElement(SearchSVG, null),
|
|
3640
|
+
label: t("params.label_search"),
|
|
3254
3641
|
onClick: () => handleShowFilter(!showGlobalFilter)
|
|
3255
3642
|
}
|
|
3256
|
-
), /* @__PURE__ */
|
|
3643
|
+
), /* @__PURE__ */ React10__default.createElement(
|
|
3257
3644
|
Box,
|
|
3258
3645
|
{
|
|
3259
3646
|
w: showGlobalFilter ? 120 : 0,
|
|
3647
|
+
h: showGlobalFilter ? "auto" : 0,
|
|
3260
3648
|
sx: {
|
|
3261
3649
|
transition: "width .2s cubic-bezier(0.4, 0, 0.2, 1)",
|
|
3262
3650
|
overflow: "hidden"
|
|
3263
3651
|
}
|
|
3264
3652
|
},
|
|
3265
|
-
/* @__PURE__ */
|
|
3653
|
+
/* @__PURE__ */ React10__default.createElement(
|
|
3266
3654
|
TextInput,
|
|
3267
3655
|
{
|
|
3268
3656
|
ref: inputRef,
|
|
@@ -3275,13 +3663,43 @@ function ToolbarSearch({ table }) {
|
|
|
3275
3663
|
)
|
|
3276
3664
|
));
|
|
3277
3665
|
}
|
|
3278
|
-
function Toolbar({
|
|
3279
|
-
|
|
3666
|
+
function Toolbar({
|
|
3667
|
+
table,
|
|
3668
|
+
fullscreen
|
|
3669
|
+
}) {
|
|
3670
|
+
const { translate: t } = useTranslation();
|
|
3671
|
+
const theme = useMantineTheme();
|
|
3672
|
+
const smallerThanMd = useMediaQuery(`(max-width: ${theme.breakpoints.md})`);
|
|
3673
|
+
const settings = /* @__PURE__ */ React10__default.createElement(
|
|
3674
|
+
Flex,
|
|
3675
|
+
{
|
|
3676
|
+
direction: { base: "column", md: "row" },
|
|
3677
|
+
justify: "flex-start",
|
|
3678
|
+
sx: toolbarSx,
|
|
3679
|
+
p: "0.325rem",
|
|
3680
|
+
px: "md",
|
|
3681
|
+
wrap: "nowrap",
|
|
3682
|
+
gap: "xs"
|
|
3683
|
+
},
|
|
3684
|
+
/* @__PURE__ */ React10__default.createElement(ToolbarSearch, { table }),
|
|
3685
|
+
/* @__PURE__ */ React10__default.createElement(
|
|
3686
|
+
ToolbarButton,
|
|
3687
|
+
{
|
|
3688
|
+
icon: /* @__PURE__ */ React10__default.createElement(FullScreenSVG, null),
|
|
3689
|
+
label: t("params.label_fullscreen"),
|
|
3690
|
+
onClick: fullscreen.toggle
|
|
3691
|
+
}
|
|
3692
|
+
)
|
|
3693
|
+
);
|
|
3694
|
+
return smallerThanMd ? /* @__PURE__ */ React10__default.createElement(Menu, null, /* @__PURE__ */ React10__default.createElement(Menu.Target, null, /* @__PURE__ */ React10__default.createElement(ActionIcon, null, /* @__PURE__ */ React10__default.createElement(IconSettings, null))), /* @__PURE__ */ React10__default.createElement(Menu.Dropdown, null, settings)) : settings;
|
|
3280
3695
|
}
|
|
3281
3696
|
|
|
3282
3697
|
// src/components/ExplorerTabs.tsx
|
|
3283
3698
|
init_esm_shims();
|
|
3284
3699
|
var tabsStyles = (t) => ({
|
|
3700
|
+
root: {
|
|
3701
|
+
alignSelf: "flex-end"
|
|
3702
|
+
},
|
|
3285
3703
|
tab: {
|
|
3286
3704
|
fontWeight: 700,
|
|
3287
3705
|
color: t.colors.gray[6],
|
|
@@ -3300,7 +3718,7 @@ function ExplorerTabs({
|
|
|
3300
3718
|
value
|
|
3301
3719
|
}) {
|
|
3302
3720
|
const { translate: t } = useTranslation();
|
|
3303
|
-
return /* @__PURE__ */
|
|
3721
|
+
return /* @__PURE__ */ React10__default.createElement(
|
|
3304
3722
|
Tabs,
|
|
3305
3723
|
{
|
|
3306
3724
|
color: "blue",
|
|
@@ -3309,7 +3727,7 @@ function ExplorerTabs({
|
|
|
3309
3727
|
value,
|
|
3310
3728
|
styles: tabsStyles
|
|
3311
3729
|
},
|
|
3312
|
-
/* @__PURE__ */
|
|
3730
|
+
/* @__PURE__ */ React10__default.createElement(Tabs.List, null, panels.map((panel) => /* @__PURE__ */ React10__default.createElement(Tabs.Tab, { key: panel.key, id: panel.key, value: panel.key, h: 56 }, t(panel.label))))
|
|
3313
3731
|
);
|
|
3314
3732
|
}
|
|
3315
3733
|
var useStyles2 = createStyles(() => ({
|
|
@@ -3322,35 +3740,34 @@ var useStyles2 = createStyles(() => ({
|
|
|
3322
3740
|
function ExplorerResults(props) {
|
|
3323
3741
|
const cube = useSelector$1(selectOlapCube);
|
|
3324
3742
|
const serverStatus = useSelector$1(selectServerState);
|
|
3325
|
-
const {
|
|
3326
|
-
const { loading: isLoading } = useSelector$1(selectLoadingState);
|
|
3743
|
+
const { params, result } = useSelector$1(selectCurrentQueryItem);
|
|
3327
3744
|
const { online: isServerOnline, url: serverUrl } = serverStatus;
|
|
3328
3745
|
const { data, error } = result;
|
|
3329
3746
|
const { translate: t } = useTranslation();
|
|
3330
3747
|
const { classes, cx } = useStyles2();
|
|
3331
3748
|
if (typeof window === "object" && window.navigator.onLine === false) {
|
|
3332
|
-
return /* @__PURE__ */
|
|
3749
|
+
return /* @__PURE__ */ React10__default.createElement(
|
|
3333
3750
|
FailureResult,
|
|
3334
3751
|
{
|
|
3335
3752
|
className: cx(classes.container, props.className),
|
|
3336
|
-
icon: /* @__PURE__ */
|
|
3753
|
+
icon: /* @__PURE__ */ React10__default.createElement(IconWorld, { color: "orange", size: "5rem" }),
|
|
3337
3754
|
title: t("results.error_disconnected_title")
|
|
3338
3755
|
}
|
|
3339
3756
|
);
|
|
3340
3757
|
}
|
|
3341
3758
|
if (isServerOnline === false) {
|
|
3342
|
-
return /* @__PURE__ */
|
|
3759
|
+
return /* @__PURE__ */ React10__default.createElement(
|
|
3343
3760
|
FailureResult,
|
|
3344
3761
|
{
|
|
3345
3762
|
className: cx(classes.container, props.className),
|
|
3346
|
-
icon: /* @__PURE__ */
|
|
3763
|
+
icon: /* @__PURE__ */ React10__default.createElement(IconAlertTriangle, { color: "orange", size: "5rem" }),
|
|
3347
3764
|
title: t("results.error_serveroffline_title"),
|
|
3348
|
-
description: /* @__PURE__ */
|
|
3765
|
+
description: /* @__PURE__ */ React10__default.createElement(Text, { span: true }, t("results.error_serveroffline_detail"), /* @__PURE__ */ React10__default.createElement(Anchor, { href: serverUrl, target: "_blank", rel: "noopener noreferrer" }, serverUrl), ".")
|
|
3349
3766
|
}
|
|
3350
3767
|
);
|
|
3351
3768
|
}
|
|
3352
|
-
if (isServerOnline == null || !cube
|
|
3353
|
-
return /* @__PURE__ */
|
|
3769
|
+
if (isServerOnline == null || !cube) {
|
|
3770
|
+
return /* @__PURE__ */ React10__default.createElement(
|
|
3354
3771
|
Paper,
|
|
3355
3772
|
{
|
|
3356
3773
|
className: cx(classes.container, props.className),
|
|
@@ -3361,27 +3778,16 @@ function ExplorerResults(props) {
|
|
|
3361
3778
|
);
|
|
3362
3779
|
}
|
|
3363
3780
|
if (error) {
|
|
3364
|
-
return /* @__PURE__ */
|
|
3365
|
-
FailureResult,
|
|
3366
|
-
{
|
|
3367
|
-
className: cx(classes.container, props.className),
|
|
3368
|
-
description: /* @__PURE__ */ React13__default.createElement(Stack, { align: "center", spacing: "xs" }, /* @__PURE__ */ React13__default.createElement(Text, null, t("results.error_execquery_detail")), /* @__PURE__ */ React13__default.createElement(Text, null, error)),
|
|
3369
|
-
icon: /* @__PURE__ */ React13__default.createElement(IconAlertTriangle, { color: "orange", size: "5rem" })
|
|
3370
|
-
}
|
|
3371
|
-
);
|
|
3372
|
-
}
|
|
3373
|
-
if (data.length === 0) {
|
|
3374
|
-
return /* @__PURE__ */ React13__default.createElement(
|
|
3781
|
+
return /* @__PURE__ */ React10__default.createElement(
|
|
3375
3782
|
FailureResult,
|
|
3376
3783
|
{
|
|
3377
3784
|
className: cx(classes.container, props.className),
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
description: t("results.error_emptyresult_detail")
|
|
3785
|
+
description: /* @__PURE__ */ React10__default.createElement(Stack, { align: "center", spacing: "xs" }, /* @__PURE__ */ React10__default.createElement(Text, null, t("results.error_execquery_detail")), /* @__PURE__ */ React10__default.createElement(Text, null, error)),
|
|
3786
|
+
icon: /* @__PURE__ */ React10__default.createElement(IconAlertTriangle, { color: "orange", size: "5rem" })
|
|
3381
3787
|
}
|
|
3382
3788
|
);
|
|
3383
3789
|
}
|
|
3384
|
-
return /* @__PURE__ */
|
|
3790
|
+
return /* @__PURE__ */ React10__default.createElement(
|
|
3385
3791
|
SuccessResult,
|
|
3386
3792
|
{
|
|
3387
3793
|
className: cx(classes.container, props.className),
|
|
@@ -3394,7 +3800,7 @@ function ExplorerResults(props) {
|
|
|
3394
3800
|
);
|
|
3395
3801
|
}
|
|
3396
3802
|
function FailureResult(props) {
|
|
3397
|
-
return /* @__PURE__ */
|
|
3803
|
+
return /* @__PURE__ */ React10__default.createElement(
|
|
3398
3804
|
Paper,
|
|
3399
3805
|
{
|
|
3400
3806
|
id: "query-results-failure",
|
|
@@ -3403,7 +3809,7 @@ function FailureResult(props) {
|
|
|
3403
3809
|
withBorder: true,
|
|
3404
3810
|
sx: { justifyContent: "center" }
|
|
3405
3811
|
},
|
|
3406
|
-
/* @__PURE__ */
|
|
3812
|
+
/* @__PURE__ */ React10__default.createElement(Stack, { align: "center", spacing: "xs" }, props.icon && props.icon, props.title && /* @__PURE__ */ React10__default.createElement(Title, { order: 5 }, props.title), props.description && /* @__PURE__ */ React10__default.createElement(Text, null, props.description), props.children && props.children, props.action && props.action)
|
|
3407
3813
|
);
|
|
3408
3814
|
}
|
|
3409
3815
|
function SuccessResult(props) {
|
|
@@ -3412,7 +3818,7 @@ function SuccessResult(props) {
|
|
|
3412
3818
|
const { previewLimit, actions: actions2 } = useSettings();
|
|
3413
3819
|
const queryItem = useSelector$1(selectCurrentQueryItem);
|
|
3414
3820
|
const isPreviewMode = useSelector$1(selectIsPreviewMode);
|
|
3415
|
-
const { table } = useTable({ cube, result });
|
|
3821
|
+
const { table, isError, isLoading, data } = useTable({ cube, result });
|
|
3416
3822
|
const fullscreen = useFullscreen();
|
|
3417
3823
|
const [CurrentComponent, panelKey, panelMeta] = useMemo(() => {
|
|
3418
3824
|
const currentPanel = queryItem.panel || `${panels[0].key}-`;
|
|
@@ -3423,7 +3829,7 @@ function SuccessResult(props) {
|
|
|
3423
3829
|
const tabHandler = useCallback((newTab) => {
|
|
3424
3830
|
actions2.switchPanel(newTab);
|
|
3425
3831
|
}, []);
|
|
3426
|
-
return /* @__PURE__ */
|
|
3832
|
+
return /* @__PURE__ */ React10__default.createElement(Flex, { gap: "xs", direction: "column", w: "100%", className: props.className }, /* @__PURE__ */ React10__default.createElement(Paper, { ref: fullscreen.ref, id: "query-results-success", h: "100%" }, /* @__PURE__ */ React10__default.createElement(
|
|
3427
3833
|
Flex,
|
|
3428
3834
|
{
|
|
3429
3835
|
sx: (t2) => ({
|
|
@@ -3433,16 +3839,19 @@ function SuccessResult(props) {
|
|
|
3433
3839
|
}),
|
|
3434
3840
|
w: "100%"
|
|
3435
3841
|
},
|
|
3436
|
-
/* @__PURE__ */
|
|
3437
|
-
(!queryItem.panel || queryItem.panel === "table") && /* @__PURE__ */
|
|
3438
|
-
), isPreviewMode && /* @__PURE__ */
|
|
3842
|
+
/* @__PURE__ */ React10__default.createElement(ExplorerTabs, { panels, onChange: tabHandler, value: panelKey }),
|
|
3843
|
+
(!queryItem.panel || queryItem.panel === "table") && /* @__PURE__ */ React10__default.createElement(Group, { sx: { display: "flex", flex: "0 1 auto" }, mr: "sm", noWrap: true }, /* @__PURE__ */ React10__default.createElement(DrawerMenu_default, null), /* @__PURE__ */ React10__default.createElement(Toolbar, { table, fullscreen }))
|
|
3844
|
+
), isPreviewMode && /* @__PURE__ */ React10__default.createElement(Alert, { id: "alert-load-all-results", color: "yellow", radius: 0, sx: { flex: "0 0 auto" } }, /* @__PURE__ */ React10__default.createElement(Group, { position: "apart" }, /* @__PURE__ */ React10__default.createElement(Text, null, /* @__PURE__ */ React10__default.createElement(Text, { fw: 700, span: true }, t("previewMode.title_preview"), ":", " "), /* @__PURE__ */ React10__default.createElement(Text, { span: true }, t("previewMode.description_preview", { limit: previewLimit }))), /* @__PURE__ */ React10__default.createElement(PreviewModeSwitch, null))), /* @__PURE__ */ React10__default.createElement(Box, { id: "query-results-content", sx: { flex: "1 1", height: "calc(100% - 60px)" } }, /* @__PURE__ */ React10__default.createElement(Suspense, { fallback: props.children }, /* @__PURE__ */ React10__default.createElement(Flex, { h: "100%" }, /* @__PURE__ */ React10__default.createElement(Box, { sx: { flex: "1 1", overflowX: "scroll" } }, /* @__PURE__ */ React10__default.createElement(
|
|
3439
3845
|
CurrentComponent,
|
|
3440
3846
|
{
|
|
3441
3847
|
panelKey: `${panelKey}-${panelMeta}`,
|
|
3442
3848
|
cube,
|
|
3443
3849
|
params,
|
|
3444
3850
|
result,
|
|
3445
|
-
table
|
|
3851
|
+
table,
|
|
3852
|
+
isError,
|
|
3853
|
+
isLoading,
|
|
3854
|
+
data
|
|
3446
3855
|
}
|
|
3447
3856
|
)))))));
|
|
3448
3857
|
}
|
|
@@ -3453,9 +3862,9 @@ init_esm_shims();
|
|
|
3453
3862
|
// src/utils/create-context.ts
|
|
3454
3863
|
init_esm_shims();
|
|
3455
3864
|
var createContext2 = (name4) => {
|
|
3456
|
-
const Context =
|
|
3865
|
+
const Context = React10__default.createContext(void 0);
|
|
3457
3866
|
const useContext2 = () => {
|
|
3458
|
-
const ctx =
|
|
3867
|
+
const ctx = React10__default.useContext(Context);
|
|
3459
3868
|
if (ctx === void 0) {
|
|
3460
3869
|
throw new Error(`useContext for must be inside a ${name4}Provider with a value`);
|
|
3461
3870
|
}
|
|
@@ -3523,7 +3932,7 @@ var Graph = class {
|
|
|
3523
3932
|
});
|
|
3524
3933
|
return subtopic;
|
|
3525
3934
|
}
|
|
3526
|
-
filter(locale,
|
|
3935
|
+
filter(locale, filter) {
|
|
3527
3936
|
function addItemToSubtopic(map2, subtopic, item) {
|
|
3528
3937
|
if (map2.has(subtopic)) {
|
|
3529
3938
|
map2.get(subtopic).push(item);
|
|
@@ -3534,24 +3943,21 @@ var Graph = class {
|
|
|
3534
3943
|
const map = /* @__PURE__ */ new Map();
|
|
3535
3944
|
const matches = [];
|
|
3536
3945
|
if (filter !== "") {
|
|
3537
|
-
this.
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
const subtopic = getAnnotation(item, "subtopic", locale);
|
|
3545
|
-
const topic = getAnnotation(item, "topic", locale);
|
|
3546
|
-
addItemToSubtopic(map, `${topic} - ${subtopic}`, list[0]);
|
|
3547
|
-
matches.push(...list);
|
|
3548
|
-
}
|
|
3549
|
-
}
|
|
3550
|
-
} else {
|
|
3551
|
-
matches.push(node);
|
|
3552
|
-
}
|
|
3553
|
-
}
|
|
3946
|
+
const results = matchSorter(this.items, filter, {
|
|
3947
|
+
keys: [
|
|
3948
|
+
"name",
|
|
3949
|
+
(item) => getAnnotation(item, "topic", locale) || "",
|
|
3950
|
+
(item) => getAnnotation(item, "subtopic", locale) || "",
|
|
3951
|
+
(item) => getAnnotation(item, "table", locale) || ""
|
|
3952
|
+
]
|
|
3554
3953
|
});
|
|
3954
|
+
for (const item of results) {
|
|
3955
|
+
const topic = getAnnotation(item, "topic", locale);
|
|
3956
|
+
const subtopic = getAnnotation(item, "subtopic", locale);
|
|
3957
|
+
const title = getAnnotation(item, "table", locale);
|
|
3958
|
+
addItemToSubtopic(map, `${topic} - ${subtopic}`, title);
|
|
3959
|
+
matches.push(title);
|
|
3960
|
+
}
|
|
3555
3961
|
}
|
|
3556
3962
|
return { matches, map };
|
|
3557
3963
|
}
|
|
@@ -3598,38 +4004,383 @@ var Graph = class {
|
|
|
3598
4004
|
};
|
|
3599
4005
|
var graph_default = Graph;
|
|
3600
4006
|
|
|
4007
|
+
// src/components/LocaleSelector.tsx
|
|
4008
|
+
init_esm_shims();
|
|
4009
|
+
|
|
4010
|
+
// src/components/Select.tsx
|
|
4011
|
+
init_esm_shims();
|
|
4012
|
+
var SelectObject = forwardRef(function(props, ref) {
|
|
4013
|
+
var _a;
|
|
4014
|
+
const { getLabel, getValue = identity, items, onItemSelect, selectedItem, selectProps = {} } = props;
|
|
4015
|
+
const [itemList, itemMap] = useMemo(() => {
|
|
4016
|
+
const valueAccessor = accesorFactory(getValue);
|
|
4017
|
+
const labelAccessor = getLabel ? accesorFactory(getLabel) : valueAccessor;
|
|
4018
|
+
const list = items.map((item) => ({
|
|
4019
|
+
label: labelAccessor(item),
|
|
4020
|
+
value: valueAccessor(item),
|
|
4021
|
+
item
|
|
4022
|
+
}));
|
|
4023
|
+
return [list, keyBy(list, (option) => option.value)];
|
|
4024
|
+
}, [items, getLabel, getValue]);
|
|
4025
|
+
const selected = useMemo(() => {
|
|
4026
|
+
if (selectedItem == null) return null;
|
|
4027
|
+
if (typeof selectedItem === "string") return selectedItem;
|
|
4028
|
+
const valueAccessor = accesorFactory(getValue);
|
|
4029
|
+
return valueAccessor(selectedItem);
|
|
4030
|
+
}, [selectedItem, getValue]);
|
|
4031
|
+
const itemSelectHandler = (value) => {
|
|
4032
|
+
onItemSelect && onItemSelect(itemMap[value].item);
|
|
4033
|
+
};
|
|
4034
|
+
if (items.length === 0 || !selected) {
|
|
4035
|
+
return null;
|
|
4036
|
+
}
|
|
4037
|
+
return /* @__PURE__ */ React10__default.createElement(
|
|
4038
|
+
Select,
|
|
4039
|
+
{
|
|
4040
|
+
ref,
|
|
4041
|
+
data: itemList,
|
|
4042
|
+
disabled: props.loading || props.disabled,
|
|
4043
|
+
hidden: props.hidden,
|
|
4044
|
+
label: props.label,
|
|
4045
|
+
onChange: itemSelectHandler,
|
|
4046
|
+
onClick: inputFocusHandler,
|
|
4047
|
+
onFocus: inputFocusHandler,
|
|
4048
|
+
searchable: (_a = props.searchable) != null ? _a : props.items.length > 6,
|
|
4049
|
+
value: selected,
|
|
4050
|
+
...selectProps
|
|
4051
|
+
}
|
|
4052
|
+
);
|
|
4053
|
+
});
|
|
4054
|
+
function inputFocusHandler(event) {
|
|
4055
|
+
if (event.target instanceof HTMLInputElement) event.target.select();
|
|
4056
|
+
}
|
|
4057
|
+
var localeSelectorStyle = (theme) => ({
|
|
4058
|
+
input: {
|
|
4059
|
+
border: "none",
|
|
4060
|
+
background: theme.colorScheme === "dark" ? theme.fn.darken(theme.fn.primaryColor(), 0.1) : theme.fn.lighten(theme.fn.primaryColor(), 0.8),
|
|
4061
|
+
borderRadius: theme.radius.sm,
|
|
4062
|
+
color: theme.colorScheme === "dark" ? theme.fn.lighten(theme.fn.primaryColor(), 0.7) : theme.fn.primaryColor(),
|
|
4063
|
+
fontSize: 12,
|
|
4064
|
+
fontWeight: 700,
|
|
4065
|
+
width: 94,
|
|
4066
|
+
textTransform: "uppercase"
|
|
4067
|
+
},
|
|
4068
|
+
item: {
|
|
4069
|
+
fontSize: 12,
|
|
4070
|
+
textTransform: "uppercase"
|
|
4071
|
+
},
|
|
4072
|
+
rightSection: {
|
|
4073
|
+
pointerEvents: "none"
|
|
4074
|
+
// weird hack, seems like CSSObject is not completely right defined inside mantine.
|
|
4075
|
+
}
|
|
4076
|
+
});
|
|
4077
|
+
function LocaleSelector() {
|
|
4078
|
+
const actions2 = useActions();
|
|
4079
|
+
const { resetGraph } = useSideBar();
|
|
4080
|
+
const { translate: t, locale } = useTranslation();
|
|
4081
|
+
const { code: currentCode } = useSelector$1(selectLocale);
|
|
4082
|
+
const { localeOptions } = useSelector$1(selectServerState);
|
|
4083
|
+
const theme = useMantineTheme();
|
|
4084
|
+
const options = useMemo(() => {
|
|
4085
|
+
const languages = ISO6391.getLanguages(localeOptions);
|
|
4086
|
+
return languages.map((lang) => ({
|
|
4087
|
+
label: t("params.label_localeoption", {
|
|
4088
|
+
code: lang.code,
|
|
4089
|
+
engName: lang.name,
|
|
4090
|
+
nativeName: lang.nativeName,
|
|
4091
|
+
customName: t(`params.label_localecustom_${lang.code}`)
|
|
4092
|
+
}) || lang.nativeName,
|
|
4093
|
+
value: lang.code
|
|
4094
|
+
}));
|
|
4095
|
+
}, [locale, localeOptions]);
|
|
4096
|
+
const localeChangeHandler = (l) => {
|
|
4097
|
+
if (currentCode !== l.value) {
|
|
4098
|
+
resetGraph();
|
|
4099
|
+
actions2.updateLocale(l.value);
|
|
4100
|
+
actions2.willRequestQuery();
|
|
4101
|
+
}
|
|
4102
|
+
};
|
|
4103
|
+
if (localeOptions.length < 2) {
|
|
4104
|
+
return null;
|
|
4105
|
+
}
|
|
4106
|
+
return /* @__PURE__ */ React10__default.createElement(Box, { id: "select-locale" }, /* @__PURE__ */ React10__default.createElement(Tooltip, { label: t("params.label_locale") }, /* @__PURE__ */ React10__default.createElement(
|
|
4107
|
+
SelectObject,
|
|
4108
|
+
{
|
|
4109
|
+
getLabel: "value",
|
|
4110
|
+
getValue: "value",
|
|
4111
|
+
items: options,
|
|
4112
|
+
onItemSelect: localeChangeHandler,
|
|
4113
|
+
selectedItem: currentCode,
|
|
4114
|
+
selectProps: {
|
|
4115
|
+
styles: localeSelectorStyle,
|
|
4116
|
+
icon: /* @__PURE__ */ React10__default.createElement(IconLanguage, { size: "0.8rem", color: theme.colorScheme === "dark" ? theme.fn.lighten(theme.fn.primaryColor(), 0.8) : theme.fn.primaryColor() })
|
|
4117
|
+
}
|
|
4118
|
+
}
|
|
4119
|
+
)));
|
|
4120
|
+
}
|
|
4121
|
+
var [useSideBar, Provider] = createContext2("SideBar");
|
|
4122
|
+
function SideBarProvider(props) {
|
|
4123
|
+
const [input, setInput] = useState("");
|
|
4124
|
+
const [expanded, setExpanded] = useState(false);
|
|
4125
|
+
const [results, setResults] = useState([]);
|
|
4126
|
+
const [map, setMap] = useState();
|
|
4127
|
+
const [graph, setGraph] = useState(new graph_default());
|
|
4128
|
+
const resetGraph = () => setGraph(new graph_default());
|
|
4129
|
+
return /* @__PURE__ */ React10__default.createElement(
|
|
4130
|
+
Provider,
|
|
4131
|
+
{
|
|
4132
|
+
...props,
|
|
4133
|
+
value: {
|
|
4134
|
+
expanded,
|
|
4135
|
+
setExpanded,
|
|
4136
|
+
graph,
|
|
4137
|
+
setGraph,
|
|
4138
|
+
results,
|
|
4139
|
+
setResults,
|
|
4140
|
+
input,
|
|
4141
|
+
map,
|
|
4142
|
+
setMap,
|
|
4143
|
+
setInput,
|
|
4144
|
+
resetGraph
|
|
4145
|
+
}
|
|
4146
|
+
}
|
|
4147
|
+
);
|
|
4148
|
+
}
|
|
4149
|
+
function SideBar(props) {
|
|
4150
|
+
const { expanded, setExpanded } = useSideBar();
|
|
4151
|
+
const { translate: t } = useTranslation();
|
|
4152
|
+
return /* @__PURE__ */ React10__default.createElement(
|
|
4153
|
+
Box,
|
|
4154
|
+
{
|
|
4155
|
+
id: "dex-sidebar",
|
|
4156
|
+
py: "md",
|
|
4157
|
+
sx: (t2) => ({
|
|
4158
|
+
height: "calc(100vh - 50px)",
|
|
4159
|
+
backgroundColor: t2.colorScheme === "dark" ? t2.colors.dark[8] : t2.colors.gray[1],
|
|
4160
|
+
boxShadow: "0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",
|
|
4161
|
+
maxWidth: expanded ? 300 : 54,
|
|
4162
|
+
padding: 0,
|
|
4163
|
+
zIndex: 99,
|
|
4164
|
+
boxSizing: "border-box",
|
|
4165
|
+
[t2.fn.smallerThan("md")]: {
|
|
4166
|
+
position: "absolute",
|
|
4167
|
+
width: expanded ? 300 : 54,
|
|
4168
|
+
height: expanded ? "calc(100vh - 75px)" : 54,
|
|
4169
|
+
bottom: expanded ? "unset" : t2.spacing.md,
|
|
4170
|
+
left: expanded ? "unset" : t2.spacing.md,
|
|
4171
|
+
overflow: "hidden",
|
|
4172
|
+
paddingTop: expanded ? t2.spacing.md : 0,
|
|
4173
|
+
paddingBottom: expanded ? t2.spacing.md : 0,
|
|
4174
|
+
borderRadius: expanded ? 0 : "100%"
|
|
4175
|
+
}
|
|
4176
|
+
})
|
|
4177
|
+
},
|
|
4178
|
+
/* @__PURE__ */ React10__default.createElement(Flex, { h: "100%", direction: "column", justify: "flex-start" }, /* @__PURE__ */ React10__default.createElement(Box, { px: "sm", my: "sm" }, /* @__PURE__ */ React10__default.createElement(Flex, { direction: "column", sx: { flex: 1 } }, /* @__PURE__ */ React10__default.createElement(Flex, { align: "center", justify: "apart" }, /* @__PURE__ */ React10__default.createElement(
|
|
4179
|
+
ActionIcon,
|
|
4180
|
+
{
|
|
4181
|
+
onClick: () => setExpanded(!expanded),
|
|
4182
|
+
variant: "subtle",
|
|
4183
|
+
sx: (t2) => ({
|
|
4184
|
+
alignSelf: "center",
|
|
4185
|
+
color: t2.colorScheme === "dark" ? t2.white : t2.colors.gray[7]
|
|
4186
|
+
})
|
|
4187
|
+
},
|
|
4188
|
+
/* @__PURE__ */ React10__default.createElement(DataSetSVG, null)
|
|
4189
|
+
), /* @__PURE__ */ React10__default.createElement(
|
|
4190
|
+
Group,
|
|
4191
|
+
{
|
|
4192
|
+
position: "apart",
|
|
4193
|
+
noWrap: true,
|
|
4194
|
+
sx: {
|
|
4195
|
+
overflow: "hidden",
|
|
4196
|
+
whiteSpace: "nowrap",
|
|
4197
|
+
transition: "width 0.2s cubic-bezier(0.4, 0, 0.2, 1), margin-left 0.2s cubic-bezier(0.4, 0, 0.2, 1)",
|
|
4198
|
+
width: expanded ? 300 : 0
|
|
4199
|
+
}
|
|
4200
|
+
},
|
|
4201
|
+
/* @__PURE__ */ React10__default.createElement(Text, { sx: (t2) => ({ color: t2.colorScheme === "dark" ? t2.white : t2.black }), ml: "sm" }, t("params.label_dataset")),
|
|
4202
|
+
/* @__PURE__ */ React10__default.createElement(LocaleSelector, null)
|
|
4203
|
+
)), /* @__PURE__ */ React10__default.createElement(
|
|
4204
|
+
Box,
|
|
4205
|
+
{
|
|
4206
|
+
my: "md",
|
|
4207
|
+
sx: {
|
|
4208
|
+
overflow: "hidden",
|
|
4209
|
+
whiteSpace: "nowrap",
|
|
4210
|
+
transition: "width 0.2s cubic-bezier(0.4, 0, 0.2, 1), margin-left 0.2s cubic-bezier(0.4, 0, 0.2, 1)",
|
|
4211
|
+
width: expanded ? "100%" : 0
|
|
4212
|
+
}
|
|
4213
|
+
},
|
|
4214
|
+
/* @__PURE__ */ React10__default.createElement(Auto, null)
|
|
4215
|
+
), /* @__PURE__ */ React10__default.createElement(Box, { sx: { flexGrow: 1 } }))), /* @__PURE__ */ React10__default.createElement(
|
|
4216
|
+
ScrollArea,
|
|
4217
|
+
{
|
|
4218
|
+
sx: (theme) => ({
|
|
4219
|
+
borderTopColor: theme.colorScheme === "dark" ? theme.colors.dark[6] : theme.colors.gray[3],
|
|
4220
|
+
borderTopWidth: "1px",
|
|
4221
|
+
borderTopStyle: expanded ? "solid" : "none"
|
|
4222
|
+
})
|
|
4223
|
+
},
|
|
4224
|
+
/* @__PURE__ */ React10__default.createElement(Box, { h: expanded ? "auto" : "0px" }, props.children)
|
|
4225
|
+
), /* @__PURE__ */ React10__default.createElement(
|
|
4226
|
+
Group,
|
|
4227
|
+
{
|
|
4228
|
+
align: "center",
|
|
4229
|
+
position: expanded ? "right" : "center",
|
|
4230
|
+
w: "100%",
|
|
4231
|
+
p: "md",
|
|
4232
|
+
sx: { alignSelf: "flex-end", marginTop: "auto" },
|
|
4233
|
+
noWrap: true
|
|
4234
|
+
},
|
|
4235
|
+
/* @__PURE__ */ React10__default.createElement(
|
|
4236
|
+
ActionIcon,
|
|
4237
|
+
{
|
|
4238
|
+
onClick: () => setExpanded(!expanded),
|
|
4239
|
+
variant: "subtle",
|
|
4240
|
+
mt: "auto",
|
|
4241
|
+
sx: (t2) => ({ alignSelf: "flex-end", color: t2.colors.gray[7] })
|
|
4242
|
+
},
|
|
4243
|
+
expanded ? /* @__PURE__ */ React10__default.createElement(IconChevronLeft, null) : /* @__PURE__ */ React10__default.createElement(IconChevronRight, null)
|
|
4244
|
+
)
|
|
4245
|
+
))
|
|
4246
|
+
);
|
|
4247
|
+
}
|
|
4248
|
+
var SideBar_default = SideBar;
|
|
4249
|
+
function SideBarItem({ children }) {
|
|
4250
|
+
const { expanded } = useSideBar();
|
|
4251
|
+
return /* @__PURE__ */ React10__default.createElement(
|
|
4252
|
+
Box,
|
|
4253
|
+
{
|
|
4254
|
+
sx: {
|
|
4255
|
+
overflow: "hidden",
|
|
4256
|
+
whiteSpace: "nowrap",
|
|
4257
|
+
width: expanded ? 300 : 0,
|
|
4258
|
+
transition: "width 0.2s cubic-bezier(0.4, 0, 0.2, 1)"
|
|
4259
|
+
}
|
|
4260
|
+
},
|
|
4261
|
+
children
|
|
4262
|
+
);
|
|
4263
|
+
}
|
|
4264
|
+
function Auto() {
|
|
4265
|
+
const { code: locale } = useSelector$1(selectLocale);
|
|
4266
|
+
const { translate: t } = useTranslation();
|
|
4267
|
+
const { expanded, graph, setResults, input, setInput, setMap } = useSideBar();
|
|
4268
|
+
const [debouncedInput] = useDebouncedValue(input, 200);
|
|
4269
|
+
useEffect(() => {
|
|
4270
|
+
if (graph.items.length > 0) {
|
|
4271
|
+
const { matches, map } = graph.filter(locale, debouncedInput);
|
|
4272
|
+
setResults(matches);
|
|
4273
|
+
setMap(map);
|
|
4274
|
+
}
|
|
4275
|
+
}, [debouncedInput, graph]);
|
|
4276
|
+
return /* @__PURE__ */ React10__default.createElement(
|
|
4277
|
+
Input,
|
|
4278
|
+
{
|
|
4279
|
+
icon: /* @__PURE__ */ React10__default.createElement(IconSearch, null),
|
|
4280
|
+
radius: "xl",
|
|
4281
|
+
size: "md",
|
|
4282
|
+
placeholder: t("params.label_search"),
|
|
4283
|
+
value: input,
|
|
4284
|
+
onInput: (e) => setInput(e.currentTarget.value),
|
|
4285
|
+
styles: {
|
|
4286
|
+
wrapper: {
|
|
4287
|
+
width: expanded ? "100%" : 0,
|
|
4288
|
+
overflow: "hidden",
|
|
4289
|
+
transition: "width 0.2s cubic-bezier(0.4, 0, 0.2, 1), margin-left 0.2s cubic-bezier(0.4, 0, 0.2, 1)"
|
|
4290
|
+
},
|
|
4291
|
+
input: {
|
|
4292
|
+
whiteSpace: "nowrap"
|
|
4293
|
+
}
|
|
4294
|
+
},
|
|
4295
|
+
rightSection: /* @__PURE__ */ React10__default.createElement(
|
|
4296
|
+
CloseButton,
|
|
4297
|
+
{
|
|
4298
|
+
"aria-label": "Clear input",
|
|
4299
|
+
onClick: () => setInput(""),
|
|
4300
|
+
style: { display: input ? void 0 : "none" }
|
|
4301
|
+
}
|
|
4302
|
+
)
|
|
4303
|
+
}
|
|
4304
|
+
);
|
|
4305
|
+
}
|
|
4306
|
+
|
|
4307
|
+
// src/components/ParamsExplorer.tsx
|
|
4308
|
+
init_esm_shims();
|
|
4309
|
+
|
|
3601
4310
|
// src/components/SelectCubes.tsx
|
|
3602
4311
|
init_esm_shims();
|
|
3603
4312
|
|
|
3604
4313
|
// src/components/Results.tsx
|
|
3605
4314
|
init_esm_shims();
|
|
4315
|
+
|
|
4316
|
+
// src/hooks/useSelectCube.tsx
|
|
4317
|
+
init_esm_shims();
|
|
4318
|
+
function useSelectCube(onSelectCube) {
|
|
4319
|
+
const { updateMeasure, updateCut, updateDrilldown, willFetchMembers: willFetchMembers2 } = useActions();
|
|
4320
|
+
const createCutHandler2 = React10__default.useCallback((level) => {
|
|
4321
|
+
const cutItem = buildCut({ ...level });
|
|
4322
|
+
cutItem.active = false;
|
|
4323
|
+
updateCut(cutItem);
|
|
4324
|
+
}, []);
|
|
4325
|
+
const addDrilldown = useCallback((level, dimensions) => {
|
|
4326
|
+
const drilldownItem = buildDrilldown(level);
|
|
4327
|
+
createCutHandler2(level);
|
|
4328
|
+
updateDrilldown(drilldownItem);
|
|
4329
|
+
return willFetchMembers2({ ...level, level: level.name }).then((members) => {
|
|
4330
|
+
const dimension = dimensions.find((dim) => dim.name === level.dimension);
|
|
4331
|
+
if (!dimension) return;
|
|
4332
|
+
return updateDrilldown({
|
|
4333
|
+
...drilldownItem,
|
|
4334
|
+
dimType: dimension.dimensionType,
|
|
4335
|
+
memberCount: members.length,
|
|
4336
|
+
members
|
|
4337
|
+
});
|
|
4338
|
+
});
|
|
4339
|
+
}, []);
|
|
4340
|
+
return (item, subtopic) => () => onSelectCube(item, subtopic).then(({ cube, measures, dimensions }) => {
|
|
4341
|
+
const [measure] = Object.values(measures);
|
|
4342
|
+
const drilldowns = deriveDrilldowns(dimensions);
|
|
4343
|
+
if (measure && drilldowns.length > 0) {
|
|
4344
|
+
updateMeasure({ ...measure, active: true });
|
|
4345
|
+
for (const level of drilldowns) {
|
|
4346
|
+
addDrilldown(level, dimensions);
|
|
4347
|
+
}
|
|
4348
|
+
}
|
|
4349
|
+
});
|
|
4350
|
+
}
|
|
4351
|
+
|
|
4352
|
+
// src/components/Results.tsx
|
|
3606
4353
|
function Results(props) {
|
|
3607
4354
|
const { onSelectCube, graph, selectedItem, locale, getCube: getCube2, isSelected: isSelected2 } = props;
|
|
3608
4355
|
const { classes } = useStyles3();
|
|
3609
4356
|
const { setExpanded, setInput, map } = useSideBar();
|
|
4357
|
+
const callback = useSelectCube(onSelectCube);
|
|
3610
4358
|
const result = [];
|
|
3611
4359
|
if (map) {
|
|
3612
4360
|
for (let [key, items] of map) {
|
|
3613
4361
|
const [topic, subtopic] = key.split(" - ");
|
|
3614
|
-
const component = /* @__PURE__ */
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
4362
|
+
const component = /* @__PURE__ */ React10__default.createElement("div", { key }, /* @__PURE__ */ React10__default.createElement(Divider, { my: "xs", label: key }), items.map((item) => {
|
|
4363
|
+
const cube = getCube2(graph.items, item, subtopic, locale);
|
|
4364
|
+
return /* @__PURE__ */ React10__default.createElement(
|
|
4365
|
+
Text,
|
|
4366
|
+
{
|
|
4367
|
+
key: cube.name,
|
|
4368
|
+
component: "a",
|
|
4369
|
+
fz: "xs",
|
|
4370
|
+
className: isSelected2(selectedItem, cube) ? `${classes.link} ${classes.linkActive}` : classes.link,
|
|
4371
|
+
onClick: () => {
|
|
4372
|
+
callback(item, subtopic)();
|
|
4373
|
+
setExpanded(false);
|
|
4374
|
+
setInput("");
|
|
4375
|
+
}
|
|
4376
|
+
},
|
|
4377
|
+
item
|
|
4378
|
+
);
|
|
4379
|
+
}));
|
|
3629
4380
|
result.push(component);
|
|
3630
4381
|
}
|
|
3631
4382
|
}
|
|
3632
|
-
return result;
|
|
4383
|
+
return /* @__PURE__ */ React10__default.createElement(Box, { px: "sm" }, result);
|
|
3633
4384
|
}
|
|
3634
4385
|
var useStyles3 = createStyles((theme) => ({
|
|
3635
4386
|
link: {
|
|
@@ -3661,20 +4412,25 @@ function SelectCube() {
|
|
|
3661
4412
|
if (items.length === 1) {
|
|
3662
4413
|
return null;
|
|
3663
4414
|
}
|
|
3664
|
-
return /* @__PURE__ */
|
|
4415
|
+
return /* @__PURE__ */ React10__default.createElement(SelectCubeInternal, { items, selectedItem });
|
|
3665
4416
|
}
|
|
3666
4417
|
function SelectCubeInternal(props) {
|
|
3667
4418
|
const { items, selectedItem } = props;
|
|
3668
4419
|
useTranslation();
|
|
3669
4420
|
const { code: locale } = useSelector$1(selectLocale);
|
|
3670
|
-
const {
|
|
3671
|
-
const initRef = useRef(false);
|
|
4421
|
+
const { updateMeasure, updateDrilldown, willFetchMembers: willFetchMembers2, updateCut } = useActions();
|
|
3672
4422
|
const cube = useSelector$1(selectCubeName);
|
|
3673
4423
|
const itemMap = useSelector$1(selectMeasureMap);
|
|
3674
4424
|
const dimensions = useSelector$1(selectOlapDimensionItems);
|
|
4425
|
+
const createCutHandler2 = React10__default.useCallback((level) => {
|
|
4426
|
+
const cutItem = buildCut({ ...level });
|
|
4427
|
+
cutItem.active = false;
|
|
4428
|
+
updateCut(cutItem);
|
|
4429
|
+
}, []);
|
|
3675
4430
|
const addDrilldown = useCallback(
|
|
3676
4431
|
(level) => {
|
|
3677
|
-
const drilldownItem = buildDrilldown(
|
|
4432
|
+
const drilldownItem = buildDrilldown(level);
|
|
4433
|
+
createCutHandler2(level);
|
|
3678
4434
|
updateDrilldown(drilldownItem);
|
|
3679
4435
|
return willFetchMembers2({ ...level, level: level.name }).then((members) => {
|
|
3680
4436
|
const dimension = dimensions.find((dim) => dim.name === level.dimension);
|
|
@@ -3693,35 +4449,24 @@ function SelectCubeInternal(props) {
|
|
|
3693
4449
|
const params = new URLSearchParams(location.search);
|
|
3694
4450
|
const cubeParam = params.get("cube");
|
|
3695
4451
|
if (selectedItem && cube && !cubeParam) {
|
|
3696
|
-
|
|
3697
|
-
const
|
|
3698
|
-
const dimension = [...dimensions].shift();
|
|
4452
|
+
const [measure] = Object.values(itemMap);
|
|
4453
|
+
const [dimension] = dimensions;
|
|
3699
4454
|
if (measure && dimension) {
|
|
3700
4455
|
updateMeasure({ ...measure, active: true });
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
});
|
|
3704
|
-
}
|
|
3705
|
-
}
|
|
3706
|
-
if (selectedItem && cube && cubeParam) {
|
|
3707
|
-
if (!initRef.current) {
|
|
3708
|
-
initRef.current = true;
|
|
3709
|
-
} else {
|
|
3710
|
-
const measure = Object.keys(itemMap).map((k) => itemMap[k]).shift();
|
|
3711
|
-
const dimension = [...dimensions].shift();
|
|
3712
|
-
if (measure && dimension) {
|
|
4456
|
+
const drilldowns = deriveDrilldowns(dimensions);
|
|
4457
|
+
if (measure && drilldowns.length > 0) {
|
|
3713
4458
|
updateMeasure({ ...measure, active: true });
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
}
|
|
4459
|
+
for (const level of drilldowns) {
|
|
4460
|
+
addDrilldown(level, dimensions);
|
|
4461
|
+
}
|
|
3717
4462
|
}
|
|
3718
4463
|
}
|
|
3719
4464
|
}
|
|
3720
4465
|
}, [selectedItem, cube]);
|
|
3721
|
-
return /* @__PURE__ */
|
|
4466
|
+
return /* @__PURE__ */ React10__default.createElement(Stack, { id: "select-cube", spacing: "xs", w: "100%" }, /* @__PURE__ */ React10__default.createElement(CubeTree, { items, locale, selectedItem }));
|
|
3722
4467
|
}
|
|
3723
4468
|
function AccordionControl(props) {
|
|
3724
|
-
return /* @__PURE__ */
|
|
4469
|
+
return /* @__PURE__ */ React10__default.createElement(Box, { sx: { display: "flex", alignItems: "center" } }, /* @__PURE__ */ React10__default.createElement(Accordion.Control, { ...props }));
|
|
3725
4470
|
}
|
|
3726
4471
|
function getKeys2(items, k, locale, filter) {
|
|
3727
4472
|
let cubes = items;
|
|
@@ -3773,7 +4518,8 @@ function CubeTree({
|
|
|
3773
4518
|
locale,
|
|
3774
4519
|
selectedItem
|
|
3775
4520
|
}) {
|
|
3776
|
-
const { graph, setGraph, map } = useSideBar();
|
|
4521
|
+
const { graph, setGraph, map, input } = useSideBar();
|
|
4522
|
+
const { translate: t } = useTranslation();
|
|
3777
4523
|
useBuildGraph(items, locale, graph, setGraph);
|
|
3778
4524
|
const actions2 = useActions();
|
|
3779
4525
|
const onSelectCube = (table, subtopic) => {
|
|
@@ -3781,11 +4527,14 @@ function CubeTree({
|
|
|
3781
4527
|
(item) => getAnnotation(item, "table", locale) === table && getAnnotation(item, "subtopic", locale) === subtopic
|
|
3782
4528
|
);
|
|
3783
4529
|
if (cube) {
|
|
3784
|
-
actions2.willSetCube(cube.name);
|
|
4530
|
+
return actions2.willSetCube(cube.name);
|
|
3785
4531
|
}
|
|
3786
4532
|
};
|
|
3787
4533
|
const topics = useMemo(() => getKeys2(items, "topic", locale), [items, locale]);
|
|
3788
|
-
|
|
4534
|
+
if (input.length > 0 && map && !(map.size > 0)) {
|
|
4535
|
+
return /* @__PURE__ */ React10__default.createElement(Text, { ta: "center", fz: "xs", my: "sm", italic: true }, t("params.label_no_results"));
|
|
4536
|
+
}
|
|
4537
|
+
return map && map.size > 0 ? /* @__PURE__ */ React10__default.createElement(
|
|
3789
4538
|
Results_default,
|
|
3790
4539
|
{
|
|
3791
4540
|
onSelectCube,
|
|
@@ -3795,7 +4544,7 @@ function CubeTree({
|
|
|
3795
4544
|
graph,
|
|
3796
4545
|
locale
|
|
3797
4546
|
}
|
|
3798
|
-
) : graph.items.length > 0 && /* @__PURE__ */
|
|
4547
|
+
) : graph.items.length > 0 && /* @__PURE__ */ React10__default.createElement(
|
|
3799
4548
|
RootAccordions,
|
|
3800
4549
|
{
|
|
3801
4550
|
items: topics,
|
|
@@ -3819,7 +4568,7 @@ function useAccordionValue(key, locale) {
|
|
|
3819
4568
|
}
|
|
3820
4569
|
function RootAccordions({ items, graph, locale, selectedItem, onSelectCube }) {
|
|
3821
4570
|
const { value, setValue } = useAccordionValue("topic", locale);
|
|
3822
|
-
return /* @__PURE__ */
|
|
4571
|
+
return /* @__PURE__ */ React10__default.createElement(
|
|
3823
4572
|
Accordion,
|
|
3824
4573
|
{
|
|
3825
4574
|
value,
|
|
@@ -3830,11 +4579,12 @@ function RootAccordions({ items, graph, locale, selectedItem, onSelectCube }) {
|
|
|
3830
4579
|
styles: (t) => ({
|
|
3831
4580
|
control: {
|
|
3832
4581
|
background: t.colorScheme === "dark" ? t.colors.dark[7] : t.colors.gray[1],
|
|
3833
|
-
borderLeft:
|
|
4582
|
+
borderLeft: 6,
|
|
3834
4583
|
borderLeftColor: "transparent",
|
|
3835
4584
|
borderLeftStyle: "solid",
|
|
4585
|
+
fontSize: t.fontSizes.md,
|
|
3836
4586
|
"&[data-active]": {
|
|
3837
|
-
borderLeft:
|
|
4587
|
+
borderLeft: 6,
|
|
3838
4588
|
borderLeftColor: t.colors[t.primaryColor][t.fn.primaryShade()],
|
|
3839
4589
|
borderLeftStyle: "solid",
|
|
3840
4590
|
color: t.colors[t.primaryColor][t.fn.primaryShade()]
|
|
@@ -3849,7 +4599,7 @@ function RootAccordions({ items, graph, locale, selectedItem, onSelectCube }) {
|
|
|
3849
4599
|
})
|
|
3850
4600
|
},
|
|
3851
4601
|
items.map((item) => {
|
|
3852
|
-
return /* @__PURE__ */
|
|
4602
|
+
return /* @__PURE__ */ React10__default.createElement(Accordion.Item, { value: `topic-${item}`, key: `topic-${item}` }, /* @__PURE__ */ React10__default.createElement(AccordionControl, null, item), /* @__PURE__ */ React10__default.createElement(Accordion.Panel, null, /* @__PURE__ */ React10__default.createElement(
|
|
3853
4603
|
SubtopicAccordion,
|
|
3854
4604
|
{
|
|
3855
4605
|
graph,
|
|
@@ -3872,30 +4622,25 @@ function CubeButton({
|
|
|
3872
4622
|
locale,
|
|
3873
4623
|
parent
|
|
3874
4624
|
}) {
|
|
3875
|
-
const
|
|
4625
|
+
const callback = useSelectCube(onSelectCube);
|
|
3876
4626
|
const { classes } = useStyles3();
|
|
3877
4627
|
const table = item;
|
|
3878
4628
|
const subtopic = parent != null ? parent : "";
|
|
3879
|
-
return /* @__PURE__ */
|
|
4629
|
+
return /* @__PURE__ */ React10__default.createElement(
|
|
3880
4630
|
Text,
|
|
3881
4631
|
{
|
|
3882
4632
|
key: `table-${item}`,
|
|
3883
|
-
fz: "
|
|
4633
|
+
fz: "xs",
|
|
3884
4634
|
pl: 60,
|
|
3885
|
-
maw:
|
|
4635
|
+
maw: "100%",
|
|
3886
4636
|
pr: "md",
|
|
3887
4637
|
component: "a",
|
|
3888
4638
|
className: isSelected(selectedItem, getCube(graph.items, table, subtopic, locale)) ? `${classes.link} ${classes.linkActive}` : classes.link,
|
|
3889
4639
|
sx: (t) => ({
|
|
3890
4640
|
background: isSelected(selectedItem, getCube(graph.items, table, subtopic, locale)) ? t.fn.primaryColor() : t.colorScheme === "dark" ? t.colors.dark[6] : t.colors.gray[3],
|
|
3891
|
-
|
|
3892
|
-
overflow: "hidden",
|
|
3893
|
-
textOverflow: "ellipsis"
|
|
4641
|
+
overflow: "hidden"
|
|
3894
4642
|
}),
|
|
3895
|
-
onClick: ()
|
|
3896
|
-
onSelectCube(item, subtopic);
|
|
3897
|
-
setExpanded(false);
|
|
3898
|
-
}
|
|
4643
|
+
onClick: callback(item, subtopic)
|
|
3899
4644
|
},
|
|
3900
4645
|
item
|
|
3901
4646
|
);
|
|
@@ -3909,7 +4654,7 @@ function SubtopicAccordion({
|
|
|
3909
4654
|
locale
|
|
3910
4655
|
}) {
|
|
3911
4656
|
const { value, setValue } = useAccordionValue("subtopic", locale);
|
|
3912
|
-
return /* @__PURE__ */
|
|
4657
|
+
return /* @__PURE__ */ React10__default.createElement(
|
|
3913
4658
|
Accordion,
|
|
3914
4659
|
{
|
|
3915
4660
|
value,
|
|
@@ -3920,15 +4665,13 @@ function SubtopicAccordion({
|
|
|
3920
4665
|
ml: 0,
|
|
3921
4666
|
styles: (t) => ({
|
|
3922
4667
|
control: {
|
|
3923
|
-
fontSize:
|
|
4668
|
+
fontSize: t.fontSizes.sm,
|
|
3924
4669
|
background: t.colorScheme === "dark" ? t.colors.dark[7] : t.colors.gray[2],
|
|
3925
4670
|
borderLeft: 8,
|
|
3926
4671
|
borderLeftColor: "transparent",
|
|
3927
4672
|
borderLeftStyle: "solid",
|
|
3928
|
-
"&[data-active]": {
|
|
3929
|
-
|
|
3930
|
-
borderLeftColor: t.colors[t.primaryColor][4],
|
|
3931
|
-
borderLeftStyle: "solid"
|
|
4673
|
+
"&[data-active] span": {
|
|
4674
|
+
color: t.fn.primaryColor()
|
|
3932
4675
|
}
|
|
3933
4676
|
},
|
|
3934
4677
|
content: {
|
|
@@ -3938,7 +4681,7 @@ function SubtopicAccordion({
|
|
|
3938
4681
|
},
|
|
3939
4682
|
[...items].map((item, index) => {
|
|
3940
4683
|
const filtered = [...graph.adjList[item]].filter((value2) => value2 !== parent);
|
|
3941
|
-
return /* @__PURE__ */
|
|
4684
|
+
return /* @__PURE__ */ React10__default.createElement(Accordion.Item, { value: `subtopic-${item}`, key: `subtopic-${item}-${index}` }, /* @__PURE__ */ React10__default.createElement(AccordionControl, null, item), /* @__PURE__ */ React10__default.createElement(Accordion.Panel, null, filtered.map((table, index2) => /* @__PURE__ */ React10__default.createElement(
|
|
3942
4685
|
CubeButton,
|
|
3943
4686
|
{
|
|
3944
4687
|
key: index2,
|
|
@@ -3954,281 +4697,19 @@ function SubtopicAccordion({
|
|
|
3954
4697
|
);
|
|
3955
4698
|
}
|
|
3956
4699
|
|
|
3957
|
-
// src/components/LocaleSelector.tsx
|
|
3958
|
-
init_esm_shims();
|
|
3959
|
-
|
|
3960
|
-
// src/components/Select.tsx
|
|
3961
|
-
init_esm_shims();
|
|
3962
|
-
var SelectObject = forwardRef(function(props, ref) {
|
|
3963
|
-
var _a;
|
|
3964
|
-
const { getLabel, getValue = identity, items, onItemSelect, selectedItem, selectProps = {} } = props;
|
|
3965
|
-
const [itemList, itemMap] = useMemo(() => {
|
|
3966
|
-
const valueAccessor = accesorFactory(getValue);
|
|
3967
|
-
const labelAccessor = getLabel ? accesorFactory(getLabel) : valueAccessor;
|
|
3968
|
-
const list = items.map((item) => ({
|
|
3969
|
-
label: labelAccessor(item),
|
|
3970
|
-
value: valueAccessor(item),
|
|
3971
|
-
item
|
|
3972
|
-
}));
|
|
3973
|
-
return [list, keyBy(list, (option) => option.value)];
|
|
3974
|
-
}, [items, getLabel, getValue]);
|
|
3975
|
-
const selected = useMemo(() => {
|
|
3976
|
-
if (selectedItem == null) return null;
|
|
3977
|
-
if (typeof selectedItem === "string") return selectedItem;
|
|
3978
|
-
const valueAccessor = accesorFactory(getValue);
|
|
3979
|
-
return valueAccessor(selectedItem);
|
|
3980
|
-
}, [selectedItem, getValue]);
|
|
3981
|
-
const itemSelectHandler = (value) => {
|
|
3982
|
-
onItemSelect && onItemSelect(itemMap[value].item);
|
|
3983
|
-
};
|
|
3984
|
-
if (items.length === 0 || !selected) {
|
|
3985
|
-
return null;
|
|
3986
|
-
}
|
|
3987
|
-
return /* @__PURE__ */ React13__default.createElement(
|
|
3988
|
-
Select,
|
|
3989
|
-
{
|
|
3990
|
-
ref,
|
|
3991
|
-
data: itemList,
|
|
3992
|
-
disabled: props.loading || props.disabled,
|
|
3993
|
-
hidden: props.hidden,
|
|
3994
|
-
label: props.label,
|
|
3995
|
-
onChange: itemSelectHandler,
|
|
3996
|
-
onClick: inputFocusHandler,
|
|
3997
|
-
onFocus: inputFocusHandler,
|
|
3998
|
-
searchable: (_a = props.searchable) != null ? _a : props.items.length > 6,
|
|
3999
|
-
value: selected,
|
|
4000
|
-
...selectProps
|
|
4001
|
-
}
|
|
4002
|
-
);
|
|
4003
|
-
});
|
|
4004
|
-
function inputFocusHandler(event) {
|
|
4005
|
-
if (event.target instanceof HTMLInputElement) event.target.select();
|
|
4006
|
-
}
|
|
4007
|
-
var localeSelectorStyle = (theme) => ({
|
|
4008
|
-
input: {
|
|
4009
|
-
border: "none",
|
|
4010
|
-
background: theme.colorScheme === "dark" ? theme.fn.darken(theme.fn.primaryColor(), 0.1) : theme.fn.lighten(theme.fn.primaryColor(), 0.8),
|
|
4011
|
-
borderRadius: theme.radius.sm,
|
|
4012
|
-
color: theme.colorScheme === "dark" ? theme.fn.lighten(theme.fn.primaryColor(), 0.7) : theme.fn.primaryColor(),
|
|
4013
|
-
fontSize: 12,
|
|
4014
|
-
fontWeight: 700,
|
|
4015
|
-
width: 94,
|
|
4016
|
-
textTransform: "uppercase"
|
|
4017
|
-
},
|
|
4018
|
-
item: {
|
|
4019
|
-
fontSize: 12,
|
|
4020
|
-
textTransform: "uppercase"
|
|
4021
|
-
},
|
|
4022
|
-
rightSection: {
|
|
4023
|
-
pointerEvents: "none"
|
|
4024
|
-
// weird hack, seems like CSSObject is not completely right defined inside mantine.
|
|
4025
|
-
}
|
|
4026
|
-
});
|
|
4027
|
-
function LocaleSelector() {
|
|
4028
|
-
const actions2 = useActions();
|
|
4029
|
-
const { resetGraph } = useSideBar();
|
|
4030
|
-
const { translate: t, locale } = useTranslation();
|
|
4031
|
-
const { code: currentCode } = useSelector$1(selectLocale);
|
|
4032
|
-
const { localeOptions } = useSelector$1(selectServerState);
|
|
4033
|
-
const theme = useMantineTheme();
|
|
4034
|
-
const options = useMemo(() => {
|
|
4035
|
-
const languages = ISO6391.getLanguages(localeOptions);
|
|
4036
|
-
return languages.map((lang) => ({
|
|
4037
|
-
label: t("params.label_localeoption", {
|
|
4038
|
-
code: lang.code,
|
|
4039
|
-
engName: lang.name,
|
|
4040
|
-
nativeName: lang.nativeName,
|
|
4041
|
-
customName: t(`params.label_localecustom_${lang.code}`)
|
|
4042
|
-
}) || lang.nativeName,
|
|
4043
|
-
value: lang.code
|
|
4044
|
-
}));
|
|
4045
|
-
}, [locale, localeOptions]);
|
|
4046
|
-
const localeChangeHandler = (l) => {
|
|
4047
|
-
if (currentCode !== l.value) {
|
|
4048
|
-
resetGraph();
|
|
4049
|
-
actions2.updateLocale(l.value);
|
|
4050
|
-
}
|
|
4051
|
-
};
|
|
4052
|
-
if (localeOptions.length < 2) {
|
|
4053
|
-
return null;
|
|
4054
|
-
}
|
|
4055
|
-
return /* @__PURE__ */ React13__default.createElement(Box, { id: "select-locale" }, /* @__PURE__ */ React13__default.createElement(Tooltip, { label: t("params.label_locale") }, /* @__PURE__ */ React13__default.createElement(
|
|
4056
|
-
SelectObject,
|
|
4057
|
-
{
|
|
4058
|
-
getLabel: "value",
|
|
4059
|
-
getValue: "value",
|
|
4060
|
-
items: options,
|
|
4061
|
-
onItemSelect: localeChangeHandler,
|
|
4062
|
-
selectedItem: currentCode,
|
|
4063
|
-
selectProps: {
|
|
4064
|
-
styles: localeSelectorStyle,
|
|
4065
|
-
icon: /* @__PURE__ */ React13__default.createElement(IconLanguage, { size: "0.8rem", color: theme.colorScheme === "dark" ? theme.fn.lighten(theme.fn.primaryColor(), 0.8) : theme.fn.primaryColor() })
|
|
4066
|
-
}
|
|
4067
|
-
}
|
|
4068
|
-
)));
|
|
4069
|
-
}
|
|
4070
|
-
|
|
4071
|
-
// src/components/SideBar.tsx
|
|
4072
|
-
var [useSideBar, Provider] = createContext2("SideBar");
|
|
4073
|
-
function SideBarProvider(props) {
|
|
4074
|
-
const [input, setInput] = useState("");
|
|
4075
|
-
const [expanded, setExpanded] = useState(false);
|
|
4076
|
-
const [results, setResults] = useState([]);
|
|
4077
|
-
const [map, setMap] = useState();
|
|
4078
|
-
const [graph, setGraph] = useState(new graph_default());
|
|
4079
|
-
const resetGraph = () => {
|
|
4080
|
-
setGraph(new graph_default());
|
|
4081
|
-
};
|
|
4082
|
-
return /* @__PURE__ */ React13__default.createElement(
|
|
4083
|
-
Provider,
|
|
4084
|
-
{
|
|
4085
|
-
...props,
|
|
4086
|
-
value: {
|
|
4087
|
-
expanded,
|
|
4088
|
-
setExpanded,
|
|
4089
|
-
graph,
|
|
4090
|
-
setGraph,
|
|
4091
|
-
results,
|
|
4092
|
-
setResults,
|
|
4093
|
-
input,
|
|
4094
|
-
map,
|
|
4095
|
-
setMap,
|
|
4096
|
-
setInput,
|
|
4097
|
-
resetGraph
|
|
4098
|
-
}
|
|
4099
|
-
}
|
|
4100
|
-
);
|
|
4101
|
-
}
|
|
4102
|
-
function SideBar(props) {
|
|
4103
|
-
const { expanded, setExpanded } = useSideBar();
|
|
4104
|
-
return /* @__PURE__ */ React13__default.createElement(
|
|
4105
|
-
Box,
|
|
4106
|
-
{
|
|
4107
|
-
py: "md",
|
|
4108
|
-
sx: (t) => ({
|
|
4109
|
-
height: "calc(100vh - 75px)",
|
|
4110
|
-
backgroundColor: t.colorScheme === "dark" ? t.colors.dark[8] : t.colors.gray[2],
|
|
4111
|
-
boxShadow: "0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",
|
|
4112
|
-
maxWidth: 300,
|
|
4113
|
-
padding: 0
|
|
4114
|
-
})
|
|
4115
|
-
},
|
|
4116
|
-
/* @__PURE__ */ React13__default.createElement(Flex, { h: "100%", direction: "column", justify: "flex-start" }, /* @__PURE__ */ React13__default.createElement(Box, { px: "sm" }, /* @__PURE__ */ React13__default.createElement(Flex, { direction: "column", sx: { flex: 1 } }, /* @__PURE__ */ React13__default.createElement(Flex, { align: "center", justify: "center" }, /* @__PURE__ */ React13__default.createElement(
|
|
4117
|
-
ActionIcon,
|
|
4118
|
-
{
|
|
4119
|
-
onClick: () => setExpanded(!expanded),
|
|
4120
|
-
variant: "subtle",
|
|
4121
|
-
sx: (t) => ({ alignSelf: "center", color: t.colorScheme === "dark" ? t.white : t.colors.gray[7] })
|
|
4122
|
-
},
|
|
4123
|
-
/* @__PURE__ */ React13__default.createElement(DataSetSVG, null)
|
|
4124
|
-
), /* @__PURE__ */ React13__default.createElement(
|
|
4125
|
-
Group,
|
|
4126
|
-
{
|
|
4127
|
-
position: "apart",
|
|
4128
|
-
noWrap: true,
|
|
4129
|
-
sx: {
|
|
4130
|
-
overflow: "hidden",
|
|
4131
|
-
whiteSpace: "nowrap",
|
|
4132
|
-
transition: "width 0.2s cubic-bezier(0.4, 0, 0.2, 1), margin-left 0.2s cubic-bezier(0.4, 0, 0.2, 1)",
|
|
4133
|
-
width: expanded ? 300 : 0
|
|
4134
|
-
}
|
|
4135
|
-
},
|
|
4136
|
-
/* @__PURE__ */ React13__default.createElement(Text, { sx: (t) => ({ color: t.colorScheme === "dark" ? t.white : t.black }), ml: "sm" }, "Select Dataset"),
|
|
4137
|
-
/* @__PURE__ */ React13__default.createElement(LocaleSelector, null)
|
|
4138
|
-
)), /* @__PURE__ */ React13__default.createElement(Box, { my: "md" }, /* @__PURE__ */ React13__default.createElement(Auto, null)), /* @__PURE__ */ React13__default.createElement(Box, { sx: { flexGrow: 1 } }))), /* @__PURE__ */ React13__default.createElement(ScrollArea, { sx: (theme) => ({
|
|
4139
|
-
borderTopColor: theme.colorScheme === "dark" ? theme.colors.dark[6] : theme.colors.gray[3],
|
|
4140
|
-
borderTopWidth: "1px",
|
|
4141
|
-
borderTopStyle: expanded ? "solid" : "none"
|
|
4142
|
-
}) }, /* @__PURE__ */ React13__default.createElement(Box, { h: expanded ? "auto" : "0px" }, props.children)), /* @__PURE__ */ React13__default.createElement(
|
|
4143
|
-
Group,
|
|
4144
|
-
{
|
|
4145
|
-
align: "center",
|
|
4146
|
-
position: expanded ? "right" : "center",
|
|
4147
|
-
w: "100%",
|
|
4148
|
-
p: "md",
|
|
4149
|
-
sx: { alignSelf: "flex-end", marginTop: "auto" },
|
|
4150
|
-
noWrap: true
|
|
4151
|
-
},
|
|
4152
|
-
/* @__PURE__ */ React13__default.createElement(
|
|
4153
|
-
ActionIcon,
|
|
4154
|
-
{
|
|
4155
|
-
onClick: () => setExpanded(!expanded),
|
|
4156
|
-
variant: "subtle",
|
|
4157
|
-
mt: "auto",
|
|
4158
|
-
sx: (t) => ({ alignSelf: "flex-end", color: t.colors.gray[7] })
|
|
4159
|
-
},
|
|
4160
|
-
expanded ? /* @__PURE__ */ React13__default.createElement(IconChevronLeft, null) : /* @__PURE__ */ React13__default.createElement(IconChevronRight, null)
|
|
4161
|
-
)
|
|
4162
|
-
))
|
|
4163
|
-
);
|
|
4164
|
-
}
|
|
4165
|
-
var SideBar_default = SideBar;
|
|
4166
|
-
function SideBarItem({ children }) {
|
|
4167
|
-
const { expanded } = useSideBar();
|
|
4168
|
-
return /* @__PURE__ */ React13__default.createElement(
|
|
4169
|
-
Box,
|
|
4170
|
-
{
|
|
4171
|
-
sx: {
|
|
4172
|
-
overflow: "hidden",
|
|
4173
|
-
whiteSpace: "nowrap",
|
|
4174
|
-
width: expanded ? 300 : 0,
|
|
4175
|
-
transition: "width 0.2s cubic-bezier(0.4, 0, 0.2, 1)"
|
|
4176
|
-
}
|
|
4177
|
-
},
|
|
4178
|
-
children
|
|
4179
|
-
);
|
|
4180
|
-
}
|
|
4181
|
-
function Auto() {
|
|
4182
|
-
const { code: locale } = useSelector$1(selectLocale);
|
|
4183
|
-
const { expanded, graph, setResults, input, setInput, setMap } = useSideBar();
|
|
4184
|
-
const items = graph.items;
|
|
4185
|
-
const roots = useMemo(() => getKeys2(items, "topic", locale), [items]);
|
|
4186
|
-
useEffect(() => {
|
|
4187
|
-
if (graph.items.length > 0) {
|
|
4188
|
-
let matches = [];
|
|
4189
|
-
let maps = /* @__PURE__ */ new Map();
|
|
4190
|
-
roots.forEach((root) => {
|
|
4191
|
-
const { matches: result, map } = graph.filter(locale, root, input);
|
|
4192
|
-
matches = [...matches, ...result];
|
|
4193
|
-
maps = new Map([...maps, ...map]);
|
|
4194
|
-
});
|
|
4195
|
-
setResults(matches);
|
|
4196
|
-
setMap(maps);
|
|
4197
|
-
}
|
|
4198
|
-
}, [input, graph]);
|
|
4199
|
-
return /* @__PURE__ */ React13__default.createElement(Box, null, /* @__PURE__ */ React13__default.createElement(
|
|
4200
|
-
Input,
|
|
4201
|
-
{
|
|
4202
|
-
icon: /* @__PURE__ */ React13__default.createElement(IconSearch, null),
|
|
4203
|
-
radius: "xl",
|
|
4204
|
-
size: "md",
|
|
4205
|
-
placeholder: "Search",
|
|
4206
|
-
value: input,
|
|
4207
|
-
onInput: (e) => setInput(e.currentTarget.value),
|
|
4208
|
-
styles: {
|
|
4209
|
-
wrapper: {
|
|
4210
|
-
whiteSpace: "nowrap",
|
|
4211
|
-
width: expanded ? "100%" : 0,
|
|
4212
|
-
overflow: "hidden",
|
|
4213
|
-
animation: "width 0.2s cubic-bezier(0.4, 0, 0.2, 1)"
|
|
4214
|
-
},
|
|
4215
|
-
input: {
|
|
4216
|
-
whiteSpace: "nowrap",
|
|
4217
|
-
width: expanded ? "100%" : 0,
|
|
4218
|
-
overflow: "hidden"
|
|
4219
|
-
}
|
|
4220
|
-
}
|
|
4221
|
-
}
|
|
4222
|
-
));
|
|
4223
|
-
}
|
|
4224
|
-
|
|
4225
4700
|
// src/components/ParamsExplorer.tsx
|
|
4226
|
-
init_esm_shims();
|
|
4227
4701
|
function ParamsExplorer(props) {
|
|
4228
|
-
return /* @__PURE__ */
|
|
4702
|
+
return /* @__PURE__ */ React10__default.createElement(SelectCube, null);
|
|
4229
4703
|
}
|
|
4230
4704
|
var ParamsExplorer_default = ParamsExplorer;
|
|
4231
4705
|
|
|
4706
|
+
// src/context/index.tsx
|
|
4707
|
+
init_esm_shims();
|
|
4708
|
+
var queryClient = new QueryClient();
|
|
4709
|
+
function AppProviders({ children }) {
|
|
4710
|
+
return /* @__PURE__ */ React10.createElement(QueryClientProvider, { client: queryClient }, children);
|
|
4711
|
+
}
|
|
4712
|
+
|
|
4232
4713
|
// src/components/ExplorerContent.tsx
|
|
4233
4714
|
var useStyles4 = createStyles((theme, params) => ({
|
|
4234
4715
|
container: {
|
|
@@ -4241,7 +4722,8 @@ var useStyles4 = createStyles((theme, params) => ({
|
|
|
4241
4722
|
root: {
|
|
4242
4723
|
display: "flex",
|
|
4243
4724
|
flexFlow: "column nowrap",
|
|
4244
|
-
|
|
4725
|
+
position: "relative",
|
|
4726
|
+
height: "calc(100% - 70px)",
|
|
4245
4727
|
[theme.fn.largerThan("md")]: {
|
|
4246
4728
|
flexDirection: "row"
|
|
4247
4729
|
// height: params.height,
|
|
@@ -4250,9 +4732,10 @@ var useStyles4 = createStyles((theme, params) => ({
|
|
|
4250
4732
|
},
|
|
4251
4733
|
flexCol: {
|
|
4252
4734
|
flex: "1 1 auto",
|
|
4253
|
-
height: "calc(100vh -
|
|
4735
|
+
height: "calc(100vh - 70px)",
|
|
4254
4736
|
[theme.fn.largerThan("md")]: {
|
|
4255
|
-
width: 0
|
|
4737
|
+
width: 0,
|
|
4738
|
+
paddingLeft: 0
|
|
4256
4739
|
}
|
|
4257
4740
|
}
|
|
4258
4741
|
}));
|
|
@@ -4260,17 +4743,16 @@ function ExplorerContent(props) {
|
|
|
4260
4743
|
useMantineTheme();
|
|
4261
4744
|
useState(false);
|
|
4262
4745
|
const translation = useTranslation();
|
|
4263
|
-
useSetup(props.source, props.dataLocale);
|
|
4264
|
-
useSelector$1(selectServerState);
|
|
4746
|
+
useSetup(props.source, props.dataLocale, props.defaultCube);
|
|
4265
4747
|
const { classes } = useStyles4({ height: props.height });
|
|
4266
4748
|
useEffect(() => {
|
|
4267
4749
|
if (props.uiLocale) translation.setLocale(props.uiLocale);
|
|
4268
4750
|
}, [props.uiLocale]);
|
|
4269
4751
|
const splash = useMemo(() => {
|
|
4270
4752
|
const SplashComponent = props.splash;
|
|
4271
|
-
return SplashComponent ? /* @__PURE__ */
|
|
4753
|
+
return SplashComponent ? /* @__PURE__ */ React10__default.createElement(SplashComponent, { translation }) : /* @__PURE__ */ React10__default.createElement(Center, { h: "100%", sx: { flex: 1 } }, /* @__PURE__ */ React10__default.createElement(AnimatedCube, null));
|
|
4272
4754
|
}, [props.splash]);
|
|
4273
|
-
return /* @__PURE__ */
|
|
4755
|
+
return /* @__PURE__ */ React10__default.createElement("div", { className: classes.container }, /* @__PURE__ */ React10__default.createElement("div", { className: classes.root }, /* @__PURE__ */ React10__default.createElement(AppProviders, null, /* @__PURE__ */ React10__default.createElement(SideBarProvider, null, /* @__PURE__ */ React10__default.createElement(SideBar_default, null, /* @__PURE__ */ React10__default.createElement(SideBarItem, null, /* @__PURE__ */ React10__default.createElement(ParamsExplorer_default, null)))), /* @__PURE__ */ React10__default.createElement(ExplorerResults, { className: classes.flexCol, panels: props.panels, splash }))));
|
|
4274
4756
|
}
|
|
4275
4757
|
|
|
4276
4758
|
// src/components/PivotView.tsx
|
|
@@ -4556,7 +5038,7 @@ var ButtonDownload2 = (props) => {
|
|
|
4556
5038
|
console.error("Error downloading content:", error.message);
|
|
4557
5039
|
});
|
|
4558
5040
|
}, [provider]);
|
|
4559
|
-
return /* @__PURE__ */
|
|
5041
|
+
return /* @__PURE__ */ React10__default.createElement(
|
|
4560
5042
|
Button,
|
|
4561
5043
|
{
|
|
4562
5044
|
...buttonProps,
|
|
@@ -4564,13 +5046,13 @@ var ButtonDownload2 = (props) => {
|
|
|
4564
5046
|
onClick,
|
|
4565
5047
|
variant: "default"
|
|
4566
5048
|
},
|
|
4567
|
-
/* @__PURE__ */
|
|
5049
|
+
/* @__PURE__ */ React10__default.createElement(Text, { fz: "xs" }, props.children)
|
|
4568
5050
|
);
|
|
4569
5051
|
};
|
|
4570
5052
|
|
|
4571
5053
|
// src/components/NonIdealState.jsx
|
|
4572
5054
|
init_esm_shims();
|
|
4573
|
-
var NonIdealState = (props) => /* @__PURE__ */
|
|
5055
|
+
var NonIdealState = (props) => /* @__PURE__ */ React10__default.createElement(
|
|
4574
5056
|
Center,
|
|
4575
5057
|
{
|
|
4576
5058
|
h: "100%",
|
|
@@ -4581,7 +5063,7 @@ var NonIdealState = (props) => /* @__PURE__ */ React13__default.createElement(
|
|
|
4581
5063
|
}
|
|
4582
5064
|
})
|
|
4583
5065
|
},
|
|
4584
|
-
/* @__PURE__ */
|
|
5066
|
+
/* @__PURE__ */ React10__default.createElement(Stack, { align: "center", spacing: "xs" }, props.icon && props.icon, props.title && /* @__PURE__ */ React10__default.createElement(Title, { order: 5 }, props.title), props.description && /* @__PURE__ */ React10__default.createElement(Text, null, props.description), props.children && props.children, props.action && props.action)
|
|
4585
5067
|
);
|
|
4586
5068
|
|
|
4587
5069
|
// src/components/PivotView.tsx
|
|
@@ -4671,12 +5153,12 @@ function PivotView(props) {
|
|
|
4671
5153
|
const warnings2 = [];
|
|
4672
5154
|
if (rowProp.type === "prop" || colProp.type === "prop") {
|
|
4673
5155
|
warnings2.push(
|
|
4674
|
-
/* @__PURE__ */
|
|
5156
|
+
/* @__PURE__ */ React10__default.createElement(
|
|
4675
5157
|
Alert,
|
|
4676
5158
|
{
|
|
4677
5159
|
color: "yellow",
|
|
4678
5160
|
m: "sm",
|
|
4679
|
-
icon: /* @__PURE__ */
|
|
5161
|
+
icon: /* @__PURE__ */ React10__default.createElement(IconAlertCircle, { size: "2rem" }),
|
|
4680
5162
|
key: "propertypivot"
|
|
4681
5163
|
},
|
|
4682
5164
|
t("pivot_view.warning_propertypivot")
|
|
@@ -4686,21 +5168,21 @@ function PivotView(props) {
|
|
|
4686
5168
|
const drilldownCount = Object.values(params.drilldowns).filter(isActiveItem).length;
|
|
4687
5169
|
if (drilldownCount > 2) {
|
|
4688
5170
|
warnings2.push(
|
|
4689
|
-
valProp.type !== "SUM" ? /* @__PURE__ */
|
|
5171
|
+
valProp.type !== "SUM" ? /* @__PURE__ */ React10__default.createElement(
|
|
4690
5172
|
Alert,
|
|
4691
5173
|
{
|
|
4692
5174
|
color: "yellow",
|
|
4693
5175
|
m: "sm",
|
|
4694
|
-
icon: /* @__PURE__ */
|
|
5176
|
+
icon: /* @__PURE__ */ React10__default.createElement(IconAlertCircle, { size: "2rem" }),
|
|
4695
5177
|
key: "notsummeasure"
|
|
4696
5178
|
},
|
|
4697
5179
|
t("pivot_view.warning_notsummeasure")
|
|
4698
|
-
) : /* @__PURE__ */
|
|
5180
|
+
) : /* @__PURE__ */ React10__default.createElement(
|
|
4699
5181
|
Alert,
|
|
4700
5182
|
{
|
|
4701
5183
|
color: "yellow",
|
|
4702
5184
|
m: "sm",
|
|
4703
|
-
icon: /* @__PURE__ */
|
|
5185
|
+
icon: /* @__PURE__ */ React10__default.createElement(IconAlertCircle, { size: "2rem" }),
|
|
4704
5186
|
key: "sumdimensions"
|
|
4705
5187
|
},
|
|
4706
5188
|
t("pivot_view.warning_sumdimensions")
|
|
@@ -4711,7 +5193,7 @@ function PivotView(props) {
|
|
|
4711
5193
|
}, [params.drilldowns, rowProp, colProp, valProp]);
|
|
4712
5194
|
const downloadToolbar = useMemo(() => {
|
|
4713
5195
|
if (!pivottedData) return null;
|
|
4714
|
-
return /* @__PURE__ */
|
|
5196
|
+
return /* @__PURE__ */ React10__default.createElement(Input.Wrapper, { label: t("pivot_view.title_download") }, /* @__PURE__ */ React10__default.createElement(Button.Group, null, /* @__PURE__ */ React10__default.createElement(
|
|
4715
5197
|
ButtonDownload2,
|
|
4716
5198
|
{
|
|
4717
5199
|
provider: () => ({
|
|
@@ -4721,7 +5203,7 @@ function PivotView(props) {
|
|
|
4721
5203
|
})
|
|
4722
5204
|
},
|
|
4723
5205
|
"CSV"
|
|
4724
|
-
), /* @__PURE__ */
|
|
5206
|
+
), /* @__PURE__ */ React10__default.createElement(
|
|
4725
5207
|
ButtonDownload2,
|
|
4726
5208
|
{
|
|
4727
5209
|
provider: () => ({
|
|
@@ -4734,51 +5216,51 @@ function PivotView(props) {
|
|
|
4734
5216
|
)));
|
|
4735
5217
|
}, [pivottedData, formatter]);
|
|
4736
5218
|
if (drilldownOptions.length < 2) {
|
|
4737
|
-
return /* @__PURE__ */
|
|
5219
|
+
return /* @__PURE__ */ React10__default.createElement(
|
|
4738
5220
|
NonIdealState,
|
|
4739
5221
|
{
|
|
4740
|
-
icon: /* @__PURE__ */
|
|
5222
|
+
icon: /* @__PURE__ */ React10__default.createElement(IconAlertTriangle, { color: "orange", size: "5rem" }),
|
|
4741
5223
|
title: t("pivot_view.error_missingparams")
|
|
4742
5224
|
}
|
|
4743
5225
|
);
|
|
4744
5226
|
}
|
|
4745
5227
|
let preview;
|
|
4746
5228
|
if (!colProp || !rowProp || !valProp) {
|
|
4747
|
-
preview = /* @__PURE__ */
|
|
5229
|
+
preview = /* @__PURE__ */ React10__default.createElement(
|
|
4748
5230
|
NonIdealState,
|
|
4749
5231
|
{
|
|
4750
|
-
icon: /* @__PURE__ */
|
|
5232
|
+
icon: /* @__PURE__ */ React10__default.createElement(IconAlertTriangle, { color: "orange", size: "5rem" }),
|
|
4751
5233
|
title: t("pivot_view.error_missingparams")
|
|
4752
5234
|
}
|
|
4753
5235
|
);
|
|
4754
5236
|
} else if (colProp === rowProp) {
|
|
4755
|
-
preview = /* @__PURE__ */
|
|
5237
|
+
preview = /* @__PURE__ */ React10__default.createElement(
|
|
4756
5238
|
NonIdealState,
|
|
4757
5239
|
{
|
|
4758
|
-
icon: /* @__PURE__ */
|
|
5240
|
+
icon: /* @__PURE__ */ React10__default.createElement(IconAlertTriangle, { color: "orange", size: "5rem" }),
|
|
4759
5241
|
title: t("pivot_view.error_onedimension")
|
|
4760
5242
|
}
|
|
4761
5243
|
);
|
|
4762
5244
|
} else if (pivottingError != null) {
|
|
4763
|
-
preview = /* @__PURE__ */
|
|
5245
|
+
preview = /* @__PURE__ */ React10__default.createElement(
|
|
4764
5246
|
NonIdealState,
|
|
4765
5247
|
{
|
|
4766
|
-
icon: /* @__PURE__ */
|
|
5248
|
+
icon: /* @__PURE__ */ React10__default.createElement(IconAlertTriangle, { color: "orange", size: "5rem" }),
|
|
4767
5249
|
title: t("pivot_view.error_internal"),
|
|
4768
5250
|
description: t("pivot_view.error_internal_detail", { error: pivottingError.message })
|
|
4769
5251
|
}
|
|
4770
5252
|
);
|
|
4771
5253
|
} else if (!pivottedData) {
|
|
4772
|
-
preview = /* @__PURE__ */
|
|
5254
|
+
preview = /* @__PURE__ */ React10__default.createElement(
|
|
4773
5255
|
NonIdealState,
|
|
4774
5256
|
{
|
|
4775
|
-
icon: /* @__PURE__ */
|
|
5257
|
+
icon: /* @__PURE__ */ React10__default.createElement(Loader, { size: "xl" }),
|
|
4776
5258
|
title: t("pivot_view.loading_title"),
|
|
4777
5259
|
description: t("pivot_view.loading_details")
|
|
4778
5260
|
}
|
|
4779
5261
|
);
|
|
4780
5262
|
} else {
|
|
4781
|
-
preview = /* @__PURE__ */
|
|
5263
|
+
preview = /* @__PURE__ */ React10__default.createElement(
|
|
4782
5264
|
MatrixTable,
|
|
4783
5265
|
{
|
|
4784
5266
|
key: `${fileName} ${formatterKey}`,
|
|
@@ -4789,13 +5271,13 @@ function PivotView(props) {
|
|
|
4789
5271
|
}
|
|
4790
5272
|
);
|
|
4791
5273
|
}
|
|
4792
|
-
return /* @__PURE__ */
|
|
5274
|
+
return /* @__PURE__ */ React10__default.createElement(
|
|
4793
5275
|
Box,
|
|
4794
5276
|
{
|
|
4795
5277
|
id: "query-results-pivot-view",
|
|
4796
5278
|
className: cx(props.className, classes.container)
|
|
4797
5279
|
},
|
|
4798
|
-
/* @__PURE__ */
|
|
5280
|
+
/* @__PURE__ */ React10__default.createElement(Box, { className: classes.colParams }, /* @__PURE__ */ React10__default.createElement(
|
|
4799
5281
|
SimpleGrid,
|
|
4800
5282
|
{
|
|
4801
5283
|
id: "query-results-pivot-view-params",
|
|
@@ -4808,7 +5290,7 @@ function PivotView(props) {
|
|
|
4808
5290
|
{ minWidth: "md", cols: 1 }
|
|
4809
5291
|
]
|
|
4810
5292
|
},
|
|
4811
|
-
/* @__PURE__ */
|
|
5293
|
+
/* @__PURE__ */ React10__default.createElement(
|
|
4812
5294
|
SelectOption,
|
|
4813
5295
|
{
|
|
4814
5296
|
getLabel: "label",
|
|
@@ -4819,7 +5301,7 @@ function PivotView(props) {
|
|
|
4819
5301
|
label: colProp.type === "prop" ? t("pivot_view.label_ddcolumnprop") : t("pivot_view.label_ddcolumn")
|
|
4820
5302
|
}
|
|
4821
5303
|
),
|
|
4822
|
-
/* @__PURE__ */
|
|
5304
|
+
/* @__PURE__ */ React10__default.createElement(
|
|
4823
5305
|
SelectOption,
|
|
4824
5306
|
{
|
|
4825
5307
|
getLabel: "label",
|
|
@@ -4830,7 +5312,7 @@ function PivotView(props) {
|
|
|
4830
5312
|
label: rowProp.type === "prop" ? t("pivot_view.label_ddrowprop") : t("pivot_view.label_ddrow")
|
|
4831
5313
|
}
|
|
4832
5314
|
),
|
|
4833
|
-
/* @__PURE__ */
|
|
5315
|
+
/* @__PURE__ */ React10__default.createElement(
|
|
4834
5316
|
SelectOption,
|
|
4835
5317
|
{
|
|
4836
5318
|
getLabel: "label",
|
|
@@ -4841,7 +5323,7 @@ function PivotView(props) {
|
|
|
4841
5323
|
selectedItem: valProp.value
|
|
4842
5324
|
}
|
|
4843
5325
|
),
|
|
4844
|
-
/* @__PURE__ */
|
|
5326
|
+
/* @__PURE__ */ React10__default.createElement(
|
|
4845
5327
|
SelectObject,
|
|
4846
5328
|
{
|
|
4847
5329
|
getLabel: "label",
|
|
@@ -4854,7 +5336,7 @@ function PivotView(props) {
|
|
|
4854
5336
|
),
|
|
4855
5337
|
downloadToolbar
|
|
4856
5338
|
), warnings.length > 0 ? warnings : null),
|
|
4857
|
-
/* @__PURE__ */
|
|
5339
|
+
/* @__PURE__ */ React10__default.createElement(Box, { className: classes.colContent }, preview)
|
|
4858
5340
|
);
|
|
4859
5341
|
}
|
|
4860
5342
|
function MatrixTable(props) {
|
|
@@ -4916,7 +5398,7 @@ function MatrixTable(props) {
|
|
|
4916
5398
|
columns,
|
|
4917
5399
|
data
|
|
4918
5400
|
});
|
|
4919
|
-
return /* @__PURE__ */
|
|
5401
|
+
return /* @__PURE__ */ React10__default.createElement(MantineReactTable, { table });
|
|
4920
5402
|
}
|
|
4921
5403
|
function stringifyMatrix(matrix, formatter, format2) {
|
|
4922
5404
|
const joint = { csv: ",", tsv: " " }[format2];
|
|
@@ -4963,7 +5445,7 @@ function ExplorerComponent(props) {
|
|
|
4963
5445
|
extra.previewLimit = previewLimit;
|
|
4964
5446
|
});
|
|
4965
5447
|
}, [previewLimit]);
|
|
4966
|
-
let content = /* @__PURE__ */
|
|
5448
|
+
let content = /* @__PURE__ */ React10__default.createElement(
|
|
4967
5449
|
SettingsProvider,
|
|
4968
5450
|
{
|
|
4969
5451
|
actions: boundActions,
|
|
@@ -4973,7 +5455,7 @@ function ExplorerComponent(props) {
|
|
|
4973
5455
|
withPermalink: props.withPermalink,
|
|
4974
5456
|
panels
|
|
4975
5457
|
},
|
|
4976
|
-
/* @__PURE__ */
|
|
5458
|
+
/* @__PURE__ */ React10__default.createElement(TranslationProvider, { defaultLocale: props.uiLocale, translations: props.translations }, /* @__PURE__ */ React10__default.createElement(
|
|
4977
5459
|
ExplorerContent,
|
|
4978
5460
|
{
|
|
4979
5461
|
dataLocale: locale,
|
|
@@ -4983,12 +5465,13 @@ function ExplorerComponent(props) {
|
|
|
4983
5465
|
source: props.source,
|
|
4984
5466
|
splash: props.splash,
|
|
4985
5467
|
uiLocale: props.uiLocale,
|
|
5468
|
+
defaultCube: props.defaultCube,
|
|
4986
5469
|
withMultiQuery
|
|
4987
5470
|
}
|
|
4988
5471
|
))
|
|
4989
5472
|
);
|
|
4990
5473
|
if (withinMantineProvider) {
|
|
4991
|
-
content = /* @__PURE__ */
|
|
5474
|
+
content = /* @__PURE__ */ React10__default.createElement(
|
|
4992
5475
|
MantineProvider,
|
|
4993
5476
|
{
|
|
4994
5477
|
withNormalizeCSS: true,
|
|
@@ -5025,13 +5508,10 @@ function ExplorerComponent(props) {
|
|
|
5025
5508
|
);
|
|
5026
5509
|
}
|
|
5027
5510
|
if (withinReduxProvider) {
|
|
5028
|
-
content = /* @__PURE__ */
|
|
5511
|
+
content = /* @__PURE__ */ React10__default.createElement(Provider$1, { store }, content);
|
|
5029
5512
|
}
|
|
5030
5513
|
return content;
|
|
5031
5514
|
}
|
|
5032
|
-
ExplorerComponent.defaultProps = {
|
|
5033
|
-
version: process.env.BUILD_VERSION || "dev"
|
|
5034
|
-
};
|
|
5035
5515
|
ExplorerComponent.displayName = "TesseractExplorer";
|
|
5036
5516
|
|
|
5037
5517
|
// src/vizbuilder/components/VizbuilderView.tsx
|
|
@@ -5915,7 +6395,7 @@ function saveElement_default(elem) {
|
|
|
5915
6395
|
|
|
5916
6396
|
// src/vizbuilder/components/ErrorBoundary.tsx
|
|
5917
6397
|
init_esm_shims();
|
|
5918
|
-
var ErrorBoundary = class extends
|
|
6398
|
+
var ErrorBoundary = class extends React10__default.Component {
|
|
5919
6399
|
constructor() {
|
|
5920
6400
|
super(...arguments);
|
|
5921
6401
|
this.state = {
|
|
@@ -5932,9 +6412,9 @@ var ErrorBoundary = class extends React13__default.Component {
|
|
|
5932
6412
|
if (!message) {
|
|
5933
6413
|
return this.props.children;
|
|
5934
6414
|
}
|
|
5935
|
-
return /* @__PURE__ */
|
|
6415
|
+
return /* @__PURE__ */ React10__default.createElement(TranslationConsumer, null, ({ translate: t }) => {
|
|
5936
6416
|
const detailText = t("error.detail");
|
|
5937
|
-
return /* @__PURE__ */
|
|
6417
|
+
return /* @__PURE__ */ React10__default.createElement(Flex, { p: "xl", align: "center", justify: "center", direction: "column", className: "chart-card error" }, /* @__PURE__ */ React10__default.createElement(Title, { order: 3 }, t("error.title")), detailText.length ? /* @__PURE__ */ React10__default.createElement(Text, null, detailText) : null, /* @__PURE__ */ React10__default.createElement(Text, null, t("error.message", { message })), /* @__PURE__ */ React10__default.createElement(Group, { spacing: "xs", my: "sm" }, /* @__PURE__ */ React10__default.createElement(
|
|
5938
6418
|
Button,
|
|
5939
6419
|
{
|
|
5940
6420
|
onClick: this.clearError,
|
|
@@ -5942,7 +6422,7 @@ var ErrorBoundary = class extends React13__default.Component {
|
|
|
5942
6422
|
variant: "light"
|
|
5943
6423
|
},
|
|
5944
6424
|
t("action_retry")
|
|
5945
|
-
), /* @__PURE__ */
|
|
6425
|
+
), /* @__PURE__ */ React10__default.createElement(Button, { error: name4, message })));
|
|
5946
6426
|
});
|
|
5947
6427
|
}
|
|
5948
6428
|
};
|
|
@@ -5988,12 +6468,12 @@ function ChartCard(props) {
|
|
|
5988
6468
|
return asArray2(props.downloadFormats).map((format2) => {
|
|
5989
6469
|
const formatLower = format2.toLowerCase();
|
|
5990
6470
|
const Icon = iconByFormat[formatLower] || IconDownload;
|
|
5991
|
-
return /* @__PURE__ */
|
|
6471
|
+
return /* @__PURE__ */ React10__default.createElement(
|
|
5992
6472
|
Button,
|
|
5993
6473
|
{
|
|
5994
6474
|
compact: true,
|
|
5995
6475
|
key: format2,
|
|
5996
|
-
leftIcon: /* @__PURE__ */
|
|
6476
|
+
leftIcon: /* @__PURE__ */ React10__default.createElement(Icon, { size: 16 }),
|
|
5997
6477
|
onClick: () => {
|
|
5998
6478
|
const { current: boxElement } = nodeRef;
|
|
5999
6479
|
const svgElement = boxElement && boxElement.querySelector("svg");
|
|
@@ -6015,11 +6495,11 @@ function ChartCard(props) {
|
|
|
6015
6495
|
const focusButton = useMemo(() => {
|
|
6016
6496
|
if (!isFocused && isSingleChart) return null;
|
|
6017
6497
|
const Icon = isFocused ? IconArrowsMinimize : IconArrowsMaximize;
|
|
6018
|
-
return /* @__PURE__ */
|
|
6498
|
+
return /* @__PURE__ */ React10__default.createElement(
|
|
6019
6499
|
Button,
|
|
6020
6500
|
{
|
|
6021
6501
|
compact: true,
|
|
6022
|
-
leftIcon: /* @__PURE__ */
|
|
6502
|
+
leftIcon: /* @__PURE__ */ React10__default.createElement(Icon, { size: 16 }),
|
|
6023
6503
|
onClick: props.onToggle,
|
|
6024
6504
|
size: "sm",
|
|
6025
6505
|
variant: isFocused ? "filled" : "light"
|
|
@@ -6028,7 +6508,7 @@ function ChartCard(props) {
|
|
|
6028
6508
|
);
|
|
6029
6509
|
}, [isFocused, isSingleChart, locale, props.onToggle]);
|
|
6030
6510
|
const height = isFocused ? "calc(100vh - 3rem)" : isSingleChart ? "75vh" : 300;
|
|
6031
|
-
return /* @__PURE__ */
|
|
6511
|
+
return /* @__PURE__ */ React10__default.createElement(Paper, { h: height, w: "100%", style: { overflow: "hidden" } }, /* @__PURE__ */ React10__default.createElement(ErrorBoundary, null, /* @__PURE__ */ React10__default.createElement(Stack, { spacing: 0, h: height, style: { position: "relative" }, w: "100%" }, /* @__PURE__ */ React10__default.createElement(Group, { position: "right", p: "xs", spacing: "xs", align: "center" }, downloadButtons, focusButton), /* @__PURE__ */ React10__default.createElement(Box, { style: { flex: "1 1 auto" }, ref: nodeRef, pb: "xs", px: "xs" }, /* @__PURE__ */ React10__default.createElement(ChartComponent, { config })))));
|
|
6032
6512
|
}
|
|
6033
6513
|
var getBackground = (node) => {
|
|
6034
6514
|
if (node.nodeType !== Node.ELEMENT_NODE) return "white";
|
|
@@ -6107,8 +6587,8 @@ function createVizbuilderView(settings) {
|
|
|
6107
6587
|
const isSingleChart = charts.length === 1;
|
|
6108
6588
|
const chartMap = new Map(charts.map((item) => [item.key, item]));
|
|
6109
6589
|
const filteredCharts = [...chartMap.values()];
|
|
6110
|
-
if (filteredCharts.length === 0) return /* @__PURE__ */
|
|
6111
|
-
return /* @__PURE__ */
|
|
6590
|
+
if (filteredCharts.length === 0) return /* @__PURE__ */ React10__default.createElement(Notice, null);
|
|
6591
|
+
return /* @__PURE__ */ React10__default.createElement(
|
|
6112
6592
|
SimpleGrid,
|
|
6113
6593
|
{
|
|
6114
6594
|
breakpoints: [
|
|
@@ -6119,7 +6599,7 @@ function createVizbuilderView(settings) {
|
|
|
6119
6599
|
],
|
|
6120
6600
|
className: clsx_m_default({ unique: filteredCharts.length === 1 })
|
|
6121
6601
|
},
|
|
6122
|
-
filteredCharts.map((chart) => /* @__PURE__ */
|
|
6602
|
+
filteredCharts.map((chart) => /* @__PURE__ */ React10__default.createElement(
|
|
6123
6603
|
ChartCard,
|
|
6124
6604
|
{
|
|
6125
6605
|
chart,
|
|
@@ -6140,7 +6620,7 @@ function createVizbuilderView(settings) {
|
|
|
6140
6620
|
const focusContent = useMemo(() => {
|
|
6141
6621
|
const chart = charts.find((chart2) => currentChart && chart2.key === currentChart);
|
|
6142
6622
|
if (!chart) return null;
|
|
6143
|
-
return /* @__PURE__ */
|
|
6623
|
+
return /* @__PURE__ */ React10__default.createElement(
|
|
6144
6624
|
ChartCard,
|
|
6145
6625
|
{
|
|
6146
6626
|
chart,
|
|
@@ -6155,7 +6635,7 @@ function createVizbuilderView(settings) {
|
|
|
6155
6635
|
}
|
|
6156
6636
|
);
|
|
6157
6637
|
}, [currentChart, charts]);
|
|
6158
|
-
return /* @__PURE__ */
|
|
6638
|
+
return /* @__PURE__ */ React10__default.createElement(Box, { className: props.className, p: "sm" }, content, /* @__PURE__ */ React10__default.createElement(
|
|
6159
6639
|
Modal,
|
|
6160
6640
|
{
|
|
6161
6641
|
centered: true,
|
|
@@ -6175,7 +6655,7 @@ function createVizbuilderView(settings) {
|
|
|
6175
6655
|
}
|
|
6176
6656
|
function NonIdealState2() {
|
|
6177
6657
|
const { translate: t } = useTranslation();
|
|
6178
|
-
return /* @__PURE__ */
|
|
6658
|
+
return /* @__PURE__ */ React10__default.createElement(Box, { className: "vizbuilder-nonidealstate" }, /* @__PURE__ */ React10__default.createElement(Title, { order: 1, className: "vizbuilder-nonidealstate-header" }, t("nonidealstate_msg")));
|
|
6179
6659
|
}
|
|
6180
6660
|
/*! Bundled license information:
|
|
6181
6661
|
|