1 |
- !function(o,v){"use strict";var P="ht",r=o[P],w="px",f="left",i="top",$="bottom",k="right",u="innerHTML",j="className",H="",D="width",a="height",K="string",R="position",J="absolute",l="0",C="opacity",B="background",W=r.Default,E=W.getInternal(),m=r.Color,I=W.animate,T=W.isTouchable,F=null,s=(Math.sqrt,o.parseInt),Q=o.setTimeout,_=(Math.round,m.titleIconBackground),S=function(F){return typeof F===K||F instanceof String},p=function(){return document},X=function(g){return p().createElement(g)},q=function(){var x=X("div");return x.tabIndex=-1,x.style.outline="none",x},V=function(){return X("canvas")},n=function(z,c){N(z,"-webkit-transform",c),N(z,"-ms-transform",c),N(z,"transform",c)},N=function(T,O,s){T.style.setProperty(O,s,F)},U=function(d,k,L){W.def(r.widget[d],k,L)},e=function(h,Y){h.appendChild(Y)},g=function(N,m){N.removeChild(m)},y=function(){return p().body},d=function(){return p().documentElement},t=function(){return d().clientWidth},L=function(){return d().clientHeight},Z=function(z,S,c,p){z.addEventListener(S,c,!!p)},O=function(H){var Q=H.touches[0];return Q?Q:H.changedTouches[0]};E.addMethod(W,{dialogCloseIcon:{width:100,height:100,comps:[{type:"shape",points:[10,10,90,90],segments:[1,2],borderWidth:8,borderColor:_},{type:"shape",points:[90,10,10,90],segments:[1,2],borderWidth:8,borderColor:_}]},dialogMaximizeIcon:{width:100,height:100,comps:[{type:"rect",rect:[10,15,80,75],borderWidth:6,borderColor:_},{type:"rect",rect:[10,10,80,20],background:_}]},dialogRestoreIcon:{width:100,height:100,comps:[{type:"rect",rect:[10,34,56,56],borderWidth:8,borderColor:_},{type:"rect",rect:[10,34,56,14],background:_},{type:"rect",rect:[34,10,56,14],background:_},{type:"rect",rect:[82,10,8,56],background:_},{type:"rect",rect:[66,62,24,8],background:_}]},dialogTitleLabelColor:W.labelSelectColor,dialogTitleLabelFont:(T?"18":"14")+"px arial, sans-serif",dialogContentLabelFont:W.labelFont,dialogTitleBackground:m.titleBackground,dialogHeaderBackground:m.headerBackground,dialogButtonBackground:"#1ABC9C",dialogButtonSelectBackground:"#16A085",dialogButtonLabelColor:"#fff"},!0);var x=function(j){var C=this;C.$1d=j,C.addListeners()};W.def(x,v,{ms_listener:1,getView:function(){return this.$1d.getView()},clear:function(){delete this.$2d,delete this.$3d,delete this.$4d,delete this.$5d},handle_touchstart:function(t){var K=this,M=K.$1d,S=M.$6d,e=M._config,i=M.$7d,N=t,k=t.target;if(i.contains(k)||W.preventDefault(t),W.isLeftButton(t)){T&&(N=O(t));var U=K.$8d={x:N.pageX,y:N.pageY};K.$9d={x:U.x,y:U.y},!e.maximized&&e.draggable&&S.contains(k)&&(K.$4d=!0,W.startDragging(K,t)),K.handle_mousemove(t)&&(K.$2d=!0,W.startDragging(K,t)),i.contains(t.target)||M.$41d.focus()}},handle_mousedown:function(S){this.handle_touchstart(S)},handle_touchend:function(c){if(W.isLeftButton(c)&&!this.$5d&&!this.$3d){var x=this,V=x.$1d,B=c.target,o=V._config,n=V.$18d,q=V.$16d;for(o.closable&&n.contains(B)&&V.hide(),o.maximizable&&q.contains(B)&&(o.maximized?V.restore():V.maximize());B&&(B.className||"").indexOf("dialog-button")<0;)B=B.parentNode;B&&B.buttonItem&&V.action&&V.action(B.buttonItem,c),delete x.$8d,delete x.$9d}},handle_mouseup:function(V){this.handle_touchend(V)},handleWindowTouchEnd:function(M){var D=this,s=D.$1d,g=s.$10d;D.$2d&&D.$3d?g.fire({kind:"endResize",target:s,originEvent:M}):D.$4d&&D.$5d&&g.fire({kind:"endMove",target:s,originEvent:M}),this.clear()},handleWindowMouseUp:function(G){this.handleWindowTouchEnd(G)},handle_mousemove:function(s){var G=this.$1d._config;if(G.maximized)return!1;if("w"!==G.resizeMode&&"h"!==G.resizeMode&&"wh"!==G.resizeMode)return!1;var Y=this,J=Y.getView(),u=J.querySelector(".resize-area"),b=u.getBoundingClientRect(),e={x:b.left,y:b.top,width:b.width,height:b.height};s=T?O(s):s;var j=s.clientX,o=s.clientY,y={x:j,y:o};return W.containsPoint(e,y)?(N(J,"cursor","nwse-resize"),!0):(N(J,"cursor",H),void 0)},handleWindowTouchMove:function(j){j.preventDefault();var Q=j;T&&(Q=O(j));var n=this,h=n.$8d,Z=n.$9d;if(!(Z.x==h.x&&Z.y==h.y&&W.getDistance(Z,{x:Q.pageX,y:Q.pageY})<=1)){var C=n.$1d,U=C._config,A=C.$21d,R=U.resizeMode||"wh",e=Q.pageX-h.x,b=Q.pageY-h.y;if(n.$2d){var p=A.offsetWidth,I=A.offsetHeight,x=p+e,c=I+b;if(x=Math.max(x,50),c=Math.max(c,50),"center"===U.position||U.position==F){var r={},S=A.getBoundingClientRect();r.x=S.left,r.y=S.top,U.position=r}"w"===R?(C.setSize(x,I),h.x+=x-p):"h"===R?(C.setSize(p,c),h.y+=c-I):"wh"===R&&(C.setSize(x,c),h.x+=x-p,h.y+=c-I),n.$3d?C.$10d.fire({kind:"betweenResize",target:C,originEvent:j}):(n.$3d=!0,C.$10d.fire({kind:"beginResize",target:C,originEvent:j}))}else if(n.$4d){var X=A.getBoundingClientRect(),B=X.width,y=X.height,d=t(),u=L(),D=s(A.style.left)||0,H=s(A.style.top)||0,G=D+e,Y=H+b;G+B>d&&(G=d-B),Y+y>u&&(Y=u-y),0>G&&(G=0),0>Y&&(Y=0);var o=G-D,$=Y-H;N(A,f,G+w),N(A,i,Y+w),h.x+=o,h.y+=$,U.position={x:G,y:Y},n.$5d?C.$10d.fire({kind:"betweenMove",target:C,originEvent:j}):(n.$5d=!0,C.$10d.fire({kind:"beginMove",target:C,originEvent:j}))}}},handleWindowMouseMove:function(G){this.handleWindowTouchMove(G)},handleWindowResize:function(){var n=this,$=n,Z=$._config,W=$.$21d,m=t(),Y=L(),c=Z.width,Q=Z.height,T=Z.position||"center";Z.maximized?(N(W,D,m+w),N(W,a,Y+w),N(W,i,l),N(W,f,l)):(N(W,D,c+w),N(W,a,Q+w),"center"===T?(N(W,f,(m-c)/2+w),N(W,i,(Y-Q)/2+w)):(N(W,f,T.x+w),N(W,i,T.y+w))),$.iv()},handle_mousewheel:function(J){J.stopPropagation()},handle_DOMMouseScroll:function(U){U.stopPropagation()}}),r.widget.Dialog=function(L){var s=this,A=s._view=E.createView(null,s);A[j]="ht-widget-dialog",N(A,R,J),W.baseZIndex!=F&&N(A,"z-index",W.baseZIndex+"");var P=s.$11d=new x(s);s.bindingHandleWindowResize=P.handleWindowResize.bind(s),s.$10d=new r.Notifier,L&&s.setConfig(L)},U("Dialog",v,{ms_v:1,setTitle:function(d){this._config.title=d,this.getView().querySelector(".dialog-container-title span").innerHTML=d},$31d:function(){var L=this,t=L.$6d=q(),f=L._config,D=L.$12d=L.$13d();t[j]="dialog-container-title",N(t,"cursor","default"),N(t,"white-space","nowrap"),N(t,"overflow","hidden"),N(t,"font",W.dialogTitleLabelFont),N(t,B,f.titleBackground||W.dialogTitleBackground),N(t,"color",f.titleColor||W.dialogTitleLabelColor);var z=X("span"),r=L.$25d();if(f.titleAlign&&N(t,"text-align",f.titleAlign),f.titleIcon){var F=L.$14d=L.$15d();e(t,F)}if(z[u]=f.title||" ",e(t,z),f.maximizable){var O=L.$16d=L.$17d();e(D,O)}if(f.closable){var i=L.$18d=L.$19d();e(D,i)}return e(t,D),N(t,"display","block"),N(t,"line-height",r+w),t},$13d:function(){var X=q();return N(X,R,J),N(X,f,l),N(X,k,5+w),N(X,i,l),N(X,$,l),N(X,"text-align",k),N(X,"white-space","nowrap"),X[j]="dialog-title-controls",X},$20d:function(){var S=this.$21d=q(),C=this._config,T=C.borderWidth;return N(S,R,"fixed"),N(S,"box-shadow","rgba(0, 0, 0, 0.2) 0px 5px 10px 0px"),N(S,"padding",l+" "+T+w+" "+T+w+" "+T+w),N(S,"box-sizing","border-box"),N(S,"-moz-box-sizing","border-box"),S[j]="dialog-container",N(S,B,C.titleBackground||W.dialogTitleBackground),S},$22d:function(){var v,p=this,G=p._config,s=p.$7d=q(),Z=G.content,H=0,Y=G.contentPadding||0;G.buttons!=F&&G.buttons.length>0&&(H=32),S(Z)?s[u]=Z:Z.getView?(v=Z.getView(),e(s,v)):(v=Z,e(s,v)),N(s,R,J),N(s,"font",W.dialogContentLabelFont),e(y(),s);var O=s.offsetWidth+1,t=s.offsetHeight,z=p.$25d();return G.width==F&&(G.width=O+10+2*Y),G.height==F&&(G.height=t+z+H+5+2*Y),g(y(),s),v&&(N(v,"box-sizing","border-box"),N(v,"-moz-box-sizing","border-box"),N(v,D,"100%"),N(v,a,"100%")),s[j]="dialog-content",N(s,i,z+Y+w),N(s,$,H+Y+w),N(s,f,Y+w),N(s,k,Y+w),N(s,"overflow","hidden"),s},$23d:function(){var g=this.$41d=q();return g[j]="dialog-overlay",N(g,D,"100%"),N(g,a,"100%"),N(g,R,"fixed"),N(g,i,l),N(g,f,l),N(g,B,"rgba(235, 235, 235, 0.7)"),g},_config:F,setSize:function(G,V){var q=this,t=q._config;t&&(t.width=G,t.height=V,q.isShowing()&&(q.bindingHandleWindowResize(),q.iv()))},getConfig:function(){return this._config},$24d:function(){var r=this._config,k=r.titleIconSize||16;return T&&(k*=1.2),k},$25d:function(){var U=this._config,p=U.titleHeight||W.widgetTitleHeight;return p},$26d:function(I){N(I,"cursor","pointer"),N(I,"display","inline-block"),N(I,"margin-right",(T?8:4)+w),N(I,"vertical-align",i)},$27d:function(){var S=this.$30d=q(),X=10;return T&&(X=20),N(S,D,X+w),N(S,a,X+w),N(S,R,J),N(S,$,l),N(S,k,l),S[j]="resize-area",S},$15d:function(){var r=this,b=V();b[j]="dialog-title-control dialog-title-control-icon";var U=r.$25d(),e=r.$24d();return r.$26d(b),E.setCanvas(b,e,U),b},$17d:function(){var J=V();J[j]="dialog-title-control dialog-title-control-maximize";var L=this.$25d(),S=this.$24d();return this.$26d(J),E.setCanvas(J,S,L),J},$19d:function(){var G=V();G[j]="dialog-title-control dialog-title-control-close";var d=this.$25d(),u=this.$24d();return this.$26d(G),E.setCanvas(G,u,d),G},$28d:function(){var m=q();return N(m,B,"white"),N(m,D,"100%"),N(m,a,"100%"),N(m,R,"relative"),m},$29d:function(){var i=this,H=q();N(H,"line-height",32+w),N(H,R,J),N(H,$,l),N(H,f,l),N(H,"white-space","nowrap"),N(H,"overflow","hidden"),N(H,k,l),N(H,B,W.dialogHeaderBackground),H[j]="dialog-container-buttons";var t=this._config,m=t.buttonsAlign||k,L=0;return N(H,"text-align",m),i.$42d=[],t.buttons.forEach(function(Z){var B=new r.widget.Button,d=B.getView();d[j]="dialog-button "+Z.className,d.buttonItem=Z,i.$42d.push(B),B.setBorderColor(F),B.setBackground(W.dialogButtonBackground),B.setSelectBackground(W.dialogButtonSelectBackground),B.setLabelColor(W.dialogButtonLabelColor),N(d,R,"static"),N(d,"display","inline-block"),N(d,"text-align",f),N(d,"height",24+w);var A=T?10:5;m===f||m===k?N(d,"margin-"+m,A+w):0===L||N(d,"margin-"+f,A+w),N(d,"vertical-align","middle");var V=W.getTextSize(B.getLabelFont(),Z.label).width+10;B.onClicked=function(H){Z.action&&Z.action.call(i,Z,H)},B.setLabel(Z.label),N(d,D,V+w),e(H,B.getView()),L++}),H},setConfig:function(D){if(D){var C=this,E=C._view;C._config=D,C.action=D.action,E[u]=H,D.borderWidth==F&&(D.borderWidth=5);var Z=C.$23d(),o=C.$28d(),S=C.$31d(),r=C.$22d(),G=C.$20d(),N=C.$30d=C.$27d();if(e(E,Z),e(E,G),e(G,o),e(o,S),e(o,r),D.buttons!=F&&D.buttons.length>0){var X=C.$29d();e(o,X)}e(G,N),D.maximized?(D.maximized=!1,C.bindingHandleWindowResize(),C.maximize(!0)):C.bindingHandleWindowResize(),C.isShowing()&&C.iv()}},hide:function(){var _=this,L=_.$21d,M=_.$41d,J=_._view;J[j]="ht-widget-dialog",I(L).duration(200).scale(.7).set(C,l).end(function(){_.onHidden&&_.onHidden(),g(y(),J),_.$10d.fire({kind:"hide",target:_})}),I(M).duration(200).set(C,l).end(),o.removeEventListener("resize",_.bindingHandleWindowResize)},isShowing:function(){return y().contains(this._view)},setModal:function(c){this.$41d.style.display=c?"block":"none"},isModal:function(){return"none"!==this.$41d.style.display},$32d:function(){var _=this,p=_._config,Q=_.$21d;n(Q,H),_.iv(),p.maximized?_.$10d.fire({kind:"maximize",target:_}):_.$10d.fire({kind:"restore",target:_})},maximize:function($){var y=this,h=y.$21d,k=y._config;if(!k.maximized){k.maximized=!0,y.$33d(),y.$16d[j]="dialog-title-control dialog-title-control-minimize";var u=t(),F=L(),H=k.width,Q=k.height,G=s(h.style.left)||0,P=s(h.style.top)||0;y.$36d=H,y.$37d=Q,y.$34d=G,y.$35d=P;var J=$?0:200;I(h).duration(J).set(f,l).set(i,l).set(D,u+w).set(a,F+w).end(function(){y.$32d()})}},restore:function(){var y=this,W=y.$34d,U=y.$35d,R=y.$36d,d=y.$37d,n=y._config;if(n.maximized&&(n.maximized=!1,y.$33d(),y.$16d[j]="dialog-title-control dialog-title-control-maximize",y.isShowing()&&W!=F&&U!=F&&R!=F&&d!=F)){var A=y.$21d;I(A).duration(200).set(f,W+w).set(i,U+w).set(D,R+w).set(a,d+w).end(function(){y.$32d()})}delete y.$34d,delete y.$35d,delete y.$36d,delete y.$37d},show:function(){var B=this,A=B._view,g=B._config,u=B.$21d,O=B.$41d;g&&g.zIndex!=F&&N(A,"z-index",g.zIndex+H),e(y(),A),n(u,"scale(0.7)"),N(u,C,l),B.iv(),B.validate(),B._view[j]+=" dialog-show",Q(function(){I(u).duration(200).scale(1).set(C,"1").end(function(){N(u,D,u.clientWidth+w),N(u,a,u.clientHeight+w),B.onShown&&B.onShown(),B.$10d.fire({kind:"show",target:B})}),I(O).duration(200).set(C,"1").end(),Z(o,"resize",B.bindingHandleWindowResize)},30)},addEventListener:function(S,p,D){this.$10d.add(S,p,D)},removeEventListener:function(E,e){this.$10d.remove(E,e)},$38d:function(I,N,v,V){var T=E.initContext(I);E.translateAndScale(T,0,0,1),T.clearRect(0,0,v,v);var b=(v-V)/2;W.drawStretchImage(T,W.getImage(N),"fill",0,b,V,V),T.restore()},$33d:function(){var T=this,B=T._config,t=T.$16d,o=B.maximized?W.dialogRestoreIcon:W.dialogMaximizeIcon;if(t&&o){var V=T.$25d(),g=T.$24d();T.$38d(t,W.getImage(o),V,g)}},$39d:function(){var w=this,r=w._config,P=w.$14d,g=r.titleIcon;if(P&&g){var z=w.$25d(),C=w.$24d();w.$38d(P,W.getImage(g),z,C)}},$40d:function(){var v=this,w=v.$18d,s=W.dialogCloseIcon;if(w&&s){var L=v.$25d(),U=v.$24d();v.$38d(w,W.getImage(s),L,U)}},invalidate:function(U){var k=this,D=k.$42d;k._68I||(k._68I=1,W.callLater(k.validate,k,F,U),k.onInvalidated&&k.onInvalidated(),k.fireViewEvent("invalidate"));var a=k._config.content;a.invalidate&&a.invalidate(),D&&D.forEach(function(X){X.iv()})},validateImpl:function(){var F=this;F.$40d(),F.$33d(),F.$39d()}})}("undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:this,Object);
|