dtable-ui-component 5.3.1-beta → 5.3.1-beta2
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/lib/Comment/body/comment.js +190 -0
- package/lib/Comment/body/index.css +95 -0
- package/lib/Comment/body/index.js +32 -0
- package/lib/Comment/footer/btns/index.css +40 -0
- package/lib/Comment/footer/btns/index.js +113 -0
- package/lib/Comment/footer/index.css +157 -0
- package/lib/Comment/footer/index.js +170 -0
- package/lib/Comment/footer/input/index.css +52 -0
- package/lib/Comment/footer/input/index.js +448 -0
- package/lib/Comment/footer/input/participant/index.css +0 -0
- package/lib/Comment/footer/input/participant/index.js +53 -0
- package/lib/Comment/footer/participants/index.css +22 -0
- package/lib/Comment/footer/participants/index.js +68 -0
- package/lib/Comment/footer/participants/participant/index.css +5 -0
- package/lib/Comment/footer/participants/participant/index.js +32 -0
- package/lib/Comment/footer/participants/participant-select/index.css +104 -0
- package/lib/Comment/footer/participants/participant-select/index.js +182 -0
- package/lib/Comment/index.css +19 -0
- package/lib/Comment/index.js +305 -0
- package/lib/Comment/model.js +25 -0
- package/lib/Comment/utils/common.js +62 -0
- package/lib/Comment/utils/index.js +27 -0
- package/lib/Comment/utils/utilities.js +176 -0
- package/lib/DigitalSignEditor/index.js +1 -1
- package/lib/FileEditor/index.js +16 -2
- package/lib/RowExpandDialog/body/index.js +43 -60
- package/lib/RowExpandDialog/column-content/index.css +1 -0
- package/lib/RowExpandDialog/header/index.css +3 -3
- package/lib/RowExpandDialog/header/index.js +33 -11
- package/lib/RowExpandDialog/index.js +35 -51
- package/lib/RowExpandEditor/RowExpandLongTextEditor/index.js +1 -2
- package/lib/RowExpandFormatter/RowExpandLinkFormatter/index.js +1 -1
- package/lib/RowExpandFormatter/index.css +1 -1
- package/lib/RowExpandFormatter/index.js +3 -4
- package/lib/lang/index.js +3 -2
- package/lib/locales/de.json +5 -1
- package/lib/locales/en.json +5 -1
- package/lib/locales/es.json +5 -1
- package/lib/locales/fr.json +5 -1
- package/lib/locales/pt.json +5 -1
- package/lib/locales/ru.json +5 -1
- package/lib/locales/zh-CN.json +5 -1
- package/lib/utils/hotkey.js +37 -0
- package/lib/utils/utils.js +58 -2
- package/package.json +1 -1
- package/lib/RowExpandDialog/constants.js +0 -114
- package/lib/RowExpandDialog/utils.js +0 -83
- package/lib/RowExpandFormatter/RowExpandLinkFormatter/utils.js +0 -71
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _reactstrap = require("reactstrap");
|
|
11
|
+
var _seafileEditor = require("@seafile/seafile-editor");
|
|
12
|
+
var _ImagePreviewerLightbox = _interopRequireDefault(require("../../ImagePreviewerLightbox"));
|
|
13
|
+
var _lang = require("../../lang");
|
|
14
|
+
class Comment extends _react.PureComponent {
|
|
15
|
+
constructor(props) {
|
|
16
|
+
super(props);
|
|
17
|
+
this.toggleDropDownMenu = () => {
|
|
18
|
+
this.setState({
|
|
19
|
+
dropdownOpen: !this.state.dropdownOpen
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
this.convertComment = mdFile => {
|
|
23
|
+
// innerHtml transform & to &, After seafile-editor is upgraded, & will be converted to & again,
|
|
24
|
+
// so it needs to be converted back manually
|
|
25
|
+
const mdString = mdFile.replaceAll('&', '&');
|
|
26
|
+
_seafileEditor.processor.process(mdString).then(result => {
|
|
27
|
+
let commentContent = String(result);
|
|
28
|
+
let {
|
|
29
|
+
isScrollBottom,
|
|
30
|
+
onScrollBottom
|
|
31
|
+
} = this.props;
|
|
32
|
+
this.setState({
|
|
33
|
+
commentContent: commentContent
|
|
34
|
+
});
|
|
35
|
+
if (isScrollBottom) {
|
|
36
|
+
onScrollBottom();
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
this.handleImageZoom = event => {
|
|
41
|
+
if (event.target.tagName === 'IMG') {
|
|
42
|
+
let imageUrl = event.target.src;
|
|
43
|
+
let imageTagList = this.commentContentRef.getElementsByTagName('img');
|
|
44
|
+
let imageUrlList = [];
|
|
45
|
+
for (let i = 0; i < imageTagList.length; i++) {
|
|
46
|
+
imageUrlList.push(imageTagList[i].src);
|
|
47
|
+
}
|
|
48
|
+
let largeImageIndex = imageUrlList.findIndex(imageItemUrl => imageItemUrl === imageUrl);
|
|
49
|
+
this.setState({
|
|
50
|
+
isShowLargeImage: true,
|
|
51
|
+
imageUrlList: imageUrlList,
|
|
52
|
+
largeImageIndex: largeImageIndex
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
this.moveNext = () => {
|
|
57
|
+
let images = this.state.imageUrlList;
|
|
58
|
+
this.setState(prevState => ({
|
|
59
|
+
largeImageIndex: (prevState.largeImageIndex + 1) % images.length
|
|
60
|
+
}));
|
|
61
|
+
};
|
|
62
|
+
this.movePrev = () => {
|
|
63
|
+
let images = this.state.imageUrlList;
|
|
64
|
+
this.setState(prevState => ({
|
|
65
|
+
largeImageIndex: (prevState.largeImageIndex + images.length - 1) % images.length
|
|
66
|
+
}));
|
|
67
|
+
};
|
|
68
|
+
this.hideLargeImage = () => {
|
|
69
|
+
this.setState({
|
|
70
|
+
isShowLargeImage: false,
|
|
71
|
+
largeImageIndex: '',
|
|
72
|
+
imageUrlList: []
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
this.isCommentUserExist = commentItem => {
|
|
76
|
+
const {
|
|
77
|
+
collaborators
|
|
78
|
+
} = this.props;
|
|
79
|
+
return !!collaborators.find(collaborator => collaborator.email === commentItem.author);
|
|
80
|
+
};
|
|
81
|
+
this.renderInfo = comment => {
|
|
82
|
+
const {
|
|
83
|
+
collaborators
|
|
84
|
+
} = this.props;
|
|
85
|
+
let authorInfo = Array.isArray(collaborators) && collaborators.find(collaborator => comment.author === collaborator.email);
|
|
86
|
+
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("img", {
|
|
87
|
+
className: "avatar",
|
|
88
|
+
src: authorInfo.avatar_url,
|
|
89
|
+
alt: ""
|
|
90
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
91
|
+
className: "reviewer-info"
|
|
92
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
93
|
+
className: "reviewer-name"
|
|
94
|
+
}, authorInfo.name), /*#__PURE__*/_react.default.createElement("div", {
|
|
95
|
+
className: "review-time"
|
|
96
|
+
}, comment.create_at)));
|
|
97
|
+
};
|
|
98
|
+
this.onCommentClick = e => {
|
|
99
|
+
// click participant link, page shouldn't jump
|
|
100
|
+
if (e.target.nodeName !== 'A') return;
|
|
101
|
+
const preNode = e.target.previousSibling;
|
|
102
|
+
if (preNode && preNode.nodeType === 3 && preNode.nodeValue.slice(-1) === '@') {
|
|
103
|
+
e.preventDefault();
|
|
104
|
+
} else {
|
|
105
|
+
e.target.setAttribute('target', '_blank');
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
this.state = {
|
|
109
|
+
dropdownOpen: false,
|
|
110
|
+
commentContent: '',
|
|
111
|
+
isShowLargeImage: false,
|
|
112
|
+
imageUrlList: [],
|
|
113
|
+
largeImageIndex: ''
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
componentDidMount() {
|
|
117
|
+
this.convertComment(this.props.comment.comment);
|
|
118
|
+
}
|
|
119
|
+
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
120
|
+
if (nextProps.comment.comment !== this.props.comment.comment) {
|
|
121
|
+
this.convertComment(nextProps.comment.comment);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
render() {
|
|
125
|
+
const {
|
|
126
|
+
comment,
|
|
127
|
+
onResolve,
|
|
128
|
+
onDelete
|
|
129
|
+
} = this.props;
|
|
130
|
+
const {
|
|
131
|
+
username
|
|
132
|
+
} = window.dtable;
|
|
133
|
+
const moreOperationsText = (0, _lang.getLocale)('More_operations');
|
|
134
|
+
if (!this.isCommentUserExist(comment)) return null;
|
|
135
|
+
const isShowDropdownMenu = comment.author === username || !comment.resolved;
|
|
136
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
137
|
+
className: "dtable-ui-comment-container ".concat(comment.resolved ? 'dtable-ui-comment-container-resolved' : ''),
|
|
138
|
+
id: comment.id
|
|
139
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
140
|
+
className: "dtable-ui-comment-info"
|
|
141
|
+
}, this.renderInfo(comment), isShowDropdownMenu && /*#__PURE__*/_react.default.createElement(_reactstrap.Dropdown, {
|
|
142
|
+
isOpen: this.state.dropdownOpen,
|
|
143
|
+
size: "sm",
|
|
144
|
+
className: "dtable-ui-comments-dropdown",
|
|
145
|
+
toggle: this.toggleDropDownMenu
|
|
146
|
+
}, /*#__PURE__*/_react.default.createElement(_reactstrap.DropdownToggle, {
|
|
147
|
+
className: "dtable-ui-comments-dropdown-btn",
|
|
148
|
+
role: "button",
|
|
149
|
+
"data-toggle": "dropdown",
|
|
150
|
+
title: moreOperationsText,
|
|
151
|
+
"aria-label": moreOperationsText,
|
|
152
|
+
"aria-expanded": this.state.dropdownOpen
|
|
153
|
+
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
154
|
+
className: "dtable-font dtable-icon-more-level",
|
|
155
|
+
title: moreOperationsText,
|
|
156
|
+
"aria-label": moreOperationsText
|
|
157
|
+
})), /*#__PURE__*/_react.default.createElement(_reactstrap.DropdownMenu, {
|
|
158
|
+
className: "dtable-dropdown-menu dropdown-menu dtable-ui-comment-dropdown-list"
|
|
159
|
+
}, !comment.resolved && onResolve && /*#__PURE__*/_react.default.createElement(_reactstrap.DropdownItem, {
|
|
160
|
+
onClick: event => onResolve(event, comment.id)
|
|
161
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
162
|
+
className: "comment-icon dtable-font dtable-icon-mark mr-2"
|
|
163
|
+
}), /*#__PURE__*/_react.default.createElement("span", {
|
|
164
|
+
className: "comment-text"
|
|
165
|
+
}, (0, _lang.getLocale)('Mark_as_resolved'))), comment.author === username && onDelete && /*#__PURE__*/_react.default.createElement(_reactstrap.DropdownItem, {
|
|
166
|
+
onClick: event => onDelete(event, comment.id)
|
|
167
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
168
|
+
className: "comment-icon dtable-font dtable-icon-delete mr-2"
|
|
169
|
+
}), /*#__PURE__*/_react.default.createElement("span", {
|
|
170
|
+
className: "comment-text"
|
|
171
|
+
}, (0, _lang.getLocale)('Delete')))))), /*#__PURE__*/_react.default.createElement("div", {
|
|
172
|
+
className: "dtable-ui-comment-content",
|
|
173
|
+
onClick: e => this.onCommentClick(e)
|
|
174
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
175
|
+
className: "dtable-ui-comment-content-container",
|
|
176
|
+
ref: ref => this.commentContentRef = ref,
|
|
177
|
+
onClick: this.handleImageZoom,
|
|
178
|
+
dangerouslySetInnerHTML: {
|
|
179
|
+
__html: this.state.commentContent
|
|
180
|
+
}
|
|
181
|
+
})), this.state.isShowLargeImage && /*#__PURE__*/_react.default.createElement(_ImagePreviewerLightbox.default, {
|
|
182
|
+
imageItems: this.state.imageUrlList,
|
|
183
|
+
imageIndex: this.state.largeImageIndex,
|
|
184
|
+
closeImagePopup: this.hideLargeImage,
|
|
185
|
+
moveToPrevImage: this.movePrev,
|
|
186
|
+
moveToNextImage: this.moveNext
|
|
187
|
+
}));
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
var _default = exports.default = Comment;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
.dtable-ui-comments .dtable-ui-comments-body .dtable-ui-comments-empty {
|
|
2
|
+
padding: 1em;
|
|
3
|
+
text-align: center;
|
|
4
|
+
list-style: none;
|
|
5
|
+
color: #666;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
.dtable-ui-comments .dtable-ui-comment-container {
|
|
10
|
+
padding: 10px 0;
|
|
11
|
+
margin-bottom: 0;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.dtable-ui-comment-container .dtable-ui-comment-info {
|
|
15
|
+
padding-bottom: 0.5em;
|
|
16
|
+
width: 100%;
|
|
17
|
+
height: 3em;
|
|
18
|
+
display: flex;
|
|
19
|
+
justify-content: flex-start;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.dtable-ui-comment-container .dtable-ui-comment-info .reviewer-info {
|
|
23
|
+
padding-left: 10px;
|
|
24
|
+
flex: 1;
|
|
25
|
+
padding-right: 10px;
|
|
26
|
+
overflow: hidden;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.dtable-ui-comment-container .dtable-ui-comment-info .reviewer-name {
|
|
30
|
+
font-size: 14px;
|
|
31
|
+
font-weight: 500;
|
|
32
|
+
overflow: hidden;
|
|
33
|
+
white-space: nowrap;
|
|
34
|
+
text-overflow: ellipsis;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.dtable-ui-comment-container .dtable-ui-comment-info .review-time {
|
|
38
|
+
font-size: 12px;
|
|
39
|
+
color: #666;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.dtable-ui-comment-container .dtable-ui-comment-info .dtable-ui-comments-dropdown {
|
|
43
|
+
margin-left: auto;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.dtable-ui-comment-container .dtable-ui-comment-info .dtable-ui-comments-dropdown button {
|
|
47
|
+
border: none;
|
|
48
|
+
box-shadow: none;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.dtable-ui-comment-container .dtable-ui-comment-info .dtable-ui-comments-dropdown button span {
|
|
52
|
+
font-size: 14px;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.dtable-ui-comment-container .dtable-ui-comment-info .dtable-ui-comments-dropdown .dtable-ui-comments-dropdown-btn {
|
|
56
|
+
color: #999;
|
|
57
|
+
background-color: transparent;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.dtable-ui-comment-container .dtable-ui-comment-info .dtable-ui-comments-dropdown:hover .dtable-ui-comments-dropdown-btn {
|
|
61
|
+
color: #555;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.dtable-ui-comment-container .dtable-ui-comment-content {
|
|
65
|
+
margin-left: 42px;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.dtable-ui-comment-container .dtable-ui-comment-content .dtable-ui-comment-content-container {
|
|
69
|
+
padding: 5px 10px;
|
|
70
|
+
border-radius: 4px;
|
|
71
|
+
display: inline-block;
|
|
72
|
+
background: #fff;
|
|
73
|
+
max-width: 100%;
|
|
74
|
+
word-wrap: break-word;
|
|
75
|
+
margin: 0;
|
|
76
|
+
font-size: 14px;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.dtable-ui-comment-container .dtable-ui-comment-content img {
|
|
80
|
+
cursor: pointer;
|
|
81
|
+
display: block;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.dtable-ui-comment-container .dtable-ui-comment-content p {
|
|
85
|
+
margin-bottom: 0;
|
|
86
|
+
letter-spacing: 1px;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.dtable-ui-comment-container-resolved .dtable-ui-comment-content .dtable-ui-comment-content-container {
|
|
90
|
+
background-color: #e6ffed;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.dtable-ui-comment-dropdown-list {
|
|
94
|
+
min-width: 8rem;
|
|
95
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _lang = require("../../lang");
|
|
10
|
+
var _comment = _interopRequireDefault(require("./comment"));
|
|
11
|
+
require("./index.css");
|
|
12
|
+
const Body = _ref => {
|
|
13
|
+
let {
|
|
14
|
+
comments,
|
|
15
|
+
isFirstLoading,
|
|
16
|
+
...props
|
|
17
|
+
} = _ref;
|
|
18
|
+
if (comments.length === 0) {
|
|
19
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
20
|
+
className: "dtable-ui-comments-empty"
|
|
21
|
+
}, (0, _lang.getLocale)('No_comment_yet'));
|
|
22
|
+
}
|
|
23
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, comments.map((comment, index) => {
|
|
24
|
+
return /*#__PURE__*/_react.default.createElement(_comment.default, Object.assign({
|
|
25
|
+
key: comment.id
|
|
26
|
+
}, props, {
|
|
27
|
+
comment: comment,
|
|
28
|
+
isScrollBottom: index === comments.length - 1 && isFirstLoading
|
|
29
|
+
}));
|
|
30
|
+
}));
|
|
31
|
+
};
|
|
32
|
+
var _default = exports.default = Body;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
.dtable-ui-comment-input-btns {
|
|
2
|
+
padding: 5px;
|
|
3
|
+
border: 1px solid #e6e6dd;
|
|
4
|
+
border-top: none;
|
|
5
|
+
background: #fff;
|
|
6
|
+
border-radius: 0 0 5px 5px;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.dtable-ui-comment-input-btns .dtable-ui-comment-input-btns-container {
|
|
10
|
+
border-top: 1px solid #e6e6dd;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.dtable-ui-comment-input-btns .dtable-ui-comment-input-btns-container .dtable-ui-comment-input-btns-content {
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
padding-left: 10px;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.dtable-ui-comment-input-btns .dtable-ui-comment-input-btns-container .dtable-ui-comment-collaborator-tip {
|
|
20
|
+
cursor: pointer;
|
|
21
|
+
position: relative;
|
|
22
|
+
margin-left: 10px;
|
|
23
|
+
color: #666;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.dtable-ui-comment-input-btns .dtable-ui-comment-input-btns-container .dtable-ui-comment-image-upload:hover,
|
|
27
|
+
.dtable-ui-comment-input-btns .dtable-ui-comment-input-btns-container .dtable-ui-comment-collaborator-tip:hover {
|
|
28
|
+
color: #FF8000;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.dtable-ui-comment-input-btns .dtable-ui-comment-input-btns-container .dtable-ui-comment-image-upload {
|
|
32
|
+
margin-top: 3px;
|
|
33
|
+
font-size: 15px;
|
|
34
|
+
color: #666;
|
|
35
|
+
cursor: pointer;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.dtable-ui-comment-input-btns .dtable-ui-comment-input-btns-container .dtable-ui-comment-image-upload .dtable-icon-picture-linear {
|
|
39
|
+
font-size: 15px;
|
|
40
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _reactstrap = require("reactstrap");
|
|
11
|
+
var _FileUploader = _interopRequireDefault(require("../../../FileUploader"));
|
|
12
|
+
var _DTablePopover = _interopRequireDefault(require("../../../DTablePopover"));
|
|
13
|
+
var _Loading = _interopRequireDefault(require("../../../Loading"));
|
|
14
|
+
var _lang = require("../../../lang");
|
|
15
|
+
require("./index.css");
|
|
16
|
+
class Btns extends _react.default.Component {
|
|
17
|
+
constructor(props) {
|
|
18
|
+
super(props);
|
|
19
|
+
this.onHideCollaboratorTip = () => {
|
|
20
|
+
this.setState({
|
|
21
|
+
isShowPopover: false
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
this.onHandleCollaboratorTip = event => {
|
|
25
|
+
event.nativeEvent.stopImmediatePropagation();
|
|
26
|
+
this.setState({
|
|
27
|
+
isShowPopover: !this.state.isShowPopover
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
this.onChangeInputValue = participant => {
|
|
31
|
+
this.props.onInsertElement(participant, 'collaborator');
|
|
32
|
+
this.props.addParticipant(participant.email);
|
|
33
|
+
this.onHideCollaboratorTip();
|
|
34
|
+
};
|
|
35
|
+
this.onSubmit = () => {
|
|
36
|
+
this.props.onSubmit();
|
|
37
|
+
};
|
|
38
|
+
this.onFileUploadSuccess = uploadFileMessage => {
|
|
39
|
+
this.props.onInsertElement(uploadFileMessage.url, 'image');
|
|
40
|
+
};
|
|
41
|
+
this.getCollaboratorContent = () => {
|
|
42
|
+
const {
|
|
43
|
+
collaborators
|
|
44
|
+
} = this.props;
|
|
45
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
46
|
+
className: "comment-popover-list"
|
|
47
|
+
}, collaborators.map(participant => {
|
|
48
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
49
|
+
key: participant.email,
|
|
50
|
+
className: "comment-participant-item",
|
|
51
|
+
onClick: this.onChangeInputValue.bind(this, participant)
|
|
52
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
53
|
+
className: "comment-participant-container"
|
|
54
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
55
|
+
className: "comment-participant text-truncate"
|
|
56
|
+
}, /*#__PURE__*/_react.default.createElement("img", {
|
|
57
|
+
className: "comment-dtable-ui-participant-avatar ml-2",
|
|
58
|
+
alt: participant.name,
|
|
59
|
+
src: participant.avatar_url
|
|
60
|
+
}), /*#__PURE__*/_react.default.createElement("span", {
|
|
61
|
+
className: "comment-participant-name text-truncate"
|
|
62
|
+
}, participant.name))));
|
|
63
|
+
}));
|
|
64
|
+
};
|
|
65
|
+
this.state = {
|
|
66
|
+
isShowPopover: false
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
shouldComponentUpdate(nextProps, nextState) {
|
|
70
|
+
return nextProps.isAdding !== this.props.isAdding || nextState.isShowPopover !== this.state.isShowPopover;
|
|
71
|
+
}
|
|
72
|
+
render() {
|
|
73
|
+
const {
|
|
74
|
+
isAdding,
|
|
75
|
+
canUpdateParticipants
|
|
76
|
+
} = this.props;
|
|
77
|
+
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
78
|
+
className: "dtable-ui-comment-input-btns"
|
|
79
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
80
|
+
className: "d-flex justify-content-between dtable-ui-comment-input-btns-container"
|
|
81
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
82
|
+
className: "dtable-ui-comment-input-btns-content",
|
|
83
|
+
ref: ref => this.toolRef = ref
|
|
84
|
+
}, /*#__PURE__*/_react.default.createElement(_FileUploader.default, {
|
|
85
|
+
uploadType: "image",
|
|
86
|
+
className: "dtable-ui-comment-image-upload",
|
|
87
|
+
onFileUploadSuccess: this.onFileUploadSuccess,
|
|
88
|
+
uploadFile: this.props.uploadFile
|
|
89
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
90
|
+
"aria-hidden": "true",
|
|
91
|
+
className: "dtable-font dtable-icon-picture-linear"
|
|
92
|
+
})), canUpdateParticipants && /*#__PURE__*/_react.default.createElement("span", {
|
|
93
|
+
className: "dtable-ui-comment-collaborator-tip",
|
|
94
|
+
onClick: this.onHandleCollaboratorTip
|
|
95
|
+
}, "@")), isAdding ? /*#__PURE__*/_react.default.createElement(_reactstrap.Button, {
|
|
96
|
+
className: "dtable-ui-comment-submit",
|
|
97
|
+
color: "primary",
|
|
98
|
+
size: "sm",
|
|
99
|
+
disabled: true
|
|
100
|
+
}, /*#__PURE__*/_react.default.createElement(_Loading.default, null)) : /*#__PURE__*/_react.default.createElement(_reactstrap.Button, {
|
|
101
|
+
className: "dtable-ui-comment-submit",
|
|
102
|
+
color: "primary",
|
|
103
|
+
size: "sm",
|
|
104
|
+
onClick: this.onSubmit,
|
|
105
|
+
tabIndex: -1
|
|
106
|
+
}, (0, _lang.getLocale)('Submit')))), this.state.isShowPopover && /*#__PURE__*/_react.default.createElement(_DTablePopover.default, {
|
|
107
|
+
target: this.toolRef,
|
|
108
|
+
hideDTablePopover: this.onHideCollaboratorTip,
|
|
109
|
+
hideDTablePopoverWithEsc: this.onHideCollaboratorTip
|
|
110
|
+
}, this.getCollaboratorContent()));
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
var _default = exports.default = Btns;
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
.dtable-ui-comments .dtable-ui-comments-footer {
|
|
2
|
+
padding: 5px 10px;
|
|
3
|
+
border-top: 1px solid #e5e5e5;
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
min-height: 185px;
|
|
7
|
+
border-bottom-right-radius: 3px;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
.dtable-ui-comments .dtable-ui-comment-input:focus {
|
|
14
|
+
outline: none;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.dtable-ui-comments textarea:focus {
|
|
18
|
+
outline: none;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.dtable-ui-comments-title {
|
|
22
|
+
border-bottom: 1px solid #e5e5e5;
|
|
23
|
+
min-height: 3em;
|
|
24
|
+
line-height: 3em;
|
|
25
|
+
padding: 0 1em;
|
|
26
|
+
display: flex;
|
|
27
|
+
background-color: #fafaf9;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.dtable-ui-comments-title .dtable-ui-comments-title-text {
|
|
31
|
+
width: 100%;
|
|
32
|
+
text-align: center;
|
|
33
|
+
font-weight: 700;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.dtable-ui-comments-title .dtable-ui-comments-title-close {
|
|
37
|
+
color: #b9b9b9;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.dtable-ui-comments-title .dtable-ui-comments-title-close:hover {
|
|
41
|
+
color: #888;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.dtable-ui-comments-toggle-resolved {
|
|
45
|
+
margin-top: 45px;
|
|
46
|
+
border-bottom: 1px solid #e5e5e5;
|
|
47
|
+
padding: 5px 10px;
|
|
48
|
+
display: flex;
|
|
49
|
+
position: absolute;
|
|
50
|
+
background-color: #fff;
|
|
51
|
+
justify-content: space-between;
|
|
52
|
+
width: 29%;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
@media (max-width: 768px) {
|
|
57
|
+
.dtable-ui-comments-toggle-resolved {
|
|
58
|
+
width: 100%;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
.completion-dtable-ui-participant-avatar img {
|
|
66
|
+
border-radius: 50%;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
.dtable-ui-comments-footer .dtable-ui-comment-submit {
|
|
74
|
+
margin-top: 5px;
|
|
75
|
+
min-width: 60px;
|
|
76
|
+
width: auto;
|
|
77
|
+
height: 28px;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
.comment-header .comment-header-title {
|
|
85
|
+
display: flex;
|
|
86
|
+
justify-content: space-between;
|
|
87
|
+
height: 48px;
|
|
88
|
+
align-items: center;
|
|
89
|
+
font-size: 16px;
|
|
90
|
+
font-weight: 600;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.comment-header .comment-header-tool {
|
|
94
|
+
display: flex;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.comment-header .comment-header-tool .comment-tool-item {
|
|
98
|
+
padding: 5px 5px 5px 0;
|
|
99
|
+
color: #666;
|
|
100
|
+
cursor: default;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.comment-header .comment-header-tool .comment-item-active {
|
|
104
|
+
color: #212529;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.comment-header .comment-close {
|
|
108
|
+
width: 24px;
|
|
109
|
+
height: 24px;
|
|
110
|
+
color: #999999;
|
|
111
|
+
font-weight: 700;
|
|
112
|
+
cursor: pointer;
|
|
113
|
+
margin-left: 5px;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.comment-header .comment-close:hover {
|
|
117
|
+
color: #555555;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.comment-header .comment-close .dtable-icon-x {
|
|
121
|
+
padding: 4px;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.comment-popover-list {
|
|
125
|
+
padding: 10px 0;
|
|
126
|
+
max-height: 200px;
|
|
127
|
+
overflow: auto;
|
|
128
|
+
min-width: 150px;
|
|
129
|
+
max-width: 200px;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.comment-popover-list .comment-participant-item {
|
|
133
|
+
padding: 5px 0;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.comment-popover-list .comment-participant-item:hover {
|
|
137
|
+
background: #f5f5f5;
|
|
138
|
+
cursor: pointer;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/* comment @ function*/
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
.comment-participant-item .comment-dtable-ui-participant-avatar {
|
|
146
|
+
width: 16px;
|
|
147
|
+
height: 16px;
|
|
148
|
+
line-height: 16px;
|
|
149
|
+
transform: translateY(-1px);
|
|
150
|
+
border-radius: 50%;
|
|
151
|
+
vertical-align: middle;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.comment-participant-item .comment-participant-name {
|
|
155
|
+
margin-left: 4px;
|
|
156
|
+
font-size: 14px;
|
|
157
|
+
}
|