lhcb-ntuple-wizard-test 0.0.1

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 (41) hide show
  1. package/COPYING +674 -0
  2. package/README.md +79 -0
  3. package/dist/components/App.js +99 -0
  4. package/dist/components/ConfigDict.js +103 -0
  5. package/dist/components/ConfigList.js +94 -0
  6. package/dist/components/ConfigNode.js +323 -0
  7. package/dist/components/ConfigValue.js +85 -0
  8. package/dist/components/Dataset.js +67 -0
  9. package/dist/components/Decay.js +51 -0
  10. package/dist/components/DecayItem.js +101 -0
  11. package/dist/components/DecayTag.js +50 -0
  12. package/dist/components/DecayTree.js +452 -0
  13. package/dist/components/DecaysList.js +108 -0
  14. package/dist/components/DeleteButton.js +56 -0
  15. package/dist/components/DescriptorsSearch.js +351 -0
  16. package/dist/components/EventTypeBadge.js +42 -0
  17. package/dist/components/ItemSearch.js +119 -0
  18. package/dist/components/LinesTable.js +1111 -0
  19. package/dist/components/NtupleWizard.js +141 -0
  20. package/dist/components/ParticleTag.js +52 -0
  21. package/dist/components/PolarityBadge.js +35 -0
  22. package/dist/components/SearchItem.js +100 -0
  23. package/dist/components/SelectParticle.js +61 -0
  24. package/dist/components/SelectTag.js +66 -0
  25. package/dist/components/SelectTool.js +59 -0
  26. package/dist/components/SelectVariables.js +105 -0
  27. package/dist/components/StrippingBadge.js +62 -0
  28. package/dist/components/StrippingLine.js +48 -0
  29. package/dist/components/TupleTool.js +46 -0
  30. package/dist/components/VariablesSearch.js +127 -0
  31. package/dist/components/YearBadge.js +35 -0
  32. package/dist/config.json +70 -0
  33. package/dist/contexts/MetadataContext.js +134 -0
  34. package/dist/index.js +18 -0
  35. package/dist/lib/BKPath.js +58 -0
  36. package/dist/lib/DTTConfig.js +174 -0
  37. package/dist/lib/analysisHelpers.js +30 -0
  38. package/dist/lib/mathjax.js +35 -0
  39. package/dist/lib/utils.js +191 -0
  40. package/dist/style/DecaysList.css +15 -0
  41. package/package.json +66 -0
@@ -0,0 +1,141 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ require("bootstrap/dist/css/bootstrap.css");
8
+ var _lodash = _interopRequireDefault(require("lodash"));
9
+ var _propTypes = _interopRequireDefault(require("prop-types"));
10
+ var _react = _interopRequireDefault(require("react"));
11
+ var _reactRouterDom = require("react-router-dom");
12
+ var _MetadataContext = require("../contexts/MetadataContext");
13
+ var _DescriptorsSearch = _interopRequireDefault(require("./DescriptorsSearch"));
14
+ var _LinesTable = _interopRequireDefault(require("./LinesTable"));
15
+ var _SelectVariables = _interopRequireDefault(require("./SelectVariables"));
16
+ var _jsxRuntime = require("react/jsx-runtime");
17
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
+ 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; }
19
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
20
+ 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); } /*****************************************************************************\
21
+ * (c) Copyright 2021 CERN for the benefit of the LHCb Collaboration *
22
+ * *
23
+ * This software is distributed under the terms of the GNU General Public *
24
+ * Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". *
25
+ * *
26
+ * In applying this licence, CERN does not waive the privileges and immunities *
27
+ * granted to it by virtue of its status as an Intergovernmental Organization *
28
+ * or submit itself to any jurisdiction. *
29
+ \*****************************************************************************/
30
+ class NtupleWizard extends _react.default.Component {
31
+ constructor() {
32
+ super(...arguments);
33
+ _defineProperty(this, "state", {
34
+ rows: JSON.parse(localStorage.getItem("rows") || "[]"),
35
+ productionName: localStorage.getItem("name") || "",
36
+ contactEmail: (localStorage.getItem("email") || "").split(/,/).filter(s => s),
37
+ reasonForRequest: localStorage.getItem("reasonForRequest") || ""
38
+ });
39
+ _defineProperty(this, "callbackUpdateRows", rows => {
40
+ const newRows = rows.map(row => ({
41
+ ...row,
42
+ dtt: row.dtt ? _lodash.default.cloneDeep(row.dtt.config) : false
43
+ }));
44
+ this.setState({
45
+ rows: newRows
46
+ });
47
+ const rowString = JSON.stringify(newRows);
48
+ localStorage.setItem("rows", rowString);
49
+ });
50
+ _defineProperty(this, "callbackUpdateInfo", (name, email, reasonForRequest) => {
51
+ this.setState({
52
+ productionName: name,
53
+ contactEmail: email,
54
+ reasonForRequest: reasonForRequest
55
+ });
56
+ localStorage.setItem("name", name);
57
+ localStorage.setItem("email", email.join(","));
58
+ localStorage.setItem("reasonForRequest", reasonForRequest);
59
+ });
60
+ }
61
+ render() {
62
+ let {
63
+ basePath,
64
+ decaysPath,
65
+ variablesPath,
66
+ contactEmail,
67
+ submitLocation,
68
+ hideDownloadButtons,
69
+ hideUploadButtons,
70
+ requestReasonMessage,
71
+ requestSubmittedMessage
72
+ } = this.props;
73
+ let emailIsKnown = false;
74
+ if (contactEmail) {
75
+ localStorage.setItem("email", contactEmail);
76
+ emailIsKnown = true;
77
+ }
78
+ if (!submitLocation) {
79
+ hideDownloadButtons = false;
80
+ }
81
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_MetadataContext.MetadataProvider, {
82
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.BrowserRouter, {
83
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactRouterDom.Switch, {
84
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.Route, {
85
+ exact: true,
86
+ path: basePath,
87
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_LinesTable.default, {
88
+ parentCallbackRows: this.callbackUpdateRows,
89
+ parentCallbackInfo: this.callbackUpdateInfo,
90
+ rows: this.state.rows,
91
+ name: this.state.productionName,
92
+ email: this.state.contactEmail,
93
+ reasonForRequest: this.state.reasonForRequest,
94
+ decaysPath: decaysPath,
95
+ variablesPath: variablesPath,
96
+ submitLocation: submitLocation,
97
+ hideDownloadButtons: hideDownloadButtons,
98
+ hideUploadButtons: hideUploadButtons,
99
+ emailIsKnown: emailIsKnown,
100
+ requestReasonMessage: requestReasonMessage,
101
+ requestSubmittedMessage: requestSubmittedMessage,
102
+ csrfToken: this.props.csrfToken
103
+ })
104
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.Route, {
105
+ exact: true,
106
+ path: decaysPath,
107
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DescriptorsSearch.default, {
108
+ parentCallback: this.callbackUpdateRows,
109
+ rows: this.state.rows,
110
+ basePath: basePath
111
+ })
112
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.Route, {
113
+ exact: true,
114
+ path: variablesPath,
115
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_SelectVariables.default, {
116
+ parentCallback: this.callbackUpdateRows,
117
+ rows: this.state.rows,
118
+ basePath: basePath
119
+ })
120
+ })]
121
+ })
122
+ })
123
+ });
124
+ }
125
+ }
126
+ NtupleWizard.propTypes = {
127
+ basePath: _propTypes.default.string.isRequired,
128
+ decaysPath: _propTypes.default.string.isRequired,
129
+ variablesPath: _propTypes.default.string.isRequired,
130
+ contactEmail: _propTypes.default.string,
131
+ submitLocation: _propTypes.default.string,
132
+ hideDownloadButtons: _propTypes.default.bool,
133
+ hideUploadButtons: _propTypes.default.bool,
134
+ requestReasonMessage: _propTypes.default.string,
135
+ requestSubmittedMessage: _propTypes.default.object,
136
+ csrfToken: _propTypes.default.string
137
+ };
138
+ NtupleWizard.defaultProps = {
139
+ csrfToken: ""
140
+ };
141
+ var _default = exports.default = NtupleWizard;
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = exports.ParticleTag = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _propTypes = _interopRequireDefault(require("prop-types"));
9
+ var _reactBootstrap = require("react-bootstrap");
10
+ var _MetadataContext = _interopRequireDefault(require("../contexts/MetadataContext"));
11
+ var _config = _interopRequireDefault(require("../config"));
12
+ var _jsxRuntime = require("react/jsx-runtime");
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
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; }
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
+ \*****************************************************************************/
26
+ class ParticleTag extends _react.default.Component {
27
+ render() {
28
+ const background = this.context.loaded.userHints ? _config.default.particleTagGroupStyles[this.context.metadata.userHints.particleTags[this.props.tag].group] : "dark";
29
+ const foreground = "light";
30
+ const description = this.context.loaded.userHints ? this.context.metadata.userHints.particleTags[this.props.tag].description : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Spinner, {
31
+ animation: "border"
32
+ });
33
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.OverlayTrigger, {
34
+ overlay: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Tooltip, {
35
+ children: description
36
+ }),
37
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Badge, {
38
+ pill: true,
39
+ bg: background,
40
+ text: foreground,
41
+ ...this.props,
42
+ children: this.props.tag
43
+ })
44
+ });
45
+ }
46
+ }
47
+ exports.ParticleTag = ParticleTag;
48
+ _defineProperty(ParticleTag, "contextType", _MetadataContext.default);
49
+ ParticleTag.propTypes = {
50
+ tag: _propTypes.default.string
51
+ };
52
+ var _default = exports.default = ParticleTag;
@@ -0,0 +1,35 @@
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 _reactBootstrap = require("react-bootstrap");
10
+ var _jsxRuntime = require("react/jsx-runtime");
11
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+ /*****************************************************************************\
13
+ * (c) Copyright 2021 CERN for the benefit of the LHCb Collaboration *
14
+ * *
15
+ * This software is distributed under the terms of the GNU General Public *
16
+ * Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". *
17
+ * *
18
+ * In applying this licence, CERN does not waive the privileges and immunities *
19
+ * granted to it by virtue of its status as an Intergovernmental Organization *
20
+ * or submit itself to any jurisdiction. *
21
+ \*****************************************************************************/
22
+
23
+ class PolarityBadge extends _react.default.Component {
24
+ render() {
25
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Badge, {
26
+ pill: true,
27
+ bg: "danger",
28
+ children: this.props.polarity
29
+ });
30
+ }
31
+ }
32
+ PolarityBadge.propTypes = {
33
+ polarity: _propTypes.default.arrayOf(_propTypes.default.string)
34
+ };
35
+ var _default = exports.default = PolarityBadge;
@@ -0,0 +1,100 @@
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 _reactSelect = _interopRequireDefault(require("react-select"));
10
+ var _Tooltip = _interopRequireDefault(require("react-bootstrap/Tooltip"));
11
+ var _OverlayTrigger = _interopRequireDefault(require("react-bootstrap/OverlayTrigger"));
12
+ var _jsxRuntime = require("react/jsx-runtime");
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
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; }
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
+ \*****************************************************************************/
26
+ function compare(a, b) {
27
+ return a.value > b.value ? 1 : b.value > a.value ? -1 : 0;
28
+ }
29
+ class SearchItem extends _react.default.Component {
30
+ constructor() {
31
+ super(...arguments);
32
+ _defineProperty(this, "state", {
33
+ variables: this.variablesOptions(this.props.variables)
34
+ });
35
+ _defineProperty(this, "onInputChange", inputValue => {
36
+ const nInclOptions = this.state.variables.filter(variable => !variable.value.toLowerCase().includes(inputValue.toLowerCase()));
37
+ const inclOptions = this.state.variables.filter(variable => variable.value.toLowerCase().includes(inputValue.toLowerCase()) && variable.value.toLowerCase() !== inputValue.toLowerCase());
38
+ const matchedOptions = this.state.variables.filter(variable => variable.value.toLowerCase() === inputValue.toLowerCase());
39
+ const orderedNewOptions = matchedOptions.sort(compare);
40
+ this.setState({
41
+ variables: orderedNewOptions.concat(inclOptions).concat(nInclOptions)
42
+ });
43
+ });
44
+ _defineProperty(this, "customSelectStyles", {
45
+ option: (provided, state) => ({
46
+ ...provided,
47
+ borderBottom: "3px dotted red",
48
+ color: state.isSelected ? "red" : "blue",
49
+ padding: 10,
50
+ width: 535
51
+ }),
52
+ menu: styles => ({
53
+ ...styles,
54
+ width: "540px",
55
+ height: "35px"
56
+ })
57
+ });
58
+ }
59
+ variablesOptions(variables) {
60
+ let result_options = [];
61
+ //const options = list_to_options(variables)
62
+ Object.keys(variables).forEach(variable => {
63
+ let value = variable;
64
+ let label = /*#__PURE__*/(0, _jsxRuntime.jsx)(_OverlayTrigger.default, {
65
+ placement: "left",
66
+ delay: {
67
+ hide: 450,
68
+ show: 300
69
+ },
70
+ overlay: props => /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, {
71
+ ...props,
72
+ children: variables[variable]
73
+ }),
74
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
75
+ children: variable
76
+ })
77
+ });
78
+ result_options.push({
79
+ value: value,
80
+ label: label
81
+ });
82
+ });
83
+ return result_options;
84
+ }
85
+ render() {
86
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
87
+ width: "20px",
88
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactSelect.default, {
89
+ isMulti: true,
90
+ options: this.state.variables.sort((a, b) => a.value - b.value),
91
+ styles: this.customSelectStyles,
92
+ onInputChange: this.onInputChange
93
+ })
94
+ });
95
+ }
96
+ }
97
+ SearchItem.propTypes = {
98
+ variables: _propTypes.default.arrayOf(_propTypes.default.object)
99
+ };
100
+ var _default = exports.default = SearchItem;
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var React = _interopRequireWildcard(require("react"));
8
+ var _propTypes = _interopRequireDefault(require("prop-types"));
9
+ var _mathjaxReact = require("mathjax-react");
10
+ var _reactSelect = _interopRequireDefault(require("react-select"));
11
+ var _MetadataContext = _interopRequireDefault(require("../contexts/MetadataContext"));
12
+ var _jsxRuntime = require("react/jsx-runtime");
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
15
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
16
+ 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; }
17
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
18
+ 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); } /*****************************************************************************\
19
+ * (c) Copyright 2021 CERN for the benefit of the LHCb Collaboration *
20
+ * *
21
+ * This software is distributed under the terms of the GNU General Public *
22
+ * Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". *
23
+ * *
24
+ * In applying this licence, CERN does not waive the privileges and immunities *
25
+ * granted to it by virtue of its status as an Intergovernmental Organization *
26
+ * or submit itself to any jurisdiction. *
27
+ \*****************************************************************************/
28
+ class SelectParticle extends React.Component {
29
+ constructor() {
30
+ super(...arguments);
31
+ _defineProperty(this, "allowedParticles", () => this.props.onlyHeads ? [...new Set(Object.values(this.context.metadata.decays).map(decay => decay.descriptors.list[0]))] : this.props.onlyKnown ? Object.keys(this.context.metadata.particleProperties).filter(key => !this.context.metadata.particleProperties[key].hide) : Object.keys(this.context.metadata.particleProperties));
32
+ }
33
+ render() {
34
+ let remainingProps = this.props;
35
+ delete remainingProps.options;
36
+ const loaded = this.context.loaded.particleProperties && (!this.props.onlyHeads || this.context.loaded.decays);
37
+ const options = loaded ? this.allowedParticles().map(key => Object({
38
+ value: key,
39
+ label: /*#__PURE__*/(0, _jsxRuntime.jsx)(_mathjaxReact.MathComponent, {
40
+ tex: this.context.metadata.particleProperties[key]["latex"],
41
+ display: false
42
+ })
43
+ })) : [];
44
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
45
+ className: "react-select form-control p-0",
46
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactSelect.default, {
47
+ options: options,
48
+ isLoading: !loaded,
49
+ filterOption: (candidate, input) => candidate.value.toLowerCase().startsWith(input.toLowerCase()),
50
+ ...remainingProps
51
+ })
52
+ });
53
+ }
54
+ }
55
+ _defineProperty(SelectParticle, "contextType", _MetadataContext.default);
56
+ SelectParticle.propTypes = {
57
+ options: _propTypes.default.arrayOf(_propTypes.default.object),
58
+ onlyHeads: _propTypes.default.bool,
59
+ onlyKnown: _propTypes.default.bool
60
+ };
61
+ var _default = exports.default = SelectParticle;
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var React = _interopRequireWildcard(require("react"));
8
+ var _propTypes = _interopRequireDefault(require("prop-types"));
9
+ var _reactSelect = _interopRequireDefault(require("react-select"));
10
+ var _reactBootstrap = require("react-bootstrap");
11
+ var _MetadataContext = _interopRequireDefault(require("../contexts/MetadataContext"));
12
+ var _jsxRuntime = require("react/jsx-runtime");
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
15
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
16
+ 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; }
17
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
18
+ 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); } /*****************************************************************************\
19
+ * (c) Copyright 2021 CERN for the benefit of the LHCb Collaboration *
20
+ * *
21
+ * This software is distributed under the terms of the GNU General Public *
22
+ * Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". *
23
+ * *
24
+ * In applying this licence, CERN does not waive the privileges and immunities *
25
+ * granted to it by virtue of its status as an Intergovernmental Organization *
26
+ * or submit itself to any jurisdiction. *
27
+ \*****************************************************************************/
28
+ class SelectTag extends React.Component {
29
+ static createOptions(tags, filter) {
30
+ return Object.keys(tags).filter(key => filter(tags[key])).map(key => Object({
31
+ value: key,
32
+ label: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.OverlayTrigger, {
33
+ placement: "bottom",
34
+ overlay: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Tooltip, {
35
+ children: tags[key]["description"]
36
+ }),
37
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
38
+ children: key
39
+ })
40
+ })
41
+ }));
42
+ }
43
+ render() {
44
+ let remainingProps = this.props;
45
+ delete remainingProps.options;
46
+ delete remainingProps.isLoading;
47
+ const loaded = this.context.loaded.userHints;
48
+ const options = SelectTag.createOptions(loaded ? this.context.metadata.userHints[this.props.type] : [], this.props.filter ? this.props.filter : _tag => true);
49
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
50
+ className: "react-select form-control p-0",
51
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactSelect.default, {
52
+ options: options,
53
+ isLoading: !loaded,
54
+ ...remainingProps
55
+ })
56
+ });
57
+ }
58
+ }
59
+ _defineProperty(SelectTag, "contextType", _MetadataContext.default);
60
+ SelectTag.propTypes = {
61
+ options: _propTypes.default.array,
62
+ isLoading: _propTypes.default.bool,
63
+ type: _propTypes.default.string,
64
+ filter: _propTypes.default.func
65
+ };
66
+ var _default = exports.default = SelectTag;
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var React = _interopRequireWildcard(require("react"));
8
+ var _propTypes = _interopRequireDefault(require("prop-types"));
9
+ var _reactSelect = _interopRequireDefault(require("react-select"));
10
+ var _TupleTool = _interopRequireDefault(require("./TupleTool"));
11
+ var _MetadataContext = _interopRequireDefault(require("../contexts/MetadataContext"));
12
+ var _jsxRuntime = require("react/jsx-runtime");
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
15
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
16
+ 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; }
17
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
18
+ 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); } /*****************************************************************************\
19
+ * (c) Copyright 2021 CERN for the benefit of the LHCb Collaboration *
20
+ * *
21
+ * This software is distributed under the terms of the GNU General Public *
22
+ * Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". *
23
+ * *
24
+ * In applying this licence, CERN does not waive the privileges and immunities *
25
+ * granted to it by virtue of its status as an Intergovernmental Organization *
26
+ * or submit itself to any jurisdiction. *
27
+ \*****************************************************************************/
28
+ class SelectTool extends React.Component {
29
+ render() {
30
+ let remainingProps = this.props;
31
+ delete remainingProps.options;
32
+ delete remainingProps.isLoading;
33
+ const loaded = this.context.loaded.tupleTools;
34
+ const options = loaded ? this.props.filterToolTags.map(allowedTag => Object({
35
+ label: allowedTag,
36
+ options: Object.keys(this.context.metadata.tupleTools.tupleTools).sort().map(tool => Object({
37
+ value: tool,
38
+ label: /*#__PURE__*/(0, _jsxRuntime.jsx)(_TupleTool.default, {
39
+ tool: tool
40
+ })
41
+ })).filter(tool => this.context.metadata.tupleTools.tupleTools[tool.value].tags.includes(allowedTag))
42
+ })) : [];
43
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
44
+ className: "react-select form-control p-0",
45
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactSelect.default, {
46
+ options: options,
47
+ isLoading: !loaded,
48
+ ...remainingProps
49
+ })
50
+ });
51
+ }
52
+ }
53
+ _defineProperty(SelectTool, "contextType", _MetadataContext.default);
54
+ SelectTool.propTypes = {
55
+ options: _propTypes.default.array,
56
+ isLoading: _propTypes.default.bool,
57
+ filterToolTags: _propTypes.default.arrayOf(_propTypes.default.string)
58
+ };
59
+ var _default = exports.default = SelectTool;
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _propTypes = _interopRequireDefault(require("prop-types"));
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _reactBootstrap = require("react-bootstrap");
10
+ var _reactRouterDom = require("react-router-dom");
11
+ var _MetadataContext = require("../contexts/MetadataContext");
12
+ var _DecayTree = _interopRequireDefault(require("./DecayTree"));
13
+ var _jsxRuntime = require("react/jsx-runtime");
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+ 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; }
16
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
17
+ 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); } /*****************************************************************************\
18
+ * (c) Copyright 2021 CERN for the benefit of the LHCb Collaboration *
19
+ * *
20
+ * This software is distributed under the terms of the GNU General Public *
21
+ * Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". *
22
+ * *
23
+ * In applying this licence, CERN does not waive the privileges and immunities *
24
+ * granted to it by virtue of its status as an Intergovernmental Organization *
25
+ * or submit itself to any jurisdiction. *
26
+ \*****************************************************************************/
27
+ class SelectVariables extends _react.default.Component {
28
+ constructor(props) {
29
+ super(props);
30
+ _defineProperty(this, "state", {
31
+ selectedRows: this.props.rows.map(row => ({
32
+ ...row,
33
+ dtt: {
34
+ config: row.dtt
35
+ }
36
+ }))
37
+ });
38
+ _defineProperty(this, "callbackFunction", index => childConfig => {
39
+ let updatedRows = [...this.state.selectedRows];
40
+ updatedRows.filter(row => row.id === index)[0].dtt.config = childConfig;
41
+ this.setState({
42
+ selectedRows: updatedRows
43
+ });
44
+ this.props.parentCallback(updatedRows);
45
+ });
46
+ _defineProperty(this, "handeReturn", history => {
47
+ history.push(this.propsVar.basePath);
48
+ });
49
+ this.propsVar = this.props;
50
+ }
51
+ render() {
52
+ const innerContent = this.context.loaded.tupleTools ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
53
+ children: this.state.selectedRows.filter(row => row.editTree).map(row => {
54
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Col, {
55
+ lg: "auto",
56
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_MetadataContext.MetadataLoadWall, {
57
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DecayTree.default, {
58
+ decay: row.decay,
59
+ dttConfig: row.dtt.config,
60
+ parentCallback: this.callbackFunction(row.id)
61
+ })
62
+ })
63
+ }, row.id);
64
+ })
65
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Col, {
66
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Spinner, {
67
+ animation: "border",
68
+ role: "status",
69
+ size: "sm"
70
+ })
71
+ });
72
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
73
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("h3", {
74
+ children: "DecayTreeTuple configuration"
75
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Container, {
76
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Row, {
77
+ className: "justify-content-lg-center",
78
+ children: innerContent
79
+ })
80
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.Route, {
81
+ render: _ref => {
82
+ let {
83
+ history
84
+ } = _ref;
85
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.OverlayTrigger, {
86
+ overlay: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Tooltip, {
87
+ children: "Return to Stripping line and dataset selection"
88
+ }),
89
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Button, {
90
+ type: "submit",
91
+ onClick: () => this.handeReturn(history),
92
+ children: "Return"
93
+ })
94
+ });
95
+ }
96
+ })]
97
+ });
98
+ }
99
+ }
100
+ _defineProperty(SelectVariables, "contextType", _MetadataContext.MetadataContext);
101
+ SelectVariables.propTypes = {
102
+ rows: _propTypes.default.arrayOf(_propTypes.default.object),
103
+ parentCallback: _propTypes.default.func
104
+ };
105
+ var _default = exports.default = SelectVariables;