chem-generic-ui 0.1.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 ADDED
@@ -0,0 +1,70 @@
1
+ # Getting Started with Create React App
2
+
3
+ This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
4
+
5
+ ## Available Scripts
6
+
7
+ In the project directory, you can run:
8
+
9
+ ### `yarn start`
10
+
11
+ Runs the app in the development mode.\
12
+ Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
13
+
14
+ The page will reload when you make changes.\
15
+ You may also see any lint errors in the console.
16
+
17
+ ### `yarn test`
18
+
19
+ Launches the test runner in the interactive watch mode.\
20
+ See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
21
+
22
+ ### `yarn build`
23
+
24
+ Builds the app for production to the `build` folder.\
25
+ It correctly bundles React in production mode and optimizes the build for the best performance.
26
+
27
+ The build is minified and the filenames include the hashes.\
28
+ Your app is ready to be deployed!
29
+
30
+ See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
31
+
32
+ ### `yarn eject`
33
+
34
+ **Note: this is a one-way operation. Once you `eject`, you can't go back!**
35
+
36
+ If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
37
+
38
+ Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
39
+
40
+ You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
41
+
42
+ ## Learn More
43
+
44
+ You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
45
+
46
+ To learn React, check out the [React documentation](https://reactjs.org/).
47
+
48
+ ### Code Splitting
49
+
50
+ This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
51
+
52
+ ### Analyzing the Bundle Size
53
+
54
+ This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
55
+
56
+ ### Making a Progressive Web App
57
+
58
+ This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
59
+
60
+ ### Advanced Configuration
61
+
62
+ This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
63
+
64
+ ### Deployment
65
+
66
+ This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
67
+
68
+ ### `yarn build` fails to minify
69
+
70
+ This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
@@ -0,0 +1,121 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var _react = _interopRequireWildcard(require("react"));
11
+
12
+ var _reactBootstrap = require("react-bootstrap");
13
+
14
+ var _lodash = require("lodash");
15
+
16
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
17
+
18
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
19
+
20
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
21
+
22
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
23
+
24
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
25
+
26
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
27
+
28
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
29
+
30
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
31
+
32
+ var ElementManager = function ElementManager(props) {
33
+ var _useState = (0, _react.useState)({
34
+ elements: [],
35
+ element: {}
36
+ }),
37
+ _useState2 = _slicedToArray(_useState, 2),
38
+ state = _useState2[0],
39
+ setState = _useState2[1];
40
+
41
+ (0, _react.useEffect)(function () {// setState({...state, element: 'test'});
42
+ // UsersFetcher.scifinderCredential().then((json) => {
43
+ // setCredential(json);
44
+ // }).catch(err => notify({ title: 'SciFinder-n Error', lvl: 'error', msg: err }));
45
+ }, [state.element]);
46
+ var els = (0, _lodash.orderBy)(props.elements, ['is_active', 'name', 'klass_prefix'], ['desc', 'asc', 'asc']);
47
+ var tbody = els && els.map(function (e, idx) {
48
+ return /*#__PURE__*/_react.default.createElement("tbody", {
49
+ key: "tbody_".concat(e.id)
50
+ }, /*#__PURE__*/_react.default.createElement("tr", {
51
+ key: "row_".concat(e.id),
52
+ id: "row_".concat(e.id),
53
+ style: e.id === props.element.id ? {
54
+ fontWeight: 'bold',
55
+ borderWidth: 'medium',
56
+ backgroundColor: 'white',
57
+ borderStyle: 'groove'
58
+ } : {
59
+ fontWeight: 'unset'
60
+ }
61
+ }, /*#__PURE__*/_react.default.createElement("td", null, idx + 1), /*#__PURE__*/_react.default.createElement("td", null, /*#__PURE__*/_react.default.createElement(_reactBootstrap.Button, {
62
+ bsStyle: "primary",
63
+ onClick: function onClick() {}
64
+ }, "Copy to..."), "\xA0", /*#__PURE__*/_react.default.createElement(_reactBootstrap.Button, {
65
+ bsStyle: "primary",
66
+ onClick: function onClick() {}
67
+ }, "Edit Element attributes..."), "\xA0"), /*#__PURE__*/_react.default.createElement("td", null, e.name), /*#__PURE__*/_react.default.createElement("td", null, e.klass_prefix), /*#__PURE__*/_react.default.createElement("td", null, e.is_active ? /*#__PURE__*/_react.default.createElement("i", {
68
+ className: "fa fa-check",
69
+ "aria-hidden": "true",
70
+ style: {
71
+ color: 'green'
72
+ }
73
+ }) : /*#__PURE__*/_react.default.createElement("i", {
74
+ className: "fa fa-ban",
75
+ "aria-hidden": "true",
76
+ style: {
77
+ color: 'red'
78
+ }
79
+ })), /*#__PURE__*/_react.default.createElement("td", null, e.label), /*#__PURE__*/_react.default.createElement("td", null, /*#__PURE__*/_react.default.createElement("i", {
80
+ className: e.icon_name
81
+ })), /*#__PURE__*/_react.default.createElement("td", null, e.desc), /*#__PURE__*/_react.default.createElement("td", null, /*#__PURE__*/_react.default.createElement(_reactBootstrap.Button, {
82
+ bsStyle: "primary",
83
+ onClick: function onClick() {}
84
+ }, "Edit Element template..."), /*#__PURE__*/_react.default.createElement(_reactBootstrap.Button, {
85
+ bsStyle: "primary",
86
+ onClick: function onClick() {}
87
+ }, "Edit Element template in YAML format...")), /*#__PURE__*/_react.default.createElement("td", null, e.released_at, " (UTC)")));
88
+ });
89
+ return /*#__PURE__*/_react.default.createElement(_reactBootstrap.Card, null, /*#__PURE__*/_react.default.createElement(_reactBootstrap.Card.Heading, null, /*#__PURE__*/_react.default.createElement(_reactBootstrap.Table, {
90
+ responsive: true,
91
+ condensed: true,
92
+ hover: true
93
+ }, /*#__PURE__*/_react.default.createElement("thead", null, /*#__PURE__*/_react.default.createElement("tr", {
94
+ style: {
95
+ backgroundColor: '#ddd'
96
+ }
97
+ }, /*#__PURE__*/_react.default.createElement("th", {
98
+ width: "4%"
99
+ }, "#"), /*#__PURE__*/_react.default.createElement("th", {
100
+ width: "6%"
101
+ }, "Actions"), /*#__PURE__*/_react.default.createElement("th", {
102
+ width: "10%"
103
+ }, "Element"), /*#__PURE__*/_react.default.createElement("th", {
104
+ width: "6%"
105
+ }, "Prefix"), /*#__PURE__*/_react.default.createElement("th", {
106
+ width: "8%"
107
+ }, "Active"), /*#__PURE__*/_react.default.createElement("th", {
108
+ width: "12%"
109
+ }, "Element Label"), /*#__PURE__*/_react.default.createElement("th", {
110
+ width: "6%"
111
+ }, "Icon"), /*#__PURE__*/_react.default.createElement("th", {
112
+ width: "16%"
113
+ }, "Description"), /*#__PURE__*/_react.default.createElement("th", {
114
+ width: "12%"
115
+ }, "Template"), /*#__PURE__*/_react.default.createElement("th", {
116
+ width: "18%"
117
+ }, "Released at"))), tbody)));
118
+ };
119
+
120
+ var _default = ElementManager;
121
+ exports.default = _default;
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "chem-generic-ui",
3
+ "version": "0.1.0",
4
+ "main": "dist/index.js",
5
+ "private": false,
6
+ "files": [
7
+ "dist",
8
+ "README.md"
9
+ ],
10
+ "dependencies": {
11
+ "@testing-library/jest-dom": "^5.14.1",
12
+ "@testing-library/react": "^12.0.0",
13
+ "@testing-library/user-event": "^13.2.1",
14
+ "lodash": "^4.17.21",
15
+ "react": "^17.0.2",
16
+ "react-bootstrap": "^2.2.0",
17
+ "react-dom": "^17.0.2",
18
+ "react-scripts": "5.0.0",
19
+ "web-vitals": "^2.1.0"
20
+ },
21
+ "scripts": {
22
+ "start": "react-scripts start",
23
+ "build": "react-scripts build",
24
+ "test": "react-scripts test",
25
+ "eject": "react-scripts eject",
26
+ "compile": "rm -rf dist && cross-env NODE_ENV=production babel src/components --out-dir dist --copy-files"
27
+ },
28
+ "eslintConfig": {
29
+ "extends": [
30
+ "react-app",
31
+ "react-app/jest"
32
+ ]
33
+ },
34
+ "browserslist": {
35
+ "production": [
36
+ ">0.2%",
37
+ "not dead",
38
+ "not op_mini all"
39
+ ],
40
+ "development": [
41
+ "last 1 chrome version",
42
+ "last 1 firefox version",
43
+ "last 1 safari version"
44
+ ]
45
+ },
46
+ "devDependencies": {
47
+ "@babel/cli": "^7.17.6",
48
+ "@babel/preset-env": "^7.16.11",
49
+ "@babel/preset-react": "^7.16.7",
50
+ "cross-env": "^7.0.3"
51
+ }
52
+ }