@etsoo/react 1.2.72 → 1.2.76

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.
@@ -193,7 +193,6 @@ export function DataGridEx(props) {
193
193
  }
194
194
  };
195
195
  const handleMouseDown = (event) => {
196
- var _a;
197
196
  const div = event.currentTarget;
198
197
  const row = div.dataset['row'];
199
198
  if (div.parentElement == null || row == null)
@@ -211,7 +210,6 @@ export function DataGridEx(props) {
211
210
  currentDiv.classList.add('DataGridEx-Selected');
212
211
  });
213
212
  state.selectedRowIndex = rowIndex;
214
- (_a = state.ref) === null || _a === void 0 ? void 0 : _a.select(state.selectedRowIndex);
215
213
  };
216
214
  const handleMouseOver = (event) => {
217
215
  rowItems(event.currentTarget, (div) => {
@@ -33,7 +33,7 @@ export function MaskInput(props) {
33
33
  InputProps.readOnly = readOnly;
34
34
  InputProps.inputRef = ref;
35
35
  React.useEffect(() => {
36
- if (maskRef.current == null)
36
+ if (maskRef.current == null || localValue == null)
37
37
  return;
38
38
  maskRef.current.value = String(localValue);
39
39
  maskRef.current.updateValue();
@@ -7,16 +7,33 @@ import React from 'react';
7
7
  */
8
8
  export function TooltipClick(props) {
9
9
  // Destruct
10
- const { children, onClose, title, ...rest } = props;
10
+ // leaveDelay set to 5 seconds to hide the tooltip automatically
11
+ const { children, leaveDelay = 5000, onClose, title, ...rest } = props;
11
12
  // State
12
13
  const [localTitle, setTitle] = React.useState(title);
13
14
  const [open, setOpen] = React.useState(false);
15
+ const leaveSeed = React.useRef(0);
14
16
  // Callback for open the tooltip
15
17
  const openTooltip = (newTitle) => {
16
18
  setOpen(true);
17
19
  if (newTitle)
18
20
  setTitle(newTitle);
21
+ if (leaveDelay > 0) {
22
+ clearLeaveSeed();
23
+ leaveSeed.current = window.setTimeout(() => setOpen(false), leaveDelay);
24
+ }
19
25
  };
26
+ const clearLeaveSeed = () => {
27
+ if (leaveSeed.current > 0) {
28
+ window.clearTimeout(leaveSeed.current);
29
+ leaveSeed.current = 0;
30
+ }
31
+ };
32
+ React.useEffect(() => {
33
+ return () => {
34
+ clearLeaveSeed();
35
+ };
36
+ }, []);
20
37
  // Layout
21
38
  return (React.createElement(ClickAwayListener, { onClickAway: () => setOpen(false) },
22
39
  React.createElement(Tooltip, { PopperProps: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/react",
3
- "version": "1.2.72",
3
+ "version": "1.2.76",
4
4
  "description": "TypeScript ReactJs framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -50,9 +50,9 @@
50
50
  "@emotion/react": "^11.5.0",
51
51
  "@emotion/style": "^0.8.0",
52
52
  "@emotion/styled": "^11.3.0",
53
- "@etsoo/appscript": "^1.1.21",
53
+ "@etsoo/appscript": "^1.1.23",
54
54
  "@etsoo/notificationbase": "^1.0.89",
55
- "@etsoo/shared": "^1.0.58",
55
+ "@etsoo/shared": "^1.0.62",
56
56
  "@mui/icons-material": "^5.0.4",
57
57
  "@mui/material": "^5.0.4",
58
58
  "@reach/router": "^1.3.4",
@@ -83,7 +83,7 @@
83
83
  "@types/react-test-renderer": "^17.0.1",
84
84
  "@typescript-eslint/eslint-plugin": "^5.1.0",
85
85
  "@typescript-eslint/parser": "^5.1.0",
86
- "eslint": "^8.0.1",
86
+ "eslint": "^8.1.0",
87
87
  "eslint-config-airbnb-base": "^14.2.1",
88
88
  "eslint-plugin-import": "^2.25.2",
89
89
  "eslint-plugin-react": "^7.26.1",
@@ -478,8 +478,6 @@ export function DataGridEx<T extends Record<string, any>>(
478
478
  currentDiv.classList.add('DataGridEx-Selected');
479
479
  });
480
480
  state.selectedRowIndex = rowIndex;
481
-
482
- state.ref?.select(state.selectedRowIndex);
483
481
  };
484
482
 
485
483
  const handleMouseOver = (event: React.MouseEvent<HTMLDivElement>) => {
@@ -89,7 +89,7 @@ export function MaskInput<
89
89
  InputProps.inputRef = ref;
90
90
 
91
91
  React.useEffect(() => {
92
- if (maskRef.current == null) return;
92
+ if (maskRef.current == null || localValue == null) return;
93
93
  maskRef.current.value = String(localValue);
94
94
  maskRef.current.updateValue();
95
95
  }, [maskRef.current, localValue]);
@@ -25,18 +25,41 @@ export interface TooltipClickProps
25
25
  */
26
26
  export function TooltipClick(props: TooltipClickProps) {
27
27
  // Destruct
28
- const { children, onClose, title, ...rest } = props;
28
+ // leaveDelay set to 5 seconds to hide the tooltip automatically
29
+ const { children, leaveDelay = 5000, onClose, title, ...rest } = props;
29
30
 
30
31
  // State
31
32
  const [localTitle, setTitle] = React.useState(title);
32
33
  const [open, setOpen] = React.useState(false);
34
+ const leaveSeed = React.useRef(0);
33
35
 
34
36
  // Callback for open the tooltip
35
37
  const openTooltip = (newTitle?: string) => {
36
38
  setOpen(true);
37
39
  if (newTitle) setTitle(newTitle);
40
+
41
+ if (leaveDelay > 0) {
42
+ clearLeaveSeed();
43
+ leaveSeed.current = window.setTimeout(
44
+ () => setOpen(false),
45
+ leaveDelay
46
+ );
47
+ }
48
+ };
49
+
50
+ const clearLeaveSeed = () => {
51
+ if (leaveSeed.current > 0) {
52
+ window.clearTimeout(leaveSeed.current);
53
+ leaveSeed.current = 0;
54
+ }
38
55
  };
39
56
 
57
+ React.useEffect(() => {
58
+ return () => {
59
+ clearLeaveSeed();
60
+ };
61
+ }, []);
62
+
40
63
  // Layout
41
64
  return (
42
65
  <ClickAwayListener onClickAway={() => setOpen(false)}>