diff --git a/docs/index.html.ejs b/docs/index.html.ejs index 6c1e8f1..2073dbf 100644 --- a/docs/index.html.ejs +++ b/docs/index.html.ejs @@ -41,6 +41,7 @@
  • TreeView
  • +
  • TableView
  • Issues, Contributing, etc.
  • @@ -798,6 +799,96 @@ +
    +

    TableView

    +
    +

    + To render a table view, use a table element. Wrap it with a div element with sunken-panel class to provide proper border and overflow container. +

    +

    + With a bit of extra scripting you can make table view interactive. Give interactive class to + table element to show pointer cursor when hovering over body rows. Table rows can be given + highlighted class to appear selected. +

    + + <%- example(` +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameVersionCompany
    MySQL ODBC 3.51 Driver3.51.11.00MySQL AB
    SQL Server3.70.06.23Microsoft Corporation
    SQL Server3.70.06.23Microsoft Corporation
    SQL Server3.70.06.23Microsoft Corporation
    SQL Server3.70.06.23Microsoft Corporation
    SQL Server3.70.06.23Microsoft Corporation
    SQL Server3.70.06.23Microsoft Corporation
    SQL Server3.70.06.23Microsoft Corporation
    SQL Server3.70.06.23Microsoft Corporation
    SQL Server3.70.06.23Microsoft Corporation
    +
    + + `) %> +
    +
    +

    Issues, Contributing, etc.

    diff --git a/icon/sunken-panel-border.svg b/icon/sunken-panel-border.svg new file mode 100644 index 0000000..1f09c91 --- /dev/null +++ b/icon/sunken-panel-border.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/style.css b/style.css index 86e8e18..f222a15 100644 --- a/style.css +++ b/style.css @@ -99,6 +99,7 @@ input, textarea, select, option, +table, ul.tree-view, .window, .title-bar { @@ -790,3 +791,44 @@ summary:focus { width: 16px; background-image: svg-load("./icon/button-right.svg"); } + +.sunken-panel { + box-sizing: border-box; + border: 2px groove transparent; + border-image: svg-load("./icon/sunken-panel-border.svg") 2; + overflow: auto; + background-color: #fff; +} + +table { + border-collapse: collapse; + position: relative; + text-align: left; + white-space: nowrap; + background-color: #fff; +} + +table > thead > tr > * { + position: sticky; + top: 0; + height: 17px; + box-shadow: var(--border-raised-outer), var(--border-raised-inner); + background: var(--surface); + box-sizing: border-box; + font-weight: normal; + padding: 0 var(--grouped-element-spacing); +} + +table.interactive > tbody > tr { + cursor: pointer; +} + +table > tbody > tr.highlighted { + color: #fff; + background-color: var(--dialog-blue); +} + +table > tbody > tr > * { + padding: 0 var(--grouped-element-spacing); + height: 14px; +} \ No newline at end of file