@zohodesk/dot 1.0.0-temp-213 → 1.0.0-temp-214
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 +8 -0
- package/assets/Appearance/dark/mode/Dot_DarkMode.module.css +1 -1
- package/assets/Appearance/light/mode/Dot_LightMode.module.css +1 -1
- package/assets/Appearance/pureDark/mode/Dot_PureDarkMode.module.css +1 -1
- package/es/Attachment/Attachment.module.css +7 -3
- package/es/AttachmentViewer/Attachment.js +106 -1
- package/es/AttachmentViewer/AttachmentViewer.js +114 -28
- package/es/AttachmentViewer/AttachmentViewer.module.css +32 -9
- package/es/AttachmentViewer/props/defaultProps.js +1 -1
- package/es/AttachmentViewer/props/propTypes.js +9 -1
- package/es/AttachmentViewer/utils.js +98 -13
- package/es/form/fields/CheckBoxField/CheckBoxField.js +7 -9
- package/es/form/fields/CurrencyField/CurrencyField.js +5 -5
- package/es/form/fields/DateField/DateField.js +7 -8
- package/es/form/fields/Fields.module.css +3 -0
- package/es/form/fields/MultiSelectField/MultiSelectField.js +5 -6
- package/es/form/fields/RadioField/RadioField.js +1 -1
- package/es/form/fields/SelectField/SelectField.js +5 -6
- package/es/form/fields/TagsMultiSelectField/TagsMultiSelectField.js +6 -8
- package/es/form/fields/TextBoxField/TextBoxField.js +7 -7
- package/es/form/fields/TextareaField/TextareaField.js +6 -6
- package/es/lookup/Lookup/Lookup.js +2 -1
- package/es/lookup/Lookup/Lookup.module.css +6 -1
- package/es/lookup/Lookup/props/propTypes.js +1 -0
- package/es/utils/General.js +23 -1
- package/lib/Attachment/Attachment.module.css +7 -3
- package/lib/AttachmentViewer/Attachment.js +109 -1
- package/lib/AttachmentViewer/AttachmentViewer.js +121 -25
- package/lib/AttachmentViewer/AttachmentViewer.module.css +32 -9
- package/lib/AttachmentViewer/props/defaultProps.js +1 -1
- package/lib/AttachmentViewer/props/propTypes.js +9 -1
- package/lib/AttachmentViewer/utils.js +102 -8
- package/lib/form/fields/CheckBoxField/CheckBoxField.js +7 -10
- package/lib/form/fields/CurrencyField/CurrencyField.js +4 -5
- package/lib/form/fields/DateField/DateField.js +6 -9
- package/lib/form/fields/Fields.module.css +3 -0
- package/lib/form/fields/MultiSelectField/MultiSelectField.js +5 -7
- package/lib/form/fields/RadioField/RadioField.js +1 -1
- package/lib/form/fields/SelectField/SelectField.js +5 -7
- package/lib/form/fields/TagsMultiSelectField/TagsMultiSelectField.js +5 -8
- package/lib/form/fields/TextBoxField/TextBoxField.js +6 -8
- package/lib/form/fields/TextareaField/TextareaField.js +5 -6
- package/lib/lookup/Lookup/Lookup.js +2 -1
- package/lib/lookup/Lookup/Lookup.module.css +6 -1
- package/lib/lookup/Lookup/props/propTypes.js +1 -0
- package/lib/utils/General.js +25 -1
- package/package.json +9 -11
- package/result.json +1 -0
- package/unittest/index.html +37 -0
- package/es/common/dot_common.module.css +0 -4
- package/lib/common/dot_common.module.css +0 -4
|
@@ -21,8 +21,12 @@ var _Avatar = _interopRequireDefault(require("@zohodesk/components/lib/Avatar/Av
|
|
|
21
21
|
|
|
22
22
|
var _CustomResponsive = require("@zohodesk/components/lib/Responsive/CustomResponsive");
|
|
23
23
|
|
|
24
|
+
var _Typography = _interopRequireDefault(require("@zohodesk/components/lib/Typography/Typography"));
|
|
25
|
+
|
|
24
26
|
var _IdProvider = require("@zohodesk/components/lib/Provider/IdProvider");
|
|
25
27
|
|
|
28
|
+
var _Button = _interopRequireDefault(require("@zohodesk/components/es/Button/Button"));
|
|
29
|
+
|
|
26
30
|
var _AttachmentImage = _interopRequireDefault(require("./AttachmentImage"));
|
|
27
31
|
|
|
28
32
|
var _Link = _interopRequireDefault(require("../Link/Link"));
|
|
@@ -35,11 +39,9 @@ var _Attachment = require("./Attachment");
|
|
|
35
39
|
|
|
36
40
|
var _General = require("../utils/General");
|
|
37
41
|
|
|
38
|
-
var _AttachmentViewerModule = _interopRequireDefault(require("./AttachmentViewer.module.css"));
|
|
39
|
-
|
|
40
42
|
var _utils = require("./utils");
|
|
41
43
|
|
|
42
|
-
var
|
|
44
|
+
var _AttachmentViewerModule = _interopRequireDefault(require("./AttachmentViewer.module.css"));
|
|
43
45
|
|
|
44
46
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
45
47
|
|
|
@@ -117,10 +119,39 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
117
119
|
_this.getUpdateDataList = _this.getUpdateDataList.bind(_assertThisInitialized(_this));
|
|
118
120
|
_this.zoomMaintain = _this.zoomMaintain.bind(_assertThisInitialized(_this));
|
|
119
121
|
_this.handleMenuValidation = _this.handleMenuValidation.bind(_assertThisInitialized(_this));
|
|
122
|
+
_this.getPreviewIconData = _this.getPreviewIconData.bind(_assertThisInitialized(_this));
|
|
123
|
+
_this.renderIframe = _this.renderIframe.bind(_assertThisInitialized(_this));
|
|
120
124
|
return _this;
|
|
121
125
|
}
|
|
122
126
|
|
|
123
127
|
_createClass(AttachmentViewer, [{
|
|
128
|
+
key: "isImageFileType",
|
|
129
|
+
value: function isImageFileType(fileName) {
|
|
130
|
+
var extension = ((0, _Attachment.getExtensionFromFileName)(fileName) || '').toLowerCase();
|
|
131
|
+
if (!extension) return false;
|
|
132
|
+
return _utils.FILE_EXTENSIONS.image.map(function (ext) {
|
|
133
|
+
return ext.toLowerCase();
|
|
134
|
+
}).includes(extension);
|
|
135
|
+
}
|
|
136
|
+
}, {
|
|
137
|
+
key: "isVideoFileType",
|
|
138
|
+
value: function isVideoFileType(fileName) {
|
|
139
|
+
var extension = ((0, _Attachment.getExtensionFromFileName)(fileName) || '').toLowerCase();
|
|
140
|
+
if (!extension) return false;
|
|
141
|
+
return _utils.FILE_EXTENSIONS.video.map(function (ext) {
|
|
142
|
+
return ext.toLowerCase();
|
|
143
|
+
}).includes(extension);
|
|
144
|
+
}
|
|
145
|
+
}, {
|
|
146
|
+
key: "isAudioFileType",
|
|
147
|
+
value: function isAudioFileType(fileName) {
|
|
148
|
+
var extension = ((0, _Attachment.getExtensionFromFileName)(fileName) || '').toLowerCase();
|
|
149
|
+
if (!extension) return false;
|
|
150
|
+
return _utils.FILE_EXTENSIONS.audio.map(function (ext) {
|
|
151
|
+
return ext.toLowerCase();
|
|
152
|
+
}).includes(extension);
|
|
153
|
+
}
|
|
154
|
+
}, {
|
|
124
155
|
key: "componentDidMount",
|
|
125
156
|
value: function componentDidMount() {
|
|
126
157
|
this.handleMenuValidation();
|
|
@@ -163,13 +194,17 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
163
194
|
var _this$state = this.state,
|
|
164
195
|
data = _this$state.data,
|
|
165
196
|
selectedIndex = _this$state.selectedIndex;
|
|
197
|
+
var allowedPreviewExtensionsData = this.props.allowedPreviewExtensionsData;
|
|
166
198
|
var selectedAttachment = data[selectedIndex] || {};
|
|
167
|
-
var selectedAttachmentViewUrl = selectedAttachment.viewUrl;
|
|
168
|
-
|
|
199
|
+
var selectedAttachmentViewUrl = selectedAttachment.viewUrl; // const selectedAttachmentDownloadUrl = selectedAttachment.downloadUrl;
|
|
200
|
+
|
|
169
201
|
var selectedAttachmentName = selectedAttachment.name;
|
|
202
|
+
var selectedAttachmentPreviewUrl = selectedAttachment.previewurl;
|
|
170
203
|
(0, _utils.checkFileSourcesValidation)({
|
|
171
204
|
fileName: selectedAttachmentName,
|
|
172
|
-
viewURL: selectedAttachmentViewUrl
|
|
205
|
+
viewURL: selectedAttachmentViewUrl,
|
|
206
|
+
previewUrl: selectedAttachmentPreviewUrl,
|
|
207
|
+
allowedPreviewExtensionsData: allowedPreviewExtensionsData
|
|
173
208
|
}).then(function (fileSourceValidation) {
|
|
174
209
|
var isViewURLValid = fileSourceValidation.isViewURLValid,
|
|
175
210
|
canZoom = fileSourceValidation.canZoom;
|
|
@@ -332,9 +367,38 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
332
367
|
}])
|
|
333
368
|
};
|
|
334
369
|
}
|
|
370
|
+
}, {
|
|
371
|
+
key: "getPreviewIconData",
|
|
372
|
+
value: function getPreviewIconData(name, size, dataId) {
|
|
373
|
+
var fileUnknown = {
|
|
374
|
+
iconName: 'ZD-GN-fileUnknown',
|
|
375
|
+
iconSize: '40'
|
|
376
|
+
};
|
|
377
|
+
var fileIconName = (0, _Attachment.getAttachmentIconDetails)(name);
|
|
378
|
+
var fileDetails = name ? {
|
|
379
|
+
iconName: fileIconName,
|
|
380
|
+
iconSize: size
|
|
381
|
+
} : fileUnknown;
|
|
382
|
+
var iconName = fileDetails.iconName,
|
|
383
|
+
iconSize = fileDetails.iconSize;
|
|
384
|
+
return /*#__PURE__*/_react["default"].createElement(_icons.Icon, {
|
|
385
|
+
iconClass: _AttachmentViewerModule["default"].prevFooterIcon,
|
|
386
|
+
name: iconName,
|
|
387
|
+
size: iconSize,
|
|
388
|
+
"data-id": dataId
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
}, {
|
|
392
|
+
key: "renderIframe",
|
|
393
|
+
value: function renderIframe(previewurl) {
|
|
394
|
+
return /*#__PURE__*/_react["default"].createElement("iframe", _extends({
|
|
395
|
+
src: previewurl,
|
|
396
|
+
className: _AttachmentViewerModule["default"].previewFrame
|
|
397
|
+
}, this.props.customProps.iframeProps));
|
|
398
|
+
}
|
|
335
399
|
}, {
|
|
336
400
|
key: "imgPreviewView",
|
|
337
|
-
value: function imgPreviewView() {
|
|
401
|
+
value: function imgPreviewView(downloadUrl) {
|
|
338
402
|
var _this5 = this;
|
|
339
403
|
|
|
340
404
|
var _this$state3 = this.state,
|
|
@@ -345,7 +409,9 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
345
409
|
isPreviewAttachmentValid = _this$state3.isPreviewAttachmentValid;
|
|
346
410
|
var _this$props = this.props,
|
|
347
411
|
maintainZoom = _this$props.maintainZoom,
|
|
348
|
-
dataId = _this$props.dataId
|
|
412
|
+
dataId = _this$props.dataId,
|
|
413
|
+
i18nKeys = _this$props.i18nKeys,
|
|
414
|
+
renderUnSupportedElement = _this$props.renderUnSupportedElement;
|
|
349
415
|
|
|
350
416
|
var getImgStyle = function getImgStyle(i) {
|
|
351
417
|
var position;
|
|
@@ -383,16 +449,25 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
383
449
|
_data$customClass = data.customClass,
|
|
384
450
|
customClass = _data$customClass === void 0 ? {} : _data$customClass,
|
|
385
451
|
_data$customProps = data.customProps,
|
|
386
|
-
customProps = _data$customProps === void 0 ? {} : _data$customProps
|
|
452
|
+
customProps = _data$customProps === void 0 ? {} : _data$customProps,
|
|
453
|
+
previewurl = data.previewurl,
|
|
454
|
+
type = data.type;
|
|
387
455
|
var _customProps$audioPro = customProps.audioProps,
|
|
388
456
|
audioProps = _customProps$audioPro === void 0 ? {} : _customProps$audioPro,
|
|
389
457
|
_customProps$imagePro = customProps.imageProps,
|
|
390
|
-
imageProps = _customProps$imagePro === void 0 ? {} : _customProps$imagePro
|
|
458
|
+
imageProps = _customProps$imagePro === void 0 ? {} : _customProps$imagePro,
|
|
459
|
+
_customProps$videoPro = customProps.videoProps,
|
|
460
|
+
videoProps = _customProps$videoPro === void 0 ? {} : _customProps$videoPro;
|
|
391
461
|
var _customClass$customIm = customClass.customImageClass,
|
|
392
462
|
customImageClass = _customClass$customIm === void 0 ? '' : _customClass$customIm,
|
|
393
463
|
_customClass$customCh = customClass.customChildrenClass,
|
|
394
464
|
customChildrenClass = _customClass$customCh === void 0 ? '' : _customClass$customCh;
|
|
395
465
|
var retainZoom = canZoom && selectedIndex == i && maintainZoom;
|
|
466
|
+
var extension = (0, _Attachment.getExtensionFromFileName)(name);
|
|
467
|
+
var _i18nKeys$previewUnsu = i18nKeys.previewUnsupportedText,
|
|
468
|
+
previewUnsupportedText = _i18nKeys$previewUnsu === void 0 ? "Preview not available for the selected file type." : _i18nKeys$previewUnsu,
|
|
469
|
+
_i18nKeys$downloadTex = i18nKeys.downloadText,
|
|
470
|
+
downloadText = _i18nKeys$downloadTex === void 0 ? "Download" : _i18nKeys$downloadTex;
|
|
396
471
|
return /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
|
|
397
472
|
className: _AttachmentViewerModule["default"].imgBox,
|
|
398
473
|
id: "imgBox".concat(i),
|
|
@@ -403,29 +478,51 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
403
478
|
}, /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
404
479
|
className: _AttachmentViewerModule["default"].imgRef,
|
|
405
480
|
id: "imgPreviewRef".concat(i)
|
|
406
|
-
}, (
|
|
407
|
-
|
|
481
|
+
}, selectedIndex == i && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, _this5.isAudioFileType(name) ? /*#__PURE__*/_react["default"].createElement("audio", _extends({
|
|
482
|
+
controls: true,
|
|
483
|
+
className: _AttachmentViewerModule["default"].zoomIn,
|
|
484
|
+
"data-id": "".concat(dataId, "_audioPreview"),
|
|
485
|
+
"data-test-id": "".concat(dataId, "_audioPreview")
|
|
486
|
+
}, audioProps), /*#__PURE__*/_react["default"].createElement("source", {
|
|
487
|
+
src: previewurl || viewUrl,
|
|
488
|
+
type: "audio/".concat(extension)
|
|
489
|
+
})) : _this5.isVideoFileType(name) ? /*#__PURE__*/_react["default"].createElement("video", _extends({
|
|
408
490
|
controls: true,
|
|
409
491
|
className: _AttachmentViewerModule["default"].zoomIn,
|
|
410
492
|
"data-id": "".concat(dataId, "_videoPreview"),
|
|
411
493
|
"data-test-id": "".concat(dataId, "_videoPreview")
|
|
412
|
-
},
|
|
494
|
+
}, videoProps), /*#__PURE__*/_react["default"].createElement("source", {
|
|
413
495
|
src: viewUrl,
|
|
414
|
-
type: "
|
|
415
|
-
})) :
|
|
496
|
+
type: "video/".concat(extension)
|
|
497
|
+
})) : _this5.isImageFileType(name) || children ? /*#__PURE__*/_react["default"].createElement(_AttachmentImage["default"], _extends({
|
|
416
498
|
customClass: {
|
|
417
|
-
customImageClass: "".concat(_AttachmentViewerModule["default"].img, " ").concat(_AttachmentViewerModule["default"].altText, "
|
|
499
|
+
customImageClass: "".concat(_AttachmentViewerModule["default"].img, " ").concat(_AttachmentViewerModule["default"].altText, " ").concat(canZoom || retainZoom ? isZoomed ? "".concat(_AttachmentViewerModule["default"].zoomedImg, " ").concat(_AttachmentViewerModule["default"].zoomOutCursor) : "".concat(_AttachmentViewerModule["default"].normalImg, " ").concat(_AttachmentViewerModule["default"].zoomInCursor) : '', " ").concat(customImageClass),
|
|
418
500
|
customChildrenClass: customChildrenClass
|
|
419
501
|
},
|
|
420
502
|
src: viewUrl,
|
|
421
503
|
onClick: isPreviewAttachmentValid ? isZoomed ? _this5.zoomOut.bind(_this5, i) : function (e) {
|
|
422
|
-
_this5.zoomIn(e, i, true);
|
|
504
|
+
return _this5.zoomIn(e, i, true);
|
|
423
505
|
} : undefined,
|
|
424
506
|
alt: name,
|
|
425
507
|
dataId: dataId,
|
|
426
508
|
id: "img".concat(i),
|
|
427
509
|
isCover: false
|
|
428
|
-
}, imageProps), children)))
|
|
510
|
+
}, imageProps), children) : type === "document" && previewurl != null ? _this5.renderIframe(previewurl) : typeof renderUnSupportedElement === 'function' ? renderUnSupportedElement(data) : /*#__PURE__*/_react["default"].createElement("div", {
|
|
511
|
+
className: _AttachmentViewerModule["default"].previewNone
|
|
512
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
513
|
+
className: _AttachmentViewerModule["default"].fileTypeImg
|
|
514
|
+
}, _this5.getPreviewIconData(name, '70')), /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
|
|
515
|
+
$ui_size: "20",
|
|
516
|
+
$ui_weight: "semibold"
|
|
517
|
+
}, previewUnsupportedText), downloadUrl ? /*#__PURE__*/_react["default"].createElement(_Link["default"], {
|
|
518
|
+
href: downloadUrl,
|
|
519
|
+
className: _AttachmentViewerModule["default"].downloadLink,
|
|
520
|
+
hasReload: true,
|
|
521
|
+
download: true
|
|
522
|
+
}, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
523
|
+
palette: "primaryFilled",
|
|
524
|
+
text: downloadText
|
|
525
|
+
})) : null))));
|
|
429
526
|
});
|
|
430
527
|
}
|
|
431
528
|
}, {
|
|
@@ -451,7 +548,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
451
548
|
avatarProps = _customProps$avatarPr === void 0 ? {} : _customProps$avatarPr;
|
|
452
549
|
var totalLen = data.length;
|
|
453
550
|
var selectedAttachment = data[selectedIndex] || {};
|
|
454
|
-
var selectedImgUrl = selectedAttachment.viewUrl;
|
|
551
|
+
var selectedImgUrl = selectedAttachment.previewurl || selectedAttachment.viewUrl;
|
|
455
552
|
var downloadUrl = selectedAttachment.downloadUrl;
|
|
456
553
|
var authorHref;
|
|
457
554
|
var authorName;
|
|
@@ -606,7 +703,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
606
703
|
eleRef: _this6.setImgBoxRef,
|
|
607
704
|
scroll: "both",
|
|
608
705
|
flexible: true
|
|
609
|
-
}, _this6.imgPreviewView()), /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
706
|
+
}, _this6.imgPreviewView(downloadUrl)), /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
610
707
|
className: "".concat(_AttachmentViewerModule["default"].arrowBox, " ").concat(uptoTablet ? _AttachmentViewerModule["default"].mbleArrowBox : _AttachmentViewerModule["default"].nrmlArrowBox, " ").concat(totalLen === selectedIndex + 1 ? _AttachmentViewerModule["default"].hidden : ''),
|
|
611
708
|
onClick: _this6.changeSelectedIndex.bind(_this6, selectedIndex + 1),
|
|
612
709
|
"data-title": i18nKeys.nextText,
|
|
@@ -662,14 +759,13 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
662
759
|
_item$customProps = item.customProps,
|
|
663
760
|
customProps = _item$customProps === void 0 ? {} : _item$customProps;
|
|
664
761
|
var thumbnail = item.thumbnail;
|
|
762
|
+
var isImageFileType = _this6.isImageFileType(name) || thumbnail;
|
|
665
763
|
var _customClass$customIm2 = customClass.customImageClass,
|
|
666
764
|
customImageClass = _customClass$customIm2 === void 0 ? '' : _customClass$customIm2,
|
|
667
765
|
_customClass$customCh2 = customClass.customChildrenClass,
|
|
668
766
|
customChildrenClass = _customClass$customCh2 === void 0 ? '' : _customClass$customCh2;
|
|
669
|
-
thumbnail = (0, _Attachment.isAudioFile)(name) ? thumbnail || _audio_thumbnail["default"] : thumbnail; //fallback thumbnail for audio
|
|
670
|
-
|
|
671
767
|
return /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
672
|
-
className: "".concat(_AttachmentViewerModule["default"].imgItem, " ").concat(index === selectedIndex ? _AttachmentViewerModule["default"].selected : ''),
|
|
768
|
+
className: "".concat(_AttachmentViewerModule["default"].imgItem, " ").concat(index === selectedIndex ? _AttachmentViewerModule["default"].selected : '', " ").concat(isImageFileType ? '' : _AttachmentViewerModule["default"].previewIconDiv),
|
|
673
769
|
key: index,
|
|
674
770
|
onClick: _this6.changeSelectedIndex.bind(_this6, index),
|
|
675
771
|
eleRef: function eleRef(el) {
|
|
@@ -677,7 +773,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
677
773
|
},
|
|
678
774
|
dataId: "attachPreviewList",
|
|
679
775
|
"data-title": name
|
|
680
|
-
}, /*#__PURE__*/_react["default"].createElement(_AttachmentImage["default"], _extends({
|
|
776
|
+
}, isImageFileType || children ? /*#__PURE__*/_react["default"].createElement(_AttachmentImage["default"], _extends({
|
|
681
777
|
src: thumbnail || viewUrl,
|
|
682
778
|
size: "small",
|
|
683
779
|
alt: name,
|
|
@@ -686,7 +782,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
686
782
|
customChildrenClass: "".concat(_AttachmentViewerModule["default"].crsrPointer, " ").concat(customChildrenClass)
|
|
687
783
|
},
|
|
688
784
|
dataId: dataId
|
|
689
|
-
}, customProps), children));
|
|
785
|
+
}, customProps), children) : _this6.getPreviewIconData(name, '40'));
|
|
690
786
|
}))))), totalLen !== 1 && /*#__PURE__*/_react["default"].createElement(_IconButton["default"], {
|
|
691
787
|
dataId: "attachToggle",
|
|
692
788
|
onClick: _this6.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: 1.
|
|
82
|
+
line-height: 1.6;
|
|
83
83
|
border-radius: 50%;
|
|
84
84
|
cursor: pointer;
|
|
85
85
|
}
|
|
@@ -230,14 +230,10 @@
|
|
|
230
230
|
transform: rotateX(0deg);
|
|
231
231
|
}
|
|
232
232
|
|
|
233
|
-
.
|
|
234
|
-
|
|
235
|
-
width:
|
|
236
|
-
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
.isAudio .image {
|
|
240
|
-
opacity: 0;
|
|
233
|
+
.previewFrame {
|
|
234
|
+
height: 100% ;
|
|
235
|
+
width: 100% ;
|
|
236
|
+
border: 0;
|
|
241
237
|
}
|
|
242
238
|
|
|
243
239
|
.video {
|
|
@@ -362,4 +358,31 @@
|
|
|
362
358
|
background-color: var(--dot_mirror);
|
|
363
359
|
border: 0;
|
|
364
360
|
cursor: pointer;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
.fileTypeImg {
|
|
364
|
+
margin-bottom: var(--zd_size30) ;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
.previewNone {
|
|
368
|
+
color: var(--zdt_attachmentviewer_title_text);
|
|
369
|
+
max-width: 70% ;
|
|
370
|
+
text-align: center;
|
|
371
|
+
margin: auto ;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
.downloadLink {
|
|
375
|
+
display: inline-block;
|
|
376
|
+
padding-top: var(--zd_size15) ;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
.previewIconDiv {
|
|
380
|
+
width: var(--zd_size60) ;
|
|
381
|
+
composes: dflex from '~@zohodesk/components/lib/common/common.module.css';
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
.prevFooterIcon {
|
|
385
|
+
color: var(--zdt_attachmentviewer_title_text);
|
|
386
|
+
padding: var(--zd_size2) ;
|
|
387
|
+
margin: auto ;
|
|
365
388
|
}
|
|
@@ -15,10 +15,10 @@ exports.AttachmentImage_defaultProps = AttachmentImage_defaultProps;
|
|
|
15
15
|
var AttachmentViewer_defaultProps = {
|
|
16
16
|
responsiveId: "Helmet",
|
|
17
17
|
needDownload: true,
|
|
18
|
-
i18nKeys: {},
|
|
19
18
|
maintainZoom: false,
|
|
20
19
|
isActive: false,
|
|
21
20
|
dataId: 'AttachmentViewer',
|
|
21
|
+
i18nKeys: {},
|
|
22
22
|
customProps: {}
|
|
23
23
|
};
|
|
24
24
|
exports.AttachmentViewer_defaultProps = AttachmentViewer_defaultProps;
|
|
@@ -38,7 +38,8 @@ var AttachmentViewer_propTypes = {
|
|
|
38
38
|
downloadText: _propTypes["default"].string,
|
|
39
39
|
closeText: _propTypes["default"].string,
|
|
40
40
|
hideText: _propTypes["default"].string,
|
|
41
|
-
showText: _propTypes["default"].string
|
|
41
|
+
showText: _propTypes["default"].string,
|
|
42
|
+
previewUnsupportedText: _propTypes["default"].string
|
|
42
43
|
}),
|
|
43
44
|
needDownload: _propTypes["default"].string,
|
|
44
45
|
previewObj: _propTypes["default"].object,
|
|
@@ -46,6 +47,13 @@ var AttachmentViewer_propTypes = {
|
|
|
46
47
|
maintainZoom: _propTypes["default"].bool,
|
|
47
48
|
isActive: _propTypes["default"].bool,
|
|
48
49
|
dataId: _propTypes["default"].string,
|
|
50
|
+
allowedPreviewExtensionsData: _propTypes["default"].shape({
|
|
51
|
+
audio: _propTypes["default"].arrayOf(_propTypes["default"].string),
|
|
52
|
+
video: _propTypes["default"].arrayOf(_propTypes["default"].string),
|
|
53
|
+
image: _propTypes["default"].arrayOf(_propTypes["default"].string),
|
|
54
|
+
document: _propTypes["default"].arrayOf(_propTypes["default"].string)
|
|
55
|
+
}),
|
|
56
|
+
renderUnSupportedElement: _propTypes["default"].func,
|
|
49
57
|
customProps: _propTypes["default"].shape({
|
|
50
58
|
avatarProps: _propTypes["default"].exact(_propTypes2.propTypes)
|
|
51
59
|
})
|
|
@@ -3,10 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.ZoomEvent = exports.Zoom = void 0;
|
|
6
|
+
exports.ZoomEvent = exports.Zoom = exports.SUPPORTED_FILE_EXTENSIONS = exports.FILE_EXTENSIONS = void 0;
|
|
7
7
|
exports.checkAudioUrlValidity = checkAudioUrlValidity;
|
|
8
8
|
exports.checkFileSourcesValidation = checkFileSourcesValidation;
|
|
9
9
|
exports.checkImageValidity = checkImageValidity;
|
|
10
|
+
exports.checkVideoUrlValidity = checkVideoUrlValidity;
|
|
11
|
+
exports.isValidDocument = isValidDocument;
|
|
10
12
|
|
|
11
13
|
var _Attachment = require("./Attachment");
|
|
12
14
|
|
|
@@ -153,6 +155,21 @@ function checkImageValidity(src) {
|
|
|
153
155
|
});
|
|
154
156
|
}
|
|
155
157
|
|
|
158
|
+
function checkVideoUrlValidity(url) {
|
|
159
|
+
return new Promise(function (resolve) {
|
|
160
|
+
var video = document.createElement('video');
|
|
161
|
+
video.src = url;
|
|
162
|
+
|
|
163
|
+
video.oncanplaythrough = function () {
|
|
164
|
+
return resolve(true);
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
video.onerror = function () {
|
|
168
|
+
return resolve(false);
|
|
169
|
+
};
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
|
|
156
173
|
function checkAudioUrlValidity(url) {
|
|
157
174
|
return new Promise(function (resolve) {
|
|
158
175
|
var audio = new Audio(url);
|
|
@@ -169,25 +186,102 @@ function checkAudioUrlValidity(url) {
|
|
|
169
186
|
|
|
170
187
|
;
|
|
171
188
|
|
|
189
|
+
function isValidDocument(url) {
|
|
190
|
+
if (!url) {
|
|
191
|
+
return false;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
return true;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
var FILE_EXTENSIONS = {
|
|
198
|
+
audio: ['mp3', 'wav', 'wma', 'aac', 'm4r', 'm4a', 'flac', 'aiff', 'alac', 'ogg', 'opus', 'amr', 'mid', 'midi'],
|
|
199
|
+
video: ['mp4', 'mkv', 'mov', 'mpeg', 'mpg', 'flv', 'wmv', 'avi', 'webm', 'ogv', 'm4v', '3gp', '3g2'],
|
|
200
|
+
document: ['doc', 'docx', 'docm', 'dot', 'dotx', 'dotm', 'odt', 'rtf', 'txt', 'md', 'pages', 'xls', 'xlsx', 'xlsm', 'xlsb', 'csv', 'tsv', 'ods', 'sxc', 'numbers', 'ppt', 'pptx', 'pps', 'ppsx', 'pot', 'potx', 'odp', 'sxi', 'key', 'pdf', 'xml', 'json', 'yaml', 'yml', 'log', 'eml', 'msg'],
|
|
201
|
+
image: ['jpeg', 'jpg', 'png', 'apng', 'gif', 'bmp', 'dib', 'tiff', 'tif', 'ico', 'svg', 'webp', 'heic', 'heif', 'jfif', 'pjpeg', 'pjp', 'avif']
|
|
202
|
+
};
|
|
203
|
+
exports.FILE_EXTENSIONS = FILE_EXTENSIONS;
|
|
204
|
+
var SUPPORTED_FILE_EXTENSIONS = {
|
|
205
|
+
image: ['jpeg', 'jpg', 'png', 'apng', 'gif', 'bmp', 'tiff', 'tif', 'ico', 'svg', 'heic', 'webp'],
|
|
206
|
+
doc: ['txt'],
|
|
207
|
+
pdf: ['pdf'],
|
|
208
|
+
html: ['html', 'htm', 'xhtml'],
|
|
209
|
+
ppt: ['ppt', 'pps', 'odp', 'sxi', 'pptx', 'ppsx', 'pot', 'potx', 'key'],
|
|
210
|
+
zip: ['rar', 'jar', 'zip'],
|
|
211
|
+
word: ['doc', 'docx', 'sxw', 'odt', 'docm', 'dot', 'dotm', 'dotx', 'rtf', 'pages'],
|
|
212
|
+
xml: ['xml'],
|
|
213
|
+
sheet: ['xls', 'xlsx', 'xlsm', 'xlsb', 'sxc', 'ods', 'csv', 'tsv', 'numbers'],
|
|
214
|
+
audio: ['mp3', 'wav', 'wma', 'aac', 'm4r', 'ogg', 'opus'],
|
|
215
|
+
video: ['mp4', 'mkv', 'mov', 'mpeg', 'flv', 'wmv', 'avi', 'webm', 'ogv'],
|
|
216
|
+
mail: ['eml', 'msg'],
|
|
217
|
+
linux: ['sh', 'bin'],
|
|
218
|
+
css: ['css'],
|
|
219
|
+
exe: ['exe'],
|
|
220
|
+
event: ['ics']
|
|
221
|
+
};
|
|
222
|
+
exports.SUPPORTED_FILE_EXTENSIONS = SUPPORTED_FILE_EXTENSIONS;
|
|
223
|
+
|
|
172
224
|
function checkFileSourcesValidation(_ref) {
|
|
173
225
|
var fileName = _ref.fileName,
|
|
174
|
-
viewURL = _ref.viewURL
|
|
226
|
+
viewURL = _ref.viewURL,
|
|
227
|
+
previewUrl = _ref.previewUrl,
|
|
228
|
+
allowedPreviewExtensionsData = _ref.allowedPreviewExtensionsData;
|
|
229
|
+
var extension = ((0, _Attachment.getExtensionFromFileName)(fileName) || '').toLowerCase();
|
|
230
|
+
|
|
231
|
+
if (!extension) {
|
|
232
|
+
return Promise.resolve({
|
|
233
|
+
isViewURLValid: false,
|
|
234
|
+
canZoom: false
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
var extensionSource = allowedPreviewExtensionsData || FILE_EXTENSIONS;
|
|
175
239
|
|
|
176
|
-
|
|
177
|
-
var
|
|
178
|
-
|
|
240
|
+
var fileExtensionValidation = function fileExtensionValidation(type) {
|
|
241
|
+
var list = extensionSource[type];
|
|
242
|
+
if (!Array.isArray(list)) return false;
|
|
243
|
+
return list.map(function (e) {
|
|
244
|
+
return e.toLowerCase();
|
|
245
|
+
}).includes(extension);
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
if (fileExtensionValidation('audio')) {
|
|
249
|
+
return checkAudioUrlValidity(viewURL).then(function (isURLValid) {
|
|
179
250
|
return {
|
|
180
251
|
isViewURLValid: isURLValid,
|
|
181
252
|
canZoom: false
|
|
182
253
|
};
|
|
183
254
|
});
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
if (fileExtensionValidation('video')) {
|
|
258
|
+
return checkVideoUrlValidity(viewURL).then(function (isURLValid) {
|
|
259
|
+
return {
|
|
260
|
+
isViewURLValid: isURLValid,
|
|
261
|
+
canZoom: false
|
|
262
|
+
};
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
if (fileExtensionValidation('document')) {
|
|
267
|
+
var isValid = isValidDocument(previewUrl, fileName);
|
|
268
|
+
return Promise.resolve({
|
|
269
|
+
isViewURLValid: isValid,
|
|
270
|
+
canZoom: false
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
if (fileExtensionValidation('image')) {
|
|
275
|
+
return checkImageValidity(viewURL).then(function (isURLValid) {
|
|
187
276
|
return {
|
|
188
277
|
isViewURLValid: isURLValid,
|
|
189
278
|
canZoom: isURLValid
|
|
190
279
|
};
|
|
191
280
|
});
|
|
192
281
|
}
|
|
282
|
+
|
|
283
|
+
return Promise.resolve({
|
|
284
|
+
isViewURLValid: false,
|
|
285
|
+
canZoom: false
|
|
286
|
+
});
|
|
193
287
|
}
|
|
@@ -13,7 +13,7 @@ var _defaultProps = require("./props/defaultProps");
|
|
|
13
13
|
|
|
14
14
|
var _propTypes = require("./props/propTypes");
|
|
15
15
|
|
|
16
|
-
var _Label = _interopRequireDefault(require("@zohodesk/components/
|
|
16
|
+
var _Label = _interopRequireDefault(require("@zohodesk/components/es/v1/Label/Label"));
|
|
17
17
|
|
|
18
18
|
var _CheckBox = _interopRequireDefault(require("@zohodesk/components/lib/CheckBox/CheckBox"));
|
|
19
19
|
|
|
@@ -140,15 +140,12 @@ var CheckBoxField = /*#__PURE__*/function (_PureComponent) {
|
|
|
140
140
|
renderProps: renderLabelProps
|
|
141
141
|
}, /*#__PURE__*/_react["default"].createElement(_Label["default"], _extends({
|
|
142
142
|
text: labelName,
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
onClick: !removeEvent ? this.handleLabelClick : null,
|
|
150
|
-
variant: isDirectCol ? 'default' : 'primary',
|
|
151
|
-
dataId: isDisabled ? "".concat(dataId, "_label_disabled") : isMandatory ? "".concat(dataId, "_label_mandatory") : "".concat(dataId, "_label")
|
|
143
|
+
isRequired: isMandatory,
|
|
144
|
+
isInlineField: true,
|
|
145
|
+
customStyle: labelCustomClass,
|
|
146
|
+
testId: id,
|
|
147
|
+
customId: isDisabled ? "".concat(dataId, "_label_disabled") : isMandatory ? "".concat(dataId, "_label_mandatory") : "".concat(dataId, "_label"),
|
|
148
|
+
onClick: !removeEvent ? this.handleLabelClick : null
|
|
152
149
|
}, LabelProps)));
|
|
153
150
|
|
|
154
151
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
@@ -13,7 +13,7 @@ var _defaultProps = require("./props/defaultProps");
|
|
|
13
13
|
|
|
14
14
|
var _propTypes = require("./props/propTypes");
|
|
15
15
|
|
|
16
|
-
var _Label = _interopRequireDefault(require("@zohodesk/components/
|
|
16
|
+
var _Label = _interopRequireDefault(require("@zohodesk/components/es/v1/Label/Label"));
|
|
17
17
|
|
|
18
18
|
var _TextBoxIcon = _interopRequireDefault(require("@zohodesk/components/lib/TextBoxIcon/TextBoxIcon"));
|
|
19
19
|
|
|
@@ -178,11 +178,10 @@ var CurrencyField = /*#__PURE__*/function (_PureComponent) {
|
|
|
178
178
|
renderProps: renderLabelProps
|
|
179
179
|
}, /*#__PURE__*/_react["default"].createElement(_Label["default"], _extends({
|
|
180
180
|
text: labelName,
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
customClass: "".concat(_FieldsModule["default"].fieldLabel, " ").concat(labelCustomClass, " ").concat(isMandatory ? _FieldsModule["default"].labelMandatory : ''),
|
|
181
|
+
isRequired: isMandatory,
|
|
182
|
+
customStyle: labelCustomClass,
|
|
184
183
|
htmlFor: uniqueId,
|
|
185
|
-
|
|
184
|
+
customId: isDisabled ? "".concat(dataId, "_label_disabled") : isMandatory ? "".concat(dataId, "_label_mandatory") : "".concat(dataId, "_label")
|
|
186
185
|
}, LabelProps))), /*#__PURE__*/_react["default"].createElement("div", {
|
|
187
186
|
className: "".concat(_FieldsModule["default"].fieldContainer, " ").concat(labelName ? _FieldsModule["default"]["fieldMargin_".concat(fieldSize)] : '')
|
|
188
187
|
}, /*#__PURE__*/_react["default"].createElement(_TextBoxIcon["default"], _extends({
|
|
@@ -13,7 +13,7 @@ var _defaultProps = require("./props/defaultProps");
|
|
|
13
13
|
|
|
14
14
|
var _propTypes = require("./props/propTypes");
|
|
15
15
|
|
|
16
|
-
var _Label = _interopRequireDefault(require("@zohodesk/components/
|
|
16
|
+
var _Label = _interopRequireDefault(require("@zohodesk/components/es/v1/Label/Label"));
|
|
17
17
|
|
|
18
18
|
var _DateWidget = _interopRequireDefault(require("@zohodesk/components/lib/DateTime/DateWidget"));
|
|
19
19
|
|
|
@@ -185,15 +185,12 @@ var DateField = /*#__PURE__*/function (_PureComponent) {
|
|
|
185
185
|
renderProps: renderLabelProps
|
|
186
186
|
}, /*#__PURE__*/_react["default"].createElement(_Label["default"], _extends({
|
|
187
187
|
text: labelName,
|
|
188
|
+
isRequired: isMandatory,
|
|
189
|
+
customStyle: labelCustomClass,
|
|
188
190
|
htmlFor: getAriaId,
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
customClass: "".concat(_FieldsModule["default"].fieldLabel, " ").concat(labelCustomClass, " ").concat(isMandatory ? _FieldsModule["default"].labelMandatory : ''),
|
|
193
|
-
dataId: isDisabled ? "".concat(dataId, "_label_disabled") : isMandatory ? "".concat(dataId, "_label_mandatory") : "".concat(dataId, "_label")
|
|
194
|
-
}, LabelProps, {
|
|
195
|
-
id: labelName
|
|
196
|
-
}))), /*#__PURE__*/_react["default"].createElement("div", {
|
|
191
|
+
testId: labelName,
|
|
192
|
+
customId: isDisabled ? "".concat(dataId, "_label_disabled") : isMandatory ? "".concat(dataId, "_label_mandatory") : "".concat(dataId, "_label")
|
|
193
|
+
}, LabelProps))), /*#__PURE__*/_react["default"].createElement("div", {
|
|
197
194
|
className: "".concat(_FieldsModule["default"].fieldContainer, " ").concat(labelName ? _FieldsModule["default"]["fieldMargin_".concat(fieldSize)] : '')
|
|
198
195
|
}, isLocked && lockedValueText ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
199
196
|
className: _FieldsModule["default"].lockText
|
|
@@ -13,7 +13,7 @@ var _defaultProps = require("./props/defaultProps");
|
|
|
13
13
|
|
|
14
14
|
var _propTypes = require("./props/propTypes");
|
|
15
15
|
|
|
16
|
-
var _Label = _interopRequireDefault(require("@zohodesk/components/
|
|
16
|
+
var _Label = _interopRequireDefault(require("@zohodesk/components/es/v1/Label/Label"));
|
|
17
17
|
|
|
18
18
|
var _MultiSelect = _interopRequireDefault(require("@zohodesk/components/lib/MultiSelect/MultiSelect"));
|
|
19
19
|
|
|
@@ -198,13 +198,11 @@ var MultiSelectField = /*#__PURE__*/function (_PureComponent) {
|
|
|
198
198
|
renderProps: renderLabelProps
|
|
199
199
|
}, /*#__PURE__*/_react["default"].createElement(_Label["default"], _extends({
|
|
200
200
|
text: labelName,
|
|
201
|
-
|
|
202
|
-
size: fieldSize === 'small' ? 'small' : 'medium',
|
|
203
|
-
palette: isDarkPalette ? 'dark' : isMandatory ? 'mandatory' : isDisabled ? 'primary' : labelPalette // onClick={this.handleLabelClick}
|
|
201
|
+
isRequired: isMandatory // customStyle={style.fieldLabel}
|
|
204
202
|
,
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
203
|
+
htmlFor: uniqueId,
|
|
204
|
+
testId: id,
|
|
205
|
+
customId: isDisabled ? "".concat(dataId, "_label_disabled") : isMandatory ? "".concat(dataId, "_label_mandatory") : "".concat(dataId, "_label")
|
|
208
206
|
}, LabelProps))), /*#__PURE__*/_react["default"].createElement(_MultiSelect["default"], _extends({
|
|
209
207
|
options: options,
|
|
210
208
|
onChange: this.handleChange,
|