@zohodesk/dot 1.0.0-temp-198.3.3 → 1.0.0-temp-199
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 +39 -0
- package/assets/Appearance/dark/mode/Dot_DarkMode.module.css +1 -0
- package/assets/Appearance/light/mode/Dot_LightMode.module.css +1 -0
- package/assets/Appearance/pureDark/mode/Dot_PureDarkMode.module.css +1 -0
- package/es/ActionButton/ActionButton.module.css +192 -192
- package/es/AlphabeticList/AlphabeticList.module.css +57 -57
- package/es/AttachmentViewer/AttachmentImage.js +68 -32
- package/es/AttachmentViewer/AttachmentViewer.js +120 -41
- package/es/AttachmentViewer/AttachmentViewer.module.css +364 -352
- package/es/AttachmentViewer/__tests__/AttachmentImage.spec.js +63 -13
- package/es/AttachmentViewer/__tests__/__snapshots__/AttachmentImage.spec.js.snap +9 -5
- package/es/AttachmentViewer/__tests__/__snapshots__/AttachmentViewer.spec.js.snap +16 -117
- package/es/AttachmentViewer/props/defaultProps.js +5 -1
- package/es/AttachmentViewer/props/propTypes.js +7 -3
- package/es/AttachmentViewer/utils.js +49 -0
- package/es/ChannelIcon/ChannelIcon.module.css +225 -225
- package/es/FormAction/FormAction.module.css +100 -100
- package/es/IconButton/IconButton.module.css +22 -22
- package/es/Image/Image.js +6 -2
- package/es/Image/props/propTypes.js +3 -1
- package/es/TagWithIcon/TagWithIcon.module.css +66 -66
- package/es/avatar/AvatarIcon/AvatarIcon.module.css +58 -58
- package/es/emptystate/CommonEmptyState/CommonEmptyState.module.css +92 -92
- package/es/form/fields/CurrencyField/CurrencyField.js +2 -1
- package/es/form/fields/TextEditor/TextEditor.js +64 -64
- package/es/form/fields/TextEditor/TextEditor.module.css +73 -61
- package/es/form/fields/TextEditor/__tests__/__snapshots__/TextEditor.spec.js.snap +1 -1
- package/es/form/fields/TextEditor/props/defaultProps.js +4 -1
- package/es/form/fields/TextEditor/props/propTypes.js +10 -3
- package/es/form/fields/ValidationMessage/ValidationMessage.module.css +27 -27
- package/es/layout/SubtabLayout/SubtabLayout.module.css +164 -164
- package/es/list/Comment/Comment.module.css +29 -29
- package/es/list/Dot/Dot.module.css +15 -15
- package/es/list/ListLayout/ListLayout.module.css +79 -79
- package/es/list/Subject/Subject.module.css +34 -34
- package/es/list/Thread/Thread.module.css +42 -42
- package/es/list/status/StatusDropdown/StatusDropdown.js +8 -2
- package/es/list/status/StatusDropdown/__tests__/StatusDropdown.spec.js +16 -0
- package/es/list/status/StatusDropdown/__tests__/__snapshots__/StatusDropdown.spec.js.snap +14 -0
- package/es/list/status/StatusDropdown/props/propTypes.js +2 -0
- package/es/lookup/header/Search/LookupSearch.module.css +26 -26
- package/es/lookup/header/Search/Search.js +55 -38
- package/es/lookup/header/Search/props/defaultProps.js +2 -1
- package/es/lookup/header/Search/props/propTypes.js +5 -1
- package/es/utils/editorUtils.js +6 -6
- package/es/v1/AttachmentViewer/AttachmentImage.js +44 -23
- package/es/v1/AttachmentViewer/AttachmentViewer.js +120 -41
- package/es/v1/AttachmentViewer/props/propTypes.js +7 -3
- package/es/v1/Image/Image.js +6 -2
- package/es/v1/Image/props/propTypes.js +3 -1
- package/es/v1/form/fields/CurrencyField/CurrencyField.js +2 -1
- package/es/v1/form/fields/TextEditor/TextEditor.js +63 -64
- package/es/v1/form/fields/TextEditor/props/defaultProps.js +4 -1
- package/es/v1/form/fields/TextEditor/props/propTypes.js +10 -3
- package/es/v1/list/status/StatusDropdown/StatusDropdown.js +8 -2
- package/es/v1/list/status/StatusDropdown/props/propTypes.js +2 -0
- package/es/v1/utils/editorUtils.js +6 -6
- package/es/version2/GlobalNotification/GlobalNotification.module.css +177 -177
- package/es/version2/lookup/AlertHeader/css/AlertHeaderNew.module.css +87 -87
- package/es/version2/notification/DesktopNotificationHeader/DesktopNotificationHeader.module.css +132 -132
- package/lib/ActionButton/ActionButton.module.css +192 -192
- package/lib/AlphabeticList/AlphabeticList.module.css +57 -57
- package/lib/AttachmentViewer/AttachmentImage.js +74 -36
- package/lib/AttachmentViewer/AttachmentViewer.js +151 -70
- package/lib/AttachmentViewer/AttachmentViewer.module.css +364 -352
- package/lib/AttachmentViewer/__tests__/AttachmentImage.spec.js +64 -13
- package/lib/AttachmentViewer/__tests__/__snapshots__/AttachmentImage.spec.js.snap +9 -5
- package/lib/AttachmentViewer/__tests__/__snapshots__/AttachmentViewer.spec.js.snap +16 -117
- package/lib/AttachmentViewer/props/defaultProps.js +5 -1
- package/lib/AttachmentViewer/props/propTypes.js +7 -3
- package/lib/AttachmentViewer/utils.js +60 -1
- package/lib/ChannelIcon/ChannelIcon.module.css +225 -225
- package/lib/FormAction/FormAction.module.css +100 -100
- package/lib/IconButton/IconButton.module.css +22 -22
- package/lib/Image/Image.js +6 -2
- package/lib/Image/props/propTypes.js +3 -1
- package/lib/TagWithIcon/TagWithIcon.module.css +66 -66
- package/lib/avatar/AvatarIcon/AvatarIcon.module.css +58 -58
- package/lib/emptystate/CommonEmptyState/CommonEmptyState.module.css +92 -92
- package/lib/form/fields/CurrencyField/CurrencyField.js +2 -1
- package/lib/form/fields/TextEditor/TextEditor.js +74 -74
- package/lib/form/fields/TextEditor/TextEditor.module.css +73 -61
- package/lib/form/fields/TextEditor/__tests__/__snapshots__/TextEditor.spec.js.snap +1 -1
- package/lib/form/fields/TextEditor/props/defaultProps.js +4 -1
- package/lib/form/fields/TextEditor/props/propTypes.js +10 -3
- package/lib/form/fields/ValidationMessage/ValidationMessage.module.css +27 -27
- package/lib/layout/SubtabLayout/SubtabLayout.module.css +164 -164
- package/lib/list/Comment/Comment.module.css +29 -29
- package/lib/list/Dot/Dot.module.css +15 -15
- package/lib/list/ListLayout/ListLayout.module.css +79 -79
- package/lib/list/Subject/Subject.module.css +34 -34
- package/lib/list/Thread/Thread.module.css +42 -42
- package/lib/list/status/StatusDropdown/StatusDropdown.js +8 -2
- package/lib/list/status/StatusDropdown/__tests__/StatusDropdown.spec.js +14 -0
- package/lib/list/status/StatusDropdown/__tests__/__snapshots__/StatusDropdown.spec.js.snap +14 -0
- package/lib/list/status/StatusDropdown/props/propTypes.js +1 -1
- package/lib/lookup/header/Search/LookupSearch.module.css +26 -26
- package/lib/lookup/header/Search/Search.js +73 -64
- package/lib/lookup/header/Search/props/defaultProps.js +2 -1
- package/lib/lookup/header/Search/props/propTypes.js +9 -3
- package/lib/utils/editorUtils.js +6 -5
- package/lib/v1/AttachmentViewer/AttachmentImage.js +52 -24
- package/lib/v1/AttachmentViewer/AttachmentViewer.js +151 -70
- package/lib/v1/AttachmentViewer/props/propTypes.js +7 -3
- package/lib/v1/Image/Image.js +6 -2
- package/lib/v1/Image/props/propTypes.js +3 -1
- package/lib/v1/form/fields/CurrencyField/CurrencyField.js +2 -1
- package/lib/v1/form/fields/TextEditor/TextEditor.js +73 -74
- package/lib/v1/form/fields/TextEditor/props/defaultProps.js +4 -1
- package/lib/v1/form/fields/TextEditor/props/propTypes.js +10 -3
- package/lib/v1/list/status/StatusDropdown/StatusDropdown.js +8 -2
- package/lib/v1/list/status/StatusDropdown/props/propTypes.js +1 -1
- package/lib/v1/utils/editorUtils.js +6 -5
- package/lib/version2/GlobalNotification/GlobalNotification.module.css +177 -177
- package/lib/version2/lookup/AlertHeader/css/AlertHeaderNew.module.css +87 -87
- package/lib/version2/notification/DesktopNotificationHeader/DesktopNotificationHeader.module.css +132 -132
- package/package.json +6 -6
- package/result.json +1 -1
- package/unittest/index.html +6 -2
|
@@ -9,10 +9,16 @@ exports["default"] = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
|
|
12
|
+
var _hooks = require("@zohodesk/hooks");
|
|
13
|
+
|
|
14
|
+
var _Layout = require("@zohodesk/components/es/Layout");
|
|
15
|
+
|
|
12
16
|
var _defaultProps = require("./props/defaultProps");
|
|
13
17
|
|
|
14
18
|
var _propTypes = require("./props/propTypes");
|
|
15
19
|
|
|
20
|
+
var _utils = require("../../AttachmentViewer/utils");
|
|
21
|
+
|
|
16
22
|
var _Image = _interopRequireDefault(require("../Image/Image"));
|
|
17
23
|
|
|
18
24
|
var _AttachmentViewerModule = _interopRequireDefault(require("../../AttachmentViewer/AttachmentViewer.module.css"));
|
|
@@ -36,51 +42,73 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
36
42
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
37
43
|
|
|
38
44
|
var AttachmentImage = function AttachmentImage(props) {
|
|
39
|
-
var
|
|
40
|
-
|
|
45
|
+
var onLoad = props.onLoad,
|
|
46
|
+
onError = props.onError,
|
|
41
47
|
src = props.src,
|
|
42
48
|
onClick = props.onClick,
|
|
43
49
|
alt = props.alt,
|
|
44
50
|
dataId = props.dataId,
|
|
45
51
|
id = props.id,
|
|
46
|
-
|
|
47
|
-
isCover = props.isCover
|
|
48
|
-
|
|
52
|
+
customClass = props.customClass,
|
|
53
|
+
isCover = props.isCover,
|
|
54
|
+
children = props.children;
|
|
55
|
+
var _customClass$customIm = customClass.customImageClass,
|
|
56
|
+
customImageClass = _customClass$customIm === void 0 ? '' : _customClass$customIm,
|
|
57
|
+
_customClass$customCh = customClass.customChildrenClass,
|
|
58
|
+
customChildrenClass = _customClass$customCh === void 0 ? '' : _customClass$customCh;
|
|
49
59
|
|
|
50
60
|
var _useState = (0, _react.useState)(true),
|
|
51
61
|
_useState2 = _slicedToArray(_useState, 2),
|
|
52
62
|
isLoading = _useState2[0],
|
|
53
63
|
setLoading = _useState2[1];
|
|
54
64
|
|
|
55
|
-
var
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
65
|
+
var _useState3 = (0, _react.useState)(false),
|
|
66
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
67
|
+
isImageValid = _useState4[0],
|
|
68
|
+
setImageValidity = _useState4[1];
|
|
59
69
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
image.addEventListener('load', imgLoad);
|
|
64
|
-
} else {
|
|
70
|
+
function handleImageValidation() {
|
|
71
|
+
(0, _utils.checkImageValidity)(src).then(function (isValid) {
|
|
72
|
+
setImageValidity(isValid);
|
|
65
73
|
setLoading(false);
|
|
66
|
-
}
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
(0, _react.useEffect)(function () {
|
|
78
|
+
handleImageValidation();
|
|
67
79
|
}, []);
|
|
80
|
+
(0, _hooks.useEffectCallOnlyAfterState)(function () {
|
|
81
|
+
setLoading(true);
|
|
82
|
+
handleImageValidation();
|
|
83
|
+
}, [src]);
|
|
84
|
+
|
|
85
|
+
function renderImage() {
|
|
86
|
+
return /*#__PURE__*/_react["default"].createElement(_Image["default"], {
|
|
87
|
+
htmlId: id,
|
|
88
|
+
dataId: isImageValid ? dataId : "".concat(dataId, "_alt"),
|
|
89
|
+
src: src,
|
|
90
|
+
onClick: onClick,
|
|
91
|
+
className: customImageClass,
|
|
92
|
+
alt: alt,
|
|
93
|
+
isCover: isCover,
|
|
94
|
+
onLoad: onLoad,
|
|
95
|
+
onError: onError
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
|
|
68
99
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, isLoading ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
69
100
|
className: "".concat(_AttachmentViewerModule["default"].spinLoad),
|
|
70
101
|
"data-id": "".concat(dataId, "_loader"),
|
|
71
102
|
"data-test-id": "".concat(dataId, "_loader")
|
|
72
103
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
73
104
|
className: _AttachmentViewerModule["default"].loader
|
|
74
|
-
})) :
|
|
105
|
+
})) : isImageValid ? renderImage() : children ? /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
|
|
106
|
+
align: "both",
|
|
75
107
|
htmlId: id,
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
className: "".concat(isLoading ? _AttachmentViewerModule["default"].hide : '', " ").concat(className),
|
|
81
|
-
alt: alt,
|
|
82
|
-
isCover: isCover
|
|
83
|
-
}));
|
|
108
|
+
dataId: "".concat(dataId, "_custom"),
|
|
109
|
+
className: customChildrenClass
|
|
110
|
+
}, children) : renderImage() //alt ui
|
|
111
|
+
);
|
|
84
112
|
};
|
|
85
113
|
|
|
86
114
|
AttachmentImage.propTypes = _propTypes.AttachmentImage_propTypes;
|
|
@@ -33,6 +33,10 @@ var _FreezeLayer = _interopRequireDefault(require("../FreezeLayer/FreezeLayer"))
|
|
|
33
33
|
|
|
34
34
|
var _Attachment = require("../../AttachmentViewer/Attachment");
|
|
35
35
|
|
|
36
|
+
var _utils = require("../../AttachmentViewer/utils");
|
|
37
|
+
|
|
38
|
+
var _audio_thumbnail = _interopRequireDefault(require("../../../images/audio_thumbnail.png"));
|
|
39
|
+
|
|
36
40
|
var _General = require("../../utils/General");
|
|
37
41
|
|
|
38
42
|
var _AttachmentViewerModule = _interopRequireDefault(require("../../AttachmentViewer/AttachmentViewer.module.css"));
|
|
@@ -43,6 +47,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
43
47
|
|
|
44
48
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
45
49
|
|
|
50
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
51
|
+
|
|
46
52
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
47
53
|
|
|
48
54
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -95,7 +101,10 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
95
101
|
index: _this.props.previewObj.selectedIndex,
|
|
96
102
|
data: _this.props.previewObj ? _this.props.previewObj.previewData : [],
|
|
97
103
|
dataList: []
|
|
98
|
-
})
|
|
104
|
+
}),
|
|
105
|
+
canOpenInNewTab: false,
|
|
106
|
+
canZoom: false,
|
|
107
|
+
isPreviewAttachmentValid: false
|
|
99
108
|
};
|
|
100
109
|
_this.togglePViewList = _this.togglePViewList.bind(_assertThisInitialized(_this));
|
|
101
110
|
_this.changeSelectedIndex = _this.changeSelectedIndex.bind(_assertThisInitialized(_this));
|
|
@@ -107,13 +116,20 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
107
116
|
_this.getNextId = (0, _IdProvider.getUniqueId)(_assertThisInitialized(_this));
|
|
108
117
|
_this.getUpdateDataList = _this.getUpdateDataList.bind(_assertThisInitialized(_this));
|
|
109
118
|
_this.zoomMaintain = _this.zoomMaintain.bind(_assertThisInitialized(_this));
|
|
119
|
+
_this.handleMenuValidation = _this.handleMenuValidation.bind(_assertThisInitialized(_this));
|
|
110
120
|
return _this;
|
|
111
121
|
}
|
|
112
122
|
|
|
113
123
|
_createClass(AttachmentViewer, [{
|
|
124
|
+
key: "componentDidMount",
|
|
125
|
+
value: function componentDidMount() {
|
|
126
|
+
this.handleMenuValidation();
|
|
127
|
+
}
|
|
128
|
+
}, {
|
|
114
129
|
key: "componentDidUpdate",
|
|
115
|
-
value: function componentDidUpdate(prevProps) {
|
|
130
|
+
value: function componentDidUpdate(prevProps, prevState) {
|
|
116
131
|
var previewObj = this.props.previewObj;
|
|
132
|
+
var selectedIndex = this.state.selectedIndex;
|
|
117
133
|
var indexChanged = previewObj.selectedIndex != prevProps.previewObj.selectedIndex;
|
|
118
134
|
|
|
119
135
|
if (previewObj.previewData.length != prevProps.previewObj.previewData.length || indexChanged) {
|
|
@@ -134,18 +150,48 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
134
150
|
});
|
|
135
151
|
}
|
|
136
152
|
}
|
|
153
|
+
|
|
154
|
+
if (prevState.selectedIndex != selectedIndex) {
|
|
155
|
+
this.handleMenuValidation();
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}, {
|
|
159
|
+
key: "handleMenuValidation",
|
|
160
|
+
value: function handleMenuValidation() {
|
|
161
|
+
var _this2 = this;
|
|
162
|
+
|
|
163
|
+
var _this$state = this.state,
|
|
164
|
+
data = _this$state.data,
|
|
165
|
+
selectedIndex = _this$state.selectedIndex;
|
|
166
|
+
var selectedAttachment = data[selectedIndex] || {};
|
|
167
|
+
var selectedAttachmentViewUrl = selectedAttachment.viewUrl;
|
|
168
|
+
var selectedAttachmentDownloadUrl = selectedAttachment.downloadUrl;
|
|
169
|
+
var selectedAttachmentName = selectedAttachment.name;
|
|
170
|
+
(0, _utils.checkFileSourcesValidation)({
|
|
171
|
+
fileName: selectedAttachmentName,
|
|
172
|
+
viewURL: selectedAttachmentViewUrl
|
|
173
|
+
}).then(function (fileSourceValidation) {
|
|
174
|
+
var isViewURLValid = fileSourceValidation.isViewURLValid,
|
|
175
|
+
canZoom = fileSourceValidation.canZoom;
|
|
176
|
+
|
|
177
|
+
_this2.setState({
|
|
178
|
+
isPreviewAttachmentValid: isViewURLValid,
|
|
179
|
+
canZoom: canZoom,
|
|
180
|
+
canOpenInNewTab: isViewURLValid
|
|
181
|
+
});
|
|
182
|
+
});
|
|
137
183
|
}
|
|
138
184
|
}, {
|
|
139
185
|
key: "togglePViewList",
|
|
140
186
|
value: function togglePViewList() {
|
|
141
|
-
var
|
|
187
|
+
var _this3 = this;
|
|
142
188
|
|
|
143
189
|
this.setState(function (prevState) {
|
|
144
190
|
return {
|
|
145
191
|
isPViewListOpen: !prevState.isPViewListOpen
|
|
146
192
|
};
|
|
147
193
|
}, function () {
|
|
148
|
-
|
|
194
|
+
_this3.focusSelectedImg(_this3.state.selectedIndex);
|
|
149
195
|
});
|
|
150
196
|
}
|
|
151
197
|
}, {
|
|
@@ -153,13 +199,11 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
153
199
|
value: function zoomOut(ele) {
|
|
154
200
|
this.setState({
|
|
155
201
|
isZoomed: false
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
img.classList.add(_AttachmentViewerModule["default"].normalImg);
|
|
162
|
-
}
|
|
202
|
+
}); // const img = document.getElementById(`img${ele}`);
|
|
203
|
+
// if (img) {
|
|
204
|
+
// img.classList.remove(style.zoomedImg);
|
|
205
|
+
// img.classList.add(style.normalImg);
|
|
206
|
+
// }
|
|
163
207
|
}
|
|
164
208
|
}, {
|
|
165
209
|
key: "zoomIn",
|
|
@@ -191,12 +235,11 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
191
235
|
top: 0,
|
|
192
236
|
left: 0
|
|
193
237
|
};
|
|
194
|
-
}
|
|
238
|
+
} // if (img) {
|
|
239
|
+
// img.classList.remove(style.normalImg);
|
|
240
|
+
// img.classList.add(style.zoomedImg);
|
|
241
|
+
// }
|
|
195
242
|
|
|
196
|
-
if (img) {
|
|
197
|
-
img.classList.remove(_AttachmentViewerModule["default"].normalImg);
|
|
198
|
-
img.classList.add(_AttachmentViewerModule["default"].zoomedImg);
|
|
199
|
-
}
|
|
200
243
|
|
|
201
244
|
if (moveToPosition) {
|
|
202
245
|
imgContainer.scrollLeft = (event.pageX - imgContainerPosition.left - imgUnits.left) * imgRatio.width;
|
|
@@ -242,11 +285,11 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
242
285
|
}, {
|
|
243
286
|
key: "changeSelectedIndex",
|
|
244
287
|
value: function changeSelectedIndex(index) {
|
|
245
|
-
var
|
|
288
|
+
var _this4 = this;
|
|
246
289
|
|
|
247
|
-
var _this$
|
|
248
|
-
data = _this$
|
|
249
|
-
selectedIndex = _this$
|
|
290
|
+
var _this$state2 = this.state,
|
|
291
|
+
data = _this$state2.data,
|
|
292
|
+
selectedIndex = _this$state2.selectedIndex;
|
|
250
293
|
var maintainZoom = this.props.maintainZoom;
|
|
251
294
|
maintainZoom ? this.zoomMaintain(index) : this.zoomOut(selectedIndex);
|
|
252
295
|
|
|
@@ -257,7 +300,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
257
300
|
this.setState({
|
|
258
301
|
selectedIndex: index
|
|
259
302
|
}, function () {
|
|
260
|
-
|
|
303
|
+
_this4.focusSelectedImg(index);
|
|
261
304
|
});
|
|
262
305
|
}
|
|
263
306
|
}, {
|
|
@@ -292,12 +335,14 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
292
335
|
}, {
|
|
293
336
|
key: "imgPreviewView",
|
|
294
337
|
value: function imgPreviewView() {
|
|
295
|
-
var
|
|
338
|
+
var _this5 = this;
|
|
296
339
|
|
|
297
|
-
var _this$
|
|
298
|
-
dataList = _this$
|
|
299
|
-
selectedIndex = _this$
|
|
300
|
-
isZoomed = _this$
|
|
340
|
+
var _this$state3 = this.state,
|
|
341
|
+
dataList = _this$state3.dataList,
|
|
342
|
+
selectedIndex = _this$state3.selectedIndex,
|
|
343
|
+
isZoomed = _this$state3.isZoomed,
|
|
344
|
+
canZoom = _this$state3.canZoom,
|
|
345
|
+
isPreviewAttachmentValid = _this$state3.isPreviewAttachmentValid;
|
|
301
346
|
var _this$props = this.props,
|
|
302
347
|
maintainZoom = _this$props.maintainZoom,
|
|
303
348
|
dataId = _this$props.dataId;
|
|
@@ -330,7 +375,24 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
330
375
|
return dataList.length && dataList.map(function () {
|
|
331
376
|
var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
332
377
|
var i = arguments.length > 1 ? arguments[1] : undefined;
|
|
333
|
-
var
|
|
378
|
+
var viewUrl = data.viewUrl,
|
|
379
|
+
name = data.name,
|
|
380
|
+
children = data.children,
|
|
381
|
+
_data$dataId = data.dataId,
|
|
382
|
+
dataId = _data$dataId === void 0 ? 'attachViewer' : _data$dataId,
|
|
383
|
+
_data$customClass = data.customClass,
|
|
384
|
+
customClass = _data$customClass === void 0 ? {} : _data$customClass,
|
|
385
|
+
_data$customProps = data.customProps,
|
|
386
|
+
customProps = _data$customProps === void 0 ? {} : _data$customProps;
|
|
387
|
+
var _customProps$audioPro = customProps.audioProps,
|
|
388
|
+
audioProps = _customProps$audioPro === void 0 ? {} : _customProps$audioPro,
|
|
389
|
+
_customProps$imagePro = customProps.imageProps,
|
|
390
|
+
imageProps = _customProps$imagePro === void 0 ? {} : _customProps$imagePro;
|
|
391
|
+
var _customClass$customIm = customClass.customImageClass,
|
|
392
|
+
customImageClass = _customClass$customIm === void 0 ? '' : _customClass$customIm,
|
|
393
|
+
_customClass$customCh = customClass.customChildrenClass,
|
|
394
|
+
customChildrenClass = _customClass$customCh === void 0 ? '' : _customClass$customCh;
|
|
395
|
+
var retainZoom = canZoom && selectedIndex == i && maintainZoom;
|
|
334
396
|
return /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
|
|
335
397
|
className: _AttachmentViewerModule["default"].imgBox,
|
|
336
398
|
id: "imgBox".concat(i),
|
|
@@ -341,39 +403,43 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
341
403
|
}, /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
342
404
|
className: _AttachmentViewerModule["default"].imgRef,
|
|
343
405
|
id: "imgPreviewRef".concat(i)
|
|
344
|
-
}, (0, _Attachment.isAudioFile)(
|
|
406
|
+
}, (0, _Attachment.isAudioFile)(name) ? selectedIndex == i ? /*#__PURE__*/_react["default"].createElement("video", _extends({
|
|
345
407
|
autoPlay: true,
|
|
346
408
|
controls: true,
|
|
347
409
|
className: _AttachmentViewerModule["default"].zoomIn,
|
|
348
410
|
"data-id": "".concat(dataId, "_videoPreview"),
|
|
349
411
|
"data-test-id": "".concat(dataId, "_videoPreview")
|
|
350
|
-
}, /*#__PURE__*/_react["default"].createElement("source", {
|
|
351
|
-
src:
|
|
352
|
-
type: "audio/".concat((0, _Attachment.getExtensionFromFileName)(
|
|
353
|
-
})) : null : /*#__PURE__*/_react["default"].createElement(_AttachmentImage["default"], {
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
_this4.zoomIn(e, i, true);
|
|
412
|
+
}, audioProps), /*#__PURE__*/_react["default"].createElement("source", {
|
|
413
|
+
src: viewUrl,
|
|
414
|
+
type: "audio/".concat((0, _Attachment.getExtensionFromFileName)(name))
|
|
415
|
+
})) : null : /*#__PURE__*/_react["default"].createElement(_AttachmentImage["default"], _extends({
|
|
416
|
+
customClass: {
|
|
417
|
+
customImageClass: "".concat(_AttachmentViewerModule["default"].img, " ").concat(_AttachmentViewerModule["default"].altText, "\n ").concat(canZoom || retainZoom ? isZoomed ? "".concat(_AttachmentViewerModule["default"].zoomedImg, " ").concat(_AttachmentViewerModule["default"].zoomOutCursor) : "".concat(_AttachmentViewerModule["default"].normalImg, " ").concat(_AttachmentViewerModule["default"].zoomInCursor) : '', " ").concat(customImageClass),
|
|
418
|
+
customChildrenClass: customChildrenClass
|
|
358
419
|
},
|
|
359
|
-
|
|
360
|
-
|
|
420
|
+
src: viewUrl,
|
|
421
|
+
onClick: isPreviewAttachmentValid ? isZoomed ? _this5.zoomOut.bind(_this5, i) : function (e) {
|
|
422
|
+
_this5.zoomIn(e, i, true);
|
|
423
|
+
} : undefined,
|
|
424
|
+
alt: name,
|
|
425
|
+
dataId: dataId,
|
|
361
426
|
id: "img".concat(i),
|
|
362
|
-
isImage: true,
|
|
363
427
|
isCover: false
|
|
364
|
-
})));
|
|
428
|
+
}, imageProps), children)));
|
|
365
429
|
});
|
|
366
430
|
}
|
|
367
431
|
}, {
|
|
368
432
|
key: "render",
|
|
369
433
|
value: function render() {
|
|
370
|
-
var
|
|
371
|
-
|
|
372
|
-
var _this$
|
|
373
|
-
isPViewListOpen = _this$
|
|
374
|
-
selectedIndex = _this$
|
|
375
|
-
data = _this$
|
|
376
|
-
isZoomed = _this$
|
|
434
|
+
var _this6 = this;
|
|
435
|
+
|
|
436
|
+
var _this$state4 = this.state,
|
|
437
|
+
isPViewListOpen = _this$state4.isPViewListOpen,
|
|
438
|
+
selectedIndex = _this$state4.selectedIndex,
|
|
439
|
+
data = _this$state4.data,
|
|
440
|
+
isZoomed = _this$state4.isZoomed,
|
|
441
|
+
canZoom = _this$state4.canZoom,
|
|
442
|
+
canOpenInNewTab = _this$state4.canOpenInNewTab;
|
|
377
443
|
var _this$props2 = this.props,
|
|
378
444
|
responsiveId = _this$props2.responsiveId,
|
|
379
445
|
needDownload = _this$props2.needDownload,
|
|
@@ -431,9 +497,9 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
431
497
|
align: uptoTablet ? 'bottom' : 'center',
|
|
432
498
|
wrap: "wrap",
|
|
433
499
|
isCover: false
|
|
434
|
-
}, isZoomed ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
500
|
+
}, canZoom ? isZoomed ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
435
501
|
className: uptoTablet ? _AttachmentViewerModule["default"].mobileMenu : _AttachmentViewerModule["default"].menu,
|
|
436
|
-
onClick:
|
|
502
|
+
onClick: _this6.zoomOut.bind(_this6, selectedIndex),
|
|
437
503
|
"data-id": "zoomOut",
|
|
438
504
|
"data-test-id": "zoomOut",
|
|
439
505
|
"data-title": i18nKeys.zoomOutText
|
|
@@ -448,7 +514,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
448
514
|
})) : /*#__PURE__*/_react["default"].createElement("div", {
|
|
449
515
|
className: uptoTablet ? _AttachmentViewerModule["default"].mobileMenu : _AttachmentViewerModule["default"].menu,
|
|
450
516
|
onClick: function onClick(e) {
|
|
451
|
-
return
|
|
517
|
+
return _this6.zoomIn(e, selectedIndex);
|
|
452
518
|
},
|
|
453
519
|
"data-id": "zoomIn",
|
|
454
520
|
"data-test-id": "zoomIn",
|
|
@@ -461,7 +527,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
461
527
|
a11y: {
|
|
462
528
|
ariaLabel: i18nKeys.zoomInText
|
|
463
529
|
}
|
|
464
|
-
})), /*#__PURE__*/_react["default"].createElement("div", {
|
|
530
|
+
})) : null, canOpenInNewTab ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
465
531
|
className: uptoTablet ? _AttachmentViewerModule["default"].mobileMenu : _AttachmentViewerModule["default"].menu
|
|
466
532
|
}, /*#__PURE__*/_react["default"].createElement(_Link["default"], {
|
|
467
533
|
href: selectedImgUrl,
|
|
@@ -477,7 +543,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
477
543
|
a11y: {
|
|
478
544
|
ariaLabel: i18nKeys.newTabText
|
|
479
545
|
}
|
|
480
|
-
}))), needDownload ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
546
|
+
}))) : null, needDownload ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
481
547
|
className: uptoTablet ? _AttachmentViewerModule["default"].mobileMenu : _AttachmentViewerModule["default"].menu
|
|
482
548
|
}, /*#__PURE__*/_react["default"].createElement(_Link["default"], {
|
|
483
549
|
href: downloadUrl,
|
|
@@ -497,7 +563,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
497
563
|
}
|
|
498
564
|
}))) : null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
499
565
|
className: uptoTablet ? _AttachmentViewerModule["default"].mobileMenu : _AttachmentViewerModule["default"].menu,
|
|
500
|
-
onClick:
|
|
566
|
+
onClick: _this6.closeAttachmentViewer,
|
|
501
567
|
"data-id": "closeAttach",
|
|
502
568
|
"data-test-id": "closeAttach",
|
|
503
569
|
"data-title": i18nKeys.closeText
|
|
@@ -518,7 +584,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
518
584
|
alignBox: "row"
|
|
519
585
|
}, /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
520
586
|
className: "".concat(_AttachmentViewerModule["default"].arrowBox, " ").concat(uptoTablet ? _AttachmentViewerModule["default"].mbleArrowBox : _AttachmentViewerModule["default"].nrmlArrowBox, " ").concat(selectedIndex === 0 ? _AttachmentViewerModule["default"].hidden : ''),
|
|
521
|
-
onClick:
|
|
587
|
+
onClick: _this6.changeSelectedIndex.bind(_this6, selectedIndex - 1),
|
|
522
588
|
"data-title": i18nKeys.previousText,
|
|
523
589
|
"data-title-position": "left"
|
|
524
590
|
}, /*#__PURE__*/_react["default"].createElement("button", {
|
|
@@ -534,12 +600,12 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
534
600
|
tabindex: "0",
|
|
535
601
|
"aria-describedby": ariaId,
|
|
536
602
|
isShrink: false,
|
|
537
|
-
eleRef:
|
|
603
|
+
eleRef: _this6.setImgBoxRef,
|
|
538
604
|
scroll: "both",
|
|
539
605
|
flexible: true
|
|
540
|
-
},
|
|
606
|
+
}, _this6.imgPreviewView()), /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
541
607
|
className: "".concat(_AttachmentViewerModule["default"].arrowBox, " ").concat(uptoTablet ? _AttachmentViewerModule["default"].mbleArrowBox : _AttachmentViewerModule["default"].nrmlArrowBox, " ").concat(totalLen === selectedIndex + 1 ? _AttachmentViewerModule["default"].hidden : ''),
|
|
542
|
-
onClick:
|
|
608
|
+
onClick: _this6.changeSelectedIndex.bind(_this6, selectedIndex + 1),
|
|
543
609
|
"data-title": i18nKeys.nextText,
|
|
544
610
|
"data-title-position": "right"
|
|
545
611
|
}, /*#__PURE__*/_react["default"].createElement("button", {
|
|
@@ -579,33 +645,48 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
|
|
|
579
645
|
alignBox: "row",
|
|
580
646
|
scroll: "horizontal",
|
|
581
647
|
eleRef: function eleRef(el) {
|
|
582
|
-
return
|
|
648
|
+
return _this6.imgListCont = el;
|
|
583
649
|
},
|
|
584
650
|
className: _AttachmentViewerModule["default"].listContainer
|
|
585
651
|
}, data.map(function (item, index) {
|
|
586
652
|
var name = item.name,
|
|
587
|
-
viewUrl = item.viewUrl
|
|
588
|
-
|
|
653
|
+
viewUrl = item.viewUrl,
|
|
654
|
+
children = item.children,
|
|
655
|
+
_item$customClass = item.customClass,
|
|
656
|
+
customClass = _item$customClass === void 0 ? {} : _item$customClass,
|
|
657
|
+
_item$dataId = item.dataId,
|
|
658
|
+
dataId = _item$dataId === void 0 ? 'AttachmentImage' : _item$dataId,
|
|
659
|
+
_item$customProps = item.customProps,
|
|
660
|
+
customProps = _item$customProps === void 0 ? {} : _item$customProps;
|
|
661
|
+
var thumbnail = item.thumbnail;
|
|
662
|
+
var _customClass$customIm2 = customClass.customImageClass,
|
|
663
|
+
customImageClass = _customClass$customIm2 === void 0 ? '' : _customClass$customIm2,
|
|
664
|
+
_customClass$customCh2 = customClass.customChildrenClass,
|
|
665
|
+
customChildrenClass = _customClass$customCh2 === void 0 ? '' : _customClass$customCh2;
|
|
666
|
+
thumbnail = (0, _Attachment.isAudioFile)(name) ? thumbnail || _audio_thumbnail["default"] : thumbnail; //fallback thumbnail for audio
|
|
667
|
+
|
|
589
668
|
return /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
590
|
-
className: "".concat(_AttachmentViewerModule["default"].imgItem, " ").concat(index === selectedIndex ? _AttachmentViewerModule["default"].selected : ''
|
|
669
|
+
className: "".concat(_AttachmentViewerModule["default"].imgItem, " ").concat(index === selectedIndex ? _AttachmentViewerModule["default"].selected : ''),
|
|
591
670
|
key: index,
|
|
592
|
-
onClick:
|
|
671
|
+
onClick: _this6.changeSelectedIndex.bind(_this6, index),
|
|
593
672
|
eleRef: function eleRef(el) {
|
|
594
|
-
return
|
|
673
|
+
return _this6["img_".concat(index)] = el;
|
|
595
674
|
},
|
|
596
675
|
dataId: "attachPreviewList",
|
|
597
676
|
"data-title": name
|
|
598
|
-
}, /*#__PURE__*/_react["default"].createElement(_AttachmentImage["default"], {
|
|
599
|
-
src: viewUrl,
|
|
677
|
+
}, /*#__PURE__*/_react["default"].createElement(_AttachmentImage["default"], _extends({
|
|
678
|
+
src: thumbnail || viewUrl,
|
|
600
679
|
size: "small",
|
|
601
680
|
alt: name,
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
681
|
+
customClass: {
|
|
682
|
+
customImageClass: "".concat(_AttachmentViewerModule["default"].image, " ").concat(_AttachmentViewerModule["default"].altText, " ").concat(customImageClass),
|
|
683
|
+
customChildrenClass: "".concat(_AttachmentViewerModule["default"].crsrPointer, " ").concat(customChildrenClass)
|
|
684
|
+
},
|
|
685
|
+
dataId: dataId
|
|
686
|
+
}, customProps), children));
|
|
606
687
|
}))))), totalLen !== 1 && /*#__PURE__*/_react["default"].createElement(_IconButton["default"], {
|
|
607
688
|
dataId: "attachToggle",
|
|
608
|
-
onClick:
|
|
689
|
+
onClick: _this6.togglePViewList,
|
|
609
690
|
iconName: "ZD-GN-hideTab",
|
|
610
691
|
iconSize: "14",
|
|
611
692
|
hoverType: "border",
|
|
@@ -11,14 +11,18 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
|
|
|
11
11
|
|
|
12
12
|
var AttachmentImage_propTypes = {
|
|
13
13
|
alt: _propTypes["default"].string,
|
|
14
|
-
|
|
14
|
+
customClass: _propTypes["default"].shape({
|
|
15
|
+
customImageClass: _propTypes["default"].string,
|
|
16
|
+
customChildrenClass: _propTypes["default"].string
|
|
17
|
+
}),
|
|
15
18
|
dataId: _propTypes["default"].string,
|
|
16
19
|
id: _propTypes["default"].string,
|
|
17
20
|
isCover: _propTypes["default"].bool,
|
|
18
|
-
isImage: _propTypes["default"].bool,
|
|
19
21
|
onClick: _propTypes["default"].func,
|
|
20
22
|
onLoad: _propTypes["default"].func,
|
|
21
|
-
|
|
23
|
+
onError: _propTypes["default"].func,
|
|
24
|
+
src: _propTypes["default"].string,
|
|
25
|
+
children: _propTypes["default"].node
|
|
22
26
|
};
|
|
23
27
|
exports.AttachmentImage_propTypes = AttachmentImage_propTypes;
|
|
24
28
|
var AttachmentViewer_propTypes = {
|
package/lib/v1/Image/Image.js
CHANGED
|
@@ -25,7 +25,9 @@ function Image(props) {
|
|
|
25
25
|
dataId = props.dataId,
|
|
26
26
|
htmlId = props.htmlId,
|
|
27
27
|
eleRef = props.eleRef,
|
|
28
|
-
original = props.original
|
|
28
|
+
original = props.original,
|
|
29
|
+
onLoad = props.onLoad,
|
|
30
|
+
onError = props.onError;
|
|
29
31
|
return /*#__PURE__*/_react["default"].createElement("img", {
|
|
30
32
|
src: src,
|
|
31
33
|
alt: alt,
|
|
@@ -36,7 +38,9 @@ function Image(props) {
|
|
|
36
38
|
onClick: onClick,
|
|
37
39
|
id: htmlId,
|
|
38
40
|
ref: eleRef,
|
|
39
|
-
"data-original": original
|
|
41
|
+
"data-original": original,
|
|
42
|
+
onLoad: onLoad,
|
|
43
|
+
onError: onError
|
|
40
44
|
});
|
|
41
45
|
}
|
|
42
46
|
|
|
@@ -19,6 +19,8 @@ var propTypes = {
|
|
|
19
19
|
onClick: _propTypes["default"].func,
|
|
20
20
|
original: _propTypes["default"].string,
|
|
21
21
|
src: _propTypes["default"].string.isRequired,
|
|
22
|
-
title: _propTypes["default"].string
|
|
22
|
+
title: _propTypes["default"].string,
|
|
23
|
+
onLoad: _propTypes["default"].func,
|
|
24
|
+
onError: _propTypes["default"].func
|
|
23
25
|
};
|
|
24
26
|
exports.propTypes = propTypes;
|
|
@@ -109,6 +109,7 @@ function CurrencyField(props) {
|
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
var uniqueId = htmlId ? htmlId : getNextId();
|
|
112
|
+
var isFocusable = !needReadOnlyStyle || !isReadOnly && needReadOnlyStyle;
|
|
112
113
|
|
|
113
114
|
function handleChange(value) {
|
|
114
115
|
onChange && onChange(id, value);
|
|
@@ -160,7 +161,7 @@ function CurrencyField(props) {
|
|
|
160
161
|
onChange: handleChange,
|
|
161
162
|
dataId: dataId,
|
|
162
163
|
onBlur: handleonBlur,
|
|
163
|
-
onFocus: handleonFocus,
|
|
164
|
+
onFocus: isFocusable && handleonFocus,
|
|
164
165
|
onKeyDown: onKeyDown,
|
|
165
166
|
placeHolder: placeHolder,
|
|
166
167
|
borderColor: borderColor,
|