Skip to content

Commit 318dec1

Browse files
olivierauverlotOlivier Auverlot
and
Olivier Auverlot
authored
Table improvements (#242)
Co-authored-by: Olivier Auverlot <[email protected]>
1 parent 9974f08 commit 318dec1

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

examples/official-site/sqlpage/migrations/01_documentation.sql

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,12 @@ INSERT INTO parameter(component, name, description, type, top_level, optional) S
552552
('markdown', 'Set this to the name of a column whose content should be interpreted as markdown . Used to display rich text with links in the table. This argument can be repeated multiple times to intepret multiple columns as markdown.', 'TEXT', TRUE, TRUE),
553553
('icon', 'Set this to the name of a column whose content should be interpreted as a tabler icon name. Used to display icons in the table. This argument can be repeated multiple times to intepret multiple columns as icons. Introduced in v0.8.0.', 'TEXT', TRUE, TRUE),
554554
('align_right', 'Name of a column the contents of which should be right-aligned. This argument can be repeated multiple times to align multiple columns to the right. Introduced in v0.15.0.', 'TEXT', TRUE, TRUE),
555+
('striped_rows', 'Whether to add zebra-striping to any table row.', 'BOOLEAN', TRUE, TRUE),
556+
('striped_columns', 'Whether to add zebra-striping to any table column.', 'BOOLEAN', TRUE, TRUE),
557+
('hover', 'Whether to enable a hover state on table rows.', 'BOOLEAN', TRUE, TRUE),
558+
('border', 'Whether to draw borders on all sides of the table and cells.', 'BOOLEAN', TRUE, TRUE),
559+
('small', 'Whether to use compact table.', 'BOOLEAN', TRUE, TRUE),
560+
('description','Description of the table content and helps users with screen readers to find a table and understand what it’s.','TEXT',TRUE,TRUE),
555561
-- row level
556562
('_sqlpage_css_class', 'For advanced users. Sets a css class on the table row. Added in v0.8.0.', 'TEXT', FALSE, TRUE),
557563
('_sqlpage_color', 'Sets the background color of the row. Added in v0.8.0.', 'TEXT', FALSE, TRUE)
@@ -578,6 +584,18 @@ INSERT INTO example(component, description, properties) VALUES
578584
{"id": 996, "part_no": "MIC-ROCC-F-24-206-A", "Price ($)": 1, "Amount in stock": 15},
579585
{"id": 131456, "part_no": "KIB-ROCC-F-13-205-B", "Price ($)": 127, "Amount in stock": 9}
580586
]'
587+
)),
588+
(
589+
'table',
590+
'A table with some presentation options',
591+
json(
592+
'[{"component":"table", "hover": true, "striped_rows": true, "description": "Some Star Trek Starfleet starships", "small": true},'||
593+
'{"name": "USS Enterprise", "registry": "NCC-1701-C", "class":"Ambassador"},
594+
{"name": "USS Archer", "registry": "NCC-44278", "class":"Archer"},
595+
{"name": "USS Endeavour", "registry": "NCC-06", "class":"Columbia"},
596+
{"name": "USS Constellation", "registry": "NCC-1974", "class":"Constellation"},
597+
{"name": "USS Dakota", "registry": "NCC-63892", "class":"Akira"}
598+
]'
581599
)
582600
);
583601

sqlpage/templates/table.handlebars

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@
66
<input type="search" class="form-control form-control-rounded fs-6 search" placeholder="Search…">
77
</div>
88
{{/if}}
9-
<table class="table">
9+
<table class="table {{#if striped_rows}}table-striped {{/if}}{{#if
10+
striped_columns}}table-striped-columns {{/if}}{{#if
11+
hover}}table-hover {{/if}}{{#if border}}table-bordered {{/if}}
12+
{{#if small}}table-sm {{/if}}">
13+
{{#if description}}<caption>{{description}}</caption>{{/if}}
1014
{{#each_row}}
1115
{{#if (eq @row_index 0)}}
1216
<thead>

0 commit comments

Comments
 (0)