Skip to content

Commit

Permalink
fix: #304 update storybook + refacto syntax of the table emits defini…
Browse files Browse the repository at this point in the history
…tions
  • Loading branch information
mattgoud committed Jan 29, 2024
1 parent a0d6e5b commit f2c5d6e
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 18 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"not op_mini all"
],
"peerDependencies": {
"vue": "^3.4.14"
"vue": "^3.2.0"
},
"dependencies": {
"@headlessui/vue": "^1.7.13",
Expand Down Expand Up @@ -108,7 +108,7 @@
"typescript": "^5.0.4",
"unplugin-vue-define-options": "^1.3.3",
"vitest": "^0.32.4",
"vue": "^3.4.14",
"vue": "^3.2.47",
"vue-router": "^4.1.6",
"vue-tsc": "^1.2.0"
}
Expand Down
10 changes: 5 additions & 5 deletions packages/components/table/src/table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -378,11 +378,11 @@ defineOptions({
const props = defineProps(tableProps)
const emit = defineEmits<{
(e: 'select', index: number): void
(e: 'select:all'): void
(e: 'update:selection', value: number[]): void
(e: 'sortColumn', column: sortOption): void
(e: 'searchSubmit', column: searchOption[]): void
select: [index: number]
'select:all': []
'update:selection': [value: number[]]
sortColumn: [column: sortOption]
searchSubmit: [column: searchOption[]]
}>()
const { t } = useLocale()
Expand Down
31 changes: 21 additions & 10 deletions packages/components/table/stories/table.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,21 @@ export default {
import type { PuikTableHeader } from '@prestashopcorp/puik/es/components/table/src/table'
interface PuikTableHeader {
text: string | undefined
value: string
size: 'sm' | 'md' | 'lg' | undefined
width: string | undefined
align: 'left' | 'center' | 'right' | undefined
sortable: boolean | undefined
searchable: boolean | undefined
preventExpand: boolean | undefined
text?: string
size?: 'sm' | 'md' | 'lg'
align?: 'left' | 'center' | 'right'
width?: string
sortable?: boolean
preventExpand?: boolean
searchable?: boolean
searchSubmit?: boolean
searchType?: {$PuikTableSearchInputTypes}
}
enum PuikTableSearchInputTypes {
Text = 'text',
Range = 'range',
}
`,
},
Expand Down Expand Up @@ -216,8 +223,10 @@ export default {
description: 'Event emitted when sorting a column',
table: {
type: {
summary: 'sortOption',
summary: 'event => sortOption',
detail: `
// Payload type = sortOption
import type { sortOption } from '@prestashopcorp/puik/es/components/table/src/table'
type sortOption = {
Expand All @@ -233,9 +242,11 @@ type sortOption = {
control: 'none',
table: {
type: {
summary: 'event',
summary: 'event => SearchOption[]',
detail: `
Payload type = Array<SearchOption>
// Payload type = Array<SearchOption>
import type { searchOption } from '@prestashopcorp/puik/es/components/table/src/table'
type searchOption = {
searchBy: string;
Expand Down
2 changes: 1 addition & 1 deletion playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"preview": "vite preview"
},
"dependencies": {
"vue": "^3.4.14"
"vue": "3.3.10"
},
"devDependencies": {
"@vitejs/plugin-vue": "^4.1.0",
Expand Down

0 comments on commit f2c5d6e

Please sign in to comment.