dtable-ui-component 4.4.0-alpha1 → 4.4.0-alpha2
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.
|
@@ -11,6 +11,11 @@ class CollaboratorEditor extends React.Component {
|
|
|
11
11
|
constructor(props) {
|
|
12
12
|
super(props);
|
|
13
13
|
this.onMouseDown = e => {
|
|
14
|
+
if (this.state.isPopoverShow && this.editorPopoverRef) {
|
|
15
|
+
if (this.editorPopoverRef === e.target || this.editorPopoverRef.contains(e.target)) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
14
19
|
if (this.editorContainer !== e.target && !this.editorContainer.contains(e.target)) {
|
|
15
20
|
this.onClosePopover();
|
|
16
21
|
}
|
|
@@ -83,6 +88,17 @@ class CollaboratorEditor extends React.Component {
|
|
|
83
88
|
}
|
|
84
89
|
};
|
|
85
90
|
this.caculatePopoverPosition = () => {
|
|
91
|
+
if (this.props.isInModel) {
|
|
92
|
+
const {
|
|
93
|
+
top,
|
|
94
|
+
left
|
|
95
|
+
} = this.editor.getBoundingClientRect();
|
|
96
|
+
return {
|
|
97
|
+
top: top + 40,
|
|
98
|
+
left,
|
|
99
|
+
zIndex: 1051
|
|
100
|
+
};
|
|
101
|
+
}
|
|
86
102
|
const POPOVER_MAX_HEIGHT = 200;
|
|
87
103
|
let innerHeight = window.innerHeight;
|
|
88
104
|
let {
|
|
@@ -123,6 +139,9 @@ class CollaboratorEditor extends React.Component {
|
|
|
123
139
|
this.setEditorRef = editor => {
|
|
124
140
|
this.editor = editor;
|
|
125
141
|
};
|
|
142
|
+
this.setPopoverRef = ref => {
|
|
143
|
+
this.editorPopoverRef = ref;
|
|
144
|
+
};
|
|
126
145
|
this.state = {
|
|
127
146
|
newValue: Array.isArray(props.value) ? props.value : [],
|
|
128
147
|
isPopoverShow: false,
|
|
@@ -173,7 +192,8 @@ class CollaboratorEditor extends React.Component {
|
|
|
173
192
|
isReadOnly: this.props.isReadOnly,
|
|
174
193
|
selectedCollaborators: selectedCollaborators,
|
|
175
194
|
collaborators: collaborators,
|
|
176
|
-
onCollaboratorItemToggle: this.onCollaboratorItemToggle
|
|
195
|
+
onCollaboratorItemToggle: this.onCollaboratorItemToggle,
|
|
196
|
+
setPopoverRef: this.setPopoverRef
|
|
177
197
|
}))), /*#__PURE__*/React.createElement(MediaQuery, {
|
|
178
198
|
query: '(max-width: 767.8px)'
|
|
179
199
|
}, /*#__PURE__*/React.createElement(MBCollaboratorEditorPopover, {
|
|
@@ -189,6 +209,7 @@ class CollaboratorEditor extends React.Component {
|
|
|
189
209
|
CollaboratorEditor.defaultProps = {
|
|
190
210
|
isShowEditButton: true,
|
|
191
211
|
isReadOnly: false,
|
|
192
|
-
value: []
|
|
212
|
+
value: [],
|
|
213
|
+
isInModel: false
|
|
193
214
|
};
|
|
194
215
|
export default CollaboratorEditor;
|
|
@@ -54,7 +54,8 @@ class PCCollaboratorEditorPopover extends React.Component {
|
|
|
54
54
|
});
|
|
55
55
|
return /*#__PURE__*/React.createElement("div", {
|
|
56
56
|
className: "dtable-ui-editor-popover dtable-ui-collaborator-editor-popover",
|
|
57
|
-
style: popoverStyle
|
|
57
|
+
style: popoverStyle,
|
|
58
|
+
ref: this.props.setPopoverRef
|
|
58
59
|
}, /*#__PURE__*/React.createElement("div", {
|
|
59
60
|
className: "collaborator-search-container"
|
|
60
61
|
}, /*#__PURE__*/React.createElement("input", {
|