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,323 @@
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 _TupleTool = _interopRequireDefault(require("./TupleTool"));
10
+ var _SelectTool = _interopRequireDefault(require("./SelectTool"));
11
+ var _ConfigValue = _interopRequireDefault(require("./ConfigValue"));
12
+ var _ConfigList = _interopRequireDefault(require("./ConfigList"));
13
+ var _ConfigDict = _interopRequireDefault(require("./ConfigDict"));
14
+ var _DeleteButton = _interopRequireDefault(require("./DeleteButton"));
15
+ var _reactBootstrap = require("react-bootstrap");
16
+ var _reactBootstrapIcons = require("react-bootstrap-icons");
17
+ var _MetadataContext = _interopRequireDefault(require("../contexts/MetadataContext"));
18
+ var _jsxRuntime = require("react/jsx-runtime");
19
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20
+ 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; }
21
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
22
+ 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); } /*****************************************************************************\
23
+ * (c) Copyright 2021 CERN for the benefit of the LHCb Collaboration *
24
+ * *
25
+ * This software is distributed under the terms of the GNU General Public *
26
+ * Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". *
27
+ * *
28
+ * In applying this licence, CERN does not waive the privileges and immunities *
29
+ * granted to it by virtue of its status as an Intergovernmental Organization *
30
+ * or submit itself to any jurisdiction. *
31
+ \*****************************************************************************/
32
+ class ParticleConfig extends _react.default.Component {
33
+ constructor() {
34
+ super(...arguments);
35
+ _defineProperty(this, "state", {
36
+ dtt: this.props.dtt,
37
+ openAddTool: false,
38
+ openConfigTool: false,
39
+ expandedTool: {
40
+ tool: "",
41
+ open: false
42
+ },
43
+ selectedToolClass: "",
44
+ selectedToolName: ""
45
+ });
46
+ _defineProperty(this, "handleOpen", type => () => {
47
+ this.setState({
48
+ ["open".concat(type, "Tool")]: true
49
+ });
50
+ });
51
+ _defineProperty(this, "handleClose", type => () => {
52
+ this.setState({
53
+ ["open".concat(type, "Tool")]: false
54
+ });
55
+ this.clearSelectedTool();
56
+ this.props.parentCallbackClose();
57
+ this.props.parentCallbackUpdated();
58
+ });
59
+ _defineProperty(this, "clearSelectedTool", () => {
60
+ this.setState({
61
+ selectedToolClass: "",
62
+ selectedToolName: ""
63
+ });
64
+ });
65
+ _defineProperty(this, "handleRemoveTool", tool => () => {
66
+ this.state.dtt.removeTool(this.props.particleID, tool);
67
+ this.setState({
68
+ dtt: this.state.dtt
69
+ });
70
+ this.props.parentCallbackUpdated();
71
+ });
72
+ _defineProperty(this, "handleConfigTool", tool => () => {
73
+ const splitArr = tool.split("/");
74
+ const toolClass = splitArr[0];
75
+ const toolName = splitArr.length > 1 ? splitArr[1] : "";
76
+ this.setState({
77
+ openConfigTool: true,
78
+ selectedToolClass: toolClass,
79
+ selectedToolName: toolName
80
+ });
81
+ });
82
+ _defineProperty(this, "handleUpdateTool", (tool, parameter) => value => {
83
+ let parameters = this.state.dtt.getToolConfig(this.props.particleID, tool);
84
+ const signalUpdated = parameters[parameter] !== value;
85
+ parameters[parameter] = value;
86
+ this.state.dtt.configureTool(this.props.particleID, tool, parameters);
87
+ this.setState({
88
+ dtt: this.state.dtt
89
+ });
90
+ if (signalUpdated) {
91
+ this.props.parentCallbackUpdated();
92
+ }
93
+ });
94
+ _defineProperty(this, "setToolClass", option => {
95
+ this.setState({
96
+ selectedToolClass: option.value
97
+ });
98
+ });
99
+ _defineProperty(this, "setToolName", _ref => {
100
+ let {
101
+ target
102
+ } = _ref;
103
+ this.setState({
104
+ selectedToolName: target.value
105
+ });
106
+ });
107
+ _defineProperty(this, "handleAddTool", () => {
108
+ const {
109
+ selectedToolClass,
110
+ selectedToolName
111
+ } = this.state;
112
+ if (selectedToolClass) {
113
+ this.state.dtt.addTool(this.props.particleID, selectedToolClass, selectedToolName);
114
+ this.setState({
115
+ dtt: this.state.dtt,
116
+ selectedToolClass: "",
117
+ selectedToolName: ""
118
+ });
119
+ this.props.parentCallbackUpdated();
120
+ }
121
+ });
122
+ _defineProperty(this, "getSelectedTool", () => {
123
+ const {
124
+ selectedToolClass,
125
+ selectedToolName
126
+ } = this.state;
127
+ let selectedTool = selectedToolClass;
128
+ if (selectedToolName) {
129
+ selectedTool = "".concat(selectedToolClass, "/").concat(selectedToolName);
130
+ }
131
+ return selectedTool;
132
+ });
133
+ _defineProperty(this, "toolExists", () => {
134
+ const selectedTool = this.getSelectedTool();
135
+ return this.state.dtt.listTools(this.props.particleID).includes(selectedTool);
136
+ });
137
+ _defineProperty(this, "getParam", (tool, param) => {
138
+ const toolClass = tool.split("/")[0];
139
+ const toolInterface = this.context.metadata.tupleTools.tupleTools[toolClass].interface;
140
+ const paramInfo = toolInterface.filter(i => i.name === param);
141
+ if (paramInfo.length === 1) {
142
+ return paramInfo[0];
143
+ } else {
144
+ console.warn("Cannot find " + param + " in:");
145
+ console.warn(toolInterface);
146
+ return {
147
+ type: "str",
148
+ description: "Error loading description"
149
+ };
150
+ }
151
+ });
152
+ _defineProperty(this, "displayDoxygen", () => {
153
+ const html = {
154
+ __html: this.context.metadata.tupleTools.tupleTools[this.state.selectedToolClass].documentation
155
+ };
156
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
157
+ dangerouslySetInnerHTML: html
158
+ });
159
+ });
160
+ }
161
+ render() {
162
+ const toolList = this.state.dtt.listTools(this.props.particleID);
163
+ const nTools = toolList.length;
164
+ const selectedTool = this.getSelectedTool();
165
+ const toolDocs = selectedTool ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Accordion, {
166
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Accordion.Item, {
167
+ eventKey: "0",
168
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Accordion.Header, {
169
+ children: ["Documentation for ", this.state.selectedToolClass]
170
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Accordion.Body, {
171
+ children: this.context.loaded.tupleTools ? this.displayDoxygen() : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Spinner, {
172
+ animation: "outline"
173
+ })
174
+ })]
175
+ })
176
+ }) : "";
177
+ const selectToolProps = this.state.selectedToolClass === "" ? {
178
+ value: null
179
+ } : {};
180
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
181
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Card, {
182
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Card.Header, {
183
+ className: "d-flex justify-content-between align-items-start",
184
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
185
+ children: [nTools, " TupleTool", nTools === 1 ? "" : "s"]
186
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Button, {
187
+ variant: "success",
188
+ size: "sm",
189
+ onClick: this.handleOpen("Add"),
190
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrapIcons.PlusLg, {})
191
+ })]
192
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.ListGroup, {
193
+ variant: "flush",
194
+ children: toolList.map(toolName => {
195
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.ListGroup.Item, {
196
+ className: "d-flex justify-content-between align-items-start",
197
+ variant: toolName === selectedTool ? "secondary" : "",
198
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_TupleTool.default, {
199
+ tool: toolName
200
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.ButtonGroup, {
201
+ size: "sm",
202
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Button, {
203
+ variant: "outline-secondary",
204
+ onClick: this.handleConfigTool(toolName),
205
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrapIcons.PencilSquare, {})
206
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_DeleteButton.default, {
207
+ outline: true,
208
+ action: this.handleRemoveTool(toolName)
209
+ })]
210
+ })]
211
+ }, toolName);
212
+ })
213
+ })]
214
+ }), this.state.openAddTool ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Modal, {
215
+ show: true,
216
+ onHide: this.handleClose("Add"),
217
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Modal.Header, {
218
+ closeButton: true,
219
+ children: "Add TupleTool"
220
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Modal.Body, {
221
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.InputGroup, {
222
+ hasValidation: true,
223
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_SelectTool.default, {
224
+ filterToolTags: this.props.filterToolTags,
225
+ placeholder: "TupleTool class",
226
+ onChange: this.setToolClass,
227
+ ...selectToolProps
228
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.FormControl, {
229
+ placeholder: "TupleTool name",
230
+ onChange: this.setToolName,
231
+ disabled: this.state.selectedToolClass === "",
232
+ value: this.state.selectedToolName,
233
+ isInvalid: this.toolExists()
234
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.FormControl.Feedback, {
235
+ type: "invalid",
236
+ children: ["A ", this.state.selectedToolClass, " with the name \"", this.state.selectedToolName, "\" already exists"]
237
+ })]
238
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Button, {
239
+ variant: "success",
240
+ disabled: !this.state.selectedToolClass || this.toolExists(),
241
+ onClick: this.handleAddTool,
242
+ children: "Add tool"
243
+ }), toolDocs]
244
+ })]
245
+ }) : "", this.state.openConfigTool ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Modal, {
246
+ show: true,
247
+ size: "xl",
248
+ fullscreen: "lg-down",
249
+ onHide: this.handleClose("Config"),
250
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Modal.Header, {
251
+ closeButton: true,
252
+ children: ["Configure ", selectedTool]
253
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Modal.Body, {
254
+ children: [selectedTool ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Form, {
255
+ children: Object.entries(this.state.dtt.getToolConfig(this.props.particleID, selectedTool)).map(_ref2 => {
256
+ let [param, value] = _ref2;
257
+ const paramObj = {
258
+ ...this.getParam(selectedTool, param)
259
+ };
260
+ const {
261
+ description,
262
+ type
263
+ } = paramObj;
264
+ const defaultValue = paramObj["default"]; // TODO: get rid of JS keywords from metadata
265
+ const list_re = /\[(\w+)\]/;
266
+ const dict_re = /\{(\w+):(\w+)\}/;
267
+ const configProps = {
268
+ value: value,
269
+ defaultValue: defaultValue,
270
+ callback: this.handleUpdateTool(selectedTool, param)
271
+ };
272
+ const inputBox = type.match(list_re) !== null ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ConfigList.default, {
273
+ type: type.match(list_re)[1],
274
+ ...configProps
275
+ }) : type.match(dict_re) !== null ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ConfigDict.default, {
276
+ keyType: type.match(dict_re)[1],
277
+ valType: type.match(dict_re)[2],
278
+ ...configProps
279
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ConfigValue.default, {
280
+ type: type,
281
+ ...configProps
282
+ });
283
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Form.Group, {
284
+ as: _reactBootstrap.Row,
285
+ className: "mb-2",
286
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Form.Label, {
287
+ column: true,
288
+ sm: 3,
289
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.OverlayTrigger, {
290
+ overlay: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Tooltip, {
291
+ children: description
292
+ }),
293
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrapIcons.QuestionCircle, {})
294
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("code", {
295
+ children: [" ", param, " "]
296
+ })]
297
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Form.Label, {
298
+ column: true,
299
+ sm: 2,
300
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("code", {
301
+ children: [" ", type, " "]
302
+ })
303
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Col, {
304
+ sm: 7,
305
+ children: inputBox
306
+ })]
307
+ }, param);
308
+ })
309
+ }) : "No tool selected", toolDocs]
310
+ })]
311
+ }) : ""]
312
+ });
313
+ }
314
+ }
315
+ _defineProperty(ParticleConfig, "contextType", _MetadataContext.default);
316
+ ParticleConfig.propTypes = {
317
+ dtt: _propTypes.default.object,
318
+ parentCallbackClose: _propTypes.default.func,
319
+ parentCallbackUpdated: _propTypes.default.func,
320
+ particleID: _propTypes.default.arrayOf(_propTypes.default.string),
321
+ filterToolTags: _propTypes.default.arrayOf(_propTypes.default.string)
322
+ };
323
+ var _default = exports.default = ParticleConfig;
@@ -0,0 +1,85 @@
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
+ 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; }
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
+ \*****************************************************************************/ /*
24
+ * bool -> <input type="checkbox" />
25
+ * int -> <input type="number" step=1 />
26
+ * uint -> <input type="number" step=1 min=0 />
27
+ * float -> <input type="number" />
28
+ * str -> <input type="text" />
29
+ * text -> <textarea />
30
+ */
31
+ class ConfigValue extends _react.default.Component {
32
+ constructor() {
33
+ super(...arguments);
34
+ _defineProperty(this, "handleUpdate", event => {
35
+ const {
36
+ value
37
+ } = event.target;
38
+ const sanitisedValue = this.props.type === "int" ? Math.trunc(value) : this.props.type === "uint" ? Math.trunc(Math.abs(value)) : this.props.type === "text" ? value.split(/\r?\n/) : value;
39
+ this.props.callback(sanitisedValue);
40
+ });
41
+ _defineProperty(this, "handleCheck", () => {
42
+ this.props.callback(!this.props.value);
43
+ });
44
+ }
45
+ render() {
46
+ const inputType = {
47
+ bool: "switch",
48
+ float: "number",
49
+ int: "number",
50
+ uint: "number",
51
+ str: "text",
52
+ text: "textarea"
53
+ }[this.props.type];
54
+ if (this.props.type === "bool") {
55
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Form.Check, {
56
+ onChange: this.handleCheck,
57
+ type: inputType,
58
+ checked: this.props.value
59
+ });
60
+ } else {
61
+ let inputBoxProps = {
62
+ onChange: this.handleUpdate,
63
+ placeholder: inputType === "textarea" ? this.props.defaultValue.join("\n") : this.props.defaultValue,
64
+ value: inputType === "textarea" ? this.props.value.join("\n") : this.props.value
65
+ };
66
+ inputBoxProps[inputType === "textarea" ? "as" : "type"] = inputType;
67
+ if (this.props.type.includes("int")) {
68
+ inputBoxProps.step = 1;
69
+ if (this.props.type === "uint") {
70
+ inputBoxProps.min = 0;
71
+ }
72
+ }
73
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Form.Control, {
74
+ ...inputBoxProps
75
+ });
76
+ }
77
+ }
78
+ }
79
+ ConfigValue.propTypes = {
80
+ type: _propTypes.default.string,
81
+ callback: _propTypes.default.func,
82
+ value: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.bool, _propTypes.default.number, _propTypes.default.arrayOf(_propTypes.default.string)]),
83
+ defaultValue: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.bool, _propTypes.default.number, _propTypes.default.arrayOf(_propTypes.default.string)])
84
+ };
85
+ var _default = exports.default = ConfigValue;
@@ -0,0 +1,67 @@
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 _YearBadge = _interopRequireDefault(require("./YearBadge"));
11
+ var _PolarityBadge = _interopRequireDefault(require("./PolarityBadge"));
12
+ var _StrippingBadge = _interopRequireDefault(require("./StrippingBadge"));
13
+ var _EventTypeBadge = _interopRequireDefault(require("./EventTypeBadge"));
14
+ var _BKPath = _interopRequireDefault(require("../lib/BKPath"));
15
+ var _jsxRuntime = require("react/jsx-runtime");
16
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
+ 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; }
18
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
19
+ 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); } /*****************************************************************************\
20
+ * (c) Copyright 2021 CERN for the benefit of the LHCb Collaboration *
21
+ * *
22
+ * This software is distributed under the terms of the GNU General Public *
23
+ * Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". *
24
+ * *
25
+ * In applying this licence, CERN does not waive the privileges and immunities *
26
+ * granted to it by virtue of its status as an Intergovernmental Organization *
27
+ * or submit itself to any jurisdiction. *
28
+ \*****************************************************************************/
29
+ class Dataset extends _react.default.Component {
30
+ constructor() {
31
+ super(...arguments);
32
+ _defineProperty(this, "path", new _BKPath.default(this.props.path));
33
+ }
34
+ render() {
35
+ const version = this.path.getStrippingVersion();
36
+ const eventType = this.path.getEventType();
37
+ const year = this.path.getYear();
38
+ const polarity = this.path.getPolarity();
39
+ const filename = this.path.getFilename();
40
+ const strippingInfo = /*#__PURE__*/(0, _jsxRuntime.jsx)(_StrippingBadge.default, {
41
+ version: version
42
+ });
43
+ const eventTypeInfo = /*#__PURE__*/(0, _jsxRuntime.jsx)(_EventTypeBadge.default, {
44
+ eventType: eventType
45
+ });
46
+ const yearInfo = /*#__PURE__*/(0, _jsxRuntime.jsx)(_YearBadge.default, {
47
+ year: year
48
+ });
49
+ const polarityInfo = /*#__PURE__*/(0, _jsxRuntime.jsx)(_PolarityBadge.default, {
50
+ polarity: polarity
51
+ });
52
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
53
+ children: [filename, /*#__PURE__*/(0, _jsxRuntime.jsx)("br", {}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Stack, {
54
+ direction: "horizontal",
55
+ style: {
56
+ flexWrap: "wrap"
57
+ },
58
+ gap: 1,
59
+ children: [eventTypeInfo, " ", yearInfo, " ", polarityInfo, " ", strippingInfo]
60
+ })]
61
+ });
62
+ }
63
+ }
64
+ Dataset.propTypes = {
65
+ path: _propTypes.default.string
66
+ };
67
+ var _default = exports.default = Dataset;
@@ -0,0 +1,51 @@
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 _reactBootstrap = require("react-bootstrap");
11
+ var _jsxRuntime = require("react/jsx-runtime");
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+ 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); }
14
+ 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; }
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 Decay extends React.Component {
27
+ render() {
28
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.OverlayTrigger, {
29
+ overlay: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Popover, {
30
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Popover.Header, {
31
+ children: "LoKi descriptor"
32
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Popover.Body, {
33
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("code", {
34
+ children: this.props.decay.descriptors.plain
35
+ })
36
+ })]
37
+ }),
38
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
39
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_mathjaxReact.MathComponent, {
40
+ tex: this.props.decay.descriptors.latex,
41
+ display: this.props.display
42
+ })
43
+ })
44
+ });
45
+ }
46
+ }
47
+ Decay.propTypes = {
48
+ decay: _propTypes.default.object,
49
+ display: _propTypes.default.bool
50
+ };
51
+ var _default = exports.default = Decay;
@@ -0,0 +1,101 @@
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 _StrippingLine = _interopRequireDefault(require("./StrippingLine"));
11
+ var _Decay = _interopRequireDefault(require("./Decay"));
12
+ var _DecayTag = _interopRequireDefault(require("./DecayTag"));
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 DecayItem extends _react.default.Component {
28
+ constructor() {
29
+ super(...arguments);
30
+ _defineProperty(this, "state", {
31
+ selected: this.props.selected,
32
+ decay: this.props.decay
33
+ });
34
+ _defineProperty(this, "sendData", () => {
35
+ this.props.parentCallback(this.state);
36
+ });
37
+ _defineProperty(this, "select", () => {
38
+ this.setState({
39
+ selected: this.state.selected ? false : true
40
+ });
41
+ this.sendData();
42
+ });
43
+ _defineProperty(this, "getExtraInfo", () => {
44
+ const nLines = Object.keys(this.props.decay.lines).length;
45
+ const nTags = this.props.decay.tags.length;
46
+ const tagInfo = this.props.decay.tags.map(tag => /*#__PURE__*/(0, _jsxRuntime.jsx)(_DecayTag.default, {
47
+ tag: tag
48
+ }, tag));
49
+ const strippingInfo = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
50
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.OverlayTrigger, {
51
+ placement: "right",
52
+ overlay: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Popover, {
53
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Popover.Header, {
54
+ children: "Stripping lines"
55
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Popover.Body, {
56
+ children: Object.keys(this.props.decay.lines).map(line => {
57
+ const [stream, name] = line.split("/");
58
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_StrippingLine.default, {
59
+ line: name,
60
+ stream: stream,
61
+ versions: this.props.decay.lines[line]
62
+ }, line);
63
+ })
64
+ })]
65
+ }),
66
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Badge, {
67
+ pill: true,
68
+ bg: this.state.selected ? "primary" : "secondary",
69
+ children: [nLines, " Stripping line", nLines === 1 ? "" : "s"]
70
+ })
71
+ }), nTags > 0 ? tagInfo : ""]
72
+ });
73
+ return strippingInfo;
74
+ });
75
+ }
76
+ render() {
77
+ const extraInfo = this.getExtraInfo();
78
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.ListGroup.Item, {
79
+ as: "li",
80
+ onClick: this.select,
81
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.InputGroup, {
82
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.InputGroup.Checkbox, {
83
+ checked: this.state.selected,
84
+ readOnly: true
85
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
86
+ className: "react-select form-control p-2 " + (this.state.selected ? "list-group-item-primary" : "list-group-item-light"),
87
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Decay.default, {
88
+ decay: this.props.decay,
89
+ display: false
90
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("br", {}), extraInfo]
91
+ })]
92
+ })
93
+ });
94
+ }
95
+ }
96
+ DecayItem.propTypes = {
97
+ selected: _propTypes.default.bool,
98
+ decay: _propTypes.default.object,
99
+ parentCallback: _propTypes.default.func
100
+ };
101
+ var _default = exports.default = DecayItem;