@datawheel/data-explorer 0.2.2 → 0.2.3
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.js +119 -93
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -3,7 +3,7 @@ import { useClipboard, useClickOutside, useFullscreen, useMediaQuery, useDebounc
|
|
|
3
3
|
import { Prism } from '@mantine/prism';
|
|
4
4
|
import { IconWorld, IconExternalLink, IconClipboard, IconAlertCircle, IconAlertTriangle, IconSettings, IconMathGreater, IconMathLower, IconArrowsLeftRight, IconCopy, IconDownload, IconDotsVertical, IconArrowsMinimize, IconArrowsMaximize, IconInfoCircleFilled, IconTrash, IconSearch, IconPhotoDown, IconVectorTriangle, IconStack3, IconFilterOff, IconFilter, IconArrowsSort, IconSortDescendingNumbers, IconSortDescendingLetters, IconSortAscendingNumbers, IconSortAscendingLetters, IconLanguage } from '@tabler/icons-react';
|
|
5
5
|
import * as React10 from 'react';
|
|
6
|
-
import React10__default, { createContext, forwardRef, useMemo, useCallback, useContext, useState, useEffect, useRef, Suspense } from 'react';
|
|
6
|
+
import React10__default, { createContext, forwardRef, useMemo, useCallback, useContext, useState, useEffect, useRef, Suspense, useLayoutEffect } from 'react';
|
|
7
7
|
import { translationFactory } from '@datawheel/use-translation';
|
|
8
8
|
import { translationDict, generateCharts, createChartConfig } from '@datawheel/vizbuilder';
|
|
9
9
|
import { createSlice, createSelector, combineReducers, bindActionCreators, configureStore } from '@reduxjs/toolkit';
|
|
@@ -1565,7 +1565,7 @@ function calcMaxMemberCount(query, params, dispatch) {
|
|
|
1565
1565
|
(level) => Level.isLevel(level) ? drills[level.uniqueName] || ds.fetchMembers(level).then(async (members) => {
|
|
1566
1566
|
const { dimension } = level;
|
|
1567
1567
|
const drilldown = Object.values(params.drilldowns).find(
|
|
1568
|
-
(d) => d.uniqueName === level.uniqueName
|
|
1568
|
+
(d) => d.uniqueName === buildDrilldown(level).uniqueName
|
|
1569
1569
|
);
|
|
1570
1570
|
if (drilldown) {
|
|
1571
1571
|
const ddd = {
|
|
@@ -1574,7 +1574,6 @@ function calcMaxMemberCount(query, params, dispatch) {
|
|
|
1574
1574
|
memberCount: members.length,
|
|
1575
1575
|
members
|
|
1576
1576
|
};
|
|
1577
|
-
dispatch(actions.updateDrilldown(ddd));
|
|
1578
1577
|
createCutHandler(params.cuts, ddd, dispatch);
|
|
1579
1578
|
}
|
|
1580
1579
|
return members.length;
|
|
@@ -1591,6 +1590,7 @@ function hydrateDrilldownProperties(cube, drilldownItem) {
|
|
|
1591
1590
|
if (level.matches(drilldownItem)) {
|
|
1592
1591
|
return buildDrilldown({
|
|
1593
1592
|
...drilldownItem,
|
|
1593
|
+
key: stringifyName(drilldownItem),
|
|
1594
1594
|
fullName: level.fullName,
|
|
1595
1595
|
uniqueName: level.uniqueName,
|
|
1596
1596
|
dimType: level.dimension.dimensionType,
|
|
@@ -1617,9 +1617,15 @@ function deriveDrilldowns(dimensions) {
|
|
|
1617
1617
|
}
|
|
1618
1618
|
for (const dim of dimensions) {
|
|
1619
1619
|
if (dim.type !== "time" && drilldowns.length < 4) {
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1620
|
+
if (dim.hierarchies.length === 1) {
|
|
1621
|
+
const { levels } = dim.hierarchies[0];
|
|
1622
|
+
const levelIndex = dim.type === "geo" ? levels.length - 1 : 0;
|
|
1623
|
+
drilldowns.push(levels[levelIndex]);
|
|
1624
|
+
} else {
|
|
1625
|
+
const { levels } = findDefaultHierarchy(dim);
|
|
1626
|
+
const levelIndex = dim.type === "geo" ? levels.length - 1 : 0;
|
|
1627
|
+
drilldowns.push(levels[levelIndex]);
|
|
1628
|
+
}
|
|
1623
1629
|
}
|
|
1624
1630
|
}
|
|
1625
1631
|
return drilldowns;
|
|
@@ -1749,7 +1755,7 @@ function willExecuteQuery({ limit, offset } = {}) {
|
|
|
1749
1755
|
const { data, headers, status } = aggregation;
|
|
1750
1756
|
!isPrefetch && dispatch(
|
|
1751
1757
|
queriesActions.updateResult({
|
|
1752
|
-
data,
|
|
1758
|
+
data: data == null ? void 0 : data.data,
|
|
1753
1759
|
types: (data == null ? void 0 : data.data.length) ? describeData(cube.toJSON(), params, data == null ? void 0 : data.data) : currentResult.types,
|
|
1754
1760
|
headers: { ...headers },
|
|
1755
1761
|
sourceCall: query.toSource(),
|
|
@@ -2707,33 +2713,8 @@ function AddColumnsDrawer() {
|
|
|
2707
2713
|
}
|
|
2708
2714
|
function DrillDownOptions() {
|
|
2709
2715
|
const locale = useSelector$1(selectLocale);
|
|
2710
|
-
const actions2 = useActions();
|
|
2711
2716
|
const selectedDimensions = useSelector$1(selectDrilldownItems);
|
|
2712
2717
|
const dimensions = useSelector$1(selectOlapDimensionItems) || [];
|
|
2713
|
-
const createCutHandler2 = React10__default.useCallback((level) => {
|
|
2714
|
-
const cutItem = buildCut({ ...level, key: level.fullName, members: [] });
|
|
2715
|
-
cutItem.active = false;
|
|
2716
|
-
actions2.updateCut(cutItem);
|
|
2717
|
-
}, []);
|
|
2718
|
-
useCallback(
|
|
2719
|
-
(level) => {
|
|
2720
|
-
var _a;
|
|
2721
|
-
const drilldownItem = (_a = selectedDimensions.find((item) => item.uniqueName === level.uniqueName)) != null ? _a : buildDrilldown({ ...level });
|
|
2722
|
-
createCutHandler2(level);
|
|
2723
|
-
actions2.updateDrilldown(drilldownItem);
|
|
2724
|
-
actions2.willFetchMembers({ ...level, level: level.name }).then((members) => {
|
|
2725
|
-
const dimension = dimensions.find((dim) => dim.name === level.dimension);
|
|
2726
|
-
if (!dimension) return;
|
|
2727
|
-
actions2.updateDrilldown({
|
|
2728
|
-
...drilldownItem,
|
|
2729
|
-
dimType: dimension.dimensionType,
|
|
2730
|
-
memberCount: members.length,
|
|
2731
|
-
members
|
|
2732
|
-
});
|
|
2733
|
-
});
|
|
2734
|
-
},
|
|
2735
|
-
[dimensions]
|
|
2736
|
-
);
|
|
2737
2718
|
const activeItems = selectedDimensions.filter((i) => i.active);
|
|
2738
2719
|
const options = useMemo(
|
|
2739
2720
|
() => dimensions.map((dimension) => /* @__PURE__ */ React10__default.createElement(
|
|
@@ -2745,7 +2726,7 @@ function DrillDownOptions() {
|
|
|
2745
2726
|
activeItems
|
|
2746
2727
|
}
|
|
2747
2728
|
)),
|
|
2748
|
-
[dimensions, activeItems
|
|
2729
|
+
[dimensions, activeItems]
|
|
2749
2730
|
);
|
|
2750
2731
|
return options;
|
|
2751
2732
|
}
|
|
@@ -2803,12 +2784,9 @@ function LevelItem({ dimension, hierarchy, isSubMenu, level, locale, activeItems
|
|
|
2803
2784
|
const { translate: t } = useTranslation();
|
|
2804
2785
|
const actions2 = useActions();
|
|
2805
2786
|
const cutItems = useSelector$1(selectCutItems);
|
|
2806
|
-
useSelector$1(selectOlapDimensionItems);
|
|
2787
|
+
const dimensions = useSelector$1(selectOlapDimensionItems);
|
|
2807
2788
|
const drilldowns = useSelector$1(selectDrilldownMap);
|
|
2808
|
-
const
|
|
2809
|
-
const [currentDrilldown, setCurrentDrilldown] = useState(
|
|
2810
|
-
drilldowns[stringifyNameInternal(level)] || drilldowns[stringifyName(level)]
|
|
2811
|
-
);
|
|
2789
|
+
const ditems = useSelector$1(selectDrilldownItems);
|
|
2812
2790
|
const label = useMemo(() => {
|
|
2813
2791
|
const captions = [
|
|
2814
2792
|
getCaption(dimension, locale),
|
|
@@ -2825,20 +2803,36 @@ function LevelItem({ dimension, hierarchy, isSubMenu, level, locale, activeItems
|
|
|
2825
2803
|
level: captions[2]
|
|
2826
2804
|
});
|
|
2827
2805
|
}, [locale, dimension, hierarchy, level, isSubMenu]);
|
|
2828
|
-
React10__default.useCallback((level2) => {
|
|
2806
|
+
const createCutHandler2 = React10__default.useCallback((level2) => {
|
|
2829
2807
|
const cutItem = buildCut({ ...level2, members: [], key: level2.fullName });
|
|
2830
2808
|
cutItem.active = false;
|
|
2831
2809
|
actions2.updateCut(cutItem);
|
|
2832
2810
|
}, []);
|
|
2833
2811
|
function createDrilldown(level2, cuts) {
|
|
2834
2812
|
const drilldown = buildDrilldown({ ...level2, key: stringifyName(level2), active: false });
|
|
2813
|
+
actions2.updateDrilldown(drilldown);
|
|
2814
|
+
const cut2 = cuts.find((cut3) => cut3.uniqueName === drilldown.uniqueName);
|
|
2815
|
+
if (!cut2) {
|
|
2816
|
+
createCutHandler2({ ...level2, key: stringifyName(level2) });
|
|
2817
|
+
}
|
|
2818
|
+
actions2.willFetchMembers({ ...level2, level: level2.name }).then((members) => {
|
|
2819
|
+
const dimension2 = dimensions.find((dim) => dim.name === level2.dimension);
|
|
2820
|
+
if (!dimension2) return;
|
|
2821
|
+
actions2.updateDrilldown({
|
|
2822
|
+
...drilldown,
|
|
2823
|
+
dimType: dimension2.dimensionType,
|
|
2824
|
+
memberCount: members.length,
|
|
2825
|
+
members
|
|
2826
|
+
});
|
|
2827
|
+
});
|
|
2835
2828
|
return drilldown;
|
|
2836
2829
|
}
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2830
|
+
const currentDrilldown = drilldowns[stringifyName(level)];
|
|
2831
|
+
useLayoutEffect(() => {
|
|
2832
|
+
if (!drilldowns[stringifyName(level)] && !ditems.find((d) => d.uniqueName === buildDrilldown(level).uniqueName)) {
|
|
2833
|
+
createDrilldown(level, cutItems);
|
|
2840
2834
|
}
|
|
2841
|
-
}, []);
|
|
2835
|
+
}, [level, ditems]);
|
|
2842
2836
|
const cut = cutItems.find((cut2) => {
|
|
2843
2837
|
return cut2.uniqueName === (currentDrilldown == null ? void 0 : currentDrilldown.uniqueName);
|
|
2844
2838
|
});
|
|
@@ -2847,7 +2841,7 @@ function LevelItem({ dimension, hierarchy, isSubMenu, level, locale, activeItems
|
|
|
2847
2841
|
}, []);
|
|
2848
2842
|
const checked = activeItems.map(stringifyName).includes(stringifyName(level));
|
|
2849
2843
|
if (!currentDrilldown) return;
|
|
2850
|
-
return /* @__PURE__ */ React10__default.createElement(React10__default.Fragment, null, /* @__PURE__ */ React10__default.createElement(Group, { mt: "sm", position: "apart", key: level.uri, noWrap: true }, /* @__PURE__ */ React10__default.createElement(
|
|
2844
|
+
return currentDrilldown && /* @__PURE__ */ React10__default.createElement(React10__default.Fragment, null, /* @__PURE__ */ React10__default.createElement(Group, { mt: "sm", position: "apart", key: level.uri, noWrap: true }, /* @__PURE__ */ React10__default.createElement(
|
|
2851
2845
|
Checkbox,
|
|
2852
2846
|
{
|
|
2853
2847
|
onChange: () => {
|
|
@@ -2855,7 +2849,6 @@ function LevelItem({ dimension, hierarchy, isSubMenu, level, locale, activeItems
|
|
|
2855
2849
|
const active = checked ? false : cut.members.length ? true : false;
|
|
2856
2850
|
actions2.updateCut({ ...cut, active });
|
|
2857
2851
|
}
|
|
2858
|
-
console.log({ currentDrilldown });
|
|
2859
2852
|
actions2.updateDrilldown({ ...currentDrilldown, active: !currentDrilldown.active });
|
|
2860
2853
|
},
|
|
2861
2854
|
checked,
|
|
@@ -3049,7 +3042,7 @@ function MeasuresOptions() {
|
|
|
3049
3042
|
}, [itemMap, measures, filtersMap, filtersItems]);
|
|
3050
3043
|
const activeItems = filteredItems.filter((f) => isActiveItem(f.measure));
|
|
3051
3044
|
const options = filteredItems.map(({ measure, filter }) => {
|
|
3052
|
-
return /* @__PURE__ */ React10__default.createElement(FilterItem4, { measure, filter, activeItems });
|
|
3045
|
+
return /* @__PURE__ */ React10__default.createElement(FilterItem4, { key: measure.key, measure, filter, activeItems });
|
|
3053
3046
|
});
|
|
3054
3047
|
return options;
|
|
3055
3048
|
}
|
|
@@ -3159,7 +3152,7 @@ function getFiltersConditions(fn, value) {
|
|
|
3159
3152
|
]);
|
|
3160
3153
|
return (_a = comparisonMap.get(fn)) == null ? void 0 : _a(value);
|
|
3161
3154
|
}
|
|
3162
|
-
function useTableData({
|
|
3155
|
+
function useTableData({ columns, filters, cuts, pagination }) {
|
|
3163
3156
|
const normalizedFilters = filters.map((filter) => ({
|
|
3164
3157
|
id: filter.measure,
|
|
3165
3158
|
value: getFilterValue(filter)
|
|
@@ -3205,7 +3198,8 @@ function usePrefetch({
|
|
|
3205
3198
|
columns,
|
|
3206
3199
|
cuts,
|
|
3207
3200
|
filters,
|
|
3208
|
-
pagination
|
|
3201
|
+
pagination,
|
|
3202
|
+
isFetching
|
|
3209
3203
|
}) {
|
|
3210
3204
|
const queryClient2 = useQueryClient();
|
|
3211
3205
|
const actions2 = useActions();
|
|
@@ -3223,7 +3217,7 @@ function usePrefetch({
|
|
|
3223
3217
|
const columnsStr = JSON.stringify(columns.sort());
|
|
3224
3218
|
const key = [columnsStr, filterKey, cutKey, page];
|
|
3225
3219
|
React10__default.useEffect(() => {
|
|
3226
|
-
if (!isPlaceholderData && hasMore) {
|
|
3220
|
+
if (!isPlaceholderData && hasMore && !isFetching) {
|
|
3227
3221
|
queryClient2.prefetchQuery({
|
|
3228
3222
|
queryKey: ["table", key],
|
|
3229
3223
|
queryFn: () => {
|
|
@@ -3236,7 +3230,7 @@ function usePrefetch({
|
|
|
3236
3230
|
staleTime: 3e5
|
|
3237
3231
|
});
|
|
3238
3232
|
}
|
|
3239
|
-
}, [
|
|
3233
|
+
}, [limit, page, isPlaceholderData, key, queryClient2, hasMore, off, isFetching]);
|
|
3240
3234
|
}
|
|
3241
3235
|
function useTable({
|
|
3242
3236
|
cube,
|
|
@@ -3276,8 +3270,8 @@ function useTable({
|
|
|
3276
3270
|
actions2.updateFilter(filter);
|
|
3277
3271
|
return filter;
|
|
3278
3272
|
}
|
|
3279
|
-
|
|
3280
|
-
|
|
3273
|
+
useLayoutEffect(() => {
|
|
3274
|
+
filterMap(measuresOlap, (m) => {
|
|
3281
3275
|
const measure = measuresMap[m.name] || handlerCreateMeasure({ ...m, active: false });
|
|
3282
3276
|
const foundFilter = filtersMap[m.name] || filterItems.find((f) => f.measure === measure.name);
|
|
3283
3277
|
const filter = foundFilter || handlerCreateFilter({
|
|
@@ -3289,8 +3283,6 @@ function useTable({
|
|
|
3289
3283
|
});
|
|
3290
3284
|
}, [measuresMap, measuresOlap, filtersMap, filterItems]);
|
|
3291
3285
|
const { isLoading, isFetching, isError, data, isPlaceholderData } = useTableData({
|
|
3292
|
-
offset,
|
|
3293
|
-
limit,
|
|
3294
3286
|
columns: finalUniqueKeys,
|
|
3295
3287
|
filters: filterItems.filter(isActiveItem),
|
|
3296
3288
|
cuts: itemsCuts.filter(isActiveCut),
|
|
@@ -3309,14 +3301,15 @@ function useTable({
|
|
|
3309
3301
|
columns: finalUniqueKeys,
|
|
3310
3302
|
filters: filterItems.filter(isActiveItem),
|
|
3311
3303
|
cuts: itemsCuts.filter(isActiveCut),
|
|
3312
|
-
pagination
|
|
3304
|
+
pagination,
|
|
3305
|
+
isFetching: isFetching || isLoading
|
|
3313
3306
|
});
|
|
3314
3307
|
useEffect(() => {
|
|
3315
3308
|
actions2.updatePagination({
|
|
3316
3309
|
limit: pagination.pageSize,
|
|
3317
3310
|
offset: pagination.pageIndex * pagination.pageSize
|
|
3318
3311
|
});
|
|
3319
|
-
}, [pagination]);
|
|
3312
|
+
}, [pagination, actions2]);
|
|
3320
3313
|
const { translate: t } = useTranslation();
|
|
3321
3314
|
const { currentFormats, getAvailableKeys, getFormatter, getFormatterKey, setFormat } = useFormatter(
|
|
3322
3315
|
cube.measures
|
|
@@ -3325,7 +3318,7 @@ function useTable({
|
|
|
3325
3318
|
const indexColumn = {
|
|
3326
3319
|
id: "#",
|
|
3327
3320
|
Header: "#",
|
|
3328
|
-
Cell: ({ row }) => row.index + 1,
|
|
3321
|
+
Cell: ({ row }) => row.index + 1 + offset,
|
|
3329
3322
|
minWidth: 50,
|
|
3330
3323
|
maxWidth: 50,
|
|
3331
3324
|
width: 50,
|
|
@@ -3979,6 +3972,11 @@ var Graph = class {
|
|
|
3979
3972
|
});
|
|
3980
3973
|
return topic;
|
|
3981
3974
|
}
|
|
3975
|
+
getName(node, locale) {
|
|
3976
|
+
const item = this.items.find((item2) => item2.name === node);
|
|
3977
|
+
const name4 = getAnnotation(item, "table", locale);
|
|
3978
|
+
return name4;
|
|
3979
|
+
}
|
|
3982
3980
|
getSubtopic(startingNode, locale) {
|
|
3983
3981
|
let found = false;
|
|
3984
3982
|
let subtopic = null;
|
|
@@ -4008,15 +4006,16 @@ var Graph = class {
|
|
|
4008
4006
|
"name",
|
|
4009
4007
|
(item) => getAnnotation(item, "topic", locale) || "",
|
|
4010
4008
|
(item) => getAnnotation(item, "subtopic", locale) || "",
|
|
4011
|
-
(item) => getAnnotation(item, "table", locale) || ""
|
|
4009
|
+
(item) => getAnnotation(item, "table", locale) || "",
|
|
4010
|
+
(item) => item.name.replace(/_/g, " ")
|
|
4012
4011
|
]
|
|
4013
4012
|
});
|
|
4014
4013
|
for (const item of results) {
|
|
4015
4014
|
const topic = getAnnotation(item, "topic", locale);
|
|
4016
4015
|
const subtopic = getAnnotation(item, "subtopic", locale);
|
|
4017
|
-
|
|
4018
|
-
addItemToSubtopic(map, `${topic} - ${subtopic}`,
|
|
4019
|
-
matches.push(
|
|
4016
|
+
getAnnotation(item, "table", locale);
|
|
4017
|
+
addItemToSubtopic(map, `${topic} - ${subtopic}`, item.name);
|
|
4018
|
+
matches.push(item.name);
|
|
4020
4019
|
}
|
|
4021
4020
|
}
|
|
4022
4021
|
return { matches, map };
|
|
@@ -4383,12 +4382,7 @@ init_esm_shims();
|
|
|
4383
4382
|
init_esm_shims();
|
|
4384
4383
|
function useSelectCube(onSelectCube) {
|
|
4385
4384
|
const { updateMeasure, updateCut, updateDrilldown, willFetchMembers: willFetchMembers2 } = useActions();
|
|
4386
|
-
|
|
4387
|
-
const cutItem = buildCut({ ...level });
|
|
4388
|
-
cutItem.active = false;
|
|
4389
|
-
updateCut(cutItem);
|
|
4390
|
-
}, []);
|
|
4391
|
-
const addDrilldown = useCallback((level, dimensions) => {
|
|
4385
|
+
useCallback((level, dimensions) => {
|
|
4392
4386
|
const drilldownItem = buildDrilldown(level);
|
|
4393
4387
|
createCutHandler2(level);
|
|
4394
4388
|
updateDrilldown(drilldownItem);
|
|
@@ -4403,13 +4397,34 @@ function useSelectCube(onSelectCube) {
|
|
|
4403
4397
|
});
|
|
4404
4398
|
});
|
|
4405
4399
|
}, []);
|
|
4400
|
+
const createCutHandler2 = React10__default.useCallback((level) => {
|
|
4401
|
+
const cutItem = buildCut({ ...level });
|
|
4402
|
+
cutItem.active = false;
|
|
4403
|
+
updateCut(cutItem);
|
|
4404
|
+
}, []);
|
|
4405
|
+
function createDrilldown(level, dimensions) {
|
|
4406
|
+
const drilldown = buildDrilldown({ ...level, key: stringifyName(level), active: true });
|
|
4407
|
+
updateDrilldown(drilldown);
|
|
4408
|
+
createCutHandler2({ ...level, key: stringifyName(level) });
|
|
4409
|
+
willFetchMembers2({ ...level, level: level.name }).then((members) => {
|
|
4410
|
+
const dimension = dimensions.find((dim) => dim.name === level.dimension);
|
|
4411
|
+
if (!dimension) return;
|
|
4412
|
+
updateDrilldown({
|
|
4413
|
+
...drilldown,
|
|
4414
|
+
dimType: dimension.dimensionType,
|
|
4415
|
+
memberCount: members.length,
|
|
4416
|
+
members
|
|
4417
|
+
});
|
|
4418
|
+
});
|
|
4419
|
+
return drilldown;
|
|
4420
|
+
}
|
|
4406
4421
|
return (item, subtopic) => () => onSelectCube(item, subtopic).then(({ cube, measures, dimensions }) => {
|
|
4407
4422
|
const [measure] = Object.values(measures);
|
|
4408
4423
|
const drilldowns = deriveDrilldowns(dimensions);
|
|
4409
4424
|
if (measure && drilldowns.length > 0) {
|
|
4410
4425
|
updateMeasure({ ...measure, active: true });
|
|
4411
4426
|
for (const level of drilldowns) {
|
|
4412
|
-
|
|
4427
|
+
createDrilldown(level, dimensions);
|
|
4413
4428
|
}
|
|
4414
4429
|
}
|
|
4415
4430
|
});
|
|
@@ -4427,6 +4442,7 @@ function Results(props) {
|
|
|
4427
4442
|
const [topic, subtopic] = key.split(" - ");
|
|
4428
4443
|
const component = /* @__PURE__ */ React10__default.createElement("div", { key }, /* @__PURE__ */ React10__default.createElement(Divider, { my: "xs", label: key }), items.map((item) => {
|
|
4429
4444
|
const cube = getCube2(graph.items, item, subtopic, locale);
|
|
4445
|
+
const table = getAnnotation(cube, "table", locale);
|
|
4430
4446
|
return /* @__PURE__ */ React10__default.createElement(
|
|
4431
4447
|
Text,
|
|
4432
4448
|
{
|
|
@@ -4440,7 +4456,7 @@ function Results(props) {
|
|
|
4440
4456
|
setInput("");
|
|
4441
4457
|
}
|
|
4442
4458
|
},
|
|
4443
|
-
|
|
4459
|
+
table
|
|
4444
4460
|
);
|
|
4445
4461
|
}));
|
|
4446
4462
|
result.push(component);
|
|
@@ -4485,32 +4501,38 @@ function SelectCubeInternal(props) {
|
|
|
4485
4501
|
useTranslation();
|
|
4486
4502
|
const { code: locale } = useSelector$1(selectLocale);
|
|
4487
4503
|
const { updateMeasure, updateDrilldown, willFetchMembers: willFetchMembers2, updateCut } = useActions();
|
|
4504
|
+
const cutItems = useSelector$1(selectCutItems);
|
|
4488
4505
|
const cube = useSelector$1(selectCubeName);
|
|
4489
4506
|
const itemMap = useSelector$1(selectMeasureMap);
|
|
4490
4507
|
const dimensions = useSelector$1(selectOlapDimensionItems);
|
|
4508
|
+
const drilldowns = useSelector$1(selectDrilldownMap);
|
|
4509
|
+
const ditems = useSelector$1(selectDrilldownItems);
|
|
4491
4510
|
const createCutHandler2 = React10__default.useCallback((level) => {
|
|
4492
4511
|
const cutItem = buildCut({ ...level });
|
|
4493
4512
|
cutItem.active = false;
|
|
4494
4513
|
updateCut(cutItem);
|
|
4495
4514
|
}, []);
|
|
4496
|
-
|
|
4497
|
-
(level) => {
|
|
4498
|
-
const
|
|
4499
|
-
|
|
4500
|
-
|
|
4501
|
-
|
|
4515
|
+
function createDrilldown(level, cuts) {
|
|
4516
|
+
if (!drilldowns[stringifyName(level)] && !ditems.find((d) => d.uniqueName === buildDrilldown(level).uniqueName)) {
|
|
4517
|
+
const drilldown = buildDrilldown({ ...level, key: stringifyName(level), active: true });
|
|
4518
|
+
updateDrilldown(drilldown);
|
|
4519
|
+
const cut = cuts.find((cut2) => cut2.uniqueName === drilldown.uniqueName);
|
|
4520
|
+
if (!cut) {
|
|
4521
|
+
createCutHandler2({ ...level, key: stringifyName(level) });
|
|
4522
|
+
}
|
|
4523
|
+
willFetchMembers2({ ...level, level: level.name }).then((members) => {
|
|
4502
4524
|
const dimension = dimensions.find((dim) => dim.name === level.dimension);
|
|
4503
4525
|
if (!dimension) return;
|
|
4504
|
-
|
|
4505
|
-
...
|
|
4526
|
+
updateDrilldown({
|
|
4527
|
+
...drilldown,
|
|
4506
4528
|
dimType: dimension.dimensionType,
|
|
4507
4529
|
memberCount: members.length,
|
|
4508
4530
|
members
|
|
4509
4531
|
});
|
|
4510
4532
|
});
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
|
|
4533
|
+
return drilldown;
|
|
4534
|
+
}
|
|
4535
|
+
}
|
|
4514
4536
|
useEffect(() => {
|
|
4515
4537
|
const params = new URLSearchParams(location.search);
|
|
4516
4538
|
const cubeParam = params.get("cube");
|
|
@@ -4519,11 +4541,11 @@ function SelectCubeInternal(props) {
|
|
|
4519
4541
|
const [dimension] = dimensions;
|
|
4520
4542
|
if (measure && dimension) {
|
|
4521
4543
|
updateMeasure({ ...measure, active: true });
|
|
4522
|
-
const
|
|
4523
|
-
if (measure &&
|
|
4544
|
+
const drilldowns2 = deriveDrilldowns(dimensions);
|
|
4545
|
+
if (measure && drilldowns2.length > 0) {
|
|
4524
4546
|
updateMeasure({ ...measure, active: true });
|
|
4525
|
-
for (const level of
|
|
4526
|
-
|
|
4547
|
+
for (const level of drilldowns2) {
|
|
4548
|
+
createDrilldown(level, cutItems);
|
|
4527
4549
|
}
|
|
4528
4550
|
}
|
|
4529
4551
|
}
|
|
@@ -4553,7 +4575,7 @@ function isSelected(selectedItem, currentItem) {
|
|
|
4553
4575
|
}
|
|
4554
4576
|
function getCube(items, table, subtopic, locale) {
|
|
4555
4577
|
const cube = items.find(
|
|
4556
|
-
(item) =>
|
|
4578
|
+
(item) => item.name === table && getAnnotation(item, "subtopic", locale) === subtopic
|
|
4557
4579
|
);
|
|
4558
4580
|
return cube;
|
|
4559
4581
|
}
|
|
@@ -4561,16 +4583,17 @@ function useBuildGraph(items, locale, graph, setGraph) {
|
|
|
4561
4583
|
useEffect(() => {
|
|
4562
4584
|
const graph2 = new graph_default();
|
|
4563
4585
|
items.map((item) => {
|
|
4586
|
+
const { name: name4 } = item;
|
|
4564
4587
|
const topic = getAnnotation(item, "topic", locale);
|
|
4565
4588
|
const subtopic = getAnnotation(item, "subtopic", locale);
|
|
4566
|
-
|
|
4589
|
+
getAnnotation(item, "table", locale);
|
|
4567
4590
|
const hide = getAnnotation(item, "hide_in_ui", locale);
|
|
4568
4591
|
if (!yn(hide)) {
|
|
4569
4592
|
graph2.addNode(topic);
|
|
4570
4593
|
graph2.addNode(subtopic);
|
|
4571
|
-
graph2.addNode(
|
|
4594
|
+
graph2.addNode(name4);
|
|
4572
4595
|
graph2.addEdge(topic, subtopic);
|
|
4573
|
-
graph2.addEdge(subtopic,
|
|
4596
|
+
graph2.addEdge(subtopic, name4);
|
|
4574
4597
|
}
|
|
4575
4598
|
return item;
|
|
4576
4599
|
});
|
|
@@ -4590,9 +4613,12 @@ function CubeTree({
|
|
|
4590
4613
|
const actions2 = useActions();
|
|
4591
4614
|
const onSelectCube = (table, subtopic) => {
|
|
4592
4615
|
const cube = items.find(
|
|
4593
|
-
(item) =>
|
|
4616
|
+
(item) => item.name === table && getAnnotation(item, "subtopic", locale) === subtopic
|
|
4594
4617
|
);
|
|
4595
4618
|
if (cube) {
|
|
4619
|
+
actions2.resetDrilldowns({});
|
|
4620
|
+
actions2.resetCuts({});
|
|
4621
|
+
actions2.resetMeasures({});
|
|
4596
4622
|
return actions2.willSetCube(cube.name);
|
|
4597
4623
|
}
|
|
4598
4624
|
};
|
|
@@ -4690,7 +4716,7 @@ function CubeButton({
|
|
|
4690
4716
|
}) {
|
|
4691
4717
|
const callback = useSelectCube(onSelectCube);
|
|
4692
4718
|
const { classes } = useStyles3();
|
|
4693
|
-
const table = item;
|
|
4719
|
+
const table = graph.getName(item, locale);
|
|
4694
4720
|
const subtopic = parent != null ? parent : "";
|
|
4695
4721
|
return /* @__PURE__ */ React10__default.createElement(
|
|
4696
4722
|
Text,
|
|
@@ -4701,14 +4727,14 @@ function CubeButton({
|
|
|
4701
4727
|
maw: "100%",
|
|
4702
4728
|
pr: "md",
|
|
4703
4729
|
component: "a",
|
|
4704
|
-
className: isSelected(selectedItem, getCube(graph.items,
|
|
4730
|
+
className: isSelected(selectedItem, getCube(graph.items, item, subtopic, locale)) ? `${classes.link} ${classes.linkActive}` : classes.link,
|
|
4705
4731
|
sx: (t) => ({
|
|
4706
|
-
background: isSelected(selectedItem, getCube(graph.items,
|
|
4732
|
+
background: isSelected(selectedItem, getCube(graph.items, item, subtopic, locale)) ? t.fn.primaryColor() : t.colorScheme === "dark" ? t.colors.dark[6] : t.colors.gray[3],
|
|
4707
4733
|
overflow: "hidden"
|
|
4708
4734
|
}),
|
|
4709
4735
|
onClick: callback(item, subtopic)
|
|
4710
4736
|
},
|
|
4711
|
-
|
|
4737
|
+
table
|
|
4712
4738
|
);
|
|
4713
4739
|
}
|
|
4714
4740
|
function SubtopicAccordion({
|