From e325a0af8d37bab9ae6518a5b3b4311d5c74d624 Mon Sep 17 00:00:00 2001 From: mertsincan Date: Wed, 1 Jun 2022 07:51:00 +0100 Subject: [PATCH] Refactor #2602 --- api-generator/components/portal.js | 28 +++++++++++++++++++++++ src/components/portal/Portal.d.ts | 36 ++++++++++++++++++++++++++++++ src/components/portal/package.json | 1 + 3 files changed, 65 insertions(+) create mode 100644 api-generator/components/portal.js create mode 100644 src/components/portal/Portal.d.ts diff --git a/api-generator/components/portal.js b/api-generator/components/portal.js new file mode 100644 index 000000000..7e23b1d47 --- /dev/null +++ b/api-generator/components/portal.js @@ -0,0 +1,28 @@ +const PortalProps = [ + { + name: "appendTo", + type: "string", + default: "body", + description: 'A valid query selector or an HTMLElement to specify where the dialog gets attached. Special keywords are "body" for document body and "self" for the element itself.' + }, + { + name: "disabled", + type: "boolean", + default: "false", + description: "If disabled, the Portal feature is eliminated and the content is displayed directly." + } +]; + +const PortalEvents = []; + +const PortalSlots = []; + +module.exports = { + portal: { + name: "Portal", + description: "Portal moves its container to a specific location based on target elements. Basically it uses in the background.", + props: PortalProps, + events: PortalEvents, + slots: PortalSlots + } +}; diff --git a/src/components/portal/Portal.d.ts b/src/components/portal/Portal.d.ts new file mode 100644 index 000000000..767d53387 --- /dev/null +++ b/src/components/portal/Portal.d.ts @@ -0,0 +1,36 @@ +import { VNode } from 'vue'; +import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers'; + +type PortalAppendToType = 'body' | 'self' | string | undefined; + +export interface PortalProps { + /** + * A valid query selector or an HTMLElement to specify where the dialog gets attached. Special keywords are 'body' for document body and 'self' for the element itself. + * @see PortalAppendToType + * Default value is 'body'. + */ + appendTo?: PortalAppendToType; + /** + * If disabled, the Portal feature is eliminated and the content is displayed directly. + */ + disabled?: boolean | undefined; +} + +export interface PortalSlots { + /** + * Default content slot. + */ + default: () => VNode[]; +} + +export declare type PortalEmits = { } + +declare class Portal extends ClassComponent { } + +declare module '@vue/runtime-core' { + interface GlobalComponents { + Portal: GlobalComponentConstructor + } +} + +export default Portal; diff --git a/src/components/portal/package.json b/src/components/portal/package.json index cccf68768..4153445b6 100644 --- a/src/components/portal/package.json +++ b/src/components/portal/package.json @@ -2,6 +2,7 @@ "main": "./portal.cjs.js", "module": "./portal.esm.js", "unpkg": "./portal.min.js", + "types": "./Portal.d.ts", "browser": { "./sfc": "./Portal.vue" }