Extending postgres data source plugin functionality

Hi!

I need to extend functionality of Postgres data source plugin.
I would like to add additional UI like dropdown lists that automatically generates sql queries (besides the standard query editor).

What is the best way to approach this? Can I make a new data source plugin that derives from Postgres plugin?

Or maybe I don’t need a data source plugin, perhaps this should be done in a panel plugin?

Best regards,
Aga