SQLpage icon indicating copy to clipboard operation
SQLpage copied to clipboard

[feat] Foldable component - ability to embed other sql files

Open accforgithubtest opened this issue 1 year ago • 4 comments

Requesting a feature for Foldable component to be able to embed other sql files.

I can think of many useful scenarios, where a "break-down" of data could be presented upon expansion in neat ways on the UI, while also conserving valuable screen real-estate.

Examples -

  1. Display a "Total = $12345" on the Foldable component title, and then display a breakdown (using big_number for example) uopn expansion. The big_number component could be in a separate sql file that can be then re-used in multiple places.

  2. Display a "X New Offers" as title and upon expansion display cards or columns components highlighting the offers / products with more details. The cards or column components are in a separate sql file, which can be re-used in multiple places like search products, carts, etc.

As you can see, this feature could help re-using the common sql files with components and help optimize screen real-estate in very useful ways.

Looking forward to hearing your thoughts. Cheers!

accforgithubtest avatar Nov 08 '24 23:11 accforgithubtest

Hello ! This is indeed a very good idea, I can think of multiple scenarios where this would be useful. I will keep this in mind.

lovasoa avatar Nov 15 '24 14:11 lovasoa

Yeah this would be great to have ability to use other components and sql files embed in foldable! 👍

ToniJ123 avatar Nov 25 '24 05:11 ToniJ123

I think this is the missing piece of sqlpage; the ability to compose pages from multiple sql files.

Looking at this issue https://github.com/sqlpage/SQLPage/issues/747, the embed feature is doing composition on the client side. It would be great to be able to do it on the server side. e.g.

select 'my_component.sql' as embed;

mingfang avatar Jan 15 '25 13:01 mingfang

nvm, after posting my comment then I read this https://github.com/sqlpage/SQLPage/issues/20

I think dynamic components with sqlpage.run_sql() looks like a good option. https://sql-page.com/component.sql?component=dynamic#component

mingfang avatar Jan 15 '25 13:01 mingfang