Пример #1
0
        public void SelectRow(BvgRow <TItem> ActiveRow, bool DoClear)
        {
            if (DoClear)
            {
                Cmd_Clear_Selection();
            }


            short j = -1;

            string[] UpdatePkg = new string[ActiveRow.Cells.Count() * 2];


            foreach (var c in ActiveRow.Cells)
            {
                c.IsSelected   = true;
                c.CssClassBase = CellStyle.CS.ToString();

                UpdatePkg[++j] = c.ID;
                UpdatePkg[++j] = c.CssClassFull.ToString();
                //c.InvokePropertyChanged();
            }


            BVirtualGridCJsInterop.SetAttributeBatch(UpdatePkg, "class");

            //ActiveRow.InvokePropertyChanged();
            //InvokePropertyChanged();
        }
Пример #2
0
 public void ActiveCellFocus()
 {
     if (ActiveCell != null)
     {
         BVirtualGridCJsInterop.SetFocus(ActiveBvgCell.ID);
     }
 }
Пример #3
0
        public void SelectCell(BvgCell <TItem> parCell, bool doFocus)
        {
            string oldActiveCellID = string.Empty;
            bool   IsSameRow       = false;

            if (ActiveBvgCell != null)
            {
                oldActiveCellID = ActiveBvgCell.ID;
                IsSameRow       = ActiveBvgCell.bvgRow.ID == parCell.bvgRow.ID;
            }


            ActiveBvgCell = parCell;

            ActiveCell = Tuple.Create(true, parCell.bvgRow.IndexInSource, parCell.bvgColumn.prop.Name);


            if (IsSameRow)
            {
                BVirtualGridCJsInterop.SetAttributeBatch(new string[] { oldActiveCellID, "CDiv " + CellStyle.CS.ToString() }, "class");
            }
            else
            {
                SelectRow(parCell.bvgRow, true);
            }


            SelectActiveCell(false);

            if (doFocus)
            {
                ActiveCellFocus();
            }
        }
 public void RegisterJsEvents()
 {
     foreach (var item in listDragTarget)
     {
         BVirtualGridCJsInterop.HandleDrop(item.ElementID, item.ID, DotNetObjectReference.Create(classForJS));
     }
 }
Пример #5
0
        public static void GetColumns(ColProp[] props, BvgGrid <T> _bvgGrid, T[] list, bool UpdateUI)
        {
            int h = _bvgGrid.bvgSettings.HeaderHeight - 10;

            if (!_bvgGrid.Columns.Any())
            {
                _bvgGrid.Columns = new BvgColumn <T> [props.Count()];
                for (ushort i = 0; i < props.Count(); i++)
                {
                    _bvgGrid.Columns[i] = getCol(i, props[i], h, _bvgGrid);
                }
            }
            else
            {
                _bvgGrid.Columns = new BvgColumn <T> [props.Count()];
                string[] UpdatePkg = new string[props.Count() * 4];
                short    j         = -1;
                for (ushort i = 0; i < props.Count(); i++)
                {
                    _bvgGrid.Columns[i] = getCol(i, props[i], h, _bvgGrid);

                    UpdatePkg[++j] = i.ToString();
                    UpdatePkg[++j] = props[i].prop.Name;
                    UpdatePkg[++j] = _bvgGrid.Columns[i].ColWidth.ToString();
                    UpdatePkg[++j] = _bvgGrid.Columns[i].ColWidthSpan.ToString();
                }

                if (_bvgGrid.Rows.Any())
                {
                    foreach (BvgRow <T> r in _bvgGrid.Rows)
                    {
                        foreach (BvgCell <T> c in r.Cells)
                        {
                            c.bvgColumn = _bvgGrid.Columns[c.bvgColumn.ID];
                        }
                    }
                }


                if (UpdateUI)
                {
                    BVirtualGridCJsInterop.UpdateColContentsBatch(UpdatePkg);
                    RefreshRows(list, _bvgGrid, true, 0);
                }
            }



            if (_bvgGrid.SortState.Item1)
            {
                if (_bvgGrid.Columns.Any(x => x.prop.Name.Equals(_bvgGrid.SortState.Item2)))
                {
                    BvgColumn <T> sortedCol2 = _bvgGrid.Columns.Single(x => x.prop.Name.Equals(_bvgGrid.SortState.Item2));

                    sortedCol2.IsSorted = true;
                    sortedCol2.IsAscendingOrDescending = _bvgGrid.SortState.Item3;
                }
            }
        }
Пример #6
0
        public void Cmd_Clear_Selection()
        {
            List <string> l = new List <string>();

            foreach (var item in Rows.Where(x => x.Cells.Any(y => y.IsSelected)))
            {
                l.AddRange(item.Cmd_Clear_Selection());
            }


            BVirtualGridCJsInterop.SetAttributeBatch(l.ToArray(), "class");
        }
Пример #7
0
 public BSortStyle(int w = 20, int h = 40, int ph = 3, int pv = 8)
 {
     if (w > 0 && h > 0)
     {
         width             = w;
         height            = h;
         PaddingHorizontal = ph;
         PaddingVertical   = pv;
         CalculatePoligonPoints();
     }
     else
     {
         BVirtualGridCJsInterop.Alert("Not set Sort icon width and/or height!");
     }
 }
Пример #8
0
        public void UpdateStyle2(BvgGrid <TItem> _bvgGrid)
        {
            //without this it was generating old data, weird but fact.
            //now we are sure that we have last version of bvgGrid state
            bvgGrid = _bvgGrid;


            blazorCSS.RemoveSelector(".myGridArea");
            blazorCSS.RemoveSelector(".myContainerFrozen");
            blazorCSS.RemoveSelector(".myContainerNonFrozen");

            GenerateCSSGridmyGridArea();

            GenerateCSSGridFrozenCSS();
            GenerateCSSGridNonFrozenCSS();



            BVirtualGridCJsInterop.UpdateStyle(StyleID2, GetString(StyleID2));
        }
Пример #9
0
        public void Cmd_Clear_ActiveCellSelection()
        {
            List <string> l = new List <string>();

            foreach (var item in Rows.Where(x => x.Cells.Any(y => y.IsActive)))
            {
                foreach (var cell in item.Cells.Where(x => x.IsActive))
                {
                    cell.IsActive     = false;
                    cell.CssClassBase = CellStyle.CS.ToString();


                    l.Add(cell.ID);
                    l.Add(cell.CssClassFull);
                }
            }


            BVirtualGridCJsInterop.SetAttributeBatch(l.ToArray(), "class");
        }
Пример #10
0
        private void SelectActiveCell(bool DoClear = true)
        {
            if (DoClear)
            {
                Cmd_Clear_Selection();
            }

            ActiveBvgCell.IsSelected   = true;
            ActiveBvgCell.IsActive     = true;
            ActiveBvgCell.CssClassBase = CellStyle.CA.ToString();


            BVirtualGridCJsInterop.SetAttributeBatch(new string[] { ActiveBvgCell.ID, ActiveBvgCell.CssClassFull }, "class");



            EnsureCellIsShownFully();

            //ActiveCell.InvokePropertyChanged();
        }
Пример #11
0
        private static void RefreshRows(T[] list, BvgGrid <T> _bvgGrid, bool updateWidths, int skip)
        {
            //BlazorWindowHelper.BlazorTimeAnalyzer.Add("Refresh rows start", MethodBase.GetCurrentMethod());
            short i      = -1;
            short i1     = -1;
            short i2     = -1;
            short i3     = -1;
            byte  g      = 0;
            int   lenght = _bvgGrid.Rows.Count() * _bvgGrid.Rows[0].Cells.Count();

            string[] PkgIDs = new string[lenght];

            string[] UpdatePkg = new string[lenght * 2];



            string[] UpdatePkg2 = new string[1];
            if (updateWidths)
            {
                UpdatePkg2 = new string[lenght];
            }

            string[] UpdatePkgClass = new string[1];
            if (!updateWidths)
            {
                UpdatePkgClass = new string[lenght];
            }


            foreach (T item in list)
            {
                if (!updateWidths)
                {
                    _bvgGrid.Rows[g].IndexInSource = (ushort)(g + skip + 1);
                }

                foreach (BvgCell <T> c in _bvgGrid.Rows[g].Cells)
                {
                    c.Value = c.bvgColumn.prop.GetValue(item, null).ToString();

                    PkgIDs[++i1] = c.ID;

                    UpdatePkg[++i] = c.Value;

                    if (c.bvgColumn.prop.PropertyType.Equals(typeof(bool)))
                    {
                        UpdatePkg[++i] = "b";
                    }
                    else
                    {
                        UpdatePkg[++i] = "s";
                    }


                    if (!updateWidths)
                    {
                        c.UpdateCssClass();
                        UpdatePkgClass[++i3] = c.CssClassFull;
                    }

                    if (updateWidths)
                    {
                        UpdatePkg2[++i2] = c.bvgColumn.ColWidth.ToString();
                    }
                }
                g++;
            }

            //BlazorWindowHelper.BlazorTimeAnalyzer.Add("js calls start", MethodBase.GetCurrentMethod());


            //BlazorWindowHelper.BlazorTimeAnalyzer.Add("js calls 1 start", MethodBase.GetCurrentMethod());
            BVirtualGridCJsInterop.UpdateElementContentBatchMonoByteArray(PkgIDs, UpdatePkg);

            if (!updateWidths)
            {
                //BlazorWindowHelper.BlazorTimeAnalyzer.Add("js calls 2 start", MethodBase.GetCurrentMethod());
                BVirtualGridCJsInterop.UpdateCellClassBatchMonoByteArray(PkgIDs, UpdatePkgClass);
            }

            if (updateWidths)
            {
                //BlazorWindowHelper.BlazorTimeAnalyzer.Add("js calls 3 start", MethodBase.GetCurrentMethod());
                BVirtualGridCJsInterop.UpdateRowWidthsBatch(PkgIDs, UpdatePkg2);
            }
            //BlazorWindowHelper.BlazorTimeAnalyzer.Add("js calls end", MethodBase.GetCurrentMethod());

            //BlazorWindowHelper.BlazorTimeAnalyzer.Add("Refresh rows end", MethodBase.GetCurrentMethod());
        }
Пример #12
0
 public void SetScrollTop(double p)
 {
     //BvgJsInterop.SetElementScrollTop("FrozenDiv1", p);
     //BvgJsInterop.SetElementScrollTop("NonFrozenDiv1", p);
     BVirtualGridCJsInterop.SetDivsScrollTop(p);
 }
 public void OnMouseDown(MouseEventArgs e, MyDraggable item)
 {
     BVirtualGridCJsInterop.HandleDrag(item.ElementID, item.ID, DotNetObjectReference.Create(classForJS));
 }