ironmansoftware / powershell-universal

Issue tracker for PowerShell Universal
https://powershelluniversal.com
35 stars 3 forks source link

new-udtypography disappear when only white space or empty #2399

Closed rstolpe closed 1 year ago

rstolpe commented 1 year ago

Version

3.9.0

Severity

Visual

Steps to Reproduce

If you put something in to new-udtypography -text $mytext and the variable only contains whitespace or if it's empty new-udtypography are removed from the dashboard. This is a issue if you are using New-UDStack as it won't be aline anymore if you have stacks of new-udtypography in a column then everything get moved up a step.

Expected behavior

If $mytext are empty, null or whitespace new-udtypography won't disappear-

Actual behavior

new-udtypography disappear if $mytext are empty, null or whitespace

Additional Environment data

No response

Visuals

No response

rstolpe commented 1 year ago

@adamdriscoll why are the required triage always show? It seem that it tag it by it self.

adamdriscoll commented 1 year ago

We are automatically adding this for any bugs and it just means the team hasn't verified or looked into the bug yet.

adamdriscoll commented 1 year ago

I can't reproduce this. Notice the element is on the page but the text is empty. Is there something I don't understand?

image
New-UDDashboard -Title 'PowerShell Universal' -Pages @(
    # Create a page using the menu to the right ->   
    # Reference the page here with Get-UDPage
    New-UDPage -Name 'Home' -Content {
        New-UDTypography -Text ' '
    }
)
rstolpe commented 1 year ago

@adamdriscoll Here is a example of my code, if $AssetInformation.$ai.AttributeValue is empty, contains whitespace or similar it will not draw it out as a "empty" text that result in that the rest are moved up and are not longer aligned with the New-UDTypography -FontWeight bold -Text $AssetInformation.$ai.Name

                           New-UDStack -Spacing 6 -Direction row -Children {
                                New-UDStack -Direction column -Children {
                                    foreach ($ai in $AssetProperty) {
                                        New-UDTypography -FontWeight bold -Text $AssetInformation.$ai.Name
                                    }
                                }
                                New-UDStack -Direction column -Children {
                                    foreach ($ai in $AssetProperty) {
                                        New-UDTextbox -Id $AssetInformation.$ai.AttributeId -Value $AssetInformation.$ai.AttributeValue -FullWidth
                                    }
                                }
                            }
adamdriscoll commented 1 year ago

If you use a minHeight for the typography, you can prevent this from happening.

                New-UDTypography -FontWeight bold -Text $ai -Style @{
                    minHeight = '10px'
                }
rstolpe commented 1 year ago

@adamdriscoll nice I did made a function that added a . If it was empty.

I'll use your approach instead ofc.

adamdriscoll commented 1 year ago

Sounds good. Going to close this as this is working as designed but just requires that additional styling.