UNPKG

@aurigma/ui-framework

Version:

A platform which allows building print product personalization editors based on Aurigma's Customer's Canvas.

1 lines 2.71 kB
(window.multistep_editor_jsonpFunction=window.multistep_editor_jsonpFunction||[]).push([[25],{906:function(t,e,i){i.r(e),i.d(e,"AuWidgetDndController",function(){return a}),i.d(e,"widget",function(){return a});var o,e=i(0),n=i(160),d=i(2),s=i(17),r=i(1),a=(o=n.c,Object(e.d)(g,o),g.prototype.valueChanged=function(){this.toggle?this.hide(this.hideWidget,this.showWidget):this.show(this.hideWidget,this.showWidget)},g.prototype.updateParams=function(t){this.hideWidgetName=t.hideWidget,this.showWidgetName=t.showWidget,this.findWidget(this.showWidgetName,"showWidget"),this.findWidget(this.hideWidgetName,"hideWidget"),this.toggle=t.hide||!1,this.subscribeWidget(),this.handleDrop()},g.prototype.handleDrop=function(){var e=this,i=this;["dragenter","dragover","dragleave","dragend","dragexit","drop"].forEach(function(t){e.hideWidget.addEventListener(t,function(t){t.preventDefault(),t.stopPropagation()},!1)}),["dragenter","dragover","drop"].forEach(function(t){e.hideWidget.addEventListener(t,function(t){i.toggle=!0},!1)}),["dragend","dragexit","dragleave"].forEach(function(t){e.hideWidget.addEventListener(t,function(t){i.toggle=!1},!1)})},g.prototype.findWidget=function(e,i){var o=this;this.observe(s.a.WIDGET_CONNECTED_CALLBACK).subscribe(function(t){t.name===e&&(t=t.sender,o[i]=t)}).unsubscribe()},g.prototype.subscribeWidget=function(){var e=this;this.subscriber=this.observe(s.a.CLOSE_DISPLAYED_WIDGET).subscribe(function(t){t.name===e.showWidgetName&&(e.toggle=!1)})},g.prototype.disconnectedCallback=function(){this.subscriber.unsubscribe()},g.prototype.hide=function(t,e){r.a.isNotNullOrUndefined(t)&&r.a.isNotNullOrUndefined(e)&&(t.shadowRoot.contains(e)||t.shadowRoot.appendChild(e),e.setAttribute("style","position:absolute; top:0; left:0; width:100%; height:100%; opacity:1; transition: all 0.1s ease-out; z-index:100000;"))},g.prototype.show=function(t,e){r.a.isNotNullOrUndefined(t)&&r.a.isNotNullOrUndefined(e)&&e.setAttribute("style","position:absolute; top:0; left:0;pointer-events: none; width:100%; height:100%; opacity:0; transition: all 0.1s ease-in; z-index:-1;")},Object(e.c)([Object(d.c)(),Object(e.g)("design:type",Object)],g.prototype,"params",void 0),Object(e.c)([Object(d.c)(),Object(e.g)("design:type",String)],g.prototype,"hideWidgetName",void 0),Object(e.c)([Object(d.c)(),Object(e.g)("design:type",String)],g.prototype,"showWidgetName",void 0),Object(e.c)([Object(d.b)("toggle"),Object(e.g)("design:type",Function),Object(e.g)("design:paramtypes",[]),Object(e.g)("design:returntype",void 0)],g.prototype,"valueChanged",null),Object(e.c)([Object(d.a)("au-widget-dnd-controller")],g));function g(){var t=null!==o&&o.apply(this,arguments)||this;return t.toggle=!1,t}}}]);