p-110b93ae.entry.js 2.1 KB
Newer Older
1
import{r as t,h as i}from"./p-38dcedc4.js";import{m as s}from"./p-c3d35135.js";import{G as o,n,d as l}from"./p-8d47f7b8.js";import{O as h,a as e}from"./p-63e3a721.js";import"./p-202e7480.js";import"./p-f2660943.js";import"./p-5a5a5c96.js";const a=class{constructor(i){t(this,i),this.store=o.getInstance(),this.pageSize=20,this.showSize=this.pageSize,this.models=[],this.filterList=[],this.showList=[],this.disableLoadMore=!1,this.filterData=t=>{let i=t.detail.value;n(i)?(i=i.toLowerCase(),this.filterList=this.models.filter((t=>!!n(t.text)&&-1!==t.text.toLowerCase().indexOf(i)))):this.filterList=this.models,this.showSize=this.pageSize,this.load()},this.loadMore=t=>{this.timer&&(clearTimeout(this.timer),this.timer=null),this.timer=setTimeout((()=>{this.showSize+=this.pageSize,this.load(),t.target.complete()}),300)}}componentWillLoad(){this.models=l(this.item.models),this.filterList=this.models,this.load()}dismissModal(){s.dismiss()}load(){this.showList=this.filterList.slice(0,this.showSize),this.disableLoadMore=this.showList.length>=this.filterList.length}itemClick(t){h.objModel(t)}render(){return this.item?[i("ion-header",{translucent:!0},i("ion-toolbar",null,i("ion-buttons",{slot:"start"},i("ion-button",{onClick:this.dismissModal},"返回")),i("ion-title",null,this.item.text||this.item.key),i("ion-badge",{color:"secondary",slot:"end"},this.showList.length," / ",this.filterList.length)),i("ion-searchbar",{debounce:500,animated:!0,placeholder:"请输入需要查找的模型名称",showCancelButton:"focus",cancelButtonText:"取消",showClearButton:"focus",onIonChange:this.filterData})),i("ion-content",{fullscreen:!0},i("ion-list",null,this.showList.map((t=>i("ion-item",{button:!0,detail:!0,onClick:()=>this.itemClick(t)},i("ion-label",null,i("h3",null,t.text)),t.enableOpenDesign?i("div",{class:"list-item-actions",slot:"end"},i("ion-button",{onClick:i=>{i.stopPropagation(),e.openDesignView(t.model)}},"设计")):null)))),i("ion-infinite-scroll",{disabled:this.disableLoadMore,onIonInfinite:this.loadMore},i("ion-infinite-scroll-content",{loadingSpinner:"bubbles",loadingText:"加载中..."})))]:null}};a.style=":host{display:block}";export{a as app_model_list}