Skip to content

Support dynamic modal method type for version 2.0.0 #45

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,8 @@
"vetur": {
"tags": "vetur/tags.json",
"attributes": "vetur/attributes.json"
},
"dependencies": {
"vue": "^2.6.12"
}
}
47 changes: 44 additions & 3 deletions types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Vue, { PluginObject } from 'vue'
import Vue, { PluginObject, VNodeData, Component, AsyncComponent } from 'vue'
import './lib'

export class VueFinalModalComponant extends Vue {
Expand All @@ -8,11 +8,52 @@ export class VueFinalModalComponant extends Vue {
}
}

export type VueFinalModalProperty = {
export interface DynamicModalOptions {
/**
* modal component
*/
component?: string | Component | AsyncComponent
/**
* bind props and attrs to modal
*/
bind?: {[key: string]: any}
/**
* register events to modal
*/
on?: VNodeData['on']
/**
* modal component slot
*
* @example
* ```js
* {
* slot: {
* default: {
* component: 'RegistedComponentName'
* bind: {
* yourPropsKey: propsValue
* }
* }
* }
* }
* ```
*/
slots?: {
[key: string]: {
component: string | Component | AsyncComponent
bind: {[key: string]: any}
}
}
}

export interface VueFinalModalProperty {
readonly openedModals: VueFinalModalComponant[]
readonly modals: VueFinalModalComponant[],
get(name: string): VueFinalModalComponant | undefined
show(name: string): void

show(name: string, params?: any): void
show(options: DynamicModalOptions, params?: any): void

hide(name: string): void
hideAll(): void
toggle(name: string, params?: any): void
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9089,6 +9089,11 @@ vue-template-es2015-compiler@^1.9.0:
resolved "https://registry.yarnpkg.com/vue-template-es2015-compiler/-/vue-template-es2015-compiler-1.9.1.tgz#1ee3bc9a16ecbf5118be334bb15f9c46f82f5825"
integrity sha512-4gDntzrifFnCEvyoO8PqyJDmguXgVPxKiIxrBKjIowvL9l+N66196+72XVYR8BBf1Uv1Fgt3bGevJ+sEmxfZzw==

vue@^2.6.12:
version "2.6.12"
resolved "https://registry.yarnpkg.com/vue/-/vue-2.6.12.tgz#f5ebd4fa6bd2869403e29a896aed4904456c9123"
integrity sha512-uhmLFETqPPNyuLLbsKz6ioJ4q7AZHzD8ZVFNATNyICSZouqP2Sz0rotWQC8UNBF6VGSCs5abnKJoStA6JbCbfg==

watchpack-chokidar2@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/watchpack-chokidar2/-/watchpack-chokidar2-2.0.1.tgz#38500072ee6ece66f3769936950ea1771be1c957"
Expand Down