dtable-ui-component 4.3.10-alpha4 → 4.3.10-alpha5
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/CollaboratorEditor/index.js +22 -10
- package/package.json +1 -1
|
@@ -56,18 +56,29 @@ class CollaboratorEditor extends React.Component {
|
|
|
56
56
|
this.props.onCommit(updated);
|
|
57
57
|
};
|
|
58
58
|
this.onCollaboratorItemToggle = collaborator => {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
if (this.props.isMultilple) {
|
|
60
|
+
let newValue = this.state.newValue.slice();
|
|
61
|
+
let collaboratorIndex = newValue.findIndex(collaboratorEmail => collaboratorEmail === collaborator.email);
|
|
62
|
+
if (collaboratorIndex !== -1) {
|
|
63
|
+
newValue.splice(collaboratorIndex, 1);
|
|
64
|
+
} else {
|
|
65
|
+
newValue.push(collaborator.email);
|
|
66
|
+
}
|
|
67
|
+
this.setState({
|
|
68
|
+
newValue
|
|
69
|
+
}, () => {
|
|
70
|
+
this.onCommit(newValue);
|
|
71
|
+
});
|
|
63
72
|
} else {
|
|
64
|
-
newValue.
|
|
73
|
+
const collaboratorIndex = this.state.newValue.findIndex(collaboratorEmail => collaboratorEmail === collaborator.email);
|
|
74
|
+
const newValue = collaboratorIndex === -1 ? [collaborator.email] : [];
|
|
75
|
+
this.setState({
|
|
76
|
+
newValue
|
|
77
|
+
}, () => {
|
|
78
|
+
this.onCommit(newValue);
|
|
79
|
+
this.onClosePopover();
|
|
80
|
+
});
|
|
65
81
|
}
|
|
66
|
-
this.setState({
|
|
67
|
-
newValue
|
|
68
|
-
}, () => {
|
|
69
|
-
this.onCommit(newValue);
|
|
70
|
-
});
|
|
71
82
|
};
|
|
72
83
|
this.onDeleteCollaborator = collaborator => {
|
|
73
84
|
let newValue = this.state.newValue.slice();
|
|
@@ -186,6 +197,7 @@ class CollaboratorEditor extends React.Component {
|
|
|
186
197
|
}
|
|
187
198
|
}
|
|
188
199
|
CollaboratorEditor.defaultProps = {
|
|
200
|
+
isMultilple: true,
|
|
189
201
|
isShowEditButton: true,
|
|
190
202
|
isReadOnly: false,
|
|
191
203
|
value: []
|