@widergy/energy-ui 2.12.1 → 2.12.2
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/dist/components/EnergyThemeProvider/index.js +36 -13
- package/dist/components/Loading/constants.js +2 -1
- package/dist/components/Loading/index.js +12 -13
- package/dist/components/Loading/theme.js +2 -4
- package/dist/components/UTAlert/AlertHandler.js +101 -75
- package/dist/components/UTAlert/index.js +87 -65
- package/dist/components/UTAlert/theme.js +32 -32
- package/dist/components/UTAttachment/components/Preview/index.js +9 -8
- package/dist/components/UTAttachment/constants.js +13 -7
- package/dist/components/UTAttachment/index.js +250 -159
- package/dist/components/UTAttachment/layout.js +27 -26
- package/dist/components/UTAttachment/theme.js +2 -4
- package/dist/components/UTAttachment/utils.js +117 -34
- package/dist/components/UTAutocomplete/components/ListBox/index.js +21 -13
- package/dist/components/UTAutocomplete/components/ListBox/utils.js +11 -9
- package/dist/components/UTAutocomplete/constants.js +23 -12
- package/dist/components/UTAutocomplete/index.js +94 -54
- package/dist/components/UTAutocomplete/theme.js +4 -6
- package/dist/components/UTAvatar/constants.js +3 -2
- package/dist/components/UTAvatar/index.js +17 -18
- package/dist/components/UTBarChart/components/Bars/components/Bar/components/Rect/index.js +22 -22
- package/dist/components/UTBarChart/components/Bars/components/Bar/constants.js +1 -1
- package/dist/components/UTBarChart/components/Bars/components/Bar/index.js +22 -21
- package/dist/components/UTBarChart/components/Bars/constants.js +6 -3
- package/dist/components/UTBarChart/components/Bars/index.js +80 -70
- package/dist/components/UTBarChart/components/Legend/constants.js +18 -12
- package/dist/components/UTBarChart/components/Legend/index.js +93 -75
- package/dist/components/UTBarChart/components/Legend/utils.js +5 -1
- package/dist/components/UTBarChart/components/Levels/index.js +14 -16
- package/dist/components/UTBarChart/components/Levels/utils.js +27 -25
- package/dist/components/UTBarChart/components/LinearPlot/constants.js +5 -3
- package/dist/components/UTBarChart/components/LinearPlot/index.js +20 -25
- package/dist/components/UTBarChart/components/LinearPlot/utils.js +39 -37
- package/dist/components/UTBarChart/components/Pagination/constants.js +2 -1
- package/dist/components/UTBarChart/components/Pagination/index.js +24 -20
- package/dist/components/UTBarChart/components/XAxis/components/AxisElement/index.js +32 -21
- package/dist/components/UTBarChart/components/XAxis/components/Decoration/constants.js +4 -2
- package/dist/components/UTBarChart/components/XAxis/components/Decoration/index.js +19 -20
- package/dist/components/UTBarChart/components/XAxis/constants.js +2 -1
- package/dist/components/UTBarChart/components/XAxis/index.js +65 -54
- package/dist/components/UTBarChart/components/YAxis/AxisElement/index.js +11 -12
- package/dist/components/UTBarChart/components/YAxis/constants.js +2 -1
- package/dist/components/UTBarChart/components/YAxis/index.js +37 -30
- package/dist/components/UTBarChart/components/YAxis/utils.js +6 -4
- package/dist/components/UTBarChart/constants.js +8 -4
- package/dist/components/UTBarChart/hooks/use-dynamic-margins.js +40 -23
- package/dist/components/UTBarChart/index.js +166 -152
- package/dist/components/UTBarChart/theme.js +2 -4
- package/dist/components/UTBarChart/types.js +19 -10
- package/dist/components/UTBarChart/utils.js +111 -107
- package/dist/components/UTBreadcrumbs/constants.js +31 -23
- package/dist/components/UTBreadcrumbs/index.js +101 -76
- package/dist/components/UTBreadcrumbs/theme.js +2 -4
- package/dist/components/UTButton/constants.js +17 -11
- package/dist/components/UTButton/index.js +31 -28
- package/dist/components/UTButton/theme.js +23 -23
- package/dist/components/UTCBUInput/index.js +40 -36
- package/dist/components/UTCBUInput/theme.js +2 -4
- package/dist/components/UTCaptcha/index.js +45 -19
- package/dist/components/UTCard/components/UTCardFooter/index.js +16 -15
- package/dist/components/UTCard/index.js +120 -85
- package/dist/components/UTCard/theme.js +12 -11
- package/dist/components/UTCard/types.js +3 -2
- package/dist/components/UTCarousel/components/Button/index.js +13 -13
- package/dist/components/UTCarousel/components/Legend/index.js +15 -13
- package/dist/components/UTCarousel/components/Slider/component/Slide/index.js +16 -16
- package/dist/components/UTCarousel/components/Slider/constants.js +10 -5
- package/dist/components/UTCarousel/components/Slider/index.js +273 -204
- package/dist/components/UTCarousel/components/Slider/layout.js +94 -67
- package/dist/components/UTCarousel/index.js +15 -14
- package/dist/components/UTCarousel/theme.js +2 -4
- package/dist/components/UTCheckList/constants.js +2 -1
- package/dist/components/UTCheckList/index.js +93 -72
- package/dist/components/UTCheckList/theme.js +31 -31
- package/dist/components/UTCheckbox/constants.js +6 -3
- package/dist/components/UTCheckbox/index.js +44 -32
- package/dist/components/UTCheckbox/theme.js +35 -35
- package/dist/components/UTConsumptionBar/components/ConsumptionBarIndicator/index.js +9 -9
- package/dist/components/UTConsumptionBar/constants.js +6 -3
- package/dist/components/UTConsumptionBar/index.js +80 -53
- package/dist/components/UTCuit/index.js +133 -109
- package/dist/components/UTCuit/theme.js +53 -51
- package/dist/components/UTDatePicker/components/Day/constants.js +2 -1
- package/dist/components/UTDatePicker/components/Day/index.js +12 -12
- package/dist/components/UTDatePicker/constants.js +31 -20
- package/dist/components/UTDatePicker/index.js +102 -60
- package/dist/components/UTDatePicker/theme.js +3 -5
- package/dist/components/UTDatePicker/types.js +3 -2
- package/dist/components/UTDatePicker/utils.js +6 -2
- package/dist/components/UTDialog/constants.js +4 -2
- package/dist/components/UTDialog/index.js +37 -38
- package/dist/components/UTDialog/theme.js +2 -4
- package/dist/components/UTDialog/types.js +3 -2
- package/dist/components/UTDotMenu/index.js +61 -39
- package/dist/components/UTEmojiPicker/constants.js +11 -6
- package/dist/components/UTEmojiPicker/index.js +65 -45
- package/dist/components/UTEmojiPicker/theme.js +2 -4
- package/dist/components/UTEmojiPicker/utils.js +51 -21
- package/dist/components/UTExternalLink/constants.js +5 -3
- package/dist/components/UTExternalLink/index.js +15 -18
- package/dist/components/UTExternalLink/theme.js +6 -8
- package/dist/components/UTFileInput/constants.js +4 -2
- package/dist/components/UTFileInput/index.js +31 -7
- package/dist/components/UTFileInput/layout.js +97 -68
- package/dist/components/UTIconButton/index.js +72 -49
- package/dist/components/UTIconButton/theme.js +2 -4
- package/dist/components/UTImageRadio/components/ImageRadioCard/index.js +58 -53
- package/dist/components/UTImageRadio/constants.js +6 -3
- package/dist/components/UTImageRadio/index.js +47 -39
- package/dist/components/UTImageRadio/theme.js +12 -11
- package/dist/components/UTImageRadio/types.js +3 -2
- package/dist/components/UTImageRadio/utils.js +6 -2
- package/dist/components/UTLabel/constants.js +20 -14
- package/dist/components/UTLabel/index.js +20 -18
- package/dist/components/UTLabel/theme.js +15 -15
- package/dist/components/UTList/index.js +18 -15
- package/dist/components/UTLoading/index.js +15 -15
- package/dist/components/UTMap/components/GoogleMaps/constants.js +11 -8
- package/dist/components/UTMap/components/GoogleMaps/index.js +91 -63
- package/dist/components/UTMap/components/GoogleMaps/styles.js +3 -2
- package/dist/components/UTMap/constants.js +12 -6
- package/dist/components/UTMap/index.js +198 -163
- package/dist/components/UTMap/types.js +6 -4
- package/dist/components/UTMap/utils.js +46 -29
- package/dist/components/UTMap/withGoogleMapScript.js +22 -18
- package/dist/components/UTMenu/index.js +69 -52
- package/dist/components/UTMenu/theme.js +3 -5
- package/dist/components/UTMenu/utils.js +11 -5
- package/dist/components/UTModal/constants.js +13 -9
- package/dist/components/UTModal/index.js +30 -26
- package/dist/components/UTModal/theme.js +2 -4
- package/dist/components/UTPagination/components/PageSizeSelector/index.js +10 -11
- package/dist/components/UTPagination/components/PageSizeSelector/utils.js +13 -7
- package/dist/components/UTPagination/components/Pagination/components/NavigationButton/index.js +12 -12
- package/dist/components/UTPagination/components/Pagination/index.js +39 -28
- package/dist/components/UTPagination/components/Pagination/utils.js +14 -8
- package/dist/components/UTPagination/constants.js +6 -3
- package/dist/components/UTPagination/index.js +17 -16
- package/dist/components/UTPagination/theme.js +2 -4
- package/dist/components/UTPanel/index.js +44 -38
- package/dist/components/UTPasswordField/components/PasswordValidations/components/Error/index.js +10 -13
- package/dist/components/UTPasswordField/components/PasswordValidations/components/Validation/index.js +19 -22
- package/dist/components/UTPasswordField/components/PasswordValidations/index.js +50 -63
- package/dist/components/UTPasswordField/components/PasswordWarning/index.js +26 -25
- package/dist/components/UTPasswordField/index.js +23 -26
- package/dist/components/UTPasswordField/theme.js +2 -4
- package/dist/components/UTPhoneInput/constants.js +6 -3
- package/dist/components/UTPhoneInput/index.js +205 -180
- package/dist/components/UTPhoneInput/theme.js +77 -77
- package/dist/components/UTPieChart/components/ArrowLabel/constants.js +8 -4
- package/dist/components/UTPieChart/components/ArrowLabel/index.js +23 -24
- package/dist/components/UTPieChart/components/Legend/contants.js +6 -3
- package/dist/components/UTPieChart/components/Legend/index.js +24 -27
- package/dist/components/UTPieChart/constants.js +26 -13
- package/dist/components/UTPieChart/hooks/use-animated-value/index.js +33 -15
- package/dist/components/UTPieChart/index.js +76 -73
- package/dist/components/UTPieChart/theme.js +2 -4
- package/dist/components/UTPieChart/utils.js +2 -4
- package/dist/components/UTProgressBar/constants.js +4 -2
- package/dist/components/UTProgressBar/index.js +17 -15
- package/dist/components/UTProgressBar/theme.js +2 -4
- package/dist/components/UTProgressBar/types.js +3 -2
- package/dist/components/UTRadioGroup/index.js +83 -56
- package/dist/components/UTRadioGroup/theme.js +52 -52
- package/dist/components/UTRating/components/Circle/index.js +56 -41
- package/dist/components/UTRating/components/Faces/constants.js +4 -2
- package/dist/components/UTRating/components/Faces/index.js +36 -34
- package/dist/components/UTRating/components/Star/index.js +40 -36
- package/dist/components/UTRating/constants.js +8 -4
- package/dist/components/UTRating/index.js +46 -31
- package/dist/components/UTRating/theme.js +2 -4
- package/dist/components/UTRipple/Ripple.js +39 -22
- package/dist/components/UTRipple/index.js +37 -18
- package/dist/components/UTSelect/components/Option/index.js +13 -13
- package/dist/components/UTSelect/constants.js +8 -4
- package/dist/components/UTSelect/index.js +85 -63
- package/dist/components/UTSelect/stylesJS.js +3 -2
- package/dist/components/UTSelect/theme.js +4 -6
- package/dist/components/UTSelect/utils.js +13 -3
- package/dist/components/UTSidebar/components/ListOption/index.js +49 -34
- package/dist/components/UTSidebar/components/LogosContainer/components/DynamicIcon/index.js +8 -8
- package/dist/components/UTSidebar/components/LogosContainer/index.js +14 -14
- package/dist/components/UTSidebar/components/Option/constants.js +3 -2
- package/dist/components/UTSidebar/components/Option/index.js +32 -28
- package/dist/components/UTSidebar/components/Toggler/index.js +11 -11
- package/dist/components/UTSidebar/index.js +53 -42
- package/dist/components/UTSidebar/theme.js +2 -4
- package/dist/components/UTSidebar/types.js +10 -5
- package/dist/components/UTSkeleton/index.js +36 -10
- package/dist/components/UTStatus/constants.js +9 -5
- package/dist/components/UTStatus/index.js +15 -16
- package/dist/components/UTStatus/theme.js +49 -66
- package/dist/components/UTSwitch/constants.js +6 -3
- package/dist/components/UTSwitch/index.js +57 -42
- package/dist/components/UTSwitch/theme.js +2 -4
- package/dist/components/UTTable/components/ActionIcons/constants.js +2 -1
- package/dist/components/UTTable/components/ActionIcons/index.js +85 -47
- package/dist/components/UTTable/components/Cell/components/ActionButton/index.js +12 -10
- package/dist/components/UTTable/components/Cell/index.js +23 -18
- package/dist/components/UTTable/components/HeaderCell/constants.js +3 -2
- package/dist/components/UTTable/components/HeaderCell/index.js +30 -23
- package/dist/components/UTTable/components/HeaderCell/utils.js +3 -3
- package/dist/components/UTTable/components/PrimaryAction/index.js +11 -12
- package/dist/components/UTTable/components/ResponsiveCell/index.js +20 -19
- package/dist/components/UTTable/components/Status/index.js +19 -18
- package/dist/components/UTTable/components/TableFooter/components/PageSizeSelector/index.js +9 -10
- package/dist/components/UTTable/components/TableFooter/components/PageSizeSelector/utils.js +13 -7
- package/dist/components/UTTable/components/TableFooter/components/Pagination/components/NavigationButton/index.js +12 -12
- package/dist/components/UTTable/components/TableFooter/components/Pagination/index.js +32 -21
- package/dist/components/UTTable/components/TableFooter/components/Pagination/utils.js +14 -8
- package/dist/components/UTTable/components/TableFooter/constants.js +2 -1
- package/dist/components/UTTable/components/TableFooter/index.js +15 -15
- package/dist/components/UTTable/components/TableHeader/index.js +11 -11
- package/dist/components/UTTable/components/TableRow/constants.js +6 -3
- package/dist/components/UTTable/components/TableRow/index.js +94 -79
- package/dist/components/UTTable/constants.js +43 -26
- package/dist/components/UTTable/hook.js +26 -11
- package/dist/components/UTTable/index.js +223 -132
- package/dist/components/UTTable/theme.js +17 -17
- package/dist/components/UTTable/types.js +8 -4
- package/dist/components/UTTable/utils.js +74 -70
- package/dist/components/UTTabs/components/TooltipTab/index.js +30 -20
- package/dist/components/UTTabs/constants.js +8 -4
- package/dist/components/UTTabs/index.js +86 -57
- package/dist/components/UTTabs/theme.js +2 -4
- package/dist/components/UTTabs/utils.js +1 -1
- package/dist/components/UTTextArea/constants.js +6 -3
- package/dist/components/UTTextArea/index.js +23 -23
- package/dist/components/UTTextArea/theme.js +2 -4
- package/dist/components/UTTextInput/constants.js +3 -2
- package/dist/components/UTTextInput/index.js +165 -137
- package/dist/components/UTTextInput/theme.js +4 -6
- package/dist/components/UTThirdPartyCookieChecker/index.js +21 -17
- package/dist/components/UTToggle/components/ToggleOption/index.js +17 -16
- package/dist/components/UTToggle/index.js +26 -25
- package/dist/components/UTToggle/theme.js +2 -4
- package/dist/components/UTTooltip/index.js +30 -23
- package/dist/components/UTTooltip/theme.js +2 -4
- package/dist/components/UTTopbar/components/Notifications/index.js +14 -11
- package/dist/components/UTTopbar/components/UserMenu/index.js +15 -15
- package/dist/components/UTTopbar/index.js +31 -28
- package/dist/components/UTTopbar/theme.js +2 -4
- package/dist/components/UTTopbar/types.js +9 -5
- package/dist/components/UTTouchableWithoutFeedback/index.js +27 -14
- package/dist/components/UTVirtualizedList/components/VirtualizedData/components/ListRow/constants.js +4 -2
- package/dist/components/UTVirtualizedList/components/VirtualizedData/components/ListRow/index.js +31 -34
- package/dist/components/UTVirtualizedList/components/VirtualizedData/components/ListRow/utils.js +4 -4
- package/dist/components/UTVirtualizedList/components/VirtualizedData/constants.js +12 -6
- package/dist/components/UTVirtualizedList/components/VirtualizedData/hooks/use-ledger.js +18 -8
- package/dist/components/UTVirtualizedList/components/VirtualizedData/hooks/use-virtualized-data.js +47 -23
- package/dist/components/UTVirtualizedList/components/VirtualizedData/index.js +34 -31
- package/dist/components/UTVirtualizedList/components/VirtualizedData/utils.js +93 -81
- package/dist/components/UTVirtualizedList/constants.js +8 -4
- package/dist/components/UTVirtualizedList/index.js +38 -26
- package/dist/components/UTWorkflowContainer/components/ActionButton/index.js +21 -17
- package/dist/components/UTWorkflowContainer/constants.js +6 -3
- package/dist/components/UTWorkflowContainer/hooks/use-previous.js +3 -3
- package/dist/components/UTWorkflowContainer/index.js +51 -32
- package/dist/components/UTWorkflowContainer/theme.js +53 -60
- package/dist/components/UTWorkflowContainer/types.js +3 -2
- package/dist/components/WithLoading/index.js +15 -10
- package/dist/components/WithTheme/index.js +17 -10
- package/dist/components/WithTheme/layout.js +28 -22
- package/dist/components/WithTouch/index.js +19 -12
- package/dist/constants/UTTable.js +3 -2
- package/dist/index.js +58 -58
- package/dist/theme.js +5 -6
- package/dist/types/commonTypes.js +5 -3
- package/dist/types/consumptionTypes.js +5 -3
- package/dist/types/formTypes.js +7 -4
- package/dist/types/tableTypes.js +3 -2
- package/dist/utils/classesUtils.js +13 -5
- package/dist/utils/componentUtils.js +13 -10
- package/dist/utils/helperFunctions.js +4 -4
- package/dist/utils/shadowUtils.js +11 -13
- package/dist/utils/useScreenSize.js +3 -2
- package/package.json +1 -1
|
@@ -1,32 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.default = void 0;
|
|
7
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
9
|
var _propTypes = require("prop-types");
|
|
9
|
-
function _getRequireWildcardCache(
|
|
10
|
-
function _interopRequireWildcard(
|
|
10
|
+
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); }
|
|
11
|
+
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; }
|
|
11
12
|
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); }
|
|
12
|
-
|
|
13
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
14
|
+
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."); }
|
|
15
|
+
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); }
|
|
16
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
17
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
18
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
19
|
+
var AxisElement = function AxisElement(_ref) {
|
|
13
20
|
var _textRef$getBoundingC, _textRef$getBoundingC2, _textRef$getBoundingC3;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
21
|
+
var x = _ref.x,
|
|
22
|
+
graphYStart = _ref.graphYStart,
|
|
23
|
+
className = _ref.className,
|
|
24
|
+
mainLabel = _ref.mainLabel,
|
|
25
|
+
mainLabelStyles = _ref.mainLabelStyles,
|
|
26
|
+
secondaryLabel = _ref.secondaryLabel,
|
|
27
|
+
color = _ref.color,
|
|
28
|
+
yOffset = _ref.yOffset,
|
|
29
|
+
circle = _ref.circle,
|
|
30
|
+
selected = _ref.selected,
|
|
31
|
+
selectedLabelBackground = _ref.selectedLabelBackground,
|
|
32
|
+
labelBackgroundPadding = _ref.labelBackgroundPadding;
|
|
33
|
+
var y = graphYStart + yOffset;
|
|
34
|
+
var _useState = (0, _react.useState)(),
|
|
35
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
36
|
+
textRef = _useState2[0],
|
|
37
|
+
setTextRef = _useState2[1];
|
|
30
38
|
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, secondaryLabel && /*#__PURE__*/_react.default.createElement("text", {
|
|
31
39
|
className: className,
|
|
32
40
|
textAnchor: "middle",
|
|
@@ -44,7 +52,9 @@ const AxisElement = _ref => {
|
|
|
44
52
|
fill: selectedLabelBackground,
|
|
45
53
|
rx: "14"
|
|
46
54
|
}), /*#__PURE__*/_react.default.createElement("text", _extends({
|
|
47
|
-
ref:
|
|
55
|
+
ref: function ref(el) {
|
|
56
|
+
return setTextRef(el);
|
|
57
|
+
},
|
|
48
58
|
className: className,
|
|
49
59
|
textAnchor: "middle",
|
|
50
60
|
fill: color,
|
|
@@ -66,4 +76,5 @@ AxisElement.propTypes = {
|
|
|
66
76
|
selectedLabelBackground: _propTypes.string,
|
|
67
77
|
labelBackgroundPadding: _propTypes.number
|
|
68
78
|
};
|
|
69
|
-
var _default =
|
|
79
|
+
var _default = AxisElement;
|
|
80
|
+
exports.default = _default;
|
|
@@ -4,5 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.LINE_PADDING_Y = exports.LINE_PADDING_X = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
var LINE_PADDING_X = 5;
|
|
8
|
+
exports.LINE_PADDING_X = LINE_PADDING_X;
|
|
9
|
+
var LINE_PADDING_Y = 20;
|
|
10
|
+
exports.LINE_PADDING_Y = LINE_PADDING_Y;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
@@ -8,26 +9,23 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
8
9
|
var _propTypes = require("prop-types");
|
|
9
10
|
var _commonTypes = require("../../../../../../types/commonTypes");
|
|
10
11
|
var _constants = require("./constants");
|
|
11
|
-
function _getRequireWildcardCache(
|
|
12
|
-
function _interopRequireWildcard(
|
|
12
|
+
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); }
|
|
13
|
+
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; }
|
|
13
14
|
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); }
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
withLine
|
|
29
|
-
} = decoration;
|
|
30
|
-
const xCoordinate = x + (position === 'center' ? barWidth / 2 : 0);
|
|
15
|
+
var Decoration = function Decoration(_ref) {
|
|
16
|
+
var decoration = _ref.decoration,
|
|
17
|
+
barWidth = _ref.barWidth,
|
|
18
|
+
graphYStart = _ref.graphYStart,
|
|
19
|
+
offset = _ref.offset,
|
|
20
|
+
classes = _ref.classes;
|
|
21
|
+
var x = decoration.x,
|
|
22
|
+
label = decoration.label,
|
|
23
|
+
position = decoration.position,
|
|
24
|
+
textAnchor = decoration.textAnchor,
|
|
25
|
+
_decoration$textProps = decoration.textProps,
|
|
26
|
+
textProps = _decoration$textProps === void 0 ? {} : _decoration$textProps,
|
|
27
|
+
withLine = decoration.withLine;
|
|
28
|
+
var xCoordinate = x + (position === 'center' ? barWidth / 2 : 0);
|
|
31
29
|
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("text", _extends({
|
|
32
30
|
className: classes.decoration,
|
|
33
31
|
textAnchor: textAnchor,
|
|
@@ -55,4 +53,5 @@ Decoration.propTypes = {
|
|
|
55
53
|
offset: _propTypes.number,
|
|
56
54
|
classes: _commonTypes.classesType
|
|
57
55
|
};
|
|
58
|
-
var _default =
|
|
56
|
+
var _default = Decoration;
|
|
57
|
+
exports.default = _default;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
@@ -13,35 +14,46 @@ var _AxisElement = _interopRequireDefault(require("./components/AxisElement"));
|
|
|
13
14
|
var _Decoration = _interopRequireDefault(require("./components/Decoration"));
|
|
14
15
|
var _constants = require("./constants");
|
|
15
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
-
function _getRequireWildcardCache(
|
|
17
|
-
function _interopRequireWildcard(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
17
|
+
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); }
|
|
18
|
+
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; }
|
|
19
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
20
|
+
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."); }
|
|
21
|
+
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); }
|
|
22
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
23
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
24
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
25
|
+
var XAxis = function XAxis(_ref) {
|
|
26
|
+
var data = _ref.data,
|
|
27
|
+
setRef = _ref.setRef,
|
|
28
|
+
classes = _ref.classes,
|
|
29
|
+
barWidth = _ref.barWidth,
|
|
30
|
+
xAxisDefinition = _ref.xAxisDefinition,
|
|
31
|
+
xAxis = _ref.xAxis,
|
|
32
|
+
graphYStart = _ref.graphYStart,
|
|
33
|
+
graphXStart = _ref.graphXStart,
|
|
34
|
+
graphXEnd = _ref.graphXEnd,
|
|
35
|
+
decoratorRenderer = _ref.decoratorRenderer,
|
|
36
|
+
pagination = _ref.pagination,
|
|
37
|
+
currentPage = _ref.currentPage,
|
|
38
|
+
initialHeight = _ref.initialHeight,
|
|
39
|
+
paginationRef = _ref.paginationRef,
|
|
40
|
+
currentLabel = _ref.currentLabel;
|
|
41
|
+
var xOffset = barWidth / 2;
|
|
42
|
+
var decorations = (0, _react.useMemo)(function () {
|
|
43
|
+
return decoratorRenderer === null || decoratorRenderer === void 0 ? void 0 : decoratorRenderer({
|
|
44
|
+
data: data,
|
|
45
|
+
currentPage: currentPage,
|
|
46
|
+
pagination: pagination
|
|
47
|
+
});
|
|
48
|
+
}, [data, currentPage, pagination, decoratorRenderer]) || [];
|
|
49
|
+
var _useState = (0, _react.useState)(0),
|
|
50
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
51
|
+
offset = _useState2[0],
|
|
52
|
+
setOffset = _useState2[1];
|
|
53
|
+
var formattedDecorators = (0, _react.useMemo)(function () {
|
|
54
|
+
return (0, _utils.getFormattedDecorators)(xAxis, decorations, currentPage, pagination);
|
|
55
|
+
}, [decorations]);
|
|
56
|
+
(0, _react.useEffect)(function () {
|
|
45
57
|
if (!offset && initialHeight > 0) {
|
|
46
58
|
setOffset(initialHeight);
|
|
47
59
|
}
|
|
@@ -58,16 +70,14 @@ const XAxis = _ref => {
|
|
|
58
70
|
className: classes.xAxis
|
|
59
71
|
}), /*#__PURE__*/_react.default.createElement("g", null, /*#__PURE__*/_react.default.createElement("g", {
|
|
60
72
|
ref: paginationRef
|
|
61
|
-
}, xAxisDefinition.map((_ref2, index)
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
} = _ref2;
|
|
70
|
-
const selected = index === currentLabel;
|
|
73
|
+
}, xAxisDefinition.map(function (_ref2, index) {
|
|
74
|
+
var mainLabel = _ref2.mainLabel,
|
|
75
|
+
color = _ref2.color,
|
|
76
|
+
mainLabelStyles = _ref2.mainLabelStyles,
|
|
77
|
+
circle = _ref2.circle,
|
|
78
|
+
selectedLabelBackground = _ref2.selectedLabelBackground,
|
|
79
|
+
labelBackgroundPadding = _ref2.labelBackgroundPadding;
|
|
80
|
+
var selected = index === currentLabel;
|
|
71
81
|
return /*#__PURE__*/_react.default.createElement(_AxisElement.default, {
|
|
72
82
|
className: "".concat(classes.xAxisMainLabel, " ").concat(selected && classes.xAxisSelectedLabel),
|
|
73
83
|
barWidth: barWidth,
|
|
@@ -82,11 +92,9 @@ const XAxis = _ref => {
|
|
|
82
92
|
selectedLabelBackground: selectedLabelBackground,
|
|
83
93
|
labelBackgroundPadding: labelBackgroundPadding
|
|
84
94
|
});
|
|
85
|
-
})), /*#__PURE__*/_react.default.createElement("g", null, xAxisDefinition.map((_ref3, index)
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
color
|
|
89
|
-
} = _ref3;
|
|
95
|
+
})), /*#__PURE__*/_react.default.createElement("g", null, xAxisDefinition.map(function (_ref3, index) {
|
|
96
|
+
var secondaryLabel = _ref3.secondaryLabel,
|
|
97
|
+
color = _ref3.color;
|
|
90
98
|
return /*#__PURE__*/_react.default.createElement(_AxisElement.default, {
|
|
91
99
|
className: classes.xAxisSecondaryLabel,
|
|
92
100
|
barWidth: barWidth,
|
|
@@ -96,15 +104,17 @@ const XAxis = _ref => {
|
|
|
96
104
|
graphYStart: graphYStart,
|
|
97
105
|
yOffset: _constants.Y_OFFSET
|
|
98
106
|
});
|
|
99
|
-
})))), /*#__PURE__*/_react.default.createElement("g", null, formattedDecorators.map(
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
107
|
+
})))), /*#__PURE__*/_react.default.createElement("g", null, formattedDecorators.map(function (decoration) {
|
|
108
|
+
return /*#__PURE__*/_react.default.createElement(_Decoration.default, {
|
|
109
|
+
classes: classes,
|
|
110
|
+
barWidth: barWidth,
|
|
111
|
+
xAxis: xAxis,
|
|
112
|
+
decoration: decoration,
|
|
113
|
+
offset: offset + _constants.Y_OFFSET,
|
|
114
|
+
graphYStart: graphYStart,
|
|
115
|
+
yOffset: _constants.Y_OFFSET
|
|
116
|
+
});
|
|
117
|
+
})));
|
|
108
118
|
};
|
|
109
119
|
XAxis.propTypes = {
|
|
110
120
|
classes: _commonTypes.classesType,
|
|
@@ -123,4 +133,5 @@ XAxis.propTypes = {
|
|
|
123
133
|
paginationRef: _commonTypes.refType,
|
|
124
134
|
currentLabel: _propTypes.number
|
|
125
135
|
};
|
|
126
|
-
var _default =
|
|
136
|
+
var _default = XAxis;
|
|
137
|
+
exports.default = _default;
|
|
@@ -8,17 +8,15 @@ var _propTypes = require("prop-types");
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _commonTypes = require("../../../../../types/commonTypes");
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
className
|
|
21
|
-
} = _ref;
|
|
11
|
+
var AxisElement = function AxisElement(_ref) {
|
|
12
|
+
var x = _ref.x,
|
|
13
|
+
value = _ref.value,
|
|
14
|
+
label = _ref.label,
|
|
15
|
+
textAnchor = _ref.textAnchor,
|
|
16
|
+
yAxis = _ref.yAxis,
|
|
17
|
+
height = _ref.height,
|
|
18
|
+
setRef = _ref.setRef,
|
|
19
|
+
className = _ref.className;
|
|
22
20
|
return /*#__PURE__*/_react.default.createElement("text", {
|
|
23
21
|
className: className,
|
|
24
22
|
ref: setRef,
|
|
@@ -40,4 +38,5 @@ AxisElement.propTypes = {
|
|
|
40
38
|
height: _propTypes.number,
|
|
41
39
|
setRef: _commonTypes.refType
|
|
42
40
|
};
|
|
43
|
-
var _default =
|
|
41
|
+
var _default = AxisElement;
|
|
42
|
+
exports.default = _default;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
@@ -12,32 +13,37 @@ var _utils = require("./utils");
|
|
|
12
13
|
var _AxisElement = _interopRequireDefault(require("./AxisElement"));
|
|
13
14
|
var _constants = require("./constants");
|
|
14
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
function _getRequireWildcardCache(
|
|
16
|
-
function _interopRequireWildcard(
|
|
17
|
-
|
|
16
|
+
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); }
|
|
17
|
+
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; }
|
|
18
|
+
var YAxis = function YAxis(_ref) {
|
|
18
19
|
var _labelRef$current, _labelRef$current$get;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
valueDecorator =
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
20
|
+
var classes = _ref.classes,
|
|
21
|
+
graphYEnd = _ref.graphYEnd,
|
|
22
|
+
graphYStart = _ref.graphYStart,
|
|
23
|
+
maxValue = _ref.maxValue,
|
|
24
|
+
setRef = _ref.setRef,
|
|
25
|
+
textAnchor = _ref.textAnchor,
|
|
26
|
+
unit = _ref.unit,
|
|
27
|
+
_ref$valueDecorator = _ref.valueDecorator,
|
|
28
|
+
valueDecorator = _ref$valueDecorator === void 0 ? function (value) {
|
|
29
|
+
return value;
|
|
30
|
+
} : _ref$valueDecorator,
|
|
31
|
+
x = _ref.x,
|
|
32
|
+
yAxis = _ref.yAxis,
|
|
33
|
+
yAxisTicks = _ref.yAxisTicks,
|
|
34
|
+
graphXEnd = _ref.graphXEnd,
|
|
35
|
+
unitSubtitle = _ref.unitSubtitle,
|
|
36
|
+
linearData = _ref.linearData;
|
|
37
|
+
var labelRef = (0, _react.useRef)();
|
|
38
|
+
var height = ((_labelRef$current = labelRef.current) === null || _labelRef$current === void 0 || (_labelRef$current$get = _labelRef$current.getBoundingClientRect) === null || _labelRef$current$get === void 0 ? void 0 : _labelRef$current$get.call(_labelRef$current).height) || 0;
|
|
39
|
+
var axis = (0, _react.useMemo)(function () {
|
|
40
|
+
return new Array(yAxisTicks).fill(0).map(function (_, index) {
|
|
41
|
+
return index;
|
|
42
|
+
});
|
|
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
|
|
@@ -49,10 +55,10 @@ const YAxis = _ref => {
|
|
|
49
55
|
className: classes.yAxisUnit,
|
|
50
56
|
x: x,
|
|
51
57
|
y: unitSubtitleYPosition
|
|
52
|
-
}, unitSubtitle), axis.map(index
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
58
|
+
}, unitSubtitle), axis.map(function (index) {
|
|
59
|
+
var newMaxValue = (0, _utils.yAxisMaxValueRounder)(maxValue, yAxisTicks);
|
|
60
|
+
var value = Math.round((maxValue - index * maxValue / (yAxisTicks - 1)) * 100) / 100;
|
|
61
|
+
var labelValue = Math.round((newMaxValue - index * newMaxValue / (yAxisTicks - 1)) * 100) / 100;
|
|
56
62
|
return /*#__PURE__*/_react.default.createElement(_AxisElement.default, {
|
|
57
63
|
className: classes.yAxisLabel,
|
|
58
64
|
setRef: (0, _utils.applyToIndex)(0, index, labelRef),
|
|
@@ -81,4 +87,5 @@ YAxis.propTypes = {
|
|
|
81
87
|
unitSubtitle: _propTypes.string,
|
|
82
88
|
linearData: _propTypes.bool
|
|
83
89
|
};
|
|
84
|
-
var _default =
|
|
90
|
+
var _default = YAxis;
|
|
91
|
+
exports.default = _default;
|
|
@@ -4,11 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.yAxisMaxValueRounder = exports.applyToIndex = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
var applyToIndex = function applyToIndex(targetIndex, currentIndex, prop) {
|
|
8
|
+
var defaultValue = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
|
9
9
|
return currentIndex === targetIndex ? prop : defaultValue;
|
|
10
10
|
};
|
|
11
11
|
exports.applyToIndex = applyToIndex;
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
var TICKS_MULTIPLIER_DISTANCE = 5;
|
|
13
|
+
var yAxisMaxValueRounder = function yAxisMaxValueRounder(maxValue, yAxisTicks) {
|
|
14
|
+
return maxValue < 25 ? maxValue : Math.ceil(maxValue / (yAxisTicks - 1) / TICKS_MULTIPLIER_DISTANCE) * TICKS_MULTIPLIER_DISTANCE * (yAxisTicks - 1);
|
|
15
|
+
};
|
|
14
16
|
exports.yAxisMaxValueRounder = yAxisMaxValueRounder;
|
|
@@ -4,7 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.DEFAULT_SCROLL_PADDING = exports.DEFAULT_MAX_VALUE = exports.DEFAULT_MARGIN_TOP = exports.DEFAULT_AXIS_PADDING = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
var DEFAULT_AXIS_PADDING = 10;
|
|
8
|
+
exports.DEFAULT_AXIS_PADDING = DEFAULT_AXIS_PADDING;
|
|
9
|
+
var DEFAULT_SCROLL_PADDING = 20;
|
|
10
|
+
exports.DEFAULT_SCROLL_PADDING = DEFAULT_SCROLL_PADDING;
|
|
11
|
+
var DEFAULT_MARGIN_TOP = 40;
|
|
12
|
+
exports.DEFAULT_MARGIN_TOP = DEFAULT_MARGIN_TOP;
|
|
13
|
+
var DEFAULT_MAX_VALUE = 100;
|
|
14
|
+
exports.DEFAULT_MAX_VALUE = DEFAULT_MAX_VALUE;
|
|
@@ -5,22 +5,38 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = require("react");
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
8
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
9
|
+
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."); }
|
|
10
|
+
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); }
|
|
11
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
12
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
13
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
14
|
+
var LATERAL_DEFAULT_MARGIN = 30;
|
|
15
|
+
var VERTICAL_DEFAULT_MARGIN = 0;
|
|
16
|
+
var useDynamicMargins = function useDynamicMargins(center, options) {
|
|
17
|
+
var _useState = (0, _react.useState)(0),
|
|
18
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
19
|
+
marginLeft = _useState2[0],
|
|
20
|
+
setMarginLeft = _useState2[1];
|
|
21
|
+
var _useState3 = (0, _react.useState)(0),
|
|
22
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
23
|
+
marginRight = _useState4[0],
|
|
24
|
+
setMarginRight = _useState4[1];
|
|
25
|
+
var _useState5 = (0, _react.useState)(0),
|
|
26
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
27
|
+
marginBottom = _useState6[0],
|
|
28
|
+
setMarginBottom = _useState6[1];
|
|
29
|
+
var _useState7 = (0, _react.useState)(0),
|
|
30
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
31
|
+
marginTop = _useState8[0],
|
|
32
|
+
setMarginTop = _useState8[1];
|
|
33
|
+
var lateralMargin = options.lateralMargin,
|
|
34
|
+
verticalMargin = options.verticalMargin;
|
|
35
|
+
var marginLeftRef = (0, _react.useRef)();
|
|
36
|
+
var marginRightRef = (0, _react.useRef)();
|
|
37
|
+
var marginBottomRef = (0, _react.useRef)();
|
|
38
|
+
var marginTopRef = (0, _react.useRef)();
|
|
39
|
+
(0, _react.useEffect)(function () {
|
|
24
40
|
var _marginLeftRef$curren, _marginRightRef$curre, _marginBottomRef$curr, _marginTopRef$current;
|
|
25
41
|
setMarginLeft(Math.ceil((_marginLeftRef$curren = marginLeftRef.current) === null || _marginLeftRef$curren === void 0 ? void 0 : _marginLeftRef$curren.getBoundingClientRect().width) || lateralMargin || LATERAL_DEFAULT_MARGIN);
|
|
26
42
|
setMarginRight(Math.ceil((_marginRightRef$curre = marginRightRef.current) === null || _marginRightRef$curre === void 0 ? void 0 : _marginRightRef$curre.getBoundingClientRect().width) || lateralMargin || LATERAL_DEFAULT_MARGIN);
|
|
@@ -28,14 +44,15 @@ const useDynamicMargins = (center, options) => {
|
|
|
28
44
|
setMarginTop(Math.ceil((_marginTopRef$current = marginTopRef.current) === null || _marginTopRef$current === void 0 ? void 0 : _marginTopRef$current.getBoundingClientRect().height) || verticalMargin || VERTICAL_DEFAULT_MARGIN);
|
|
29
45
|
}, []);
|
|
30
46
|
return {
|
|
31
|
-
marginLeftRef,
|
|
32
|
-
marginRightRef,
|
|
33
|
-
marginBottomRef,
|
|
34
|
-
marginTopRef,
|
|
35
|
-
marginBottom,
|
|
36
|
-
marginTop,
|
|
47
|
+
marginLeftRef: marginLeftRef,
|
|
48
|
+
marginRightRef: marginRightRef,
|
|
49
|
+
marginBottomRef: marginBottomRef,
|
|
50
|
+
marginTopRef: marginTopRef,
|
|
51
|
+
marginBottom: marginBottom,
|
|
52
|
+
marginTop: marginTop,
|
|
37
53
|
marginLeft: center ? Math.max(marginLeft, marginRight) : marginLeft,
|
|
38
54
|
marginRight: center ? Math.max(marginLeft, marginRight) : marginRight
|
|
39
55
|
};
|
|
40
56
|
};
|
|
41
|
-
var _default =
|
|
57
|
+
var _default = useDynamicMargins;
|
|
58
|
+
exports.default = _default;
|