@datawheel/data-explorer 1.0.20 → 1.0.22

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 +66 -34
  2. package/dist/main.mjs +4389 -4453
  3. package/package.json +3 -5
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 } from '@reduxjs/toolkit';
8
+ import { StateFromReducersMapObject, ThunkAction, Action } from '@reduxjs/toolkit';
9
9
  import * as redux from 'redux';
10
10
 
11
11
  declare enum Aggregator {
@@ -377,7 +377,6 @@ interface QueryItem {
377
377
  chart: string | null;
378
378
  params: QueryParams;
379
379
  result: QueryResult;
380
- link?: string;
381
380
  }
382
381
  interface QueryParams {
383
382
  booleans: Record<string, undefined | boolean>;
@@ -456,6 +455,11 @@ interface PropertyItem extends QueryParamsItem {
456
455
  name: string;
457
456
  }
458
457
 
458
+ interface FileDescriptor {
459
+ content: Blob | string;
460
+ extension: string;
461
+ name: string;
462
+ }
459
463
  type Formatter = (value: number | null, locale?: string) => string;
460
464
  interface PanelDescriptor {
461
465
  key: string;
@@ -467,7 +471,7 @@ interface ViewProps<TData extends Record<string, any> = Record<string, string |
467
471
  cube: TesseractCube;
468
472
  panelKey: string | null;
469
473
  params: QueryParams;
470
- result?: QueryResult<TData>;
474
+ result: QueryResult<TData>;
471
475
  table?: MRT_TableInstance<TData & Record<string, any>>;
472
476
  isError?: boolean;
473
477
  isLoading?: boolean;
@@ -478,7 +482,7 @@ interface ViewProps<TData extends Record<string, any> = Record<string, string |
478
482
  }
479
483
 
480
484
  /** */
481
- declare function DebugView(props: ViewProps): React.JSX.Element | null;
485
+ declare function DebugView(props: ViewProps): React.JSX.Element;
482
486
 
483
487
  declare const explorerTranslation: {
484
488
  action_copy: string;
@@ -529,7 +533,6 @@ declare const explorerTranslation: {
529
533
  action_clear_description: string;
530
534
  action_execute: string;
531
535
  add_columns: string;
532
- submit: string;
533
536
  column_title: string;
534
537
  current_endpoint: string;
535
538
  dimmenu_abbrjoint: string;
@@ -831,7 +834,6 @@ declare const defaultTranslation: {
831
834
  action_clear_description: string;
832
835
  action_execute: string;
833
836
  add_columns: string;
834
- submit: string;
835
837
  column_title: string;
836
838
  current_endpoint: string;
837
839
  dimmenu_abbrjoint: string;
@@ -1092,15 +1094,6 @@ declare function ExplorerComponent<Locale extends string>(props: {
1092
1094
  * @default undefined
1093
1095
  */
1094
1096
  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;
1104
1097
  /**
1105
1098
  * Specifies which property should be used to filter elements in the member
1106
1099
  * selection control of the Cuts parameter area.
@@ -1113,6 +1106,14 @@ declare function ExplorerComponent<Locale extends string>(props: {
1113
1106
  * @default "measures"
1114
1107
  */
1115
1108
  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;
1116
1117
  /**
1117
1118
  * Defines an index of formatter functions available to the measures shown
1118
1119
  * in the app, besides a limited list of default ones. The key used comes
@@ -1187,16 +1188,16 @@ declare namespace ExplorerComponent {
1187
1188
  var displayName: string;
1188
1189
  }
1189
1190
 
1191
+ /** */
1190
1192
  declare function PivotView<TData extends Record<string, unknown>>(props: {} & ViewProps<TData> & MRT_TableOptions<TData>): React.JSX.Element;
1191
1193
 
1192
- type TData = Record<string, string | number> & Record<string, any>;
1194
+ type TData = Record<string, any> & Record<string, string | number>;
1193
1195
  type TableView = {
1194
1196
  table: MRT_TableInstance<TData>;
1195
1197
  getColumn(id: string): AnyResultColumn | undefined;
1196
1198
  columns: AnyResultColumn[];
1197
- setPagination: (pagination: MRT_PaginationState) => void;
1198
1199
  } & ViewProps;
1199
- declare function TableView({ table, isError, isLoading, data, pagination, setPagination, result }: TableView): React.JSX.Element;
1200
+ declare function TableView({ table, result, isError, isLoading, data, pagination, setPagination }: TableView): React.JSX.Element;
1200
1201
  declare namespace TableView {
1201
1202
  var displayName: string;
1202
1203
  }
@@ -1219,7 +1220,9 @@ declare function thunkExtraArg(): {
1219
1220
  complexity: ComplexityModuleClient;
1220
1221
  previewLimit: number;
1221
1222
  };
1223
+ type ExplorerThunkArg = ReturnType<typeof thunkExtraArg>;
1222
1224
  type ExplorerState = StateFromReducersMapObject<typeof reducerMap>;
1225
+ type ExplorerThunk<ReturnType = void> = ThunkAction<ReturnType, ExplorerState, ExplorerThunkArg, Action<string>>;
1223
1226
 
1224
1227
  declare const LOADINGSTATUS: {
1225
1228
  readonly FETCHING: "FETCHING";
@@ -1239,6 +1242,11 @@ interface LoadingState {
1239
1242
  trigger: string | null;
1240
1243
  }
1241
1244
 
1245
+ interface QueriesState {
1246
+ current: string;
1247
+ itemMap: Record<string, QueryItem>;
1248
+ }
1249
+
1242
1250
  interface ServerState {
1243
1251
  cubeMap: Record<string, TesseractCube>;
1244
1252
  locale: string;
@@ -1247,18 +1255,42 @@ interface ServerState {
1247
1255
  url: string;
1248
1256
  }
1249
1257
 
1250
- interface QueriesState {
1251
- current: string;
1252
- itemMap: Record<string, QueryItem>;
1253
- }
1254
-
1255
1258
  type ExplorerActionMap = typeof actions;
1256
1259
  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
+ }>>;
1257
1290
  resetQueries: _reduxjs_toolkit.ActionCreatorWithPayload<Record<string, any>, "explorerQueries/resetQueries">;
1258
1291
  removeQuery: _reduxjs_toolkit.ActionCreatorWithPayload<string, "explorerQueries/removeQuery">;
1259
1292
  selectQuery: _reduxjs_toolkit.ActionCreatorWithPayload<string, "explorerQueries/selectQuery">;
1260
1293
  updateQuery: _reduxjs_toolkit.ActionCreatorWithPayload<QueryItem, "explorerQueries/updateQuery">;
1261
- updateCurrentQuery: _reduxjs_toolkit.ActionCreatorWithPayload<QueryItem, "explorerQueries/updateCurrentQuery">;
1262
1294
  switchPanel: _reduxjs_toolkit.ActionCreatorWithPayload<string | null, "explorerQueries/switchPanel">;
1263
1295
  updateChart: _reduxjs_toolkit.ActionCreatorWithPayload<string | null, "explorerQueries/updateChart">;
1264
1296
  removeCut: _reduxjs_toolkit.ActionCreatorWithPayload<string, "explorerQueries/removeCut">;
@@ -1295,6 +1327,13 @@ declare const actions: {
1295
1327
  }, "explorerQueries/updateSorting">;
1296
1328
  clearSorting: _reduxjs_toolkit.ActionCreatorWithoutPayload<"explorerQueries/clearSorting">;
1297
1329
  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">;
1298
1337
  };
1299
1338
 
1300
1339
  type ExplorerBoundActionMap = {
@@ -1310,12 +1349,6 @@ interface SettingsContextProps {
1310
1349
  paginationConfig: Pagination;
1311
1350
  measuresActive?: number;
1312
1351
  toolbarConfig?: ToolbarConfigType;
1313
- serverConfig?: RequestInit;
1314
- serverURL: string;
1315
- defaultDataLocale?: string;
1316
- defaultCube?: string;
1317
- defaultLocale: string;
1318
- locale: string;
1319
1352
  }
1320
1353
  /**
1321
1354
  * A wrapper for the Consumer, for use with class components.
@@ -1329,10 +1362,9 @@ declare function useSettings(): SettingsContextProps;
1329
1362
  declare function VizbuilderView(props: {
1330
1363
  cube: TesseractCube;
1331
1364
  params: QueryParams;
1332
- }): React.JSX.Element;
1365
+ result: QueryResult;
1366
+ }): false | React.JSX.Element;
1333
1367
 
1334
1368
  declare function TourStep(props: TourStepsPropsType): React.JSX.Element;
1335
1369
 
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 };
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 };