@panneau/display-unit 3.0.308 → 4.0.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/es/index.js +11 -22
- package/package.json +5 -5
package/es/index.js
CHANGED
|
@@ -1,27 +1,18 @@
|
|
|
1
1
|
import isObject from 'lodash-es/isObject';
|
|
2
2
|
import prettyBytes from 'pretty-bytes';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
3
|
import React, { useMemo } from 'react';
|
|
5
4
|
import { formatDuration } from '@panneau/core/utils';
|
|
6
5
|
|
|
7
6
|
/* eslint-disable react/jsx-no-useless-fragment */
|
|
8
|
-
|
|
9
|
-
value
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
format: null,
|
|
18
|
-
suffix: null
|
|
19
|
-
};
|
|
20
|
-
var Unit = function Unit(_ref) {
|
|
21
|
-
var value = _ref.value,
|
|
22
|
-
placeholder = _ref.placeholder,
|
|
23
|
-
format = _ref.format,
|
|
24
|
-
suffix = _ref.suffix;
|
|
7
|
+
function Unit(_ref) {
|
|
8
|
+
var _ref$value = _ref.value,
|
|
9
|
+
value = _ref$value === void 0 ? null : _ref$value,
|
|
10
|
+
_ref$placeholder = _ref.placeholder,
|
|
11
|
+
placeholder = _ref$placeholder === void 0 ? null : _ref$placeholder,
|
|
12
|
+
_ref$format = _ref.format,
|
|
13
|
+
format = _ref$format === void 0 ? null : _ref$format,
|
|
14
|
+
_ref$suffix = _ref.suffix,
|
|
15
|
+
suffix = _ref$suffix === void 0 ? null : _ref$suffix;
|
|
25
16
|
var finalValue = useMemo(function () {
|
|
26
17
|
if (value === null) {
|
|
27
18
|
return null;
|
|
@@ -47,12 +38,10 @@ var Unit = function Unit(_ref) {
|
|
|
47
38
|
return formatDuration(value);
|
|
48
39
|
}
|
|
49
40
|
return value;
|
|
50
|
-
}, [value]);
|
|
41
|
+
}, [value, format, suffix]);
|
|
51
42
|
return /*#__PURE__*/React.createElement("span", {
|
|
52
43
|
className: "text-nowrap"
|
|
53
44
|
}, finalValue || placeholder);
|
|
54
|
-
}
|
|
55
|
-
Unit.propTypes = propTypes;
|
|
56
|
-
Unit.defaultProps = defaultProps;
|
|
45
|
+
}
|
|
57
46
|
|
|
58
47
|
export { Unit as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@panneau/display-unit",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "Unit display",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -49,15 +49,15 @@
|
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@babel/runtime": "^7.12.5",
|
|
52
|
-
"@panneau/core": "^
|
|
53
|
-
"@panneau/themes": "^
|
|
52
|
+
"@panneau/core": "^4.0.0",
|
|
53
|
+
"@panneau/themes": "^4.0.0",
|
|
54
54
|
"lodash-es": "^4.17.21",
|
|
55
55
|
"pretty-bytes": "^6.1.1",
|
|
56
56
|
"prop-types": "^15.7.2",
|
|
57
|
-
"react-intl": "^5.15.8
|
|
57
|
+
"react-intl": "^5.15.8 || ^6.0.0 || ^7.0.0"
|
|
58
58
|
},
|
|
59
59
|
"publishConfig": {
|
|
60
60
|
"access": "public"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "2cca874e0388b4a20c39aadb205c0e67d5a946fc"
|
|
63
63
|
}
|