lhcb-ntuple-wizard-test 1.1.14 → 1.2.0
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.
- package/dist/components/ConfigDict.js +39 -38
- package/dist/components/ConfigList.js +33 -29
- package/dist/components/ConfigNode.js +135 -132
- package/dist/components/ConfigValue.js +22 -18
- package/dist/components/Dataset.js +7 -3
- package/dist/components/Decay.js +1 -2
- package/dist/components/DecayItem.js +49 -45
- package/dist/components/DecayTag.js +10 -7
- package/dist/components/DecayTree.js +153 -146
- package/dist/components/DecaysList.js +38 -35
- package/dist/components/DescriptorsSearch.js +192 -187
- package/dist/components/EventTypeBadge.js +9 -6
- package/dist/components/ItemSearch.js +15 -10
- package/dist/components/LinesTable.js +464 -462
- package/dist/components/NtupleWizard.js +32 -27
- package/dist/components/ParticleTag.js +10 -7
- package/dist/components/SearchItem.js +34 -31
- package/dist/components/SelectParticle.js +14 -10
- package/dist/components/SelectTag.js +10 -9
- package/dist/components/SelectTool.js +10 -9
- package/dist/components/SelectVariables.js +24 -22
- package/dist/components/StrippingBadge.js +10 -7
- package/dist/components/StrippingLine.js +8 -6
- package/dist/components/TupleTool.js +4 -3
- package/dist/components/VariablesSearch.js +15 -10
- package/dist/components/loki/LokiDict.js +184 -0
- package/dist/components/loki/LokiEditor.js +199 -0
- package/dist/components/loki/LokiForm.js +116 -0
- package/dist/components/semantic.js +97 -0
- package/dist/components/semform.js +184 -0
- package/dist/components/worker.js +196 -0
- package/dist/config.json +1 -1
- package/dist/contexts/MetadataContext.js +8 -7
- package/dist/lib/DTTConfig.js +8 -8
- package/package.json +25 -2
|
@@ -12,7 +12,9 @@ var _Decay = _interopRequireDefault(require("./Decay"));
|
|
|
12
12
|
var _DecayTag = _interopRequireDefault(require("./DecayTag"));
|
|
13
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
-
|
|
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); } /*****************************************************************************\
|
|
16
18
|
* (c) Copyright 2021 CERN for the benefit of the LHCb Collaboration *
|
|
17
19
|
* *
|
|
18
20
|
* This software is distributed under the terms of the GNU General Public *
|
|
@@ -22,53 +24,55 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
22
24
|
* granted to it by virtue of its status as an Intergovernmental Organization *
|
|
23
25
|
* or submit itself to any jurisdiction. *
|
|
24
26
|
\*****************************************************************************/
|
|
25
|
-
|
|
26
27
|
class DecayItem extends _react.default.Component {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
this.setState({
|
|
36
|
-
selected: this.state.selected ? false : true
|
|
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);
|
|
37
36
|
});
|
|
38
|
-
this
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const tagInfo = this.props.decay.tags.map(tag => /*#__PURE__*/(0, _jsxRuntime.jsx)(_DecayTag.default, {
|
|
44
|
-
tag: tag
|
|
45
|
-
}, tag));
|
|
46
|
-
const strippingInfo = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
47
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.OverlayTrigger, {
|
|
48
|
-
placement: "right",
|
|
49
|
-
overlay: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Popover, {
|
|
50
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Popover.Header, {
|
|
51
|
-
children: "Stripping lines"
|
|
52
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Popover.Body, {
|
|
53
|
-
children: Object.keys(this.props.decay.lines).map(line => {
|
|
54
|
-
const [stream, name] = line.split("/");
|
|
55
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_StrippingLine.default, {
|
|
56
|
-
line: name,
|
|
57
|
-
stream: stream,
|
|
58
|
-
versions: this.props.decay.lines[line]
|
|
59
|
-
}, line);
|
|
60
|
-
})
|
|
61
|
-
})]
|
|
62
|
-
}),
|
|
63
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Badge, {
|
|
64
|
-
pill: true,
|
|
65
|
-
bg: this.state.selected ? "primary" : "secondary",
|
|
66
|
-
children: [nLines, " Stripping line", nLines === 1 ? "" : "s"]
|
|
67
|
-
})
|
|
68
|
-
}), nTags > 0 ? tagInfo : ""]
|
|
37
|
+
_defineProperty(this, "select", () => {
|
|
38
|
+
this.setState({
|
|
39
|
+
selected: this.state.selected ? false : true
|
|
40
|
+
});
|
|
41
|
+
this.sendData();
|
|
69
42
|
});
|
|
70
|
-
|
|
71
|
-
|
|
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
|
+
}
|
|
72
76
|
render() {
|
|
73
77
|
const extraInfo = this.getExtraInfo();
|
|
74
78
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.ListGroup.Item, {
|
|
@@ -10,7 +10,11 @@ var _reactBootstrap = require("react-bootstrap");
|
|
|
10
10
|
var _MetadataContext = _interopRequireDefault(require("../contexts/MetadataContext"));
|
|
11
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
-
|
|
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); } /*****************************************************************************\
|
|
14
18
|
* (c) Copyright 2021 CERN for the benefit of the LHCb Collaboration *
|
|
15
19
|
* *
|
|
16
20
|
* This software is distributed under the terms of the GNU General Public *
|
|
@@ -20,9 +24,7 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
20
24
|
* granted to it by virtue of its status as an Intergovernmental Organization *
|
|
21
25
|
* or submit itself to any jurisdiction. *
|
|
22
26
|
\*****************************************************************************/
|
|
23
|
-
|
|
24
27
|
class DecayTag extends _react.default.Component {
|
|
25
|
-
static contextType = (() => _MetadataContext.default)();
|
|
26
28
|
render() {
|
|
27
29
|
const background = this.context.loaded.userHints && this.context.metadata.userHints.decayTags[this.props.tag].warn ? "danger" : "warning";
|
|
28
30
|
const foreground = this.context.loaded.userHints && this.context.metadata.userHints.decayTags[this.props.tag].warn ? "light" : "dark";
|
|
@@ -33,16 +35,17 @@ class DecayTag extends _react.default.Component {
|
|
|
33
35
|
overlay: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Tooltip, {
|
|
34
36
|
children: description
|
|
35
37
|
}),
|
|
36
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Badge, {
|
|
38
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Badge, _objectSpread(_objectSpread({
|
|
37
39
|
pill: true,
|
|
38
40
|
bg: background,
|
|
39
|
-
text: foreground
|
|
40
|
-
|
|
41
|
+
text: foreground
|
|
42
|
+
}, this.props), {}, {
|
|
41
43
|
children: this.props.tag
|
|
42
|
-
})
|
|
44
|
+
}))
|
|
43
45
|
});
|
|
44
46
|
}
|
|
45
47
|
}
|
|
48
|
+
_defineProperty(DecayTag, "contextType", _MetadataContext.default);
|
|
46
49
|
DecayTag.propTypes = {
|
|
47
50
|
tag: _propTypes.default.string
|
|
48
51
|
};
|
|
@@ -19,9 +19,14 @@ var _mathjax = _interopRequireDefault(require("../lib/mathjax"));
|
|
|
19
19
|
var _config = _interopRequireDefault(require("../config.json"));
|
|
20
20
|
var _DTTConfig = _interopRequireDefault(require("../lib/DTTConfig"));
|
|
21
21
|
var _lodash = _interopRequireDefault(require("lodash"));
|
|
22
|
+
var _semform = _interopRequireDefault(require("./semform"));
|
|
22
23
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
24
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
24
|
-
|
|
25
|
+
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; }
|
|
26
|
+
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; }
|
|
27
|
+
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; }
|
|
28
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
29
|
+
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); } /*****************************************************************************\
|
|
25
30
|
* (c) Copyright 2021 CERN for the benefit of the LHCb Collaboration *
|
|
26
31
|
* *
|
|
27
32
|
* This software is distributed under the terms of the GNU General Public *
|
|
@@ -31,7 +36,6 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
31
36
|
* granted to it by virtue of its status as an Intergovernmental Organization *
|
|
32
37
|
* or submit itself to any jurisdiction. *
|
|
33
38
|
\*****************************************************************************/
|
|
34
|
-
|
|
35
39
|
function htmlTitle(text) {
|
|
36
40
|
const container = document.createElement("span");
|
|
37
41
|
container.innerText = text;
|
|
@@ -40,7 +44,7 @@ function htmlTitle(text) {
|
|
|
40
44
|
function makeSVG(text) {
|
|
41
45
|
let colour = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "black";
|
|
42
46
|
const pipes = "\\phantom{{}^{|-}_{|-}}"; // looks weird but helps ensure uniform text scaling
|
|
43
|
-
const texSVG = (0, _mathjax.default)(
|
|
47
|
+
const texSVG = (0, _mathjax.default)("".concat(pipes).concat(text).concat(pipes)).innerHTML.replaceAll("currentColor", colour);
|
|
44
48
|
return "data:image/svg+xml;charset=utf-8," + encodeURIComponent(texSVG);
|
|
45
49
|
}
|
|
46
50
|
function buildDecayGraph(decay, metadata) {
|
|
@@ -89,162 +93,149 @@ function buildDecayGraph(decay, metadata) {
|
|
|
89
93
|
return graph;
|
|
90
94
|
}
|
|
91
95
|
class DecayTree extends _react.default.Component {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
values.color = "#0d6efd";
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
state = (() => ({
|
|
109
|
-
graph: buildDecayGraph(this.props.decay.descriptors.mapped_list, this.context.metadata.particleProperties),
|
|
110
|
-
dtt: new _DTTConfig.default(_lodash.default.cloneDeep(this.props.dttConfig), this.context.metadata.tupleTools.tupleTools),
|
|
111
|
-
lastSave: _lodash.default.cloneDeep(this.props.dttConfig),
|
|
112
|
-
selectedParticleId: [],
|
|
113
|
-
updated: false,
|
|
114
|
-
lockGraphZoom: !_config.default.dttGraphOptions.interaction.zoomView,
|
|
115
|
-
showNodeModal: false
|
|
116
|
-
}))();
|
|
117
|
-
network = null;
|
|
118
|
-
selectAllByTag = tag => () => {
|
|
119
|
-
const allBranches = this.state.dtt.config.branches;
|
|
120
|
-
const matchingParticles = Object.keys(allBranches).filter(branch => {
|
|
121
|
-
const particle = allBranches[branch].particle;
|
|
122
|
-
const allTags = this.context.metadata.particleProperties[particle].tags;
|
|
123
|
-
return allTags.includes(tag);
|
|
124
|
-
}).sort();
|
|
125
|
-
this.setState({
|
|
126
|
-
selectedParticleId: matchingParticles
|
|
96
|
+
constructor() {
|
|
97
|
+
super(...arguments);
|
|
98
|
+
_defineProperty(this, "state", {
|
|
99
|
+
graph: buildDecayGraph(this.props.decay.descriptors.mapped_list, this.context.metadata.particleProperties),
|
|
100
|
+
dtt: new _DTTConfig.default(_lodash.default.cloneDeep(this.props.dttConfig), this.context.metadata.tupleTools.tupleTools),
|
|
101
|
+
lastSave: _lodash.default.cloneDeep(this.props.dttConfig),
|
|
102
|
+
selectedParticleId: [],
|
|
103
|
+
updated: false,
|
|
104
|
+
lockGraphZoom: !_config.default.dttGraphOptions.interaction.zoomView,
|
|
105
|
+
showNodeModal: false
|
|
127
106
|
});
|
|
128
|
-
this
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
107
|
+
_defineProperty(this, "network", null);
|
|
108
|
+
_defineProperty(this, "selectAllByTag", tag => () => {
|
|
109
|
+
const allBranches = this.state.dtt.config.branches;
|
|
110
|
+
const matchingParticles = Object.keys(allBranches).filter(branch => {
|
|
111
|
+
const particle = allBranches[branch].particle;
|
|
112
|
+
const allTags = this.context.metadata.particleProperties[particle].tags;
|
|
113
|
+
return allTags.includes(tag);
|
|
114
|
+
}).sort();
|
|
115
|
+
this.setState({
|
|
116
|
+
selectedParticleId: matchingParticles
|
|
117
|
+
});
|
|
118
|
+
this.network.selectNodes(matchingParticles);
|
|
134
119
|
});
|
|
135
|
-
this
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
120
|
+
_defineProperty(this, "selectGroup", group => () => {
|
|
121
|
+
const selection = group.split(",");
|
|
122
|
+
this.setState({
|
|
123
|
+
selectedParticleId: selection
|
|
124
|
+
});
|
|
125
|
+
this.network.selectNodes(selection);
|
|
126
|
+
});
|
|
127
|
+
_defineProperty(this, "countGroupTools", group => {
|
|
128
|
+
const toolList = this.state.dtt.listTools(group);
|
|
129
|
+
const nTools = toolList.length;
|
|
130
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.OverlayTrigger, {
|
|
131
|
+
overlay: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Popover, {
|
|
132
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.ListGroup, {
|
|
133
|
+
children: toolList.map(tool => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.ListGroup.Item, {
|
|
134
|
+
children: tool
|
|
135
|
+
}, tool))
|
|
136
|
+
})
|
|
137
|
+
}),
|
|
138
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
139
|
+
children: [nTools, " TupleTool", nTools === 1 ? "" : "s"]
|
|
146
140
|
})
|
|
147
|
-
})
|
|
148
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
149
|
-
children: [nTools, " TupleTool", nTools === 1 ? "" : "s"]
|
|
150
|
-
})
|
|
141
|
+
});
|
|
151
142
|
});
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
143
|
+
_defineProperty(this, "callbackCloseNodeConf", () => {
|
|
144
|
+
this.setState({
|
|
145
|
+
showNodeModal: false
|
|
146
|
+
});
|
|
156
147
|
});
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
148
|
+
_defineProperty(this, "callbackSignalUpdated", () => {
|
|
149
|
+
this.setState({
|
|
150
|
+
updated: true
|
|
151
|
+
});
|
|
161
152
|
});
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
153
|
+
_defineProperty(this, "sendData", () => {
|
|
154
|
+
const dttConfig = _lodash.default.cloneDeep(this.state.dtt.config);
|
|
155
|
+
this.setState({
|
|
156
|
+
updated: false,
|
|
157
|
+
lastSave: dttConfig
|
|
158
|
+
});
|
|
159
|
+
this.props.parentCallback(dttConfig);
|
|
168
160
|
});
|
|
169
|
-
this
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
updated: false
|
|
161
|
+
_defineProperty(this, "revertDTT", () => {
|
|
162
|
+
let dtt = this.state.dtt;
|
|
163
|
+
dtt.config = _lodash.default.cloneDeep(this.state.lastSave);
|
|
164
|
+
this.setState({
|
|
165
|
+
dtt: dtt,
|
|
166
|
+
updated: false
|
|
167
|
+
});
|
|
177
168
|
});
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
169
|
+
_defineProperty(this, "displaySelectionDescriptor", decaySelector => {
|
|
170
|
+
// split into an array for easier looping
|
|
171
|
+
// XXX: we could probably use descriptors.list in conjunction with descriptors.mapped_list here...
|
|
172
|
+
const lokiArray = decaySelector.replace(/^\[/, "").replace(/^\^\[/, "^").replace(/\]CC$/, "").split(" ");
|
|
173
|
+
const texArray = lokiArray.map(particle => {
|
|
174
|
+
if (particle === "->") {
|
|
175
|
+
return "\\to";
|
|
176
|
+
} else {
|
|
177
|
+
let name = particle.replace(/^\^/, ""); // name will be used to look up the particle in metadata
|
|
178
|
+
// detect and handle sub-decays (marked with round braces)
|
|
179
|
+
// A -> (B -> C D) E
|
|
180
|
+
// A -> (B -> C (D -> E F)) G
|
|
181
|
+
let braces = ["", ""];
|
|
182
|
+
const numBraces = [/\(/g, /\)/g].map(pattern => (name.match(pattern) || []).length);
|
|
183
|
+
if (name.startsWith("(")) {
|
|
184
|
+
name = name.replace(/^\(/, "");
|
|
185
|
+
braces[0] = "(";
|
|
186
|
+
} else if (name.endsWith(")") && numBraces[1] > numBraces[0]) {
|
|
187
|
+
name = name.replace(/\)+$/, "");
|
|
188
|
+
braces[1] = ")".repeat(numBraces[1] - numBraces[0]);
|
|
189
|
+
}
|
|
190
|
+
// spit edge-cases to the console and handle them somewhat gracefully
|
|
191
|
+
if (!Object.keys(this.context.metadata.particleProperties).includes(name)) {
|
|
192
|
+
console.error("".concat(name, " not found in particle property metadata!"));
|
|
193
|
+
return "\\text{".concat(particle, "}");
|
|
194
|
+
}
|
|
195
|
+
let latex = this.context.metadata.particleProperties[name].latex;
|
|
196
|
+
// mark particles by underlining them
|
|
197
|
+
// TODO: if we can figure out colour with mathjax-react, turn them blue instead
|
|
198
|
+
if (particle.startsWith("^")) {
|
|
199
|
+
latex = "\\underline{".concat(latex, "}");
|
|
200
|
+
}
|
|
201
|
+
// remember to put the braces back
|
|
202
|
+
return "".concat(braces[0]).concat(latex).concat(braces[1]);
|
|
210
203
|
}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
}
|
|
204
|
+
});
|
|
205
|
+
return texArray.join(" ");
|
|
214
206
|
});
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
207
|
+
_defineProperty(this, "displaySelection", selection => {
|
|
208
|
+
const decaySelector = this.props.decay.descriptors.template.replace(/\${(\w+)}/g, (_, v) => selection.includes(v) ? "^" : "");
|
|
209
|
+
const latex = this.displaySelectionDescriptor(decaySelector);
|
|
210
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.OverlayTrigger, {
|
|
211
|
+
overlay: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Popover, {
|
|
212
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Popover.Header, {
|
|
213
|
+
children: "LoKi selector"
|
|
214
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Popover.Body, {
|
|
215
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("code", {
|
|
216
|
+
children: decaySelector
|
|
217
|
+
})
|
|
218
|
+
})]
|
|
219
|
+
}),
|
|
220
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
221
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_mathjaxReact.MathComponent, {
|
|
222
|
+
tex: "".concat(latex),
|
|
223
|
+
display: false
|
|
227
224
|
})
|
|
228
|
-
})]
|
|
229
|
-
}),
|
|
230
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
231
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_mathjaxReact.MathComponent, {
|
|
232
|
-
tex: `${latex}`,
|
|
233
|
-
display: false
|
|
234
225
|
})
|
|
235
|
-
})
|
|
236
|
-
});
|
|
237
|
-
};
|
|
238
|
-
toggleZoomLock = () => {
|
|
239
|
-
this.network.setOptions({
|
|
240
|
-
interaction: {
|
|
241
|
-
zoomView: this.state.lockGraphZoom
|
|
242
|
-
}
|
|
226
|
+
});
|
|
243
227
|
});
|
|
244
|
-
this
|
|
245
|
-
|
|
228
|
+
_defineProperty(this, "toggleZoomLock", () => {
|
|
229
|
+
this.network.setOptions({
|
|
230
|
+
interaction: {
|
|
231
|
+
zoomView: this.state.lockGraphZoom
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
this.setState({
|
|
235
|
+
lockGraphZoom: !this.state.lockGraphZoom
|
|
236
|
+
});
|
|
246
237
|
});
|
|
247
|
-
}
|
|
238
|
+
}
|
|
248
239
|
render() {
|
|
249
240
|
this.state.dtt.pruneGroups(); // Make sure no empty groups
|
|
250
241
|
const selection = this.state.selectedParticleId;
|
|
@@ -308,7 +299,7 @@ class DecayTree extends _react.default.Component {
|
|
|
308
299
|
overlay: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Popover, {
|
|
309
300
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Popover.Body, {
|
|
310
301
|
children: ["The ROOT TTree will be found under ", /*#__PURE__*/(0, _jsxRuntime.jsx)("code", {
|
|
311
|
-
children:
|
|
302
|
+
children: "DecayTreeTuple/".concat(dttName)
|
|
312
303
|
}), "."]
|
|
313
304
|
})
|
|
314
305
|
}),
|
|
@@ -391,6 +382,9 @@ class DecayTree extends _react.default.Component {
|
|
|
391
382
|
})
|
|
392
383
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Card.Title, {
|
|
393
384
|
children: ["Current selection: ", selectedName]
|
|
385
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Card.Title, {
|
|
386
|
+
className: "d-flex justify-content-between align-items-center flex-column",
|
|
387
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_semform.default, {})
|
|
394
388
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ConfigNode.default, {
|
|
395
389
|
dtt: this.state.dtt,
|
|
396
390
|
particleID: selection,
|
|
@@ -440,6 +434,19 @@ class DecayTree extends _react.default.Component {
|
|
|
440
434
|
});
|
|
441
435
|
}
|
|
442
436
|
}
|
|
437
|
+
_defineProperty(DecayTree, "contextType", _MetadataContext.default);
|
|
438
|
+
_defineProperty(DecayTree, "options", _objectSpread(_objectSpread({}, _config.default.dttGraphOptions), {}, {
|
|
439
|
+
nodes: _objectSpread(_objectSpread({}, _config.default.dttGraphOptions.nodes), {}, {
|
|
440
|
+
chosen: {
|
|
441
|
+
label: (values, id, selected, _hovering) => {
|
|
442
|
+
if (selected) {
|
|
443
|
+
values.mod = "bold";
|
|
444
|
+
values.color = "#0d6efd";
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
})
|
|
449
|
+
}));
|
|
443
450
|
DecayTree.propTypes = {
|
|
444
451
|
decay: _propTypes.default.object,
|
|
445
452
|
dttConfig: _propTypes.default.object,
|
|
@@ -13,9 +13,10 @@ var _reactBootstrap = require("react-bootstrap");
|
|
|
13
13
|
var _config = _interopRequireDefault(require("../config"));
|
|
14
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
15
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
|
-
function
|
|
17
|
-
function
|
|
18
|
-
|
|
16
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
17
|
+
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; }
|
|
18
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : 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); } /*****************************************************************************\
|
|
19
20
|
* (c) Copyright 2021 CERN for the benefit of the LHCb Collaboration *
|
|
20
21
|
* *
|
|
21
22
|
* This software is distributed under the terms of the GNU General Public *
|
|
@@ -25,40 +26,42 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
25
26
|
* granted to it by virtue of its status as an Intergovernmental Organization *
|
|
26
27
|
* or submit itself to any jurisdiction. *
|
|
27
28
|
\*****************************************************************************/
|
|
28
|
-
|
|
29
29
|
class DecaysList extends React.Component {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
if (
|
|
47
|
-
this.state.selectedDecays.
|
|
30
|
+
constructor() {
|
|
31
|
+
super(...arguments);
|
|
32
|
+
_defineProperty(this, "state", {
|
|
33
|
+
items: this.props.decays.length > _config.default.batch_size ? this.props.decays.slice(0, _config.default.batch_size) : this.props.decays,
|
|
34
|
+
index: this.props.decays.length > _config.default.batch_size ? _config.default.batch_size - 1 : this.props.decays.length,
|
|
35
|
+
selectedDecays: this.props.selectedDecays
|
|
36
|
+
});
|
|
37
|
+
_defineProperty(this, "fetchMoreData", () => {
|
|
38
|
+
setTimeout(() => {
|
|
39
|
+
this.setState({
|
|
40
|
+
items: this.state.items.concat(this.props.decays.slice(this.state.index + 1, this.state.index + 1 + _config.default.batch_size)),
|
|
41
|
+
index: this.state.index + _config.default.batch_size < this.props.decays.length ? this.state.index + _config.default.batch_size : this.props.decays.length
|
|
42
|
+
});
|
|
43
|
+
}, 1000);
|
|
44
|
+
});
|
|
45
|
+
_defineProperty(this, "callbackFunction", childData => {
|
|
46
|
+
if (childData.selected) {
|
|
47
|
+
const index = this.state.selectedDecays.indexOf(childData.decay);
|
|
48
|
+
if (index > -1) {
|
|
49
|
+
this.state.selectedDecays.splice(index, 1);
|
|
50
|
+
}
|
|
51
|
+
} else {
|
|
52
|
+
this.state.selectedDecays.push(childData.decay);
|
|
48
53
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
return strippingDecayItem;
|
|
61
|
-
};
|
|
54
|
+
this.props.parentCallback(this.state.selectedDecays);
|
|
55
|
+
});
|
|
56
|
+
_defineProperty(this, "getDecayItem", () => {
|
|
57
|
+
const strippingDecayItem = this.state.items.map(decay => /*#__PURE__*/(0, _jsxRuntime.jsx)(_DecayItem.default, {
|
|
58
|
+
decay: decay,
|
|
59
|
+
selected: this.state.selectedDecays.some(selected => selected.descriptors.plain === decay.descriptors.plain),
|
|
60
|
+
parentCallback: this.callbackFunction
|
|
61
|
+
}, decay.descriptors.plain));
|
|
62
|
+
return strippingDecayItem;
|
|
63
|
+
});
|
|
64
|
+
}
|
|
62
65
|
render() {
|
|
63
66
|
const decayItem = this.getDecayItem();
|
|
64
67
|
const nShown = this.state.items.length;
|