authscape 1.0.250 → 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 +31 -15
- package/package.json +1 -1
- package/src/components/DocumentManager.js +21 -8
package/index.js
CHANGED
|
@@ -449,6 +449,9 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
449
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
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
451
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
452
|
+
// remove before merging back
|
|
453
|
+
// import { FileUploader, apiService, NextImage } from 'authscape';
|
|
454
|
+
|
|
452
455
|
var DocumentManager = function DocumentManager(_ref) {
|
|
453
456
|
var loadedUser = _ref.loadedUser,
|
|
454
457
|
setIsLoading = _ref.setIsLoading,
|
|
@@ -456,6 +459,8 @@ var DocumentManager = function DocumentManager(_ref) {
|
|
|
456
459
|
viewDocumentType = _ref$viewDocumentType === void 0 ? 1 : _ref$viewDocumentType,
|
|
457
460
|
_ref$apiDownloadEnfor = _ref.apiDownloadEnforced,
|
|
458
461
|
apiDownloadEnforced = _ref$apiDownloadEnfor === void 0 ? false : _ref$apiDownloadEnfor,
|
|
462
|
+
_ref$openToFolderId = _ref.openToFolderId,
|
|
463
|
+
openToFolderId = _ref$openToFolderId === void 0 ? null : _ref$openToFolderId,
|
|
459
464
|
_ref$overrideLockMess = _ref.overrideLockMessage,
|
|
460
465
|
overrideLockMessage = _ref$overrideLockMess === void 0 ? "The directory cannot be removed." : _ref$overrideLockMess;
|
|
461
466
|
var fileUploaderRef = (0, _react.useRef)();
|
|
@@ -505,32 +510,40 @@ var DocumentManager = function DocumentManager(_ref) {
|
|
|
505
510
|
if (loadedUser) {
|
|
506
511
|
var fetchDocuments = /*#__PURE__*/function () {
|
|
507
512
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
508
|
-
var response, _response;
|
|
513
|
+
var folderId, response, _response;
|
|
509
514
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
510
515
|
while (1) switch (_context.prev = _context.next) {
|
|
511
516
|
case 0:
|
|
512
|
-
|
|
513
|
-
|
|
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;
|
|
514
527
|
break;
|
|
515
528
|
}
|
|
516
|
-
_context.next =
|
|
517
|
-
return apiService().get("/Document/GetDocumentsAndFiles?parentFolderId=" +
|
|
518
|
-
case
|
|
529
|
+
_context.next = 5;
|
|
530
|
+
return apiService().get("/Document/GetDocumentsAndFiles?parentFolderId=" + folderId + "&ViewDocumentType=" + viewDocumentType);
|
|
531
|
+
case 5:
|
|
519
532
|
response = _context.sent;
|
|
520
533
|
if (response != null && response.status == 200) {
|
|
521
534
|
setFiles(response.data);
|
|
522
535
|
}
|
|
523
|
-
_context.next =
|
|
536
|
+
_context.next = 13;
|
|
524
537
|
break;
|
|
525
|
-
case 7:
|
|
526
|
-
_context.next = 9;
|
|
527
|
-
return apiService().get("/Document/GetDocumentsAndFiles?ViewDocumentType=" + viewDocumentType);
|
|
528
538
|
case 9:
|
|
539
|
+
_context.next = 11;
|
|
540
|
+
return apiService().get("/Document/GetDocumentsAndFiles?ViewDocumentType=" + viewDocumentType);
|
|
541
|
+
case 11:
|
|
529
542
|
_response = _context.sent;
|
|
530
543
|
if (_response != null && _response.status == 200) {
|
|
531
544
|
setFiles(_response.data);
|
|
532
545
|
}
|
|
533
|
-
case
|
|
546
|
+
case 13:
|
|
534
547
|
case "end":
|
|
535
548
|
return _context.stop();
|
|
536
549
|
}
|
|
@@ -732,7 +745,7 @@ var DocumentManager = function DocumentManager(_ref) {
|
|
|
732
745
|
refOveride: fileUploaderRef,
|
|
733
746
|
url: "/Document/UploadFile",
|
|
734
747
|
params: {
|
|
735
|
-
parentFolderId: folderParent != null ? folderParent.id :
|
|
748
|
+
parentFolderId: folderParent != null ? folderParent.id : "",
|
|
736
749
|
viewDocumentType: viewDocumentType
|
|
737
750
|
},
|
|
738
751
|
multiple: true,
|
|
@@ -808,10 +821,12 @@ var DocumentManager = function DocumentManager(_ref) {
|
|
|
808
821
|
}, /*#__PURE__*/_react["default"].createElement(_material.Paper, {
|
|
809
822
|
sx: {
|
|
810
823
|
padding: 2,
|
|
811
|
-
display: 'flex',
|
|
812
824
|
flexDirection: 'column',
|
|
813
|
-
|
|
825
|
+
height: "100%",
|
|
826
|
+
display: "flex",
|
|
827
|
+
alignItems: "center",
|
|
814
828
|
cursor: 'pointer',
|
|
829
|
+
maxHeight: 300,
|
|
815
830
|
position: "relative",
|
|
816
831
|
'&:hover': {
|
|
817
832
|
backgroundColor: '#F5F5F5'
|
|
@@ -849,7 +864,8 @@ var DocumentManager = function DocumentManager(_ref) {
|
|
|
849
864
|
}), /*#__PURE__*/_react["default"].createElement(_material.Typography, {
|
|
850
865
|
variant: "subtitle1",
|
|
851
866
|
sx: {
|
|
852
|
-
paddingTop: 1
|
|
867
|
+
paddingTop: 1,
|
|
868
|
+
fontSize: 14
|
|
853
869
|
}
|
|
854
870
|
}, file.name), /*#__PURE__*/_react["default"].createElement(_material.Typography, {
|
|
855
871
|
variant: "subtitle2",
|
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>
|