Skip to content

Commit

Permalink
Merge pull request #110 from langleyfoxall/release-prep
Browse files Browse the repository at this point in the history
Release prep
  • Loading branch information
jameswilddev authored Jun 28, 2024
2 parents 8ed1b79 + 4410819 commit 563c49a
Show file tree
Hide file tree
Showing 21 changed files with 7,248 additions and 2,891 deletions.
6 changes: 4 additions & 2 deletions .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
"@babel/preset-react",
[
"@babel/preset-env",
{ "useBuiltIns": "usage" }
{
"useBuiltIns": "usage"
}
]
]
}
}
25 changes: 25 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"standard",
"plugin:react/recommended"
],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
"react"
],
"globals": {
"route": true
},
"settings": {
"react": {
"version": "detect"
}
}
}
33 changes: 33 additions & 0 deletions .github/workflows/continuous-integration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Continuous Integration
on:
push:
pull_request:
release:
types: [created]
jobs:
lint-and-build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '21.7'
registry-url: 'https://registry.npmjs.org'
- run: npm ci
- run: npm run-script lint
- run: npm run-script build
release:
if: github.event_name == 'release' && github.event.action == 'created'
needs: lint-and-build
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '21.7'
registry-url: 'https://registry.npmjs.org'
- run: npm ci
- run: npm run-script build
- run: echo //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }} > ${NPM_CONFIG_USERCONFIG}
- run: "sed -i \"s/\\\"version\\\": \\\"0.0.0\\\",/\\\"version\\\": \\\"${GITHUB_REF/refs\\/tags\\/v/}\\\",/g\" package.json"
- run: npm publish
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
node_modules
package-lock.json
.idea
*.tgz
1 change: 0 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
src
.babelrc
.gitignore
.idea
13 changes: 13 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"editor.formatOnSave": true,
"editor.detectIndentation": false,
"editor.tabSize": 2,
"editor.insertSpaces": true,
"files.trimFinalNewlines": true,
"files.trimTrailingWhitespace": true,
"files.insertFinalNewline": true,
"files.eol": "\n"
}
35 changes: 24 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# React Dynamic Data Table

[![npm version](https://badge.fury.io/js/%40langleyfoxall%2Freact-dynamic-data-table.svg)](https://badge.fury.io/js/%40langleyfoxall%2Freact-dynamic-data-table)
[![npm](https://img.shields.io/npm/dt/@langleyfoxall/react-dynamic-data-table.svg)](https://npm-stat.com/charts.html?package=%40langleyfoxall%2Freact-dynamic-data-table)
[![npm version](https://badge.fury.io/js/%40code-based%2Freact-dynamic-data-table.svg)](https://badge.fury.io/js/%40code-based%2Freact-dynamic-data-table)
[![npm](https://img.shields.io/npm/dt/@code-based/react-dynamic-data-table.svg)](https://npm-stat.com/charts.html?package=%40code-based%2Freact-dynamic-data-table)


This package provides a React Dynamic Data Table component that supports sortable columns,
Expand All @@ -12,17 +12,17 @@ pagination, field mapping, data manipulation, and more.
You can install this package with either `npm` or `yarn` as shown below.

```bash
npm install @langleyfoxall/react-dynamic-data-table
npm install @code-based/react-dynamic-data-table
```

```bash
yarn add @langleyfoxall/react-dynamic-data-table
yarn add @code-based/react-dynamic-data-table
```

Remember to import the `DynamicDataTable` component where it is needed.

```JSX
import DynamicDataTable from "@langleyfoxall/react-dynamic-data-table";
import DynamicDataTable from "@code-based/react-dynamic-data-table";
```

## Usage
Expand All @@ -46,7 +46,7 @@ The `rows` prop expects an array of objects, such as the following.
### Specifying a CSS class for the table

By default tables are assigned the bootstrap `table` and `table-striped` CSS classes.
If you need a different table style, you can override these defaults by providing the
If you need a different table style, you can override these defaults by providing the
`className` prop:

```JSX
Expand Down Expand Up @@ -191,7 +191,7 @@ be pushed to the end of the ordered fields.
```JSX
<DynamicDataTable
rows={[
{ id: 1, email: 'info@langleyfoxall.co.uk', name: 'Langley Foxall' }
{ id: 1, email: 'info@codebased.co.uk', name: 'Codebased' }
]}
fieldOrder={[
'id', 'name'
Expand All @@ -206,7 +206,7 @@ Mixing strings and regex is also supported.
```JSX
<DynamicDataTable
rows={[
{ id: 1, email: 'info@langleyfoxall.co.uk', first_name: 'Langley', last_name: 'Foxall' }
{ id: 1, email: 'info@codebased.co.uk', first_name: 'Code', last_name: 'Based' }
]}
fieldOrder={[
'id', /_name/
Expand All @@ -229,7 +229,7 @@ it respects whatever unit is set.
```jsx
<DynamicDataTable
rows={[
{ id: 1, email: 'info@langleyfoxall.co.uk', first_name: 'Langley', last_name: 'Foxall' }
{ id: 1, email: 'info@codebased.co.uk', first_name: 'Code', last_name: 'Foxall' }
]}
columnWidths={{
// 10%
Expand All @@ -255,7 +255,7 @@ node into `orderByAscIcon` and `orderByDescIcon`.
/>
```

You can optionally specify an icon to appear when a sortable field is *not* the
You can optionally specify an icon to appear when a sortable field is *not* the
currently sorted field using the `orderByIcon` prop:

```JSX
Expand Down Expand Up @@ -511,7 +511,7 @@ For more complex interactions, such as supporting the ability to Middle-click, y
#### Context Menus

The ability to right click rows can be enabled by using `onContextMenu` and `rowRenderer`.
In the example we will use our own [`@langleyfoxall/react-dynamic-context-menu`](https://github.com/langleyfoxall/react-dynamic-context-menu):
In the example we will use our own [`@code-based/react-dynamic-context-menu`](https://github.com/langleyfoxall/react-dynamic-context-menu):

```JSX
<DynamicDataTable
Expand Down Expand Up @@ -986,3 +986,16 @@ matching the predicate is given the CSS class `table-active`:
<DynamicDataTable
rowIsActive={(row) => row.id === 3}
/>
```

## Development

### Linting

This package uses [ESLint](https://eslint.org/) for linting of JS/X. You can run ESLint at any time by executing `npm run-script lint-fix`. Install the [ESLint extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) to get real-time linting in Visual Studio Code.

These linters additionally run in continuous integration as a GitHub Action.

### Releases

To release a new version of this package, simply [create a new release](https://github.com/langleyfoxall/react-dynamic-data-table/releases/new).
Loading

0 comments on commit 563c49a

Please sign in to comment.