pb-sxp-ui 1.0.20 → 1.0.21
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/dist/index.cjs +16 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +16 -17
- package/dist/index.js.map +1 -1
- package/dist/index.min.cjs +2 -1
- package/dist/index.min.cjs.map +1 -1
- package/dist/index.min.js +2 -1
- package/dist/index.min.js.map +1 -1
- package/dist/pb-ui.js +16 -17
- package/dist/pb-ui.js.map +1 -1
- package/dist/pb-ui.min.js +2 -1
- package/dist/pb-ui.min.js.map +1 -1
- package/es/core/components/SxpPageRender/PictureGroup/Picture.js +15 -17
- package/es/core/components/SxpPageRender/VideoWidget/index.js +2 -1
- package/lib/core/components/SxpPageRender/PictureGroup/Picture.js +14 -16
- package/lib/core/components/SxpPageRender/VideoWidget/index.js +2 -1
- package/package.json +1 -1
package/dist/pb-ui.js
CHANGED
@@ -12229,7 +12229,7 @@ Made in Italy` })));
|
|
12229
12229
|
* @Author: binruan@chatlabs.com
|
12230
12230
|
* @Date: 2024-03-20 10:27:31
|
12231
12231
|
* @LastEditors: binruan@chatlabs.com
|
12232
|
-
* @LastEditTime: 2024-04-17
|
12232
|
+
* @LastEditTime: 2024-04-17 18:09:29
|
12233
12233
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\PictureGroup\Picture.tsx
|
12234
12234
|
*
|
12235
12235
|
*/
|
@@ -12237,28 +12237,26 @@ Made in Italy` })));
|
|
12237
12237
|
const { src, height, width } = props;
|
12238
12238
|
const [blur, setBlur] = React.useState(false);
|
12239
12239
|
const { sxpParameter } = useSxpDataSource();
|
12240
|
-
|
12241
|
-
|
12242
|
-
|
12243
|
-
const
|
12244
|
-
|
12245
|
-
|
12246
|
-
|
12247
|
-
|
12248
|
-
const tolerance = 0.05; // 允许的宽高比误差范围
|
12249
|
-
if (Math.abs(aspectRatio - targetAspectRatio) > tolerance) {
|
12250
|
-
setBlur(true);
|
12251
|
-
}
|
12252
|
-
};
|
12253
|
-
}, [src]);
|
12240
|
+
const onLoad = (img) => {
|
12241
|
+
const aspectRatio = img.height / img.width;
|
12242
|
+
const targetAspectRatio = 16 / 9;
|
12243
|
+
const tolerance = 0.05; // 允许的宽高比误差范围
|
12244
|
+
if (Math.abs(aspectRatio - targetAspectRatio) > tolerance) {
|
12245
|
+
setBlur(true);
|
12246
|
+
}
|
12247
|
+
};
|
12254
12248
|
const getImg = React.useCallback((src, style) => {
|
12255
12249
|
if (src === '' || !src)
|
12256
12250
|
return;
|
12257
|
-
return (src === null || src === void 0 ? void 0 : src.
|
12251
|
+
return (src === null || src === void 0 ? void 0 : src.includes('.avif')) ? (React.createElement("picture", null,
|
12258
12252
|
React.createElement("source", { type: 'image/avif', srcSet: src }),
|
12259
12253
|
React.createElement("source", { type: 'image/webp', srcSet: `${src}?imageMogr2/format/webp` }),
|
12260
12254
|
React.createElement("source", { type: 'image/jpeg', srcSet: `${src}?imageMogr2/format/jpg` }),
|
12261
|
-
React.createElement("img", {
|
12255
|
+
React.createElement("img", { src: src, style: style, onLoad: (e) => {
|
12256
|
+
onLoad(e.target);
|
12257
|
+
} }))) : (React.createElement("img", { src: src, style: style, onLoad: (e) => {
|
12258
|
+
onLoad(e.target);
|
12259
|
+
} }));
|
12262
12260
|
}, []);
|
12263
12261
|
return (React.createElement("div", { style: {
|
12264
12262
|
overflow: 'hidden',
|
@@ -13058,3 +13056,4 @@ Made in Italy` })));
|
|
13058
13056
|
Object.defineProperty(exports, '__esModule', { value: true });
|
13059
13057
|
|
13060
13058
|
}));
|
13059
|
+
//# sourceMappingURL=pb-ui.js.map
|