// @ts-nocheck import { Component, ViewChild } from "@angular/core"; import { FastGridComponent } from "fastgrid-angular"; const src = ({ //. All layout and data for grid //. --- Custom JavaScript functions and properties accessible by API by Grid.Script.XXX --- Script: { //. --- Calculates all and verified summary in TotalRow1, TotalRow2 (row==null) and Group (row set) rows --- //. id can be "R1" or "R2" as D id to sum these rows monthtotal: function(G,row,col,id){ var sum = 0, sumver = 0, idx = col.id.slice(1), amount = G.Cols["A"+idx], price = G.Cols["P"+idx], ver = G.Cols["V"+idx], D = G.DefRows[id], L = row ? row.L : -10; if(!row&&G.Script[id+"All"+idx]!=null){ //. Precalculated results in data for TotalRow rows sum = G.Script[id+"All"+idx]; sumver = G.Script[id+"Ver"+idx]; G.Script[id+"All"+idx] = null; G.Script[id+"Ver"+idx] = null; } else G.IterSimple(row||G.GetFirst("Body"),function(r){ if(r.L<=L) return true; if(r.D==D&&~r.O&4/*&&!(G.IsHidden(r)&3)*/) { var v = G.GetValueSimple(r,amount) * G.GetValueSimple(r,price); if(v){ sum += v; if(G.GetValueSimple(r,ver)>0) sumver += v; } } //if(r.D==D&&~r.O&4/*&&!(G.IsHidden(r)&3)*/) { var v = r.V[amount.VIndex] * r.V[price.VIndex]; if(v){ sum += v; if(r.V[ver.VIndex]>0) sumver += v; } } },!row); return "all: "+G.NumberToString(sum,",0.##")+"; verified: "+G.NumberToString(sumver,",0.##")+""; }, //. --- subtract TotalRow1 - TotalRow2 values to TotalRow3 row --- monthsubtract: function(G,row,col){ var r2 = G.GetPrev(row), r1 = G.GetPrev(r2), v1 = G.GetValue(r1,col).replace(/\#\w+/g,"").replace(/[^\d\.\;\-]/g,"").split(";"), v2 = G.GetValue(r2,col).replace(/\#\w+/g,"").replace(/[^\d\.\;\-]/g,"").split(";"); return "all: "+G.NumberToString(v1[0]-v2[0],",0.##")+"; verified: "+G.NumberToString(v1[1]-v2[1],",0.##")+""; }, //. --- sums all and verified results in Group and TotalRowX rows to TotalCol column --- fulltotal: function(G,row,col,pos){ for(var i=1,sum=0;i<=12;i++){ var v = G.GetValue(row,G.Cols["A"+i]); if(typeof(v)=="string"){ v = v.replace(/\#\w+/g,"").replace(/[^\d\.\;\-]/g,"").split(";"); sum += v[pos]-0||0; } } return sum; }, //. --- Calculates counts of all and visible rows / columns / cells for Info cell on Toolbar --- rowstotal: function(G){ var ra = G.Count("Body"), rv = G.Count("Body",15), ca = 0, cv = 0; for(var c in G.Cols){ ca++; if(!G.IsHidden(G.Cols[c])) cv++; } return "Shown "+G.NumberToString(rv,",0")+(ra!=rv?" / "+G.NumberToString(ra,",0"):"")+" rows, "+cv+(cv!=ca?" / "+ca:"")+" columns, "+G.NumberToString(rv*160/3,",0")+(rv!=ra?" / "+G.NumberToString(ra*160/3,",0"):"")+" cells"; }, //. --- Returns list of parent groups --- getgroups: function(G,row,col){ var par = G.GetParent(row), tree = G.GetTreeCol(row); if(!par) return ""; var pv = G.GetValue(par,col)||"", v = G.GetString(par,tree)||""; return pv + (pv&&v ? ", " : "") + v; }, //. --- Custom AI API function, to choose which child row will be used to sort contractors by TotalCol / Amount / Price / Total / Verified columns setsortbychild: function(G,child){ G.SortByChild = child=="Gain" ? 2 : child=="2022" ? 1 : 0; } }, //. --- API events assigned to this grid --- Events: { //. --- Manually updates Formula results after editing cell --- OnAfterSetValue: function(G,row,col,val,oval){ var idx = col.id.slice(1); if(idx-0 && !row.Filter){ //. Amount/Price/Verified column var total = row.D.id=="R1" ? G.Rows.TotalRow1 : G.Rows.TotalRow2; var cc = G.Cols["A"+idx], c = col.id[0], V = G.GetValue(row,G.Cols["V"+idx]), P = G.GetValue(row,G.Cols["P"+idx]), A = G.GetValue(row,G.Cols["A"+idx]); var v = G.GetResult(total,cc); if(v==null) return; v = v.replace(/\#\w+/g,"").replace(/[^\d\.\;\-]/g,"").split(";"); v[0] -= 0; v[1] -= 0; var d = (val||0) - (oval||0); if(c=="A"){ v[0] += d*P; if(V) v[1] += d*P; } else if(c=="P"){ v[0] += d*A; if(V) v[1] += d*A; } else if(c=="V"){ if(val) v[1] += A*P; else v[1] -= A*P; } if((c=="A"||c=="P")&&row.D.id=="R1") for(var par=G.GetParent(row);par;par=G.GetParent(par)){ //. Group parents //G.SetResult(par,col,c=="A" ? G.GetResult(par,col)+d : null); G.SetResult(par,G.Cols["A"+idx]); G.SetResult(par,G.Cols.TotalCol); } var r3 = G.GetNext(G.GetNext(row)); G.SetResult(r3,col); G.SetResult(r3,col,null,null,"TextColor"); G.SetResult(r3,G.Cols["T"+idx]); G.SetResult(r3,G.Cols["T"+idx],null,null,"TextColor"); G.SetResult(r3,G.Cols.TotalCol); G.SetResult(r3,G.Cols.TotalCol,null,null,"TextColor"); G.SetResult(total,cc,"all: "+G.NumberToString(v[0],",0.##")+"; verified: "+G.NumberToString(v[1],",0.##")+""); G.SetResult(G.Rows.TotalRow3,cc); G.SetResult(total,G.Cols.TotalCol); G.SetResult(G.Rows.TotalRow3,G.Cols.TotalCol); G.SetResult(G.Rows.TotalRow3,G.Cols.TotalCol,null,null,"TextColor"); G.Repaint(total,1); G.Repaint(r3,1); } else if(col.id=="Region"||col.id=="Country"){ G.SetResult(row,G.Cols.State,null,0,"RightIcons"); G.SetResult(row,G.Cols.State,null,0,"Button"); G.SetResult(row,G.Cols.State,null,0,"NoEdit"); } }, //. --- Manually updates Formula results after deleting row(s) --- OnDeleting: function(G,rows,del){ if(rows.length>300) { G.Recalculate(); return; } for(var i=0;iNow the changes are accepted like they were saved." }} }, //. Simulated save //@ IgnoreF:1, //. Set it to 1 to ignore all Fx fast attributes and behave normally and slower with only standard cell attributes }, AI:{ StaticInstructions:"", //. To avoid generating default static instructions DynamicInstructions:"", //. To avoid generating default dynamic instructions //. Sample input history to demonstrate various AI tasks InputHistory: "|-|What is in table?|What can you do?" + "|What is the highest value in Amount in January?|What is the highest Price?" + "|What is the total price of vendors registered after year 2011 in Brazil?" + "|What is the most common surname?" + "|Select all contractors from Countries starting by B|Choose all vendors from countries in Asia|Select contractors registered after 2/1/2014" + "|Mark and focus the highest and lowest not zero values in Amount columns" + "|Double values in Amount columns|Add 3 months to dates in America" + "|Set February prices in Canada to 1,234.56|Change all rows with surname James to surname Nulland" + "|Set all contractors data verified|Set all vendors data as not verified and next select all vendors that were changed in every month" + "|Change Brazil to Germany in all contractors" + "|Delete all contractors from Europe|Delete all rows" + "|Add 100 vendors to Berlin|Add 10000 contractors and fill their data with meaningful random values, including their details" + "|Copy contractors from USA below the sources each|Copy contractors from Brazil, with values in main rows and empty details" + "|Show only Wisconsin|Show dates between 10/1/2005 and 7/6/2010|Show only names with are least 20 characters|Filter and mark all Amounts less than -20 or higher than 40" + "|Group by month from Since|Sort by Total Gain descending" + "|Hide Amount and Price|Move March to the left section|Undo it" + "|Export data to xlsx", APIFunctions: { //. Description of custom AI API functions. The custom JavaScript functions are defined in Script. setsortbychild: { Param:"child", Use:"Do", Desc:"sets if the Contractor itself or which its child row will be used for sorting by right column Total and by data columns Amount, Price, Total, Verified; " + "'child can be '2023', '2022' or 'Gain'; by default is sorted by '2023' as the Contractor row itself" } } }, Format: { //. Custom colors fd: "MM/dd/yy", //. Date format for FT, value 10, used for Since column nfg:",0.##", //. Number format for FT, value 5, used for Amount, Price and Total columns and TotalCol column nfp:"0.##\\%", //. Number format for FT, value 8, used for Rabat column }, Locks: { Data:"Data" }, LockNames: { Data:"Restrict choosing data set" }, //. Custom Lock names Styles: { Base: { Colors: { red:"red", green:"#080", blue:"blue", gray:"#AAA", dark:"black" } }, White: { Colors: { } }, Dark: { Colors: { red:"#C66", green:"#0B0", blue:"#0BB", gray:"#888", dark:"#BBB", outer:"#555" } }, Black: { Colors: { red:"#C66", green:"#0A0", blue:"#0AA", gray:"#888", dark:"#AAA", outer:"#555" } }, }, Cookie: { Rows:"First,Height,CS,Mirror", //. Saves Height to DefRows, CS with Mirror cells, iterates only first page in every part RowParts:"-", Parts: { Body: "Sort,Group,Filter,Height,Alternate,AlternateCount,CollapseLevel", Head2:"CollapseLevel", Foot:"CollapseLevel" } //. Defines the Cookie only for Body part instead of all Row parts }, RowParts: [ { id:"TopScroll", Hidden:0 }, { id:"Head2", Prev:"Head", Rel:100000, MinHeight:70, MinHeightResize:0 }, { id:"Head3", Prev:"Head2" } ], ColParts: [ { Clear:1 }, { id:"LeftScroll", Type:"Scroll", Item:"$ItemLeftScroll" }, { id:"ColsIndex", Type:"Cols", NoResize:1, ExportFixed:1 }, { id:"LeftCols", Type:"Cols", Rel:100000, MinWidth:180, MinWidthResize:21, MaxWidth:500, ExportFixed:1 }, { id:"Cols1", Type:"Cols", Rel:2, MinWidth:80, MinWidthResize:21 }, { id:"Cols2", Type:"Cols", Rel:2, MinWidth:80, MinWidthResize:21 }, { id:"RightCols",Type:"Cols", Rel:100000, MinWidth:70, MinWidthResize:21, MaxWidth:500 }, { id:"RightScroll",Type:"Scroll", Item:"$ItemRightScroll" } ], DefCells: { Base: { ColBorderFormula:"return Row.D.id!='Header'&&Col.Block&&(Grid.GetPrev(Col)||{}).Block!=Col.Block ? 'outer,' : ''" }, //. Calculates left border in every month block Cell: { }, //. Defined to use Base to all cells R1Base: { SortValueFormula:"!Grid.SortByChild ? null : Grid.GetValue(Grid.SortByChild==2 ? Grid.GetLastChild(Row) : Grid.GetFirstChild(Row),Col)" }, R1State: { RightIconsFormula:"Grid.GetList(Row,Col)?'List':''", ButtonFormula:"Grid.GetList(Row,Col)?'List':''", NoEditFormula:"Grid.GetList(Row,Col)?0:2" }, R1SinceWeekDay: { SortValueFormula:"new Date(Grid.GetValue(Row,Grid.Cols.Since)).getUTCDay()" }, R1SinceMonth: { SortValueFormula:"var v=new Date(Grid.GetValue(Row,Grid.Cols.Since)).getUTCMonth();return v<10?'0'+v:v;" }, R1Year: { Value:2023 }, R2Year: { Value:2022 }, R3Year: { Value:"Gain" }, //. Amount column in R3 rows R3Base: { //. Amount / Price / Total columns in R3 rows ValueFormula:"Grid.GetNumber(Grid.GetParent(Row),Col) - Grid.GetNumber(Grid.GetPrev(Row),Col)", TextColorFormula:"CValue>0?Grid.Colors.blue:CValue<0?Grid.Colors.red:Grid.Colors.gray", }, R1A: { D:"R1Base" }, R1P: { D:"R1Base" }, R1T: { D:"R1Base" }, R1TotalCol: { D:"R1Base" }, R3A: { D:"R3Base" }, R3P: { D:"R3Base" }, R3T: { D:"R3Base" }, R3TotalCol: { D:"R3Base" }, R3V: { ValueFormula:"[0,-1,1][Grid.GetNumber(Grid.GetParent(Row),Col) + Grid.GetNumber(Grid.GetPrev(Row),Col)]" }, //. Verified column in R3 rows TA: { Type:"Html", Align:2 }, T1A: { D:"TA", ValueFormula:"Grid.Script.monthtotal(Grid,null,Col,'R1')" }, T2A: { D:"TA", ValueFormula:"Grid.Script.monthtotal(Grid,null,Col,'R2')" }, T3A: { D:"TA", ValueFormula:"Grid.Script.monthsubtract(Grid,Row,Col)" }, FilterV: { LeftIcons:"", Range:0 }, Filter2V: { LeftIcons:"", Range:0 }, Filter3V: { LeftIcons:"", Range:0, BoolCycle:2 }, GA: { D:"TA", ValueFormula:"Grid.Script.monthtotal(Grid,Row,Col,'R1')" }, GPanel: { LeftIcons:"DeleteRow" }, GIndex: { NoSearch:1 }, GName: { Wrap:0 }, GRegion: { NoEdit:1 }, H2A: { Align:2, SortColFormula:"'T'+Col.id.slice(1)" } }, DefRows: { Row: { }, R: { Tree:"Year", Accept:"", DHeight:1, ResizeHeight:1 }, R1: { D:"R", DA:"R1", AIKind:"Contractor", NoSelect:0, Block:"B1", RS:{ Index:3, Panel:3, Name:3, Region:3, Country:3, State:3, Partner:3, Since:3, Calls:3, Rabat:3, SinceMonthDay:3, SinceWeekDay:3, SinceMonth:3, SinceYear:3 }, //@ FV: { Amount:0, Price:0, Total:1, Verified:0, Col:0, Location:0, Year:8, TotalCol:1, Index:0 }, //@ FT: { Amount:5, Price:5, Total:5, Verified:15, Name:1, Region:20, Country:24, State:24, Partner:15, Since:10, Calls:20, Rabat:8, Year:0, TotalCol:5, Index:4 }, //@ FS: { Amount:1, Price:1, Total:1+256, Verified:2+32, Col:0, Since:1, Rabat:1, Year:1+32+256, TotalCol:1+256, Name:8, Location:8, Calls:8, Index:1+64+256 }, //@ FA: { Amount:0, Price:0, Total:0, Verified:0, Col:0, Location:256, Since:256, Calls:256, Index:0 }, //@ FE: 1+2+32+64 }, R2: { D:"R", DA:"R2", AIKind:"2022", NoSelect:8, L:1, TextColor:"gray", NoIndex:1, NoEdit:1, //@ FV: { Amount:0, Price:0, Total:1, Verified:0, Col:0, Location:0, Year:8, TotalCol:1 }, //@ FT: { Amount:5, Price:5, Total:5, Verified:15, Col:0, TotalCol:5 }, //@ FS: { Amount:1, Price:1, Total:1, Verified:2+32, Col:0, Since:1, Rabat:1, Year:1+32+256, TotalCol:1 }, //@ FE: 1+2+32+64 }, R3: { D:"R", DA:"R3", AIKind:"Gain", NoSelect:8, L:1, NoIndex:1, NoEdit:1, Formula:"", RowBorder:",outer", NoSave:1, //@ FV: { Amount:1+8, Price:1+8, Total:1+8, Verified:1+8, Col:0, Location:0, Year:8, TotalCol:1+8 }, //@ FT: { Amount:5, Price:5, Total:5, Verified:15, Col:0, TotalCol:5 }, //@ FS: { Amount:1+32+256, Price:1+32+256, Total:1+32+256, Verified:2+32, Col:0, Since:1, Rabat:1, Year:1+32+256, TotalCol:1+32+256 }, //@ FE: 1+2+32+64 }, Header: { Height:25, Item:"Headers" }, TotalRow: { Tree:"Year", AIKind:"Total", NoEdit:1, NoIndex:1, CS: { Region:11 }, NoSelect:3, NoSearch:1, NoDelete:1, Item:"Totals" }, Filter: { MinHeight:18, Range:1 }, R1Filter: { D:"Filter,R1" },//, FV:-1, FT:-1, FS:-1, FA:-1 }, Group: { DA:"G", CD:"R1", Accept:"Row,R1", AIKind:"Group", Color:"group", Formula:"", DHeight:1, F: { TotalCol:"Grid.Script.fulltotal(Grid,Row,Col,0)", Region:"Grid.Script.getgroups(Grid,Row,Col)" }, NoCalc:1, NoIndex:1, NoFilterRow:2, NoSelect:1, NoEdit:1, NoMove:1, NoPaste:2, A: { Region: { TextColor:"gray", Mirror:3, MirrorRow:"GroupChildren", Color:"group" }, Country: { Mirror:3, MirrorRow:"GroupChildren", Color:"group" }, State: { Mirror:3, MirrorRow:"GroupChildren", Color:"group" } }, //. For sorting CS: { Region:7, A1:4, A2:4, A3:4, A4:4, A5:4, A6:4, A7:4, A8:4, A9:4, A10:4, A11:4, A12:4 }, DCS:1, //@ FV: { Amount:1+8, Price:0, Total:0, Verified:0, Col:0, Location:0, Year:8, Name:8, Region:1+8, TotalCol:1+8, Index:32 }, //@ FT: { Amount:2, Price:3, Total:3, Verified:3, Col:3, TotalCol:5, Name:31, Region:2, Index:3 }, //@ FS: { Amount:2+32+64, Region:64+256, Col:64, Location:64, TotalCol:64+256, Index:1+64 }, //@ FA: { Amount:0, Region:0, Col:0, TotalCol:0, Index:0, Name:256 }, //@ FE: 1+2+32+64 }, }, Head: [ { id:"Header2", D:"Header", DA:"H2", Wrap:4, Index:0, LevelsPart:"Head2,Body,Foot", V: { Name:"Name", Region:"Region", Country:"Country", State:"State or\nProvince", Partner:"Partner", Since:"Since", Calls:"Calls per", Rabat:"Rabat", Year:"Year", TotalCol:"Total", SinceMonthDay:"Since Day", SinceWeekDay:"Since Weekday", SinceMonth:"Since Month", SinceYear:"Since Year" }, A: { Panel: { LeftIcons:"SelectRows,DeleteRows",IconWrap:1 }, Rabat:{ Rotate:290, Align:2 }, Partner: { Rotate:290, PaddingLeft:0, PaddingRight:0, Align:2 } }, RS: { Index:2, Panel:2, Name:2, Region:2, Country:2, State:2, Partner:2, Since:2, Calls:2, Rabat:2, Year:2, TotalCol:2, SinceMonthDay:2, SinceWeekDay:2, SinceMonth:2, SinceYear:2 } }, { id:"Header", D:"Header" } ], Head2: [ { id:"Filter", D:"R1Filter", DA:"Filter", AIKind:"Filter", Block:3, L:0, FilterD:"R1", FilterBlock:1, FilterAction:1, DefaultFilter:1, NoSelect:3, Item:"Filters", A: { Panel: { D:"FilterAction" }, Name: { DefaultFilter:11 }, Partner: { LeftIcons:"", Range:0 }, Region: { LeftIcons:"" }, Country: { LeftIcons:"", D:"R1State" }, State: { LeftIcons:"", D:"R1State" }, Since: { LeftIcons:"Filter,Date", RightIcons:"", Wrap:2, IconWrap:3 }, Calls: { LeftIcons:"" }, Rabat: { IconWrap:4, IconVertAlign:0 }, Year: { Value:"", LeftIcons:"", RightIcons:"List", Button:"List", TextColor:"dark", Wrap:1, FilterBlock:0, FilterD:"", VertAlign:0, ListMenu:[ "*FilterOff", "-" , { id:2023, V:[2023,1], NoEdit:1 }, "2022", "Gain" ] } }, RS: { Year:3, Panel:1 } }, { id:"Filter2", D:"Filter", DA:"Filter2", L:1, Tree:"Year", FilterD:"R2", FilterBlock:1, FilterAction:1, DefaultFilter:1, Item:"Filters", A: { Panel: { D:"FilterAction" } } }, { id:"Filter3", D:"Filter", DA:"Filter3", L:1, Tree:"Year", FilterD:"R3", FilterBlock:1, FilterAction:1, DefaultFilter:1, Item:"Filters", A: { Panel: { D:"FilterAction" } } }, ], Head3: [ { id:"Sticky", D:"Sticky", CS: { Region:7 }, ColBorder:"group", Type:"String", A: { Name: { Static:1, ColBorder:"" }, Region: { RightIcons:"", Button:"" } } }, //. Shows parent values when parent moved above body top, for grouped grid ], Head3_Cfg: { BorderColorLeftCols:",group", BorderColorCols1:",group", BorderColorCols2:",group", OverlayParts:"LeftCols,Cols1,Cols2,RightCols" }, Foot: [ { id:"TotalRow1", D:"TotalRow", DA:"T1", Block:3, Formula:"", F: { TotalCol:"Grid.Script.fulltotal(Grid,Row,Col,0)" }, V: { Name:"Total", Year:2023 }, CS: { A1:4, A2:4, A3:4, A4:4, A5:4, A6:4, A7:4, A8:4, A9:4, A10:4, A11:4, A12:4 }, RS: { Index:3, Panel:3, Name:3, Region:3 }, A: { Panel: { LeftIcons:"" }, TotalCol: { TextStyle:1, TextColor:"dark" } } }, { id:"TotalRow2", D:"TotalRow", DA:"T2", L:1, TextColor:"gray", Formula:"", F: { TotalCol:"Grid.Script.fulltotal(Grid,Row,Col,0)" }, V: { Year:2022 }, CS: { A1:4, A2:4, A3:4, A4:4, A5:4, A6:4, A7:4, A8:4, A9:4, A10:4, A11:4, A12:4 }, A: { TotalCol: { TextStyle:1 } } }, { id:"TotalRow3", D:"TotalRow", DA:"T3", L:1, Formula:"",F: { TotalCol:"Grid.Script.fulltotal(Grid,Row,Col,0)" }, NoSelect:3, NoSearch:1, Tree:"Year", CS: { A1:4, A2:4, A3:4, A4:4, A5:4, A6:4, A7:4, A8:4, A9:4, A10:4, A11:4, A12:4 }, A: { Year: { Value:"Gain" }, TotalCol: { TextStyle:1, TextColorFormula:"CValue>0?'blue':CValue<0?'red':'dark'" } } }, ], DefCols: { Base: { Item:0 }, Number: { Type:"Number", ResizeWidth:1, DWidth:1, Format:",0.##", ExportFormat:"#,0", NoPaste:1 }, Location: { Type:"String", RightIcons:"List", Button:"List", Wrap:2, IndexList:1, Item3:"Location" }, Amount: { DA:"A", D:"Number", Item1:"A", Width:60, UCode:0x08, V:{ Header:"Amount" }, CS: { Header2: 4 } }, Price: { DA:"P", D:"Number", Item1:"P", Width:70, UCode:0x807, V:{ Header:"Price" } }, Total: { DA:"T", D:"Number", Item1:"T", Width:90, V: { Header:"Total" }, NoEdit:1, TextColor:"green" }, Verified:{ DA:"V", Type:"Bool", Item1:"V",Width:60, ResizeWidth:1, DWidth:1, UCode:0x0B, NoPaste:1, V:{ Header:"Verified" } }, SincePart: { Type:"String", NoEdit:1, Hidden:1 } }, ColsIndex: [ { id:"Index", D:"Index", DA:"Index", Wrap:3, NoExport:0, Item:"", Item2:-1 }, //, FV:0, FT:4, FS:1+64+256, FA:0 }, ], LeftCols: [ { id:"Panel", D:"Panel", DA:"Panel", LeftIcons:"SelectRow,DeleteRow,AddRow", IconWrap:1, Width:25, Item2:"Buttons" }, { id:"Name", DA:"Name", UCode:0xD1, UIndex:30, Type:"String", Wrap:2, Width:120, GroupWidth:220, Names:1, Item2:-1 }, //. Surname is in Texts, first name in UTexts ], Cols1: [ { id:"Region", D:"Location", UCode:0x08, UIndex:24.5, DA:"Region", ClearCells:"Country,State", Width:125, List:"|Central & South Asia|East Asia & the Pacific|East Europe|Middle East & North Africa|North & Central America|South America|Sub-Saharan Africa|West Europe" }, { id:"Country", D:"Location", UCode:0x08, UIndex:25.1, DA:"Country", ListRelated:"Region", ClearCells:"State", Width:110, SortList:1, List: [ "|Armenia|Azerbaijan|Bangladesh|India|Kazakstan|Pakistan|Sri Lanka", "|Australia|Brunei|China|Hong Kong|Indonesia|Japan|Korea, dpr|Malaysia|Mongolia|Myanmar|New Zealand|Papua New Guinea|Philippines|Singapore|South Korea|Taiwan|Thailand|Vietnam", "|Albania|Belarus|Bulgaria|Croatia|Czech Republic|Estonia|Hungary|Latvia|Lithuania|Moldova|Poland|Romania|Russia|Serbia-Montenegro|Slovak Republic|Slovenia|Ukraine", "|Algeria|Bahrain|Egypt|Iran|Iraq|Israel|Jordan|Kuwait|Lebanon|Libya|Morocco|Oman|Qatar|Saudi Arabia|Syria|Tunisia|UAE|Yemen", "|Bahamas|Canada|Costa Rica|Cuba|Dominican Republic|El Salvador|Guatemala|Haiti|Honduras|Jamaica|Mexico|Nicaragua|Panama|Trinidad & Tobago|United States", "|Argentina|Bolivia|Brazil|Chile|Colombia|Ecuador|Guyana|Paraguay|Peru|Suriname|Uruguay|Venezuela", "|Angola|Botswana|Burkina Faso|Cameroon|Congo|Congo dr|Cote d'Ivoire|Ethiopia|Gabon|Gambia|Ghana|Guinea|Guinea-Bissau|Kenya|Liberia|Madagascar|Malawi|Mali|Mozambique|Namibia|Niger|Nigeria|Senegal|Sierra Leone|Somalia|South Africa|Sudan|Tanzania|Togo|Uganda|Zambia|Zimbabwe", "|Austria|Belgium|Cyprus|Denmark|Finland|France|Germany|Greece|Iceland|Ireland|Italy|Luxembourg|Malta|Netherlands|Norway|Portugal|Spain|Sweden|Switzerland|Turkey|United Kingdom" ]}, { id:"State", D:"Location", UCode:0x01, UIndex:26, DA:"State", ListRelated:"Region,Country", Width:90, SortList:1, List: { 0: { 3: "|Andhra Pradesh|Arunachal Pradesh|Assam|Bihar|Chhattisgarh|Goa|Gujarat|Haryana|Himachal Pradesh|Jharkhand|Karnataka|Kerala|Madhya Pradesh|Maharashtra|Manipur|Meghalaya|Mizoram|Nagaland|Odisha|Punjab|Rajasthan|Sikkim|Tamil Nadu|Telangana|Tripura|Uttar Pradesh|Uttarakhand|West Bengal|-|Andaman and Nicobar Islands|Chandigarh|Dadra and Nagar Haveli and Daman and Diu|Delhi|Jammu and Kashmir|Ladakh|Lakshadweep|Puducherry" }, 1: { 0: "|New South Wales|Queensland|South Australia|Tasmania|Victoria|Western Australia|-|Australian Capital Territory|Jervis Bay Territory|Northern Territory|Australian Antarctic Territory|Christmas Island|Cocos (Keeling) Islands|Heard Island and McDonald Islands|Norfolk Island", 2: "|Anhui|Beijing|Chongqing|Fujian|Guangdong|Gansu|Guizhou|Henan|Hubei|Hebei|Hainan|Heilongjiang|Hunan|Jilin|Jiangsu|Jiangxi|Liaoning|Qinghai|Sichuan|Shandong|Shanghai|Shaanxi|Shanxi|Tianjin|Yunnan|Zhejiang|-|Guangxi Zhuang|Inner Mongolia|Ningxia Hui|Xinjiang Uyghur|Tibet", 5: "|Chūbu|Chūgoku|Hokkaidō|Kansai|Kantō|Kyūshū|Shikoku|Tōhoku" }, 4: { 1: "|Alberta|British Columbia|Manitoba|New Brunswick|Newfoundland and Labrador|Nova Scotia|Ontario|Prince Edward Island|Quebec|Saskatchewan", 14: "|Alabama|Alaska|Arizona|Arkansas|California|Colorado|Connecticut|Delaware|Florida|Georgia|Hawaii|Idaho|Illinois|Indiana|Iowa|Kansas|Kentucky|Louisiana|Maine|Maryland|Massachusetts|Michigan|Minnesota|Mississippi|Missouri|Montana|Nebraska|Nevada|New Hampshire|New Jersey|New Mexico|New York|North Carolina|North Dakota|Ohio|Oklahoma|Oregon|Pennsylvania|Rhode Island|South Carolina|South Dakota|Tennessee|Texas|Utah|Vermont|Virginia|Washington|West Virginia|Wisconsin|Wyoming|-|District of Columbia|-|American Samoa|Guam|Northern Mariana Islands|Puerto Rico|U.S. Virgin Islands" }, 5: { 2: "|Acre|Alagoas|Amapá|Amazonas|Bahia|Ceará|Distrito Federal|Espírito Santo|Goiás|Maranhão|Mato Grosso|Mato Grosso do Sul|Minas Gerais|Pará|Paraíba|Paraná|Pernambuco|Piauí|Rio de Janeiro|Rio Grande do Norte|Rio Grande do Sul|Rondônia|Roraima|Santa Catarina|São Paulo|Sergipe|Tocantins", }, 7: { 5: "|Alsace|Aquitaine|Auvergne|Brittany|Burgundy|Centre-Val de Loire|Champagne-Ardenne|Franche-Comté|Île-de-France|Languedoc-Roussillon|Limousin|Lorraine|Lower Normandy|Midi-Pyrénées|Nord-Pas-de-Calais|Pays de la Loire|Picardy|Poitou-Charentes|Provence-Alpes-Côte d'Azur|Rhône-Alpes|Upper Normandy", 6: "|Baden-Württemberg|Bavaria|Berlin|Brandenburg|Bremen|Hamburg|Hesse|Lower Saxony|Mecklenburg-Western Pomerania|North Rhine-Westphalia|Rhineland-Palatinate|Saarland|Saxony|Saxony-Anhalt|Schleswig-Holstein|Thuringia", 10: "|Abruzzo|Aosta Valley|Apulia|Basilicata|Calabria|Campania|Emilia-Romagna|Friuli Venezia Giulia|Lazio|Liguria|Lombardy|Marche|Molise|Piedmont|Sardinia|Sicily|Trentino-South Tyrol|Tuscany|Umbria|Veneto", 16: "|Andalusia|Aragon|Asturias|Balearic Islands|Basque Country|Canary Islands|Cantabria|Castile and León|Castilla–La Mancha|Catalonia|Community of Madrid|Extremadura|Galicia|La Rioja|Navarre|Region of Murcia|Valencian Community|-|Ceuta|Melilla", 20: "|England|Northern Ireland|Scotland|Wales", } }}, { id:"Partner", UCode:0x0B, UIndex:25, Type:"Bool", Width:25, Item3:-1, ShortColBorder:0 }, { id:"Since", UCode:FGrid.GetUCode(2,1,12,1,0,0,0,Date.UTC(2020,1,1)), UIndex:28, Width:95, Type:"Date", Wrap:2, Format:"MM/dd/yy", EditFormat:"M/d/yyyy", RightIcons:"Date", Item3:-1 }, { id:"Calls", UCode:0x0D, UIndex:24, Type:"Auto", Wrap:2, Width:85, IndexList:1, RightIcons:"List", Button:"List", List:"|week|month|quarter|half year|year", Item3:-1 }, { id:"Rabat", UCode:0x01, UIndex:27, Type:"Number", Format:"0.##\\%", ExportFormat:"General\\%", Width:35, Item3:-1 }, //. Hidden columns with parsed Since date, usable for grouping, sorting or filtering by AI { id:"SinceWeekDay", D:"SincePart", Formula:"Grid.DateToString(Since,'dddd')", Item2:"Since Weekday", DA:"SinceWeekDay" }, { id:"SinceMonthDay", D:"SincePart", Formula:"Grid.DateToString(Since,'dd')", Item2:"Since Day" }, { id:"SinceMonth", D:"SincePart", Formula:"Grid.DateToString(Since,'MMMM')", Item2:"Since Month", DA:"SinceMonth" }, { id:"SinceYear", D:"SincePart", Formula:"Grid.DateToString(Since,'yyyy')", Item2:"Since Year" } ], Cols2: [ { id:"A1", D:"Amount", UIndex:0.1, Item:1, V: { Header2:"January" } }, { id:"P1", D:"Price", UIndex:1, Item:1 }, { id:"T1", D:"Total", Item:1, Formula:"A1*P1" }, { id:"V1", D:"Verified", UIndex:0, Item:1 }, { id:"A2", D:"Amount", UIndex:2.1, Item:2, V: { Header2:"February" } }, { id:"P2", D:"Price", UIndex:3, Item:2 }, { id:"T2", D:"Total", Item:2, Formula:"A2*P2" }, { id:"V2", D:"Verified", UIndex:2, Item:2 }, { id:"A3", D:"Amount", UIndex:4.1, Item:3, V: { Header2:"March" } }, { id:"P3", D:"Price", UIndex:5, Item:3 }, { id:"T3", D:"Total", Item:3, Formula:"A3*P3" }, { id:"V3", D:"Verified", UIndex:4, Item:3 }, { id:"A4", D:"Amount", UIndex:6.1, Item:4, V: { Header2:"April" } }, { id:"P4", D:"Price", UIndex:7, Item:4 }, { id:"T4", D:"Total", Item:4, Formula:"A4*P4" }, { id:"V4", D:"Verified", UIndex:6, Item:4 }, { id:"A5", D:"Amount", UIndex:8.1, Item:5, V: { Header2:"May" } }, { id:"P5", D:"Price", UIndex:9, Item:5 }, { id:"T5", D:"Total", Item:5, Formula:"A5*P5" }, { id:"V5", D:"Verified", UIndex:8, Item:5 }, { id:"A6", D:"Amount", UIndex:10.1, Item:6, V: { Header2:"June" } }, { id:"P6", D:"Price", UIndex:11, Item:6 }, { id:"T6", D:"Total", Item:6, Formula:"A6*P6" }, { id:"V6", D:"Verified", UIndex:10, Item:6 }, { id:"A7", D:"Amount", UIndex:12.1, Item:7, V: { Header2:"July" } }, { id:"P7", D:"Price", UIndex:13, Item:7 }, { id:"T7", D:"Total", Item:7, Formula:"A7*P7" }, { id:"V7", D:"Verified", UIndex:12, Item:7 }, { id:"A8", D:"Amount", UIndex:14.1, Item:8, V: { Header2:"August" } }, { id:"P8", D:"Price", UIndex:15, Item:8 }, { id:"T8", D:"Total", Item:8, Formula:"A8*P8" }, { id:"V8", D:"Verified", UIndex:14, Item:8 }, { id:"A9", D:"Amount", UIndex:16.1, Item:9, V: { Header2:"September" } },{ id:"P9", D:"Price", UIndex:17, Item:9 }, { id:"T9", D:"Total", Item:9, Formula:"A9*P9" }, { id:"V9", D:"Verified", UIndex:16, Item:9 }, { id:"A10", D:"Amount", UIndex:18.1, Item:10, V: { Header2:"October" } }, { id:"P10", D:"Price", UIndex:19, Item:10 }, { id:"T10", D:"Total", Item:10, Formula:"A10*P10" }, { id:"V10", D:"Verified", UIndex:18, Item:10 }, { id:"A11", D:"Amount", UIndex:20.1, Item:11, V: { Header2:"November" } }, { id:"P11", D:"Price", UIndex:21, Item:11 }, { id:"T11", D:"Total", Item:11, Formula:"A11*P11" }, { id:"V11", D:"Verified", UIndex:20, Item:11 }, { id:"A12", D:"Amount", UIndex:22.1, Item:12, V: { Header2:"December" } }, { id:"P12", D:"Price", UIndex:23, Item:12 }, { id:"T12", D:"Total", Item:12, Formula:"A12*P12" }, { id:"V12", D:"Verified", UIndex:22, Item:12 }, ], RightCols: [ { id:"Year", DA:"Year", Type:"String", NoEdit:1, Align:1, Width:85, TextColor:"gray", NoSortBy:1, NoGroupBy:1, Item2:-1 }, { id:"TotalCol", DA:"TotalCol", Type:"Number", Formula:"T1+T2+T3+T4+T5+T6+T7+T8+T9+T10+T11+T12", Format:",0.##", ExportFormat:"#,0", NoEdit:1, Width:115, TextColor:"green", Item2:-1, Name:"Total" } ], Body_Cfg: { GroupTree:"Name", Group:"Region,Country,State", CD:"R1", Par:"P1,P2", HoverCol:["Body","Head2"], FocusCol:["Body","Head2"], BorderColor:",,outer,", BorderColorLeftScroll:"", BorderColorRightScroll:"", ScrollOnDrag:"", StickyRow:"Sticky", StickyCol:"Name", }, TopScroll_Cfg: { ScrollOnDrag:"1,-4000%,Body" }, Head_Cfg: { HoverCol:["Body","Head2"], FocusCol:["Body","Head2"], ScrollOnDrag:"0.5,-400%,Body,1,-50%,Body" }, Head2_Cfg: { HoverCol:["Body","Head2"], FocusCol:["Body","Head2"], Accept:"", ScrollOnDrag:"1,-3,Body" }, Foot_Cfg: { HoverCol:["Body","Head2","Head","Foot"], FocusCol:["Body","Head2","Head","Foot"], ScrollOnDrag:"-0.33,400%,Body,-0.66,50%,Body,-1,3,Body" }, BottomScroll_Cfg: { ScrollOnDrag:"-1,4000%,Body" }, Blocks: { B1: [ { }, { D:"R2" }, { D:"R3", Add:1 } ], }, Actions: { OnClickAddRow:"AddRow(0,0,3)", OnClickDeleteRows:"DeleteRows(1,1,3)", OnClickDeleteRow:"DeleteRow(0,1,3)" }, Text: { $ConfirmDelete: "Do you want to delete {Count>3 ? ''+Math.floor(Count/3)+' selected contractors' : 'contractor '+Name+''}?", $Item1: "January", $Item2: "February", $Item3: "March", $Item4: "April", $Item5: "May", $Item6: "June", $Item7: "July", $Item8: "August", $Item9: "September", $Item10: "October", $Item11: "November", $Item12: "December", $ItemA: "Amount", $ItemP:"Price", $ItemT:"Total", $ItemV:"Verified", $ItemCaptionC:"Months", $ItemCaptionC1:"Month values", $ItemCaptionC2:"Base columns", $ItemCaptionC3:"Suplement columns", }, Dialogs: { Layout: { Script: { Options:16, Grouped:2 } } }, //. Permits hiding individual columns from block in the Layout menu and shows Grouped column in Base columns DefTools: { Drag: { MinWidth:50, MaxWidth:110 } }, //. Increases minimal width of the grouped column caption on toolbar Top: [ { id:"Focus", Cells:[ { id:"Focus", D:"Focus", NoFocus:3, NoEdit:1, VertAlign:2, Formula:"", Icon:"", Width:150, CellBorder:"Edit" } ] }, "Search", { id:"Toolbar1", Cells:[ "Save","Reload","PrintPdf","Export" ], Item:"Data" }, { id:"Toolbar2", Cells:[ "Copy","PasteOnly" ], Item:"Clipboard" }, { id:"Toolbar3", Cells:[ "Undo","Redo","AddRowEnd","ExpandRows","CollapseRows" ], Item:"Manipulation" }, { id:"Toolbar4", Cells:[ "Settings","Filter","ClearSort","TipAction","Lock" ], Item:"Settings" }, "Layout", "Cookies", { id:"GroupList", D:"Group", Cells: [ { id:"GroupList", D:"GroupList", Width:55, List:{ "":"none", "Region,Country,State":"Location", "Calls":"Calls per" }, DisabledFormula:"Grid.IsLocked('group')" }, "Group" ], Item:"Group list" }, "Styles", { id:"DataSet", Cells: [ { id:"Data", D:"List", Width:275, Align:1, Label:"Data set", TextColor:"blue", UseResize:2, Formula: "Grid.GetSources(1)[1].match(/SpansData\\d+\\w*/)[0]", DisabledFormula:"Grid.IsLocked('Data')", List: { SpansData10: { Value: "30 rows / 1,600 cells (2 kB)", Text:"30 rows / 1,600 cells (2 kB)" }, SpansData100: { Value: "300 rows / 16,000 cells (8 kB)", Text:"300 rows / 16,000 cells (8 kB)" }, SpansData1000: { Value: "3,000 rows / 160,000 cells (75 kB)", Text:"3,000 rows / 160,000 cells (75 kB)" }, SpansData3333: { Value: "10,000 rows / 530,000 cells (0.2 MB)", Text:"10,000 rows / 539,000 cells (0.2 MB)" }, SpansData10000: { Value: "30,000 rows / 1,600,000 cells (0.7 MB)", Text:"30,000 rows / 1,600,000 cells (0.7 MB)" }, SpansData33333: { Value: "100,000 rows / 5,300,000 cells (2.1 MB)", Text:"100,000 rows / 5,300,000 cells (2.1 MB)
download from treegrid.com" }, SpansData100000: { Value: "300,000 rows / 16,000,000 cells (6.5 MB)", Text:"300,000 rows / 16,000,000 cells (6.5 MB)
download from treegrid.com" }, SpansData333333: { Value: "1,000,000 rows / 53,000,000 cells (21 MB)", Text:"1,000,000 rows / 53,000,000 cells (21 MB)
download from treegrid.com" }, SpansData333333D1: { Value: "1,000,000 rows / 53,000,000 cells (21 MB)", Text:'1,000,000 rows / 53,000,000 cells (21 MB)
download on background from treegrid.com' }, SpansData1000000: { Value: "3,000,000 rows / 160,000,000 cells (62 MB)", Text:"3,000,000 rows / 160,000,000 cells (62 MB)
download from treegrid.com" }, SpansData1000000D1: { Value: "3,000,000 rows / 160,000,000 cells (62 MB)", Text:'3,000,000 rows / 160,000,000 cells (62 MB)
download on background from treegrid.com' }, }, OnChange: function(Grid,Row,Col,Event){ var Value = Grid.GetValue(Row,Col,1), S0 = Grid.GetSources(0), S1 = Grid.GetSources(1); S0.D = null; Grid.Disable(); S1[1] = S1[1].replace(/SpansData\d+\w*/,Value); if(S1[1].search(/33333|100000/)>=0){ //. Too large data are not included in the Angular package and it are loaded directly from treegrid.com if(S1[1].indexOf("treegrid.com")<0) S1[1] = S1[1].replace(/.*SpansData/,"https://www.treegrid.com/FExamples/Complex/01-Spans/Data/SpansData"); } else if(S1[1].indexOf("treegrid.com")>=0) S1[1] = S1[1].replace(/.*SpansData/,"/01-spans/SpansData"); S1[2] = Value.indexOf('D1')>=0 ? { Url:S1[1].replace(/D1\./,'D2.'), Defer: { Row:'Info', Col:'Count', Max:Value=='SpansData1000000D1' ? 621e5 : 204e5 } } : ''; S0.Progress = {SpansData33333:21e5,SpansData100000:65e5,SpansData333333:210e5,SpansData1000000:627e5}[Value]; Grid.ActionReload(); } } ] }, { id:"Info", Cells: [{ id:"Count", NoHover:1, NoEdit:1, NoFocus:3, Type:"Html", MinWidth:250, Formula:"Grid.IsBusy()==6 ? ''+Value+'' : Grid.Script.rowstotal(Grid)", Rel:1, Align:1 }], Item:"Information" } ], Bottom:["AI"], Par: { P1: ["U",0x2000+34], //. 0x2000 + 34 characters (2*12+10) P2: ["U",0x2000+24] //. 0x2000 + 24 characters (2*12) }, Media: { Tablet: { //. Changes for touch only screens RowParts: [ { id:"TopScroll", Hidden:1 } ], ColParts: [ { id:"LeftScroll", Hidden:1 } ] }, Mobile: { //. Changes for small displays, mostly mobile phones DefTools: { SearchText: { Width:80 } }, ColsIndex: [ { id:"Index", Width:30 } ] }, SmallMobile: { //. Changes for very narrow mobiles Rules: { Tablet:1, MaxWidth:359, Apply:1 }, LeftCols: { MinWidth:140 } } } }); @Component({ selector:"app-example-grid-01-spans", standalone:true, imports:[ FastGridComponent ], templateUrl:"./01-spans.component.html", host:{ class:"Tutorial" } }) export class Grid_01SpansComponent { readonly src = src; @ViewChild("gridRef") gridRef!:FastGridComponent; }