@acorex/layout 3.0.47 → 3.0.48

Sign up to get free protection for your applications and to get access to all the features.
@@ -12,5 +12,5 @@
12
12
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13
13
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
14
  PERFORMANCE OF THIS SOFTWARE.
15
- ***************************************************************************** */var l=function(e,t){return(l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)};function c(e,t){function i(){this.constructor=e}l(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}function p(e,t,i,n){var o,r=arguments.length,a=r<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a}function g(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function u(e,t,i,n){return new(i||(i=Promise))((function(o,r){function a(e){try{d(n.next(e))}catch(e){r(e)}}function s(e){try{d(n.throw(e))}catch(e){r(e)}}function d(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,s)}d((n=n.apply(e,t||[])).next())}))}function h(e,t){var i,n,o,r,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return r={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function s(r){return function(s){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;a;)try{if(i=1,n&&(o=2&r[0]?n.return:r[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,r[1])).done)return o;switch(n=0,o&&(r=[2&r[0],o.value]),r[0]){case 0:case 1:o=r;break;case 4:return a.label++,{value:r[1],done:!1};case 5:a.label++,n=r[1],r=[0];continue;case 7:r=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===r[0]||2===r[0])){a=0;continue}if(3===r[0]&&(!o||r[1]>o[0]&&r[1]<o[3])){a.label=r[1];break}if(6===r[0]&&a.label<o[1]){a.label=o[1],o=r;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(r);break}o[2]&&a.ops.pop(),a.trys.pop();continue}r=t.call(e,a)}catch(e){r=[6,e],n=0}finally{i=o=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,s])}}}function f(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var n,o,r=i.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=r.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(i=r.return)&&i.call(r)}finally{if(o)throw o.error}}return a}function m(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(f(arguments[t]));return e}var v=function(){return[1,2,3,5,10,20,30,60].map((function(e){return{id:6e4*e,text:n.AXTranslator.get("dateTime.duration.format_minute").replace("{0}",e.toString())}}))},y=function(){function e(){var e=this;this.uid=n.AXHtmlUtil.getUID(),this.onBusyChanged=new t.EventEmitter,this._isBusy=!0,this.refreshRate=[{id:3e5,text:n.AXTranslator.get("dateTime.duration.format_minute").replace("{0}","5")}],this.onConfiguredChanged=new t.EventEmitter,this.onConfiguredChanged.subscribe((function(){!0===e.isConfigured&&e.getRefreshRate()?e.restartRefreshTimer():e.stopRefreshTimer()}))}return Object.defineProperty(e.prototype,"isBusy",{get:function(){return this._isBusy},set:function(e){if(e!==this._isBusy){var t={component:this,oldValue:this._isBusy,value:e};this._isBusy=e,this.onBusyChanged.emit(t)}},enumerable:!0,configurable:!0}),e.prototype.getRefreshRate=function(){return Array.isArray(this.refreshRate)&&this.refreshRate.length?this.refreshRate[0].id:this.refreshRate},e.prototype.startRefreshTimer=function(){this.intervalId=window.setInterval(this.refresh.bind(this),this.getRefreshRate())},e.prototype.stopRefreshTimer=function(){window.clearInterval(this.intervalId)},e.prototype.restartRefreshTimer=function(){this.stopRefreshTimer(),this.startRefreshTimer()},e.prototype.ngOnDestroy=function(){this.stopRefreshTimer()},e.prototype.redraw=function(){},e.prototype.refresh=function(){this.restartRefreshTimer()},Object.defineProperty(e.prototype,"isConfigured",{get:function(){return!0},enumerable:!0,configurable:!0}),e.prototype.setValue=function(e,t){this[e]=t,this.onConfiguredChanged.emit()},e.prototype.getValue=function(e){var t,i=this[e],n=this.__meta__.config;if((null===(t=n.props[e])||void 0===t?void 0:t.runtime)&&this.provideValue){var o=this.provideValue({name:e,value:i,uniqueName:n.uniqueName,options:n.options});return this.provideValue instanceof Promise?o:Promise.resolve(o)}return Promise.resolve(i)},p([i.propertyEditor({editorClass:"ax/editors/widget-size",title:"common.size",visible:!1,order:-99}),g("design:type",Array)],e.prototype,"widgetSize",void 0),p([i.propertyEditor({editorClass:"ax/editors/select",title:"common.refresh-rate",visible:!0,order:-98,editorOptions:{items:v,allowNull:!1,allowSearch:!1,selectionDataMode:"value",selectionMode:"single",valueField:"id"}}),g("design:type",Object)],e.prototype,"refreshRate",void 0),e}(),w=function(e){function o(t){var i=e.call(this)||this;return i.cdr=t,i.props=[],i.displayProps=[],i.changes=[],i.context={},i}return c(o,e),o.prototype.getFooterButtons=function(){return[{name:"okay",submitBehavior:!0,text:n.AXTranslator.get("common.confirm"),style:"success"},{name:"cancel",cancelBehavior:!0,text:n.AXTranslator.get("common.cancel"),style:"danger blank"}]},o.prototype.onFooterButtonClick=function(e){var t=this;"cancel"===e.name&&this.close(),"okay"===e.name&&this.form.validate().then((function(e){e.result&&t.close(t.changes)}))},o.prototype.handleValueChange=function(e){var t=this.changes.find((function(t){return t.property.name===e.property.name}));t?t.value=e.value:this.changes.push({property:e.property,value:e.value}),this.updateContext()},o.prototype.ngOnInit=function(){this.displayProps=this.props.filter((function(e){return!1!==e.property.visible})).sort((function(e,t){return e.property.order-t.property.order})),this.updateContext()},o.prototype.updateContext=function(){var e={};this.props.forEach((function(t){e[t.property.name]=t.value})),this.changes.forEach((function(t){e[t.property.name]=t.value})),this.context=e},o.prototype.identify=function(e,t){return t.property.name},o.ctorParameters=function(){return[{type:t.ChangeDetectorRef}]},p([t.ViewChild(i.AXValidationFormComponent),g("design:type",i.AXValidationFormComponent)],o.prototype,"form",void 0),o=p([t.Component({template:'<ax-page>\r\n <ax-page-content>\r\n <div class="container">\r\n <ax-validation-form #form>\r\n <div class="row" *ngFor="let p of displayProps; trackBy: identify">\r\n <div class="col-12">\r\n <ax-label>{{p.property.title | trans}}</ax-label>\r\n <ng-container ax-property-editor-renderer [property]="p" [context]="context" [host]="widget" [validationForm]="form"\r\n (onValueChange)="handleValueChange($event)">\r\n </ng-container>\r\n </div>\r\n </div>\r\n </ax-validation-form>\r\n </div>\r\n </ax-page-content>\r\n</ax-page>',encapsulation:t.ViewEncapsulation.None,changeDetection:t.ChangeDetectionStrategy.OnPush}),g("design:paramtypes",[t.ChangeDetectorRef])],o)}(i.AXBasePopupPageComponent),b=function(e){function i(){var t=null!==e&&e.apply(this,arguments)||this;return t.props=[],t}return c(i,e),i.prototype.getFooterButtons=function(){return[{name:"okay",submitBehavior:!0,text:n.AXTranslator.get("common.confirm"),style:"ax success"},{name:"cancel",cancelBehavior:!0,text:n.AXTranslator.get("common.cancel"),style:"ax light"}]},i.prototype.ngOnInit=function(){var e,t,i=(null===(e=this.props.find((function(e){return"title"===e.property.name||"name"===e.property.name})))||void 0===e?void 0:e.value)||this.config.title,o={};null===(t=this.props)||void 0===t||t.forEach((function(e){o[e.property.name]=e.property})),this.data={component:this.config.component,title:i,uniqueName:this.config.uniqueName+"-"+n.AXHtmlUtil.getUID(),options:n.AXObjectUtil.deepJSONClone(this.config.options),props:n.AXObjectUtil.deepJSONClone(o)},this.displayProps=this.props.filter((function(e){return!1!==e.property.visible})).sort((function(e,t){return e.property.order-t.property.order})).map((function(e){return{name:e.property.name,title:e.property.title,allow:!0}}))},i.prototype.onFooterButtonClick=function(e){var t=this;"cancel"===e.name&&this.close(),"okay"===e.name&&(this.props.forEach((function(e){var i=t.displayProps.find((function(t){return t.name===e.property.name}));if(null==i||!i.allow){var n=t.data.props[e.property.name];n?n.visible=!1:n={visible:!1}}})),this.close(this.data))},i=p([t.Component({template:'<ax-page>\r\n <ax-page-content>\r\n <div class="container">\r\n <div class="row">\r\n <div class="col-12">\r\n <ax-form-group>\r\n <ax-label>{{\'common.title\' | trans}}</ax-label>\r\n <ax-text-box [(value)]="data.title"></ax-text-box>\r\n </ax-form-group>\r\n </div>\r\n </div>\r\n <div class="row">\r\n <div class="col-12">\r\n <ax-form-group>\r\n <ax-label>{{\'common.description\' | trans}}</ax-label>\r\n <ax-text-area [(value)]="data.description"></ax-text-area>\r\n </ax-form-group>\r\n </div>\r\n </div>\r\n \x3c!-- <div class="row">\r\n <div class="col-12">\r\n <ax-form-group>\r\n <ax-label>{{\'common.uniquename\' | trans}}</ax-label>\r\n <ax-text-box></ax-text-box>\r\n </ax-form-group>\r\n </div>\r\n </div> --\x3e\r\n <div class="row" style="margin-block-end: var(--ax-size-md);margin-block-start: var(--ax-size-md);">\r\n <div class="col-12">\r\n <ax-fieldset caption="{{\'widget-board.configurable-props\' | trans}}">\r\n <div class="row" *ngFor="let prop of displayProps">\r\n <div class="col-12" style="margin-block-end: var(--ax-size-sm)">\r\n <ax-check-box [(value)]="prop.allow" label="{{ prop.title | trans }}">\r\n\r\n </ax-check-box>\r\n </div>\r\n </div>\r\n </ax-fieldset>\r\n </div>\r\n </div>\r\n </div>\r\n </ax-page-content>\r\n</ax-page>',encapsulation:t.ViewEncapsulation.None,changeDetection:t.ChangeDetectionStrategy.OnPush})],i)}(i.AXBasePopupPageComponent),x=function(){function e(e,i,n,o,r,a){this.ref=e,this.componentFactoryResolver=i,this.rendererService=n,this.cdr=o,this.popup=r,this.loadingService=a,this._hasProps=!1,this._hasMenu=!1,this.configMenuItem=[{icon:"far fa-ellipsis-h",items:[]}],this.onRemove=new t.EventEmitter,this.onConfigChanged=new t.EventEmitter,this.onResized=new t.EventEmitter,this.onSave=new t.EventEmitter,this._isLoading=!1,this.sizeX=1,this.sizeY=1,this.col=1,this.row=1}return Object.defineProperty(e.prototype,"widget",{get:function(){return this._widget},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"element",{get:function(){return this.ref.nativeElement},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isLoading",{get:function(){return this._isLoading},set:function(e){this._isLoading=e,this._loadingId&&!e&&(this.loadingService.hide(this._loadingId),this._loadingId=null),e&&(this._loadingId=this.loadingService.show(this.ref.nativeElement))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isConfigured",{get:function(){var e;return(null===(e=this._widget)||void 0===e?void 0:e.isConfigured)||!1},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){this.isLoading=!0},e.prototype.ngAfterViewInit=function(){var e;return u(this,void 0,void 0,(function(){var t,o,r,a=this;return h(this,(function(s){switch(s.label){case 0:return"string"!=typeof this.config.component?[3,2]:[4,this.rendererService.findLoadedComponentByRoute(this.config.component,20)];case 1:return o=s.sent(),t=null===(e=o)||void 0===e?void 0:e.component,[3,3];case 2:"function"==typeof this.config.component&&(t=this.config.component),s.label=3;case 3:return null==t?(console.error("Invalid Widget Component!",this.config),this.onRemove.emit(this),[2]):(r=this.componentFactoryResolver.resolveComponentFactory(t),this.componentRef=this.vc.createComponent(r),this._widget=this.componentRef.instance,this._widget.provideValue=this.provideValue,this._widget.onBusyChanged&&this._widget.onBusyChanged.subscribe((function(e){a._widget.widgetSize?a.setSizeFromOptions():a._widget.setValue("widgetSize",[a.sizeX,a.sizeY]),a.isLoading=e.value,a.cdr.detectChanges()})),this._widget.onConfiguredChanged&&this._widget.onConfiguredChanged.subscribe((function(){a.setSizeFromOptions()})),this.config.options&&Object.assign(this._widget,this.config.options),this._hasProps=i.AXPropertyDecorators.getProperties(this._widget).length>0,this.isLoading=!1,this.config.__meta__.instance=this,this._widget.__meta__={},this._widget.__meta__.config=this.config,this._hasProps&&this.configMenuItem[0].items.push({name:"configs",icon:"far fa-cogs",text:n.AXTranslator.get("common.configs"),onClick:function(){a.openConfigDialog()}}),this.configMenuItem[0].items.push({name:"save",icon:"far fa-save",text:n.AXTranslator.get("common.save-as"),onClick:function(){a.openSaveDialog()}}),this.configMenuItem[0].items.push({name:"remove",icon:"far fa-times",style:"ax danger blank",text:n.AXTranslator.get("common.remove"),onClick:function(){a.onRemove.emit(a)}}),this._hasMenu=this.configMenuItem[0].items.length>0,this.cdr.detectChanges(),[2])}}))}))},e.prototype.setSizeFromOptions=function(){var e=this;this._widget.getValue("widgetSize").then((function(t){var i=e.sizeX,n=e.sizeY;t&&Array.isArray(t)&&(i!==t[0]||n!==t[1])&&(e.config.sizeX=e.sizeX=t[0],e.config.sizeY=e.sizeY=t[1],e.onResized.emit({component:e._widget,config:e.config})),e.cdr.detectChanges()}))},e.prototype.remove=function(e){return e.preventDefault(),e.stopPropagation(),this.onRemove.emit(this),!1},e.prototype.handleConfig=function(e){return e.preventDefault(),e.stopPropagation(),this.openConfigDialog(),!1},e.prototype.openConfigDialog=function(){var e=this,t=this.getMergedProps();this.popup.open(w,{title:n.AXTranslator.get("common.configs"),size:"sm",data:{props:t.map((function(t){return{property:t.options,value:e._widget[t.options.name]}})),widget:this.widget}}).then((function(t){t.data&&(e.config.options||(e.config.options={}),t.data.forEach((function(t){e._widget.setValue(t.property.name,t.value),e.config.options[t.property.name]=t.value})),e.emitConfigChanged(),e._widget.redraw(),e.cdr.detectChanges())}))},e.prototype.openSaveDialog=function(){var e=this,t=this.getMergedProps();this.popup.open(b,{title:n.AXTranslator.get("common.save-as"),size:"sm",data:{config:this.config,props:t.map((function(t){return{property:t.options,value:e._widget[t.options.name]}}))}}).then((function(t){t.data&&e.onSave.emit({component:e._widget,data:t.data})}))},e.prototype.handleOptionClick=function(e){return e.preventDefault(),e.stopPropagation(),this.openConfigDialog(),!1},e.prototype.ngOnDestroy=function(){this.vc.clear(),this.componentRef&&this.componentRef.destroy()},e.prototype.getMergedProps=function(){var e=n.AXObjectUtil.deepCopy(i.AXPropertyDecorators.getProperties(this._widget)),t=function(t){if(Object.prototype.hasOwnProperty.call(o.config.props,t)){var i=o.config.props[t],n=e.find((function(e){return e.property===t}));n&&Object.assign(n.options,i)}},o=this;for(var r in this.config.props)t(r);return e},e.prototype.emitConfigChanged=function(){this.onConfigChanged.emit({component:this._widget,config:this.config})},e.ctorParameters=function(){return[{type:t.ElementRef},{type:t.ComponentFactoryResolver},{type:n.AXRenderService},{type:t.ChangeDetectorRef},{type:i.AXPopupService},{type:i.AXLoadingService}]},p([t.Input(),g("design:type",Function)],e.prototype,"provideValue",void 0),p([t.Output(),g("design:type",t.EventEmitter)],e.prototype,"onRemove",void 0),p([t.Output(),g("design:type",t.EventEmitter)],e.prototype,"onConfigChanged",void 0),p([t.Output(),g("design:type",t.EventEmitter)],e.prototype,"onResized",void 0),p([t.Output(),g("design:type",t.EventEmitter)],e.prototype,"onSave",void 0),p([t.Input(),g("design:type",Object)],e.prototype,"config",void 0),p([t.ViewChild("vc",{read:t.ViewContainerRef}),g("design:type",t.ViewContainerRef)],e.prototype,"vc",void 0),p([t.HostBinding("attr.data-size-x"),t.Input(),g("design:type",Number)],e.prototype,"sizeX",void 0),p([t.HostBinding("attr.data-size-y"),t.Input(),g("design:type",Number)],e.prototype,"sizeY",void 0),p([t.HostBinding("attr.data-col"),t.Input(),g("design:type",Number)],e.prototype,"col",void 0),p([t.HostBinding("attr.data-row"),t.Input(),g("design:type",Number)],e.prototype,"row",void 0),e=p([t.Component({selector:"ax-widget-host",template:'<div class=\'widget-container\'>\r\n <div class="widget-config-overlay" *ngIf="!isConfigured" (click)="handleConfig($event)">\r\n <div class="widget-title">{{config.title}}</div>\r\n <div class="widget-config-box">\r\n <div class="config-title">{{ \'widget-board.configure\' | trans}}</div>\r\n <div class="config-icon"><i class="fas fa-cogs fa-5x"></i></div>\r\n </div>\r\n </div>\r\n <div class=\'widget-edit-overlay\'>\r\n <div class=\'widget-edit-menu\'>\r\n <button class="widget-edit-menu-button" (click)="handleConfig($event)"\r\n (mousedown)="$event.stopPropagation()" *ngIf="_hasProps" (mouseup)="$event.stopPropagation()">\r\n <i class="far fa-cogs"></i>\r\n </button>\r\n <button class="widget-edit-menu-button" (click)="remove($event)" (mousedown)="$event.stopPropagation()"\r\n (mouseup)="$event.stopPropagation()">\r\n <i class="far fa-times"></i>\r\n </button>\r\n </div>\r\n\r\n </div>\r\n <div class="widget-options-menu" *ngIf="_hasMenu">\r\n <ax-menu [items]=\'configMenuItem\' direction="horizontal"></ax-menu>\r\n </div>\r\n \x3c!-- <ax-loading-panel [visible]="isBusy">\r\n </ax-loading-panel> --\x3e\r\n <div class="widget-content">\r\n <ng-container #vc></ng-container>\r\n </div>\r\n</div>',host:{class:"ax widget-host",tabindex:"0"},encapsulation:t.ViewEncapsulation.None,changeDetection:t.ChangeDetectionStrategy.OnPush}),g("design:paramtypes",[t.ElementRef,t.ComponentFactoryResolver,n.AXRenderService,t.ChangeDetectorRef,i.AXPopupService,i.AXLoadingService])],e)}(),A=function(){function e(e,i,n){this.ref=e,this.zone=i,this.cdr=n,this.widgets=[],this.galleryItems=[],this.tileSize=80,this.gapSize=5,this.newWidget=null,this._isInEditing=!1,this.isDragging=!1,this.DATA_COL="data-col",this.DATA_ROW="data-row",this.DATA_SIZE_X="data-size-x",this.DATA_SIZE_Y="data-size-y",this.DATA_OLD_COL="data-old-col",this.DATA_OLD_ROW="data-old-row",this.onConfigChanged=new t.EventEmitter,this.onWidgetSave=new t.EventEmitter}return e.prototype.isInEditing=function(){return this._isInEditing},e.prototype.ngOnInit=function(){null==this.rtl&&(this.rtl="rtl"===window.getComputedStyle(this.ref.nativeElement,null).getPropertyValue("direction"))},e.prototype.ngAfterViewInit=function(){var e=this;this.zone.runOutsideAngular((function(t){var i=document.createElement("style");i.type="text/css",e.ref.nativeElement.appendChild(i);for(var n=1;n<=50;n++)i.innerHTML+="["+e.DATA_COL+'="'+n+'"] { '+(e.rtl?"right":"left")+": "+(n-1)*(e.tileSize+e.gapSize)+"px; }",i.innerHTML+="["+e.DATA_ROW+'="'+n+'"] { top: '+(n-1)*(e.tileSize+e.gapSize)+"px; }",i.innerHTML+="["+e.DATA_SIZE_X+'="'+n+'"] { width: '+(n*e.tileSize+(n-1)*e.gapSize)+"px; }",i.innerHTML+="["+e.DATA_SIZE_Y+'="'+n+'"] { height: '+(n*e.tileSize+(n-1)*e.gapSize)+"px; }"}))},e.prototype.calcGridSize=function(){var e=this;this.zone.runOutsideAngular((function(){var t=Math.max.apply(Math,m(e.widgets.map((function(e){return e.col+e.sizeX-1}))))*(e.tileSize+e.gapSize),i=Math.max.apply(Math,m(e.widgets.map((function(e){return e.row+e.sizeY-1}))))*(e.tileSize+e.gapSize);e.container.nativeElement.style.width=t+"px",e.container.nativeElement.style.height=i+"px"}))},e.prototype.toggleEdit=function(){this._isInEditing?this.finishEdit():this.startEdit()},e.prototype.dragStart=function(e){var t=this;return e.preventDefault(),e.stopPropagation(),this.zone.runOutsideAngular((function(){t._isInEditing&&1===e.which&&(t.dragItem=e.currentTarget,t.dragItem.setAttribute("data-x-offset",(t.dragItem.offsetLeft-e.clientX).toString()),t.dragItem.setAttribute("data-y-offset",(t.dragItem.offsetTop-e.clientY).toString()),t.dragItem.classList.add("widget-dragging"),t.dragItem.classList.remove("animate__animated","animate__pulse"))})),!1},e.prototype.removePositionData=function(){var e=this;this.zone.runOutsideAngular((function(){e.dragItem&&e._isInEditing&&null==e.dragItem.getAttribute(e.DATA_OLD_COL)&&(e.dragItem.setAttribute(e.DATA_OLD_COL,e.dragItem.getAttribute(e.DATA_COL)),e.dragItem.setAttribute(e.DATA_OLD_ROW,e.dragItem.getAttribute(e.DATA_ROW)),e.dragItem.removeAttribute(e.DATA_COL),e.dragItem.removeAttribute(e.DATA_ROW))}))},e.prototype.resetPositionData=function(){var e=this;this.zone.runOutsideAngular((function(){e.dragItem&&e._isInEditing&&e.setPosition(e.dragItem,e.dragItem.getAttribute(e.DATA_OLD_COL),e.dragItem.getAttribute(e.DATA_OLD_ROW))}))},e.prototype.setPosition=function(e,t,i){var n=this;this.zone.runOutsideAngular((function(){e.setAttribute(n.DATA_COL,t),e.setAttribute(n.DATA_ROW,i),e.removeAttribute(n.DATA_OLD_COL),e.removeAttribute(n.DATA_OLD_ROW),e.style.removeProperty("top"),e.style.removeProperty("left");var o=n.widgets.find((function(t){return t.__meta__.instance.element===e}));o.col=Number(t),o.row=Number(i)}))},e.prototype.drag=function(e){var t=this;return e.preventDefault(),e.stopPropagation(),this.zone.runOutsideAngular((function(){if(t.dragItem&&t._isInEditing){t.isDragging=!0,t.addPlaceholder();var i=Number(t.dragItem.getAttribute("data-x-offset")),n=Number(t.dragItem.getAttribute("data-y-offset"));t.dragItem.style.left=e.clientX+i+"px",t.dragItem.style.top=e.clientY+n+"px",t.detectBestPlacement(),t.removePositionData()}})),!1},e.prototype.dragEnd=function(e){var t=this;this.zone.runOutsideAngular((function(){if(t.dragItem&&t._isInEditing&&t.isDragging){t.dragItem.classList.remove("widget-dragging"),t.dragItem.classList.add("animate__animated","animate__pulse");var e=t.container.nativeElement.querySelector(".widget-blank-placeholder");if(t.newWidget){var i={uniqueName:t.newWidget.uniqueName,component:t.newWidget.component,title:t.newWidget.title,options:t.newWidget.options,sizeX:t.newWidget.sizeX,sizeY:t.newWidget.sizeY,col:Number(e.getAttribute(t.DATA_COL)),row:Number(e.getAttribute(t.DATA_ROW))};t.widgets.push(i),t.newWidget=null,t.container.nativeElement.removeChild(t.dragItem),t.zone.run((function(){t.cdr.detectChanges(),t.calcGridSize(),setTimeout((function(){i.__meta__.instance.element.addEventListener("mousedown",t.dragStart.bind(t),!1)}),1e3)}))}else e?t.setPosition(t.dragItem,e.getAttribute(t.DATA_COL),e.getAttribute(t.DATA_ROW)):t.setPosition(t.dragItem,t.dragItem.getAttribute(t.DATA_OLD_COL),t.dragItem.getAttribute(t.DATA_OLD_ROW));t.removePlaceholder(),t.dragItem=null,t.calcGridSize(),t.emitConfigChanged()}t.isDragging=!1}))},e.prototype.detectFirstEmptySlot=function(e){for(var t=Math.floor(this.ref.nativeElement.parentElement.offsetWidth/this.tileSize),i=1;i<=100;i++)for(var o=function(t){var o=new n.AXClientRec({left:t,top:i,width:e.sizeX,height:e.sizeY});if(null==r.widgets.filter((function(t){return t!==e})).find((function(e){return o.intersect({left:e.col,top:e.row,width:e.sizeX,height:e.sizeY})})))return e.col=t,e.row=i,{value:void 0}},r=this,a=1;a<=t-e.sizeX;a++){var s=o(a);if("object"==typeof s)return s.value}},e.prototype.detectBestPlacement=function(){var e=this;this.zone.runOutsideAngular((function(){var t=e.container.nativeElement.querySelector(".widget-blank-placeholder"),i=Math.ceil(e.dragItem.offsetLeft/e.tileSize);e.rtl&&(i=Math.ceil((e.container.nativeElement.clientWidth-(e.dragItem.offsetLeft+e.dragItem.clientWidth))/e.tileSize));var o=Math.ceil(e.dragItem.offsetTop/e.tileSize);i<1&&(i=1),o<1&&(o=1);var r=Array.from(e.ref.nativeElement.querySelectorAll(".widget-host")).map((function(e){return e}));t.setAttribute(e.DATA_COL,i.toString()),t.setAttribute(e.DATA_ROW,o.toString()),r.filter((function(t){return t!==e.dragItem})).some((function(t){return n.AXHtmlUtil.collision(t,e.dragItem)}))&&e.removePlaceholder()}))},e.prototype.addPlaceholder=function(){var e=this;this.zone.runOutsideAngular((function(){if(e.removePlaceholder(),e.dragItem){var t=document.createElement("div");t.classList.add("widget-blank-placeholder"),t.setAttribute(e.DATA_COL,e.dragItem.getAttribute(e.DATA_COL)),t.setAttribute(e.DATA_ROW,e.dragItem.getAttribute(e.DATA_ROW)),t.setAttribute(e.DATA_SIZE_X,e.dragItem.getAttribute(e.DATA_SIZE_X)),t.setAttribute(e.DATA_SIZE_Y,e.dragItem.getAttribute(e.DATA_SIZE_Y)),e.container.nativeElement.appendChild(t)}}))},e.prototype.removePlaceholder=function(){var e;null===(e=this.container.nativeElement.querySelector(".widget-blank-placeholder"))||void 0===e||e.remove()},e.prototype.startEdit=function(){var e=this;this._isInEditing=!0,this.calcGridSize(),this.ref.nativeElement.classList.add("grid-background");var t=this.ref.nativeElement;t.style.setProperty("background-position",(this.rtl?"right":"left")+" top");var i='url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="'+(this.tileSize+this.gapSize)+'" height="'+(this.tileSize+this.gapSize)+'"> <rect style="fill: %23dadada" x="'+(this.rtl?this.gapSize:0)+'" width="'+this.tileSize+'" height="'+this.tileSize+'" y="0"></rect></svg>\')';t.style.setProperty("background-image",i),Array.from(this.ref.nativeElement.querySelectorAll(".widget-host")).forEach((function(t){t.addEventListener("mousedown",e.dragStart.bind(e),!1)})),this.ref.nativeElement.addEventListener("mousemove",this.drag.bind(this),!1),this.ref.nativeElement.addEventListener("mouseup",this.dragEnd.bind(this),!1)},e.prototype.finishEdit=function(){var e=this;this.ref.nativeElement.classList.remove("grid-background"),this.ref.nativeElement.style.removeProperty("background-image"),this._isInEditing=!1,Array.from(this.ref.nativeElement.querySelectorAll(".widget-host")).forEach((function(t){t.removeEventListener("mousedown",e.dragStart.bind(e),!1)})),this.ref.nativeElement.removeEventListener("mousemove",this.drag.bind(this),!1),this.ref.nativeElement.removeEventListener("mouseup",this.dragEnd.bind(this),!1),this.emitConfigChanged()},e.prototype.addWidget=function(e){var t=this;this.zone.runOutsideAngular((function(){t.newWidget={uniqueName:e.uniqueName,component:e.component,title:e.title,col:1,row:1,sizeX:e.sizeX,sizeY:e.sizeY,options:e.options,props:e.props},t.detectFirstEmptySlot(t.newWidget);var i={uniqueName:t.newWidget.uniqueName,component:t.newWidget.component,title:t.newWidget.title,options:t.newWidget.options,props:t.newWidget.props,sizeX:t.newWidget.sizeX,sizeY:t.newWidget.sizeY,col:t.newWidget.col,row:t.newWidget.row};t.widgets.push(i),t.newWidget=null,t.zone.run((function(){t.cdr.detectChanges(),t.calcGridSize(),t.emitConfigChanged(),setTimeout((function(){i.__meta__.instance.element.addEventListener("mousedown",t.dragStart.bind(t),!1)}),1e3)}))}))},e.prototype.handleOnRemove=function(e){var t=this;e.element.classList.add("animate__animated","animate__zoomOut"),e.element.addEventListener("animationend",(function(){t.widgets=t.widgets.filter((function(t){return t.__meta__.id!==e.config.__meta__.id})),t.cdr.detectChanges(),t.calcGridSize(),t.emitConfigChanged()}))},e.prototype.handleOnSave=function(e){this.onWidgetSave.emit(e)},e.prototype.trackByFn=function(e,t){var i,o;return(null===(i=t.__meta__)||void 0===i?void 0:i.id)||(t.__meta__={},t.__meta__.id=n.AXHtmlUtil.getUID()),null===(o=t.__meta__)||void 0===o?void 0:o.id},e.prototype.load=function(e){var t=this;return this.clear(),new Promise((function(i,n){if(e){var o=[];if("string"==typeof e)try{o.push.apply(o,m(JSON.parse(e)))}catch(e){n("Invalid widget json data!")}else o.push.apply(o,m(e));var r=-1;r=window.setInterval((function(){var e;t.galleryItems&&t.galleryItems.length>0&&(o.forEach((function(e){var i=t.galleryItems.find((function(t){return t.uniqueName===e.uniqueName}));i&&(e.component=i.component,i.props&&(e.props=JSON.parse(JSON.stringify(i.props))))})),(e=t.widgets).push.apply(e,m(o)),window.clearInterval(r),t.cdr.detectChanges(),i())}),200)}else i()}))},e.prototype.clear=function(){this.widgets.length&&(this.widgets=[],this.cdr.detectChanges(),this.emitConfigChanged())},e.prototype.save=function(){var e=this.widgets.map((function(e){return{uniqueName:e.uniqueName,component:e.component,title:e.title,sizeX:e.sizeX,sizeY:e.sizeY,col:e.col,row:e.row,options:e.options,props:e.props}}));return Promise.resolve(JSON.stringify(e))},e.prototype.refresh=function(){this.widgetHosts.forEach((function(e){e.widget.refresh()}))},e.prototype.handleOnConfigChanged=function(e){this.cdr.detectChanges(),this.emitConfigChanged()},e.prototype.handleOnResizedChanged=function(e){this.detectFirstEmptySlot(e.config),this.cdr.detectChanges(),this.emitConfigChanged()},e.prototype.emitConfigChanged=function(){var e=this;this.resizeChangeObserver||(this.resizeChangeObserver=new o.Observable,o.Observable.create((function(t){e.resizeChangeObserver=t})).pipe(r.debounceTime(750)).pipe(r.distinctUntilChanged()).subscribe((function(t){e.onConfigChanged.emit({component:e})}))),this.resizeChangeObserver.next(new Date)},e.ctorParameters=function(){return[{type:t.ElementRef},{type:t.NgZone},{type:t.ChangeDetectorRef}]},p([t.ViewChild("container"),g("design:type",t.ElementRef)],e.prototype,"container",void 0),p([t.ViewChildren(x),g("design:type",t.QueryList)],e.prototype,"widgetHosts",void 0),p([t.Input(),g("design:type",Array)],e.prototype,"galleryItems",void 0),p([t.Input(),g("design:type",Number)],e.prototype,"tileSize",void 0),p([t.Input(),g("design:type",Number)],e.prototype,"gapSize",void 0),p([t.Input(),g("design:type",Function)],e.prototype,"provideValue",void 0),p([t.Output(),g("design:type",t.EventEmitter)],e.prototype,"onConfigChanged",void 0),p([t.Output(),g("design:type",t.EventEmitter)],e.prototype,"onWidgetSave",void 0),e=p([t.Component({selector:"ax-widget-board",template:'<div class="widgets-container" [class.rtl]="rtl" #container>\r\n <ax-widget-host *ngFor="let w of widgets;trackBy: trackByFn" [config]=\'w\' [sizeX]="w.sizeX"\r\n [sizeY]="w.sizeY" [col]="w.col" [row]="w.row" (onRemove)="handleOnRemove($event)" (onSave)="handleOnSave($event)"\r\n (onConfigChanged)="handleOnConfigChanged($event)" (onResized)="handleOnResizedChanged($event)"\r\n [provideValue]="provideValue">\r\n </ax-widget-host>\r\n</div>\r\n',host:{class:"ax widget-board"},encapsulation:t.ViewEncapsulation.None,changeDetection:t.ChangeDetectionStrategy.OnPush,styles:[".widget-board{display:inline-block;margin:15px 20px;min-width:calc(100% - 40px);min-height:calc(100% - 34px);--animate-duration:0.5s;background-repeat:no-repeat}.widget-board.grid-background{background-repeat:repeat!important}.widget-board.grid-background .widgets-container .widget-host{touch-action:none;touch-action:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.widget-board.grid-background .widgets-container .widget-host .widget-edit-overlay{display:block;cursor:move}.widget-board.grid-background .widgets-container .widget-host.widget-dragging{z-index:1000}.widget-board.grid-background .widgets-container .widget-host:focus{outline-width:1px;outline-style:solid;outline-color:var(--ax-primary-color)}.widget-board.grid-background .widget-blank-placeholder{background:var(--ax-primary-trans-light-color);position:absolute}.widget-board .widgets-container{position:relative;touch-action:none}.widget-board .widgets-container.rtl .widget-host .widget-options-menu{right:unset!important;left:0!important}.widget-board .widgets-container .widget-host{position:absolute;background:#fff;box-shadow:2px 2px 3px #dadada}.widget-board .widgets-container .widget-host .widget-content{width:100%;height:100%;display:flex;flex-direction:column}.widget-board .widgets-container .widget-host .widget-content .widget-title{padding:var(--ax-size-md);text-align:start;font-size:1.5em;position:absolute}.widget-board .widgets-container .widget-host .widget-edit-loading{display:none;background:rgba(255,255,255,.85);position:absolute;width:100%;height:100%;top:0;left:0;z-index:2;display:flex}.widget-board .widgets-container .widget-host .widget-config-overlay{position:absolute;background:#fff;width:100%;height:100%;top:0;left:0;z-index:1;padding:var(--ax-size-md);cursor:pointer}.widget-board .widgets-container .widget-host .widget-config-overlay:hover .widget-title{text-decoration:underline}.widget-board .widgets-container .widget-host .widget-config-overlay .widget-title{text-align:start;font-size:1.5em}.widget-board .widgets-container .widget-host .widget-config-overlay .widget-config-box{align-self:center;text-align:center;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);color:var(--ax-gray-dark-color)}.widget-board .widgets-container .widget-host .widget-config-overlay .widget-config-box .config-title{font-size:1.2em;margin-bottom:var(--ax-size-md)}.widget-board .widgets-container .widget-host .widget-edit-overlay{display:none;background:rgba(255,255,255,.5);position:absolute;width:100%;height:100%;top:0;left:0;z-index:10}.widget-board .widgets-container .widget-host .widget-edit-overlay .widget-edit-menu{margin:6px;text-align:end;float:inline-end;opacity:1;transition:opacity 1s}.widget-board .widgets-container .widget-host .widget-edit-overlay .widget-edit-menu .widget-edit-menu-button{display:inline-block;background-color:#f0f0f0;border-radius:1px;border:2px solid #fff;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;padding:0;height:32px;width:32px;cursor:pointer;color:#666}.widget-board .widgets-container .widget-host .widget-edit-overlay .widget-edit-menu .widget-edit-menu-button:hover{border-color:#a6a6a6;background-color:#c8c8c8}.widget-board .widgets-container .widget-host .widget-options-menu{display:none;position:absolute;top:0;right:0;z-index:2;cursor:pointer;padding:2px 5px}.widget-board .widgets-container .widget-host .widget-options-menu:hover{background-color:#f0f0f0}.widget-board .widgets-container .widget-host .widget-container{padding:1px;height:100%}.widget-board .widgets-container .widget-host .widget-container:hover .widget-options-menu{display:block}"]}),g("design:paramtypes",[t.ElementRef,t.NgZone,t.ChangeDetectorRef])],e)}(),_=function(e){function i(t){var i=e.call(this,t)||this;return i.cdr=t,i.minX=1,i.maxX=10,i.minY=1,i.maxY=10,i}return c(i,e),i.prototype.ngOnInit=function(){Array.isArray(this.value)?(this.sizeX=this.value[0],this.sizeY=this.value[1]):(this.sizeX=2,this.sizeY=2)},i.prototype.handleMinValueChange=function(t){this.sizeX=t.value,this.sizeY>0&&e.prototype.handleValueChange.call(this,[this.sizeX,this.sizeY])},i.prototype.handleMaxValueChange=function(t){this.sizeY=t.value,this.sizeX>0&&e.prototype.handleValueChange.call(this,[this.sizeX,this.sizeY])},i.prototype.ngAfterViewInit=function(){this.initiated=!0},i.ctorParameters=function(){return[{type:t.ChangeDetectorRef}]},i=p([t.Component({template:'<div style="display: flex;">\r\n <div style="margin-inline-end: 0.5em;flex: calc(50% - 0.25em);">\r\n <ax-number-box (onValueChanged)="handleMinValueChange($event)" [value]="sizeX" [min]="minX" [max]="maxX">\r\n </ax-number-box>\r\n </div>\r\n <div style="flex: calc(50% - 0.25em);">\r\n <ax-number-box (onValueChanged)="handleMaxValueChange($event)" [value]="sizeY" [min]="minY" [max]="maxY">\r\n </ax-number-box>\r\n </div>\r\n</div>'}),g("design:paramtypes",[t.ChangeDetectorRef])],i)}(i.AXProperyEditorComponent),C=function(){function e(){}return e=p([t.NgModule({declarations:[_],imports:[a.CommonModule,d.FormsModule,i.AXNumberBoxModule],exports:[_],entryComponents:[_],providers:[]}),g("design:paramtypes",[])],e)}(),z=function(){function e(){n.AXTranslator.load("en",{"widget-board":{"configurable-props":"Configurable Properties",configure:"Configure Widget"}}),n.AXTranslator.load("fa",{"widget-board":{"configurable-props":"ویژگی های قابل تنظیم",configure:"پیکر بندی ابزارک"}})}return e=p([t.NgModule({imports:[a.CommonModule,i.AXSearchBoxModule,i.AXLoadingModule,s.RouterModule,i.AXProppertyEditorModule,i.AXPageModule,i.AXToolbarModule,n.AXTranslatorModule,i.AXLabelModule,i.AXTextAreaModule,i.AXFieldsetModule,i.AXTextBoxModule,i.AXFormGroupModule,i.AXTabStripModule,i.AXCheckBoxModule,i.AXMenuModule,n.AXTranslatorModule,C,i.AXValidationModule,s.RouterModule.forChild([{component:_,path:"ax/editors/widget-size"}])],exports:[A,i.AXProppertyEditorModule],declarations:[A,x,w,b],entryComponents:[w,b],providers:[]}),g("design:paramtypes",[])],e)}();e.AXWidgetBoardComponent=A,e.AXWidgetBoardModule=z,e.AXWidgetComponent=y,e.AXWidgetHostComponent=x,e.AXWidgetSizePropertyEditorComponent=_,e.AXWidgetSizePropertyEditorModule=C,e.ɵ0=v,e.ɵa=w,e.ɵb=b,Object.defineProperty(e,"__esModule",{value:!0})}));
15
+ ***************************************************************************** */var l=function(e,t){return(l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(e,t)};function c(e,t){function i(){this.constructor=e}l(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}function p(e,t,i,n){var o,r=arguments.length,a=r<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,i,a):o(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a}function g(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function u(e,t,i,n){return new(i||(i=Promise))((function(o,r){function a(e){try{d(n.next(e))}catch(e){r(e)}}function s(e){try{d(n.throw(e))}catch(e){r(e)}}function d(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,s)}d((n=n.apply(e,t||[])).next())}))}function h(e,t){var i,n,o,r,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return r={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function s(r){return function(s){return function(r){if(i)throw new TypeError("Generator is already executing.");for(;a;)try{if(i=1,n&&(o=2&r[0]?n.return:r[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,r[1])).done)return o;switch(n=0,o&&(r=[2&r[0],o.value]),r[0]){case 0:case 1:o=r;break;case 4:return a.label++,{value:r[1],done:!1};case 5:a.label++,n=r[1],r=[0];continue;case 7:r=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===r[0]||2===r[0])){a=0;continue}if(3===r[0]&&(!o||r[1]>o[0]&&r[1]<o[3])){a.label=r[1];break}if(6===r[0]&&a.label<o[1]){a.label=o[1],o=r;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(r);break}o[2]&&a.ops.pop(),a.trys.pop();continue}r=t.call(e,a)}catch(e){r=[6,e],n=0}finally{i=o=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,s])}}}function f(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var n,o,r=i.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=r.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(i=r.return)&&i.call(r)}finally{if(o)throw o.error}}return a}function m(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(f(arguments[t]));return e}var v=function(){return[1,2,3,5,10,20,30,60].map((function(e){return{id:6e4*e,text:n.AXTranslator.get("dateTime.duration.format_minute").replace("{0}",e.toString())}}))},y=function(){function e(){var e=this;this.uid=n.AXHtmlUtil.getUID(),this.onBusyChanged=new t.EventEmitter,this._isBusy=!0,this.refreshRate=[{id:3e5,text:n.AXTranslator.get("dateTime.duration.format_minute").replace("{0}","5")}],this.onConfiguredChanged=new t.EventEmitter,this.onConfiguredChanged.subscribe((function(){!0===e.isConfigured&&e.getRefreshRate()?e.restartRefreshTimer():e.stopRefreshTimer()}))}return Object.defineProperty(e.prototype,"isBusy",{get:function(){return this._isBusy},set:function(e){if(e!==this._isBusy){var t={component:this,oldValue:this._isBusy,value:e};this._isBusy=e,this.onBusyChanged.emit(t)}},enumerable:!0,configurable:!0}),e.prototype.getRefreshRate=function(){return Array.isArray(this.refreshRate)&&this.refreshRate.length?this.refreshRate[0].id:this.refreshRate},e.prototype.startRefreshTimer=function(){this.intervalId=window.setInterval(this.refresh.bind(this),this.getRefreshRate())},e.prototype.stopRefreshTimer=function(){window.clearInterval(this.intervalId)},e.prototype.restartRefreshTimer=function(){this.stopRefreshTimer(),this.startRefreshTimer()},e.prototype.ngOnDestroy=function(){this.stopRefreshTimer()},e.prototype.redraw=function(){},e.prototype.refresh=function(){this.restartRefreshTimer()},Object.defineProperty(e.prototype,"isConfigured",{get:function(){return!0},enumerable:!0,configurable:!0}),e.prototype.setValue=function(e,t){this[e]=t,this.onConfiguredChanged.emit()},e.prototype.getValue=function(e){var t,i=this[e],n=this.__meta__.config;if((null===(t=n.props[e])||void 0===t?void 0:t.runtime)&&this.provideValue){var o=this.provideValue({name:e,value:i,uniqueName:n.uniqueName,options:n.options});return this.provideValue instanceof Promise?o:Promise.resolve(o)}return Promise.resolve(i)},p([i.propertyEditor({editorClass:"ax/editors/widget-size",title:"common.size",visible:!1,order:-99}),g("design:type",Array)],e.prototype,"widgetSize",void 0),p([i.propertyEditor({editorClass:"ax/editors/select",title:"common.refresh-rate",visible:!0,order:-98,editorOptions:{items:v,allowNull:!1,allowSearch:!1,selectionDataMode:"value",selectionMode:"single",valueField:"id"}}),g("design:type",Object)],e.prototype,"refreshRate",void 0),e}(),w=function(e){function o(t){var i=e.call(this)||this;return i.cdr=t,i.props=[],i.displayProps=[],i.changes=[],i.context={},i}return c(o,e),o.prototype.getFooterButtons=function(){return[{name:"okay",submitBehavior:!0,text:n.AXTranslator.get("common.confirm"),style:"success"},{name:"cancel",cancelBehavior:!0,text:n.AXTranslator.get("common.cancel"),style:"danger blank"}]},o.prototype.onFooterButtonClick=function(e){var t=this;"cancel"===e.name&&this.close(),"okay"===e.name&&this.form.validate().then((function(e){e.result&&t.close(t.changes)}))},o.prototype.handleValueChange=function(e){var t=this.changes.find((function(t){return t.property.name===e.property.name}));t?t.value=e.value:this.changes.push({property:e.property,value:e.value}),this.updateContext()},o.prototype.ngOnInit=function(){this.displayProps=this.props.filter((function(e){return!1!==e.property.visible})).sort((function(e,t){return e.property.order-t.property.order})),this.updateContext()},o.prototype.updateContext=function(){var e={};this.props.forEach((function(t){e[t.property.name]=t.value})),this.changes.forEach((function(t){e[t.property.name]=t.value})),this.context=e},o.prototype.identify=function(e,t){return t.property.name},o.ctorParameters=function(){return[{type:t.ChangeDetectorRef}]},p([t.ViewChild(i.AXValidationFormComponent),g("design:type",i.AXValidationFormComponent)],o.prototype,"form",void 0),o=p([t.Component({template:'<ax-page>\r\n <ax-page-content>\r\n <div class="container">\r\n <ax-validation-form #form>\r\n <div class="row" *ngFor="let p of displayProps; trackBy: identify">\r\n <div class="col-12">\r\n <ax-label>{{p.property.title | trans}}</ax-label>\r\n <ng-container ax-property-editor-renderer [property]="p" [context]="context" [host]="widget" [validationForm]="form"\r\n (onValueChange)="handleValueChange($event)">\r\n </ng-container>\r\n </div>\r\n </div>\r\n </ax-validation-form>\r\n </div>\r\n </ax-page-content>\r\n</ax-page>',encapsulation:t.ViewEncapsulation.None,changeDetection:t.ChangeDetectionStrategy.OnPush}),g("design:paramtypes",[t.ChangeDetectorRef])],o)}(i.AXBasePopupPageComponent),b=function(e){function i(){var t=null!==e&&e.apply(this,arguments)||this;return t.props=[],t}return c(i,e),i.prototype.getFooterButtons=function(){return[{name:"okay",submitBehavior:!0,text:n.AXTranslator.get("common.confirm"),style:"ax success"},{name:"cancel",cancelBehavior:!0,text:n.AXTranslator.get("common.cancel"),style:"ax light"}]},i.prototype.ngOnInit=function(){var e,t,i=(null===(e=this.props.find((function(e){return"title"===e.property.name||"name"===e.property.name})))||void 0===e?void 0:e.value)||this.config.title,o={};null===(t=this.props)||void 0===t||t.forEach((function(e){o[e.property.name]=e.property})),this.data={component:this.config.component,title:i,uniqueName:this.config.uniqueName+"-"+n.AXHtmlUtil.getUID(),options:n.AXObjectUtil.deepJSONClone(this.config.options),props:n.AXObjectUtil.deepJSONClone(o)},this.displayProps=this.props.filter((function(e){return!1!==e.property.visible})).sort((function(e,t){return e.property.order-t.property.order})).map((function(e){return{name:e.property.name,title:e.property.title,allow:!0}}))},i.prototype.onFooterButtonClick=function(e){var t=this;"cancel"===e.name&&this.close(),"okay"===e.name&&(this.props.forEach((function(e){var i=t.displayProps.find((function(t){return t.name===e.property.name}));if(null==i||!i.allow){var n=t.data.props[e.property.name];n?n.visible=!1:n={visible:!1}}})),this.close(this.data))},i=p([t.Component({template:'<ax-page>\r\n <ax-page-content>\r\n <div class="container">\r\n <div class="row">\r\n <div class="col-12">\r\n <ax-form-group>\r\n <ax-label>{{\'common.title\' | trans}}</ax-label>\r\n <ax-text-box [(value)]="data.title"></ax-text-box>\r\n </ax-form-group>\r\n </div>\r\n </div>\r\n <div class="row">\r\n <div class="col-12">\r\n <ax-form-group>\r\n <ax-label>{{\'common.description\' | trans}}</ax-label>\r\n <ax-text-area [(value)]="data.description"></ax-text-area>\r\n </ax-form-group>\r\n </div>\r\n </div>\r\n \x3c!-- <div class="row">\r\n <div class="col-12">\r\n <ax-form-group>\r\n <ax-label>{{\'common.uniquename\' | trans}}</ax-label>\r\n <ax-text-box></ax-text-box>\r\n </ax-form-group>\r\n </div>\r\n </div> --\x3e\r\n <div class="row" style="margin-block-end: var(--ax-size-md);margin-block-start: var(--ax-size-md);">\r\n <div class="col-12">\r\n <ax-fieldset caption="{{\'widget-board.configurable-props\' | trans}}">\r\n <div class="row" *ngFor="let prop of displayProps">\r\n <div class="col-12" style="margin-block-end: var(--ax-size-sm)">\r\n <ax-check-box [(value)]="prop.allow" label="{{ prop.title | trans }}">\r\n\r\n </ax-check-box>\r\n </div>\r\n </div>\r\n </ax-fieldset>\r\n </div>\r\n </div>\r\n </div>\r\n </ax-page-content>\r\n</ax-page>',encapsulation:t.ViewEncapsulation.None,changeDetection:t.ChangeDetectionStrategy.OnPush})],i)}(i.AXBasePopupPageComponent),x=function(){function e(e,i,n,o,r,a){this.ref=e,this.componentFactoryResolver=i,this.rendererService=n,this.cdr=o,this.popup=r,this.loadingService=a,this._hasProps=!1,this._hasMenu=!1,this.configMenuItem=[{icon:"far fa-ellipsis-h",items:[]}],this.onRemove=new t.EventEmitter,this.onConfigChanged=new t.EventEmitter,this.onResized=new t.EventEmitter,this.onSave=new t.EventEmitter,this._isLoading=!1,this.sizeX=1,this.sizeY=1,this.col=1,this.row=1}return Object.defineProperty(e.prototype,"widget",{get:function(){return this._widget},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"element",{get:function(){return this.ref.nativeElement},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isLoading",{get:function(){return this._isLoading},set:function(e){this._isLoading=e,this._loadingId&&!e&&(this.loadingService.hide(this._loadingId),this._loadingId=null),e&&(this._loadingId=this.loadingService.show(this.ref.nativeElement))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isConfigured",{get:function(){var e;return(null===(e=this._widget)||void 0===e?void 0:e.isConfigured)||!1},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){this.isLoading=!0},e.prototype.ngAfterViewInit=function(){var e;return u(this,void 0,void 0,(function(){var t,o,r,a=this;return h(this,(function(s){switch(s.label){case 0:return"string"!=typeof this.config.component?[3,2]:[4,this.rendererService.findLoadedComponentByRoute(this.config.component,20)];case 1:return o=s.sent(),t=null===(e=o)||void 0===e?void 0:e.component,[3,3];case 2:"function"==typeof this.config.component&&(t=this.config.component),s.label=3;case 3:return null==t?(console.error("Invalid Widget Component!",this.config),this.onRemove.emit(this),[2]):(r=this.componentFactoryResolver.resolveComponentFactory(t),this.componentRef=this.vc.createComponent(r),this._widget=this.componentRef.instance,this._widget.provideValue=this.provideValue,this._widget.onBusyChanged&&this._widget.onBusyChanged.subscribe((function(e){a._widget.widgetSize?a.setSizeFromOptions():a._widget.setValue("widgetSize",[a.sizeX,a.sizeY]),a.isLoading=e.value,a.cdr.detectChanges()})),this._widget.onConfiguredChanged&&this._widget.onConfiguredChanged.subscribe((function(){a.setSizeFromOptions()})),this.config.options&&Object.assign(this._widget,this.config.options),this._hasProps=i.AXPropertyDecorators.getProperties(this._widget).length>0,this.isLoading=!1,this.config.__meta__.instance=this,this._widget.__meta__={},this._widget.__meta__.config=this.config,this.configMenuItem[0].items.push({name:"refresh",icon:"far fa-undo",text:n.AXTranslator.get("common.refresh"),onClick:function(){var e,t;null===(t=null===(e=a)||void 0===e?void 0:e.widget)||void 0===t||t.refresh()}}),this._hasProps&&this.configMenuItem[0].items.push({name:"configs",icon:"far fa-cogs",text:n.AXTranslator.get("common.configs"),onClick:function(){a.openConfigDialog()}}),this.configMenuItem[0].items.push({name:"save",icon:"far fa-save",text:n.AXTranslator.get("common.save-as"),onClick:function(){a.openSaveDialog()}}),this.configMenuItem[0].items.push({name:"remove",icon:"far fa-times",style:"ax danger blank",text:n.AXTranslator.get("common.remove"),onClick:function(){a.onRemove.emit(a)}}),this._hasMenu=this.configMenuItem[0].items.length>0,this.cdr.detectChanges(),[2])}}))}))},e.prototype.setSizeFromOptions=function(){var e=this;this._widget.getValue("widgetSize").then((function(t){var i=e.sizeX,n=e.sizeY;t&&Array.isArray(t)&&(i!==t[0]||n!==t[1])&&(e.config.sizeX=e.sizeX=t[0],e.config.sizeY=e.sizeY=t[1],e.onResized.emit({component:e._widget,config:e.config})),e.cdr.detectChanges()}))},e.prototype.remove=function(e){return e.preventDefault(),e.stopPropagation(),this.onRemove.emit(this),!1},e.prototype.handleConfig=function(e){return e.preventDefault(),e.stopPropagation(),this.openConfigDialog(),!1},e.prototype.openConfigDialog=function(){var e=this,t=this.getMergedProps();this.popup.open(w,{title:n.AXTranslator.get("common.configs"),size:"sm",data:{props:t.map((function(t){return{property:t.options,value:e._widget[t.options.name]}})),widget:this.widget}}).then((function(t){t.data&&(e.config.options||(e.config.options={}),t.data.forEach((function(t){e._widget.setValue(t.property.name,t.value),e.config.options[t.property.name]=t.value})),e.emitConfigChanged(),e._widget.redraw(),e.cdr.detectChanges())}))},e.prototype.openSaveDialog=function(){var e=this,t=this.getMergedProps();this.popup.open(b,{title:n.AXTranslator.get("common.save-as"),size:"sm",data:{config:this.config,props:t.map((function(t){return{property:t.options,value:e._widget[t.options.name]}}))}}).then((function(t){t.data&&e.onSave.emit({component:e._widget,data:t.data})}))},e.prototype.handleOptionClick=function(e){return e.preventDefault(),e.stopPropagation(),this.openConfigDialog(),!1},e.prototype.ngOnDestroy=function(){this.vc.clear(),this.componentRef&&this.componentRef.destroy()},e.prototype.getMergedProps=function(){var e=n.AXObjectUtil.deepCopy(i.AXPropertyDecorators.getProperties(this._widget)),t=function(t){if(Object.prototype.hasOwnProperty.call(o.config.props,t)){var i=o.config.props[t],n=e.find((function(e){return e.property===t}));n&&Object.assign(n.options,i)}},o=this;for(var r in this.config.props)t(r);return e},e.prototype.emitConfigChanged=function(){this.onConfigChanged.emit({component:this._widget,config:this.config})},e.ctorParameters=function(){return[{type:t.ElementRef},{type:t.ComponentFactoryResolver},{type:n.AXRenderService},{type:t.ChangeDetectorRef},{type:i.AXPopupService},{type:i.AXLoadingService}]},p([t.Input(),g("design:type",Function)],e.prototype,"provideValue",void 0),p([t.Output(),g("design:type",t.EventEmitter)],e.prototype,"onRemove",void 0),p([t.Output(),g("design:type",t.EventEmitter)],e.prototype,"onConfigChanged",void 0),p([t.Output(),g("design:type",t.EventEmitter)],e.prototype,"onResized",void 0),p([t.Output(),g("design:type",t.EventEmitter)],e.prototype,"onSave",void 0),p([t.Input(),g("design:type",Object)],e.prototype,"config",void 0),p([t.ViewChild("vc",{read:t.ViewContainerRef}),g("design:type",t.ViewContainerRef)],e.prototype,"vc",void 0),p([t.HostBinding("attr.data-size-x"),t.Input(),g("design:type",Number)],e.prototype,"sizeX",void 0),p([t.HostBinding("attr.data-size-y"),t.Input(),g("design:type",Number)],e.prototype,"sizeY",void 0),p([t.HostBinding("attr.data-col"),t.Input(),g("design:type",Number)],e.prototype,"col",void 0),p([t.HostBinding("attr.data-row"),t.Input(),g("design:type",Number)],e.prototype,"row",void 0),e=p([t.Component({selector:"ax-widget-host",template:'<div class=\'widget-container\'>\r\n <div class="widget-config-overlay" *ngIf="!isConfigured" (click)="handleConfig($event)">\r\n <div class="widget-title">{{config.title}}</div>\r\n <div class="widget-config-box">\r\n <div class="config-title">{{ \'widget-board.configure\' | trans}}</div>\r\n <div class="config-icon"><i class="fas fa-cogs fa-5x" aria-hidden="true"></i></div>\r\n </div>\r\n </div>\r\n <div class=\'widget-edit-overlay\'>\r\n <div class=\'widget-edit-menu\'>\r\n <button class="widget-edit-menu-button" (click)="handleConfig($event)"\r\n (mousedown)="$event.stopPropagation()" *ngIf="_hasProps" (mouseup)="$event.stopPropagation()">\r\n <i class="far fa-cogs" aria-hidden="true"></i>\r\n </button>\r\n <button class="widget-edit-menu-button" (click)="remove($event)" (mousedown)="$event.stopPropagation()"\r\n (mouseup)="$event.stopPropagation()">\r\n <i class="far fa-times" aria-hidden="true"></i>\r\n </button>\r\n </div>\r\n\r\n </div>\r\n <div class="widget-options-menu" *ngIf="_hasMenu">\r\n <ax-menu [items]=\'configMenuItem\' direction="horizontal"></ax-menu>\r\n </div>\r\n \x3c!-- <ax-loading-panel [visible]="isBusy">\r\n </ax-loading-panel> --\x3e\r\n <div class="widget-content">\r\n <ng-container #vc></ng-container>\r\n </div>\r\n</div>',host:{class:"ax widget-host",tabindex:"0"},encapsulation:t.ViewEncapsulation.None,changeDetection:t.ChangeDetectionStrategy.OnPush}),g("design:paramtypes",[t.ElementRef,t.ComponentFactoryResolver,n.AXRenderService,t.ChangeDetectorRef,i.AXPopupService,i.AXLoadingService])],e)}(),A=function(){function e(e,i,n){this.ref=e,this.zone=i,this.cdr=n,this.widgets=[],this.galleryItems=[],this.tileSize=80,this.gapSize=5,this.newWidget=null,this._isInEditing=!1,this.isDragging=!1,this.DATA_COL="data-col",this.DATA_ROW="data-row",this.DATA_SIZE_X="data-size-x",this.DATA_SIZE_Y="data-size-y",this.DATA_OLD_COL="data-old-col",this.DATA_OLD_ROW="data-old-row",this.onConfigChanged=new t.EventEmitter,this.onWidgetSave=new t.EventEmitter}return e.prototype.isInEditing=function(){return this._isInEditing},e.prototype.ngOnInit=function(){null==this.rtl&&(this.rtl="rtl"===window.getComputedStyle(this.ref.nativeElement,null).getPropertyValue("direction"))},e.prototype.ngAfterViewInit=function(){var e=this;this.zone.runOutsideAngular((function(t){var i=document.createElement("style");i.type="text/css",e.ref.nativeElement.appendChild(i);for(var n=1;n<=50;n++)i.innerHTML+="["+e.DATA_COL+'="'+n+'"] { '+(e.rtl?"right":"left")+": "+(n-1)*(e.tileSize+e.gapSize)+"px; }",i.innerHTML+="["+e.DATA_ROW+'="'+n+'"] { top: '+(n-1)*(e.tileSize+e.gapSize)+"px; }",i.innerHTML+="["+e.DATA_SIZE_X+'="'+n+'"] { width: '+(n*e.tileSize+(n-1)*e.gapSize)+"px; }",i.innerHTML+="["+e.DATA_SIZE_Y+'="'+n+'"] { height: '+(n*e.tileSize+(n-1)*e.gapSize)+"px; }"}))},e.prototype.calcGridSize=function(){var e=this;this.zone.runOutsideAngular((function(){var t=Math.max.apply(Math,m(e.widgets.map((function(e){return e.col+e.sizeX-1}))))*(e.tileSize+e.gapSize),i=Math.max.apply(Math,m(e.widgets.map((function(e){return e.row+e.sizeY-1}))))*(e.tileSize+e.gapSize);e.container.nativeElement.style.width=t+"px",e.container.nativeElement.style.height=i+"px"}))},e.prototype.toggleEdit=function(){this._isInEditing?this.finishEdit():this.startEdit()},e.prototype.dragStart=function(e){var t=this;return e.preventDefault(),e.stopPropagation(),this.zone.runOutsideAngular((function(){t._isInEditing&&1===e.which&&(t.dragItem=e.currentTarget,t.dragItem.setAttribute("data-x-offset",(t.dragItem.offsetLeft-e.clientX).toString()),t.dragItem.setAttribute("data-y-offset",(t.dragItem.offsetTop-e.clientY).toString()),t.dragItem.classList.add("widget-dragging"),t.dragItem.classList.remove("animate__animated","animate__pulse"))})),!1},e.prototype.removePositionData=function(){var e=this;this.zone.runOutsideAngular((function(){e.dragItem&&e._isInEditing&&null==e.dragItem.getAttribute(e.DATA_OLD_COL)&&(e.dragItem.setAttribute(e.DATA_OLD_COL,e.dragItem.getAttribute(e.DATA_COL)),e.dragItem.setAttribute(e.DATA_OLD_ROW,e.dragItem.getAttribute(e.DATA_ROW)),e.dragItem.removeAttribute(e.DATA_COL),e.dragItem.removeAttribute(e.DATA_ROW))}))},e.prototype.resetPositionData=function(){var e=this;this.zone.runOutsideAngular((function(){e.dragItem&&e._isInEditing&&e.setPosition(e.dragItem,e.dragItem.getAttribute(e.DATA_OLD_COL),e.dragItem.getAttribute(e.DATA_OLD_ROW))}))},e.prototype.setPosition=function(e,t,i){var n=this;this.zone.runOutsideAngular((function(){e.setAttribute(n.DATA_COL,t),e.setAttribute(n.DATA_ROW,i),e.removeAttribute(n.DATA_OLD_COL),e.removeAttribute(n.DATA_OLD_ROW),e.style.removeProperty("top"),e.style.removeProperty("left");var o=n.widgets.find((function(t){return t.__meta__.instance.element===e}));o.col=Number(t),o.row=Number(i)}))},e.prototype.drag=function(e){var t=this;return e.preventDefault(),e.stopPropagation(),this.zone.runOutsideAngular((function(){if(t.dragItem&&t._isInEditing){t.isDragging=!0,t.addPlaceholder();var i=Number(t.dragItem.getAttribute("data-x-offset")),n=Number(t.dragItem.getAttribute("data-y-offset"));t.dragItem.style.left=e.clientX+i+"px",t.dragItem.style.top=e.clientY+n+"px",t.detectBestPlacement(),t.removePositionData()}})),!1},e.prototype.dragEnd=function(e){var t=this;this.zone.runOutsideAngular((function(){if(t.dragItem&&t._isInEditing&&t.isDragging){t.dragItem.classList.remove("widget-dragging"),t.dragItem.classList.add("animate__animated","animate__pulse");var e=t.container.nativeElement.querySelector(".widget-blank-placeholder");if(t.newWidget){var i={uniqueName:t.newWidget.uniqueName,component:t.newWidget.component,title:t.newWidget.title,options:t.newWidget.options,sizeX:t.newWidget.sizeX,sizeY:t.newWidget.sizeY,col:Number(e.getAttribute(t.DATA_COL)),row:Number(e.getAttribute(t.DATA_ROW))};t.widgets.push(i),t.newWidget=null,t.container.nativeElement.removeChild(t.dragItem),t.zone.run((function(){t.cdr.detectChanges(),t.calcGridSize(),setTimeout((function(){i.__meta__.instance.element.addEventListener("mousedown",t.dragStart.bind(t),!1)}),1e3)}))}else e?t.setPosition(t.dragItem,e.getAttribute(t.DATA_COL),e.getAttribute(t.DATA_ROW)):t.setPosition(t.dragItem,t.dragItem.getAttribute(t.DATA_OLD_COL),t.dragItem.getAttribute(t.DATA_OLD_ROW));t.removePlaceholder(),t.dragItem=null,t.calcGridSize(),t.emitConfigChanged()}t.isDragging=!1}))},e.prototype.detectFirstEmptySlot=function(e){for(var t=Math.floor(this.ref.nativeElement.parentElement.offsetWidth/this.tileSize),i=1;i<=100;i++)for(var o=function(t){var o=new n.AXClientRec({left:t,top:i,width:e.sizeX,height:e.sizeY});if(null==r.widgets.filter((function(t){return t!==e})).find((function(e){return o.intersect({left:e.col,top:e.row,width:e.sizeX,height:e.sizeY})})))return e.col=t,e.row=i,{value:void 0}},r=this,a=1;a<=t-e.sizeX;a++){var s=o(a);if("object"==typeof s)return s.value}},e.prototype.detectBestPlacement=function(){var e=this;this.zone.runOutsideAngular((function(){var t=e.container.nativeElement.querySelector(".widget-blank-placeholder"),i=Math.ceil(e.dragItem.offsetLeft/e.tileSize);e.rtl&&(i=Math.ceil((e.container.nativeElement.clientWidth-(e.dragItem.offsetLeft+e.dragItem.clientWidth))/e.tileSize));var o=Math.ceil(e.dragItem.offsetTop/e.tileSize);i<1&&(i=1),o<1&&(o=1);var r=Array.from(e.ref.nativeElement.querySelectorAll(".widget-host")).map((function(e){return e}));t.setAttribute(e.DATA_COL,i.toString()),t.setAttribute(e.DATA_ROW,o.toString()),r.filter((function(t){return t!==e.dragItem})).some((function(t){return n.AXHtmlUtil.collision(t,e.dragItem)}))&&e.removePlaceholder()}))},e.prototype.addPlaceholder=function(){var e=this;this.zone.runOutsideAngular((function(){if(e.removePlaceholder(),e.dragItem){var t=document.createElement("div");t.classList.add("widget-blank-placeholder"),t.setAttribute(e.DATA_COL,e.dragItem.getAttribute(e.DATA_COL)),t.setAttribute(e.DATA_ROW,e.dragItem.getAttribute(e.DATA_ROW)),t.setAttribute(e.DATA_SIZE_X,e.dragItem.getAttribute(e.DATA_SIZE_X)),t.setAttribute(e.DATA_SIZE_Y,e.dragItem.getAttribute(e.DATA_SIZE_Y)),e.container.nativeElement.appendChild(t)}}))},e.prototype.removePlaceholder=function(){var e;null===(e=this.container.nativeElement.querySelector(".widget-blank-placeholder"))||void 0===e||e.remove()},e.prototype.startEdit=function(){var e=this;this._isInEditing=!0,this.calcGridSize(),this.ref.nativeElement.classList.add("grid-background");var t=this.ref.nativeElement;t.style.setProperty("background-position",(this.rtl?"right":"left")+" top");var i='url(\'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="'+(this.tileSize+this.gapSize)+'" height="'+(this.tileSize+this.gapSize)+'"> <rect style="fill: %23dadada" x="'+(this.rtl?this.gapSize:0)+'" width="'+this.tileSize+'" height="'+this.tileSize+'" y="0"></rect></svg>\')';t.style.setProperty("background-image",i),Array.from(this.ref.nativeElement.querySelectorAll(".widget-host")).forEach((function(t){t.addEventListener("mousedown",e.dragStart.bind(e),!1)})),this.ref.nativeElement.addEventListener("mousemove",this.drag.bind(this),!1),this.ref.nativeElement.addEventListener("mouseup",this.dragEnd.bind(this),!1)},e.prototype.finishEdit=function(){var e=this;this.ref.nativeElement.classList.remove("grid-background"),this.ref.nativeElement.style.removeProperty("background-image"),this._isInEditing=!1,Array.from(this.ref.nativeElement.querySelectorAll(".widget-host")).forEach((function(t){t.removeEventListener("mousedown",e.dragStart.bind(e),!1)})),this.ref.nativeElement.removeEventListener("mousemove",this.drag.bind(this),!1),this.ref.nativeElement.removeEventListener("mouseup",this.dragEnd.bind(this),!1),this.emitConfigChanged()},e.prototype.addWidget=function(e){var t=this;this.zone.runOutsideAngular((function(){t.newWidget={uniqueName:e.uniqueName,component:e.component,title:e.title,col:1,row:1,sizeX:e.sizeX,sizeY:e.sizeY,options:e.options,props:e.props},t.detectFirstEmptySlot(t.newWidget);var i={uniqueName:t.newWidget.uniqueName,component:t.newWidget.component,title:t.newWidget.title,options:t.newWidget.options,props:t.newWidget.props,sizeX:t.newWidget.sizeX,sizeY:t.newWidget.sizeY,col:t.newWidget.col,row:t.newWidget.row};t.widgets.push(i),t.newWidget=null,t.zone.run((function(){t.cdr.detectChanges(),t.calcGridSize(),t.emitConfigChanged(),setTimeout((function(){i.__meta__.instance.element.addEventListener("mousedown",t.dragStart.bind(t),!1)}),1e3)}))}))},e.prototype.handleOnRemove=function(e){var t=this;e.element.classList.add("animate__animated","animate__zoomOut"),e.element.addEventListener("animationend",(function(){t.widgets=t.widgets.filter((function(t){return t.__meta__.id!==e.config.__meta__.id})),t.cdr.detectChanges(),t.calcGridSize(),t.emitConfigChanged()}))},e.prototype.handleOnSave=function(e){this.onWidgetSave.emit(e)},e.prototype.trackByFn=function(e,t){var i,o;return(null===(i=t.__meta__)||void 0===i?void 0:i.id)||(t.__meta__={},t.__meta__.id=n.AXHtmlUtil.getUID()),null===(o=t.__meta__)||void 0===o?void 0:o.id},e.prototype.load=function(e){var t=this;return this.clear(),new Promise((function(i,n){if(e){var o=[];if("string"==typeof e)try{o.push.apply(o,m(JSON.parse(e)))}catch(e){n("Invalid widget json data!")}else o.push.apply(o,m(e));var r=-1;r=window.setInterval((function(){var e;t.galleryItems&&t.galleryItems.length>0&&(o.forEach((function(e){var i=t.galleryItems.find((function(t){return t.uniqueName===e.uniqueName}));i&&(e.component=i.component,i.props&&(e.props=JSON.parse(JSON.stringify(i.props))))})),(e=t.widgets).push.apply(e,m(o)),window.clearInterval(r),t.cdr.detectChanges(),i())}),200)}else i()}))},e.prototype.clear=function(){this.widgets.length&&(this.widgets=[],this.cdr.detectChanges(),this.emitConfigChanged())},e.prototype.save=function(){var e=this.widgets.map((function(e){return{uniqueName:e.uniqueName,component:e.component,title:e.title,sizeX:e.sizeX,sizeY:e.sizeY,col:e.col,row:e.row,options:e.options,props:e.props}}));return Promise.resolve(JSON.stringify(e))},e.prototype.refresh=function(){this.widgetHosts.forEach((function(e){e.widget.refresh()}))},e.prototype.handleOnConfigChanged=function(e){this.cdr.detectChanges(),this.emitConfigChanged()},e.prototype.handleOnResizedChanged=function(e){this.detectFirstEmptySlot(e.config),this.cdr.detectChanges(),this.emitConfigChanged()},e.prototype.emitConfigChanged=function(){var e=this;this.resizeChangeObserver||(this.resizeChangeObserver=new o.Observable,o.Observable.create((function(t){e.resizeChangeObserver=t})).pipe(r.debounceTime(750)).pipe(r.distinctUntilChanged()).subscribe((function(t){e.onConfigChanged.emit({component:e})}))),this.resizeChangeObserver.next(new Date)},e.ctorParameters=function(){return[{type:t.ElementRef},{type:t.NgZone},{type:t.ChangeDetectorRef}]},p([t.ViewChild("container"),g("design:type",t.ElementRef)],e.prototype,"container",void 0),p([t.ViewChildren(x),g("design:type",t.QueryList)],e.prototype,"widgetHosts",void 0),p([t.Input(),g("design:type",Array)],e.prototype,"galleryItems",void 0),p([t.Input(),g("design:type",Number)],e.prototype,"tileSize",void 0),p([t.Input(),g("design:type",Number)],e.prototype,"gapSize",void 0),p([t.Input(),g("design:type",Function)],e.prototype,"provideValue",void 0),p([t.Output(),g("design:type",t.EventEmitter)],e.prototype,"onConfigChanged",void 0),p([t.Output(),g("design:type",t.EventEmitter)],e.prototype,"onWidgetSave",void 0),e=p([t.Component({selector:"ax-widget-board",template:'<div class="widgets-container" [class.rtl]="rtl" #container>\r\n <ax-widget-host *ngFor="let w of widgets;trackBy: trackByFn" [config]=\'w\' [sizeX]="w.sizeX"\r\n [sizeY]="w.sizeY" [col]="w.col" [row]="w.row" (onRemove)="handleOnRemove($event)" (onSave)="handleOnSave($event)"\r\n (onConfigChanged)="handleOnConfigChanged($event)" (onResized)="handleOnResizedChanged($event)"\r\n [provideValue]="provideValue">\r\n </ax-widget-host>\r\n</div>\r\n',host:{class:"ax widget-board"},encapsulation:t.ViewEncapsulation.None,changeDetection:t.ChangeDetectionStrategy.OnPush,styles:[".widget-board{display:inline-block;margin:15px 20px;min-width:calc(100% - 40px);min-height:calc(100% - 34px);--animate-duration:0.5s;background-repeat:no-repeat}.widget-board.grid-background{background-repeat:repeat!important}.widget-board.grid-background .widgets-container .widget-host{touch-action:none;touch-action:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.widget-board.grid-background .widgets-container .widget-host .widget-edit-overlay{display:block;cursor:move}.widget-board.grid-background .widgets-container .widget-host.widget-dragging{z-index:1000}.widget-board.grid-background .widgets-container .widget-host:focus{outline-width:1px;outline-style:solid;outline-color:var(--ax-primary-color)}.widget-board.grid-background .widget-blank-placeholder{background:var(--ax-primary-trans-light-color);position:absolute}.widget-board .widgets-container{position:relative;touch-action:none}.widget-board .widgets-container.rtl .widget-host .widget-options-menu{right:unset!important;left:0!important}.widget-board .widgets-container .widget-host{position:absolute;background:#fff;box-shadow:2px 2px 3px #dadada}.widget-board .widgets-container .widget-host .widget-content{width:100%;height:100%;display:flex;flex-direction:column}.widget-board .widgets-container .widget-host .widget-content .widget-title{padding:var(--ax-size-md);text-align:start;font-size:1.5em;position:absolute}.widget-board .widgets-container .widget-host .widget-edit-loading{display:none;background:rgba(255,255,255,.85);position:absolute;width:100%;height:100%;top:0;left:0;z-index:2;display:flex}.widget-board .widgets-container .widget-host .widget-config-overlay{position:absolute;background:#fff;width:100%;height:100%;top:0;left:0;z-index:1;padding:var(--ax-size-md);cursor:pointer}.widget-board .widgets-container .widget-host .widget-config-overlay:hover .widget-title{text-decoration:underline}.widget-board .widgets-container .widget-host .widget-config-overlay .widget-title{text-align:start;font-size:1.5em}.widget-board .widgets-container .widget-host .widget-config-overlay .widget-config-box{align-self:center;text-align:center;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);color:var(--ax-gray-dark-color)}.widget-board .widgets-container .widget-host .widget-config-overlay .widget-config-box .config-title{font-size:1.2em;margin-bottom:var(--ax-size-md)}.widget-board .widgets-container .widget-host .widget-edit-overlay{display:none;background:rgba(255,255,255,.5);position:absolute;width:100%;height:100%;top:0;left:0;z-index:10}.widget-board .widgets-container .widget-host .widget-edit-overlay .widget-edit-menu{margin:6px;text-align:end;float:inline-end;opacity:1;transition:opacity 1s}.widget-board .widgets-container .widget-host .widget-edit-overlay .widget-edit-menu .widget-edit-menu-button{display:inline-block;background-color:#f0f0f0;border-radius:1px;border:2px solid #fff;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;padding:0;height:32px;width:32px;cursor:pointer;color:#666}.widget-board .widgets-container .widget-host .widget-edit-overlay .widget-edit-menu .widget-edit-menu-button:hover{border-color:#a6a6a6;background-color:#c8c8c8}.widget-board .widgets-container .widget-host .widget-options-menu{display:none;position:absolute;top:0;right:0;z-index:2;cursor:pointer;padding:2px 5px}.widget-board .widgets-container .widget-host .widget-options-menu:hover{background-color:#f0f0f0}.widget-board .widgets-container .widget-host .widget-container{padding:1px;height:100%}.widget-board .widgets-container .widget-host .widget-container:hover .widget-options-menu{display:block}"]}),g("design:paramtypes",[t.ElementRef,t.NgZone,t.ChangeDetectorRef])],e)}(),_=function(e){function i(t){var i=e.call(this,t)||this;return i.cdr=t,i.minX=1,i.maxX=10,i.minY=1,i.maxY=10,i}return c(i,e),i.prototype.ngOnInit=function(){Array.isArray(this.value)?(this.sizeX=this.value[0],this.sizeY=this.value[1]):(this.sizeX=2,this.sizeY=2)},i.prototype.handleMinValueChange=function(t){this.sizeX=t.value,this.sizeY>0&&e.prototype.handleValueChange.call(this,[this.sizeX,this.sizeY])},i.prototype.handleMaxValueChange=function(t){this.sizeY=t.value,this.sizeX>0&&e.prototype.handleValueChange.call(this,[this.sizeX,this.sizeY])},i.prototype.ngAfterViewInit=function(){this.onRenderCompleted.emit()},i.ctorParameters=function(){return[{type:t.ChangeDetectorRef}]},i=p([t.Component({template:'<div style="display: flex;">\r\n <div style="margin-inline-end: 0.5em;flex: calc(50% - 0.25em);">\r\n <ax-number-box (onValueChanged)="handleMinValueChange($event)" [value]="sizeX" [min]="minX" [max]="maxX">\r\n </ax-number-box>\r\n </div>\r\n <div style="flex: calc(50% - 0.25em);">\r\n <ax-number-box (onValueChanged)="handleMaxValueChange($event)" [value]="sizeY" [min]="minY" [max]="maxY">\r\n </ax-number-box>\r\n </div>\r\n</div>'}),g("design:paramtypes",[t.ChangeDetectorRef])],i)}(i.AXProperyEditorComponent),C=function(){function e(){n.AXTranslator.load("en",{"widget-board":{"configurable-props":"Configurable Properties",configure:"Configure Widget"}}),n.AXTranslator.load("fa",{"widget-board":{"configurable-props":"ویژگی های قابل تنظیم",configure:"پیکر بندی ابزارک"}})}return e=p([t.NgModule({imports:[a.CommonModule,i.AXSearchBoxModule,i.AXLoadingModule,s.RouterModule,i.AXProppertyEditorModule,i.AXPageModule,i.AXToolbarModule,n.AXTranslatorModule,i.AXLabelModule,i.AXTextAreaModule,i.AXFieldsetModule,i.AXTextBoxModule,i.AXFormGroupModule,i.AXTabStripModule,i.AXCheckBoxModule,i.AXMenuModule,n.AXTranslatorModule,i.AXValidationModule,s.RouterModule.forChild([{component:_,path:"ax/editors/widget-size"}])],exports:[A,i.AXProppertyEditorModule],declarations:[A,x,w,b],entryComponents:[w,b],providers:[]}),g("design:paramtypes",[])],e)}(),z=function(){function e(){}return e=p([t.NgModule({declarations:[_],imports:[a.CommonModule,d.FormsModule,i.AXNumberBoxModule],exports:[_],entryComponents:[_],providers:[]})],e)}();e.AXWidgetBoardComponent=A,e.AXWidgetBoardModule=C,e.AXWidgetComponent=y,e.AXWidgetHostComponent=x,e.AXWidgetSizePropertyEditorComponent=_,e.AXWidgetSizePropertyEditorModule=z,e.ɵ0=v,e.ɵa=w,e.ɵb=b,Object.defineProperty(e,"__esModule",{value:!0})}));
16
16
  //# sourceMappingURL=acorex-layout.umd.min.js.map