@onesy/ui-react 1.0.178 → 1.0.180
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/Chart/Chart.js +10 -8
- package/Expand/Expand.js +5 -1
- package/TableCell/TableCell.js +1 -1
- package/esm/Chart/Chart.js +10 -8
- package/esm/Expand/Expand.js +6 -2
- package/esm/TableCell/TableCell.js +1 -1
- package/esm/index.js +1 -1
- package/esm/useResize/useResize.js +22 -31
- package/index.js +1 -1
- package/package.json +1 -1
- package/useResize/useResize.js +22 -31
package/Chart/Chart.js
CHANGED
|
@@ -542,14 +542,16 @@ const Chart = props_ => {
|
|
|
542
542
|
setHover(true);
|
|
543
543
|
};
|
|
544
544
|
const onWrapperMouseLeave = () => {
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
545
|
+
if (refs.hover.current) {
|
|
546
|
+
setHover(false);
|
|
547
|
+
setTimeout(() => {
|
|
548
|
+
if (tooltipCloseOnMouseLeave) setAppend(values__0 => _objectSpread(_objectSpread({}, values__0), {}, {
|
|
549
|
+
open: false
|
|
550
|
+
}));
|
|
551
|
+
if (!guidelinesDisplayInactive) setGuidelineIn(false);
|
|
552
|
+
setGuidelinePosition({});
|
|
553
|
+
});
|
|
554
|
+
}
|
|
553
555
|
};
|
|
554
556
|
const makeGroupTooltip = (x_, y_) => {
|
|
555
557
|
const items_0 = refs.allValues.current.filter(item_2 => item_2.normalized[0] === x_);
|
package/Expand/Expand.js
CHANGED
|
@@ -113,7 +113,8 @@ const Expand = props_ => {
|
|
|
113
113
|
placeholder: _react.default.useRef(undefined),
|
|
114
114
|
parent: _react.default.useRef(undefined),
|
|
115
115
|
element: _react.default.useRef(undefined),
|
|
116
|
-
value: _react.default.useRef(0)
|
|
116
|
+
value: _react.default.useRef(0),
|
|
117
|
+
previousWidth: _react.default.useRef((0, _utils.isEnvironment)('browser') && window.innerWidth)
|
|
117
118
|
};
|
|
118
119
|
refs.value.current = value;
|
|
119
120
|
refs.parent.current = parent;
|
|
@@ -126,8 +127,11 @@ const Expand = props_ => {
|
|
|
126
127
|
const childrenWithTransition = isTransition(children === null || children === void 0 || (_children$type = children.type) === null || _children$type === void 0 ? void 0 : _children$type.displayName);
|
|
127
128
|
_react.default.useEffect(() => {
|
|
128
129
|
const method = () => {
|
|
130
|
+
const newWidth = window.innerWidth;
|
|
131
|
+
if (refs.previousWidth.current === newWidth) return;
|
|
129
132
|
setValue(null);
|
|
130
133
|
setParent(null);
|
|
134
|
+
refs.previousWidth.current = newWidth;
|
|
131
135
|
};
|
|
132
136
|
|
|
133
137
|
// on resize
|
package/TableCell/TableCell.js
CHANGED
|
@@ -208,7 +208,7 @@ const TableCell = props_ => {
|
|
|
208
208
|
}, [sortedBy_]);
|
|
209
209
|
const onStickyMove = () => {
|
|
210
210
|
const offsetNew = refs.root.current.offsetLeft;
|
|
211
|
-
setStickyActive(refs.offset.current
|
|
211
|
+
setStickyActive(offsetNew < refs.offset.current);
|
|
212
212
|
};
|
|
213
213
|
const onStickyInit = () => {
|
|
214
214
|
if (refs.sticky.current && refs.root.current) {
|
package/esm/Chart/Chart.js
CHANGED
|
@@ -534,14 +534,16 @@ const Chart = props_ => {
|
|
|
534
534
|
setHover(true);
|
|
535
535
|
};
|
|
536
536
|
const onWrapperMouseLeave = () => {
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
537
|
+
if (refs.hover.current) {
|
|
538
|
+
setHover(false);
|
|
539
|
+
setTimeout(() => {
|
|
540
|
+
if (tooltipCloseOnMouseLeave) setAppend(values__0 => _objectSpread(_objectSpread({}, values__0), {}, {
|
|
541
|
+
open: false
|
|
542
|
+
}));
|
|
543
|
+
if (!guidelinesDisplayInactive) setGuidelineIn(false);
|
|
544
|
+
setGuidelinePosition({});
|
|
545
|
+
});
|
|
546
|
+
}
|
|
545
547
|
};
|
|
546
548
|
const makeGroupTooltip = (x_, y_) => {
|
|
547
549
|
const items_0 = refs.allValues.current.filter(item_2 => item_2.normalized[0] === x_);
|
package/esm/Expand/Expand.js
CHANGED
|
@@ -6,7 +6,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
6
6
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7
7
|
import { c as _c } from "react/compiler-runtime";
|
|
8
8
|
import React from 'react';
|
|
9
|
-
import { is } from '@onesy/utils';
|
|
9
|
+
import { is, isEnvironment } from '@onesy/utils';
|
|
10
10
|
import { useOnesyTheme } from '@onesy/style-react';
|
|
11
11
|
import { Transition } from '..';
|
|
12
12
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -105,7 +105,8 @@ const Expand = props_ => {
|
|
|
105
105
|
placeholder: React.useRef(undefined),
|
|
106
106
|
parent: React.useRef(undefined),
|
|
107
107
|
element: React.useRef(undefined),
|
|
108
|
-
value: React.useRef(0)
|
|
108
|
+
value: React.useRef(0),
|
|
109
|
+
previousWidth: React.useRef(isEnvironment('browser') && window.innerWidth)
|
|
109
110
|
};
|
|
110
111
|
refs.value.current = value;
|
|
111
112
|
refs.parent.current = parent;
|
|
@@ -118,8 +119,11 @@ const Expand = props_ => {
|
|
|
118
119
|
const childrenWithTransition = isTransition(children?.type?.displayName);
|
|
119
120
|
React.useEffect(() => {
|
|
120
121
|
const method = () => {
|
|
122
|
+
const newWidth = window.innerWidth;
|
|
123
|
+
if (refs.previousWidth.current === newWidth) return;
|
|
121
124
|
setValue(null);
|
|
122
125
|
setParent(null);
|
|
126
|
+
refs.previousWidth.current = newWidth;
|
|
123
127
|
};
|
|
124
128
|
|
|
125
129
|
// on resize
|
|
@@ -199,7 +199,7 @@ const TableCell = props_ => {
|
|
|
199
199
|
}, [sortedBy_]);
|
|
200
200
|
const onStickyMove = () => {
|
|
201
201
|
const offsetNew = refs.root.current.offsetLeft;
|
|
202
|
-
setStickyActive(refs.offset.current
|
|
202
|
+
setStickyActive(offsetNew < refs.offset.current);
|
|
203
203
|
};
|
|
204
204
|
const onStickyInit = () => {
|
|
205
205
|
if (refs.sticky.current && refs.root.current) {
|
package/esm/index.js
CHANGED
|
@@ -1,36 +1,27 @@
|
|
|
1
|
-
import { c as _c } from "react/compiler-runtime";
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import { isEnvironment } from '@onesy/utils';
|
|
4
3
|
const useResize = () => {
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
4
|
+
const [width, setWidth] = React.useState(() => {
|
|
5
|
+
if (isEnvironment('browser')) return window.innerWidth;
|
|
6
|
+
return 0;
|
|
7
|
+
});
|
|
8
|
+
const refs = {
|
|
9
|
+
width: React.useRef(width)
|
|
10
|
+
};
|
|
11
|
+
refs.width.current = width;
|
|
12
|
+
React.useEffect(() => {
|
|
13
|
+
const onResize = () => {
|
|
14
|
+
const newWidth = window.innerWidth;
|
|
15
|
+
if (refs.width.current === newWidth) return;
|
|
16
|
+
setWidth(newWidth);
|
|
19
17
|
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return windowWidth;
|
|
18
|
+
if (isEnvironment('browser')) {
|
|
19
|
+
const newWidth_0 = window.innerWidth;
|
|
20
|
+
if (refs.width.current !== newWidth_0) setWidth(newWidth_0);
|
|
21
|
+
window.addEventListener('resize', onResize);
|
|
22
|
+
return () => window.removeEventListener('resize', onResize);
|
|
23
|
+
}
|
|
24
|
+
}, []);
|
|
25
|
+
return width;
|
|
29
26
|
};
|
|
30
|
-
export default useResize;
|
|
31
|
-
function _temp() {
|
|
32
|
-
if (isEnvironment("browser")) {
|
|
33
|
-
return window.innerWidth;
|
|
34
|
-
}
|
|
35
|
-
return 0;
|
|
36
|
-
}
|
|
27
|
+
export default useResize;
|
package/index.js
CHANGED
package/package.json
CHANGED
package/useResize/useResize.js
CHANGED
|
@@ -5,39 +5,30 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
var _compilerRuntime = require("react/compiler-runtime");
|
|
9
8
|
var _react = _interopRequireDefault(require("react"));
|
|
10
9
|
var _utils = require("@onesy/utils");
|
|
11
10
|
const useResize = () => {
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
11
|
+
const [width, setWidth] = _react.default.useState(() => {
|
|
12
|
+
if ((0, _utils.isEnvironment)('browser')) return window.innerWidth;
|
|
13
|
+
return 0;
|
|
14
|
+
});
|
|
15
|
+
const refs = {
|
|
16
|
+
width: _react.default.useRef(width)
|
|
17
|
+
};
|
|
18
|
+
refs.width.current = width;
|
|
19
|
+
_react.default.useEffect(() => {
|
|
20
|
+
const onResize = () => {
|
|
21
|
+
const newWidth = window.innerWidth;
|
|
22
|
+
if (refs.width.current === newWidth) return;
|
|
23
|
+
setWidth(newWidth);
|
|
26
24
|
};
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return windowWidth;
|
|
25
|
+
if ((0, _utils.isEnvironment)('browser')) {
|
|
26
|
+
const newWidth_0 = window.innerWidth;
|
|
27
|
+
if (refs.width.current !== newWidth_0) setWidth(newWidth_0);
|
|
28
|
+
window.addEventListener('resize', onResize);
|
|
29
|
+
return () => window.removeEventListener('resize', onResize);
|
|
30
|
+
}
|
|
31
|
+
}, []);
|
|
32
|
+
return width;
|
|
36
33
|
};
|
|
37
|
-
var _default = exports.default = useResize;
|
|
38
|
-
function _temp() {
|
|
39
|
-
if ((0, _utils.isEnvironment)("browser")) {
|
|
40
|
-
return window.innerWidth;
|
|
41
|
-
}
|
|
42
|
-
return 0;
|
|
43
|
-
}
|
|
34
|
+
var _default = exports.default = useResize;
|