Skip to content

Commit 51d23a6

Browse files
authored
Merge pull request #523 from dnum-mi/fix/table-cell-with-component
docs(DsfrTableCell): 🐛 Corrige l’erreur de component
2 parents b42503a + 1bc22aa commit 51d23a6

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

src/components/DsfrTable/DsfrTableCell.stories.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1+
import { setup } from '@storybook/vue3'
2+
import DsfrTag from '../DsfrTag/DsfrTag.vue'
13
import DsfrTable from './DsfrTable.vue'
24
import DsfrTableHeaders from './DsfrTableHeaders.vue'
35
import DsfrTableCell from './DsfrTableCell.vue'
46

7+
setup(app => {
8+
app.component('DsfrTag', DsfrTag) // Composant utilisé dans les stories CelluleDeTableauAvecComposant et CelluleDeTableauComplexe
9+
})
10+
511
export default {
612
component: DsfrTableCell,
713
title: 'Composants/Tableau/Cellule de tableau - DsfrTableCell',
@@ -16,7 +22,7 @@ export default {
1622
description: 'Contenu du champ. Peut être une string ou bien un objet',
1723
},
1824
onClickCell: {
19-
action: 'Clicked on cell',
25+
action: 'Clic sur l’étiquette !',
2026
description: 'Fonction pour montrer le clic sur une cellule (Ici seulement pour "Cellule de tableau complexe")',
2127
},
2228
},
@@ -70,7 +76,6 @@ export const CelluleDeTableauSimple = (args) => ({
7076
</DsfrTable>
7177
`,
7278

73-
7479
})
7580
CelluleDeTableauSimple.args = {
7681
title,

src/components/DsfrTable/DsfrTableCell.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default defineComponent({
1919
isObject () {
2020
return typeof this.field === 'object' && this.field !== null
2121
},
22-
isComponent () {
22+
component () {
2323
return (this.isObject && this.field.component) ? this.field.component : false
2424
},
2525
isString () {
@@ -32,8 +32,8 @@ export default defineComponent({
3232
<template>
3333
<td v-bind="cellAttrs">
3434
<component
35-
:is="isComponent"
36-
v-if="isComponent"
35+
:is="component"
36+
v-if="component"
3737
v-bind="field"
3838
>
3939
{{ field.text }}

0 commit comments

Comments
 (0)