tenjin-ui-kit 0.3.67 → 0.3.69
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/.dockerignore +6 -0
- package/.storybook/main.js +16 -0
- package/.storybook/preview.js +11 -0
- package/Dockerfile +17 -0
- package/Jenkinsfile +66 -0
- package/build/asset-manifest.json +16 -0
- package/build/favicon.ico +0 -0
- package/build/index.html +1 -0
- package/build/logo192.png +0 -0
- package/build/logo512.png +0 -0
- package/build/manifest.json +25 -0
- package/build/robots.txt +3 -0
- package/build/static/css/main.e7366529.css +2 -0
- package/build/static/css/main.e7366529.css.map +1 -0
- package/build/static/js/453.900c81c3.chunk.js +2 -0
- package/build/static/js/453.900c81c3.chunk.js.map +1 -0
- package/build/static/js/main.8abb72fa.js +3 -0
- package/build/static/js/main.8abb72fa.js.LICENSE.txt +61 -0
- package/build/static/js/main.8abb72fa.js.map +1 -0
- package/build/static/media/logo.6ce24c58023cc2f8fd88fe9d219db6c6.svg +1 -0
- package/build/tenjinLogo.png +0 -0
- package/dist/README.md +13 -0
- package/dist/common/hooks/apiHooks.js +155 -0
- package/dist/common/hooks/newApiHook.js +188 -0
- package/{common → dist/common}/utils/security/index.js +2 -2
- package/{common → dist/common}/utils/security/securityConfig.js +1 -2
- package/dist/components/Canvas.js +330 -0
- package/dist/components/DragBox/index.js +40 -0
- package/dist/components/InputWithChip/index.js +294 -0
- package/{components → dist/components}/RightContext/index.js +19 -28
- package/dist/components/WorkFlow.js +42 -0
- package/dist/components/WorkFlowBuilder.js +115 -0
- package/dist/components/alert/Style.js +20 -0
- package/dist/components/alert/index.js +67 -0
- package/{components → dist/components}/attachment/index.js +21 -28
- package/{components → dist/components}/authenticationProvider/AuthError.js +3 -4
- package/{components → dist/components}/authenticationProvider/AuthLoader.js +3 -4
- package/dist/components/authenticationProvider/index.js +110 -0
- package/{components → dist/components}/avatar/index.js +13 -14
- package/dist/components/avatar/styles.js +91 -0
- package/dist/components/breadCrumbs/index.js +169 -0
- package/{components → dist/components}/breadCrumbs/style.js +1 -4
- package/{components → dist/components}/browsingTestCaseLayout/DetailsViewLayout/DetailsViewContent/index.js +5 -6
- package/{components → dist/components}/browsingTestCaseLayout/DetailsViewLayout/DetailsViewContent/style.js +5 -8
- package/{components → dist/components}/browsingTestCaseLayout/DetailsViewLayout/DetailsViewHeader/index.js +4 -5
- package/{components → dist/components}/browsingTestCaseLayout/TreeViewLayout/TreeViewContent/Index.js +4 -5
- package/{components → dist/components}/browsingTestCaseLayout/TreeViewLayout/TreeViewHeader/Index.js +5 -6
- package/dist/components/browsingTestCaseLayout/TreeViewLayout/TreeViewHeader/style.js +23 -0
- package/{components → dist/components}/browsingTestCaseLayout/index.js +25 -30
- package/dist/components/button/index.js +133 -0
- package/{components → dist/components}/chatBotModal/index.js +36 -45
- package/dist/components/checkBox/index.js +29 -0
- package/{components → dist/components}/combobox/index.js +51 -72
- package/dist/components/divider/index.js +37 -0
- package/{components → dist/components}/editableField/index.js +19 -28
- package/{components → dist/components}/error/index.js +6 -12
- package/dist/components/errorBoundary/index.js +140 -0
- package/dist/components/fileUploader/index.js +151 -0
- package/dist/components/fileUploader/style.js +57 -0
- package/dist/components/filter/ValueSelector.js +333 -0
- package/{components → dist/components}/filter/index.js +31 -36
- package/{components → dist/components}/iconButton/index.js +3 -4
- package/dist/components/input/index.js +167 -0
- package/dist/components/layout/index.js +94 -0
- package/dist/components/layout/main/index.js +24 -0
- package/dist/components/layout/main/style.js +19 -0
- package/{components → dist/components}/layout/pageContent/index.js +6 -7
- package/dist/components/layout/sidebar/FlatMenu.js +64 -0
- package/dist/components/layout/sidebar/GroupedIconMenu.js +233 -0
- package/dist/components/layout/sidebar/GroupedMenu.js +57 -0
- package/dist/components/layout/sidebar/ProjectMenu.js +223 -0
- package/dist/components/layout/sidebar/index.js +88 -0
- package/dist/components/layout/sidebar/style.js +149 -0
- package/{components → dist/components}/layout/topBar/ProjectTopbar.js +81 -98
- package/dist/components/layout/topBar/UserAvatar.js +138 -0
- package/dist/components/layout/topBar/index.js +121 -0
- package/{components → dist/components}/loader/index.js +9 -12
- package/dist/components/menu/index.js +71 -0
- package/{components → dist/components}/modal/Modal.js +5 -6
- package/dist/components/modal/index.js +88 -0
- package/dist/components/modal/style.js +65 -0
- package/dist/components/optionMenu/index.js +105 -0
- package/dist/components/pagination/index.js +114 -0
- package/dist/components/pagination/style.js +33 -0
- package/dist/components/paginationUpdated/index.js +73 -0
- package/dist/components/paper/index.js +43 -0
- package/dist/components/paper/style.js +31 -0
- package/dist/components/reactSelect/index.js +195 -0
- package/dist/components/reactSelect/style.js +130 -0
- package/dist/components/richTextEditor/index.js +64 -0
- package/dist/components/select/GroupedSelect.js +167 -0
- package/dist/components/select/SimpleSelect.js +184 -0
- package/{components → dist/components}/select/index.js +38 -54
- package/dist/components/simpleSelect/index.js +53 -0
- package/{components → dist/components}/sort/index.js +19 -22
- package/{components → dist/components}/switch/index.js +10 -11
- package/dist/components/switch/style.js +39 -0
- package/{components → dist/components}/switch/switch.js +17 -23
- package/dist/components/table/ReactTable.js +101 -0
- package/dist/components/table/SimpleTable.js +117 -0
- package/dist/components/table/index.js +381 -0
- package/dist/components/text/index.js +65 -0
- package/{components → dist/components}/timeStamp/index.js +4 -6
- package/dist/components/timeStamp/style.js +20 -0
- package/dist/components/topBar/index.js +169 -0
- package/{components → dist/components}/tree/index.js +29 -47
- package/dist/components/tree/style.js +29 -0
- package/dist/components/valuePicker/ValueSelector.js +205 -0
- package/{components → dist/components}/valuePicker/index.js +19 -26
- package/{components → dist/components}/wrapperLayout/layout/index.js +4 -5
- package/{components → dist/components}/wrapperLayout/main/index.js +4 -5
- package/{components → dist/components}/wrapperLayout/main/pageContainer/index.js +4 -5
- package/dist/components/wrapperLayout/main/sideBar/index.js +272 -0
- package/dist/components/wrapperLayout/main/sideBar/style.js +190 -0
- package/{components → dist/components}/wrapperLayout/topBar/UserAvatar.js +4 -5
- package/dist/components/wrapperLayout/topBar/avatar.js +55 -0
- package/dist/components/wrapperLayout/topBar/index.js +196 -0
- package/{components → dist/components}/wrapperLayout/topBar/menuIcon.js +4 -5
- package/dist/components/wrapperLayout/topBar/style.js +74 -0
- package/dist/http/index.js +133 -0
- package/{index.js → dist/index.js} +53 -55
- package/dist/package.json +127 -0
- package/{templates → dist/templates}/listPage/index.js +36 -57
- package/{themes → dist/themes}/default.js +5 -7
- package/{themes → dist/themes}/defaultSmall.js +2 -3
- package/{themes → dist/themes}/responsiveTheme.js +6 -8
- package/package.json +4 -1
- package/public/favicon.ico +0 -0
- package/public/index.html +43 -0
- package/public/logo192.png +0 -0
- package/public/logo512.png +0 -0
- package/public/manifest.json +25 -0
- package/public/robots.txt +3 -0
- package/public/tenjinLogo.png +0 -0
- package/common/hooks/apiHooks.js +0 -223
- package/common/hooks/newApiHook.js +0 -270
- package/components/Canvas.js +0 -254
- package/components/DragBox/index.js +0 -45
- package/components/InputWithChip/index.js +0 -187
- package/components/WorkFlow.js +0 -47
- package/components/WorkFlowBuilder.js +0 -130
- package/components/alert/Style.js +0 -23
- package/components/alert/index.js +0 -69
- package/components/authenticationProvider/index.js +0 -166
- package/components/avatar/styles.js +0 -94
- package/components/breadCrumbs/index.js +0 -180
- package/components/browsingTestCaseLayout/TreeViewLayout/TreeViewHeader/style.js +0 -26
- package/components/button/index.js +0 -135
- package/components/checkBox/index.js +0 -30
- package/components/divider/index.js +0 -41
- package/components/errorBoundary/index.js +0 -160
- package/components/fileUploader/index.js +0 -156
- package/components/fileUploader/style.js +0 -60
- package/components/filter/ValueSelector.js +0 -350
- package/components/input/index.js +0 -174
- package/components/layout/index.js +0 -98
- package/components/layout/main/index.js +0 -27
- package/components/layout/main/style.js +0 -22
- package/components/layout/sidebar/FlatMenu.js +0 -64
- package/components/layout/sidebar/GroupedIconMenu.js +0 -246
- package/components/layout/sidebar/GroupedMenu.js +0 -67
- package/components/layout/sidebar/ProjectMenu.js +0 -230
- package/components/layout/sidebar/index.js +0 -91
- package/components/layout/sidebar/style.js +0 -154
- package/components/layout/topBar/UserAvatar.js +0 -145
- package/components/layout/topBar/index.js +0 -132
- package/components/menu/index.js +0 -80
- package/components/modal/index.js +0 -91
- package/components/modal/style.js +0 -68
- package/components/optionMenu/index.js +0 -112
- package/components/pagination/index.js +0 -129
- package/components/pagination/style.js +0 -36
- package/components/paginationUpdated/index.js +0 -75
- package/components/paper/index.js +0 -44
- package/components/paper/style.js +0 -34
- package/components/reactSelect/index.js +0 -212
- package/components/reactSelect/style.js +0 -163
- package/components/richTextEditor/index.js +0 -83
- package/components/select/GroupedSelect.js +0 -183
- package/components/select/SimpleSelect.js +0 -212
- package/components/simpleSelect/index.js +0 -56
- package/components/switch/style.js +0 -42
- package/components/table/ReactTable.js +0 -118
- package/components/table/SimpleTable.js +0 -136
- package/components/table/index.js +0 -256
- package/components/text/index.js +0 -67
- package/components/timeStamp/style.js +0 -23
- package/components/topBar/index.js +0 -176
- package/components/tree/style.js +0 -32
- package/components/valuePicker/ValueSelector.js +0 -273
- package/components/wrapperLayout/main/sideBar/index.js +0 -262
- package/components/wrapperLayout/main/sideBar/style.js +0 -196
- package/components/wrapperLayout/topBar/avatar.js +0 -57
- package/components/wrapperLayout/topBar/index.js +0 -182
- package/components/wrapperLayout/topBar/style.js +0 -77
- package/http/index.js +0 -226
- /package/{assets → dist/assets}/images/MicrosoftTeams-image (1).png +0 -0
- /package/{assets → dist/assets}/images/tenjin-4.0-logo.png +0 -0
- /package/{components → dist/components}/RightContext/index.css +0 -0
- /package/{components → dist/components}/browsingTestCaseLayout/style.css +0 -0
- /package/{components → dist/components}/errorBoundary/Error.jpg +0 -0
- /package/{components → dist/components}/iconButton/style.js +0 -0
- /package/{components → dist/components}/richTextEditor/style.js +0 -0
- /package/{components → dist/components}/wrapperLayout/layout/style.js +0 -0
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
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
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
@@ -13,17 +12,16 @@ var _material = require("@mui/material");
|
|
|
13
12
|
var _style = _interopRequireDefault(require("./style"));
|
|
14
13
|
var _default = _interopRequireDefault(require("../../themes/default"));
|
|
15
14
|
var _text = _interopRequireDefault(require("../text"));
|
|
16
|
-
function _interopRequireDefault(
|
|
17
|
-
function
|
|
18
|
-
function
|
|
19
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
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 _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
20
18
|
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."); }
|
|
21
|
-
function _unsupportedIterableToArray(
|
|
22
|
-
function _arrayLikeToArray(
|
|
23
|
-
function _iterableToArrayLimit(
|
|
24
|
-
function _arrayWithHoles(
|
|
25
|
-
|
|
26
|
-
|
|
19
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
20
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
21
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
22
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
23
|
+
const MuiSwitchStyledComp = (0, _styles.styled)(_material.Switch)(_ref => {
|
|
24
|
+
let MuiSwitch = _ref.MuiSwitch;
|
|
27
25
|
return {
|
|
28
26
|
padding: 10,
|
|
29
27
|
marginTop: "-6px",
|
|
@@ -56,17 +54,17 @@ var MuiSwitchStyledComp = (0, _styles.styled)(_material.Switch)(function (_ref)
|
|
|
56
54
|
});
|
|
57
55
|
function Switch(props) {
|
|
58
56
|
var _props$objects, _props$objects2, _props$label;
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
const classes = (0, _style.default)();
|
|
58
|
+
const _React$useState = React.useState(props.checked),
|
|
61
59
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
62
60
|
switchChecked = _React$useState2[0],
|
|
63
61
|
setSwitchChecked = _React$useState2[1];
|
|
64
|
-
|
|
62
|
+
const onChangeEvent = () => {
|
|
65
63
|
setSwitchChecked(!switchChecked);
|
|
66
64
|
props.handleChange(!switchChecked);
|
|
67
65
|
};
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
const handleChange = keyId => {
|
|
67
|
+
const newData = props.objects.map(item => {
|
|
70
68
|
if (item.id === keyId) {
|
|
71
69
|
item.checked = item.checked === true ? false : true;
|
|
72
70
|
}
|
|
@@ -74,7 +72,7 @@ function Switch(props) {
|
|
|
74
72
|
});
|
|
75
73
|
props.setObjects(newData);
|
|
76
74
|
};
|
|
77
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, props.objects && ((_props$objects = props.objects) === null || _props$objects === void 0 ? void 0 : _props$objects.length) > 0 ? (_props$objects2 = props.objects) === null || _props$objects2 === void 0 ? void 0 : _props$objects2.map(
|
|
75
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, props.objects && ((_props$objects = props.objects) === null || _props$objects === void 0 ? void 0 : _props$objects.length) > 0 ? (_props$objects2 = props.objects) === null || _props$objects2 === void 0 ? void 0 : _props$objects2.map((object, index) => {
|
|
78
76
|
var _object$label;
|
|
79
77
|
return /*#__PURE__*/React.createElement("div", {
|
|
80
78
|
className: classes.root
|
|
@@ -82,9 +80,7 @@ function Switch(props) {
|
|
|
82
80
|
label: /*#__PURE__*/React.createElement(_text.default, null, object.label && ((_object$label = object.label) === null || _object$label === void 0 ? void 0 : _object$label.length) > 0 ? object.label : ""),
|
|
83
81
|
control: /*#__PURE__*/React.createElement(MuiSwitchStyledComp, {
|
|
84
82
|
checked: object.checked === true,
|
|
85
|
-
onChange:
|
|
86
|
-
return handleChange(object.id);
|
|
87
|
-
},
|
|
83
|
+
onChange: () => handleChange(object.id),
|
|
88
84
|
sx: {
|
|
89
85
|
"&:hover": {
|
|
90
86
|
backgroundColor: "transparent",
|
|
@@ -100,9 +96,7 @@ function Switch(props) {
|
|
|
100
96
|
}, /*#__PURE__*/React.createElement(_FormGroup.default, null, /*#__PURE__*/React.createElement(_FormControlLabel.default, {
|
|
101
97
|
control: /*#__PURE__*/React.createElement(MuiSwitchStyledComp, {
|
|
102
98
|
checked: switchChecked,
|
|
103
|
-
onChange:
|
|
104
|
-
return onChangeEvent();
|
|
105
|
-
}
|
|
99
|
+
onChange: () => onChangeEvent()
|
|
106
100
|
}),
|
|
107
101
|
label: /*#__PURE__*/React.createElement(_text.default, null, "`$", props.label && ((_props$label = props.label) === null || _props$label === void 0 ? void 0 : _props$label.length) > 0 ? props.label : "", "`"),
|
|
108
102
|
disabled: props.disabled && props.disabled
|
|
@@ -0,0 +1,101 @@
|
|
|
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 _material = require("@mui/material");
|
|
10
|
+
var _text = _interopRequireDefault(require("../text"));
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
13
|
+
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."); }
|
|
14
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
15
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
16
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
17
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
18
|
+
const ReactTable = _ref => {
|
|
19
|
+
let columns = _ref.columns,
|
|
20
|
+
rows = _ref.rows,
|
|
21
|
+
sortable = _ref.sortable,
|
|
22
|
+
msg = _ref.msg;
|
|
23
|
+
const _React$useState = _react.default.useState({
|
|
24
|
+
column: null,
|
|
25
|
+
direction: "desc"
|
|
26
|
+
}),
|
|
27
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
28
|
+
sorting = _React$useState2[0],
|
|
29
|
+
setSorting = _React$useState2[1];
|
|
30
|
+
const handleSort = columnName => {
|
|
31
|
+
setSorting(prevSorting => ({
|
|
32
|
+
column: columnName,
|
|
33
|
+
direction: prevSorting.column === columnName && prevSorting.direction === "desc" ? "asc" : "desc"
|
|
34
|
+
}));
|
|
35
|
+
};
|
|
36
|
+
const sortedData = _react.default.useMemo(() => {
|
|
37
|
+
if (sorting !== null && sorting !== void 0 && sorting.column) {
|
|
38
|
+
const sortedArray = [...rows].sort((a, b) => {
|
|
39
|
+
const valueA = a[sorting.column];
|
|
40
|
+
const valueB = b[sorting.column];
|
|
41
|
+
if (typeof valueA === "string" && typeof valueB === "string") {
|
|
42
|
+
return sorting.direction === "asc" ? valueA.localeCompare(valueB) : valueB.localeCompare(valueA);
|
|
43
|
+
}
|
|
44
|
+
return sorting.direction === "asc" ? valueA - valueB : valueB - valueA;
|
|
45
|
+
});
|
|
46
|
+
return sortedArray;
|
|
47
|
+
}
|
|
48
|
+
return rows;
|
|
49
|
+
}, [rows, sorting]);
|
|
50
|
+
const theme = (0, _material.useTheme)();
|
|
51
|
+
return rows && (rows === null || rows === void 0 ? void 0 : rows.length) > 0 ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_material.TableContainer, null, /*#__PURE__*/_react.default.createElement(_material.Table, null, /*#__PURE__*/_react.default.createElement(_material.TableHead, null, /*#__PURE__*/_react.default.createElement(_material.TableRow, null, columns === null || columns === void 0 ? void 0 : columns.map(c => /*#__PURE__*/_react.default.createElement(_material.TableCell, {
|
|
52
|
+
key: c.name,
|
|
53
|
+
style: {
|
|
54
|
+
width: c.width
|
|
55
|
+
}
|
|
56
|
+
}, sortable ? /*#__PURE__*/_react.default.createElement(_material.TableSortLabel, {
|
|
57
|
+
active: sorting.column === c.name.toLowerCase(),
|
|
58
|
+
direction: sorting.column === c.name.toLowerCase() ? sorting.direction : "asc",
|
|
59
|
+
onClick: () => handleSort(c.name.toLowerCase())
|
|
60
|
+
}, /*#__PURE__*/_react.default.createElement(_text.default, {
|
|
61
|
+
style: {
|
|
62
|
+
color: "#7D7D7D"
|
|
63
|
+
}
|
|
64
|
+
}, c.displayName)) : /*#__PURE__*/_react.default.createElement(_text.default, {
|
|
65
|
+
style: {
|
|
66
|
+
color: "#7D7D7D"
|
|
67
|
+
}
|
|
68
|
+
}, c.displayName))))), /*#__PURE__*/_react.default.createElement(_material.TableBody, null, sortedData === null || sortedData === void 0 ? void 0 : sortedData.map(u => /*#__PURE__*/_react.default.createElement(_material.TableRow, {
|
|
69
|
+
key: u.id
|
|
70
|
+
}, columns === null || columns === void 0 ? void 0 : columns.map(c => /*#__PURE__*/_react.default.createElement(_material.TableCell, {
|
|
71
|
+
size: "small",
|
|
72
|
+
key: u[c.name],
|
|
73
|
+
style: {
|
|
74
|
+
width: c.width,
|
|
75
|
+
borderBottom: "none"
|
|
76
|
+
}
|
|
77
|
+
}, c.render ? c.render(u) : /*#__PURE__*/_react.default.createElement(_text.default, null, u[c.name]))))))))) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, " ", /*#__PURE__*/_react.default.createElement(_material.TableContainer, null, /*#__PURE__*/_react.default.createElement(_material.Table, null, /*#__PURE__*/_react.default.createElement(_material.TableHead, null, columns === null || columns === void 0 ? void 0 : columns.map(c => /*#__PURE__*/_react.default.createElement(_material.TableCell, {
|
|
78
|
+
key: c.name,
|
|
79
|
+
style: {
|
|
80
|
+
width: c.width,
|
|
81
|
+
color: "#7D7D7D",
|
|
82
|
+
borderBottom: "none"
|
|
83
|
+
}
|
|
84
|
+
}, /*#__PURE__*/_react.default.createElement(_text.default, null, c.displayName)))), " ")), /*#__PURE__*/_react.default.createElement(_material.Grid, {
|
|
85
|
+
item: true,
|
|
86
|
+
xs: 11,
|
|
87
|
+
container: true,
|
|
88
|
+
justifyContent: "center"
|
|
89
|
+
}, /*#__PURE__*/_react.default.createElement(_text.default, {
|
|
90
|
+
style: {
|
|
91
|
+
color: "grey",
|
|
92
|
+
marginTop: "calc(100vh - 750px)"
|
|
93
|
+
}
|
|
94
|
+
}, msg)));
|
|
95
|
+
};
|
|
96
|
+
ReactTable.propTypes = {
|
|
97
|
+
rows: _propTypes.default.array.isRequired,
|
|
98
|
+
columns: _propTypes.default.array.isRequired,
|
|
99
|
+
msg: _propTypes.default.string
|
|
100
|
+
};
|
|
101
|
+
var _default = exports.default = ReactTable;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _material = require("@mui/material");
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _text = _interopRequireDefault(require("../text"));
|
|
10
|
+
var _styles = require("@mui/styles");
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
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); }
|
|
13
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
14
|
+
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."); }
|
|
15
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
16
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
17
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
18
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
19
|
+
const useStyles = (0, _styles.makeStyles)(theme => ({
|
|
20
|
+
customCell: {
|
|
21
|
+
padding: "0px 1rem"
|
|
22
|
+
},
|
|
23
|
+
customTableContainer: {
|
|
24
|
+
overflowX: "initial"
|
|
25
|
+
}
|
|
26
|
+
}));
|
|
27
|
+
const SimpleTable = _ref => {
|
|
28
|
+
let rows = _ref.rows,
|
|
29
|
+
columns = _ref.columns,
|
|
30
|
+
size = _ref.size,
|
|
31
|
+
height = _ref.height,
|
|
32
|
+
isHeight = _ref.isHeight,
|
|
33
|
+
sx = _ref.sx;
|
|
34
|
+
const classes = useStyles();
|
|
35
|
+
const theme = (0, _material.useTheme)();
|
|
36
|
+
const _useState = (0, _react.useState)({
|
|
37
|
+
column: null,
|
|
38
|
+
direction: "desc"
|
|
39
|
+
}),
|
|
40
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
41
|
+
sorting = _useState2[0],
|
|
42
|
+
setSorting = _useState2[1];
|
|
43
|
+
const handleSort = columnName => {
|
|
44
|
+
setSorting(prevSorting => ({
|
|
45
|
+
column: columnName,
|
|
46
|
+
direction: prevSorting.column === columnName && prevSorting.direction === "desc" ? "asc" : "desc"
|
|
47
|
+
}));
|
|
48
|
+
};
|
|
49
|
+
const sortedData = _react.default.useMemo(() => {
|
|
50
|
+
if (sorting.column) {
|
|
51
|
+
const sortedArray = [...rows].sort((a, b) => {
|
|
52
|
+
const valueA = a[sorting.column];
|
|
53
|
+
const valueB = b[sorting.column];
|
|
54
|
+
if (typeof valueA === "string" && typeof valueB === "string") {
|
|
55
|
+
return sorting.direction === "asc" ? valueA.localeCompare(valueB) : valueB.localeCompare(valueA);
|
|
56
|
+
}
|
|
57
|
+
return sorting.direction === "asc" ? valueA - valueB : valueB - valueA;
|
|
58
|
+
});
|
|
59
|
+
return sortedArray;
|
|
60
|
+
}
|
|
61
|
+
return rows;
|
|
62
|
+
}, [rows, sorting]);
|
|
63
|
+
return rows && rows.length > 0 ? /*#__PURE__*/_react.default.createElement(_material.TableContainer, {
|
|
64
|
+
classes: {
|
|
65
|
+
root: classes.customTableContainer
|
|
66
|
+
}
|
|
67
|
+
}, /*#__PURE__*/_react.default.createElement(_material.Table, {
|
|
68
|
+
size: size,
|
|
69
|
+
stickyHeader: true
|
|
70
|
+
}, /*#__PURE__*/_react.default.createElement(_material.TableHead, null, /*#__PURE__*/_react.default.createElement(_material.TableRow, null, columns && columns.map((c, index) => /*#__PURE__*/_react.default.createElement(_material.TableCell, {
|
|
71
|
+
key: index,
|
|
72
|
+
style: {
|
|
73
|
+
minWidth: c.minWidth || 80,
|
|
74
|
+
maxWidth: c.maxWidth || 240
|
|
75
|
+
}
|
|
76
|
+
}, /*#__PURE__*/_react.default.createElement(_material.TableSortLabel, {
|
|
77
|
+
active: sorting.column === c.name.toLowerCase(),
|
|
78
|
+
direction: sorting.column === c.name.toLowerCase() ? sorting.direction : "asc",
|
|
79
|
+
onClick: () => handleSort(c.name)
|
|
80
|
+
}, /*#__PURE__*/_react.default.createElement(_text.default, {
|
|
81
|
+
semibold: true,
|
|
82
|
+
color: theme.palette.grey[500]
|
|
83
|
+
// textTransform="uppercase"
|
|
84
|
+
,
|
|
85
|
+
fontSize: theme.typography.fontSize - 1
|
|
86
|
+
}, c.displayName)))))), /*#__PURE__*/_react.default.createElement(_material.TableBody, null, sortedData.map((r, index) => /*#__PURE__*/_react.default.createElement(_material.TableRow, {
|
|
87
|
+
key: index,
|
|
88
|
+
hover: true
|
|
89
|
+
}, columns.map((c, index) => /*#__PURE__*/_react.default.createElement(_material.TableCell, {
|
|
90
|
+
className: isHeight && classes.customCell,
|
|
91
|
+
style: {
|
|
92
|
+
padding: "".concat(height || "0.5rem", " 1rem")
|
|
93
|
+
},
|
|
94
|
+
key: index
|
|
95
|
+
}, renderCellContent(r, c)))))))) : /*#__PURE__*/_react.default.createElement(_material.Box, {
|
|
96
|
+
height: "300px",
|
|
97
|
+
display: "flex",
|
|
98
|
+
alignItems: "center",
|
|
99
|
+
justifyContent: "center",
|
|
100
|
+
sx: sx
|
|
101
|
+
}, /*#__PURE__*/_react.default.createElement(_text.default, {
|
|
102
|
+
color: theme.palette.grey[500],
|
|
103
|
+
semibold: true
|
|
104
|
+
}, "No records found"));
|
|
105
|
+
};
|
|
106
|
+
const renderCellContent = (row, column) => {
|
|
107
|
+
const name = column.name,
|
|
108
|
+
render = column.render;
|
|
109
|
+
let returnComponent;
|
|
110
|
+
if (render) {
|
|
111
|
+
returnComponent = render(row);
|
|
112
|
+
} else {
|
|
113
|
+
returnComponent = /*#__PURE__*/_react.default.createElement(_text.default, null, row[name]);
|
|
114
|
+
}
|
|
115
|
+
return returnComponent;
|
|
116
|
+
};
|
|
117
|
+
var _default = exports.default = SimpleTable;
|