1.2.2 • Published 3 years ago

datapackage-ui v1.2.2

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

datapackage-ui

Travis Coveralls NPM Github Gitter

UI for datapackage as a framework-agnostic browser components (DEMO).

Features

  • render - framework-agnostic component render
  • List of components: TBD

Contents

Getting Started

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 datapackageUI.render(datapackageUI.<Component>, 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/datapackage-ui/dist/datapackage-ui.min.css">

Installation

NPM

Install the package in your terminal $ npm install --save datapackage-ui

The package could be used as datapackage-ui package from NPM:

import datapackageUI from 'datapackage-ui'

const props = '<YOUR-PROPS>'
const element = document.getElementById('component')
datapackageUI.render(datapackageUI.Component, {...props}, element)

CDN

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/datapackage-ui/dist/datapackage-ui.min.js"></script>
<script>
  var props = '<YOUR-PROPS>'
  var element = document.getElementById('component')
  datapackageUI.render(datapackageUI.Component, {...props}, element)
</script>

Documentation

React

In this case your application should provide react and react-dom.

You could use presented components as native React component (import from datapackage-ui/lib to get native React support):

import React from 'react'
import ReactDOM from 'react-dom'
import datapackageUI from 'datapackage-ui/lib'

const props = '<YOUR-PROPS>'
const element = document.getElementById('component')
ReactDOM.render(<datapackageUI.Component ...props />, element)

Angular

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 datapackageUI from 'datapackageUI'

@Component({
  selector: 'component',
  template: '<div id="component"></div>'
})
class Report {
  @Input() <YOUR_PROPS>: any;
  ngAfterViewInit() {
    const element = document.getElementById('component')
    datapackageUI.render(datapackageUI.Component, {...this.props}, element)
  }
}

Vue

This example is for Vue2+. Use similar approach for Vue1.

The package's components could be used as vue component:

import datapackageUI from 'datapackageUI'

const Report = {
  props: [<YOUR_PROPS>],
  template: '<div id="component"></div>',
  mounted() {
    const element = document.getElementById('component')
    datapackageUI.render(datapackageUI.Report, {...this.props}, element)
  },
}

API Reference

render(component, props, element)

Render component

ParamTypeDescription
componentComponentit could be one of provided by the library component
propsObjectobject containing props
elementElementDOM element to render into

Contributing

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

Changelog

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.

v1.2

  • Moved react to peer dependencies

v1.1

  • An ability to extend the package editor (#272)

v1.0

  • Initial release of the library
1.2.2

3 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.1.0

4 years ago

1.0.12

4 years ago

1.0.11

4 years ago

1.0.9

4 years ago

1.0.10

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.2.1

5 years ago