dtable-ui-component 5.3.9 → 5.3.10-beta

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.
@@ -5,7 +5,7 @@
5
5
  border-radius: 3px;
6
6
  z-index: 100;
7
7
  padding: 0.75rem;
8
- line-height: normal;
8
+ line-height: 16px;
9
9
  position: absolute;
10
10
  box-shadow: rgba(0, 0, 0, 0.3) 0px 0px 2px, rgba(0, 0, 0, 0.3) 0px 4px 4px;
11
11
  }
@@ -48,7 +48,7 @@ class RowExpandCollaboratorEditor extends _react.default.Component {
48
48
  }
49
49
  };
50
50
  this.hideSelect = event => {
51
- if (!this.state.showCollaboratorSelect || !event.target || event.target.tagName.toUpperCase() === 'INPUT') {
51
+ if (!this.state.showCollaboratorSelect || !event.target) {
52
52
  return;
53
53
  }
54
54
  const editor = document.querySelector('.dtable-ui-collaborator-editor-container');
@@ -11,9 +11,7 @@ var _classnames = _interopRequireDefault(require("classnames"));
11
11
  var _hooks = require("../../hooks");
12
12
  var _DepartmentSingleSelectFormatter = _interopRequireDefault(require("../../DepartmentSingleSelectFormatter"));
13
13
  var _constants = require("../../constants");
14
- var _lang = require("../../lang");
15
14
  var _departmentSingleSelect = _interopRequireDefault(require("../../Department-editor/department-single-select"));
16
- var _constants2 = require("../../Department-editor/constants");
17
15
  function RowExpandDepartmentEditor(props) {
18
16
  const {
19
17
  row,
@@ -45,7 +43,7 @@ function RowExpandDepartmentEditor(props) {
45
43
  // eslint-disable-next-line
46
44
  }, [row]);
47
45
  function hideDropDownMenu(event) {
48
- if (!event.target || event.target.tagName.toUpperCase() === 'INPUT') return;
46
+ if (!event.target) return;
49
47
  toggleDepartmentSelect(false);
50
48
  }
51
49
  function onKeyDown(e) {
@@ -23,7 +23,7 @@ class RowExpandGeolocationEditor extends _react.default.Component {
23
23
  }
24
24
  };
25
25
  this.hideEditor = event => {
26
- if (!this.state.isShowEditor || !event.target || event.target.tagName.toUpperCase() === 'INPUT' || this.editorContainer.contains(event.target)) return;
26
+ if (!this.state.isShowEditor || !event.target || this.editorContainer.contains(event.target)) return;
27
27
  if (this.state.isShowEditor && this.geoEditor.getLargeEditorState()) return;
28
28
  this.setState({
29
29
  isShowEditor: false
@@ -39,7 +39,7 @@ class RowExpandMultipleSelectEditor extends _react.default.Component {
39
39
  });
40
40
  };
41
41
  this.hideDropDownMenu = event => {
42
- if (!event.target || event.target.tagName.toUpperCase() === 'INPUT') return;
42
+ if (!event.target) return;
43
43
  if (!this.ref.contains(event.target) && this.state.showSelectPopover) {
44
44
  const singleSelectEditor = document.getElementsByClassName('dtable-ui-select-editor-container')[0];
45
45
  if (singleSelectEditor && singleSelectEditor.contains(event.target)) return;
@@ -62,7 +62,7 @@ class RowExpandSingleSelectEditor extends _react.default.Component {
62
62
  this.toggleSingleSelect(false);
63
63
  };
64
64
  this.hideDropDownMenu = event => {
65
- if (!event.target || event.target.tagName.toUpperCase() === 'INPUT') return;
65
+ if (!event.target) return;
66
66
  if (!this.singleSelectContainer.contains(event.target) && this.state.showSelectPopover) {
67
67
  const singleSelectEditor = document.getElementsByClassName('dtable-ui-select-editor-container')[0];
68
68
  if (singleSelectEditor && singleSelectEditor.contains(event.target)) return;
@@ -12,19 +12,22 @@ const ANIMATION_DURATION = 240;
12
12
  class Toast extends _react.default.PureComponent {
13
13
  constructor() {
14
14
  super(...arguments);
15
+ this._isMounted = false;
15
16
  this.state = {
16
- isShown: true,
17
- height: 0
17
+ isShown: true
18
18
  };
19
+ this.containerRef = /*#__PURE__*/_react.default.createRef();
19
20
  this.close = event => {
20
21
  if (event) {
21
22
  event.nativeEvent.stopImmediatePropagation();
22
23
  event.stopPropagation();
23
24
  }
24
25
  this.clearCloseTimer();
25
- this.setState({
26
- isShown: false
27
- });
26
+ if (this._isMounted) {
27
+ this.setState({
28
+ isShown: false
29
+ });
30
+ }
28
31
  };
29
32
  this.startCloseTimer = () => {
30
33
  if (this.props.duration) {
@@ -47,12 +50,12 @@ class Toast extends _react.default.PureComponent {
47
50
  };
48
51
  this.onRef = ref => {
49
52
  if (ref === null) return;
50
- const {
51
- height
52
- } = ref.getBoundingClientRect();
53
- this.setState({
54
- height
55
- });
53
+ setTimeout(() => {
54
+ const {
55
+ height
56
+ } = ref.getBoundingClientRect();
57
+ this.containerRef.current.style.height = height + 'px';
58
+ }, 1);
56
59
  };
57
60
  }
58
61
  componentDidUpdate(prevProps) {
@@ -64,9 +67,11 @@ class Toast extends _react.default.PureComponent {
64
67
  }
65
68
  }
66
69
  componentDidMount() {
70
+ this._isMounted = true;
67
71
  this.startCloseTimer();
68
72
  }
69
73
  componentWillUnmount() {
74
+ this._isMounted = false;
70
75
  this.clearCloseTimer();
71
76
  }
72
77
  render() {
@@ -82,10 +87,9 @@ class Toast extends _react.default.PureComponent {
82
87
  onMouseEnter: this.handleMouseEnter,
83
88
  onMouseLeave: this.handleMouseLeave,
84
89
  style: {
85
- height: this.state.height,
86
- zIndex: this.props.zIndex,
87
- marginBottom: this.state.isShown ? 0 : -this.state.height
88
- }
90
+ zIndex: this.props.zIndex
91
+ },
92
+ ref: this.containerRef
89
93
  }, /*#__PURE__*/_react.default.createElement("div", {
90
94
  ref: this.onRef,
91
95
  style: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dtable-ui-component",
3
- "version": "5.3.9",
3
+ "version": "5.3.10beta",
4
4
  "main": "./lib/index.js",
5
5
  "dependencies": {
6
6
  "@seafile/react-image-lightbox": "3.0.1",