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.
- package/README.md +1 -2
- package/dist/App.d.ts +12 -0
- package/dist/App.js +22 -0
- package/dist/components/ConfigFilesUploadingAlert.d.ts +1 -0
- package/dist/components/ConfigFilesUploadingAlert.js +5 -0
- package/dist/components/DatasetEventTypeBadge.d.ts +5 -0
- package/dist/components/DatasetEventTypeBadge.js +23 -0
- package/dist/components/DatasetInfo.d.ts +5 -0
- package/dist/components/DatasetInfo.js +21 -0
- package/dist/components/DecayLatex.d.ts +7 -0
- package/dist/components/DecayLatex.js +103 -0
- package/dist/components/DecayList.d.ts +8 -0
- package/dist/components/DecayList.js +37 -0
- package/dist/components/DecayListItem.d.ts +11 -0
- package/dist/components/DecayListItem.js +23 -0
- package/dist/components/DecayTagBadge.d.ts +5 -0
- package/dist/components/DecayTagBadge.js +21 -0
- package/dist/components/DecayTreeCard.d.ts +7 -0
- package/dist/components/DecayTreeCard.js +43 -0
- package/dist/components/DecayTreeCardHeader.d.ts +7 -0
- package/dist/components/DecayTreeCardHeader.js +5 -0
- package/dist/components/DecayTreeGraph.d.ts +9 -0
- package/dist/components/DecayTreeGraph.js +89 -0
- package/dist/components/DeleteButton.d.ts +9 -0
- package/dist/components/DeleteButton.js +16 -53
- package/dist/components/DttNameInput.d.ts +9 -0
- package/dist/components/DttNameInput.js +73 -0
- package/dist/components/LineTableRow.d.ts +9 -0
- package/dist/components/LineTableRow.js +123 -0
- package/dist/components/LoadingIndicator.d.ts +6 -0
- package/dist/components/LoadingIndicator.js +5 -0
- package/dist/components/NtupleWizard.d.ts +26 -0
- package/dist/components/NtupleWizard.js +28 -137
- package/dist/components/NumStrippingLinesBadge.d.ts +8 -0
- package/dist/components/NumStrippingLinesBadge.js +10 -0
- package/dist/components/ParticleDropdown.d.ts +8 -0
- package/dist/components/ParticleDropdown.js +33 -0
- package/dist/components/ParticleTagBadge.d.ts +9 -0
- package/dist/components/ParticleTagBadge.js +22 -0
- package/dist/components/ParticleTagFilters.d.ts +6 -0
- package/dist/components/ParticleTagFilters.js +51 -0
- package/dist/components/PolarityBadge.d.ts +5 -0
- package/dist/components/PolarityBadge.js +13 -33
- package/dist/components/StrippingLineBadge.d.ts +7 -0
- package/dist/components/StrippingLineBadge.js +29 -0
- package/dist/components/StrippingLineInfo.d.ts +8 -0
- package/dist/components/StrippingLineInfo.js +17 -0
- package/dist/components/SubmitRequestButton.d.ts +11 -0
- package/dist/components/SubmitRequestButton.js +39 -0
- package/dist/components/TagDropdown.d.ts +12 -0
- package/dist/components/TagDropdown.js +31 -0
- package/dist/components/TupleToolDocsAccordion.d.ts +5 -0
- package/dist/components/TupleToolDocsAccordion.js +14 -0
- package/dist/components/TupleToolDropdown.d.ts +21 -0
- package/dist/components/TupleToolDropdown.js +29 -0
- package/dist/components/TupleToolGroup.d.ts +6 -0
- package/dist/components/TupleToolGroup.js +22 -0
- package/dist/components/TupleToolLabel.d.ts +6 -0
- package/dist/components/TupleToolLabel.js +20 -0
- package/dist/components/TupleToolList.d.ts +7 -0
- package/dist/components/TupleToolList.js +38 -0
- package/dist/components/YearBadge.d.ts +5 -0
- package/dist/components/YearBadge.js +13 -33
- package/dist/components/modals/AddTupleToolModal.d.ts +7 -0
- package/dist/components/modals/AddTupleToolModal.js +32 -0
- package/dist/components/modals/ConfigureTupleToolModal.d.ts +8 -0
- package/dist/components/modals/ConfigureTupleToolModal.js +43 -0
- package/dist/components/modals/ReasonForRequestModal.d.ts +8 -0
- package/dist/components/modals/ReasonForRequestModal.js +49 -0
- package/dist/components/modals/UploadDttConfigModal.d.ts +7 -0
- package/dist/components/modals/UploadDttConfigModal.js +35 -0
- package/dist/components/modals/UploadProdConfigModal.d.ts +5 -0
- package/dist/components/modals/UploadProdConfigModal.js +27 -0
- package/dist/components/tupleToolParams/BoolParamInput.d.ts +16 -0
- package/dist/components/tupleToolParams/BoolParamInput.js +15 -0
- package/dist/components/tupleToolParams/DictParamInput.d.ts +14 -0
- package/dist/components/tupleToolParams/DictParamInput.js +31 -0
- package/dist/components/tupleToolParams/ListParamInput.d.ts +14 -0
- package/dist/components/tupleToolParams/ListParamInput.js +46 -0
- package/dist/components/tupleToolParams/NumParamInput.d.ts +18 -0
- package/dist/components/tupleToolParams/NumParamInput.js +25 -0
- package/dist/components/tupleToolParams/StrParamInput.d.ts +19 -0
- package/dist/components/tupleToolParams/StrParamInput.js +22 -0
- package/dist/config.d.ts +78 -0
- package/dist/config.js +72 -0
- package/dist/{style/DecaysList.css → index.d.ts} +2 -6
- package/dist/index.js +2 -11
- package/dist/models/bkPath.d.ts +11 -0
- package/dist/models/bkPath.js +40 -0
- package/dist/models/blobFile.d.ts +12 -0
- package/dist/models/blobFile.js +1 -0
- package/dist/models/decayData.d.ts +15 -0
- package/dist/models/decayData.js +1 -0
- package/dist/models/dropdownOption.d.ts +5 -0
- package/dist/models/dropdownOption.js +1 -0
- package/dist/models/dtt.d.ts +108 -0
- package/dist/models/dtt.js +149 -0
- package/dist/models/jobConfig.d.ts +7 -0
- package/dist/models/jobConfig.js +1 -0
- package/dist/models/particle.d.ts +12 -0
- package/dist/models/particle.js +1 -0
- package/dist/models/particleTag.d.ts +4 -0
- package/dist/models/particleTag.js +1 -0
- package/dist/models/rowData.d.ts +15 -0
- package/dist/models/rowData.js +1 -0
- package/dist/models/strippingLine.d.ts +5 -0
- package/dist/models/strippingLine.js +1 -0
- package/dist/models/strippingLineOption.d.ts +6 -0
- package/dist/models/strippingLineOption.js +1 -0
- package/dist/models/tupleTool.d.ts +8 -0
- package/dist/models/tupleTool.js +18 -0
- package/dist/models/tupleTreeGraphData.d.ts +20 -0
- package/dist/models/tupleTreeGraphData.js +1 -0
- package/dist/models/yamlFile.d.ts +11 -0
- package/dist/models/yamlFile.js +78 -0
- package/dist/pages/DecaySearchPage.d.ts +5 -0
- package/dist/pages/DecaySearchPage.js +197 -0
- package/dist/pages/DecayTreeConfigPage.d.ts +5 -0
- package/dist/pages/DecayTreeConfigPage.js +63 -0
- package/dist/pages/LinesTablePage.d.ts +14 -0
- package/dist/pages/LinesTablePage.js +120 -0
- package/dist/providers/DttProvider.d.ts +24 -0
- package/dist/providers/DttProvider.js +77 -0
- package/dist/providers/MetadataProvider.d.ts +87 -0
- package/dist/providers/MetadataProvider.js +50 -0
- package/dist/providers/ProductionConfigProvider.d.ts +14 -0
- package/dist/providers/ProductionConfigProvider.js +76 -0
- package/dist/providers/RequestProvider.d.ts +15 -0
- package/dist/providers/RequestProvider.js +35 -0
- package/dist/providers/RowsProvider.d.ts +14 -0
- package/dist/providers/RowsProvider.js +31 -0
- package/dist/utils/mathjaxUtils.d.ts +12 -0
- package/dist/utils/mathjaxUtils.js +24 -0
- package/dist/utils/utils.d.ts +31 -0
- package/dist/utils/utils.js +80 -0
- package/package.json +43 -21
- package/dist/components/App.js +0 -99
- package/dist/components/ConfigDict.js +0 -103
- package/dist/components/ConfigList.js +0 -94
- package/dist/components/ConfigNode.js +0 -320
- package/dist/components/ConfigValue.js +0 -86
- package/dist/components/Dataset.js +0 -67
- package/dist/components/Decay.js +0 -50
- package/dist/components/DecayItem.js +0 -101
- package/dist/components/DecayTag.js +0 -52
- package/dist/components/DecayTree.js +0 -451
- package/dist/components/DecaysList.js +0 -107
- package/dist/components/DescriptorsSearch.js +0 -352
- package/dist/components/EventTypeBadge.js +0 -45
- package/dist/components/ItemSearch.js +0 -120
- package/dist/components/LinesTable.js +0 -1105
- package/dist/components/ParticleTag.js +0 -54
- package/dist/components/SearchItem.js +0 -99
- package/dist/components/SelectParticle.js +0 -61
- package/dist/components/SelectTag.js +0 -66
- package/dist/components/SelectTool.js +0 -59
- package/dist/components/SelectVariables.js +0 -106
- package/dist/components/StrippingBadge.js +0 -64
- package/dist/components/StrippingLine.js +0 -50
- package/dist/components/TupleTool.js +0 -46
- package/dist/components/VariablesSearch.js +0 -128
- package/dist/config.json +0 -72
- package/dist/contexts/MetadataContext.js +0 -135
- package/dist/lib/BKPath.js +0 -58
- package/dist/lib/DTTConfig.js +0 -178
- package/dist/lib/mathjax.js +0 -35
- package/dist/lib/utils.js +0 -191
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
require("../style/DecaysList.css");
|
|
8
|
-
var React = _interopRequireWildcard(require("react"));
|
|
9
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
-
var _reactInfiniteScrollComponent = _interopRequireDefault(require("react-infinite-scroll-component"));
|
|
11
|
-
var _DecayItem = _interopRequireDefault(require("./DecayItem"));
|
|
12
|
-
var _reactBootstrap = require("react-bootstrap");
|
|
13
|
-
var _config = _interopRequireDefault(require("../config"));
|
|
14
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
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); } /*****************************************************************************\
|
|
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 DecaysList extends React.Component {
|
|
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);
|
|
53
|
-
}
|
|
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
|
-
}
|
|
65
|
-
render() {
|
|
66
|
-
const decayItem = this.getDecayItem();
|
|
67
|
-
const nShown = this.state.items.length;
|
|
68
|
-
const nTotal = this.props.decays.length;
|
|
69
|
-
if (nShown === 0) {
|
|
70
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Alert, {
|
|
71
|
-
variant: "danger",
|
|
72
|
-
children: "No matching decays"
|
|
73
|
-
});
|
|
74
|
-
} else {
|
|
75
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
76
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.ListGroup, {
|
|
77
|
-
variant: "flush",
|
|
78
|
-
id: "scrollableDiv",
|
|
79
|
-
className: "decaysListClass",
|
|
80
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactInfiniteScrollComponent.default, {
|
|
81
|
-
dataLength: nShown,
|
|
82
|
-
next: this.fetchMoreData,
|
|
83
|
-
hasMore: nShown < nTotal,
|
|
84
|
-
loader: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Alert, {
|
|
85
|
-
variant: "warning",
|
|
86
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Spinner, {
|
|
87
|
-
size: "sm",
|
|
88
|
-
animation: "border"
|
|
89
|
-
}), " Loading next", " ", Math.min(_config.default.batch_size, nTotal - nShown), " decays..."]
|
|
90
|
-
}),
|
|
91
|
-
scrollableTarget: "scrollableDiv",
|
|
92
|
-
children: decayItem
|
|
93
|
-
})
|
|
94
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Alert, {
|
|
95
|
-
variant: "light",
|
|
96
|
-
children: ["Showing ", nShown, " of ", nTotal, " matching decays"]
|
|
97
|
-
})]
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
DecaysList.propTypes = {
|
|
103
|
-
decays: _propTypes.default.arrayOf(_propTypes.default.object),
|
|
104
|
-
selectedDecays: _propTypes.default.arrayOf(_propTypes.default.object),
|
|
105
|
-
parentCallback: _propTypes.default.func
|
|
106
|
-
};
|
|
107
|
-
var _default = exports.default = DecaysList;
|
|
@@ -1,352 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _lodash = _interopRequireDefault(require("lodash.memoize"));
|
|
8
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
var _react = _interopRequireDefault(require("react"));
|
|
10
|
-
var _reactBootstrap = require("react-bootstrap");
|
|
11
|
-
var _reactRouterDom = require("react-router-dom");
|
|
12
|
-
var _reactSelect = _interopRequireDefault(require("react-select"));
|
|
13
|
-
var _MetadataContext = _interopRequireDefault(require("../contexts/MetadataContext"));
|
|
14
|
-
var _DecaysList = _interopRequireDefault(require("./DecaysList"));
|
|
15
|
-
var _SelectParticle = _interopRequireDefault(require("./SelectParticle"));
|
|
16
|
-
var _SelectTag = _interopRequireDefault(require("./SelectTag"));
|
|
17
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
|
-
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; }
|
|
20
|
-
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; }
|
|
21
|
-
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; }
|
|
22
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
23
|
-
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); } /*****************************************************************************\
|
|
24
|
-
* (c) Copyright 2021 CERN for the benefit of the LHCb Collaboration *
|
|
25
|
-
* *
|
|
26
|
-
* This software is distributed under the terms of the GNU General Public *
|
|
27
|
-
* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". *
|
|
28
|
-
* *
|
|
29
|
-
* In applying this licence, CERN does not waive the privileges and immunities *
|
|
30
|
-
* granted to it by virtue of its status as an Intergovernmental Organization *
|
|
31
|
-
* or submit itself to any jurisdiction. *
|
|
32
|
-
\*****************************************************************************/
|
|
33
|
-
class DescriptorsSearch extends _react.default.Component {
|
|
34
|
-
constructor() {
|
|
35
|
-
super(...arguments);
|
|
36
|
-
_defineProperty(this, "state", {
|
|
37
|
-
selectedContains: [],
|
|
38
|
-
selectedHead: null,
|
|
39
|
-
selectedHeadTags: [],
|
|
40
|
-
selectedDecays: this.props.rows.map(row => row.decay),
|
|
41
|
-
selectedTags: null,
|
|
42
|
-
selectedLine: null,
|
|
43
|
-
chargeConjugateContains: true,
|
|
44
|
-
chargeConjugateHeads: true,
|
|
45
|
-
containsMatchType: "all",
|
|
46
|
-
headMatchType: "exactly",
|
|
47
|
-
tagMatchType: "none",
|
|
48
|
-
headTagMatchType: "all",
|
|
49
|
-
onlySelected: false
|
|
50
|
-
});
|
|
51
|
-
_defineProperty(this, "updateState", key => contents => {
|
|
52
|
-
this.setState({
|
|
53
|
-
[key]: contents
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
_defineProperty(this, "toggleState", key => () => {
|
|
57
|
-
this.setState({
|
|
58
|
-
[key]: !this.state[key]
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
_defineProperty(this, "callbackFunction", childData => {
|
|
62
|
-
this.setState({
|
|
63
|
-
selectedDecays: childData
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
_defineProperty(this, "createRow", (decay, id) => {
|
|
67
|
-
return Object({
|
|
68
|
-
id: id,
|
|
69
|
-
decay: decay,
|
|
70
|
-
lines: [],
|
|
71
|
-
paths: [],
|
|
72
|
-
// Currently-selected paths
|
|
73
|
-
pathOptions: [],
|
|
74
|
-
// Keep a history of valid paths
|
|
75
|
-
dtt: false
|
|
76
|
-
});
|
|
77
|
-
});
|
|
78
|
-
_defineProperty(this, "sendData", () => {
|
|
79
|
-
const selectedDecays = this.state.selectedDecays;
|
|
80
|
-
const selectedDecayDescriptors = selectedDecays.map(decay => decay.descriptors.plain);
|
|
81
|
-
// Loop through rows and remove any not-selected decays
|
|
82
|
-
let rows = [...this.props.rows].filter(row => selectedDecayDescriptors.includes(row.decay.descriptors.plain));
|
|
83
|
-
const existingDecayDescriptors = rows.map(row => row.decay.descriptors.plain);
|
|
84
|
-
// Loop through selected decays and add any new rows
|
|
85
|
-
const newDecays = selectedDecays.filter(decay => !existingDecayDescriptors.includes(decay.descriptors.plain));
|
|
86
|
-
newDecays.forEach(decay => {
|
|
87
|
-
const rowIDs = rows.map(row => row.id);
|
|
88
|
-
let newRowID = 0;
|
|
89
|
-
while (rowIDs.includes(newRowID)) {
|
|
90
|
-
newRowID += 1;
|
|
91
|
-
}
|
|
92
|
-
rows.push(this.createRow(decay, newRowID));
|
|
93
|
-
});
|
|
94
|
-
this.props.parentCallback(rows.map(row => _objectSpread(_objectSpread({}, row), {}, {
|
|
95
|
-
dtt: {
|
|
96
|
-
config: row.dtt
|
|
97
|
-
}
|
|
98
|
-
}))); // callback expects row.dtt to be a DTTConfig
|
|
99
|
-
});
|
|
100
|
-
_defineProperty(this, "allStrippingLines", (0, _lodash.default)(() => {
|
|
101
|
-
const allLines = [].concat(...Object.values(this.context.metadata.stripping).map(stream => Object.keys(stream)));
|
|
102
|
-
const uniqueLines = new Set(allLines);
|
|
103
|
-
return [...uniqueLines];
|
|
104
|
-
}));
|
|
105
|
-
_defineProperty(this, "filterDecays", selectedTags => {
|
|
106
|
-
// XXX: selectedTags is passed as an arg because it's the only one with a non-empty default value.
|
|
107
|
-
// the value depends on async-loaded metadata, and I don't know how to put it in the state.
|
|
108
|
-
// TODO: can probably do some refactoring in here (cf variableMatch)
|
|
109
|
-
let newDecays = Object.values(this.context.metadata.decays);
|
|
110
|
-
if (this.state.selectedContains) {
|
|
111
|
-
newDecays = newDecays.filter(decay => {
|
|
112
|
-
const conditions = this.state.selectedContains.map(element => {
|
|
113
|
-
const particle = element.value;
|
|
114
|
-
const antiparticle = this.context.metadata.particleProperties[particle]["antiparticle"];
|
|
115
|
-
return decay.descriptors.plain.includes(particle) || this.state.chargeConjugateContains && decay.descriptors.plain.includes(antiparticle);
|
|
116
|
-
});
|
|
117
|
-
return DescriptorsSearch.variableMatch(this.state.containsMatchType, conditions);
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
if (this.state.headMatchType === "exactly") {
|
|
121
|
-
if (this.state.selectedHead) {
|
|
122
|
-
const particle = this.state.selectedHead.value;
|
|
123
|
-
const antiparticle = this.context.metadata.particleProperties[particle]["antiparticle"];
|
|
124
|
-
newDecays = newDecays.filter(decay => {
|
|
125
|
-
const head = decay.descriptors.list[0];
|
|
126
|
-
return head === particle || this.state.chargeConjugateHeads && head === antiparticle;
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
} else if (this.state.headMatchType === "category") {
|
|
130
|
-
if (this.state.selectedHeadTags) {
|
|
131
|
-
newDecays = newDecays.filter(decay => {
|
|
132
|
-
const conditions = this.state.selectedHeadTags.map(element => {
|
|
133
|
-
const tag = element.value;
|
|
134
|
-
const head = this.context.metadata.particleProperties[decay.descriptors.list[0]];
|
|
135
|
-
return head.tags.includes(tag);
|
|
136
|
-
});
|
|
137
|
-
return DescriptorsSearch.variableMatch(this.state.headTagMatchType, conditions);
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
if (this.state.onlySelected) {
|
|
142
|
-
newDecays = newDecays.filter(decay => this.state.selectedDecays.map(selectedDecay => selectedDecay.descriptors.plain).includes(decay.descriptors.plain));
|
|
143
|
-
}
|
|
144
|
-
if (selectedTags) {
|
|
145
|
-
newDecays = newDecays.filter(decay => {
|
|
146
|
-
const conditions = selectedTags.map(element => {
|
|
147
|
-
const tag = element.value;
|
|
148
|
-
return decay.tags.includes(tag);
|
|
149
|
-
});
|
|
150
|
-
return DescriptorsSearch.variableMatch(this.state.tagMatchType, conditions);
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
if (this.state.selectedLine) {
|
|
154
|
-
const line = this.state.selectedLine.value;
|
|
155
|
-
newDecays = newDecays.filter(decay => {
|
|
156
|
-
const decayStreamLines = Object.keys(decay.lines);
|
|
157
|
-
const decayLines = new Set(decayStreamLines.map(streamLine => streamLine.split("/")[1]));
|
|
158
|
-
return decayLines.has(line);
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
return newDecays;
|
|
162
|
-
});
|
|
163
|
-
_defineProperty(this, "getDecayList", () => {
|
|
164
|
-
const strippingSelectedTags = this.state.selectedTags !== null // If a value has been chosen by the user...
|
|
165
|
-
? this.state.selectedTags // ... then set according to the state.
|
|
166
|
-
: this.context.loaded.userHints // Otherwise, if the metadata is loaded, set the default value...
|
|
167
|
-
? _SelectTag.default.createOptions(this.context.metadata.userHints.decayTags, tag => tag.hide) : []; // ... or empty if not loaded yet
|
|
168
|
-
const filteredDecays = this.context.loaded.decays ? this.filterDecays(strippingSelectedTags) : [];
|
|
169
|
-
const strippingDecayList = /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
170
|
-
children: this.context.loaded.decays ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_DecaysList.default, {
|
|
171
|
-
decays: filteredDecays,
|
|
172
|
-
selectedDecays: this.state.selectedDecays,
|
|
173
|
-
parentCallback: this.callbackFunction
|
|
174
|
-
}, JSON.stringify(filteredDecays)) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Alert, {
|
|
175
|
-
variant: "warning",
|
|
176
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Spinner, {
|
|
177
|
-
size: "sm",
|
|
178
|
-
animation: "border"
|
|
179
|
-
}), " Loading decays..."]
|
|
180
|
-
})
|
|
181
|
-
});
|
|
182
|
-
return strippingDecayList;
|
|
183
|
-
});
|
|
184
|
-
_defineProperty(this, "getExtraInputs", () => {
|
|
185
|
-
const strippingSelectedTags = this.state.selectedTags !== null // If a value has been chosen by the user...
|
|
186
|
-
? this.state.selectedTags // ... then set according to the state.
|
|
187
|
-
: this.context.loaded.userHints // Otherwise, if the metadata is loaded, set the default value...
|
|
188
|
-
? _SelectTag.default.createOptions(this.context.metadata.userHints.decayTags, tag => tag.hide) : []; // ... or empty if not loaded yet
|
|
189
|
-
const strippingExtraInput = /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
190
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.InputGroup, {
|
|
191
|
-
size: "sm",
|
|
192
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.DropdownButton, {
|
|
193
|
-
title: "Tags (" + this.state.tagMatchType + " of):",
|
|
194
|
-
variant: "outline-secondary",
|
|
195
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(DescriptorsSearch.DropdownMatchTypes, {
|
|
196
|
-
parent: this,
|
|
197
|
-
stateItem: "tagMatchType",
|
|
198
|
-
options: ["any", "all", "none"]
|
|
199
|
-
})
|
|
200
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_SelectTag.default, {
|
|
201
|
-
isMulti: true,
|
|
202
|
-
type: "decayTags",
|
|
203
|
-
placeholder: "Decay tags",
|
|
204
|
-
value: strippingSelectedTags,
|
|
205
|
-
onChange: this.updateState("selectedTags"),
|
|
206
|
-
closeMenuOnSelect: false
|
|
207
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
208
|
-
className: "react-select form-control p-0",
|
|
209
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactSelect.default, {
|
|
210
|
-
placeholder: "Stripping line",
|
|
211
|
-
isClearable: true,
|
|
212
|
-
options: this.context.loaded.stripping ? this.allStrippingLines().map(line => Object({
|
|
213
|
-
value: line,
|
|
214
|
-
label: line
|
|
215
|
-
})) : [],
|
|
216
|
-
onChange: this.updateState("selectedLine"),
|
|
217
|
-
isLoading: !this.context.loaded.stripping
|
|
218
|
-
})
|
|
219
|
-
})]
|
|
220
|
-
})
|
|
221
|
-
});
|
|
222
|
-
return strippingExtraInput;
|
|
223
|
-
});
|
|
224
|
-
}
|
|
225
|
-
static DropdownMatchTypes(props) {
|
|
226
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
227
|
-
children: props.options.map(option => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Dropdown.Item, {
|
|
228
|
-
active: props.parent.state[props.stateItem] === option,
|
|
229
|
-
onClick: () => props.parent.setState({
|
|
230
|
-
[props.stateItem]: option
|
|
231
|
-
}),
|
|
232
|
-
children: option
|
|
233
|
-
}, option))
|
|
234
|
-
});
|
|
235
|
-
}
|
|
236
|
-
static DropdownChargeConjugate(props) {
|
|
237
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
238
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Dropdown.Item, {
|
|
239
|
-
active: props.parent.state[props.stateItem],
|
|
240
|
-
onClick: () => props.parent.setState({
|
|
241
|
-
[props.stateItem]: true
|
|
242
|
-
}),
|
|
243
|
-
children: "Include antiparticles"
|
|
244
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Dropdown.Item, {
|
|
245
|
-
active: !props.parent.state[props.stateItem],
|
|
246
|
-
onClick: () => props.parent.setState({
|
|
247
|
-
[props.stateItem]: false
|
|
248
|
-
}),
|
|
249
|
-
children: "Exclude antiparticles"
|
|
250
|
-
})]
|
|
251
|
-
});
|
|
252
|
-
}
|
|
253
|
-
render() {
|
|
254
|
-
const nSelected = this.state.selectedDecays.length;
|
|
255
|
-
const {
|
|
256
|
-
basePath
|
|
257
|
-
} = this.props;
|
|
258
|
-
const decayList = this.getDecayList();
|
|
259
|
-
const extraInputs = this.getExtraInputs();
|
|
260
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
261
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("h3", {
|
|
262
|
-
children: "Decay search"
|
|
263
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.InputGroup, {
|
|
264
|
-
size: "sm",
|
|
265
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.DropdownButton, {
|
|
266
|
-
title: "Head (" + (this.state.headMatchType === "exactly" ? this.state.headMatchType : this.state.headTagMatchType + " of") + "):",
|
|
267
|
-
variant: "outline-secondary",
|
|
268
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(DescriptorsSearch.DropdownMatchTypes, {
|
|
269
|
-
parent: this,
|
|
270
|
-
stateItem: "headMatchType",
|
|
271
|
-
options: ["exactly", "category"]
|
|
272
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Dropdown.Divider, {}), this.state.headMatchType === "exactly" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(DescriptorsSearch.DropdownChargeConjugate, {
|
|
273
|
-
parent: this,
|
|
274
|
-
stateItem: "chargeConjugateHeads"
|
|
275
|
-
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(DescriptorsSearch.DropdownMatchTypes, {
|
|
276
|
-
parent: this,
|
|
277
|
-
stateItem: "headTagMatchType",
|
|
278
|
-
options: ["any", "all", "none"]
|
|
279
|
-
})]
|
|
280
|
-
}), this.state.headMatchType === "exactly" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_SelectParticle.default, {
|
|
281
|
-
isClearable: true,
|
|
282
|
-
onlyHeads: true,
|
|
283
|
-
placeholder: "Decay head",
|
|
284
|
-
onChange: this.updateState("selectedHead")
|
|
285
|
-
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_SelectTag.default, {
|
|
286
|
-
isMulti: true,
|
|
287
|
-
type: "particleTags",
|
|
288
|
-
placeholder: "Decay head",
|
|
289
|
-
filter: tag => !tag.hide,
|
|
290
|
-
onChange: this.updateState("selectedHeadTags")
|
|
291
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.DropdownButton, {
|
|
292
|
-
title: "Contains (" + this.state.containsMatchType + " of):",
|
|
293
|
-
variant: "outline-secondary",
|
|
294
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(DescriptorsSearch.DropdownMatchTypes, {
|
|
295
|
-
parent: this,
|
|
296
|
-
stateItem: "containsMatchType",
|
|
297
|
-
options: ["any", "all", "none"]
|
|
298
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Dropdown.Divider, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(DescriptorsSearch.DropdownChargeConjugate, {
|
|
299
|
-
parent: this,
|
|
300
|
-
stateItem: "chargeConjugateContains"
|
|
301
|
-
})]
|
|
302
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_SelectParticle.default, {
|
|
303
|
-
isMulti: true,
|
|
304
|
-
onlyKnown: true,
|
|
305
|
-
placeholder: "Particles in decay...",
|
|
306
|
-
onChange: this.updateState("selectedContains"),
|
|
307
|
-
closeMenuOnSelect: false
|
|
308
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.InputGroup.Text, {
|
|
309
|
-
children: "Show only selected:"
|
|
310
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.InputGroup.Checkbox, {
|
|
311
|
-
onChange: this.toggleState("onlySelected")
|
|
312
|
-
})]
|
|
313
|
-
}), extraInputs, decayList, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.Link, {
|
|
314
|
-
to: basePath,
|
|
315
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.OverlayTrigger, {
|
|
316
|
-
overlay: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Tooltip, {
|
|
317
|
-
children: "Return to production configuration"
|
|
318
|
-
}),
|
|
319
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Button, {
|
|
320
|
-
variant: "success",
|
|
321
|
-
type: "submit",
|
|
322
|
-
onClick: this.sendData,
|
|
323
|
-
children: ["Select ", /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Badge, {
|
|
324
|
-
pill: true,
|
|
325
|
-
bg: "secondary",
|
|
326
|
-
children: nSelected
|
|
327
|
-
})]
|
|
328
|
-
})
|
|
329
|
-
})
|
|
330
|
-
})]
|
|
331
|
-
});
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
_defineProperty(DescriptorsSearch, "contextType", _MetadataContext.default);
|
|
335
|
-
_defineProperty(DescriptorsSearch, "variableMatch", (type, conditions) => {
|
|
336
|
-
if (type === "all") {
|
|
337
|
-
return conditions.every(x => x);
|
|
338
|
-
} else if (type === "any") {
|
|
339
|
-
return conditions.some(x => x);
|
|
340
|
-
} else if (type === "none") {
|
|
341
|
-
return !conditions.some(x => x);
|
|
342
|
-
} else {
|
|
343
|
-
console.error("Unrecognised match type: " + type);
|
|
344
|
-
return true;
|
|
345
|
-
}
|
|
346
|
-
});
|
|
347
|
-
DescriptorsSearch.propTypes = {
|
|
348
|
-
rows: _propTypes.default.arrayOf(_propTypes.default.object),
|
|
349
|
-
parentCallback: _propTypes.default.func,
|
|
350
|
-
basePath: _propTypes.default.string.isRequired
|
|
351
|
-
};
|
|
352
|
-
var _default = exports.default = DescriptorsSearch;
|
|
@@ -1,45 +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 _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
-
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; }
|
|
13
|
-
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; }
|
|
14
|
-
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; }
|
|
15
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
16
|
-
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /*****************************************************************************\
|
|
17
|
-
* (c) Copyright 2021 CERN for the benefit of the LHCb Collaboration *
|
|
18
|
-
* *
|
|
19
|
-
* This software is distributed under the terms of the GNU General Public *
|
|
20
|
-
* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". *
|
|
21
|
-
* *
|
|
22
|
-
* In applying this licence, CERN does not waive the privileges and immunities *
|
|
23
|
-
* granted to it by virtue of its status as an Intergovernmental Organization *
|
|
24
|
-
* or submit itself to any jurisdiction. *
|
|
25
|
-
\*****************************************************************************/
|
|
26
|
-
class EventTypeBadge extends _react.default.Component {
|
|
27
|
-
render() {
|
|
28
|
-
const content = "" + this.props.eventType === "90000000" ? "Data" : "" + this.props.eventType;
|
|
29
|
-
const linkProps = content === "Data" ? {} : {
|
|
30
|
-
as: "a",
|
|
31
|
-
href: "http://lhcbdoc.web.cern.ch/lhcbdoc/decfiles/",
|
|
32
|
-
target: "_blank"
|
|
33
|
-
};
|
|
34
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Badge, _objectSpread(_objectSpread({
|
|
35
|
-
pill: true
|
|
36
|
-
}, linkProps), {}, {
|
|
37
|
-
bg: "primary",
|
|
38
|
-
children: content
|
|
39
|
-
}));
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
EventTypeBadge.propTypes = {
|
|
43
|
-
eventType: _propTypes.default.string
|
|
44
|
-
};
|
|
45
|
-
var _default = exports.default = EventTypeBadge;
|
|
@@ -1,120 +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 _Tooltip = _interopRequireDefault(require("react-bootstrap/Tooltip"));
|
|
10
|
-
var _OverlayTrigger = _interopRequireDefault(require("react-bootstrap/OverlayTrigger"));
|
|
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
|
-
const {
|
|
28
|
-
search
|
|
29
|
-
} = window.location;
|
|
30
|
-
const query = new URLSearchParams(search).get("s");
|
|
31
|
-
//const [searchQuery, setSearchQuery] = useState(query || '')
|
|
32
|
-
|
|
33
|
-
function compare(a, b) {
|
|
34
|
-
return Object.keys(a)[0] > Object.keys(b)[0] ? 1 : Object.keys(a)[0] < Object.keys(b)[0] ? -1 : 0;
|
|
35
|
-
}
|
|
36
|
-
class ItemSearch extends _react.default.Component {
|
|
37
|
-
constructor() {
|
|
38
|
-
super(...arguments);
|
|
39
|
-
_defineProperty(this, "state", {
|
|
40
|
-
items: this.props.data,
|
|
41
|
-
label: this.props.label,
|
|
42
|
-
searchQuery: query || ""
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
filterItems(variables, query) {
|
|
46
|
-
/*
|
|
47
|
-
const nInclOptions = variables.filter(
|
|
48
|
-
variable => !Object.keys(variable)[0].toLowerCase().includes(query.toLowerCase())
|
|
49
|
-
);
|
|
50
|
-
*/
|
|
51
|
-
const inclOptions = variables.filter(variable => Object.keys(variable)[0].toLowerCase().includes(query.toLowerCase()) && Object.keys(variable)[0].toLowerCase() !== query.toLowerCase());
|
|
52
|
-
const matchedOptions = variables.filter(variable => Object.keys(variable)[0].toLowerCase() === query.toLowerCase());
|
|
53
|
-
const orderedNewOptions = matchedOptions.sort(compare);
|
|
54
|
-
//this.setState({
|
|
55
|
-
return orderedNewOptions.concat(inclOptions);
|
|
56
|
-
//});
|
|
57
|
-
/* if (!query) {
|
|
58
|
-
return variables;
|
|
59
|
-
}
|
|
60
|
-
return variables.filter((variable) => {
|
|
61
|
-
const name = Object.keys(variable)[0].toLowerCase();
|
|
62
|
-
return name.includes(query.toLowerCase());
|
|
63
|
-
});*/
|
|
64
|
-
}
|
|
65
|
-
render() {
|
|
66
|
-
//const {decay} = this.props
|
|
67
|
-
const filteredItems = this.filterItems(this.state.items, this.state.searchQuery);
|
|
68
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
69
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("form", {
|
|
70
|
-
action: "/",
|
|
71
|
-
method: "get",
|
|
72
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
|
|
73
|
-
htmlFor: "header-search",
|
|
74
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
75
|
-
className: "visually-hidden",
|
|
76
|
-
children: "Search item"
|
|
77
|
-
})
|
|
78
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
|
|
79
|
-
value: this.state.searchQuery,
|
|
80
|
-
onInput: e => this.setState({
|
|
81
|
-
searchQuery: e.target.value
|
|
82
|
-
}),
|
|
83
|
-
type: "text",
|
|
84
|
-
id: "header-search",
|
|
85
|
-
placeholder: this.state.label,
|
|
86
|
-
name: "s"
|
|
87
|
-
})]
|
|
88
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
89
|
-
className: "scroll",
|
|
90
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("ul", {
|
|
91
|
-
children: filteredItems.map((variable, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_OverlayTrigger.default, {
|
|
92
|
-
placement: "top",
|
|
93
|
-
delay: {
|
|
94
|
-
hide: 450,
|
|
95
|
-
show: 300
|
|
96
|
-
},
|
|
97
|
-
overlay: props => /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.default, _objectSpread(_objectSpread({}, props), {}, {
|
|
98
|
-
children: Object.values(variable)[0]
|
|
99
|
-
})),
|
|
100
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
101
|
-
children: Object.keys(variable)[0]
|
|
102
|
-
})
|
|
103
|
-
}, index))
|
|
104
|
-
})
|
|
105
|
-
})]
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
ItemSearch.propTypes = {
|
|
110
|
-
data: _propTypes.default.arrayOf(_propTypes.default.object),
|
|
111
|
-
label: _propTypes.default.string
|
|
112
|
-
};
|
|
113
|
-
var _default = exports.default = ItemSearch;
|
|
114
|
-
/* <div>
|
|
115
|
-
<ul>
|
|
116
|
-
{filteredVariables.map(variable => (
|
|
117
|
-
<li key={Object.keys(variable)[0]}>{Object.keys(variable)[0]}</li>
|
|
118
|
-
))}
|
|
119
|
-
</ul>
|
|
120
|
-
</div> */
|