private void AddCellProperties(FWTableColumn column, FWTableCellElement cell) { if (column.Css != null) { cell.AddCssClass(column.Css); } //Checks to see if the property is hidden if (column.IsHidden) { cell.AddCssClass("hidden"); } foreach (var attribute in column.Attributes) { cell.Attributes.Add(attribute.Key, attribute.Value); } if (column.Metadata != null) { //Sets the column size if was defined in the metadata. if (column.Metadata.AdditionalValues.ContainsKey(nameof(FWSizeAttribute))) { var sizes = column.Metadata.AdditionalValues[nameof(FWSizeAttribute)] as List <FWSizeAttribute>; foreach (var item in sizes) { cell.AddCssClass(FWGridSizeHelper.GetCss(item.Size, item.Device)); } } } }
private FWDivElement CreateItemElement(ModelMetadata itemMetadata, object item, object itemModel, string index) { var detailControlItem = new FWDivElement(); detailControlItem.Attributes.Add("data-type", "fw-detailcontrol-item"); //Checks to see if the property is hidden if (!itemMetadata.AdditionalValues.ContainsKey(nameof(FWHiddenAttribute))) { // Checks if the property has a size. if (itemMetadata.AdditionalValues.ContainsKey(nameof(FWSizeAttribute))) { // Sets the size of the line and then, marks all inner controls as full width. var sizeAttr = itemMetadata.AdditionalValues[nameof(FWSizeAttribute)] as List <FWSizeAttribute>; foreach (var size in sizeAttr) { detailControlItem.AddCssClass(FWGridSizeHelper.GetCss(size.Size, size.Device)); if (!_totalColumnSize.ContainsKey(size.Device)) { _totalColumnSize[size.Device] = 0; } _totalColumnSize[size.Device] += (int)size.Size; } } } else { detailControlItem.AddCssClass("hidden"); } return(detailControlItem); }
/// <summary> /// Writes the content by encoding it with the specified encoder to the specified writer. /// </summary> /// <param name="writer">The System.IO.TextWriter to which the content is written.</param> /// <param name="encoder">The System.Text.Encodings.Web.HtmlEncoder which encodes the content to be written.</param> public virtual void WriteTo(TextWriter writer, HtmlEncoder encoder) { var controlContent = CreateControl(); // Set the control size foreach (var size in Sizes) { controlContent.AddCssClass(FWGridSizeHelper.GetCss(size.Size, size.Device)); } writer.Write(controlContent?.ToString()); }
private FWDivElement CreateActionButtons() { var actions = new FWDivElement(); actions.AddCssClass("fw-actions"); foreach (var actionSizes in _totalColumnSize) { // Calculates the remaining grid size in the last row. var colSize = FWGridSizeHelper.GRID_COLUMNS - (actionSizes.Value % FWGridSizeHelper.GRID_COLUMNS); actions.AddCssClass($"col-{FWGridSizeHelper.GetDeviceName(actionSizes.Key)}-{colSize}"); } actions.Add(FWDetailHelper.CreateRemoveButton().ToString()); return(actions); }