dtable-ui-component 6.0.107-opl.2 → 6.0.107-opl.4
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.
|
@@ -27,35 +27,44 @@ function ImagePreviewerLightbox(props) {
|
|
|
27
27
|
onRotateImage
|
|
28
28
|
} = props;
|
|
29
29
|
const imageSrcList = imageItems.map(src => {
|
|
30
|
+
let name = '';
|
|
31
|
+
try {
|
|
32
|
+
name = src ? decodeURIComponent(src.slice(src.lastIndexOf('/') + 1)) : '';
|
|
33
|
+
} catch (error) {
|
|
34
|
+
// eslint-disable-next-line no-console
|
|
35
|
+
console.log(error);
|
|
36
|
+
}
|
|
30
37
|
if (server && dtableUuid && (0, _url.isCustomAssetUrl)(src)) {
|
|
31
38
|
const assetUuid = src.slice(src.lastIndexOf('/') + 1, src.lastIndexOf('.'));
|
|
32
|
-
return
|
|
39
|
+
return {
|
|
40
|
+
name,
|
|
41
|
+
thumbnail: server + '/dtable/' + dtableUuid + '/custom-asset/' + assetUuid
|
|
42
|
+
};
|
|
33
43
|
}
|
|
34
44
|
if (server && dtableUuid && workspaceID && (0, _url.isDigitalSignsUrl)(src)) {
|
|
35
|
-
return
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
45
|
+
return {
|
|
46
|
+
name,
|
|
47
|
+
thumbnail: (0, _url.generateCurrentBaseImageUrl)({
|
|
48
|
+
server,
|
|
49
|
+
workspaceID,
|
|
50
|
+
dtableUuid,
|
|
51
|
+
partUrl: src
|
|
52
|
+
})
|
|
53
|
+
};
|
|
41
54
|
}
|
|
42
|
-
return
|
|
55
|
+
return {
|
|
56
|
+
name: name || '',
|
|
57
|
+
thumbnail: src
|
|
58
|
+
};
|
|
43
59
|
});
|
|
44
60
|
const imagesLength = imageSrcList.length;
|
|
45
61
|
const [currentImageIndex, setCurrentImageIndex] = _react.default.useState(imageIndex || 0);
|
|
46
|
-
const
|
|
62
|
+
const imageItem = imageSrcList[currentImageIndex];
|
|
63
|
+
const URL = imageItem ? imageItem.thumbnail : '';
|
|
64
|
+
const imageName = imageItem ? imageItem.name : '';
|
|
47
65
|
_react.default.useEffect(() => {
|
|
48
66
|
setCurrentImageIndex(imageIndex);
|
|
49
67
|
}, [imageIndex]);
|
|
50
|
-
|
|
51
|
-
// Handle URL has special symbol %$
|
|
52
|
-
let imageName = '';
|
|
53
|
-
try {
|
|
54
|
-
imageName = URL ? decodeURI(URL.slice(URL.lastIndexOf('/') + 1)) : '';
|
|
55
|
-
} catch (error) {
|
|
56
|
-
// eslint-disable-next-line no-console
|
|
57
|
-
console.log(error);
|
|
58
|
-
}
|
|
59
68
|
const canRotateImage = onRotateImage && !readOnly && !['gif', 'heic', 'heif'].includes((0, _url.getFileSuffix)(URL)) && (0, _url.isInternalImg)(URL, server);
|
|
60
69
|
let mainSrc = URL;
|
|
61
70
|
if ((0, _url.needUseThumbnailImage)(URL)) {
|
|
@@ -70,12 +79,13 @@ function ImagePreviewerLightbox(props) {
|
|
|
70
79
|
className: "d-flex",
|
|
71
80
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
72
81
|
className: "text-truncate",
|
|
73
|
-
children: imageName
|
|
82
|
+
children: imageName || ''
|
|
74
83
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
|
|
75
84
|
className: "flex-shrink-0 pl-1",
|
|
76
85
|
children: ["(", currentImageIndex + 1, "/", imagesLength, ")"]
|
|
77
86
|
})]
|
|
78
87
|
});
|
|
88
|
+
console.log('imageSrcList', imageSrcList);
|
|
79
89
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactImageLightbox.default, {
|
|
80
90
|
imageItems: imageSrcList,
|
|
81
91
|
currentIndex: currentImageIndex,
|
|
@@ -83,8 +93,8 @@ function ImagePreviewerLightbox(props) {
|
|
|
83
93
|
wrapperClassName: (0, _classnames.default)('dtable-ui-component', className),
|
|
84
94
|
imageTitle: imageTitleDOM,
|
|
85
95
|
mainSrc: mainSrc,
|
|
86
|
-
nextSrc: imageSrcList[(currentImageIndex + 1) % imagesLength],
|
|
87
|
-
prevSrc: imageSrcList[(currentImageIndex + imagesLength - 1) % imagesLength],
|
|
96
|
+
nextSrc: imageSrcList[(currentImageIndex + 1) % imagesLength] ? imageSrcList[(currentImageIndex + 1) % imagesLength].thumbnail : '',
|
|
97
|
+
prevSrc: imageSrcList[(currentImageIndex + imagesLength - 1) % imagesLength] ? imageSrcList[(currentImageIndex + imagesLength - 1) % imagesLength].thumbnail : '',
|
|
88
98
|
imagePadding: 70,
|
|
89
99
|
viewOriginalImageLabel: (0, _lang.getLocale)('View_original_image'),
|
|
90
100
|
enableRotate: canRotateImage,
|