lhcb-ntuple-wizard 1.0.2 → 1.0.4

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.
Files changed (37) hide show
  1. package/dist/components/App.js +81 -94
  2. package/dist/components/ConfigDict.js +60 -74
  3. package/dist/components/ConfigList.js +61 -82
  4. package/dist/components/ConfigNode.js +237 -259
  5. package/dist/components/ConfigValue.js +54 -68
  6. package/dist/components/Dataset.js +46 -61
  7. package/dist/components/Decay.js +33 -46
  8. package/dist/components/DecayItem.js +55 -81
  9. package/dist/components/DecayTag.js +32 -47
  10. package/dist/components/DecayTree.js +278 -344
  11. package/dist/components/DecaysList.js +73 -90
  12. package/dist/components/DeleteButton.js +36 -49
  13. package/dist/components/DescriptorsSearch.js +217 -280
  14. package/dist/components/EventTypeBadge.js +27 -43
  15. package/dist/components/ItemSearch.js +85 -112
  16. package/dist/components/LinesTable.js +796 -971
  17. package/dist/components/NtupleWizard.js +90 -109
  18. package/dist/components/ParticleTag.js +32 -47
  19. package/dist/components/PolarityBadge.js +20 -33
  20. package/dist/components/SearchItem.js +72 -102
  21. package/dist/components/SelectParticle.js +39 -72
  22. package/dist/components/SelectTag.js +44 -66
  23. package/dist/components/SelectTool.js +38 -59
  24. package/dist/components/SelectVariables.js +79 -107
  25. package/dist/components/StrippingBadge.js +40 -54
  26. package/dist/components/StrippingLine.js +30 -48
  27. package/dist/components/TupleTool.js +27 -40
  28. package/dist/components/VariablesSearch.js +95 -122
  29. package/dist/components/YearBadge.js +20 -33
  30. package/dist/config.json +1 -14
  31. package/dist/contexts/MetadataContext.js +52 -80
  32. package/dist/lib/BKPath.js +35 -60
  33. package/dist/lib/DTTConfig.js +144 -183
  34. package/dist/lib/analysisHelpers.js +2 -3
  35. package/dist/lib/mathjax.js +4 -5
  36. package/dist/lib/utils.js +61 -98
  37. package/package.json +8 -7
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
@@ -13,100 +12,88 @@ var _config = _interopRequireDefault(require("../config"));
13
12
  var _NtupleWizard = _interopRequireDefault(require("./NtupleWizard"));
14
13
  var _jsxRuntime = require("react/jsx-runtime");
15
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
17
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
18
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
19
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
20
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
21
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
22
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
23
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
24
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
25
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
26
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
27
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
28
- var App = /*#__PURE__*/function (_React$Component) {
29
- _inherits(App, _React$Component);
30
- var _super = _createSuper(App);
31
- function App() {
32
- _classCallCheck(this, App);
33
- return _super.apply(this, arguments);
34
- }
35
- _createClass(App, [{
36
- key: "render",
37
- value: function render() {
38
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
39
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Navbar, {
40
- collapseOnSelect: true,
41
- expand: "lg",
42
- bg: "dark",
43
- variant: "dark",
44
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Container, {
45
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Navbar.Brand, {
46
- href: "/",
47
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
48
- src: "/logo.svg",
49
- height: "30",
50
- className: "d-inline-block align-top",
51
- alt: "LHCb logo"
52
- }), " ", "LHCb NTuple Wizard"]
53
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Navbar.Toggle, {
54
- "aria-controls": "responsive-navbar-nav"
55
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Navbar.Collapse, {
56
- className: "justify-content-end",
57
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Nav, {
58
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.NavDropdown, {
59
- title: "About",
60
- id: "about-dropdown",
61
- menuVariant: "dark",
62
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.NavDropdown.Item, {
63
- href: "https://lhcb-dpa.web.cern.ch/lhcb-dpa/wp6/ntupling-wizard.html",
64
- target: "_blank",
65
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrapIcons.House, {}), " Project home"]
66
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.NavDropdown.Item, {
67
- href: "https://gitlab.cern.ch/lhcb-dpa/wp6-analysis-preservation-and-open-data/lhcb-ntuple-wizard-frontend",
68
- target: "_blank",
69
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrapIcons.CodeSlash, {}), " Source code"]
70
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.NavDropdown.Item, {
71
- href: _config.default.metadata_baseurl,
72
- target: "_blank",
73
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrapIcons.Archive, {}), " Metadata files"]
74
- })]
75
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Nav.Link, {
76
- href: "https://opendata.cern.ch/",
15
+ /*****************************************************************************\
16
+ * (c) Copyright 2021 CERN for the benefit of the LHCb Collaboration *
17
+ * *
18
+ * This software is distributed under the terms of the GNU General Public *
19
+ * Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". *
20
+ * *
21
+ * In applying this licence, CERN does not waive the privileges and immunities *
22
+ * granted to it by virtue of its status as an Intergovernmental Organization *
23
+ * or submit itself to any jurisdiction. *
24
+ \*****************************************************************************/
25
+
26
+ class App extends _react.default.Component {
27
+ render() {
28
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
29
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Navbar, {
30
+ collapseOnSelect: true,
31
+ expand: "lg",
32
+ bg: "dark",
33
+ variant: "dark",
34
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Container, {
35
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Navbar.Brand, {
36
+ href: "/",
37
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
38
+ src: "/logo.svg",
39
+ height: "30",
40
+ className: "d-inline-block align-top",
41
+ alt: "LHCb logo"
42
+ }), " ", "LHCb NTuple Wizard"]
43
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Navbar.Toggle, {
44
+ "aria-controls": "responsive-navbar-nav"
45
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Navbar.Collapse, {
46
+ className: "justify-content-end",
47
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Nav, {
48
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.NavDropdown, {
49
+ title: "About",
50
+ id: "about-dropdown",
51
+ menuVariant: "dark",
52
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.NavDropdown.Item, {
53
+ href: "https://lhcb-dpa.web.cern.ch/lhcb-dpa/wp6/ntupling-wizard.html",
54
+ target: "_blank",
55
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrapIcons.House, {}), " Project home"]
56
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.NavDropdown.Item, {
57
+ href: "https://gitlab.cern.ch/lhcb-dpa/wp6-analysis-preservation-and-open-data/lhcb-ntuple-wizard-frontend",
77
58
  target: "_blank",
78
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
79
- src: "/open_data_portal.png",
80
- height: "30",
81
- alt: "CERN Open Data Portal"
82
- })
59
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrapIcons.CodeSlash, {}), " Source code"]
60
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.NavDropdown.Item, {
61
+ href: _config.default.metadata_baseurl,
62
+ target: "_blank",
63
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrapIcons.Archive, {}), " Metadata files"]
83
64
  })]
84
- })
85
- })]
86
- })
87
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Container, {
88
- className: "mt-4",
89
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_NtupleWizard.default, {
90
- basePath: "/",
91
- decaysPath: "/decays",
92
- variablesPath: "/variables",
93
- submitLocation: "" // Leave empty to hide the submit button -> overrides hideDownloadButtons to false
94
- ,
95
- contactEmail: "" // Leave empty to let the user fill in their email address
96
- ,
97
- hideDownloadButtons: false // Can be overridden by submitLocation
98
- ,
99
- hideUploadButtons: false,
100
- requestReasonMessage: "Please provide a reason for your request.",
101
- requestSubmittedMessage: /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
102
- children: "Your request has been submitted."
65
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Nav.Link, {
66
+ href: "https://opendata.cern.ch/",
67
+ target: "_blank",
68
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
69
+ src: "/open_data_portal.png",
70
+ height: "30",
71
+ alt: "CERN Open Data Portal"
72
+ })
73
+ })]
103
74
  })
75
+ })]
76
+ })
77
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Container, {
78
+ className: "mt-4",
79
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_NtupleWizard.default, {
80
+ basePath: "/",
81
+ decaysPath: "/decays",
82
+ variablesPath: "/variables",
83
+ submitLocation: "" // Leave empty to hide the submit button -> overrides hideDownloadButtons to false
84
+ ,
85
+ contactEmail: "" // Leave empty to let the user fill in their email address
86
+ ,
87
+ hideDownloadButtons: false // Can be overridden by submitLocation
88
+ ,
89
+ hideUploadButtons: false,
90
+ requestReasonMessage: "Please provide a reason for your request.",
91
+ requestSubmittedMessage: /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
92
+ children: "Your request has been submitted."
104
93
  })
105
- })]
106
- });
107
- }
108
- }]);
109
- return App;
110
- }(_react.default.Component);
111
- var _default = App;
112
- exports.default = _default;
94
+ })
95
+ })]
96
+ });
97
+ }
98
+ }
99
+ var _default = exports.default = App;
@@ -9,109 +9,95 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
9
9
  var _reactBootstrap = require("react-bootstrap");
10
10
  var _jsxRuntime = require("react/jsx-runtime");
11
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
13
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
14
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
15
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
16
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
17
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
18
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
19
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
20
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
21
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
22
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
23
12
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
24
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
25
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
13
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
14
+ 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); } /*****************************************************************************\
15
+ * (c) Copyright 2021 CERN for the benefit of the LHCb Collaboration *
16
+ * *
17
+ * This software is distributed under the terms of the GNU General Public *
18
+ * Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". *
19
+ * *
20
+ * In applying this licence, CERN does not waive the privileges and immunities *
21
+ * granted to it by virtue of its status as an Intergovernmental Organization *
22
+ * or submit itself to any jurisdiction. *
23
+ \*****************************************************************************/ //import ConfigValue from "./ConfigValue";
26
24
  /*
27
25
  * {str:str} -> <ConfigDict /> multiple rows of <input type="text" /> <input type="text" />
28
26
  * {str:text} -> <ConfigDict /> multiple rows of <input type="text" /> <textarea />
29
- */
30
- /*
27
+ */ /*
31
28
  * Keys have to be unique and not empty...
32
29
  * this may cause problems if the callback is executed on every keystroke
33
30
  */
34
- var ConfigDict = /*#__PURE__*/function (_React$Component) {
35
- _inherits(ConfigDict, _React$Component);
36
- var _super = _createSuper(ConfigDict);
37
- function ConfigDict() {
38
- var _this;
39
- _classCallCheck(this, ConfigDict);
40
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
41
- args[_key] = arguments[_key];
42
- }
43
- _this = _super.call.apply(_super, [this].concat(args));
44
- _defineProperty(_assertThisInitialized(_this), "state", {
45
- value: JSON.stringify(_this.props.value, null, 2),
31
+ class ConfigDict extends _react.default.Component {
32
+ constructor() {
33
+ super(...arguments);
34
+ _defineProperty(this, "state", {
35
+ value: JSON.stringify(this.props.value, null, 2),
46
36
  // Object.keys(this.props.value).map((key) => [key, this.props.value[key].valueOf()]),
47
37
  edit: false,
48
38
  error: ""
49
39
  });
50
- _defineProperty(_assertThisInitialized(_this), "toggleEdit", function () {
51
- _this.setState({
52
- edit: !_this.state.edit
40
+ _defineProperty(this, "toggleEdit", () => {
41
+ this.setState({
42
+ edit: !this.state.edit
53
43
  });
54
44
  });
55
- _defineProperty(_assertThisInitialized(_this), "handleSave", function () {
45
+ _defineProperty(this, "handleSave", () => {
56
46
  try {
57
- var value = JSON.parse(_this.state.value);
58
- _this.props.callback(value);
59
- _this.setState({
47
+ const value = JSON.parse(this.state.value);
48
+ this.props.callback(value);
49
+ this.setState({
60
50
  error: ""
61
51
  });
62
- _this.setState({
52
+ this.setState({
63
53
  edit: false
64
54
  });
65
55
  } catch (e) {
66
- _this.setState({
56
+ this.setState({
67
57
  error: "".concat(e)
68
58
  });
69
59
  }
70
60
  });
71
- _defineProperty(_assertThisInitialized(_this), "handleUpdate", function (event) {
72
- var value = event.target.value;
73
- _this.setState({
61
+ _defineProperty(this, "handleUpdate", event => {
62
+ const {
63
+ value
64
+ } = event.target;
65
+ this.setState({
74
66
  value: value
75
67
  });
76
68
  });
77
- return _this;
78
69
  }
79
- _createClass(ConfigDict, [{
80
- key: "render",
81
- value: function render() {
82
- var errorMessage = this.state.error ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Alert, {
83
- variant: "danger",
84
- children: this.state.error
85
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {});
86
- var buttonLabel = this.state.edit ? "Cancel" : "Edit";
87
- var saveButton = this.state.edit ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Button, {
88
- variant: "primary",
89
- onClick: this.handleSave,
90
- children: "Save"
91
- }) : "";
92
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Card, {
93
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Card.Body, {
94
- children: [errorMessage, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.FormControl, {
95
- as: "textarea",
96
- value: this.state.value,
97
- onChange: this.handleUpdate,
98
- disabled: !this.state.edit
99
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.ButtonGroup, {
100
- children: [saveButton, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Button, {
101
- variant: "outline-secondary",
102
- onClick: this.toggleEdit,
103
- children: buttonLabel
104
- })]
70
+ render() {
71
+ const errorMessage = this.state.error ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Alert, {
72
+ variant: "danger",
73
+ children: this.state.error
74
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {});
75
+ const buttonLabel = this.state.edit ? "Cancel" : "Edit";
76
+ const saveButton = this.state.edit ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Button, {
77
+ variant: "primary",
78
+ onClick: this.handleSave,
79
+ children: "Save"
80
+ }) : "";
81
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Card, {
82
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Card.Body, {
83
+ children: [errorMessage, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.FormControl, {
84
+ as: "textarea",
85
+ value: this.state.value,
86
+ onChange: this.handleUpdate,
87
+ disabled: !this.state.edit
88
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.ButtonGroup, {
89
+ children: [saveButton, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Button, {
90
+ variant: "outline-secondary",
91
+ onClick: this.toggleEdit,
92
+ children: buttonLabel
105
93
  })]
106
- })
107
- });
108
- }
109
- }]);
110
- return ConfigDict;
111
- }(_react.default.Component);
94
+ })]
95
+ })
96
+ });
97
+ }
98
+ }
112
99
  ConfigDict.propTypes = {
113
100
  value: _propTypes.default.oneOfType([_propTypes.default.objectOf(_propTypes.default.string), _propTypes.default.objectOf(_propTypes.default.arrayOf(_propTypes.default.string))]),
114
101
  callback: _propTypes.default.func
115
102
  };
116
- var _default = ConfigDict;
117
- exports.default = _default;
103
+ var _default = exports.default = ConfigDict;
@@ -11,105 +11,84 @@ var _reactBootstrap = require("react-bootstrap");
11
11
  var _reactBootstrapIcons = require("react-bootstrap-icons");
12
12
  var _jsxRuntime = require("react/jsx-runtime");
13
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
15
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
16
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
17
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
18
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
19
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
20
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
21
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
22
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
23
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
24
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
25
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
26
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
27
14
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
28
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
29
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
30
- /*
15
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
16
+ 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); } /*****************************************************************************\
17
+ * (c) Copyright 2021 CERN for the benefit of the LHCb Collaboration *
18
+ * *
19
+ * This software is distributed under the terms of the GNU General Public *
20
+ * Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". *
21
+ * *
22
+ * In applying this licence, CERN does not waive the privileges and immunities *
23
+ * granted to it by virtue of its status as an Intergovernmental Organization *
24
+ * or submit itself to any jurisdiction. *
25
+ \*****************************************************************************/ /*
31
26
  * [int] -> <ConfigList /> multiple rows of <input type="number" step=1 />
32
27
  * [uint] -> <ConfigList /> multiple rows of <input type="number" step=1 min=0 />
33
28
  * [float] -> <ConfigList /> multiple rows of <input type="number" />
34
29
  */
35
- var ConfigList = /*#__PURE__*/function (_React$Component) {
36
- _inherits(ConfigList, _React$Component);
37
- var _super = _createSuper(ConfigList);
38
- function ConfigList() {
39
- var _this;
40
- _classCallCheck(this, ConfigList);
41
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
42
- args[_key] = arguments[_key];
43
- }
44
- _this = _super.call.apply(_super, [this].concat(args));
45
- _defineProperty(_assertThisInitialized(_this), "handleUpdate", function (index) {
46
- return function (value) {
47
- var listValue = _this.props.value;
48
- listValue[index] = value;
49
- _this.props.callback(listValue);
50
- };
30
+ class ConfigList extends _react.default.Component {
31
+ constructor() {
32
+ super(...arguments);
33
+ _defineProperty(this, "handleUpdate", index => value => {
34
+ let listValue = this.props.value;
35
+ listValue[index] = value;
36
+ this.props.callback(listValue);
51
37
  });
52
- _defineProperty(_assertThisInitialized(_this), "handleAdd", function () {
53
- var listValue = _this.props.value;
54
- var index = listValue.length;
55
- if (index < _this.props.defaultValue.length) {
56
- var defaultValue = _this.props.defaultValue[index].valueOf(); // Shallow copy
38
+ _defineProperty(this, "handleAdd", () => {
39
+ let listValue = this.props.value;
40
+ const index = listValue.length;
41
+ if (index < this.props.defaultValue.length) {
42
+ const defaultValue = this.props.defaultValue[index].valueOf(); // Shallow copy
57
43
  listValue.push(defaultValue);
58
44
  } else {
59
45
  listValue.push(0);
60
46
  }
61
- _this.props.callback(listValue);
47
+ this.props.callback(listValue);
48
+ });
49
+ _defineProperty(this, "handleRemove", index => () => {
50
+ let listValue = this.props.value;
51
+ listValue.splice(index, 1);
52
+ this.props.callback(listValue);
62
53
  });
63
- _defineProperty(_assertThisInitialized(_this), "handleRemove", function (index) {
64
- return function () {
65
- var listValue = _this.props.value;
66
- listValue.splice(index, 1);
67
- _this.props.callback(listValue);
54
+ }
55
+ render() {
56
+ const configurables = this.props.value.map((value, index) => {
57
+ const configProps = {
58
+ type: this.props.type,
59
+ value: this.props.value[index],
60
+ callback: this.handleUpdate(index)
68
61
  };
62
+ if (index < this.props.defaultValue.length) {
63
+ configProps["defaultValue"] = this.props.defaultValue[index];
64
+ }
65
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.ListGroup.Item, {
66
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.InputGroup, {
67
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ConfigValue.default, {
68
+ ...configProps
69
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.CloseButton, {
70
+ onClick: this.handleRemove(index)
71
+ })]
72
+ })
73
+ }, index);
74
+ });
75
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
76
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.ListGroup, {
77
+ variant: "flush",
78
+ children: configurables
79
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Button, {
80
+ variant: "success",
81
+ size: "sm",
82
+ onClick: this.handleAdd,
83
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrapIcons.PlusLg, {})
84
+ })]
69
85
  });
70
- return _this;
71
86
  }
72
- _createClass(ConfigList, [{
73
- key: "render",
74
- value: function render() {
75
- var _this2 = this;
76
- var configurables = this.props.value.map(function (value, index) {
77
- var configProps = {
78
- type: _this2.props.type,
79
- value: _this2.props.value[index],
80
- callback: _this2.handleUpdate(index)
81
- };
82
- if (index < _this2.props.defaultValue.length) {
83
- configProps["defaultValue"] = _this2.props.defaultValue[index];
84
- }
85
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.ListGroup.Item, {
86
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.InputGroup, {
87
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ConfigValue.default, _objectSpread({}, configProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.CloseButton, {
88
- onClick: _this2.handleRemove(index)
89
- })]
90
- })
91
- }, index);
92
- });
93
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
94
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.ListGroup, {
95
- variant: "flush",
96
- children: configurables
97
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Button, {
98
- variant: "success",
99
- size: "sm",
100
- onClick: this.handleAdd,
101
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrapIcons.PlusLg, {})
102
- })]
103
- });
104
- }
105
- }]);
106
- return ConfigList;
107
- }(_react.default.Component);
87
+ }
108
88
  ConfigList.propTypes = {
109
89
  type: _propTypes.default.string,
110
90
  callback: _propTypes.default.func,
111
91
  value: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.bool, _propTypes.default.number, _propTypes.default.arrayOf(_propTypes.default.string)]),
112
92
  defaultValue: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.bool, _propTypes.default.number, _propTypes.default.arrayOf(_propTypes.default.string)])
113
93
  };
114
- var _default = ConfigList;
115
- exports.default = _default;
94
+ var _default = exports.default = ConfigList;