lhcb-ntuple-wizard-test 1.3.3 → 2.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 (167) hide show
  1. package/README.md +1 -2
  2. package/dist/App.d.ts +12 -0
  3. package/dist/App.js +22 -0
  4. package/dist/components/ConfigFilesUploadingAlert.d.ts +1 -0
  5. package/dist/components/ConfigFilesUploadingAlert.js +5 -0
  6. package/dist/components/DatasetEventTypeBadge.d.ts +5 -0
  7. package/dist/components/DatasetEventTypeBadge.js +23 -0
  8. package/dist/components/DatasetInfo.d.ts +5 -0
  9. package/dist/components/DatasetInfo.js +21 -0
  10. package/dist/components/DecayLatex.d.ts +7 -0
  11. package/dist/components/DecayLatex.js +103 -0
  12. package/dist/components/DecayList.d.ts +8 -0
  13. package/dist/components/DecayList.js +37 -0
  14. package/dist/components/DecayListItem.d.ts +11 -0
  15. package/dist/components/DecayListItem.js +23 -0
  16. package/dist/components/DecayTagBadge.d.ts +5 -0
  17. package/dist/components/DecayTagBadge.js +21 -0
  18. package/dist/components/DecayTreeCard.d.ts +7 -0
  19. package/dist/components/DecayTreeCard.js +43 -0
  20. package/dist/components/DecayTreeCardHeader.d.ts +7 -0
  21. package/dist/components/DecayTreeCardHeader.js +5 -0
  22. package/dist/components/DecayTreeGraph.d.ts +9 -0
  23. package/dist/components/DecayTreeGraph.js +89 -0
  24. package/dist/components/DeleteButton.d.ts +9 -0
  25. package/dist/components/DeleteButton.js +16 -53
  26. package/dist/components/DttNameInput.d.ts +9 -0
  27. package/dist/components/DttNameInput.js +73 -0
  28. package/dist/components/LineTableRow.d.ts +9 -0
  29. package/dist/components/LineTableRow.js +123 -0
  30. package/dist/components/LoadingIndicator.d.ts +6 -0
  31. package/dist/components/LoadingIndicator.js +5 -0
  32. package/dist/components/NtupleWizard.d.ts +26 -0
  33. package/dist/components/NtupleWizard.js +28 -137
  34. package/dist/components/NumStrippingLinesBadge.d.ts +8 -0
  35. package/dist/components/NumStrippingLinesBadge.js +10 -0
  36. package/dist/components/ParticleDropdown.d.ts +8 -0
  37. package/dist/components/ParticleDropdown.js +33 -0
  38. package/dist/components/ParticleTagBadge.d.ts +9 -0
  39. package/dist/components/ParticleTagBadge.js +22 -0
  40. package/dist/components/ParticleTagFilters.d.ts +6 -0
  41. package/dist/components/ParticleTagFilters.js +51 -0
  42. package/dist/components/PolarityBadge.d.ts +5 -0
  43. package/dist/components/PolarityBadge.js +13 -33
  44. package/dist/components/StrippingLineBadge.d.ts +7 -0
  45. package/dist/components/StrippingLineBadge.js +29 -0
  46. package/dist/components/StrippingLineInfo.d.ts +8 -0
  47. package/dist/components/StrippingLineInfo.js +17 -0
  48. package/dist/components/SubmitRequestButton.d.ts +11 -0
  49. package/dist/components/SubmitRequestButton.js +39 -0
  50. package/dist/components/TagDropdown.d.ts +12 -0
  51. package/dist/components/TagDropdown.js +31 -0
  52. package/dist/components/TupleToolDocsAccordion.d.ts +5 -0
  53. package/dist/components/TupleToolDocsAccordion.js +14 -0
  54. package/dist/components/TupleToolDropdown.d.ts +21 -0
  55. package/dist/components/TupleToolDropdown.js +29 -0
  56. package/dist/components/TupleToolGroup.d.ts +6 -0
  57. package/dist/components/TupleToolGroup.js +22 -0
  58. package/dist/components/TupleToolLabel.d.ts +6 -0
  59. package/dist/components/TupleToolLabel.js +20 -0
  60. package/dist/components/TupleToolList.d.ts +7 -0
  61. package/dist/components/TupleToolList.js +38 -0
  62. package/dist/components/YearBadge.d.ts +5 -0
  63. package/dist/components/YearBadge.js +13 -33
  64. package/dist/components/modals/AddTupleToolModal.d.ts +7 -0
  65. package/dist/components/modals/AddTupleToolModal.js +32 -0
  66. package/dist/components/modals/ConfigureTupleToolModal.d.ts +8 -0
  67. package/dist/components/modals/ConfigureTupleToolModal.js +43 -0
  68. package/dist/components/modals/ReasonForRequestModal.d.ts +8 -0
  69. package/dist/components/modals/ReasonForRequestModal.js +49 -0
  70. package/dist/components/modals/UploadDttConfigModal.d.ts +7 -0
  71. package/dist/components/modals/UploadDttConfigModal.js +35 -0
  72. package/dist/components/modals/UploadProdConfigModal.d.ts +5 -0
  73. package/dist/components/modals/UploadProdConfigModal.js +27 -0
  74. package/dist/components/tupleToolParams/BoolParamInput.d.ts +16 -0
  75. package/dist/components/tupleToolParams/BoolParamInput.js +15 -0
  76. package/dist/components/tupleToolParams/DictParamInput.d.ts +14 -0
  77. package/dist/components/tupleToolParams/DictParamInput.js +31 -0
  78. package/dist/components/tupleToolParams/ListParamInput.d.ts +14 -0
  79. package/dist/components/tupleToolParams/ListParamInput.js +46 -0
  80. package/dist/components/tupleToolParams/NumParamInput.d.ts +18 -0
  81. package/dist/components/tupleToolParams/NumParamInput.js +25 -0
  82. package/dist/components/tupleToolParams/StrParamInput.d.ts +19 -0
  83. package/dist/components/tupleToolParams/StrParamInput.js +22 -0
  84. package/dist/config.d.ts +78 -0
  85. package/dist/config.js +72 -0
  86. package/dist/{style/DecaysList.css → index.d.ts} +2 -6
  87. package/dist/index.js +2 -11
  88. package/dist/models/bkPath.d.ts +11 -0
  89. package/dist/models/bkPath.js +40 -0
  90. package/dist/models/blobFile.d.ts +12 -0
  91. package/dist/models/blobFile.js +1 -0
  92. package/dist/models/decayData.d.ts +15 -0
  93. package/dist/models/decayData.js +1 -0
  94. package/dist/models/dropdownOption.d.ts +5 -0
  95. package/dist/models/dropdownOption.js +1 -0
  96. package/dist/models/dtt.d.ts +108 -0
  97. package/dist/models/dtt.js +149 -0
  98. package/dist/models/jobConfig.d.ts +7 -0
  99. package/dist/models/jobConfig.js +1 -0
  100. package/dist/models/particle.d.ts +12 -0
  101. package/dist/models/particle.js +1 -0
  102. package/dist/models/particleTag.d.ts +4 -0
  103. package/dist/models/particleTag.js +1 -0
  104. package/dist/models/rowData.d.ts +15 -0
  105. package/dist/models/rowData.js +1 -0
  106. package/dist/models/strippingLine.d.ts +5 -0
  107. package/dist/models/strippingLine.js +1 -0
  108. package/dist/models/strippingLineOption.d.ts +6 -0
  109. package/dist/models/strippingLineOption.js +1 -0
  110. package/dist/models/tupleTool.d.ts +8 -0
  111. package/dist/models/tupleTool.js +18 -0
  112. package/dist/models/tupleTreeGraphData.d.ts +20 -0
  113. package/dist/models/tupleTreeGraphData.js +1 -0
  114. package/dist/models/yamlFile.d.ts +11 -0
  115. package/dist/models/yamlFile.js +78 -0
  116. package/dist/pages/DecaySearchPage.d.ts +5 -0
  117. package/dist/pages/DecaySearchPage.js +197 -0
  118. package/dist/pages/DecayTreeConfigPage.d.ts +5 -0
  119. package/dist/pages/DecayTreeConfigPage.js +63 -0
  120. package/dist/pages/LinesTablePage.d.ts +14 -0
  121. package/dist/pages/LinesTablePage.js +120 -0
  122. package/dist/providers/DttProvider.d.ts +24 -0
  123. package/dist/providers/DttProvider.js +77 -0
  124. package/dist/providers/MetadataProvider.d.ts +87 -0
  125. package/dist/providers/MetadataProvider.js +50 -0
  126. package/dist/providers/ProductionConfigProvider.d.ts +14 -0
  127. package/dist/providers/ProductionConfigProvider.js +76 -0
  128. package/dist/providers/RequestProvider.d.ts +15 -0
  129. package/dist/providers/RequestProvider.js +35 -0
  130. package/dist/providers/RowsProvider.d.ts +14 -0
  131. package/dist/providers/RowsProvider.js +31 -0
  132. package/dist/utils/mathjaxUtils.d.ts +12 -0
  133. package/dist/utils/mathjaxUtils.js +24 -0
  134. package/dist/utils/utils.d.ts +31 -0
  135. package/dist/utils/utils.js +80 -0
  136. package/package.json +43 -21
  137. package/dist/components/App.js +0 -99
  138. package/dist/components/ConfigDict.js +0 -103
  139. package/dist/components/ConfigList.js +0 -94
  140. package/dist/components/ConfigNode.js +0 -320
  141. package/dist/components/ConfigValue.js +0 -86
  142. package/dist/components/Dataset.js +0 -67
  143. package/dist/components/Decay.js +0 -50
  144. package/dist/components/DecayItem.js +0 -101
  145. package/dist/components/DecayTag.js +0 -52
  146. package/dist/components/DecayTree.js +0 -451
  147. package/dist/components/DecaysList.js +0 -107
  148. package/dist/components/DescriptorsSearch.js +0 -352
  149. package/dist/components/EventTypeBadge.js +0 -45
  150. package/dist/components/ItemSearch.js +0 -120
  151. package/dist/components/LinesTable.js +0 -1105
  152. package/dist/components/ParticleTag.js +0 -54
  153. package/dist/components/SearchItem.js +0 -99
  154. package/dist/components/SelectParticle.js +0 -61
  155. package/dist/components/SelectTag.js +0 -66
  156. package/dist/components/SelectTool.js +0 -59
  157. package/dist/components/SelectVariables.js +0 -106
  158. package/dist/components/StrippingBadge.js +0 -64
  159. package/dist/components/StrippingLine.js +0 -50
  160. package/dist/components/TupleTool.js +0 -46
  161. package/dist/components/VariablesSearch.js +0 -128
  162. package/dist/config.json +0 -72
  163. package/dist/contexts/MetadataContext.js +0 -135
  164. package/dist/lib/BKPath.js +0 -58
  165. package/dist/lib/DTTConfig.js +0 -178
  166. package/dist/lib/mathjax.js +0 -35
  167. package/dist/lib/utils.js +0 -191
@@ -1,101 +0,0 @@
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(e) { return e && e.__esModule ? e : { default: e }; }
15
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
16
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : 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;
@@ -1,52 +0,0 @@
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 _MetadataContext = _interopRequireDefault(require("../contexts/MetadataContext"));
11
- var _jsxRuntime = require("react/jsx-runtime");
12
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
14
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
15
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
16
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : 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 DecayTag extends _react.default.Component {
28
- render() {
29
- const background = this.context.loaded.userHints && this.context.metadata.userHints.decayTags[this.props.tag].warn ? "danger" : "warning";
30
- const foreground = this.context.loaded.userHints && this.context.metadata.userHints.decayTags[this.props.tag].warn ? "light" : "dark";
31
- const description = this.context.loaded.userHints ? this.context.metadata.userHints.decayTags[this.props.tag].description : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Spinner, {
32
- animation: "border"
33
- });
34
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.OverlayTrigger, {
35
- overlay: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Tooltip, {
36
- children: description
37
- }),
38
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Badge, _objectSpread(_objectSpread({
39
- pill: true,
40
- bg: background,
41
- text: foreground
42
- }, this.props), {}, {
43
- children: this.props.tag
44
- }))
45
- });
46
- }
47
- }
48
- _defineProperty(DecayTag, "contextType", _MetadataContext.default);
49
- DecayTag.propTypes = {
50
- tag: _propTypes.default.string
51
- };
52
- var _default = exports.default = DecayTag;
@@ -1,451 +0,0 @@
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 _reactGraphVis = _interopRequireDefault(require("react-graph-vis"));
10
- var _ParticleTag = _interopRequireDefault(require("./ParticleTag"));
11
- var _DecayTag = _interopRequireDefault(require("./DecayTag"));
12
- var _Decay = _interopRequireDefault(require("./Decay"));
13
- var _ConfigNode = _interopRequireDefault(require("./ConfigNode"));
14
- var _MetadataContext = _interopRequireDefault(require("../contexts/MetadataContext"));
15
- var _reactBootstrap = require("react-bootstrap");
16
- var _reactBootstrapIcons = require("react-bootstrap-icons");
17
- var _mathjaxReact = require("mathjax-react");
18
- var _mathjax = _interopRequireDefault(require("../lib/mathjax"));
19
- var _config = _interopRequireDefault(require("../config.json"));
20
- var _DTTConfig = _interopRequireDefault(require("../lib/DTTConfig"));
21
- var _lodash = _interopRequireDefault(require("lodash"));
22
- var _jsxRuntime = require("react/jsx-runtime");
23
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
24
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
25
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
26
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
27
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
28
- 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); } /*****************************************************************************\
29
- * (c) Copyright 2021 CERN for the benefit of the LHCb Collaboration *
30
- * *
31
- * This software is distributed under the terms of the GNU General Public *
32
- * Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". *
33
- * *
34
- * In applying this licence, CERN does not waive the privileges and immunities *
35
- * granted to it by virtue of its status as an Intergovernmental Organization *
36
- * or submit itself to any jurisdiction. *
37
- \*****************************************************************************/
38
- function htmlTitle(text) {
39
- const container = document.createElement("span");
40
- container.innerText = text;
41
- return container;
42
- }
43
- function makeSVG(text) {
44
- let colour = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "black";
45
- const pipes = "\\phantom{{}^{|-}_{|-}}"; // looks weird but helps ensure uniform text scaling
46
- const texSVG = (0, _mathjax.default)("".concat(pipes).concat(text).concat(pipes)).innerHTML.replaceAll("currentColor", colour);
47
- return "data:image/svg+xml;charset=utf-8," + encodeURIComponent(texSVG);
48
- }
49
- function buildDecayGraph(decay, metadata) {
50
- const getGraphParams = (term, graph, parentId) => {
51
- if (!(term instanceof Array)) {
52
- const {
53
- branch,
54
- particle
55
- } = term;
56
- return {
57
- newNode: {
58
- id: branch,
59
- label: branch,
60
- title: htmlTitle(metadata[particle].html),
61
- image: {
62
- selected: makeSVG(metadata[particle].latex, "#0d6efd"),
63
- unselected: makeSVG(metadata[particle].latex, "black")
64
- }
65
- },
66
- newEdge: parentId === 0 ? {} : {
67
- from: parentId,
68
- to: branch
69
- }
70
- };
71
- }
72
- term.forEach(element => {
73
- if (element instanceof Array) {
74
- const subParentId = graph.nodes.slice(-1)[0].id;
75
- graph = getGraphParams(element, graph, subParentId);
76
- } else {
77
- const {
78
- newNode,
79
- newEdge
80
- } = getGraphParams(element, graph, parentId);
81
- graph.nodes.push(newNode);
82
- graph.edges.push(newEdge);
83
- }
84
- });
85
- return graph;
86
- };
87
- let graph = getGraphParams(decay, {
88
- nodes: [],
89
- edges: []
90
- }, 0);
91
- graph.edges = graph.edges.filter(edge => Object.keys(edge).length !== 0);
92
- return graph;
93
- }
94
- class DecayTree extends _react.default.Component {
95
- constructor() {
96
- super(...arguments);
97
- _defineProperty(this, "state", {
98
- graph: buildDecayGraph(this.props.decay.descriptors.mapped_list, this.context.metadata.particleProperties),
99
- dtt: new _DTTConfig.default(_lodash.default.cloneDeep(this.props.dttConfig), this.context.metadata.tupleTools.tupleTools),
100
- lastSave: _lodash.default.cloneDeep(this.props.dttConfig),
101
- selectedParticleId: [],
102
- updated: false,
103
- lockGraphZoom: !_config.default.dttGraphOptions.interaction.zoomView,
104
- showNodeModal: false
105
- });
106
- _defineProperty(this, "network", null);
107
- _defineProperty(this, "selectAllByTag", tag => () => {
108
- const allBranches = this.state.dtt.config.branches;
109
- const matchingParticles = Object.keys(allBranches).filter(branch => {
110
- const particle = allBranches[branch].particle;
111
- const allTags = this.context.metadata.particleProperties[particle].tags;
112
- return allTags.includes(tag);
113
- }).sort();
114
- this.setState({
115
- selectedParticleId: matchingParticles
116
- });
117
- this.network.selectNodes(matchingParticles);
118
- });
119
- _defineProperty(this, "selectGroup", group => () => {
120
- const selection = group.split(",");
121
- this.setState({
122
- selectedParticleId: selection
123
- });
124
- this.network.selectNodes(selection);
125
- });
126
- _defineProperty(this, "countGroupTools", group => {
127
- const toolList = this.state.dtt.listTools(group);
128
- const nTools = toolList.length;
129
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.OverlayTrigger, {
130
- overlay: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Popover, {
131
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.ListGroup, {
132
- children: toolList.map(tool => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.ListGroup.Item, {
133
- children: tool
134
- }, tool))
135
- })
136
- }),
137
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
138
- children: [nTools, " TupleTool", nTools === 1 ? "" : "s"]
139
- })
140
- });
141
- });
142
- _defineProperty(this, "callbackCloseNodeConf", () => {
143
- this.setState({
144
- showNodeModal: false
145
- });
146
- });
147
- _defineProperty(this, "callbackSignalUpdated", () => {
148
- this.setState({
149
- updated: true
150
- });
151
- });
152
- _defineProperty(this, "sendData", () => {
153
- const dttConfig = _lodash.default.cloneDeep(this.state.dtt.config);
154
- this.setState({
155
- updated: false,
156
- lastSave: dttConfig
157
- });
158
- this.props.parentCallback(dttConfig);
159
- });
160
- _defineProperty(this, "revertDTT", () => {
161
- let dtt = this.state.dtt;
162
- dtt.config = _lodash.default.cloneDeep(this.state.lastSave);
163
- this.setState({
164
- dtt: dtt,
165
- updated: false
166
- });
167
- });
168
- _defineProperty(this, "displaySelectionDescriptor", decaySelector => {
169
- // split into an array for easier looping
170
- // XXX: we could probably use descriptors.list in conjunction with descriptors.mapped_list here...
171
- const lokiArray = decaySelector.replace(/^\[/, "").replace(/^\^\[/, "^").replace(/\]CC$/, "").split(" ");
172
- const texArray = lokiArray.map(particle => {
173
- if (particle === "->") {
174
- return "\\to";
175
- } else {
176
- let name = particle.replace(/^\^/, ""); // name will be used to look up the particle in metadata
177
- // detect and handle sub-decays (marked with round braces)
178
- // A -> (B -> C D) E
179
- // A -> (B -> C (D -> E F)) G
180
- let braces = ["", ""];
181
- const numBraces = [/\(/g, /\)/g].map(pattern => (name.match(pattern) || []).length);
182
- if (name.startsWith("(")) {
183
- name = name.replace(/^\(/, "");
184
- braces[0] = "(";
185
- } else if (name.endsWith(")") && numBraces[1] > numBraces[0]) {
186
- name = name.replace(/\)+$/, "");
187
- braces[1] = ")".repeat(numBraces[1] - numBraces[0]);
188
- }
189
- // spit edge-cases to the console and handle them somewhat gracefully
190
- if (!Object.keys(this.context.metadata.particleProperties).includes(name)) {
191
- console.error("".concat(name, " not found in particle property metadata!"));
192
- return "\\text{".concat(particle, "}");
193
- }
194
- let latex = this.context.metadata.particleProperties[name].latex;
195
- // mark particles by underlining them
196
- // TODO: if we can figure out colour with mathjax-react, turn them blue instead
197
- if (particle.startsWith("^")) {
198
- latex = "\\underline{".concat(latex, "}");
199
- }
200
- // remember to put the braces back
201
- return "".concat(braces[0]).concat(latex).concat(braces[1]);
202
- }
203
- });
204
- return texArray.join(" ");
205
- });
206
- _defineProperty(this, "displaySelection", selection => {
207
- const decaySelector = this.props.decay.descriptors.template.replace(/\${(\w+)}/g, (_, v) => selection.includes(v) ? "^" : "");
208
- const latex = this.displaySelectionDescriptor(decaySelector);
209
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.OverlayTrigger, {
210
- overlay: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Popover, {
211
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Popover.Header, {
212
- children: "LoKi selector"
213
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Popover.Body, {
214
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("code", {
215
- children: decaySelector
216
- })
217
- })]
218
- }),
219
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
220
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_mathjaxReact.MathComponent, {
221
- tex: "".concat(latex),
222
- display: false
223
- })
224
- })
225
- });
226
- });
227
- _defineProperty(this, "toggleZoomLock", () => {
228
- this.network.setOptions({
229
- interaction: {
230
- zoomView: this.state.lockGraphZoom
231
- }
232
- });
233
- this.setState({
234
- lockGraphZoom: !this.state.lockGraphZoom
235
- });
236
- });
237
- }
238
- render() {
239
- this.state.dtt.pruneGroups(); // Make sure no empty groups
240
- const selection = this.state.selectedParticleId;
241
- const tagInfo = this.context.metadata.userHints.particleTags;
242
- const particleInfo = this.context.metadata.particleProperties;
243
- const dtt = this.state.dtt.config;
244
- const nGroups = Object.keys(dtt.groups).length;
245
- const dttName = this.state.dtt.getSafeName();
246
- const decayTags = /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Stack, {
247
- direction: "horizontal",
248
- style: {
249
- flexWrap: "wrap",
250
- justifyContent: "center"
251
- },
252
- gap: 2,
253
- children: this.props.decay.tags.filter(tag => this.context.metadata.userHints.decayTags[tag].warn).map(tag => /*#__PURE__*/(0, _jsxRuntime.jsx)(_DecayTag.default, {
254
- tag: tag
255
- }, tag))
256
- });
257
- let selectedName = "";
258
- let filterToolTags = ["IParticleTupleTool"];
259
- let particleTags = [];
260
- let displayedGroups = {};
261
- if (selection.length > 0) {
262
- const target = this.state.dtt.getTarget(selection);
263
- const allParticles = selection.length > 1 ? target.particles.map(particle => particleInfo[particle]) : [particleInfo[target.particle]];
264
- const allTags = new Set([].concat(...allParticles.map(particle => particle.tags.filter(tag => !tagInfo[tag].hide))));
265
- particleTags = [...allTags].filter(tag => allParticles.every(particle => particle.tags.includes(tag)));
266
- selectedName = this.displaySelection(selection);
267
- if (selection.length === 1) {
268
- const filteredGroups = Object.entries(dtt.groups).filter(_ref => {
269
- let [key, _value] = _ref;
270
- return key.includes(selection[0]);
271
- });
272
- displayedGroups = Object.fromEntries(filteredGroups);
273
- }
274
- } else {
275
- filterToolTags.push("IEventTupleTool");
276
- const allBranches = dtt.branches;
277
- const allParticles = Object.keys(allBranches).map(branch => particleInfo[allBranches[branch].particle]);
278
- const uniqueTags = new Set([].concat(...allParticles.map(particle => particle.tags.filter(tag => !tagInfo[tag].hide))));
279
- particleTags = [...uniqueTags];
280
- selectedName = /*#__PURE__*/(0, _jsxRuntime.jsx)(_Decay.default, {
281
- decay: this.props.decay,
282
- display: false
283
- });
284
- displayedGroups = dtt.groups;
285
- }
286
- particleTags.sort((a, b) => tagInfo[a].group > tagInfo[b].group);
287
- const inputList = dtt.inputs.length === 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.ListGroup.Item, {
288
- children: "Choose at least one Stripping line, otherwise no decay candidates will be selected"
289
- }) : dtt.inputs.map((location, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.ListGroup.Item, {
290
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("code", {
291
- children: location
292
- })
293
- }, index));
294
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Card, {
295
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Card.Header, {
296
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.OverlayTrigger, {
297
- placement: "bottom",
298
- overlay: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Popover, {
299
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Popover.Body, {
300
- children: ["The ROOT TTree will be found under ", /*#__PURE__*/(0, _jsxRuntime.jsx)("code", {
301
- children: "DecayTreeTuple/".concat(dttName)
302
- }), "."]
303
- })
304
- }),
305
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Card.Title, {
306
- children: ["Tree name: ", /*#__PURE__*/(0, _jsxRuntime.jsx)("code", {
307
- children: dttName
308
- })]
309
- })
310
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Accordion, {
311
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Accordion.Item, {
312
- eventKey: "0",
313
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Accordion.Header, {
314
- children: [dtt.inputs.length, " input location", dtt.inputs.length === 1 ? "" : "s"]
315
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Accordion.Body, {
316
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.ListGroup, {
317
- variant: "flush",
318
- children: inputList
319
- })
320
- })]
321
- })
322
- })]
323
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Card.Body, {
324
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Card.Title, {
325
- className: "d-flex justify-content-between align-items-start",
326
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
327
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.OverlayTrigger, {
328
- placement: "bottom",
329
- overlay: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Tooltip, {
330
- children: "Click to select particles to configure. Hold ctrl to select multiple. Clear the selection to configure the entire decay."
331
- }),
332
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrapIcons.QuestionCircle, {})
333
- }), " ", "Configure ", /*#__PURE__*/(0, _jsxRuntime.jsx)(_Decay.default, {
334
- decay: this.props.decay,
335
- display: false
336
- })]
337
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.OverlayTrigger, {
338
- placement: "bottom",
339
- overlay: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Tooltip, {
340
- children: ["Click to ", this.state.lockGraphZoom ? "unlock" : "lock", " scroll-to-zoom."]
341
- }),
342
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Button, {
343
- onClick: this.toggleZoomLock,
344
- variant: "secondary-outline",
345
- children: [this.state.lockGraphZoom ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrapIcons.Lock, {}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrapIcons.Unlock, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrapIcons.Search, {})]
346
- })
347
- })]
348
- }), decayTags, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactGraphVis.default, {
349
- graph: this.state.graph,
350
- options: DecayTree.options,
351
- events: {
352
- selectNode: event => {
353
- this.setState({
354
- selectedParticleId: [...event.nodes].sort()
355
- });
356
- },
357
- deselectNode: event => {
358
- this.setState({
359
- selectedParticleId: [...event.nodes].sort()
360
- });
361
- }
362
- },
363
- getNetwork: network => {
364
- this.network = network;
365
- }
366
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Card.Title, {
367
- children: "Select by category"
368
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Card.Body, {
369
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Stack, {
370
- direction: "horizontal",
371
- style: {
372
- flexWrap: "wrap",
373
- justifyContent: "center"
374
- },
375
- gap: 2,
376
- children: particleTags.map(tag => /*#__PURE__*/(0, _jsxRuntime.jsx)(_ParticleTag.default, {
377
- as: "button",
378
- tag: tag,
379
- onClick: this.selectAllByTag(tag)
380
- }, tag))
381
- })
382
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Card.Title, {
383
- children: ["Current selection: ", selectedName]
384
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ConfigNode.default, {
385
- dtt: this.state.dtt,
386
- particleID: selection,
387
- parentCallbackClose: this.callbackCloseNodeConf,
388
- parentCallbackUpdated: this.callbackSignalUpdated,
389
- filterToolTags: filterToolTags,
390
- updated: this.state.updated
391
- }), Object.keys(displayedGroups).length > 0 ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Card, {
392
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Card.Header, {
393
- children: [nGroups, " group", nGroups === 1 ? "" : "s"]
394
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.ListGroup, {
395
- variant: "flush",
396
- children: Object.keys(displayedGroups).map(sel => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.ListGroup.Item, {
397
- className: "d-flex justify-content-between align-items-start",
398
- children: [this.displaySelection(sel.split(",")), this.countGroupTools(sel.split(",")), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Button, {
399
- variant: "outline-secondary",
400
- size: "sm",
401
- onClick: this.selectGroup(sel),
402
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrapIcons.PencilSquare, {})
403
- })]
404
- }, sel))
405
- })]
406
- }) : "", /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.ButtonGroup, {
407
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.OverlayTrigger, {
408
- overlay: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Tooltip, {
409
- children: "Save changes to this DecayTreeTuple"
410
- }),
411
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Button, {
412
- type: "submit",
413
- onClick: this.sendData,
414
- disabled: !this.state.updated,
415
- children: "Save"
416
- })
417
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.OverlayTrigger, {
418
- overlay: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Tooltip, {
419
- children: "Discard changes to this DecayTreeTuple"
420
- }),
421
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Button, {
422
- variant: "outline-danger",
423
- onClick: this.revertDTT,
424
- disabled: !this.state.updated,
425
- children: "Revert"
426
- })
427
- })]
428
- })]
429
- })]
430
- });
431
- }
432
- }
433
- _defineProperty(DecayTree, "contextType", _MetadataContext.default);
434
- _defineProperty(DecayTree, "options", _objectSpread(_objectSpread({}, _config.default.dttGraphOptions), {}, {
435
- nodes: _objectSpread(_objectSpread({}, _config.default.dttGraphOptions.nodes), {}, {
436
- chosen: {
437
- label: (values, id, selected, _hovering) => {
438
- if (selected) {
439
- values.mod = "bold";
440
- values.color = "#0d6efd";
441
- }
442
- }
443
- }
444
- })
445
- }));
446
- DecayTree.propTypes = {
447
- decay: _propTypes.default.object,
448
- dttConfig: _propTypes.default.object,
449
- parentCallback: _propTypes.default.func
450
- };
451
- var _default = exports.default = DecayTree;