Refactor #2602
parent
3168936376
commit
e325a0af8d
|
@ -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 <Teleport> in the background.",
|
||||
props: PortalProps,
|
||||
events: PortalEvents,
|
||||
slots: PortalSlots
|
||||
}
|
||||
};
|
|
@ -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<PortalProps, PortalSlots, PortalEmits> { }
|
||||
|
||||
declare module '@vue/runtime-core' {
|
||||
interface GlobalComponents {
|
||||
Portal: GlobalComponentConstructor<Portal>
|
||||
}
|
||||
}
|
||||
|
||||
export default Portal;
|
|
@ -2,6 +2,7 @@
|
|||
"main": "./portal.cjs.js",
|
||||
"module": "./portal.esm.js",
|
||||
"unpkg": "./portal.min.js",
|
||||
"types": "./Portal.d.ts",
|
||||
"browser": {
|
||||
"./sfc": "./Portal.vue"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue