diff --git a/src/components/DsfrSelect/DsfrSelect.vue b/src/components/DsfrSelect/DsfrSelect.vue index 973c675a..64249da3 100644 --- a/src/components/DsfrSelect/DsfrSelect.vue +++ b/src/components/DsfrSelect/DsfrSelect.vue @@ -13,7 +13,7 @@ const props = withDefaults(defineProps<{ description?: string modelValue?: string | number label?: string - options?:(string | number | { value: string | number, text: string, disabled: boolean })[] + options?:(string | number | { value: string | number, text: string, disabled?: boolean })[] successMessage?: string errorMessage?: string defaultUnselectedText?: string diff --git a/src/components/DsfrTable/DsfrTable.stories.ts b/src/components/DsfrTable/DsfrTable.stories.ts index 30ee7511..0edc287f 100644 --- a/src/components/DsfrTable/DsfrTable.stories.ts +++ b/src/components/DsfrTable/DsfrTable.stories.ts @@ -24,6 +24,10 @@ export default { control: 'boolean', description: 'Indique si la balise caption doit être visible (`false`, défaut) ou cachée (`true`)', }, + pagination: { + control: 'boolean', + description: 'Intègre une pagination au tableau', + }, headers: { control: 'object', description: 'Liste des en-têtes du tableau (tableau de string). Il existe un slot nommé `headers` pour gérer les en-têtes avec d’autres composants. C’est la même props attendue par DsfrTableHeaders', @@ -40,6 +44,14 @@ export default { action: 'clicked on row', description: 'Fonction pour montrer le clic sur une ligne (Ici seulement la 2e ligne)', }, + defaultCurrentPage: { + control: 'number', + description: 'Le numéro de la page dans la pagination', + }, + defaultOptionSelected: { + control: 'number', + description: 'La sélection du nombre d\'enregistrements par page', + }, }, } @@ -49,9 +61,9 @@ const rows = [ [ 'EGAUD', 'Pierre-Louis', - 'pierre.egaud@ninja.com', - '01 02 03 04 05', - '06 01 02 03 04', + 'pierre.egaud@castor.fr', + '02 04 06 08 10', + '06 05 04 03 02', { component: 'DsfrTag', label: 'Erreur', @@ -66,9 +78,9 @@ const rows = [ rowData: [ 'DEBROIZE', 'Clément', - 'clement.debroize@ninja.com', - '01 02 03 04 05', - '06 01 02 03 04', + 'clement.debroize@exile.com', + '02 44 66 55 99', + '07 88 77 22 33', { component: 'DsfrTag', label: 'Succès', @@ -81,21 +93,168 @@ const rows = [ 'Stan', 'stan.ormieres@ninja.com', { - text: '01 02 03 04 05', + text: '02 77 00 00 77', cellAttrs: { class: 'pointer', onClick: () => {}, // eslint-disable-line @typescript-eslint/no-empty-function }, }, - '06 01 02 03 04', + '06 08 07 09 08', + { + component: 'DsfrTag', + label: 'Info', + class: 'info', + }, + ], + [ + 'MONTANA', + 'Tony', + 'tony.montana@depalma.com', + '02 07 03 19 84', + '06 07 03 19 84', + { + component: 'DsfrTag', + label: 'Erreur', + class: 'error', + }, + ], + [ + 'BOND', + 'James', + 'james.bond@mi6.com', + '02 00 07 19 62', + '06 00 07 19 62', + { + component: 'DsfrTag', + label: 'Succès', + class: 'success', + }, + ], + [ + 'RAMBO', + 'John', + 'john.rambo@veterans.com', + '02 00 00 19 82', + '06 00 00 19 82', + { + component: 'DsfrTag', + label: 'Info', + class: 'info', + }, + ], + [ + 'CONNOR', + 'Sarah', + 'sarah.connor@skynet.com', + '02 00 00 19 84', + '06 00 00 19 84', + { + component: 'DsfrTag', + label: 'Erreur', + class: 'error', + }, + ], + [ + 'KENOBI', + 'Obiwan', + 'obiwan.kenobi@jedimaster.com', + '02 00 00 19 77', + '06 00 00 19 77', + { + component: 'DsfrTag', + label: 'Succès', + class: 'success', + }, + ], + [ + 'KRUEGER', + 'Freddy', + 'freddy.krueger@goodnight.com', + '02 00 00 19 84', + '06 00 00 19 84', + { + component: 'DsfrTag', + label: 'Info', + class: 'info', + }, + ], + [ + 'LEGRIS', + 'Gandalf', + 'gandalf.leblanc@mellon.com', + '02 00 00 20 01', + '06 00 00 20 01', + { + component: 'DsfrTag', + label: 'Erreur', + class: 'error', + }, + ], + [ + 'SÖZE', + 'Keyser', + 'keyser.soze@mastermind.com', + '02 00 00 19 95', + '06 00 00 19 95', { component: 'DsfrTag', label: 'Info', class: 'info', }, ], + [ + 'HUNT', + 'Ethan', + 'ethan.hunt@impossible.com', + '02 00 00 19 96', + '06 00 00 19 96', + { + component: 'DsfrTag', + label: 'Erreur', + class: 'error', + }, + ], + [ + 'HOLMES', + 'Sherlock', + 'sherlock.holmes@whodunit.com', + '02 00 00 18 87', + '06 00 00 18 87', + { + component: 'DsfrTag', + label: 'Succès', + class: 'success', + }, + ], + [ + 'JONES', + 'Indiana', + 'indiana.jones@london-university.com', + '02 00 00 19 81', + '06 00 00 19 81', + { + component: 'DsfrTag', + label: 'Info', + class: 'info', + }, + ], + [ + 'WAYNE', + 'Bruce', + 'bruce.wayne@batmail.com', + '02 00 00 19 89', + '06 00 00 19 89', + { + component: 'DsfrTag', + label: 'Erreur', + class: 'error', + }, + ], ] const noCaption = false +const pagination = true +const defaultCurrentPage = 2 +const defaultOptionSelected = 5 export const TableauEntier = (args) => ({ components: { @@ -120,6 +279,9 @@ export const TableauEntier = (args) => ({ :headers="headers" :rows="rows" :no-caption="noCaption" + :pagination="pagination" + :defaultCurrentPage="defaultCurrentPage" + :defaultOptionSelected="defaultOptionSelected" /> `, @@ -129,4 +291,7 @@ TableauEntier.args = { headers, rows, noCaption, + pagination, + defaultCurrentPage, + defaultOptionSelected, } diff --git a/src/components/DsfrTable/DsfrTable.vue b/src/components/DsfrTable/DsfrTable.vue index 856e14a5..65158ade 100644 --- a/src/components/DsfrTable/DsfrTable.vue +++ b/src/components/DsfrTable/DsfrTable.vue @@ -1,23 +1,60 @@ + +