@zohodesk/dot 1.0.0-temp-230.2 → 1.0.0-temp-230.3
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/es/AttachmentViewer/AttachmentViewer.js +5 -6
- package/es/AttachmentViewer/AttachmentViewer.module.css +7 -14
- package/es/AttachmentViewer/props/defaultProps.js +3 -2
- package/es/AttachmentViewer/props/propTypes.js +2 -4
- package/lib/AttachmentViewer/AttachmentViewer.js +12 -11
- package/lib/AttachmentViewer/AttachmentViewer.module.css +7 -14
- package/lib/AttachmentViewer/props/defaultProps.js +5 -2
- package/lib/AttachmentViewer/props/propTypes.js +2 -4
- package/package.json +2 -2
|
@@ -4,7 +4,7 @@ import React, { Component } from 'react';
|
|
|
4
4
|
import { AttachmentViewer_defaultProps } from "./props/defaultProps";
|
|
5
5
|
import { AttachmentViewer_propTypes } from "./props/propTypes";
|
|
6
6
|
import { Container, Box } from '@zohodesk/components/es/Layout';
|
|
7
|
-
import
|
|
7
|
+
import Icon from '@zohodesk/icons/es/Icon';
|
|
8
8
|
import Avatar from '@zohodesk/components/es/Avatar/Avatar';
|
|
9
9
|
import { ResponsiveReceiver } from '@zohodesk/components/es/Responsive/CustomResponsive';
|
|
10
10
|
import Typography from '@zohodesk/components/es/Typography/Typography';
|
|
@@ -107,11 +107,11 @@ export default class AttachmentViewer extends Component {
|
|
|
107
107
|
selectedIndex
|
|
108
108
|
} = this.state;
|
|
109
109
|
let indexChanged = previewObj.selectedIndex != prevProps.previewObj.selectedIndex;
|
|
110
|
-
const attachmentPreviewUrlChanged = previewObj.previewData
|
|
110
|
+
const attachmentPreviewUrlChanged = previewObj.previewData.some((value, index) => value?.viewUrl !== prevState.data[index]?.viewUrl); // Triggers an update if any previewed attachment is edited by the Attachment Annotator.
|
|
111
111
|
|
|
112
112
|
if (previewObj.previewData.length != prevProps.previewObj.previewData.length || indexChanged || attachmentPreviewUrlChanged) {
|
|
113
113
|
let objChanged = previewObj.previewData.some((value, index) => {
|
|
114
|
-
return shallowDiff(value, prevProps.previewObj[index]);
|
|
114
|
+
return shallowDiff(value, prevProps.previewObj.previewData[index]);
|
|
115
115
|
});
|
|
116
116
|
|
|
117
117
|
if (objChanged || indexChanged) {
|
|
@@ -389,15 +389,14 @@ export default class AttachmentViewer extends Component {
|
|
|
389
389
|
customImageClass,
|
|
390
390
|
customChildrenClass
|
|
391
391
|
});
|
|
392
|
-
const img = /*#__PURE__*/React.createElement(AttachmentImage, _extends({
|
|
392
|
+
const img = /*#__PURE__*/React.createElement(AttachmentImage, _extends({}, imageProps, {
|
|
393
393
|
customClass: imageFrameCustomClass,
|
|
394
394
|
src: viewUrl,
|
|
395
395
|
onClick: handleImageClick,
|
|
396
396
|
alt: name,
|
|
397
397
|
dataId: dataId,
|
|
398
398
|
id: `img${i}`,
|
|
399
|
-
isCover: false
|
|
400
|
-
}, imageProps, {
|
|
399
|
+
isCover: false,
|
|
401
400
|
imageRef: resolvedImageRef
|
|
402
401
|
}), children);
|
|
403
402
|
return typeof renderCustomImagePreviewElement === 'function' ? renderCustomImagePreviewElement({
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
height: var(--zd_size48) ;
|
|
3
3
|
position: relative;
|
|
4
4
|
z-index: 1;
|
|
5
|
-
padding-block:0 ;
|
|
5
|
+
padding-block: 0 ;
|
|
6
6
|
padding-inline: var(--zd_size15) ;
|
|
7
7
|
composes: alignVertical from '~@zohodesk/components/es/common/common.module.css';
|
|
8
8
|
background-color: var(--zdt_attachmentviewer_header_bg);
|
|
@@ -10,20 +10,13 @@
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
.title {
|
|
13
|
+
padding-inline-end: var(--zd_size15) ;
|
|
13
14
|
max-width: 50% ;
|
|
14
15
|
composes: dotted from '~@zohodesk/components/es/common/common.module.css';
|
|
15
16
|
}
|
|
16
17
|
|
|
17
|
-
[dir=ltr] .title {
|
|
18
|
-
padding-right: var(--zd_size15) ;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
[dir=rtl] .title {
|
|
22
|
-
padding-left: var(--zd_size15) ;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
18
|
.count {
|
|
26
|
-
padding-block:0 ;
|
|
19
|
+
padding-block: 0 ;
|
|
27
20
|
padding-inline: var(--zd_size10) ;
|
|
28
21
|
position: absolute;
|
|
29
22
|
composes: xMiddle from '~@zohodesk/components/es/common/common.module.css';
|
|
@@ -80,7 +73,7 @@
|
|
|
80
73
|
|
|
81
74
|
.preview {
|
|
82
75
|
margin-block: var(--zd_size20) ;
|
|
83
|
-
margin-inline:0 ;
|
|
76
|
+
margin-inline: 0 ;
|
|
84
77
|
composes: posrel from '~@zohodesk/components/es/common/common.module.css';
|
|
85
78
|
text-align: center;
|
|
86
79
|
}
|
|
@@ -136,7 +129,7 @@
|
|
|
136
129
|
}
|
|
137
130
|
|
|
138
131
|
.listContainer {
|
|
139
|
-
padding-block:0 ;
|
|
132
|
+
padding-block: 0 ;
|
|
140
133
|
padding-inline: var(--zd_size18) ;
|
|
141
134
|
}
|
|
142
135
|
|
|
@@ -324,7 +317,7 @@
|
|
|
324
317
|
}
|
|
325
318
|
|
|
326
319
|
.authorName {
|
|
327
|
-
margin-block:0 ;
|
|
320
|
+
margin-block: 0 ;
|
|
328
321
|
margin-inline: var(--zd_size10) ;
|
|
329
322
|
font-size: var(--zd_font_size15) ;
|
|
330
323
|
color: var(--zdt_attachmentviewer_title_text);
|
|
@@ -364,4 +357,4 @@
|
|
|
364
357
|
color: var(--zdt_attachmentviewer_title_text);
|
|
365
358
|
padding: var(--zd_size2) ;
|
|
366
359
|
margin: auto ;
|
|
367
|
-
}
|
|
360
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DUMMY_OBJECT } from "../../utils/General";
|
|
1
2
|
export const AttachmentImage_defaultProps = {
|
|
2
3
|
dataId: 'AttachmentImage',
|
|
3
4
|
customClass: {
|
|
@@ -11,7 +12,7 @@ export const AttachmentViewer_defaultProps = {
|
|
|
11
12
|
maintainZoom: false,
|
|
12
13
|
isActive: false,
|
|
13
14
|
dataId: 'AttachmentViewer',
|
|
14
|
-
i18nKeys:
|
|
15
|
-
customProps:
|
|
15
|
+
i18nKeys: DUMMY_OBJECT,
|
|
16
|
+
customProps: DUMMY_OBJECT,
|
|
16
17
|
showCount: true
|
|
17
18
|
};
|
|
@@ -20,9 +20,6 @@ export const AttachmentImage_propTypes = {
|
|
|
20
20
|
};
|
|
21
21
|
export const AttachmentViewer_propTypes = {
|
|
22
22
|
hideAttachmentViewer: PropTypes.func,
|
|
23
|
-
imageRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
24
|
-
current: PropTypes.any
|
|
25
|
-
})]),
|
|
26
23
|
i18nKeys: PropTypes.shape({
|
|
27
24
|
nextText: PropTypes.string,
|
|
28
25
|
previousText: PropTypes.string,
|
|
@@ -35,7 +32,7 @@ export const AttachmentViewer_propTypes = {
|
|
|
35
32
|
showText: PropTypes.string,
|
|
36
33
|
previewUnsupportedText: PropTypes.string
|
|
37
34
|
}),
|
|
38
|
-
needDownload: PropTypes.
|
|
35
|
+
needDownload: PropTypes.bool,
|
|
39
36
|
previewObj: PropTypes.object,
|
|
40
37
|
responsiveId: PropTypes.string,
|
|
41
38
|
maintainZoom: PropTypes.bool,
|
|
@@ -48,6 +45,7 @@ export const AttachmentViewer_propTypes = {
|
|
|
48
45
|
document: PropTypes.arrayOf(PropTypes.string)
|
|
49
46
|
}),
|
|
50
47
|
renderUnSupportedElement: PropTypes.func,
|
|
48
|
+
renderCustomImagePreviewElement: PropTypes.func,
|
|
51
49
|
customProps: PropTypes.shape({
|
|
52
50
|
avatarProps: PropTypes.exact(AvatarProps)
|
|
53
51
|
}),
|
|
@@ -15,7 +15,7 @@ var _propTypes = require("./props/propTypes");
|
|
|
15
15
|
|
|
16
16
|
var _Layout = require("@zohodesk/components/es/Layout");
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _Icon = _interopRequireDefault(require("@zohodesk/icons/es/Icon"));
|
|
19
19
|
|
|
20
20
|
var _Avatar = _interopRequireDefault(require("@zohodesk/components/es/Avatar/Avatar"));
|
|
21
21
|
|
|
@@ -187,16 +187,18 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
187
187
|
}, {
|
|
188
188
|
key: "componentDidUpdate",
|
|
189
189
|
value: function componentDidUpdate(prevProps, prevState) {
|
|
190
|
-
var _previewObj$previewDa, _prevState$data$;
|
|
191
|
-
|
|
192
190
|
var previewObj = this.props.previewObj;
|
|
193
191
|
var selectedIndex = this.state.selectedIndex;
|
|
194
192
|
var indexChanged = previewObj.selectedIndex != prevProps.previewObj.selectedIndex;
|
|
195
|
-
var attachmentPreviewUrlChanged =
|
|
193
|
+
var attachmentPreviewUrlChanged = previewObj.previewData.some(function (value, index) {
|
|
194
|
+
var _prevState$data$index;
|
|
195
|
+
|
|
196
|
+
return (value === null || value === void 0 ? void 0 : value.viewUrl) !== ((_prevState$data$index = prevState.data[index]) === null || _prevState$data$index === void 0 ? void 0 : _prevState$data$index.viewUrl);
|
|
197
|
+
}); // Triggers an update if any previewed attachment is edited by the Attachment Annotator.
|
|
196
198
|
|
|
197
199
|
if (previewObj.previewData.length != prevProps.previewObj.previewData.length || indexChanged || attachmentPreviewUrlChanged) {
|
|
198
200
|
var objChanged = previewObj.previewData.some(function (value, index) {
|
|
199
|
-
return (0, _General.shallowDiff)(value, prevProps.previewObj[index]);
|
|
201
|
+
return (0, _General.shallowDiff)(value, prevProps.previewObj.previewData[index]);
|
|
200
202
|
});
|
|
201
203
|
|
|
202
204
|
if (objChanged || indexChanged) {
|
|
@@ -412,7 +414,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
412
414
|
} : fileUnknown;
|
|
413
415
|
var iconName = fileDetails.iconName,
|
|
414
416
|
iconSize = fileDetails.iconSize;
|
|
415
|
-
return /*#__PURE__*/_react["default"].createElement(
|
|
417
|
+
return /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
|
|
416
418
|
iconClass: _AttachmentViewerModule["default"].prevFooterIcon,
|
|
417
419
|
name: iconName,
|
|
418
420
|
size: iconSize,
|
|
@@ -484,15 +486,14 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
484
486
|
customChildrenClass: customChildrenClass
|
|
485
487
|
});
|
|
486
488
|
|
|
487
|
-
var img = /*#__PURE__*/_react["default"].createElement(_AttachmentImage["default"], _extends({
|
|
489
|
+
var img = /*#__PURE__*/_react["default"].createElement(_AttachmentImage["default"], _extends({}, imageProps, {
|
|
488
490
|
customClass: imageFrameCustomClass,
|
|
489
491
|
src: viewUrl,
|
|
490
492
|
onClick: handleImageClick,
|
|
491
493
|
alt: name,
|
|
492
494
|
dataId: dataId,
|
|
493
495
|
id: "img".concat(i),
|
|
494
|
-
isCover: false
|
|
495
|
-
}, imageProps, {
|
|
496
|
+
isCover: false,
|
|
496
497
|
imageRef: resolvedImageRef
|
|
497
498
|
}), children);
|
|
498
499
|
|
|
@@ -791,7 +792,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
791
792
|
}, /*#__PURE__*/_react["default"].createElement("button", {
|
|
792
793
|
className: _AttachmentViewerModule["default"].btn,
|
|
793
794
|
"aria-label": i18nKeys.previousText
|
|
794
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
|
795
|
+
}, /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
|
|
795
796
|
name: "ZD-arrowLeft3",
|
|
796
797
|
iconClass: _AttachmentViewerModule["default"].arrow,
|
|
797
798
|
dataId: "leftAttachNav",
|
|
@@ -812,7 +813,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
812
813
|
}, /*#__PURE__*/_react["default"].createElement("button", {
|
|
813
814
|
className: _AttachmentViewerModule["default"].btn,
|
|
814
815
|
"aria-label": i18nKeys.nextText
|
|
815
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
|
816
|
+
}, /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
|
|
816
817
|
name: "ZD-arrowRight3",
|
|
817
818
|
iconClass: _AttachmentViewerModule["default"].arrow,
|
|
818
819
|
dataId: "rightAttachNav",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
height: var(--zd_size48) ;
|
|
3
3
|
position: relative;
|
|
4
4
|
z-index: 1;
|
|
5
|
-
padding-block:0 ;
|
|
5
|
+
padding-block: 0 ;
|
|
6
6
|
padding-inline: var(--zd_size15) ;
|
|
7
7
|
composes: alignVertical from '~@zohodesk/components/es/common/common.module.css';
|
|
8
8
|
background-color: var(--zdt_attachmentviewer_header_bg);
|
|
@@ -10,20 +10,13 @@
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
.title {
|
|
13
|
+
padding-inline-end: var(--zd_size15) ;
|
|
13
14
|
max-width: 50% ;
|
|
14
15
|
composes: dotted from '~@zohodesk/components/es/common/common.module.css';
|
|
15
16
|
}
|
|
16
17
|
|
|
17
|
-
[dir=ltr] .title {
|
|
18
|
-
padding-right: var(--zd_size15) ;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
[dir=rtl] .title {
|
|
22
|
-
padding-left: var(--zd_size15) ;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
18
|
.count {
|
|
26
|
-
padding-block:0 ;
|
|
19
|
+
padding-block: 0 ;
|
|
27
20
|
padding-inline: var(--zd_size10) ;
|
|
28
21
|
position: absolute;
|
|
29
22
|
composes: xMiddle from '~@zohodesk/components/es/common/common.module.css';
|
|
@@ -80,7 +73,7 @@
|
|
|
80
73
|
|
|
81
74
|
.preview {
|
|
82
75
|
margin-block: var(--zd_size20) ;
|
|
83
|
-
margin-inline:0 ;
|
|
76
|
+
margin-inline: 0 ;
|
|
84
77
|
composes: posrel from '~@zohodesk/components/es/common/common.module.css';
|
|
85
78
|
text-align: center;
|
|
86
79
|
}
|
|
@@ -136,7 +129,7 @@
|
|
|
136
129
|
}
|
|
137
130
|
|
|
138
131
|
.listContainer {
|
|
139
|
-
padding-block:0 ;
|
|
132
|
+
padding-block: 0 ;
|
|
140
133
|
padding-inline: var(--zd_size18) ;
|
|
141
134
|
}
|
|
142
135
|
|
|
@@ -324,7 +317,7 @@
|
|
|
324
317
|
}
|
|
325
318
|
|
|
326
319
|
.authorName {
|
|
327
|
-
margin-block:0 ;
|
|
320
|
+
margin-block: 0 ;
|
|
328
321
|
margin-inline: var(--zd_size10) ;
|
|
329
322
|
font-size: var(--zd_font_size15) ;
|
|
330
323
|
color: var(--zdt_attachmentviewer_title_text);
|
|
@@ -364,4 +357,4 @@
|
|
|
364
357
|
color: var(--zdt_attachmentviewer_title_text);
|
|
365
358
|
padding: var(--zd_size2) ;
|
|
366
359
|
margin: auto ;
|
|
367
|
-
}
|
|
360
|
+
}
|
|
@@ -4,6 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.AttachmentViewer_defaultProps = exports.AttachmentImage_defaultProps = void 0;
|
|
7
|
+
|
|
8
|
+
var _General = require("../../utils/General");
|
|
9
|
+
|
|
7
10
|
var AttachmentImage_defaultProps = {
|
|
8
11
|
dataId: 'AttachmentImage',
|
|
9
12
|
customClass: {
|
|
@@ -18,8 +21,8 @@ var AttachmentViewer_defaultProps = {
|
|
|
18
21
|
maintainZoom: false,
|
|
19
22
|
isActive: false,
|
|
20
23
|
dataId: 'AttachmentViewer',
|
|
21
|
-
i18nKeys:
|
|
22
|
-
customProps:
|
|
24
|
+
i18nKeys: _General.DUMMY_OBJECT,
|
|
25
|
+
customProps: _General.DUMMY_OBJECT,
|
|
23
26
|
showCount: true
|
|
24
27
|
};
|
|
25
28
|
exports.AttachmentViewer_defaultProps = AttachmentViewer_defaultProps;
|
|
@@ -32,9 +32,6 @@ var AttachmentImage_propTypes = {
|
|
|
32
32
|
exports.AttachmentImage_propTypes = AttachmentImage_propTypes;
|
|
33
33
|
var AttachmentViewer_propTypes = {
|
|
34
34
|
hideAttachmentViewer: _propTypes["default"].func,
|
|
35
|
-
imageRef: _propTypes["default"].oneOfType([_propTypes["default"].func, _propTypes["default"].shape({
|
|
36
|
-
current: _propTypes["default"].any
|
|
37
|
-
})]),
|
|
38
35
|
i18nKeys: _propTypes["default"].shape({
|
|
39
36
|
nextText: _propTypes["default"].string,
|
|
40
37
|
previousText: _propTypes["default"].string,
|
|
@@ -47,7 +44,7 @@ var AttachmentViewer_propTypes = {
|
|
|
47
44
|
showText: _propTypes["default"].string,
|
|
48
45
|
previewUnsupportedText: _propTypes["default"].string
|
|
49
46
|
}),
|
|
50
|
-
needDownload: _propTypes["default"].
|
|
47
|
+
needDownload: _propTypes["default"].bool,
|
|
51
48
|
previewObj: _propTypes["default"].object,
|
|
52
49
|
responsiveId: _propTypes["default"].string,
|
|
53
50
|
maintainZoom: _propTypes["default"].bool,
|
|
@@ -60,6 +57,7 @@ var AttachmentViewer_propTypes = {
|
|
|
60
57
|
document: _propTypes["default"].arrayOf(_propTypes["default"].string)
|
|
61
58
|
}),
|
|
62
59
|
renderUnSupportedElement: _propTypes["default"].func,
|
|
60
|
+
renderCustomImagePreviewElement: _propTypes["default"].func,
|
|
63
61
|
customProps: _propTypes["default"].shape({
|
|
64
62
|
avatarProps: _propTypes["default"].exact(_propTypes2.propTypes)
|
|
65
63
|
}),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zohodesk/dot",
|
|
3
|
-
"version": "1.0.0-temp-230.
|
|
3
|
+
"version": "1.0.0-temp-230.3",
|
|
4
4
|
"main": "lib/index",
|
|
5
5
|
"module": "es/index.js",
|
|
6
6
|
"private": false,
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"snap-update": "npm run test-clean && npm run test -- -u",
|
|
35
35
|
"sstest": "react-cli sstest",
|
|
36
36
|
"common_package_build": "cd ../common && npm run build && cd ../dot",
|
|
37
|
-
"prepublishOnly": "node ../prePublish.js && npm run css:review",
|
|
37
|
+
"prepublishOnly": "node ../prePublish.js && npm run css:review && npm run review:props",
|
|
38
38
|
"postpublish": "node ../postPublish.js",
|
|
39
39
|
"test-clean": "react-cli clean ./coverage && react-cli clean ./unittest react-cli clean ./es && react-cli clean ./lib && react-cli clean ./package-lock.json && react-cli clean ./result.json",
|
|
40
40
|
"download": "npm run downloadOnly && cd ../ && npm run download",
|