UNPKG

angular-split-workaround-angular6

Version:

Angular UI library used to split views and to allow dragging to resize the split areas using CSS flexbox layout.

1 lines 44.9 kB
!function(global,factory){"object"==typeof exports&&"undefined"!=typeof module?factory(exports,require("@angular/core"),require("@angular/common")):"function"==typeof define&&define.amd?define(["exports","@angular/core","@angular/common"],factory):factory((global.ng=global.ng||{},global.ng.angularSplit={}),global.ng.core,global.ng.common)}(this,function(exports,core,common){"use strict";function __extends(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)}function isFunction(x){return"function"==typeof x}function hostReportError(err){setTimeout(function(){throw err})}function isObject(x){return null!=x&&"object"==typeof x}function tryCatcher(){try{return tryCatchTarget.apply(this,arguments)}catch(e){return errorObject.e=e,errorObject}}function tryCatch(fn){return tryCatchTarget=fn,tryCatcher}function flattenUnsubscriptionErrors(errors){return errors.reduce(function(errs,err){return errs.concat(err instanceof UnsubscriptionError?err.errors:err)},[])}function isTrustedSubscriber(obj){return obj instanceof Subscriber||"syncErrorThrowable"in obj&&obj[rxSubscriber]}function toSubscriber(nextOrObserver,error,complete){if(nextOrObserver){if(nextOrObserver instanceof Subscriber)return nextOrObserver;if(nextOrObserver[rxSubscriber])return nextOrObserver[rxSubscriber]()}return nextOrObserver||error||complete?new Subscriber(nextOrObserver,error,complete):new Subscriber(empty)}function noop(){}function pipeFromArray(fns){return fns?1===fns.length?fns[0]:function(input){return fns.reduce(function(prev,fn){return fn(prev)},input)}:noop}function getPromiseCtor(promiseCtor){if(promiseCtor||(promiseCtor=config.Promise||Promise),!promiseCtor)throw new Error("no Promise impl found");return promiseCtor}function debounceTime(dueTime,scheduler){return void 0===scheduler&&(scheduler=async),function(source){return source.lift(new DebounceTimeOperator(dueTime,scheduler))}}function dispatchNext$2(subscriber){subscriber.debouncedNext()}var tryCatchTarget,extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])},_enable_super_gross_mode_that_will_cause_bad_things=!1,config={Promise:void 0,set useDeprecatedSynchronousErrorHandling(value){value&&(new Error).stack,_enable_super_gross_mode_that_will_cause_bad_things=value},get useDeprecatedSynchronousErrorHandling(){return _enable_super_gross_mode_that_will_cause_bad_things}},empty={closed:!0,next:function(value){},error:function(err){if(config.useDeprecatedSynchronousErrorHandling)throw err;hostReportError(err)},complete:function(){}},isArray=Array.isArray||function(x){return x&&"number"==typeof x.length},errorObject={e:{}},UnsubscriptionError=function(_super){function UnsubscriptionError(errors){var _this=_super.call(this,errors?errors.length+" errors occurred during unsubscription:\n "+errors.map(function(err,i){return i+1+") "+err.toString()}).join("\n "):"")||this;return _this.errors=errors,_this.name="UnsubscriptionError",Object.setPrototypeOf(_this,UnsubscriptionError.prototype),_this}return __extends(UnsubscriptionError,_super),UnsubscriptionError}(Error),Subscription=function(){function Subscription(unsubscribe){this.closed=!1,this._parent=null,this._parents=null,this._subscriptions=null,unsubscribe&&(this._unsubscribe=unsubscribe)}return Subscription.prototype.unsubscribe=function(){var errors,hasErrors=!1;if(!this.closed){var _a=this,_parent=_a._parent,_parents=_a._parents,_unsubscribe=_a._unsubscribe,_subscriptions=_a._subscriptions;this.closed=!0,this._parent=null,this._parents=null,this._subscriptions=null;for(var index=-1,len=_parents?_parents.length:0;_parent;)_parent.remove(this),_parent=++index<len&&_parents[index]||null;if(isFunction(_unsubscribe)&&(trial=tryCatch(_unsubscribe).call(this))===errorObject&&(hasErrors=!0,errors=errors||(errorObject.e instanceof UnsubscriptionError?flattenUnsubscriptionErrors(errorObject.e.errors):[errorObject.e])),isArray(_subscriptions))for(index=-1,len=_subscriptions.length;++index<len;){var sub=_subscriptions[index];if(isObject(sub)){var trial=tryCatch(sub.unsubscribe).call(sub);if(trial===errorObject){hasErrors=!0,errors=errors||[];var err=errorObject.e;err instanceof UnsubscriptionError?errors=errors.concat(flattenUnsubscriptionErrors(err.errors)):errors.push(err)}}}if(hasErrors)throw new UnsubscriptionError(errors)}},Subscription.prototype.add=function(teardown){if(!teardown||teardown===Subscription.EMPTY)return Subscription.EMPTY;if(teardown===this)return this;var subscription=teardown;switch(typeof teardown){case"function":subscription=new Subscription(teardown);case"object":if(subscription.closed||"function"!=typeof subscription.unsubscribe)return subscription;if(this.closed)return subscription.unsubscribe(),subscription;if("function"!=typeof subscription._addParent){var tmp=subscription;(subscription=new Subscription)._subscriptions=[tmp]}break;default:throw new Error("unrecognized teardown "+teardown+" added to Subscription.")}return(this._subscriptions||(this._subscriptions=[])).push(subscription),subscription._addParent(this),subscription},Subscription.prototype.remove=function(subscription){var subscriptions=this._subscriptions;if(subscriptions){var subscriptionIndex=subscriptions.indexOf(subscription);-1!==subscriptionIndex&&subscriptions.splice(subscriptionIndex,1)}},Subscription.prototype._addParent=function(parent){var _a=this,_parent=_a._parent,_parents=_a._parents;_parent&&_parent!==parent?_parents?-1===_parents.indexOf(parent)&&_parents.push(parent):this._parents=[parent]:this._parent=parent},Subscription.EMPTY=function(empty){return empty.closed=!0,empty}(new Subscription),Subscription}(),rxSubscriber="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("rxSubscriber"):"@@rxSubscriber",Subscriber=function(_super){function Subscriber(destinationOrNext,error,complete){var _this=_super.call(this)||this;switch(_this.syncErrorValue=null,_this.syncErrorThrown=!1,_this.syncErrorThrowable=!1,_this.isStopped=!1,arguments.length){case 0:_this.destination=empty;break;case 1:if(!destinationOrNext){_this.destination=empty;break}if("object"==typeof destinationOrNext){if(isTrustedSubscriber(destinationOrNext)){var trustedSubscriber=destinationOrNext[rxSubscriber]();_this.syncErrorThrowable=trustedSubscriber.syncErrorThrowable,_this.destination=trustedSubscriber,trustedSubscriber.add(_this)}else _this.syncErrorThrowable=!0,_this.destination=new SafeSubscriber(_this,destinationOrNext);break}default:_this.syncErrorThrowable=!0,_this.destination=new SafeSubscriber(_this,destinationOrNext,error,complete)}return _this}return __extends(Subscriber,_super),Subscriber.prototype[rxSubscriber]=function(){return this},Subscriber.create=function(next,error,complete){var subscriber=new Subscriber(next,error,complete);return subscriber.syncErrorThrowable=!1,subscriber},Subscriber.prototype.next=function(value){this.isStopped||this._next(value)},Subscriber.prototype.error=function(err){this.isStopped||(this.isStopped=!0,this._error(err))},Subscriber.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},Subscriber.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,_super.prototype.unsubscribe.call(this))},Subscriber.prototype._next=function(value){this.destination.next(value)},Subscriber.prototype._error=function(err){this.destination.error(err),this.unsubscribe()},Subscriber.prototype._complete=function(){this.destination.complete(),this.unsubscribe()},Subscriber.prototype._unsubscribeAndRecycle=function(){var _a=this,_parent=_a._parent,_parents=_a._parents;return this._parent=null,this._parents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parent=_parent,this._parents=_parents,this},Subscriber}(Subscription),SafeSubscriber=function(_super){function SafeSubscriber(_parentSubscriber,observerOrNext,error,complete){var _this=_super.call(this)||this;_this._parentSubscriber=_parentSubscriber;var next,context=_this;return isFunction(observerOrNext)?next=observerOrNext:observerOrNext&&(next=observerOrNext.next,error=observerOrNext.error,complete=observerOrNext.complete,observerOrNext!==empty&&(isFunction((context=Object.create(observerOrNext)).unsubscribe)&&_this.add(context.unsubscribe.bind(context)),context.unsubscribe=_this.unsubscribe.bind(_this))),_this._context=context,_this._next=next,_this._error=error,_this._complete=complete,_this}return __extends(SafeSubscriber,_super),SafeSubscriber.prototype.next=function(value){if(!this.isStopped&&this._next){var _parentSubscriber=this._parentSubscriber;config.useDeprecatedSynchronousErrorHandling&&_parentSubscriber.syncErrorThrowable?this.__tryOrSetError(_parentSubscriber,this._next,value)&&this.unsubscribe():this.__tryOrUnsub(this._next,value)}},SafeSubscriber.prototype.error=function(err){if(!this.isStopped){var _parentSubscriber=this._parentSubscriber,useDeprecatedSynchronousErrorHandling=config.useDeprecatedSynchronousErrorHandling;if(this._error)useDeprecatedSynchronousErrorHandling&&_parentSubscriber.syncErrorThrowable?(this.__tryOrSetError(_parentSubscriber,this._error,err),this.unsubscribe()):(this.__tryOrUnsub(this._error,err),this.unsubscribe());else if(_parentSubscriber.syncErrorThrowable)useDeprecatedSynchronousErrorHandling?(_parentSubscriber.syncErrorValue=err,_parentSubscriber.syncErrorThrown=!0):hostReportError(err),this.unsubscribe();else{if(this.unsubscribe(),useDeprecatedSynchronousErrorHandling)throw err;hostReportError(err)}}},SafeSubscriber.prototype.complete=function(){var _this=this;if(!this.isStopped){var _parentSubscriber=this._parentSubscriber;if(this._complete){var wrappedComplete=function(){return _this._complete.call(_this._context)};config.useDeprecatedSynchronousErrorHandling&&_parentSubscriber.syncErrorThrowable?(this.__tryOrSetError(_parentSubscriber,wrappedComplete),this.unsubscribe()):(this.__tryOrUnsub(wrappedComplete),this.unsubscribe())}else this.unsubscribe()}},SafeSubscriber.prototype.__tryOrUnsub=function(fn,value){try{fn.call(this._context,value)}catch(err){if(this.unsubscribe(),config.useDeprecatedSynchronousErrorHandling)throw err;hostReportError(err)}},SafeSubscriber.prototype.__tryOrSetError=function(parent,fn,value){if(!config.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{fn.call(this._context,value)}catch(err){return config.useDeprecatedSynchronousErrorHandling?(parent.syncErrorValue=err,parent.syncErrorThrown=!0,!0):(hostReportError(err),!0)}return!1},SafeSubscriber.prototype._unsubscribe=function(){var _parentSubscriber=this._parentSubscriber;this._context=null,this._parentSubscriber=null,_parentSubscriber.unsubscribe()},SafeSubscriber}(Subscriber),observable="function"==typeof Symbol&&Symbol.observable||"@@observable",Observable=function(){function Observable(subscribe){this._isScalar=!1,subscribe&&(this._subscribe=subscribe)}return Observable.prototype.lift=function(operator){var observable$$1=new Observable;return observable$$1.source=this,observable$$1.operator=operator,observable$$1},Observable.prototype.subscribe=function(observerOrNext,error,complete){var operator=this.operator,sink=toSubscriber(observerOrNext,error,complete);if(operator?operator.call(sink,this.source):sink.add(this.source||!sink.syncErrorThrowable?this._subscribe(sink):this._trySubscribe(sink)),config.useDeprecatedSynchronousErrorHandling&&sink.syncErrorThrowable&&(sink.syncErrorThrowable=!1,sink.syncErrorThrown))throw sink.syncErrorValue;return sink},Observable.prototype._trySubscribe=function(sink){try{return this._subscribe(sink)}catch(err){config.useDeprecatedSynchronousErrorHandling&&(sink.syncErrorThrown=!0,sink.syncErrorValue=err),sink.error(err)}},Observable.prototype.forEach=function(next,promiseCtor){var _this=this;return new(promiseCtor=getPromiseCtor(promiseCtor))(function(resolve,reject){var subscription;subscription=_this.subscribe(function(value){try{next(value)}catch(err){reject(err),subscription&&subscription.unsubscribe()}},reject,resolve)})},Observable.prototype._subscribe=function(subscriber){var source=this.source;return source&&source.subscribe(subscriber)},Observable.prototype[observable]=function(){return this},Observable.prototype.pipe=function(){for(var operations=[],_i=0;_i<arguments.length;_i++)operations[_i]=arguments[_i];return 0===operations.length?this:pipeFromArray(operations)(this)},Observable.prototype.toPromise=function(promiseCtor){var _this=this;return new(promiseCtor=getPromiseCtor(promiseCtor))(function(resolve,reject){var value;_this.subscribe(function(x){return value=x},function(err){return reject(err)},function(){return resolve(value)})})},Observable.create=function(subscribe){return new Observable(subscribe)},Observable}(),ObjectUnsubscribedError=function(_super){function ObjectUnsubscribedError(){var _this=_super.call(this,"object unsubscribed")||this;return _this.name="ObjectUnsubscribedError",Object.setPrototypeOf(_this,ObjectUnsubscribedError.prototype),_this}return __extends(ObjectUnsubscribedError,_super),ObjectUnsubscribedError}(Error),SubjectSubscription=function(_super){function SubjectSubscription(subject,subscriber){var _this=_super.call(this)||this;return _this.subject=subject,_this.subscriber=subscriber,_this.closed=!1,_this}return __extends(SubjectSubscription,_super),SubjectSubscription.prototype.unsubscribe=function(){if(!this.closed){this.closed=!0;var subject=this.subject,observers=subject.observers;if(this.subject=null,observers&&0!==observers.length&&!subject.isStopped&&!subject.closed){var subscriberIndex=observers.indexOf(this.subscriber);-1!==subscriberIndex&&observers.splice(subscriberIndex,1)}}},SubjectSubscription}(Subscription),SubjectSubscriber=function(_super){function SubjectSubscriber(destination){var _this=_super.call(this,destination)||this;return _this.destination=destination,_this}return __extends(SubjectSubscriber,_super),SubjectSubscriber}(Subscriber),Subject=function(_super){function Subject(){var _this=_super.call(this)||this;return _this.observers=[],_this.closed=!1,_this.isStopped=!1,_this.hasError=!1,_this.thrownError=null,_this}return __extends(Subject,_super),Subject.prototype[rxSubscriber]=function(){return new SubjectSubscriber(this)},Subject.prototype.lift=function(operator){var subject=new AnonymousSubject(this,this);return subject.operator=operator,subject},Subject.prototype.next=function(value){if(this.closed)throw new ObjectUnsubscribedError;if(!this.isStopped)for(var observers=this.observers,len=observers.length,copy=observers.slice(),i=0;i<len;i++)copy[i].next(value)},Subject.prototype.error=function(err){if(this.closed)throw new ObjectUnsubscribedError;this.hasError=!0,this.thrownError=err,this.isStopped=!0;for(var observers=this.observers,len=observers.length,copy=observers.slice(),i=0;i<len;i++)copy[i].error(err);this.observers.length=0},Subject.prototype.complete=function(){if(this.closed)throw new ObjectUnsubscribedError;this.isStopped=!0;for(var observers=this.observers,len=observers.length,copy=observers.slice(),i=0;i<len;i++)copy[i].complete();this.observers.length=0},Subject.prototype.unsubscribe=function(){this.isStopped=!0,this.closed=!0,this.observers=null},Subject.prototype._trySubscribe=function(subscriber){if(this.closed)throw new ObjectUnsubscribedError;return _super.prototype._trySubscribe.call(this,subscriber)},Subject.prototype._subscribe=function(subscriber){if(this.closed)throw new ObjectUnsubscribedError;return this.hasError?(subscriber.error(this.thrownError),Subscription.EMPTY):this.isStopped?(subscriber.complete(),Subscription.EMPTY):(this.observers.push(subscriber),new SubjectSubscription(this,subscriber))},Subject.prototype.asObservable=function(){var observable=new Observable;return observable.source=this,observable},Subject.create=function(destination,source){return new AnonymousSubject(destination,source)},Subject}(Observable),AnonymousSubject=function(_super){function AnonymousSubject(destination,source){var _this=_super.call(this)||this;return _this.destination=destination,_this.source=source,_this}return __extends(AnonymousSubject,_super),AnonymousSubject.prototype.next=function(value){var destination=this.destination;destination&&destination.next&&destination.next(value)},AnonymousSubject.prototype.error=function(err){var destination=this.destination;destination&&destination.error&&this.destination.error(err)},AnonymousSubject.prototype.complete=function(){var destination=this.destination;destination&&destination.complete&&this.destination.complete()},AnonymousSubject.prototype._subscribe=function(subscriber){return this.source?this.source.subscribe(subscriber):Subscription.EMPTY},AnonymousSubject}(Subject),AsyncAction=function(_super){function AsyncAction(scheduler,work){var _this=_super.call(this,scheduler,work)||this;return _this.scheduler=scheduler,_this.work=work,_this.pending=!1,_this}return __extends(AsyncAction,_super),AsyncAction.prototype.schedule=function(state,delay){if(void 0===delay&&(delay=0),this.closed)return this;this.state=state;var id=this.id,scheduler=this.scheduler;return null!=id&&(this.id=this.recycleAsyncId(scheduler,id,delay)),this.pending=!0,this.delay=delay,this.id=this.id||this.requestAsyncId(scheduler,this.id,delay),this},AsyncAction.prototype.requestAsyncId=function(scheduler,id,delay){return void 0===delay&&(delay=0),setInterval(scheduler.flush.bind(scheduler,this),delay)},AsyncAction.prototype.recycleAsyncId=function(scheduler,id,delay){return void 0===delay&&(delay=0),null!==delay&&this.delay===delay&&!1===this.pending?id:clearInterval(id)&&void 0||void 0},AsyncAction.prototype.execute=function(state,delay){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var error=this._execute(state,delay);if(error)return error;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},AsyncAction.prototype._execute=function(state,delay){var errored=!1,errorValue=void 0;try{this.work(state)}catch(e){errored=!0,errorValue=!!e&&e||new Error(e)}if(errored)return this.unsubscribe(),errorValue},AsyncAction.prototype._unsubscribe=function(){var id=this.id,scheduler=this.scheduler,actions=scheduler.actions,index=actions.indexOf(this);this.work=null,this.state=null,this.pending=!1,this.scheduler=null,-1!==index&&actions.splice(index,1),null!=id&&(this.id=this.recycleAsyncId(scheduler,id,null)),this.delay=null},AsyncAction}(function(_super){function Action(scheduler,work){return _super.call(this)||this}return __extends(Action,_super),Action.prototype.schedule=function(state,delay){return void 0===delay&&(delay=0),this},Action}(Subscription)),Scheduler=function(){function Scheduler(SchedulerAction,now){void 0===now&&(now=Scheduler.now),this.SchedulerAction=SchedulerAction,this.now=now}return Scheduler.prototype.schedule=function(work,delay,state){return void 0===delay&&(delay=0),new this.SchedulerAction(this,work).schedule(state,delay)},Scheduler.now=Date.now?Date.now:function(){return+new Date},Scheduler}(),AsyncScheduler=function(_super){function AsyncScheduler(SchedulerAction,now){void 0===now&&(now=Scheduler.now);var _this=_super.call(this,SchedulerAction,function(){return AsyncScheduler.delegate&&AsyncScheduler.delegate!==_this?AsyncScheduler.delegate.now():now()})||this;return _this.actions=[],_this.active=!1,_this.scheduled=void 0,_this}return __extends(AsyncScheduler,_super),AsyncScheduler.prototype.schedule=function(work,delay,state){return void 0===delay&&(delay=0),AsyncScheduler.delegate&&AsyncScheduler.delegate!==this?AsyncScheduler.delegate.schedule(work,delay,state):_super.prototype.schedule.call(this,work,delay,state)},AsyncScheduler.prototype.flush=function(action){var actions=this.actions;if(this.active)actions.push(action);else{var error;this.active=!0;do{if(error=action.execute(action.state,action.delay))break}while(action=actions.shift());if(this.active=!1,error){for(;action=actions.shift();)action.unsubscribe();throw error}}},AsyncScheduler}(Scheduler),async=new AsyncScheduler(AsyncAction),DebounceTimeOperator=(Error,Error,Error,function(){function DebounceTimeOperator(dueTime,scheduler){this.dueTime=dueTime,this.scheduler=scheduler}return DebounceTimeOperator.prototype.call=function(subscriber,source){return source.subscribe(new DebounceTimeSubscriber(subscriber,this.dueTime,this.scheduler))},DebounceTimeOperator}()),DebounceTimeSubscriber=function(_super){function DebounceTimeSubscriber(destination,dueTime,scheduler){var _this=_super.call(this,destination)||this;return _this.dueTime=dueTime,_this.scheduler=scheduler,_this.debouncedSubscription=null,_this.lastValue=null,_this.hasValue=!1,_this}return __extends(DebounceTimeSubscriber,_super),DebounceTimeSubscriber.prototype._next=function(value){this.clearDebounce(),this.lastValue=value,this.hasValue=!0,this.add(this.debouncedSubscription=this.scheduler.schedule(dispatchNext$2,this.dueTime,this))},DebounceTimeSubscriber.prototype._complete=function(){this.debouncedNext(),this.destination.complete()},DebounceTimeSubscriber.prototype.debouncedNext=function(){if(this.clearDebounce(),this.hasValue){var lastValue=this.lastValue;this.lastValue=null,this.hasValue=!1,this.destination.next(lastValue)}},DebounceTimeSubscriber.prototype.clearDebounce=function(){var debouncedSubscription=this.debouncedSubscription;null!==debouncedSubscription&&(this.remove(debouncedSubscription),debouncedSubscription.unsubscribe(),this.debouncedSubscription=null)},DebounceTimeSubscriber}(Subscriber),SplitComponent=function(){function SplitComponent(ngZone,elRef,cdRef,renderer){this.ngZone=ngZone,this.elRef=elRef,this.cdRef=cdRef,this.renderer=renderer,this._direction="horizontal",this._useTransition=!1,this._disabled=!1,this._width=null,this._height=null,this._gutterSize=11,this._gutterColor="",this._gutterImageH="",this._gutterImageV="",this._dir="ltr",this.dragStart=new core.EventEmitter(!1),this.dragProgress=new core.EventEmitter(!1),this.dragEnd=new core.EventEmitter(!1),this.gutterClick=new core.EventEmitter(!1),this.transitionEndInternal=new Subject,this.transitionEnd=this.transitionEndInternal.asObservable().pipe(debounceTime(20)),this.isViewInitialized=!1,this.isDragging=!1,this.draggingWithoutMove=!1,this.currentGutterNum=0,this.displayedAreas=[],this.hidedAreas=[],this.dragListeners=[],this.dragStartValues={sizePixelContainer:0,sizePixelA:0,sizePixelB:0,sizePercentA:0,sizePercentB:0}}return Object.defineProperty(SplitComponent.prototype,"direction",{get:function(){return this._direction},set:function(v){var _this=this;v="vertical"===v?"vertical":"horizontal",this._direction=v,this.displayedAreas.concat(this.hidedAreas).forEach(function(area){area.comp.setStyleVisibleAndDir(area.comp.visible,_this.isDragging,_this.direction)}),this.build(!1,!1)},enumerable:!0,configurable:!0}),Object.defineProperty(SplitComponent.prototype,"useTransition",{get:function(){return this._useTransition},set:function(v){v="boolean"==typeof v?v:"false"!==v,this._useTransition=v},enumerable:!0,configurable:!0}),Object.defineProperty(SplitComponent.prototype,"disabled",{get:function(){return this._disabled},set:function(v){v="boolean"==typeof v?v:"false"!==v,this._disabled=v,this.cdRef.markForCheck()},enumerable:!0,configurable:!0}),Object.defineProperty(SplitComponent.prototype,"width",{get:function(){return this._width},set:function(v){v=Number(v),this._width=!isNaN(v)&&v>0?v:null,this.build(!1,!1)},enumerable:!0,configurable:!0}),Object.defineProperty(SplitComponent.prototype,"height",{get:function(){return this._height},set:function(v){v=Number(v),this._height=!isNaN(v)&&v>0?v:null,this.build(!1,!1)},enumerable:!0,configurable:!0}),Object.defineProperty(SplitComponent.prototype,"gutterSize",{get:function(){return this._gutterSize},set:function(v){v=Number(v),this._gutterSize=!isNaN(v)&&v>0?v:11,this.build(!1,!1)},enumerable:!0,configurable:!0}),Object.defineProperty(SplitComponent.prototype,"gutterColor",{get:function(){return this._gutterColor},set:function(v){this._gutterColor="string"==typeof v&&""!==v?v:"",this.cdRef.markForCheck()},enumerable:!0,configurable:!0}),Object.defineProperty(SplitComponent.prototype,"gutterImageH",{get:function(){return this._gutterImageH},set:function(v){this._gutterImageH="string"==typeof v&&""!==v?v:"",this.cdRef.markForCheck()},enumerable:!0,configurable:!0}),Object.defineProperty(SplitComponent.prototype,"gutterImageV",{get:function(){return this._gutterImageV},set:function(v){this._gutterImageV="string"==typeof v&&""!==v?v:"",this.cdRef.markForCheck()},enumerable:!0,configurable:!0}),Object.defineProperty(SplitComponent.prototype,"dir",{get:function(){return this._dir},set:function(v){v="rtl"===v?"rtl":"ltr",this._dir=v},enumerable:!0,configurable:!0}),Object.defineProperty(SplitComponent.prototype,"cssFlexdirection",{get:function(){return"horizontal"===this.direction?"row":"column"},enumerable:!0,configurable:!0}),Object.defineProperty(SplitComponent.prototype,"cssWidth",{get:function(){return this.width?this.width+"px":"100%"},enumerable:!0,configurable:!0}),Object.defineProperty(SplitComponent.prototype,"cssHeight",{get:function(){return this.height?this.height+"px":"100%"},enumerable:!0,configurable:!0}),Object.defineProperty(SplitComponent.prototype,"cssMinwidth",{get:function(){return"horizontal"===this.direction?this.getNbGutters()*this.gutterSize+"px":null},enumerable:!0,configurable:!0}),Object.defineProperty(SplitComponent.prototype,"cssMinheight",{get:function(){return"vertical"===this.direction?this.getNbGutters()*this.gutterSize+"px":null},enumerable:!0,configurable:!0}),SplitComponent.prototype.ngAfterViewInit=function(){this.isViewInitialized=!0},SplitComponent.prototype.getNbGutters=function(){return this.displayedAreas.length-1},SplitComponent.prototype.addArea=function(comp){var newArea={comp:comp,order:0,size:0};!0===comp.visible?this.displayedAreas.push(newArea):this.hidedAreas.push(newArea),comp.setStyleVisibleAndDir(comp.visible,this.isDragging,this.direction),this.build(!0,!0)},SplitComponent.prototype.removeArea=function(comp){if(this.displayedAreas.some(function(a){return a.comp===comp})){area=this.displayedAreas.find(function(a){return a.comp===comp});this.displayedAreas.splice(this.displayedAreas.indexOf(area),1),this.build(!0,!0)}else if(this.hidedAreas.some(function(a){return a.comp===comp})){var area=this.hidedAreas.find(function(a){return a.comp===comp});this.hidedAreas.splice(this.hidedAreas.indexOf(area),1)}},SplitComponent.prototype.updateArea=function(comp,resetOrders,resetSizes){this.displayedAreas.find(function(a){return a.comp===comp})&&this.build(resetOrders,resetSizes)},SplitComponent.prototype.showArea=function(comp){var area=this.hidedAreas.find(function(a){return a.comp===comp});if(area){comp.setStyleVisibleAndDir(comp.visible,this.isDragging,this.direction);var areas=this.hidedAreas.splice(this.hidedAreas.indexOf(area),1);(_a=this.displayedAreas).push.apply(_a,areas),this.build(!0,!0)}var _a},SplitComponent.prototype.hideArea=function(comp){var area=this.displayedAreas.find(function(a){return a.comp===comp});if(area){comp.setStyleVisibleAndDir(comp.visible,this.isDragging,this.direction);var areas=this.displayedAreas.splice(this.displayedAreas.indexOf(area),1);areas.forEach(function(area){area.order=0,area.size=0}),(_a=this.hidedAreas).push.apply(_a,areas),this.build(!0,!0)}var _a},SplitComponent.prototype.build=function(resetOrders,resetSizes){var _this=this;if(this.stopDragging(),!0===resetOrders&&(this.displayedAreas.every(function(a){return null!==a.comp.order})&&this.displayedAreas.sort(function(a,b){return a.comp.order-b.comp.order}),this.displayedAreas.forEach(function(area,i){area.order=2*i,area.comp.setStyleOrder(area.order)})),!0===resetSizes){var totalUserSize=this.displayedAreas.reduce(function(total,s){return s.comp.size?total+s.comp.size:total},0);if(this.displayedAreas.every(function(a){return null!==a.comp.size})&&totalUserSize>.999&&totalUserSize<1.001)this.displayedAreas.forEach(function(area){area.size=area.comp.size});else{var size_1=1/this.displayedAreas.length;this.displayedAreas.forEach(function(area){area.size=size_1})}}var percentToDispatch=0,containerSizePixel=this.getNbGutters()*this.gutterSize;if(containerSizePixel="horizontal"===this.direction?this.width?this.width:this.elRef.nativeElement.offsetWidth:this.height?this.height:this.elRef.nativeElement.offsetHeight,this.displayedAreas.forEach(function(area){area.size*containerSizePixel<_this.gutterSize&&(percentToDispatch+=area.size,area.size=0)}),percentToDispatch>0&&this.displayedAreas.length>0){var nbAreasNotZero=this.displayedAreas.filter(function(a){return 0!==a.size}).length;if(nbAreasNotZero>0){var percentToAdd_1=percentToDispatch/nbAreasNotZero;this.displayedAreas.filter(function(a){return 0!==a.size}).forEach(function(area){area.size+=percentToAdd_1})}else this.displayedAreas[this.displayedAreas.length-1].size=1}this.refreshStyleSizes(),this.cdRef.markForCheck()},SplitComponent.prototype.refreshStyleSizes=function(){var _this=this,sumGutterSize=this.getNbGutters()*this.gutterSize;this.displayedAreas.forEach(function(area){area.comp.setStyleFlexbasis("calc( "+100*area.size+"% - "+area.size*sumGutterSize+"px )",_this.isDragging)})},SplitComponent.prototype.startDragging=function(startEvent,gutterOrder,gutterNum){var _this=this;if(startEvent.preventDefault(),this.currentGutterNum=gutterNum,this.draggingWithoutMove=!0,this.ngZone.runOutsideAngular(function(){_this.dragListeners.push(_this.renderer.listen("document","mouseup",function(e){return _this.stopDragging()})),_this.dragListeners.push(_this.renderer.listen("document","touchend",function(e){return _this.stopDragging()})),_this.dragListeners.push(_this.renderer.listen("document","touchcancel",function(e){return _this.stopDragging()}))}),!this.disabled){var areaA=this.displayedAreas.find(function(a){return a.order===gutterOrder-1}),areaB=this.displayedAreas.find(function(a){return a.order===gutterOrder+1});if(areaA&&areaB){var prop="horizontal"===this.direction?"offsetWidth":"offsetHeight";this.dragStartValues.sizePixelContainer=this.elRef.nativeElement[prop],this.dragStartValues.sizePixelA=areaA.comp.getSizePixel(prop),this.dragStartValues.sizePixelB=areaB.comp.getSizePixel(prop),this.dragStartValues.sizePercentA=areaA.size,this.dragStartValues.sizePercentB=areaB.size;var start;if(startEvent instanceof MouseEvent)start={x:startEvent.screenX,y:startEvent.screenY};else{if(!(startEvent instanceof TouchEvent))return;start={x:startEvent.touches[0].screenX,y:startEvent.touches[0].screenY}}this.ngZone.runOutsideAngular(function(){_this.dragListeners.push(_this.renderer.listen("document","mousemove",function(e){return _this.dragEvent(e,start,areaA,areaB)})),_this.dragListeners.push(_this.renderer.listen("document","touchmove",function(e){return _this.dragEvent(e,start,areaA,areaB)}))}),areaA.comp.lockEvents(),areaB.comp.lockEvents(),this.isDragging=!0,this.notify("start")}}},SplitComponent.prototype.dragEvent=function(event,start,areaA,areaB){if(this.isDragging){var end;if(event instanceof MouseEvent)end={x:event.screenX,y:event.screenY};else{if(!(event instanceof TouchEvent))return;end={x:event.touches[0].screenX,y:event.touches[0].screenY}}this.draggingWithoutMove=!1,this.drag(start,end,areaA,areaB)}},SplitComponent.prototype.drag=function(start,end,areaA,areaB){var devicePixelRatio=window.devicePixelRatio||1,offsetPixel="horizontal"===this.direction?start.x-end.x:start.y-end.y;offsetPixel/=devicePixelRatio,"rtl"===this.dir&&(offsetPixel=-offsetPixel);var newSizePixelA=this.dragStartValues.sizePixelA-offsetPixel,newSizePixelB=this.dragStartValues.sizePixelB+offsetPixel;newSizePixelA<this.gutterSize&&newSizePixelB<this.gutterSize||(newSizePixelA<this.gutterSize?(newSizePixelB+=newSizePixelA,newSizePixelA=0):newSizePixelB<this.gutterSize&&(newSizePixelA+=newSizePixelB,newSizePixelB=0),0===newSizePixelA?(areaB.size+=areaA.size,areaA.size=0):0===newSizePixelB?(areaA.size+=areaB.size,areaB.size=0):0===this.dragStartValues.sizePercentA?(areaB.size=this.dragStartValues.sizePercentB/this.dragStartValues.sizePixelB*newSizePixelB,areaA.size=this.dragStartValues.sizePercentB-areaB.size):0===this.dragStartValues.sizePercentB?(areaA.size=this.dragStartValues.sizePercentA/this.dragStartValues.sizePixelA*newSizePixelA,areaB.size=this.dragStartValues.sizePercentA-areaA.size):(areaA.size=this.dragStartValues.sizePercentA/this.dragStartValues.sizePixelA*newSizePixelA,areaB.size=this.dragStartValues.sizePercentA+this.dragStartValues.sizePercentB-areaA.size),this.refreshStyleSizes(),this.notify("progress"))},SplitComponent.prototype.stopDragging=function(){if(!1!==this.isDragging||!1!==this.draggingWithoutMove){for(this.displayedAreas.forEach(function(area){area.comp.unlockEvents()});this.dragListeners.length>0;){var fct=this.dragListeners.pop();fct&&fct()}!0===this.draggingWithoutMove?this.notify("click"):this.notify("end"),this.isDragging=!1,this.draggingWithoutMove=!1}},SplitComponent.prototype.notify=function(type){var areasSize=this.displayedAreas.map(function(a){return 100*a.size});switch(type){case"start":return this.dragStart.emit({gutterNum:this.currentGutterNum,sizes:areasSize});case"progress":return this.dragProgress.emit({gutterNum:this.currentGutterNum,sizes:areasSize});case"end":return this.dragEnd.emit({gutterNum:this.currentGutterNum,sizes:areasSize});case"click":return this.gutterClick.emit({gutterNum:this.currentGutterNum,sizes:areasSize});case"transitionEnd":return this.transitionEndInternal.next(areasSize)}},SplitComponent.prototype.ngOnDestroy=function(){this.stopDragging()},SplitComponent.decorators=[{type:core.Component,args:[{selector:"split",changeDetection:core.ChangeDetectionStrategy.OnPush,styles:["\n :host {\n display: flex;\n flex-wrap: nowrap;\n justify-content: flex-start;\n align-items: stretch;\n overflow: hidden;\n /* \n Important to keep following rules even if overrided later by 'HostBinding' \n because if [width] & [height] not provided, when build() is executed,\n 'HostBinding' hasn't been applied yet so code:\n this.elRef.nativeElement[\"offsetHeight\"] gives wrong value! \n */\n width: 100%;\n height: 100%; \n }\n\n split-gutter {\n flex-grow: 0;\n flex-shrink: 0;\n background-position: center center;\n background-repeat: no-repeat;\n }\n "],template:'\n <ng-content></ng-content>\n <ng-template ngFor let-area [ngForOf]="displayedAreas" let-index="index" let-last="last">\n <split-gutter *ngIf="last === false" \n [order]="index*2+1"\n [direction]="direction"\n [useTransition]="useTransition"\n [size]="gutterSize"\n [color]="gutterColor"\n [imageH]="gutterImageH"\n [imageV]="gutterImageV"\n [disabled]="disabled"\n (mousedown)="startDragging($event, index*2+1, index+1)"\n (touchstart)="startDragging($event, index*2+1, index+1)"></split-gutter>\n </ng-template>'}]}],SplitComponent.ctorParameters=function(){return[{type:core.NgZone},{type:core.ElementRef},{type:core.ChangeDetectorRef},{type:core.Renderer2}]},SplitComponent.propDecorators={direction:[{type:core.Input}],useTransition:[{type:core.Input}],disabled:[{type:core.Input}],width:[{type:core.Input}],height:[{type:core.Input}],gutterSize:[{type:core.Input}],gutterColor:[{type:core.Input}],gutterImageH:[{type:core.Input}],gutterImageV:[{type:core.Input}],dir:[{type:core.Input}],dragStart:[{type:core.Output}],dragProgress:[{type:core.Output}],dragEnd:[{type:core.Output}],gutterClick:[{type:core.Output}],transitionEnd:[{type:core.Output}],cssFlexdirection:[{type:core.HostBinding,args:["style.flex-direction"]}],cssWidth:[{type:core.HostBinding,args:["style.width"]}],cssHeight:[{type:core.HostBinding,args:["style.height"]}],cssMinwidth:[{type:core.HostBinding,args:["style.min-width"]}],cssMinheight:[{type:core.HostBinding,args:["style.min-height"]}]},SplitComponent}(),SplitAreaDirective=function(){function SplitAreaDirective(ngZone,elRef,renderer,split){this.ngZone=ngZone,this.elRef=elRef,this.renderer=renderer,this.split=split,this._order=null,this._size=null,this._minSize=0,this._visible=!0,this.lockListeners=[]}return Object.defineProperty(SplitAreaDirective.prototype,"order",{get:function(){return this._order},set:function(v){v=Number(v),this._order=isNaN(v)?null:v,this.split.updateArea(this,!0,!1)},enumerable:!0,configurable:!0}),Object.defineProperty(SplitAreaDirective.prototype,"size",{get:function(){return this._size},set:function(v){v=Number(v),this._size=!isNaN(v)&&v>=0&&v<=100?v/100:null,this.split.updateArea(this,!1,!0)},enumerable:!0,configurable:!0}),Object.defineProperty(SplitAreaDirective.prototype,"minSize",{get:function(){return this._minSize},set:function(v){v=Number(v),this._minSize=!isNaN(v)&&v>0&&v<100?v/100:0,this.split.updateArea(this,!1,!0)},enumerable:!0,configurable:!0}),Object.defineProperty(SplitAreaDirective.prototype,"visible",{get:function(){return this._visible},set:function(v){v="boolean"==typeof v?v:"false"!==v,this._visible=v,this.visible?this.split.showArea(this):this.split.hideArea(this)},enumerable:!0,configurable:!0}),SplitAreaDirective.prototype.ngOnInit=function(){var _this=this;this.split.addArea(this),this.renderer.setStyle(this.elRef.nativeElement,"flex-grow","0"),this.renderer.setStyle(this.elRef.nativeElement,"flex-shrink","0"),this.ngZone.runOutsideAngular(function(){_this.transitionListener=_this.renderer.listen(_this.elRef.nativeElement,"transitionend",function(e){return _this.onTransitionEnd(e)})})},SplitAreaDirective.prototype.getSizePixel=function(prop){return this.elRef.nativeElement[prop]},SplitAreaDirective.prototype.setStyleVisibleAndDir=function(isVisible,isDragging,direction){!1===isVisible?(this.setStyleFlexbasis("0",isDragging),this.renderer.setStyle(this.elRef.nativeElement,"overflow-x","hidden"),this.renderer.setStyle(this.elRef.nativeElement,"overflow-y","hidden"),"vertical"===direction&&this.renderer.setStyle(this.elRef.nativeElement,"max-width","0")):(this.renderer.setStyle(this.elRef.nativeElement,"overflow-x","hidden"),this.renderer.setStyle(this.elRef.nativeElement,"overflow-y","auto"),this.renderer.removeStyle(this.elRef.nativeElement,"max-width")),"horizontal"===direction?(this.renderer.setStyle(this.elRef.nativeElement,"height","100%"),this.renderer.removeStyle(this.elRef.nativeElement,"width")):(this.renderer.setStyle(this.elRef.nativeElement,"width","100%"),this.renderer.removeStyle(this.elRef.nativeElement,"height"))},SplitAreaDirective.prototype.setStyleOrder=function(value){this.renderer.setStyle(this.elRef.nativeElement,"order",value)},SplitAreaDirective.prototype.setStyleFlexbasis=function(value,isDragging){!1===this.split.isViewInitialized||!0===isDragging?this.setStyleTransition(!1):this.setStyleTransition(this.split.useTransition),this.renderer.setStyle(this.elRef.nativeElement,"flex-basis",value)},SplitAreaDirective.prototype.setStyleTransition=function(useTransition){useTransition?this.renderer.setStyle(this.elRef.nativeElement,"transition","flex-basis 0.3s"):this.renderer.removeStyle(this.elRef.nativeElement,"transition")},SplitAreaDirective.prototype.onTransitionEnd=function(event){"flex-basis"===event.propertyName&&this.split.notify("transitionEnd")},SplitAreaDirective.prototype.lockEvents=function(){var _this=this;this.ngZone.runOutsideAngular(function(){_this.lockListeners.push(_this.renderer.listen(_this.elRef.nativeElement,"selectstart",function(e){return!1})),_this.lockListeners.push(_this.renderer.listen(_this.elRef.nativeElement,"dragstart",function(e){return!1}))})},SplitAreaDirective.prototype.unlockEvents=function(){for(;this.lockListeners.length>0;){var fct=this.lockListeners.pop();fct&&fct()}},SplitAreaDirective.prototype.ngOnDestroy=function(){this.unlockEvents(),this.transitionListener&&this.transitionListener(),this.split.removeArea(this)},SplitAreaDirective.decorators=[{type:core.Directive,args:[{selector:"split-area"}]}],SplitAreaDirective.ctorParameters=function(){return[{type:core.NgZone},{type:core.ElementRef},{type:core.Renderer2},{type:SplitComponent}]},SplitAreaDirective.propDecorators={order:[{type:core.Input}],size:[{type:core.Input}],minSize:[{type:core.Input}],visible:[{type:core.Input}]},SplitAreaDirective}(),SplitGutterDirective=function(){function SplitGutterDirective(elRef,renderer){this.elRef=elRef,this.renderer=renderer,this._disabled=!1}return Object.defineProperty(SplitGutterDirective.prototype,"order",{set:function(v){this.renderer.setStyle(this.elRef.nativeElement,"order",v)},enumerable:!0,configurable:!0}),Object.defineProperty(SplitGutterDirective.prototype,"direction",{get:function(){return this._direction},set:function(v){this._direction=v,this.refreshStyle()},enumerable:!0,configurable:!0}),Object.defineProperty(SplitGutterDirective.prototype,"useTransition",{set:function(v){v?this.renderer.setStyle(this.elRef.nativeElement,"transition","flex-basis 0.3s"):this.renderer.removeStyle(this.elRef.nativeElement,"transition")},enumerable:!0,configurable:!0}),Object.defineProperty(SplitGutterDirective.prototype,"size",{get:function(){return this._size},set:function(v){this._size=v,this.refreshStyle()},enumerable:!0,configurable:!0}),Object.defineProperty(SplitGutterDirective.prototype,"color",{get:function(){return this._color},set:function(v){this._color=v,this.refreshStyle()},enumerable:!0,configurable:!0}),Object.defineProperty(SplitGutterDirective.prototype,"imageH",{get:function(){return this._imageH},set:function(v){this._imageH=v,this.refreshStyle()},enumerable:!0,configurable:!0}),Object.defineProperty(SplitGutterDirective.prototype,"imageV",{get:function(){return this._imageV},set:function(v){this._imageV=v,this.refreshStyle()},enumerable:!0,configurable:!0}),Object.defineProperty(SplitGutterDirective.prototype,"disabled",{get:function(){return this._disabled},set:function(v){this._disabled=v,this.refreshStyle()},enumerable:!0,configurable:!0}),SplitGutterDirective.prototype.refreshStyle=function(){this.renderer.setStyle(this.elRef.nativeElement,"flex-basis",this.size+"px"),this.renderer.setStyle(this.elRef.nativeElement,"height","vertical"===this.direction?this.size+"px":"100%"),this.renderer.setStyle(this.elRef.nativeElement,"background-color",""!==this.color?this.color:"#eeeeee");var state=!0===this.disabled?"disabled":this.direction;this.renderer.setStyle(this.elRef.nativeElement,"background-image",this.getImage(state)),this.renderer.setStyle(this.elRef.nativeElement,"cursor",this.getCursor(state))},SplitGutterDirective.prototype.getCursor=function(state){switch(state){case"horizontal":return"col-resize";case"vertical":return"row-resize";case"disabled":return"default"}},SplitGutterDirective.prototype.getImage=function(state){switch(state){case"horizontal":return""!==this.imageH?this.imageH:defaultImageH;case"vertical":return""!==this.imageV?this.imageV:defaultImageV;case"disabled":return""}},SplitGutterDirective.decorators=[{type:core.Directive,args:[{selector:"split-gutter"}]}],SplitGutterDirective.ctorParameters=function(){return[{type:core.ElementRef},{type:core.Renderer2}]},SplitGutterDirective.propDecorators={order:[{type:core.Input}],direction:[{type:core.Input}],useTransition:[{type:core.Input}],size:[{type:core.Input}],color:[{type:core.Input}],imageH:[{type:core.Input}],imageV:[{type:core.Input}],disabled:[{type:core.Input}]},SplitGutterDirective}(),defaultImageH='url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAeCAYAAADkftS9AAAAIklEQVQoU2M4c+bMfxAGAgYYmwGrIIiDjrELjpo5aiZeMwF+yNnOs5KSvgAAAABJRU5ErkJggg==")',defaultImageV='url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAFCAMAAABl/6zIAAAABlBMVEUAAADMzMzIT8AyAAAAAXRSTlMAQObYZgAAABRJREFUeAFjYGRkwIMJSeMHlBkOABP7AEGzSuPKAAAAAElFTkSuQmCC")',AngularSplitModule=function(){function AngularSplitModule(){}return AngularSplitModule.forRoot=function(){return{ngModule:AngularSplitModule,providers:[]}},AngularSplitModule.forChild=function(){return{ngModule:AngularSplitModule,providers:[]}},AngularSplitModule.decorators=[{type:core.NgModule,args:[{imports:[common.CommonModule],declarations:[SplitComponent,SplitAreaDirective,SplitGutterDirective],exports:[SplitComponent,SplitAreaDirective]}]}],AngularSplitModule}();exports.AngularSplitModule=AngularSplitModule,exports.SplitComponent=SplitComponent,exports.SplitAreaDirective=SplitAreaDirective,exports.ɵa=SplitGutterDirective,Object.defineProperty(exports,"__esModule",{value:!0})});