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/index.js
CHANGED
@@ -12214,7 +12214,7 @@ const FingerSwipeTip = ({ imageUrl }) => {
|
|
12214
12214
|
* @Author: binruan@chatlabs.com
|
12215
12215
|
* @Date: 2024-03-20 10:27:31
|
12216
12216
|
* @LastEditors: binruan@chatlabs.com
|
12217
|
-
* @LastEditTime: 2024-04-17
|
12217
|
+
* @LastEditTime: 2024-04-17 18:09:29
|
12218
12218
|
* @FilePath: \pb-sxp-ui\src\core\components\SxpPageRender\PictureGroup\Picture.tsx
|
12219
12219
|
*
|
12220
12220
|
*/
|
@@ -12222,28 +12222,26 @@ const Picture = (props) => {
|
|
12222
12222
|
const { src, height, width } = props;
|
12223
12223
|
const [blur, setBlur] = useState(false);
|
12224
12224
|
const { sxpParameter } = useSxpDataSource();
|
12225
|
-
|
12226
|
-
|
12227
|
-
|
12228
|
-
const
|
12229
|
-
|
12230
|
-
|
12231
|
-
|
12232
|
-
|
12233
|
-
const tolerance = 0.05; // 允许的宽高比误差范围
|
12234
|
-
if (Math.abs(aspectRatio - targetAspectRatio) > tolerance) {
|
12235
|
-
setBlur(true);
|
12236
|
-
}
|
12237
|
-
};
|
12238
|
-
}, [src]);
|
12225
|
+
const onLoad = (img) => {
|
12226
|
+
const aspectRatio = img.height / img.width;
|
12227
|
+
const targetAspectRatio = 16 / 9;
|
12228
|
+
const tolerance = 0.05; // 允许的宽高比误差范围
|
12229
|
+
if (Math.abs(aspectRatio - targetAspectRatio) > tolerance) {
|
12230
|
+
setBlur(true);
|
12231
|
+
}
|
12232
|
+
};
|
12239
12233
|
const getImg = useCallback((src, style) => {
|
12240
12234
|
if (src === '' || !src)
|
12241
12235
|
return;
|
12242
|
-
return (src === null || src === void 0 ? void 0 : src.
|
12236
|
+
return (src === null || src === void 0 ? void 0 : src.includes('.avif')) ? (React.createElement("picture", null,
|
12243
12237
|
React.createElement("source", { type: 'image/avif', srcSet: src }),
|
12244
12238
|
React.createElement("source", { type: 'image/webp', srcSet: `${src}?imageMogr2/format/webp` }),
|
12245
12239
|
React.createElement("source", { type: 'image/jpeg', srcSet: `${src}?imageMogr2/format/jpg` }),
|
12246
|
-
React.createElement("img", {
|
12240
|
+
React.createElement("img", { src: src, style: style, onLoad: (e) => {
|
12241
|
+
onLoad(e.target);
|
12242
|
+
} }))) : (React.createElement("img", { src: src, style: style, onLoad: (e) => {
|
12243
|
+
onLoad(e.target);
|
12244
|
+
} }));
|
12247
12245
|
}, []);
|
12248
12246
|
return (React.createElement("div", { style: {
|
12249
12247
|
overflow: 'hidden',
|
@@ -13030,3 +13028,4 @@ function useEditorDataProvider() {
|
|
13030
13028
|
*/
|
13031
13029
|
|
13032
13030
|
export { EditorDataProvider, Modal$1 as Modal, SxpDataSourceProvider$1 as SxpDataSourceProvider, index as SxpPageCore, SxpPageRender, index$1 as core, Pagebuilder as default, defaultSetting, _materials_ as materials, useEditorDataProvider };
|
13031
|
+
//# sourceMappingURL=index.js.map
|