@datawheel/data-explorer 1.0.4 → 1.0.6
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.d.mts +3 -3
- package/dist/main.mjs +156 -191
- package/package.json +1 -1
package/dist/main.d.mts
CHANGED
|
@@ -467,7 +467,7 @@ interface ViewProps<TData extends Record<string, any> = Record<string, string |
|
|
|
467
467
|
cube: TesseractCube;
|
|
468
468
|
panelKey: string | null;
|
|
469
469
|
params: QueryParams;
|
|
470
|
-
result
|
|
470
|
+
result?: QueryResult<TData>;
|
|
471
471
|
table?: MRT_TableInstance<TData & Record<string, any>>;
|
|
472
472
|
isError?: boolean;
|
|
473
473
|
isLoading?: boolean;
|
|
@@ -478,7 +478,7 @@ interface ViewProps<TData extends Record<string, any> = Record<string, string |
|
|
|
478
478
|
}
|
|
479
479
|
|
|
480
480
|
/** */
|
|
481
|
-
declare function DebugView(props: ViewProps): React.JSX.Element;
|
|
481
|
+
declare function DebugView(props: ViewProps): React.JSX.Element | null;
|
|
482
482
|
|
|
483
483
|
declare const explorerTranslation: {
|
|
484
484
|
action_copy: string;
|
|
@@ -1188,7 +1188,7 @@ declare namespace ExplorerComponent {
|
|
|
1188
1188
|
}
|
|
1189
1189
|
|
|
1190
1190
|
/** */
|
|
1191
|
-
declare function PivotView<TData extends Record<string, unknown>>(props: {} & ViewProps<TData> & MRT_TableOptions<TData>): React.JSX.Element;
|
|
1191
|
+
declare function PivotView<TData extends Record<string, unknown>>(props: {} & ViewProps<TData> & MRT_TableOptions<TData>): React.JSX.Element | null;
|
|
1192
1192
|
|
|
1193
1193
|
type TData = Record<string, string | number> & Record<string, any>;
|
|
1194
1194
|
type TableView = {
|
package/dist/main.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { keyframes, createStyles, Select, rem, Input, Box, Text, Stack, Group, Button, SimpleGrid, Flex, ScrollArea, LoadingOverlay, Table, MultiSelect, Center, NumberInput, Menu, ActionIcon, UnstyledButton, Alert, Loader, Container, Title, useMantineTheme, MantineProvider, Modal, Space, useComponentDefaultProps, Anchor, Paper, Accordion, Tooltip, Tabs, Switch, ThemeIcon, CloseButton, Drawer, Divider, Checkbox, packSx, Affix, Popover } from '@mantine/core';
|
|
2
2
|
import { useClipboard, useFullscreen, useDebouncedState, useMediaQuery, useDisclosure } from '@mantine/hooks';
|
|
3
|
-
import { IconWorld, IconExternalLink, IconClipboard, IconSettings, IconMathGreater, IconMathLower, IconArrowsLeftRight, IconAlertCircle, IconAlertTriangle, IconCopy, IconDownload, IconDotsVertical, IconArrowRight, IconArrowLeft, IconBrandGithub, IconCheck, IconShare, IconLanguage, IconTrash, IconInfoCircleFilled, IconChevronLeft, IconChevronRight, IconSearch, IconArrowsMinimize, IconArrowsMaximize, IconCircleOff, IconArrowsSort, IconSortDescendingNumbers, IconSortDescendingLetters, IconSortAscendingNumbers, IconSortAscendingLetters, IconPlus, IconStack3, IconFilterOff, IconFilter, IconAdjustments,
|
|
3
|
+
import { IconWorld, IconExternalLink, IconClipboard, IconSettings, IconMathGreater, IconMathLower, IconArrowsLeftRight, IconAlertCircle, IconAlertTriangle, IconCopy, IconDownload, IconDotsVertical, IconBox, IconArrowRight, IconArrowLeft, IconBrandGithub, IconCheck, IconShare, IconLanguage, IconTrash, IconInfoCircleFilled, IconChevronLeft, IconChevronRight, IconSearch, IconArrowsMinimize, IconArrowsMaximize, IconCircleOff, IconArrowsSort, IconSortDescendingNumbers, IconSortDescendingLetters, IconSortAscendingNumbers, IconSortAscendingLetters, IconPlus, IconStack3, IconFilterOff, IconFilter, IconAdjustments, IconClock, IconHelpCircle, IconPhotoDown, IconVectorTriangle } from '@tabler/icons-react';
|
|
4
4
|
import * as React13 from 'react';
|
|
5
5
|
import React13__default, { createContext, forwardRef, useMemo, useCallback, useContext, useRef, useEffect, useState, Suspense, Component, useLayoutEffect } from 'react';
|
|
6
6
|
import { translationFactory } from '@datawheel/use-translation';
|
|
@@ -500,42 +500,19 @@ var { useTranslation, TranslationConsumer, TranslationProvider } = translationFa
|
|
|
500
500
|
|
|
501
501
|
// src/components/DebugView.tsx
|
|
502
502
|
function DebugView(props) {
|
|
503
|
+
if (!props.result) return null;
|
|
503
504
|
const { url } = props.result;
|
|
504
505
|
const { translate: t } = useTranslation();
|
|
505
506
|
const { copy, copied } = useClipboard({ timeout: 1e3 });
|
|
506
507
|
const copyHandler = useCallback(() => copy(url), [url, copy]);
|
|
507
508
|
const openHandler = useCallback(() => window.open(url, "_blank"), [url]);
|
|
508
509
|
const headers = useMemo(() => {
|
|
509
|
-
|
|
510
|
+
var _a;
|
|
511
|
+
const headers2 = Object.entries(((_a = props.result) == null ? void 0 : _a.headers) || {});
|
|
510
512
|
if (headers2.length === 0) return null;
|
|
511
513
|
return /* @__PURE__ */ React13__default.createElement(Input.Wrapper, { label: t("debug_view.httpheaders") }, /* @__PURE__ */ React13__default.createElement(Box, { component: "dl", sx: { fontFamily: "monospace", overflowWrap: "break-word" } }, headers2.map((entry) => /* @__PURE__ */ React13__default.createElement(React13__default.Fragment, { key: entry[0] }, /* @__PURE__ */ React13__default.createElement(Text, { component: "dt", fw: "bold", fz: "sm" }, entry[0]), /* @__PURE__ */ React13__default.createElement(Text, { component: "dd", c: "#5c940d", fz: "sm" }, entry[1])))));
|
|
512
514
|
}, [props.result.headers, t]);
|
|
513
|
-
return /* @__PURE__ */ React13__default.createElement(Box, { id: "query-results-debug-view" }, /* @__PURE__ */ React13__default.createElement(Stack, { spacing: "md", px: "md", py: "sm" }, url && /* @__PURE__ */ React13__default.createElement(Input.Wrapper, { label: t("debug_view.url_logiclayer") }, /* @__PURE__ */ React13__default.createElement(Group, { noWrap: true, spacing: "xs" }, /* @__PURE__ */ React13__default.createElement(
|
|
514
|
-
Input,
|
|
515
|
-
{
|
|
516
|
-
icon: /* @__PURE__ */ React13__default.createElement(IconWorld, null),
|
|
517
|
-
readOnly: true,
|
|
518
|
-
rightSectionWidth: "auto",
|
|
519
|
-
value: url,
|
|
520
|
-
w: "100%"
|
|
521
|
-
}
|
|
522
|
-
), /* @__PURE__ */ React13__default.createElement(Button.Group, null, /* @__PURE__ */ React13__default.createElement(
|
|
523
|
-
Button,
|
|
524
|
-
{
|
|
525
|
-
leftIcon: /* @__PURE__ */ React13__default.createElement(IconExternalLink, null),
|
|
526
|
-
onClick: openHandler,
|
|
527
|
-
variant: "default"
|
|
528
|
-
},
|
|
529
|
-
t("action_open")
|
|
530
|
-
), /* @__PURE__ */ React13__default.createElement(
|
|
531
|
-
Button,
|
|
532
|
-
{
|
|
533
|
-
leftIcon: /* @__PURE__ */ React13__default.createElement(IconClipboard, null),
|
|
534
|
-
onClick: copyHandler,
|
|
535
|
-
variant: "default"
|
|
536
|
-
},
|
|
537
|
-
copied ? t("action_copy_done") : t("action_copy")
|
|
538
|
-
)))), /* @__PURE__ */ React13__default.createElement(SimpleGrid, { cols: 2 }, headers)));
|
|
515
|
+
return /* @__PURE__ */ React13__default.createElement(Box, { id: "query-results-debug-view" }, /* @__PURE__ */ React13__default.createElement(Stack, { spacing: "md", px: "md", py: "sm" }, url && /* @__PURE__ */ React13__default.createElement(Input.Wrapper, { label: t("debug_view.url_logiclayer") }, /* @__PURE__ */ React13__default.createElement(Group, { noWrap: true, spacing: "xs" }, /* @__PURE__ */ React13__default.createElement(Input, { icon: /* @__PURE__ */ React13__default.createElement(IconWorld, null), readOnly: true, rightSectionWidth: "auto", value: url, w: "100%" }), /* @__PURE__ */ React13__default.createElement(Button.Group, null, /* @__PURE__ */ React13__default.createElement(Button, { leftIcon: /* @__PURE__ */ React13__default.createElement(IconExternalLink, null), onClick: openHandler, variant: "default" }, t("action_open")), /* @__PURE__ */ React13__default.createElement(Button, { leftIcon: /* @__PURE__ */ React13__default.createElement(IconClipboard, null), onClick: copyHandler, variant: "default" }, copied ? t("action_copy_done") : t("action_copy"))))), /* @__PURE__ */ React13__default.createElement(SimpleGrid, { cols: 2 }, headers)));
|
|
539
516
|
}
|
|
540
517
|
|
|
541
518
|
// src/components/Explorer.tsx
|
|
@@ -2368,7 +2345,7 @@ function useFetchQuery(queryParams, queryLink, options) {
|
|
|
2368
2345
|
if (!response.ok) {
|
|
2369
2346
|
throw new Error(`Backend Error: ${content.detail}`);
|
|
2370
2347
|
}
|
|
2371
|
-
const cubeData = await tesseract.fetchCube({ cube: queryParams.cube });
|
|
2348
|
+
const cubeData = await tesseract.fetchCube({ cube: queryParams.cube, locale: queryParams.locale });
|
|
2372
2349
|
return {
|
|
2373
2350
|
data: content.data,
|
|
2374
2351
|
page: content.page,
|
|
@@ -2948,10 +2925,8 @@ function useTableRefresh() {
|
|
|
2948
2925
|
function useTableData({ pagination }) {
|
|
2949
2926
|
const queryItem = useSelector$1(selectCurrentQueryItem);
|
|
2950
2927
|
const queryLink = queryItem.link;
|
|
2951
|
-
useActions();
|
|
2952
2928
|
const pageSize = pagination.pageSize;
|
|
2953
2929
|
const pageIndex = pagination.pageIndex;
|
|
2954
|
-
useUpdateUrl();
|
|
2955
2930
|
const query = useFetchQuery(queryItem.params, queryLink, {
|
|
2956
2931
|
limit: pageSize,
|
|
2957
2932
|
offset: pageIndex * pageSize
|
|
@@ -3252,6 +3227,7 @@ function useTable({
|
|
|
3252
3227
|
...mantineTableProps
|
|
3253
3228
|
});
|
|
3254
3229
|
return {
|
|
3230
|
+
result: data,
|
|
3255
3231
|
table,
|
|
3256
3232
|
isError,
|
|
3257
3233
|
isLoading,
|
|
@@ -3419,6 +3395,7 @@ function MultiFilter({ header }) {
|
|
|
3419
3395
|
const cutItems = useSelector$1(selectCutItems);
|
|
3420
3396
|
const drilldownItems = useSelector$1(selectDrilldownItems);
|
|
3421
3397
|
const label = header.column.id;
|
|
3398
|
+
const localeLabel = header.column.columnDef.header;
|
|
3422
3399
|
const drilldown = drilldownItems.find((d) => d.level === header.column.id);
|
|
3423
3400
|
const actions2 = useActions();
|
|
3424
3401
|
const { idFormatters } = useidFormatters();
|
|
@@ -3460,7 +3437,7 @@ function MultiFilter({ header }) {
|
|
|
3460
3437
|
newQuery.params.cuts[cut.key] = { ...newCut, members: value };
|
|
3461
3438
|
debouncedUpdateUrl(newQuery);
|
|
3462
3439
|
},
|
|
3463
|
-
placeholder: t("params.filter_by", { name:
|
|
3440
|
+
placeholder: t("params.filter_by", { name: localeLabel }),
|
|
3464
3441
|
value: cut.members || [],
|
|
3465
3442
|
data: drilldown.members.map((m) => {
|
|
3466
3443
|
const idFormatter = idFormatters[`${label} ID`];
|
|
@@ -4236,7 +4213,8 @@ function ExplorerResults(props) {
|
|
|
4236
4213
|
className: cx(classes.container, props.className),
|
|
4237
4214
|
cube,
|
|
4238
4215
|
panels: props.panels,
|
|
4239
|
-
params
|
|
4216
|
+
params,
|
|
4217
|
+
panelKey: null
|
|
4240
4218
|
},
|
|
4241
4219
|
props.splash
|
|
4242
4220
|
);
|
|
@@ -4256,15 +4234,13 @@ function FailureResult(props) {
|
|
|
4256
4234
|
}
|
|
4257
4235
|
function SuccessResult(props) {
|
|
4258
4236
|
const updateUrl = useUpdateUrl();
|
|
4259
|
-
const { cube, panels, params
|
|
4237
|
+
const { cube, panels, params } = props;
|
|
4260
4238
|
const { translate: t } = useTranslation();
|
|
4261
4239
|
const { previewLimit, actions: actions2 } = useSettings();
|
|
4262
4240
|
const queryItem = useSelector$1(selectCurrentQueryItem);
|
|
4263
4241
|
const isPreviewMode = useSelector$1(selectIsPreviewMode);
|
|
4264
|
-
const { table, isError, isLoading, data, columns, pagination, setPagination } = useTable({
|
|
4265
|
-
cube
|
|
4266
|
-
});
|
|
4267
4242
|
const fullscreen = useFullscreen();
|
|
4243
|
+
const { classes, cx } = useStyles2();
|
|
4268
4244
|
const [CurrentComponent, panelKey, panelMeta] = useMemo(() => {
|
|
4269
4245
|
const currentPanel = queryItem.panel || `${panels[0].key}-`;
|
|
4270
4246
|
const [panelKey2, ...panelMeta2] = currentPanel.split("-");
|
|
@@ -4275,6 +4251,20 @@ function SuccessResult(props) {
|
|
|
4275
4251
|
actions2.switchPanel(newTab);
|
|
4276
4252
|
updateUrl({ ...queryItem, panel: newTab });
|
|
4277
4253
|
};
|
|
4254
|
+
const { table, isError, isLoading, data, columns, result, pagination, setPagination } = useTable({
|
|
4255
|
+
cube
|
|
4256
|
+
});
|
|
4257
|
+
if ((data == null ? void 0 : data.length) === 0 && !isLoading && !isError) {
|
|
4258
|
+
return /* @__PURE__ */ React13__default.createElement(
|
|
4259
|
+
FailureResult,
|
|
4260
|
+
{
|
|
4261
|
+
className: cx(classes.container, props.className),
|
|
4262
|
+
icon: /* @__PURE__ */ React13__default.createElement(IconBox, { color: "orange", size: "5rem" }),
|
|
4263
|
+
title: t("results.error_emptyresult_title"),
|
|
4264
|
+
description: t("results.error_emptyresult_detail")
|
|
4265
|
+
}
|
|
4266
|
+
);
|
|
4267
|
+
}
|
|
4278
4268
|
return /* @__PURE__ */ React13__default.createElement(
|
|
4279
4269
|
Flex,
|
|
4280
4270
|
{
|
|
@@ -4305,7 +4295,7 @@ function SuccessResult(props) {
|
|
|
4305
4295
|
h: "fit-content"
|
|
4306
4296
|
},
|
|
4307
4297
|
/* @__PURE__ */ React13__default.createElement(ExplorerTabs, { panels, onChange: tabHandler, value: panelKey }),
|
|
4308
|
-
(!queryItem.panel || queryItem.panel === "table") && /* @__PURE__ */ React13__default.createElement(Group, { sx: { display: "flex", flex: "0 1 auto", gap: "0.5rem" }, mr: "sm", noWrap: true }, /* @__PURE__ */ React13__default.createElement(Toolbar, { table, fullscreen }), /* @__PURE__ */ React13__default.createElement(DrawerMenu_default, null))
|
|
4298
|
+
(!queryItem.panel || queryItem.panel === "table") && /* @__PURE__ */ React13__default.createElement(Group, { sx: { display: "flex", flex: "0 1 auto", gap: "0.5rem" }, mr: "sm", noWrap: true }, props.table && /* @__PURE__ */ React13__default.createElement(Toolbar, { table: props.table, fullscreen }), /* @__PURE__ */ React13__default.createElement(DrawerMenu_default, null))
|
|
4309
4299
|
),
|
|
4310
4300
|
isPreviewMode && /* @__PURE__ */ React13__default.createElement(Alert, { id: "alert-load-all-results", color: "yellow", radius: 0, sx: { flex: "0 0 auto" } }, /* @__PURE__ */ React13__default.createElement(Group, { position: "apart" }, /* @__PURE__ */ React13__default.createElement(Text, null, /* @__PURE__ */ React13__default.createElement(Text, { fw: 700, span: true }, t("previewMode.title_preview"), ":", " "), /* @__PURE__ */ React13__default.createElement(Text, { span: true }, t("previewMode.description_preview", { limit: previewLimit }))), /* @__PURE__ */ React13__default.createElement(PreviewModeSwitch, null))),
|
|
4311
4301
|
/* @__PURE__ */ React13__default.createElement(
|
|
@@ -4320,11 +4310,11 @@ function SuccessResult(props) {
|
|
|
4320
4310
|
panelKey: `${panelKey}-${panelMeta}`,
|
|
4321
4311
|
cube,
|
|
4322
4312
|
params,
|
|
4313
|
+
data,
|
|
4323
4314
|
result,
|
|
4324
4315
|
table,
|
|
4325
4316
|
isError,
|
|
4326
4317
|
isLoading,
|
|
4327
|
-
data,
|
|
4328
4318
|
columns,
|
|
4329
4319
|
pagination,
|
|
4330
4320
|
setPagination
|
|
@@ -4815,7 +4805,7 @@ function QueryProvider({ children, defaultCube }) {
|
|
|
4815
4805
|
const cubeDefault = defaultCube && hasProperty(cubeMap, defaultCube) ? defaultCube : Object.keys(cubeMap)[0];
|
|
4816
4806
|
setDefaultValues(cubeMap[cubeDefault]);
|
|
4817
4807
|
}
|
|
4818
|
-
}, [location2.search, runFetchMembers, schema, serverURL]);
|
|
4808
|
+
}, [location2.search, runFetchMembers, schema, serverURL, defaultLocale]);
|
|
4819
4809
|
const onChangeCube = (table, subtopic) => {
|
|
4820
4810
|
const locale = defaultLocale || queryItem.params.locale;
|
|
4821
4811
|
const cubeMap = (schema == null ? void 0 : schema.cubeMap) || {};
|
|
@@ -5562,7 +5552,8 @@ var useStyles5 = createStyles((theme) => ({
|
|
|
5562
5552
|
}
|
|
5563
5553
|
}));
|
|
5564
5554
|
function PivotView(props) {
|
|
5565
|
-
const { cube, params, result, ...mantineReactTableProps } = props;
|
|
5555
|
+
const { cube, params, result, isLoading, ...mantineReactTableProps } = props;
|
|
5556
|
+
if (!result) return null;
|
|
5566
5557
|
const locale = params.locale;
|
|
5567
5558
|
const { translate: t } = useTranslation();
|
|
5568
5559
|
const measureMap = useSelector$1(selectOlapMeasureMap);
|
|
@@ -5609,51 +5600,27 @@ function PivotView(props) {
|
|
|
5609
5600
|
);
|
|
5610
5601
|
const [valProp, setValueProp] = useState(() => measureOptions[0]);
|
|
5611
5602
|
const fileName = [params.cube, colProp.label, rowProp.label, valProp.value].join("_");
|
|
5612
|
-
const [pivottedData, pivottingError] = usePivottedData(
|
|
5613
|
-
|
|
5614
|
-
|
|
5615
|
-
|
|
5616
|
-
|
|
5617
|
-
|
|
5618
|
-
} = useFormatParams(
|
|
5603
|
+
const [pivottedData, pivottingError] = usePivottedData(
|
|
5604
|
+
result.data,
|
|
5605
|
+
colProp.value,
|
|
5606
|
+
rowProp.value,
|
|
5607
|
+
valProp.value
|
|
5608
|
+
);
|
|
5609
|
+
const { formatter: formatter2, formatterKey, formatterKeyOptions, setFormat } = useFormatParams(
|
|
5610
|
+
props.cube.measures,
|
|
5611
|
+
valProp.value
|
|
5612
|
+
);
|
|
5619
5613
|
const warnings = useMemo(() => {
|
|
5620
5614
|
const warnings2 = [];
|
|
5621
5615
|
if (rowProp.type === "prop" || colProp.type === "prop") {
|
|
5622
5616
|
warnings2.push(
|
|
5623
|
-
/* @__PURE__ */ React13__default.createElement(
|
|
5624
|
-
Alert,
|
|
5625
|
-
{
|
|
5626
|
-
color: "yellow",
|
|
5627
|
-
m: "sm",
|
|
5628
|
-
icon: /* @__PURE__ */ React13__default.createElement(IconAlertCircle, { size: "2rem" }),
|
|
5629
|
-
key: "propertypivot"
|
|
5630
|
-
},
|
|
5631
|
-
t("pivot_view.warning_propertypivot")
|
|
5632
|
-
)
|
|
5617
|
+
/* @__PURE__ */ React13__default.createElement(Alert, { color: "yellow", m: "sm", icon: /* @__PURE__ */ React13__default.createElement(IconAlertCircle, { size: "2rem" }), key: "propertypivot" }, t("pivot_view.warning_propertypivot"))
|
|
5633
5618
|
);
|
|
5634
5619
|
}
|
|
5635
5620
|
const drilldownCount = Object.values(params.drilldowns).filter(isActiveItem).length;
|
|
5636
5621
|
if (drilldownCount > 2) {
|
|
5637
5622
|
warnings2.push(
|
|
5638
|
-
valProp.type !== "Sum" /* SUM */ ? /* @__PURE__ */ React13__default.createElement(
|
|
5639
|
-
Alert,
|
|
5640
|
-
{
|
|
5641
|
-
color: "yellow",
|
|
5642
|
-
m: "sm",
|
|
5643
|
-
icon: /* @__PURE__ */ React13__default.createElement(IconAlertCircle, { size: "2rem" }),
|
|
5644
|
-
key: "notsummeasure"
|
|
5645
|
-
},
|
|
5646
|
-
t("pivot_view.warning_notsummeasure")
|
|
5647
|
-
) : /* @__PURE__ */ React13__default.createElement(
|
|
5648
|
-
Alert,
|
|
5649
|
-
{
|
|
5650
|
-
color: "yellow",
|
|
5651
|
-
m: "sm",
|
|
5652
|
-
icon: /* @__PURE__ */ React13__default.createElement(IconAlertCircle, { size: "2rem" }),
|
|
5653
|
-
key: "sumdimensions"
|
|
5654
|
-
},
|
|
5655
|
-
t("pivot_view.warning_sumdimensions")
|
|
5656
|
-
)
|
|
5623
|
+
valProp.type !== "Sum" /* SUM */ ? /* @__PURE__ */ React13__default.createElement(Alert, { color: "yellow", m: "sm", icon: /* @__PURE__ */ React13__default.createElement(IconAlertCircle, { size: "2rem" }), key: "notsummeasure" }, t("pivot_view.warning_notsummeasure")) : /* @__PURE__ */ React13__default.createElement(Alert, { color: "yellow", m: "sm", icon: /* @__PURE__ */ React13__default.createElement(IconAlertCircle, { size: "2rem" }), key: "sumdimensions" }, t("pivot_view.warning_sumdimensions"))
|
|
5657
5624
|
);
|
|
5658
5625
|
}
|
|
5659
5626
|
return warnings2;
|
|
@@ -5738,127 +5705,127 @@ function PivotView(props) {
|
|
|
5738
5705
|
}
|
|
5739
5706
|
);
|
|
5740
5707
|
}
|
|
5741
|
-
return /* @__PURE__ */ React13__default.createElement(
|
|
5742
|
-
|
|
5708
|
+
return /* @__PURE__ */ React13__default.createElement(Box, { id: "query-results-pivot-view", className: cx(props.className, classes.container) }, /* @__PURE__ */ React13__default.createElement(Box, { className: classes.colParams }, /* @__PURE__ */ React13__default.createElement(
|
|
5709
|
+
SimpleGrid,
|
|
5743
5710
|
{
|
|
5744
|
-
id: "query-results-pivot-view",
|
|
5745
|
-
|
|
5711
|
+
id: "query-results-pivot-view-params",
|
|
5712
|
+
px: "md",
|
|
5713
|
+
py: "sm",
|
|
5714
|
+
cols: 1,
|
|
5715
|
+
breakpoints: [
|
|
5716
|
+
{ minWidth: "xs", cols: 2 },
|
|
5717
|
+
{ minWidth: "sm", cols: 3 },
|
|
5718
|
+
{ minWidth: "md", cols: 1 }
|
|
5719
|
+
]
|
|
5746
5720
|
},
|
|
5747
|
-
/* @__PURE__ */ React13__default.createElement(
|
|
5748
|
-
|
|
5721
|
+
/* @__PURE__ */ React13__default.createElement(
|
|
5722
|
+
SelectOption,
|
|
5749
5723
|
{
|
|
5750
|
-
|
|
5751
|
-
|
|
5752
|
-
|
|
5753
|
-
|
|
5754
|
-
|
|
5755
|
-
|
|
5756
|
-
|
|
5757
|
-
|
|
5758
|
-
|
|
5759
|
-
|
|
5760
|
-
|
|
5761
|
-
|
|
5762
|
-
|
|
5763
|
-
|
|
5764
|
-
|
|
5765
|
-
|
|
5766
|
-
|
|
5767
|
-
|
|
5768
|
-
|
|
5769
|
-
|
|
5770
|
-
|
|
5771
|
-
|
|
5772
|
-
|
|
5773
|
-
|
|
5774
|
-
|
|
5775
|
-
|
|
5776
|
-
|
|
5777
|
-
|
|
5778
|
-
|
|
5779
|
-
|
|
5780
|
-
|
|
5781
|
-
|
|
5782
|
-
|
|
5783
|
-
|
|
5784
|
-
|
|
5785
|
-
|
|
5786
|
-
|
|
5787
|
-
|
|
5788
|
-
|
|
5789
|
-
|
|
5790
|
-
|
|
5791
|
-
|
|
5792
|
-
|
|
5793
|
-
/* @__PURE__ */ React13__default.createElement(
|
|
5794
|
-
SelectObject,
|
|
5795
|
-
{
|
|
5796
|
-
getLabel: "label",
|
|
5797
|
-
getValue: "value",
|
|
5798
|
-
items: formatterKeyOptions,
|
|
5799
|
-
label: t("pivot_view.label_formatter"),
|
|
5800
|
-
onItemSelect: (item) => setFormat(valProp.value, item.value),
|
|
5801
|
-
selectedItem: formatterKey
|
|
5802
|
-
}
|
|
5803
|
-
),
|
|
5804
|
-
downloadToolbar
|
|
5805
|
-
), warnings.length > 0 ? warnings : null),
|
|
5806
|
-
/* @__PURE__ */ React13__default.createElement(Box, { className: classes.colContent }, preview)
|
|
5807
|
-
);
|
|
5724
|
+
getLabel: "label",
|
|
5725
|
+
getValue: "value",
|
|
5726
|
+
items: drilldownOptions,
|
|
5727
|
+
onItemSelect: setColumnProp,
|
|
5728
|
+
selectedItem: colProp.value,
|
|
5729
|
+
label: colProp.type === "prop" ? t("pivot_view.label_ddcolumnprop") : t("pivot_view.label_ddcolumn")
|
|
5730
|
+
}
|
|
5731
|
+
),
|
|
5732
|
+
/* @__PURE__ */ React13__default.createElement(
|
|
5733
|
+
SelectOption,
|
|
5734
|
+
{
|
|
5735
|
+
getLabel: "label",
|
|
5736
|
+
getValue: "value",
|
|
5737
|
+
items: drilldownOptions,
|
|
5738
|
+
onItemSelect: setRowProp,
|
|
5739
|
+
selectedItem: rowProp.value,
|
|
5740
|
+
label: rowProp.type === "prop" ? t("pivot_view.label_ddrowprop") : t("pivot_view.label_ddrow")
|
|
5741
|
+
}
|
|
5742
|
+
),
|
|
5743
|
+
/* @__PURE__ */ React13__default.createElement(
|
|
5744
|
+
SelectOption,
|
|
5745
|
+
{
|
|
5746
|
+
getLabel: "label",
|
|
5747
|
+
getValue: "value",
|
|
5748
|
+
items: measureOptions,
|
|
5749
|
+
label: t("pivot_view.label_valmeasure"),
|
|
5750
|
+
onItemSelect: setValueProp,
|
|
5751
|
+
selectedItem: valProp.value
|
|
5752
|
+
}
|
|
5753
|
+
),
|
|
5754
|
+
/* @__PURE__ */ React13__default.createElement(
|
|
5755
|
+
SelectObject,
|
|
5756
|
+
{
|
|
5757
|
+
getLabel: "label",
|
|
5758
|
+
getValue: "value",
|
|
5759
|
+
items: formatterKeyOptions,
|
|
5760
|
+
label: t("pivot_view.label_formatter"),
|
|
5761
|
+
onItemSelect: (item) => setFormat(valProp.value, item.value),
|
|
5762
|
+
selectedItem: formatterKey
|
|
5763
|
+
}
|
|
5764
|
+
),
|
|
5765
|
+
downloadToolbar
|
|
5766
|
+
), warnings.length > 0 ? warnings : null), /* @__PURE__ */ React13__default.createElement(Box, { className: classes.colContent }, preview));
|
|
5808
5767
|
}
|
|
5809
5768
|
function MatrixTable(props) {
|
|
5810
5769
|
const { data, formatter: formatter2, headers, ...mantineReactTableProps } = props;
|
|
5811
|
-
const columns = useMemo(
|
|
5812
|
-
|
|
5813
|
-
|
|
5814
|
-
|
|
5815
|
-
|
|
5816
|
-
|
|
5817
|
-
|
|
5818
|
-
|
|
5819
|
-
const tableProps = useMemo(() => ({
|
|
5820
|
-
enableBottomToolbar: false,
|
|
5821
|
-
enableColumnFilterModes: true,
|
|
5822
|
-
enableColumnResizing: true,
|
|
5823
|
-
enableColumnVirtualization: true,
|
|
5824
|
-
enableTopToolbar: false,
|
|
5825
|
-
enablePagination: false,
|
|
5826
|
-
enableRowNumbers: true,
|
|
5827
|
-
enableRowVirtualization: true,
|
|
5828
|
-
initialState: {
|
|
5829
|
-
density: "xs"
|
|
5830
|
-
},
|
|
5831
|
-
mantineTableProps: {
|
|
5832
|
-
sx: {
|
|
5833
|
-
"& td": {
|
|
5834
|
-
padding: "7px 10px!important"
|
|
5770
|
+
const columns = useMemo(
|
|
5771
|
+
() => headers.map(
|
|
5772
|
+
(header, colIndex) => ({
|
|
5773
|
+
accesorKey: header,
|
|
5774
|
+
Cell: ({ row }) => colIndex > 0 && typeof row.original[colIndex] === "number" ? formatter2(row.original[colIndex]) : row.original[colIndex],
|
|
5775
|
+
header,
|
|
5776
|
+
mantineTableBodyCellProps: {
|
|
5777
|
+
align: colIndex > 0 ? "right" : "left"
|
|
5835
5778
|
}
|
|
5779
|
+
})
|
|
5780
|
+
),
|
|
5781
|
+
[headers]
|
|
5782
|
+
);
|
|
5783
|
+
const tableProps = useMemo(
|
|
5784
|
+
() => ({
|
|
5785
|
+
enableBottomToolbar: false,
|
|
5786
|
+
enableColumnFilterModes: true,
|
|
5787
|
+
enableColumnResizing: true,
|
|
5788
|
+
enableColumnVirtualization: true,
|
|
5789
|
+
enableTopToolbar: false,
|
|
5790
|
+
enablePagination: false,
|
|
5791
|
+
enableRowNumbers: true,
|
|
5792
|
+
enableRowVirtualization: true,
|
|
5793
|
+
initialState: {
|
|
5794
|
+
density: "xs"
|
|
5836
5795
|
},
|
|
5837
|
-
|
|
5838
|
-
|
|
5839
|
-
|
|
5840
|
-
|
|
5841
|
-
|
|
5842
|
-
|
|
5843
|
-
|
|
5844
|
-
|
|
5845
|
-
|
|
5846
|
-
|
|
5796
|
+
mantineTableProps: {
|
|
5797
|
+
sx: {
|
|
5798
|
+
"& td": {
|
|
5799
|
+
padding: "7px 10px!important"
|
|
5800
|
+
}
|
|
5801
|
+
},
|
|
5802
|
+
withColumnBorders: true
|
|
5803
|
+
},
|
|
5804
|
+
mantinePaperProps: {
|
|
5805
|
+
id: "query-results-pivot-view-preview",
|
|
5806
|
+
withBorder: false,
|
|
5807
|
+
sx: (theme) => ({
|
|
5808
|
+
height: "100%",
|
|
5809
|
+
padding: `0 ${theme.spacing.sm}`,
|
|
5810
|
+
[theme.fn.largerThan("lg")]: {
|
|
5811
|
+
padding: 0
|
|
5812
|
+
}
|
|
5813
|
+
})
|
|
5814
|
+
},
|
|
5815
|
+
mantineTableContainerProps: {
|
|
5816
|
+
id: "query-results-pivot-view-table",
|
|
5817
|
+
sx: {
|
|
5818
|
+
height: "100%"
|
|
5819
|
+
}
|
|
5820
|
+
},
|
|
5821
|
+
rowVirtualizerProps: {
|
|
5822
|
+
measureElement() {
|
|
5823
|
+
return 37;
|
|
5847
5824
|
}
|
|
5848
|
-
})
|
|
5849
|
-
},
|
|
5850
|
-
mantineTableContainerProps: {
|
|
5851
|
-
id: "query-results-pivot-view-table",
|
|
5852
|
-
sx: {
|
|
5853
|
-
height: "100%"
|
|
5854
|
-
}
|
|
5855
|
-
},
|
|
5856
|
-
rowVirtualizerProps: {
|
|
5857
|
-
measureElement() {
|
|
5858
|
-
return 37;
|
|
5859
5825
|
}
|
|
5860
|
-
}
|
|
5861
|
-
|
|
5826
|
+
}),
|
|
5827
|
+
[]
|
|
5828
|
+
);
|
|
5862
5829
|
const table = useMantineReactTable({
|
|
5863
5830
|
...tableProps,
|
|
5864
5831
|
...mantineReactTableProps,
|
|
@@ -5876,9 +5843,7 @@ function stringifyMatrix(matrix, formatter2, format2) {
|
|
|
5876
5843
|
const safeFormatter = (value) => value === void 0 ? "" : safeQuoter(formatter2(value));
|
|
5877
5844
|
return [
|
|
5878
5845
|
matrix.headers.map(safeQuoter).join(joint),
|
|
5879
|
-
...matrix.data.map(
|
|
5880
|
-
(row) => [safeQuoter(row[0]), ...row.slice(1).map(safeFormatter)].join(joint)
|
|
5881
|
-
)
|
|
5846
|
+
...matrix.data.map((row) => [safeQuoter(row[0]), ...row.slice(1).map(safeFormatter)].join(joint))
|
|
5882
5847
|
].join("\n");
|
|
5883
5848
|
}
|
|
5884
5849
|
|