import{a as i}from"./chunk-VGRXCTXL.js";import"./chunk-4G57JG5N.js";import"./chunk-MJMWESWV.js";import{a as S}from"./chunk-JI65IOIM.js";import{O as v,j as T}from"./chunk-57DG2VC5.js";import"./chunk-NMMBNW5X.js";import"./chunk-5IDV7BCW.js";import"./chunk-CVFNZXIB.js";import"./chunk-EU5XKS65.js";import"./chunk-XALE2GEX.js";import"./chunk-GJIGZB63.js";import"./chunk-TOJME4VO.js";import"./chunk-2CD72B3Z.js";import"./chunk-4TDNJBFX.js";import"./chunk-4LZAXRJQ.js";import"./chunk-XHRSSCXW.js";import{a as A,b as p}from"./chunk-5VDVFGVW.js";import"./chunk-NLMVBXFK.js";import"./chunk-BUHB7MLU.js";import"./chunk-KUS3L5XF.js";import{Bc as I,Eb as h,Fd as w,Vb as D,cc as l,dc as c,ec as b,rb as f,sb as g}from"./chunk-J476KISY.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};
