authscape 1.0.282 → 1.0.284
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 +9 -6
- package/package.json +1 -1
- package/src/components/DocumentManager.js +76 -96
package/index.js
CHANGED
|
@@ -422,6 +422,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
422
422
|
exports.DocumentManager = void 0;
|
|
423
423
|
var _material = require("@mui/material");
|
|
424
424
|
var _react = _interopRequireWildcard(require("react"));
|
|
425
|
+
var _AddRounded = _interopRequireDefault(require("@mui/icons-material/AddRounded"));
|
|
425
426
|
var _DeleteRounded = _interopRequireDefault(require("@mui/icons-material/DeleteRounded"));
|
|
426
427
|
var _Folder = _interopRequireDefault(require("@mui/icons-material/Folder"));
|
|
427
428
|
var _InsertDriveFile = _interopRequireDefault(require("@mui/icons-material/InsertDriveFile"));
|
|
@@ -429,6 +430,7 @@ var _styles = require("@mui/material/styles");
|
|
|
429
430
|
var _Menu = _interopRequireDefault(require("@mui/material/Menu"));
|
|
430
431
|
var _MenuItem = _interopRequireDefault(require("@mui/material/MenuItem"));
|
|
431
432
|
var _Divider = _interopRequireDefault(require("@mui/material/Divider"));
|
|
433
|
+
var _KeyboardArrowDown = _interopRequireDefault(require("@mui/icons-material/KeyboardArrowDown"));
|
|
432
434
|
var _InsertDriveFileOutlined = _interopRequireDefault(require("@mui/icons-material/InsertDriveFileOutlined"));
|
|
433
435
|
var _Breadcrumbs = _interopRequireDefault(require("@mui/material/Breadcrumbs"));
|
|
434
436
|
var _Link = _interopRequireDefault(require("@mui/material/Link"));
|
|
@@ -456,8 +458,7 @@ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructur
|
|
|
456
458
|
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); }
|
|
457
459
|
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; }
|
|
458
460
|
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; } }
|
|
459
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
460
|
-
// import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
|
|
461
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
461
462
|
// remove before merging back
|
|
462
463
|
// import { FileUploader, apiService, NextImage } from 'authscape';
|
|
463
464
|
|
|
@@ -480,6 +481,8 @@ var DocumentManager = function DocumentManager(_ref) {
|
|
|
480
481
|
lg = _ref$lg === void 0 ? 2 : _ref$lg,
|
|
481
482
|
_ref$overrideLockMess = _ref.overrideLockMessage,
|
|
482
483
|
overrideLockMessage = _ref$overrideLockMess === void 0 ? "The directory cannot be removed." : _ref$overrideLockMess,
|
|
484
|
+
_ref$zeroStateView = _ref.zeroStateView,
|
|
485
|
+
zeroStateView = _ref$zeroStateView === void 0 ? null : _ref$zeroStateView,
|
|
483
486
|
_ref$fieldId = _ref.fieldId1,
|
|
484
487
|
fieldId1 = _ref$fieldId === void 0 ? null : _ref$fieldId,
|
|
485
488
|
_ref$fieldId2 = _ref.fieldId2,
|
|
@@ -742,7 +745,7 @@ var DocumentManager = function DocumentManager(_ref) {
|
|
|
742
745
|
sx: {
|
|
743
746
|
flexGrow: 1
|
|
744
747
|
}
|
|
745
|
-
}, /*#__PURE__*/_react["default"].createElement(_material.AppBar, {
|
|
748
|
+
}, (files != null && files.documentSegments.length == 0 || folderParent != null) && /*#__PURE__*/_react["default"].createElement(_material.AppBar, {
|
|
746
749
|
position: "static",
|
|
747
750
|
color: "inherit",
|
|
748
751
|
elevation: 0
|
|
@@ -925,8 +928,8 @@ var DocumentManager = function DocumentManager(_ref) {
|
|
|
925
928
|
fontSize: 11
|
|
926
929
|
}
|
|
927
930
|
}, file.lastUpdated)));
|
|
928
|
-
})));
|
|
929
|
-
}), (files.documentSegments.length == 0 || folderParent != null) && /*#__PURE__*/_react["default"].createElement(_material.Grid, {
|
|
931
|
+
})), files != null && files.documentAndFiles != null && zeroStateView != null && /*#__PURE__*/_react["default"].createElement(_material.Box, null, zeroStateView(segment)));
|
|
932
|
+
}), (files.documentSegments.length == 0 || folderParent != null) && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_material.Grid, {
|
|
930
933
|
container: true,
|
|
931
934
|
spacing: 2
|
|
932
935
|
}, files.documentAndFiles.map(function (file, index) {
|
|
@@ -999,7 +1002,7 @@ var DocumentManager = function DocumentManager(_ref) {
|
|
|
999
1002
|
fontSize: 11
|
|
1000
1003
|
}
|
|
1001
1004
|
}, file.lastUpdated)));
|
|
1002
|
-
}))), /*#__PURE__*/_react["default"].createElement(_Menu["default"], {
|
|
1005
|
+
})), files != null && files.documentAndFiles != null && zeroStateView != null && /*#__PURE__*/_react["default"].createElement(_material.Box, null, zeroStateView()))), /*#__PURE__*/_react["default"].createElement(_Menu["default"], {
|
|
1003
1006
|
open: contextMenu !== null,
|
|
1004
1007
|
onClose: handleClose,
|
|
1005
1008
|
anchorReference: "anchorPosition",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AppBar, Box, Button, Toolbar, Typography, Grid, Paper } from '@mui/material';
|
|
2
2
|
import React, {useEffect, useState, useRef} from 'react';
|
|
3
|
-
|
|
3
|
+
import AddRoundedIcon from '@mui/icons-material/AddRounded';
|
|
4
4
|
import DeleteRoundedIcon from '@mui/icons-material/DeleteRounded';
|
|
5
5
|
import FolderIcon from '@mui/icons-material/Folder';
|
|
6
6
|
import InsertDriveFileIcon from '@mui/icons-material/InsertDriveFile';
|
|
@@ -8,7 +8,7 @@ import { styled, alpha } from '@mui/material/styles';
|
|
|
8
8
|
import Menu from '@mui/material/Menu';
|
|
9
9
|
import MenuItem from '@mui/material/MenuItem';
|
|
10
10
|
import Divider from '@mui/material/Divider';
|
|
11
|
-
|
|
11
|
+
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
|
|
12
12
|
import InsertDriveFileOutlinedIcon from '@mui/icons-material/InsertDriveFileOutlined';
|
|
13
13
|
import Breadcrumbs from '@mui/material/Breadcrumbs';
|
|
14
14
|
import Link from '@mui/material/Link';
|
|
@@ -24,7 +24,7 @@ import Tooltip from '@mui/material/Tooltip';
|
|
|
24
24
|
// remove before merging back
|
|
25
25
|
// import { FileUploader, apiService, NextImage } from 'authscape';
|
|
26
26
|
|
|
27
|
-
export const DocumentManager = ({loadedUser, setIsLoading, viewDocumentType = 1, disablePreview = false, openToFolderId = null, xs=12, sm=6, md=4, lg=2, overrideLockMessage = "The directory cannot be removed.", fieldId1 = null, fieldId2 = null, fieldId3 = null}) => {
|
|
27
|
+
export const DocumentManager = ({loadedUser, setIsLoading, viewDocumentType = 1, disablePreview = false, openToFolderId = null, xs=12, sm=6, md=4, lg=2, overrideLockMessage = "The directory cannot be removed.", zeroStateView = null, fieldId1 = null, fieldId2 = null, fieldId3 = null}) => {
|
|
28
28
|
|
|
29
29
|
const fileUploaderRef = useRef();
|
|
30
30
|
const [files, setFiles] = useState(null);
|
|
@@ -238,8 +238,12 @@ export const DocumentManager = ({loadedUser, setIsLoading, viewDocumentType = 1,
|
|
|
238
238
|
return (
|
|
239
239
|
<>
|
|
240
240
|
<Box sx={{ flexGrow: 1 }}>
|
|
241
|
+
|
|
242
|
+
{(files != null && files.documentSegments.length == 0 || folderParent != null) &&
|
|
241
243
|
<AppBar position="static" color='inherit' elevation={0}>
|
|
242
244
|
<Toolbar>
|
|
245
|
+
|
|
246
|
+
|
|
243
247
|
<Box>
|
|
244
248
|
<Button
|
|
245
249
|
id="demo-customized-button"
|
|
@@ -272,55 +276,7 @@ export const DocumentManager = ({loadedUser, setIsLoading, viewDocumentType = 1,
|
|
|
272
276
|
New Folder
|
|
273
277
|
</Button>
|
|
274
278
|
</Box>
|
|
275
|
-
|
|
276
|
-
<Button
|
|
277
|
-
id="demo-customized-button"
|
|
278
|
-
aria-controls={open ? 'demo-customized-menu' : undefined}
|
|
279
|
-
aria-haspopup="true"
|
|
280
|
-
aria-expanded={open ? 'true' : undefined}
|
|
281
|
-
variant="contained"
|
|
282
|
-
disableElevation
|
|
283
|
-
onClick={handleClick}
|
|
284
|
-
startIcon={<AddRoundedIcon />}
|
|
285
|
-
endIcon={<KeyboardArrowDownIcon />}
|
|
286
|
-
>
|
|
287
|
-
New
|
|
288
|
-
</Button>
|
|
289
|
-
<StyledMenu
|
|
290
|
-
id="demo-customized-menu"
|
|
291
|
-
MenuListProps={{
|
|
292
|
-
'aria-labelledby': 'demo-customized-button',
|
|
293
|
-
}}
|
|
294
|
-
anchorEl={anchorEl}
|
|
295
|
-
open={open}
|
|
296
|
-
onClose={handleClose}
|
|
297
|
-
>
|
|
298
|
-
<MenuItem onClick={async () => {
|
|
299
|
-
|
|
300
|
-
let newDocumentName = prompt("New folder name");
|
|
301
|
-
if (newDocumentName != null && newDocumentName != "")
|
|
302
|
-
{
|
|
303
|
-
let response = await apiService().post("/Document/CreateFolder", {
|
|
304
|
-
folderName: newDocumentName,
|
|
305
|
-
parentFolderId: folderParent != null ? folderParent.id : null,
|
|
306
|
-
viewDocumentType: viewDocumentType
|
|
307
|
-
});
|
|
308
|
-
|
|
309
|
-
if (response != null && response.status == 200)
|
|
310
|
-
{
|
|
311
|
-
// refresh
|
|
312
|
-
setUpdate(!update);
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
handleClose();
|
|
318
|
-
}} disableRipple>
|
|
319
|
-
<InsertDriveFileIcon />
|
|
320
|
-
New Folder
|
|
321
|
-
</MenuItem>
|
|
322
|
-
</StyledMenu>
|
|
323
|
-
</Box> */}
|
|
279
|
+
|
|
324
280
|
|
|
325
281
|
{(files != null && files.documentSegments.length == 0 || folderParent != null) &&
|
|
326
282
|
<FileUploader refOveride={fileUploaderRef} url={"/Document/UploadFile"} params={{
|
|
@@ -349,6 +305,7 @@ export const DocumentManager = ({loadedUser, setIsLoading, viewDocumentType = 1,
|
|
|
349
305
|
}
|
|
350
306
|
</Toolbar>
|
|
351
307
|
</AppBar>
|
|
308
|
+
}
|
|
352
309
|
|
|
353
310
|
<Divider />
|
|
354
311
|
|
|
@@ -440,62 +397,85 @@ export const DocumentManager = ({loadedUser, setIsLoading, viewDocumentType = 1,
|
|
|
440
397
|
))}
|
|
441
398
|
</Grid>
|
|
442
399
|
|
|
400
|
+
|
|
401
|
+
{(files != null && files.documentAndFiles != null && zeroStateView != null) &&
|
|
402
|
+
|
|
403
|
+
<Box>
|
|
404
|
+
{zeroStateView(segment)}
|
|
405
|
+
</Box>
|
|
406
|
+
}
|
|
407
|
+
|
|
443
408
|
</Box>
|
|
444
409
|
|
|
445
410
|
))}
|
|
446
411
|
|
|
447
412
|
|
|
448
413
|
{(files.documentSegments.length == 0 || folderParent != null) &&
|
|
449
|
-
|
|
450
|
-
|
|
414
|
+
<>
|
|
415
|
+
<Grid container spacing={2}>
|
|
416
|
+
{files.documentAndFiles.map((file, index) => (
|
|
417
|
+
|
|
418
|
+
<Grid onContextMenu={(event) => {
|
|
419
|
+
handleContextMenu(event, file);
|
|
420
|
+
}} item key={index} xs={xs} sm={sm} md={md} lg={lg} onClick={() => handleFileClick(file)}>
|
|
421
|
+
<Paper
|
|
422
|
+
sx={{
|
|
423
|
+
padding: 2,
|
|
424
|
+
flexDirection: 'column',
|
|
425
|
+
height: "100%", display: "flex", alignItems: "center",
|
|
426
|
+
cursor: 'pointer',
|
|
427
|
+
maxHeight:300,
|
|
428
|
+
position:"relative",
|
|
429
|
+
'&:hover': {
|
|
430
|
+
backgroundColor: '#F5F5F5'
|
|
431
|
+
}
|
|
432
|
+
}}>
|
|
433
|
+
|
|
434
|
+
{file.type === 'folder' &&
|
|
435
|
+
<Box sx={{position:"absolute", top:45, color:"white"}}>
|
|
436
|
+
{file.count}
|
|
437
|
+
</Box>}
|
|
438
|
+
|
|
439
|
+
{file.isLocked &&
|
|
440
|
+
<Box sx={{position:"absolute", top:10, right: 10, color:"black"}}>
|
|
441
|
+
<Tooltip title={overrideLockMessage}>
|
|
442
|
+
<LockRoundedIcon />
|
|
443
|
+
</Tooltip>
|
|
444
|
+
</Box>
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
{file.type === 'folder' ? (
|
|
448
|
+
<FolderIcon sx={{ fontSize: 80, color:"orange" }} />
|
|
449
|
+
) : (
|
|
450
|
+
|
|
451
|
+
file.documentFileExtentionType == 0 || disablePreview ? <InsertDriveFileOutlinedIcon sx={{ fontSize: 60 }} /> : <NextImage src={file.uri} alt={"Image"} width={80} height={80} />
|
|
452
|
+
|
|
453
|
+
)}
|
|
454
|
+
<Typography variant="subtitle1" sx={{paddingTop:1, fontSize:14}}>{file.name}</Typography>
|
|
455
|
+
<Typography variant="subtitle2" sx={{paddingTop:0, fontSize:11}}>{file.lastUpdated}</Typography>
|
|
456
|
+
</Paper>
|
|
457
|
+
</Grid>
|
|
458
|
+
|
|
459
|
+
))}
|
|
460
|
+
</Grid>
|
|
461
|
+
|
|
462
|
+
{(files != null && files.documentAndFiles != null && zeroStateView != null) &&
|
|
451
463
|
|
|
452
|
-
<
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
sx={{
|
|
457
|
-
padding: 2,
|
|
458
|
-
flexDirection: 'column',
|
|
459
|
-
height: "100%", display: "flex", alignItems: "center",
|
|
460
|
-
cursor: 'pointer',
|
|
461
|
-
maxHeight:300,
|
|
462
|
-
position:"relative",
|
|
463
|
-
'&:hover': {
|
|
464
|
-
backgroundColor: '#F5F5F5'
|
|
465
|
-
}
|
|
466
|
-
}}>
|
|
467
|
-
|
|
468
|
-
{file.type === 'folder' &&
|
|
469
|
-
<Box sx={{position:"absolute", top:45, color:"white"}}>
|
|
470
|
-
{file.count}
|
|
471
|
-
</Box>}
|
|
472
|
-
|
|
473
|
-
{file.isLocked &&
|
|
474
|
-
<Box sx={{position:"absolute", top:10, right: 10, color:"black"}}>
|
|
475
|
-
<Tooltip title={overrideLockMessage}>
|
|
476
|
-
<LockRoundedIcon />
|
|
477
|
-
</Tooltip>
|
|
478
|
-
</Box>
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
{file.type === 'folder' ? (
|
|
482
|
-
<FolderIcon sx={{ fontSize: 80, color:"orange" }} />
|
|
483
|
-
) : (
|
|
484
|
-
|
|
485
|
-
file.documentFileExtentionType == 0 || disablePreview ? <InsertDriveFileOutlinedIcon sx={{ fontSize: 60 }} /> : <NextImage src={file.uri} alt={"Image"} width={80} height={80} />
|
|
486
|
-
|
|
487
|
-
)}
|
|
488
|
-
<Typography variant="subtitle1" sx={{paddingTop:1, fontSize:14}}>{file.name}</Typography>
|
|
489
|
-
<Typography variant="subtitle2" sx={{paddingTop:0, fontSize:11}}>{file.lastUpdated}</Typography>
|
|
490
|
-
</Paper>
|
|
491
|
-
</Grid>
|
|
464
|
+
<Box>
|
|
465
|
+
{zeroStateView()}
|
|
466
|
+
</Box>
|
|
467
|
+
}
|
|
492
468
|
|
|
493
|
-
|
|
494
|
-
</Grid>
|
|
469
|
+
</>
|
|
495
470
|
}
|
|
496
471
|
|
|
497
472
|
</>
|
|
498
473
|
}
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
|
|
499
479
|
<Menu
|
|
500
480
|
open={contextMenu !== null}
|
|
501
481
|
onClose={handleClose}
|