synapse-react-client
Version:
[](https://travis-ci.com/Sage-Bionetworks/Synapse-React-Client) [](https://badge.fury.io/js/synaps
37 lines • 2.33 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EvaluationRoundLimitOptions = exports.LIMIT_TYPE_DISPLAY_NAME = void 0;
var tslib_1 = require("tslib");
var react_1 = (0, tslib_1.__importDefault)(require("react"));
var react_bootstrap_1 = require("react-bootstrap");
exports.LIMIT_TYPE_DISPLAY_NAME = {
// EvaluationRoundLimitType.TOTAL is purposely omitted because an <input> in the parent handles it
DAILY: 'Daily Limit',
WEEKLY: 'Weekly Limit',
MONTHLY: 'Monthly Limit',
};
var EvaluationRoundLimitOptions = function (_a) {
var limitInput = _a.limitInput, allSelectedTypes = _a.allSelectedTypes, onChange = _a.onChange;
return (react_1.default.createElement(react_1.default.Fragment, null,
react_1.default.createElement(react_bootstrap_1.FormGroup, { className: "limit-type" },
react_1.default.createElement("label", null, "Limit Type"),
react_1.default.createElement(react_bootstrap_1.FormControl, { as: "select", custom: true, value: limitInput.type, onChange: function (event) {
onChange({
type: event.target.value,
maxSubmissionString: limitInput.maxSubmissionString,
});
} }, Object.entries(exports.LIMIT_TYPE_DISPLAY_NAME).map(function (_a) {
var displayLimitType = _a[0], displayName = _a[1];
return (react_1.default.createElement("option", { key: displayLimitType, value: displayLimitType, disabled: allSelectedTypes.has(displayLimitType) && displayLimitType !== limitInput.type }, displayName));
}))),
react_1.default.createElement(react_bootstrap_1.FormGroup, { className: "limit-input" },
react_1.default.createElement("label", null, "Maximum Submissions"),
react_1.default.createElement(react_bootstrap_1.FormControl, { type: "text", pattern: "[0-9]*", value: limitInput.maxSubmissionString, onChange: function (event) {
onChange({
type: limitInput.type,
maxSubmissionString: event.target.value,
});
} }))));
};
exports.EvaluationRoundLimitOptions = EvaluationRoundLimitOptions;
//# sourceMappingURL=EvaluationRoundLimitOptions.js.map