UniversalDashboard.UDQueryBuilder.psm1
$IndexJs = Get-ChildItem "$PSScriptRoot\index.*.bundle.js" $AssetId = [UniversalDashboard.Services.AssetService]::Instance.RegisterAsset($IndexJs.FullName) function New-UDQueryBuilder { <# .SYNOPSIS Creates a new component .DESCRIPTION Creates a new component .PARAMETER Id The ID of this editor .PARAMETER Text Text for the component .EXAMPLE New-UDComponent -Text 'Hello, world!' #> param( [Parameter()] [string]$Id = (New-Guid).ToString(), [Parameter()] [scriptblock]$Fields ) End { @{ assetId = $AssetId isPlugin = $true type = "ud-querybuilder" id = $Id fields = [array]$Fields.invoke() } } } function New-UDQueryBuilderField { [CmdletBinding(DefaultParameterSetName = "Default")] param( [Parameter( Mandatory = $true )] [string]$Name, [Parameter()] [string]$Label ) Begin { $out = @{ }; } Process { if ($null -eq $Label) { $Label = $Name } $out.name = $Name $out.label = $Label } End { return $out } } |