You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,10 @@
1
1
# CHANGELOG.md
2
2
3
-
## v0.38.1
3
+
## v0.39.0
4
4
- Ability to execute sql for URL paths with another extension. If you create sitemap.xml.sql, it will be executed for example.com/sitemap.xml
5
5
- Display source line info in errors even when the database does not return a precise error position. In this case, the entire problematic SQL statement is referenced.
6
6
- The shell with a vertical sidebar can now have "active" elements, just like the horizontal header bar.
7
+
- New `edit_url`, `delete_url`, and `custom_actions` properties in the [table](https://sql-page.com/component.sql?component=table) component to easily add nice icon buttons to a table.
7
8
8
9
## v0.38.0
9
10
- Added support for the Open Database Connectivity (ODBC) standard.
Copy file name to clipboardExpand all lines: Cargo.toml
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
[package]
2
2
name = "sqlpage"
3
-
version = "0.38.1"
3
+
version = "0.39.0"
4
4
edition = "2021"
5
5
description = "Build data user interfaces entirely in SQL. A web server that takes .sql files and formats the query result using pre-made configurable professional-looking components."
Copy file name to clipboardExpand all lines: examples/official-site/sqlpage/migrations/01_documentation.sql
+123-2Lines changed: 123 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -810,11 +810,15 @@ INSERT INTO parameter(component, name, description, type, top_level, optional) S
810
810
('money', 'Name of a numeric column whose values should be displayed as currency amounts, in the currency defined by the `currency` property. This argument can be repeated multiple times.', 'TEXT', TRUE, TRUE),
811
811
('currency', 'The ISO 4217 currency code (e.g., USD, EUR, GBP, etc.) to use when formatting monetary values.', 'TEXT', TRUE, TRUE),
812
812
('number_format_digits', 'Maximum number of decimal digits to display for numeric values.', 'INTEGER', TRUE, TRUE),
813
+
('edit_url', 'If set, an edit button will be added to each row. The value of this property should be a URL, possibly containing the `{id}` placeholder that will be replaced by the value of the `_sqlpage_id` property for that row. Clicking the edit button will take the user to that URL. Added in v0.39.0', 'TEXT', TRUE, TRUE),
814
+
('delete_url', 'If set, a delete button will be added to each row. The value of this property should be a URL, possibly containing the `{id}` placeholder that will be replaced by the value of the `_sqlpage_id` property for that row. Clicking the delete button will take the user to that URL. Added in v0.39.0', 'TEXT', TRUE, TRUE),
815
+
('custom_actions', 'If set, a column of custom action buttons will be added to each row. The value of this property should be a JSON array of objects, each object defining a button with the following properties: `name` (the text to display on the button), `icon` (the tabler icon name or image link to display on the button), `link` (the URL to navigate to when the button is clicked, possibly containing the `{id}` placeholder that will be replaced by the value of the `_sqlpage_id` property for that row), and `tooltip` (optional text to display when hovering over the button). Added in v0.39.0', 'JSON', TRUE, TRUE),
813
816
-- row level
814
817
('_sqlpage_css_class', 'For advanced users. Sets a css class on the table row. Added in v0.8.0.', 'TEXT', FALSE, TRUE),
815
818
('_sqlpage_color', 'Sets the background color of the row. Added in v0.8.0.', 'COLOR', FALSE, TRUE),
816
819
('_sqlpage_footer', 'Sets this row as the table footer. It is recommended that this parameter is applied to the last row. Added in v0.34.0.', 'BOOLEAN', FALSE, TRUE),
817
-
('_sqlpage_id', 'Sets the id of the html tabler row element. Allows you to make links targeting a specific row in a table.', 'TEXT', FALSE, TRUE)
820
+
('_sqlpage_id', 'Sets the id of the html tabler row element. Allows you to make links targeting a specific row in a table.', 'TEXT', FALSE, TRUE),
821
+
('_sqlpage_actions', 'Sets custom action buttons for this specific row in addition to any defined at the table level, The value of this property should be a JSON array of objects, each object defining a button with the following properties: `name` (the text to display on the button), `icon` (the tabler icon name or image link to display on the button), `link` (the URL to navigate to when the button is clicked, possibly containing the `{id}` placeholder that will be replaced by the value of the `_sqlpage_id` property for that row), and `tooltip` (optional text to display when hovering over the button). Added in v0.39.0', 'JSON', FALSE, TRUE)
818
822
) x;
819
823
820
824
INSERT INTO example(component, description, properties) VALUES
@@ -994,7 +998,124 @@ GROUP BY
994
998
This will generate a table with the stores in the first column, and the items in the following columns, with the quantity sold in each store for each item.
995
999
996
1000
', NULL
997
-
);
1001
+
),
1002
+
(
1003
+
'table',
1004
+
'## Using Action Buttons in a table.
1005
+
1006
+
### Preset Actions: `edit_url` & `delete_url`
1007
+
Since edit and delete are common actions, the `table` component has dedicated `edit_url` and `delete_url` properties to add buttons for these actions.
1008
+
The value of these properties should be a URL, containing the `{id}` placeholder that will be replaced by the value of the `_sqlpage_id` property for that row.
1009
+
1010
+
### Column with fixed action buttons
1011
+
1012
+
You may want to add custom action buttons to your table rows, for instance to view details, download a file, or perform a custom operation.
1013
+
For this, the `table` component has a `custom_actions` top-level property that lets you define a column of buttons, each button defined by a name, an icon, a link, and an optional tooltip.
1014
+
1015
+
### Column with variable action buttons
1016
+
1017
+
The `table` component also supports the row level `_sqlpage_actions` column in your data table.
1018
+
This is helpful if you want a more complex logic, for instance to disable a button on some rows, or to change the link or icon based on the row data.
1019
+
1020
+
> WARNING!
1021
+
> If the number of array items in `_sqlpage_actions` is not consistent across all rows, the table may not render correctly.
1022
+
> You can leave blank spaces by including an object with only the `name` property.
1023
+
1024
+
The table has a column of buttons, each button defined by the `_sqlpage_actions` column at the table level, and by the `_sqlpage_actions` property at the row level.
Each button is defined by the following properties:
1027
+
* `name`: sets the column header and the tooltip if no tooltip is provided,
1028
+
* `tooltip`: text to display when hovering over the button,
1029
+
* `link`: the URL to navigate to when the button is clicked, possibly containing the `{id}` placeholder that will be replaced by the value of the `_sqlpage_id` property for that row,
1030
+
* `icon`: the tabler icon name or image link to display on the button
0 commit comments