UNPKG

test-isc

Version:

An Ionic component similar to Ionic Select, that allows to search items, including async search, group, add, edit, delete items, and much more.

1 lines 4.61 kB
var __awaiter=this&&this.__awaiter||function(t,e,i,n){function r(t){return t instanceof i?t:new i((function(e){e(t)}))}return new(i||(i=Promise))((function(i,o){function s(t){try{a(n.next(t))}catch(e){o(e)}}function l(t){try{a(n["throw"](t))}catch(e){o(e)}}function a(t){t.done?i(t.value):r(t.value).then(s,l)}a((n=n.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var i={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,r,o,s;return s={next:l(0),throw:l(1),return:l(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function l(t){return function(e){return a([t,e])}}function a(s){if(n)throw new TypeError("Generator is already executing.");while(i)try{if(n=1,r&&(o=s[0]&2?r["return"]:s[0]?r["throw"]||((o=r["return"])&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;if(r=0,o)s=[s[0]&2,o.value];switch(s[0]){case 0:case 1:o=s;break;case 4:i.label++;return{value:s[1],done:false};case 5:i.label++;r=s[1];s=[0];continue;case 7:s=i.ops.pop();i.trys.pop();continue;default:if(!(o=i.trys,o=o.length>0&&o[o.length-1])&&(s[0]===6||s[0]===2)){i=0;continue}if(s[0]===3&&(!o||s[1]>o[0]&&s[1]<o[3])){i.label=s[1];break}if(s[0]===6&&i.label<o[1]){i.label=o[1];o=s;break}if(o&&i.label<o[2]){i.label=o[2];i.ops.push(s);break}if(o[2])i.ops.pop();i.trys.pop();continue}s=e.call(t,i)}catch(l){s=[6,l];r=0}finally{n=o=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};System.register(["./p-901cf683.system.js","./p-efec1ef9.system.js"],(function(t){"use strict";var e,i,n,r,o,s,l,a;return{setters:[function(t){e=t.r;i=t.d;n=t.w;r=t.i;o=t.h;s=t.e;l=t.H},function(t){a=t.g}],execute:function(){var c="ion-infinite-scroll{display:none;width:100%}.infinite-scroll-enabled{display:block}";var h=t("ion_infinite_scroll",function(){function t(t){var n=this;e(this,t);this.thrPx=0;this.thrPc=0;this.didFire=false;this.isBusy=false;this.isLoading=false;this.threshold="15%";this.disabled=false;this.position="bottom";this.onScroll=function(){var t=n.scrollEl;if(!t||!n.canStart()){return 1}var e=n.el.offsetHeight;if(e===0){return 2}var i=t.scrollTop;var r=t.scrollHeight;var o=t.offsetHeight;var s=n.thrPc!==0?o*n.thrPc:n.thrPx;var l=n.position==="bottom"?r-e-i-s-o:i-e-s;if(l<0){if(!n.didFire){n.isLoading=true;n.didFire=true;n.ionInfinite.emit();return 3}}else{n.didFire=false}return 4};this.ionInfinite=i(this,"ionInfinite",7)}t.prototype.thresholdChanged=function(){var t=this.threshold;if(t.lastIndexOf("%")>-1){this.thrPx=0;this.thrPc=parseFloat(t)/100}else{this.thrPx=parseFloat(t);this.thrPc=0}};t.prototype.disabledChanged=function(){var t=this.disabled;if(t){this.isLoading=false;this.isBusy=false}this.enableScrollEvents(!t)};t.prototype.connectedCallback=function(){return __awaiter(this,void 0,void 0,(function(){var t,e;var i=this;return __generator(this,(function(r){switch(r.label){case 0:t=this.el.closest("ion-content");if(!t){console.error("<ion-infinite-scroll> must be used inside an <ion-content>");return[2]}e=this;return[4,t.getScrollElement()];case 1:e.scrollEl=r.sent();this.thresholdChanged();this.disabledChanged();if(this.position==="top"){n((function(){if(i.scrollEl){i.scrollEl.scrollTop=i.scrollEl.scrollHeight-i.scrollEl.clientHeight}}))}return[2]}}))}))};t.prototype.disconnectedCallback=function(){this.enableScrollEvents(false);this.scrollEl=undefined};t.prototype.complete=function(){return __awaiter(this,void 0,void 0,(function(){var t,e;var i=this;return __generator(this,(function(o){t=this.scrollEl;if(!this.isLoading||!t){return[2]}this.isLoading=false;if(this.position==="top"){this.isBusy=true;e=t.scrollHeight-t.scrollTop;requestAnimationFrame((function(){r((function(){var r=t.scrollHeight;var o=r-e;requestAnimationFrame((function(){n((function(){t.scrollTop=o;i.isBusy=false}))}))}))}))}return[2]}))}))};t.prototype.canStart=function(){return!this.disabled&&!this.isBusy&&!!this.scrollEl&&!this.isLoading};t.prototype.enableScrollEvents=function(t){if(this.scrollEl){if(t){this.scrollEl.addEventListener("scroll",this.onScroll)}else{this.scrollEl.removeEventListener("scroll",this.onScroll)}}};t.prototype.render=function(){var t;var e=a(this);var i=this.disabled;return o(l,{class:(t={},t[e]=true,t["infinite-scroll-loading"]=this.isLoading,t["infinite-scroll-enabled"]=!i,t)})};Object.defineProperty(t.prototype,"el",{get:function(){return s(this)},enumerable:true,configurable:true});Object.defineProperty(t,"watchers",{get:function(){return{threshold:["thresholdChanged"],disabled:["disabledChanged"]}},enumerable:true,configurable:true});return t}());h.style=c}}}));