/// <summary> /// Opens a <c><table></c> block, adding the given id and CSS class attributes if /// provided, and automatically opens the first row with a call to /// <see cref="OpenRow(FluentRenderTreeBuilder, string?, int)">OpenRow(...)</see>. /// </summary> /// <remarks> /// Note: Each call to this method must be matched with a call to /// <see cref="FluentRenderTreeBuilder.Close(bool, int)">Close(...)</see>, which will close /// both the last row and the table. /// </remarks> /// <param name="frtb">The <see cref="FluentRenderTreeBuilder"/>.</param> /// <param name="tableClass">The optional CSS class name for the table.</param> /// <param name="tableId">The optional id attribute value.</param> /// <param name="rowClass">The optional CSS class name for the first table row.</param> /// <param name="line">The source code line number used to generate the sequence number.</param> public static FluentRenderTreeBuilder OpenAutoTable(this FluentRenderTreeBuilder frtb, string?tableClass = "table", string?tableId = null, string?rowClass = null, [CallerLineNumber] int line = 0) => frtb .OpenElement("table", tableClass, tableId, line: line) .OpenRow(rowClass, line) .CloseHelper(l => frtb.Close(2, line: l)); // tr, table
/// <summary> /// Opens an <c><ol></c> block, adding the given id and CSS class attributes if /// provided, and automatically opens the first list item and sets the item's key, if /// provided, with a call to /// <see cref="OpenItem(FluentRenderTreeBuilder, string?, object?, int)">OpenItem(...)</see>. /// </summary> /// <remarks> /// Note: Each call to this method must be matched with a call to /// <see cref="FluentRenderTreeBuilder.Close(bool, int)">Close(...)</see>, which will /// close both the last item and the list. /// </remarks> /// <param name="frtb">The <see cref="FluentRenderTreeBuilder"/>.</param> /// <param name="listClass">The optional CSS class name for the list.</param> /// <param name="listId">The optional id attribute value.</param> /// <param name="itemClass">The optional CSS class name for the first list item.</param> /// <param name="itemKey">The optional key to set for the first item.</param> /// <param name="line">The source code line number used to generate the sequence number.</param> public static FluentRenderTreeBuilder OpenAutoOrderedList(this FluentRenderTreeBuilder frtb, string?listClass = null, string?listId = null, string?itemClass = null, object?itemKey = null, [CallerLineNumber] int line = 0) => frtb .OpenElement("ol", listClass, listId, line: line) .OpenItem(itemClass, itemKey, line) .CloseHelper(l => frtb.Close(2, line: l)); // li, ol
/// <summary> /// Opens a <c><tbody></c> block after first closing the existing /// <c><thead></c> block opened by a previous call to /// <see cref="TableHead(FluentRenderTreeBuilder, string?, string?, string?, int)">TableHead(...)</see>. /// </summary> /// <param name="frtb">The <see cref="FluentRenderTreeBuilder"/>.</param> /// <param name="line">The source code line number used to generate the sequence number.</param> public static FluentRenderTreeBuilder OpenTableBody(this FluentRenderTreeBuilder frtb, [CallerLineNumber] int line = 0) => frtb .Close(line: line) // table-head .OpenElement("tbody", null, null, line: line) .CloseHelper(l => frtb.Close(2, line: l)); // tr, thead
/// <summary> /// Opens a new <c><tr></c> block, adding the given CSS class attribute if provided, /// after first closing the currently open row. /// </summary> /// <remarks> /// Note: Do not use this method with an /// <see cref="OpenAutoTable(FluentRenderTreeBuilder, string?, string?, string?, int)">OpenAutoTable(...)</see>; /// instead, use <see cref="NewAutoRow(FluentRenderTreeBuilder, string?, int)">NewAutoRow(...)</see>. /// </remarks> /// <param name="frtb">The <see cref="FluentRenderTreeBuilder"/>.</param> /// <param name="class">The optional CSS class name for the new table row.</param> /// <param name="line">The source code line number used to generate the sequence number.</param> public static FluentRenderTreeBuilder NewRow(this FluentRenderTreeBuilder frtb, string? @class = null, [CallerLineNumber] int line = 0) => frtb .Close(line: line) // tr .OpenRow(@class, line);
/// <summary> /// Calls <see cref="FluentRenderTreeBuilder.Close(bool, int)">Close(...)</see> with the /// <c>prettyPrint</c> parameter set to <c>false</c>, to generate markup to close the /// last opened <c>Region</c>, <c>Element</c> or <c>Component</c> block without any /// newline or indent whitespace, even if pretty-printing is enabled (see the /// <see cref="FluentRenderTreeBuilder"/> overview for details on pretty-printing). /// </summary> /// <param name="frtb">The <see cref="FluentRenderTreeBuilder"/>.</param> /// <param name="line">The source code line number used to generate the sequence number.</param> public static FluentRenderTreeBuilder CloseInline(this FluentRenderTreeBuilder frtb, [CallerLineNumber] int line = 0) => frtb.Close(prettyPrint: false, line);
/// <summary> /// Opens a new <c><li></c> block within a /// <see cref="OpenList(FluentRenderTreeBuilder, string?, string?, int)">OpenList(...)</see> or an /// <see cref="OpenOrderedList(FluentRenderTreeBuilder, string?, string?, int)">OpenOrderedList(...)</see>, /// adding the given CSS class attribute, and setting /// the key, if provided, after first closing the currently open item. /// </summary> /// <remarks> /// Note: Do not use this method within an /// <see cref="OpenAutoList(FluentRenderTreeBuilder, string?, string?, string?, object?, int)"> /// OpenAutoList(...)</see> or an /// <see cref="OpenAutoOrderedList(FluentRenderTreeBuilder, string?, string?, string?, object?, int)"> /// OpenAutoOrderedList(...)</see>; /// instead, use <see cref="NewAutoItem(FluentRenderTreeBuilder, string?, object?, int)"> /// NewAutoItem(...)</see>. /// </remarks> /// <param name="frtb">The <see cref="FluentRenderTreeBuilder"/>.</param> /// <param name="class">The optional CSS class name for the new list item.</param> /// <param name="key">The optional key to set for this list item.</param> /// <param name="line">The source code line number used to generate the sequence number.</param> public static FluentRenderTreeBuilder NewItem(this FluentRenderTreeBuilder frtb, string? @class = null, object?key = null, [CallerLineNumber] int line = 0) => frtb .Close(line: line) // li .OpenItem(@class, key, line);