@datawheel/data-explorer 1.3.0 → 1.3.1

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
@@ -475,6 +475,7 @@ interface ViewProps<TData extends Record<string, any> = Record<string, string |
475
475
  table?: MRT_TableInstance<TData & Record<string, any>>;
476
476
  isError?: boolean;
477
477
  isLoading?: boolean;
478
+ isFetching?: boolean;
478
479
  data?: Record<string, string | number>[];
479
480
  columns?: MRT_ColumnDef<TData>[];
480
481
  pagination?: MRT_PaginationState;
package/dist/main.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { keyframes, createStyles, Select, Center, Text, rem, Input, Box, Stack, Group, Button, SimpleGrid, Flex, ScrollArea, LoadingOverlay, Table, MultiSelect, NumberInput, Menu, ActionIcon, UnstyledButton, Loader, Container, Title, useMantineTheme, TextInput, CopyButton, MantineProvider, Alert, Space, Modal, Tooltip, useComponentDefaultProps, Skeleton, Anchor, Paper, packSx, CloseButton, Tabs, ThemeIcon, Drawer, Switch, Divider, Accordion, Popover, Checkbox } from '@mantine/core';
2
2
  import { useClipboard, useDebouncedState, useMediaQuery, useFullscreen, useDisclosure } from '@mantine/hooks';
3
- import { IconWorld, IconExternalLink, IconClipboard, IconSettings, IconMathGreater, IconMathLower, IconArrowsLeftRight, IconWorldWww, IconClipboardCheck, IconAlertCircle, IconAlertTriangle, IconLanguage, IconCopy, IconArrowLeft, IconArrowRight, IconX, IconChevronLeft, IconChevronRight, IconVectorTriangle, IconPhotoDown, IconDownload, IconArrowsMinimize, IconArrowsMaximize, IconCheck, IconShare, IconSearch, IconBox, IconDotsVertical, IconTrash, IconPlus, IconStack3, IconInfoCircleFilled, IconArrowsSort, IconSortDescendingNumbers, IconSortDescendingLetters, IconSortAscendingNumbers, IconSortAscendingLetters, IconHelpCircle, IconFilterOff, IconFilter, IconClock, IconAdjustments } from '@tabler/icons-react';
3
+ import { IconWorld, IconExternalLink, IconClipboard, IconSettings, IconMathGreater, IconMathLower, IconArrowsLeftRight, IconWorldWww, IconClipboardCheck, IconAlertCircle, IconAlertTriangle, IconLanguage, IconCopy, IconArrowLeft, IconArrowRight, IconX, IconChevronLeft, IconChevronRight, IconVectorTriangle, IconPhotoDown, IconDownload, IconArrowsMinimize, IconArrowsMaximize, IconCheck, IconShare, IconSearch, IconDotsVertical, IconTrash, IconPlus, IconStack3, IconInfoCircleFilled, IconArrowsSort, IconSortDescendingNumbers, IconSortDescendingLetters, IconSortAscendingNumbers, IconSortAscendingLetters, IconHelpCircle, IconFilterOff, IconFilter, IconBox, IconClock, IconAdjustments } from '@tabler/icons-react';
4
4
  import * as React15 from 'react';
5
5
  import React15__default, { createContext, forwardRef, useMemo, useCallback, useContext, useRef, useEffect, useState, Suspense, useLayoutEffect } from 'react';
6
6
  import { translationFactory } from '@datawheel/use-translation';
@@ -1179,18 +1179,31 @@ function describeData(cube, params, result) {
1179
1179
  const entityResult = entityFinder(cube, column);
1180
1180
  if (!entityResult) return null;
1181
1181
  const [entity] = entityResult;
1182
+ let entityType;
1183
+ if (hasProperty(entity, "aggregator")) {
1184
+ entityType = "measure";
1185
+ } else if (hasProperty(entity, "depth")) {
1186
+ entityType = "level";
1187
+ } else {
1188
+ entityType = "property";
1189
+ }
1182
1190
  const typeSet = new Set(result.data.map((item) => typeof item[column]));
1183
- const valueType = typeSet.size === 1 ? typeSet.has("number") ? "number" : typeSet.has("boolean") ? "boolean" : (
1184
- /* else */
1185
- "string"
1186
- ) : typeSet.has("number") ? "number" : "string";
1191
+ let valueType;
1192
+ if (entityType === "measure" || typeSet.has("number")) {
1193
+ valueType = "number";
1194
+ } else if (typeSet.size === 1 && typeSet.has("boolean")) {
1195
+ valueType = "boolean";
1196
+ } else {
1197
+ valueType = "string";
1198
+ }
1187
1199
  const isId = column !== entity.name;
1188
- const entityType = hasProperty(entity, "aggregator") ? "measure" : hasProperty(entity, "depth") ? "level" : "property";
1200
+ const caption = getCaption(entity, locale) || column;
1201
+ const localeLabel = isId ? `${caption} ID` : caption;
1189
1202
  return [
1190
1203
  column,
1191
1204
  {
1192
1205
  label: column,
1193
- localeLabel: getCaption(entity, locale) + (isId ? " ID" : "") || column,
1206
+ localeLabel,
1194
1207
  entity,
1195
1208
  entityType,
1196
1209
  isId,
@@ -3758,7 +3771,8 @@ var MultiFilter = ({ header }) => {
3758
3771
  ));
3759
3772
  };
3760
3773
  var NoRecords = React15__default.memo(() => {
3761
- return /* @__PURE__ */ React15__default.createElement(Center, { style: { height: "calc(100% - 210px)" } }, /* @__PURE__ */ React15__default.createElement(Text, { size: "xl", color: "gray", italic: true }, "No records to display."));
3774
+ const { translate: t } = useTranslation();
3775
+ return /* @__PURE__ */ React15__default.createElement(Center, { style: { height: "calc(100% - 210px)" }, my: "xl" }, /* @__PURE__ */ React15__default.createElement(Text, { size: "md", color: "gray", italic: true }, t("results.error_emptyresult_detail")));
3762
3776
  });
3763
3777
  TableView.displayName = "TesseractExplorer:TableView";
3764
3778
 
@@ -5022,17 +5036,6 @@ function SuccessResult(props) {
5022
5036
  const { table, isError, isLoading, data, columns, result, pagination, isFetching } = useTable({
5023
5037
  cube
5024
5038
  });
5025
- if ((data == null ? void 0 : data.length) === 0 && !isLoading && !isError) {
5026
- return /* @__PURE__ */ React15__default.createElement(
5027
- FailureResult,
5028
- {
5029
- className: cx(classes.container, props.className),
5030
- icon: /* @__PURE__ */ React15__default.createElement(IconBox, { color: "orange", size: "5rem" }),
5031
- title: t("results.error_emptyresult_title"),
5032
- description: t("results.error_emptyresult_detail")
5033
- }
5034
- );
5035
- }
5036
5039
  return /* @__PURE__ */ React15__default.createElement(
5037
5040
  Flex,
5038
5041
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datawheel/data-explorer",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "main": "./dist/main.mjs",
5
5
  "types": "./dist/main.d.mts",
6
6
  "files": [