dtable-ui-component 4.4.30-beta3 → 4.4.30
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.
|
@@ -63,22 +63,20 @@ class SimpleLongTextFormatter extends _react.default.Component {
|
|
|
63
63
|
}
|
|
64
64
|
return {};
|
|
65
65
|
};
|
|
66
|
-
this.
|
|
67
|
-
if (
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
this.clearClosePreviewTimer = () => {
|
|
72
|
-
if (!this.closePreviewTimer) return;
|
|
73
|
-
clearTimeout(this.closePreviewTimer);
|
|
74
|
-
this.closePreviewTimer = null;
|
|
66
|
+
this.clearTimer = () => {
|
|
67
|
+
if (this.timer) {
|
|
68
|
+
clearTimeout(this.timer);
|
|
69
|
+
this.timer = null;
|
|
70
|
+
}
|
|
75
71
|
};
|
|
76
72
|
this.onMouseEnter = () => {
|
|
77
73
|
// in case that there is no `modal-wrapper`
|
|
78
|
-
if (!document.getElementById('modal-wrapper'))
|
|
79
|
-
|
|
74
|
+
if (!document.getElementById('modal-wrapper')) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
this.clearTimer();
|
|
80
78
|
if (this.props.value) {
|
|
81
|
-
this.
|
|
79
|
+
this.timer = setTimeout(() => {
|
|
82
80
|
const style = this.ref.getBoundingClientRect();
|
|
83
81
|
this.formatterStyle = style;
|
|
84
82
|
this.setState({
|
|
@@ -88,23 +86,7 @@ class SimpleLongTextFormatter extends _react.default.Component {
|
|
|
88
86
|
}
|
|
89
87
|
};
|
|
90
88
|
this.onMouseLeave = () => {
|
|
91
|
-
this.
|
|
92
|
-
|
|
93
|
-
// Case 1: The mouse moves out of the cell and is not in the preview component, close the preview component after 2S
|
|
94
|
-
this.closePreviewTimer = setTimeout(() => {
|
|
95
|
-
if (this.state.isPreview) {
|
|
96
|
-
this.setState({
|
|
97
|
-
isPreview: false
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
}, 2000);
|
|
101
|
-
};
|
|
102
|
-
// Case 2: The mouse moves out of the cell and into the preview component, do not close the preview component
|
|
103
|
-
this.onPreviewMouseEnter = () => {
|
|
104
|
-
this.clearClosePreviewTimer();
|
|
105
|
-
};
|
|
106
|
-
// Case 2: The mouse move out of the preview component, close the preview component
|
|
107
|
-
this.onPreviewMouseLeave = () => {
|
|
89
|
+
this.clearTimer();
|
|
108
90
|
if (this.state.isPreview) {
|
|
109
91
|
this.setState({
|
|
110
92
|
isPreview: false
|
|
@@ -117,8 +99,7 @@ class SimpleLongTextFormatter extends _react.default.Component {
|
|
|
117
99
|
};
|
|
118
100
|
}
|
|
119
101
|
componentWillUnmount() {
|
|
120
|
-
this.
|
|
121
|
-
this.clearClosePreviewTimer();
|
|
102
|
+
this.clearTimer();
|
|
122
103
|
}
|
|
123
104
|
render() {
|
|
124
105
|
const {
|
|
@@ -138,9 +119,7 @@ class SimpleLongTextFormatter extends _react.default.Component {
|
|
|
138
119
|
}, this.renderLinks(value), this.renderCheckList(value), this.renderImages(value), this.renderContent(value), isPreview && /*#__PURE__*/_react.default.createElement(_ModalPortal.default, null, /*#__PURE__*/_react.default.createElement(_LongTextPreview.default, {
|
|
139
120
|
className: previewClassName,
|
|
140
121
|
value: value,
|
|
141
|
-
formatterStyle: this.formatterStyle
|
|
142
|
-
onMouseEnter: this.onPreviewMouseEnter,
|
|
143
|
-
onMouseLeave: this.onPreviewMouseLeave
|
|
122
|
+
formatterStyle: this.formatterStyle
|
|
144
123
|
})));
|
|
145
124
|
}
|
|
146
125
|
}
|
|
@@ -20,11 +20,8 @@ class LongTextPreview extends _react.default.PureComponent {
|
|
|
20
20
|
left,
|
|
21
21
|
top
|
|
22
22
|
} = formatterStyle;
|
|
23
|
-
const {
|
|
24
|
-
height,
|
|
25
|
-
opacity
|
|
26
|
-
} = this.state;
|
|
27
23
|
const width = 520;
|
|
24
|
+
const height = this.state.height;
|
|
28
25
|
const padding = 6;
|
|
29
26
|
left = left - width > 0 ? left - width - 12 : 0;
|
|
30
27
|
top = top - padding;
|
|
@@ -34,15 +31,9 @@ class LongTextPreview extends _react.default.PureComponent {
|
|
|
34
31
|
return {
|
|
35
32
|
left,
|
|
36
33
|
top,
|
|
37
|
-
opacity
|
|
34
|
+
opacity: this.state.opacity
|
|
38
35
|
};
|
|
39
36
|
};
|
|
40
|
-
this.onMouseEnter = e => {
|
|
41
|
-
this.props.onMouseEnter && this.props.onMouseEnter(e);
|
|
42
|
-
};
|
|
43
|
-
this.onMouseLeave = e => {
|
|
44
|
-
this.props.onMouseLeave && this.props.onMouseLeave(e);
|
|
45
|
-
};
|
|
46
37
|
this.state = {
|
|
47
38
|
height: 450,
|
|
48
39
|
opacity: 0
|
|
@@ -50,22 +41,13 @@ class LongTextPreview extends _react.default.PureComponent {
|
|
|
50
41
|
}
|
|
51
42
|
componentDidMount() {
|
|
52
43
|
setTimeout(() => {
|
|
53
|
-
var _value$images;
|
|
54
44
|
if (!this.ref) return;
|
|
55
|
-
const
|
|
56
|
-
value
|
|
57
|
-
} = this.props;
|
|
58
|
-
// If image is included, sets the preview height to the maximum height
|
|
59
|
-
const hasImage = (value === null || value === void 0 ? void 0 : (_value$images = value.images) === null || _value$images === void 0 ? void 0 : _value$images.length) >= 2 ? true : false;
|
|
60
|
-
let {
|
|
61
|
-
height: domHeight
|
|
62
|
-
} = this.ref.getBoundingClientRect();
|
|
63
|
-
domHeight = hasImage ? 450 : domHeight;
|
|
45
|
+
const domHeight = this.ref.offsetHeight;
|
|
64
46
|
this.setState({
|
|
65
|
-
height:
|
|
47
|
+
height: domHeight,
|
|
66
48
|
opacity: 1
|
|
67
49
|
});
|
|
68
|
-
},
|
|
50
|
+
}, 0);
|
|
69
51
|
}
|
|
70
52
|
render() {
|
|
71
53
|
const {
|
|
@@ -76,9 +58,7 @@ class LongTextPreview extends _react.default.PureComponent {
|
|
|
76
58
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
77
59
|
className: (0, _classnames.default)('longtext-modal-dialog longtext-preview', className),
|
|
78
60
|
style: this.getStyle(),
|
|
79
|
-
ref: ref => this.ref = ref
|
|
80
|
-
onMouseEnter: this.onMouseEnter,
|
|
81
|
-
onMouseLeave: this.onMouseLeave
|
|
61
|
+
ref: ref => this.ref = ref
|
|
82
62
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
83
63
|
className: "longtext-container longtext-container-scroll"
|
|
84
64
|
}, /*#__PURE__*/_react.default.createElement(_dtableMarkdownViewer.default, {
|
|
@@ -339,12 +339,10 @@
|
|
|
339
339
|
|
|
340
340
|
.longtext-preview .sf-slate-viewer-scroll-container .sf-slate-viewer-article-container {
|
|
341
341
|
width: 100%;
|
|
342
|
-
margin: 0;
|
|
343
342
|
}
|
|
344
343
|
|
|
345
344
|
.longtext-preview .longtext-container .article {
|
|
346
345
|
padding: 10px 16px;
|
|
347
|
-
border: unset;
|
|
348
346
|
}
|
|
349
347
|
|
|
350
348
|
.row-height-128 .longtext-formatter .article {
|