From 13ee7ebc1c027f2fb08c93eefb2c631262cd31bc Mon Sep 17 00:00:00 2001 From: Guillaume Grossetie Date: Fri, 20 Dec 2024 08:32:30 +0100 Subject: [PATCH] fix #1136: ajout d'un index sur les styles bibliographiques (#1169) --- front/src/components/Export.jsx | 12 +++++++++++- front/src/components/SelectCombobox.js | 9 ++++----- front/src/components/field.module.scss | 3 +-- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/front/src/components/Export.jsx b/front/src/components/Export.jsx index 6c5083df7..5a1b04bce 100644 --- a/front/src/components/Export.jsx +++ b/front/src/components/Export.jsx @@ -39,6 +39,16 @@ export default function Export({ [name] ) const { t } = useTranslation() + const groupedExportStyles = useMemo(() => { + return exportStyles?.map(({ key, name }, index) => ({ + key, + name, + section: '', + // pre-assign an index to each entry. It will persist upon filtered results. + // @see https://github.com/EcrituresNumeriques/stylo/issues/1014 + index, + })) + }, [exportStyles]) const exportUrl = bookId ? `${processEndpoint}/cgi-bin/exportBook/exec.cgi?id=${exportId}&book=${bookId}&processor=xelatex&source=${exportEndpoint}/&format=${format}&bibstyle=${csl}&toc=${Boolean( @@ -93,7 +103,7 @@ export default function Export({ diff --git a/front/src/components/SelectCombobox.js b/front/src/components/SelectCombobox.js index 91a505fb1..d8469ee58 100644 --- a/front/src/components/SelectCombobox.js +++ b/front/src/components/SelectCombobox.js @@ -10,12 +10,11 @@ export function groupItems(items) { return Array.from( items .reduce((groups, item) => { - if (!groups.has(item.section)) { - groups.set(item.section, []) + const section = item.section + if (!groups.has(section)) { + groups.set(section, []) } - - groups.get(item.section).push({ ...item }) - + groups.get(section).push({ ...item }) return groups }, new Map()) .entries() diff --git a/front/src/components/field.module.scss b/front/src/components/field.module.scss index 77bf1954b..51da7965d 100644 --- a/front/src/components/field.module.scss +++ b/front/src/components/field.module.scss @@ -133,8 +133,7 @@ .comboboxControllerActions { position: absolute; right: 0; - /* (with label) .field label font-size + .field label margin-bottom + .field padding-top + .field border-top-width */ - top: calc(1rem + 0.5rem + 0.2rem + 1px); + top: 0; } /* (without label) .field border-top-width */ .combobox > label:empty ~ * .comboboxControllerActions {