gogoclient 1.2.2
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/LICENSE +21 -0
- package/README.md +1 -0
- package/dist/components/AuthWrapper.js +61 -0
- package/dist/components/PageLayout.js +53 -0
- package/dist/components/RequireAuth.js +86 -0
- package/dist/components/index.js +27 -0
- package/dist/helpers/Root.js +206 -0
- package/dist/helpers/SubscriptionManager.js +61 -0
- package/dist/helpers/currentUserContext.js +12 -0
- package/dist/helpers/currentUserQuery.js +11 -0
- package/dist/helpers/getUrl.js +18 -0
- package/dist/helpers/sentry.js +25 -0
- package/dist/helpers/startClient.js +25 -0
- package/dist/helpers/subscriptionManagerContext.js +22 -0
- package/dist/index.js +109 -0
- package/dist/pages/ProviderConnection.page.js +99 -0
- package/dist/pages/ProviderConnection.queries.js +12 -0
- package/dist/pages/index.js +28 -0
- package/dist/theme/elements/Action.js +29 -0
- package/dist/theme/elements/ActionGroup.js +14 -0
- package/dist/theme/elements/AppBar.js +17 -0
- package/dist/theme/elements/Button.js +31 -0
- package/dist/theme/elements/Checkbox.js +38 -0
- package/dist/theme/elements/GlobalStyle.js +10 -0
- package/dist/theme/elements/Logo.js +10 -0
- package/dist/theme/elements/Menu.js +15 -0
- package/dist/theme/elements/Radio.js +27 -0
- package/dist/theme/elements/TextField.js +39 -0
- package/dist/theme/elements/index.js +76 -0
- package/dist/theme/index.js +93 -0
- package/dist/toolkit/darkenLighten.js +57 -0
- package/dist/toolkit/headingScale.js +29 -0
- package/dist/toolkit/index.js +79 -0
- package/dist/toolkit/media.js +23 -0
- package/dist/toolkit/override.js +74 -0
- package/dist/toolkit/styles/fadeInOut.js +11 -0
- package/dist/toolkit/styles/rotate360.js +11 -0
- package/dist/toolkit/themeHelper.js +53 -0
- package/dist/ui/_helpers/_helpers.js +69 -0
- package/dist/ui/_helpers/cssSnippets.js +11 -0
- package/dist/ui/_helpers/index.js +40 -0
- package/dist/ui/_helpers/useBreakpoint.js +35 -0
- package/dist/ui/assignReviewers/AssignReviewers.js +174 -0
- package/dist/ui/assignReviewers/InviteRowProp.js +130 -0
- package/dist/ui/assignReviewers/ReviewerTable.js +268 -0
- package/dist/ui/assignReviewers/SearchBox.js +160 -0
- package/dist/ui/assignReviewers/SuggestedReviewer.js +28 -0
- package/dist/ui/assignReviewers/index.js +13 -0
- package/dist/ui/authentication/AuthenticationForm.js +87 -0
- package/dist/ui/authentication/AuthenticationHeader.js +13 -0
- package/dist/ui/authentication/AuthenticationWrapper.js +13 -0
- package/dist/ui/authentication/ChangePassword.js +128 -0
- package/dist/ui/authentication/DeactivatedUser.js +17 -0
- package/dist/ui/authentication/Login.js +74 -0
- package/dist/ui/authentication/ProfileForm.js +79 -0
- package/dist/ui/authentication/ProviderConnection.js +69 -0
- package/dist/ui/authentication/RequestPasswordReset.js +89 -0
- package/dist/ui/authentication/ResetPassword.js +96 -0
- package/dist/ui/authentication/Signup.js +180 -0
- package/dist/ui/authentication/SuccessSubTitle.js +20 -0
- package/dist/ui/authentication/VerifyCheck.js +55 -0
- package/dist/ui/authentication/VerifyEmail.js +119 -0
- package/dist/ui/authentication/index.js +104 -0
- package/dist/ui/chat/ChatInput.js +63 -0
- package/dist/ui/chat/ChatMessage.js +67 -0
- package/dist/ui/chat/ChatMessageList.js +45 -0
- package/dist/ui/chat/ChatThread.js +41 -0
- package/dist/ui/chat/index.js +34 -0
- package/dist/ui/common/AutoComplete.js +56 -0
- package/dist/ui/common/Button.js +83 -0
- package/dist/ui/common/ButtonGroup.js +58 -0
- package/dist/ui/common/Checkbox.js +30 -0
- package/dist/ui/common/CheckboxGroup.js +42 -0
- package/dist/ui/common/CokoLink.js +24 -0
- package/dist/ui/common/Collapse.js +14 -0
- package/dist/ui/common/DateParser.js +49 -0
- package/dist/ui/common/Divider.js +8 -0
- package/dist/ui/common/Empty.js +14 -0
- package/dist/ui/common/Form.js +216 -0
- package/dist/ui/common/FormSection.js +35 -0
- package/dist/ui/common/Headings.js +74 -0
- package/dist/ui/common/Input.js +72 -0
- package/dist/ui/common/InputNumber.js +54 -0
- package/dist/ui/common/InviteStatus.js +63 -0
- package/dist/ui/common/Layout.js +17 -0
- package/dist/ui/common/LinkWithoutStyles.js +12 -0
- package/dist/ui/common/List.js +390 -0
- package/dist/ui/common/Modal.js +17 -0
- package/dist/ui/common/Note.js +23 -0
- package/dist/ui/common/Page.js +33 -0
- package/dist/ui/common/Pagination.js +126 -0
- package/dist/ui/common/Popup.js +146 -0
- package/dist/ui/common/Radio.js +54 -0
- package/dist/ui/common/Result.js +8 -0
- package/dist/ui/common/Ribbon.js +54 -0
- package/dist/ui/common/Search.js +30 -0
- package/dist/ui/common/Select.js +148 -0
- package/dist/ui/common/Spin.js +87 -0
- package/dist/ui/common/Split.js +49 -0
- package/dist/ui/common/Status.js +53 -0
- package/dist/ui/common/Switch.js +47 -0
- package/dist/ui/common/Table.js +111 -0
- package/dist/ui/common/Tabs.js +8 -0
- package/dist/ui/common/TabsStyled.js +65 -0
- package/dist/ui/common/TextArea.js +29 -0
- package/dist/ui/common/Typography.js +9 -0
- package/dist/ui/common/VisuallyHiddenElement.js +17 -0
- package/dist/ui/common/_reusableStyles.js +14 -0
- package/dist/ui/common/index.js +341 -0
- package/dist/ui/index.js +49 -0
- package/package.json +114 -0
- package/scripts/coko-client-build.js +42 -0
- package/scripts/coko-client-build.sh +28 -0
- package/scripts/coko-client-dev.js +16 -0
- package/scripts/coko-client-dev.sh +28 -0
- package/scripts/env.sh +41 -0
- package/webpack/changes.md +20 -0
- package/webpack/index.ejs +15 -0
- package/webpack/noop.js +11 -0
- package/webpack/webpack.config.js +483 -0
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
11
|
+
var _toolkit = require("../../toolkit");
|
|
12
|
+
var _SearchBox = _interopRequireDefault(require("./SearchBox"));
|
|
13
|
+
var _SuggestedReviewer = _interopRequireDefault(require("./SuggestedReviewer"));
|
|
14
|
+
var _common = require("../common");
|
|
15
|
+
var _ReviewerTable = _interopRequireDefault(require("./ReviewerTable"));
|
|
16
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
|
|
17
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
18
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
19
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
20
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
21
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
22
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
23
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
24
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
25
|
+
function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
|
|
26
|
+
var Wrapper = _styledComponents["default"].div(_templateObject || (_templateObject = _taggedTemplateLiteral([""])));
|
|
27
|
+
var Top = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n justify-content: space-between;\n margin-bottom: ", ";\n\n label:last-of-type {\n margin-top: 0;\n }\n"])), (0, _toolkit.grid)(3));
|
|
28
|
+
var ItemWrapper = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral([""])));
|
|
29
|
+
var Head = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n margin-bottom: ", ";\n"])), (0, _toolkit.grid)(1));
|
|
30
|
+
var HeadSecondRow = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n align-items: center;\n display: flex;\n justify-content: space-between;\n margin: ", " ", ";\n\n > div > button:not(:last-child) {\n margin-right: ", ";\n }\n"])), (0, _toolkit.grid)(2), (0, _toolkit.grid)(4), (0, _toolkit.grid)(1));
|
|
31
|
+
var Search = (0, _styledComponents["default"])(_SearchBox["default"])(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n margin-bottom: ", ";\n"])), (0, _toolkit.grid)(1));
|
|
32
|
+
var StyledRibbon = (0, _styledComponents["default"])(_common.Ribbon)(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n margin-bottom: ", ";\n"])), (0, _toolkit.grid)(1));
|
|
33
|
+
var AssignReviewers = function AssignReviewers(props) {
|
|
34
|
+
var additionalReviewerColumns = props.additionalReviewerColumns,
|
|
35
|
+
additionalSearchFields = props.additionalSearchFields,
|
|
36
|
+
amountOfReviewers = props.amountOfReviewers,
|
|
37
|
+
automate = props.automate,
|
|
38
|
+
canInviteMore = props.canInviteMore,
|
|
39
|
+
canDismissReviewer = props.canDismissReviewer,
|
|
40
|
+
className = props.className,
|
|
41
|
+
onAddReviewers = props.onAddReviewers,
|
|
42
|
+
onAmountOfReviewersChange = props.onAmountOfReviewersChange,
|
|
43
|
+
onAutomationChange = props.onAutomationChange,
|
|
44
|
+
onClickInvite = props.onClickInvite,
|
|
45
|
+
onClickRemoveRow = props.onClickRemoveRow,
|
|
46
|
+
onClickRevokeInvitation = props.onClickRevokeInvitation,
|
|
47
|
+
onSearch = props.onSearch,
|
|
48
|
+
onTableChange = props.onTableChange,
|
|
49
|
+
reviewerPool = props.reviewerPool,
|
|
50
|
+
searchPlaceholder = props.searchPlaceholder,
|
|
51
|
+
suggestedReviewerName = props.suggestedReviewerName,
|
|
52
|
+
useShowEmail = props.useShowEmail;
|
|
53
|
+
var _useState = (0, _react.useState)(false),
|
|
54
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
55
|
+
showEmails = _useState2[0],
|
|
56
|
+
setShowEmails = _useState2[1];
|
|
57
|
+
var _useState3 = (0, _react.useState)(false),
|
|
58
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
59
|
+
manualSorting = _useState4[0],
|
|
60
|
+
setManualSorting = _useState4[1];
|
|
61
|
+
|
|
62
|
+
// Explainer text: Adding reviewers to the list won't send them an invite yet
|
|
63
|
+
return /*#__PURE__*/_react["default"].createElement(Wrapper, {
|
|
64
|
+
className: className
|
|
65
|
+
}, suggestedReviewerName && /*#__PURE__*/_react["default"].createElement(Top, null, /*#__PURE__*/_react["default"].createElement(ItemWrapper, null, suggestedReviewerName && /*#__PURE__*/_react["default"].createElement(_SuggestedReviewer["default"], {
|
|
66
|
+
name: suggestedReviewerName
|
|
67
|
+
}))), /*#__PURE__*/_react["default"].createElement(Search, {
|
|
68
|
+
additionalSearchFields: additionalSearchFields,
|
|
69
|
+
onAdd: onAddReviewers,
|
|
70
|
+
onSearch: onSearch,
|
|
71
|
+
searchPlaceholder: searchPlaceholder
|
|
72
|
+
}), /*#__PURE__*/_react["default"].createElement(Head, null, /*#__PURE__*/_react["default"].createElement(StyledRibbon, {
|
|
73
|
+
status: automate ? 'success' : null
|
|
74
|
+
}, "Automation is ", automate ? 'on' : 'off'), /*#__PURE__*/_react["default"].createElement(HeadSecondRow, null, /*#__PURE__*/_react["default"].createElement(ItemWrapper, null, /*#__PURE__*/_react["default"].createElement(_common.Switch, {
|
|
75
|
+
checked: automate,
|
|
76
|
+
disabled: !manualSorting,
|
|
77
|
+
label: "Automate invites",
|
|
78
|
+
labelPosition: "left",
|
|
79
|
+
onChange: onAutomationChange
|
|
80
|
+
})), /*#__PURE__*/_react["default"].createElement(ItemWrapper, null, /*#__PURE__*/_react["default"].createElement(_common.Switch, {
|
|
81
|
+
checked: manualSorting,
|
|
82
|
+
label: "Sort reviewers manually",
|
|
83
|
+
labelPosition: "left",
|
|
84
|
+
onChange: setManualSorting
|
|
85
|
+
})), useShowEmail && /*#__PURE__*/_react["default"].createElement(ItemWrapper, null, /*#__PURE__*/_react["default"].createElement(_common.Switch, {
|
|
86
|
+
checked: showEmails,
|
|
87
|
+
label: "Show reviewer emails",
|
|
88
|
+
labelPosition: "left",
|
|
89
|
+
onChange: function onChange() {
|
|
90
|
+
return setShowEmails(!showEmails);
|
|
91
|
+
}
|
|
92
|
+
})), /*#__PURE__*/_react["default"].createElement(_common.InputNumber, {
|
|
93
|
+
disabled: automate,
|
|
94
|
+
label: "Maximum reviewers from pool",
|
|
95
|
+
min: 1,
|
|
96
|
+
onChange: onAmountOfReviewersChange,
|
|
97
|
+
value: amountOfReviewers
|
|
98
|
+
}))), /*#__PURE__*/_react["default"].createElement(_ReviewerTable["default"], {
|
|
99
|
+
additionalColumns: additionalReviewerColumns,
|
|
100
|
+
canDismissReviewer: canDismissReviewer,
|
|
101
|
+
canInviteMore: canInviteMore,
|
|
102
|
+
manualSorting: manualSorting,
|
|
103
|
+
onChange: onTableChange,
|
|
104
|
+
onInvite: onClickInvite,
|
|
105
|
+
onRemoveRow: onClickRemoveRow,
|
|
106
|
+
onRevokeInvitation: onClickRevokeInvitation,
|
|
107
|
+
reviewers: reviewerPool,
|
|
108
|
+
showEmails: showEmails
|
|
109
|
+
}));
|
|
110
|
+
};
|
|
111
|
+
AssignReviewers.propTypes = {
|
|
112
|
+
/** Additional column definitions of type `ColumnsType` from `antd/es/table` */
|
|
113
|
+
additionalReviewerColumns: _propTypes["default"].arrayOf(_propTypes["default"].shape({
|
|
114
|
+
title: _propTypes["default"].string.isRequired,
|
|
115
|
+
dataIndex: _propTypes["default"].string.isRequired
|
|
116
|
+
})),
|
|
117
|
+
/** Additional search fields definitions to display on search */
|
|
118
|
+
additionalSearchFields: _propTypes["default"].arrayOf(_propTypes["default"].shape({
|
|
119
|
+
label: _propTypes["default"].string.isRequired,
|
|
120
|
+
value: _propTypes["default"].string.isRequired,
|
|
121
|
+
items: _propTypes["default"].arrayOf(_propTypes["default"].string)
|
|
122
|
+
})),
|
|
123
|
+
/** Maximum amount of reviewers that can be invited at the same time */
|
|
124
|
+
amountOfReviewers: _propTypes["default"].number.isRequired,
|
|
125
|
+
/** Whether reviewer invitation automation is on for this manuscript version */
|
|
126
|
+
automate: _propTypes["default"].bool.isRequired,
|
|
127
|
+
/** Whether more reviewers can be invited */
|
|
128
|
+
canInviteMore: _propTypes["default"].bool.isRequired,
|
|
129
|
+
/** Whether more reviewers can be invited */
|
|
130
|
+
canDismissReviewer: _propTypes["default"].bool,
|
|
131
|
+
/** Function to run on selecting a reviewer in the search box */
|
|
132
|
+
onAddReviewers: _propTypes["default"].func.isRequired,
|
|
133
|
+
/** Handle change in amount of reviewers input */
|
|
134
|
+
onAmountOfReviewersChange: _propTypes["default"].func.isRequired,
|
|
135
|
+
/** Function to run when "Automate invites" is toggled */
|
|
136
|
+
onAutomationChange: _propTypes["default"].func.isRequired,
|
|
137
|
+
/** Function to run when "invite" is clicked on a row from the pool */
|
|
138
|
+
onClickInvite: _propTypes["default"].func.isRequired,
|
|
139
|
+
/** Function to run when the "X" button is clicked on a row from the pool */
|
|
140
|
+
onClickRemoveRow: _propTypes["default"].func.isRequired,
|
|
141
|
+
/** Function to run when "revoke invitation" is clicked on a row from the pool */
|
|
142
|
+
onClickRevokeInvitation: _propTypes["default"].func.isRequired,
|
|
143
|
+
/** Function that returns a promise. Must resolve to an array objects, each with shape `{ value: <String>, label: <String>, isDisabled: <Boolean>, status: <String>}` */
|
|
144
|
+
onSearch: _propTypes["default"].func.isRequired,
|
|
145
|
+
/** Function to run when data is filtered/sorted */
|
|
146
|
+
onTableChange: _propTypes["default"].func.isRequired,
|
|
147
|
+
/** Reviewers added to the pool list. Shape defined in ReviewerRow */
|
|
148
|
+
reviewerPool: _propTypes["default"].arrayOf(_propTypes["default"].shape({
|
|
149
|
+
id: _propTypes["default"].string.isRequired,
|
|
150
|
+
displayName: _propTypes["default"].string.isRequired,
|
|
151
|
+
invited: _propTypes["default"].bool,
|
|
152
|
+
acceptedInvitation: _propTypes["default"].bool,
|
|
153
|
+
rejectedInvitation: _propTypes["default"].bool,
|
|
154
|
+
invitationRevoked: _propTypes["default"].bool,
|
|
155
|
+
reviewSubmitted: _propTypes["default"].bool
|
|
156
|
+
})),
|
|
157
|
+
/** Placeholder for the search bar */
|
|
158
|
+
searchPlaceholder: _propTypes["default"].string,
|
|
159
|
+
/** Display name of suggested reviewer */
|
|
160
|
+
suggestedReviewerName: _propTypes["default"].string,
|
|
161
|
+
/** Whether to display the option to show `Show reviewer emails` checkbox.
|
|
162
|
+
* Alternatively, the email renders can be customised using `additionalReviewerColumns` */
|
|
163
|
+
useShowEmail: _propTypes["default"].bool
|
|
164
|
+
};
|
|
165
|
+
AssignReviewers.defaultProps = {
|
|
166
|
+
additionalReviewerColumns: [],
|
|
167
|
+
additionalSearchFields: [],
|
|
168
|
+
canDismissReviewer: false,
|
|
169
|
+
reviewerPool: [],
|
|
170
|
+
searchPlaceholder: undefined,
|
|
171
|
+
suggestedReviewerName: null,
|
|
172
|
+
useShowEmail: false
|
|
173
|
+
};
|
|
174
|
+
var _default = exports["default"] = AssignReviewers;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
10
|
+
var _icons = require("@ant-design/icons");
|
|
11
|
+
var _toolkit = require("../../toolkit");
|
|
12
|
+
var _common = require("../common");
|
|
13
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
15
|
+
function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
|
|
16
|
+
var StyledInviteStatus = (0, _styledComponents["default"])(_common.InviteStatus)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n font-size: 12px;\n margin: 0 ", ";\n"])), (0, _toolkit.grid)(1));
|
|
17
|
+
var InviteStatusWrapper = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: inline-block;\n"])));
|
|
18
|
+
var InviteActionWrapper = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral([""])));
|
|
19
|
+
var RemoveInviteWrapper = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n &:hover {\n cursor: pointer;\n }\n"])));
|
|
20
|
+
var InviteRowProp = function InviteRowProp(props) {
|
|
21
|
+
var canInvite = props.canInvite,
|
|
22
|
+
canDismissReviewer = props.canDismissReviewer,
|
|
23
|
+
className = props.className,
|
|
24
|
+
data = props.data,
|
|
25
|
+
onClickInvite = props.onClickInvite,
|
|
26
|
+
onClickRemove = props.onClickRemove,
|
|
27
|
+
onClickRevokeInvitation = props.onClickRevokeInvitation,
|
|
28
|
+
type = props.type;
|
|
29
|
+
var id = data.id,
|
|
30
|
+
invited = data.invited,
|
|
31
|
+
acceptedInvitation = data.acceptedInvitation,
|
|
32
|
+
rejectedInvitation = data.rejectedInvitation,
|
|
33
|
+
invitationRevoked = data.invitationRevoked,
|
|
34
|
+
reviewSubmitted = data.reviewSubmitted;
|
|
35
|
+
var reviewPending = invited && acceptedInvitation && !reviewSubmitted;
|
|
36
|
+
var submitted = invited && acceptedInvitation && reviewSubmitted;
|
|
37
|
+
var rejected = invited && rejectedInvitation;
|
|
38
|
+
var revoked = invited && invitationRevoked;
|
|
39
|
+
var responsePending = invited && !invitationRevoked && !acceptedInvitation && !rejectedInvitation;
|
|
40
|
+
var notInvited = !invited && !invitationRevoked;
|
|
41
|
+
var makeStatusText = function makeStatusText() {
|
|
42
|
+
if (reviewPending) return 'accepted invitation - pending review';
|
|
43
|
+
if (submitted) return 'review submitted';
|
|
44
|
+
if (rejected) return 'rejected invitation';
|
|
45
|
+
if (revoked) return 'invitation revoked';
|
|
46
|
+
if (responsePending) return 'invited';
|
|
47
|
+
if (notInvited) return 'not invited';
|
|
48
|
+
return null;
|
|
49
|
+
};
|
|
50
|
+
var makeStatus = function makeStatus() {
|
|
51
|
+
if (reviewPending) return 'success';
|
|
52
|
+
if (submitted) return 'primary';
|
|
53
|
+
if (rejected) return 'error';
|
|
54
|
+
if (revoked) return 'error';
|
|
55
|
+
if (responsePending) return 'success';
|
|
56
|
+
if (notInvited) return null;
|
|
57
|
+
return null;
|
|
58
|
+
};
|
|
59
|
+
var handleRemove = function handleRemove() {
|
|
60
|
+
onClickRemove(id);
|
|
61
|
+
};
|
|
62
|
+
if (type === 'status') {
|
|
63
|
+
return /*#__PURE__*/_react["default"].createElement(InviteStatusWrapper, {
|
|
64
|
+
className: className
|
|
65
|
+
}, /*#__PURE__*/_react["default"].createElement(StyledInviteStatus, {
|
|
66
|
+
reverseColors: true,
|
|
67
|
+
status: makeStatus()
|
|
68
|
+
}, makeStatusText()));
|
|
69
|
+
}
|
|
70
|
+
if (type === 'action') {
|
|
71
|
+
return /*#__PURE__*/_react["default"].createElement(InviteActionWrapper, {
|
|
72
|
+
className: className
|
|
73
|
+
}, notInvited && /*#__PURE__*/_react["default"].createElement(_common.Button, {
|
|
74
|
+
disabled: !canInvite,
|
|
75
|
+
onClick: function onClick() {
|
|
76
|
+
return onClickInvite(id);
|
|
77
|
+
},
|
|
78
|
+
type: "primary"
|
|
79
|
+
}, "Invite"), revoked && /*#__PURE__*/_react["default"].createElement(_common.Button, {
|
|
80
|
+
disabled: !canInvite,
|
|
81
|
+
onClick: function onClick() {
|
|
82
|
+
return onClickInvite(id);
|
|
83
|
+
},
|
|
84
|
+
type: "primary"
|
|
85
|
+
}, "Reinvite"), responsePending && /*#__PURE__*/_react["default"].createElement(_common.Button, {
|
|
86
|
+
onClick: function onClick() {
|
|
87
|
+
return onClickRevokeInvitation(id);
|
|
88
|
+
},
|
|
89
|
+
type: "primary"
|
|
90
|
+
}, "Revoke invite"));
|
|
91
|
+
}
|
|
92
|
+
if (type === 'remove' && (notInvited || canDismissReviewer)) {
|
|
93
|
+
return /*#__PURE__*/_react["default"].createElement(RemoveInviteWrapper, {
|
|
94
|
+
className: className,
|
|
95
|
+
onClick: handleRemove
|
|
96
|
+
}, /*#__PURE__*/_react["default"].createElement(_icons.CloseOutlined, null));
|
|
97
|
+
}
|
|
98
|
+
return null;
|
|
99
|
+
};
|
|
100
|
+
InviteRowProp.propTypes = {
|
|
101
|
+
/** Whether more reviewers can be invited */
|
|
102
|
+
canInvite: _propTypes["default"].bool,
|
|
103
|
+
/** Whether a reviewer can be removed even after accepting invitation */
|
|
104
|
+
canDismissReviewer: _propTypes["default"].bool,
|
|
105
|
+
/** Current row's invite status fields */
|
|
106
|
+
data: _propTypes["default"].shape({
|
|
107
|
+
id: _propTypes["default"].string.isRequired,
|
|
108
|
+
invited: _propTypes["default"].bool,
|
|
109
|
+
acceptedInvitation: _propTypes["default"].bool,
|
|
110
|
+
rejectedInvitation: _propTypes["default"].bool,
|
|
111
|
+
invitationRevoked: _propTypes["default"].bool,
|
|
112
|
+
reviewSubmitted: _propTypes["default"].bool
|
|
113
|
+
}).isRequired,
|
|
114
|
+
/** Function to run when "invite" is clicked on a row from the pool */
|
|
115
|
+
onClickInvite: _propTypes["default"].func,
|
|
116
|
+
/** Function to run when the "X" is clicked on a row from the pool */
|
|
117
|
+
onClickRemove: _propTypes["default"].func,
|
|
118
|
+
/** Function to run when "Revoke invitiation" is clicked on a row from the pool */
|
|
119
|
+
onClickRevokeInvitation: _propTypes["default"].func,
|
|
120
|
+
/** Type of invite prop being rendered */
|
|
121
|
+
type: _propTypes["default"].string.isRequired
|
|
122
|
+
};
|
|
123
|
+
InviteRowProp.defaultProps = {
|
|
124
|
+
canInvite: false,
|
|
125
|
+
canDismissReviewer: false,
|
|
126
|
+
onClickInvite: function onClickInvite() {},
|
|
127
|
+
onClickRemove: function onClickRemove() {},
|
|
128
|
+
onClickRevokeInvitation: function onClickRevokeInvitation() {}
|
|
129
|
+
};
|
|
130
|
+
var _default = exports["default"] = InviteRowProp;
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
11
|
+
var _antd = require("antd");
|
|
12
|
+
var _reactBeautifulDnd = require("react-beautiful-dnd");
|
|
13
|
+
var _icons = require("@ant-design/icons");
|
|
14
|
+
var _toolkit = require("../../toolkit");
|
|
15
|
+
var _InviteRowProp = _interopRequireDefault(require("./InviteRowProp"));
|
|
16
|
+
var _excluded = ["children", "className"],
|
|
17
|
+
_excluded2 = ["children", "index", "manualSorting"],
|
|
18
|
+
_excluded3 = ["sorter"];
|
|
19
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
20
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
21
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
22
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
23
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
24
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
25
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
26
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
27
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
28
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
29
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
30
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
31
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
32
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
33
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
34
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
35
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
36
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
37
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
38
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
39
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
40
|
+
function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
|
|
41
|
+
var Wrapper = _styledComponents["default"].div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n border: 1px solid grey;\n padding: 16px;\n"])));
|
|
42
|
+
var EmptyMessage = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n color: ", ";\n font-size: ", ";\n font-style: italic;\n"])), (0, _toolkit.th)('colorTextPlaceholder'), (0, _toolkit.th)('fontSizeBaseSmall'));
|
|
43
|
+
var StyledTable = (0, _styledComponents["default"])(_antd.Table)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral([""])));
|
|
44
|
+
var StyledMenuOutlined = (0, _styledComponents["default"])(_icons.MenuOutlined)(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n cursor: move;\n touch-action: none;\n"])));
|
|
45
|
+
var TableBody = function TableBody(_ref) {
|
|
46
|
+
var children = _ref.children,
|
|
47
|
+
className = _ref.className,
|
|
48
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
49
|
+
return /*#__PURE__*/_react["default"].createElement(_reactBeautifulDnd.Droppable, {
|
|
50
|
+
droppableId: "droppable-table"
|
|
51
|
+
}, function (provided, snapshot) {
|
|
52
|
+
return /*#__PURE__*/_react["default"].createElement("tbody", _extends({
|
|
53
|
+
className: className,
|
|
54
|
+
ref: provided.innerRef
|
|
55
|
+
}, props, provided.droppableProps), children, provided.placeholder);
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
var TableRow = function TableRow(_ref2) {
|
|
59
|
+
var children = _ref2.children,
|
|
60
|
+
index = _ref2.index,
|
|
61
|
+
manualSorting = _ref2.manualSorting,
|
|
62
|
+
props = _objectWithoutProperties(_ref2, _excluded2);
|
|
63
|
+
return manualSorting ? /*#__PURE__*/_react["default"].createElement(_reactBeautifulDnd.Draggable, {
|
|
64
|
+
draggableId: props['data-row-key'].toString(),
|
|
65
|
+
index: index,
|
|
66
|
+
key: props['data-row-key']
|
|
67
|
+
}, function (provided, snapshot) {
|
|
68
|
+
return /*#__PURE__*/_react["default"].createElement("tr", _extends({
|
|
69
|
+
ref: provided.innerRef
|
|
70
|
+
}, props, provided.draggableProps, provided.dragHandleProps), _react["default"].Children.map(children, function (child) {
|
|
71
|
+
if (child.key === 'sort') {
|
|
72
|
+
return /*#__PURE__*/_react["default"].cloneElement(child, {
|
|
73
|
+
children: /*#__PURE__*/_react["default"].createElement(StyledMenuOutlined, null)
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
return child;
|
|
77
|
+
}));
|
|
78
|
+
}) : /*#__PURE__*/_react["default"].createElement("tr", props, children);
|
|
79
|
+
};
|
|
80
|
+
TableRow.propTypes = {
|
|
81
|
+
'data-row-key': _propTypes["default"].string.isRequired,
|
|
82
|
+
index: _propTypes["default"].number.isRequired,
|
|
83
|
+
manualSorting: _propTypes["default"].bool.isRequired,
|
|
84
|
+
record: _propTypes["default"].shape({
|
|
85
|
+
id: _propTypes["default"].string
|
|
86
|
+
}).isRequired,
|
|
87
|
+
style: _propTypes["default"].shape().isRequired
|
|
88
|
+
};
|
|
89
|
+
var ReviewerTable = function ReviewerTable(props) {
|
|
90
|
+
var additionalColumns = props.additionalColumns,
|
|
91
|
+
canInviteMore = props.canInviteMore,
|
|
92
|
+
canDismissReviewer = props.canDismissReviewer,
|
|
93
|
+
className = props.className,
|
|
94
|
+
manualSorting = props.manualSorting,
|
|
95
|
+
onChange = props.onChange,
|
|
96
|
+
onInvite = props.onInvite,
|
|
97
|
+
onRemoveRow = props.onRemoveRow,
|
|
98
|
+
onRevokeInvitation = props.onRevokeInvitation,
|
|
99
|
+
reviewers = props.reviewers,
|
|
100
|
+
showEmails = props.showEmails;
|
|
101
|
+
var _useState = (0, _react.useState)({}),
|
|
102
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
103
|
+
tableSorter = _useState2[0],
|
|
104
|
+
setTableSorter = _useState2[1];
|
|
105
|
+
(0, _react.useEffect)(function () {
|
|
106
|
+
setTableSorter(manualSorting ? {} : tableSorter);
|
|
107
|
+
}, [manualSorting]);
|
|
108
|
+
if (reviewers.length === 0) {
|
|
109
|
+
return /*#__PURE__*/_react["default"].createElement(Wrapper, {
|
|
110
|
+
className: className
|
|
111
|
+
}, /*#__PURE__*/_react["default"].createElement(EmptyMessage, null, "No reviewers have been added to the list"));
|
|
112
|
+
}
|
|
113
|
+
var handleChange = function handleChange(pagination, filters, sorter, extra) {
|
|
114
|
+
onChange(extra.currentDataSource);
|
|
115
|
+
setTableSorter(manualSorting ? {} : sorter);
|
|
116
|
+
};
|
|
117
|
+
var onDragEnd = function onDragEnd(result) {
|
|
118
|
+
var destination = result.destination,
|
|
119
|
+
source = result.source;
|
|
120
|
+
if (!destination) return;
|
|
121
|
+
if (destination.droppableId === source.droppableId && destination.index === source.index) return;
|
|
122
|
+
var newDataSource = _toConsumableArray(reviewers);
|
|
123
|
+
var draggedElement = newDataSource.splice(source.index, 1);
|
|
124
|
+
newDataSource.splice.apply(newDataSource, [destination.index, 0].concat(_toConsumableArray(draggedElement)));
|
|
125
|
+
onChange(newDataSource);
|
|
126
|
+
};
|
|
127
|
+
var columns = [].concat(_toConsumableArray(manualSorting ? [{
|
|
128
|
+
key: 'sort'
|
|
129
|
+
}] : []), [{
|
|
130
|
+
title: 'Name',
|
|
131
|
+
dataIndex: 'displayName',
|
|
132
|
+
key: 'displayName',
|
|
133
|
+
sorter: function sorter(a, b) {
|
|
134
|
+
return a.displayName.toLowerCase().localeCompare(b.displayName.toLowerCase());
|
|
135
|
+
},
|
|
136
|
+
sortDirections: ['ascend', 'descend']
|
|
137
|
+
}, {
|
|
138
|
+
title: '',
|
|
139
|
+
dataIndex: 'inviteStatus',
|
|
140
|
+
key: 'inviteStatus',
|
|
141
|
+
render: function render(text, rowData) {
|
|
142
|
+
return /*#__PURE__*/_react["default"].createElement(_InviteRowProp["default"], {
|
|
143
|
+
className: className,
|
|
144
|
+
data: rowData,
|
|
145
|
+
type: "status"
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
}], _toConsumableArray(showEmails ? [{
|
|
149
|
+
title: 'Email',
|
|
150
|
+
dataIndex: 'email',
|
|
151
|
+
key: 'email',
|
|
152
|
+
sorter: function sorter(a, b) {
|
|
153
|
+
return a.email.toLowerCase().localeCompare(b.email.toLowerCase());
|
|
154
|
+
},
|
|
155
|
+
sortDirections: ['ascend', 'descend']
|
|
156
|
+
}] : []), _toConsumableArray(additionalColumns), [{
|
|
157
|
+
title: '',
|
|
158
|
+
dataIndex: 'inviteAction',
|
|
159
|
+
key: 'inviteAction',
|
|
160
|
+
render: function render(text, rowData) {
|
|
161
|
+
return /*#__PURE__*/_react["default"].createElement(_InviteRowProp["default"], {
|
|
162
|
+
canInvite: canInviteMore,
|
|
163
|
+
className: className,
|
|
164
|
+
data: rowData,
|
|
165
|
+
onClickInvite: onInvite,
|
|
166
|
+
onClickRevokeInvitation: onRevokeInvitation,
|
|
167
|
+
type: "action"
|
|
168
|
+
});
|
|
169
|
+
},
|
|
170
|
+
align: 'right'
|
|
171
|
+
}, {
|
|
172
|
+
title: '',
|
|
173
|
+
dataIndex: 'removeRow',
|
|
174
|
+
key: 'removeRow',
|
|
175
|
+
render: function render(text, rowData) {
|
|
176
|
+
return /*#__PURE__*/_react["default"].createElement(_InviteRowProp["default"], {
|
|
177
|
+
canDismissReviewer: canDismissReviewer,
|
|
178
|
+
canInvite: canInviteMore,
|
|
179
|
+
className: className,
|
|
180
|
+
data: rowData,
|
|
181
|
+
onClickRemove: onRemoveRow,
|
|
182
|
+
type: "remove"
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
}]).map(function (col) {
|
|
186
|
+
if (manualSorting) {
|
|
187
|
+
var sorter = col.sorter,
|
|
188
|
+
rest = _objectWithoutProperties(col, _excluded3);
|
|
189
|
+
return _objectSpread(_objectSpread({}, rest), {}, {
|
|
190
|
+
sortOrder: false
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
return _objectSpread(_objectSpread({}, col), {}, {
|
|
194
|
+
sortOrder: tableSorter.columnKey === col.key && tableSorter.order
|
|
195
|
+
});
|
|
196
|
+
});
|
|
197
|
+
var rows = reviewers.map(function (r) {
|
|
198
|
+
return _objectSpread(_objectSpread({}, r), {}, {
|
|
199
|
+
key: r.id
|
|
200
|
+
});
|
|
201
|
+
});
|
|
202
|
+
return /*#__PURE__*/_react["default"].createElement(Wrapper, {
|
|
203
|
+
className: className
|
|
204
|
+
}, /*#__PURE__*/_react["default"].createElement(_reactBeautifulDnd.DragDropContext, {
|
|
205
|
+
onDragEnd: onDragEnd
|
|
206
|
+
}, /*#__PURE__*/_react["default"].createElement(StyledTable, {
|
|
207
|
+
columns: columns,
|
|
208
|
+
components: {
|
|
209
|
+
body: {
|
|
210
|
+
row: TableRow,
|
|
211
|
+
wrapper: TableBody
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
dataSource: rows,
|
|
215
|
+
key: "manual-sorting-".concat(manualSorting),
|
|
216
|
+
onChange: handleChange,
|
|
217
|
+
onRow: function onRow(record, index) {
|
|
218
|
+
return {
|
|
219
|
+
record: record,
|
|
220
|
+
index: index,
|
|
221
|
+
manualSorting: manualSorting
|
|
222
|
+
};
|
|
223
|
+
},
|
|
224
|
+
pagination: false,
|
|
225
|
+
rowKey: "id"
|
|
226
|
+
})));
|
|
227
|
+
};
|
|
228
|
+
ReviewerTable.propTypes = {
|
|
229
|
+
/** Column definitions of type `ColumnsType` from `antd/es/table` */
|
|
230
|
+
additionalColumns: _propTypes["default"].arrayOf(_propTypes["default"].shape({
|
|
231
|
+
title: _propTypes["default"].string.isRequired,
|
|
232
|
+
dataIndex: _propTypes["default"].string.isRequired
|
|
233
|
+
})),
|
|
234
|
+
/** Whether more reviewers can be invited */
|
|
235
|
+
canInviteMore: _propTypes["default"].bool.isRequired,
|
|
236
|
+
/** Whether a reviewer can be removed even after accepting invitation */
|
|
237
|
+
canDismissReviewer: _propTypes["default"].bool,
|
|
238
|
+
/** Enable drag and drop, but also disable auto-sorted columns */
|
|
239
|
+
manualSorting: _propTypes["default"].bool,
|
|
240
|
+
/** Function to run when data is filtered/sorted */
|
|
241
|
+
onChange: _propTypes["default"].func.isRequired,
|
|
242
|
+
/** Function to run when "invite" is clicked on a row from the pool */
|
|
243
|
+
onInvite: _propTypes["default"].func.isRequired,
|
|
244
|
+
/** Function to run when the "X" button is clicked on a row from the pool */
|
|
245
|
+
onRemoveRow: _propTypes["default"].func.isRequired,
|
|
246
|
+
/** Function to run when "revoke invitation" is clicked on a row from the pool */
|
|
247
|
+
onRevokeInvitation: _propTypes["default"].func.isRequired,
|
|
248
|
+
/** List of reviewers */
|
|
249
|
+
reviewers: _propTypes["default"].arrayOf(_propTypes["default"].shape({
|
|
250
|
+
id: _propTypes["default"].string.isRequired,
|
|
251
|
+
displayName: _propTypes["default"].string.isRequired,
|
|
252
|
+
invited: _propTypes["default"].bool,
|
|
253
|
+
acceptedInvitation: _propTypes["default"].bool,
|
|
254
|
+
rejectedInvitation: _propTypes["default"].bool,
|
|
255
|
+
invitationRevoked: _propTypes["default"].bool,
|
|
256
|
+
reviewSubmitted: _propTypes["default"].bool
|
|
257
|
+
})),
|
|
258
|
+
/** Shorthand flag to indicate if the emails should be shown */
|
|
259
|
+
showEmails: _propTypes["default"].bool
|
|
260
|
+
};
|
|
261
|
+
ReviewerTable.defaultProps = {
|
|
262
|
+
additionalColumns: [],
|
|
263
|
+
canDismissReviewer: false,
|
|
264
|
+
manualSorting: false,
|
|
265
|
+
reviewers: [],
|
|
266
|
+
showEmails: false
|
|
267
|
+
};
|
|
268
|
+
var _default = exports["default"] = ReviewerTable;
|