@aurigma/ui-framework
Version:
A platform which allows building print product personalization editors based on Aurigma's Customer's Canvas.
1 lines • 2.76 kB
JavaScript
(window.multistep_editor_jsonpFunction=window.multistep_editor_jsonpFunction||[]).push([[25],{906:function(t,e,i){"use strict";i.r(e),i.d(e,"AuWidgetDndController",(function(){return a})),i.d(e,"widget",(function(){return a}));var n=i(0),o=i(160),d=i(2),s=i(17),r=i(1),a=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.toggle=!1,e}return Object(n.d)(e,t),e.prototype.valueChanged=function(){this.toggle?this.hide(this.hideWidget,this.showWidget):this.show(this.hideWidget,this.showWidget)},e.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()},e.prototype.handleDrop=function(){var t=this,e=this;["dragenter","dragover","dragleave","dragend","dragexit","drop"].forEach((function(e){t.hideWidget.addEventListener(e,(function(t){t.preventDefault(),t.stopPropagation()}),!1)})),["dragenter","dragover","drop"].forEach((function(i){t.hideWidget.addEventListener(i,(function(t){e.toggle=!0}),!1)})),["dragend","dragexit","dragleave"].forEach((function(i){t.hideWidget.addEventListener(i,(function(t){e.toggle=!1}),!1)}))},e.prototype.findWidget=function(t,e){var i=this;this.observe(s.a.WIDGET_CONNECTED_CALLBACK).subscribe((function(n){if(n.name===t){var o=n.sender;i[e]=o}})).unsubscribe()},e.prototype.subscribeWidget=function(){var t=this;this.subscriber=this.observe(s.a.CLOSE_DISPLAYED_WIDGET).subscribe((function(e){e.name===t.showWidgetName&&(t.toggle=!1)}))},e.prototype.disconnectedCallback=function(){this.subscriber.unsubscribe()},e.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;"))},e.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(n.c)([Object(d.c)(),Object(n.g)("design:type",Object)],e.prototype,"params",void 0),Object(n.c)([Object(d.c)(),Object(n.g)("design:type",String)],e.prototype,"hideWidgetName",void 0),Object(n.c)([Object(d.c)(),Object(n.g)("design:type",String)],e.prototype,"showWidgetName",void 0),Object(n.c)([Object(d.b)("toggle"),Object(n.g)("design:type",Function),Object(n.g)("design:paramtypes",[]),Object(n.g)("design:returntype",void 0)],e.prototype,"valueChanged",null),Object(n.c)([Object(d.a)("au-widget-dnd-controller")],e)}(o.c)}}]);