generated from filamentphp/plugin-skeleton
-
-
Notifications
You must be signed in to change notification settings - Fork 44
Expand file tree
/
Copy pathflowforge.js
More file actions
1 lines (1 loc) · 1.1 KB
/
flowforge.js
File metadata and controls
1 lines (1 loc) · 1.1 KB
1
function d({state:l}){return{state:l,isLoading:{},fullyLoaded:{},areFiltersOpen:!1,init(){this.$wire.$on("kanban-items-loaded",t=>{let{columnId:e,isFullyLoaded:s}=t;s&&(this.fullyLoaded[e]=!0)})},handleSortableEnd(t){let e=t.to.sortable.toArray(),s=t.item.getAttribute("x-sortable-item"),a=t.to.getAttribute("data-column-id"),i=t.item;this.setCardState(i,!0);let o=e.indexOf(s),r=o>0?e[o-1]:null,n=o<e.length-1?e[o+1]:null;this.$wire.moveCard(s,a,r,n).then(()=>this.setCardState(i,!1)).catch(()=>this.setCardState(i,!1))},setCardState(t,e){t.style.opacity=e?"0.7":"",t.style.pointerEvents=e?"none":""},isLoadingColumn(t){return this.isLoading[t]||!1},isColumnFullyLoaded(t){return this.fullyLoaded[t]||!1},handleSmoothScroll(t){this.isLoadingColumn(t)||this.isColumnFullyLoaded(t)||(this.isLoading[t]=!0,this.$wire.loadMoreItems(t).then(()=>setTimeout(()=>this.isLoading[t]=!1,100)).catch(()=>this.isLoading[t]=!1))},handleColumnScroll(t,e){if(this.isColumnFullyLoaded(e))return;let{scrollTop:s,scrollHeight:a,clientHeight:i}=t.target;(s+i)/a>=.8&&!this.isLoadingColumn(e)&&this.handleSmoothScroll(e)}}}export{d as default};