@datawheel/data-explorer 1.0.4 → 1.0.5
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 +154 -190
- 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,
|
|
@@ -4236,7 +4212,8 @@ function ExplorerResults(props) {
|
|
|
4236
4212
|
className: cx(classes.container, props.className),
|
|
4237
4213
|
cube,
|
|
4238
4214
|
panels: props.panels,
|
|
4239
|
-
params
|
|
4215
|
+
params,
|
|
4216
|
+
panelKey: null
|
|
4240
4217
|
},
|
|
4241
4218
|
props.splash
|
|
4242
4219
|
);
|
|
@@ -4256,15 +4233,13 @@ function FailureResult(props) {
|
|
|
4256
4233
|
}
|
|
4257
4234
|
function SuccessResult(props) {
|
|
4258
4235
|
const updateUrl = useUpdateUrl();
|
|
4259
|
-
const { cube, panels, params
|
|
4236
|
+
const { cube, panels, params } = props;
|
|
4260
4237
|
const { translate: t } = useTranslation();
|
|
4261
4238
|
const { previewLimit, actions: actions2 } = useSettings();
|
|
4262
4239
|
const queryItem = useSelector$1(selectCurrentQueryItem);
|
|
4263
4240
|
const isPreviewMode = useSelector$1(selectIsPreviewMode);
|
|
4264
|
-
const { table, isError, isLoading, data, columns, pagination, setPagination } = useTable({
|
|
4265
|
-
cube
|
|
4266
|
-
});
|
|
4267
4241
|
const fullscreen = useFullscreen();
|
|
4242
|
+
const { classes, cx } = useStyles2();
|
|
4268
4243
|
const [CurrentComponent, panelKey, panelMeta] = useMemo(() => {
|
|
4269
4244
|
const currentPanel = queryItem.panel || `${panels[0].key}-`;
|
|
4270
4245
|
const [panelKey2, ...panelMeta2] = currentPanel.split("-");
|
|
@@ -4275,6 +4250,20 @@ function SuccessResult(props) {
|
|
|
4275
4250
|
actions2.switchPanel(newTab);
|
|
4276
4251
|
updateUrl({ ...queryItem, panel: newTab });
|
|
4277
4252
|
};
|
|
4253
|
+
const { table, isError, isLoading, data, columns, result, pagination, setPagination } = useTable({
|
|
4254
|
+
cube
|
|
4255
|
+
});
|
|
4256
|
+
if ((data == null ? void 0 : data.length) === 0 && !isLoading && !isError) {
|
|
4257
|
+
return /* @__PURE__ */ React13__default.createElement(
|
|
4258
|
+
FailureResult,
|
|
4259
|
+
{
|
|
4260
|
+
className: cx(classes.container, props.className),
|
|
4261
|
+
icon: /* @__PURE__ */ React13__default.createElement(IconBox, { color: "orange", size: "5rem" }),
|
|
4262
|
+
title: t("results.error_emptyresult_title"),
|
|
4263
|
+
description: t("results.error_emptyresult_detail")
|
|
4264
|
+
}
|
|
4265
|
+
);
|
|
4266
|
+
}
|
|
4278
4267
|
return /* @__PURE__ */ React13__default.createElement(
|
|
4279
4268
|
Flex,
|
|
4280
4269
|
{
|
|
@@ -4305,7 +4294,7 @@ function SuccessResult(props) {
|
|
|
4305
4294
|
h: "fit-content"
|
|
4306
4295
|
},
|
|
4307
4296
|
/* @__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))
|
|
4297
|
+
(!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
4298
|
),
|
|
4310
4299
|
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
4300
|
/* @__PURE__ */ React13__default.createElement(
|
|
@@ -4320,11 +4309,11 @@ function SuccessResult(props) {
|
|
|
4320
4309
|
panelKey: `${panelKey}-${panelMeta}`,
|
|
4321
4310
|
cube,
|
|
4322
4311
|
params,
|
|
4312
|
+
data,
|
|
4323
4313
|
result,
|
|
4324
4314
|
table,
|
|
4325
4315
|
isError,
|
|
4326
4316
|
isLoading,
|
|
4327
|
-
data,
|
|
4328
4317
|
columns,
|
|
4329
4318
|
pagination,
|
|
4330
4319
|
setPagination
|
|
@@ -4815,7 +4804,7 @@ function QueryProvider({ children, defaultCube }) {
|
|
|
4815
4804
|
const cubeDefault = defaultCube && hasProperty(cubeMap, defaultCube) ? defaultCube : Object.keys(cubeMap)[0];
|
|
4816
4805
|
setDefaultValues(cubeMap[cubeDefault]);
|
|
4817
4806
|
}
|
|
4818
|
-
}, [location2.search, runFetchMembers, schema, serverURL]);
|
|
4807
|
+
}, [location2.search, runFetchMembers, schema, serverURL, defaultLocale]);
|
|
4819
4808
|
const onChangeCube = (table, subtopic) => {
|
|
4820
4809
|
const locale = defaultLocale || queryItem.params.locale;
|
|
4821
4810
|
const cubeMap = (schema == null ? void 0 : schema.cubeMap) || {};
|
|
@@ -5562,7 +5551,8 @@ var useStyles5 = createStyles((theme) => ({
|
|
|
5562
5551
|
}
|
|
5563
5552
|
}));
|
|
5564
5553
|
function PivotView(props) {
|
|
5565
|
-
const { cube, params, result, ...mantineReactTableProps } = props;
|
|
5554
|
+
const { cube, params, result, isLoading, ...mantineReactTableProps } = props;
|
|
5555
|
+
if (!result) return null;
|
|
5566
5556
|
const locale = params.locale;
|
|
5567
5557
|
const { translate: t } = useTranslation();
|
|
5568
5558
|
const measureMap = useSelector$1(selectOlapMeasureMap);
|
|
@@ -5609,51 +5599,27 @@ function PivotView(props) {
|
|
|
5609
5599
|
);
|
|
5610
5600
|
const [valProp, setValueProp] = useState(() => measureOptions[0]);
|
|
5611
5601
|
const fileName = [params.cube, colProp.label, rowProp.label, valProp.value].join("_");
|
|
5612
|
-
const [pivottedData, pivottingError] = usePivottedData(
|
|
5613
|
-
|
|
5614
|
-
|
|
5615
|
-
|
|
5616
|
-
|
|
5617
|
-
|
|
5618
|
-
} = useFormatParams(
|
|
5602
|
+
const [pivottedData, pivottingError] = usePivottedData(
|
|
5603
|
+
result.data,
|
|
5604
|
+
colProp.value,
|
|
5605
|
+
rowProp.value,
|
|
5606
|
+
valProp.value
|
|
5607
|
+
);
|
|
5608
|
+
const { formatter: formatter2, formatterKey, formatterKeyOptions, setFormat } = useFormatParams(
|
|
5609
|
+
props.cube.measures,
|
|
5610
|
+
valProp.value
|
|
5611
|
+
);
|
|
5619
5612
|
const warnings = useMemo(() => {
|
|
5620
5613
|
const warnings2 = [];
|
|
5621
5614
|
if (rowProp.type === "prop" || colProp.type === "prop") {
|
|
5622
5615
|
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
|
-
)
|
|
5616
|
+
/* @__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
5617
|
);
|
|
5634
5618
|
}
|
|
5635
5619
|
const drilldownCount = Object.values(params.drilldowns).filter(isActiveItem).length;
|
|
5636
5620
|
if (drilldownCount > 2) {
|
|
5637
5621
|
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
|
-
)
|
|
5622
|
+
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
5623
|
);
|
|
5658
5624
|
}
|
|
5659
5625
|
return warnings2;
|
|
@@ -5738,127 +5704,127 @@ function PivotView(props) {
|
|
|
5738
5704
|
}
|
|
5739
5705
|
);
|
|
5740
5706
|
}
|
|
5741
|
-
return /* @__PURE__ */ React13__default.createElement(
|
|
5742
|
-
|
|
5707
|
+
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(
|
|
5708
|
+
SimpleGrid,
|
|
5743
5709
|
{
|
|
5744
|
-
id: "query-results-pivot-view",
|
|
5745
|
-
|
|
5710
|
+
id: "query-results-pivot-view-params",
|
|
5711
|
+
px: "md",
|
|
5712
|
+
py: "sm",
|
|
5713
|
+
cols: 1,
|
|
5714
|
+
breakpoints: [
|
|
5715
|
+
{ minWidth: "xs", cols: 2 },
|
|
5716
|
+
{ minWidth: "sm", cols: 3 },
|
|
5717
|
+
{ minWidth: "md", cols: 1 }
|
|
5718
|
+
]
|
|
5746
5719
|
},
|
|
5747
|
-
/* @__PURE__ */ React13__default.createElement(
|
|
5748
|
-
|
|
5720
|
+
/* @__PURE__ */ React13__default.createElement(
|
|
5721
|
+
SelectOption,
|
|
5749
5722
|
{
|
|
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
|
-
);
|
|
5723
|
+
getLabel: "label",
|
|
5724
|
+
getValue: "value",
|
|
5725
|
+
items: drilldownOptions,
|
|
5726
|
+
onItemSelect: setColumnProp,
|
|
5727
|
+
selectedItem: colProp.value,
|
|
5728
|
+
label: colProp.type === "prop" ? t("pivot_view.label_ddcolumnprop") : t("pivot_view.label_ddcolumn")
|
|
5729
|
+
}
|
|
5730
|
+
),
|
|
5731
|
+
/* @__PURE__ */ React13__default.createElement(
|
|
5732
|
+
SelectOption,
|
|
5733
|
+
{
|
|
5734
|
+
getLabel: "label",
|
|
5735
|
+
getValue: "value",
|
|
5736
|
+
items: drilldownOptions,
|
|
5737
|
+
onItemSelect: setRowProp,
|
|
5738
|
+
selectedItem: rowProp.value,
|
|
5739
|
+
label: rowProp.type === "prop" ? t("pivot_view.label_ddrowprop") : t("pivot_view.label_ddrow")
|
|
5740
|
+
}
|
|
5741
|
+
),
|
|
5742
|
+
/* @__PURE__ */ React13__default.createElement(
|
|
5743
|
+
SelectOption,
|
|
5744
|
+
{
|
|
5745
|
+
getLabel: "label",
|
|
5746
|
+
getValue: "value",
|
|
5747
|
+
items: measureOptions,
|
|
5748
|
+
label: t("pivot_view.label_valmeasure"),
|
|
5749
|
+
onItemSelect: setValueProp,
|
|
5750
|
+
selectedItem: valProp.value
|
|
5751
|
+
}
|
|
5752
|
+
),
|
|
5753
|
+
/* @__PURE__ */ React13__default.createElement(
|
|
5754
|
+
SelectObject,
|
|
5755
|
+
{
|
|
5756
|
+
getLabel: "label",
|
|
5757
|
+
getValue: "value",
|
|
5758
|
+
items: formatterKeyOptions,
|
|
5759
|
+
label: t("pivot_view.label_formatter"),
|
|
5760
|
+
onItemSelect: (item) => setFormat(valProp.value, item.value),
|
|
5761
|
+
selectedItem: formatterKey
|
|
5762
|
+
}
|
|
5763
|
+
),
|
|
5764
|
+
downloadToolbar
|
|
5765
|
+
), warnings.length > 0 ? warnings : null), /* @__PURE__ */ React13__default.createElement(Box, { className: classes.colContent }, preview));
|
|
5808
5766
|
}
|
|
5809
5767
|
function MatrixTable(props) {
|
|
5810
5768
|
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"
|
|
5769
|
+
const columns = useMemo(
|
|
5770
|
+
() => headers.map(
|
|
5771
|
+
(header, colIndex) => ({
|
|
5772
|
+
accesorKey: header,
|
|
5773
|
+
Cell: ({ row }) => colIndex > 0 && typeof row.original[colIndex] === "number" ? formatter2(row.original[colIndex]) : row.original[colIndex],
|
|
5774
|
+
header,
|
|
5775
|
+
mantineTableBodyCellProps: {
|
|
5776
|
+
align: colIndex > 0 ? "right" : "left"
|
|
5835
5777
|
}
|
|
5778
|
+
})
|
|
5779
|
+
),
|
|
5780
|
+
[headers]
|
|
5781
|
+
);
|
|
5782
|
+
const tableProps = useMemo(
|
|
5783
|
+
() => ({
|
|
5784
|
+
enableBottomToolbar: false,
|
|
5785
|
+
enableColumnFilterModes: true,
|
|
5786
|
+
enableColumnResizing: true,
|
|
5787
|
+
enableColumnVirtualization: true,
|
|
5788
|
+
enableTopToolbar: false,
|
|
5789
|
+
enablePagination: false,
|
|
5790
|
+
enableRowNumbers: true,
|
|
5791
|
+
enableRowVirtualization: true,
|
|
5792
|
+
initialState: {
|
|
5793
|
+
density: "xs"
|
|
5836
5794
|
},
|
|
5837
|
-
|
|
5838
|
-
|
|
5839
|
-
|
|
5840
|
-
|
|
5841
|
-
|
|
5842
|
-
|
|
5843
|
-
|
|
5844
|
-
|
|
5845
|
-
|
|
5846
|
-
|
|
5795
|
+
mantineTableProps: {
|
|
5796
|
+
sx: {
|
|
5797
|
+
"& td": {
|
|
5798
|
+
padding: "7px 10px!important"
|
|
5799
|
+
}
|
|
5800
|
+
},
|
|
5801
|
+
withColumnBorders: true
|
|
5802
|
+
},
|
|
5803
|
+
mantinePaperProps: {
|
|
5804
|
+
id: "query-results-pivot-view-preview",
|
|
5805
|
+
withBorder: false,
|
|
5806
|
+
sx: (theme) => ({
|
|
5807
|
+
height: "100%",
|
|
5808
|
+
padding: `0 ${theme.spacing.sm}`,
|
|
5809
|
+
[theme.fn.largerThan("lg")]: {
|
|
5810
|
+
padding: 0
|
|
5811
|
+
}
|
|
5812
|
+
})
|
|
5813
|
+
},
|
|
5814
|
+
mantineTableContainerProps: {
|
|
5815
|
+
id: "query-results-pivot-view-table",
|
|
5816
|
+
sx: {
|
|
5817
|
+
height: "100%"
|
|
5818
|
+
}
|
|
5819
|
+
},
|
|
5820
|
+
rowVirtualizerProps: {
|
|
5821
|
+
measureElement() {
|
|
5822
|
+
return 37;
|
|
5847
5823
|
}
|
|
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
5824
|
}
|
|
5860
|
-
}
|
|
5861
|
-
|
|
5825
|
+
}),
|
|
5826
|
+
[]
|
|
5827
|
+
);
|
|
5862
5828
|
const table = useMantineReactTable({
|
|
5863
5829
|
...tableProps,
|
|
5864
5830
|
...mantineReactTableProps,
|
|
@@ -5876,9 +5842,7 @@ function stringifyMatrix(matrix, formatter2, format2) {
|
|
|
5876
5842
|
const safeFormatter = (value) => value === void 0 ? "" : safeQuoter(formatter2(value));
|
|
5877
5843
|
return [
|
|
5878
5844
|
matrix.headers.map(safeQuoter).join(joint),
|
|
5879
|
-
...matrix.data.map(
|
|
5880
|
-
(row) => [safeQuoter(row[0]), ...row.slice(1).map(safeFormatter)].join(joint)
|
|
5881
|
-
)
|
|
5845
|
+
...matrix.data.map((row) => [safeQuoter(row[0]), ...row.slice(1).map(safeFormatter)].join(joint))
|
|
5882
5846
|
].join("\n");
|
|
5883
5847
|
}
|
|
5884
5848
|
|