Skip to content

Commit c2071e3

Browse files
author
Shammamah Hossain
authored
Merge pull request #66 from plotly/add-width-parameter
Add width parameter
2 parents 84223ac + d4c22f7 commit c2071e3

11 files changed

+503
-217
lines changed

CHANGELOG.md

+12
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,18 @@ The format is based on [Keep a
66
Changelog](http://keepachangelog.com/en/1.0.0/) and this project
77
adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
88

9+
## [0.2.1] - 2019-09-24
10+
11+
### Fixed
12+
* Fixed "Cannot read property 'subscribe' of undefined" JavaScript
13+
error.
14+
15+
## [0.2.0] - 2019-09-24
16+
17+
### Added
18+
* Added `height` and `width` parameters to `daq.Tank` and
19+
`daq.Thermometer`.
20+
921
## [0.1.7] - 2019-07-24
1022

1123
### Changed

MANIFEST.in

+1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ include dash_daq/bundle.js
22
include dash_daq/bundle.js.map
33
include dash_daq/metadata.json
44
include dash_daq/[email protected]
5+
include dash_daq/package-info.json
56
include README.md
67
include LICENSE.md

dash_daq/__init__.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
import os as _os
22
import dash as _dash
33
import sys as _sys
4-
from .version import __version__
4+
import json
5+
6+
_basepath = _os.path.dirname(__file__)
7+
_filepath = _os.path.abspath(_os.path.join(_basepath, 'package-info.json'))
8+
9+
with open(_filepath) as f:
10+
__version__ = json.loads(f.read())['version']
511

612
_current_path = _os.path.dirname(_os.path.abspath(__file__))
713

dash_daq/bundle.js

+55-42
Original file line numberDiff line numberDiff line change
@@ -60240,7 +60240,8 @@ this["dash_daq"] =
6024060240
color = props.color,
6024160241
logarithmic = props.logarithmic,
6024260242
base = props.base,
60243-
size = props.size;
60243+
height = props.height,
60244+
width = props.width;
6024460245

6024560246

6024660247
var dirtyValue = logarithmic ? log.compute(props.value, base) : props.value;
@@ -60296,7 +60297,7 @@ this["dash_daq"] =
6029660297
scaleContainer,
6029760298
React.createElement(
6029860299
TankContainer,
60299-
{ size: size },
60300+
{ height: height, width: width },
6030060301
React.createElement(TankFill, { color: color, height: percentageFill + '%' }),
6030160302
showCurrentValue && currentValue
6030260303
)
@@ -60308,7 +60309,8 @@ this["dash_daq"] =
6030860309
Tank.defaultProps = {
6030960310
min: 0,
6031060311
max: 10,
60311-
size: 192,
60312+
height: 192,
60313+
width: 112,
6031260314
base: 10,
6031360315
labelPosition: 'top'
6031460316
};
@@ -60326,9 +60328,14 @@ this["dash_daq"] =
6032660328
value: PropTypes.number,
6032760329

6032860330
/**
60329-
* The size (height) of the tank in pixels
60331+
* The height of the tank in pixels
6033060332
*/
60331-
size: PropTypes.number,
60333+
height: PropTypes.number,
60334+
60335+
/**
60336+
* The width of the tank in pixels
60337+
*/
60338+
width: PropTypes.number,
6033260339

6033360340
/**
6033460341
* The color of tank fill
@@ -60495,16 +60502,17 @@ this["dash_daq"] =
6049560502

6049660503
function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
6049760504

60498-
var TankContainer = exports.TankContainer = styled.div(_templateObject, function (props) {
60499-
return props.width || '112px';
60500-
}, function (_ref) {
60501-
var size = _ref.size;
60502-
return size + 'px';
60505+
var TankContainer = exports.TankContainer = styled.div(_templateObject, function (_ref) {
60506+
var width = _ref.width;
60507+
return width + 'px';
6050360508
}, function (_ref2) {
60504-
var thermometer = _ref2.thermometer;
60505-
return thermometer ? '40px' : '0';
60509+
var height = _ref2.height;
60510+
return height + 'px';
6050660511
}, function (_ref3) {
60507-
var theme = _ref3.theme;
60512+
var thermometer = _ref3.thermometer;
60513+
return thermometer ? '40px' : '0';
60514+
}, function (_ref4) {
60515+
var theme = _ref4.theme;
6050860516
return theme.dark ? darkTankContainer : lightTankContainer;
6050960517
});
6051060518
TankContainer.defaultProps = {
@@ -60517,43 +60525,43 @@ this["dash_daq"] =
6051760525
return props.theme.secondary;
6051860526
});
6051960527

60520-
var TankFill = exports.TankFill = styled.div(_templateObject4, function (_ref4) {
60521-
var height = _ref4.height;
60528+
var TankFill = exports.TankFill = styled.div(_templateObject4, function (_ref5) {
60529+
var height = _ref5.height;
6052260530
return height || 0;
60523-
}, function (_ref5) {
60524-
var thermometer = _ref5.thermometer;
60525-
return thermometer ? '40px' : '0';
6052660531
}, function (_ref6) {
60527-
var theme = _ref6.theme;
60532+
var thermometer = _ref6.thermometer;
60533+
return thermometer ? '40px' : '0';
60534+
}, function (_ref7) {
60535+
var theme = _ref7.theme;
6052860536
return theme.dark ? darkTankFill : lightTankFill;
6052960537
});
6053060538
TankFill.defaultProps = {
6053160539
theme: light
6053260540
};
6053360541

60534-
var darkTankFill = css(_templateObject5, function (_ref7) {
60535-
var color = _ref7.color,
60536-
theme = _ref7.theme;
60537-
return color || theme.primary;
60538-
}, function (_ref8) {
60542+
var darkTankFill = css(_templateObject5, function (_ref8) {
6053960543
var color = _ref8.color,
6054060544
theme = _ref8.theme;
60545+
return color || theme.primary;
60546+
}, function (_ref9) {
60547+
var color = _ref9.color,
60548+
theme = _ref9.theme;
6054160549
return Color(color || theme.primary).alpha(0.7).string();
6054260550
});
6054360551

60544-
var lightTankFill = css(_templateObject3, function (_ref9) {
60545-
var color = _ref9.color,
60546-
theme = _ref9.theme;
60552+
var lightTankFill = css(_templateObject3, function (_ref10) {
60553+
var color = _ref10.color,
60554+
theme = _ref10.theme;
6054760555
return color || theme.primary;
6054860556
});
6054960557

60550-
var TickContainer = exports.TickContainer = styled.div(_templateObject6, function (_ref10) {
60551-
var xPositioned = _ref10.xPositioned;
60558+
var TickContainer = exports.TickContainer = styled.div(_templateObject6, function (_ref11) {
60559+
var xPositioned = _ref11.xPositioned;
6055260560
return xPositioned && css(_templateObject7);
6055360561
});
6055460562

60555-
var Tick = exports.Tick = styled.div(_templateObject8, function (_ref11) {
60556-
var xPosition = _ref11.xPosition;
60563+
var Tick = exports.Tick = styled.div(_templateObject8, function (_ref12) {
60564+
var xPosition = _ref12.xPosition;
6055760565
return xPosition || xPosition === 0 ? css(_templateObject9, 'calc(' + xPosition + '% - ' + xPosition / 100.0 * 18 + 'px)') : '';
6055860566
}, function (props) {
6055960567
return props.width || 4;
@@ -60565,10 +60573,10 @@ this["dash_daq"] =
6056560573
theme: light
6056660574
};
6056760575

60568-
var Container = exports.Container = styled.div(_templateObject10, function (_ref12) {
60569-
var thermometer = _ref12.thermometer;
60570-
return thermometer ? css(_templateObject11, function (_ref13) {
60571-
var xPositioned = _ref13.xPositioned;
60576+
var Container = exports.Container = styled.div(_templateObject10, function (_ref13) {
60577+
var thermometer = _ref13.thermometer;
60578+
return thermometer ? css(_templateObject11, function (_ref14) {
60579+
var xPositioned = _ref14.xPositioned;
6057260580
return xPositioned ? '-4px' : '-24px';
6057360581
}) : '';
6057460582
});
@@ -60643,8 +60651,6 @@ this["dash_daq"] =
6064360651

6064460652
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6064560653

60646-
var WIDTH = 20;
60647-
6064860654
/**
6064960655
* A thermometer component that
6065060656
* fills to a value between some
@@ -60662,7 +60668,8 @@ this["dash_daq"] =
6066260668
units = props.units,
6066360669
theme = props.theme,
6066460670
color = props.color,
60665-
size = props.size;
60671+
height = props.height,
60672+
width = props.width;
6066660673

6066760674

6066860675
var dirtyValue = logarithmic ? log.compute(props.value, base) : props.value;
@@ -60723,7 +60730,7 @@ this["dash_daq"] =
6072360730
scaleContainer,
6072460731
React.createElement(
6072560732
TankContainer,
60726-
{ thermometer: true, size: size, width: WIDTH + 'px' },
60733+
{ thermometer: true, height: height, width: width },
6072760734
React.createElement(TankFill, {
6072860735
thermometer: true,
6072960736
color: color,
@@ -60741,7 +60748,8 @@ this["dash_daq"] =
6074160748
Thermometer.defaultProps = {
6074260749
min: 0,
6074360750
max: 10,
60744-
size: 192,
60751+
height: 192,
60752+
width: 20,
6074560753
base: 10,
6074660754
labelPosition: 'top',
6074760755
theme: light
@@ -60760,9 +60768,14 @@ this["dash_daq"] =
6076060768
value: PropTypes.number,
6076160769

6076260770
/**
60763-
* The size (height) of the thermometer in pixels
60771+
* The height of the thermometer in pixels
6076460772
*/
60765-
size: PropTypes.number,
60773+
height: PropTypes.number,
60774+
60775+
/**
60776+
* The width of the thermometer in pixels
60777+
*/
60778+
width: PropTypes.number,
6076660779

6076760780
/**
6076860781
* The color of the thermometer fill/current value text

dash_daq/bundle.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dash_daq/package-info.json

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"name": "dash_daq", "version": "0.2.1", "author": "The Plotly Team <[email protected]>"}

0 commit comments

Comments
 (0)