import{a as i}from"./chunk-EHFHHT2U.js";import"./chunk-RABF62S5.js";import"./chunk-MJMWESWV.js";import{a as S}from"./chunk-FIGHW4X4.js";import{n as v}from"./chunk-X2EAJMA6.js";import{p as T}from"./chunk-PPSZCPHP.js";import"./chunk-6IEN3EM2.js";import"./chunk-B4D6D4FF.js";import"./chunk-RWQFHLB3.js";import"./chunk-L7ZSBQSX.js";import"./chunk-DLQQOPQN.js";import"./chunk-H2CU6EEU.js";import"./chunk-GK2ZGAUD.js";import"./chunk-4TDNJBFX.js";import"./chunk-NUAVJ2U7.js";import"./chunk-2TNAYJH2.js";import"./chunk-JZGJVYPU.js";import"./chunk-OOGMMK6A.js";import{a as A,b as L,c as p,d as P}from"./chunk-PBM4LEG7.js";import"./chunk-QVLAHW2O.js";import"./chunk-TI6NUUOB.js";import"./chunk-LYCHGZAM.js";import{$b as D,Gc as I,Kb as h,Md as w,Sd as R,hc as l,ic as c,jc as b,nd as C,xb as f,yb as g}from"./chunk-PGS4AHIT.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: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{U as SbDatagridComponent};
