sqlpage / SQLPage

Fast SQL-only data application builder. Automatically build a UI on top of SQL queries.
https://sql.datapage.app
MIT License
1.57k stars 89 forks source link

[feat] Columns Component - Do not show blank lines when `null as item` #642

Open accforgithubtest opened 2 days ago

accforgithubtest commented 2 days ago

What are you building with SQLPage ?

This feature request is to ensure that a blank line is not shown when encountering null as item in the column component item section.

What is your problem ? A description of the problem, not the solution you are proposing.

I am trying to conditionally include / exclude a few items in the column component. I am returning null as item when the condition is not met, because I do not wish to display that particular item when condition fails. I see a blank line on the UI when it encounters a null as item.

Describe the solution you'd like

Do not show blank line when encountering a null as item.

Describe alternatives you've considered

Pls suggest if there is a better way of handling this.

select 
    'columns' as component;

select 
    'Standard Plan' as title,
    '$49'           as value,
    'star'          as icon,
    'A standard plan for small teams.' as description,
    JSON_OBJECT("icon", "check", "color", "green", "description", "Limited Customization") as item,
    case 
        when true then JSON_OBJECT("icon", "check", "color", "green", "description", "Collaboration Tools")
        else null
    end as item,
    case 
        when false then JSON_OBJECT("icon", "check", "color", "green", "description", "Custom data sources")
        else null
    end as item,
    JSON_OBJECT("icon", "check", "color", "green", "description", "Priority support") as item,
    '#'             as link,
    'Select'        as button_text,
    'success'       as button_color,
    'green'         as value_color,
    '/month'        as small_text;

image