Skip to content

Commit

Permalink
Merge branch 'release/v0.23.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
holtwick committed Aug 28, 2024
2 parents 04a928c + 1abc27c commit 1f46bbd
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 14 deletions.
28 changes: 15 additions & 13 deletions lib/modal/oui-dialog-edit.demo.vue
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
<script lang="ts" setup>
import { reactive } from 'vue'
import OuiDialogExample from './oui-dialog-edit.example.vue'
import { OuiButton, OuiDemo, useDialog } from '@/lib'
import { dialogOpen, useDialogOpen } from './use-dialog'
import { OuiButton } from '@/lib'
const state = reactive({
show: false,
value: null,
})
const { open } = useDialog(OuiDialogExample)
const open = useDialogOpen(OuiDialogExample)
</script>

<template>
<OuiButton @click="open().then(v => state.value = v as any)">
Create Dialog
<OuiButton @click="dialogOpen(OuiDialogExample)">
Create Dialog with dialogOpen
</OuiButton>
<OuiButton @click="dialogOpen(OuiDialogExample, { id: 123 })">
Edit Dialog with dialogOpen
</OuiButton>
<br>
<br>
<OuiButton @click="open()">
Create Dialog with useDialogOpen
</OuiButton>
<OuiButton @click="open({ id: 123 }).then(v => state.value = v as any)">
Edit Dialog
<OuiButton @click="open({ id: 123 })">
Edit Dialog with useDialogOpen
</OuiButton>
<OuiDemo :state="state" />
</template>
10 changes: 10 additions & 0 deletions lib/modal/use-dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,13 @@ export function useDialog<T extends Component>(component?: T) {
},
}
}

export function dialogOpen<T = any>(component: Component, props?: T) {
const { open } = useDialog(component)
open(props)
}

export function useDialogOpen(component: Component) {
const { open } = useDialog(component)
return open
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "oui-kit",
"type": "module",
"version": "0.23.1",
"version": "0.23.2",
"author": {
"email": "[email protected]",
"name": "Dirk Holtwick",
Expand Down

0 comments on commit 1f46bbd

Please sign in to comment.