From e558815fdbe8be25901a9db44c923446680e9bc6 Mon Sep 17 00:00:00 2001 From: mertsincan Date: Tue, 14 Jun 2022 13:45:31 +0100 Subject: [PATCH] Refactor on DynamicDialog d.ts files --- .../dialogservice/DialogService.d.ts | 26 +++---------------- .../DynamicDialogOptions.d.ts | 21 +++++++++++++++ src/components/usedialog/UseDialog.d.ts | 6 ++--- 3 files changed, 27 insertions(+), 26 deletions(-) diff --git a/src/components/dialogservice/DialogService.d.ts b/src/components/dialogservice/DialogService.d.ts index afb0bbeaf..ab57ce411 100644 --- a/src/components/dialogservice/DialogService.d.ts +++ b/src/components/dialogservice/DialogService.d.ts @@ -1,37 +1,17 @@ import { Plugin, VNode } from 'vue'; -import { DynamicDialogOptions } from '../dynamicdialogoptions'; +import { DynamicDialogOptions, DynamicDialogInstance } from '../dynamicdialogoptions'; declare const plugin: Plugin; export default plugin; -export interface DialogInstance { - /** - * Dynamic component for content template - */ - content: VNode | undefined; - /** - * Instance options - * @see DynamicDialogOptions - */ - options: DynamicDialogOptions; - /** - * Custom data object - */ - data: any; - /** - * Closes the dialog. - * @param {*} params - Parameters sent by the user to the root instance - */ - close: (params?: any) => void; -} - export interface DialogServiceMethods { /** * Displays the dialog using the dynamic dialog object options. * @param {VNode} content - Dynamic component for content template * @param {DynamicDialogOptions} options - DynamicDialog Object + * @return {@link DynamicDialogInstance} */ - open(content: VNode, options?: DynamicDialogOptions): DialogInstance; + open: (content: VNode, options?: DynamicDialogOptions) => DynamicDialogInstance; } declare module 'vue/types/vue' { diff --git a/src/components/dynamicdialogoptions/DynamicDialogOptions.d.ts b/src/components/dynamicdialogoptions/DynamicDialogOptions.d.ts index d47c86802..15f6ce86b 100644 --- a/src/components/dynamicdialogoptions/DynamicDialogOptions.d.ts +++ b/src/components/dynamicdialogoptions/DynamicDialogOptions.d.ts @@ -51,3 +51,24 @@ export interface DynamicDialogOptions { */ [key: string]: any; } + +export interface DynamicDialogInstance { + /** + * Dynamic component for content template + */ + content: VNode | undefined; + /** + * Instance options + * @see DynamicDialogOptions + */ + options: DynamicDialogOptions; + /** + * Custom data object + */ + data: any; + /** + * Closes the dialog. + * @param {*} params - Parameters sent by the user to the root instance + */ + close: (params?: any) => void; +} diff --git a/src/components/usedialog/UseDialog.d.ts b/src/components/usedialog/UseDialog.d.ts index cb655ca6c..ce8004961 100644 --- a/src/components/usedialog/UseDialog.d.ts +++ b/src/components/usedialog/UseDialog.d.ts @@ -1,6 +1,6 @@ -//import { DynamicDialogOptions } from '../dynamicdialogoptions'; +import { VNode } from 'vue'; +import { DynamicDialogOptions, DynamicDialogInstance } from '../dynamicdialogoptions'; export declare function useDialog(): { - open: (dialog: any) => void; - close: () => void; + open: (content: VNode, options?: DynamicDialogOptions) => DynamicDialogInstance; }