@datawheel/data-explorer 1.1.16 → 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.mjs +53 -70
- package/package.json +1 -1
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) => ({
|