@datawheel/data-explorer 1.0.9 → 1.0.10

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 CHANGED
@@ -1333,4 +1333,6 @@ declare function VizbuilderView(props: {
1333
1333
 
1334
1334
  declare function TourStep(props: TourStepsPropsType): React.JSX.Element;
1335
1335
 
1336
- export { DebugView, ExplorerComponent as Explorer, type ExplorerState, type ExplorerStepType, PivotView, SettingsConsumer, TableView, ToolbarButton, TourStep, TranslationConsumer, type Translation as TranslationDict, type ViewProps, VizbuilderView, reducer as explorerReducer, thunkExtraArg as explorerThunkExtraArg, defaultTranslation as translationDict, useSettings, useTranslation };
1336
+ declare function RawResponseView(props: any): React.JSX.Element;
1337
+
1338
+ export { DebugView, ExplorerComponent as Explorer, type ExplorerState, type ExplorerStepType, PivotView, RawResponseView, SettingsConsumer, TableView, ToolbarButton, TourStep, TranslationConsumer, type Translation as TranslationDict, type ViewProps, VizbuilderView, reducer as explorerReducer, thunkExtraArg as explorerThunkExtraArg, defaultTranslation as translationDict, useSettings, useTranslation };
package/dist/main.mjs CHANGED
@@ -1,6 +1,6 @@
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';
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, TextInput, CopyButton, 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, 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';
3
+ import { IconWorld, IconExternalLink, IconClipboard, IconSettings, IconMathGreater, IconMathLower, IconArrowsLeftRight, IconAlertCircle, IconAlertTriangle, IconWorldWww, IconClipboardCheck, 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';
@@ -1886,7 +1886,7 @@ var selectOlapMeasureItems = createSelector(
1886
1886
  selectOlapCube,
1887
1887
  (cube) => cube ? cube.measures : []
1888
1888
  );
1889
- var selectOlapMeasureMap = createSelector(
1889
+ createSelector(
1890
1890
  selectOlapMeasureItems,
1891
1891
  (measures) => Object.fromEntries(measures.map((item) => [item.name, item]))
1892
1892
  );
@@ -3179,7 +3179,7 @@ function useTable({
3179
3179
  return /* @__PURE__ */ React13__default.createElement("span", { style: { display: "block", textAlign: "right" } }, formatter2(cell.getValue(), locale));
3180
3180
  } : ({ cell, renderedCellValue, row }) => {
3181
3181
  const cellId = row.original[`${cell.column.id} ID`];
3182
- const idFormatter = idFormatters[`${cell.column.id} ID`];
3182
+ const idFormatter = idFormatters[`${column.localeLabel} ID`];
3183
3183
  return /* @__PURE__ */ React13__default.createElement(Flex, { justify: "space-between", sx: { width: "100%", maxWidth: 400 }, gap: "sm" }, /* @__PURE__ */ React13__default.createElement(
3184
3184
  Text,
3185
3185
  {
@@ -3295,6 +3295,7 @@ function useTable({
3295
3295
  table,
3296
3296
  isError,
3297
3297
  isLoading,
3298
+ isFetching,
3298
3299
  data: tableData,
3299
3300
  columns,
3300
3301
  pagination,
@@ -3458,7 +3459,7 @@ function MultiFilter({ header }) {
3458
3459
  const { translate: t } = useTranslation();
3459
3460
  const cutItems = useSelector$1(selectCutItems);
3460
3461
  const drilldownItems = useSelector$1(selectDrilldownItems);
3461
- const label = header.column.id;
3462
+ header.column.id;
3462
3463
  const localeLabel = header.column.columnDef.header;
3463
3464
  const drilldown = drilldownItems.find((d) => d.level === header.column.id);
3464
3465
  const actions2 = useActions();
@@ -3504,7 +3505,7 @@ function MultiFilter({ header }) {
3504
3505
  placeholder: t("params.filter_by", { name: localeLabel }),
3505
3506
  value: cut.members || [],
3506
3507
  data: drilldown.members.map((m) => {
3507
- const idFormatter = idFormatters[`${label} ID`];
3508
+ const idFormatter = idFormatters[`${localeLabel} ID`];
3508
3509
  const formattedKey = idFormatter ? idFormatter(m.key) : m.key;
3509
3510
  return {
3510
3511
  value: `${m.key}`,
@@ -4315,7 +4316,7 @@ function SuccessResult(props) {
4315
4316
  actions2.switchPanel(newTab);
4316
4317
  updateUrl({ ...queryItem, panel: newTab });
4317
4318
  };
4318
- const { table, isError, isLoading, data, columns, result, pagination, setPagination } = useTable({
4319
+ const { table, isError, isLoading, data, columns, result, pagination, isFetching, setPagination } = useTable({
4319
4320
  cube
4320
4321
  });
4321
4322
  if ((data == null ? void 0 : data.length) === 0 && !isLoading && !isError) {
@@ -4381,7 +4382,8 @@ function SuccessResult(props) {
4381
4382
  isLoading,
4382
4383
  columns,
4383
4384
  pagination,
4384
- setPagination
4385
+ setPagination,
4386
+ isFetching
4385
4387
  }
4386
4388
  ))))
4387
4389
  )
@@ -5624,11 +5626,15 @@ var useStyles5 = createStyles((theme) => ({
5624
5626
  }
5625
5627
  }));
5626
5628
  function PivotView(props) {
5629
+ var _a;
5627
5630
  const { cube, params, result, isLoading, ...mantineReactTableProps } = props;
5628
- if (!result) return null;
5631
+ console.log("PivotView", props);
5629
5632
  const locale = params.locale;
5630
5633
  const { translate: t } = useTranslation();
5631
- const measureMap = useSelector$1(selectOlapMeasureMap);
5634
+ const { data: schema } = useServerSchema();
5635
+ const measures = (_a = schema == null ? void 0 : schema.cubeMap[cube.name]) == null ? void 0 : _a.measures;
5636
+ if (!result || !measures) return null;
5637
+ const measureMap = Object.fromEntries(measures.map((item) => [item.name, item]));
5632
5638
  const { classes, cx } = useStyles5();
5633
5639
  const measureOptions = useMemo(
5634
5640
  () => filterMap(Object.values(params.measures), (item) => {
@@ -7732,10 +7738,80 @@ function VizbuilderView(props) {
7732
7738
  }
7733
7739
  );
7734
7740
  }
7741
+
7742
+ // src/components/RawResponseView.tsx
7743
+ init_esm_shims();
7744
+ function RawResponseView(props) {
7745
+ const { result, isLoading, isFetching } = props;
7746
+ console.log(result);
7747
+ const theme = useMantineTheme();
7748
+ const token = "tokenValue";
7749
+ const tokenizedUrl = (result == null ? void 0 : result.url) ? `${result.url}${`&token=${token}` }` : "";
7750
+ const curlCommand = `curl "${tokenizedUrl}"`;
7751
+ return /* @__PURE__ */ React13__default.createElement(Container, { fluid: true, py: "xl" }, /* @__PURE__ */ React13__default.createElement(Stack, null, /* @__PURE__ */ React13__default.createElement(Group, { align: "flex-end", noWrap: true, w: "100%" }, /* @__PURE__ */ React13__default.createElement(
7752
+ TextInput,
7753
+ {
7754
+ icon: /* @__PURE__ */ React13__default.createElement(IconWorldWww, { size: 20 }),
7755
+ label: "API URL",
7756
+ readOnly: true,
7757
+ value: tokenizedUrl,
7758
+ w: "100%",
7759
+ mb: 0,
7760
+ disabled: isLoading || isFetching
7761
+ }
7762
+ ), /* @__PURE__ */ React13__default.createElement(Button.Group, null, /* @__PURE__ */ React13__default.createElement(
7763
+ Button,
7764
+ {
7765
+ component: "a",
7766
+ href: tokenizedUrl,
7767
+ target: "_blank",
7768
+ leftIcon: /* @__PURE__ */ React13__default.createElement(IconExternalLink, null),
7769
+ sx: {
7770
+ borderBottomRightRadius: 0,
7771
+ borderTopRightRadius: 0
7772
+ }
7773
+ },
7774
+ "Open"
7775
+ ), /* @__PURE__ */ React13__default.createElement(CopyButton, { value: tokenizedUrl }, ({ copied, copy }) => /* @__PURE__ */ React13__default.createElement(
7776
+ Button,
7777
+ {
7778
+ color: copied ? theme.colors.teal[5] : theme.colors.green[7],
7779
+ leftIcon: copied ? /* @__PURE__ */ React13__default.createElement(IconClipboardCheck, null) : /* @__PURE__ */ React13__default.createElement(IconClipboard, null),
7780
+ onClick: copy,
7781
+ sx: (theme2) => ({
7782
+ borderBottomLeftRadius: 0,
7783
+ borderTopLeftRadius: 0,
7784
+ "&:hover": {
7785
+ background: theme2.colors.green[7]
7786
+ }
7787
+ })
7788
+ },
7789
+ copied ? "Copied" : "Copy"
7790
+ )))), /* @__PURE__ */ React13__default.createElement(Group, { align: "flex-end", noWrap: true, w: "100%" }, /* @__PURE__ */ React13__default.createElement(
7791
+ TextInput,
7792
+ {
7793
+ icon: /* @__PURE__ */ React13__default.createElement(IconWorldWww, { size: 20 }),
7794
+ label: "Curl Command",
7795
+ readOnly: true,
7796
+ value: curlCommand,
7797
+ w: "100%",
7798
+ mb: 0,
7799
+ disabled: isLoading || isFetching
7800
+ }
7801
+ ), /* @__PURE__ */ React13__default.createElement(CopyButton, { value: curlCommand }, ({ copied, copy }) => /* @__PURE__ */ React13__default.createElement(
7802
+ Button,
7803
+ {
7804
+ color: copied ? theme.colors.teal[5] : theme.colors.green[7],
7805
+ leftIcon: copied ? /* @__PURE__ */ React13__default.createElement(IconClipboardCheck, null) : /* @__PURE__ */ React13__default.createElement(IconClipboard, null),
7806
+ onClick: copy
7807
+ },
7808
+ copied ? "Copied" : "Copy"
7809
+ )))));
7810
+ }
7735
7811
  /*! Bundled license information:
7736
7812
 
7737
7813
  file-saver/FileSaver.js:
7738
7814
  (*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js *)
7739
7815
  */
7740
7816
 
7741
- export { DebugView, ExplorerComponent as Explorer, PivotView, SettingsConsumer, TableView, ToolbarButton, TourStep, TranslationConsumer, VizbuilderView, reducer as explorerReducer, thunkExtraArg as explorerThunkExtraArg, defaultTranslation as translationDict, useSettings, useTranslation };
7817
+ export { DebugView, ExplorerComponent as Explorer, PivotView, RawResponseView, SettingsConsumer, TableView, ToolbarButton, TourStep, TranslationConsumer, VizbuilderView, reducer as explorerReducer, thunkExtraArg as explorerThunkExtraArg, defaultTranslation as translationDict, useSettings, useTranslation };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datawheel/data-explorer",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "main": "./dist/main.mjs",
5
5
  "types": "./dist/main.d.mts",
6
6
  "files": [