authscape 1.0.249 → 1.0.252
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
|
@@ -405,6 +405,530 @@ _defineProperty(Datatable, "defaultProps", {
|
|
|
405
405
|
});
|
|
406
406
|
"use strict";
|
|
407
407
|
|
|
408
|
+
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); }
|
|
409
|
+
Object.defineProperty(exports, "__esModule", {
|
|
410
|
+
value: true
|
|
411
|
+
});
|
|
412
|
+
exports.DocumentManager = void 0;
|
|
413
|
+
var _material = require("@mui/material");
|
|
414
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
415
|
+
var _AddRounded = _interopRequireDefault(require("@mui/icons-material/AddRounded"));
|
|
416
|
+
var _DeleteRounded = _interopRequireDefault(require("@mui/icons-material/DeleteRounded"));
|
|
417
|
+
var _Folder = _interopRequireDefault(require("@mui/icons-material/Folder"));
|
|
418
|
+
var _InsertDriveFile = _interopRequireDefault(require("@mui/icons-material/InsertDriveFile"));
|
|
419
|
+
var _styles = require("@mui/material/styles");
|
|
420
|
+
var _Menu = _interopRequireDefault(require("@mui/material/Menu"));
|
|
421
|
+
var _MenuItem = _interopRequireDefault(require("@mui/material/MenuItem"));
|
|
422
|
+
var _Divider = _interopRequireDefault(require("@mui/material/Divider"));
|
|
423
|
+
var _KeyboardArrowDown = _interopRequireDefault(require("@mui/icons-material/KeyboardArrowDown"));
|
|
424
|
+
var _InsertDriveFileOutlined = _interopRequireDefault(require("@mui/icons-material/InsertDriveFileOutlined"));
|
|
425
|
+
var _Breadcrumbs = _interopRequireDefault(require("@mui/material/Breadcrumbs"));
|
|
426
|
+
var _Link = _interopRequireDefault(require("@mui/material/Link"));
|
|
427
|
+
var _PublishRounded = _interopRequireDefault(require("@mui/icons-material/PublishRounded"));
|
|
428
|
+
var _Dialog = _interopRequireDefault(require("@mui/material/Dialog"));
|
|
429
|
+
var _DialogActions = _interopRequireDefault(require("@mui/material/DialogActions"));
|
|
430
|
+
var _DialogContent = _interopRequireDefault(require("@mui/material/DialogContent"));
|
|
431
|
+
var _DialogContentText = _interopRequireDefault(require("@mui/material/DialogContentText"));
|
|
432
|
+
var _DialogTitle = _interopRequireDefault(require("@mui/material/DialogTitle"));
|
|
433
|
+
var _LockRounded = _interopRequireDefault(require("@mui/icons-material/LockRounded"));
|
|
434
|
+
var _Tooltip = _interopRequireDefault(require("@mui/material/Tooltip"));
|
|
435
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
436
|
+
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); }
|
|
437
|
+
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; }
|
|
438
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
439
|
+
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."); }
|
|
440
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
441
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
442
|
+
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); }
|
|
443
|
+
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; }
|
|
444
|
+
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); } }
|
|
445
|
+
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); }); }; }
|
|
446
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
447
|
+
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."); }
|
|
448
|
+
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); }
|
|
449
|
+
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; }
|
|
450
|
+
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; } }
|
|
451
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
452
|
+
// remove before merging back
|
|
453
|
+
// import { FileUploader, apiService, NextImage } from 'authscape';
|
|
454
|
+
|
|
455
|
+
var DocumentManager = function DocumentManager(_ref) {
|
|
456
|
+
var loadedUser = _ref.loadedUser,
|
|
457
|
+
setIsLoading = _ref.setIsLoading,
|
|
458
|
+
_ref$viewDocumentType = _ref.viewDocumentType,
|
|
459
|
+
viewDocumentType = _ref$viewDocumentType === void 0 ? 1 : _ref$viewDocumentType,
|
|
460
|
+
_ref$apiDownloadEnfor = _ref.apiDownloadEnforced,
|
|
461
|
+
apiDownloadEnforced = _ref$apiDownloadEnfor === void 0 ? false : _ref$apiDownloadEnfor,
|
|
462
|
+
_ref$openToFolderId = _ref.openToFolderId,
|
|
463
|
+
openToFolderId = _ref$openToFolderId === void 0 ? null : _ref$openToFolderId,
|
|
464
|
+
_ref$overrideLockMess = _ref.overrideLockMessage,
|
|
465
|
+
overrideLockMessage = _ref$overrideLockMess === void 0 ? "The directory cannot be removed." : _ref$overrideLockMess;
|
|
466
|
+
var fileUploaderRef = (0, _react.useRef)();
|
|
467
|
+
var _useState = (0, _react.useState)(null),
|
|
468
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
469
|
+
files = _useState2[0],
|
|
470
|
+
setFiles = _useState2[1];
|
|
471
|
+
var _useState3 = (0, _react.useState)(false),
|
|
472
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
473
|
+
update = _useState4[0],
|
|
474
|
+
setUpdate = _useState4[1];
|
|
475
|
+
var _useState5 = (0, _react.useState)(null),
|
|
476
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
477
|
+
folderParent = _useState6[0],
|
|
478
|
+
setFolderParent = _useState6[1];
|
|
479
|
+
var _useState7 = (0, _react.useState)([]),
|
|
480
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
481
|
+
breadCrumb = _useState8[0],
|
|
482
|
+
setBreadCrumb = _useState8[1];
|
|
483
|
+
var _useState9 = (0, _react.useState)(null),
|
|
484
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
485
|
+
contextMenu = _useState10[0],
|
|
486
|
+
setContextMenu = _useState10[1];
|
|
487
|
+
var _useState11 = (0, _react.useState)(null),
|
|
488
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
489
|
+
contextFile = _useState12[0],
|
|
490
|
+
setContextFile = _useState12[1];
|
|
491
|
+
var _useState13 = (0, _react.useState)(false),
|
|
492
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
493
|
+
dialogDelete = _useState14[0],
|
|
494
|
+
setDialogDelete = _useState14[1];
|
|
495
|
+
var handleContextMenu = function handleContextMenu(event, file) {
|
|
496
|
+
event.preventDefault();
|
|
497
|
+
setContextFile(file);
|
|
498
|
+
if (!file.isLocked) {
|
|
499
|
+
setContextMenu(contextMenu === null ? {
|
|
500
|
+
mouseX: event.clientX + 2,
|
|
501
|
+
mouseY: event.clientY - 6
|
|
502
|
+
} :
|
|
503
|
+
// repeated contextmenu when it is already open closes it with Chrome 84 on Ubuntu
|
|
504
|
+
// Other native context menus might behave different.
|
|
505
|
+
// With this behavior we prevent contextmenu from the backdrop to re-locale existing context menus.
|
|
506
|
+
null);
|
|
507
|
+
}
|
|
508
|
+
};
|
|
509
|
+
(0, _react.useEffect)(function () {
|
|
510
|
+
if (loadedUser) {
|
|
511
|
+
var fetchDocuments = /*#__PURE__*/function () {
|
|
512
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
513
|
+
var folderId, response, _response;
|
|
514
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
515
|
+
while (1) switch (_context.prev = _context.next) {
|
|
516
|
+
case 0:
|
|
517
|
+
folderId = null;
|
|
518
|
+
if (folderParent == null && openToFolderId != null) {
|
|
519
|
+
folderId = {
|
|
520
|
+
id: openToFolderId
|
|
521
|
+
};
|
|
522
|
+
} else if (folderParent != null) {
|
|
523
|
+
folderId = folderParent.id;
|
|
524
|
+
}
|
|
525
|
+
if (!(folderId != null)) {
|
|
526
|
+
_context.next = 9;
|
|
527
|
+
break;
|
|
528
|
+
}
|
|
529
|
+
_context.next = 5;
|
|
530
|
+
return apiService().get("/Document/GetDocumentsAndFiles?parentFolderId=" + folderId + "&ViewDocumentType=" + viewDocumentType);
|
|
531
|
+
case 5:
|
|
532
|
+
response = _context.sent;
|
|
533
|
+
if (response != null && response.status == 200) {
|
|
534
|
+
setFiles(response.data);
|
|
535
|
+
}
|
|
536
|
+
_context.next = 13;
|
|
537
|
+
break;
|
|
538
|
+
case 9:
|
|
539
|
+
_context.next = 11;
|
|
540
|
+
return apiService().get("/Document/GetDocumentsAndFiles?ViewDocumentType=" + viewDocumentType);
|
|
541
|
+
case 11:
|
|
542
|
+
_response = _context.sent;
|
|
543
|
+
if (_response != null && _response.status == 200) {
|
|
544
|
+
setFiles(_response.data);
|
|
545
|
+
}
|
|
546
|
+
case 13:
|
|
547
|
+
case "end":
|
|
548
|
+
return _context.stop();
|
|
549
|
+
}
|
|
550
|
+
}, _callee);
|
|
551
|
+
}));
|
|
552
|
+
return function fetchDocuments() {
|
|
553
|
+
return _ref2.apply(this, arguments);
|
|
554
|
+
};
|
|
555
|
+
}();
|
|
556
|
+
fetchDocuments();
|
|
557
|
+
}
|
|
558
|
+
}, [loadedUser, folderParent, update]);
|
|
559
|
+
var _useState15 = (0, _react.useState)(null),
|
|
560
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
561
|
+
anchorEl = _useState16[0],
|
|
562
|
+
setAnchorEl = _useState16[1];
|
|
563
|
+
var open = Boolean(anchorEl);
|
|
564
|
+
var handleClick = function handleClick(event) {
|
|
565
|
+
setAnchorEl(event.currentTarget);
|
|
566
|
+
};
|
|
567
|
+
var handleClose = function handleClose() {
|
|
568
|
+
setAnchorEl(null);
|
|
569
|
+
setContextMenu(null);
|
|
570
|
+
};
|
|
571
|
+
var StyledMenu = (0, _styles.styled)(function (props) {
|
|
572
|
+
return /*#__PURE__*/_react["default"].createElement(_Menu["default"], _extends({
|
|
573
|
+
elevation: 0,
|
|
574
|
+
anchorOrigin: {
|
|
575
|
+
vertical: 'bottom',
|
|
576
|
+
horizontal: 'right'
|
|
577
|
+
},
|
|
578
|
+
transformOrigin: {
|
|
579
|
+
vertical: 'top',
|
|
580
|
+
horizontal: 'right'
|
|
581
|
+
}
|
|
582
|
+
}, props));
|
|
583
|
+
})(function (_ref3) {
|
|
584
|
+
var theme = _ref3.theme;
|
|
585
|
+
return {
|
|
586
|
+
'& .MuiPaper-root': {
|
|
587
|
+
borderRadius: 6,
|
|
588
|
+
marginTop: theme.spacing(1),
|
|
589
|
+
minWidth: 180,
|
|
590
|
+
color: theme.palette.mode === 'light' ? 'rgb(55, 65, 81)' : theme.palette.grey[300],
|
|
591
|
+
boxShadow: 'rgb(255, 255, 255) 0px 0px 0px 0px, rgba(0, 0, 0, 0.05) 0px 0px 0px 1px, rgba(0, 0, 0, 0.1) 0px 10px 15px -3px, rgba(0, 0, 0, 0.05) 0px 4px 6px -2px',
|
|
592
|
+
'& .MuiMenu-list': {
|
|
593
|
+
padding: '4px 0'
|
|
594
|
+
},
|
|
595
|
+
'& .MuiMenuItem-root': {
|
|
596
|
+
'& .MuiSvgIcon-root': {
|
|
597
|
+
fontSize: 18,
|
|
598
|
+
color: theme.palette.text.secondary,
|
|
599
|
+
marginRight: theme.spacing(1.5)
|
|
600
|
+
},
|
|
601
|
+
'&:active': {
|
|
602
|
+
backgroundColor: (0, _styles.alpha)(theme.palette.primary.main, theme.palette.action.selectedOpacity)
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
};
|
|
607
|
+
});
|
|
608
|
+
var handleFileClick = /*#__PURE__*/function () {
|
|
609
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(file) {
|
|
610
|
+
var addToBread,
|
|
611
|
+
newBC,
|
|
612
|
+
newList,
|
|
613
|
+
hasBeenFound,
|
|
614
|
+
index,
|
|
615
|
+
element,
|
|
616
|
+
_args2 = arguments;
|
|
617
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
618
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
619
|
+
case 0:
|
|
620
|
+
addToBread = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : true;
|
|
621
|
+
if (!(file.type == "folder")) {
|
|
622
|
+
_context2.next = 25;
|
|
623
|
+
break;
|
|
624
|
+
}
|
|
625
|
+
setFolderParent(file);
|
|
626
|
+
if (!addToBread) {
|
|
627
|
+
_context2.next = 9;
|
|
628
|
+
break;
|
|
629
|
+
}
|
|
630
|
+
newBC = _toConsumableArray(breadCrumb);
|
|
631
|
+
newBC.push(file);
|
|
632
|
+
setBreadCrumb(newBC);
|
|
633
|
+
_context2.next = 23;
|
|
634
|
+
break;
|
|
635
|
+
case 9:
|
|
636
|
+
newList = [];
|
|
637
|
+
hasBeenFound = false;
|
|
638
|
+
index = 0;
|
|
639
|
+
case 12:
|
|
640
|
+
if (!(index < breadCrumb.length)) {
|
|
641
|
+
_context2.next = 22;
|
|
642
|
+
break;
|
|
643
|
+
}
|
|
644
|
+
element = breadCrumb[index];
|
|
645
|
+
if (!(element.id == file.id)) {
|
|
646
|
+
_context2.next = 18;
|
|
647
|
+
break;
|
|
648
|
+
}
|
|
649
|
+
hasBeenFound = true;
|
|
650
|
+
newList.push(element);
|
|
651
|
+
return _context2.abrupt("break", 22);
|
|
652
|
+
case 18:
|
|
653
|
+
if (!hasBeenFound) {
|
|
654
|
+
newList.push(element);
|
|
655
|
+
}
|
|
656
|
+
case 19:
|
|
657
|
+
index++;
|
|
658
|
+
_context2.next = 12;
|
|
659
|
+
break;
|
|
660
|
+
case 22:
|
|
661
|
+
setBreadCrumb(newList);
|
|
662
|
+
case 23:
|
|
663
|
+
_context2.next = 28;
|
|
664
|
+
break;
|
|
665
|
+
case 25:
|
|
666
|
+
setIsLoading(true);
|
|
667
|
+
_context2.next = 28;
|
|
668
|
+
return apiService().DownloadFile("/Document/DownloadDocument?documentId=" + file.id + "&ViewDocumentType=" + viewDocumentType, file.name, function () {
|
|
669
|
+
setIsLoading(false);
|
|
670
|
+
});
|
|
671
|
+
case 28:
|
|
672
|
+
case "end":
|
|
673
|
+
return _context2.stop();
|
|
674
|
+
}
|
|
675
|
+
}, _callee2);
|
|
676
|
+
}));
|
|
677
|
+
return function handleFileClick(_x2) {
|
|
678
|
+
return _ref4.apply(this, arguments);
|
|
679
|
+
};
|
|
680
|
+
}();
|
|
681
|
+
var dialogDeleteClosed = function dialogDeleteClosed() {
|
|
682
|
+
setContextFile(null);
|
|
683
|
+
setContextMenu(null);
|
|
684
|
+
setDialogDelete(false);
|
|
685
|
+
};
|
|
686
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_material.Box, {
|
|
687
|
+
sx: {
|
|
688
|
+
flexGrow: 1
|
|
689
|
+
}
|
|
690
|
+
}, /*#__PURE__*/_react["default"].createElement(_material.AppBar, {
|
|
691
|
+
position: "static",
|
|
692
|
+
color: "inherit",
|
|
693
|
+
elevation: 0
|
|
694
|
+
}, /*#__PURE__*/_react["default"].createElement(_material.Toolbar, null, /*#__PURE__*/_react["default"].createElement(_material.Box, null, /*#__PURE__*/_react["default"].createElement(_material.Button, {
|
|
695
|
+
id: "demo-customized-button",
|
|
696
|
+
"aria-controls": open ? 'demo-customized-menu' : undefined,
|
|
697
|
+
"aria-haspopup": "true",
|
|
698
|
+
"aria-expanded": open ? 'true' : undefined,
|
|
699
|
+
variant: "contained",
|
|
700
|
+
disableElevation: true,
|
|
701
|
+
onClick: handleClick,
|
|
702
|
+
startIcon: /*#__PURE__*/_react["default"].createElement(_AddRounded["default"], null),
|
|
703
|
+
endIcon: /*#__PURE__*/_react["default"].createElement(_KeyboardArrowDown["default"], null)
|
|
704
|
+
}, "New"), /*#__PURE__*/_react["default"].createElement(StyledMenu, {
|
|
705
|
+
id: "demo-customized-menu",
|
|
706
|
+
MenuListProps: {
|
|
707
|
+
'aria-labelledby': 'demo-customized-button'
|
|
708
|
+
},
|
|
709
|
+
anchorEl: anchorEl,
|
|
710
|
+
open: open,
|
|
711
|
+
onClose: handleClose
|
|
712
|
+
}, /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
|
|
713
|
+
onClick: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
714
|
+
var newDocumentName, response;
|
|
715
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
716
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
717
|
+
case 0:
|
|
718
|
+
newDocumentName = prompt("New folder name");
|
|
719
|
+
if (!(newDocumentName != null && newDocumentName != "")) {
|
|
720
|
+
_context3.next = 6;
|
|
721
|
+
break;
|
|
722
|
+
}
|
|
723
|
+
_context3.next = 4;
|
|
724
|
+
return apiService().post("/Document/CreateFolder", {
|
|
725
|
+
folderName: newDocumentName,
|
|
726
|
+
parentFolderId: folderParent != null ? folderParent.id : null,
|
|
727
|
+
viewDocumentType: viewDocumentType
|
|
728
|
+
});
|
|
729
|
+
case 4:
|
|
730
|
+
response = _context3.sent;
|
|
731
|
+
if (response != null && response.status == 200) {
|
|
732
|
+
// refresh
|
|
733
|
+
setUpdate(!update);
|
|
734
|
+
}
|
|
735
|
+
case 6:
|
|
736
|
+
handleClose();
|
|
737
|
+
case 7:
|
|
738
|
+
case "end":
|
|
739
|
+
return _context3.stop();
|
|
740
|
+
}
|
|
741
|
+
}, _callee3);
|
|
742
|
+
})),
|
|
743
|
+
disableRipple: true
|
|
744
|
+
}, /*#__PURE__*/_react["default"].createElement(_InsertDriveFile["default"], null), "New Folder"))), /*#__PURE__*/_react["default"].createElement(FileUploader, {
|
|
745
|
+
refOveride: fileUploaderRef,
|
|
746
|
+
url: "/Document/UploadFile",
|
|
747
|
+
params: {
|
|
748
|
+
parentFolderId: folderParent != null ? folderParent.id : "",
|
|
749
|
+
viewDocumentType: viewDocumentType
|
|
750
|
+
},
|
|
751
|
+
multiple: true,
|
|
752
|
+
variant: "custom",
|
|
753
|
+
onUploadCompleted: function onUploadCompleted() {
|
|
754
|
+
setUpdate(!update);
|
|
755
|
+
handleClose();
|
|
756
|
+
}
|
|
757
|
+
}, /*#__PURE__*/_react["default"].createElement(_material.Button, {
|
|
758
|
+
id: "FileUploader",
|
|
759
|
+
"aria-controls": open ? 'demo-customized-menu' : undefined,
|
|
760
|
+
"aria-haspopup": "true",
|
|
761
|
+
"aria-expanded": open ? 'true' : undefined,
|
|
762
|
+
variant: "text",
|
|
763
|
+
disableElevation: true,
|
|
764
|
+
startIcon: /*#__PURE__*/_react["default"].createElement(_PublishRounded["default"], null),
|
|
765
|
+
sx: {
|
|
766
|
+
marginLeft: 1
|
|
767
|
+
}
|
|
768
|
+
}, "Upload File(s)")))), /*#__PURE__*/_react["default"].createElement(_Divider["default"], null), /*#__PURE__*/_react["default"].createElement(_Breadcrumbs["default"], {
|
|
769
|
+
"aria-label": "breadcrumb",
|
|
770
|
+
separator: ">",
|
|
771
|
+
sx: {
|
|
772
|
+
marginLeft: 1,
|
|
773
|
+
marginBottom: 2,
|
|
774
|
+
marginTop: 2
|
|
775
|
+
}
|
|
776
|
+
}, /*#__PURE__*/_react["default"].createElement(_Link["default"], {
|
|
777
|
+
underline: "hover",
|
|
778
|
+
color: "inherit",
|
|
779
|
+
sx: {
|
|
780
|
+
cursor: "pointer",
|
|
781
|
+
fontWeight: "bold"
|
|
782
|
+
},
|
|
783
|
+
onClick: function onClick() {
|
|
784
|
+
setFolderParent(null);
|
|
785
|
+
setBreadCrumb([]);
|
|
786
|
+
}
|
|
787
|
+
}, "My Files"), breadCrumb.map(function (bread, index) {
|
|
788
|
+
return /*#__PURE__*/_react["default"].createElement(_Link["default"], {
|
|
789
|
+
key: index,
|
|
790
|
+
underline: "hover",
|
|
791
|
+
sx: {
|
|
792
|
+
cursor: "pointer"
|
|
793
|
+
},
|
|
794
|
+
color: "inherit",
|
|
795
|
+
onClick: function onClick() {
|
|
796
|
+
handleFileClick(bread, false);
|
|
797
|
+
}
|
|
798
|
+
}, bread.name);
|
|
799
|
+
}))), /*#__PURE__*/_react["default"].createElement(_material.Box, {
|
|
800
|
+
sx: {
|
|
801
|
+
height: "85vh",
|
|
802
|
+
width: '100%'
|
|
803
|
+
}
|
|
804
|
+
}, /*#__PURE__*/_react["default"].createElement(_material.Grid, {
|
|
805
|
+
container: true,
|
|
806
|
+
spacing: 2
|
|
807
|
+
}, files != null && files.map(function (file, index) {
|
|
808
|
+
return /*#__PURE__*/_react["default"].createElement(_material.Grid, {
|
|
809
|
+
onContextMenu: function onContextMenu(event) {
|
|
810
|
+
handleContextMenu(event, file);
|
|
811
|
+
},
|
|
812
|
+
item: true,
|
|
813
|
+
key: index,
|
|
814
|
+
xs: 12,
|
|
815
|
+
sm: 6,
|
|
816
|
+
md: 4,
|
|
817
|
+
lg: 2,
|
|
818
|
+
onClick: function onClick() {
|
|
819
|
+
return handleFileClick(file);
|
|
820
|
+
}
|
|
821
|
+
}, /*#__PURE__*/_react["default"].createElement(_material.Paper, {
|
|
822
|
+
sx: {
|
|
823
|
+
padding: 2,
|
|
824
|
+
flexDirection: 'column',
|
|
825
|
+
height: "100%",
|
|
826
|
+
display: "flex",
|
|
827
|
+
alignItems: "center",
|
|
828
|
+
cursor: 'pointer',
|
|
829
|
+
maxHeight: 300,
|
|
830
|
+
position: "relative",
|
|
831
|
+
'&:hover': {
|
|
832
|
+
backgroundColor: '#F5F5F5'
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
}, file.type === 'folder' && /*#__PURE__*/_react["default"].createElement(_material.Box, {
|
|
836
|
+
sx: {
|
|
837
|
+
position: "absolute",
|
|
838
|
+
top: 45,
|
|
839
|
+
color: "white"
|
|
840
|
+
}
|
|
841
|
+
}, file.count), file.isLocked && /*#__PURE__*/_react["default"].createElement(_material.Box, {
|
|
842
|
+
sx: {
|
|
843
|
+
position: "absolute",
|
|
844
|
+
top: 10,
|
|
845
|
+
right: 10,
|
|
846
|
+
color: "black"
|
|
847
|
+
}
|
|
848
|
+
}, /*#__PURE__*/_react["default"].createElement(_Tooltip["default"], {
|
|
849
|
+
title: overrideLockMessage
|
|
850
|
+
}, /*#__PURE__*/_react["default"].createElement(_LockRounded["default"], null))), file.type === 'folder' ? /*#__PURE__*/_react["default"].createElement(_Folder["default"], {
|
|
851
|
+
sx: {
|
|
852
|
+
fontSize: 80,
|
|
853
|
+
color: "orange"
|
|
854
|
+
}
|
|
855
|
+
}) : file.documentFileExtentionType == 0 || apiDownloadEnforced ? /*#__PURE__*/_react["default"].createElement(_InsertDriveFileOutlined["default"], {
|
|
856
|
+
sx: {
|
|
857
|
+
fontSize: 60
|
|
858
|
+
}
|
|
859
|
+
}) : /*#__PURE__*/_react["default"].createElement(NextImage, {
|
|
860
|
+
src: file.uri,
|
|
861
|
+
alt: "Image",
|
|
862
|
+
width: 80,
|
|
863
|
+
height: 80
|
|
864
|
+
}), /*#__PURE__*/_react["default"].createElement(_material.Typography, {
|
|
865
|
+
variant: "subtitle1",
|
|
866
|
+
sx: {
|
|
867
|
+
paddingTop: 1,
|
|
868
|
+
fontSize: 14
|
|
869
|
+
}
|
|
870
|
+
}, file.name), /*#__PURE__*/_react["default"].createElement(_material.Typography, {
|
|
871
|
+
variant: "subtitle2",
|
|
872
|
+
sx: {
|
|
873
|
+
paddingTop: 0,
|
|
874
|
+
fontSize: 11
|
|
875
|
+
}
|
|
876
|
+
}, file.lastUpdated)));
|
|
877
|
+
})), /*#__PURE__*/_react["default"].createElement(_Menu["default"], {
|
|
878
|
+
open: contextMenu !== null,
|
|
879
|
+
onClose: handleClose,
|
|
880
|
+
anchorReference: "anchorPosition",
|
|
881
|
+
anchorPosition: contextMenu !== null ? {
|
|
882
|
+
top: contextMenu.mouseY,
|
|
883
|
+
left: contextMenu.mouseX
|
|
884
|
+
} : undefined
|
|
885
|
+
}, /*#__PURE__*/_react["default"].createElement(_MenuItem["default"], {
|
|
886
|
+
startIcon: /*#__PURE__*/_react["default"].createElement(_DeleteRounded["default"], null),
|
|
887
|
+
onClick: function onClick() {
|
|
888
|
+
setDialogDelete(true);
|
|
889
|
+
handleClose();
|
|
890
|
+
}
|
|
891
|
+
}, "Delete"))), /*#__PURE__*/_react["default"].createElement(_Dialog["default"], {
|
|
892
|
+
open: dialogDelete,
|
|
893
|
+
onClose: function onClose() {
|
|
894
|
+
dialogDeleteClosed();
|
|
895
|
+
},
|
|
896
|
+
"aria-labelledby": "alert-dialog-title",
|
|
897
|
+
"aria-describedby": "alert-dialog-description"
|
|
898
|
+
}, /*#__PURE__*/_react["default"].createElement(_DialogTitle["default"], {
|
|
899
|
+
id: "alert-dialog-title"
|
|
900
|
+
}, "Are you sure you wan to delete ", contextFile != null ? contextFile.name : "", "?"), /*#__PURE__*/_react["default"].createElement(_DialogContent["default"], null, /*#__PURE__*/_react["default"].createElement(_DialogContentText["default"], {
|
|
901
|
+
id: "alert-dialog-description"
|
|
902
|
+
}, contextFile != null && contextFile.type != null && contextFile.type == 'folder' && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, "If you delete ", contextFile != null ? contextFile.name : "", ", you will delete all files and folders within ", contextFile != null ? contextFile.name : "", "."), contextFile != null && contextFile.type != null && contextFile.type != 'folder' && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, "If you delete ", contextFile != null ? contextFile.name : "", " this file will be gone forever."))), /*#__PURE__*/_react["default"].createElement(_DialogActions["default"], null, /*#__PURE__*/_react["default"].createElement(_material.Button, {
|
|
903
|
+
onClick: function onClick() {
|
|
904
|
+
dialogDeleteClosed();
|
|
905
|
+
}
|
|
906
|
+
}, "Cancel"), /*#__PURE__*/_react["default"].createElement(_material.Button, {
|
|
907
|
+
onClick: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
908
|
+
var response;
|
|
909
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
910
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
911
|
+
case 0:
|
|
912
|
+
dialogDeleteClosed();
|
|
913
|
+
_context4.next = 3;
|
|
914
|
+
return apiService()["delete"]("/Document/DeleteFolder?documentId=" + contextFile.id);
|
|
915
|
+
case 3:
|
|
916
|
+
response = _context4.sent;
|
|
917
|
+
if (response != null && response.status == 200) {
|
|
918
|
+
setUpdate(!update);
|
|
919
|
+
}
|
|
920
|
+
case 5:
|
|
921
|
+
case "end":
|
|
922
|
+
return _context4.stop();
|
|
923
|
+
}
|
|
924
|
+
}, _callee4);
|
|
925
|
+
})),
|
|
926
|
+
autoFocus: true
|
|
927
|
+
}, "Delete"))));
|
|
928
|
+
};
|
|
929
|
+
exports.DocumentManager = DocumentManager;
|
|
930
|
+
"use strict";
|
|
931
|
+
|
|
408
932
|
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); }
|
|
409
933
|
Object.defineProperty(exports, "__esModule", {
|
|
410
934
|
value: true
|
package/package.json
CHANGED
|
@@ -21,7 +21,10 @@ import DialogTitle from '@mui/material/DialogTitle';
|
|
|
21
21
|
import LockRoundedIcon from '@mui/icons-material/LockRounded';
|
|
22
22
|
import Tooltip from '@mui/material/Tooltip';
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
// remove before merging back
|
|
25
|
+
// import { FileUploader, apiService, NextImage } from 'authscape';
|
|
26
|
+
|
|
27
|
+
export const DocumentManager = ({loadedUser, setIsLoading, viewDocumentType = 1, apiDownloadEnforced = false, openToFolderId = null, overrideLockMessage = "The directory cannot be removed."}) => {
|
|
25
28
|
|
|
26
29
|
const fileUploaderRef = useRef();
|
|
27
30
|
const [files, setFiles] = useState(null);
|
|
@@ -61,13 +64,23 @@ export const DocumentManager = ({loadedUser, setIsLoading, viewDocumentType = 1,
|
|
|
61
64
|
if (loadedUser)
|
|
62
65
|
{
|
|
63
66
|
const fetchDocuments = async () => {
|
|
67
|
+
|
|
68
|
+
let folderId = null;
|
|
69
|
+
if (folderParent == null && openToFolderId != null)
|
|
70
|
+
{
|
|
71
|
+
folderId = { id: openToFolderId };
|
|
72
|
+
}
|
|
73
|
+
else if (folderParent != null)
|
|
74
|
+
{
|
|
75
|
+
folderId = folderParent.id;
|
|
76
|
+
}
|
|
64
77
|
|
|
65
|
-
if (
|
|
78
|
+
if (folderId != null)
|
|
66
79
|
{
|
|
67
|
-
let response = await apiService().get("/Document/GetDocumentsAndFiles?parentFolderId=" +
|
|
80
|
+
let response = await apiService().get("/Document/GetDocumentsAndFiles?parentFolderId=" + folderId + "&ViewDocumentType=" + viewDocumentType);
|
|
68
81
|
if (response != null && response.status == 200)
|
|
69
82
|
{
|
|
70
|
-
setFiles(response.data);
|
|
83
|
+
setFiles(response.data);
|
|
71
84
|
}
|
|
72
85
|
}
|
|
73
86
|
else
|
|
@@ -248,7 +261,7 @@ export const DocumentManager = ({loadedUser, setIsLoading, viewDocumentType = 1,
|
|
|
248
261
|
|
|
249
262
|
|
|
250
263
|
<FileUploader refOveride={fileUploaderRef} url={"/Document/UploadFile"} params={{
|
|
251
|
-
parentFolderId: (folderParent != null ? folderParent.id :
|
|
264
|
+
parentFolderId: (folderParent != null ? folderParent.id : ""),
|
|
252
265
|
viewDocumentType: viewDocumentType
|
|
253
266
|
|
|
254
267
|
}} multiple={true} variant='custom' onUploadCompleted={() => {
|
|
@@ -309,10 +322,10 @@ export const DocumentManager = ({loadedUser, setIsLoading, viewDocumentType = 1,
|
|
|
309
322
|
<Paper
|
|
310
323
|
sx={{
|
|
311
324
|
padding: 2,
|
|
312
|
-
display: 'flex',
|
|
313
325
|
flexDirection: 'column',
|
|
314
|
-
alignItems:
|
|
326
|
+
height: "100%", display: "flex", alignItems: "center",
|
|
315
327
|
cursor: 'pointer',
|
|
328
|
+
maxHeight:300,
|
|
316
329
|
position:"relative",
|
|
317
330
|
'&:hover': {
|
|
318
331
|
backgroundColor: '#F5F5F5'
|
|
@@ -339,7 +352,7 @@ export const DocumentManager = ({loadedUser, setIsLoading, viewDocumentType = 1,
|
|
|
339
352
|
file.documentFileExtentionType == 0 || apiDownloadEnforced ? <InsertDriveFileOutlinedIcon sx={{ fontSize: 60 }} /> : <NextImage src={file.uri} alt={"Image"} width={80} height={80} />
|
|
340
353
|
|
|
341
354
|
)}
|
|
342
|
-
<Typography variant="subtitle1" sx={{paddingTop:1}}>{file.name}</Typography>
|
|
355
|
+
<Typography variant="subtitle1" sx={{paddingTop:1, fontSize:14}}>{file.name}</Typography>
|
|
343
356
|
<Typography variant="subtitle2" sx={{paddingTop:0, fontSize:11}}>{file.lastUpdated}</Typography>
|
|
344
357
|
</Paper>
|
|
345
358
|
</Grid>
|