UNPKG

@aurigma/ui-framework

Version:

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

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