# etools-table

> etools-table

Latest version **0.1.7** (published 2020-01-13) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install etools-table
pnpm add etools-table
yarn add etools-table
bun add etools-table
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.7 |
| Published | 2020-01-13 |
| First published | 2020-01-10 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 7 |
| Unpacked size | 46.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | dci_npm |

## Links

- npm: https://www.npmjs.com/package/etools-table
- Repository: https://github.com/danNordlogic/test-table
- Homepage: https://github.com/danNordlogic/test-table.git
- Issues: https://github.com/danNordlogic/test-table/issues
- npm.io page: https://npm.io/package/etools-table

## Dependencies (7)

- [moment](https://npm.io/package/moment.md) ^2.24.0
- [lodash-es](https://npm.io/package/lodash-es.md) ^4.17.11
- [lit-element](https://npm.io/package/lit-element.md) ^2.2.1
- [@polymer/polymer](https://npm.io/package/@polymer/polymer.md) ^3.1.0
- [@polymer/iron-icons](https://npm.io/package/@polymer/iron-icons.md) ^3.0.1
- [@polymer/paper-checkbox](https://npm.io/package/@polymer/paper-checkbox.md) ^3.1.0
- [@polymer/paper-icon-button](https://npm.io/package/@polymer/paper-icon-button.md) ^3.0.1

## Recent versions

- 0.1.7 (latest) — 2020-01-13
- 0.1.6 — 2020-01-13
- 0.1.5 — 2020-01-13
- 0.1.4 — 2020-01-13
- 0.1.3 — 2020-01-13
- 0.1.2 — 2020-01-13
- 0.1.1 — 2020-01-13
- 0.1.0 — 2020-01-13
- 0.0.8 — 2020-01-13
- 0.0.7 — 2020-01-13
- 0.0.6 — 2020-01-13
- 0.0.5 — 2020-01-13
- 0.0.4 — 2020-01-13
- 0.0.3 — 2020-01-13
- 0.0.2 — 2020-01-10
- … 1 more at https://npm.io/package/etools-table/versions

## README

# \<etools-table\>

LitElement based data table UI
## Usage
```html
        <etools-table .columns="${this.listColumns}"
                      .items="${this.listData}"
                      .paginator="${this.paginator}"
                      @paginator-change="${this.paginatorChange}"
                      @sort-change="${this.sortChange}">
        </etools-table>

        @property({type: Array})
        listColumns: EtoolsTableColumn[] = [
          {
            label: 'Reference No.',
            name: 'reference_number',
            link_tmpl: `${ROOT_PATH}items/:id/details`,
            type: EtoolsTableColumnType.Link
          },
          {
            label: 'Created Date',
            name: 'created_date',
            type: EtoolsTableColumnType.Date,
            sort: EtoolsTableColumnSort.Desc
          },
          {
            label: 'Partner Org',
            name: 'partner_name',
            type: EtoolsTableColumnType.Text,
            sort: EtoolsTableColumnSort.Asc
          },
          {
            label: 'Status',
            name: 'status',
            type: EtoolsTableColumnType.Text,
            capitalize: true
          },
          {
            label: 'Assessor',
            name: 'assessor',
            type: EtoolsTableColumnType.Text
          },
          {
            label: 'Priority',
            name: 'high_priority',
            type: EtoolsTableColumnType.Custom,
            customMethod: (item: any) => {return item.high_priority ? 'High' : '';}
          }
        ];

        paginatorChange(e: CustomEvent) {
          const newPaginator = {...e.detail};
          this.paginator = newPaginator;
          this.updateUrlListQueryParams();
        }

        sortChange(e: CustomEvent) {
          this.sort = getSortFields(e.detail);
          this.updateUrlListQueryParams();
        }
```
## EtoolsTable

   Custom property      | Description
   ---------------------|-------------------
   `caption` | table caption
   `dateFormat` | date format to be used for columns of type EtoolsTableColumnType.Date, by default is 'D MMM YYYY'
   `actionsLabel` | if `showEdit` or `showDelete` is true at the end of the table it is added and extra column for actions, this property will set the column caption
   `showEdit` | display edit icon in the last column, on click will fire event `edit-item`
   `showDelete` | display delete icon in the last column, on click will fire event `delete-item`
   `showCopy` | display copy icon in the last column, on click will fire event `copy-item`
   `columns` | array of `EtoolsTableColumn`, see below the properties
   `items` | array of objects to be used for populating the table
   `paginator` | of type `EtoolsPaginator`, not required, will fire event `paginator-change`

## EtoolsTableColumn

   Custom property      | Description
   ---------------------|-------------------
  `label`| column header label
  `name` | property name from item object
  `type` | column type: `EtoolsTableColumnType` (`Text`, `Date`, `Link`, `Number`, `Checkbox`, `Custom`)
  `sort` | colum sort: `EtoolsTableColumnSort` (`Asc`, `Desc`)
  `link_tmpl` | used only for `EtoolsTableColumnType.Link` to specify url template (route with a single param), ex: `${ROOT_PATH}assessments/:id/details`, id will be replaced with item object id property
  `isExternalLink` | used by columns of Link type to specify if url is external,
  `capitalize`  | capitalize first letter
  `placeholder` | placeholder to be used in case of missing data
  `customMethod` | bind custom method which will return cell output for more flexibility

## EtoolsPaginator

   Custom property      | Description
   ---------------------|-------------------
   `page` |
   `page_size` |
   `total_pages` |
   `count` |
   `visible_range` |


## Install
TODO: create npm package
```bash
$ npm i --save @unicef-polymer/etools-table
```

---
_Source: https://npm.io/package/etools-table · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
