@rio-cloud/rio-uikit 0.15.0-beta-44 → 0.15.0-beta-48
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/README.md +12 -8
- package/lib/components/applicationLayout/ApplicationLayoutBody.js +3 -1
- package/lib/components/assetTree/AssetTree.less +1 -0
- package/lib/components/bottomSheet/BottomSheet.js +157 -0
- package/lib/components/button/Button.js +110 -7
- package/lib/components/button/ToggleButton.js +11 -108
- package/lib/components/charts/BarChart.js +2 -1
- package/lib/components/charts/ChartNeedle.js +57 -0
- package/lib/components/charts/PieChart.js +19 -15
- package/lib/components/charts/RadialBarChart.js +4 -1
- package/lib/components/datepicker/DatePicker.less +4 -0
- package/lib/components/datepicker/DateRangePicker.js +1 -1
- package/lib/components/selects/DropdownHeader.js +2 -6
- package/lib/components/spinner/Spinner.less +2 -2
- package/lib/components/states/MaintenanceState.js +25 -0
- package/lib/components/table/TableCardsSorting.js +7 -7
- package/lib/es/BottomSheet.d.ts +5 -0
- package/lib/es/BottomSheet.js +15 -0
- package/lib/es/ChartNeedle.d.ts +5 -0
- package/lib/es/ChartNeedle.js +15 -0
- package/lib/es/DeviceUtils.d.ts +5 -0
- package/lib/es/MaintenanceState.d.ts +5 -0
- package/lib/es/MaintenanceState.js +15 -0
- package/lib/es/SortDirection.d.ts +6 -0
- package/lib/es/SortDirection.js +13 -0
- package/lib/es/SortUtils.d.ts +6 -0
- package/lib/es/SortUtils.js +19 -0
- package/lib/es/SupportMarker.js +15 -0
- package/lib/es/deviceUtils.js +14 -2
- package/lib/es/useAfterMount.d.ts +4 -0
- package/lib/es/useAfterMount.js +15 -0
- package/lib/es/useClickOutside.d.ts +4 -0
- package/lib/es/useClickOutside.js +15 -0
- package/lib/es/useClipboard.d.ts +4 -0
- package/lib/es/useClipboard.js +15 -0
- package/lib/es/useDebugInfo.d.ts +4 -0
- package/lib/es/useDebugInfo.js +15 -0
- package/lib/es/useEffectOnce.d.ts +4 -0
- package/lib/es/useEffectOnce.js +15 -0
- package/lib/es/useElementSize.d.ts +4 -0
- package/lib/es/useElementSize.js +15 -0
- package/lib/es/useEsc.d.ts +4 -0
- package/lib/es/useEsc.js +15 -0
- package/lib/es/useEvent.d.ts +4 -0
- package/lib/es/useEvent.js +15 -0
- package/lib/es/useInterval.d.ts +4 -0
- package/lib/es/useInterval.js +15 -0
- package/lib/es/useKey.d.ts +4 -0
- package/lib/es/useKey.js +15 -0
- package/lib/es/useLocalStorage.d.ts +4 -0
- package/lib/es/useLocalStorage.js +13 -0
- package/lib/es/useOnMount.js +15 -0
- package/lib/es/useOnScreen.d.ts +4 -0
- package/lib/es/useOnScreen.js +15 -0
- package/lib/es/useOnlineStatus.d.ts +4 -0
- package/lib/es/useOnlineStatus.js +15 -0
- package/lib/es/useRenderCount.d.ts +4 -0
- package/lib/es/useRenderCount.js +15 -0
- package/lib/es/useSessionStorage.d.ts +4 -0
- package/lib/es/useSessionStorage.js +13 -0
- package/lib/es/useStateWithValidation.d.ts +4 -0
- package/lib/es/useStateWithValidation.js +15 -0
- package/lib/es/useTimeout.d.ts +4 -0
- package/lib/es/useTimeout.js +15 -0
- package/lib/es/useWindowResize.d.ts +4 -0
- package/lib/es/useWindowResize.js +15 -0
- package/lib/hooks/useDebugInfo.js +55 -0
- package/lib/hooks/useInterval.js +30 -0
- package/lib/hooks/useOnScreen.js +46 -0
- package/lib/hooks/useOnlineStatus.js +30 -0
- package/lib/hooks/useRenderCount.js +17 -0
- package/lib/hooks/useStateWithValidation.js +33 -0
- package/lib/hooks/useStorage.js +53 -0
- package/lib/hooks/useTimeout.js +9 -6
- package/lib/hooks/useWindowResize.js +9 -3
- package/lib/index.js +20 -4
- package/lib/style/css/_exports/man-uikit.less +1 -0
- package/lib/style/css/_exports/rio-uikit-core.less +2 -2
- package/lib/style/css/_exports/rio-uikit-print-utilities.less +21 -0
- package/lib/style/css/_exports/rio-uikit-responsive-utilities.less +2 -1
- package/lib/style/css/_exports/rio-uikit.less +1 -0
- package/lib/style/css/_exports/rio-website.less +42 -0
- package/lib/style/css/_exports/vw-uikit.less +2 -1
- package/lib/style/css/rio-theme/buttons.less +5 -1
- package/lib/style/css/rio-theme/dropdowns.less +6 -26
- package/lib/style/css/rio-theme/navbar.less +1 -1
- package/lib/style/css/rio-theme/navs.less +19 -0
- package/lib/style/css/utils/_imports.less +82 -0
- package/lib/style/css/utils/responsive/border.less +27 -19
- package/lib/style/css/utils/responsive/display.less +2 -0
- package/lib/style/css/utils/responsive/grid.less +6 -0
- package/lib/style/css/utils/responsive/sizing.less +1 -1
- package/lib/types.ts +121 -11
- package/lib/utils/SortUtils.js +54 -0
- package/lib/utils/routeUtils.js +3 -3
- package/lib/version.json +1 -1
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
# RIO UIKIT
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## Documentation
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
$ npm install && cd uikit-demo/ && npm i && npm start
|
|
7
|
-
```
|
|
8
|
-
The UIKIT is accessable at http://localhost:8090.
|
|
5
|
+
The documentation and how to integrate the UIKIT in your project can be found here: https://uikit.developers.rio.cloud/
|
|
9
6
|
|
|
10
7
|
## Release
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
versions of the uikit will be available under https://uikit.developers.rio.cloud/${VERSION}.
|
|
8
|
+
|
|
9
|
+
Starting with version 0.12.8, all versions of the uikit will be available under https://uikit.developers.rio.cloud/${VERSION}.
|
|
14
10
|
|
|
15
11
|
Changes made without incrementing the version number will not be published under the new version number, but the latest
|
|
16
12
|
"in development" state will be available under https://uikit.developers.rio.cloud/latest
|
|
17
13
|
|
|
14
|
+
## Development
|
|
15
|
+
To run the UIKIT and the UIKIT Demo locally for development, use:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
$ npm install && cd uikit-demo/ && npm i && npm start
|
|
19
|
+
```
|
|
20
|
+
The UIKIT demo is accessable at http://localhost:8090.
|
|
21
|
+
|
|
18
22
|
## License
|
|
19
23
|
|
|
20
24
|
RIO UIKIT is licensed under the Apache 2.0 license.
|
|
@@ -42,7 +42,9 @@ var ApplicationLayoutBody = function ApplicationLayoutBody(props) {
|
|
|
42
42
|
|
|
43
43
|
var moduleContentRef = (0, _react.useRef)();
|
|
44
44
|
var handleScroll = (0, _debounce.default)(RESIZE_THROTTELING)(function () {
|
|
45
|
-
|
|
45
|
+
if (moduleContentRef.current) {
|
|
46
|
+
setOffset(moduleContentRef.current.scrollTop);
|
|
47
|
+
}
|
|
46
48
|
});
|
|
47
49
|
|
|
48
50
|
var handleToTop = function handleToTop() {
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports.default = void 0;
|
|
11
|
+
|
|
12
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
|
+
|
|
14
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
15
|
+
|
|
16
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
17
|
+
|
|
18
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
19
|
+
|
|
20
|
+
var _reactMotion = require("react-motion");
|
|
21
|
+
|
|
22
|
+
var _isFunction = _interopRequireDefault(require("lodash/fp/isFunction"));
|
|
23
|
+
|
|
24
|
+
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); }
|
|
25
|
+
|
|
26
|
+
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; }
|
|
27
|
+
|
|
28
|
+
var BottomSheet = function BottomSheet(props) {
|
|
29
|
+
var show = props.show,
|
|
30
|
+
onClose = props.onClose,
|
|
31
|
+
width = props.width,
|
|
32
|
+
height = props.height,
|
|
33
|
+
title = props.title,
|
|
34
|
+
detatch = props.detatch,
|
|
35
|
+
useBackdrop = props.useBackdrop,
|
|
36
|
+
showCloseButton = props.showCloseButton,
|
|
37
|
+
showMaximizeButton = props.showMaximizeButton,
|
|
38
|
+
onHeightChange = props.onHeightChange,
|
|
39
|
+
bodyRef = props.bodyRef,
|
|
40
|
+
bodyClassName = props.bodyClassName,
|
|
41
|
+
className = props.className,
|
|
42
|
+
children = props.children;
|
|
43
|
+
|
|
44
|
+
var _useState = (0, _react.useState)(show),
|
|
45
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
46
|
+
isShown = _useState2[0],
|
|
47
|
+
setIsShown = _useState2[1];
|
|
48
|
+
|
|
49
|
+
var _useState3 = (0, _react.useState)(false),
|
|
50
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
51
|
+
isMaxHeight = _useState4[0],
|
|
52
|
+
setIsMaxHeight = _useState4[1];
|
|
53
|
+
|
|
54
|
+
(0, _react.useEffect)(function () {
|
|
55
|
+
return setIsShown(show);
|
|
56
|
+
}, [show]);
|
|
57
|
+
|
|
58
|
+
var handleToggle = function handleToggle() {
|
|
59
|
+
var newValue = !isShown;
|
|
60
|
+
|
|
61
|
+
if ((0, _isFunction.default)(onClose)) {
|
|
62
|
+
onClose(newValue);
|
|
63
|
+
} else {
|
|
64
|
+
setIsShown(newValue);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
var handleMaximize = function handleMaximize() {
|
|
69
|
+
var newValue = !isMaxHeight;
|
|
70
|
+
setIsMaxHeight(newValue);
|
|
71
|
+
onHeightChange();
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
var sheetClasses = (0, _classnames.default)('bottom-sheet', 'position-fixed left-0', !width && 'width-100pct', !height && !isMaxHeight && 'height-auto', 'bg-white z-index-max', 'shadow-hard', detatch ? 'margin-15 rounded' : 'rounded-top-left rounded-top-right', className && className);
|
|
75
|
+
var sheetBodyCasses = (0, _classnames.default)('bottom-sheet-body', 'height-100pct', bodyClassName && bodyClassName);
|
|
76
|
+
var backdropClassNames = (0, _classnames.default)('modal-backdrop', 'bg-black opacity-50');
|
|
77
|
+
var sheetHeight = isMaxHeight ? window.innerHeight : height;
|
|
78
|
+
var motionStyles = {}; // Animate the bottom position
|
|
79
|
+
|
|
80
|
+
motionStyles.bottom = (0, _reactMotion.spring)(isShown ? 0 : -1000, {
|
|
81
|
+
stiffness: 210,
|
|
82
|
+
damping: 25
|
|
83
|
+
}); // Animate the max height if a height value is given via prop
|
|
84
|
+
|
|
85
|
+
if (height) {
|
|
86
|
+
motionStyles.height = (0, _reactMotion.spring)(sheetHeight, {
|
|
87
|
+
stiffness: isMaxHeight ? 210 : 180,
|
|
88
|
+
damping: isMaxHeight ? 26 : 15
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_reactMotion.Motion, {
|
|
93
|
+
defaultStyle: {
|
|
94
|
+
bottom: -1000,
|
|
95
|
+
height: height
|
|
96
|
+
},
|
|
97
|
+
style: motionStyles
|
|
98
|
+
}, function (style) {
|
|
99
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
100
|
+
className: sheetClasses,
|
|
101
|
+
width: width,
|
|
102
|
+
style: {
|
|
103
|
+
bottom: style.bottom,
|
|
104
|
+
height: style.height
|
|
105
|
+
}
|
|
106
|
+
}, /*#__PURE__*/_react.default.createElement("div", null, title && /*#__PURE__*/_react.default.createElement("div", {
|
|
107
|
+
className: "bottom-sheet-title display-flex justify-content-between padding-15 border border-top-none border-left-none border-right-none border-color-lighter"
|
|
108
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
109
|
+
className: "text-size-18"
|
|
110
|
+
}, title)), showCloseButton && /*#__PURE__*/_react.default.createElement("div", {
|
|
111
|
+
className: "bottom-sheet-close position-absolute top-10 right-10"
|
|
112
|
+
}, /*#__PURE__*/_react.default.createElement("button", {
|
|
113
|
+
className: "btn btn-muted btn-sm btn-icon-only",
|
|
114
|
+
onClick: handleToggle
|
|
115
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
116
|
+
className: "rioglyph rioglyph-remove"
|
|
117
|
+
}))), showMaximizeButton && /*#__PURE__*/_react.default.createElement("div", {
|
|
118
|
+
className: "bottom-sheet-maximize height-30 position-absolute top-5 left-50pct translate-x-50 cursor-pointer",
|
|
119
|
+
onClick: handleMaximize
|
|
120
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
121
|
+
className: "height-5 width-40 rounded bg-lighter"
|
|
122
|
+
}))), /*#__PURE__*/_react.default.createElement("div", {
|
|
123
|
+
className: sheetBodyCasses,
|
|
124
|
+
ref: bodyRef
|
|
125
|
+
}, children));
|
|
126
|
+
}), useBackdrop && isShown && /*#__PURE__*/_react.default.createElement("div", {
|
|
127
|
+
className: backdropClassNames,
|
|
128
|
+
onClick: handleToggle
|
|
129
|
+
}));
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
BottomSheet.defaultProps = {
|
|
133
|
+
show: false,
|
|
134
|
+
detatch: false,
|
|
135
|
+
useBackdrop: false,
|
|
136
|
+
showCloseButton: true,
|
|
137
|
+
showMaximizeButton: false,
|
|
138
|
+
onHeightChange: function onHeightChange() {}
|
|
139
|
+
};
|
|
140
|
+
BottomSheet.propTypes = {
|
|
141
|
+
show: _propTypes.default.bool.isRequired,
|
|
142
|
+
onClose: _propTypes.default.func,
|
|
143
|
+
width: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
144
|
+
height: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
145
|
+
title: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.string]),
|
|
146
|
+
showCloseButton: _propTypes.default.bool,
|
|
147
|
+
showMaximizeButton: _propTypes.default.bool,
|
|
148
|
+
onHeightChange: _propTypes.default.func,
|
|
149
|
+
detatch: _propTypes.default.bool,
|
|
150
|
+
useBackdrop: _propTypes.default.bool,
|
|
151
|
+
onBackdropClick: _propTypes.default.func,
|
|
152
|
+
bodyRef: _propTypes.default.object,
|
|
153
|
+
bodyClassName: _propTypes.default.string,
|
|
154
|
+
className: _propTypes.default.string
|
|
155
|
+
};
|
|
156
|
+
var _default = BottomSheet;
|
|
157
|
+
exports.default = _default;
|
|
@@ -2,14 +2,117 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
5
7
|
Object.defineProperty(exports, "__esModule", {
|
|
6
8
|
value: true
|
|
7
9
|
});
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
exports.default = void 0;
|
|
11
|
+
|
|
12
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
+
|
|
14
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
|
+
|
|
16
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
17
|
+
|
|
18
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
19
|
+
|
|
20
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
21
|
+
|
|
22
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
23
|
+
|
|
24
|
+
var _excluded = ["active", "disabled", "asToggle", "onClick", "bsStyle", "bsSize", "variant", "iconOnly", "multiline", "block", "className", "children"];
|
|
25
|
+
|
|
26
|
+
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); }
|
|
27
|
+
|
|
28
|
+
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; }
|
|
29
|
+
|
|
30
|
+
var Button = function Button(props) {
|
|
31
|
+
var active = props.active,
|
|
32
|
+
disabled = props.disabled,
|
|
33
|
+
asToggle = props.asToggle,
|
|
34
|
+
onClick = props.onClick,
|
|
35
|
+
bsStyle = props.bsStyle,
|
|
36
|
+
bsSize = props.bsSize,
|
|
37
|
+
variant = props.variant,
|
|
38
|
+
iconOnly = props.iconOnly,
|
|
39
|
+
multiline = props.multiline,
|
|
40
|
+
block = props.block,
|
|
41
|
+
className = props.className,
|
|
42
|
+
children = props.children,
|
|
43
|
+
remainingProps = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
44
|
+
|
|
45
|
+
var _useState = (0, _react.useState)(active),
|
|
46
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
47
|
+
isToggled = _useState2[0],
|
|
48
|
+
setIsToggled = _useState2[1]; // Update internal toggle state when used as controlled component
|
|
49
|
+
// and outside toggle state changes
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
(0, _react.useEffect)(function () {
|
|
53
|
+
return setIsToggled(active);
|
|
54
|
+
}, [active]);
|
|
55
|
+
var toggleRef = (0, _react.useRef)(); // Intercept click handler only for toggle button to update
|
|
56
|
+
// internal state and blur after click
|
|
57
|
+
|
|
58
|
+
var handleClick = function handleClick() {
|
|
59
|
+
var newIsToggled = !isToggled;
|
|
60
|
+
setIsToggled(newIsToggled);
|
|
61
|
+
toggleRef.current && newIsToggled && toggleRef.current.blur();
|
|
62
|
+
onClick(isToggled);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
var buttonClassNames = (0, _classnames.default)('btn', "btn-".concat(bsStyle), variant === Button.VARIANT_LINK && 'btn-link', variant === Button.VARIANT_LINK_INLINE && 'btn-link btn-link-inline', variant === Button.VARIANT_OUTLINE && 'btn-outline', variant === Button.VARIANT_ACTION && 'btn-action', bsSize && "btn-".concat(bsSize), asToggle && 'btn-toggle', isToggled && 'active', iconOnly && 'btn-icon-only', disabled && 'disabled', multiline && 'btn-multiline', block && 'btn-block', className);
|
|
66
|
+
return /*#__PURE__*/_react.default.createElement("button", (0, _extends2.default)({
|
|
67
|
+
ref: asToggle ? toggleRef : undefined,
|
|
68
|
+
type: 'button'
|
|
69
|
+
}, remainingProps, {
|
|
70
|
+
className: buttonClassNames,
|
|
71
|
+
onClick: asToggle ? handleClick : onClick
|
|
72
|
+
}), children);
|
|
73
|
+
}; // Button styles
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
Button.DEFAULT = 'default';
|
|
77
|
+
Button.PRIMARY = 'primary';
|
|
78
|
+
Button.INFO = 'info';
|
|
79
|
+
Button.WARNING = 'warning';
|
|
80
|
+
Button.DANGER = 'danger';
|
|
81
|
+
Button.SUCCESS = 'success';
|
|
82
|
+
Button.MUTED = 'muted'; // Button Type
|
|
83
|
+
|
|
84
|
+
Button.VARIANT_LINK = 'link';
|
|
85
|
+
Button.VARIANT_LINK_INLINE = 'link-inline';
|
|
86
|
+
Button.VARIANT_OUTLINE = 'outline';
|
|
87
|
+
Button.VARIANT_ACTION = 'action'; // Button Size
|
|
14
88
|
|
|
15
|
-
|
|
89
|
+
Button.XS = 'xs';
|
|
90
|
+
Button.SM = 'sm';
|
|
91
|
+
Button.MD = 'md';
|
|
92
|
+
Button.LG = 'lg';
|
|
93
|
+
Button.defaultProps = {
|
|
94
|
+
active: false,
|
|
95
|
+
disabled: false,
|
|
96
|
+
asToggle: false,
|
|
97
|
+
iconOnly: false,
|
|
98
|
+
multiline: false,
|
|
99
|
+
block: false,
|
|
100
|
+
onClick: function onClick() {},
|
|
101
|
+
className: '',
|
|
102
|
+
bsStyle: 'default'
|
|
103
|
+
};
|
|
104
|
+
Button.propTypes = {
|
|
105
|
+
active: _propTypes.default.bool,
|
|
106
|
+
disabled: _propTypes.default.bool,
|
|
107
|
+
asToggle: _propTypes.default.bool,
|
|
108
|
+
iconOnly: _propTypes.default.bool,
|
|
109
|
+
multiline: _propTypes.default.bool,
|
|
110
|
+
block: _propTypes.default.bool,
|
|
111
|
+
onClick: _propTypes.default.func.isRequired,
|
|
112
|
+
bsStyle: _propTypes.default.oneOf([Button.DEFAULT, Button.PRIMARY, Button.INFO, Button.WARNING, Button.DANGER, Button.SUCCESS, Button.MUTED]),
|
|
113
|
+
bsSize: _propTypes.default.oneOf([Button.XS, Button.SM, Button.MD, Button.LG]),
|
|
114
|
+
variant: _propTypes.default.oneOf([Button.VARIANT_LINK, Button.VARIANT_LINK_INLINE, Button.VARIANT_OUTLINE, Button.VARIANT_ACTION]),
|
|
115
|
+
className: _propTypes.default.string
|
|
116
|
+
};
|
|
117
|
+
var _default = Button;
|
|
118
|
+
exports.default = _default;
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
@@ -11,112 +9,17 @@ exports.default = void 0;
|
|
|
11
9
|
|
|
12
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
11
|
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
17
|
-
|
|
18
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
19
|
-
|
|
20
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
21
|
-
|
|
22
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
23
|
-
|
|
24
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
25
|
-
|
|
26
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
27
|
-
|
|
28
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
29
|
-
|
|
30
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
31
|
-
|
|
32
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
33
|
-
|
|
34
|
-
var _excluded = ["active", "className", "bsStyle", "children"];
|
|
35
|
-
|
|
36
|
-
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); }
|
|
12
|
+
var _react = _interopRequireDefault(require("react"));
|
|
37
13
|
|
|
38
|
-
|
|
14
|
+
var _Button = _interopRequireDefault(require("./Button"));
|
|
39
15
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
var ToggleButton = /*#__PURE__*/function (_Component) {
|
|
45
|
-
(0, _inherits2.default)(ToggleButton, _Component);
|
|
46
|
-
|
|
47
|
-
var _super = _createSuper(ToggleButton);
|
|
48
|
-
|
|
49
|
-
function ToggleButton(props) {
|
|
50
|
-
var _this;
|
|
51
|
-
|
|
52
|
-
(0, _classCallCheck2.default)(this, ToggleButton);
|
|
53
|
-
_this = _super.call(this, props);
|
|
54
|
-
_this.state = {
|
|
55
|
-
toggled: props.active
|
|
56
|
-
};
|
|
57
|
-
_this.handleClick = _this.handleClick.bind((0, _assertThisInitialized2.default)(_this));
|
|
58
|
-
return _this;
|
|
59
|
-
} // eslint-disable-next-line camelcase
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
(0, _createClass2.default)(ToggleButton, [{
|
|
63
|
-
key: "UNSAFE_componentWillReceiveProps",
|
|
64
|
-
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
65
|
-
this.setState({
|
|
66
|
-
toggled: nextProps.active
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
}, {
|
|
70
|
-
key: "handleClick",
|
|
71
|
-
value: function handleClick() {
|
|
72
|
-
var isToggled = !this.state.toggled;
|
|
73
|
-
this.setState({
|
|
74
|
-
toggled: isToggled
|
|
75
|
-
});
|
|
76
|
-
this.props.onClick(isToggled);
|
|
77
|
-
|
|
78
|
-
if (this.toggleRef) {
|
|
79
|
-
this.toggleRef.blur();
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}, {
|
|
83
|
-
key: "render",
|
|
84
|
-
value: function render() {
|
|
85
|
-
var _this2 = this;
|
|
86
|
-
|
|
87
|
-
// eslint-disable-next-line no-unused-vars
|
|
88
|
-
var _this$props = this.props,
|
|
89
|
-
active = _this$props.active,
|
|
90
|
-
className = _this$props.className,
|
|
91
|
-
bsStyle = _this$props.bsStyle,
|
|
92
|
-
children = _this$props.children,
|
|
93
|
-
remainingProps = (0, _objectWithoutProperties2.default)(_this$props, _excluded);
|
|
94
|
-
var toggled = this.state.toggled;
|
|
95
|
-
var buttonClassNames = (0, _classnames.default)('ToggleButton', 'btn', "btn-".concat(bsStyle), toggled && 'active', className);
|
|
96
|
-
return /*#__PURE__*/_react.default.createElement("button", (0, _extends2.default)({
|
|
97
|
-
ref: function ref(node) {
|
|
98
|
-
return _this2.toggleRef = node;
|
|
99
|
-
},
|
|
100
|
-
type: 'button'
|
|
101
|
-
}, remainingProps, {
|
|
102
|
-
className: buttonClassNames,
|
|
103
|
-
onClick: this.handleClick
|
|
104
|
-
}), children);
|
|
105
|
-
}
|
|
106
|
-
}]);
|
|
107
|
-
return ToggleButton;
|
|
108
|
-
}(_react.Component);
|
|
109
|
-
|
|
110
|
-
exports.default = ToggleButton;
|
|
111
|
-
ToggleButton.defaultProps = {
|
|
112
|
-
active: false,
|
|
113
|
-
onClick: function onClick() {},
|
|
114
|
-
className: '',
|
|
115
|
-
bsStyle: 'default'
|
|
16
|
+
var ToggleButton = function ToggleButton(props) {
|
|
17
|
+
return /*#__PURE__*/_react.default.createElement(_Button.default, (0, _extends2.default)({}, props, {
|
|
18
|
+
asToggle: true
|
|
19
|
+
}));
|
|
116
20
|
};
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
};
|
|
21
|
+
|
|
22
|
+
ToggleButton.defaultProps = _Button.default.defaultProps;
|
|
23
|
+
ToggleButton.propTypes = _Button.default.propTypes;
|
|
24
|
+
var _default = ToggleButton;
|
|
25
|
+
exports.default = _default;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
|
|
12
|
+
var _react = _interopRequireDefault(require("react"));
|
|
13
|
+
|
|
14
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
15
|
+
|
|
16
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
17
|
+
|
|
18
|
+
var ChartNeedle = function ChartNeedle(props) {
|
|
19
|
+
var width = props.width,
|
|
20
|
+
height = props.height,
|
|
21
|
+
x = props.x,
|
|
22
|
+
y = props.y,
|
|
23
|
+
rotation = props.rotation,
|
|
24
|
+
className = props.className,
|
|
25
|
+
style = props.style;
|
|
26
|
+
|
|
27
|
+
var needleStyle = _objectSpread({
|
|
28
|
+
width: width,
|
|
29
|
+
height: height,
|
|
30
|
+
transformOrigin: 'bottom',
|
|
31
|
+
transform: "translate(".concat(x, ", ").concat(y, ") rotate(").concat(rotation, "deg)"),
|
|
32
|
+
borderBottomLeftRadius: '4px',
|
|
33
|
+
borderBottomRightRadius: '4px',
|
|
34
|
+
borderTopLeftRadius: '100%',
|
|
35
|
+
borderTopRightRadius: '100%',
|
|
36
|
+
display: 'inline-block'
|
|
37
|
+
}, style);
|
|
38
|
+
|
|
39
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
40
|
+
className: 'position-relative'
|
|
41
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
42
|
+
className: "position-absolute bg-dark ".concat(className),
|
|
43
|
+
style: needleStyle
|
|
44
|
+
}));
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
ChartNeedle.defaultProps = {
|
|
48
|
+
width: '5px',
|
|
49
|
+
height: '65px',
|
|
50
|
+
x: '-50%',
|
|
51
|
+
y: '-100%',
|
|
52
|
+
rotation: 0,
|
|
53
|
+
className: '' // style
|
|
54
|
+
|
|
55
|
+
};
|
|
56
|
+
var _default = ChartNeedle;
|
|
57
|
+
exports.default = _default;
|
|
@@ -21,7 +21,7 @@ var _chartHelper = require("./chartHelper");
|
|
|
21
21
|
|
|
22
22
|
var _Legend = _interopRequireDefault(require("./Legend"));
|
|
23
23
|
|
|
24
|
-
var _excluded = ["width", "height", "innerRadius", "outerRadius", "data", "dataKey", "dataUnit", "nameKey", "color", "filled", "innerLabels", "paddingAngle", "legend", "tooltip"];
|
|
24
|
+
var _excluded = ["width", "height", "innerRadius", "outerRadius", "data", "dataKey", "dataUnit", "nameKey", "color", "filled", "labels", "innerLabels", "paddingAngle", "legend", "tooltip", "pieOptions"];
|
|
25
25
|
var RADIAN = Math.PI / 180;
|
|
26
26
|
|
|
27
27
|
var PieChart = function PieChart(props) {
|
|
@@ -35,10 +35,12 @@ var PieChart = function PieChart(props) {
|
|
|
35
35
|
nameKey = props.nameKey,
|
|
36
36
|
color = props.color,
|
|
37
37
|
filled = props.filled,
|
|
38
|
+
labels = props.labels,
|
|
38
39
|
innerLabels = props.innerLabels,
|
|
39
40
|
paddingAngle = props.paddingAngle,
|
|
40
41
|
legend = props.legend,
|
|
41
42
|
tooltip = props.tooltip,
|
|
43
|
+
pieOptions = props.pieOptions,
|
|
42
44
|
remainingProps = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
43
45
|
|
|
44
46
|
var renderInnerLabel = function renderInnerLabel(_ref) {
|
|
@@ -62,37 +64,37 @@ var PieChart = function PieChart(props) {
|
|
|
62
64
|
}, "".concat(value, " ").concat(dataUnit));
|
|
63
65
|
};
|
|
64
66
|
|
|
67
|
+
var renderLabels = function renderLabels(entry) {
|
|
68
|
+
return "".concat((0, _isFunction.default)(dataKey) ? dataKey(entry) : entry[dataKey], " ").concat(dataUnit);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
var pieLabel = labels && (innerLabels ? renderInnerLabel : renderLabels);
|
|
65
72
|
return /*#__PURE__*/_react.default.createElement(_recharts.ResponsiveContainer, {
|
|
66
|
-
height: "100%",
|
|
67
|
-
width: "100%"
|
|
68
|
-
}, /*#__PURE__*/_react.default.createElement(_recharts.PieChart, (0, _extends2.default)({
|
|
69
73
|
width: width,
|
|
70
74
|
height: height
|
|
71
|
-
}, remainingProps
|
|
75
|
+
}, /*#__PURE__*/_react.default.createElement(_recharts.PieChart, remainingProps, legend && /*#__PURE__*/_react.default.createElement(_recharts.Legend, (0, _extends2.default)({
|
|
72
76
|
formatter: function formatter(value, entry) {
|
|
73
77
|
return /*#__PURE__*/_react.default.createElement("span", {
|
|
74
78
|
className: "text-color-darker"
|
|
75
79
|
}, value);
|
|
76
80
|
}
|
|
77
|
-
}, legend.props)), /*#__PURE__*/_react.default.createElement(_recharts.Pie, {
|
|
81
|
+
}, legend.props)), /*#__PURE__*/_react.default.createElement(_recharts.Pie, (0, _extends2.default)({
|
|
78
82
|
data: data,
|
|
79
83
|
isAnimationActive: true,
|
|
80
84
|
nameKey: nameKey,
|
|
81
85
|
dataKey: dataKey,
|
|
82
|
-
label:
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
cx: Math.max(outerRadius, width / 3),
|
|
86
|
-
cy: height / 2,
|
|
86
|
+
label: pieLabel // cx={Math.max(outerRadius, width / 3)}
|
|
87
|
+
// cy={height / 2}
|
|
88
|
+
,
|
|
87
89
|
innerRadius: filled ? 0 : innerRadius,
|
|
88
90
|
outerRadius: outerRadius,
|
|
89
|
-
paddingAngle: paddingAngle,
|
|
91
|
+
paddingAngle: filled ? 0 : paddingAngle,
|
|
90
92
|
labelLine: !innerLabels
|
|
91
|
-
}, data.map(function (entry, index) {
|
|
93
|
+
}, pieOptions), data.map(function (entry, index) {
|
|
92
94
|
var cellColor = (0, _chartHelper.getColor)(entry.color) || (0, _chartHelper.getFromDefaultColors)(index);
|
|
93
95
|
return /*#__PURE__*/_react.default.createElement(_recharts.Cell, {
|
|
94
96
|
key: "cell-".concat(index),
|
|
95
|
-
fill: (0, _isFunction.default)(color) ? color(entry, index) : cellColor
|
|
97
|
+
fill: (0, _isFunction.default)(color) ? (0, _chartHelper.getColor)(color(entry, index)) : cellColor
|
|
96
98
|
});
|
|
97
99
|
})), tooltip && /*#__PURE__*/_react.default.createElement(_recharts.Tooltip, {
|
|
98
100
|
formatter: function formatter(value) {
|
|
@@ -102,7 +104,7 @@ var PieChart = function PieChart(props) {
|
|
|
102
104
|
};
|
|
103
105
|
|
|
104
106
|
PieChart.defaultProps = {
|
|
105
|
-
width:
|
|
107
|
+
width: '100%',
|
|
106
108
|
height: 250,
|
|
107
109
|
innerRadius: 60,
|
|
108
110
|
outerRadius: 80,
|
|
@@ -112,8 +114,10 @@ PieChart.defaultProps = {
|
|
|
112
114
|
nameKey: 'name',
|
|
113
115
|
// color,
|
|
114
116
|
filled: false,
|
|
117
|
+
labels: true,
|
|
115
118
|
innerLabels: false,
|
|
116
119
|
paddingAngle: 3,
|
|
120
|
+
// pieOptions,
|
|
117
121
|
legend: /*#__PURE__*/_react.default.createElement(_Legend.default, null),
|
|
118
122
|
tooltip: true
|
|
119
123
|
};
|
|
@@ -22,7 +22,7 @@ var _Legend = _interopRequireDefault(require("./Legend"));
|
|
|
22
22
|
var _chartHelper = require("./chartHelper");
|
|
23
23
|
|
|
24
24
|
var _excluded = ["width", "height", "data", "dataKey", "startAngle", "endAngle", "innerRadius", "outerRadius", "clockWise", "legend", "textOptions", "radialBarOptions", "showBarLabel", "cornerRadius", "background", "range", "tooltip"],
|
|
25
|
-
_excluded2 = ["text", "size", "color"];
|
|
25
|
+
_excluded2 = ["text", "size", "weight", "color"];
|
|
26
26
|
|
|
27
27
|
var RadialBarChart = function RadialBarChart(props) {
|
|
28
28
|
var width = props.width,
|
|
@@ -48,12 +48,15 @@ var RadialBarChart = function RadialBarChart(props) {
|
|
|
48
48
|
text = _ref.text,
|
|
49
49
|
_ref$size = _ref.size,
|
|
50
50
|
size = _ref$size === void 0 ? '500%' : _ref$size,
|
|
51
|
+
_ref$weight = _ref.weight,
|
|
52
|
+
weight = _ref$weight === void 0 ? 'normal' : _ref$weight,
|
|
51
53
|
_ref$color = _ref.color,
|
|
52
54
|
color = _ref$color === void 0 ? 'gray-darkest' : _ref$color,
|
|
53
55
|
remainingTextOptions = (0, _objectWithoutProperties2.default)(_ref, _excluded2);
|
|
54
56
|
|
|
55
57
|
var textStyle = {
|
|
56
58
|
fontSize: size,
|
|
59
|
+
fontWeight: weight,
|
|
57
60
|
fill: color && (0, _chartHelper.getColor)(color)
|
|
58
61
|
};
|
|
59
62
|
return /*#__PURE__*/_react.default.createElement(_recharts.ResponsiveContainer, {
|