Dashimo.psm1

function Container {
    [CmdletBinding()]
    param([Parameter(Position = 0)][ValidateNotNull()][ScriptBlock] $Content = $(Throw "Container requires opening and closing brace."))
    New-HTMLContainer -HTML $Content
}
function Dashboard {
    [CmdletBinding()]
    param([Parameter(Position = 0)][ValidateNotNull()][ScriptBlock] $Content = $(Throw "Dashboard requires opening and closing brace."),
        [string] $Name,
        [string] $FilePath,
        [int] $AutoRefresh,
        [alias('Open')][switch] $Show)
    New-HTML -TitleText $Name -UseCssLinks:$true -UseJavaScriptLinks:$true -FilePath $FilePath -AutoRefresh $AutoRefresh -ShowHTML:$Show {$Object = Invoke-Command -ScriptBlock $Content
        $Object}
}
function Panel {
    param([Parameter(Position = 0)][ValidateNotNull()][ScriptBlock] $Content = $(Throw "Panel requires opening and closing brace."),
        [string] $Name,
        [switch] $Invisible)
    New-HTMLPanel -Invisible:$Invisible {$Object = Invoke-Command -ScriptBlock $Content
        if ($null -ne $Object) {$Object}}
}
function Section {
    [CmdletBinding()]
    param([Parameter(Position = 0)][ValidateNotNull()][ScriptBlock] $Content = $(Throw "Section requires opening and closing brace."),
        [string] $Name,
        [switch] $Collapsable,
        [switch] $Collapsed,
        [switch] $Invisible,
        [RGBColors] $TextColor = [RGBColors]::White,
        [string][ValidateSet('center', 'left', 'right', 'justify')] $TextAlignment = 'center',
        [RGBColors] $TextBackGroundColor = [RGBColors]::DeepSkyBlue,
        [alias('BackgroundShade')][RGBColors]$BackgroundColor = [RGBColors]::None)
    New-HTMLSection -HeaderText $Name -CanCollapse:$Collapsable -Invisible:$Invisible -Collapsed:$Collapsed -HeaderTextColor $TextColor -HeaderTextAlignment $TextAlignment -HeaderBackGroundColor $TextBackGroundColor -BackgroundColor $BackgroundColor -Content $Content
}
function Tab {
    [CmdletBinding()]
    param([Parameter(Position = 0)][ValidateNotNull()][ScriptBlock] $Content = $(Throw "Tab requires opening and closing brace."),
        [string] $Name)
    New-HTMLTab -TabName $Name {$Object = Invoke-Command -ScriptBlock $Content
        if ($null -ne $Object) {$Object}}
}
function Table {
    [CmdletBinding()]
    param([Parameter(Mandatory = $false, Position = 0)][ScriptBlock] $HTML,
        [Parameter(Mandatory = $false, Position = 1)][ScriptBlock] $PreContent,
        [Parameter(Mandatory = $false, Position = 2)][ScriptBlock] $PostContent,
        [Array] $DataTable,
        [string[]][ValidateSet('copyHtml5', 'excelHtml5', 'csvHtml5', 'pdfHtml5')] $Buttons = @('copyHtml5', 'excelHtml5', 'csvHtml5', 'pdfHtml5'),
        [string[]][ValidateSet('numbers', 'simple', 'simple_numbers', 'full', 'full_numbers', 'first_last_numbers')] $PagingStyle = 'full_numbers',
        [int[]]$PagingOptions = @(15, 25, 50, 100),
        [switch]$DisablePaging,
        [switch]$DisableOrdering,
        [switch]$DisableInfo,
        [switch]$HideFooter,
        [switch]$DisableColumnReorder,
        [switch]$DisableProcessing,
        [switch]$DisableResponsiveTable,
        [switch]$DisableSelect,
        [switch]$DisableStateSave,
        [switch]$DisableSearch,
        [switch]$ScrollCollapse,
        [switch]$OrderMulti,
        [switch]$Filtering,
        [ValidateSet('Top', 'Bottom', 'Both')][string]$FilteringLocation = 'Bottom',
        [string[]][ValidateSet('display', 'cell-border', 'compact', 'hover', 'nowrap', 'order-column', 'row-border', 'stripe')] $Style = @('display', 'compact'),
        [string]$TextWhenNoData = 'No data available.',
        [int] $ScreenSizePercent = 0,
        [string[]] $DefaultSortColumn,
        [int[]] $DefaultSortIndex,
        [ValidateSet('Ascending', 'Descending')][string] $DefaultSortOrder = 'Ascending',
        [alias('Search')][string]$Find,
        [switch] $InvokeHTMLTags,
        [switch] $DisableNewLine)
    New-HTMLTable -DataTable $DataTable -HideFooter:$HideFooter -Buttons $Buttons -PagingStyle $PagingStyle -PagingOptions $PagingOptions -DisablePaging:$DisablePaging -DisableOrdering:$DisableOrdering -DisableInfo:$DisableInfo -DisableColumnReorder:$DisableColumnReorder -DisableProcessing:$DisableProcessing -DisableResponsiveTable:$DisableResponsiveTable -DisableSelect:$DisableSelect -DisableStateSave:$DisableStateSave -DisableSearch:$DisableSearch -ScrollCollapse:$ScrollCollapse -Style $Style -TextWhenNoData:$TextWhenNoData -ScreenSizePercent $ScreenSizePercent -HTML $HTML -PreContent $PreContent -PostContent $PostContent -DefaultSortColumn $DefaultSortColumn -DefaultSortIndex $DefaultSortIndex -DefaultSortOrder $DefaultSortOrder -Find $Find -OrderMulti:$OrderMulti -Filtering:$Filtering -FilteringLocation $FilteringLocation -InvokeHTMLTags:$InvokeHTMLTags -DisableNewLine:$DisableNewLine
}
function TableConditionalFormatting {
    [CmdletBinding()]
    param([alias('ColumnName')][string] $Name,
        [alias('Type')][ValidateSet('number', 'string')][string] $ComparisonType,
        [ValidateSet('lt', 'le', 'eq', 'ge', 'gt')][string] $Operator,
        [Object] $Value,
        [switch] $Row,
        [nullable[RGBColors]] $Color,
        [nullable[RGBColors]] $BackgroundColor)
    return [PSCustomObject] @{Row = $Row; Type = $ComparisonType; Name = $Name; Operator = $Operator; Value = $Value; Color = $Color; BackgroundColor = $BackgroundColor}
}
Export-ModuleMember -Function @('Container', 'Dashboard', 'Panel', 'Section', 'Tab', 'Table', 'TableConditionalFormatting') -Alias @()