@datawheel/data-explorer 1.0.9 → 1.0.11

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}`,
@@ -4208,6 +4209,150 @@ function Toolbar({
4208
4209
  return smallerThanLg ? /* @__PURE__ */ React13__default.createElement(Menu, null, /* @__PURE__ */ React13__default.createElement(Menu.Target, null, /* @__PURE__ */ React13__default.createElement(ActionIcon, null, /* @__PURE__ */ React13__default.createElement(IconSettings, null))), /* @__PURE__ */ React13__default.createElement(Menu.Dropdown, null, settings)) : settings;
4209
4210
  }
4210
4211
 
4212
+ // src/context/query.tsx
4213
+ init_esm_shims();
4214
+ var QueryContext = createContext(void 0);
4215
+ function QueryProvider({ children, defaultCube }) {
4216
+ const { tesseract } = useLogicLayer();
4217
+ const location2 = useLocation();
4218
+ const { updateCurrentQuery } = useActions();
4219
+ const { paginationConfig, measuresActive, serverURL, defaultLocale } = useSettings();
4220
+ const { data: schema, isLoading: schemaLoading, isError: schemaError } = useServerSchema();
4221
+ const updateUrl = useUpdateUrl();
4222
+ const queryItem = useSelector$1(selectCurrentQueryItem);
4223
+ const prevLocaleRef = useRef();
4224
+ function fetchMembers(level, localeStr, cubeName) {
4225
+ return tesseract.fetchMembers({ request: { cube: cubeName || "", level, locale: localeStr } });
4226
+ }
4227
+ const {
4228
+ run: runFetchMembers,
4229
+ data: membersData,
4230
+ isSuccess: isMembersSuccess,
4231
+ isLoading: membersLoading
4232
+ } = useAsync();
4233
+ const [transintionLocaleLoading, setTransintionLocaleLoading] = React13__default.useState(false);
4234
+ useEffect(() => {
4235
+ if (schemaLoading) {
4236
+ setTransintionLocaleLoading(true);
4237
+ }
4238
+ const searchParams = new URLSearchParams(location2.search);
4239
+ const cube = searchParams.get("cube");
4240
+ const cubeMap = (schema == null ? void 0 : schema.cubeMap) || void 0;
4241
+ if (cube && cubeMap && serverURL && cubeMap[cube] && (schema == null ? void 0 : schema.online)) {
4242
+ let newQuery = parsePermalink(cubeMap[cube], searchParams);
4243
+ newQuery = isValidQuery(newQuery == null ? void 0 : newQuery.params) ? newQuery : buildQuery({ params: { cube } });
4244
+ newQuery.params.locale = defaultLocale || newQuery.params.locale;
4245
+ if (newQuery) {
4246
+ const promises = Object.values(newQuery.params.drilldowns).map((dd) => {
4247
+ const currentDrilldown = queryItem.params.drilldowns[dd.key];
4248
+ const localeChanged = prevLocaleRef.current !== (newQuery == null ? void 0 : newQuery.params.locale);
4249
+ if (currentDrilldown && currentDrilldown.members && currentDrilldown.members.length > 0 && !localeChanged) {
4250
+ return Promise.resolve({
4251
+ drilldown: currentDrilldown,
4252
+ cut: buildCut({ ...currentDrilldown, active: false })
4253
+ });
4254
+ } else {
4255
+ return fetchMembers(dd.level, newQuery == null ? void 0 : newQuery.params.locale, cube).then((levelMeta) => {
4256
+ const cut = buildCut({ ...dd, active: false });
4257
+ return {
4258
+ drilldown: {
4259
+ ...dd,
4260
+ members: levelMeta.members
4261
+ },
4262
+ cut
4263
+ };
4264
+ });
4265
+ }
4266
+ });
4267
+ runFetchMembers(Promise.all(promises)).then((data) => {
4268
+ setTransintionLocaleLoading(false);
4269
+ prevLocaleRef.current = newQuery == null ? void 0 : newQuery.params.locale;
4270
+ const drilldowns = data.map((item) => item.drilldown);
4271
+ const cuts = data.map((item) => item.cut);
4272
+ newQuery.params.drilldowns = keyBy(drilldowns, "key");
4273
+ const existingCuts = keyBy(
4274
+ Object.values(newQuery.params.cuts || {}).map((c) => ({ ...c, key: c.level })),
4275
+ "key"
4276
+ );
4277
+ const newCuts = keyBy(cuts, "key");
4278
+ newQuery.params.cuts = { ...newCuts, ...existingCuts };
4279
+ const newQueryItem = isValidQuery(newQuery.params) ? newQuery : void 0;
4280
+ if (newQueryItem) {
4281
+ updateCurrentQuery({ ...newQuery, link: serializePermalink(newQuery) });
4282
+ }
4283
+ });
4284
+ }
4285
+ }
4286
+ if (!cube && cubeMap && serverURL && (schema == null ? void 0 : schema.online)) {
4287
+ const cubeDefault = defaultCube && hasProperty(cubeMap, defaultCube) ? defaultCube : Object.keys(cubeMap)[0];
4288
+ setDefaultValues(cubeMap[cubeDefault]);
4289
+ }
4290
+ }, [location2.search, runFetchMembers, schema, schemaLoading, serverURL, defaultLocale]);
4291
+ const onChangeCube = (table, subtopic) => {
4292
+ const locale = defaultLocale || queryItem.params.locale;
4293
+ const cubeMap = (schema == null ? void 0 : schema.cubeMap) || {};
4294
+ const cubeArray = getValues(cubeMap);
4295
+ const cube = cubeArray.find(
4296
+ (cube2) => cube2.name === table && getAnnotation(cube2, "subtopic", locale) === subtopic
4297
+ );
4298
+ if (cube) {
4299
+ setDefaultValues(cube);
4300
+ }
4301
+ };
4302
+ function setDefaultValues(cube) {
4303
+ const drilldowns = pickDefaultDrilldowns(cube.dimensions).map(
4304
+ (level) => buildDrilldown({
4305
+ ...level,
4306
+ key: level.name,
4307
+ active: true,
4308
+ properties: level.properties.map(
4309
+ (prop) => buildProperty({ level: level.name, name: prop.name })
4310
+ )
4311
+ })
4312
+ );
4313
+ const measuresLimit = typeof measuresActive !== "undefined" ? measuresActive : cube.measures.length;
4314
+ const measures = cube.measures.slice(0, measuresLimit).map((measure) => {
4315
+ return buildMeasure({
4316
+ active: true,
4317
+ key: measure.name,
4318
+ name: measure.name,
4319
+ caption: measure.caption
4320
+ });
4321
+ });
4322
+ const panel = queryItem.panel;
4323
+ const locale = defaultLocale || queryItem.params.locale;
4324
+ const query = buildQuery({
4325
+ params: {
4326
+ cube: cube.name,
4327
+ measures: keyBy(measures, (item) => item.key),
4328
+ drilldowns: keyBy(drilldowns, (item) => item.key),
4329
+ locale
4330
+ },
4331
+ panel: panel != null ? panel : "table"
4332
+ });
4333
+ updateUrl(query);
4334
+ }
4335
+ return /* @__PURE__ */ React13__default.createElement(
4336
+ QueryContext.Provider,
4337
+ {
4338
+ value: {
4339
+ onChangeCube,
4340
+ schemaLoading,
4341
+ membersLoading,
4342
+ transintionLocaleLoading
4343
+ }
4344
+ },
4345
+ children
4346
+ );
4347
+ }
4348
+ function useQueryItem() {
4349
+ const context = useContext(QueryContext);
4350
+ if (context === void 0) {
4351
+ throw new Error("useQuery must be used within a QueryProvider");
4352
+ }
4353
+ return context;
4354
+ }
4355
+
4211
4356
  // src/components/ExplorerResults.tsx
4212
4357
  var useStyles2 = createStyles(() => ({
4213
4358
  container: {
@@ -4223,6 +4368,7 @@ function ExplorerResults(props) {
4223
4368
  isError: schemaError,
4224
4369
  error: schemaErrorDetail
4225
4370
  } = useServerSchema();
4371
+ const { transintionLocaleLoading } = useQueryItem();
4226
4372
  const { params } = useSelector$1(selectCurrentQueryItem);
4227
4373
  const cubeMap = (schema == null ? void 0 : schema.cubeMap) || {};
4228
4374
  const cube = cubeMap[params.cube];
@@ -4250,7 +4396,7 @@ function ExplorerResults(props) {
4250
4396
  }
4251
4397
  );
4252
4398
  }
4253
- if (isServerOnline == null || !cube) {
4399
+ if (isServerOnline == null || !cube || schemaLoading || transintionLocaleLoading) {
4254
4400
  return /* @__PURE__ */ React13__default.createElement(
4255
4401
  Paper,
4256
4402
  {
@@ -4315,7 +4461,7 @@ function SuccessResult(props) {
4315
4461
  actions2.switchPanel(newTab);
4316
4462
  updateUrl({ ...queryItem, panel: newTab });
4317
4463
  };
4318
- const { table, isError, isLoading, data, columns, result, pagination, setPagination } = useTable({
4464
+ const { table, isError, isLoading, data, columns, result, pagination, isFetching, setPagination } = useTable({
4319
4465
  cube
4320
4466
  });
4321
4467
  if ((data == null ? void 0 : data.length) === 0 && !isLoading && !isError) {
@@ -4381,7 +4527,8 @@ function SuccessResult(props) {
4381
4527
  isLoading,
4382
4528
  columns,
4383
4529
  pagination,
4384
- setPagination
4530
+ setPagination,
4531
+ isFetching
4385
4532
  }
4386
4533
  ))))
4387
4534
  )
@@ -4394,7 +4541,7 @@ init_esm_shims();
4394
4541
 
4395
4542
  // src/utils/create-context.ts
4396
4543
  init_esm_shims();
4397
- var createContext3 = (name4) => {
4544
+ var createContext4 = (name4) => {
4398
4545
  const Context = React13__default.createContext(void 0);
4399
4546
  const useContext5 = () => {
4400
4547
  const ctx = React13__default.useContext(Context);
@@ -4607,7 +4754,7 @@ function useCubeSearch(input, graph) {
4607
4754
  }
4608
4755
 
4609
4756
  // src/components/SideBar.tsx
4610
- var [useSideBar, Provider] = createContext3("SideBar");
4757
+ var [useSideBar, Provider] = createContext4("SideBar");
4611
4758
  function SideBarProvider(props) {
4612
4759
  const [input, setInput] = useDebouncedState("", 200);
4613
4760
  const [expanded, setExpanded] = useState(true);
@@ -4806,143 +4953,6 @@ init_esm_shims();
4806
4953
 
4807
4954
  // src/components/Results.tsx
4808
4955
  init_esm_shims();
4809
-
4810
- // src/context/query.tsx
4811
- init_esm_shims();
4812
- var QueryContext = createContext(void 0);
4813
- function QueryProvider({ children, defaultCube }) {
4814
- const { tesseract } = useLogicLayer();
4815
- const location2 = useLocation();
4816
- const { updateCurrentQuery } = useActions();
4817
- const { paginationConfig, measuresActive, serverURL, defaultLocale } = useSettings();
4818
- const { data: schema, isLoading: schemaLoading, isError: schemaError } = useServerSchema();
4819
- const updateUrl = useUpdateUrl();
4820
- const queryItem = useSelector$1(selectCurrentQueryItem);
4821
- function fetchMembers(level, localeStr, cubeName) {
4822
- return tesseract.fetchMembers({ request: { cube: cubeName || "", level, locale: localeStr } });
4823
- }
4824
- const {
4825
- run: runFetchMembers,
4826
- data: membersData,
4827
- isSuccess: isMembersSuccess,
4828
- isLoading: membersLoading
4829
- } = useAsync();
4830
- useEffect(() => {
4831
- const searchParams = new URLSearchParams(location2.search);
4832
- const cube = searchParams.get("cube");
4833
- const cubeMap = (schema == null ? void 0 : schema.cubeMap) || void 0;
4834
- if (cube && cubeMap && serverURL && cubeMap[cube] && (schema == null ? void 0 : schema.online)) {
4835
- let newQuery = parsePermalink(cubeMap[cube], searchParams);
4836
- newQuery = isValidQuery(newQuery == null ? void 0 : newQuery.params) ? newQuery : buildQuery({ params: { cube } });
4837
- newQuery.params.locale = defaultLocale || newQuery.params.locale;
4838
- if (newQuery) {
4839
- const promises = Object.values(newQuery.params.drilldowns).map((dd) => {
4840
- const currentDrilldown = queryItem.params.drilldowns[dd.key];
4841
- if (currentDrilldown && currentDrilldown.members && currentDrilldown.members.length > 0) {
4842
- return Promise.resolve({
4843
- drilldown: currentDrilldown,
4844
- cut: buildCut({ ...currentDrilldown, active: false })
4845
- });
4846
- } else {
4847
- return fetchMembers(dd.level, newQuery == null ? void 0 : newQuery.params.locale, cube).then((levelMeta) => {
4848
- const cut = buildCut({ ...dd, active: false });
4849
- return {
4850
- drilldown: {
4851
- ...dd,
4852
- members: levelMeta.members
4853
- },
4854
- cut
4855
- };
4856
- });
4857
- }
4858
- });
4859
- runFetchMembers(Promise.all(promises)).then((data) => {
4860
- const drilldowns = data.map((item) => item.drilldown);
4861
- const cuts = data.map((item) => item.cut);
4862
- newQuery.params.drilldowns = keyBy(drilldowns, "key");
4863
- const existingCuts = keyBy(
4864
- Object.values(newQuery.params.cuts || {}).map((c) => ({ ...c, key: c.level })),
4865
- "key"
4866
- );
4867
- const newCuts = keyBy(cuts, "key");
4868
- newQuery.params.cuts = { ...newCuts, ...existingCuts };
4869
- const newQueryItem = isValidQuery(newQuery.params) ? newQuery : void 0;
4870
- if (newQueryItem) {
4871
- updateCurrentQuery({ ...newQuery, link: serializePermalink(newQuery) });
4872
- }
4873
- });
4874
- }
4875
- }
4876
- if (!cube && cubeMap && serverURL && (schema == null ? void 0 : schema.online)) {
4877
- const cubeDefault = defaultCube && hasProperty(cubeMap, defaultCube) ? defaultCube : Object.keys(cubeMap)[0];
4878
- setDefaultValues(cubeMap[cubeDefault]);
4879
- }
4880
- }, [location2.search, runFetchMembers, schema, serverURL, defaultLocale]);
4881
- const onChangeCube = (table, subtopic) => {
4882
- const locale = defaultLocale || queryItem.params.locale;
4883
- const cubeMap = (schema == null ? void 0 : schema.cubeMap) || {};
4884
- const cubeArray = getValues(cubeMap);
4885
- const cube = cubeArray.find(
4886
- (cube2) => cube2.name === table && getAnnotation(cube2, "subtopic", locale) === subtopic
4887
- );
4888
- if (cube) {
4889
- setDefaultValues(cube);
4890
- }
4891
- };
4892
- function setDefaultValues(cube) {
4893
- const drilldowns = pickDefaultDrilldowns(cube.dimensions).map(
4894
- (level) => buildDrilldown({
4895
- ...level,
4896
- key: level.name,
4897
- active: true,
4898
- properties: level.properties.map(
4899
- (prop) => buildProperty({ level: level.name, name: prop.name })
4900
- )
4901
- })
4902
- );
4903
- const measuresLimit = typeof measuresActive !== "undefined" ? measuresActive : cube.measures.length;
4904
- const measures = cube.measures.slice(0, measuresLimit).map((measure) => {
4905
- return buildMeasure({
4906
- active: true,
4907
- key: measure.name,
4908
- name: measure.name,
4909
- caption: measure.caption
4910
- });
4911
- });
4912
- const panel = queryItem.panel;
4913
- const locale = defaultLocale || queryItem.params.locale;
4914
- const query = buildQuery({
4915
- params: {
4916
- cube: cube.name,
4917
- measures: keyBy(measures, (item) => item.key),
4918
- drilldowns: keyBy(drilldowns, (item) => item.key),
4919
- locale
4920
- },
4921
- panel: panel != null ? panel : "table"
4922
- });
4923
- updateUrl(query);
4924
- }
4925
- return /* @__PURE__ */ React13__default.createElement(
4926
- QueryContext.Provider,
4927
- {
4928
- value: {
4929
- onChangeCube,
4930
- schemaLoading,
4931
- membersLoading
4932
- }
4933
- },
4934
- children
4935
- );
4936
- }
4937
- function useQueryItem() {
4938
- const context = useContext(QueryContext);
4939
- if (context === void 0) {
4940
- throw new Error("useQuery must be used within a QueryProvider");
4941
- }
4942
- return context;
4943
- }
4944
-
4945
- // src/components/Results.tsx
4946
4956
  function Results(props) {
4947
4957
  const { graph, selectedItem, locale, getCube: getCube2, isSelected: isSelected2, isSelectionInProgress } = props;
4948
4958
  const { classes } = useStyles3();
@@ -5624,11 +5634,14 @@ var useStyles5 = createStyles((theme) => ({
5624
5634
  }
5625
5635
  }));
5626
5636
  function PivotView(props) {
5637
+ var _a;
5627
5638
  const { cube, params, result, isLoading, ...mantineReactTableProps } = props;
5628
- if (!result) return null;
5629
5639
  const locale = params.locale;
5630
5640
  const { translate: t } = useTranslation();
5631
- const measureMap = useSelector$1(selectOlapMeasureMap);
5641
+ const { data: schema } = useServerSchema();
5642
+ const measures = (_a = schema == null ? void 0 : schema.cubeMap[cube.name]) == null ? void 0 : _a.measures;
5643
+ if (!result || !measures) return null;
5644
+ const measureMap = Object.fromEntries(measures.map((item) => [item.name, item]));
5632
5645
  const { classes, cx } = useStyles5();
5633
5646
  const measureOptions = useMemo(
5634
5647
  () => filterMap(Object.values(params.measures), (item) => {
@@ -7732,10 +7745,80 @@ function VizbuilderView(props) {
7732
7745
  }
7733
7746
  );
7734
7747
  }
7748
+
7749
+ // src/components/RawResponseView.tsx
7750
+ init_esm_shims();
7751
+ function RawResponseView(props) {
7752
+ const { result, isLoading, isFetching } = props;
7753
+ console.log(result);
7754
+ const theme = useMantineTheme();
7755
+ const token = "tokenValue";
7756
+ const tokenizedUrl = (result == null ? void 0 : result.url) ? `${result.url}${`&token=${token}` }` : "";
7757
+ const curlCommand = `curl "${tokenizedUrl}"`;
7758
+ 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(
7759
+ TextInput,
7760
+ {
7761
+ icon: /* @__PURE__ */ React13__default.createElement(IconWorldWww, { size: 20 }),
7762
+ label: "API URL",
7763
+ readOnly: true,
7764
+ value: tokenizedUrl,
7765
+ w: "100%",
7766
+ mb: 0,
7767
+ disabled: isLoading || isFetching
7768
+ }
7769
+ ), /* @__PURE__ */ React13__default.createElement(Button.Group, null, /* @__PURE__ */ React13__default.createElement(
7770
+ Button,
7771
+ {
7772
+ component: "a",
7773
+ href: tokenizedUrl,
7774
+ target: "_blank",
7775
+ leftIcon: /* @__PURE__ */ React13__default.createElement(IconExternalLink, null),
7776
+ sx: {
7777
+ borderBottomRightRadius: 0,
7778
+ borderTopRightRadius: 0
7779
+ }
7780
+ },
7781
+ "Open"
7782
+ ), /* @__PURE__ */ React13__default.createElement(CopyButton, { value: tokenizedUrl }, ({ copied, copy }) => /* @__PURE__ */ React13__default.createElement(
7783
+ Button,
7784
+ {
7785
+ color: copied ? theme.colors.teal[5] : theme.colors.green[7],
7786
+ leftIcon: copied ? /* @__PURE__ */ React13__default.createElement(IconClipboardCheck, null) : /* @__PURE__ */ React13__default.createElement(IconClipboard, null),
7787
+ onClick: copy,
7788
+ sx: (theme2) => ({
7789
+ borderBottomLeftRadius: 0,
7790
+ borderTopLeftRadius: 0,
7791
+ "&:hover": {
7792
+ background: theme2.colors.green[7]
7793
+ }
7794
+ })
7795
+ },
7796
+ copied ? "Copied" : "Copy"
7797
+ )))), /* @__PURE__ */ React13__default.createElement(Group, { align: "flex-end", noWrap: true, w: "100%" }, /* @__PURE__ */ React13__default.createElement(
7798
+ TextInput,
7799
+ {
7800
+ icon: /* @__PURE__ */ React13__default.createElement(IconWorldWww, { size: 20 }),
7801
+ label: "Curl Command",
7802
+ readOnly: true,
7803
+ value: curlCommand,
7804
+ w: "100%",
7805
+ mb: 0,
7806
+ disabled: isLoading || isFetching
7807
+ }
7808
+ ), /* @__PURE__ */ React13__default.createElement(CopyButton, { value: curlCommand }, ({ copied, copy }) => /* @__PURE__ */ React13__default.createElement(
7809
+ Button,
7810
+ {
7811
+ color: copied ? theme.colors.teal[5] : theme.colors.green[7],
7812
+ leftIcon: copied ? /* @__PURE__ */ React13__default.createElement(IconClipboardCheck, null) : /* @__PURE__ */ React13__default.createElement(IconClipboard, null),
7813
+ onClick: copy
7814
+ },
7815
+ copied ? "Copied" : "Copy"
7816
+ )))));
7817
+ }
7735
7818
  /*! Bundled license information:
7736
7819
 
7737
7820
  file-saver/FileSaver.js:
7738
7821
  (*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js *)
7739
7822
  */
7740
7823
 
7741
- export { DebugView, ExplorerComponent as Explorer, PivotView, SettingsConsumer, TableView, ToolbarButton, TourStep, TranslationConsumer, VizbuilderView, reducer as explorerReducer, thunkExtraArg as explorerThunkExtraArg, defaultTranslation as translationDict, useSettings, useTranslation };
7824
+ 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.11",
4
4
  "main": "./dist/main.mjs",
5
5
  "types": "./dist/main.d.mts",
6
6
  "files": [