tenjin-ui-kit 0.3.72-dev-1 → 0.3.73
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 +91 -199
- package/common/hooks/newApiHook.js +127 -258
- package/common/utils/security/index.js +2 -2
- package/common/utils/security/securityConfig.js +1 -2
- package/components/Canvas.js +172 -101
- package/components/DragBox/index.js +21 -31
- package/components/InputWithChip/index.js +178 -83
- package/components/RightContext/index.js +17 -41
- package/components/WorkFlow.js +19 -29
- package/components/WorkFlowBuilder.js +32 -56
- package/components/alert/Style.js +11 -14
- package/components/alert/index.js +8 -14
- package/components/attachment/index.js +26 -31
- package/components/authenticationProvider/AuthError.js +3 -4
- package/components/authenticationProvider/AuthLoader.js +3 -4
- package/components/authenticationProvider/index.js +58 -130
- package/components/avatar/index.js +24 -23
- package/components/avatar/styles.js +76 -77
- package/components/breadCrumbs/index.js +64 -89
- package/components/breadCrumbs/style.js +1 -4
- package/components/browsingTestCaseLayout/DetailsViewLayout/DetailsViewContent/index.js +7 -6
- package/components/browsingTestCaseLayout/DetailsViewLayout/DetailsViewContent/style.js +5 -8
- package/components/browsingTestCaseLayout/DetailsViewLayout/DetailsViewHeader/index.js +7 -6
- package/components/browsingTestCaseLayout/TreeViewLayout/TreeViewContent/Index.js +8 -7
- package/components/browsingTestCaseLayout/TreeViewLayout/TreeViewHeader/Index.js +8 -7
- package/components/browsingTestCaseLayout/TreeViewLayout/TreeViewHeader/style.js +16 -19
- package/components/browsingTestCaseLayout/index.js +30 -46
- package/components/button/index.js +47 -58
- package/components/chatBotModal/index.js +40 -61
- package/components/checkBox/index.js +8 -10
- package/components/combobox/index.js +66 -100
- package/components/divider/index.js +9 -18
- package/components/editableField/index.js +19 -46
- package/components/error/index.js +6 -12
- package/components/errorBoundary/index.js +74 -98
- package/components/fileUploader/index.js +46 -58
- package/components/fileUploader/style.js +46 -49
- package/components/filter/ValueSelector.js +149 -245
- package/components/filter/index.js +45 -71
- package/components/iconButton/index.js +3 -4
- package/components/input/index.js +60 -74
- package/components/layout/index.js +36 -49
- package/components/layout/main/index.js +13 -14
- package/components/layout/main/style.js +11 -14
- package/components/layout/pageContent/index.js +8 -7
- package/components/layout/sidebar/FlatMenu.js +51 -47
- package/components/layout/sidebar/GroupedIconMenu.js +169 -194
- package/components/layout/sidebar/GroupedMenu.js +45 -50
- package/components/layout/sidebar/ProjectMenu.js +165 -185
- package/components/layout/sidebar/index.js +27 -26
- package/components/layout/sidebar/style.js +138 -143
- package/components/layout/topBar/ProjectTopbar.js +91 -208
- package/components/layout/topBar/UserAvatar.js +53 -69
- package/components/layout/topBar/index.js +23 -41
- package/components/loader/index.js +9 -12
- package/components/menu/index.js +23 -42
- package/components/modal/Modal.js +5 -6
- package/components/modal/index.js +16 -20
- package/components/modal/style.js +53 -56
- package/components/optionMenu/index.js +32 -47
- package/components/pagination/index.js +23 -43
- package/components/pagination/style.js +25 -28
- package/components/paginationUpdated/index.js +22 -29
- package/components/paper/index.js +20 -22
- package/components/paper/style.js +24 -27
- package/components/reactSelect/index.js +64 -97
- package/components/reactSelect/style.js +131 -151
- package/components/richTextEditor/index.js +24 -48
- package/components/select/GroupedSelect.js +96 -99
- package/components/select/SimpleSelect.js +61 -103
- package/components/select/index.js +56 -69
- package/components/simpleSelect/index.js +18 -22
- package/components/sort/index.js +23 -36
- package/components/switch/index.js +14 -15
- package/components/switch/style.js +29 -32
- package/components/switch/switch.js +30 -47
- package/components/table/ReactTable.js +59 -83
- package/components/table/SimpleTable.js +67 -91
- package/components/table/index.js +300 -206
- package/components/text/index.js +22 -30
- package/components/timeStamp/index.js +4 -9
- package/components/timeStamp/style.js +12 -15
- package/components/topBar/index.js +86 -102
- package/components/tree/index.js +30 -58
- package/components/tree/style.js +20 -23
- package/components/valuePicker/ValueSelector.js +78 -160
- package/components/valuePicker/index.js +30 -50
- package/components/wrapperLayout/layout/index.js +8 -7
- package/components/wrapperLayout/main/index.js +8 -7
- package/components/wrapperLayout/main/pageContainer/index.js +6 -5
- package/components/wrapperLayout/main/sideBar/index.js +171 -175
- package/components/wrapperLayout/main/sideBar/style.js +177 -183
- package/components/wrapperLayout/topBar/UserAvatar.js +6 -5
- package/components/wrapperLayout/topBar/avatar.js +15 -18
- package/components/wrapperLayout/topBar/index.js +115 -107
- package/components/wrapperLayout/topBar/menuIcon.js +6 -5
- package/components/wrapperLayout/topBar/style.js +63 -64
- package/http/index.js +92 -188
- package/index.js +53 -55
- package/package.json +3 -3
- package/templates/listPage/index.js +168 -196
- package/themes/default.js +5 -7
- package/themes/defaultSmall.js +2 -3
- package/themes/responsiveTheme.js +6 -8
|
@@ -8,37 +8,25 @@ var _material = require("@mui/material");
|
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _Error = _interopRequireDefault(require("./Error.jpg"));
|
|
10
10
|
var _text = _interopRequireDefault(require("../text"));
|
|
11
|
-
function _interopRequireDefault(
|
|
12
|
-
function
|
|
13
|
-
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; }
|
|
14
|
-
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); }
|
|
15
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
16
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
17
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
18
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
19
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
20
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
21
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
22
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
23
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
24
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
25
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
26
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
27
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
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); }
|
|
28
13
|
// const ErrorBoundary = (props) => {
|
|
29
14
|
// const { homePage } = props;
|
|
30
15
|
// const [hasError, setHasError] = useState(false);
|
|
16
|
+
|
|
31
17
|
// useEffect(() => {
|
|
32
18
|
// const handleError = (error) => {
|
|
33
19
|
// window.alert("coming");
|
|
34
20
|
// // console.error(error);
|
|
35
21
|
// setHasError(true);
|
|
36
22
|
// };
|
|
23
|
+
|
|
37
24
|
// window.addEventListener("error", handleError);
|
|
38
25
|
// return () => {
|
|
39
26
|
// window.removeEventListener("error", handleError);
|
|
40
27
|
// };
|
|
41
28
|
// }, []);
|
|
29
|
+
|
|
42
30
|
// if (hasError) {
|
|
43
31
|
// return (
|
|
44
32
|
// <Grid container>
|
|
@@ -46,6 +34,7 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
|
46
34
|
// <Grid container justifyContent="center">
|
|
47
35
|
// <h1>Oops! Something went wrong.</h1>
|
|
48
36
|
// </Grid>
|
|
37
|
+
|
|
49
38
|
// <Grid container justifyContent="center">
|
|
50
39
|
// <Stack direction="row" spacing={2}>
|
|
51
40
|
// <Button
|
|
@@ -72,89 +61,76 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
|
72
61
|
// return <>{props.children}</>;
|
|
73
62
|
// }
|
|
74
63
|
// };
|
|
64
|
+
|
|
75
65
|
// export default ErrorBoundary;
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
_classCallCheck(this, ErrorBoundary);
|
|
82
|
-
_this = _super.call(this, props);
|
|
83
|
-
_defineProperty(_assertThisInitialized(_this), "handleGoBack", function () {
|
|
84
|
-
window.history.back();
|
|
85
|
-
window.setTimeout(function () {
|
|
86
|
-
window.location.reload();
|
|
87
|
-
}, 10);
|
|
88
|
-
});
|
|
89
|
-
_this.state = {
|
|
66
|
+
|
|
67
|
+
class ErrorBoundary extends _react.Component {
|
|
68
|
+
constructor(props) {
|
|
69
|
+
super(props);
|
|
70
|
+
this.state = {
|
|
90
71
|
hasError: false
|
|
91
72
|
};
|
|
92
|
-
return _this;
|
|
93
73
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
})));
|
|
153
|
-
}
|
|
154
|
-
return this.props.children;
|
|
74
|
+
componentDidCatch(error, errorInfo) {
|
|
75
|
+
this.setState({
|
|
76
|
+
hasError: true
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
handleGoBack = () => {
|
|
80
|
+
window.history.back();
|
|
81
|
+
window.setTimeout(() => {
|
|
82
|
+
window.location.reload();
|
|
83
|
+
}, 10);
|
|
84
|
+
};
|
|
85
|
+
render() {
|
|
86
|
+
if (this.state.hasError) {
|
|
87
|
+
return /*#__PURE__*/_react.default.createElement(_material.Grid, {
|
|
88
|
+
container: true
|
|
89
|
+
}, /*#__PURE__*/_react.default.createElement(_material.Grid, {
|
|
90
|
+
item: true,
|
|
91
|
+
xs: 6,
|
|
92
|
+
margin: "auto"
|
|
93
|
+
}, /*#__PURE__*/_react.default.createElement(_material.Grid, {
|
|
94
|
+
container: true,
|
|
95
|
+
justifyContent: "center",
|
|
96
|
+
textAlign: "center"
|
|
97
|
+
}, /*#__PURE__*/_react.default.createElement(_text.default, {
|
|
98
|
+
variant: "title",
|
|
99
|
+
bold: true
|
|
100
|
+
}, "Oops! Something went wrong."), /*#__PURE__*/_react.default.createElement(_text.default, {
|
|
101
|
+
variant: "body1"
|
|
102
|
+
}, "Please Reload the page or Refresh the page or return Home to try again.")), /*#__PURE__*/_react.default.createElement(_material.Grid, {
|
|
103
|
+
container: true,
|
|
104
|
+
justifyContent: "center"
|
|
105
|
+
}, /*#__PURE__*/_react.default.createElement(_material.Stack, {
|
|
106
|
+
direction: "row",
|
|
107
|
+
spacing: 2
|
|
108
|
+
}, /*#__PURE__*/_react.default.createElement(_material.Button, {
|
|
109
|
+
variant: "contained",
|
|
110
|
+
onClick: () => window.location.reload()
|
|
111
|
+
}, "Reload"), /*#__PURE__*/_react.default.createElement(_material.Button, {
|
|
112
|
+
variant: "contained",
|
|
113
|
+
onClick: this.handleGoBack
|
|
114
|
+
}, "Go Back"), /*#__PURE__*/_react.default.createElement(_material.Button, {
|
|
115
|
+
variant: "outlined"
|
|
116
|
+
}, /*#__PURE__*/_react.default.createElement("a", {
|
|
117
|
+
style: {
|
|
118
|
+
textDecoration: "none"
|
|
119
|
+
},
|
|
120
|
+
href: this.props.homePage ?? "/"
|
|
121
|
+
}, " ", "Go Home"))))), /*#__PURE__*/_react.default.createElement(_material.Grid, {
|
|
122
|
+
item: true,
|
|
123
|
+
xs: 6
|
|
124
|
+
}, /*#__PURE__*/_react.default.createElement("img", {
|
|
125
|
+
style: {
|
|
126
|
+
height: "100vh",
|
|
127
|
+
width: "100%",
|
|
128
|
+
overflow: "hidden"
|
|
129
|
+
},
|
|
130
|
+
src: _Error.default
|
|
131
|
+
})));
|
|
155
132
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
}
|
|
159
|
-
var _default = ErrorBoundary;
|
|
160
|
-
exports.default = _default;
|
|
133
|
+
return this.props.children;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
var _default = exports.default = ErrorBoundary;
|
|
@@ -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
|
});
|
|
@@ -10,14 +9,13 @@ var _material = require("@mui/material");
|
|
|
10
9
|
var _styles = require("@mui/material/styles");
|
|
11
10
|
var _fi = require("react-icons/fi");
|
|
12
11
|
var _text = _interopRequireDefault(require("../text"));
|
|
13
|
-
function _interopRequireDefault(
|
|
14
|
-
function
|
|
15
|
-
function
|
|
16
|
-
|
|
17
|
-
var FileInput = (0, _styles.styled)("input")({
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
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); }
|
|
14
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
15
|
+
const FileInput = (0, _styles.styled)("input")({
|
|
18
16
|
display: "none"
|
|
19
17
|
});
|
|
20
|
-
|
|
18
|
+
const DropzoneContainer = (0, _styles.styled)(_material.Container)({
|
|
21
19
|
width: "27.3rem",
|
|
22
20
|
height: "9.3rem",
|
|
23
21
|
display: "flex",
|
|
@@ -32,7 +30,7 @@ var DropzoneContainer = (0, _styles.styled)(_material.Container)({
|
|
|
32
30
|
backgroundColor: "#f5f5f5"
|
|
33
31
|
}
|
|
34
32
|
});
|
|
35
|
-
|
|
33
|
+
const DropzoneText = (0, _styles.styled)("p")({
|
|
36
34
|
margin: "1rem",
|
|
37
35
|
display: "flex",
|
|
38
36
|
justifyContent: "center",
|
|
@@ -40,57 +38,51 @@ var DropzoneText = (0, _styles.styled)("p")({
|
|
|
40
38
|
flexDirection: "column",
|
|
41
39
|
gap: "1rem"
|
|
42
40
|
});
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
setSelectedFile
|
|
47
|
-
key
|
|
48
|
-
|
|
41
|
+
const FileUploader = props => {
|
|
42
|
+
const {
|
|
43
|
+
selectedFile,
|
|
44
|
+
setSelectedFile,
|
|
45
|
+
key
|
|
46
|
+
} = props;
|
|
47
|
+
const fileInputRef = (0, _react.useRef)(null);
|
|
49
48
|
|
|
50
49
|
// const handleFileInput = (e) => {
|
|
51
50
|
// e.target.files[0] && setSelectedFile(e.target.files);
|
|
52
51
|
// };
|
|
53
|
-
|
|
52
|
+
const handleFileInput = e => {
|
|
54
53
|
// e.target.files[0] && setSelectedFile(e.target.files);
|
|
55
|
-
|
|
54
|
+
const selectedFile = e.target.files[0];
|
|
56
55
|
if (selectedFile) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
return selectedFile.name.endsWith(ext);
|
|
62
|
-
})) {
|
|
63
|
-
alert("Selected file type .".concat(fileExtension, " is not allowed."));
|
|
56
|
+
const excludedExtensions = [".zip", ".exe", ".batch", ".webm", ".mp4", ".mp3", ".bat", ".js", ".vbs", ".html", ".scr", ".cmd", ".rar", ".svg", ".lnk"];
|
|
57
|
+
const fileExtension = selectedFile?.name?.split(".")?.pop()?.toLowerCase();
|
|
58
|
+
if (excludedExtensions.some(ext => selectedFile.name.endsWith(ext))) {
|
|
59
|
+
alert(`Selected file type .${fileExtension} is not allowed.`);
|
|
64
60
|
e.target.value = null;
|
|
65
61
|
} else {
|
|
66
62
|
e.target.files[0] && setSelectedFile(e.target.files);
|
|
67
63
|
}
|
|
68
64
|
}
|
|
69
65
|
};
|
|
70
|
-
|
|
66
|
+
const handleDrop = e => {
|
|
71
67
|
e.preventDefault();
|
|
72
68
|
e.stopPropagation();
|
|
73
69
|
// setSelectedFile(e.dataTransfer.files);
|
|
74
|
-
|
|
70
|
+
const droppedFiles = e.dataTransfer.files;
|
|
75
71
|
if (droppedFiles.length > 0) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
var _droppedFiles$2, _droppedFiles$2$name;
|
|
81
|
-
return (_droppedFiles$2 = droppedFiles[0]) === null || _droppedFiles$2 === void 0 ? void 0 : (_droppedFiles$2$name = _droppedFiles$2.name) === null || _droppedFiles$2$name === void 0 ? void 0 : _droppedFiles$2$name.endsWith(ext);
|
|
82
|
-
})) {
|
|
83
|
-
alert("Selected file type .".concat(fileExtension, " is not allowed."));
|
|
72
|
+
const excludedExtensions = [".zip", ".exe", ".batch", ".webm", ".mp4", ".mp3", ".bat", ".js", ".vbs", ".html", ".scr", ".cmd", ".rar", ".svg", ".lnk"];
|
|
73
|
+
const fileExtension = droppedFiles[0]?.name?.split(".")?.pop()?.toLowerCase();
|
|
74
|
+
if (excludedExtensions?.some(ext => droppedFiles[0]?.name?.endsWith(ext))) {
|
|
75
|
+
alert(`Selected file type .${fileExtension} is not allowed.`);
|
|
84
76
|
} else {
|
|
85
77
|
setSelectedFile(droppedFiles);
|
|
86
78
|
}
|
|
87
79
|
}
|
|
88
80
|
};
|
|
89
|
-
|
|
81
|
+
const handleDragOver = e => {
|
|
90
82
|
e.preventDefault();
|
|
91
83
|
e.stopPropagation();
|
|
92
84
|
};
|
|
93
|
-
|
|
85
|
+
const handleClick = e => {
|
|
94
86
|
e.preventDefault();
|
|
95
87
|
fileInputRef.current.click();
|
|
96
88
|
};
|
|
@@ -104,34 +96,31 @@ var FileUploader = function FileUploader(props) {
|
|
|
104
96
|
onClick: handleClick,
|
|
105
97
|
onDrop: handleDrop,
|
|
106
98
|
onDragOver: handleDragOver
|
|
107
|
-
}, /*#__PURE__*/_react.default.createElement(DropzoneText, null, !
|
|
99
|
+
}, /*#__PURE__*/_react.default.createElement(DropzoneText, null, !selectedFile?.length > 0 ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_fi.FiUpload, {
|
|
108
100
|
size: "1.9rem",
|
|
109
101
|
color: "#44409A"
|
|
110
102
|
}), /*#__PURE__*/_react.default.createElement(_text.default, {
|
|
111
103
|
bold: true,
|
|
112
104
|
fontWeight: "400",
|
|
113
105
|
fontSize: "1rem"
|
|
114
|
-
}, "Drag and Drop or ", /*#__PURE__*/_react.default.createElement("b", null, "Choose File"), " to Upload")) :
|
|
115
|
-
var _file$name;
|
|
116
|
-
return /*#__PURE__*/_react.default.createElement(_material.Tooltip, {
|
|
117
|
-
arrow: true,
|
|
118
|
-
placement: "top",
|
|
119
|
-
title: (file === null || file === void 0 ? void 0 : (_file$name = file.name) === null || _file$name === void 0 ? void 0 : _file$name.length) > 25 ? file === null || file === void 0 ? void 0 : file.name : ""
|
|
120
|
-
}, /*#__PURE__*/_react.default.createElement(_text.default, {
|
|
121
|
-
sx: {
|
|
122
|
-
width: "220px",
|
|
123
|
-
whiteSpace: "nowrap",
|
|
124
|
-
overflow: "hidden",
|
|
125
|
-
textOverflow: "ellipsis",
|
|
126
|
-
fontWeight: 400,
|
|
127
|
-
fontSize: "1rem"
|
|
128
|
-
},
|
|
129
|
-
key: index
|
|
130
|
-
}, file === null || file === void 0 ? void 0 : file.name));
|
|
131
|
-
})) : /*#__PURE__*/_react.default.createElement(_material.Tooltip, {
|
|
106
|
+
}, "Drag and Drop or ", /*#__PURE__*/_react.default.createElement("b", null, "Choose File"), " to Upload")) : selectedFile?.length > 1 ? /*#__PURE__*/_react.default.createElement("ul", null, Array.from(selectedFile).map((file, index) => /*#__PURE__*/_react.default.createElement(_material.Tooltip, {
|
|
132
107
|
arrow: true,
|
|
133
108
|
placement: "top",
|
|
134
|
-
title:
|
|
109
|
+
title: file?.name?.length > 25 ? file?.name : ""
|
|
110
|
+
}, /*#__PURE__*/_react.default.createElement(_text.default, {
|
|
111
|
+
sx: {
|
|
112
|
+
width: "220px",
|
|
113
|
+
whiteSpace: "nowrap",
|
|
114
|
+
overflow: "hidden",
|
|
115
|
+
textOverflow: "ellipsis",
|
|
116
|
+
fontWeight: 400,
|
|
117
|
+
fontSize: "1rem"
|
|
118
|
+
},
|
|
119
|
+
key: index
|
|
120
|
+
}, file?.name)))) : /*#__PURE__*/_react.default.createElement(_material.Tooltip, {
|
|
121
|
+
arrow: true,
|
|
122
|
+
placement: "top",
|
|
123
|
+
title: selectedFile[0]?.name?.length > 25 ? selectedFile[0]?.name : ""
|
|
135
124
|
}, /*#__PURE__*/_react.default.createElement(_text.default, {
|
|
136
125
|
sx: {
|
|
137
126
|
width: "220px",
|
|
@@ -143,7 +132,7 @@ var FileUploader = function FileUploader(props) {
|
|
|
143
132
|
display: "flex",
|
|
144
133
|
justifyContent: "center"
|
|
145
134
|
}
|
|
146
|
-
},
|
|
135
|
+
}, selectedFile[0]?.name)))), /*#__PURE__*/_react.default.createElement(FileInput, _extends({
|
|
147
136
|
type: "file",
|
|
148
137
|
accept: "image/*",
|
|
149
138
|
onChange: handleFileInput,
|
|
@@ -152,5 +141,4 @@ var FileUploader = function FileUploader(props) {
|
|
|
152
141
|
key: key
|
|
153
142
|
}, props))));
|
|
154
143
|
};
|
|
155
|
-
var _default = FileUploader;
|
|
156
|
-
exports.default = _default;
|
|
144
|
+
var _default = exports.default = FileUploader;
|
|
@@ -6,55 +6,52 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _styles = require("@mui/styles");
|
|
8
8
|
var _default2 = _interopRequireDefault(require("../../themes/default"));
|
|
9
|
-
function _interopRequireDefault(
|
|
10
|
-
var _default = (0, _styles.makeStyles)(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"
|
|
19
|
-
outline: "none"
|
|
20
|
-
},
|
|
21
|
-
margin: "auto"
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
var _default = exports.default = (0, _styles.makeStyles)(() => ({
|
|
11
|
+
modalContentWrapper: {
|
|
12
|
+
position: "absolute",
|
|
13
|
+
backgroundColor: _default2.default.palette.background.paper,
|
|
14
|
+
borderRadius: "3px",
|
|
15
|
+
boxShadow: _default2.default.shadows[5],
|
|
16
|
+
top: "10%",
|
|
17
|
+
"&:focus": {
|
|
18
|
+
outline: "none"
|
|
22
19
|
},
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
margin: "auto"
|
|
21
|
+
},
|
|
22
|
+
default: {
|
|
23
|
+
width: "400px",
|
|
24
|
+
left: "calc(50% - 400px / 2)"
|
|
25
|
+
},
|
|
26
|
+
large: {
|
|
27
|
+
width: "600px",
|
|
28
|
+
left: "calc(50% - 600px / 2)"
|
|
29
|
+
},
|
|
30
|
+
xlarge: {
|
|
31
|
+
width: "800px",
|
|
32
|
+
left: "calc(50% - 800px / 2)"
|
|
33
|
+
},
|
|
34
|
+
fullscreen: {
|
|
35
|
+
width: "98%",
|
|
36
|
+
left: "1%",
|
|
37
|
+
top: "10px"
|
|
38
|
+
},
|
|
39
|
+
header: {
|
|
40
|
+
display: "flex",
|
|
41
|
+
alignItems: "center",
|
|
42
|
+
padding: "0.4rem 1rem",
|
|
43
|
+
borderBottom: "1px solid #ccc",
|
|
44
|
+
"& .title": {
|
|
45
|
+
flexGrow: 1,
|
|
46
|
+
fontWeight: 500
|
|
26
47
|
},
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
left: "calc(50% - 600px / 2)"
|
|
30
|
-
},
|
|
31
|
-
xlarge: {
|
|
32
|
-
width: "800px",
|
|
33
|
-
left: "calc(50% - 800px / 2)"
|
|
34
|
-
},
|
|
35
|
-
fullscreen: {
|
|
36
|
-
width: "98%",
|
|
37
|
-
left: "1%",
|
|
38
|
-
top: "10px"
|
|
39
|
-
},
|
|
40
|
-
header: {
|
|
41
|
-
display: "flex",
|
|
42
|
-
alignItems: "center",
|
|
43
|
-
padding: "0.4rem 1rem",
|
|
44
|
-
borderBottom: "1px solid #ccc",
|
|
45
|
-
"& .title": {
|
|
46
|
-
flexGrow: 1,
|
|
47
|
-
fontWeight: 500
|
|
48
|
-
},
|
|
49
|
-
"& .modalCloseTrigger": {
|
|
50
|
-
cursor: "pointer"
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
content: {
|
|
54
|
-
padding: "0.4rem 1rem",
|
|
55
|
-
maxHeight: "calc(100vh - 170px)",
|
|
56
|
-
overflowY: "auto"
|
|
48
|
+
"& .modalCloseTrigger": {
|
|
49
|
+
cursor: "pointer"
|
|
57
50
|
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
|
|
51
|
+
},
|
|
52
|
+
content: {
|
|
53
|
+
padding: "0.4rem 1rem",
|
|
54
|
+
maxHeight: `calc(100vh - 170px)`,
|
|
55
|
+
overflowY: "auto"
|
|
56
|
+
}
|
|
57
|
+
}));
|