@zohodesk/dot 1.0.0-temp-187.2 → 1.0.0-temp-200
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/.cli/propValidation_report.html +1 -1
- package/README.md +4 -0
- package/es/Attachment/Attachment.js +2 -1
- package/es/Attachment/Attachment.module.css +7 -3
- package/es/AttachmentViewer/Attachment.js +60 -1
- package/es/AttachmentViewer/AttachmentViewer.js +146 -12
- package/es/AttachmentViewer/AttachmentViewer.module.css +124 -4
- package/es/DotProvider/__tests__/DotProvider.spec.js +174 -0
- package/es/DotProvider/__tests__/__snapshots__/DotProvider.spec.js.snap +478 -0
- package/es/common/dot_common.module.css +35 -0
- package/es/form/fields/TagsMultiSelect/TagsMultiSelect.js +2 -4
- package/es/list/DepartmentDropDown/DepartmentDropDown.js +2 -7
- package/es/list/DepartmentDropDown/props/defaultProps.js +1 -2
- package/es/list/DepartmentDropDown/props/propTypes.js +1 -2
- package/es/list/status/StatusListItem/StatusListItem.module.css +5 -35
- package/es/lookup/header/Search/LookupSearch.module.css +33 -27
- package/es/lookup/header/Search/Search.js +58 -40
- package/es/lookup/header/Search/__tests__/Search.spec.js +67 -1
- package/es/lookup/header/Search/__tests__/__snapshots__/Search.spec.js.snap +316 -3
- package/es/lookup/header/Search/props/defaultProps.js +3 -1
- package/es/lookup/header/Search/props/propTypes.js +6 -1
- package/lib/Attachment/Attachment.js +3 -1
- package/lib/Attachment/Attachment.module.css +7 -3
- package/lib/AttachmentViewer/Attachment.js +88 -1
- package/lib/AttachmentViewer/AttachmentViewer.js +147 -13
- package/lib/AttachmentViewer/AttachmentViewer.module.css +124 -4
- package/lib/DotProvider/__tests__/DotProvider.spec.js +441 -0
- package/lib/DotProvider/__tests__/__snapshots__/DotProvider.spec.js.snap +478 -0
- package/lib/common/dot_common.module.css +35 -0
- package/lib/form/fields/TagsMultiSelect/TagsMultiSelect.js +3 -5
- package/lib/list/DepartmentDropDown/DepartmentDropDown.js +3 -8
- package/lib/list/DepartmentDropDown/props/defaultProps.js +1 -2
- package/lib/list/DepartmentDropDown/props/propTypes.js +1 -1
- package/lib/list/status/StatusListItem/StatusListItem.module.css +5 -35
- package/lib/lookup/header/Search/LookupSearch.module.css +33 -27
- package/lib/lookup/header/Search/Search.js +76 -66
- package/lib/lookup/header/Search/__tests__/Search.spec.js +65 -0
- package/lib/lookup/header/Search/__tests__/__snapshots__/Search.spec.js.snap +316 -3
- package/lib/lookup/header/Search/props/defaultProps.js +3 -1
- package/lib/lookup/header/Search/props/propTypes.js +6 -1
- package/package.json +8 -8
- package/result.json +1 -1
- package/unittest/index.html +2 -6
- /package/images/{audio_thumbnail.png → audio_thumbnail_old.png} +0 -0
package/README.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
In this Library, we Provide Some Basic Components to Build Your Application
|
|
4
4
|
|
|
5
|
+
# 1.7.2
|
|
6
|
+
|
|
7
|
+
- **Lookup - Search** - renderChildren, isActive, hasSeparator & customStyle props supported & Some customization also opened for this compoenent.
|
|
8
|
+
|
|
5
9
|
# 1.7.1
|
|
6
10
|
|
|
7
11
|
- **Drawer** - The customDrawerClass prop is now supported to customize the drawer size.
|
|
@@ -14,15 +14,15 @@
|
|
|
14
14
|
height: 100% ;
|
|
15
15
|
width: 100% ;
|
|
16
16
|
position: absolute;
|
|
17
|
-
top:0
|
|
17
|
+
top: 0
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
[dir=ltr] .disableLayer {
|
|
21
|
-
left:0
|
|
21
|
+
left: 0
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
[dir=rtl] .disableLayer {
|
|
25
|
-
right:0
|
|
25
|
+
right: 0
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
.attachmentHover {
|
|
@@ -66,6 +66,10 @@
|
|
|
66
66
|
height: var(--zd_size40) ;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
+
.attachleft {
|
|
70
|
+
padding: var(--zd_size3) ;
|
|
71
|
+
}
|
|
72
|
+
|
|
69
73
|
[dir=ltr] .attachleft {
|
|
70
74
|
border-right: 1px solid var(--zdt_attachment_default_border);
|
|
71
75
|
}
|
|
@@ -2,7 +2,55 @@ const UNASSIGNED = 'Unassigned';
|
|
|
2
2
|
const BROWSER_SUPPORTED_FILES = ['pdf', 'text', 'txt', 'css', 'jpg', 'jpeg', 'gif', 'png', 'bmp', 'ico', 'sh', 'mp3', 'wav', 'ogg'];
|
|
3
3
|
export function isAudioFile(fileName) {
|
|
4
4
|
const extension = getExtensionFromFileName(fileName);
|
|
5
|
-
return /mp3|wav|ogg/i.test(extension);
|
|
5
|
+
return /mp3|wav|ogg|oga|m4a|weba|opus|m4b|webma|aac/i.test(extension);
|
|
6
|
+
}
|
|
7
|
+
export function isVideoFile(fileName) {
|
|
8
|
+
const extension = getExtensionFromFileName(fileName);
|
|
9
|
+
return /mp4|webm|ogg/i.test(extension);
|
|
10
|
+
}
|
|
11
|
+
export function isPdfFile(fileName) {
|
|
12
|
+
const extension = getExtensionFromFileName(fileName);
|
|
13
|
+
return /pdf/i.test(extension);
|
|
14
|
+
}
|
|
15
|
+
export function isDocsFile(fileName) {
|
|
16
|
+
const extension = getExtensionFromFileName(fileName);
|
|
17
|
+
return /docx|doc|docm|rtf|odt|dot|dotm|dotx|pages/i.test(extension);
|
|
18
|
+
}
|
|
19
|
+
export function isSheetFile(fileName) {
|
|
20
|
+
const extension = getExtensionFromFileName(fileName);
|
|
21
|
+
return /xlsx|numbers/i.test(extension);
|
|
22
|
+
}
|
|
23
|
+
export function isShowFile(fileName) {
|
|
24
|
+
const extension = getExtensionFromFileName(fileName);
|
|
25
|
+
return /pptx|ppt|pps|ppsx|key/i.test(extension);
|
|
26
|
+
}
|
|
27
|
+
export function isEmailFile(fileName) {
|
|
28
|
+
const extension = getExtensionFromFileName(fileName);
|
|
29
|
+
return /eml|msg/i.test(extension);
|
|
30
|
+
}
|
|
31
|
+
export function isImageFile(fileName) {
|
|
32
|
+
const extension = getExtensionFromFileName(fileName);
|
|
33
|
+
return /jpeg|jpg|png|gif|bmp|tiff|tif|ico/i.test(extension);
|
|
34
|
+
}
|
|
35
|
+
export function docsFileTypes(fileName) {
|
|
36
|
+
const extension = getExtensionFromFileName(fileName);
|
|
37
|
+
return /docx|doc|docm|rtf|odt|dot|dotm|dotx|sxw|odt|ott|txt|pages/i.test(extension);
|
|
38
|
+
}
|
|
39
|
+
export function sheetFileTypes(fileName) {
|
|
40
|
+
const extension = getExtensionFromFileName(fileName);
|
|
41
|
+
return /xls|xlsx|sxc|ods|csv|tsv|ots|xlsm|xlsb|xlt|xltx|xltm|numbers/i.test(extension);
|
|
42
|
+
}
|
|
43
|
+
export function showFileTypes(fileName) {
|
|
44
|
+
const extension = getExtensionFromFileName(fileName);
|
|
45
|
+
return /pptx|ppt|pps|ppsx|odp|sxi|key|pot|potx/i.test(extension);
|
|
46
|
+
}
|
|
47
|
+
export function designFileTypes(fileName) {
|
|
48
|
+
const extension = getExtensionFromFileName(fileName);
|
|
49
|
+
return /sketch|xd|psd|ai|fig|svg/i.test(extension);
|
|
50
|
+
}
|
|
51
|
+
export function zipFileType(fileName) {
|
|
52
|
+
const extension = getExtensionFromFileName(fileName);
|
|
53
|
+
return /zip/i.test(extension);
|
|
6
54
|
}
|
|
7
55
|
export function getExtensionFromFileName(fileName) {
|
|
8
56
|
if (fileName && fileName.indexOf(".") !== -1) {
|
|
@@ -14,4 +62,15 @@ export function getExtensionFromFileName(fileName) {
|
|
|
14
62
|
export function isBrowserSupportedFile(fileName) {
|
|
15
63
|
const extension = getExtensionFromFileName(fileName);
|
|
16
64
|
return BROWSER_SUPPORTED_FILES.indexOf(extension) !== -1;
|
|
65
|
+
}
|
|
66
|
+
export function openInNewTabWithNoopener(url) {
|
|
67
|
+
let targetnName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '_blank';
|
|
68
|
+
const aTag = document.createElement('a');
|
|
69
|
+
aTag.rel = 'noopener noreferrer';
|
|
70
|
+
aTag.target = targetnName;
|
|
71
|
+
aTag.href = url;
|
|
72
|
+
aTag.click();
|
|
73
|
+
}
|
|
74
|
+
export function openNewTab(href) {
|
|
75
|
+
openInNewTabWithNoopener(href);
|
|
17
76
|
}
|
|
@@ -10,7 +10,7 @@ import AttachmentImage from "./AttachmentImage";
|
|
|
10
10
|
import Link from "../Link/Link";
|
|
11
11
|
import IconButton from "../IconButton/IconButton";
|
|
12
12
|
import FreezeLayer from "../FreezeLayer/FreezeLayer";
|
|
13
|
-
import { isAudioFile, getExtensionFromFileName } from "./Attachment";
|
|
13
|
+
import { isAudioFile, getExtensionFromFileName, isVideoFile, isPdfFile, isDocsFile, isSheetFile, isShowFile, isEmailFile, isImageFile, openNewTab, sheetFileTypes, docsFileTypes, showFileTypes, designFileTypes, zipFileType } from "./Attachment";
|
|
14
14
|
import { shallowDiff } from "../utils/General";
|
|
15
15
|
import style from "./AttachmentViewer.module.css";
|
|
16
16
|
import { checkFileSourcesValidation } from "./utils";
|
|
@@ -310,6 +310,62 @@ export default class AttachmentViewer extends Component {
|
|
|
310
310
|
customChildrenClass = ''
|
|
311
311
|
} = customClass;
|
|
312
312
|
const retainZoom = canZoom && selectedIndex == i && maintainZoom;
|
|
313
|
+
const {
|
|
314
|
+
previewurl
|
|
315
|
+
} = data;
|
|
316
|
+
const fileTypeIconList = [{
|
|
317
|
+
check: isAudioFile(data.name),
|
|
318
|
+
name: 'ZD-EF-fileMp3',
|
|
319
|
+
size: '50'
|
|
320
|
+
}, {
|
|
321
|
+
check: isVideoFile(data.name),
|
|
322
|
+
name: 'ZD-EF-fileMp4',
|
|
323
|
+
size: '50'
|
|
324
|
+
}, {
|
|
325
|
+
check: isPdfFile(data.name),
|
|
326
|
+
name: 'ZD-EF-filePdf',
|
|
327
|
+
size: '50'
|
|
328
|
+
}, {
|
|
329
|
+
check: docsFileTypes(data.name),
|
|
330
|
+
name: 'ZD-EF-fileWord',
|
|
331
|
+
size: '50'
|
|
332
|
+
}, {
|
|
333
|
+
check: sheetFileTypes(data.name),
|
|
334
|
+
name: 'ZD-EF-fileExcel',
|
|
335
|
+
size: '50'
|
|
336
|
+
}, {
|
|
337
|
+
check: showFileTypes(data.name),
|
|
338
|
+
name: 'ZD-SE-ppt',
|
|
339
|
+
size: '50'
|
|
340
|
+
}, {
|
|
341
|
+
check: designFileTypes(data.name),
|
|
342
|
+
name: 'ZD-EF-file',
|
|
343
|
+
size: '50'
|
|
344
|
+
}, {
|
|
345
|
+
check: isEmailFile(data.name),
|
|
346
|
+
name: 'ZD-CH-mail',
|
|
347
|
+
size: '50'
|
|
348
|
+
}, {
|
|
349
|
+
check: zipFileType(data.name),
|
|
350
|
+
name: 'ZD-EF-fileZip',
|
|
351
|
+
size: '50'
|
|
352
|
+
}];
|
|
353
|
+
|
|
354
|
+
const PreviewFileIcon = _ref3 => {
|
|
355
|
+
let {
|
|
356
|
+
data
|
|
357
|
+
} = _ref3;
|
|
358
|
+
const matchedIcon = fileTypeIconList.find(item => item.check);
|
|
359
|
+
const iconName = matchedIcon ? matchedIcon.name : 'ZD-EF-file';
|
|
360
|
+
const iconSize = matchedIcon ? matchedIcon.size : '50';
|
|
361
|
+
return /*#__PURE__*/React.createElement(Icon, {
|
|
362
|
+
iconClass: style.prevIcon,
|
|
363
|
+
name: iconName,
|
|
364
|
+
size: iconSize
|
|
365
|
+
});
|
|
366
|
+
};
|
|
367
|
+
|
|
368
|
+
console.log("...previewUrl", previewurl, "...data", data);
|
|
313
369
|
return /*#__PURE__*/React.createElement(Container, {
|
|
314
370
|
className: style.imgBox,
|
|
315
371
|
id: `imgBox${i}`,
|
|
@@ -328,12 +384,27 @@ export default class AttachmentViewer extends Component {
|
|
|
328
384
|
"data-test-id": `${dataId}_videoPreview`,
|
|
329
385
|
...audioProps
|
|
330
386
|
}, /*#__PURE__*/React.createElement("source", {
|
|
331
|
-
src:
|
|
387
|
+
src: previewurl,
|
|
332
388
|
type: `audio/${getExtensionFromFileName(name)}`
|
|
333
|
-
})) : null : /*#__PURE__*/React.createElement(
|
|
389
|
+
})) : null : isVideoFile(data.name) ? selectedIndex == i ? /*#__PURE__*/React.createElement("video", {
|
|
390
|
+
autoPlay: true,
|
|
391
|
+
controls: true,
|
|
392
|
+
className: style.zoomIn
|
|
393
|
+
}, /*#__PURE__*/React.createElement("source", {
|
|
394
|
+
src: previewurl,
|
|
395
|
+
type: `video/${getExtensionFromFileName(data.name)}`
|
|
396
|
+
})) : null : isDocsFile(data.name) || isSheetFile(data.name) || isShowFile(data.name) ? selectedIndex == i ? (console.log("...previewurl", previewurl), /*#__PURE__*/React.createElement("iframe", {
|
|
397
|
+
src: previewurl,
|
|
398
|
+
className: style.pdfFrame
|
|
399
|
+
}) // <iframe src={previewurl+"&frameorigin=https://deskqa.localzoho.com"} className={style.pdfFrame}></iframe>
|
|
400
|
+
) : null : isPdfFile(data.name) || isEmailFile(data.name) ? selectedIndex == i ? /*#__PURE__*/React.createElement("iframe", {
|
|
401
|
+
src: previewurl,
|
|
402
|
+
className: style.pdfFrame
|
|
403
|
+
}) // <iframe src={previewurl+"&frameorigin=https://deskqa.localzoho.com"} className={style.pdfFrame}/>
|
|
404
|
+
: null : isImageFile(data.name) ? /*#__PURE__*/React.createElement(AttachmentImage, {
|
|
334
405
|
customClass: {
|
|
335
406
|
customImageClass: `${style.img} ${style.altText}
|
|
336
|
-
|
|
407
|
+
${canZoom || retainZoom ? isZoomed ? `${style.zoomedImg} ${style.zoomOutCursor}` : `${style.normalImg} ${style.zoomInCursor}` : ''} ${customImageClass}`,
|
|
337
408
|
customChildrenClass
|
|
338
409
|
},
|
|
339
410
|
src: viewUrl,
|
|
@@ -345,7 +416,17 @@ export default class AttachmentViewer extends Component {
|
|
|
345
416
|
id: `img${i}`,
|
|
346
417
|
isCover: false,
|
|
347
418
|
...imageProps
|
|
348
|
-
}, children)
|
|
419
|
+
}, children) : /*#__PURE__*/React.createElement("div", {
|
|
420
|
+
className: style.previewNone
|
|
421
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
422
|
+
className: style.fileTypeImg
|
|
423
|
+
}, /*#__PURE__*/React.createElement(PreviewFileIcon, {
|
|
424
|
+
data: data.name
|
|
425
|
+
})), "Preview not available for the selected file type.", /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(Link, {
|
|
426
|
+
href: data.href,
|
|
427
|
+
className: style.downloadLink,
|
|
428
|
+
onClick: () => openNewTab(data.href)
|
|
429
|
+
}, "Download"))));
|
|
349
430
|
});
|
|
350
431
|
}
|
|
351
432
|
|
|
@@ -388,10 +469,10 @@ export default class AttachmentViewer extends Component {
|
|
|
388
469
|
}, /*#__PURE__*/React.createElement(ResponsiveReceiver, {
|
|
389
470
|
responsiveId: responsiveId,
|
|
390
471
|
query: this.responsiveFunc
|
|
391
|
-
},
|
|
472
|
+
}, _ref4 => {
|
|
392
473
|
let {
|
|
393
474
|
uptoTablet
|
|
394
|
-
} =
|
|
475
|
+
} = _ref4;
|
|
395
476
|
return /*#__PURE__*/React.createElement(Container, {
|
|
396
477
|
scroll: "none",
|
|
397
478
|
"data-scroll-palette": "dark"
|
|
@@ -580,17 +661,68 @@ export default class AttachmentViewer extends Component {
|
|
|
580
661
|
const {
|
|
581
662
|
customImageClass = '',
|
|
582
663
|
customChildrenClass = ''
|
|
583
|
-
} = customClass;
|
|
584
|
-
|
|
664
|
+
} = customClass; // thumbnail= isAudioFile(name) ? thumbnail || audioThumbNail : thumbnail //fallback thumbnail for audio
|
|
665
|
+
|
|
666
|
+
const fileTypeIconList = [{
|
|
667
|
+
check: isAudioFile(name),
|
|
668
|
+
name: thumbnail || 'ZD-EF-fileMp3',
|
|
669
|
+
size: '30'
|
|
670
|
+
}, {
|
|
671
|
+
check: isVideoFile(name),
|
|
672
|
+
name: 'ZD-EF-fileMp4',
|
|
673
|
+
size: '30'
|
|
674
|
+
}, {
|
|
675
|
+
check: isPdfFile(name),
|
|
676
|
+
name: 'ZD-EF-filePdf',
|
|
677
|
+
size: '30'
|
|
678
|
+
}, {
|
|
679
|
+
check: docsFileTypes(name),
|
|
680
|
+
name: 'ZD-EF-fileWord',
|
|
681
|
+
size: '30'
|
|
682
|
+
}, {
|
|
683
|
+
check: sheetFileTypes(name),
|
|
684
|
+
name: 'ZD-EF-fileExcel',
|
|
685
|
+
size: '30'
|
|
686
|
+
}, {
|
|
687
|
+
check: showFileTypes(name),
|
|
688
|
+
name: 'ZD-SE-ppt',
|
|
689
|
+
size: '30'
|
|
690
|
+
}, {
|
|
691
|
+
check: designFileTypes(name),
|
|
692
|
+
name: 'ZD-EF-file',
|
|
693
|
+
size: '30'
|
|
694
|
+
}, {
|
|
695
|
+
check: isEmailFile(name),
|
|
696
|
+
name: 'ZD-CH-mail',
|
|
697
|
+
size: '30'
|
|
698
|
+
}, {
|
|
699
|
+
check: zipFileType(name),
|
|
700
|
+
name: 'ZD-EF-fileZip',
|
|
701
|
+
size: '30'
|
|
702
|
+
}];
|
|
703
|
+
|
|
704
|
+
const PreviewFileIcon = _ref5 => {
|
|
705
|
+
let {
|
|
706
|
+
data
|
|
707
|
+
} = _ref5;
|
|
708
|
+
const matchedIcon = fileTypeIconList.find(item => item.check);
|
|
709
|
+
const iconName = matchedIcon ? matchedIcon.name : 'ZD-EF-file';
|
|
710
|
+
const iconSize = matchedIcon ? matchedIcon.size : '30';
|
|
711
|
+
return /*#__PURE__*/React.createElement(Icon, {
|
|
712
|
+
iconClass: style.prevFooterIcon,
|
|
713
|
+
name: iconName,
|
|
714
|
+
size: iconSize
|
|
715
|
+
});
|
|
716
|
+
};
|
|
585
717
|
|
|
586
718
|
return /*#__PURE__*/React.createElement(Box, {
|
|
587
|
-
className: `${style.imgItem} ${index === selectedIndex ? style.selected : ''}`,
|
|
719
|
+
className: `${style.imgItem} ${index === selectedIndex ? style.selected : ''} ${isImageFile(name) || thumbnail ? '' : style.previewIconDiv}`,
|
|
588
720
|
key: index,
|
|
589
721
|
onClick: this.changeSelectedIndex.bind(this, index),
|
|
590
722
|
eleRef: el => this[`img_${index}`] = el,
|
|
591
723
|
dataId: "attachPreviewList",
|
|
592
724
|
"data-title": name
|
|
593
|
-
}, /*#__PURE__*/React.createElement(AttachmentImage, {
|
|
725
|
+
}, isImageFile(name) || thumbnail ? /*#__PURE__*/React.createElement(AttachmentImage, {
|
|
594
726
|
src: thumbnail || viewUrl,
|
|
595
727
|
size: "small",
|
|
596
728
|
alt: name,
|
|
@@ -600,7 +732,9 @@ export default class AttachmentViewer extends Component {
|
|
|
600
732
|
},
|
|
601
733
|
dataId: dataId,
|
|
602
734
|
...customProps
|
|
603
|
-
}, children)
|
|
735
|
+
}, children) : /*#__PURE__*/React.createElement(PreviewFileIcon, {
|
|
736
|
+
data: name
|
|
737
|
+
}));
|
|
604
738
|
}))))), totalLen !== 1 && /*#__PURE__*/React.createElement(IconButton, {
|
|
605
739
|
dataId: "attachToggle",
|
|
606
740
|
onClick: this.togglePViewList,
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
font-size: var(--zd_font_size22) ;
|
|
80
80
|
height: var(--zd_size38) ;
|
|
81
81
|
width: var(--zd_size38) ;
|
|
82
|
-
line-height:
|
|
82
|
+
line-height: 36px;
|
|
83
83
|
border-radius: 50%;
|
|
84
84
|
cursor: pointer;
|
|
85
85
|
}
|
|
@@ -154,6 +154,7 @@
|
|
|
154
154
|
.imgItem {
|
|
155
155
|
height: var(--zd_size60) ;
|
|
156
156
|
min-width: var(--zd_size40) ;
|
|
157
|
+
/* css:theme-validation:ignore */
|
|
157
158
|
position: relative;
|
|
158
159
|
transition: border var(--zd_transition3);
|
|
159
160
|
border-width: 2px;
|
|
@@ -168,6 +169,10 @@
|
|
|
168
169
|
border-color: var(--zdt_attachmentviewer_hover_border);
|
|
169
170
|
}
|
|
170
171
|
|
|
172
|
+
.imgItem+.imgItem {
|
|
173
|
+
/* margin-left: 6px; */
|
|
174
|
+
}
|
|
175
|
+
|
|
171
176
|
[dir=ltr] .imgItem+.imgItem {
|
|
172
177
|
margin-left: var(--zd_size12) ;
|
|
173
178
|
}
|
|
@@ -230,16 +235,71 @@
|
|
|
230
235
|
transform: rotateX(0deg);
|
|
231
236
|
}
|
|
232
237
|
|
|
238
|
+
.isAudio,
|
|
239
|
+
.isVideo,
|
|
240
|
+
.isPdf,
|
|
241
|
+
.isMail,
|
|
242
|
+
.isWriter,
|
|
243
|
+
.isSheet,
|
|
244
|
+
.isShow,
|
|
245
|
+
.otherFile {
|
|
246
|
+
width: var(--zd_size60) ;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
.isAudio, .isVideo, .isPdf, .isMail, .isWriter, .isSheet, .isShow, .otherFile {
|
|
250
|
+
background-size: 100% 100%;
|
|
251
|
+
}
|
|
252
|
+
|
|
233
253
|
.isAudio {
|
|
234
254
|
composes: audioImage from '../common/dot_common.module.css';
|
|
235
|
-
width: var(--zd_size100) ;
|
|
236
|
-
background-size: 100% 100%;
|
|
237
255
|
}
|
|
238
256
|
|
|
239
|
-
.
|
|
257
|
+
.isVideo {
|
|
258
|
+
composes: videoImage from '../common/dot_common.module.css';
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
.isPdf {
|
|
262
|
+
composes: pdfImage from '../common/dot_common.module.css';
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
.isWriter {
|
|
266
|
+
composes: writerImage from '../common/dot_common.module.css';
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
.isSheet {
|
|
270
|
+
composes: sheetImage from '../common/dot_common.module.css';
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
.isShow {
|
|
274
|
+
composes: showImage from '../common/dot_common.module.css';
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
.isMail {
|
|
279
|
+
composes: mailImage from '../common/dot_common.module.css';
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
.otherFile {
|
|
283
|
+
composes: otherImage from '../common/dot_common.module.css';
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
.isAudio .image,
|
|
287
|
+
.isVideo .image,
|
|
288
|
+
.isPdf .image,
|
|
289
|
+
.isWriter .image,
|
|
290
|
+
.isSheet .image,
|
|
291
|
+
.isShow .image,
|
|
292
|
+
.isMail .image,
|
|
293
|
+
.otherFile .image {
|
|
240
294
|
opacity: 0;
|
|
241
295
|
}
|
|
242
296
|
|
|
297
|
+
.pdfFrame {
|
|
298
|
+
height: 100% ;
|
|
299
|
+
width: 100% ;
|
|
300
|
+
border: 0;
|
|
301
|
+
}
|
|
302
|
+
|
|
243
303
|
.video {
|
|
244
304
|
position: absolute;
|
|
245
305
|
top: 0 ;
|
|
@@ -357,9 +417,69 @@
|
|
|
357
417
|
}
|
|
358
418
|
|
|
359
419
|
.btn {
|
|
420
|
+
/* css:theme-validation:ignore */
|
|
360
421
|
height: 100% ;
|
|
361
422
|
width: 100% ;
|
|
362
423
|
background-color: var(--dot_mirror);
|
|
363
424
|
border: 0;
|
|
364
425
|
cursor: pointer;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
.fileTypeImg {
|
|
429
|
+
margin: 0 auto var(--zd_size20) ;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
.previewNone {
|
|
433
|
+
/* css:theme-validation:ignore */
|
|
434
|
+
color: #fff;
|
|
435
|
+
text-align: center;
|
|
436
|
+
margin: auto ;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
.downloadLink {
|
|
440
|
+
/* css:theme-validation:ignore */
|
|
441
|
+
color: #0a73eb;
|
|
442
|
+
display: inline-block;
|
|
443
|
+
padding-top: var(--zd_size10) ;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
.previewIconDiv {
|
|
447
|
+
width: var(--zd_size60) ;
|
|
448
|
+
composes: dflex from '~@zohodesk/components/lib/common/common.module.css';
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
.prevFooterIcon,
|
|
452
|
+
.prevIcon {
|
|
453
|
+
/* css:theme-validation:ignore */
|
|
454
|
+
color: #fff;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
.prevFooterIcon, .prevIcon {
|
|
458
|
+
padding: var(--zd_size2) ;
|
|
459
|
+
margin: auto ;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
.prevFooterIcon::before,
|
|
463
|
+
.prevIcon::before {
|
|
464
|
+
/* css:theme-validation:ignore */
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
.prevFooterIcon::before, .prevIcon::before {
|
|
468
|
+
background-color: transparent;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
[dir=ltr] .prevIcon::before {
|
|
472
|
+
border-radius: 10px 30px 10px 10px;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
[dir=rtl] .prevIcon::before {
|
|
476
|
+
border-radius: 30px 10px 10px 10px;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
[dir=ltr] .prevFooterIcon::before {
|
|
480
|
+
border-radius: 5px 17px 5px 5px
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
[dir=rtl] .prevFooterIcon::before {
|
|
484
|
+
border-radius: 17px 5px 5px 5px
|
|
365
485
|
}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, waitFor } from '@testing-library/react';
|
|
3
|
+
import DotProvider from "../DotProvider"; // snapshot test cases
|
|
4
|
+
|
|
5
|
+
describe('DotProvider Snapshot', () => {
|
|
6
|
+
const THEME_APPEARANCE = ['light', 'dark', 'pureDark'];
|
|
7
|
+
const THEME_COLOR = ['blue', 'green', 'orange', 'red', 'yellow'];
|
|
8
|
+
const BASE_ZOOM_UNIT = ['0.5', '0.8', '1', '1.2'];
|
|
9
|
+
const BASE_FONT_UNIT = ['1px', '1rem', '1em', '1'];
|
|
10
|
+
test('rendering the default props', async () => {
|
|
11
|
+
const {
|
|
12
|
+
asFragment
|
|
13
|
+
} = render( /*#__PURE__*/React.createElement(DotProvider, null, "This is a DotProvider component")); // wait for the data attributes and styles to be applied
|
|
14
|
+
|
|
15
|
+
await waitFor(() => {}); // take the snapshot after the attributes and styles are applied
|
|
16
|
+
|
|
17
|
+
expect(asFragment()).toMatchSnapshot();
|
|
18
|
+
});
|
|
19
|
+
test('rendering the default attributes, styles and modified the tag props', async () => {
|
|
20
|
+
const {
|
|
21
|
+
asFragment
|
|
22
|
+
} = render( /*#__PURE__*/React.createElement(DotProvider, {
|
|
23
|
+
tag: "span"
|
|
24
|
+
}, "This is a DotProvider component"));
|
|
25
|
+
await waitFor(() => {});
|
|
26
|
+
expect(asFragment()).toMatchSnapshot();
|
|
27
|
+
});
|
|
28
|
+
test('rendering the default attributes, styles and modifying the tag prop to React.Fragment', async () => {
|
|
29
|
+
render( /*#__PURE__*/React.createElement(DotProvider, {
|
|
30
|
+
tag: React.Fragment
|
|
31
|
+
}, "This is a DotProvider component"));
|
|
32
|
+
await waitFor(() => {});
|
|
33
|
+
expect(document.documentElement).toMatchSnapshot();
|
|
34
|
+
});
|
|
35
|
+
test('rendering the providerRef props', async () => {
|
|
36
|
+
const mockProviderRef = jest.fn();
|
|
37
|
+
const {
|
|
38
|
+
asFragment
|
|
39
|
+
} = render( /*#__PURE__*/React.createElement(DotProvider, {
|
|
40
|
+
providerRef: mockProviderRef
|
|
41
|
+
}, "This is a DotProvider component"));
|
|
42
|
+
await waitFor(() => {});
|
|
43
|
+
expect(asFragment()).toMatchSnapshot();
|
|
44
|
+
});
|
|
45
|
+
test('rendering the additional ...rest props', async () => {
|
|
46
|
+
const {
|
|
47
|
+
asFragment
|
|
48
|
+
} = render( /*#__PURE__*/React.createElement(DotProvider, {
|
|
49
|
+
className: "testClass",
|
|
50
|
+
"data-id": "test-id"
|
|
51
|
+
}, "This is a DotProvider component"));
|
|
52
|
+
await waitFor(() => {});
|
|
53
|
+
expect(asFragment()).toMatchSnapshot();
|
|
54
|
+
});
|
|
55
|
+
test('rendering the wrong themeAppearance and themeColor', async () => {
|
|
56
|
+
const {
|
|
57
|
+
asFragment
|
|
58
|
+
} = render( /*#__PURE__*/React.createElement(DotProvider, {
|
|
59
|
+
themeAppearance: "ligt",
|
|
60
|
+
themeColor: "gren"
|
|
61
|
+
}, "This is a DotProvider component"));
|
|
62
|
+
await waitFor(() => {});
|
|
63
|
+
expect(asFragment()).toMatchSnapshot();
|
|
64
|
+
});
|
|
65
|
+
THEME_APPEARANCE.map(appearance => {
|
|
66
|
+
test.each(THEME_COLOR)(`rendering the theme-appearance of ${appearance} along with theme-color of %s`, async theme => {
|
|
67
|
+
const {
|
|
68
|
+
asFragment
|
|
69
|
+
} = render( /*#__PURE__*/React.createElement(DotProvider, {
|
|
70
|
+
themeAppearance: appearance,
|
|
71
|
+
themeColor: theme
|
|
72
|
+
}));
|
|
73
|
+
await waitFor(() => {});
|
|
74
|
+
expect(asFragment()).toMatchSnapshot();
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
THEME_APPEARANCE.map(appearance => {
|
|
78
|
+
test.each(THEME_COLOR)(`rendering the custom themeAppearanceAttr and themeColorAttr props with theme-appearance of ${appearance} along with theme-color of %s`, async theme => {
|
|
79
|
+
const {
|
|
80
|
+
asFragment
|
|
81
|
+
} = render( /*#__PURE__*/React.createElement(DotProvider, {
|
|
82
|
+
themeAppearance: appearance,
|
|
83
|
+
themeColor: theme,
|
|
84
|
+
themeAppearanceAttr: "data-desk-mode",
|
|
85
|
+
themeColorAttr: "data-desk-theme"
|
|
86
|
+
}));
|
|
87
|
+
await waitFor(() => {});
|
|
88
|
+
expect(asFragment()).toMatchSnapshot();
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
test.each(BASE_ZOOM_UNIT)(`rendering the baseZoomUnit props of %s`, async zoom => {
|
|
92
|
+
const {
|
|
93
|
+
asFragment
|
|
94
|
+
} = render( /*#__PURE__*/React.createElement(DotProvider, {
|
|
95
|
+
baseZoomUnit: zoom
|
|
96
|
+
}));
|
|
97
|
+
await waitFor(() => {});
|
|
98
|
+
expect(asFragment()).toMatchSnapshot();
|
|
99
|
+
});
|
|
100
|
+
test.each(BASE_FONT_UNIT)(`rendering the baseFontUnit props of %s`, async font => {
|
|
101
|
+
const {
|
|
102
|
+
asFragment
|
|
103
|
+
} = render( /*#__PURE__*/React.createElement(DotProvider, {
|
|
104
|
+
baseFontUnit: font
|
|
105
|
+
}));
|
|
106
|
+
await waitFor(() => {});
|
|
107
|
+
expect(asFragment()).toMatchSnapshot();
|
|
108
|
+
});
|
|
109
|
+
test('rendering the zoomUnitVariable prop along with baseZoomUnit props', async () => {
|
|
110
|
+
const {
|
|
111
|
+
asFragment
|
|
112
|
+
} = render( /*#__PURE__*/React.createElement(DotProvider, {
|
|
113
|
+
baseZoomUnit: "1.1",
|
|
114
|
+
zoomUnitVariable: "--gc_baseUnit"
|
|
115
|
+
}, "This is a DotProvider component"));
|
|
116
|
+
await waitFor(() => {});
|
|
117
|
+
expect(asFragment()).toMatchSnapshot();
|
|
118
|
+
});
|
|
119
|
+
test('rendering the fontUnitVariable prop along with baseFontUnit props', async () => {
|
|
120
|
+
const {
|
|
121
|
+
asFragment
|
|
122
|
+
} = render( /*#__PURE__*/React.createElement(DotProvider, {
|
|
123
|
+
baseFontUnit: "14px",
|
|
124
|
+
fontUnitVariable: "--gc_baseFontUnit"
|
|
125
|
+
}, "This is a DotProvider component"));
|
|
126
|
+
await waitFor(() => {});
|
|
127
|
+
expect(asFragment()).toMatchSnapshot();
|
|
128
|
+
});
|
|
129
|
+
}); // unit test cases
|
|
130
|
+
|
|
131
|
+
describe('DotProvider Unit-Test', () => {
|
|
132
|
+
test('rendering the ref function type props', async () => {
|
|
133
|
+
const mockFunctionRef = jest.fn();
|
|
134
|
+
render( /*#__PURE__*/React.createElement(DotProvider, {
|
|
135
|
+
id: "dot-provider",
|
|
136
|
+
ref: mockFunctionRef
|
|
137
|
+
}, "This is a DotProvider component"));
|
|
138
|
+
await waitFor(() => {});
|
|
139
|
+
const dotProviderElement = document.getElementById('dot-provider');
|
|
140
|
+
expect(mockFunctionRef).toHaveBeenCalledWith(dotProviderElement);
|
|
141
|
+
});
|
|
142
|
+
test('rendering the ref object type props', async () => {
|
|
143
|
+
const mockObjectRef = /*#__PURE__*/React.createRef();
|
|
144
|
+
render( /*#__PURE__*/React.createElement(DotProvider, {
|
|
145
|
+
id: "dot-provider",
|
|
146
|
+
ref: mockObjectRef
|
|
147
|
+
}, "This is a DotProvider component"));
|
|
148
|
+
await waitFor(() => {});
|
|
149
|
+
const dotProviderElement = document.getElementById('dot-provider');
|
|
150
|
+
expect(mockObjectRef.current).toBe(dotProviderElement);
|
|
151
|
+
});
|
|
152
|
+
test('rendering the onAssetsDownloadSuccess props', async () => {
|
|
153
|
+
const mockFunc = jest.fn();
|
|
154
|
+
render( /*#__PURE__*/React.createElement(DotProvider, {
|
|
155
|
+
onAssetsDownloadSuccess: mockFunc
|
|
156
|
+
}, "This is a DotProvider component"));
|
|
157
|
+
await waitFor(() => {});
|
|
158
|
+
expect(mockFunc).toHaveBeenCalled();
|
|
159
|
+
});
|
|
160
|
+
test('rendering the getAssetsPromises props', async () => {
|
|
161
|
+
const mockFunc = jest.fn();
|
|
162
|
+
render( /*#__PURE__*/React.createElement(DotProvider, {
|
|
163
|
+
getAssetsPromises: mockFunc
|
|
164
|
+
}, "This is a DotProvider component"));
|
|
165
|
+
await waitFor(() => {});
|
|
166
|
+
expect(mockFunc).toHaveBeenCalledWith(expect.objectContaining({
|
|
167
|
+
fontSizePromise: expect.any(Promise),
|
|
168
|
+
themeAppearancePromise: expect.arrayContaining([expect.any(Promise)]),
|
|
169
|
+
themeColorPromise: expect.arrayContaining([expect.any(Promise)]),
|
|
170
|
+
zoomSizePromise: expect.any(Promise)
|
|
171
|
+
}));
|
|
172
|
+
});
|
|
173
|
+
}); // need to check error handling cases
|
|
174
|
+
// onAssetsDownloadSuccess not called verification
|