lhcb-ntuple-wizard-test 1.3.2 → 2.0.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/README.md +1 -2
- package/package.json +42 -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/DeleteButton.js +0 -56
- 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/NtupleWizard.js +0 -142
- package/dist/components/ParticleTag.js +0 -54
- package/dist/components/PolarityBadge.js +0 -35
- 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/components/YearBadge.js +0 -35
- package/dist/config.json +0 -72
- package/dist/contexts/MetadataContext.js +0 -135
- package/dist/index.js +0 -20
- 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
- package/dist/style/DecaysList.css +0 -15
package/README.md
CHANGED
|
@@ -47,14 +47,13 @@ npm install lhcb-ntuple-wizard
|
|
|
47
47
|
### Usage
|
|
48
48
|
|
|
49
49
|
```jsx
|
|
50
|
-
import React from "react";
|
|
51
50
|
import NtupleWizard from "lhcb-ntuple-wizard";
|
|
52
51
|
|
|
53
52
|
const App = () => {
|
|
54
53
|
return (
|
|
55
54
|
<NtupleWizard
|
|
56
55
|
basePath="/"
|
|
57
|
-
decaysPath="/decays"
|
|
56
|
+
decaysPath="/select-decays"
|
|
58
57
|
variablesPath="/variables"
|
|
59
58
|
submitLocation="" // Leave empty to hide the submit button -> overrides hideDownloadButtons to false
|
|
60
59
|
contactEmail="" // Leave empty to let the user fill in their email address
|
package/package.json
CHANGED
|
@@ -1,50 +1,49 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lhcb-ntuple-wizard-test",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "An application to access large-scale open data from LHCb",
|
|
5
5
|
"url": "https://gitlab.cern.ch/lhcb-dpa/wp6-analysis-preservation-and-open-data/lhcb-ntuple-wizard-frontend/issues",
|
|
6
6
|
"private": false,
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"module": "dist/index.js",
|
|
9
|
+
"types": "dist/index.d.ts",
|
|
10
|
+
"type": "module",
|
|
9
11
|
"files": [
|
|
10
12
|
"dist",
|
|
11
13
|
"README.md"
|
|
12
14
|
],
|
|
15
|
+
"exports": {
|
|
16
|
+
".": "./dist/index.js"
|
|
17
|
+
},
|
|
13
18
|
"dependencies": {
|
|
14
|
-
"@
|
|
19
|
+
"@mathjax/src": "4.1.0",
|
|
20
|
+
"better-react-mathjax": "2.3.0",
|
|
15
21
|
"bootstrap": "5.3.8",
|
|
22
|
+
"dompurify": "^3.3.1",
|
|
16
23
|
"email-validator": "2.0.4",
|
|
17
24
|
"js-yaml": "4.1.1",
|
|
18
25
|
"jszip": "3.10.1",
|
|
19
|
-
"lodash": "4.17.
|
|
26
|
+
"lodash": "^4.17.23",
|
|
20
27
|
"lodash.memoize": "4.1.2",
|
|
21
|
-
"mathjax-
|
|
28
|
+
"mathjax-full": "3.2.2",
|
|
22
29
|
"pako": "2.1.0",
|
|
23
|
-
"react": "18.3.1",
|
|
24
30
|
"react-bootstrap": "2.10.10",
|
|
25
31
|
"react-bootstrap-icons": "1.11.6",
|
|
26
|
-
"react-dom": "18.3.1",
|
|
27
32
|
"react-graph-vis": "1.0.7",
|
|
28
|
-
"react-infinite-scroll-component": "6.1.
|
|
29
|
-
"react-
|
|
30
|
-
|
|
31
|
-
|
|
33
|
+
"react-infinite-scroll-component": "^6.1.1",
|
|
34
|
+
"react-select": "5.10.2"
|
|
35
|
+
},
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"react": ">=19",
|
|
38
|
+
"react-dom": ">=19",
|
|
39
|
+
"react-router-dom": ">=7.12.0"
|
|
32
40
|
},
|
|
33
41
|
"overrides": {
|
|
34
42
|
"autoprefixer": "10.4.5"
|
|
35
43
|
},
|
|
36
44
|
"scripts": {
|
|
37
45
|
"start": "vite --open",
|
|
38
|
-
"build": "
|
|
39
|
-
"preview": "vite preview",
|
|
40
|
-
"transpile": "babel src -d dist --copy-files",
|
|
41
|
-
"prepublishOnly": "npm run transpile"
|
|
42
|
-
},
|
|
43
|
-
"eslintConfig": {
|
|
44
|
-
"extends": [
|
|
45
|
-
"react-app",
|
|
46
|
-
"react-app/jest"
|
|
47
|
-
]
|
|
46
|
+
"build": "tsc"
|
|
48
47
|
},
|
|
49
48
|
"browserslist": {
|
|
50
49
|
"production": [
|
|
@@ -64,6 +63,28 @@
|
|
|
64
63
|
"devDependencies": {
|
|
65
64
|
"@babel/cli": "7.28.3",
|
|
66
65
|
"@babel/preset-env": "7.28.3",
|
|
67
|
-
"@babel/preset-react": "7.27.1"
|
|
66
|
+
"@babel/preset-react": "7.27.1",
|
|
67
|
+
"@eslint/js": "^9.17.0",
|
|
68
|
+
"@types/jest": "^30.0.0",
|
|
69
|
+
"@types/js-yaml": "^4.0.9",
|
|
70
|
+
"@types/lodash": "^4.17.21",
|
|
71
|
+
"@types/lodash.memoize": "^4.1.9",
|
|
72
|
+
"@types/pako": "^2.0.4",
|
|
73
|
+
"@types/react": "^19.2.7",
|
|
74
|
+
"@types/react-dom": "^19.2.3",
|
|
75
|
+
"@types/react-router-dom": "^5.3.3",
|
|
76
|
+
"@types/vis": "^4.21.27",
|
|
77
|
+
"@typescript-eslint/eslint-plugin": "^8.51.0",
|
|
78
|
+
"@typescript-eslint/parser": "^8.51.0",
|
|
79
|
+
"@vitejs/plugin-react": "5.1.2",
|
|
80
|
+
"eslint": "^9.17.0",
|
|
81
|
+
"eslint-plugin-react": "^7.37.5",
|
|
82
|
+
"globals": "^16.0.0",
|
|
83
|
+
"react": "^19.2.3",
|
|
84
|
+
"react-dom": "^19.2.3",
|
|
85
|
+
"react-router-dom": "^7.12.0",
|
|
86
|
+
"typescript": "^5.9.3",
|
|
87
|
+
"vite": "7.3.0",
|
|
88
|
+
"vite-tsconfig-paths": "^6.0.3"
|
|
68
89
|
}
|
|
69
90
|
}
|
package/dist/components/App.js
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
require("bootstrap/dist/css/bootstrap.css");
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var _reactBootstrap = require("react-bootstrap");
|
|
10
|
-
var _reactBootstrapIcons = require("react-bootstrap-icons");
|
|
11
|
-
var _config = _interopRequireDefault(require("../config"));
|
|
12
|
-
var _NtupleWizard = _interopRequireDefault(require("./NtupleWizard"));
|
|
13
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
-
/*****************************************************************************\
|
|
16
|
-
* (c) Copyright 2021 CERN for the benefit of the LHCb Collaboration *
|
|
17
|
-
* *
|
|
18
|
-
* This software is distributed under the terms of the GNU General Public *
|
|
19
|
-
* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". *
|
|
20
|
-
* *
|
|
21
|
-
* In applying this licence, CERN does not waive the privileges and immunities *
|
|
22
|
-
* granted to it by virtue of its status as an Intergovernmental Organization *
|
|
23
|
-
* or submit itself to any jurisdiction. *
|
|
24
|
-
\*****************************************************************************/
|
|
25
|
-
|
|
26
|
-
class App extends _react.default.Component {
|
|
27
|
-
render() {
|
|
28
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
29
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Navbar, {
|
|
30
|
-
collapseOnSelect: true,
|
|
31
|
-
expand: "lg",
|
|
32
|
-
bg: "dark",
|
|
33
|
-
variant: "dark",
|
|
34
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Container, {
|
|
35
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Navbar.Brand, {
|
|
36
|
-
href: "/",
|
|
37
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
38
|
-
src: "/logo.svg",
|
|
39
|
-
height: "30",
|
|
40
|
-
className: "d-inline-block align-top",
|
|
41
|
-
alt: "LHCb logo"
|
|
42
|
-
}), " ", "LHCb NTuple Wizard"]
|
|
43
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Navbar.Toggle, {
|
|
44
|
-
"aria-controls": "responsive-navbar-nav"
|
|
45
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Navbar.Collapse, {
|
|
46
|
-
className: "justify-content-end",
|
|
47
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Nav, {
|
|
48
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.NavDropdown, {
|
|
49
|
-
title: "About",
|
|
50
|
-
id: "about-dropdown",
|
|
51
|
-
menuVariant: "dark",
|
|
52
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.NavDropdown.Item, {
|
|
53
|
-
href: "https://lhcb-dpa.web.cern.ch/lhcb-dpa/wp6/ntupling-wizard.html",
|
|
54
|
-
target: "_blank",
|
|
55
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrapIcons.House, {}), " Project home"]
|
|
56
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.NavDropdown.Item, {
|
|
57
|
-
href: "https://gitlab.cern.ch/lhcb-dpa/wp6-analysis-preservation-and-open-data/lhcb-ntuple-wizard-frontend",
|
|
58
|
-
target: "_blank",
|
|
59
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrapIcons.CodeSlash, {}), " Source code"]
|
|
60
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.NavDropdown.Item, {
|
|
61
|
-
href: _config.default.metadata_baseurl,
|
|
62
|
-
target: "_blank",
|
|
63
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrapIcons.Archive, {}), " Metadata files"]
|
|
64
|
-
})]
|
|
65
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Nav.Link, {
|
|
66
|
-
href: "https://opendata.cern.ch/",
|
|
67
|
-
target: "_blank",
|
|
68
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
69
|
-
src: "/open_data_portal.png",
|
|
70
|
-
height: "30",
|
|
71
|
-
alt: "CERN Open Data Portal"
|
|
72
|
-
})
|
|
73
|
-
})]
|
|
74
|
-
})
|
|
75
|
-
})]
|
|
76
|
-
})
|
|
77
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Container, {
|
|
78
|
-
className: "mt-4",
|
|
79
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_NtupleWizard.default, {
|
|
80
|
-
basePath: "/",
|
|
81
|
-
decaysPath: "/decays",
|
|
82
|
-
variablesPath: "/variables",
|
|
83
|
-
submitLocation: "" // Leave empty to hide the submit button -> overrides hideDownloadButtons to false
|
|
84
|
-
,
|
|
85
|
-
contactEmail: "" // Leave empty to let the user fill in their email address
|
|
86
|
-
,
|
|
87
|
-
hideDownloadButtons: false // Can be overridden by submitLocation
|
|
88
|
-
,
|
|
89
|
-
hideUploadButtons: false,
|
|
90
|
-
requestReasonMessage: "Please provide a reason for your request.",
|
|
91
|
-
requestSubmittedMessage: /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
92
|
-
children: "Your request has been submitted."
|
|
93
|
-
})
|
|
94
|
-
})
|
|
95
|
-
})]
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
var _default = exports.default = App;
|
|
@@ -1,103 +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 _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; }
|
|
13
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
14
|
-
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /*****************************************************************************\
|
|
15
|
-
* (c) Copyright 2021 CERN for the benefit of the LHCb Collaboration *
|
|
16
|
-
* *
|
|
17
|
-
* This software is distributed under the terms of the GNU General Public *
|
|
18
|
-
* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". *
|
|
19
|
-
* *
|
|
20
|
-
* In applying this licence, CERN does not waive the privileges and immunities *
|
|
21
|
-
* granted to it by virtue of its status as an Intergovernmental Organization *
|
|
22
|
-
* or submit itself to any jurisdiction. *
|
|
23
|
-
\*****************************************************************************/ //import ConfigValue from "./ConfigValue";
|
|
24
|
-
/*
|
|
25
|
-
* {str:str} -> <ConfigDict /> multiple rows of <input type="text" /> <input type="text" />
|
|
26
|
-
* {str:text} -> <ConfigDict /> multiple rows of <input type="text" /> <textarea />
|
|
27
|
-
*/ /*
|
|
28
|
-
* Keys have to be unique and not empty...
|
|
29
|
-
* this may cause problems if the callback is executed on every keystroke
|
|
30
|
-
*/
|
|
31
|
-
class ConfigDict extends _react.default.Component {
|
|
32
|
-
constructor() {
|
|
33
|
-
super(...arguments);
|
|
34
|
-
_defineProperty(this, "state", {
|
|
35
|
-
value: JSON.stringify(this.props.value, null, 2),
|
|
36
|
-
// Object.keys(this.props.value).map((key) => [key, this.props.value[key].valueOf()]),
|
|
37
|
-
edit: false,
|
|
38
|
-
error: ""
|
|
39
|
-
});
|
|
40
|
-
_defineProperty(this, "toggleEdit", () => {
|
|
41
|
-
this.setState({
|
|
42
|
-
edit: !this.state.edit
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
_defineProperty(this, "handleSave", () => {
|
|
46
|
-
try {
|
|
47
|
-
const value = JSON.parse(this.state.value);
|
|
48
|
-
this.props.callback(value);
|
|
49
|
-
this.setState({
|
|
50
|
-
error: ""
|
|
51
|
-
});
|
|
52
|
-
this.setState({
|
|
53
|
-
edit: false
|
|
54
|
-
});
|
|
55
|
-
} catch (e) {
|
|
56
|
-
this.setState({
|
|
57
|
-
error: "".concat(e)
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
_defineProperty(this, "handleUpdate", event => {
|
|
62
|
-
const {
|
|
63
|
-
value
|
|
64
|
-
} = event.target;
|
|
65
|
-
this.setState({
|
|
66
|
-
value: value
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
render() {
|
|
71
|
-
const errorMessage = this.state.error ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Alert, {
|
|
72
|
-
variant: "danger",
|
|
73
|
-
children: this.state.error
|
|
74
|
-
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {});
|
|
75
|
-
const buttonLabel = this.state.edit ? "Cancel" : "Edit";
|
|
76
|
-
const saveButton = this.state.edit ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Button, {
|
|
77
|
-
variant: "primary",
|
|
78
|
-
onClick: this.handleSave,
|
|
79
|
-
children: "Save"
|
|
80
|
-
}) : "";
|
|
81
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Card, {
|
|
82
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Card.Body, {
|
|
83
|
-
children: [errorMessage, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.FormControl, {
|
|
84
|
-
as: "textarea",
|
|
85
|
-
value: this.state.value,
|
|
86
|
-
onChange: this.handleUpdate,
|
|
87
|
-
disabled: !this.state.edit
|
|
88
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.ButtonGroup, {
|
|
89
|
-
children: [saveButton, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Button, {
|
|
90
|
-
variant: "outline-secondary",
|
|
91
|
-
onClick: this.toggleEdit,
|
|
92
|
-
children: buttonLabel
|
|
93
|
-
})]
|
|
94
|
-
})]
|
|
95
|
-
})
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
ConfigDict.propTypes = {
|
|
100
|
-
value: _propTypes.default.oneOfType([_propTypes.default.objectOf(_propTypes.default.string), _propTypes.default.objectOf(_propTypes.default.arrayOf(_propTypes.default.string))]),
|
|
101
|
-
callback: _propTypes.default.func
|
|
102
|
-
};
|
|
103
|
-
var _default = exports.default = ConfigDict;
|
|
@@ -1,94 +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 _ConfigValue = _interopRequireDefault(require("./ConfigValue"));
|
|
10
|
-
var _reactBootstrap = require("react-bootstrap");
|
|
11
|
-
var _reactBootstrapIcons = require("react-bootstrap-icons");
|
|
12
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
-
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; }
|
|
15
|
-
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; }
|
|
16
|
-
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; }
|
|
17
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
18
|
-
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /*****************************************************************************\
|
|
19
|
-
* (c) Copyright 2021 CERN for the benefit of the LHCb Collaboration *
|
|
20
|
-
* *
|
|
21
|
-
* This software is distributed under the terms of the GNU General Public *
|
|
22
|
-
* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". *
|
|
23
|
-
* *
|
|
24
|
-
* In applying this licence, CERN does not waive the privileges and immunities *
|
|
25
|
-
* granted to it by virtue of its status as an Intergovernmental Organization *
|
|
26
|
-
* or submit itself to any jurisdiction. *
|
|
27
|
-
\*****************************************************************************/ /*
|
|
28
|
-
* [int] -> <ConfigList /> multiple rows of <input type="number" step=1 />
|
|
29
|
-
* [uint] -> <ConfigList /> multiple rows of <input type="number" step=1 min=0 />
|
|
30
|
-
* [float] -> <ConfigList /> multiple rows of <input type="number" />
|
|
31
|
-
*/
|
|
32
|
-
class ConfigList extends _react.default.Component {
|
|
33
|
-
constructor() {
|
|
34
|
-
super(...arguments);
|
|
35
|
-
_defineProperty(this, "handleUpdate", index => value => {
|
|
36
|
-
let listValue = this.props.value;
|
|
37
|
-
listValue[index] = value;
|
|
38
|
-
this.props.callback(listValue);
|
|
39
|
-
});
|
|
40
|
-
_defineProperty(this, "handleAdd", () => {
|
|
41
|
-
let listValue = this.props.value;
|
|
42
|
-
const index = listValue.length;
|
|
43
|
-
if (index < this.props.defaultValue.length) {
|
|
44
|
-
const defaultValue = this.props.defaultValue[index].valueOf(); // Shallow copy
|
|
45
|
-
listValue.push(defaultValue);
|
|
46
|
-
} else {
|
|
47
|
-
listValue.push(0);
|
|
48
|
-
}
|
|
49
|
-
this.props.callback(listValue);
|
|
50
|
-
});
|
|
51
|
-
_defineProperty(this, "handleRemove", index => () => {
|
|
52
|
-
let listValue = this.props.value;
|
|
53
|
-
listValue.splice(index, 1);
|
|
54
|
-
this.props.callback(listValue);
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
render() {
|
|
58
|
-
const configurables = this.props.value.map((value, index) => {
|
|
59
|
-
const configProps = {
|
|
60
|
-
type: this.props.type,
|
|
61
|
-
value: this.props.value[index],
|
|
62
|
-
callback: this.handleUpdate(index)
|
|
63
|
-
};
|
|
64
|
-
if (index < this.props.defaultValue.length) {
|
|
65
|
-
configProps["defaultValue"] = this.props.defaultValue[index];
|
|
66
|
-
}
|
|
67
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.ListGroup.Item, {
|
|
68
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.InputGroup, {
|
|
69
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ConfigValue.default, _objectSpread({}, configProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.CloseButton, {
|
|
70
|
-
onClick: this.handleRemove(index)
|
|
71
|
-
})]
|
|
72
|
-
})
|
|
73
|
-
}, index);
|
|
74
|
-
});
|
|
75
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
76
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.ListGroup, {
|
|
77
|
-
variant: "flush",
|
|
78
|
-
children: configurables
|
|
79
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Button, {
|
|
80
|
-
variant: "success",
|
|
81
|
-
size: "sm",
|
|
82
|
-
onClick: this.handleAdd,
|
|
83
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrapIcons.PlusLg, {})
|
|
84
|
-
})]
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
ConfigList.propTypes = {
|
|
89
|
-
type: _propTypes.default.string,
|
|
90
|
-
callback: _propTypes.default.func,
|
|
91
|
-
value: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.bool, _propTypes.default.number, _propTypes.default.arrayOf(_propTypes.default.string)]),
|
|
92
|
-
defaultValue: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.bool, _propTypes.default.number, _propTypes.default.arrayOf(_propTypes.default.string)])
|
|
93
|
-
};
|
|
94
|
-
var _default = exports.default = ConfigList;
|