dtable-ui-component 4.3.10 → 4.3.11
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/CTimeFormatter/index.js +1 -1
- package/lib/CollaboratorEditor/index.css +25 -2
- package/lib/CollaboratorEditor/index.js +21 -10
- package/lib/DateEditor/index.js +2 -0
- package/lib/LinkEditor/index.js +3 -3
- package/lib/MTimeFormatter/index.js +1 -1
- package/lib/MultipleSelectEditor/index.js +3 -3
- package/lib/NotificationPopover/index.js +4 -4
- package/lib/SingleSelectEditor/index.js +3 -3
- package/lib/common/ClickOutside.js +1 -1
- package/lib/common/delete-tip.js +3 -3
- package/lib/toaster/index.css +1 -1
- package/package.json +1 -1
|
@@ -15,7 +15,7 @@ class CTimeFormatter extends React.Component {
|
|
|
15
15
|
containerClassName
|
|
16
16
|
} = this.props;
|
|
17
17
|
let classname = classnames('dtable-ui cell-formatter-container ctime-formatter', containerClassName);
|
|
18
|
-
if (date
|
|
18
|
+
if (date) {
|
|
19
19
|
date = this.formatDate(date);
|
|
20
20
|
}
|
|
21
21
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -14,16 +14,20 @@
|
|
|
14
14
|
min-height: 160px;
|
|
15
15
|
max-height: 200px;
|
|
16
16
|
margin: 10px 0;
|
|
17
|
-
padding: 0 10px;
|
|
18
17
|
overflow: auto;
|
|
19
18
|
}
|
|
20
19
|
|
|
20
|
+
.dtable-ui-collaborator-editor-popover .collaborator-list-container .search-option-null {
|
|
21
|
+
opacity: 0.5;
|
|
22
|
+
padding-left: 10px;
|
|
23
|
+
}
|
|
24
|
+
|
|
21
25
|
.dtable-ui-collaborator-editor-popover .collaborator-list-container .collaborator-item-container {
|
|
22
26
|
display: flex;
|
|
23
27
|
align-items: center;
|
|
24
28
|
justify-content: space-between;
|
|
25
29
|
height: 30px;
|
|
26
|
-
padding
|
|
30
|
+
padding: 0 10px;
|
|
27
31
|
font-size: 14px;
|
|
28
32
|
cursor: pointer;
|
|
29
33
|
}
|
|
@@ -45,3 +49,22 @@
|
|
|
45
49
|
font-size: 12px;
|
|
46
50
|
color: #798d99;
|
|
47
51
|
}
|
|
52
|
+
|
|
53
|
+
.dtable-ui-collaborator-editor .dtable-ui-collaborator-editor-container-no-btn {
|
|
54
|
+
min-height: 40px;
|
|
55
|
+
padding: 0.375rem 0.75rem;
|
|
56
|
+
border: 1px solid rgba(0, 40, 100, 0.12);
|
|
57
|
+
border-radius: 3px;
|
|
58
|
+
transition: border-color .15s ease-in-out;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.dtable-ui-collaborator-editor .dtable-ui-collaborator-editor-container-no-btn .collaborators-container {
|
|
62
|
+
min-height: 26px;
|
|
63
|
+
display: flex;
|
|
64
|
+
align-items: center;
|
|
65
|
+
flex-wrap: wrap;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.dtable-ui-collaborator-editor .dtable-ui-collaborator-editor-container-no-btn .collaborators-container .collaborator-item {
|
|
69
|
+
margin: 2px 10px 2px 0;
|
|
70
|
+
}
|
|
@@ -9,7 +9,7 @@ import './index.css';
|
|
|
9
9
|
class CollaboratorEditor extends React.Component {
|
|
10
10
|
constructor(props) {
|
|
11
11
|
super(props);
|
|
12
|
-
this.
|
|
12
|
+
this.onMouseDown = e => {
|
|
13
13
|
if (this.editorContainer !== e.target && !this.editorContainer.contains(e.target)) {
|
|
14
14
|
this.onClosePopover();
|
|
15
15
|
}
|
|
@@ -28,7 +28,7 @@ class CollaboratorEditor extends React.Component {
|
|
|
28
28
|
}
|
|
29
29
|
return [];
|
|
30
30
|
};
|
|
31
|
-
this.
|
|
31
|
+
this.togglePopover = event => {
|
|
32
32
|
event.nativeEvent.stopImmediatePropagation();
|
|
33
33
|
event.stopPropagation();
|
|
34
34
|
if (this.props.isReadOnly) {
|
|
@@ -67,7 +67,6 @@ class CollaboratorEditor extends React.Component {
|
|
|
67
67
|
newValue
|
|
68
68
|
}, () => {
|
|
69
69
|
this.onCommit(newValue);
|
|
70
|
-
this.onClosePopover();
|
|
71
70
|
});
|
|
72
71
|
};
|
|
73
72
|
this.onDeleteCollaborator = collaborator => {
|
|
@@ -108,6 +107,15 @@ class CollaboratorEditor extends React.Component {
|
|
|
108
107
|
isPopoverShow: false
|
|
109
108
|
});
|
|
110
109
|
};
|
|
110
|
+
this.onClickContainer = e => {
|
|
111
|
+
e.stopPropagation();
|
|
112
|
+
if (!this.props.isShowEditButton && !this.state.isPopoverShow) {
|
|
113
|
+
this.setState({
|
|
114
|
+
isPopoverShow: true,
|
|
115
|
+
popoverPosition: this.caculatePopoverPosition()
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
};
|
|
111
119
|
this.setEditorContainerRef = editorContainer => {
|
|
112
120
|
this.editorContainer = editorContainer;
|
|
113
121
|
};
|
|
@@ -121,15 +129,16 @@ class CollaboratorEditor extends React.Component {
|
|
|
121
129
|
};
|
|
122
130
|
}
|
|
123
131
|
componentDidMount() {
|
|
124
|
-
document.addEventListener('
|
|
132
|
+
document.addEventListener('mousedown', this.onMouseDown);
|
|
125
133
|
}
|
|
126
134
|
componentWillUnmount() {
|
|
127
|
-
document.removeEventListener('
|
|
135
|
+
document.removeEventListener('mousedown', this.onMouseDown);
|
|
128
136
|
}
|
|
129
137
|
render() {
|
|
130
138
|
let {
|
|
131
139
|
collaborators,
|
|
132
|
-
isReadOnly
|
|
140
|
+
isReadOnly,
|
|
141
|
+
isShowEditButton
|
|
133
142
|
} = this.props;
|
|
134
143
|
let {
|
|
135
144
|
isPopoverShow,
|
|
@@ -142,12 +151,13 @@ class CollaboratorEditor extends React.Component {
|
|
|
142
151
|
className: "dtable-ui-collaborator-editor"
|
|
143
152
|
}, /*#__PURE__*/React.createElement("div", {
|
|
144
153
|
ref: this.setEditorRef,
|
|
145
|
-
className: "dtable-ui-collaborator-editor-container"
|
|
146
|
-
|
|
154
|
+
className: "dtable-ui-collaborator-editor-container ".concat(isShowEditButton ? '' : 'dtable-ui-collaborator-editor-container-no-btn'),
|
|
155
|
+
onClick: this.onClickContainer
|
|
156
|
+
}, isShowEditButton && /*#__PURE__*/React.createElement(EditEditorButton, {
|
|
147
157
|
text: getLocale('Add_a_collaborator'),
|
|
148
|
-
onClick: this.
|
|
158
|
+
onClick: this.togglePopover
|
|
149
159
|
}), selectedCollaborators.length > 0 && /*#__PURE__*/React.createElement("div", {
|
|
150
|
-
className: "collaborators-container mt-2
|
|
160
|
+
className: "collaborators-container ".concat(isShowEditButton ? 'mt-2' : '')
|
|
151
161
|
}, selectedCollaborators.map(collaborator => {
|
|
152
162
|
return /*#__PURE__*/React.createElement(CollaboratorItem, {
|
|
153
163
|
key: collaborator.email,
|
|
@@ -176,6 +186,7 @@ class CollaboratorEditor extends React.Component {
|
|
|
176
186
|
}
|
|
177
187
|
}
|
|
178
188
|
CollaboratorEditor.defaultProps = {
|
|
189
|
+
isShowEditButton: true,
|
|
179
190
|
isReadOnly: false,
|
|
180
191
|
value: []
|
|
181
192
|
};
|
package/lib/DateEditor/index.js
CHANGED
|
@@ -4,6 +4,8 @@ import dayjs from 'dayjs';
|
|
|
4
4
|
import { getDateDisplayString } from 'dtable-utils';
|
|
5
5
|
import PCDateEditorPopover from './pc-date-editor-popover';
|
|
6
6
|
import MBDateEditorPopover from './mb-date-editor-popover';
|
|
7
|
+
import 'dayjs/locale/zh-cn';
|
|
8
|
+
import 'dayjs/locale/en-gb';
|
|
7
9
|
import './index.css';
|
|
8
10
|
class DateEditor extends React.Component {
|
|
9
11
|
constructor(props) {
|
package/lib/LinkEditor/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import './index.css';
|
|
|
11
11
|
class LinkEditor extends React.Component {
|
|
12
12
|
constructor(props) {
|
|
13
13
|
super(props);
|
|
14
|
-
this.
|
|
14
|
+
this.onMouseDown = e => {
|
|
15
15
|
if (this.editorContainer !== e.target && !this.editorContainer.contains(e.target)) {
|
|
16
16
|
this.onClosePopover();
|
|
17
17
|
}
|
|
@@ -197,10 +197,10 @@ class LinkEditor extends React.Component {
|
|
|
197
197
|
};
|
|
198
198
|
}
|
|
199
199
|
componentDidMount() {
|
|
200
|
-
document.addEventListener('
|
|
200
|
+
document.addEventListener('mousedown', this.onMouseDown);
|
|
201
201
|
}
|
|
202
202
|
componentWillUnmount() {
|
|
203
|
-
document.removeEventListener('
|
|
203
|
+
document.removeEventListener('mousedown', this.onMouseDown);
|
|
204
204
|
}
|
|
205
205
|
render() {
|
|
206
206
|
let {
|
|
@@ -15,7 +15,7 @@ class MTimeFormatter extends React.Component {
|
|
|
15
15
|
containerClassName
|
|
16
16
|
} = this.props;
|
|
17
17
|
let classname = classnames('dtable-ui cell-formatter-container ctime-formatter', containerClassName);
|
|
18
|
-
if (date
|
|
18
|
+
if (date) {
|
|
19
19
|
date = this.formatDate(date);
|
|
20
20
|
}
|
|
21
21
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -7,7 +7,7 @@ import './index.css';
|
|
|
7
7
|
class MultipleSelectEditor extends React.Component {
|
|
8
8
|
constructor(props) {
|
|
9
9
|
super(props);
|
|
10
|
-
this.
|
|
10
|
+
this.onMouseDown = e => {
|
|
11
11
|
if (this.editorContainer !== e.target && !this.editorContainer.contains(e.target)) {
|
|
12
12
|
this.onClosePopover();
|
|
13
13
|
}
|
|
@@ -121,10 +121,10 @@ class MultipleSelectEditor extends React.Component {
|
|
|
121
121
|
this.options = _column.data && (_column.data.options || []);
|
|
122
122
|
}
|
|
123
123
|
componentDidMount() {
|
|
124
|
-
document.addEventListener('
|
|
124
|
+
document.addEventListener('mousedown', this.onMouseDown);
|
|
125
125
|
}
|
|
126
126
|
componentWillUnmount() {
|
|
127
|
-
document.removeEventListener('
|
|
127
|
+
document.removeEventListener('mousedown', this.onMouseDown);
|
|
128
128
|
}
|
|
129
129
|
render() {
|
|
130
130
|
let {
|
|
@@ -4,9 +4,9 @@ import './index.css';
|
|
|
4
4
|
export default class NotificationPopover extends React.Component {
|
|
5
5
|
constructor() {
|
|
6
6
|
super(...arguments);
|
|
7
|
-
this.
|
|
7
|
+
this.onMouseDown = e => {
|
|
8
8
|
if (!this.notificationContainerRef.contains(e.target)) {
|
|
9
|
-
document.removeEventListener('mousedown', this.
|
|
9
|
+
document.removeEventListener('mousedown', this.onMouseDown);
|
|
10
10
|
if (e.target.className === 'tool notification' || e.target.parentNode.className === 'tool notification') {
|
|
11
11
|
return;
|
|
12
12
|
}
|
|
@@ -28,10 +28,10 @@ export default class NotificationPopover extends React.Component {
|
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
componentDidMount() {
|
|
31
|
-
document.addEventListener('mousedown', this.
|
|
31
|
+
document.addEventListener('mousedown', this.onMouseDown);
|
|
32
32
|
}
|
|
33
33
|
componentWillUnmount() {
|
|
34
|
-
document.removeEventListener('mousedown', this.
|
|
34
|
+
document.removeEventListener('mousedown', this.onMouseDown);
|
|
35
35
|
}
|
|
36
36
|
render() {
|
|
37
37
|
const {
|
|
@@ -7,7 +7,7 @@ import './index.css';
|
|
|
7
7
|
class SingleSelectEditor extends React.Component {
|
|
8
8
|
constructor(props) {
|
|
9
9
|
super(props);
|
|
10
|
-
this.
|
|
10
|
+
this.onMouseDown = e => {
|
|
11
11
|
if (this.editorContainer !== e.target && !this.editorContainer.contains(e.target)) {
|
|
12
12
|
this.onClosePopover();
|
|
13
13
|
}
|
|
@@ -102,10 +102,10 @@ class SingleSelectEditor extends React.Component {
|
|
|
102
102
|
this.options = _column.data && (_column.data.options || []);
|
|
103
103
|
}
|
|
104
104
|
componentDidMount() {
|
|
105
|
-
document.addEventListener('
|
|
105
|
+
document.addEventListener('mousedown', this.onMouseDown);
|
|
106
106
|
}
|
|
107
107
|
componentWillUnmount() {
|
|
108
|
-
document.removeEventListener('
|
|
108
|
+
document.removeEventListener('mousedown', this.onMouseDown);
|
|
109
109
|
}
|
|
110
110
|
render() {
|
|
111
111
|
let {
|
|
@@ -8,7 +8,7 @@ export default class ClickOutside extends React.Component {
|
|
|
8
8
|
this.isClickedInside = false;
|
|
9
9
|
return;
|
|
10
10
|
}
|
|
11
|
-
this.props.onClickOutside(e);
|
|
11
|
+
this.props.onClickOutside && this.props.onClickOutside(e);
|
|
12
12
|
};
|
|
13
13
|
this.handleMouseDown = () => {
|
|
14
14
|
this.isClickedInside = true;
|
package/lib/common/delete-tip.js
CHANGED
|
@@ -5,17 +5,17 @@ import './delete-tip.css';
|
|
|
5
5
|
export default class DeleteTip extends React.Component {
|
|
6
6
|
constructor() {
|
|
7
7
|
super(...arguments);
|
|
8
|
-
this.
|
|
8
|
+
this.onMouseDown = e => {
|
|
9
9
|
if (this.tipContainer && !this.tipContainer.contains(e.target)) {
|
|
10
10
|
this.props.toggle();
|
|
11
11
|
}
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
14
|
componentDidMount() {
|
|
15
|
-
document.addEventListener('
|
|
15
|
+
document.addEventListener('mousedown', this.onMouseDown);
|
|
16
16
|
}
|
|
17
17
|
componentWillUnmount() {
|
|
18
|
-
document.removeEventListener('
|
|
18
|
+
document.removeEventListener('mousedown', this.onMouseDown);
|
|
19
19
|
}
|
|
20
20
|
render() {
|
|
21
21
|
const {
|
package/lib/toaster/index.css
CHANGED