@datawheel/data-explorer 1.0.22 → 1.1.0

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.
Files changed (3) hide show
  1. package/dist/main.d.mts +34 -66
  2. package/dist/main.mjs +4219 -4186
  3. package/package.json +12 -6
package/dist/main.d.mts CHANGED
@@ -5,7 +5,7 @@ import { CSSObject } from '@mantine/core';
5
5
  import { Translation as Translation$1 } from '@datawheel/vizbuilder/react';
6
6
  import { StepType, TourProps } from '@reactour/tour';
7
7
  import * as _reduxjs_toolkit from '@reduxjs/toolkit';
8
- import { StateFromReducersMapObject, ThunkAction, Action } from '@reduxjs/toolkit';
8
+ import { StateFromReducersMapObject } from '@reduxjs/toolkit';
9
9
  import * as redux from 'redux';
10
10
 
11
11
  declare enum Aggregator {
@@ -377,6 +377,7 @@ interface QueryItem {
377
377
  chart: string | null;
378
378
  params: QueryParams;
379
379
  result: QueryResult;
380
+ link?: string;
380
381
  }
381
382
  interface QueryParams {
382
383
  booleans: Record<string, undefined | boolean>;
@@ -455,11 +456,6 @@ interface PropertyItem extends QueryParamsItem {
455
456
  name: string;
456
457
  }
457
458
 
458
- interface FileDescriptor {
459
- content: Blob | string;
460
- extension: string;
461
- name: string;
462
- }
463
459
  type Formatter = (value: number | null, locale?: string) => string;
464
460
  interface PanelDescriptor {
465
461
  key: string;
@@ -471,7 +467,7 @@ interface ViewProps<TData extends Record<string, any> = Record<string, string |
471
467
  cube: TesseractCube;
472
468
  panelKey: string | null;
473
469
  params: QueryParams;
474
- result: QueryResult<TData>;
470
+ result?: QueryResult<TData>;
475
471
  table?: MRT_TableInstance<TData & Record<string, any>>;
476
472
  isError?: boolean;
477
473
  isLoading?: boolean;
@@ -482,7 +478,7 @@ interface ViewProps<TData extends Record<string, any> = Record<string, string |
482
478
  }
483
479
 
484
480
  /** */
485
- declare function DebugView(props: ViewProps): React.JSX.Element;
481
+ declare function DebugView(props: ViewProps): React.JSX.Element | null;
486
482
 
487
483
  declare const explorerTranslation: {
488
484
  action_copy: string;
@@ -533,6 +529,7 @@ declare const explorerTranslation: {
533
529
  action_clear_description: string;
534
530
  action_execute: string;
535
531
  add_columns: string;
532
+ submit: string;
536
533
  column_title: string;
537
534
  current_endpoint: string;
538
535
  dimmenu_abbrjoint: string;
@@ -834,6 +831,7 @@ declare const defaultTranslation: {
834
831
  action_clear_description: string;
835
832
  action_execute: string;
836
833
  add_columns: string;
834
+ submit: string;
837
835
  column_title: string;
838
836
  current_endpoint: string;
839
837
  dimmenu_abbrjoint: string;
@@ -1094,6 +1092,15 @@ declare function ExplorerComponent<Locale extends string>(props: {
1094
1092
  * @default undefined
1095
1093
  */
1096
1094
  defaultCube?: string | undefined;
1095
+ /**
1096
+ * The locale to use in the Explorer component UI.
1097
+ * This value is passed to the Translation utility and controls the language
1098
+ * for the labels throughout the user interface.
1099
+ * Must be equal to one of the
1100
+ * keys in the object provided to the `translations` property.
1101
+ * @default "en"
1102
+ */
1103
+ defaultLocale?: Locale;
1097
1104
  /**
1098
1105
  * Specifies which property should be used to filter elements in the member
1099
1106
  * selection control of the Cuts parameter area.
@@ -1106,14 +1113,6 @@ declare function ExplorerComponent<Locale extends string>(props: {
1106
1113
  * @default "measures"
1107
1114
  */
1108
1115
  defaultOpenParams?: "measures" | "drilldowns" | "cuts" | "options";
1109
- /**
1110
- * The locale to use in the Explorer component UI.
1111
- * This value is passed to the Translation utility and controls the language
1112
- * for the labels throughout the user interface. Must be equal to one of the
1113
- * keys in the object provided to the `translations` property.
1114
- * @default "en"
1115
- */
1116
- locale?: Locale;
1117
1116
  /**
1118
1117
  * Defines an index of formatter functions available to the measures shown
1119
1118
  * in the app, besides a limited list of default ones. The key used comes
@@ -1188,16 +1187,16 @@ declare namespace ExplorerComponent {
1188
1187
  var displayName: string;
1189
1188
  }
1190
1189
 
1191
- /** */
1192
1190
  declare function PivotView<TData extends Record<string, unknown>>(props: {} & ViewProps<TData> & MRT_TableOptions<TData>): React.JSX.Element;
1193
1191
 
1194
- type TData = Record<string, any> & Record<string, string | number>;
1192
+ type TData = Record<string, string | number> & Record<string, any>;
1195
1193
  type TableView = {
1196
1194
  table: MRT_TableInstance<TData>;
1197
1195
  getColumn(id: string): AnyResultColumn | undefined;
1198
1196
  columns: AnyResultColumn[];
1197
+ setPagination: (pagination: MRT_PaginationState) => void;
1199
1198
  } & ViewProps;
1200
- declare function TableView({ table, result, isError, isLoading, data, pagination, setPagination }: TableView): React.JSX.Element;
1199
+ declare function TableView({ table, isError, isLoading, data, pagination, setPagination, result }: TableView): React.JSX.Element;
1201
1200
  declare namespace TableView {
1202
1201
  var displayName: string;
1203
1202
  }
@@ -1220,9 +1219,7 @@ declare function thunkExtraArg(): {
1220
1219
  complexity: ComplexityModuleClient;
1221
1220
  previewLimit: number;
1222
1221
  };
1223
- type ExplorerThunkArg = ReturnType<typeof thunkExtraArg>;
1224
1222
  type ExplorerState = StateFromReducersMapObject<typeof reducerMap>;
1225
- type ExplorerThunk<ReturnType = void> = ThunkAction<ReturnType, ExplorerState, ExplorerThunkArg, Action<string>>;
1226
1223
 
1227
1224
  declare const LOADINGSTATUS: {
1228
1225
  readonly FETCHING: "FETCHING";
@@ -1242,11 +1239,6 @@ interface LoadingState {
1242
1239
  trigger: string | null;
1243
1240
  }
1244
1241
 
1245
- interface QueriesState {
1246
- current: string;
1247
- itemMap: Record<string, QueryItem>;
1248
- }
1249
-
1250
1242
  interface ServerState {
1251
1243
  cubeMap: Record<string, TesseractCube>;
1252
1244
  locale: string;
@@ -1255,42 +1247,18 @@ interface ServerState {
1255
1247
  url: string;
1256
1248
  }
1257
1249
 
1250
+ interface QueriesState {
1251
+ current: string;
1252
+ itemMap: Record<string, QueryItem>;
1253
+ }
1254
+
1258
1255
  type ExplorerActionMap = typeof actions;
1259
1256
  declare const actions: {
1260
- willDownloadQuery(format: `${Format}`): ExplorerThunk<Promise<FileDescriptor>>;
1261
- willExecuteQuery(params?: {
1262
- limit?: number;
1263
- offset?: number;
1264
- }): ExplorerThunk<Promise<void>>;
1265
- willFetchQuery(params?: {
1266
- limit?: number;
1267
- offset?: number;
1268
- withoutPagination?: boolean;
1269
- }): ExplorerThunk<Promise<QueryResult>>;
1270
- willFetchMembers(level: string, localeStr?: string, cubeName?: string): ExplorerThunk<Promise<TesseractMembersResponse>>;
1271
- willHydrateParams(suggestedCube?: string): ExplorerThunk<Promise<void>>;
1272
- willParseQueryUrl(url: string | URL): ExplorerThunk<Promise<void>>;
1273
- willReloadCubes(params?: {
1274
- locale: {
1275
- code: string;
1276
- };
1277
- }): ExplorerThunk<Promise<{
1278
- [k: string]: TesseractCube;
1279
- }>>;
1280
- willRequestQuery(): ExplorerThunk<Promise<void>>;
1281
- willSetCube(cubeName: string, measuresActive?: number, locale?: string): ExplorerThunk<Promise<void>>;
1282
- willReloadCube({ locale }: {
1283
- locale: {
1284
- code: string;
1285
- };
1286
- }): ExplorerThunk<Promise<void>>;
1287
- willSetupClient(baseURL: string, defaultLocale?: string, requestConfig?: RequestInit): ExplorerThunk<Promise<{
1288
- [k: string]: TesseractCube;
1289
- }>>;
1290
1257
  resetQueries: _reduxjs_toolkit.ActionCreatorWithPayload<Record<string, any>, "explorerQueries/resetQueries">;
1291
1258
  removeQuery: _reduxjs_toolkit.ActionCreatorWithPayload<string, "explorerQueries/removeQuery">;
1292
1259
  selectQuery: _reduxjs_toolkit.ActionCreatorWithPayload<string, "explorerQueries/selectQuery">;
1293
1260
  updateQuery: _reduxjs_toolkit.ActionCreatorWithPayload<QueryItem, "explorerQueries/updateQuery">;
1261
+ updateCurrentQuery: _reduxjs_toolkit.ActionCreatorWithPayload<QueryItem, "explorerQueries/updateCurrentQuery">;
1294
1262
  switchPanel: _reduxjs_toolkit.ActionCreatorWithPayload<string | null, "explorerQueries/switchPanel">;
1295
1263
  updateChart: _reduxjs_toolkit.ActionCreatorWithPayload<string | null, "explorerQueries/updateChart">;
1296
1264
  removeCut: _reduxjs_toolkit.ActionCreatorWithPayload<string, "explorerQueries/removeCut">;
@@ -1327,13 +1295,6 @@ declare const actions: {
1327
1295
  }, "explorerQueries/updateSorting">;
1328
1296
  clearSorting: _reduxjs_toolkit.ActionCreatorWithoutPayload<"explorerQueries/clearSorting">;
1329
1297
  updateResult: _reduxjs_toolkit.ActionCreatorWithPayload<QueryResult<Record<string, unknown>>, "explorerQueries/updateResult">;
1330
- setLoadingState(status: LoadingStatus, message?: string): {
1331
- readonly type: "explorerLoading/setLoadingState:FETCHING" | "explorerLoading/setLoadingState:SUCCESS" | "explorerLoading/setLoadingState:FAILURE";
1332
- readonly payload: string | undefined;
1333
- };
1334
- setLoadingMessage: _reduxjs_toolkit.ActionCreatorWithPayload<LoadingMessage, "explorerLoading/setLoadingMessage">;
1335
- updateServer: _reduxjs_toolkit.ActionCreatorWithPayload<Partial<ServerState>, "explorerServer/updateServer">;
1336
- resetServer: _reduxjs_toolkit.ActionCreatorWithoutPayload<"explorerServer/resetServer">;
1337
1298
  };
1338
1299
 
1339
1300
  type ExplorerBoundActionMap = {
@@ -1349,6 +1310,12 @@ interface SettingsContextProps {
1349
1310
  paginationConfig: Pagination;
1350
1311
  measuresActive?: number;
1351
1312
  toolbarConfig?: ToolbarConfigType;
1313
+ serverConfig?: RequestInit;
1314
+ serverURL: string;
1315
+ defaultDataLocale?: string;
1316
+ defaultCube?: string;
1317
+ defaultLocale: string;
1318
+ locale: string;
1352
1319
  }
1353
1320
  /**
1354
1321
  * A wrapper for the Consumer, for use with class components.
@@ -1362,9 +1329,10 @@ declare function useSettings(): SettingsContextProps;
1362
1329
  declare function VizbuilderView(props: {
1363
1330
  cube: TesseractCube;
1364
1331
  params: QueryParams;
1365
- result: QueryResult;
1366
- }): false | React.JSX.Element;
1332
+ }): React.JSX.Element;
1367
1333
 
1368
1334
  declare function TourStep(props: TourStepsPropsType): React.JSX.Element;
1369
1335
 
1370
- 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 };