ngx-golden-layout
Advanced tools
Comparing version 0.0.33 to 0.0.34
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("rxjs"),require("golden-layout"),require("rxjs/operators"),require("@angular/common")):"function"==typeof define&&define.amd?define("ngx-golden-layout",["exports","@angular/core","rxjs","golden-layout","rxjs/operators","@angular/common"],e):e((t=t||self)["ngx-golden-layout"]={},t.ng.core,t.rxjs,t.GoldenLayout,t.rxjs.operators,t.ng.common)}(this,function(t,e,n,o,i,r){"use strict";var a=function(){return(a=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function s(t){var e="function"==typeof Symbol&&t[Symbol.iterator],n=0;return e?e.call(t):{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}}}function l(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,i,r=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(o=r.next()).done;)a.push(o.value)}catch(s){i={error:s}}finally{try{o&&!o.done&&(n=r["return"])&&n.call(r)}finally{if(i)throw i.error}}return a}function c(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(l(arguments[e]));return t}var u=new e.InjectionToken("ComponentTypes"),d=new e.InjectionToken("Dependencies"),p=function(){return function(){var t=this;this.promise=new Promise(function(e,n){t.resolve=e,t.reject=n})}}();function f(){if(console.log("MultiWindowInit"),!window.opener&&!window.__services&&!window.__serviceConstructors&&(window.__services=new window.Map,window.__serviceConstructors=new window.Map,window.require)){var t=window.open.bind(window);window.open=function(e,n,o,i){var r=t(e,n,o,i);return r.require=window.require,r}}}function h(t){return f(),function(e){var n=e,o=window.opener||window,i=o===window;if(i){if(o.__serviceConstructors.has(t))throw new Error("MultiWindowService(): uniqueName "+t+" already taken.");o.__serviceConstructors.set(t,n)}var r=function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];if(!o.__services.has(t)){var r=o.__serviceConstructors.get(t)||n;o.__services.set(t,new(r.bind.apply(r,c([void 0],e))))}return o.__services.get(t)};try{if(i){var a=Reflect.getMetadata("design:paramtypes",n);Reflect.metadata("design:paramtypes",a)(r)}}catch(s){}return r}}var m=function(){function t(){this.loadedURLs=new Map,this.loads=new n.Subject,this.unloads=new n.Subject}return t.prototype.loadRequests$=function(){return this.loads},t.prototype.unloadRequests$=function(){return this.unloads},t.prototype.allPlugins=function(){return c(this.loadedURLs.entries()).map(function(t){return{id:t[0],url:t[1]}})},t.prototype.requestLoad=function(t,e){var n=this.loadedURLs.get(t);if(n){if(n!==e)throw new Error("Plugin "+t+" is already loaded with another URL")}else this.loadedURLs.set(t,e),this.loads.next({id:t,url:e})},t.prototype.requestUnload=function(t){if(!this.loadedURLs.get(t))throw new Error("Plugin "+t+" is not loaded");this.loadedURLs["delete"](t),this.unloads.next(t)},t.decorators=[{type:e.Injectable}],t=function(t,e,n,o){var i,r=arguments.length,a=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,o);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(r<3?i(a):r>3?i(e,n,a):i(e,n))||a);return r>3&&a&&Object.defineProperty(e,n,a),a}([h("_gl__PluginURLProvider")],t)}(),g=function(){function t(t,e,o){var i=this;void 0===t&&(t=[]),this.urlProvider=e,this.injector=o,this.availableDependencies=new Map,this.loadedPlugins=new Map,this.pluginLoaded$=new n.Subject,this.pluginUnloaded$=new n.Subject,console.log("Creating PluginRegistry, got",t.length,"additional dependency modules"),t.forEach(function(t){return i.availableDependencies.set(t.name,t.loader)}),this.patchWindow(),this.urlProvider.loadRequests$().subscribe(function(t){return i.load(t)}),this.urlProvider.allPlugins().forEach(function(t){return i.load(t)})}return t.prototype.startLoadPlugin=function(t,e){this.urlProvider.requestLoad(t,e)},t.prototype.startUnloadPlugin=function(t){this.urlProvider.requestUnload(t)},t.prototype.waitForPlugin=function(t){var e=this.loadedPlugins.get(t);if(e)return e.module.promise;var n={id:t,module:new p,url:null,script:null,moduleRef:null};return this.loadedPlugins.set(t,n),n.module.promise},t.prototype.patchWindow=function(){var t=this;window.define=function(n,o,i){var r=t.loadedPlugins.get(n);if(r){var a=(o=o.slice(1)).map(function(e){var o=t.availableDependencies.get(e);return o?Promise.resolve(o)["catch"](function(t){return console.warn("Plugin",n,"dependency",e,"but load failed",t),undefined}):(console.warn("Plugin",n,"requested unknown dependency",e),Promise.resolve(undefined))});Promise.all(a).then(function(o){var a={};i.apply(void 0,c([a],o)),console.log("Plugin",n,"loaded.");var s=a.MODULE;if(!s)return Promise.reject("No MODULE export found");var l=new e.ɵNgModuleFactory(s);r.moduleRef=l.create(t.injector),r.module.resolve(a),t.pluginLoaded$.next({id:r.id,module:r.moduleRef})})["catch"](function(t){console.warn("Failed to load plugin",n,"error",t),r.module.reject(t)})}else console.warn("Unknown plugin called define():",n)},window.define.amd=!0,console.log("Window AMD shim established.")},t.prototype.load=function(t){var e=t.id,n=t.url,o=this.loadedPlugins.get(e);if(o&&o.url){if(o.url!==n)throw new Error("Plugin is already loaded with another URL")}else{o||(o={id:e,module:new p,url:null,moduleRef:null,script:null}),o.url=n,this.loadedPlugins.set(e,o);var i=document.createElement("script");i.onerror=function(t){return o.module.reject(t)},i.type="text/javascript",i.src=n,o.script=i,document.body.appendChild(i)}},t.prototype.unload=function(t){},t.decorators=[{type:e.Injectable}],t.ctorParameters=function(){return[{type:Array,decorators:[{type:e.Inject,args:[d]},{type:e.Optional}]},{type:m},{type:e.Injector}]},t}(),y=new e.InjectionToken("GoldenLayoutContainer"),v=new e.InjectionToken("GoldenLayoutComponentState"),w=new e.InjectionToken("GoldenLayoutEventHub"),C=new e.InjectionToken("GoldenLayoutComponentHost");function _(t){return"object"==typeof t&&"function"==typeof t.glOnResize}function I(t){return"object"==typeof t&&"function"==typeof t.glOnShow}function b(t){return"object"==typeof t&&"function"==typeof t.glOnHide}function L(t){return"object"==typeof t&&"function"==typeof t.glOnTab}var x=function(){function t(t,e,n){this.host=t,this.container=e,this.state=n,this.destroyed=!1,this.initialized=!1,this.originalComponent=this.host.getGoldenLayoutInstance()._getAllComponents()[this.state.originalId]}return Object.defineProperty(t.prototype,"headerComponent",{get:function(){return this.originalComponent&&this.originalComponent.instance?this.originalComponent.instance.then(function(t){return t.instance.headerComponent}):undefined},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"additionalTokens",{get:function(){return this.originalComponent&&this.originalComponent.instance?this.originalComponent.instance.then(function(t){return t.instance.additionalTokens}):undefined},enumerable:!0,configurable:!0}),t.prototype.ngOnInit=function(){var t=this;this.originalComponent.instance.then(function(e){t.destroyed||t.initialized||(t.redock(e,t.container.getElement()),t.initialized=!0)})},t.prototype.ngOnDestroy=function(){var t=this;this.originalComponent.instance.then(function(e){t.initialized&&!t.destroyed&&(t.redock(e,t.originalComponent.container.getElement()),t.destroyed=!0)})},t.prototype.redock=function(t,e){var n=$(t.location.nativeElement);n.remove(),e.append(n),_(t.instance)&&t.instance.glOnResize()},t.prototype.glOnHide=function(){this.originalComponent.instance.then(function(t){b(t.instance)&&t.instance.glOnHide()})},t.prototype.glOnShow=function(){this.originalComponent.instance.then(function(t){I(t.instance)&&t.instance.glOnShow()})},t.prototype.glOnResize=function(){this.originalComponent.instance.then(function(t){_(t.instance)&&t.instance.glOnResize()})},t.prototype.glOnTab=function(t){var e=this;this.originalComponent.instance.then(function(t){L(t.instance)&&t.instance.glOnTab(e.originalComponent.tab)})},t.decorators=[{type:e.Component,args:[{selector:"gl-wrapper",encapsulation:e.ViewEncapsulation.None,template:'<div class="wrapper"></div>'}]}],t.ctorParameters=function(){return[{type:undefined,decorators:[{type:e.Inject,args:[C]}]},{type:undefined,decorators:[{type:e.Inject,args:[y]}]},{type:undefined,decorators:[{type:e.Inject,args:[v]}]}]},t}(),S=function(){function t(t,e){var n=this;this.pluginRegistry=e,this.components=new Map,this.awaitedComponents=new Map,(t||[]).forEach(function(t){return n.registerComponent(t)}),this.registerComponent({name:"gl-wrapper",type:x}),this.pluginRegistry.pluginLoaded$.subscribe(function(t){var e=t.id,o=t.module.injector.get(u,[]);console.log("Plugin",e,"wants to register",o.length,"components"),o.forEach(function(t){return n.registerComponent(a({},t,{plugin:e}))})})}return t.prototype.registeredComponents=function(){return c(this.components.entries()).map(function(t){return{name:t[0],type:t[1]}})},t.prototype.componentMap=function(){return this.components},t.prototype.registerComponent=function(t){var e=this.components.get(t.name);if(e&&e!==t.type)throw new Error("Failed to register component, "+t.name+" is already taken by another component: "+e);this.components.set(t.name,t.type);var n=this.awaitedComponents.get(t.name);n&&(this.awaitedComponents["delete"](t.name),n.resolve(t.type))},t.prototype.waitForComponent=function(t){var e=this.components.get(t);if(e)return Promise.resolve(e);var n=this.awaitedComponents.get(t);return n||(n=new p,this.awaitedComponents.set(t,n)),n.promise},t.decorators=[{type:e.Injectable}],t.ctorParameters=function(){return[{type:Array,decorators:[{type:e.Inject,args:[u]},{type:e.Optional}]},{type:g}]},t}(),j=new e.InjectionToken("fallback component"),E=new e.InjectionToken("failed component"),P=function(){function t(){}return t.prototype.isChildWindow=function(){try{return!!window.opener&&!!window.opener.location.href}catch(t){return!1}},t.prototype.getRootWindow=function(){return this.isChildWindow()?window.opener:window},t.decorators=[{type:e.Injectable}],t.ctorParameters=function(){return[]},t}(),k=function(){function t(t,e,n){var o=this;this.appref=t,this.rootService=e,this.injector=n,this.unloaded=!1,this.topWindow=this.rootService.getRootWindow(),this.isChildWindow=this.rootService.isChildWindow(),this.isChildWindow&&(window.document.title=window.document.URL,console.__log=console.log,console.log=function(){for(var t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return(t=o.topWindow.console).log.apply(t,c(["[CHILD] =>"],e))});var i=this.topWindow;this.isChildWindow||(i.__apprefs=[],i.__injector=this.injector),i.__apprefs.push(this.appref),this.appref.__tick=this.appref.tick,this.appref.tick=function(){var t,e,n=function(t){t._zone.run(function(){return t.__tick()})};try{for(var i=s(o.topWindow.__apprefs),r=i.next();!r.done;r=i.next()){n(r.value)}}catch(a){t={error:a}}finally{try{r&&!r.done&&(e=i["return"])&&e.call(i)}finally{if(t)throw t.error}}}}return t.prototype.onUnload=function(){if(!this.unloaded&&(this.unloaded=!0,this.isChildWindow)){var t=this.topWindow.__apprefs.indexOf(this.appref);t>=0&&this.topWindow.__apprefs.splice(t,1)}},t.decorators=[{type:e.Injectable}],t.ctorParameters=function(){return[{type:e.ApplicationRef},{type:P},{type:e.Injector}]},t}(),O=o,R=function(t){return t.isComponent&&t.config&&t.config.componentState&&t.config.componentState.originalId},M=function(t,e){var n=t.root.getItemsById(e);return 1!==n.length?(console.warn("non unique ID found: "+e),undefined):n[0]},A=function(t){var e=M(t.layoutManager,t.config.componentState.originalId);if(!e.isComponent)throw new Error("Expected component");return e},D=O.__lm.controls.Tab,U=function(t,e){var n=new D(t,e);return n.closeElement.off("click touchstart"),n.closeElement.on("click touchstart",function(t){if(t.stopPropagation(),R(n.contentItem)){var e=A(n.contentItem);e&&e.isComponent&&e.container.close()}else n.contentItem.container.close()}),n.element.on("mousedown touchstart",function(t){var e=n.contentItem;R(e)&&(e=A(n.contentItem)),e.layoutManager.emit("tabActivated",e)}),R(n.contentItem)&&!0===n._layoutManager.config.settings.reorderEnabled&&n.element.on("mousedown touchstart",function(e){var o,i,r=(o=n.contentItem,(i=A(o))?i.tab:undefined);if(r&&r._dragListener){var a=r._dragListener,s=function(){a.off("dragStart",s,a),t.layoutManager._maximisedItem===n.contentItem.parent&&n.contentItem.parent.toggleMaximise()};a.off("dragStart",r._onDragStart,r),a.on("dragStart",s,a),a.on("dragStart",r._onDragStart,r),a._fDown(e)}}),n};U._template='<li class="lm_tab"><i class="lm_left"></i><span class="lm_title"></span><div class="lm_close_tab"></div><i class="lm_right"></i></li>',O.__lm.controls.Tab=U;var T=O.__lm.controls.Header,W=function(t,e){var n=e._header.maximise,o=e._header.popout;n&&!0===t.config.settings.maximiseAllItems&&delete e._header.maximise,o&&!0===t.config.settings.maximiseAllItems&&delete e._header.popout;var i=new T(t,e);if(o&&!0===t.config.settings.maximiseAllItems&&(i.popoutButton=new O.__lm.controls.HeaderButton(i,o,"lm_popout",function(){var e=i.activeContentItem;R(e)?(e=A(e)).popout():!0===t.config.settings.popoutWholeStack?i.parent.popout():e.popout()})),n&&!0===t.config.settings.maximiseAllItems&&(i.maximiseButton=new O.__lm.controls.HeaderButton(i,n,"lm_maximise",function(){console.log("I should maximise all items."),t._maximisedItem===e?e.toggleMaximise():t.generateAndMaximiseDummyStack(e)})),i.closeButton){i.closeButton._$destroy();var r=i._getHeaderSetting("close");i.closeButton=new O.__lm.controls.HeaderButton(i,r,"lm_close",function(){i.parent.contentItems.forEach(function(t){t.container.close()})})}return i};W._template=['<div class="lm_header">','<ul class="lm_tabs"></ul>','<ul class="lm_controls"></ul>','<ul class="lm_tabdropdown_list"></ul>',"</div>"].join(""),O.__lm.controls.Header=W;var z=O.__lm.controls.DragProxy,H=function(t,e,n,o,i,r){return o.emit("itemDragged",i),console.log("new dragProxy",i),new z(t,e,n,o,i,r)};H._template=z._template,O.__lm.controls.DragProxy=H;var N=O.__lm.items.Stack;function G(t,e,o){var i=this;console.log(t,e,o,this),N.call(this,t,e,o),this.activeContentItem$=new n.BehaviorSubject(null);var r=function(t){i.activeContentItem$&&i.activeContentItem$.next(t)};this.on("activeContentItemChanged",r);var a=this._$destroy;return this.___destroyed=!1,this._$destroy=function(){i.___destroyed||(i.___destroyed=!0,i.off("activeContentItemChanged",r),i.activeContentItem$.complete(),i.activeContentItem$=null,a.call(i))},this}G.prototype=Object.create(N.prototype),G.prototype.addChild=function(t,e){var n=this;"stack"===t.type?((t.content||[]).forEach(function(t,o){return N.prototype.addChild.call(n,t,e+o)}),t.content.length&&this.setActiveContentItem(this.contentItems[e+t.activeItemIndex])):N.prototype.addChild.call(this,t,e)},G.prototype.setSize=function(){this.layoutManager._maximisedItem===this&&!0===this.layoutManager.config.settings.maximiseAllItems&&(this.element.width(this.layoutManager.container.width()),this.element.height(this.layoutManager.container.height())),N.prototype.setSize.call(this)},O.__lm.items.Stack=G;var q=O.__lm.controls.BrowserPopout;O.__lm.controls.BrowserPopout=function(t,e,n,o,i){return 1!==t.length?console.warn("This should not happen, permitting",t):"component"===t[0].type&&(t=[{type:"stack",title:t[0].title,content:[t[0]]}]),new q(t,e,n,o,i)};var F=function(){function t(t,o,i,r,a,s,l,c,u){var d=this;this.rootService=t,this.componentRegistry=o,this.viewContainer=i,this.appref=r,this.componentFactoryResolver=a,this.ngZone=s,this.injector=l,this.windowSync=c,this.fallbackComponent=u,this.stateChanged=new e.EventEmitter,this.tabActivated=new e.EventEmitter,this.goldenLayout=null,this.onUnloaded=new p,this.stateChangePaused=!1,this.stateChangeScheduled=!1,this.tabsList=new n.BehaviorSubject({}),this.pushStateChange=function(){d.tabsList.next(d.goldenLayout._getAllComponents()),d.stateChangePaused||d.stateChangeScheduled||(d.stateChangeScheduled=!0,window.requestAnimationFrame(function(){d.stateChangeScheduled=!1,d.stateChanged.emit()}))},this.resumeStateChange=function(){return d.stateChangePaused=!1},this.pauseStateChange=function(){return d.stateChangePaused=!0},this.pushTabActivated=function(t){d.tabActivated.emit(t)},this.fallbackType=null,this.openedComponents=[],this.poppedIn=!1,this._eventEmitter=new O.__lm.utils.EventEmitter,this.isChildWindow=this.rootService.isChildWindow(),this.fallbackComponent&&(this.fallbackType=this.buildConstructor(this.fallbackComponent)),e.isDevMode()&&console.log("Create@"+(this.isChildWindow?"child":"root")+"!")}return t.prototype.onResize=function(){this.goldenLayout&&this.goldenLayout.updateSize()},t.prototype.ngOnInit=function(){var t=this;e.isDevMode()&&console.log("Init@"+(this.isChildWindow?"child":"root")+"!"),this.layoutSubscription=this.layout.subscribe(function(e){t.destroyGoldenLayout(),t.initializeGoldenLayout(e)})},t.prototype.beforeUnload=function(){var t=this;this.poppedIn&&(this.onUnloaded.promise.then(function(){return t.ngOnDestroy()}),this.onUnloaded.resolve(),this.windowSync.onUnload())},t.prototype.pageHide=function(){var t=this;this.poppedIn||this.openedComponents.forEach(function(t){var e;"object"==typeof(e=t)&&"function"==typeof e.glOnUnload&&t.glOnUnload()}),this.onUnloaded.promise.then(function(){return t.ngOnDestroy()}),this.onUnloaded.resolve(),this.windowSync.onUnload()},t.prototype.ngOnDestroy=function(){var t;e.isDevMode()&&console.log("Destroy@"+(this.isChildWindow?"child":"root")+"!"),this.layoutSubscription.unsubscribe(),this.appref.tick=this.appref.__tick,this.destroyGoldenLayout(),this._eventEmitter._mSubscriptions=((t={})[O.__lm.utils.EventEmitter.ALL_EVENT]=[],t),this.isChildWindow&&(console.log=console.__log)},t.prototype.getGoldenLayoutInstance=function(){if(!this.goldenLayout)throw new Error("Component is not initialized yet");return this.goldenLayout},t.prototype.addEvent=function(t,e,n){this._eventEmitter.on(t,e,n)},t.prototype.getSerializableState=function(){if(this.goldenLayout){var t=this.goldenLayout.toConfig(),e=this.goldenLayout.__wrapperMaximisedItemId;if(e){t.maximisedItemId=e;var n=function(t){return("stack"!==t.type||!t.isDummy)&&("component"!==t.type&&(t.content=t.content.filter(n)),!0)};t.content=t.content.filter(n)}return t}return null},t.prototype.getComponents=function(){return this.goldenLayout._getAllComponents()},t.prototype.closeComponent=function(t){var e=M(this.goldenLayout,t);e&&e.remove()},t.prototype.focusComponent=function(t){var e=M(this.goldenLayout,t);e&&e.parent.setActiveContentItem(e)},t.prototype.createNewComponent=function(t,e){if(!this.goldenLayout)throw new Error("golden layout is not initialized");var n=t,o=this.goldenLayout.root,i=null;if(e){var r=M(this.goldenLayout,e);if(r.parent.isStack)i=r.parent;else{var s=this.goldenLayout.createContentItem({type:"stack",width:r.parent.config.width,height:r.parent.config.height,content:[]});r.parent.replaceChild(r,s,!1),s.addChild(r),i=s}}else o.contentItems&&0!==o.contentItems.length?i=this.findStack(o.contentItems):(i=o,n={type:"stack",content:[a({},n,{type:"component"})]});if(null===i)throw new Error("this should never happen!");var l=this.goldenLayout.createContentItem(n);return i.addChild(l),l.isComponent?l.instance:l.isStack&&1===l.contentItems.length?l[0].instance:l},t.prototype.findStack=function(t){var e,n;if(!t)return null;try{for(var o=s(t),i=o.next();!i.done;i=o.next()){var r=i.value;if(r.isStack){if(r.config.isDummy)continue;return r}var a=this.findStack(r.contentItems);if(null!==a)return a}}catch(l){e={error:l}}finally{try{i&&!i.done&&(n=o["return"])&&n.call(o)}finally{if(e)throw e.error}}},t.prototype.destroyGoldenLayout=function(){this.goldenLayout&&(this.goldenLayout.off("stateChanged",this.pushStateChange),this.goldenLayout.off("itemDropped",this.resumeStateChange),this.goldenLayout.off("itemDragged",this.pauseStateChange),this.goldenLayout.off("tabActivated",this.pushTabActivated),this.goldenLayout.off("initialised"),this.goldenLayout.off(O.__lm.utils.EventEmitter.ALL_EVENT,this._eventEmitter.emit,this._eventEmitter),this.goldenLayout.destroy(),this.goldenLayout=null)},t.prototype.initializeGoldenLayout=function(t){var r=this;this.goldenLayout=new o(t,$(this.el.nativeElement));var u=this.goldenLayout.createPopout.bind(this.goldenLayout);this.goldenLayout.createPopout=function(t,e,n,o){for(var i,r=[t];r.length;){var a=r.shift();if(a.contentItems&&a.contentItems.length>0&&r.push.apply(r,c(a.contentItems)),a.isComponent){var s=a.container.__ngComponent;s&&("object"==typeof(i=s)&&"function"==typeof i.glOnPopout)&&s.glOnPopout()}}return u(t,e,n,o)};var d=function(t){var e,n,o={};try{for(var i=s(t.contentItems),r=i.next();!r.done;r=i.next()){var l=r.value;if(l.isComponent){if(l.config&&l.config.componentState&&l.config.componentState.originalId)continue;o[l.id]=l}else o=a({},o,d(l))}}catch(c){e={error:c}}finally{try{r&&!r.done&&(n=i["return"])&&n.call(i)}finally{if(e)throw e.error}}return o};this.goldenLayout._getAllComponents=function(){return d(r.goldenLayout.root)},this.goldenLayout.generateAndMaximiseDummyStack=function(t,e){var o=d(r.goldenLayout.root),l=Object.keys(o);if(0!==l.length){var c=r.goldenLayout.root.contentItems[0];if(c.isStack)c.toggleMaximise();else{var u={type:"stack",content:l.map(function(t){return{type:"component",componentName:"gl-wrapper",title:o[t].config.title,reorderEnabled:!1,componentState:{originalId:t}}}),isClosable:!1,isDummy:!0,state:"dummy",activeItemIndex:l.findIndex(function(n){return n===(e||t._activeContentItem.id)})};c.addChild(u,0);var p=c.contentItems[0];r.goldenLayout.__wrapperMaximisedItemId=t._activeContentItem.id,p.activeContentItem$.subscribe(function(t){r.goldenLayout.__wrapperMaximisedItemId=t.config.componentState.originalId});var f=new n.Subject;p.on("minimised",function(){console.log("minimised",p),r.goldenLayout.__wrapperMaximisedItemId=null,f.next(),f.complete(),p.remove()}),p.toggleMaximise(),r.tabsList.pipe(i.takeUntil(f),i.distinctUntilChanged(function(t,e){var n=Object.keys(t),o=new Set(Object.keys(e));return n.length===o.size&&n.every(function(t){return o.has(t)})})).subscribe(function(t){var e,n,o,i,r=a({},t),l=new Set(Object.keys(r)),c=new Set(p.contentItems.map(function(t){return t.config.componentState.originalId}));try{for(var u=s(l),d=u.next();!d.done;d=u.next()){var f=d.value;c.has(f)?c["delete"](f):p.addChild({type:"component",componentName:"gl-wrapper",title:t[f].config.title,reorderEnabled:!1,componentState:{originalId:f}})}}catch(y){e={error:y}}finally{try{d&&!d.done&&(n=u["return"])&&n.call(u)}finally{if(e)throw e.error}}var h=function(t){p.contentItems.find(function(e){return e.config.componentState.originalId===t}).remove()};try{for(var m=s(c),g=m.next();!g.done;g=m.next()){h(g.value)}}catch(v){o={error:v}}finally{try{g&&!g.done&&(i=m["return"])&&i.call(m)}finally{if(o)throw o.error}}})}}},this.goldenLayout.on("popIn",function(){console.log("popIn"),r.poppedIn=!0,r.openedComponents.forEach(function(t){var e;"object"==typeof(e=t)&&"function"==typeof e.glOnPopin&&t.glOnPopin()})}),this.goldenLayout.getComponent=function(t){return e.isDevMode()&&console.log("Resolving component "+t),r.buildConstructor(t)},this.goldenLayout.on("stackCreated",function(t){var o=document.createElement("li");o.classList.add("custom-header"),o.style.display="none";var a=t.header.controlsContainer[0],s=null;a.prepend(o);var c=function(){o.style.display="none",s&&(o.childNodes.forEach(function(t){return o.removeChild(t)}),s.destroy(),s=null)};t.activeContentItem$.pipe(i.switchMap(function(t){return t&&t.isComponent&&t.instance||n.of(null)}),i.switchMap(function(t){if(!t)return Promise.all([null,null,null]);var e=t.instance.headerComponent,n=t.instance.additionalTokens;return Promise.all([Promise.resolve(e),Promise.resolve(n),Promise.resolve(t)])})).subscribe(function(t){var n=l(t,3),i=n[0],a=n[1],u=n[2];i&&u?function(t,n,i){s&&c(),o.style.display="";var a=r.componentFactoryResolver.resolveComponentFactory(t),l=e.Injector.create(n,i);s=r.viewContainer.createComponent(a,undefined,l),o.prepend(s.location.nativeElement)}(i,a||[],u.injector):c()},c,c)}),this.goldenLayout.on("initialised",function(){window.requestAnimationFrame(function(){if(t.maximisedItemId){var e=M(r.goldenLayout,t.maximisedItemId);e&&r.goldenLayout.generateAndMaximiseDummyStack(e.parent,t.maximisedItemId)}})}),this.goldenLayout.init(),this.goldenLayout.on("stateChanged",this.pushStateChange),this.goldenLayout.on("itemDragged",this.pauseStateChange),this.goldenLayout.on("itemDropped",this.resumeStateChange),this.goldenLayout.on("tabActivated",this.pushTabActivated),this.goldenLayout.on(O.__lm.utils.EventEmitter.ALL_EVENT,this._eventEmitter.emit,this._eventEmitter)},t.prototype.buildConstructor=function(t){var e=this;return function(n,o){var i=n.parent;i.config.id?i.id=i.config.id:(i.id="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)}),i.config.id=i.id);var r=new p;return e.ngZone.run(function(){e.componentRegistry.waitForComponent(t).then(function(i){console.log("Component "+t+" returned from componentRegistry");var a=e.componentFactoryResolver.resolveComponentFactory(i),s=null;i===e.fallbackComponent&&(s=n._config.componentName);var l=e._createComponentInjector(n,o,s),c=e.viewContainer.createComponent(a,undefined,l);n.getElement().append($(c.location.nativeElement)),e._bindEventHooks(n,c.instance),n.__ngComponent=c.instance,e.openedComponents.push(c.instance);var u=!1,d=function(){u||(u=!0,e.openedComponents=e.openedComponents.filter(function(t){return t!==c.instance}),$(c.location.nativeElement).remove(),c.destroy())};n.on("destroy",d),e.onUnloaded.promise.then(d),r.resolve(c)})}),r.promise}},t.prototype._createComponentInjector=function(t,n,o){var i=[{provide:y,useValue:t},{provide:v,useValue:n},{provide:w,useValue:this.goldenLayout.eventHub},{provide:C,useValue:this}];return o&&i.push({provide:E,useValue:o}),e.Injector.create(i,this.injector)},t.prototype._bindEventHooks=function(t,e){if(_(e)&&t.on("resize",function(){e.glOnResize()}),I(e)&&t.on("show",function(){e.glOnShow()}),b(e)&&t.on("hide",function(){e.glOnHide()}),L(e)&&t.on("tab",function(t){e.glOnTab(t)}),"object"==typeof(o=e)&&"function"==typeof o.glOnClose){var n=t.close.bind(t);t.close=function(){if(!t._config.isClosable)return!1;e.glOnClose().then(function(){n()},function(){})}}var o},t.decorators=[{type:e.Component,args:[{selector:"golden-layout-root",template:'<div class="ng-golden-layout-root" #glroot></div>',styles:["\n .ng-golden-layout-root {\n width:100%;\n height:100%;\n }"]}]}],t.ctorParameters=function(){return[{type:P},{type:S},{type:e.ViewContainerRef},{type:e.ApplicationRef},{type:e.ComponentFactoryResolver},{type:e.NgZone},{type:e.Injector},{type:k},{type:undefined,decorators:[{type:e.Optional},{type:e.Inject,args:[j]}]}]},t.propDecorators={layout:[{type:e.Input}],stateChanged:[{type:e.Output}],tabActivated:[{type:e.Output}],el:[{type:e.ViewChild,args:["glroot",{"static":!0}]}],onResize:[{type:e.HostListener,args:["window:resize"]}],beforeUnload:[{type:e.HostListener,args:["window:beforeunload"]}],pageHide:[{type:e.HostListener,args:["window:pagehide"]}]},t}(),V=function(){function t(){}return t.forRoot=function(n,o,i){return{ngModule:t,providers:[S,P,g,m,k,{provide:e.APP_INITIALIZER,useValue:f,multi:!0},{provide:u,useValue:n},{provide:e.ANALYZE_FOR_ENTRY_COMPONENTS,useValue:[n,o,x],multi:!0},{provide:d,useValue:i},{provide:j,useValue:o}]}},t.decorators=[{type:e.NgModule,args:[{declarations:[F,x],exports:[F],imports:[r.CommonModule]}]}],t}();t.ComponentRegistryService=S,t.FailedComponent=E,t.FallbackComponent=j,t.GetComponentFromLayoutManager=M,t.GoldenLayoutComponent=F,t.GoldenLayoutComponentHost=C,t.GoldenLayoutComponentState=v,t.GoldenLayoutComponents=u,t.GoldenLayoutContainer=y,t.GoldenLayoutEventHub=w,t.GoldenLayoutModule=V,t.GoldenLayoutPluginDependency=d,t.MultiWindowInit=f,t.MultiWindowService=h,t.PluginRegistryService=g,t.PluginURLProvider=m,t.RootWindowService=P,t.forChild=function(t){return[{provide:u,useValue:t},{provide:e.ANALYZE_FOR_ENTRY_COMPONENTS,useValue:t,multi:!0}]},t.ɵa=k,t.ɵb=x,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("rxjs"),require("golden-layout"),require("rxjs/operators"),require("@angular/common")):"function"==typeof define&&define.amd?define("ngx-golden-layout",["exports","@angular/core","rxjs","golden-layout","rxjs/operators","@angular/common"],e):e((t=t||self)["ngx-golden-layout"]={},t.ng.core,t.rxjs,t.GoldenLayout,t.rxjs.operators,t.ng.common)}(this,function(t,e,n,o,i,r){"use strict";var a=function(){return(a=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function s(t){var e="function"==typeof Symbol&&t[Symbol.iterator],n=0;return e?e.call(t):{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}}}function l(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,i,r=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(o=r.next()).done;)a.push(o.value)}catch(s){i={error:s}}finally{try{o&&!o.done&&(n=r["return"])&&n.call(r)}finally{if(i)throw i.error}}return a}function c(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(l(arguments[e]));return t}var u=new e.InjectionToken("ComponentTypes"),d=new e.InjectionToken("Dependencies"),p=function(){return function(){var t=this;this.promise=new Promise(function(e,n){t.resolve=e,t.reject=n})}}();function h(){if(console.log("MultiWindowInit"),!window.opener&&!window.__services&&!window.__serviceConstructors&&(window.__services=new window.Map,window.__serviceConstructors=new window.Map,window.require)){var t=window.open.bind(window);window.open=function(e,n,o,i){var r=t(e,n,o,i);return r.require=window.require,r}}}function f(t){return h(),function(e){var n=e,o=window.opener||window,i=o===window;if(i){if(o.__serviceConstructors.has(t))throw new Error("MultiWindowService(): uniqueName "+t+" already taken.");o.__serviceConstructors.set(t,n)}var r=function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];if(!o.__services.has(t)){var r=o.__serviceConstructors.get(t)||n;o.__services.set(t,new(r.bind.apply(r,c([void 0],e))))}return o.__services.get(t)};try{if(i){var a=Reflect.getMetadata("design:paramtypes",n);Reflect.metadata("design:paramtypes",a)(r)}}catch(s){}return r}}var m=function(){function t(){this.loadedURLs=new Map,this.loads=new n.Subject,this.unloads=new n.Subject}return t.prototype.loadRequests$=function(){return this.loads},t.prototype.unloadRequests$=function(){return this.unloads},t.prototype.allPlugins=function(){return c(this.loadedURLs.entries()).map(function(t){return{id:t[0],url:t[1]}})},t.prototype.requestLoad=function(t,e){var n=this.loadedURLs.get(t);if(n){if(n!==e)throw new Error("Plugin "+t+" is already loaded with another URL")}else this.loadedURLs.set(t,e),this.loads.next({id:t,url:e})},t.prototype.requestUnload=function(t){if(!this.loadedURLs.get(t))throw new Error("Plugin "+t+" is not loaded");this.loadedURLs["delete"](t),this.unloads.next(t)},t.decorators=[{type:e.Injectable}],t=function(t,e,n,o){var i,r=arguments.length,a=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,o);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(r<3?i(a):r>3?i(e,n,a):i(e,n))||a);return r>3&&a&&Object.defineProperty(e,n,a),a}([f("_gl__PluginURLProvider")],t)}(),g=function(){function t(t,e,o){var i=this;void 0===t&&(t=[]),this.urlProvider=e,this.injector=o,this.availableDependencies=new Map,this.loadedPlugins=new Map,this.pluginLoaded$=new n.Subject,this.pluginUnloaded$=new n.Subject,console.log("Creating PluginRegistry, got",t.length,"additional dependency modules"),t.forEach(function(t){return i.availableDependencies.set(t.name,t.loader)}),this.patchWindow(),this.urlProvider.loadRequests$().subscribe(function(t){return i.load(t)}),this.urlProvider.allPlugins().forEach(function(t){return i.load(t)})}return t.prototype.startLoadPlugin=function(t,e){this.urlProvider.requestLoad(t,e)},t.prototype.startUnloadPlugin=function(t){this.urlProvider.requestUnload(t)},t.prototype.waitForPlugin=function(t){var e=this.loadedPlugins.get(t);if(e)return e.module.promise;var n={id:t,module:new p,url:null,script:null,moduleRef:null};return this.loadedPlugins.set(t,n),n.module.promise},t.prototype.patchWindow=function(){var t=this;window.define=function(n,o,i){var r=t.loadedPlugins.get(n);if(r){var a=(o=o.slice(1)).map(function(e){var o=t.availableDependencies.get(e);return o?Promise.resolve(o)["catch"](function(t){return console.warn("Plugin",n,"dependency",e,"but load failed",t),undefined}):(console.warn("Plugin",n,"requested unknown dependency",e),Promise.resolve(undefined))});Promise.all(a).then(function(o){var a={};i.apply(void 0,c([a],o)),console.log("Plugin",n,"loaded.");var s=a.MODULE;if(!s)return Promise.reject("No MODULE export found");var l=new e.ɵNgModuleFactory(s);r.moduleRef=l.create(t.injector),r.module.resolve(a),t.pluginLoaded$.next({id:r.id,module:r.moduleRef})})["catch"](function(t){console.warn("Failed to load plugin",n,"error",t),r.module.reject(t)})}else console.warn("Unknown plugin called define():",n)},window.define.amd=!0,console.log("Window AMD shim established.")},t.prototype.load=function(t){var e=t.id,n=t.url,o=this.loadedPlugins.get(e);if(o&&o.url){if(o.url!==n)throw new Error("Plugin is already loaded with another URL")}else{o||(o={id:e,module:new p,url:null,moduleRef:null,script:null}),o.url=n,this.loadedPlugins.set(e,o);var i=document.createElement("script");i.onerror=function(t){return o.module.reject(t)},i.type="text/javascript",i.src=n,o.script=i,document.body.appendChild(i)}},t.prototype.unload=function(t){},t.decorators=[{type:e.Injectable}],t.ctorParameters=function(){return[{type:Array,decorators:[{type:e.Inject,args:[d]},{type:e.Optional}]},{type:m},{type:e.Injector}]},t}(),y=new e.InjectionToken("GoldenLayoutContainer"),v=new e.InjectionToken("GoldenLayoutComponentState"),w=new e.InjectionToken("GoldenLayoutEventHub"),C=new e.InjectionToken("GoldenLayoutComponentHost");function _(t){return"object"==typeof t&&"function"==typeof t.glOnResize}function I(t){return"object"==typeof t&&"function"==typeof t.glOnShow}function b(t){return"object"==typeof t&&"function"==typeof t.glOnHide}function L(t){return"object"==typeof t&&"function"==typeof t.glOnTab}var x=function(){function t(t,e,n){this.host=t,this.container=e,this.state=n,this.destroyed=!1,this.initialized=!1,this.originalComponent=this.host.getGoldenLayoutInstance()._getAllComponents()[this.state.originalId]}return Object.defineProperty(t.prototype,"headerComponent",{get:function(){return this.originalComponent&&this.originalComponent.instance?this.originalComponent.instance.then(function(t){return t.instance.headerComponent}):undefined},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"additionalTokens",{get:function(){return this.originalComponent&&this.originalComponent.instance?this.originalComponent.instance.then(function(t){return t.instance.additionalTokens}):undefined},enumerable:!0,configurable:!0}),t.prototype.ngOnInit=function(){var t=this;this.originalComponent.instance.then(function(e){t.destroyed||t.initialized||(t.redock(e,t.container.getElement()),t.initialized=!0)})},t.prototype.ngOnDestroy=function(){var t=this;this.originalComponent.instance.then(function(e){t.initialized&&!t.destroyed&&(t.redock(e,t.originalComponent.container.getElement()),t.destroyed=!0)})},t.prototype.redock=function(t,e){var n=$(t.location.nativeElement);n.remove(),e.append(n),_(t.instance)&&t.instance.glOnResize()},t.prototype.glOnHide=function(){this.originalComponent.instance.then(function(t){b(t.instance)&&t.instance.glOnHide()})},t.prototype.glOnShow=function(){this.originalComponent.instance.then(function(t){I(t.instance)&&t.instance.glOnShow()})},t.prototype.glOnResize=function(){this.originalComponent.instance.then(function(t){_(t.instance)&&t.instance.glOnResize()})},t.prototype.glOnTab=function(t){var e=this;this.originalComponent.instance.then(function(t){L(t.instance)&&t.instance.glOnTab(e.originalComponent.tab)})},t.decorators=[{type:e.Component,args:[{selector:"gl-wrapper",encapsulation:e.ViewEncapsulation.None,template:'<div class="wrapper"></div>'}]}],t.ctorParameters=function(){return[{type:undefined,decorators:[{type:e.Inject,args:[C]}]},{type:undefined,decorators:[{type:e.Inject,args:[y]}]},{type:undefined,decorators:[{type:e.Inject,args:[v]}]}]},t}(),S=function(){function t(t,e){var n=this;this.pluginRegistry=e,this.components=new Map,this.awaitedComponents=new Map,(t||[]).forEach(function(t){return n.registerComponent(t)}),this.registerComponent({name:"gl-wrapper",type:x}),this.pluginRegistry.pluginLoaded$.subscribe(function(t){var e=t.id,o=t.module.injector.get(u,[]);console.log("Plugin",e,"wants to register",o.length,"components"),o.forEach(function(t){return n.registerComponent(a({},t,{plugin:e}))})})}return t.prototype.registeredComponents=function(){return c(this.components.entries()).map(function(t){return{name:t[0],type:t[1]}})},t.prototype.componentMap=function(){return this.components},t.prototype.registerComponent=function(t){var e=this.components.get(t.name);if(e&&e!==t.type)throw new Error("Failed to register component, "+t.name+" is already taken by another component: "+e);this.components.set(t.name,t.type);var n=this.awaitedComponents.get(t.name);n&&(this.awaitedComponents["delete"](t.name),n.resolve(t.type))},t.prototype.waitForComponent=function(t){var e=this.components.get(t);if(e)return Promise.resolve(e);var n=this.awaitedComponents.get(t);return n||(n=new p,this.awaitedComponents.set(t,n)),n.promise},t.decorators=[{type:e.Injectable}],t.ctorParameters=function(){return[{type:Array,decorators:[{type:e.Inject,args:[u]},{type:e.Optional}]},{type:g}]},t}(),j=new e.InjectionToken("fallback component"),E=new e.InjectionToken("failed component"),P=function(){function t(){}return t.prototype.isChildWindow=function(){try{return!!window.opener&&!!window.opener.location.href}catch(t){return!1}},t.prototype.getRootWindow=function(){return this.isChildWindow()?window.opener:window},t.decorators=[{type:e.Injectable}],t.ctorParameters=function(){return[]},t}(),k=function(){function t(t,e,n){var o=this;this.appref=t,this.rootService=e,this.injector=n,this.unloaded=!1,this.topWindow=this.rootService.getRootWindow(),this.isChildWindow=this.rootService.isChildWindow(),this.isChildWindow&&(window.document.title=window.document.URL,console.__log=console.log,console.log=function(){for(var t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return(t=o.topWindow.console).log.apply(t,c(["[CHILD] =>"],e))});var i=this.topWindow;this.isChildWindow||(i.__apprefs=[],i.__injector=this.injector),i.__apprefs.push(this.appref),this.appref.__tick=this.appref.tick,this.appref.tick=function(){var t,e,n=function(t){t._zone.run(function(){return t.__tick()})};try{for(var i=s(o.topWindow.__apprefs),r=i.next();!r.done;r=i.next()){n(r.value)}}catch(a){t={error:a}}finally{try{r&&!r.done&&(e=i["return"])&&e.call(i)}finally{if(t)throw t.error}}}}return t.prototype.onUnload=function(){if(!this.unloaded&&(this.unloaded=!0,this.isChildWindow)){var t=this.topWindow.__apprefs.indexOf(this.appref);t>=0&&this.topWindow.__apprefs.splice(t,1)}},t.decorators=[{type:e.Injectable}],t.ctorParameters=function(){return[{type:e.ApplicationRef},{type:P},{type:e.Injector}]},t}(),O=o,R=function(t){return t.isComponent&&t.config&&t.config.componentState&&t.config.componentState.originalId},M=function(t,e){var n=t.root.getItemsById(e);return 1!==n.length?(console.warn("non unique ID found: "+e),undefined):n[0]},A=function(t){var e=M(t.layoutManager,t.config.componentState.originalId);if(!e.isComponent)throw new Error("Expected component");return e},D=O.__lm.controls.Tab,T=function(t,e){var n=new D(t,e);return n.closeElement.off("click touchstart"),n.closeElement.on("click touchstart",function(t){if(t.stopPropagation(),R(n.contentItem)){var e=A(n.contentItem);e&&e.isComponent&&e.container.close()}else n.contentItem.container.close()}),n.element.on("mousedown touchstart",function(t){var e=n.contentItem;R(e)&&(e=A(n.contentItem)),e.layoutManager.emit("tabActivated",e)}),R(n.contentItem)&&!0===n._layoutManager.config.settings.reorderEnabled&&n.element.on("mousedown touchstart",function(e){var o,i,r=(o=n.contentItem,(i=A(o))?i.tab:undefined);if(r&&r._dragListener){var a=r._dragListener,s=function(){a.off("dragStart",s,a),t.layoutManager._maximisedItem===n.contentItem.parent&&n.contentItem.parent.toggleMaximise()};a.off("dragStart",r._onDragStart,r),a.on("dragStart",s,a),a.on("dragStart",r._onDragStart,r),a._fDown(e)}}),n};T._template='<li class="lm_tab"><i class="lm_left"></i><span class="lm_title"></span><div class="lm_close_tab"></div><i class="lm_right"></i></li>',O.__lm.controls.Tab=T;var U=O.__lm.controls.Header,W=function(t,e){var n=e._header.maximise,o=e._header.popout;n&&!0===t.config.settings.maximiseAllItems&&delete e._header.maximise,o&&!0===t.config.settings.maximiseAllItems&&delete e._header.popout;var i=new U(t,e);if(o&&!0===t.config.settings.maximiseAllItems&&(i.popoutButton=new O.__lm.controls.HeaderButton(i,o,"lm_popout",function(){var e=i.activeContentItem;R(e)?(e=A(e)).popout():!0===t.config.settings.popoutWholeStack?i.parent.popout():e.popout()})),n&&!0===t.config.settings.maximiseAllItems&&(i.maximiseButton=new O.__lm.controls.HeaderButton(i,n,"lm_maximise",function(){console.log("I should maximise all items."),t._maximisedItem===e?e.toggleMaximise():t.generateAndMaximiseDummyStack(e)})),i.closeButton){i.closeButton._$destroy();var r=i._getHeaderSetting("close");i.closeButton=new O.__lm.controls.HeaderButton(i,r,"lm_close",function(){i.parent.contentItems.forEach(function(t){t.container.close()})})}return i};W._template=['<div class="lm_header">','<ul class="lm_tabs"></ul>','<ul class="lm_controls"></ul>','<ul class="lm_tabdropdown_list"></ul>',"</div>"].join(""),O.__lm.controls.Header=W;var z=O.__lm.controls.DragProxy,H=function(t,e,n,o,i,r){return o.emit("itemDragged",i),console.log("new dragProxy",i),new z(t,e,n,o,i,r)};H._template=z._template,O.__lm.controls.DragProxy=H;var N=O.__lm.items.Stack;function G(t,e,o){var i=this;console.log(t,e,o,this),N.call(this,t,e,o),this.activeContentItem$=new n.BehaviorSubject(null);var r=function(t){i.activeContentItem$&&i.activeContentItem$.next(t)};this.on("activeContentItemChanged",r);var a=this._$destroy;return this.___destroyed=!1,this._$destroy=function(){i.___destroyed||(i.___destroyed=!0,i.off("activeContentItemChanged",r),i.activeContentItem$.complete(),i.activeContentItem$=null,a.call(i))},this}G.prototype=Object.create(N.prototype),G.prototype.addChild=function(t,e){var n=this;"stack"===t.type?((t.content||[]).forEach(function(t,o){return N.prototype.addChild.call(n,t,e+o)}),t.content.length&&this.setActiveContentItem(this.contentItems[e+t.activeItemIndex])):N.prototype.addChild.call(this,t,e)},G.prototype.setSize=function(){this.layoutManager._maximisedItem===this&&!0===this.layoutManager.config.settings.maximiseAllItems&&(this.element.width(this.layoutManager.container.width()),this.element.height(this.layoutManager.container.height())),N.prototype.setSize.call(this)},O.__lm.items.Stack=G;var q=O.__lm.controls.BrowserPopout;O.__lm.controls.BrowserPopout=function(t,e,n,o,i){return 1!==t.length?console.warn("This should not happen, permitting",t):"component"===t[0].type&&(t=[{type:"stack",title:t[0].title,content:[t[0]]}]),new q(t,e,n,o,i)};var F=function(){function t(t,o,i,r,a,s,l,c,u){var d=this;this.rootService=t,this.componentRegistry=o,this.viewContainer=i,this.appref=r,this.componentFactoryResolver=a,this.ngZone=s,this.injector=l,this.windowSync=c,this.fallbackComponent=u,this.stateChanged=new e.EventEmitter,this.tabActivated=new e.EventEmitter,this.goldenLayout=null,this.onUnloaded=new p,this.stateChangePaused=!1,this.stateChangeScheduled=!1,this.tabsList=new n.BehaviorSubject({}),this.pushStateChange=function(){d.tabsList.next(d.goldenLayout._getAllComponents()),d.stateChangePaused||d.stateChangeScheduled||(d.stateChangeScheduled=!0,window.requestAnimationFrame(function(){d.stateChangeScheduled=!1,d.stateChanged.emit()}))},this.resumeStateChange=function(){return d.stateChangePaused=!1},this.pauseStateChange=function(){return d.stateChangePaused=!0},this.pushTabActivated=function(t){d.tabActivated.emit(t)},this.fallbackType=null,this.openedComponents=[],this.poppedIn=!1,this._eventEmitter=new O.__lm.utils.EventEmitter,this.isChildWindow=this.rootService.isChildWindow(),this.fallbackComponent&&(this.fallbackType=this.buildConstructor(this.fallbackComponent)),e.isDevMode()&&console.log("Create@"+(this.isChildWindow?"child":"root")+"!")}return t.prototype.onResize=function(){this.goldenLayout&&this.goldenLayout.updateSize()},t.prototype.ngOnInit=function(){var t=this;e.isDevMode()&&console.log("Init@"+(this.isChildWindow?"child":"root")+"!"),this.layoutSubscription=this.layout.subscribe(function(e){t.destroyGoldenLayout(),t.initializeGoldenLayout(e)})},t.prototype.beforeUnload=function(){var t=this;this.poppedIn&&(this.onUnloaded.promise.then(function(){return t.ngOnDestroy()}),this.onUnloaded.resolve(),this.windowSync.onUnload())},t.prototype.pageHide=function(){var t=this;this.poppedIn||this.openedComponents.forEach(function(t){var e;"object"==typeof(e=t)&&"function"==typeof e.glOnUnload&&t.glOnUnload()}),this.onUnloaded.promise.then(function(){return t.ngOnDestroy()}),this.onUnloaded.resolve(),this.windowSync.onUnload()},t.prototype.ngOnDestroy=function(){var t;e.isDevMode()&&console.log("Destroy@"+(this.isChildWindow?"child":"root")+"!"),this.layoutSubscription.unsubscribe(),this.appref.tick=this.appref.__tick,this.destroyGoldenLayout(),this._eventEmitter._mSubscriptions=((t={})[O.__lm.utils.EventEmitter.ALL_EVENT]=[],t),this.isChildWindow&&(console.log=console.__log)},t.prototype.getGoldenLayoutInstance=function(){if(!this.goldenLayout)throw new Error("Component is not initialized yet");return this.goldenLayout},t.prototype.addEvent=function(t,e,n){this._eventEmitter.on(t,e,n)},t.prototype.getSerializableState=function(){if(this.goldenLayout){var t=this.goldenLayout.toConfig(),e=this.goldenLayout.__wrapperMaximisedItemId;if(e){t.maximisedItemId=e;var n=function(t){return("stack"!==t.type||!t.isDummy)&&("component"!==t.type&&(t.content=t.content.filter(n)),!0)};t.content=t.content.filter(n)}return t}return null},t.prototype.getComponents=function(){return this.goldenLayout._getAllComponents()},t.prototype.closeComponent=function(t){var e=M(this.goldenLayout,t);e&&e.remove()},t.prototype.focusComponent=function(t){var e=M(this.goldenLayout,t);e&&e.parent.setActiveContentItem(e)},t.prototype.createNewComponent=function(t,e){if(!this.goldenLayout)throw new Error("golden layout is not initialized");var n=t,o=this.goldenLayout.root,i=null;if(e){var r=M(this.goldenLayout,e);if(r.parent.isStack)i=r.parent;else{var s=this.goldenLayout.createContentItem({type:"stack",width:r.parent.config.width,height:r.parent.config.height,content:[]});r.parent.replaceChild(r,s,!1),s.addChild(r),i=s}}else o.contentItems&&0!==o.contentItems.length?i=this.findStack(o.contentItems):(i=o,n={type:"stack",content:[a({},n,{type:"component"})]});if(null===i)throw new Error("this should never happen!");var l=this.goldenLayout.createContentItem(n);return i.addChild(l),l.isComponent?l.instance:l.isStack&&1===l.contentItems.length?l[0].instance:l},t.prototype.findStack=function(t){var e,n;if(!t)return null;try{for(var o=s(t),i=o.next();!i.done;i=o.next()){var r=i.value;if(r.isStack){if(r.config.isDummy)continue;return r}var a=this.findStack(r.contentItems);if(null!==a)return a}}catch(l){e={error:l}}finally{try{i&&!i.done&&(n=o["return"])&&n.call(o)}finally{if(e)throw e.error}}},t.prototype.destroyGoldenLayout=function(){this.goldenLayout&&(this.goldenLayout.off("stateChanged",this.pushStateChange),this.goldenLayout.off("itemDropped",this.resumeStateChange),this.goldenLayout.off("itemDragged",this.pauseStateChange),this.goldenLayout.off("tabActivated",this.pushTabActivated),this.goldenLayout.off("initialised"),this.goldenLayout.off(O.__lm.utils.EventEmitter.ALL_EVENT,this._eventEmitter.emit,this._eventEmitter),this.goldenLayout.destroy(),this.goldenLayout=null)},t.prototype.initializeGoldenLayout=function(t){var r=this;this.goldenLayout=new o(t,$(this.el.nativeElement));var u=this.goldenLayout.createPopout.bind(this.goldenLayout);this.goldenLayout.createPopout=function(t,e,n,o){for(var i,r=[t];r.length;){var a=r.shift();if(a.contentItems&&a.contentItems.length>0&&r.push.apply(r,c(a.contentItems)),a.isComponent){var s=a.container.__ngComponent;s&&("object"==typeof(i=s)&&"function"==typeof i.glOnPopout)&&s.glOnPopout()}}return u(t,e,n,o)};var d=function(t){var e,n,o={};try{for(var i=s(t.contentItems),r=i.next();!r.done;r=i.next()){var l=r.value;if(l.isComponent){if(l.config&&l.config.componentState&&l.config.componentState.originalId)continue;o[l.id]=l}else o=a({},o,d(l))}}catch(c){e={error:c}}finally{try{r&&!r.done&&(n=i["return"])&&n.call(i)}finally{if(e)throw e.error}}return o};this.goldenLayout._getAllComponents=function(){return d(r.goldenLayout.root)},this.goldenLayout.generateAndMaximiseDummyStack=function(t,e){var o=d(r.goldenLayout.root),l=Object.keys(o);if(0!==l.length){var c=r.goldenLayout.root.contentItems[0];if(c.isStack)c.toggleMaximise();else{var u={type:"stack",content:l.map(function(t){return{type:"component",componentName:"gl-wrapper",title:o[t].config.title,reorderEnabled:!1,componentState:{originalId:t}}}),isClosable:!1,isDummy:!0,state:"dummy",activeItemIndex:l.findIndex(function(n){return n===(e||t._activeContentItem.id)})};c.addChild(u,0);var p=c.contentItems[0];r.goldenLayout.__wrapperMaximisedItemId=t._activeContentItem.id,p.activeContentItem$.subscribe(function(t){r.goldenLayout.__wrapperMaximisedItemId=t.config.componentState.originalId});var h=new n.Subject;p.on("minimised",function(){console.log("minimised",p),r.goldenLayout.__wrapperMaximisedItemId=null,h.next(),h.complete(),p.remove()}),p.toggleMaximise(),r.tabsList.pipe(i.takeUntil(h),i.distinctUntilChanged(function(t,e){var n=Object.keys(t),o=new Set(Object.keys(e));return n.length===o.size&&n.every(function(t){return o.has(t)})})).subscribe(function(t){var e,n,o,i,r=a({},t),l=new Set(Object.keys(r)),c=new Set(p.contentItems.map(function(t){return t.config.componentState.originalId}));try{for(var u=s(l),d=u.next();!d.done;d=u.next()){var h=d.value;c.has(h)?c["delete"](h):p.addChild({type:"component",componentName:"gl-wrapper",title:t[h].config.title,reorderEnabled:!1,componentState:{originalId:h}})}}catch(y){e={error:y}}finally{try{d&&!d.done&&(n=u["return"])&&n.call(u)}finally{if(e)throw e.error}}var f=function(t){p.contentItems.find(function(e){return e.config.componentState.originalId===t}).remove()};try{for(var m=s(c),g=m.next();!g.done;g=m.next()){f(g.value)}}catch(v){o={error:v}}finally{try{g&&!g.done&&(i=m["return"])&&i.call(m)}finally{if(o)throw o.error}}})}}},this.goldenLayout.on("popIn",function(){console.log("popIn"),r.poppedIn=!0,r.openedComponents.forEach(function(t){var e;"object"==typeof(e=t)&&"function"==typeof e.glOnPopin&&t.glOnPopin()})}),this.goldenLayout.getComponent=function(t){return e.isDevMode()&&console.log("Resolving component "+t),r.buildConstructor(t)},this.goldenLayout.on("stackCreated",function(t){var o=document.createElement("li");o.classList.add("custom-header"),o.style.display="none";var a=t.header.controlsContainer[0],s=null;a.prepend(o);var c=function(){o.style.display="none",s&&(o.childNodes.forEach(function(t){return o.removeChild(t)}),s.destroy(),s=null,t.header._updateTabSizes())};t.activeContentItem$.pipe(i.switchMap(function(t){return t&&t.isComponent&&t.instance||n.of(null)}),i.switchMap(function(t){if(!t)return Promise.all([null,null,null]);var e=t.instance.headerComponent,n=t.instance.additionalTokens;return Promise.all([Promise.resolve(e),Promise.resolve(n),Promise.resolve(t)])})).subscribe(function(n){var i=l(n,3),a=i[0],u=i[1],d=i[2];a&&d?function(n,i,a){s&&c(),o.style.display="";var l=r.componentFactoryResolver.resolveComponentFactory(n),u=e.Injector.create(i,a);s=r.viewContainer.createComponent(l,undefined,u),o.prepend(s.location.nativeElement),t.header._updateTabSizes()}(a,u||[],d.injector):c()},c,c)}),this.goldenLayout.on("initialised",function(){window.requestAnimationFrame(function(){if(t.maximisedItemId){var e=M(r.goldenLayout,t.maximisedItemId);e&&r.goldenLayout.generateAndMaximiseDummyStack(e.parent,t.maximisedItemId)}})}),this.goldenLayout.init(),this.goldenLayout.on("stateChanged",this.pushStateChange),this.goldenLayout.on("itemDragged",this.pauseStateChange),this.goldenLayout.on("itemDropped",this.resumeStateChange),this.goldenLayout.on("tabActivated",this.pushTabActivated),this.goldenLayout.on(O.__lm.utils.EventEmitter.ALL_EVENT,this._eventEmitter.emit,this._eventEmitter)},t.prototype.buildConstructor=function(t){var e=this;return function(n,o){var i=n.parent;i.config.id?i.id=i.config.id:(i.id="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=16*Math.random()|0;return("x"==t?e:3&e|8).toString(16)}),i.config.id=i.id);var r=new p;return e.ngZone.run(function(){e.componentRegistry.waitForComponent(t).then(function(i){console.log("Component "+t+" returned from componentRegistry");var a=e.componentFactoryResolver.resolveComponentFactory(i),s=null;i===e.fallbackComponent&&(s=n._config.componentName);var l=e._createComponentInjector(n,o,s),c=e.viewContainer.createComponent(a,undefined,l);n.getElement().append($(c.location.nativeElement)),e._bindEventHooks(n,c.instance),n.__ngComponent=c.instance,e.openedComponents.push(c.instance);var u=!1,d=function(){u||(u=!0,e.openedComponents=e.openedComponents.filter(function(t){return t!==c.instance}),$(c.location.nativeElement).remove(),c.destroy())};n.on("destroy",d),e.onUnloaded.promise.then(d),r.resolve(c)})}),r.promise}},t.prototype._createComponentInjector=function(t,n,o){var i=[{provide:y,useValue:t},{provide:v,useValue:n},{provide:w,useValue:this.goldenLayout.eventHub},{provide:C,useValue:this}];return o&&i.push({provide:E,useValue:o}),e.Injector.create(i,this.injector)},t.prototype._bindEventHooks=function(t,e){if(_(e)&&t.on("resize",function(){e.glOnResize()}),I(e)&&t.on("show",function(){e.glOnShow()}),b(e)&&t.on("hide",function(){e.glOnHide()}),L(e)&&t.on("tab",function(t){e.glOnTab(t)}),"object"==typeof(o=e)&&"function"==typeof o.glOnClose){var n=t.close.bind(t);t.close=function(){if(!t._config.isClosable)return!1;e.glOnClose().then(function(){n()},function(){})}}var o},t.decorators=[{type:e.Component,args:[{selector:"golden-layout-root",template:'<div class="ng-golden-layout-root" #glroot></div>',styles:["\n .ng-golden-layout-root {\n width:100%;\n height:100%;\n }"]}]}],t.ctorParameters=function(){return[{type:P},{type:S},{type:e.ViewContainerRef},{type:e.ApplicationRef},{type:e.ComponentFactoryResolver},{type:e.NgZone},{type:e.Injector},{type:k},{type:undefined,decorators:[{type:e.Optional},{type:e.Inject,args:[j]}]}]},t.propDecorators={layout:[{type:e.Input}],stateChanged:[{type:e.Output}],tabActivated:[{type:e.Output}],el:[{type:e.ViewChild,args:["glroot",{"static":!0}]}],onResize:[{type:e.HostListener,args:["window:resize"]}],beforeUnload:[{type:e.HostListener,args:["window:beforeunload"]}],pageHide:[{type:e.HostListener,args:["window:pagehide"]}]},t}(),V=function(){function t(){}return t.forRoot=function(n,o,i){return{ngModule:t,providers:[S,P,g,m,k,{provide:e.APP_INITIALIZER,useValue:h,multi:!0},{provide:u,useValue:n},{provide:e.ANALYZE_FOR_ENTRY_COMPONENTS,useValue:[n,o,x],multi:!0},{provide:d,useValue:i},{provide:j,useValue:o}]}},t.decorators=[{type:e.NgModule,args:[{declarations:[F,x],exports:[F],imports:[r.CommonModule]}]}],t}();t.ComponentRegistryService=S,t.FailedComponent=E,t.FallbackComponent=j,t.GetComponentFromLayoutManager=M,t.GoldenLayoutComponent=F,t.GoldenLayoutComponentHost=C,t.GoldenLayoutComponentState=v,t.GoldenLayoutComponents=u,t.GoldenLayoutContainer=y,t.GoldenLayoutEventHub=w,t.GoldenLayoutModule=V,t.GoldenLayoutPluginDependency=d,t.MultiWindowInit=h,t.MultiWindowService=f,t.PluginRegistryService=g,t.PluginURLProvider=m,t.RootWindowService=P,t.forChild=function(t){return[{provide:u,useValue:t},{provide:e.ANALYZE_FOR_ENTRY_COMPONENTS,useValue:t,multi:!0}]},t.ɵa=k,t.ɵb=x,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=ngx-golden-layout.umd.min.js.map |
{ | ||
"name": "ngx-golden-layout", | ||
"version": "0.0.33", | ||
"version": "0.0.34", | ||
"license": "BSD-3-Clause", | ||
@@ -5,0 +5,0 @@ "author": { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1254815
13777