import{a as i}from"./chunk-M3DKIQAN.js";import"./chunk-HVFZ76UK.js";import{a as v}from"./chunk-WTAT2E5Z.js";import"./chunk-4KB2I3K5.js";import{o as T}from"./chunk-DFPET44C.js";import{q as S}from"./chunk-3SGEAGU4.js";import"./chunk-AXJC5PD4.js";import"./chunk-KX2PR432.js";import"./chunk-PCQVD4UN.js";import"./chunk-FUKRVTQR.js";import"./chunk-HMHHBN2H.js";import"./chunk-LTTEKZWN.js";import"./chunk-JD7XHN2Y.js";import"./chunk-PNYIEM2I.js";import"./chunk-WAKTITOT.js";import"./chunk-DIZJ6SFW.js";import"./chunk-NGFJDF4M.js";import{c as A,d as L,e as p,f as P}from"./chunk-DQXXLIFV.js";import"./chunk-BKF2JYPP.js";import"./chunk-OFEKULYN.js";import"./chunk-T3Q3DASN.js";import"./chunk-PYC6L6XB.js";import"./chunk-BEQYW66E.js";import{$b as l,Ab as h,Fd as w,Ld as R,Rb as D,ac as c,bc as b,fd as C,nb as f,ob as g,yc as I}from"./chunk-LU6Q5ONP.js";import"./chunk-5VMFMKJR.js";R();L();P();C();var U=(()=>{class a{constructor(s){this.viewSwitchService=s,this.colDef=[{id:"id",label:"ID",pinned:"left",width:60},{id:"task",label:"Task"},{id:"assignedTo",label:"Assigned",flex:1},{id:"createdBy",label:"Created by",flex:1},{id:"feature",label:"Feature",flex:2},{id:"storyPoints",label:"Story points",inputField:{id:"storyPoints",component:S}}],this.demoData=[],this.fewPeople=i.randomItems(()=>i.randomFullName()),this.demoItems=i.randomItems(t=>({id:t+1,task:i.gibberish(),assignedTo:i.randomItem(this.fewPeople),createdBy:i.randomItem(this.fewPeople),feature:i.gibberish(3)}),1,i.randomNumber(1,1e3)),this.datagrid={loadData:(t,o,e)=>{console.log("LOAD DATAGRID DATA",t,o,e);let u=this.demoItems;p.isSet(e)&&e.order=="asc"&&(u=this.demoItems.sort((d,m)=>{let n=d[e.column],r=m[e.column];return n>r?1:n<r?-1:0})),p.isSet(e)&&e.order=="desc"&&(u=this.demoItems.sort((d,m)=>{let n=d[e.column],r=m[e.column];return n>r?-1:n<r?1:0}));let y={items:A.range(this.demoItems,t,o),totalItems:this.demoItems.length};return i.randomRequest(y)},selectableRows:!0,selectByProperty:"id",rowActions:[{id:"demo-action",label:"Demo action",onSelected:()=>{console.log("ACTION SELECTED")}}]}}ngOnInit(){console.log("ALL DATA FOR DATAGRID",this.demoItems),this.viewSwitchService.setViewList({listTitle:"Datagrid test",listRequest:(s,t,o)=>{let e=this.datagrid.loadData(s,t,o);return console.log("LOAD DATA",e),e},columnsDef:this.colDef,gridSettings:this.datagrid})}static{this.\u0275fac=function(t){return new(t||a)(g(v))}}static{this.\u0275cmp=h({type:a,selectors:[["paw-sb-datagrid"]],decls:4,vars:3,consts:[[2,"height","400px"],[3,"cols","records","settings"]],template:function(t,o){t&1&&(l(0,"p"),I(1,"sb-datagrid works!"),c(),l(2,"div",0),b(3,"paw-datagrid",1),c()),t&2&&(f(3),D("cols",o.colDef)("records",o.demoData)("settings",o.datagrid))},dependencies:[w,T],encapsulation:2})}}return a})();export{U as SbDatagridComponent};
