authscape 1.0.126 → 1.0.128

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/index.js CHANGED
@@ -197,6 +197,82 @@ _defineProperty(Datatable, "defaultProps", {
197
197
  });
198
198
  "use strict";
199
199
 
200
+ 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); }
201
+ Object.defineProperty(exports, "__esModule", {
202
+ value: true
203
+ });
204
+ exports.EditableDatagrid = void 0;
205
+ var _react = _interopRequireWildcard(require("react"));
206
+ var _xDataGrid = require("@mui/x-data-grid");
207
+ var _material = require("@mui/material");
208
+ 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); }
209
+ 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; }
210
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
211
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
212
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
213
+ var EditableDatagrid = function EditableDatagrid(_ref) {
214
+ var columns = _ref.columns,
215
+ rows = _ref.rows,
216
+ _isCellEditable = _ref.isCellEditable,
217
+ onCellEdited = _ref.onCellEdited,
218
+ _ref$height = _ref.height,
219
+ height = _ref$height === void 0 ? "50vh" : _ref$height,
220
+ _ref$pageSize = _ref.pageSize,
221
+ pageSize = _ref$pageSize === void 0 ? 50 : _ref$pageSize,
222
+ _ref$rowsPerPage = _ref.rowsPerPage,
223
+ rowsPerPage = _ref$rowsPerPage === void 0 ? [25, 50, 100] : _ref$rowsPerPage,
224
+ _ref$rowHeight = _ref.rowHeight,
225
+ rowHeight = _ref$rowHeight === void 0 ? 70 : _ref$rowHeight;
226
+ var handleCellEditCommit = _react["default"].useCallback(function () {
227
+ return /*#__PURE__*/function () {
228
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(params) {
229
+ var id, field, value, editedRow;
230
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
231
+ while (1) switch (_context.prev = _context.next) {
232
+ case 0:
233
+ id = params.id, field = params.field, value = params.value;
234
+ editedRow = {
235
+ id: id,
236
+ field: field,
237
+ value: value
238
+ };
239
+ onCellEdited(editedRow);
240
+ case 3:
241
+ case "end":
242
+ return _context.stop();
243
+ }
244
+ }, _callee);
245
+ }));
246
+ return function (_x) {
247
+ return _ref2.apply(this, arguments);
248
+ };
249
+ }();
250
+ }, []);
251
+ return /*#__PURE__*/_react["default"].createElement(_material.Box, {
252
+ sx: {
253
+ height: height
254
+ }
255
+ }, /*#__PURE__*/_react["default"].createElement(_xDataGrid.DataGrid, {
256
+ rows: rows,
257
+ columns: columns,
258
+ getRowHeight: function getRowHeight() {
259
+ return rowHeight;
260
+ },
261
+ pageSize: pageSize,
262
+ rowsPerPageOptions: rowsPerPage,
263
+ disableSelectionOnClick: true,
264
+ onCellEditCommit: handleCellEditCommit(),
265
+ isCellEditable: function isCellEditable(params) {
266
+ if (_isCellEditable != null) {
267
+ _isCellEditable(params);
268
+ }
269
+ return true;
270
+ }
271
+ }));
272
+ };
273
+ exports.EditableDatagrid = EditableDatagrid;
274
+ "use strict";
275
+
200
276
  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); }
201
277
  Object.defineProperty(exports, "__esModule", {
202
278
  value: true
@@ -249,7 +325,11 @@ var FileUploader = function FileUploader(_ref) {
249
325
  _ref$primaryColor = _ref.primaryColor,
250
326
  primaryColor = _ref$primaryColor === void 0 ? "#000" : _ref$primaryColor,
251
327
  _ref$onConfirmDelete = _ref.onConfirmDelete,
252
- onConfirmDelete = _ref$onConfirmDelete === void 0 ? null : _ref$onConfirmDelete;
328
+ onConfirmDelete = _ref$onConfirmDelete === void 0 ? null : _ref$onConfirmDelete,
329
+ _ref$variant = _ref.variant,
330
+ variant = _ref$variant === void 0 ? "filemanager" : _ref$variant,
331
+ _ref$onUploadComplete = _ref.onUploadCompleted,
332
+ onUploadCompleted = _ref$onUploadComplete === void 0 ? null : _ref$onUploadComplete;
253
333
  // Declare a new state variable, which we'll call "count"
254
334
  var _useState = (0, _react.useState)(""),
255
335
  _useState2 = _slicedToArray(_useState, 2),
@@ -354,9 +434,12 @@ var FileUploader = function FileUploader(_ref) {
354
434
  _context.next = 12;
355
435
  break;
356
436
  case 30:
437
+ if (onUploadCompleted != null) {
438
+ onUploadCompleted();
439
+ }
357
440
  setUploading(false);
358
441
  setMessage("Uploaded successfully");
359
- case 32:
442
+ case 33:
360
443
  case "end":
361
444
  return _context.stop();
362
445
  }
@@ -444,7 +527,11 @@ var FileUploader = function FileUploader(_ref) {
444
527
  style: {
445
528
  display: "none"
446
529
  }
447
- }), /*#__PURE__*/_react["default"].createElement(_material.Grid, {
530
+ }), variant == "custom" && /*#__PURE__*/_react["default"].createElement(_system.Box, {
531
+ onClick: function onClick() {
532
+ handleUploadFileInput();
533
+ }
534
+ }, children), variant == "filemanager" && /*#__PURE__*/_react["default"].createElement(_material.Grid, {
448
535
  container: true,
449
536
  spacing: 2
450
537
  }, /*#__PURE__*/_react["default"].createElement(_material.Grid, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "authscape",
3
- "version": "1.0.126",
3
+ "version": "1.0.128",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -0,0 +1,40 @@
1
+ import React, {useEffect, useState} from 'react';
2
+ import { DataGrid, GridActionsCellItem } from "@mui/x-data-grid";
3
+ import { Box } from '@mui/material';
4
+
5
+ export const EditableDatagrid = ({columns, rows, isCellEditable, onCellEdited, height="50vh", pageSize = 50, rowsPerPage = [25, 50, 100], rowHeight = 70}) => {
6
+
7
+ const handleCellEditCommit = React.useCallback(() => async (params) => {
8
+
9
+ const { id, field, value } = params;
10
+ const editedRow = { id, field, value };
11
+
12
+ onCellEdited(editedRow);
13
+
14
+ }, []);
15
+
16
+ return (
17
+ <Box sx={{height}}>
18
+ <DataGrid
19
+ rows={rows}
20
+ columns={columns}
21
+ getRowHeight={() => {
22
+ return rowHeight;
23
+ }}
24
+ pageSize={pageSize}
25
+ rowsPerPageOptions={rowsPerPage}
26
+ disableSelectionOnClick
27
+ onCellEditCommit={handleCellEditCommit()}
28
+ isCellEditable={(params) => {
29
+
30
+ if (isCellEditable != null)
31
+ {
32
+ isCellEditable(params);
33
+ }
34
+ return true;
35
+ }}
36
+ />
37
+ </Box>
38
+ )
39
+
40
+ };
@@ -19,7 +19,6 @@ import Tooltip from '@mui/material/Tooltip';
19
19
  import Backdrop from '@mui/material/Backdrop';
20
20
  import CircularProgress from '@mui/material/CircularProgress';
21
21
 
22
-
23
22
  export const FileUploader = ({
24
23
  url,
25
24
  params,
@@ -29,7 +28,9 @@ export const FileUploader = ({
29
28
  isHidden = false,
30
29
  refOveride = null,
31
30
  primaryColor = "#000",
32
- onConfirmDelete = null
31
+ onConfirmDelete = null,
32
+ variant = "filemanager", // custom vs filemanager
33
+ onUploadCompleted = null
33
34
  }) => {
34
35
  // Declare a new state variable, which we'll call "count"
35
36
  const [message, setMessage] = useState("");
@@ -81,6 +82,7 @@ export const FileUploader = ({
81
82
  data.append(element.key, element.value);
82
83
  }
83
84
 
85
+
84
86
  try {
85
87
  await apiService().post(url, data, {
86
88
  onUploadProgress: (ProgressEvent) => {
@@ -107,6 +109,11 @@ export const FileUploader = ({
107
109
  fileIndex++;
108
110
  }
109
111
 
112
+ if (onUploadCompleted != null)
113
+ {
114
+ onUploadCompleted();
115
+ }
116
+
110
117
  setUploading(false);
111
118
  setMessage("Uploaded successfully");
112
119
  };
@@ -152,149 +159,159 @@ export const FileUploader = ({
152
159
  return (
153
160
  <Box sx={{ marginTop: 1, display: isHidden ? "none" : "block" }}>
154
161
 
155
- <input
156
- className="inputfile"
157
- id="file"
158
- type="file"
159
- name="file"
160
- multiple={multiple}
161
- ref={fileUploader}
162
- onChange={handleUpload}
163
- style={{ display: "none" }}
164
- />
165
-
166
- <Grid container spacing={2}>
167
- <Grid ref={refOveride} item xs={4} onClick={handleUploadFileInput}>
168
- <Grid
169
- container
170
- sx={{
171
- padding: 2,
172
- backgroundColor: "#ECEDED",
173
- fontSize: "14px",
174
- cursor: "pointer",
175
- borderRadius: "8px",
176
- border: "1px dashed #C8D4D5",
177
- }}
178
- >
179
- <Grid item xs={2}>
180
- <Box>
181
- <FileCopyRoundedIcon
182
- sx={{ fill: "#C8D4D5", width: 50, height: 50 }}
183
- />
184
- </Box>
185
- </Grid>
186
- <Grid item xs={10}>
187
- <Box>Drag and drop files here or</Box>
188
- <Box sx={{ marginTop: 1 }}>
189
- <Stack direction="row" spacing={2}>
190
- <UploadRoundedIcon
191
- sx={{ fill: primaryColor, width: 30, height: 30 }}
192
- />
193
- <Typography
162
+ <input
163
+ className="inputfile"
164
+ id="file"
165
+ type="file"
166
+ name="file"
167
+ multiple={multiple}
168
+ ref={fileUploader}
169
+ onChange={handleUpload}
170
+ style={{ display: "none" }}
171
+ />
172
+
173
+ {variant == "custom" &&
174
+ <Box onClick={() => {
175
+ handleUploadFileInput();
176
+ }}>
177
+ {children}
178
+ </Box>
179
+ }
180
+
181
+ {variant == "filemanager" &&
182
+ <Grid container spacing={2}>
183
+ <Grid ref={refOveride} item xs={4} onClick={handleUploadFileInput}>
184
+ <Grid
185
+ container
186
+ sx={{
187
+ padding: 2,
188
+ backgroundColor: "#ECEDED",
189
+ fontSize: "14px",
190
+ cursor: "pointer",
191
+ borderRadius: "8px",
192
+ border: "1px dashed #C8D4D5",
193
+ }}
194
+ >
195
+ <Grid item xs={2}>
196
+ <Box>
197
+ <FileCopyRoundedIcon
198
+ sx={{ fill: "#C8D4D5", width: 50, height: 50 }}
199
+ />
200
+ </Box>
201
+ </Grid>
202
+ <Grid item xs={10}>
203
+ <Box>Drag and drop files here or</Box>
204
+ <Box sx={{ marginTop: 1 }}>
205
+ <Stack direction="row" spacing={2}>
206
+ <UploadRoundedIcon
207
+ sx={{ fill: primaryColor, width: 30, height: 30 }}
208
+ />
209
+ <Typography
210
+ variant="h3"
211
+ component={"span"}
212
+ sx={{ color: primaryColor, paddingTop: 0.6 }}
213
+ >
214
+ Upload
215
+ </Typography>
216
+ </Stack>
217
+ </Box>
218
+ </Grid>
219
+ <Grid item xs={12}>
220
+ {loaded > 0 && (
221
+ <LinearProgress
222
+ variant="buffer"
223
+ value={loaded}
224
+ sx={{ marginTop: 2 }}
225
+ />
226
+ )}
227
+
228
+ {loaded == 100 && (
229
+ <Typography
194
230
  variant="h3"
195
231
  component={"span"}
196
- sx={{ color: primaryColor, paddingTop: 0.6 }}
197
- >
198
- Upload
199
- </Typography>
200
- </Stack>
201
- </Box>
232
+ sx={{ color: primaryColor, paddingTop: 0.6 }}>
233
+ Completed
234
+ </Typography>
235
+ )}
236
+ </Grid>
202
237
  </Grid>
203
- <Grid item xs={12}>
204
- {loaded > 0 && (
205
- <LinearProgress
206
- variant="buffer"
207
- value={loaded}
208
- sx={{ marginTop: 2 }}
209
- />
210
- )}
211
-
212
- {loaded == 100 && (
213
- <Typography
214
- variant="h3"
215
- component={"span"}
216
- sx={{ color: primaryColor, paddingTop: 0.6 }}>
217
- Completed
218
- </Typography>
219
- )}
220
238
  </Grid>
221
- </Grid>
222
- </Grid>
223
239
 
224
- {children}
225
-
226
- <Grid container sx={{ paddingTop: 1 }}>
227
- {filesDownloadable != null &&
228
- filesDownloadable.map((fileUpload, idx) => {
229
- return (
230
- <Grid
231
- key={"fileDownloadable-" + idx}
232
- item
233
- xs={8}
234
- sm={8}
235
- md={5}
236
- lg={3}
237
- sx={{
238
- marginLeft: 2,
239
- padding: 1,
240
- marginTop: 1,
241
- backgroundColor: "#ECEDED",
242
- position: "relative",
243
- fontSize: "14px",
244
- cursor: "pointer",
245
- borderRadius: "8px",
246
- border: "1px solid #54C7DD",
247
- }}
248
- onClick={async () => {
249
- window.open(fileUpload.uri);
250
- }}
251
- >
252
- <Tooltip placement="left" arrow title={fileUpload.name}>
253
- <Stack
254
- direction="row"
255
- spacing={1}
256
- display="flex"
257
- justifyContent={"space-between"}
240
+ {children}
241
+
242
+ <Grid container sx={{ paddingTop: 1 }}>
243
+ {filesDownloadable != null &&
244
+ filesDownloadable.map((fileUpload, idx) => {
245
+ return (
246
+ <Grid
247
+ key={"fileDownloadable-" + idx}
248
+ item
249
+ xs={8}
250
+ sm={8}
251
+ md={5}
252
+ lg={3}
253
+ sx={{
254
+ marginLeft: 2,
255
+ padding: 1,
256
+ marginTop: 1,
257
+ backgroundColor: "#ECEDED",
258
+ position: "relative",
259
+ fontSize: "14px",
260
+ cursor: "pointer",
261
+ borderRadius: "8px",
262
+ border: "1px solid #54C7DD",
263
+ }}
264
+ onClick={async () => {
265
+ window.open(fileUpload.uri);
266
+ }}
258
267
  >
259
- <Box display={"flex"} alignItems="center">
260
- <FileDownloadOutlinedIcon sx={{ fill: "#92D6E3" }} />
261
- <Box
262
- sx={{
263
- paddingTop: 0.6,
264
- marginLeft: "5px",
265
- }}
268
+ <Tooltip placement="left" arrow title={fileUpload.name}>
269
+ <Stack
270
+ direction="row"
271
+ spacing={1}
272
+ display="flex"
273
+ justifyContent={"space-between"}
266
274
  >
267
- <Typography
275
+ <Box display={"flex"} alignItems="center">
276
+ <FileDownloadOutlinedIcon sx={{ fill: "#92D6E3" }} />
277
+ <Box
268
278
  sx={{
269
- overflow: "hidden",
270
- whiteSpace: "nowrap",
271
- textOverflow: "ellipsis",
272
- width:"350px"
279
+ paddingTop: 0.6,
280
+ marginLeft: "5px",
273
281
  }}
274
- >
275
- {fileUpload.name}
276
- </Typography>
282
+ >
283
+ <Typography
284
+ sx={{
285
+ overflow: "hidden",
286
+ whiteSpace: "nowrap",
287
+ textOverflow: "ellipsis",
288
+ width:"350px"
289
+ }}
290
+ >
291
+ {fileUpload.name}
292
+ </Typography>
293
+ </Box>
294
+
295
+ <IconButton
296
+ aria-label="delete"
297
+ sx={{ position: "absolute", right: "0" }}
298
+ onClick={(evt) => {
299
+ evt.stopPropagation();
300
+ setOrderFileId(fileUpload.id);
301
+ setViewDeleteDialog(true);
302
+ }}
303
+ >
304
+ <DeleteIcon />
305
+ </IconButton>
277
306
  </Box>
278
-
279
- <IconButton
280
- aria-label="delete"
281
- sx={{ position: "absolute", right: "0" }}
282
- onClick={(evt) => {
283
- evt.stopPropagation();
284
- setOrderFileId(fileUpload.id);
285
- setViewDeleteDialog(true);
286
- }}
287
- >
288
- <DeleteIcon />
289
- </IconButton>
290
- </Box>
291
- </Stack>
292
- </Tooltip>
293
- </Grid>
294
- );
295
- })}
307
+ </Stack>
308
+ </Tooltip>
309
+ </Grid>
310
+ );
311
+ })}
312
+ </Grid>
296
313
  </Grid>
297
- </Grid>
314
+ }
298
315
 
299
316
  <Dialog
300
317
  open={viewDeleteDialog}