@datawheel/data-explorer 1.1.15 → 1.1.17
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 +7 -0
- package/dist/main.mjs +156 -88
- package/package.json +1 -1
package/dist/main.d.mts
CHANGED
|
@@ -1102,6 +1102,13 @@ declare function ExplorerComponent<Locale extends string>(props: {
|
|
|
1102
1102
|
* @default "en"
|
|
1103
1103
|
*/
|
|
1104
1104
|
defaultLocale?: Locale;
|
|
1105
|
+
/**
|
|
1106
|
+
* The locale to use for sorting cube items within the SelectCubes component.
|
|
1107
|
+
* This controls the sorting of subtopics and cube buttons.
|
|
1108
|
+
* If not set, the defaultLocale will be used.
|
|
1109
|
+
* @default undefined
|
|
1110
|
+
*/
|
|
1111
|
+
sortLocale?: string;
|
|
1105
1112
|
/**
|
|
1106
1113
|
* Specifies which property should be used to filter elements in the member
|
|
1107
1114
|
* selection control of the Cuts parameter area.
|
package/dist/main.mjs
CHANGED
|
@@ -1990,11 +1990,11 @@ function QueryProvider({ children, defaultCube }) {
|
|
|
1990
1990
|
if (currentDrilldown && currentDrilldown.members && currentDrilldown.members.length > 0 && !localeChanged && cube === queryItem.params.cube) {
|
|
1991
1991
|
return Promise.resolve({
|
|
1992
1992
|
drilldown: currentDrilldown,
|
|
1993
|
-
cut: buildCut({ ...currentDrilldown, active: false })
|
|
1993
|
+
cut: buildCut({ ...currentDrilldown, active: false, members: [] })
|
|
1994
1994
|
});
|
|
1995
1995
|
} else {
|
|
1996
1996
|
return fetchMembers(dd.level, newQuery == null ? void 0 : newQuery.params.locale, cube).then((levelMeta) => {
|
|
1997
|
-
const cut = buildCut({ ...dd, active: false });
|
|
1997
|
+
const cut = buildCut({ ...dd, active: false, members: [] });
|
|
1998
1998
|
return {
|
|
1999
1999
|
drilldown: {
|
|
2000
2000
|
...dd,
|
|
@@ -3388,53 +3388,38 @@ function FullScreenSVG() {
|
|
|
3388
3388
|
function isColumnSorted(column, key) {
|
|
3389
3389
|
return column == key;
|
|
3390
3390
|
}
|
|
3391
|
-
var
|
|
3392
|
-
const properties = item.properties.map(
|
|
3393
|
-
(prop) => buildProperty({
|
|
3394
|
-
...prop,
|
|
3395
|
-
active: activeProps.includes(prop.key)
|
|
3396
|
-
})
|
|
3397
|
-
);
|
|
3398
|
-
actions2.updateDrilldown({ ...item, properties });
|
|
3399
|
-
};
|
|
3400
|
-
var removeColumn = (actions2, entity, measures, drilldowns, type, queryItem, updateURL) => {
|
|
3391
|
+
var removeColumn = (queryItem, entity) => {
|
|
3401
3392
|
const newQuery = buildQuery(cloneDeep(queryItem));
|
|
3393
|
+
const params = newQuery.params;
|
|
3402
3394
|
if ("aggregator" in entity) {
|
|
3403
|
-
const measure = measures
|
|
3395
|
+
const measure = params.measures[entity.name];
|
|
3404
3396
|
if (measure) {
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
newQuery.params.measures[newMeasure.name] = newMeasure;
|
|
3408
|
-
updateURL({
|
|
3409
|
-
...newQuery,
|
|
3410
|
-
params: {
|
|
3411
|
-
...newQuery.params
|
|
3412
|
-
}
|
|
3413
|
-
});
|
|
3397
|
+
params.measures[entity.name] = { ...measure, active: false };
|
|
3398
|
+
return newQuery;
|
|
3414
3399
|
}
|
|
3415
|
-
}
|
|
3416
|
-
|
|
3417
|
-
|
|
3400
|
+
} else if ("depth" in entity) {
|
|
3401
|
+
const cut = params.cuts[entity.name];
|
|
3402
|
+
if (cut) {
|
|
3403
|
+
params.cuts[cut.key] = { ...cut, active: false };
|
|
3404
|
+
}
|
|
3405
|
+
const drilldown = params.drilldowns[entity.name];
|
|
3418
3406
|
if (drilldown) {
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
newQuery.params.drilldowns[newDrilldown.key] = newDrilldown;
|
|
3422
|
-
updateURL({
|
|
3423
|
-
...newQuery,
|
|
3424
|
-
params: {
|
|
3425
|
-
...newQuery.params
|
|
3426
|
-
}
|
|
3427
|
-
});
|
|
3407
|
+
params.drilldowns[drilldown.key] = { ...drilldown, active: false };
|
|
3408
|
+
return newQuery;
|
|
3428
3409
|
}
|
|
3429
|
-
}
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
const drilldown = activeDrilldowns.find(
|
|
3433
|
-
(dd) => dd.properties.some((property) => property.name === entity.name)
|
|
3410
|
+
} else if ("level" in entity) {
|
|
3411
|
+
const mapPropertyToDrilldown = Object.fromEntries(
|
|
3412
|
+
Object.values(params.drilldowns).filter((drilldown2) => drilldown2.active).flatMap((drilldown2) => drilldown2.properties.map((prop) => [prop.name, drilldown2]))
|
|
3434
3413
|
);
|
|
3435
|
-
const
|
|
3436
|
-
if (drilldown
|
|
3437
|
-
|
|
3414
|
+
const drilldown = mapPropertyToDrilldown[entity.name];
|
|
3415
|
+
if (drilldown) {
|
|
3416
|
+
params.drilldowns[drilldown.key] = {
|
|
3417
|
+
...drilldown,
|
|
3418
|
+
properties: drilldown.properties.map(
|
|
3419
|
+
(prop) => prop.name === entity.name ? { ...prop, active: false } : prop
|
|
3420
|
+
)
|
|
3421
|
+
};
|
|
3422
|
+
return newQuery;
|
|
3438
3423
|
}
|
|
3439
3424
|
}
|
|
3440
3425
|
};
|
|
@@ -3738,15 +3723,11 @@ function useTable({
|
|
|
3738
3723
|
key: `remove-${column2.columnDef.header}`,
|
|
3739
3724
|
disabled: !showTrashIcon(finalKeys, entityType) || isLoading || isFetching,
|
|
3740
3725
|
onClick: () => {
|
|
3741
|
-
removeColumn(
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
entityType,
|
|
3747
|
-
queryItem,
|
|
3748
|
-
updateURL
|
|
3749
|
-
);
|
|
3726
|
+
const nextQueryItem = removeColumn(queryItem, entity);
|
|
3727
|
+
if (nextQueryItem) {
|
|
3728
|
+
actions2.resetAllParams(nextQueryItem.params);
|
|
3729
|
+
updateURL(nextQueryItem);
|
|
3730
|
+
}
|
|
3750
3731
|
},
|
|
3751
3732
|
showTooltip: !showTrashIcon(finalKeys, entityType),
|
|
3752
3733
|
size: 25,
|
|
@@ -4296,12 +4277,11 @@ function LevelItem({
|
|
|
4296
4277
|
activeItems,
|
|
4297
4278
|
depth = 0
|
|
4298
4279
|
}) {
|
|
4299
|
-
const [activeFilter, setActiveFilter] = useState(false);
|
|
4300
4280
|
const [activePropertiesFilter, setActiveProperties] = useState(false);
|
|
4301
4281
|
const { translate: t } = useTranslation();
|
|
4302
4282
|
const actions2 = useActions();
|
|
4303
4283
|
const cutItems = useSelector$1(selectCutItems);
|
|
4304
|
-
|
|
4284
|
+
const drilldowns = useSelector$1(selectDrilldownMap);
|
|
4305
4285
|
useSelector$1(selectDrilldownItems);
|
|
4306
4286
|
const { idFormatters } = useidFormatters();
|
|
4307
4287
|
const label = useMemo(() => {
|
|
@@ -4324,12 +4304,7 @@ function LevelItem({
|
|
|
4324
4304
|
const isOtherHierarchySelected = activeItems.some(
|
|
4325
4305
|
(activeItem) => activeItem.dimension === dimension.name && activeItem.hierarchy !== hierarchy.name
|
|
4326
4306
|
);
|
|
4327
|
-
const cut = cutItems.find((cut2) =>
|
|
4328
|
-
return cut2.level === (currentDrilldown == null ? void 0 : currentDrilldown.level);
|
|
4329
|
-
});
|
|
4330
|
-
const updatecutHandler = (item, members) => {
|
|
4331
|
-
actions2.updateCut({ ...item, members });
|
|
4332
|
-
};
|
|
4307
|
+
const cut = cutItems.find((cut2) => cut2.level === level.name);
|
|
4333
4308
|
const checked = activeItems.map((i) => i.level).includes(level.name);
|
|
4334
4309
|
const disableUncheck = activeItems.length === 1 && checked;
|
|
4335
4310
|
const isDisabled = isOtherHierarchySelected && !checked;
|
|
@@ -4345,6 +4320,8 @@ function LevelItem({
|
|
|
4345
4320
|
...currentDrilldown,
|
|
4346
4321
|
active: !currentDrilldown.active
|
|
4347
4322
|
});
|
|
4323
|
+
if (cut && cut.members.length > 0)
|
|
4324
|
+
actions2.updateCut({ ...cut, active: !cut.active });
|
|
4348
4325
|
},
|
|
4349
4326
|
checked,
|
|
4350
4327
|
label,
|
|
@@ -4356,22 +4333,28 @@ function LevelItem({
|
|
|
4356
4333
|
{
|
|
4357
4334
|
className: "dex-level-filter",
|
|
4358
4335
|
size: "sm",
|
|
4359
|
-
onClick: () =>
|
|
4336
|
+
onClick: () => {
|
|
4337
|
+
const nextCut = buildCut(cut || level);
|
|
4338
|
+
if (cut == null ? void 0 : cut.active) {
|
|
4339
|
+
nextCut.active = false;
|
|
4340
|
+
actions2.updateCut(nextCut);
|
|
4341
|
+
} else {
|
|
4342
|
+
actions2.updateDrilldown({ ...currentDrilldown, active: true });
|
|
4343
|
+
nextCut.active = true;
|
|
4344
|
+
actions2.updateCut(nextCut);
|
|
4345
|
+
}
|
|
4346
|
+
},
|
|
4360
4347
|
disabled: isDisabled
|
|
4361
4348
|
},
|
|
4362
|
-
|
|
4363
|
-
), properties && /* @__PURE__ */ React21__default.createElement(Tooltip, { label: t("params.add_metadata") }, /* @__PURE__ */ React21__default.createElement(ActionIcon, { onClick: () => setActiveProperties((value) => !value) }, /* @__PURE__ */ React21__default.createElement(IconAdjustments, null))), /* @__PURE__ */ React21__default.createElement(ThemeIcon, { size: "xs", color: "gray", variant: "light", bg: "transparent" }, /* @__PURE__ */ React21__default.createElement(StackSVG, null)))),
|
|
4349
|
+
(cut == null ? void 0 : cut.active) ? /* @__PURE__ */ React21__default.createElement(IconFilterOff, null) : /* @__PURE__ */ React21__default.createElement(IconFilter, null)
|
|
4350
|
+
), properties && /* @__PURE__ */ React21__default.createElement(Tooltip, { label: t("params.add_metadata") }, /* @__PURE__ */ React21__default.createElement(ActionIcon, { onClick: () => setActiveProperties((value) => !value) }, /* @__PURE__ */ React21__default.createElement(IconAdjustments, null))), /* @__PURE__ */ React21__default.createElement(ThemeIcon, { size: "xs", color: "gray", variant: "light", bg: "transparent" }, /* @__PURE__ */ React21__default.createElement(StackSVG, null)))), (cut == null ? void 0 : cut.active) && /* @__PURE__ */ React21__default.createElement(Box, { pt: "md" }, /* @__PURE__ */ React21__default.createElement(
|
|
4364
4351
|
MultiSelect,
|
|
4365
4352
|
{
|
|
4366
4353
|
sx: { flex: "1 1 100%" },
|
|
4367
4354
|
searchable: true,
|
|
4368
|
-
onChange: (
|
|
4355
|
+
onChange: (members) => {
|
|
4369
4356
|
if (cut) {
|
|
4370
|
-
|
|
4371
|
-
updatecutHandler({ ...cut, active: true }, value);
|
|
4372
|
-
} else {
|
|
4373
|
-
updatecutHandler(cut, value);
|
|
4374
|
-
}
|
|
4357
|
+
actions2.updateCut({ ...cut, active: currentDrilldown.active, members });
|
|
4375
4358
|
}
|
|
4376
4359
|
},
|
|
4377
4360
|
placeholder: `Filter by ${label}`,
|
|
@@ -4396,7 +4379,7 @@ function PropertiesMultiSelect({ item }) {
|
|
|
4396
4379
|
const locale = useSelector$1(selectLocale);
|
|
4397
4380
|
const actions2 = useActions();
|
|
4398
4381
|
const { translate: t } = useTranslation();
|
|
4399
|
-
const
|
|
4382
|
+
const propertiesUpdateHandler = useCallback(
|
|
4400
4383
|
(activeProps) => {
|
|
4401
4384
|
const properties = item.properties.map(
|
|
4402
4385
|
(prop) => buildProperty({
|
|
@@ -4428,7 +4411,7 @@ function PropertiesMultiSelect({ item }) {
|
|
|
4428
4411
|
{
|
|
4429
4412
|
sx: { flex: "1 1 100%" },
|
|
4430
4413
|
searchable: true,
|
|
4431
|
-
onChange:
|
|
4414
|
+
onChange: propertiesUpdateHandler,
|
|
4432
4415
|
value: activeProperties || [],
|
|
4433
4416
|
placeholder: `Filter by ${label}`,
|
|
4434
4417
|
data: item.properties.map((property) => ({
|
|
@@ -5468,14 +5451,20 @@ function SuccessResult(props) {
|
|
|
5468
5451
|
);
|
|
5469
5452
|
}
|
|
5470
5453
|
function Results(props) {
|
|
5471
|
-
const { graph, selectedItem, locale, getCube: getCube2, isSelected: isSelected2 } = props;
|
|
5454
|
+
const { graph, selectedItem, locale, sortLocale, getCube: getCube2, isSelected: isSelected2 } = props;
|
|
5472
5455
|
const { classes } = useStyles4();
|
|
5473
5456
|
const { setExpanded, setInput, map } = useSideBar();
|
|
5474
5457
|
const { onChangeCube } = useQueryItem();
|
|
5475
5458
|
const results = [...map].flatMap((entry) => {
|
|
5476
5459
|
const [key, items] = entry;
|
|
5477
5460
|
const [topic, subtopic] = key.split(" - ");
|
|
5478
|
-
const topicResults = items.
|
|
5461
|
+
const topicResults = [...items].sort((a, b) => {
|
|
5462
|
+
const cubeA = getCube2(graph.items, a, subtopic, locale);
|
|
5463
|
+
const cubeB = getCube2(graph.items, b, subtopic, locale);
|
|
5464
|
+
const aSort = cubeA ? getAnnotation(cubeA, "table", sortLocale) || a : a;
|
|
5465
|
+
const bSort = cubeB ? getAnnotation(cubeB, "table", sortLocale) || b : b;
|
|
5466
|
+
return aSort.localeCompare(bSort, sortLocale, { sensitivity: "base" });
|
|
5467
|
+
}).map((item) => {
|
|
5479
5468
|
const cube = getCube2(graph.items, item, subtopic, locale);
|
|
5480
5469
|
if (!cube) return null;
|
|
5481
5470
|
const table = getAnnotation(cube, "table", locale);
|
|
@@ -5539,7 +5528,7 @@ var useStyles4 = createStyles((t) => ({
|
|
|
5539
5528
|
var loadingCubes = Array.from({ length: 10 }, (v, index) => ({
|
|
5540
5529
|
id: `loading-cube-${index}`
|
|
5541
5530
|
}));
|
|
5542
|
-
function SelectCubes({ locale }) {
|
|
5531
|
+
function SelectCubes({ locale, sortLocale }) {
|
|
5543
5532
|
const items = useCubeItems();
|
|
5544
5533
|
const selectedItem = useSelectedItem();
|
|
5545
5534
|
const { schemaLoading } = useQueryItem();
|
|
@@ -5549,11 +5538,27 @@ function SelectCubes({ locale }) {
|
|
|
5549
5538
|
if (items.length === 1) {
|
|
5550
5539
|
return null;
|
|
5551
5540
|
}
|
|
5552
|
-
return /* @__PURE__ */ React21__default.createElement(
|
|
5541
|
+
return /* @__PURE__ */ React21__default.createElement(
|
|
5542
|
+
SelectCubeInternal,
|
|
5543
|
+
{
|
|
5544
|
+
items,
|
|
5545
|
+
selectedItem,
|
|
5546
|
+
locale,
|
|
5547
|
+
sortLocale: sortLocale || locale
|
|
5548
|
+
}
|
|
5549
|
+
);
|
|
5553
5550
|
}
|
|
5554
5551
|
function SelectCubeInternal(props) {
|
|
5555
|
-
const { items, selectedItem, locale } = props;
|
|
5556
|
-
return /* @__PURE__ */ React21__default.createElement(Stack, { id: "dex-select-cube", spacing: "xs", w: "100%" }, /* @__PURE__ */ React21__default.createElement(
|
|
5552
|
+
const { items, selectedItem, locale, sortLocale } = props;
|
|
5553
|
+
return /* @__PURE__ */ React21__default.createElement(Stack, { id: "dex-select-cube", spacing: "xs", w: "100%" }, /* @__PURE__ */ React21__default.createElement(
|
|
5554
|
+
CubeTree,
|
|
5555
|
+
{
|
|
5556
|
+
items,
|
|
5557
|
+
locale,
|
|
5558
|
+
selectedItem,
|
|
5559
|
+
sortLocale
|
|
5560
|
+
}
|
|
5561
|
+
));
|
|
5557
5562
|
}
|
|
5558
5563
|
function AccordionControl(props) {
|
|
5559
5564
|
return /* @__PURE__ */ React21__default.createElement(Box, { sx: { display: "flex", alignItems: "center" } }, /* @__PURE__ */ React21__default.createElement(Accordion.Control, { ...props }));
|
|
@@ -5571,19 +5576,22 @@ function getKeys2(items, k, locale, filter) {
|
|
|
5571
5576
|
return Array.from(keys);
|
|
5572
5577
|
}
|
|
5573
5578
|
function isSelected(selectedItem, currentItem) {
|
|
5574
|
-
if (selectedItem && currentItem) {
|
|
5579
|
+
if (selectedItem && currentItem && selectedItem.name && currentItem.name) {
|
|
5575
5580
|
return selectedItem.name === currentItem.name;
|
|
5576
5581
|
}
|
|
5582
|
+
return false;
|
|
5577
5583
|
}
|
|
5578
5584
|
function getCube(items, name4, subtopic, locale) {
|
|
5585
|
+
if (!Array.isArray(items)) return void 0;
|
|
5579
5586
|
const cube = items.find(
|
|
5580
|
-
(item) => item.name === name4 && getAnnotation(item, "subtopic", locale) === subtopic
|
|
5587
|
+
(item) => item && item.name === name4 && getAnnotation(item, "subtopic", locale) === subtopic
|
|
5581
5588
|
);
|
|
5582
5589
|
return cube;
|
|
5583
5590
|
}
|
|
5584
5591
|
function CubeTree({
|
|
5585
5592
|
locale,
|
|
5586
|
-
selectedItem
|
|
5593
|
+
selectedItem,
|
|
5594
|
+
sortLocale
|
|
5587
5595
|
}) {
|
|
5588
5596
|
const { map, input, graph } = useSideBar();
|
|
5589
5597
|
const { translate: t } = useTranslation();
|
|
@@ -5591,6 +5599,10 @@ function CubeTree({
|
|
|
5591
5599
|
() => getKeys2(graph.items, "topic", locale),
|
|
5592
5600
|
[graph.items, locale]
|
|
5593
5601
|
);
|
|
5602
|
+
const sortTopics = useMemo(
|
|
5603
|
+
() => getKeys2(graph.items, "topic", sortLocale),
|
|
5604
|
+
[graph.items, sortLocale]
|
|
5605
|
+
);
|
|
5594
5606
|
if (input.length > 0 && map && !(map.size > 0)) {
|
|
5595
5607
|
return /* @__PURE__ */ React21__default.createElement(Text, { ta: "center", fz: "xs", my: "sm", italic: true }, t("params.label_no_results"));
|
|
5596
5608
|
}
|
|
@@ -5601,9 +5613,20 @@ function CubeTree({
|
|
|
5601
5613
|
getCube,
|
|
5602
5614
|
isSelected,
|
|
5603
5615
|
graph,
|
|
5604
|
-
locale
|
|
5616
|
+
locale,
|
|
5617
|
+
sortLocale
|
|
5618
|
+
}
|
|
5619
|
+
) : graph.items.length > 0 && /* @__PURE__ */ React21__default.createElement(
|
|
5620
|
+
RootAccordions,
|
|
5621
|
+
{
|
|
5622
|
+
items: topics,
|
|
5623
|
+
sortItems: sortTopics,
|
|
5624
|
+
graph,
|
|
5625
|
+
selectedItem,
|
|
5626
|
+
locale,
|
|
5627
|
+
sortLocale
|
|
5605
5628
|
}
|
|
5606
|
-
)
|
|
5629
|
+
);
|
|
5607
5630
|
}
|
|
5608
5631
|
function useAccordionValue(key, locale) {
|
|
5609
5632
|
const selectedItem = useSelectedItem();
|
|
@@ -5616,7 +5639,7 @@ function useAccordionValue(key, locale) {
|
|
|
5616
5639
|
}, [key, selectedItem, locale]);
|
|
5617
5640
|
return { value, setValue };
|
|
5618
5641
|
}
|
|
5619
|
-
function RootAccordions({ items, graph, locale, selectedItem }) {
|
|
5642
|
+
function RootAccordions({ items, sortItems, graph, locale, selectedItem, sortLocale }) {
|
|
5620
5643
|
const { value, setValue } = useAccordionValue("topic", locale);
|
|
5621
5644
|
return /* @__PURE__ */ React21__default.createElement(
|
|
5622
5645
|
Accordion,
|
|
@@ -5649,14 +5672,19 @@ function RootAccordions({ items, graph, locale, selectedItem }) {
|
|
|
5649
5672
|
})
|
|
5650
5673
|
},
|
|
5651
5674
|
items.sort((a, b) => graph.topicOrder[a] - graph.topicOrder[b]).map((item) => {
|
|
5675
|
+
const sortItem = sortItems.find(
|
|
5676
|
+
(topic) => graph.topicOrder[topic] === graph.topicOrder[item]
|
|
5677
|
+
) || item;
|
|
5652
5678
|
return /* @__PURE__ */ React21__default.createElement(Accordion.Item, { value: `topic-${item}`, key: `topic-${item}` }, /* @__PURE__ */ React21__default.createElement(AccordionControl, null, item), /* @__PURE__ */ React21__default.createElement(Accordion.Panel, null, /* @__PURE__ */ React21__default.createElement(
|
|
5653
5679
|
SubtopicAccordion,
|
|
5654
5680
|
{
|
|
5655
5681
|
graph,
|
|
5656
5682
|
parent: item,
|
|
5683
|
+
sortParent: sortItem,
|
|
5657
5684
|
items: graph.adjList[item],
|
|
5658
5685
|
key: item,
|
|
5659
5686
|
locale,
|
|
5687
|
+
sortLocale,
|
|
5660
5688
|
selectedItem
|
|
5661
5689
|
}
|
|
5662
5690
|
)));
|
|
@@ -5668,12 +5696,13 @@ function CubeButton({
|
|
|
5668
5696
|
selectedItem,
|
|
5669
5697
|
graph,
|
|
5670
5698
|
locale,
|
|
5699
|
+
sortLocale,
|
|
5671
5700
|
parent
|
|
5672
5701
|
}) {
|
|
5673
5702
|
const { onChangeCube, membersLoading, schemaLoading } = useQueryItem();
|
|
5674
5703
|
const { classes } = useStyles4();
|
|
5675
5704
|
const isSelectionInProgress = membersLoading || schemaLoading;
|
|
5676
|
-
const table = graph.getName(item, locale);
|
|
5705
|
+
const table = graph.getName ? graph.getName(item, locale) : item;
|
|
5677
5706
|
const subtopic = parent != null ? parent : "";
|
|
5678
5707
|
const handleClick = () => {
|
|
5679
5708
|
onChangeCube(item, subtopic);
|
|
@@ -5706,8 +5735,10 @@ function SubtopicAccordion({
|
|
|
5706
5735
|
items,
|
|
5707
5736
|
graph,
|
|
5708
5737
|
parent,
|
|
5738
|
+
sortParent,
|
|
5709
5739
|
selectedItem,
|
|
5710
|
-
locale
|
|
5740
|
+
locale,
|
|
5741
|
+
sortLocale
|
|
5711
5742
|
}) {
|
|
5712
5743
|
const { value, setValue } = useAccordionValue("subtopic", locale);
|
|
5713
5744
|
return /* @__PURE__ */ React21__default.createElement(
|
|
@@ -5736,8 +5767,42 @@ function SubtopicAccordion({
|
|
|
5736
5767
|
}
|
|
5737
5768
|
})
|
|
5738
5769
|
},
|
|
5739
|
-
[...items].sort((a, b) =>
|
|
5740
|
-
const
|
|
5770
|
+
[...items].sort((a, b) => {
|
|
5771
|
+
const aLabel = graph.items.find(
|
|
5772
|
+
(cube) => getAnnotation(cube, "topic", locale) === parent && getAnnotation(cube, "subtopic", locale) === a
|
|
5773
|
+
);
|
|
5774
|
+
const bLabel = graph.items.find(
|
|
5775
|
+
(cube) => getAnnotation(cube, "topic", locale) === parent && getAnnotation(cube, "subtopic", locale) === b
|
|
5776
|
+
);
|
|
5777
|
+
const aSort = aLabel ? getAnnotation(aLabel, "subtopic", sortLocale) || a : a;
|
|
5778
|
+
const bSort = bLabel ? getAnnotation(bLabel, "subtopic", sortLocale) || b : b;
|
|
5779
|
+
return aSort.localeCompare(bSort, sortLocale, { sensitivity: "base" });
|
|
5780
|
+
}).map((item, index) => {
|
|
5781
|
+
let sortSubtopic = item;
|
|
5782
|
+
if (sortParent && item) {
|
|
5783
|
+
const hasCubeInLocale = graph.items.some(
|
|
5784
|
+
(cube) => getAnnotation(cube, "topic", locale) === parent && getAnnotation(cube, "subtopic", locale) === item
|
|
5785
|
+
);
|
|
5786
|
+
if (hasCubeInLocale) {
|
|
5787
|
+
const matchingCube = graph.items.find(
|
|
5788
|
+
(cube) => getAnnotation(cube, "topic", sortLocale) === sortParent && getAnnotation(cube, "subtopic", locale) === item
|
|
5789
|
+
);
|
|
5790
|
+
if (matchingCube) {
|
|
5791
|
+
const annotatedSubtopic = getAnnotation(matchingCube, "subtopic", sortLocale);
|
|
5792
|
+
if (annotatedSubtopic) {
|
|
5793
|
+
sortSubtopic = annotatedSubtopic;
|
|
5794
|
+
}
|
|
5795
|
+
}
|
|
5796
|
+
}
|
|
5797
|
+
}
|
|
5798
|
+
const adjListItem = graph.adjList[sortSubtopic];
|
|
5799
|
+
const filtered = adjListItem ? [...adjListItem].filter((value2) => value2 !== parent).sort((a, b) => {
|
|
5800
|
+
const aLabel = graph.items.find((cube) => cube && cube.name === a);
|
|
5801
|
+
const bLabel = graph.items.find((cube) => cube && cube.name === b);
|
|
5802
|
+
const aSort = aLabel ? getAnnotation(aLabel, "table", sortLocale) || a : a;
|
|
5803
|
+
const bSort = bLabel ? getAnnotation(bLabel, "table", sortLocale) || b : b;
|
|
5804
|
+
return aSort.localeCompare(bSort, sortLocale, { sensitivity: "base" });
|
|
5805
|
+
}) : [];
|
|
5741
5806
|
return /* @__PURE__ */ React21__default.createElement(Accordion.Item, { value: `subtopic-${item}`, key: `subtopic-${item}-${index}` }, /* @__PURE__ */ React21__default.createElement(AccordionControl, null, item), /* @__PURE__ */ React21__default.createElement(Accordion.Panel, null, filtered.map((table, index2) => /* @__PURE__ */ React21__default.createElement(
|
|
5742
5807
|
CubeButton,
|
|
5743
5808
|
{
|
|
@@ -5745,6 +5810,7 @@ function SubtopicAccordion({
|
|
|
5745
5810
|
graph,
|
|
5746
5811
|
item: table,
|
|
5747
5812
|
locale,
|
|
5813
|
+
sortLocale,
|
|
5748
5814
|
selectedItem,
|
|
5749
5815
|
parent: item
|
|
5750
5816
|
}
|
|
@@ -5788,7 +5854,7 @@ function ExplorerContent(props) {
|
|
|
5788
5854
|
const SplashComponent = props.splash;
|
|
5789
5855
|
return SplashComponent ? /* @__PURE__ */ React21__default.createElement(SplashComponent, { translation }) : /* @__PURE__ */ React21__default.createElement(Center, { h: "100%", sx: { flex: 1 } }, /* @__PURE__ */ React21__default.createElement(AnimatedCube, null));
|
|
5790
5856
|
}, [props.splash, translation]);
|
|
5791
|
-
return /* @__PURE__ */ React21__default.createElement("div", { className: classes.container }, /* @__PURE__ */ React21__default.createElement("div", { className: classes.root }, /* @__PURE__ */ React21__default.createElement(SideBarProvider, { locale: defaultLocale }, /* @__PURE__ */ React21__default.createElement(SideBar_default, null, /* @__PURE__ */ React21__default.createElement(SideBarItem, null, /* @__PURE__ */ React21__default.createElement(SelectCubes, { locale: defaultLocale }))), /* @__PURE__ */ React21__default.createElement(
|
|
5857
|
+
return /* @__PURE__ */ React21__default.createElement("div", { className: classes.container }, /* @__PURE__ */ React21__default.createElement("div", { className: classes.root }, /* @__PURE__ */ React21__default.createElement(SideBarProvider, { locale: defaultLocale }, /* @__PURE__ */ React21__default.createElement(SideBar_default, null, /* @__PURE__ */ React21__default.createElement(SideBarItem, null, /* @__PURE__ */ React21__default.createElement(SelectCubes, { locale: defaultLocale, sortLocale: props.sortLocale || defaultLocale }))), /* @__PURE__ */ React21__default.createElement(
|
|
5792
5858
|
ExplorerResults,
|
|
5793
5859
|
{
|
|
5794
5860
|
className: classes.flexCol,
|
|
@@ -6761,6 +6827,7 @@ function ExplorerComponent(props) {
|
|
|
6761
6827
|
var _a;
|
|
6762
6828
|
const {
|
|
6763
6829
|
defaultLocale = "en",
|
|
6830
|
+
sortLocale,
|
|
6764
6831
|
defaultOpenParams = "measures",
|
|
6765
6832
|
height = "100vh",
|
|
6766
6833
|
withinMantineProvider = true,
|
|
@@ -6823,7 +6890,8 @@ function ExplorerComponent(props) {
|
|
|
6823
6890
|
serverConfig: props.serverConfig,
|
|
6824
6891
|
serverURL: props.serverURL,
|
|
6825
6892
|
splash: props.splash,
|
|
6826
|
-
withMultiQuery
|
|
6893
|
+
withMultiQuery,
|
|
6894
|
+
sortLocale
|
|
6827
6895
|
}
|
|
6828
6896
|
))))
|
|
6829
6897
|
));
|