@progress/kendo-vue-popup 8.0.3-develop.1 → 8.0.3-develop.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Popup.d.ts ADDED
@@ -0,0 +1,150 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2026 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ import { PropType } from 'vue';
9
+ import { Position } from './models/Position';
10
+ import { PopupProps } from './models/PopupProps';
11
+ /**
12
+ * @hidden
13
+ */
14
+ declare const Popup: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
15
+ appendTo: {
16
+ type: PropType<string>;
17
+ default: string;
18
+ };
19
+ anchor: {
20
+ type: PropType<string>;
21
+ default: string;
22
+ };
23
+ className: PropType<string | string[]>;
24
+ id: PropType<string>;
25
+ popupClass: PropType<string | string[]>;
26
+ collision: {
27
+ type: PropType<object>;
28
+ default: () => {
29
+ horizontal: string;
30
+ vertical: string;
31
+ };
32
+ };
33
+ anchorAlign: {
34
+ type: PropType<object>;
35
+ default: () => {
36
+ horizontal: string;
37
+ vertical: string;
38
+ };
39
+ };
40
+ popupAlign: {
41
+ type: PropType<object>;
42
+ default: () => {
43
+ horizontal: string;
44
+ vertical: string;
45
+ };
46
+ };
47
+ offset: {
48
+ type: PropType<import('.').Offset>;
49
+ default: () => {
50
+ left: number;
51
+ top: number;
52
+ };
53
+ };
54
+ show: {
55
+ type: PropType<boolean>;
56
+ default: boolean;
57
+ };
58
+ animate: {
59
+ type: PropType<boolean | import('.').PopupAnimation>;
60
+ default: boolean;
61
+ };
62
+ direction: {
63
+ type: PropType<string>;
64
+ default: string;
65
+ };
66
+ onOpen: PropType<(event: import('.').PopupOpenEvent) => void>;
67
+ onClose: PropType<(event: import('.').PopupCloseEvent) => void>;
68
+ }>, {}, {
69
+ hasMounted: boolean;
70
+ }, {}, {
71
+ onOpened(): void;
72
+ onClosing(): void;
73
+ onClosed(): void;
74
+ transitionDuration(): {
75
+ transitionEnterDuration: number;
76
+ transitionExitDuration: number;
77
+ };
78
+ getParentRef(anchor: string, isAnchor?: boolean): any;
79
+ position(settings: PopupProps, element: HTMLElement, anchor: string): Position;
80
+ calculatePosition($props: any, appendToElement?: HTMLElement): Position;
81
+ attachRepositionHandlers(element: any): void;
82
+ detachRepositionHandlers(): void;
83
+ reposition(): void;
84
+ getCurrentZIndex(): number;
85
+ }, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
86
+ appendTo: {
87
+ type: PropType<string>;
88
+ default: string;
89
+ };
90
+ anchor: {
91
+ type: PropType<string>;
92
+ default: string;
93
+ };
94
+ className: PropType<string | string[]>;
95
+ id: PropType<string>;
96
+ popupClass: PropType<string | string[]>;
97
+ collision: {
98
+ type: PropType<object>;
99
+ default: () => {
100
+ horizontal: string;
101
+ vertical: string;
102
+ };
103
+ };
104
+ anchorAlign: {
105
+ type: PropType<object>;
106
+ default: () => {
107
+ horizontal: string;
108
+ vertical: string;
109
+ };
110
+ };
111
+ popupAlign: {
112
+ type: PropType<object>;
113
+ default: () => {
114
+ horizontal: string;
115
+ vertical: string;
116
+ };
117
+ };
118
+ offset: {
119
+ type: PropType<import('.').Offset>;
120
+ default: () => {
121
+ left: number;
122
+ top: number;
123
+ };
124
+ };
125
+ show: {
126
+ type: PropType<boolean>;
127
+ default: boolean;
128
+ };
129
+ animate: {
130
+ type: PropType<boolean | import('.').PopupAnimation>;
131
+ default: boolean;
132
+ };
133
+ direction: {
134
+ type: PropType<string>;
135
+ default: string;
136
+ };
137
+ onOpen: PropType<(event: import('.').PopupOpenEvent) => void>;
138
+ onClose: PropType<(event: import('.').PopupCloseEvent) => void>;
139
+ }>> & Readonly<{}>, {
140
+ animate: boolean;
141
+ anchor: string;
142
+ direction: string;
143
+ anchorAlign: object;
144
+ offset: import('.').Offset;
145
+ appendTo: string;
146
+ collision: object;
147
+ popupAlign: object;
148
+ show: boolean;
149
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
150
+ export { Popup };
@@ -12,4 +12,4 @@
12
12
  * Licensed under commercial license. See LICENSE.md in the package root for more information
13
13
  *-------------------------------------------------------------------------------------------
14
14
  */
15
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("vue"),require("@progress/kendo-vue-animation"),require("@progress/kendo-popup-common"),require("@progress/kendo-vue-common")):"function"==typeof define&&define.amd?define(["exports","vue","@progress/kendo-vue-animation","@progress/kendo-popup-common","@progress/kendo-vue-common"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).KendoVuePopup={},t.Vue,t.KendoVueAnimation,t.KendoPopupCommon,t.KendoVueCommon)}(this,(function(t,e,n,o,i){"use strict";const s=(t,e)=>t||{height:0,left:e.left,top:e.top,width:0},r=()=>"undefined"!=typeof document&&!!document.body,l=()=>"undefined"!=typeof window,d=/auto|scroll/,a=t=>{const e=window.getComputedStyle(t);return`${e.overflow}${e.overflowX}${e.overflowY}`},p=1e3/60,c=(()=>{if(!r())return!1;const t=document.createElement("div");if(t.style.transform="matrix(10, 0, 0, 10, 0, 0)",t.innerHTML="<div>child</div>",document.body.appendChild(t),t&&t.firstChild){const e=t.firstChild;e.style.position="fixed",e.style.top="10px"}const e=10!==t.children[0].getBoundingClientRect().top;return document.body.removeChild(t),e})(),h="fit",u="flip",f="left",m="bottom",g="top";class v{constructor(t){this._dom=t}alignElement(t){const{anchor:e,element:n,anchorAlign:o,elementAlign:i,offset:s}=t,r=this._dom.hasOffsetParent(n)?this.relativeRect(e,n,s):this.absoluteRect(e,n,s);return this._dom.align({anchorAlign:o,anchorRect:r,elementAlign:i,elementRect:this._dom.offset(n)})}absoluteRect(t,e,n){const o=this._dom,i=((t,e)=>e?{height:t.height,left:t.left-e.left,top:t.top-e.top,width:t.width}:t)(s(o.offset(t),n),o.stackingElementOffset(e)),r=o.stackingElementScroll(e),l=o.addScroll(i,r),d=this.elementScrollPosition(t,e),a=o.removeScroll(l,d);return a.left+=window.scrollX||window.pageXOffset,a.top+=window.scrollY||window.pageYOffset,a}elementScrollPosition(t,e){return t?{x:0,y:0}:this._dom.scrollPosition(e)}relativeRect(t,e,n){return s(this._dom.position(t,e),n)}}class w{addOffset(t,e){return{left:t.left+e.left,top:t.top+e.top}}align(t){return o.align(t)}boundingOffset(t){return o.boundingOffset(t)}getWindow(){return l()?window:null}isBodyOffset(t){return o.isBodyOffset(t)}hasOffsetParent(t){if(!t)return!1;const e=t.offsetParent;return e&&!("BODY"===e.nodeName&&"static"===window.getComputedStyle(e).position)}offset(t){return t?o.offset(t):null}staticOffset(t){if(!t)return null;const{left:e,top:n}=t.style;t.style.left="0px",t.style.top="0px";const i=o.offset(t);return t.style.left=e,t.style.top=n,i}position(t,e){if(!t||!e)return null;const n=o.siblingContainer(t,e);return o.positionWithScroll(t,n)}relativeOffset(t,e){return o.applyLocationOffset(this.offset(t),e,this.isBodyOffset(t))}addScroll(t,e){return o.addScroll(t,e)}removeScroll(t,e){return o.removeScroll(t,e)}restrictToView(t){return o.restrictToView(t)}scrollPosition(t){return o.scrollPosition(t)}scrollableParents(t){return(t=>{const e=[];if(!r()||!l())return e;let n=t.parentElement;for(;n;)d.test(a(n))&&e.push(n),n=n.parentElement;return e.push(window),e})(t)}stackingElementOffset(t){const e=this.getRelativeContextElement(t);return e?o.offset(e):null}stackingElementScroll(t){const e=this.getRelativeContextElement(t);return e?{x:e.scrollLeft,y:e.scrollTop}:{x:0,y:0}}stackingElementViewPort(t){const e=this.getRelativeContextElement(t);return e?{height:e.scrollHeight,width:e.scrollWidth}:null}getRelativeContextElement(t){if(!t||!c)return null;let e=t.parentElement;for(;e;){if("none"!==window.getComputedStyle(e).transform)return e;e=e.parentElement}return null}useRelativePosition(t){return!!this.getRelativeContextElement(t)}windowViewPort(t){return o.getWindowViewPort(t)}zIndex(t,e){return((t,e)=>{if(!t||!r()||!l())return null;const n=o.siblingContainer(t,e);if(!n)return null;const i=[t].concat(o.parents(t,n)).reduce(((t,e)=>{const n=e.style.zIndex||window.getComputedStyle(e).zIndex,o=parseInt(n,10);return o>t?o:t}),0);return i?i+1:null})(t,e)}zoomLevel(){return r()&&l()?parseFloat((document.documentElement.clientWidth/window.innerWidth).toFixed(2)):1}isZoomed(){return this.zoomLevel()>1}}class y{constructor(t){this._dom=t}positionElement(t){const{anchor:e,currentLocation:n,element:o,anchorAlign:i,elementAlign:r,collisions:l}=t,d=this._dom,a=t.viewPort||d.stackingElementViewPort(o)||d.windowViewPort(o),p=s(d.offset(e),n),c=((t,e)=>e?{height:t.height,left:e.left,top:e.top,width:t.width}:t)(d.staticOffset(o),n),h=this.elementRect(o,c),u=d.restrictToView({anchorAlign:i,anchorRect:p,collisions:l,elementAlign:r,elementRect:h,viewPort:a});return{flipped:u.flipped,offset:d.addOffset(c,u.offset)}}elementRect(t,e){return this._dom.removeScroll(e,this._dom.scrollPosition(t))}}const _={name:"@progress/kendo-vue-popup",productName:"Kendo UI for Vue",productCode:"KENDOUIVUE",productCodes:["KENDOUIVUE"],publishDate:1657007252,version:"8.0.3-develop.1",licensingDocsUrl:"https://www.telerik.com/kendo-vue-ui/my-license/?utm_medium=product&utm_source=kendovue&utm_campaign=kendo-ui-vue-purchase-license-keys-warning"};const C={left:-1e3,top:0},E="k-animation-container-shown",b="k-popup",$=e.defineComponent({name:"Popup",props:{appendTo:{type:String,default:""},anchor:{type:[String,Object],default:""},className:String,id:String,popupClass:String,collision:{type:Object,default:function(){return{horizontal:h,vertical:u}}},anchorAlign:{type:Object,default:function(){return{horizontal:f,vertical:m}}},popupAlign:{type:Object,default:function(){return{horizontal:f,vertical:g}}},offset:{type:Object,default:function(){return C}},show:{type:Boolean,default:!1},animate:{type:[Boolean,Object],default:!0},direction:{type:String,default:"down"},onOpen:Function,onClose:Function},inject:{kCurrentZIndex:{default:null}},data:()=>({hasMounted:!1}),created(){i.validatePackage(_),this.mountedAppendTo=void 0,this.mountedAnchor=void 0,this._clonedElement=void 0,this._flipped=!1,this._offsetTop=0,this._offsetLeft=-1e3,this._exitingAnimation=!1,this._prevShow=!1,this._prevShow=this.$props.show,this._domService=new w,this._alignService=new v(this._domService),this._positionService=new y(this._domService),this.reposition=function(t,e,n={}){let o,i,s,r,l=0;n=n||{};const d=function(){l=!1===n.leading?0:(new Date).getTime(),o=null,r=t.apply(i,s),o||(i=s=null)};return function(){const a=(new Date).getTime();!l&&!1===n.leading&&(l=a);const p=e-(a-l);return i=this,s=arguments,p<=0||p>e?(o&&(clearTimeout(o),o=null),l=a,r=t.apply(i,s),o||(i=s=null)):!o&&!1!==n.trailing&&(o=setTimeout(d,p)),r}}(this.reposition.bind(this),p)},mounted(){i.canUseDOM&&(this.mountedAppendTo=this.appendTo?this.getParentRef(this.appendTo):document.body,this.mountedAnchor=this.anchor?this.getParentRef(this.anchor,!0):document.body),this._parentElement=this.$el.parentElement,this._clonedElement=this.$el.cloneNode(!0),this.hasMounted=!0,this.mountedAppendTo.appendChild(this.$el)},updated(){this._prevShow=this.$props.show},unmounted(){this.detachRepositionHandlers()},beforeUnmount(){this._parentElement&&this._parentElement.appendChild(this.$el)},methods:{onOpened(){const t=this.$el;this.$props.show&&t.classList.add(E),this.attachRepositionHandlers(t),this.$emit("open",{target:this})},onClosing(){this.$props.show||this.$el.classList.remove(E),this.detachRepositionHandlers()},onClosed(){this._exitingAnimation&&(this._exitingAnimation=!1,this.$forceUpdate()),this.$emit("close",{target:this})},transitionDuration(){const t=this.$props.animate;let e=0,n=0;return t&&(!0===t?e=n=void 0:(e=t.openDuration,n=t.closeDuration)),{transitionEnterDuration:e,transitionExitDuration:n}},getParentRef(t,e){let n=this.$parent;for(;!n.$refs[t];){if(n&&n.kendoAnchorRef&&e)return n.kendoAnchorRef;if(n=n.$parent,!n&&i.canUseDOM)return document.getElementById(t)||document.body}return n.$refs[t].$el||n.$refs[t]},position(t,e,n){const{anchorAlign:o,popupAlign:i,collision:s,offset:r}=t,l=n?this.mountedAnchor:document.body,d=this._alignService.alignElement({anchor:n?l:void 0,element:e,elementAlign:i,anchorAlign:o,offset:r});return this._positionService.positionElement({anchor:l,anchorAlign:o,collisions:s,element:e,currentLocation:d,elementAlign:i})},calculatePosition(t,e){if(!e||!l()||!i.canUseDOM)return{flipped:!1,offset:t.offset};const n=i.getDefaultSlots(this),o=document.createElement("div"),s=this.$el&&this.$el.firstChild&&this.$el.firstChild.firstChild?this.$el.firstChild.firstChild.cloneNode(!0):null,r=s&&s.getBoundingClientRect?s:this._clonedElement;if(r)o.appendChild(r);else{const t=n&&n[0].props?n[0].props.class:"",e=this.$props.popupClass;o.innerHTML=`<div class="k-animation-container k-animation-container-relative">\n <div class="k-popup k-animation-container k-animation-container-relative">\n <div class="${t} ${e}" >\n </div>\n </div>\n </div>`}if(e.appendChild(o),o&&o.firstChild){const t=o.firstChild;t.style.position="absolute",t.style.visibility="hidden",t.style.display="block",t.style.left="-1000",t.style.top="0";const e=n&&n[0].props?n[0].props.style:{};if(e)for(const[n,o]of Object.entries(e))t.style[n]=o}const d=this.position(t,o.firstChild,this.$props.anchor);return o.parentNode.removeChild(o),d},attachRepositionHandlers(t){this.detachRepositionHandlers(),this._scrollableParents=this._domService.scrollableParents(this.$props.anchor?this.mountedAnchor:t),this._scrollableParents.map((t=>t.addEventListener("scroll",this.reposition))),window.addEventListener("resize",this.reposition)},detachRepositionHandlers(){this._scrollableParents&&(this._scrollableParents.map((t=>t.removeEventListener("scroll",this.reposition))),this._scrollableParents=void 0),window.removeEventListener("resize",this.reposition)},reposition(){this._clonedElement=this.$el.cloneNode(!0),this.$forceUpdate()},getCurrentZIndex(){return this.kCurrentZIndex?this.kCurrentZIndex+1:100}},render(){const{className:t,popupClass:o,show:s,id:r}=this.$props,d=i.getDefaultSlots(this),a=d,p=l()?this.$props.appendTo?this.mountedAppendTo||this.getParentRef(this.$props.appendTo):document.body:void 0;if(this.$props.show){const t=this.calculatePosition(this.$props,p);this._offsetLeft=t.offset.left,this._offsetTop=t.offset.top,this._flipped=!!t.flipped}const c="down"===this.$props.direction?this._flipped?"up":"down":this._flipped?"down":"up",{transitionEnterDuration:h,transitionExitDuration:u}=this.transitionDuration(),f=this.getCurrentZIndex();return this._exitingAnimation=this._exitingAnimation||this._prevShow&&!s,this.hasMounted?s||this._exitingAnimation&&p?e.createVNode(n.Slide,{id:r,role:this.appendTo?"":"region",componentChildClassName:[o,b],className:t,onEntered:this.onOpened,onExiting:this.onClosing,onExited:this.onClosed,direction:c,style:{zIndex:f,position:"absolute",top:this._offsetTop+"px",left:this._offsetLeft+"px"},transitionEnterDuration:h,transitionExitDuration:u,appear:s},function(t){return"function"==typeof t||"[object Object]"===Object.prototype.toString.call(t)&&!e.isVNode(t)}(a)?a:{default:()=>[a]}):null:e.createVNode("div",{style:{display:"none"},class:t},[e.createVNode("div",{class:[o,b]},[d])])}});t.Popup=$}));
15
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("vue"),require("@progress/kendo-vue-animation"),require("@progress/kendo-popup-common"),require("@progress/kendo-vue-common")):"function"==typeof define&&define.amd?define(["exports","vue","@progress/kendo-vue-animation","@progress/kendo-popup-common","@progress/kendo-vue-common"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).KendoVuePopup={},t.Vue,t.KendoVueAnimation,t.KendoPopupCommon,t.KendoVueCommon)}(this,function(t,e,n,o,i){"use strict";const s=(t,e)=>t||{height:0,left:e.left,top:e.top,width:0},r=()=>"undefined"!=typeof document&&!!document.body,l=()=>"undefined"!=typeof window,d=/auto|scroll/,a=t=>{const e=window.getComputedStyle(t);return`${e.overflow}${e.overflowX}${e.overflowY}`},p=1e3/60,c=(()=>{if(!r())return!1;const t=document.createElement("div");if(t.style.transform="matrix(10, 0, 0, 10, 0, 0)",t.innerHTML="<div>child</div>",document.body.appendChild(t),t&&t.firstChild){const e=t.firstChild;e.style.position="fixed",e.style.top="10px"}const e=10!==t.children[0].getBoundingClientRect().top;return document.body.removeChild(t),e})(),h="fit",u="flip",f="left",m="bottom",g="top";class v{constructor(t){this._dom=t}alignElement(t){const{anchor:e,element:n,anchorAlign:o,elementAlign:i,offset:s}=t,r=this._dom.hasOffsetParent(n)?this.relativeRect(e,n,s):this.absoluteRect(e,n,s);return this._dom.align({anchorAlign:o,anchorRect:r,elementAlign:i,elementRect:this._dom.offset(n)})}absoluteRect(t,e,n){const o=this._dom,i=((t,e)=>e?{height:t.height,left:t.left-e.left,top:t.top-e.top,width:t.width}:t)(s(o.offset(t),n),o.stackingElementOffset(e)),r=o.stackingElementScroll(e),l=o.addScroll(i,r),d=this.elementScrollPosition(t,e),a=o.removeScroll(l,d);return a.left+=window.scrollX||window.pageXOffset,a.top+=window.scrollY||window.pageYOffset,a}elementScrollPosition(t,e){return t?{x:0,y:0}:this._dom.scrollPosition(e)}relativeRect(t,e,n){return s(this._dom.position(t,e),n)}}class w{addOffset(t,e){return{left:t.left+e.left,top:t.top+e.top}}align(t){return o.align(t)}boundingOffset(t){return o.boundingOffset(t)}getWindow(){return l()?window:null}isBodyOffset(t){return o.isBodyOffset(t)}hasOffsetParent(t){if(!t)return!1;const e=t.offsetParent;return e&&!("BODY"===e.nodeName&&"static"===window.getComputedStyle(e).position)}offset(t){return t?o.offset(t):null}staticOffset(t){if(!t)return null;const{left:e,top:n}=t.style;t.style.left="0px",t.style.top="0px";const i=o.offset(t);return t.style.left=e,t.style.top=n,i}position(t,e){if(!t||!e)return null;const n=o.siblingContainer(t,e);return o.positionWithScroll(t,n)}relativeOffset(t,e){return o.applyLocationOffset(this.offset(t),e,this.isBodyOffset(t))}addScroll(t,e){return o.addScroll(t,e)}removeScroll(t,e){return o.removeScroll(t,e)}restrictToView(t){return o.restrictToView(t)}scrollPosition(t){return o.scrollPosition(t)}scrollableParents(t){return(t=>{const e=[];if(!r()||!l())return e;let n=t.parentElement;for(;n;)d.test(a(n))&&e.push(n),n=n.parentElement;return e.push(window),e})(t)}stackingElementOffset(t){const e=this.getRelativeContextElement(t);return e?o.offset(e):null}stackingElementScroll(t){const e=this.getRelativeContextElement(t);return e?{x:e.scrollLeft,y:e.scrollTop}:{x:0,y:0}}stackingElementViewPort(t){const e=this.getRelativeContextElement(t);return e?{height:e.scrollHeight,width:e.scrollWidth}:null}getRelativeContextElement(t){if(!t||!c)return null;let e=t.parentElement;for(;e;){if("none"!==window.getComputedStyle(e).transform)return e;e=e.parentElement}return null}useRelativePosition(t){return!!this.getRelativeContextElement(t)}windowViewPort(t){return o.getWindowViewPort(t)}zIndex(t,e){return((t,e)=>{if(!t||!r()||!l())return null;const n=o.siblingContainer(t,e);if(!n)return null;const i=[t].concat(o.parents(t,n)).reduce((t,e)=>{const n=e.style.zIndex||window.getComputedStyle(e).zIndex,o=parseInt(n,10);return o>t?o:t},0);return i?i+1:null})(t,e)}zoomLevel(){return r()&&l()?parseFloat((document.documentElement.clientWidth/window.innerWidth).toFixed(2)):1}isZoomed(){return this.zoomLevel()>1}}class y{constructor(t){this._dom=t}positionElement(t){const{anchor:e,currentLocation:n,element:o,anchorAlign:i,elementAlign:r,collisions:l}=t,d=this._dom,a=t.viewPort||d.stackingElementViewPort(o)||d.windowViewPort(o),p=s(d.offset(e),n),c=((t,e)=>e?{height:t.height,left:e.left,top:e.top,width:t.width}:t)(d.staticOffset(o),n),h=this.elementRect(o,c),u=d.restrictToView({anchorAlign:i,anchorRect:p,collisions:l,elementAlign:r,elementRect:h,viewPort:a});return{flipped:u.flipped,offset:d.addOffset(c,u.offset)}}elementRect(t,e){return this._dom.removeScroll(e,this._dom.scrollPosition(t))}}const _={name:"@progress/kendo-vue-popup",productName:"Kendo UI for Vue",productCode:"KENDOUIVUE",productCodes:["KENDOUIVUE"],publishDate:1657007252,version:"8.0.3-develop.3",licensingDocsUrl:"https://www.telerik.com/kendo-vue-ui/my-license/?utm_medium=product&utm_source=kendovue&utm_campaign=kendo-ui-vue-purchase-license-keys-warning"};const C={left:-1e3,top:0},E="k-animation-container-shown",b="k-popup",$=e.defineComponent({name:"Popup",props:{appendTo:{type:String,default:""},anchor:{type:[String,Object],default:""},className:String,id:String,popupClass:String,collision:{type:Object,default:function(){return{horizontal:h,vertical:u}}},anchorAlign:{type:Object,default:function(){return{horizontal:f,vertical:m}}},popupAlign:{type:Object,default:function(){return{horizontal:f,vertical:g}}},offset:{type:Object,default:function(){return C}},show:{type:Boolean,default:!1},animate:{type:[Boolean,Object],default:!0},direction:{type:String,default:"down"},onOpen:Function,onClose:Function},inject:{kCurrentZIndex:{default:null}},data:()=>({hasMounted:!1}),created(){i.validatePackage(_),this.mountedAppendTo=void 0,this.mountedAnchor=void 0,this._clonedElement=void 0,this._flipped=!1,this._offsetTop=0,this._offsetLeft=-1e3,this._exitingAnimation=!1,this._prevShow=!1,this._prevShow=this.$props.show,this._domService=new w,this._alignService=new v(this._domService),this._positionService=new y(this._domService),this.reposition=function(t,e,n={}){let o,i,s,r,l=0;n=n||{};const d=function(){l=!1===n.leading?0:(new Date).getTime(),o=null,r=t.apply(i,s),o||(i=s=null)};return function(){const a=(new Date).getTime();!l&&!1===n.leading&&(l=a);const p=e-(a-l);return i=this,s=arguments,p<=0||p>e?(o&&(clearTimeout(o),o=null),l=a,r=t.apply(i,s),o||(i=s=null)):!o&&!1!==n.trailing&&(o=setTimeout(d,p)),r}}(this.reposition.bind(this),p)},mounted(){i.canUseDOM&&(this.mountedAppendTo=this.appendTo?this.getParentRef(this.appendTo):document.body,this.mountedAnchor=this.anchor?this.getParentRef(this.anchor,!0):document.body),this._parentElement=this.$el.parentElement,this._clonedElement=this.$el.cloneNode(!0),this.hasMounted=!0,this.mountedAppendTo.appendChild(this.$el)},updated(){this._prevShow=this.$props.show},unmounted(){this.detachRepositionHandlers()},beforeUnmount(){this._parentElement&&this._parentElement.appendChild(this.$el)},methods:{onOpened(){const t=this.$el;this.$props.show&&t.classList.add(E),this.attachRepositionHandlers(t),this.$emit("open",{target:this})},onClosing(){this.$props.show||this.$el.classList.remove(E),this.detachRepositionHandlers()},onClosed(){this._exitingAnimation&&(this._exitingAnimation=!1,this.$forceUpdate()),this.$emit("close",{target:this})},transitionDuration(){const t=this.$props.animate;let e=0,n=0;return t&&(!0===t?e=n=void 0:(e=t.openDuration,n=t.closeDuration)),{transitionEnterDuration:e,transitionExitDuration:n}},getParentRef(t,e){let n=this.$parent;for(;!n.$refs[t];){if(n&&n.kendoAnchorRef&&e)return n.kendoAnchorRef;if(n=n.$parent,!n&&i.canUseDOM)return document.getElementById(t)||document.body}return n.$refs[t].$el||n.$refs[t]},position(t,e,n){const{anchorAlign:o,popupAlign:i,collision:s,offset:r}=t,l=n?this.mountedAnchor:document.body,d=this._alignService.alignElement({anchor:n?l:void 0,element:e,elementAlign:i,anchorAlign:o,offset:r});return this._positionService.positionElement({anchor:l,anchorAlign:o,collisions:s,element:e,currentLocation:d,elementAlign:i})},calculatePosition(t,e){if(!e||!l()||!i.canUseDOM)return{flipped:!1,offset:t.offset};const n=i.getDefaultSlots(this),o=document.createElement("div"),s=this.$el&&this.$el.firstChild&&this.$el.firstChild.firstChild?this.$el.firstChild.firstChild.cloneNode(!0):null,r=s&&s.getBoundingClientRect?s:this._clonedElement;if(r)o.appendChild(r);else{const t=n&&n[0].props?n[0].props.class:"",e=this.$props.popupClass;o.innerHTML=`<div class="k-animation-container k-animation-container-relative">\n <div class="k-popup k-animation-container k-animation-container-relative">\n <div class="${t} ${e}" >\n </div>\n </div>\n </div>`}if(e.appendChild(o),o&&o.firstChild){const t=o.firstChild;t.style.position="absolute",t.style.visibility="hidden",t.style.display="block",t.style.left="-1000",t.style.top="0";const e=n&&n[0].props?n[0].props.style:{};if(e)for(const[n,o]of Object.entries(e))t.style[n]=o}const d=this.position(t,o.firstChild,this.$props.anchor);return o.parentNode.removeChild(o),d},attachRepositionHandlers(t){this.detachRepositionHandlers(),this._scrollableParents=this._domService.scrollableParents(this.$props.anchor?this.mountedAnchor:t),this._scrollableParents.map(t=>t.addEventListener("scroll",this.reposition)),window.addEventListener("resize",this.reposition)},detachRepositionHandlers(){this._scrollableParents&&(this._scrollableParents.map(t=>t.removeEventListener("scroll",this.reposition)),this._scrollableParents=void 0),window.removeEventListener("resize",this.reposition)},reposition(){this._clonedElement=this.$el.cloneNode(!0),this.$forceUpdate()},getCurrentZIndex(){return this.kCurrentZIndex?this.kCurrentZIndex+1:100}},render(){const{className:t,popupClass:o,show:s,id:r}=this.$props,d=i.getDefaultSlots(this),a=d,p=l()?this.$props.appendTo?this.mountedAppendTo||this.getParentRef(this.$props.appendTo):document.body:void 0;if(this.$props.show){const t=this.calculatePosition(this.$props,p);this._offsetLeft=t.offset.left,this._offsetTop=t.offset.top,this._flipped=!!t.flipped}const c="down"===this.$props.direction?this._flipped?"up":"down":this._flipped?"down":"up",{transitionEnterDuration:h,transitionExitDuration:u}=this.transitionDuration(),f=this.getCurrentZIndex();return this._exitingAnimation=this._exitingAnimation||this._prevShow&&!s,this.hasMounted?s||this._exitingAnimation&&p?e.createVNode(n.Slide,{id:r,role:this.appendTo?"":"region",componentChildClassName:[o,b],className:t,onEntered:this.onOpened,onExiting:this.onClosing,onExited:this.onClosed,direction:c,style:{zIndex:f,position:"absolute",top:this._offsetTop+"px",left:this._offsetLeft+"px"},transitionEnterDuration:h,transitionExitDuration:u,appear:s},function(t){return"function"==typeof t||"[object Object]"===Object.prototype.toString.call(t)&&!e.isVNode(t)}(a)?a:{default:()=>[a]}):null:e.createVNode("div",{style:{display:"none"},class:t},[e.createVNode("div",{class:[o,b]},[d])])}});t.Popup=$});
package/index.d.mts CHANGED
@@ -5,331 +5,12 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import { ComponentOptionsMixin } from 'vue';
9
- import { ComponentProvideOptions } from 'vue';
10
- import { DefineComponent } from 'vue';
11
- import { ExtractPropTypes } from 'vue';
12
- import { Offset as Offset_2 } from '.';
13
- import { OffsetPosition } from '@progress/kendo-popup-common';
14
- import { PopupAnimation as PopupAnimation_2 } from '.';
15
- import { PopupCloseEvent as PopupCloseEvent_2 } from '.';
16
- import { PopupOpenEvent as PopupOpenEvent_2 } from '.';
17
- import { PropType } from 'vue';
18
- import { PublicProps } from 'vue';
19
-
20
- /**
21
- * Defines the horizontal and vertical aligning point of the Popup.
22
- */
23
- export declare interface Align {
24
- /**
25
- * Defines the possible horizontal point values that are relative to the anchor or the Popup.
26
- *
27
- * The available options are:
28
- * - `left`&mdash;Uses the leftmost point of the anchor element.
29
- * - `center`&mdash;Uses the center point of the anchor element.
30
- * - `right`&mdash;Uses the rightmost point of the anchor element.
31
- */
32
- horizontal: 'left' | 'center' | 'right';
33
- /**
34
- * Defines the possible vertical point values that are relative to the anchor or the Popup.
35
- *
36
- * The available options are:
37
- * - `top`&mdash;Uses the top point of the anchor element.
38
- * - `center`&mdash;Uses the center point of the anchor element.
39
- * - `bottom`&mdash;Uses the bottom point of the anchor element.
40
- */
41
- vertical: 'top' | 'center' | 'bottom';
42
- }
43
-
44
- /**
45
- * Defines the horizontal and vertical collision behavior of the Popup.
46
- */
47
- export declare interface Collision {
48
- /**
49
- * Defines the horizontal collision behavior of the Popup.
50
- */
51
- horizontal: CollisionType;
52
- /**
53
- * Defines the vertical collision behavior of the Popup.
54
- */
55
- vertical: CollisionType;
56
- }
57
-
58
- /**
59
- * Defines the possible collision behavior when the Popup is not fully visible.
60
- *
61
- * The available options are:
62
- * - `fit`&mdash;Moves the Popup horizontally until it is fully displayed in the viewport.
63
- * - `flip`&mdash;Flips the Popup position based on the origin and the position properties.
64
- */
65
- declare type CollisionType = 'fit' | 'flip';
66
-
67
- /**
68
- * The offset position of the Popup.
69
- */
70
- export declare interface Offset {
71
- /**
72
- * Defines the top position of the Popup.
73
- */
74
- top: number;
75
- /**
76
- * Defines the left position of the Popup.
77
- */
78
- left: number;
79
- }
80
-
81
- /**
82
- * @hidden
83
- */
84
- export declare const Popup: DefineComponent<ExtractPropTypes< {
85
- appendTo: {
86
- type: PropType<string>;
87
- default: string;
88
- };
89
- anchor: {
90
- type: PropType<string>;
91
- default: string;
92
- };
93
- className: PropType<string | string[]>;
94
- id: PropType<string>;
95
- popupClass: PropType<string | string[]>;
96
- collision: {
97
- type: PropType<object>;
98
- default: () => {
99
- horizontal: string;
100
- vertical: string;
101
- };
102
- };
103
- anchorAlign: {
104
- type: PropType<object>;
105
- default: () => {
106
- horizontal: string;
107
- vertical: string;
108
- };
109
- };
110
- popupAlign: {
111
- type: PropType<object>;
112
- default: () => {
113
- horizontal: string;
114
- vertical: string;
115
- };
116
- };
117
- offset: {
118
- type: PropType<Offset_2>;
119
- default: () => {
120
- left: number;
121
- top: number;
122
- };
123
- };
124
- show: {
125
- type: PropType<boolean>;
126
- default: boolean;
127
- };
128
- animate: {
129
- type: PropType<boolean | PopupAnimation_2>;
130
- default: boolean;
131
- };
132
- direction: {
133
- type: PropType<string>;
134
- default: string;
135
- };
136
- onOpen: PropType<(event: PopupOpenEvent_2) => void>;
137
- onClose: PropType<(event: PopupCloseEvent_2) => void>;
138
- }>, {}, {
139
- hasMounted: boolean;
140
- }, {}, {
141
- onOpened(): void;
142
- onClosing(): void;
143
- onClosed(): void;
144
- transitionDuration(): {
145
- transitionEnterDuration: number;
146
- transitionExitDuration: number;
147
- };
148
- getParentRef(anchor: string, isAnchor?: boolean): any;
149
- position(settings: PopupProps, element: HTMLElement, anchor: string): Position;
150
- calculatePosition($props: any, appendToElement?: HTMLElement): Position;
151
- attachRepositionHandlers(element: any): void;
152
- detachRepositionHandlers(): void;
153
- reposition(): void;
154
- getCurrentZIndex(): number;
155
- }, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ExtractPropTypes< {
156
- appendTo: {
157
- type: PropType<string>;
158
- default: string;
159
- };
160
- anchor: {
161
- type: PropType<string>;
162
- default: string;
163
- };
164
- className: PropType<string | string[]>;
165
- id: PropType<string>;
166
- popupClass: PropType<string | string[]>;
167
- collision: {
168
- type: PropType<object>;
169
- default: () => {
170
- horizontal: string;
171
- vertical: string;
172
- };
173
- };
174
- anchorAlign: {
175
- type: PropType<object>;
176
- default: () => {
177
- horizontal: string;
178
- vertical: string;
179
- };
180
- };
181
- popupAlign: {
182
- type: PropType<object>;
183
- default: () => {
184
- horizontal: string;
185
- vertical: string;
186
- };
187
- };
188
- offset: {
189
- type: PropType<Offset_2>;
190
- default: () => {
191
- left: number;
192
- top: number;
193
- };
194
- };
195
- show: {
196
- type: PropType<boolean>;
197
- default: boolean;
198
- };
199
- animate: {
200
- type: PropType<boolean | PopupAnimation_2>;
201
- default: boolean;
202
- };
203
- direction: {
204
- type: PropType<string>;
205
- default: string;
206
- };
207
- onOpen: PropType<(event: PopupOpenEvent_2) => void>;
208
- onClose: PropType<(event: PopupCloseEvent_2) => void>;
209
- }>> & Readonly<{}>, {
210
- animate: boolean;
211
- anchor: string;
212
- direction: string;
213
- anchorAlign: object;
214
- offset: Offset_2;
215
- appendTo: string;
216
- collision: object;
217
- popupAlign: object;
218
- show: boolean;
219
- }, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
220
-
221
- /**
222
- * The animation settings for the Popup component.
223
- */
224
- export declare interface PopupAnimation {
225
- /**
226
- * The duration of the opening animation in milliseconds. Defaults to `300ms`.
227
- */
228
- openDuration?: number;
229
- /**
230
- * The duration of the closing animation in milliseconds. Defaults to `300ms`.
231
- */
232
- closeDuration?: number;
233
- }
234
-
235
- /**
236
- * Represents the object of the `Close` Popup event.
237
- */
238
- export declare interface PopupCloseEvent {
239
- /**
240
- * An event target.
241
- */
242
- target: any;
243
- }
244
-
245
- /**
246
- * Represents the object of the `Open` Popup event.
247
- */
248
- export declare interface PopupOpenEvent {
249
- /**
250
- * An event target.
251
- */
252
- target: any;
253
- }
254
-
255
- /**
256
- * Represents the props of the [KendoVue Popup component]({% slug overview_popup %}).
257
- */
258
- export declare interface PopupProps extends PopupSettings {
259
- /**
260
- * Controls the Popup visibility ([see example]({% slug hidden_popup %})). Defaults to `false`.
261
- */
262
- show?: boolean;
263
- }
264
-
265
- /**
266
- * @hidden
267
- */
268
- export declare interface PopupSettings {
269
- /**
270
- * Controls the Popup animation ([see example]({% slug animations_popup %})). By default, the opening and closing animations are enabled.
271
- */
272
- animate?: boolean | PopupAnimation;
273
- /**
274
- * Specifies the element which will be used as an anchor ([see example]({% slug alignmentpositioning_popup %})). The Popup opens next to that element.
275
- */
276
- anchor: string;
277
- /**
278
- * Specifies the pivot point of the anchor ([see example]({% slug alignmentpositioning_popup %})).
279
- */
280
- anchorAlign?: object;
281
- /**
282
- * Defines the 'id' or 'ref' of the container to which the Popup will be appended. Defaults to [`body`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/body).
283
- */
284
- appendTo?: string;
285
- /**
286
- * Configures the collision behavior of the Popup ([see example]({% slug viewportboundarydetection_popup %})).
287
- */
288
- collision?: object;
289
- /**
290
- * Specifies the pivot point of the Popup ([see example]({% slug alignmentpositioning_popup %})).
291
- */
292
- popupAlign?: object;
293
- /**
294
- * Specifies a list of CSS classes that will be added to the Popup element.
295
- */
296
- className?: string | Array<string>;
297
- /**
298
- * Specifies the id that will be added to the Popup element.
299
- */
300
- id?: string;
301
- /**
302
- * Specifies the direction of the Expand Animation. Defaults to `down`.
303
- */
304
- direction?: string;
305
- /**
306
- * Specifies a list of CSS classes that will be added to the internal animated element ([see example]({% slug appearance_popup %})).
307
- */
308
- popupClass?: string | Array<string>;
309
- /**
310
- * Represents the styles that are applied to the Popup.
311
- */
312
- style?: any;
313
- /**
314
- * Specifies the absolute position of the element ([see example]({% slug alignmentpositioning_popup %})). The Popup opens next to that point. The pivot point of the Popup is defined by the `popupAlign` configuration option. The boundary detection is applied by using the window viewport.
315
- */
316
- offset?: Offset;
317
- /**
318
- * Fires after the Popup is opened and the opening animation ends.
319
- */
320
- onOpen?: (event: PopupOpenEvent) => void;
321
- /**
322
- * Fires after the Popup is closed.
323
- */
324
- onClose?: (event: PopupCloseEvent) => void;
325
- }
326
-
327
- /**
328
- * @hidden
329
- */
330
- declare interface Position {
331
- flipped?: boolean;
332
- offset?: OffsetPosition;
333
- }
334
-
335
- export { }
8
+ import { Popup } from './Popup.js';
9
+ import { PopupProps } from './models/PopupProps.js';
10
+ import { PopupSettings } from './models/PopupSettings.js';
11
+ import { Align } from './models/Align.js';
12
+ import { Collision } from './models/Collision.js';
13
+ import { Offset } from './models/Offset.js';
14
+ import { PopupAnimation } from './models/PopupAnimation.js';
15
+ import { OpenEvent as PopupOpenEvent, CloseEvent as PopupCloseEvent } from './models/Events.js';
16
+ export { Popup, type PopupProps, type PopupSettings, type Align, type Collision, type Offset, type PopupAnimation, type PopupOpenEvent, type PopupCloseEvent };