1.3.33 • Published 3 years ago

@vanillawc/wc-sortable-table v1.3.33

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Installation

Installation

npm i @vanillawc/wc-sortable-table

Import from NPM

<script type="module" src="node_modules/@vanillawc/wc-sortable-table/index.js"></script>

Import from CDN

<script type="module" src="https://cdn.jsdelivr.net/gh/vanillawc/wc-sortable-table@1/index.js"></script>

Demo

Try it on WebComponents.dev

Usage

Attributes

  • src - load an external source file
  • theme - an external theme file

Properties

  • value - get/set the table data

Basic Usage

<wc-sortable-table src="sample.json"></wc-sortable-table>

Styling

By default, <wc-sortable-table> contains an un-styled <table> element in the lightDOM. That means, it will inherit any global CSS styles present on the site and can be styled directly using CSS.

When a sort is applied, the <th> element selected receives either a .asc or .desc class depending on the direction of the sort.

Theming

Alternatively, a theme for <wc-sortable-table> can be specified. This will encapsulate the element in a shadowDOM -- to prevent style bleed -- and apply the style provided.

<wc-sortable-table src="sample.json" theme="assets/example-theme.html"></wc-sortable-table>

Creating Themes

A theme contains a <style> element with the CSS that will be applied to the element.

example-theme.html

<style>
  table, th, td {
    border: 1px solid black;
  }
  
  .asc:after {
    content: "▲";
    color: red;
    font-size: .75rem;
    vertical-align: text-top;
    text-align:right;
  }
  
  .desc:after {
    content: "▼";
    color: red;
    font-size: .75rem;
    vertical-align: text-top;
    text-align: right;
  }
</style>

Contributing

See CONTRIBUTING.md

1.3.31

3 years ago

1.3.32

3 years ago

1.3.33

3 years ago

1.3.30

4 years ago

1.3.29

4 years ago

1.3.28

4 years ago

1.3.27

4 years ago

1.3.26

4 years ago

1.3.25

4 years ago

1.3.24

4 years ago

1.3.23

4 years ago

1.3.22

4 years ago

1.3.21

4 years ago

1.3.20

4 years ago

1.3.19

4 years ago

1.3.18

4 years ago

1.3.17

4 years ago

1.3.16

4 years ago

1.3.15

4 years ago

1.3.13

4 years ago

1.3.14

4 years ago

1.3.12

4 years ago

1.3.10

4 years ago

1.3.9

4 years ago

1.3.11

4 years ago

1.3.8

4 years ago

1.3.7

4 years ago

1.3.6

4 years ago

1.3.5

4 years ago

1.3.4

4 years ago

1.3.3

4 years ago

1.3.2

4 years ago

1.3.1

4 years ago

1.3.0

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.0

4 years ago