@widergy/energy-ui 2.1.6 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/dist/components/UTBarChart/components/Bars/index.js +5 -1
- package/dist/components/UTBarChart/components/Legend/index.js +11 -8
- package/dist/components/UTBarChart/components/YAxis/index.js +17 -4
- package/dist/components/UTBarChart/index.js +76 -65
- package/dist/components/UTBarChart/types.js +9 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,26 @@
|
|
|
1
|
+
# [2.2.0](https://github.com/widergy/energy-ui/compare/v2.1.7...v2.2.0) (2023-03-10)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* pr fixes ([edcedda](https://github.com/widergy/energy-ui/commit/edceddafae3b4c18c79077a6962ad2c278a50628))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* added some props + handling default cases ([934659f](https://github.com/widergy/energy-ui/commit/934659f0d8b022288127c9c733408f1ea7b3004d))
|
|
12
|
+
* x axis subtitle unit handled ([6a08018](https://github.com/widergy/energy-ui/commit/6a080189ee01e01b6f444d9696d843fb60bf2cd1))
|
|
13
|
+
|
|
14
|
+
## [2.1.7](https://github.com/widergy/energy-ui/compare/v2.1.6...v2.1.7) (2023-03-10)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* no newline at the end of file ([8c183bc](https://github.com/widergy/energy-ui/commit/8c183bc7628d98af62978547649f45e3434a274d))
|
|
20
|
+
* removes lock ([759b0ac](https://github.com/widergy/energy-ui/commit/759b0ac4fac83a52e08b06f00515ea22a9656704))
|
|
21
|
+
* updated hooks version ([d439bde](https://github.com/widergy/energy-ui/commit/d439bde289267937bcc109bd980146d06715d613))
|
|
22
|
+
* updates energy hooks min version ([aee9706](https://github.com/widergy/energy-ui/commit/aee970614cf0ee84e693852f02faae184741f492))
|
|
23
|
+
|
|
1
24
|
## [2.1.6](https://github.com/widergy/energy-ui/compare/v2.1.5...v2.1.6) (2023-02-28)
|
|
2
25
|
|
|
3
26
|
|
|
@@ -59,6 +59,7 @@ var Bars = function Bars(_ref) {
|
|
|
59
59
|
var resetSelection = function resetSelection() {
|
|
60
60
|
setSelectedIndex(-1);
|
|
61
61
|
setSelectedPage(-1);
|
|
62
|
+
setCurrentLabel();
|
|
62
63
|
};
|
|
63
64
|
(0, _react.useEffect)(function () {
|
|
64
65
|
resetSelection();
|
|
@@ -70,7 +71,10 @@ var Bars = function Bars(_ref) {
|
|
|
70
71
|
setSelectedPage(currentPage);
|
|
71
72
|
setCurrentLabel(index);
|
|
72
73
|
}
|
|
73
|
-
if (onBarClick)
|
|
74
|
+
if (onBarClick) {
|
|
75
|
+
onBarClick(data);
|
|
76
|
+
setCurrentLabel(index);
|
|
77
|
+
}
|
|
74
78
|
};
|
|
75
79
|
var barRenderer = function barRenderer(bar, index, data, stackIndex) {
|
|
76
80
|
var offset = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
|
|
@@ -18,6 +18,7 @@ var _utils = require("./utils");
|
|
|
18
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
19
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
20
20
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
21
22
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
22
23
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
23
24
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
@@ -32,7 +33,8 @@ var Legend = function Legend(_ref) {
|
|
|
32
33
|
displayAs = _ref$displayAs === void 0 ? 'block' : _ref$displayAs,
|
|
33
34
|
style = _ref.style,
|
|
34
35
|
labels = _ref.labels,
|
|
35
|
-
classes = _ref.classes
|
|
36
|
+
classes = _ref.classes,
|
|
37
|
+
buttonProps = _ref.buttonProps;
|
|
36
38
|
var _useState = (0, _react.useState)(false),
|
|
37
39
|
_useState2 = _slicedToArray(_useState, 2),
|
|
38
40
|
showLegend = _useState2[0],
|
|
@@ -121,7 +123,7 @@ var Legend = function Legend(_ref) {
|
|
|
121
123
|
style: style
|
|
122
124
|
}, title && /*#__PURE__*/_react.default.createElement(_.UTLabel, {
|
|
123
125
|
className: "".concat(_stylesModule.default.title, " ").concat(classes.title)
|
|
124
|
-
}, title), withButton && /*#__PURE__*/_react.default.createElement(_.UTButton, {
|
|
126
|
+
}, title), withButton && /*#__PURE__*/_react.default.createElement(_.UTButton, _extends({
|
|
125
127
|
classNames: {
|
|
126
128
|
icon: classes.showLegendIcon,
|
|
127
129
|
root: "".concat(_stylesModule.default.button, " ").concat(classes.showLegendButton)
|
|
@@ -131,7 +133,7 @@ var Legend = function Legend(_ref) {
|
|
|
131
133
|
onClick: function onClick() {
|
|
132
134
|
return setShowLegend(true);
|
|
133
135
|
}
|
|
134
|
-
}, /*#__PURE__*/_react.default.createElement(_.UTLabel, {
|
|
136
|
+
}, buttonProps), /*#__PURE__*/_react.default.createElement(_.UTLabel, {
|
|
135
137
|
className: classes.showLegendLabel
|
|
136
138
|
}, showReferencesLabel)), /*#__PURE__*/_react.default.createElement(Wrapper, wrapperProps, referencesToShow.map(function (row) {
|
|
137
139
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
@@ -142,17 +144,18 @@ var Legend = function Legend(_ref) {
|
|
|
142
144
|
})));
|
|
143
145
|
};
|
|
144
146
|
Legend.propTypes = {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
+
buttonProps: _types.buttonPropsTypes,
|
|
148
|
+
classes: _commonTypes.classesType,
|
|
149
|
+
displayAs: _propTypes.string,
|
|
147
150
|
flatData: (0, _propTypes.shape)({
|
|
148
151
|
bar: (0, _propTypes.arrayOf)(_types.barType),
|
|
149
152
|
linear: (0, _propTypes.arrayOf)(_types.linearType),
|
|
150
153
|
levels: _types.levelsType
|
|
151
154
|
}),
|
|
152
|
-
displayAs: _propTypes.string,
|
|
153
|
-
style: _propTypes.object,
|
|
154
155
|
labels: (0, _propTypes.objectOf)(_propTypes.string),
|
|
155
|
-
|
|
156
|
+
references: _types.referencesType,
|
|
157
|
+
style: _propTypes.object,
|
|
158
|
+
title: _propTypes.string
|
|
156
159
|
};
|
|
157
160
|
var _default = Legend;
|
|
158
161
|
exports.default = _default;
|
|
@@ -30,7 +30,10 @@ var YAxis = function YAxis(_ref) {
|
|
|
30
30
|
} : _ref$valueDecorator,
|
|
31
31
|
x = _ref.x,
|
|
32
32
|
yAxis = _ref.yAxis,
|
|
33
|
-
yAxisTicks = _ref.yAxisTicks
|
|
33
|
+
yAxisTicks = _ref.yAxisTicks,
|
|
34
|
+
graphXEnd = _ref.graphXEnd,
|
|
35
|
+
unitSubtitle = _ref.unitSubtitle,
|
|
36
|
+
linearData = _ref.linearData;
|
|
34
37
|
var labelRef = (0, _react.useRef)();
|
|
35
38
|
var height = ((_labelRef$current = labelRef.current) === null || _labelRef$current === void 0 ? void 0 : (_labelRef$current$get = _labelRef$current.getBoundingClientRect) === null || _labelRef$current$get === void 0 ? void 0 : _labelRef$current$get.call(_labelRef$current).height) || 0;
|
|
36
39
|
var axis = (0, _react.useMemo)(function () {
|
|
@@ -38,14 +41,21 @@ var YAxis = function YAxis(_ref) {
|
|
|
38
41
|
return index;
|
|
39
42
|
});
|
|
40
43
|
}, [yAxisTicks]);
|
|
44
|
+
var linearDataUnitXPosition = graphXEnd - graphXEnd * 0.04;
|
|
45
|
+
var unitYPosition = unitSubtitle ? (graphYEnd - _constants.UNIT_PADDING) / 2 : graphYEnd - _constants.UNIT_PADDING;
|
|
46
|
+
var unitSubtitleYPosition = graphYEnd - graphYEnd * 0.5;
|
|
41
47
|
return /*#__PURE__*/_react.default.createElement("g", {
|
|
42
48
|
textAnchor: textAnchor,
|
|
43
49
|
ref: setRef
|
|
44
50
|
}, /*#__PURE__*/_react.default.createElement("text", {
|
|
51
|
+
className: classes.yAxisUnit,
|
|
52
|
+
x: linearData ? linearDataUnitXPosition : x,
|
|
53
|
+
y: unitYPosition
|
|
54
|
+
}, unit), unitSubtitle && /*#__PURE__*/_react.default.createElement("text", {
|
|
45
55
|
className: classes.yAxisUnit,
|
|
46
56
|
x: x,
|
|
47
|
-
y:
|
|
48
|
-
},
|
|
57
|
+
y: unitSubtitleYPosition
|
|
58
|
+
}, unitSubtitle), axis.map(function (index) {
|
|
49
59
|
var newMaxValue = (0, _utils.yAxisMaxValueRounder)(maxValue, yAxisTicks);
|
|
50
60
|
var value = Math.round((maxValue - index * maxValue / (yAxisTicks - 1)) * 100) / 100;
|
|
51
61
|
var labelValue = Math.round((newMaxValue - index * newMaxValue / (yAxisTicks - 1)) * 100) / 100;
|
|
@@ -72,7 +82,10 @@ YAxis.propTypes = {
|
|
|
72
82
|
valueDecorator: _propTypes.func,
|
|
73
83
|
x: _propTypes.number,
|
|
74
84
|
yAxis: _propTypes.func,
|
|
75
|
-
yAxisTicks: _propTypes.number
|
|
85
|
+
yAxisTicks: _propTypes.number,
|
|
86
|
+
graphXEnd: _propTypes.number,
|
|
87
|
+
unitSubtitle: _propTypes.string,
|
|
88
|
+
linearData: _propTypes.bool
|
|
76
89
|
};
|
|
77
90
|
var _default = YAxis;
|
|
78
91
|
exports.default = _default;
|
|
@@ -48,12 +48,14 @@ var UTBarChart = function UTBarChart(_ref) {
|
|
|
48
48
|
var barBorderRadius = _ref.barBorderRadius,
|
|
49
49
|
barData = _ref.barData,
|
|
50
50
|
barPadding = _ref.barPadding,
|
|
51
|
+
buttonProps = _ref.buttonProps,
|
|
51
52
|
center = _ref.center,
|
|
52
53
|
theme = _ref.classes,
|
|
53
54
|
className = _ref.className,
|
|
54
55
|
classNames = _ref.classNames,
|
|
55
56
|
decoratorRenderer = _ref.decoratorRenderer,
|
|
56
57
|
displayLegendAs = _ref.displayLegendAs,
|
|
58
|
+
fitLegend = _ref.fitLegend,
|
|
57
59
|
gradientGenerator = _ref.gradientGenerator,
|
|
58
60
|
hideYAxis = _ref.hideYAxis,
|
|
59
61
|
highlightWidth = _ref.highlightWidth,
|
|
@@ -65,12 +67,11 @@ var UTBarChart = function UTBarChart(_ref) {
|
|
|
65
67
|
NoDataComponent = _ref.NoDataComponent,
|
|
66
68
|
onBarClick = _ref.onBarClick,
|
|
67
69
|
pagination = _ref.pagination,
|
|
68
|
-
selectable = _ref.selectable,
|
|
69
70
|
references = _ref.references,
|
|
71
|
+
selectable = _ref.selectable,
|
|
70
72
|
showGrid = _ref.showGrid,
|
|
71
73
|
singleYAxis = _ref.singleYAxis,
|
|
72
74
|
spacingOptions = _ref.spacingOptions,
|
|
73
|
-
fitLegend = _ref.fitLegend,
|
|
74
75
|
title = _ref.title,
|
|
75
76
|
transitionDuration = _ref.transitionDuration,
|
|
76
77
|
units = _ref.units,
|
|
@@ -156,7 +157,9 @@ var UTBarChart = function UTBarChart(_ref) {
|
|
|
156
157
|
var barAxisLabelFormatter = labelFormatters.bar,
|
|
157
158
|
linearAxisLabelFormatter = labelFormatters.linear;
|
|
158
159
|
var barUnit = units.bar,
|
|
159
|
-
|
|
160
|
+
barUnitSubtitle = units.barSubtitle,
|
|
161
|
+
linearUnit = units.linear,
|
|
162
|
+
linearUnitSubtitle = units.linearSubtitle;
|
|
160
163
|
var Wrapper = pagination ? 'div' : _reactPerfectScrollbar.default;
|
|
161
164
|
var wrapperProps = pagination ? {} : {
|
|
162
165
|
suppressScrollX: !!pagination,
|
|
@@ -174,35 +177,35 @@ var UTBarChart = function UTBarChart(_ref) {
|
|
|
174
177
|
width: TOTAL_WIDTH
|
|
175
178
|
}, gradientGenerator === null || gradientGenerator === void 0 ? void 0 : gradientGenerator(), showGrid && /*#__PURE__*/_react.default.createElement(_Levels.default, {
|
|
176
179
|
classes: classes,
|
|
177
|
-
levels: (0, _utils.getGrid)(yAxisTicks, singleYAxis ? maxAbsoluteValue : roundedMaxBarValue),
|
|
178
|
-
yAxis: yAxis,
|
|
179
|
-
graphXStart: GRAPH_X_START,
|
|
180
180
|
graphXEnd: GRAPH_X_END,
|
|
181
|
-
|
|
181
|
+
graphXStart: GRAPH_X_START,
|
|
182
|
+
graphYStart: GRAPH_Y_START,
|
|
183
|
+
levels: (0, _utils.getGrid)(yAxisTicks, singleYAxis ? maxAbsoluteValue : roundedMaxBarValue),
|
|
184
|
+
yAxis: yAxis
|
|
182
185
|
}), formattedData.map(function (data, group) {
|
|
183
186
|
return /*#__PURE__*/_react.default.createElement(_Bars.default, {
|
|
184
|
-
totalData: barData,
|
|
185
|
-
highlightWidth: highlightWidth,
|
|
186
|
-
selectable: selectable,
|
|
187
|
-
groupWidth: groupWidth,
|
|
188
|
-
xSubAxis: xSubAxis,
|
|
189
|
-
barData: data,
|
|
190
|
-
xAxis: xAxis,
|
|
191
|
-
classes: classes,
|
|
192
|
-
yAxis: yAxis,
|
|
193
187
|
barBorderRadius: barBorderRadius,
|
|
194
|
-
|
|
188
|
+
barData: data,
|
|
195
189
|
barWidth: barWidth,
|
|
190
|
+
classes: classes,
|
|
191
|
+
currentPage: currentPage,
|
|
196
192
|
graphYStart: GRAPH_Y_START,
|
|
197
|
-
maxBarValue: roundedMaxBarValue,
|
|
198
|
-
padding: barPadding,
|
|
199
193
|
group: group,
|
|
200
194
|
groups: groups,
|
|
195
|
+
groupWidth: groupWidth,
|
|
196
|
+
highlightWidth: highlightWidth,
|
|
197
|
+
maxBarValue: roundedMaxBarValue,
|
|
198
|
+
onBarClick: onBarClick,
|
|
199
|
+
padding: barPadding,
|
|
200
|
+
selectable: selectable,
|
|
201
|
+
setCurrentLabel: setCurrentLabel,
|
|
201
202
|
spacingOptions: spacingOptions,
|
|
202
|
-
|
|
203
|
-
valuesOnTop: valuesOnTop,
|
|
203
|
+
totalData: barData,
|
|
204
204
|
transitionDuration: transitionDuration,
|
|
205
|
-
|
|
205
|
+
valuesOnTop: valuesOnTop,
|
|
206
|
+
xAxis: xAxis,
|
|
207
|
+
xSubAxis: xSubAxis,
|
|
208
|
+
yAxis: yAxis
|
|
206
209
|
});
|
|
207
210
|
}), formattedLinearData.map(function (_ref3) {
|
|
208
211
|
var data = _ref3.data,
|
|
@@ -211,77 +214,83 @@ var UTBarChart = function UTBarChart(_ref) {
|
|
|
211
214
|
customLineProps = _ref3.customLineProps,
|
|
212
215
|
markers = _ref3.markers;
|
|
213
216
|
return /*#__PURE__*/_react.default.createElement(_LinearPlot.default, {
|
|
214
|
-
data: data,
|
|
215
|
-
type: type,
|
|
216
|
-
yAxis: linearYAxis,
|
|
217
|
-
xAxis: xAxis,
|
|
218
|
-
markers: markers,
|
|
219
217
|
barWidth: groupWidth,
|
|
220
218
|
color: color,
|
|
219
|
+
customLineProps: customLineProps,
|
|
220
|
+
data: data,
|
|
221
221
|
graphYStart: GRAPH_Y_START,
|
|
222
|
-
|
|
222
|
+
markers: markers,
|
|
223
|
+
type: type,
|
|
224
|
+
xAxis: xAxis,
|
|
225
|
+
yAxis: linearYAxis
|
|
223
226
|
});
|
|
224
227
|
}), /*#__PURE__*/_react.default.createElement(_Levels.default, {
|
|
225
|
-
levels: levels,
|
|
226
|
-
yAxis: yAxis,
|
|
227
|
-
graphXStart: GRAPH_X_START,
|
|
228
228
|
graphXEnd: GRAPH_X_END,
|
|
229
|
-
|
|
229
|
+
graphXStart: GRAPH_X_START,
|
|
230
|
+
graphYStart: GRAPH_Y_START,
|
|
231
|
+
levels: levels,
|
|
232
|
+
yAxis: yAxis
|
|
230
233
|
}), !hideYAxis && /*#__PURE__*/_react.default.createElement(_YAxis.default, {
|
|
231
|
-
graphYEnd: GRAPH_Y_END,
|
|
232
234
|
classes: classes,
|
|
233
|
-
|
|
234
|
-
textAnchor: "end",
|
|
235
|
-
setRef: marginLeftRef,
|
|
236
|
-
yAxisTicks: yAxisTicks,
|
|
237
|
-
maxValue: singleYAxis ? maxAbsoluteValue : roundedMaxBarValue,
|
|
235
|
+
graphYEnd: GRAPH_Y_END,
|
|
238
236
|
graphYStart: GRAPH_Y_START,
|
|
239
|
-
|
|
237
|
+
maxValue: singleYAxis ? maxAbsoluteValue : roundedMaxBarValue,
|
|
238
|
+
setRef: marginLeftRef,
|
|
239
|
+
textAnchor: "end",
|
|
240
|
+
unit: barUnit,
|
|
240
241
|
valueDecorator: barAxisLabelFormatter,
|
|
241
|
-
|
|
242
|
+
x: marginLeft,
|
|
243
|
+
yAxis: yAxis,
|
|
244
|
+
yAxisTicks: yAxisTicks,
|
|
245
|
+
unitSubtitle: barUnitSubtitle,
|
|
246
|
+
graphXEnd: GRAPH_X_END
|
|
242
247
|
}), !hideYAxis && withLinearData && !singleYAxis && /*#__PURE__*/_react.default.createElement(_YAxis.default, {
|
|
243
|
-
graphYEnd: GRAPH_Y_END,
|
|
244
248
|
classes: classes,
|
|
245
|
-
|
|
246
|
-
textAnchor: "start",
|
|
247
|
-
setRef: marginRightRef,
|
|
248
|
-
yAxisTicks: yAxisTicks,
|
|
249
|
-
maxValue: roundedMaxLinearValue,
|
|
249
|
+
graphYEnd: GRAPH_Y_END,
|
|
250
250
|
graphYStart: GRAPH_Y_START,
|
|
251
|
-
|
|
251
|
+
maxValue: roundedMaxLinearValue,
|
|
252
|
+
setRef: marginRightRef,
|
|
253
|
+
textAnchor: "start",
|
|
254
|
+
unit: linearUnit,
|
|
255
|
+
unitSubtitle: linearUnitSubtitle,
|
|
252
256
|
valueDecorator: linearAxisLabelFormatter,
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
data: formattedData,
|
|
257
|
-
graphYStart: GRAPH_Y_START,
|
|
258
|
-
graphXStart: GRAPH_X_START,
|
|
257
|
+
x: TOTAL_WIDTH - marginRight,
|
|
258
|
+
yAxis: linearYAxis,
|
|
259
|
+
yAxisTicks: yAxisTicks,
|
|
259
260
|
graphXEnd: GRAPH_X_END,
|
|
260
|
-
|
|
261
|
-
|
|
261
|
+
linearData: true
|
|
262
|
+
}), /*#__PURE__*/_react.default.createElement(_XAxis.default, {
|
|
262
263
|
barWidth: groupWidth,
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
decoratorRenderer: decoratorRenderer,
|
|
264
|
+
classes: classes,
|
|
265
|
+
currentLabel: currentLabel,
|
|
266
266
|
currentPage: currentPage,
|
|
267
|
+
data: formattedData,
|
|
268
|
+
decoratorRenderer: decoratorRenderer,
|
|
269
|
+
graphXEnd: GRAPH_X_END,
|
|
270
|
+
graphXStart: GRAPH_X_START,
|
|
271
|
+
graphYStart: GRAPH_Y_START,
|
|
267
272
|
initialHeight: marginBottom,
|
|
273
|
+
pagination: pagination,
|
|
268
274
|
paginationRef: paginationRef,
|
|
269
|
-
|
|
275
|
+
setRef: marginBottomRef,
|
|
276
|
+
xAxisDefinition: pagination ? xAxisDefinition.slice(currentPage * pagination, (currentPage + 1) * pagination) : xAxisDefinition,
|
|
277
|
+
xAxis: xAxis
|
|
270
278
|
})), !!pagination && /*#__PURE__*/_react.default.createElement(_Pagination.default, {
|
|
271
|
-
classes: classes,
|
|
272
|
-
parentYPosition: parentYPosition,
|
|
273
279
|
anchor: paginationRef,
|
|
274
|
-
|
|
280
|
+
classes: classes,
|
|
275
281
|
currentPage: currentPage,
|
|
276
|
-
totalPages: totalPages,
|
|
277
282
|
graphXEnd: GRAPH_X_END,
|
|
278
|
-
graphXStart: GRAPH_X_START
|
|
283
|
+
graphXStart: GRAPH_X_START,
|
|
284
|
+
parentYPosition: parentYPosition,
|
|
285
|
+
setCurrentPage: setCurrentPage,
|
|
286
|
+
totalPages: totalPages
|
|
279
287
|
}))), /*#__PURE__*/_react.default.createElement(_Legend.default, {
|
|
288
|
+
buttonProps: buttonProps,
|
|
280
289
|
classes: classes,
|
|
281
290
|
displayAs: displayLegendAs,
|
|
282
291
|
style: {
|
|
283
292
|
width: fitLegend ? containerWidth - 2 * GRAPH_X_START : containerWidth,
|
|
284
|
-
margin: fitLegend ?
|
|
293
|
+
margin: fitLegend ? '0' : '0 auto'
|
|
285
294
|
},
|
|
286
295
|
flatData: {
|
|
287
296
|
bar: flatBarData,
|
|
@@ -295,6 +304,7 @@ var UTBarChart = function UTBarChart(_ref) {
|
|
|
295
304
|
};
|
|
296
305
|
UTBarChart.propTypes = {
|
|
297
306
|
barData: _types.barDataType,
|
|
307
|
+
buttonProps: _types.buttonPropsTypes,
|
|
298
308
|
linearData: _types.linearDataType,
|
|
299
309
|
pagination: _propTypes.number,
|
|
300
310
|
yAxisTicks: _propTypes.number,
|
|
@@ -328,6 +338,7 @@ UTBarChart.propTypes = {
|
|
|
328
338
|
transitionDuration: _propTypes.number
|
|
329
339
|
};
|
|
330
340
|
UTBarChart.defaultProps = {
|
|
341
|
+
buttonProps: {},
|
|
331
342
|
highlightWidth: 1,
|
|
332
343
|
pagination: 0,
|
|
333
344
|
yAxisTicks: 6,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.xAxisDefinitionType = exports.referencesType = exports.linearType = exports.linearMarkersType = exports.linearDataType = exports.levelsType = exports.barType = exports.barDataType = void 0;
|
|
6
|
+
exports.xAxisDefinitionType = exports.referencesType = exports.linearType = exports.linearMarkersType = exports.linearDataType = exports.levelsType = exports.buttonPropsTypes = exports.barType = exports.barDataType = void 0;
|
|
7
7
|
var _propTypes = require("prop-types");
|
|
8
8
|
var barType = (0, _propTypes.shape)({
|
|
9
9
|
clickable: _propTypes.bool,
|
|
@@ -61,4 +61,11 @@ var xAxisDefinitionType = (0, _propTypes.arrayOf)((0, _propTypes.shape)({
|
|
|
61
61
|
secondaryLabel: _propTypes.string,
|
|
62
62
|
selectedLabelBackground: _propTypes.string
|
|
63
63
|
}));
|
|
64
|
-
exports.xAxisDefinitionType = xAxisDefinitionType;
|
|
64
|
+
exports.xAxisDefinitionType = xAxisDefinitionType;
|
|
65
|
+
var buttonPropsTypes = (0, _propTypes.shape)({
|
|
66
|
+
colorTheme: _propTypes.string,
|
|
67
|
+
iconPlacement: _propTypes.string,
|
|
68
|
+
size: _propTypes.string,
|
|
69
|
+
variant: _propTypes.string
|
|
70
|
+
});
|
|
71
|
+
exports.buttonPropsTypes = buttonPropsTypes;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@widergy/energy-ui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "Widergy Web Components",
|
|
5
5
|
"author": "widergy",
|
|
6
6
|
"license": "MIT",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@material-ui/pickers": "^3.3.10",
|
|
31
31
|
"@tippy.js/react": "^3.0.0",
|
|
32
32
|
"@trainline/react-skeletor": "^1.0.2",
|
|
33
|
-
"@widergy/energy-hooks": "^1.0.
|
|
33
|
+
"@widergy/energy-hooks": "^1.0.4",
|
|
34
34
|
"@widergy/web-utils": ">=1.0.0",
|
|
35
35
|
"autoprefixer": "^9.5.0",
|
|
36
36
|
"babel-plugin-inline-react-svg": "^1.1.0",
|