@datawheel/bespoke 0.3.0 → 0.3.2
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/index.js +110 -95
- package/dist/server.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -285,11 +285,11 @@ var init_getLocales = __esm({
|
|
|
285
285
|
"libs/configs/getLocales.ts"() {
|
|
286
286
|
init_esm_shims();
|
|
287
287
|
getLocales_default = () => {
|
|
288
|
-
const
|
|
289
|
-
const locales4 = process.env.NEXT_PUBLIC_REPORTS_LOCALES?.split(",") || [
|
|
290
|
-
if (!locales4.includes(
|
|
291
|
-
locales4.push(
|
|
292
|
-
return { localeDefault:
|
|
288
|
+
const localeDefault10 = process.env.NEXT_PUBLIC_REPORTS_LOCALE_DEFAULT || "en";
|
|
289
|
+
const locales4 = process.env.NEXT_PUBLIC_REPORTS_LOCALES?.split(",") || [localeDefault10];
|
|
290
|
+
if (!locales4.includes(localeDefault10))
|
|
291
|
+
locales4.push(localeDefault10);
|
|
292
|
+
return { localeDefault: localeDefault10, locales: locales4 };
|
|
293
293
|
};
|
|
294
294
|
}
|
|
295
295
|
});
|
|
@@ -2800,10 +2800,6 @@ function useSidebar(sidebar) {
|
|
|
2800
2800
|
handlers
|
|
2801
2801
|
};
|
|
2802
2802
|
}
|
|
2803
|
-
function useCurrentLocale() {
|
|
2804
|
-
const currentLocale = useAppSelector((state) => state.status.currentLocale);
|
|
2805
|
-
return currentLocale;
|
|
2806
|
-
}
|
|
2807
2803
|
function entityListHookFactory(entity) {
|
|
2808
2804
|
return (id) => {
|
|
2809
2805
|
const dispatch = useAppDispatch();
|
|
@@ -2939,12 +2935,12 @@ var init_hooks = __esm({
|
|
|
2939
2935
|
return resource.profilePrefix;
|
|
2940
2936
|
};
|
|
2941
2937
|
useBlockContext = (id = void 0, locale = void 0) => {
|
|
2942
|
-
const
|
|
2938
|
+
const localeDefault10 = useAppSelector((state) => state.status.localeDefault);
|
|
2943
2939
|
const query = useAppSelector((state) => state.status.query);
|
|
2944
2940
|
const variables = useInputVariablesFlat(id);
|
|
2945
2941
|
return {
|
|
2946
2942
|
variables,
|
|
2947
|
-
locale: locale ||
|
|
2943
|
+
locale: locale || localeDefault10,
|
|
2948
2944
|
query
|
|
2949
2945
|
};
|
|
2950
2946
|
};
|
|
@@ -3047,12 +3043,12 @@ var init_sanitizeBlockContent = __esm({
|
|
|
3047
3043
|
sanitizeBlockContent_default = sanitizeBlockContent;
|
|
3048
3044
|
}
|
|
3049
3045
|
});
|
|
3050
|
-
var
|
|
3046
|
+
var localeDefault8, frontEndMessage, errorStub, propify, d3plusPropify_default;
|
|
3051
3047
|
var init_d3plusPropify = __esm({
|
|
3052
3048
|
"libs/d3plusPropify.ts"() {
|
|
3053
3049
|
init_esm_shims();
|
|
3054
3050
|
init_FUNC();
|
|
3055
|
-
|
|
3051
|
+
localeDefault8 = process.env.NEXT_PUBLIC_REPORTS_LOCALE_DEFAULT || "en";
|
|
3056
3052
|
frontEndMessage = "Error Rendering Visualization";
|
|
3057
3053
|
errorStub = {
|
|
3058
3054
|
data: [],
|
|
@@ -3062,7 +3058,7 @@ var init_d3plusPropify = __esm({
|
|
|
3062
3058
|
<strong>${frontEndMessage}</strong>
|
|
3063
3059
|
</p>`
|
|
3064
3060
|
};
|
|
3065
|
-
propify = (logic, formatters2, variables = {}, locale =
|
|
3061
|
+
propify = (logic, formatters2, variables = {}, locale = localeDefault8, id = null, actions = {}, globals = {}) => {
|
|
3066
3062
|
let config;
|
|
3067
3063
|
try {
|
|
3068
3064
|
config = parse({ vars: ["variables"], logic }, formatters2, locale, actions, globals)(variables);
|
|
@@ -3669,6 +3665,8 @@ function ExploreFilters({ metadata, onFilter, initialReportId, initialVariantId,
|
|
|
3669
3665
|
showSelectors && /* @__PURE__ */ jsx(Group, { position: "center", className: "bespoke-explore-reports-selector", mb: "md", children: selectors.map((s) => /* @__PURE__ */ jsx(
|
|
3670
3666
|
Button,
|
|
3671
3667
|
{
|
|
3668
|
+
"data-selected": s.id === selectedProfile?.id ? "true" : "false",
|
|
3669
|
+
"data-report-name": s.name,
|
|
3672
3670
|
variant: s.id === selectedProfile?.id ? "outline" : "subtle",
|
|
3673
3671
|
onClick: () => onClickProfile(s),
|
|
3674
3672
|
children: translations?.dimension[s.name] ?? s.name
|
|
@@ -3678,6 +3676,8 @@ function ExploreFilters({ metadata, onFilter, initialReportId, initialVariantId,
|
|
|
3678
3676
|
selectedProfile && selectedProfile.variants && selectedProfile.variants.length > 2 && /* @__PURE__ */ jsx(Group, { position: "center", style: { minHeight: "36px" }, className: "bespoke-explore-variant-selector", mb: "md", children: selectedProfile.variants.map((v) => /* @__PURE__ */ jsx(
|
|
3679
3677
|
Button,
|
|
3680
3678
|
{
|
|
3679
|
+
"data-selected": v.id === selectedVariant?.id ? "true" : "false",
|
|
3680
|
+
"data-variant-name": v.name,
|
|
3681
3681
|
variant: v.id === selectedVariant?.id ? "outline" : "subtle",
|
|
3682
3682
|
onClick: () => onClickVariant(v),
|
|
3683
3683
|
children: translations?.dimension[v.name] ?? v.name
|
|
@@ -3735,8 +3735,8 @@ var useCustomTile = (reportTile) => {
|
|
|
3735
3735
|
};
|
|
3736
3736
|
function ExploreTile({ profile, profilePrefix, onSelect, reportTile }) {
|
|
3737
3737
|
const currentLocale = useAppSelector((state) => state.status.currentLocale);
|
|
3738
|
-
const
|
|
3739
|
-
const localePrefix = currentLocale ===
|
|
3738
|
+
const localeDefault10 = useAppSelector((state) => state.status.localeDefault);
|
|
3739
|
+
const localePrefix = currentLocale === localeDefault10 ? "" : `/${currentLocale}`;
|
|
3740
3740
|
const url = `${localePrefix}${profilePrefix}${profile.path}`;
|
|
3741
3741
|
const router = useRouter();
|
|
3742
3742
|
const members = profile.members.map((m) => ({
|
|
@@ -4012,8 +4012,8 @@ function BespokeSearch({
|
|
|
4012
4012
|
}) {
|
|
4013
4013
|
const dispatch = useAppDispatch();
|
|
4014
4014
|
const currentLocale = useAppSelector((state) => state.status.currentLocale);
|
|
4015
|
-
const
|
|
4016
|
-
const localePrefix = currentLocale ===
|
|
4015
|
+
const localeDefault10 = useAppSelector((state) => state.status.localeDefault);
|
|
4016
|
+
const localePrefix = currentLocale === localeDefault10 ? "" : `/${currentLocale}`;
|
|
4017
4017
|
const ItemRenderer = useCustomItem(autocompleteProps ? autocompleteProps.itemComponent : null);
|
|
4018
4018
|
const router = useRouter();
|
|
4019
4019
|
const [query, setQuery] = useState("");
|
|
@@ -4267,15 +4267,11 @@ function TitleIcon({
|
|
|
4267
4267
|
const [srcSVG, setSrcSVG] = useState(void 0);
|
|
4268
4268
|
const iconPath = iconType === "custom" ? icon : `/api/cms/read/icons/${iconType}/icon.svg?name=${icon}`;
|
|
4269
4269
|
useEffect(() => {
|
|
4270
|
-
if (iconType === "custom" ||
|
|
4271
|
-
setSrcSVG(void 0);
|
|
4272
|
-
return;
|
|
4273
|
-
} else {
|
|
4270
|
+
if (iconType === "custom" || icon.length) {
|
|
4274
4271
|
axios.get(iconPath, { responseType: "text" }).then((resp) => resp.data).then(setSrcSVG).catch(() => void 0);
|
|
4275
4272
|
}
|
|
4276
4273
|
}, [icon, iconType, iconPath]);
|
|
4277
|
-
const ready =
|
|
4278
|
-
const iconElement = iconType === "custom" ? /* @__PURE__ */ jsx(Image, { src: iconPath, alt: "Title Icon" }) : void 0;
|
|
4274
|
+
const ready = Boolean(srcSVG);
|
|
4279
4275
|
return /* @__PURE__ */ jsx(Fragment, { children: iconType !== "none" && icon && icon !== "" && ready && /* @__PURE__ */ jsx(
|
|
4280
4276
|
ThemeIcon,
|
|
4281
4277
|
{
|
|
@@ -4284,8 +4280,8 @@ function TitleIcon({
|
|
|
4284
4280
|
radius: iconRadius,
|
|
4285
4281
|
size: iconSize,
|
|
4286
4282
|
p: parseInt(iconPadding),
|
|
4287
|
-
dangerouslySetInnerHTML: srcSVG
|
|
4288
|
-
children:
|
|
4283
|
+
dangerouslySetInnerHTML: srcSVG ? { __html: srcSVG } : void 0,
|
|
4284
|
+
children: null
|
|
4289
4285
|
}
|
|
4290
4286
|
) });
|
|
4291
4287
|
}
|
|
@@ -4310,14 +4306,22 @@ function TranslationsProvider({ translations, children }) {
|
|
|
4310
4306
|
// frontend/components/report/hooks/useReportSearch.tsx
|
|
4311
4307
|
init_store2();
|
|
4312
4308
|
init_hooks();
|
|
4309
|
+
init_getLocales();
|
|
4310
|
+
var { localeDefault: localeDefault7 } = getLocales_default();
|
|
4311
|
+
function useCustomProps() {
|
|
4312
|
+
const { components } = useBespokeStyles();
|
|
4313
|
+
const { modal, inline } = components?.search ?? {};
|
|
4314
|
+
return { modal, inline };
|
|
4315
|
+
}
|
|
4313
4316
|
function useReportSearch(target, searchType, callback, searchProps, exploreProps) {
|
|
4317
|
+
const customProps = useCustomProps();
|
|
4314
4318
|
const initialIds = useAppSelector(
|
|
4315
4319
|
(state) => ({
|
|
4316
4320
|
reportId: state.variables.attributes.report_id,
|
|
4317
4321
|
variantId: state.variables.attributes.variant_id1
|
|
4318
4322
|
})
|
|
4319
4323
|
);
|
|
4320
|
-
const
|
|
4324
|
+
const router = useRouter();
|
|
4321
4325
|
const profilePrefix = useProfilePrefix();
|
|
4322
4326
|
const translations = useBespokeTranslations();
|
|
4323
4327
|
const targetWithSearch = useMemo(() => {
|
|
@@ -4327,12 +4331,13 @@ function useReportSearch(target, searchType, callback, searchProps, exploreProps
|
|
|
4327
4331
|
ExploreModal_default,
|
|
4328
4332
|
{
|
|
4329
4333
|
exploreProps: {
|
|
4330
|
-
locale,
|
|
4334
|
+
locale: router.locale || localeDefault7,
|
|
4331
4335
|
profilePrefix,
|
|
4332
4336
|
translations: translations["explore"],
|
|
4333
4337
|
initialReportId: initialIds.reportId,
|
|
4334
4338
|
initialVariantId: initialIds.variantId
|
|
4335
4339
|
},
|
|
4340
|
+
modalProps: customProps.modal,
|
|
4336
4341
|
...exploreProps,
|
|
4337
4342
|
children: target
|
|
4338
4343
|
}
|
|
@@ -4341,10 +4346,11 @@ function useReportSearch(target, searchType, callback, searchProps, exploreProps
|
|
|
4341
4346
|
component = /* @__PURE__ */ jsx(
|
|
4342
4347
|
Search_default,
|
|
4343
4348
|
{
|
|
4344
|
-
locale,
|
|
4349
|
+
locale: router.locale || localeDefault7,
|
|
4345
4350
|
profilePrefix,
|
|
4346
4351
|
callback,
|
|
4347
4352
|
...searchProps,
|
|
4353
|
+
autocompleteProps: customProps.inline,
|
|
4348
4354
|
children: target
|
|
4349
4355
|
}
|
|
4350
4356
|
);
|
|
@@ -5063,13 +5069,13 @@ init_hooks();
|
|
|
5063
5069
|
function RelatedView(props) {
|
|
5064
5070
|
const { related_reports } = props;
|
|
5065
5071
|
const currentLocale = useAppSelector((state) => state.status.currentLocale);
|
|
5066
|
-
const
|
|
5072
|
+
const localeDefault10 = useAppSelector((state) => state.status.localeDefault);
|
|
5067
5073
|
const profilePrefix = useProfilePrefix();
|
|
5068
5074
|
const router = useRouter();
|
|
5069
5075
|
const { components } = useBespokeStyles();
|
|
5070
5076
|
if (!related_reports?.length)
|
|
5071
5077
|
return;
|
|
5072
|
-
const localePrefix = currentLocale ===
|
|
5078
|
+
const localePrefix = currentLocale === localeDefault10 ? "" : `/${currentLocale}`;
|
|
5073
5079
|
const onItemSubmit = (innerUrl) => {
|
|
5074
5080
|
router.push(`${innerUrl}`);
|
|
5075
5081
|
};
|
|
@@ -6779,7 +6785,7 @@ function Block({ blockId, active = true, asComparison = false }) {
|
|
|
6779
6785
|
asComparison && comparison.active ? comparison?.variables.attributes : void 0
|
|
6780
6786
|
);
|
|
6781
6787
|
const blockContent = getBlockContent(block, locale);
|
|
6782
|
-
const formatterFunctions = useFormatterFunctionsForLocale();
|
|
6788
|
+
const formatterFunctions = useFormatterFunctionsForLocale(locale);
|
|
6783
6789
|
const blockContext = {
|
|
6784
6790
|
variables,
|
|
6785
6791
|
query,
|
|
@@ -8521,34 +8527,43 @@ function Section({ section }) {
|
|
|
8521
8527
|
const colsQty = Object.keys(columns).length;
|
|
8522
8528
|
if (!displaySection || comparison.active && settings.comparisonHide)
|
|
8523
8529
|
return null;
|
|
8524
|
-
const getBlockRenderers = (blocks, asComparison = false) =>
|
|
8525
|
-
|
|
8526
|
-
|
|
8527
|
-
|
|
8528
|
-
|
|
8529
|
-
|
|
8530
|
-
|
|
8531
|
-
|
|
8532
|
-
|
|
8533
|
-
|
|
8534
|
-
|
|
8535
|
-
|
|
8536
|
-
|
|
8537
|
-
|
|
8538
|
-
|
|
8539
|
-
|
|
8540
|
-
|
|
8541
|
-
|
|
8542
|
-
|
|
8543
|
-
|
|
8544
|
-
|
|
8545
|
-
|
|
8546
|
-
|
|
8547
|
-
|
|
8548
|
-
|
|
8530
|
+
const getBlockRenderers = (blocks, asComparison = false) => {
|
|
8531
|
+
const cols = Array.from(new Set(blocks.map((b) => b.blockcol))).map((d) => ({ blockcol: d })).sort((a, b) => orderSort(a, b, "blockcol"));
|
|
8532
|
+
const renderers = [];
|
|
8533
|
+
cols.forEach(({ blockcol }) => {
|
|
8534
|
+
const colRenderer = blocks.filter((b) => b.blockcol === blockcol).sort((a, b) => orderSort(a, b, "blockrow")).map((item) => {
|
|
8535
|
+
if (!item.id || !status[item.id]?.allowed && item.type !== BLOCK_TYPES.NAV)
|
|
8536
|
+
return null;
|
|
8537
|
+
const { settings: settings2, type } = blockRecords[item.id];
|
|
8538
|
+
const blockWidth = settings2.width && !settings2.width.stretch && settings2.width.unit ? formatters[settings2.width.unit](settings2.width.value) : settings2.display === "inline" ? "auto" : "100%";
|
|
8539
|
+
const blockStyles = {
|
|
8540
|
+
alignSelf: type === "visualization" ? "stretch" : "flex-start",
|
|
8541
|
+
flexGrow: 0,
|
|
8542
|
+
margin: "0",
|
|
8543
|
+
textAlign: settings2.align || blockSettings.align.defaultValue,
|
|
8544
|
+
width: blockWidth,
|
|
8545
|
+
minWidth: 300
|
|
8546
|
+
};
|
|
8547
|
+
return /* @__PURE__ */ jsx(
|
|
8548
|
+
Box,
|
|
8549
|
+
{
|
|
8550
|
+
className: "bespoke-Block-wrapper",
|
|
8551
|
+
id: `bespoke-Block-${item.id}`,
|
|
8552
|
+
sx: blockStyles,
|
|
8553
|
+
py: site_default.block.padding,
|
|
8554
|
+
children: /* @__PURE__ */ jsx(Block, { blockId: item.id, asComparison }, item.id)
|
|
8555
|
+
},
|
|
8556
|
+
item.id
|
|
8557
|
+
);
|
|
8558
|
+
});
|
|
8559
|
+
renderers.push(colRenderer);
|
|
8560
|
+
});
|
|
8561
|
+
return renderers.flat();
|
|
8562
|
+
};
|
|
8549
8563
|
let sectionColumns = [];
|
|
8550
8564
|
if (comparison.active && !settings.comparisonMerge) {
|
|
8551
8565
|
const blocks = sectionBlocks.reduce((blocks2, block) => ({ ...blocks2, [block.id]: block }), {});
|
|
8566
|
+
console.log("blocks", blocks);
|
|
8552
8567
|
sectionColumns = [
|
|
8553
8568
|
/* @__PURE__ */ jsx(SectionColumn, { column: blocks, sx: { flexBasis: "50%" }, children: getBlockRenderers(Object.values(sectionBlocks)) }, "original"),
|
|
8554
8569
|
/* @__PURE__ */ jsx(SectionColumn, { column: blocks, sx: { flexBasis: "50%" }, children: getBlockRenderers(Object.values(sectionBlocks), true) }, "comparison")
|
|
@@ -9064,11 +9079,11 @@ function DrawerContentWithScroll({ content, buttons, size }) {
|
|
|
9064
9079
|
}
|
|
9065
9080
|
function VariantEditor({ for: variant, onClose: closeHandler }) {
|
|
9066
9081
|
const dispatch = useAppDispatch();
|
|
9067
|
-
const
|
|
9082
|
+
const localeDefault10 = useAppSelector((state) => state.status.localeDefault);
|
|
9068
9083
|
const locales4 = useAppSelector((state) => state.status.locales);
|
|
9069
9084
|
const localesItems = locales4.map((locale) => ({ value: locale, label: locale.toUpperCase() }));
|
|
9070
9085
|
const [sample, setSample] = useState();
|
|
9071
|
-
const [selectedLocale, setSelectedLocale] = useState(
|
|
9086
|
+
const [selectedLocale, setSelectedLocale] = useState(localeDefault10);
|
|
9072
9087
|
const [variantConfig, setVariantConfig] = useState(variant);
|
|
9073
9088
|
const [loading, setLoading] = useState(false);
|
|
9074
9089
|
const [loadingFetch, setLoadingFetch] = useState(false);
|
|
@@ -9123,8 +9138,8 @@ function VariantEditor({ for: variant, onClose: closeHandler }) {
|
|
|
9123
9138
|
useEffect(() => {
|
|
9124
9139
|
setPayload(void 0);
|
|
9125
9140
|
let attributesList = [];
|
|
9126
|
-
if (selectedLocale !==
|
|
9127
|
-
const defaultAttributes = variantConfig.config[
|
|
9141
|
+
if (selectedLocale !== localeDefault10) {
|
|
9142
|
+
const defaultAttributes = variantConfig.config[localeDefault10] ? [...variantConfig.config[localeDefault10].attributes].map((item) => {
|
|
9128
9143
|
const newItem = { ...item };
|
|
9129
9144
|
newItem.value = "";
|
|
9130
9145
|
return newItem;
|
|
@@ -9385,8 +9400,8 @@ function VariantEditor({ for: variant, onClose: closeHandler }) {
|
|
|
9385
9400
|
value: variantConfig.config[selectedLocale].attributes[ix].type,
|
|
9386
9401
|
label: "Type",
|
|
9387
9402
|
data: [{ value: "variable", label: "Data based" }, { value: "constant", label: "Constant" }],
|
|
9388
|
-
readOnly: selectedLocale !==
|
|
9389
|
-
disabled: selectedLocale !==
|
|
9403
|
+
readOnly: selectedLocale !== localeDefault10,
|
|
9404
|
+
disabled: selectedLocale !== localeDefault10,
|
|
9390
9405
|
onChange: (e) => onChangeAttribute("type", ix, e)
|
|
9391
9406
|
}
|
|
9392
9407
|
),
|
|
@@ -9395,8 +9410,8 @@ function VariantEditor({ for: variant, onClose: closeHandler }) {
|
|
|
9395
9410
|
{
|
|
9396
9411
|
value: variantConfig.config[selectedLocale].attributes[ix].name,
|
|
9397
9412
|
label: "Name",
|
|
9398
|
-
readOnly: selectedLocale !==
|
|
9399
|
-
disabled: selectedLocale !==
|
|
9413
|
+
readOnly: selectedLocale !== localeDefault10,
|
|
9414
|
+
disabled: selectedLocale !== localeDefault10,
|
|
9400
9415
|
onChange: (e) => onChangeAttribute("name", ix, e.target.value)
|
|
9401
9416
|
}
|
|
9402
9417
|
),
|
|
@@ -9422,7 +9437,7 @@ function VariantEditor({ for: variant, onClose: closeHandler }) {
|
|
|
9422
9437
|
{
|
|
9423
9438
|
color: "red",
|
|
9424
9439
|
onClick: () => deleteAttribute(ix),
|
|
9425
|
-
disabled: selectedLocale !==
|
|
9440
|
+
disabled: selectedLocale !== localeDefault10,
|
|
9426
9441
|
children: /* @__PURE__ */ jsx(IconTrash, { size: 20 })
|
|
9427
9442
|
}
|
|
9428
9443
|
)
|
|
@@ -9433,7 +9448,7 @@ function VariantEditor({ for: variant, onClose: closeHandler }) {
|
|
|
9433
9448
|
{
|
|
9434
9449
|
onClick: addAttributes,
|
|
9435
9450
|
leftIcon: "+",
|
|
9436
|
-
disabled: loading || selectedLocale !==
|
|
9451
|
+
disabled: loading || selectedLocale !== localeDefault10,
|
|
9437
9452
|
children: "Add Attribute"
|
|
9438
9453
|
}
|
|
9439
9454
|
)
|
|
@@ -9660,9 +9675,9 @@ function normalizeList(value) {
|
|
|
9660
9675
|
}
|
|
9661
9676
|
|
|
9662
9677
|
// api/endpoints/member.ts
|
|
9663
|
-
var { localeDefault:
|
|
9678
|
+
var { localeDefault: localeDefault9 } = getLocales_default();
|
|
9664
9679
|
function parseReadMemberParams(query) {
|
|
9665
|
-
const locale = normalizeList(query.locale)[0] ||
|
|
9680
|
+
const locale = normalizeList(query.locale)[0] || localeDefault9 || "en";
|
|
9666
9681
|
const all = locale === "all" || yn3(query.all);
|
|
9667
9682
|
const mode = normalizeList(query.mode)[0];
|
|
9668
9683
|
const outputParam = normalizeList(query.output)[0] || "full";
|
|
@@ -9678,7 +9693,7 @@ function parseReadMemberParams(query) {
|
|
|
9678
9693
|
mode,
|
|
9679
9694
|
variant,
|
|
9680
9695
|
output,
|
|
9681
|
-
locale: all ?
|
|
9696
|
+
locale: all ? localeDefault9 : stripHTML(locale),
|
|
9682
9697
|
ids: normalizeList(query.ids || query["ids[]"])
|
|
9683
9698
|
};
|
|
9684
9699
|
}
|
|
@@ -9688,7 +9703,7 @@ function parseReadMemberParams(query) {
|
|
|
9688
9703
|
mode,
|
|
9689
9704
|
variant,
|
|
9690
9705
|
output,
|
|
9691
|
-
locale: all ?
|
|
9706
|
+
locale: all ? localeDefault9 : stripHTML(locale),
|
|
9692
9707
|
content_ids: normalizeList(query.content_ids || query["content_ids[]"]).map(parseFiniteNumber)
|
|
9693
9708
|
};
|
|
9694
9709
|
}
|
|
@@ -9698,7 +9713,7 @@ function parseReadMemberParams(query) {
|
|
|
9698
9713
|
mode,
|
|
9699
9714
|
variant,
|
|
9700
9715
|
output,
|
|
9701
|
-
locale: all ?
|
|
9716
|
+
locale: all ? localeDefault9 : stripHTML(locale),
|
|
9702
9717
|
slugs: normalizeList(query.slugs || query["slugs[]"]).map((token) => {
|
|
9703
9718
|
const [variantSlug, memberSlug] = token.split("/");
|
|
9704
9719
|
return { variantSlug, memberSlug };
|
|
@@ -9709,7 +9724,7 @@ function parseReadMemberParams(query) {
|
|
|
9709
9724
|
return {
|
|
9710
9725
|
all,
|
|
9711
9726
|
mode,
|
|
9712
|
-
locale: all ?
|
|
9727
|
+
locale: all ? localeDefault9 : stripHTML(locale),
|
|
9713
9728
|
related: relatedLimit,
|
|
9714
9729
|
current_ids: normalizeList(query.current_ids || query["current_ids[]"]).map(parseFiniteNumber),
|
|
9715
9730
|
report_ids: normalizeList(query.report_ids || query["report_ids[]"]).map(parseFiniteNumber),
|
|
@@ -9721,7 +9736,7 @@ function parseReadMemberParams(query) {
|
|
|
9721
9736
|
throw new BackendError(400, `Invalid mode: '${mode}'`);
|
|
9722
9737
|
}
|
|
9723
9738
|
function parseSearchMemberParams(query) {
|
|
9724
|
-
const locale = normalizeList(query.locale)[0] ||
|
|
9739
|
+
const locale = normalizeList(query.locale)[0] || localeDefault9 || "en";
|
|
9725
9740
|
const localeIsAll = locale === "all";
|
|
9726
9741
|
const format2 = normalizeList(query.format)[0];
|
|
9727
9742
|
const formatIsNested = format2 ? format2 === "nested" : localeIsAll;
|
|
@@ -9739,7 +9754,7 @@ function parseSearchMemberParams(query) {
|
|
|
9739
9754
|
}
|
|
9740
9755
|
return {
|
|
9741
9756
|
query: normalizeList(query.query || query.q)[0] || "",
|
|
9742
|
-
locale: localeIsAll ?
|
|
9757
|
+
locale: localeIsAll ? localeDefault9 : locale,
|
|
9743
9758
|
limit: normalizeList(query.limit).map(parseFiniteNumber)[0] ?? 5,
|
|
9744
9759
|
format: formatIsNested ? "nested" : "plain",
|
|
9745
9760
|
includes: yn3(query.includes, { default: true }),
|
|
@@ -9977,7 +9992,7 @@ function CMSHeader(props) {
|
|
|
9977
9992
|
const reportRef = useReportRef(reportId);
|
|
9978
9993
|
const profilePrefix = useProfilePrefix();
|
|
9979
9994
|
const currentLocale = useAppSelector((state) => state.status.currentLocale);
|
|
9980
|
-
const
|
|
9995
|
+
const localeDefault10 = useAppSelector((state) => state.status.localeDefault);
|
|
9981
9996
|
const localeOptions = useAppSelector(selectLocaleOptions);
|
|
9982
9997
|
const previewsFromState = useAppSelector((state) => state.status.previews);
|
|
9983
9998
|
const settings = useSidebar("settings");
|
|
@@ -9995,7 +10010,7 @@ function CMSHeader(props) {
|
|
|
9995
10010
|
const previewPath = previewsFromState.reduce((acc, member) => {
|
|
9996
10011
|
return acc.concat([member.variant_slug, member.slug]);
|
|
9997
10012
|
}, []);
|
|
9998
|
-
const localePrefix = currentLocale ===
|
|
10013
|
+
const localePrefix = currentLocale === localeDefault10 ? "" : `/${currentLocale}`;
|
|
9999
10014
|
const realPath = `${localePrefix}${profilePrefix}/${previewPath.join("/")}`;
|
|
10000
10015
|
const onSelectPreview = (previewMember) => {
|
|
10001
10016
|
const newPreviews = currentReport.dimensions.map((dId) => {
|
|
@@ -10093,7 +10108,7 @@ function CMSHeader(props) {
|
|
|
10093
10108
|
data: localeOptions,
|
|
10094
10109
|
value: currentLocale,
|
|
10095
10110
|
onChange: (value) => dispatch(
|
|
10096
|
-
statusActions.setStatus({ currentLocale: value ||
|
|
10111
|
+
statusActions.setStatus({ currentLocale: value || localeDefault10, previews: [] })
|
|
10097
10112
|
)
|
|
10098
10113
|
}
|
|
10099
10114
|
),
|
|
@@ -11396,7 +11411,7 @@ function Block2({
|
|
|
11396
11411
|
} = callbacks;
|
|
11397
11412
|
const block = useBlockRef(id).data;
|
|
11398
11413
|
const currentLocale = useAppSelector((state) => state.status.currentLocale);
|
|
11399
|
-
const
|
|
11414
|
+
const localeDefault10 = useAppSelector((state) => state.status.localeDefault);
|
|
11400
11415
|
const localeDerived = getLocaleDerived(block, currentLocale).locale;
|
|
11401
11416
|
const [blockState, setBlockState] = useState();
|
|
11402
11417
|
const [ready, setReady] = useState(false);
|
|
@@ -11409,7 +11424,7 @@ function Block2({
|
|
|
11409
11424
|
if (!block || !ready || !blockState)
|
|
11410
11425
|
return null;
|
|
11411
11426
|
const blockContent = getBlockContent(blockState, currentLocale);
|
|
11412
|
-
const setBlockContent = (content = {}, _locale =
|
|
11427
|
+
const setBlockContent = (content = {}, _locale = localeDefault10, flagModified = true, isValidated = void 0) => {
|
|
11413
11428
|
const { locale } = getLocaleDerived(block, _locale);
|
|
11414
11429
|
if (flagModified && !modified)
|
|
11415
11430
|
setModified(true);
|
|
@@ -13296,7 +13311,7 @@ var getCastedValue = (type, value) => {
|
|
|
13296
13311
|
}
|
|
13297
13312
|
};
|
|
13298
13313
|
function FormatterForm({ formatterId, onEditEnd }) {
|
|
13299
|
-
const
|
|
13314
|
+
const localeDefault10 = useAppSelector((state) => state.status.localeDefault);
|
|
13300
13315
|
const locales4 = useAppSelector((state) => state.status.locales);
|
|
13301
13316
|
locales4.map((locale) => ({ value: locale, label: `${locale.toUpperCase()}` }));
|
|
13302
13317
|
const opened = !!formatterId;
|
|
@@ -13360,7 +13375,7 @@ function FormatterForm({ formatterId, onEditEnd }) {
|
|
|
13360
13375
|
if (formatter) {
|
|
13361
13376
|
let results = "";
|
|
13362
13377
|
try {
|
|
13363
|
-
const newFunction = parse({ vars: ["n"], logic: formatter.content.logic }, {},
|
|
13378
|
+
const newFunction = parse({ vars: ["n"], logic: formatter.content.logic }, {}, localeDefault10, {});
|
|
13364
13379
|
const castedValue = getCastedValue(formatter.content.inputType, formatter.content.testValue);
|
|
13365
13380
|
results = newFunction(castedValue);
|
|
13366
13381
|
setIsValid(true);
|
|
@@ -13743,7 +13758,7 @@ function FilterSidebar2({ onChange, loading }) {
|
|
|
13743
13758
|
};
|
|
13744
13759
|
});
|
|
13745
13760
|
});
|
|
13746
|
-
const
|
|
13761
|
+
const localeDefault10 = useAppSelector((state) => state.status.localeDefault);
|
|
13747
13762
|
const [query, setQuery] = useState("");
|
|
13748
13763
|
const [loadingRegenerate, setLoadingRegenerate] = useState(false);
|
|
13749
13764
|
const [debouncedQuery] = useDebouncedValue(query, 500);
|
|
@@ -13808,7 +13823,7 @@ function FilterSidebar2({ onChange, loading }) {
|
|
|
13808
13823
|
/* @__PURE__ */ jsx(
|
|
13809
13824
|
TextInput,
|
|
13810
13825
|
{
|
|
13811
|
-
label: `Search item by name (${
|
|
13826
|
+
label: `Search item by name (${localeDefault10.toUpperCase()})`,
|
|
13812
13827
|
value: query,
|
|
13813
13828
|
onChange: (event) => setQuery(event.currentTarget.value),
|
|
13814
13829
|
disabled: loading
|
|
@@ -14147,11 +14162,11 @@ function ImagePreview2({
|
|
|
14147
14162
|
}
|
|
14148
14163
|
var ImagePreview_default = ImagePreview2;
|
|
14149
14164
|
function MemberForm({ memberId, onEditEnd }) {
|
|
14150
|
-
const
|
|
14165
|
+
const localeDefault10 = useAppSelector((state) => state.status.localeDefault);
|
|
14151
14166
|
const locales4 = useAppSelector((state) => state.status.locales);
|
|
14152
14167
|
const localesItems = locales4.map((locale) => ({ value: locale, label: `${locale.toUpperCase()}` }));
|
|
14153
14168
|
const opened = !!memberId;
|
|
14154
|
-
const [selectedLocale, setSelectedLocale] = useState(
|
|
14169
|
+
const [selectedLocale, setSelectedLocale] = useState(localeDefault10);
|
|
14155
14170
|
const [member, setMember] = useState(null);
|
|
14156
14171
|
const [loading, setLoading] = useState(true);
|
|
14157
14172
|
const [showImageSelector, setShowImageSelector] = useState(false);
|
|
@@ -14492,7 +14507,7 @@ function MembersTable({ members, onClickEdit, onSort }) {
|
|
|
14492
14507
|
useEffect(() => {
|
|
14493
14508
|
setRecords(members);
|
|
14494
14509
|
}, []);
|
|
14495
|
-
const
|
|
14510
|
+
const localeDefault10 = useAppSelector((state) => state.status.localeDefault);
|
|
14496
14511
|
const cols = [
|
|
14497
14512
|
{
|
|
14498
14513
|
title: "",
|
|
@@ -14534,12 +14549,12 @@ function MembersTable({ members, onClickEdit, onSort }) {
|
|
|
14534
14549
|
] })
|
|
14535
14550
|
},
|
|
14536
14551
|
{
|
|
14537
|
-
title: `Name ${
|
|
14552
|
+
title: `Name ${localeDefault10.toUpperCase()}`,
|
|
14538
14553
|
sortable: true,
|
|
14539
14554
|
accessor: "name",
|
|
14540
14555
|
render: ({ contentByLocale }) => {
|
|
14541
|
-
const defaultLocalized = contentByLocale.find((item) => item.locale ===
|
|
14542
|
-
const othersLocalized = contentByLocale.filter((item) => item.locale !==
|
|
14556
|
+
const defaultLocalized = contentByLocale.find((item) => item.locale === localeDefault10);
|
|
14557
|
+
const othersLocalized = contentByLocale.filter((item) => item.locale !== localeDefault10);
|
|
14543
14558
|
const nameTooltipContent = othersLocalized.reduce((acc, item) => {
|
|
14544
14559
|
const extraName = `${item.locale.toUpperCase()}: ${item.name}`;
|
|
14545
14560
|
const newLine2 = acc !== "" ? "\n" : "";
|
|
@@ -14555,11 +14570,11 @@ function MembersTable({ members, onClickEdit, onSort }) {
|
|
|
14555
14570
|
}
|
|
14556
14571
|
},
|
|
14557
14572
|
{
|
|
14558
|
-
title: `Keywords ${
|
|
14573
|
+
title: `Keywords ${localeDefault10.toUpperCase()}`,
|
|
14559
14574
|
accessor: "keywords",
|
|
14560
14575
|
render: ({ contentByLocale }) => {
|
|
14561
|
-
const defaultLocalized = contentByLocale.find((item) => item.locale ===
|
|
14562
|
-
const othersLocalized = contentByLocale.filter((item) => item.locale !==
|
|
14576
|
+
const defaultLocalized = contentByLocale.find((item) => item.locale === localeDefault10);
|
|
14577
|
+
const othersLocalized = contentByLocale.filter((item) => item.locale !== localeDefault10);
|
|
14563
14578
|
const keywords = (defaultLocalized.keywords ? defaultLocalized.keywords : []).map((k) => /* @__PURE__ */ jsx(Badge, { children: k }, k));
|
|
14564
14579
|
const keywordsTooltipContent = othersLocalized.reduce((acc, item) => {
|
|
14565
14580
|
const otherKeywords = item.keywords || [];
|
|
@@ -14921,7 +14936,7 @@ init_esm_shims();
|
|
|
14921
14936
|
init_store2();
|
|
14922
14937
|
function FavoriteMemberSelector({ reportId, initialFavorites = [], onSelectFavorites, onClickDelete }) {
|
|
14923
14938
|
const reportRef = useReportRef(reportId);
|
|
14924
|
-
const
|
|
14939
|
+
const localeDefault10 = useAppSelector((state) => state.status.localeDefault);
|
|
14925
14940
|
const currentReport = reportRef.data;
|
|
14926
14941
|
const [selectedMembers, setSelectedMembers] = useState(
|
|
14927
14942
|
currentReport ? currentReport.dimensions.map((d) => void 0) : [void 0]
|
|
@@ -14961,7 +14976,7 @@ function FavoriteMemberSelector({ reportId, initialFavorites = [], onSelectFavor
|
|
|
14961
14976
|
id: dId,
|
|
14962
14977
|
initialSelection: initialFavorites[ix] ? initialFavorites[ix] : void 0,
|
|
14963
14978
|
onSelect: (selectedPreview) => onSelectPreview(ix, selectedPreview),
|
|
14964
|
-
locale:
|
|
14979
|
+
locale: localeDefault10
|
|
14965
14980
|
}
|
|
14966
14981
|
) }, dId))
|
|
14967
14982
|
] }) });
|
package/dist/server.js
CHANGED
|
@@ -5805,7 +5805,7 @@ function BespokeRendererStaticProps(options) {
|
|
|
5805
5805
|
]);
|
|
5806
5806
|
const state = store.getState();
|
|
5807
5807
|
const formatterList = selectFormatterList(state);
|
|
5808
|
-
const formatters = funcifyFormattersByLocale(formatterList,
|
|
5808
|
+
const formatters = funcifyFormattersByLocale(formatterList, locale);
|
|
5809
5809
|
const sectionList = selectSectionList(state);
|
|
5810
5810
|
const blockRecords = selectBlockRecords(state);
|
|
5811
5811
|
const publicBlockRecords = { ...blockRecords };
|