@datawheel/data-explorer 1.0.6 → 1.0.8
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.mjs +45 -12
- package/package.json +1 -1
package/dist/main.mjs
CHANGED
|
@@ -449,7 +449,7 @@ var vizbuilderTranslation = {
|
|
|
449
449
|
action_fileissue: "Report an issue",
|
|
450
450
|
action_retry: "Retry",
|
|
451
451
|
aggregator: {
|
|
452
|
-
average: "Average {{measure}}",
|
|
452
|
+
average: "Average walter {{measure}}",
|
|
453
453
|
max: "Max {{measure}}",
|
|
454
454
|
min: "Min {{measure}}",
|
|
455
455
|
sum: "{{measure}}"
|
|
@@ -2234,19 +2234,19 @@ function pickDefaultDrilldowns(dimensions) {
|
|
|
2234
2234
|
// src/hooks/useQueryApi.ts
|
|
2235
2235
|
function useServerSchema() {
|
|
2236
2236
|
const { tesseract } = useLogicLayer();
|
|
2237
|
-
const { serverURL,
|
|
2237
|
+
const { serverURL, defaultLocale } = useSettings();
|
|
2238
2238
|
return useQuery({
|
|
2239
|
-
queryKey: ["schema", serverURL,
|
|
2239
|
+
queryKey: ["schema", serverURL, defaultLocale],
|
|
2240
2240
|
queryFn: async () => {
|
|
2241
2241
|
const search = new URLSearchParams(location.search);
|
|
2242
|
-
const locale = search.get("locale");
|
|
2242
|
+
const locale = defaultLocale || search.get("locale") || void 0;
|
|
2243
2243
|
try {
|
|
2244
|
-
const schema = await tesseract.fetchSchema({ locale
|
|
2244
|
+
const schema = await tesseract.fetchSchema({ locale });
|
|
2245
2245
|
const cubes = schema.cubes.filter((cube) => !cube.annotations.hide_in_ui);
|
|
2246
2246
|
const cubeMap = keyBy(cubes, "name");
|
|
2247
2247
|
return {
|
|
2248
2248
|
cubeMap,
|
|
2249
|
-
locale:
|
|
2249
|
+
locale: defaultLocale || schema.default_locale,
|
|
2250
2250
|
localeOptions: schema.locales,
|
|
2251
2251
|
online: true,
|
|
2252
2252
|
url: serverURL
|
|
@@ -2254,7 +2254,7 @@ function useServerSchema() {
|
|
|
2254
2254
|
} catch (error) {
|
|
2255
2255
|
return {
|
|
2256
2256
|
cubeMap: {},
|
|
2257
|
-
locale:
|
|
2257
|
+
locale: defaultLocale || "",
|
|
2258
2258
|
localeOptions: [],
|
|
2259
2259
|
online: false,
|
|
2260
2260
|
url: serverURL
|
|
@@ -2340,12 +2340,18 @@ function useFetchQuery(queryParams, queryLink, options) {
|
|
|
2340
2340
|
if (withoutPagination) {
|
|
2341
2341
|
request.limit = "0,0";
|
|
2342
2342
|
}
|
|
2343
|
-
const response = await tesseract.fetchData({
|
|
2343
|
+
const response = await tesseract.fetchData({
|
|
2344
|
+
request,
|
|
2345
|
+
format: "jsonrecords"
|
|
2346
|
+
});
|
|
2344
2347
|
const content = await response.json();
|
|
2345
2348
|
if (!response.ok) {
|
|
2346
2349
|
throw new Error(`Backend Error: ${content.detail}`);
|
|
2347
2350
|
}
|
|
2348
|
-
const cubeData = await tesseract.fetchCube({
|
|
2351
|
+
const cubeData = await tesseract.fetchCube({
|
|
2352
|
+
cube: queryParams.cube,
|
|
2353
|
+
locale: queryParams.locale
|
|
2354
|
+
});
|
|
2349
2355
|
return {
|
|
2350
2356
|
data: content.data,
|
|
2351
2357
|
page: content.page,
|
|
@@ -3015,7 +3021,7 @@ function useTable({
|
|
|
3015
3021
|
handlerCreateFilter,
|
|
3016
3022
|
handlerCreateMeasure
|
|
3017
3023
|
]);
|
|
3018
|
-
const { isLoading, isFetching, isError, data
|
|
3024
|
+
const { isLoading, isFetching, isError, data } = useTableData({
|
|
3019
3025
|
columns: finalUniqueKeys,
|
|
3020
3026
|
pagination,
|
|
3021
3027
|
cube: cube.name
|
|
@@ -3063,6 +3069,7 @@ function useTable({
|
|
|
3063
3069
|
header,
|
|
3064
3070
|
enableHiding: true,
|
|
3065
3071
|
accessorFn: (row) => row[columnKey],
|
|
3072
|
+
// This functions is not being used. Manual sorting is enabled.
|
|
3066
3073
|
sortingFn: (rowA, rowB, columnId) => {
|
|
3067
3074
|
if (rowA.original[columnId] < rowB.original[columnId]) {
|
|
3068
3075
|
return -1;
|
|
@@ -3083,12 +3090,38 @@ function useTable({
|
|
|
3083
3090
|
onClick: () => {
|
|
3084
3091
|
if (!isSorted) {
|
|
3085
3092
|
actions2.updateSorting({ key: entity.name, dir: "desc" });
|
|
3093
|
+
const newQuery = buildQuery(_.cloneDeep(queryItem));
|
|
3094
|
+
updateURL({
|
|
3095
|
+
...newQuery,
|
|
3096
|
+
params: {
|
|
3097
|
+
...newQuery.params,
|
|
3098
|
+
sortKey: `${entity.name}`,
|
|
3099
|
+
sortDir: "desc"
|
|
3100
|
+
}
|
|
3101
|
+
});
|
|
3086
3102
|
}
|
|
3087
3103
|
if (isSorted && sortDir === "desc") {
|
|
3088
3104
|
actions2.updateSorting({ key: entity.name, dir: "asc" });
|
|
3105
|
+
const newQuery = buildQuery(_.cloneDeep(queryItem));
|
|
3106
|
+
updateURL({
|
|
3107
|
+
...newQuery,
|
|
3108
|
+
params: {
|
|
3109
|
+
...newQuery.params,
|
|
3110
|
+
sortKey: `${entity.name}`,
|
|
3111
|
+
sortDir: "asc"
|
|
3112
|
+
}
|
|
3113
|
+
});
|
|
3089
3114
|
}
|
|
3090
3115
|
if (isSorted && sortDir === "asc") {
|
|
3091
3116
|
actions2.clearSorting();
|
|
3117
|
+
const newQuery = buildQuery(_.cloneDeep(queryItem));
|
|
3118
|
+
updateURL({
|
|
3119
|
+
...newQuery,
|
|
3120
|
+
params: {
|
|
3121
|
+
...newQuery.params,
|
|
3122
|
+
sortKey: void 0
|
|
3123
|
+
}
|
|
3124
|
+
});
|
|
3092
3125
|
}
|
|
3093
3126
|
}
|
|
3094
3127
|
},
|
|
@@ -6147,7 +6180,7 @@ function AppProviders({ children }) {
|
|
|
6147
6180
|
const queryItem = useSelector$1(selectCurrentQueryItem);
|
|
6148
6181
|
const actions2 = useActions();
|
|
6149
6182
|
const isInitialMount = useRef(true);
|
|
6150
|
-
const {
|
|
6183
|
+
const { setLocale } = useTranslation();
|
|
6151
6184
|
useEffect(() => {
|
|
6152
6185
|
if (isInitialMount.current) {
|
|
6153
6186
|
isInitialMount.current = false;
|
|
@@ -6156,7 +6189,7 @@ function AppProviders({ children }) {
|
|
|
6156
6189
|
actions2.updateLocale(defaultLocale);
|
|
6157
6190
|
updateUrl({ ...queryItem, params: { ...queryItem.params, locale: defaultLocale } });
|
|
6158
6191
|
setLocale(defaultLocale);
|
|
6159
|
-
}, [defaultLocale, setLocale]);
|
|
6192
|
+
}, [defaultLocale, setLocale, actions2]);
|
|
6160
6193
|
return /* @__PURE__ */ React13.createElement(QueryClientProvider, { client: queryClient }, /* @__PURE__ */ React13.createElement(TableRefreshProvider, { serverURL }, /* @__PURE__ */ React13.createElement(
|
|
6161
6194
|
LogicLayerProvider,
|
|
6162
6195
|
{
|