import{a as i}from"./chunk-U5KYSB37.js";import"./chunk-ZHJWMUOQ.js";import"./chunk-MJMWESWV.js";import{a as S}from"./chunk-QSXJP4VG.js";import{g as v}from"./chunk-FEZ7IZKQ.js";import{t as T}from"./chunk-3DLUOVC3.js";import"./chunk-VUGSZ2DS.js";import"./chunk-KDYFQMM5.js";import"./chunk-NPSSOGJG.js";import"./chunk-NLP6Q4GJ.js";import"./chunk-4TDNJBFX.js";import{q as A,r as p}from"./chunk-4TTMHS7H.js";import"./chunk-XWLOMB35.js";import{$b as l,Ad as w,Bb as h,Sb as D,ac as c,bc as b,ob as f,pb as g,xc as I}from"./chunk-NYZDFFAU.js";var k=(()=>{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:T}}],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(S))}}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,v],encapsulation:2})}}return a})();export{k as SbDatagridComponent};
