Commit 6fe9a2e8 authored by S Anand's avatar S Anand
Browse files

REF: Refactor rollup configurations

parent 2d0cfd28
......@@ -31,22 +31,22 @@ Components:
- Table renderer using [FormHandler](https://learn.gramener.com/guide/formhandler/): [formhandler.min.js](dist/formhandler.min.js)
- [$.formhandler](#formhandler) renders a HTML table from a [FormHandler URL](https://learn.gramener.com/guide/formhandler/)
- Leaflet utilities: [leaflet.min.js](dist/leaflet.min.js)
- [L.TopoJSON](#ltopojson) loads TopoJSON files just like GeoJSON. Requires [topojson](https://github.com/topojson/topojson)
- Sand dance transitions: [sanddance.min.js](dist/sanddance.min.js)
- [g1.sanddance](#g1sanddance) moves DOM elements smoothly based on data
- Map viewer component: [mapviewer.min.js](dist/mapviewer.min.js)
- [g1.mapviewer](#g1mapviewer) renders leaflet maps and simplifies adding layers from data
- Sand dance transitions: [sanddance.min.js](dist/sanddance.min.js)
- [g1.sanddance](#g1sanddance) moves DOM elements smoothly based on data
- Templates: [template.min.js](dist/template.min.js)
- [$.template](#template) renders lodash templates. Requires [lodash](https://lodash.com/)
Utilities:
- Template library: [template.min.js](dist/template.min.js)
- [$.template](#template) renders lodash templates. Requires [lodash](https://lodash.com/)
- Leaflet utilities: [leaflet.min.js](dist/leaflet.min.js)
- [L.TopoJSON](#ltopojson) loads TopoJSON files just like GeoJSON. Requires [topojson](https://github.com/topojson/topojson)
- Event library: [event.min.js](dist/event.min.js)
- [$.dispatch](#dispatch) is like [trigger](https://api.jquery.com/trigger/) but sends a native event (triggers non-jQuery events too)
- Data filtering library: [datafilter.min.js](dist/datafilter.min.js)
- Data filtering: [datafilter.min.js](dist/datafilter.min.js)
- [g1.datafilter](#g1datafilter) filters the data based on the options
- Type detection library: [types.min.js](dist/types.min.js)
- Type detection: [types.min.js](dist/types.min.js)
- [g1.types](#g1types) returns the data types of columns in a DataFrames
......@@ -356,9 +356,11 @@ Examples:
<!-- ----------------------------------------------------------------------- -->
# $.dropdown
Dropdown component that integrates well with g1.urlfilter
A dropdown component that integrates well with [$.urlfilter](#urlfilter) and
[$.urlchange](#urlchange).
$.dropdown requires `bootstrap-select` library and its dependencies.
It requires the [bootstrap-select](https://silviomoreto.github.io/bootstrap-select/examples/)
library and its dependencies.
Examples:
......@@ -368,7 +370,8 @@ Examples:
$('.container1').dropdown({data: ['Red', 'Green', 'Blue'] })
</script>
```
The above code snippet renders a dropdown using [bootstrap-select](https://silviomoreto.github.io/bootstrap-select/examples/) library. The rendered dropdown has 3 options namely Red, Green, Blue.
This renders a dropdown with 3 options -- Red, Green, Blue.
```html
<div class="container2"></div>
......
// g1.* namespace
export { version } from './src/package.js'
export { types } from './src/types.js'
export { url } from './index-urlfilter.js'
export { scale } from './src/scale.js'
export { datafilter } from './index-datafilter.js'
export { sanddance } from './src/sanddance.js'
// $.* namespace
import './index-highlight.js'
import './index-template.js'
import './index-formhandler.js'
......
......@@ -12,97 +12,114 @@ const babelConfig = {
export default [
{
input: "index",
plugins: [resolve(), commonjs(), htmlparts('src/formhandler.template.html'), htmlparts('src/dropdown.template.html')],
output: {
file: "dist/g1.js",
format: "umd",
name: "g1"
}
},
plugins: [
resolve(),
commonjs(),
htmlparts('src/formhandler.template.html'),
htmlparts('src/dropdown.template.html')
]
},
{
input: "index",
plugins: [resolve(), commonjs(), htmlparts('src/formhandler.template.html'), htmlparts('src/dropdown.template.html'), uglify()],
output: {
file: "dist/g1.min.js",
format: "umd",
name: "g1"
}
},
plugins: [
resolve(),
commonjs(),
htmlparts('src/formhandler.template.html'),
htmlparts('src/dropdown.template.html'),
uglify()
]
},
{
input: "index-datafilter",
plugins: [uglify()],
output: { file: "dist/datafilter.min.js", format: "umd", name: "g1" }
output: { file: "dist/datafilter.min.js", format: "umd", name: "g1" },
plugins: [uglify()]
},
{
input: "index-urlfilter",
plugins: [uglify()],
output: { file: "dist/urlfilter.min.js", format: "umd", name: "g1" }
output: { file: "dist/urlfilter.min.js", format: "umd", name: "g1" },
plugins: [uglify()]
},
{
input: "index-formhandler",
plugins: [htmlparts('src/formhandler.template.html'), process.env.npm_lifecycle_event == 'dev' ? '' : uglify()],
output: { file: "dist/formhandler.min.js", format: "umd", name: "g1" }
output: { file: "dist/formhandler.min.js", format: "umd", name: "g1" },
plugins: [
htmlparts('src/formhandler.template.html'),
process.env.npm_lifecycle_event == 'dev' ? '' : uglify()
],
},
{
input: "index-highlight",
plugins: [uglify()],
output: { file: "dist/highlight.min.js", format: "umd", name: "g1" }
output: { file: "dist/highlight.min.js", format: "umd", name: "g1" },
plugins: [uglify()]
},
{
input: "index-template",
plugins: [uglify()],
output: { file: "dist/template.min.js", format: "umd", name: "g1" }
output: { file: "dist/template.min.js", format: "umd", name: "g1" },
plugins: [uglify()]
},
{
input: "index-event",
plugins: [uglify()],
output: { file: "dist/event.min.js", format: "umd", name: "g1" }
output: { file: "dist/event.min.js", format: "umd", name: "g1" },
plugins: [uglify()]
},
{
input: "index-leaflet",
plugins: [uglify()],
output: { file: "dist/leaflet.min.js", format: "umd", name: "g1" }
output: { file: "dist/leaflet.min.js", format: "umd", name: "g1" },
plugins: [uglify()]
},
{
input: "index-mapviewer",
plugins: [resolve(),
commonjs(),
babel(babelrc({ config: babelConfig, exclude: 'node_modules/**' })),
process.env.npm_lifecycle_event == 'dev'? '': uglify()
],
output: {
file: "dist/mapviewer.min.js", format: "umd", name: "g1", globals: {
leaflet: 'L',
d3: 'd3'
}
},
plugins: [
resolve(),
commonjs(),
babel(babelrc({ config: babelConfig, exclude: 'node_modules/**' })),
process.env.npm_lifecycle_event == 'dev' ? '' : uglify()
],
// indicate which modules should be treated as external
external: ['leaflet', 'd3']
},
{
input: "index-sanddance",
plugins: [uglify()],
output: { file: "dist/sanddance.min.js", format: "umd", name: "g1" }
output: { file: "dist/sanddance.min.js", format: "umd", name: "g1" },
plugins: [uglify()]
},
{
input: "index-scale",
output: { file: "dist/scale.min.js", format: "umd", name: "g1" },
plugins: [uglify()],
output: { file: "dist/scale.min.js", format: "umd", name: "g1" }
},
{
input: "index-urlchange",
plugins: [uglify()],
output: { file: "dist/urlchange.min.js", format: "umd", name: "g1" }
output: { file: "dist/urlchange.min.js", format: "umd", name: "g1" },
plugins: [uglify()]
},
{
input: "index-dropdown",
plugins: [resolve(),
commonjs(),
htmlparts('src/dropdown.template.html')],
plugins: [
resolve(),
commonjs(),
htmlparts('src/dropdown.template.html')
],
output: {
file: "dist/dropdown.min.js",
format: "umd",
name: "g1"
}
file: "dist/dropdown.min.js",
format: "umd",
name: "g1"
}
}
]
......@@ -4,7 +4,7 @@
<title>template tests</title>
<script src="../node_modules/jquery/dist/jquery.min.js"></script>
<script src="../node_modules/lodash/lodash.min.js"></script>
<script src="../dist/g1.js"></script>
<script src="../dist/template.min.js"></script>
<script src="tape.js"></script>
</head>
<body>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment