UI for goodtables
as an framework-agnostic browser components (DEMO).
render
- framework-agnostic component renderReport
- goodtables report componentForm
- goodtables validation form component
You could use this components in plain JavaScript code or mixing with any modern framework (with native support for React). To render report
you have use goodtablesUI.render(goodtablesUI.Report, props, element)
function.
First add bootstrap and component styles:
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="//unpkg.com/goodtables-ui/dist/goodtables-ui.min.css">
Install the package in your terminal
$ npm install --save goodtables-ui
The package could be used as goodtables-ui
package from NPM:
import goodtablesUI from 'goodtables-ui'
const report = '<YOUR-REPORT>'
const element = document.getElementById('report')
goodtablesUI.render(goodtablesUI.Report, {report}, element)
The distribution is 60kb minified (20kb gzipped) with no dependencies.
The package could be used as pluggable script from CDN:
<div id="report"></div>
<script src="//unpkg.com/goodtables-ui/dist/goodtables-ui.min.js"></script>
<script>
var report = '<YOUR-REPORT>'
var element = document.getElementById('report')
goodtablesUI.render(goodtablesUI.Report, {report}, element)
</script>
In this case your application should provide
react
andreact-dom
.
You could use presented components as native React component (import from goodtables-ui/lib
to get native React support):
import React from 'react'
import ReactDOM from 'react-dom'
import goodtablesUI from 'goodtables-ui/lib'
const report = '<YOUR-REPORT>'
const element = document.getElementById('report')
ReactDOM.render(<goodtablesUI.Report report={report} />, element)
This example is for Angular2+. Use similliar approach for Angular1.
The package's components could be used as angular
component:
import {Component, Input} from '@angular/core';
import goodtablesUI from 'goodtablesUI'
@Component({
selector: 'report',
template: '<div id="report"></div>'
})
class Report {
@Input() report: any;
ngAfterViewInit() {
const element = document.getElementById('report')
goodtablesUI.render(goodtablesUI.Report, {report: this.report}, element)
}
}
This example is for Vue2+. Use similar approach for Vue1.
The package's components could be used as vue
component:
import goodtablesUI from 'goodtablesUI'
const Report = {
props: ['report'],
template: '<div id="report"></div>',
mounted() {
const element = document.getElementById('report')
goodtablesUI.render(goodtablesUI.Report, {report: this.report}, element)
},
}
The whole public API of this package is described here and follows semantic versioning rules. Everything outside of this readme are private API and could be changed without any notification on any new version.
To render one of the provided component render
function should be used.
component (Component)
- it could be one of provided by the library component e.g.Report
props (Object)
- object containing propselement (Element)
- DOM element to render into
This component represents a goodtables
report object.
report (Object)
- goodtables report
This component represents a validation form.
source (String)
- seegoodtables-js
documentationoptions (Object)
- seegoodtables-js
documentationvalidate (async func)
- an async function which getssource
andoptions
and resolves to goodtables reportreportPromise (Promise)
- a promise to be resolved as a goodtables report
The project follows the Open Knowledge International coding standards. There are common commands to work with the project:
$ npm run dev
$ npm run build
$ npm run test
Here described only breaking and the most important changes. The full changelog and documentation for all released versions could be found in nicely formatted commit history.
Improved behaviour:
- updated to Data Quality Spec v1
- added support for custom checks
First stable realese.
New functionality added:
Form
component now supports source/schema uploading
New API added:
- published
Form
component
New API added:
- published
Report
component - published
render
function