Skip to content

Commit 1166f33

Browse files
authored
Merge pull request #1014 from dnum-mi/develop
Develop
2 parents 8843ed7 + 2965746 commit 1166f33

File tree

8 files changed

+44
-30
lines changed

8 files changed

+44
-30
lines changed

docs/composants.md

+19-13
Original file line numberDiff line numberDiff line change
@@ -34,25 +34,12 @@ Le storybook est toujours disponible [ici](https://storybook.vue-ds.fr)
3434

3535
- [DsfrConsent](./composants/DsfrConsent)
3636

37-
## Infobulle (Information contextuelle)
38-
39-
- [DsfrTooltip](./composants/DsfrTooltip)
40-
4137
## En-tête de page
4238

4339
- [DsfrHeader](./composants/DsfrHeader)
4440
- [DsfrHeaderMenuLink](./composants/DsfrHeaderMenuLink)
4541
- [DsfrLanguageSelector](./composants/DsfrLanguageSelector)
4642

47-
## Modale
48-
49-
- [DsfrModal](./composants/DsfrModal)
50-
51-
## Pied de page
52-
53-
- [DsfrFooter](./composants/DsfrFooter)
54-
- [DsfrFooterLink](./composants/DsfrFooterLink)
55-
5643
## Fil d’ariane
5744

5845
- [DsfrBreadcrumb](./composants/DsfrBreadcrumb)
@@ -70,6 +57,14 @@ Le storybook est toujours disponible [ici](https://storybook.vue-ds.fr)
7057
- [DsfrRange](./composants/DsfrRange)
7158
- [DsfrFieldset](./composants/DsfrFieldset)
7259

60+
## Infobulle (Information contextuelle)
61+
62+
- [DsfrTooltip](./composants/DsfrTooltip)
63+
64+
## Modale
65+
66+
- [DsfrModal](./composants/DsfrModal)
67+
7368
## Onglets
7469

7570
- [DsfrTabs](./composants/DsfrTabs)
@@ -78,12 +73,23 @@ Le storybook est toujours disponible [ici](https://storybook.vue-ds.fr)
7873

7974
- [DsfrErrorPage](./composants/DsfrErrorPage)
8075

76+
## Pied de page
77+
78+
- [DsfrFooter](./composants/DsfrFooter)
79+
- [DsfrFooterLink](./composants/DsfrFooterLink)
80+
8181
## Retour en haut de page
8282

8383
- [DsfrBackToTop](./composants/DsfrBackToTop)
8484

8585
## Tableau
8686

87+
Conseillé pour des tableaux complexes :
88+
89+
- [DsfrDataTable](./composants/DsfrDataTable)
90+
91+
Conseillé pour des tableaux simples :
92+
8793
- [DsfrTable](./composants/DsfrTable)
8894
- [DsfrTableHeader](./composants/DsfrTableHeader)
8995
- [DsfrTableHeaders](./composants/DsfrTableHeaders)

src/components/DsfrAccordion/DsfrAccordion.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ onMounted(() => {
4141
4242
watch(isActive, (newValue, oldValue) => {
4343
/*
44-
* @see https://github.com/GouvernementFR/dsfr/blob/main/src/core/script/collapse/collapse.js
44+
* @see https://github.com/GouvernementFR/dsfr/blob/main/src/dsfr/core/script/collapse/collapse.js
4545
*/
4646
if (newValue !== oldValue) {
4747
doExpand(newValue)
@@ -76,7 +76,7 @@ watch(isActive, (newValue, oldValue) => {
7676
'fr-collapse--expanded': cssExpanded, // Need to use a separate data to add/remove the class after a RAF
7777
'fr-collapsing': collapsing,
7878
}"
79-
@transitionend="onTransitionEnd(isActive)"
79+
@transitionend="onTransitionEnd(isActive, false)"
8080
>
8181
<!-- @slot Slot par défaut pour le contenu de l’accordéon: sera dans `<div class="fr-collapse">` -->
8282
<slot />

src/components/DsfrDataTable/DsfrDataTable.vue

+6-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script lang="ts" setup>
2-
import { computed, ref } from 'vue'
2+
import { computed } from 'vue'
33
44
import DsfrPagination from '../DsfrPagination/DsfrPagination.vue'
55
import VIcon from '../VIcon/VIcon.vue'
@@ -128,17 +128,15 @@ function selectAll (bool: boolean) {
128128
if (bool) {
129129
const keyIndex = props.headersRow.findIndex(header => (header as DsfrDataTableHeaderCellObject).key ?? header)
130130
selection.value = finalRows.value.map(row => row[keyIndex] as string)
131+
} else {
132+
selection.value.length = 0
131133
}
132-
selection.value!.length = 0
133-
}
134-
const wholeSelection = ref(false)
135-
function checkSelection () {
136-
wholeSelection.value = selection.value.length === finalRows.value.length
137134
}
138135
136+
const wholeSelection = computed(() => selection.value.length === finalRows.value.length)
137+
139138
function onPaginationOptionsChange () {
140139
emit('update:current-page', 0)
141-
wholeSelection.value = false
142140
selection.value.length = 0
143141
}
144142
@@ -231,7 +229,6 @@ function copyToClipboard (text: string) {
231229
v-model="selection"
232230
:value="rows[idx][rowKey] ?? `row-${idx}`"
233231
type="checkbox"
234-
@change="checkSelection()"
235232
>
236233
<label
237234
class="fr-label"
@@ -317,6 +314,7 @@ function copyToClipboard (text: string) {
317314
<DsfrPagination
318315
v-model:current-page="currentPage"
319316
:pages="pages"
317+
@update:current-page="selection.length = 0"
320318
/>
321319
</div>
322320
</template>

src/components/DsfrHeader/DsfrHeader.vue

+4
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,13 @@ provide(registerNavigationLinkKey, () => {
193193
v-if="quickLinks?.length || languageSelector"
194194
class="fr-header__tools-links"
195195
>
196+
<slot name="before-quick-links" />
196197
<DsfrHeaderMenuLinks
197198
v-if="!menuOpened"
198199
:links="quickLinks"
199200
:nav-aria-label="quickLinksAriaLabel"
200201
/>
202+
<slot name="after-quick-links" />
201203
<template v-if="languageSelector">
202204
<DsfrLanguageSelector
203205
v-bind="languageSelector"
@@ -247,13 +249,15 @@ provide(registerNavigationLinkKey, () => {
247249
@select="languageSelector.currentLanguage = $event.codeIso"
248250
/>
249251
</template>
252+
<slot name="before-quick-links" />
250253
<DsfrHeaderMenuLinks
251254
v-if="menuOpened"
252255
role="navigation"
253256
:links="quickLinks"
254257
:nav-aria-label="quickLinksAriaLabel"
255258
@link-click="onQuickLinkClick"
256259
/>
260+
<slot name="after-quick-links" />
257261
</div>
258262

259263
<template v-if="modalOpened">

src/components/DsfrSideMenu/DsfrSideMenu.types.ts

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export type DsfrSideMenuProps = {
1010
menuItems?: DsfrSideMenuListItemProps[]
1111
headingTitle?: string
1212
titleTag?: string
13+
focusOnExpanding?: boolean
1314
}
1415

1516
export type DsfrSideMenuButtonProps = {
@@ -26,4 +27,5 @@ export type DsfrSideMenuListProps = {
2627
DsfrSideMenuListItemProps & Partial<DsfrSideMenuListProps & { to?: RouteLocationRaw, text?: string }>
2728
& { menuItems?: (DsfrSideMenuListItemProps & Partial<DsfrSideMenuListProps & { to?: RouteLocationRaw, text?: string }>)[] }
2829
)[]
30+
focusOnExpanding?: boolean
2931
}

src/components/DsfrSideMenu/DsfrSideMenu.vue

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ withDefaults(defineProps<DsfrSideMenuProps>(), {
1818
menuItems: () => undefined,
1919
headingTitle: '',
2020
titleTag: 'h3',
21+
focusOnExpanding: true,
2122
})
2223
2324
defineEmits<{ (e: 'toggleExpand', payload: string): void }>()
@@ -64,7 +65,7 @@ watch(expanded, (newValue, oldValue) => {
6465
'fr-collapse--expanded': cssExpanded, // Need to use a separate data to add/remove the class after a RAF
6566
'fr-collapsing': collapsing,
6667
}"
67-
@transitionend="onTransitionEnd(expanded)"
68+
@transitionend="onTransitionEnd(expanded, focusOnExpanding)"
6869
>
6970
<component
7071
:is="titleTag"

src/components/DsfrSideMenu/DsfrSideMenuList.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const linkProps = (to: string | RouteLocationRaw | undefined) => {
5656
'fr-collapsing': collapsing,
5757
'fr-collapse--expanded': cssExpanded,
5858
}"
59-
@transitionend="onTransitionEnd(!!expanded)"
59+
@transitionend="onTransitionEnd(!!expanded, focusOnExpanding)"
6060
>
6161
<ul
6262
class="fr-sidemenu__list"

src/composables/useCollapsable.ts

+8-5
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ export const useCollapsable = () => {
3232
}
3333
if (newValue === true) {
3434
// unbound
35-
// @see https://github.com/GouvernementFR/dsfr/blob/main/src/core/script/collapse/collapse.js#L33
35+
// @see https://github.com/GouvernementFR/dsfr/blob/main/src/dsfr/core/script/collapse/collapse.js
3636
collapse.value.style.setProperty('--collapse-max-height', 'none')
3737
}
3838
// We need to wait for the next RAF to be sure the CSS variable will be set
39-
// DSFR use RAF too https://github.com/GouvernementFR/dsfr/blob/main/src/core/script/api/modules/render/renderer.js#L22
39+
// DSFR use RAF too https://github.com/GouvernementFR/dsfr/blob/main/src/dsfr/core/script/api/modules/render/renderer.js#L22
4040
window.requestAnimationFrame(() => {
4141
collapsing.value = true
4242
adjust()
@@ -48,13 +48,16 @@ export const useCollapsable = () => {
4848
}
4949

5050
/**
51-
* @see https://github.com/GouvernementFR/dsfr/blob/main/src/core/script/collapse/collapse.js#L25
51+
* @see https://github.com/GouvernementFR/dsfr/blob/main/src/dsfr/core/script/collapse/collapse.js#L25
5252
* @param {boolean} expanded
53+
* @param {boolean} focusFirstAnchor
5354
* @return void
5455
*/
55-
const onTransitionEnd = (expanded: boolean): void => {
56+
const onTransitionEnd = (expanded: boolean, autoFocus = true): void => {
5657
collapsing.value = false
57-
collapse.value?.querySelector('a')?.focus()
58+
if (autoFocus) {
59+
collapse.value?.querySelector('a')?.focus()
60+
}
5861
if (collapse.value && expanded === false) {
5962
collapse.value.style.removeProperty('--collapse-max-height')
6063
}

0 commit comments

Comments
 (0)