tenjin-ui-kit 0.3.71 → 0.3.72-dev-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/common/hooks/apiHooks.js +182 -114
- package/common/hooks/newApiHook.js +225 -143
- package/common/utils/security/index.js +2 -2
- package/common/utils/security/securityConfig.js +2 -1
- package/components/Canvas.js +88 -164
- package/components/DragBox/index.js +26 -21
- package/components/InputWithChip/index.js +57 -164
- package/components/RightContext/index.js +28 -19
- package/components/WorkFlow.js +23 -18
- package/components/WorkFlowBuilder.js +48 -33
- package/components/alert/Style.js +14 -11
- package/components/alert/index.js +12 -10
- package/components/attachment/index.js +28 -21
- package/components/authenticationProvider/AuthError.js +4 -3
- package/components/authenticationProvider/AuthLoader.js +4 -3
- package/components/authenticationProvider/index.js +116 -60
- package/components/avatar/index.js +14 -13
- package/components/avatar/styles.js +77 -74
- package/components/breadCrumbs/index.js +53 -42
- package/components/breadCrumbs/style.js +4 -1
- package/components/browsingTestCaseLayout/DetailsViewLayout/DetailsViewContent/index.js +6 -5
- package/components/browsingTestCaseLayout/DetailsViewLayout/DetailsViewContent/style.js +8 -5
- package/components/browsingTestCaseLayout/DetailsViewLayout/DetailsViewHeader/index.js +5 -4
- package/components/browsingTestCaseLayout/TreeViewLayout/TreeViewContent/Index.js +5 -4
- package/components/browsingTestCaseLayout/TreeViewLayout/TreeViewHeader/Index.js +6 -5
- package/components/browsingTestCaseLayout/TreeViewLayout/TreeViewHeader/style.js +19 -16
- package/components/browsingTestCaseLayout/index.js +30 -25
- package/components/button/index.js +43 -36
- package/components/chatBotModal/index.js +45 -36
- package/components/checkBox/index.js +9 -8
- package/components/combobox/index.js +72 -51
- package/components/divider/index.js +18 -14
- package/components/editableField/index.js +28 -19
- package/components/error/index.js +12 -6
- package/components/errorBoundary/index.js +94 -74
- package/components/fileUploader/index.js +35 -30
- package/components/fileUploader/style.js +49 -46
- package/components/filter/ValueSelector.js +210 -137
- package/components/filter/index.js +39 -29
- package/components/iconButton/index.js +4 -3
- package/components/input/index.js +38 -31
- package/components/layout/index.js +31 -27
- package/components/layout/main/index.js +13 -10
- package/components/layout/main/style.js +14 -11
- package/components/layout/pageContent/index.js +7 -6
- package/components/layout/sidebar/FlatMenu.js +43 -43
- package/components/layout/sidebar/GroupedIconMenu.js +108 -95
- package/components/layout/sidebar/GroupedMenu.js +48 -38
- package/components/layout/sidebar/ProjectMenu.js +116 -109
- package/components/layout/sidebar/index.js +18 -15
- package/components/layout/sidebar/style.js +143 -138
- package/components/layout/topBar/ProjectTopbar.js +191 -90
- package/components/layout/topBar/UserAvatar.js +60 -51
- package/components/layout/topBar/index.js +33 -22
- package/components/loader/index.js +12 -9
- package/components/menu/index.js +35 -26
- package/components/modal/Modal.js +6 -5
- package/components/modal/index.js +13 -10
- package/components/modal/style.js +56 -53
- package/components/optionMenu/index.js +41 -34
- package/components/pagination/index.js +39 -24
- package/components/pagination/style.js +28 -25
- package/components/paginationUpdated/index.js +19 -16
- package/components/paper/index.js +16 -15
- package/components/paper/style.js +27 -24
- package/components/reactSelect/index.js +63 -46
- package/components/reactSelect/style.js +150 -117
- package/components/richTextEditor/index.js +44 -25
- package/components/select/GroupedSelect.js +61 -45
- package/components/select/SimpleSelect.js +82 -52
- package/components/select/index.js +54 -38
- package/components/simpleSelect/index.js +15 -12
- package/components/sort/index.js +22 -19
- package/components/switch/index.js +11 -10
- package/components/switch/style.js +32 -29
- package/components/switch/switch.js +23 -17
- package/components/table/ReactTable.js +71 -54
- package/components/table/SimpleTable.js +78 -59
- package/components/table/index.js +186 -311
- package/components/text/index.js +17 -15
- package/components/timeStamp/index.js +9 -4
- package/components/timeStamp/style.js +15 -12
- package/components/topBar/index.js +92 -85
- package/components/tree/index.js +47 -29
- package/components/tree/style.js +23 -20
- package/components/valuePicker/ValueSelector.js +138 -70
- package/components/valuePicker/index.js +26 -19
- package/components/wrapperLayout/layout/index.js +5 -4
- package/components/wrapperLayout/main/index.js +5 -4
- package/components/wrapperLayout/main/pageContainer/index.js +5 -4
- package/components/wrapperLayout/main/sideBar/index.js +110 -120
- package/components/wrapperLayout/main/sideBar/style.js +183 -177
- package/components/wrapperLayout/topBar/UserAvatar.js +5 -4
- package/components/wrapperLayout/topBar/avatar.js +12 -10
- package/components/wrapperLayout/topBar/index.js +97 -111
- package/components/wrapperLayout/topBar/menuIcon.js +5 -4
- package/components/wrapperLayout/topBar/style.js +64 -61
- package/http/index.js +184 -91
- package/index.js +55 -53
- package/package.json +4 -4
- package/templates/listPage/index.js +57 -36
- package/themes/default.js +7 -5
- package/themes/defaultSmall.js +3 -2
- package/themes/responsiveTheme.js +8 -6
|
@@ -1,5 +1,6 @@
|
|
|
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); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
@@ -15,17 +16,24 @@ var _button = _interopRequireDefault(require("../../button"));
|
|
|
15
16
|
var _modal = _interopRequireDefault(require("../../modal"));
|
|
16
17
|
var _text = _interopRequireDefault(require("../../text"));
|
|
17
18
|
var _UserAvatar = _interopRequireDefault(require("./UserAvatar"));
|
|
18
|
-
|
|
19
|
-
function
|
|
20
|
-
function
|
|
19
|
+
var _TranslateOutlined = _interopRequireDefault(require("@mui/icons-material/TranslateOutlined"));
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
+
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); }
|
|
22
|
+
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; }
|
|
23
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
24
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
25
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
26
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
27
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
28
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
21
29
|
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."); }
|
|
22
|
-
function _unsupportedIterableToArray(
|
|
23
|
-
function _arrayLikeToArray(
|
|
24
|
-
function _iterableToArrayLimit(
|
|
25
|
-
function _arrayWithHoles(
|
|
30
|
+
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); }
|
|
31
|
+
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; }
|
|
32
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
33
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
26
34
|
// import { BsChatRightText } from "react-icons/bs";
|
|
27
35
|
|
|
28
|
-
|
|
36
|
+
var ANNOUNCEMENT_TYPES = {
|
|
29
37
|
success: {
|
|
30
38
|
backgroundColor: "#EDF7ED",
|
|
31
39
|
borderLeft: "6px solid #4CAF50",
|
|
@@ -47,9 +55,9 @@ const ANNOUNCEMENT_TYPES = {
|
|
|
47
55
|
color: "#0D47A1"
|
|
48
56
|
}
|
|
49
57
|
};
|
|
50
|
-
|
|
58
|
+
var ProjectTopbar = function ProjectTopbar(_ref) {
|
|
51
59
|
var _loggedInUser$role;
|
|
52
|
-
|
|
60
|
+
var homeIcon = _ref.homeIcon,
|
|
53
61
|
loggedInUser = _ref.loggedInUser,
|
|
54
62
|
actions = _ref.actions,
|
|
55
63
|
onLogout = _ref.onLogout,
|
|
@@ -59,18 +67,76 @@ const ProjectTopbar = _ref => {
|
|
|
59
67
|
_ref$announcement = _ref.announcement,
|
|
60
68
|
announcement = _ref$announcement === void 0 ? null : _ref$announcement,
|
|
61
69
|
_ref$isChatEnabled = _ref.isChatEnabled,
|
|
62
|
-
isChatEnabled = _ref$isChatEnabled === void 0 ? false : _ref$isChatEnabled
|
|
63
|
-
|
|
64
|
-
|
|
70
|
+
isChatEnabled = _ref$isChatEnabled === void 0 ? false : _ref$isChatEnabled,
|
|
71
|
+
localeChangeCallBack = _ref.localeChangeCallBack,
|
|
72
|
+
localeList = _ref.localeList,
|
|
73
|
+
selectedLocale = _ref.selectedLocale,
|
|
74
|
+
administrationLabel = _ref.administrationLabel,
|
|
75
|
+
aboutLabel = _ref.aboutLabel,
|
|
76
|
+
logoutConfirmLabel = _ref.logoutConfirmLabel,
|
|
77
|
+
cancelLabel = _ref.cancelLabel,
|
|
78
|
+
logoutLabel = _ref.logoutLabel,
|
|
79
|
+
lastLoginLabel = _ref.lastLoginLabel;
|
|
80
|
+
var theme = (0, _system.useTheme)();
|
|
81
|
+
var _useState = (0, _react.useState)(null),
|
|
65
82
|
_useState2 = _slicedToArray(_useState, 2),
|
|
66
83
|
anchorEl = _useState2[0],
|
|
67
84
|
setAnchorEl = _useState2[1];
|
|
68
|
-
|
|
85
|
+
var _useState3 = (0, _react.useState)(null),
|
|
69
86
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
70
87
|
openMenuIndex = _useState4[0],
|
|
71
88
|
setOpenMenuIndex = _useState4[1];
|
|
72
|
-
|
|
73
|
-
|
|
89
|
+
var defaultLocaleList = [{
|
|
90
|
+
label: "English",
|
|
91
|
+
value: "en"
|
|
92
|
+
}, {
|
|
93
|
+
label: "Spanish",
|
|
94
|
+
value: "es"
|
|
95
|
+
}];
|
|
96
|
+
var getLocale = function getLocale() {
|
|
97
|
+
var lang = selectedLocale || getFromLocalStorage("lang") || getFromCookie("lang") || "en";
|
|
98
|
+
console.log("inside getLocale checklang ==", lang);
|
|
99
|
+
return lang;
|
|
100
|
+
};
|
|
101
|
+
function getFromLocalStorage(key) {
|
|
102
|
+
console.log("inside getFromLocalStorage checklang ==");
|
|
103
|
+
return localStorage.getItem(key);
|
|
104
|
+
}
|
|
105
|
+
function getFromCookie(name) {
|
|
106
|
+
console.log("inside getFromCookie checklang ==");
|
|
107
|
+
var cookies = document.cookie.split("; ");
|
|
108
|
+
var _iterator = _createForOfIteratorHelper(cookies),
|
|
109
|
+
_step;
|
|
110
|
+
try {
|
|
111
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
112
|
+
var cookie = _step.value;
|
|
113
|
+
var _cookie$split = cookie.split("="),
|
|
114
|
+
_cookie$split2 = _slicedToArray(_cookie$split, 2),
|
|
115
|
+
key = _cookie$split2[0],
|
|
116
|
+
value = _cookie$split2[1];
|
|
117
|
+
if (key === name) {
|
|
118
|
+
return decodeURIComponent(value);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
} catch (err) {
|
|
122
|
+
_iterator.e(err);
|
|
123
|
+
} finally {
|
|
124
|
+
_iterator.f();
|
|
125
|
+
}
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
var _useState5 = (0, _react.useState)(getLocale),
|
|
129
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
130
|
+
lang = _useState6[0],
|
|
131
|
+
setLang = _useState6[1];
|
|
132
|
+
var _useState7 = (0, _react.useState)(function () {
|
|
133
|
+
return localeList || defaultLocaleList;
|
|
134
|
+
}),
|
|
135
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
136
|
+
localeOpts = _useState8[0],
|
|
137
|
+
setLocaleOpts = _useState8[1];
|
|
138
|
+
var updatedActions = (0, _react.useMemo)(function () {
|
|
139
|
+
var base = _toConsumableArray(actions);
|
|
74
140
|
// if (isChatEnabled) {
|
|
75
141
|
// base.push({
|
|
76
142
|
// icon: <BsChatRightText size="12px" />,
|
|
@@ -79,16 +145,16 @@ const ProjectTopbar = _ref => {
|
|
|
79
145
|
// }
|
|
80
146
|
return base;
|
|
81
147
|
}, [actions, isChatEnabled]);
|
|
82
|
-
|
|
83
|
-
|
|
148
|
+
var navigate = (0, _reactRouter.useNavigate)();
|
|
149
|
+
var handleMenuOpen = function handleMenuOpen(event, index) {
|
|
84
150
|
setAnchorEl(event.currentTarget);
|
|
85
151
|
setOpenMenuIndex(index);
|
|
86
152
|
};
|
|
87
|
-
|
|
153
|
+
var handleMenuClose = function handleMenuClose() {
|
|
88
154
|
setAnchorEl(null);
|
|
89
155
|
setOpenMenuIndex(null);
|
|
90
156
|
};
|
|
91
|
-
|
|
157
|
+
var handleItemClick = function handleItemClick(item) {
|
|
92
158
|
if (item.href) {
|
|
93
159
|
if (item.serverSide) {
|
|
94
160
|
window.location.href = item.href;
|
|
@@ -110,13 +176,17 @@ const ProjectTopbar = _ref => {
|
|
|
110
176
|
};
|
|
111
177
|
|
|
112
178
|
// Logout related code starts
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
open =
|
|
116
|
-
setOpen =
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
179
|
+
var _useState9 = (0, _react.useState)(false),
|
|
180
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
181
|
+
open = _useState10[0],
|
|
182
|
+
setOpen = _useState10[1];
|
|
183
|
+
var handleOpen = function handleOpen() {
|
|
184
|
+
return setOpen(true);
|
|
185
|
+
};
|
|
186
|
+
var handleClose = function handleClose() {
|
|
187
|
+
return setOpen(false);
|
|
188
|
+
};
|
|
189
|
+
var logout = function logout() {
|
|
120
190
|
onLogout();
|
|
121
191
|
setOpen(false);
|
|
122
192
|
};
|
|
@@ -173,61 +243,89 @@ const ProjectTopbar = _ref => {
|
|
|
173
243
|
}, updatedActions && /*#__PURE__*/_react.default.createElement(_system.Box, null, /*#__PURE__*/_react.default.createElement(_material.Stack, {
|
|
174
244
|
direction: "row",
|
|
175
245
|
spacing: 1
|
|
176
|
-
}, updatedActions.map((action, index)
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
fontWeight: "600"
|
|
188
|
-
}
|
|
189
|
-
}, action.title)), action.dropdown && /*#__PURE__*/_react.default.createElement(_material.Menu, {
|
|
190
|
-
anchorEl: anchorEl,
|
|
191
|
-
open: openMenuIndex === index,
|
|
192
|
-
onClose: () => {
|
|
193
|
-
setOpenMenuIndex(null);
|
|
194
|
-
handleMenuClose();
|
|
195
|
-
}
|
|
196
|
-
}, action.dropdown.map((item, index) => /*#__PURE__*/_react.default.createElement("div", {
|
|
197
|
-
key: item.title,
|
|
198
|
-
onClick: () => {
|
|
199
|
-
if (item.clickable) {
|
|
200
|
-
handleItemClick(item);
|
|
246
|
+
}, updatedActions.map(function (action, index) {
|
|
247
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
248
|
+
key: action.title
|
|
249
|
+
}, /*#__PURE__*/_react.default.createElement(_button.default, {
|
|
250
|
+
variant: "text",
|
|
251
|
+
startIcon: action.icon,
|
|
252
|
+
endIcon: action.dropdown ? /*#__PURE__*/_react.default.createElement(_reactFeather.ChevronDown, {
|
|
253
|
+
size: "0.9rem"
|
|
254
|
+
}) : null,
|
|
255
|
+
onClick: function onClick(event) {
|
|
256
|
+
return action.dropdown ? handleMenuOpen(event, index) : handleItemClick(action);
|
|
201
257
|
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
258
|
+
}, /*#__PURE__*/_react.default.createElement(_text.default, {
|
|
259
|
+
style: {
|
|
260
|
+
fontWeight: "600"
|
|
261
|
+
}
|
|
262
|
+
}, action.title)), action.dropdown && /*#__PURE__*/_react.default.createElement(_material.Menu, {
|
|
263
|
+
anchorEl: anchorEl,
|
|
264
|
+
open: openMenuIndex === index,
|
|
265
|
+
onClose: function onClose() {
|
|
266
|
+
setOpenMenuIndex(null);
|
|
267
|
+
handleMenuClose();
|
|
268
|
+
}
|
|
269
|
+
}, action.dropdown.map(function (item, index) {
|
|
270
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
271
|
+
key: item.title,
|
|
272
|
+
onClick: function onClick() {
|
|
273
|
+
if (item.clickable) {
|
|
274
|
+
handleItemClick(item);
|
|
275
|
+
}
|
|
276
|
+
handleMenuClose();
|
|
277
|
+
},
|
|
278
|
+
style: {
|
|
279
|
+
margin: "10px",
|
|
280
|
+
paddingRight: "10px",
|
|
281
|
+
cursor: item.clickable ? "pointer" : "default",
|
|
282
|
+
backgroundColor: item.heading ? "transparent" : "transparent"
|
|
283
|
+
}
|
|
284
|
+
}, item.heading ? /*#__PURE__*/_react.default.createElement(_text.default, {
|
|
285
|
+
variant: "subtitle1",
|
|
286
|
+
style: {
|
|
287
|
+
fontWeight: 600
|
|
288
|
+
}
|
|
289
|
+
}, item.title) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
290
|
+
style: {
|
|
291
|
+
display: "flex",
|
|
292
|
+
flexDirection: "column"
|
|
293
|
+
}
|
|
294
|
+
}, /*#__PURE__*/_react.default.createElement(_text.default, {
|
|
295
|
+
style: {
|
|
296
|
+
fontWeight: item.clickable || item.heading ? 600 : 400
|
|
297
|
+
}
|
|
298
|
+
}, item.title), item.subtitle && /*#__PURE__*/_react.default.createElement(_text.default, {
|
|
299
|
+
variant: "body2",
|
|
300
|
+
color: "#ACACAC",
|
|
301
|
+
sx: {
|
|
302
|
+
marginLeft: "5px"
|
|
303
|
+
}
|
|
304
|
+
}, item.subtitle)), item.divider && index !== action.dropdown.length - 1 && /*#__PURE__*/_react.default.createElement(_material.Divider, null)), item.divider && index === action.dropdown.length - 1 && /*#__PURE__*/_react.default.createElement(_material.Divider, null));
|
|
305
|
+
})));
|
|
306
|
+
})))), localeOpts && /*#__PURE__*/_react.default.createElement(_system.Box, {
|
|
307
|
+
className: "Right",
|
|
227
308
|
sx: {
|
|
228
|
-
|
|
229
|
-
}
|
|
230
|
-
|
|
309
|
+
justifySelf: "right"
|
|
310
|
+
},
|
|
311
|
+
display: "flex",
|
|
312
|
+
alignItems: "center"
|
|
313
|
+
}, " ", /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_TranslateOutlined.default, {
|
|
314
|
+
color: "primary"
|
|
315
|
+
}), /*#__PURE__*/_react.default.createElement(_material.Select, {
|
|
316
|
+
value: lang,
|
|
317
|
+
label: "Language",
|
|
318
|
+
onChange: function onChange(e) {
|
|
319
|
+
setLang(e.target.value);
|
|
320
|
+
localeChangeCallBack(e.target.value);
|
|
321
|
+
},
|
|
322
|
+
variant: "standard"
|
|
323
|
+
}, localeOpts.map(function (opt) {
|
|
324
|
+
return /*#__PURE__*/_react.default.createElement(_material.MenuItem, {
|
|
325
|
+
key: opt.value,
|
|
326
|
+
value: opt.value
|
|
327
|
+
}, opt.label);
|
|
328
|
+
})))), /*#__PURE__*/_react.default.createElement(_system.Box, {
|
|
231
329
|
className: "Right",
|
|
232
330
|
sx: {
|
|
233
331
|
justifySelf: "right",
|
|
@@ -255,14 +353,14 @@ const ProjectTopbar = _ref => {
|
|
|
255
353
|
sx: {
|
|
256
354
|
fontSize: "12px"
|
|
257
355
|
}
|
|
258
|
-
}, announcement.message) : announcement.message), (loggedInUser === null || loggedInUser === void 0
|
|
356
|
+
}, announcement.message) : announcement.message), (loggedInUser === null || loggedInUser === void 0 ? void 0 : (_loggedInUser$role = loggedInUser.role) === null || _loggedInUser$role === void 0 ? void 0 : _loggedInUser$role.id) === 1 && /*#__PURE__*/_react.default.createElement(_button.default, {
|
|
259
357
|
variant: "text",
|
|
260
358
|
startIcon: /*#__PURE__*/_react.default.createElement(_reactFeather.Settings, {
|
|
261
359
|
size: "1rem"
|
|
262
360
|
})
|
|
263
361
|
// onClick={() => (window.location.href = "/admin/users")}
|
|
264
362
|
,
|
|
265
|
-
onClick: ()
|
|
363
|
+
onClick: function onClick() {
|
|
266
364
|
window.location.href = "/admin/users";
|
|
267
365
|
}
|
|
268
366
|
}, /*#__PURE__*/_react.default.createElement(_text.default, {
|
|
@@ -270,12 +368,12 @@ const ProjectTopbar = _ref => {
|
|
|
270
368
|
style: {
|
|
271
369
|
fontWeight: "600"
|
|
272
370
|
}
|
|
273
|
-
}, "Administration")), /*#__PURE__*/_react.default.createElement(_button.default, {
|
|
371
|
+
}, administrationLabel || "Administration")), /*#__PURE__*/_react.default.createElement(_button.default, {
|
|
274
372
|
variant: "text",
|
|
275
373
|
startIcon: /*#__PURE__*/_react.default.createElement(_fi.FiInfo, {
|
|
276
374
|
size: "1rem"
|
|
277
375
|
}),
|
|
278
|
-
onClick: ()
|
|
376
|
+
onClick: function onClick() {
|
|
279
377
|
window.open("/about", "_blank");
|
|
280
378
|
}
|
|
281
379
|
}, /*#__PURE__*/_react.default.createElement(_text.default, {
|
|
@@ -283,7 +381,7 @@ const ProjectTopbar = _ref => {
|
|
|
283
381
|
style: {
|
|
284
382
|
fontWeight: "600"
|
|
285
383
|
}
|
|
286
|
-
}, "About")), /*#__PURE__*/_react.default.createElement(_system.Box, {
|
|
384
|
+
}, aboutLabel || "About")), /*#__PURE__*/_react.default.createElement(_system.Box, {
|
|
287
385
|
sx: {
|
|
288
386
|
marginLeft: theme.spacing(1)
|
|
289
387
|
}
|
|
@@ -291,14 +389,16 @@ const ProjectTopbar = _ref => {
|
|
|
291
389
|
loggedInUser: loggedInUser,
|
|
292
390
|
onLogout: handleOpen,
|
|
293
391
|
onViewProfileClick: onViewProfileClick,
|
|
294
|
-
avatarItems: avatarItems
|
|
392
|
+
avatarItems: avatarItems,
|
|
393
|
+
lastLoginLabel: lastLoginLabel,
|
|
394
|
+
logoutLabel: logoutLabel
|
|
295
395
|
})))))), /*#__PURE__*/_react.default.createElement(_modal.default, {
|
|
296
396
|
title: "Log out",
|
|
297
397
|
open: open,
|
|
298
398
|
handleClose: handleClose,
|
|
299
399
|
onClose: handleClose,
|
|
300
400
|
width: "sm"
|
|
301
|
-
}, /*#__PURE__*/_react.default.createElement(_text.default, null, "Are you sure you want to log out?"), /*#__PURE__*/_react.default.createElement(_material.Grid, {
|
|
401
|
+
}, /*#__PURE__*/_react.default.createElement(_text.default, null, logoutConfirmLabel || "Are you sure you want to log out?"), /*#__PURE__*/_react.default.createElement(_material.Grid, {
|
|
302
402
|
container: true,
|
|
303
403
|
direction: "row",
|
|
304
404
|
justifyContent: "flex-end",
|
|
@@ -312,10 +412,11 @@ const ProjectTopbar = _ref => {
|
|
|
312
412
|
}, /*#__PURE__*/_react.default.createElement(_button.default, {
|
|
313
413
|
variant: "outlined",
|
|
314
414
|
onClick: handleClose
|
|
315
|
-
}, /*#__PURE__*/_react.default.createElement(_text.default, null, "Cancel")), /*#__PURE__*/_react.default.createElement(_button.default, {
|
|
415
|
+
}, /*#__PURE__*/_react.default.createElement(_text.default, null, cancelLabel || "Cancel")), /*#__PURE__*/_react.default.createElement(_button.default, {
|
|
316
416
|
color: "error",
|
|
317
417
|
onClick: logout
|
|
318
|
-
}, /*#__PURE__*/_react.default.createElement(_text.default, null, "Log out"))))));
|
|
418
|
+
}, /*#__PURE__*/_react.default.createElement(_text.default, null, logoutLabel || "Log out"))))));
|
|
319
419
|
};
|
|
320
420
|
ProjectTopbar.propTypes = {};
|
|
321
|
-
var _default =
|
|
421
|
+
var _default = ProjectTopbar;
|
|
422
|
+
exports.default = _default;
|
|
@@ -1,5 +1,6 @@
|
|
|
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); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
@@ -10,42 +11,47 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
10
11
|
var _avatar = _interopRequireDefault(require("../../avatar"));
|
|
11
12
|
var _text = _interopRequireDefault(require("../../text"));
|
|
12
13
|
var _timeStamp = _interopRequireDefault(require("../../timeStamp"));
|
|
13
|
-
function _interopRequireDefault(
|
|
14
|
-
function
|
|
15
|
-
function
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
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); }
|
|
16
|
+
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; }
|
|
17
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
16
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."); }
|
|
17
|
-
function _unsupportedIterableToArray(
|
|
18
|
-
function _arrayLikeToArray(
|
|
19
|
-
function _iterableToArrayLimit(
|
|
20
|
-
function _arrayWithHoles(
|
|
21
|
-
function _extends() {
|
|
22
|
-
|
|
19
|
+
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); }
|
|
20
|
+
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; }
|
|
21
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
22
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
23
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
24
|
+
var StyledMenu = (0, _styles.withStyles)({
|
|
23
25
|
paper: {
|
|
24
26
|
width: "fit-content !important",
|
|
25
27
|
marginLeft: "10px",
|
|
26
28
|
zIndex: 1
|
|
27
29
|
}
|
|
28
|
-
})(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
})(function (props) {
|
|
31
|
+
return /*#__PURE__*/_react.default.createElement(_material.Menu, _extends({
|
|
32
|
+
disableAutoFocusItem: true,
|
|
33
|
+
anchorOrigin: {
|
|
34
|
+
vertical: "bottom",
|
|
35
|
+
horizontal: "center"
|
|
36
|
+
}
|
|
37
|
+
}, props));
|
|
38
|
+
});
|
|
39
|
+
var UserAvatar = function UserAvatar(_ref) {
|
|
40
|
+
var loggedInUser = _ref.loggedInUser,
|
|
37
41
|
onViewProfileClick = _ref.onViewProfileClick,
|
|
38
42
|
onLogout = _ref.onLogout,
|
|
39
|
-
avatarItems = _ref.avatarItems
|
|
40
|
-
|
|
43
|
+
avatarItems = _ref.avatarItems,
|
|
44
|
+
lastLoginLabel = _ref.lastLoginLabel,
|
|
45
|
+
logoutLabel = _ref.logoutLabel;
|
|
46
|
+
var _useState = (0, _react.useState)(null),
|
|
41
47
|
_useState2 = _slicedToArray(_useState, 2),
|
|
42
48
|
menu = _useState2[0],
|
|
43
49
|
setMenu = _useState2[1];
|
|
44
|
-
|
|
45
|
-
|
|
50
|
+
var theme = (0, _material.useTheme)();
|
|
51
|
+
var handleMenu = function handleMenu(event) {
|
|
46
52
|
setMenu(event.currentTarget);
|
|
47
53
|
};
|
|
48
|
-
|
|
54
|
+
var handleCloseMenu = function handleCloseMenu() {
|
|
49
55
|
setMenu(null);
|
|
50
56
|
};
|
|
51
57
|
return loggedInUser ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_material.Box, {
|
|
@@ -60,7 +66,7 @@ const UserAvatar = _ref => {
|
|
|
60
66
|
open: Boolean(menu),
|
|
61
67
|
onClose: handleCloseMenu
|
|
62
68
|
}, (loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.name) && (loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.email) && /*#__PURE__*/_react.default.createElement(_material.MenuItem, {
|
|
63
|
-
onClick: ()
|
|
69
|
+
onClick: function onClick() {
|
|
64
70
|
handleCloseMenu();
|
|
65
71
|
if (onViewProfileClick) {
|
|
66
72
|
onViewProfileClick();
|
|
@@ -96,43 +102,46 @@ const UserAvatar = _ref => {
|
|
|
96
102
|
}
|
|
97
103
|
}, /*#__PURE__*/_react.default.createElement(_text.default, {
|
|
98
104
|
color: "secondary"
|
|
99
|
-
}, "Last Login :")), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_text.default, {
|
|
105
|
+
}, lastLoginLabel || "Last Login :")), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_text.default, {
|
|
100
106
|
color: "secondary"
|
|
101
107
|
}, /*#__PURE__*/_react.default.createElement(_timeStamp.default, {
|
|
102
108
|
value: (loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.lastLoginAt) + "Z",
|
|
103
109
|
local: true,
|
|
104
110
|
format: "default"
|
|
105
|
-
}))))), !!(avatarItems !== null && avatarItems !== void 0 && avatarItems.length) && (avatarItems === null || avatarItems === void 0 ? void 0 : avatarItems.map((item, index)
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
item.onClick
|
|
111
|
+
}))))), !!(avatarItems !== null && avatarItems !== void 0 && avatarItems.length) && (avatarItems === null || avatarItems === void 0 ? void 0 : avatarItems.map(function (item, index) {
|
|
112
|
+
return /*#__PURE__*/_react.default.createElement(_material.MenuItem, {
|
|
113
|
+
key: index // Add key prop for mapped items
|
|
114
|
+
,
|
|
115
|
+
onClick: function onClick() {
|
|
116
|
+
handleCloseMenu();
|
|
117
|
+
if (item.onClick) {
|
|
118
|
+
item.onClick();
|
|
119
|
+
}
|
|
112
120
|
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
onClick: ()
|
|
121
|
+
}, /*#__PURE__*/_react.default.createElement(_material.Box, {
|
|
122
|
+
display: "flex",
|
|
123
|
+
flexDirection: "row",
|
|
124
|
+
alignItems: "center"
|
|
125
|
+
}, /*#__PURE__*/_react.default.createElement(_material.Box, {
|
|
126
|
+
sx: {
|
|
127
|
+
marginRight: theme.spacing(1)
|
|
128
|
+
}
|
|
129
|
+
}, /*#__PURE__*/_react.default.createElement(_material.Avatar, {
|
|
130
|
+
variant: "rounded",
|
|
131
|
+
sx: {
|
|
132
|
+
width: 30,
|
|
133
|
+
height: 30
|
|
134
|
+
}
|
|
135
|
+
}, item.icon)), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_text.default, null, item.title))));
|
|
136
|
+
})), (loggedInUser === null || loggedInUser === void 0 ? void 0 : loggedInUser.name) && /*#__PURE__*/_react.default.createElement(_material.Divider, null), /*#__PURE__*/_react.default.createElement(_material.MenuItem, {
|
|
137
|
+
onClick: function onClick() {
|
|
130
138
|
handleCloseMenu();
|
|
131
139
|
if (onLogout) {
|
|
132
140
|
onLogout();
|
|
133
141
|
}
|
|
134
142
|
}
|
|
135
|
-
}, /*#__PURE__*/_react.default.createElement(_text.default, null, "Log out")))) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
|
|
143
|
+
}, /*#__PURE__*/_react.default.createElement(_text.default, null, logoutLabel || "Log out")))) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
|
|
136
144
|
};
|
|
137
145
|
UserAvatar.propTypes = {};
|
|
138
|
-
var _default =
|
|
146
|
+
var _default = UserAvatar;
|
|
147
|
+
exports.default = _default;
|