@micropermit/client-angular 0.4.4-alpha2 → 0.4.4-alpha3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/micropermit-client-angular.umd.js +1 -0
- package/bundles/micropermit-client-angular.umd.js.map +1 -1
- package/bundles/micropermit-client-angular.umd.min.js +1 -1
- package/bundles/micropermit-client-angular.umd.min.js.map +1 -1
- package/esm2015/lib/directives/linkfield.directive.js +2 -1
- package/esm5/lib/directives/linkfield.directive.js +2 -1
- package/fesm2015/micropermit-client-angular.js +1 -0
- package/fesm2015/micropermit-client-angular.js.map +1 -1
- package/fesm5/micropermit-client-angular.js +1 -0
- package/fesm5/micropermit-client-angular.js.map +1 -1
- package/micropermit-client-angular.metadata.json +1 -1
- package/package.json +1 -1
|
@@ -12,5 +12,5 @@
|
|
|
12
12
|
|
|
13
13
|
See the Apache Version 2.0 License for specific language governing permissions
|
|
14
14
|
and limitations under the License.
|
|
15
|
-
***************************************************************************** */var l=function(t,e){return(l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(t,e)};function u(t,e){function i(){this.constructor=t}l(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}function c(t){var e="function"==typeof Symbol&&t[Symbol.iterator],i=0;return e?e.call(t):{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}}}function h(t,e){var i="function"==typeof Symbol&&t[Symbol.iterator];if(!i)return t;var n,r,o=i.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(t){r={error:t}}finally{try{n&&!n.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}return a}var p=function(){function t(){}return t.addParam=function(e,i,n,r){void 0===r&&(r=!0);var o=e.indexOf("?")>=0;o||(e+="?");var a=t.getParam(e,i);return null!=a&&r?e=e.replace(i+"="+a,i+"="+n):(o&&(e+="&"),e+=i+"="+n),e},t.setParams=function(t,e){var i=t.split("?")[0],n=!0;for(var r in e)e.hasOwnProperty(r)&&(n&&(i+="?",n=!1),i+=r+"="+e[r]);return i},t.getParams=function(t){var e,i,n=t.split("?");if(n.length<2)return{};var r={},o=n[1].split("&");try{for(var a=c(o),s=a.next();!s.done;s=a.next()){var l=s.value.split("=",2),u=l[0];2===l.length?r[u]=l[1]:r[u]=null}}catch(t){e={error:t}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(e)throw e.error}}return r},t.base64UrlEncode=function(e){return btoa(e).replace(t.plusRegex,"-").replace(t.slashRegex,"_").replace(t.multiEqualRegex,"")},t.base64UrlDecode=function(e){return e=(e+"===").slice(0,e.length+e.length%4),atob(e.replace(t.minusRegex,"+").replace(t.underscoreRegex,"/"))},t.needsBase64UrlEncoding=function(t){return null!=t&&"object"==typeof t},t.getParam=function(t,e,i){void 0===i&&(i=!1);var n=t.indexOf("?");t=t.substr(n);var r=new RegExp("[?&]"+encodeURIComponent(e)+"=([^&]*)").exec(t);return r?i&&r[1]?this.base64UrlDecode(r[1]):r[1]:null},t.plusRegex=new RegExp("\\+"),t.slashRegex=new RegExp("/","g"),t.multiEqualRegex=new RegExp("=+$","g"),t.minusRegex=new RegExp("-","g"),t.underscoreRegex=new RegExp("_","g"),t}();var d=function(){function t(t,e,i,n){void 0===i&&(i=null),void 0===n&&(n=null),this.link=t,this.microClient=e,this.callParams=i,this.requestOptions=n,this.serializeTo=f.DONT_SERIALIZE}return t.prototype.hasLink=function(){return null!=this.link},t.prototype.getLink=function(){return this.link},t.prototype.getQueryParam=function(t,e){return void 0===e&&(e=!1),p.getParam(this.link,t,e)},t.prototype.getSignedParams=function(){var t=this.getSignedMicroObjectParam("params");return null==t&&(t=this.getSignedMicroObjectParam("bParams")),t},t.prototype.getOpenParams=function(t){void 0===t&&(t=!1);var e=this.getMicroObjectParam("oParams");return null==e?e=this.getMicroObjectParam("bOParams"):(t&&(e=g.fromString(JSON.stringify(e),this.microClient)),this.callParams&&(e=Object.assign(e,this.callParams))),e},t.prototype.getOptions=function(){var t=this.getMicroObjectParam("options");return this.requestOptions&&(null==t&&(t=new g),t=Object.assign(t,this.requestOptions)),t},t.prototype.getSignedMicroObjectParam=function(t){var e=p.getParam(this.link,t,!1),i=null;if(e){var n=e.split(".");if(3!==n.length)throw new Error("Expected a signed query param to have a JWT like structure");i=g.fromString(atob(n[1]),this.microClient)}return i},t.prototype.getMicroObjectParam=function(t){var e=p.getParam(this.link,t,!0),i=null;return e&&(i=g.fromString(e,this.microClient)),i},t.prototype.call=function(t){return this.callWith(null,null,t)},t.prototype.callWith=function(t,e,i){return void 0===t&&(t=null),void 0===e&&(e=null),this.callWithObs(t,e).toPromise().then(i)},t.prototype.callWithObs=function(t,e){if(void 0===t&&(t=null),void 0===e&&(e=null),null==this.link)throw Error("Can't use callWithObs without a provided link");if(null==this.microClient)throw Error("Can't use callWithObs without a provided microClient");var i=null;null!=this.callParams&&(i=Object.assign(new g,this.callParams)),t&&(null==i&&(i=new g),i=Object.assign(i,t));var n=null;return null!=this.requestOptions&&(n=Object.assign(new g,this.requestOptions)),e&&(null==n&&(n=new g),n=Object.assign(n,e)),this.microClient.load(this.link,i,n)},t.prototype.copy=function(){return new t(this.link,this.microClient,this.callParams,this.requestOptions)},t.prototype.withCallParams=function(e,i){return void 0===i&&(i=this.requestOptions),new t(this.link,this.microClient,e,i)},t.prototype.toJSON=function(){return this.serializeTo?this.serializeTo(this.link,this.callParams,this.requestOptions,void 0,void 0):void 0},t}();var f=function(){function t(){}return t.DONT_SERIALIZE=function(){},t.AS_LINK=function(t){return t},t.AS_VALUE_IF_INITIALIZED=function(t,e,i,n,r){return r?n:void 0},t}();var m=function(t){function e(e,i,n,r,o,a){void 0===n&&(n=null),void 0===r&&(r=!1),void 0===o&&(o=null),void 0===a&&(a=null);var s=t.call(this,e,i,o,a)||this;return s.initialized=!1,s.serializeTo=f.AS_VALUE_IF_INITIALIZED,s.intervalId=null,s.isRefreshing=!1,r&&s.set(n),s}return u(e,t),e.from=function(t){return new e(null,null,t,!0)},e.prototype.get=function(t){return t?(this.getObs().subscribe(t),null):this.getPromise()},e.prototype.getPromise=function(){return this._getPromise||(this._getPromise=this.getObs().toPromise()),this._getPromise},e.prototype.refresh=function(t,e){var i=this;t&&this.stopRefresh();var n=function(){i.isRefreshing=!1};this.isRefreshing=!0,this.initWithObs().subscribe(n,(function(t){n(),e&&e(t)}),n),t&&(this.intervalId=setInterval((function(){i.isRefreshing||(i.isRefreshing=!0,i.initWithObs().subscribe(n,(function(t){n(),e&&e(t)}),n))}),t))},e.prototype.stopRefresh=function(){this.intervalId&&clearInterval(this.intervalId)},e.prototype.listenObs=function(){var t=this;if(this.valueSubj)return this.valueSubj;var e=new n.ReplaySubject(1);return this.valueSubj=e,n.defer((function(){return t.initWithObs(null,null).subscribe((function(i){t.valueSubj!==e&&(e.next(i),e.complete())})),e}))},e.prototype.getObs=function(){return this.listenObs().pipe(r.take(1))},e.prototype.set=function(t){var e=this.value;return this.value=t,this.initialized=!0,this.valueSubj||(this.valueSubj=new n.ReplaySubject(1)),this.valueSubj.next(t),this._getPromise=null,e},e.prototype.isInitialized=function(){return this.initialized},e.prototype.uninitialize=function(){this.value=null,this.initialized=!1,this.valueSubj=null,this._getPromise=null},e.prototype.copyUninitialized=function(){var t=this.copy();return t.uninitialize(),t},e.prototype.getInitializedValue=function(){if(!this.isInitialized())throw new Error("Can't get the intialized value for a LinkField that hasn't been initialized");return this.value},e.prototype.initWith=function(t,e,i){void 0===t&&(t=null),void 0===e&&(e=null),this.initWithObs(t,e).subscribe(i)},e.prototype.initWithObs=function(t,e){var i=this;return void 0===t&&(t=null),void 0===e&&(e=null),this.callWithObs(t,e).pipe(r.map((function(t){return i.set(t),t})))},e.prototype.withCallParams=function(t,i){return void 0===i&&(i=this.requestOptions),new e(this.link,this.microClient,this.value,this.initialized,t,i)},e.prototype.copy=function(t){return void 0===t?new e(this.link,this.microClient,this.value,this.initialized,this.callParams,this.requestOptions):new e(this.link,this.microClient,t,!0,this.callParams,this.requestOptions)},e.prototype.toJSON=function(){return this.serializeTo?this.serializeTo(this.link,this.callParams,this.requestOptions,this.value,this.isInitialized()):void 0},e}(d);var g=function(){function t(){this.__meta=void 0}return t.deepCopy=function(e,i){return o.cloneDeepWith(e,t.deepCopyCustomizer)},t.deepCopyCustomizer=function(t){if(t instanceof b)return t},t.fromString=function(t,e,i){void 0===i&&(i=null);var n=JSON.parse(t);return this.fromObject(n,e,i)},t.fromObject=function(e,i,n){if(void 0===n&&(n=null),null===e)return null;if(Array.isArray(e)){for(var r=e,o=0;o<r.length;o++){var a=r[o];"object"==typeof a&&(r[o]=t.fromObject(a,i,n))}return r}for(var s in e)if(s!==t.META_KEY&&e.hasOwnProperty(s)){var l=e[s];l&&(l instanceof Object||Array.isArray(l))&&(e[s]=t.fromObject(l,i,n))}var u=null==n?t.prototype:n,c=Object.assign(Object.create(u),e);return t.attachMetadataObject(c,i),c},t.attachMetadataObject=function(e,i){var n=null!=e?e[t.META_KEY]:null;if(null==n)return null;var r=i;n.permitToken&&null!=i.getEntryPoint()&&(r=i.createChildClientForEntryPoint(e)),e.__meta=y.fromObject(e.__meta,r),t.attachLinkFields(e.__meta,e,r),t.attachCallableLinks(e.__meta,e,r)},t.attachLinkFields=function(t,e,i){t.forEachLink((function(t,n){var r=e[t];e[t]=new m(n,i,r,void 0!==r)}))},t.attachCallableLinks=function(t,e,i){t.forEachAction((function(t,n){e[t]=new d(n,i)}))},t.META_KEY="__meta",t}();var y=function(){function t(){}return t.fromObject=function(e,i){var n=Object.assign(new t,e);return null!=n.nextPage&&(n.nextPage=new m(n.nextPage,i),n.nextPage.serializeTo=f.AS_LINK),n},t.prototype.getLinkUrl=function(t){return this.links[t]},t.prototype.hasLink=function(t){return null!=this.links[t]},t.prototype.forEachLink=function(t){for(var e in this.links)this.links.hasOwnProperty(e)&&t(e,this.links[e])},t.prototype.forEachAction=function(t){for(var e in this.actions)this.actions.hasOwnProperty(e)&&t(e,this.actions[e])},t}();var v=function(){};var b=function(){function t(t){this.httpClient=t,this.entryPointSubject=new n.ReplaySubject,this.usePost=!0,this.sendAsPermitTokenHeader=!0,this.sendAsMultipartFormData=!1}return t.prototype.setSendAsPermitTokenHeader=function(t){this.sendAsPermitTokenHeader=t},t.prototype.setAuthToken=function(t){this.authHeader="Bearer "+t,this.permitToken=t},t.prototype.setAuthHeader=function(t){this.authHeader=t},t.prototype.getEntryPoint=function(){return this.entryPoint},t.prototype.waitForEntryPoint=function(t){return null!=t?(this.entryPointSubject.subscribe(t),null):this.entryPointSubject.toPromise()},t.prototype.copyAuthAndEntrypointOf=function(t){this.authHeader=t.authHeader,this.permitToken=t.permitToken,this.entryPoint=t.entryPoint},t.prototype.setEntryPoint=function(t){if(null==t)this.authHeader=null,this.entryPoint=null,this.permitToken=null;else{if(this.entryPoint=t,!this.entryPoint.__meta||!this.entryPoint.__meta.permitToken)throw Error('Expected the entryPoint to contain a "permitToken" within the "__meta" field');this.setAuthToken(this.entryPoint.__meta.permitToken),this.entryPointSubject.next(t)}},t.prototype.setDefaultErrorHandler=function(t){this.defaultErrorHandler=t},t.prototype.handleError=function(e){if(this.defaultErrorHandler)if(t.toMicroError(e)){var i=g.fromObject(e.error,this);this.defaultErrorHandler(e,i)}else this.defaultErrorHandler(e,null)},t.prototype.ignite=function(t,e,n,o){var a=this;void 0===e&&(e=null),void 0===n&&(n=null),void 0===o&&(o={}),this.urlRewriter&&(t=this.urlRewriter(t));var s=new i.HttpHeaders;for(var l in o)o.hasOwnProperty(l)&&(s=s.set(l,o[l]));return null==e&&null==n||(s=s.set("Authorization","Basic "+btoa(e+":"+n))),this.httpClient.get(t,{headers:s}).pipe(r.map((function(t){var e=g.fromObject(t,a);return a.setEntryPoint(e),e})),this.catchAndHandleError())},t.prototype.load=function(t,e,n){var o=this,a=new i.HttpHeaders;this.authHeader&&(a=a.set("Authorization",this.authHeader),this.sendAsPermitTokenHeader&&(a=a.set("MicroPermitToken",this.permitToken)));var s=e;if(null!=e||this.usePost){var l=p.getParam(t,"oParams",!0),u=void 0;u=l?JSON.parse(l):{},s=Object.assign(u,e)}var c=n;if(null!=n||this.usePost){var h=p.getParam(t,"options",!0);c=h?JSON.parse(h):{},c=Object.assign(c,n)}var d=p.getParams(t),f=null;if(this.usePost){var m=void 0,y=d.bOParams;y&&(m=JSON.parse(p.base64UrlDecode(y)));var v={params:d.params,oParams:s,bParams:d.bParams,bOParams:m,options:c};delete d.params,delete d.oParams,delete d.bParams,delete d.bOParams,delete d.options,t=p.setParams(t,d),this.urlRewriter&&(t=this.urlRewriter(t)),f=this.httpClient.post(t,this.encodeBody(v),{headers:a})}else s&&(d.oParams=p.base64UrlEncode(JSON.stringify(s))),c&&(d.options=p.base64UrlEncode(JSON.stringify(c))),t=p.setParams(t,d),this.urlRewriter&&(t=this.urlRewriter(t)),f=this.httpClient.get(t,{headers:a});return f=f.pipe(r.map((function(t){return g.fromObject(t,o)})),this.catchAndHandleError())},t.prototype.encodeBody=function(t){if(this.sendAsMultipartFormData){var e=new FormData,i=new Blob([JSON.stringify(t)],{type:"application/json"});return e.append("*",i),e}return t},t.prototype.catchAndHandleError=function(){var t=this;return(function(e){return e.pipe(r.catchError((function(e){var i=new k(e,(function(e){t.handleError(e)}));return n.throwError(i).pipe(r.finalize((function(){i.shouldPreventDefault()||i.handleDefault()})))})))})},t.prototype.createChildClientForEntryPoint=function(t){if(t.__meta&&t.__meta.permitToken){var e=Object.create(this,{entryPoint:{configurable:!0,enumerable:!0,writable:!0},authHeader:{configurable:!0,enumerable:!0,writable:!0},permitToken:{configurable:!0,enumerable:!0,writable:!0}});return e.setEntryPoint(t),e}throw new Error("The supplied value can't be used to construct a child MicroClient because it doesn't contain metadata with a permitToken ")},t.prototype.setURLRewriter=function(t){this.urlRewriter=t},t.toMicroError=function(t){var e=t.error;return e&&e.__meta&&e.__meta.error?Object.assign(new v,e.__meta.error):null},t.guessMicroComponentBaseURL=function(){var e=window.location.href;return t.staticContentRegExp.test(e)?e.replace(new RegExp("/static/.*"),"").replace(new RegExp("/#/.*"),""):window.location.protocol.startsWith("file")?"http://localhost:8080":window.location.protocol+"//"+window.location.hostname+":8080"},t.guessMicroComponentAuthorizeURL=function(){return this.guessMicroComponentBaseURL()+"/authorize"},t.staticContentRegExp=new RegExp("[a-zA-Z0-9]://.*(:[0-9]+)?(/.*)*/static(/.*(\\?.*)?(#.*)?)?"),t.decorators=[{type:e.Injectable}],t.ctorParameters=function(){return[{type:i.HttpClient}]},t}();var k=function(){function t(t,e){this.error=t,this.defaultHandler=e,this.handled=!1,this.doPreventDefault=!1}return t.prototype.handleDefault=function(){this.defaultHandler&&(this.defaultHandler(this.error),this.handled=!0)},t.prototype.handleError=function(t){t(this.error),this.handled=!0},t.prototype.isHandled=function(){return this.handled},t.prototype.shouldPreventDefault=function(){return this.doPreventDefault},t.prototype.preventDefault=function(){this.doPreventDefault=!0},t.prototype.hasDefaultHandler=function(){return null!=this.defaultHandler},t}();var C=function(){function t(){}return t.decorators=[{type:e.Component,args:[{selector:"mc-loadingindicator",template:'\n <div id="container">\n <div id="bar"></div>\n </div>\n ',styles:["\n #container {\n display: block;\n overflow: hidden;\n width: 100%;\n height: 5px;\n -webkit-transform: translate(0, 0) scale(1, 1);\n transform: translate(0, 0) scale(1, 1);\n background-color: #aad1f9;\n }\n #container #bar {\n transition: all .2s linear;\n -webkit-animation: query 0.8s infinite cubic-bezier(0.39, 0.575, 0.565, 1);\n animation: query 0.8s infinite cubic-bezier(0.39, 0.575, 0.565, 1);\n transition: -webkit-transform .2s linear;\n transition: transform .2s linear;\n background-color: #106cc8;\n width: 100%;\n height: 5px;\n }\n @keyframes query {\n 0% {\n opacity: 1;\n transform: translateX(35%) scale(0.3, 1);\n }\n 100% {\n opacity: 0;\n transform: translateX(-50%) scale(0, 1);\n }\n }\n "]}]}],t}(),w=function(){function t(t){this.asyncPipe=new a.AsyncPipe(t)}return t.prototype.ngOnDestroy=function(){this.asyncPipe.ngOnDestroy()},t.prototype.transform=function(t){if(null==t)return null;if(t instanceof m)return this.asyncPipe.transform(t.getObs());throw new Error("Can't use the linkField pipe with a value which isn't an instance of LinkField")},t.decorators=[{type:e.Pipe,args:[{name:"linkField",pure:!1}]}],t.ctorParameters=function(){return[{type:e.ChangeDetectorRef}]},t}();var P=function(){function t(){}return t.prototype.onClick=function(){this.error.handleDefault()},t.decorators=[{type:e.Component,args:[{selector:"mc-errorindicator",template:'\n <div class="blinking-error" [class.clickable]="error.hasDefaultHandler()" (click)="onClick()"></div>\n ',styles:["\n .blinking-error {\n background-image: linear-gradient(to right, tomato 0%, darkred 50%, tomato 100%);\n animation: blinkingText 0.5s 1;\n height: 5px;\n }\n\n .blinking-error.clickable {\n cursor: pointer;\n }\n\n @keyframes blinkingText {\n 0% {\n opacity: 0;\n }\n 50% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n }\n "]}]}],t.propDecorators={error:[{type:e.Input}]},t}();var O=function(){function t(t,e,i,n){this._viewContainer=t,this._template=e,this.componentResolver=i,this.changeDetectorRef=n,this.isDirty=!0,this.isLoading=!1,this.loadedResult=null,this.hasResult=!1,this.subscription=null,this.linkFieldDefaultErrorHandling=!1,this.linkFieldParams=null,this._defaultLoadingComponent=i.resolveComponentFactory(C),this._defaultErrorComponent=i.resolveComponentFactory(P)}return Object.defineProperty(t.prototype,"linkFieldFrom",{set:function(t){this._from=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"linkFieldLoadingTemplate",{set:function(t){t&&(this._loadingTemplate=t),this.updateIfDirty(!0)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"linkFieldErrorTemplate",{set:function(t){t&&(this._errorTemplate=t),this.updateIfDirty(!0)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"linkFieldTemplate",{set:function(t){t&&(this._template=t)},enumerable:!0,configurable:!0}),t.prototype.load=function(){var t=this;this._from&&(this._from instanceof m?(this.setLoading(!0),this.lastObs=this._from.listenObs(),this.subscription&&this.subscription.unsubscribe(),this.subscription=this.lastObs.pipe(r.finalize((function(){t.setLoading(!1)}))).subscribe((function(e){t.setLoadedResult(e),t.linkFieldValueChange&&t.linkFieldValueChange(e)}),(function(e){t.linkFieldDefaultErrorHandling||e.preventDefault(),t.setError(e)}))):this.setLoadedResult(this._from))},t.prototype.ngDoCheck=function(){this.updateIfDirty()},t.prototype.ngOnDestroy=function(){this.clear()},t.prototype.ngOnChanges=function(t){if(t.linkFieldFrom&&(this._from instanceof m||(this._from=m.from(this._from)),t.linkFieldFrom.previousValue!==t.linkFieldFrom.currentValue&&(this.clear(),this.load())),t.linkFieldParams&&this.linkFieldParams){var e=this._from;this._from=e.withCallParams(this.linkFieldParams)}},t.prototype.setError=function(t){(this._viewContainer.remove(),this._errorTemplate)?this._viewContainer.createEmbeddedView(this._errorTemplate,{$implicit:t}):this._viewContainer.createComponent(this._defaultErrorComponent).instance.error=t},t.prototype.setLoading=function(t){this.isLoading=t,this.isLoading&&(this._loadingTemplate?(this._viewContainer.remove(),this._viewContainer.createEmbeddedView(this._loadingTemplate)):(this._viewContainer.remove(),this._viewContainer.createComponent(this._defaultLoadingComponent)))},t.prototype.setLoadedResult=function(t){this.hasResult=!0,this.loadedResult=t,null==this.currentContext?(this.currentContext=new _(t),this.isDirty=!0):(this.currentContext.$implicit=t,this.changeDetectorRef.markForCheck()),this._viewContainer&&this._template?this.isDirty&&(this._viewContainer.remove(),this._viewContainer.createEmbeddedView(this._template,this.currentContext)):this.isDirty=!0},t.prototype.updateIfDirty=function(t){void 0===t&&(t=!1),(this.isDirty||t)&&this._loadingTemplate&&this._from&&this._template&&this._viewContainer&&(this.hasResult&&this.setLoadedResult(this.loadedResult),this.isDirty=!1)},t.prototype.clear=function(){this.hasResult=!1,this.loadedResult=null,this.isDirty=!1,this.subscription&&(this.subscription.unsubscribe(),this.subscription=null),this.lastObs=null,this.currentContext=null},t.decorators=[{type:e.Directive,args:[{selector:"[linkField][linkFieldFrom]"}]}],t.ctorParameters=function(){return[{type:e.ViewContainerRef},{type:e.TemplateRef},{type:e.ComponentFactoryResolver},{type:e.ChangeDetectorRef}]},t.propDecorators={linkFieldFrom:[{type:e.Input}],linkFieldLoadingTemplate:[{type:e.Input}],linkFieldErrorTemplate:[{type:e.Input}],linkFieldTemplate:[{type:e.Input}],linkFieldDefaultErrorHandling:[{type:e.Input}],linkFieldValueChange:[{type:e.Input}],linkFieldParams:[{type:e.Input}]},t}();var _=function(t){this.$implicit=t};var E=function(){function t(){this.callStatusChange=new e.EventEmitter,this.callSucess=new e.EventEmitter,this.callFinish=new e.EventEmitter,this.callError=new e.EventEmitter,this.callStart=new e.EventEmitter}return t.prototype.onClick=function(){var t=this;this.callLink.callWithObs(this.callParameters,this.callOptions).subscribe((function(e){t.callSucess.emit(e),t.callStatusChange.emit(new L(t.callLink,S.SUCCESS,e,null))}),(function(e){t.callError.emit(e),t.callStatusChange.emit(new L(t.callLink,S.ERROR,null,e))}),(function(){t.callFinish.emit()})),this.callStatusChange.emit(new L(this.callLink,S.CALLING,null,null))},t.decorators=[{type:e.Directive,args:[{selector:"[callLink]"}]}],t.propDecorators={callLink:[{type:e.Input}],callStatusChange:[{type:e.Output}],callSucess:[{type:e.Output}],callFinish:[{type:e.Output}],callError:[{type:e.Output}],callStart:[{type:e.Output}],callOptions:[{type:e.Input}],callParameters:[{type:e.Input}],onClick:[{type:e.HostListener,args:["click"]}]},t}();var L=function(t,e,i,n){this.link=t,this.state=e,this.response=i,this.error=n};var S={CALLING:0,SUCCESS:1,ERROR:2};S[S.CALLING]="CALLING",S[S.SUCCESS]="SUCCESS",S[S.ERROR]="ERROR";var R=function(){function t(){this.UNSET="",this.microLinkValidateField=null,this.microLinkValidateValue=this.UNSET,this.microLinkValidateDebounce=500}return t.prototype.validate=function(t){var e=this;return n.timer(this.microLinkValidateDebounce).pipe(r.switchMap((function(){var i=e.microLinkValidateValue;i===e.UNSET&&(i=t.value);var n={};return e.microLinkValidateField?n[e.microLinkValidateField]=i:n=i,e.microLinkValidate.callWithObs(n,null).pipe(r.map((function(t){var i=!1;if(e.microLinkValidateField)null!=t[e.microLinkValidateField]&&(i=!0);else for(var n in t)null!=t[n]&&(i=!0);return i?(e.result=t,{validateMicroLink:e.result}):(e.result=null,null)})))})))},t.prototype.getControlName=function(t){var e=null,i=t.parent;return i instanceof s.FormGroup&&Object.keys(i.controls).forEach((function(n){t===i.controls[n]&&(e=n)})),e},t.decorators=[{type:e.Directive,args:[{selector:"[microLinkValidate]",providers:[{provide:s.NG_ASYNC_VALIDATORS,useExisting:e.forwardRef((function(){return t})),multi:!0}],exportAs:"microValidator"}]}],t.propDecorators={microLinkValidate:[{type:e.Input}],microLinkValidateField:[{type:e.Input}],microLinkValidateValue:[{type:e.Input}],microLinkValidateDebounce:[{type:e.Input}]},t}();var j=function(){function t(){}return t.forClientRoot=function(){return{ngModule:t,providers:[b]}},t.decorators=[{type:e.NgModule,args:[{entryComponents:[C,P],imports:[i.HttpClientModule],declarations:[w,O,E,C,P,R],exports:[w,O,E,P,C,R]}]}],t}(),x=function(){function t(t,e,i){var n=this;void 0===i&&(i=200),this.pageLink=t,this.changeDetectorRef=e,this.pageLimit=i,this.sorts=null,this.isLoading=!1,this.loadedCompletely=!1,this.hasLoaded=!1,this._rows=null,this.loadingSubscription=null,this.loadingCallback=function(){n.setLoading(!1)}}return Object.defineProperty(t.prototype,"rows",{get:function(){return this.hasLoaded||this.loadNextPage(),this._rows},enumerable:!0,configurable:!0}),t.from=function(e,i,n){return void 0===n&&(n=200),new t(e,i,n)},t.prototype.applySort=function(t,e){void 0===e&&(e=!0),this.hasLoaded=!1,this.sorts=null,this._rows=null,e?(this.sorts=t,this.loadNextPage()):this.loadedCompletely?this.changeDetectorRef.detectChanges():this.loadNextPage(null)},t.prototype.loadNextPage=function(t,e){var i=this;if(void 0===t&&(t=this.pageLimit),void 0===e&&(e=null),this.pageLink&&!this.isLoading)if(this.loadingSubscription&&(this.loadingSubscription.unsubscribe(),this.loadingSubscription=null),this.hasLoaded=!0,this.loadedCompletely=!1,null==this._rows){this.setLoading(!0);var n={};null!=this.sorts&&(n.sorting=this.sorts),null!=t&&(n.pageSize=t),this.loadingSubscription=this.pageLink.initWithObs(null,n).subscribe((function(t){i.setRows(t,e)}),this.loadingCallback,this.loadingCallback)}else{var r=this.lastRow();if(r&&r.__meta.nextPage){n=null;null!=t&&(n={pageSize:t});var o=r.__meta.nextPage.initWithObs(null,n);o&&(this.setLoading(!0),this.loadingSubscription=o.subscribe((function(t){i.setRows(t,e)}),this.loadingCallback,this.loadingCallback))}}else this.pageLink||this.clearRows()},t.prototype.loadEverything=function(){this.loadNextPage(null)},t.prototype.lastRow=function(){return this._rows[this._rows.length-1]},t.prototype.setRows=function(t,e){this._rows?this._rows=function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(h(arguments[e]));return t}(this.rows,t):this._rows=t,e&&e(t,this._rows),this.reflectChanges()},t.prototype.clearRows=function(){null!=this._rows&&(this._rows=null,this.reflectChanges())},t.prototype.reflectChanges=function(){var t=this.lastRow();t&&t.__meta?this.loadedCompletely=null==t.__meta.nextPage:this.loadedCompletely=!1,this.rowsChangeCallback&&this.rowsChangeCallback(this._rows),this.changeDetectorRef.detectChanges()},t.prototype.setLoading=function(t){this.isLoading=t,this.isLoadingCallback&&this.isLoadingCallback(this.isLoading),this.changeDetectorRef.detectChanges()},t.prototype.dispose=function(){this.rowsChangeCallback=null,this.isLoadingCallback=null},t.prototype.setPageLink=function(t){this.clearState(),this.pageLink=t,this.loadNextPage()},t.prototype.hasLoadedCompletely=function(){return this.loadedCompletely},t.prototype.init=function(t,e){void 0===e&&(e=null),this.rowsChangeCallback=t,this.isLoadingCallback=e},t.prototype.clearState=function(){this.isLoading=!1,this.loadedCompletely=!1,this.hasLoaded=!1,this._rows=null,this.loadingSubscription&&(this.loadingSubscription.unsubscribe(),this.loadingSubscription=null)},t}();var D=function(t,e){if(this.field=t,this.dir=e,this.dir=e.toUpperCase(),"ASC"!==this.dir&&"DESC"!==this.dir)throw Error("dir can only be 'ASC' or 'DESC'")};var F=function(t){function e(e,i){var n=t.call(this,null,null)||this;return n.valueToLoad=e,n.delay=i,n}return u(e,t),e.prototype.callWithObs=function(t,e){return void 0===t&&(t=null),void 0===e&&(e=null),n.of(this.valueToLoad).pipe(r.delay(this.delay))},e}(m);t.CallLinkDirective=E,t.CallState=S,t.CallStatus=L,t.CallableLink=d,t.LinkField=m,t.LinkFieldContext=_,t.LinkFieldDirective=O,t.LinkFieldPagingSupport=x,t.LinkFieldPipe=w,t.LinkSerializer=f,t.MicroClient=b,t.MicroClientErrorIndicatorComponent=P,t.MicroClientLoadError=k,t.MicroClientLoadingIndicatorComponent=C,t.MicroClientModule=j,t.MicroError=v,t.MicroLinkValidateDirective=R,t.MicroObject=g,t.MicroObjectMetadata=y,t.MockLinkField=F,t.ParamUtils=p,t.SortInfo=D,Object.defineProperty(t,"__esModule",{value:!0})}));
|
|
15
|
+
***************************************************************************** */var l=function(t,e){return(l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(t,e)};function u(t,e){function i(){this.constructor=t}l(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}function c(t){var e="function"==typeof Symbol&&t[Symbol.iterator],i=0;return e?e.call(t):{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}}}function h(t,e){var i="function"==typeof Symbol&&t[Symbol.iterator];if(!i)return t;var n,r,o=i.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(t){r={error:t}}finally{try{n&&!n.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}return a}var p=function(){function t(){}return t.addParam=function(e,i,n,r){void 0===r&&(r=!0);var o=e.indexOf("?")>=0;o||(e+="?");var a=t.getParam(e,i);return null!=a&&r?e=e.replace(i+"="+a,i+"="+n):(o&&(e+="&"),e+=i+"="+n),e},t.setParams=function(t,e){var i=t.split("?")[0],n=!0;for(var r in e)e.hasOwnProperty(r)&&(n&&(i+="?",n=!1),i+=r+"="+e[r]);return i},t.getParams=function(t){var e,i,n=t.split("?");if(n.length<2)return{};var r={},o=n[1].split("&");try{for(var a=c(o),s=a.next();!s.done;s=a.next()){var l=s.value.split("=",2),u=l[0];2===l.length?r[u]=l[1]:r[u]=null}}catch(t){e={error:t}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(e)throw e.error}}return r},t.base64UrlEncode=function(e){return btoa(e).replace(t.plusRegex,"-").replace(t.slashRegex,"_").replace(t.multiEqualRegex,"")},t.base64UrlDecode=function(e){return e=(e+"===").slice(0,e.length+e.length%4),atob(e.replace(t.minusRegex,"+").replace(t.underscoreRegex,"/"))},t.needsBase64UrlEncoding=function(t){return null!=t&&"object"==typeof t},t.getParam=function(t,e,i){void 0===i&&(i=!1);var n=t.indexOf("?");t=t.substr(n);var r=new RegExp("[?&]"+encodeURIComponent(e)+"=([^&]*)").exec(t);return r?i&&r[1]?this.base64UrlDecode(r[1]):r[1]:null},t.plusRegex=new RegExp("\\+"),t.slashRegex=new RegExp("/","g"),t.multiEqualRegex=new RegExp("=+$","g"),t.minusRegex=new RegExp("-","g"),t.underscoreRegex=new RegExp("_","g"),t}();var d=function(){function t(t,e,i,n){void 0===i&&(i=null),void 0===n&&(n=null),this.link=t,this.microClient=e,this.callParams=i,this.requestOptions=n,this.serializeTo=f.DONT_SERIALIZE}return t.prototype.hasLink=function(){return null!=this.link},t.prototype.getLink=function(){return this.link},t.prototype.getQueryParam=function(t,e){return void 0===e&&(e=!1),p.getParam(this.link,t,e)},t.prototype.getSignedParams=function(){var t=this.getSignedMicroObjectParam("params");return null==t&&(t=this.getSignedMicroObjectParam("bParams")),t},t.prototype.getOpenParams=function(t){void 0===t&&(t=!1);var e=this.getMicroObjectParam("oParams");return null==e?e=this.getMicroObjectParam("bOParams"):(t&&(e=g.fromString(JSON.stringify(e),this.microClient)),this.callParams&&(e=Object.assign(e,this.callParams))),e},t.prototype.getOptions=function(){var t=this.getMicroObjectParam("options");return this.requestOptions&&(null==t&&(t=new g),t=Object.assign(t,this.requestOptions)),t},t.prototype.getSignedMicroObjectParam=function(t){var e=p.getParam(this.link,t,!1),i=null;if(e){var n=e.split(".");if(3!==n.length)throw new Error("Expected a signed query param to have a JWT like structure");i=g.fromString(atob(n[1]),this.microClient)}return i},t.prototype.getMicroObjectParam=function(t){var e=p.getParam(this.link,t,!0),i=null;return e&&(i=g.fromString(e,this.microClient)),i},t.prototype.call=function(t){return this.callWith(null,null,t)},t.prototype.callWith=function(t,e,i){return void 0===t&&(t=null),void 0===e&&(e=null),this.callWithObs(t,e).toPromise().then(i)},t.prototype.callWithObs=function(t,e){if(void 0===t&&(t=null),void 0===e&&(e=null),null==this.link)throw Error("Can't use callWithObs without a provided link");if(null==this.microClient)throw Error("Can't use callWithObs without a provided microClient");var i=null;null!=this.callParams&&(i=Object.assign(new g,this.callParams)),t&&(null==i&&(i=new g),i=Object.assign(i,t));var n=null;return null!=this.requestOptions&&(n=Object.assign(new g,this.requestOptions)),e&&(null==n&&(n=new g),n=Object.assign(n,e)),this.microClient.load(this.link,i,n)},t.prototype.copy=function(){return new t(this.link,this.microClient,this.callParams,this.requestOptions)},t.prototype.withCallParams=function(e,i){return void 0===i&&(i=this.requestOptions),new t(this.link,this.microClient,e,i)},t.prototype.toJSON=function(){return this.serializeTo?this.serializeTo(this.link,this.callParams,this.requestOptions,void 0,void 0):void 0},t}();var f=function(){function t(){}return t.DONT_SERIALIZE=function(){},t.AS_LINK=function(t){return t},t.AS_VALUE_IF_INITIALIZED=function(t,e,i,n,r){return r?n:void 0},t}();var m=function(t){function e(e,i,n,r,o,a){void 0===n&&(n=null),void 0===r&&(r=!1),void 0===o&&(o=null),void 0===a&&(a=null);var s=t.call(this,e,i,o,a)||this;return s.initialized=!1,s.serializeTo=f.AS_VALUE_IF_INITIALIZED,s.intervalId=null,s.isRefreshing=!1,r&&s.set(n),s}return u(e,t),e.from=function(t){return new e(null,null,t,!0)},e.prototype.get=function(t){return t?(this.getObs().subscribe(t),null):this.getPromise()},e.prototype.getPromise=function(){return this._getPromise||(this._getPromise=this.getObs().toPromise()),this._getPromise},e.prototype.refresh=function(t,e){var i=this;t&&this.stopRefresh();var n=function(){i.isRefreshing=!1};this.isRefreshing=!0,this.initWithObs().subscribe(n,(function(t){n(),e&&e(t)}),n),t&&(this.intervalId=setInterval((function(){i.isRefreshing||(i.isRefreshing=!0,i.initWithObs().subscribe(n,(function(t){n(),e&&e(t)}),n))}),t))},e.prototype.stopRefresh=function(){this.intervalId&&clearInterval(this.intervalId)},e.prototype.listenObs=function(){var t=this;if(this.valueSubj)return this.valueSubj;var e=new n.ReplaySubject(1);return this.valueSubj=e,n.defer((function(){return t.initWithObs(null,null).subscribe((function(i){t.valueSubj!==e&&(e.next(i),e.complete())})),e}))},e.prototype.getObs=function(){return this.listenObs().pipe(r.take(1))},e.prototype.set=function(t){var e=this.value;return this.value=t,this.initialized=!0,this.valueSubj||(this.valueSubj=new n.ReplaySubject(1)),this.valueSubj.next(t),this._getPromise=null,e},e.prototype.isInitialized=function(){return this.initialized},e.prototype.uninitialize=function(){this.value=null,this.initialized=!1,this.valueSubj=null,this._getPromise=null},e.prototype.copyUninitialized=function(){var t=this.copy();return t.uninitialize(),t},e.prototype.getInitializedValue=function(){if(!this.isInitialized())throw new Error("Can't get the intialized value for a LinkField that hasn't been initialized");return this.value},e.prototype.initWith=function(t,e,i){void 0===t&&(t=null),void 0===e&&(e=null),this.initWithObs(t,e).subscribe(i)},e.prototype.initWithObs=function(t,e){var i=this;return void 0===t&&(t=null),void 0===e&&(e=null),this.callWithObs(t,e).pipe(r.map((function(t){return i.set(t),t})))},e.prototype.withCallParams=function(t,i){return void 0===i&&(i=this.requestOptions),new e(this.link,this.microClient,this.value,this.initialized,t,i)},e.prototype.copy=function(t){return void 0===t?new e(this.link,this.microClient,this.value,this.initialized,this.callParams,this.requestOptions):new e(this.link,this.microClient,t,!0,this.callParams,this.requestOptions)},e.prototype.toJSON=function(){return this.serializeTo?this.serializeTo(this.link,this.callParams,this.requestOptions,this.value,this.isInitialized()):void 0},e}(d);var g=function(){function t(){this.__meta=void 0}return t.deepCopy=function(e,i){return o.cloneDeepWith(e,t.deepCopyCustomizer)},t.deepCopyCustomizer=function(t){if(t instanceof b)return t},t.fromString=function(t,e,i){void 0===i&&(i=null);var n=JSON.parse(t);return this.fromObject(n,e,i)},t.fromObject=function(e,i,n){if(void 0===n&&(n=null),null===e)return null;if(Array.isArray(e)){for(var r=e,o=0;o<r.length;o++){var a=r[o];"object"==typeof a&&(r[o]=t.fromObject(a,i,n))}return r}for(var s in e)if(s!==t.META_KEY&&e.hasOwnProperty(s)){var l=e[s];l&&(l instanceof Object||Array.isArray(l))&&(e[s]=t.fromObject(l,i,n))}var u=null==n?t.prototype:n,c=Object.assign(Object.create(u),e);return t.attachMetadataObject(c,i),c},t.attachMetadataObject=function(e,i){var n=null!=e?e[t.META_KEY]:null;if(null==n)return null;var r=i;n.permitToken&&null!=i.getEntryPoint()&&(r=i.createChildClientForEntryPoint(e)),e.__meta=y.fromObject(e.__meta,r),t.attachLinkFields(e.__meta,e,r),t.attachCallableLinks(e.__meta,e,r)},t.attachLinkFields=function(t,e,i){t.forEachLink((function(t,n){var r=e[t];e[t]=new m(n,i,r,void 0!==r)}))},t.attachCallableLinks=function(t,e,i){t.forEachAction((function(t,n){e[t]=new d(n,i)}))},t.META_KEY="__meta",t}();var y=function(){function t(){}return t.fromObject=function(e,i){var n=Object.assign(new t,e);return null!=n.nextPage&&(n.nextPage=new m(n.nextPage,i),n.nextPage.serializeTo=f.AS_LINK),n},t.prototype.getLinkUrl=function(t){return this.links[t]},t.prototype.hasLink=function(t){return null!=this.links[t]},t.prototype.forEachLink=function(t){for(var e in this.links)this.links.hasOwnProperty(e)&&t(e,this.links[e])},t.prototype.forEachAction=function(t){for(var e in this.actions)this.actions.hasOwnProperty(e)&&t(e,this.actions[e])},t}();var v=function(){};var b=function(){function t(t){this.httpClient=t,this.entryPointSubject=new n.ReplaySubject,this.usePost=!0,this.sendAsPermitTokenHeader=!0,this.sendAsMultipartFormData=!1}return t.prototype.setSendAsPermitTokenHeader=function(t){this.sendAsPermitTokenHeader=t},t.prototype.setAuthToken=function(t){this.authHeader="Bearer "+t,this.permitToken=t},t.prototype.setAuthHeader=function(t){this.authHeader=t},t.prototype.getEntryPoint=function(){return this.entryPoint},t.prototype.waitForEntryPoint=function(t){return null!=t?(this.entryPointSubject.subscribe(t),null):this.entryPointSubject.toPromise()},t.prototype.copyAuthAndEntrypointOf=function(t){this.authHeader=t.authHeader,this.permitToken=t.permitToken,this.entryPoint=t.entryPoint},t.prototype.setEntryPoint=function(t){if(null==t)this.authHeader=null,this.entryPoint=null,this.permitToken=null;else{if(this.entryPoint=t,!this.entryPoint.__meta||!this.entryPoint.__meta.permitToken)throw Error('Expected the entryPoint to contain a "permitToken" within the "__meta" field');this.setAuthToken(this.entryPoint.__meta.permitToken),this.entryPointSubject.next(t)}},t.prototype.setDefaultErrorHandler=function(t){this.defaultErrorHandler=t},t.prototype.handleError=function(e){if(this.defaultErrorHandler)if(t.toMicroError(e)){var i=g.fromObject(e.error,this);this.defaultErrorHandler(e,i)}else this.defaultErrorHandler(e,null)},t.prototype.ignite=function(t,e,n,o){var a=this;void 0===e&&(e=null),void 0===n&&(n=null),void 0===o&&(o={}),this.urlRewriter&&(t=this.urlRewriter(t));var s=new i.HttpHeaders;for(var l in o)o.hasOwnProperty(l)&&(s=s.set(l,o[l]));return null==e&&null==n||(s=s.set("Authorization","Basic "+btoa(e+":"+n))),this.httpClient.get(t,{headers:s}).pipe(r.map((function(t){var e=g.fromObject(t,a);return a.setEntryPoint(e),e})),this.catchAndHandleError())},t.prototype.load=function(t,e,n){var o=this,a=new i.HttpHeaders;this.authHeader&&(a=a.set("Authorization",this.authHeader),this.sendAsPermitTokenHeader&&(a=a.set("MicroPermitToken",this.permitToken)));var s=e;if(null!=e||this.usePost){var l=p.getParam(t,"oParams",!0),u=void 0;u=l?JSON.parse(l):{},s=Object.assign(u,e)}var c=n;if(null!=n||this.usePost){var h=p.getParam(t,"options",!0);c=h?JSON.parse(h):{},c=Object.assign(c,n)}var d=p.getParams(t),f=null;if(this.usePost){var m=void 0,y=d.bOParams;y&&(m=JSON.parse(p.base64UrlDecode(y)));var v={params:d.params,oParams:s,bParams:d.bParams,bOParams:m,options:c};delete d.params,delete d.oParams,delete d.bParams,delete d.bOParams,delete d.options,t=p.setParams(t,d),this.urlRewriter&&(t=this.urlRewriter(t)),f=this.httpClient.post(t,this.encodeBody(v),{headers:a})}else s&&(d.oParams=p.base64UrlEncode(JSON.stringify(s))),c&&(d.options=p.base64UrlEncode(JSON.stringify(c))),t=p.setParams(t,d),this.urlRewriter&&(t=this.urlRewriter(t)),f=this.httpClient.get(t,{headers:a});return f=f.pipe(r.map((function(t){return g.fromObject(t,o)})),this.catchAndHandleError())},t.prototype.encodeBody=function(t){if(this.sendAsMultipartFormData){var e=new FormData,i=new Blob([JSON.stringify(t)],{type:"application/json"});return e.append("*",i),e}return t},t.prototype.catchAndHandleError=function(){var t=this;return(function(e){return e.pipe(r.catchError((function(e){var i=new k(e,(function(e){t.handleError(e)}));return n.throwError(i).pipe(r.finalize((function(){i.shouldPreventDefault()||i.handleDefault()})))})))})},t.prototype.createChildClientForEntryPoint=function(t){if(t.__meta&&t.__meta.permitToken){var e=Object.create(this,{entryPoint:{configurable:!0,enumerable:!0,writable:!0},authHeader:{configurable:!0,enumerable:!0,writable:!0},permitToken:{configurable:!0,enumerable:!0,writable:!0}});return e.setEntryPoint(t),e}throw new Error("The supplied value can't be used to construct a child MicroClient because it doesn't contain metadata with a permitToken ")},t.prototype.setURLRewriter=function(t){this.urlRewriter=t},t.toMicroError=function(t){var e=t.error;return e&&e.__meta&&e.__meta.error?Object.assign(new v,e.__meta.error):null},t.guessMicroComponentBaseURL=function(){var e=window.location.href;return t.staticContentRegExp.test(e)?e.replace(new RegExp("/static/.*"),"").replace(new RegExp("/#/.*"),""):window.location.protocol.startsWith("file")?"http://localhost:8080":window.location.protocol+"//"+window.location.hostname+":8080"},t.guessMicroComponentAuthorizeURL=function(){return this.guessMicroComponentBaseURL()+"/authorize"},t.staticContentRegExp=new RegExp("[a-zA-Z0-9]://.*(:[0-9]+)?(/.*)*/static(/.*(\\?.*)?(#.*)?)?"),t.decorators=[{type:e.Injectable}],t.ctorParameters=function(){return[{type:i.HttpClient}]},t}();var k=function(){function t(t,e){this.error=t,this.defaultHandler=e,this.handled=!1,this.doPreventDefault=!1}return t.prototype.handleDefault=function(){this.defaultHandler&&(this.defaultHandler(this.error),this.handled=!0)},t.prototype.handleError=function(t){t(this.error),this.handled=!0},t.prototype.isHandled=function(){return this.handled},t.prototype.shouldPreventDefault=function(){return this.doPreventDefault},t.prototype.preventDefault=function(){this.doPreventDefault=!0},t.prototype.hasDefaultHandler=function(){return null!=this.defaultHandler},t}();var C=function(){function t(){}return t.decorators=[{type:e.Component,args:[{selector:"mc-loadingindicator",template:'\n <div id="container">\n <div id="bar"></div>\n </div>\n ',styles:["\n #container {\n display: block;\n overflow: hidden;\n width: 100%;\n height: 5px;\n -webkit-transform: translate(0, 0) scale(1, 1);\n transform: translate(0, 0) scale(1, 1);\n background-color: #aad1f9;\n }\n #container #bar {\n transition: all .2s linear;\n -webkit-animation: query 0.8s infinite cubic-bezier(0.39, 0.575, 0.565, 1);\n animation: query 0.8s infinite cubic-bezier(0.39, 0.575, 0.565, 1);\n transition: -webkit-transform .2s linear;\n transition: transform .2s linear;\n background-color: #106cc8;\n width: 100%;\n height: 5px;\n }\n @keyframes query {\n 0% {\n opacity: 1;\n transform: translateX(35%) scale(0.3, 1);\n }\n 100% {\n opacity: 0;\n transform: translateX(-50%) scale(0, 1);\n }\n }\n "]}]}],t}(),w=function(){function t(t){this.asyncPipe=new a.AsyncPipe(t)}return t.prototype.ngOnDestroy=function(){this.asyncPipe.ngOnDestroy()},t.prototype.transform=function(t){if(null==t)return null;if(t instanceof m)return this.asyncPipe.transform(t.getObs());throw new Error("Can't use the linkField pipe with a value which isn't an instance of LinkField")},t.decorators=[{type:e.Pipe,args:[{name:"linkField",pure:!1}]}],t.ctorParameters=function(){return[{type:e.ChangeDetectorRef}]},t}();var P=function(){function t(){}return t.prototype.onClick=function(){this.error.handleDefault()},t.decorators=[{type:e.Component,args:[{selector:"mc-errorindicator",template:'\n <div class="blinking-error" [class.clickable]="error.hasDefaultHandler()" (click)="onClick()"></div>\n ',styles:["\n .blinking-error {\n background-image: linear-gradient(to right, tomato 0%, darkred 50%, tomato 100%);\n animation: blinkingText 0.5s 1;\n height: 5px;\n }\n\n .blinking-error.clickable {\n cursor: pointer;\n }\n\n @keyframes blinkingText {\n 0% {\n opacity: 0;\n }\n 50% {\n opacity: 1;\n }\n 100% {\n opacity: 0;\n }\n }\n "]}]}],t.propDecorators={error:[{type:e.Input}]},t}();var O=function(){function t(t,e,i,n){this._viewContainer=t,this._template=e,this.componentResolver=i,this.changeDetectorRef=n,this.isDirty=!0,this.isLoading=!1,this.loadedResult=null,this.hasResult=!1,this.subscription=null,this.linkFieldDefaultErrorHandling=!1,this.linkFieldParams=null,this._defaultLoadingComponent=i.resolveComponentFactory(C),this._defaultErrorComponent=i.resolveComponentFactory(P)}return Object.defineProperty(t.prototype,"linkFieldFrom",{set:function(t){this._from=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"linkFieldLoadingTemplate",{set:function(t){t&&(this._loadingTemplate=t),this.updateIfDirty(!0)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"linkFieldErrorTemplate",{set:function(t){t&&(this._errorTemplate=t),this.updateIfDirty(!0)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"linkFieldTemplate",{set:function(t){t&&(this._template=t)},enumerable:!0,configurable:!0}),t.prototype.load=function(){var t=this;this._from&&(this._from instanceof m?(this.setLoading(!0),this.lastObs=this._from.listenObs(),this.subscription&&this.subscription.unsubscribe(),this.subscription=this.lastObs.pipe(r.finalize((function(){t.setLoading(!1)}))).subscribe((function(e){t.setLoadedResult(e),t.linkFieldValueChange&&t.linkFieldValueChange(e)}),(function(e){t.linkFieldDefaultErrorHandling||e.preventDefault(),t.setError(e)}))):this.setLoadedResult(this._from))},t.prototype.ngDoCheck=function(){this.updateIfDirty()},t.prototype.ngOnDestroy=function(){this.clear()},t.prototype.ngOnChanges=function(t){if(t.linkFieldFrom&&(this._from instanceof m||(this._from=m.from(this._from)),t.linkFieldFrom.previousValue!==t.linkFieldFrom.currentValue&&(this.clear(),this.load())),t.linkFieldParams&&this.linkFieldParams){var e=this._from;this._from=e.withCallParams(this.linkFieldParams)}},t.prototype.setError=function(t){(this._viewContainer.remove(),this._errorTemplate)?this._viewContainer.createEmbeddedView(this._errorTemplate,{$implicit:t}):this._viewContainer.createComponent(this._defaultErrorComponent).instance.error=t},t.prototype.setLoading=function(t){this.isLoading=t,this.isLoading&&(this._loadingTemplate?(this._viewContainer.remove(),this._viewContainer.createEmbeddedView(this._loadingTemplate)):(this._viewContainer.remove(),this._viewContainer.createComponent(this._defaultLoadingComponent)))},t.prototype.setLoadedResult=function(t){this.hasResult=!0,this.loadedResult=t,null==this.currentContext?(this.currentContext=new _(t),this.isDirty=!0):(this.currentContext.$implicit=t,this.changeDetectorRef.markForCheck()),this._viewContainer&&this._template?this.isDirty&&(this._viewContainer.remove(),this._viewContainer.createEmbeddedView(this._template,this.currentContext),this.isDirty=!1):this.isDirty=!0},t.prototype.updateIfDirty=function(t){void 0===t&&(t=!1),(this.isDirty||t)&&this._loadingTemplate&&this._from&&this._template&&this._viewContainer&&(this.hasResult&&this.setLoadedResult(this.loadedResult),this.isDirty=!1)},t.prototype.clear=function(){this.hasResult=!1,this.loadedResult=null,this.isDirty=!1,this.subscription&&(this.subscription.unsubscribe(),this.subscription=null),this.lastObs=null,this.currentContext=null},t.decorators=[{type:e.Directive,args:[{selector:"[linkField][linkFieldFrom]"}]}],t.ctorParameters=function(){return[{type:e.ViewContainerRef},{type:e.TemplateRef},{type:e.ComponentFactoryResolver},{type:e.ChangeDetectorRef}]},t.propDecorators={linkFieldFrom:[{type:e.Input}],linkFieldLoadingTemplate:[{type:e.Input}],linkFieldErrorTemplate:[{type:e.Input}],linkFieldTemplate:[{type:e.Input}],linkFieldDefaultErrorHandling:[{type:e.Input}],linkFieldValueChange:[{type:e.Input}],linkFieldParams:[{type:e.Input}]},t}();var _=function(t){this.$implicit=t};var E=function(){function t(){this.callStatusChange=new e.EventEmitter,this.callSucess=new e.EventEmitter,this.callFinish=new e.EventEmitter,this.callError=new e.EventEmitter,this.callStart=new e.EventEmitter}return t.prototype.onClick=function(){var t=this;this.callLink.callWithObs(this.callParameters,this.callOptions).subscribe((function(e){t.callSucess.emit(e),t.callStatusChange.emit(new L(t.callLink,S.SUCCESS,e,null))}),(function(e){t.callError.emit(e),t.callStatusChange.emit(new L(t.callLink,S.ERROR,null,e))}),(function(){t.callFinish.emit()})),this.callStatusChange.emit(new L(this.callLink,S.CALLING,null,null))},t.decorators=[{type:e.Directive,args:[{selector:"[callLink]"}]}],t.propDecorators={callLink:[{type:e.Input}],callStatusChange:[{type:e.Output}],callSucess:[{type:e.Output}],callFinish:[{type:e.Output}],callError:[{type:e.Output}],callStart:[{type:e.Output}],callOptions:[{type:e.Input}],callParameters:[{type:e.Input}],onClick:[{type:e.HostListener,args:["click"]}]},t}();var L=function(t,e,i,n){this.link=t,this.state=e,this.response=i,this.error=n};var S={CALLING:0,SUCCESS:1,ERROR:2};S[S.CALLING]="CALLING",S[S.SUCCESS]="SUCCESS",S[S.ERROR]="ERROR";var R=function(){function t(){this.UNSET="",this.microLinkValidateField=null,this.microLinkValidateValue=this.UNSET,this.microLinkValidateDebounce=500}return t.prototype.validate=function(t){var e=this;return n.timer(this.microLinkValidateDebounce).pipe(r.switchMap((function(){var i=e.microLinkValidateValue;i===e.UNSET&&(i=t.value);var n={};return e.microLinkValidateField?n[e.microLinkValidateField]=i:n=i,e.microLinkValidate.callWithObs(n,null).pipe(r.map((function(t){var i=!1;if(e.microLinkValidateField)null!=t[e.microLinkValidateField]&&(i=!0);else for(var n in t)null!=t[n]&&(i=!0);return i?(e.result=t,{validateMicroLink:e.result}):(e.result=null,null)})))})))},t.prototype.getControlName=function(t){var e=null,i=t.parent;return i instanceof s.FormGroup&&Object.keys(i.controls).forEach((function(n){t===i.controls[n]&&(e=n)})),e},t.decorators=[{type:e.Directive,args:[{selector:"[microLinkValidate]",providers:[{provide:s.NG_ASYNC_VALIDATORS,useExisting:e.forwardRef((function(){return t})),multi:!0}],exportAs:"microValidator"}]}],t.propDecorators={microLinkValidate:[{type:e.Input}],microLinkValidateField:[{type:e.Input}],microLinkValidateValue:[{type:e.Input}],microLinkValidateDebounce:[{type:e.Input}]},t}();var j=function(){function t(){}return t.forClientRoot=function(){return{ngModule:t,providers:[b]}},t.decorators=[{type:e.NgModule,args:[{entryComponents:[C,P],imports:[i.HttpClientModule],declarations:[w,O,E,C,P,R],exports:[w,O,E,P,C,R]}]}],t}(),x=function(){function t(t,e,i){var n=this;void 0===i&&(i=200),this.pageLink=t,this.changeDetectorRef=e,this.pageLimit=i,this.sorts=null,this.isLoading=!1,this.loadedCompletely=!1,this.hasLoaded=!1,this._rows=null,this.loadingSubscription=null,this.loadingCallback=function(){n.setLoading(!1)}}return Object.defineProperty(t.prototype,"rows",{get:function(){return this.hasLoaded||this.loadNextPage(),this._rows},enumerable:!0,configurable:!0}),t.from=function(e,i,n){return void 0===n&&(n=200),new t(e,i,n)},t.prototype.applySort=function(t,e){void 0===e&&(e=!0),this.hasLoaded=!1,this.sorts=null,this._rows=null,e?(this.sorts=t,this.loadNextPage()):this.loadedCompletely?this.changeDetectorRef.detectChanges():this.loadNextPage(null)},t.prototype.loadNextPage=function(t,e){var i=this;if(void 0===t&&(t=this.pageLimit),void 0===e&&(e=null),this.pageLink&&!this.isLoading)if(this.loadingSubscription&&(this.loadingSubscription.unsubscribe(),this.loadingSubscription=null),this.hasLoaded=!0,this.loadedCompletely=!1,null==this._rows){this.setLoading(!0);var n={};null!=this.sorts&&(n.sorting=this.sorts),null!=t&&(n.pageSize=t),this.loadingSubscription=this.pageLink.initWithObs(null,n).subscribe((function(t){i.setRows(t,e)}),this.loadingCallback,this.loadingCallback)}else{var r=this.lastRow();if(r&&r.__meta.nextPage){n=null;null!=t&&(n={pageSize:t});var o=r.__meta.nextPage.initWithObs(null,n);o&&(this.setLoading(!0),this.loadingSubscription=o.subscribe((function(t){i.setRows(t,e)}),this.loadingCallback,this.loadingCallback))}}else this.pageLink||this.clearRows()},t.prototype.loadEverything=function(){this.loadNextPage(null)},t.prototype.lastRow=function(){return this._rows[this._rows.length-1]},t.prototype.setRows=function(t,e){this._rows?this._rows=function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(h(arguments[e]));return t}(this.rows,t):this._rows=t,e&&e(t,this._rows),this.reflectChanges()},t.prototype.clearRows=function(){null!=this._rows&&(this._rows=null,this.reflectChanges())},t.prototype.reflectChanges=function(){var t=this.lastRow();t&&t.__meta?this.loadedCompletely=null==t.__meta.nextPage:this.loadedCompletely=!1,this.rowsChangeCallback&&this.rowsChangeCallback(this._rows),this.changeDetectorRef.detectChanges()},t.prototype.setLoading=function(t){this.isLoading=t,this.isLoadingCallback&&this.isLoadingCallback(this.isLoading),this.changeDetectorRef.detectChanges()},t.prototype.dispose=function(){this.rowsChangeCallback=null,this.isLoadingCallback=null},t.prototype.setPageLink=function(t){this.clearState(),this.pageLink=t,this.loadNextPage()},t.prototype.hasLoadedCompletely=function(){return this.loadedCompletely},t.prototype.init=function(t,e){void 0===e&&(e=null),this.rowsChangeCallback=t,this.isLoadingCallback=e},t.prototype.clearState=function(){this.isLoading=!1,this.loadedCompletely=!1,this.hasLoaded=!1,this._rows=null,this.loadingSubscription&&(this.loadingSubscription.unsubscribe(),this.loadingSubscription=null)},t}();var D=function(t,e){if(this.field=t,this.dir=e,this.dir=e.toUpperCase(),"ASC"!==this.dir&&"DESC"!==this.dir)throw Error("dir can only be 'ASC' or 'DESC'")};var F=function(t){function e(e,i){var n=t.call(this,null,null)||this;return n.valueToLoad=e,n.delay=i,n}return u(e,t),e.prototype.callWithObs=function(t,e){return void 0===t&&(t=null),void 0===e&&(e=null),n.of(this.valueToLoad).pipe(r.delay(this.delay))},e}(m);t.CallLinkDirective=E,t.CallState=S,t.CallStatus=L,t.CallableLink=d,t.LinkField=m,t.LinkFieldContext=_,t.LinkFieldDirective=O,t.LinkFieldPagingSupport=x,t.LinkFieldPipe=w,t.LinkSerializer=f,t.MicroClient=b,t.MicroClientErrorIndicatorComponent=P,t.MicroClientLoadError=k,t.MicroClientLoadingIndicatorComponent=C,t.MicroClientModule=j,t.MicroError=v,t.MicroLinkValidateDirective=R,t.MicroObject=g,t.MicroObjectMetadata=y,t.MockLinkField=F,t.ParamUtils=p,t.SortInfo=D,Object.defineProperty(t,"__esModule",{value:!0})}));
|
|
16
16
|
//# sourceMappingURL=micropermit-client-angular.umd.min.js.map
|