@gem-sdk/components 2.0.0-dev.693 → 2.0.0-dev.694
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/cjs/builder.js +6 -12
- package/dist/cjs/index.js +32 -34
- package/dist/cjs/index.liquid.js +10 -16
- package/dist/cjs/next.js +1 -3
- package/dist/cjs/product/components/ProductImagesV2/common/common.js +2 -1
- package/dist/cjs/product/index.js +4 -6
- package/dist/cjs/product/next.js +0 -4
- package/dist/cjs/setting.js +76 -78
- package/dist/esm/builder.js +0 -6
- package/dist/esm/index.js +0 -1
- package/dist/esm/index.liquid.js +0 -3
- package/dist/esm/next.js +1 -3
- package/dist/esm/product/components/ProductImagesV2/common/common.js +2 -1
- package/dist/esm/product/index.js +24 -26
- package/dist/esm/product/next.js +0 -4
- package/dist/esm/setting.js +0 -2
- package/dist/types/index.d.ts +116 -551
- package/package.json +1 -1
- package/dist/cjs/product/components/ProductImagesV3/common/common.js +0 -360
- package/dist/cjs/product/components/ProductImagesV3/common/getAttr.js +0 -192
- package/dist/cjs/product/components/ProductImagesV3/common/getBorderActiveCss.js +0 -26
- package/dist/cjs/product/components/ProductImagesV3/common/getClasses.js +0 -94
- package/dist/cjs/product/components/ProductImagesV3/common/getStyle.js +0 -303
- package/dist/cjs/product/components/ProductImagesV3/common/hoverAction.js +0 -95
- package/dist/cjs/product/components/ProductImagesV3/common/productFeaturedImage.js +0 -59
- package/dist/cjs/product/components/ProductImagesV3/common/productGallery.js +0 -266
- package/dist/cjs/product/components/ProductImagesV3/components/child/MediaIcon.js +0 -63
- package/dist/cjs/product/components/ProductImagesV3/components/child/ProductFeatureVideo.js +0 -36
- package/dist/cjs/product/components/ProductImagesV3/components/child/ProductFeaturedImageCarousel.js +0 -109
- package/dist/cjs/product/components/ProductImagesV3/components/child/ProductFeaturedImageOnly.js +0 -139
- package/dist/cjs/product/components/ProductImagesV3/components/child/ProductGalleryGrid.js +0 -100
- package/dist/cjs/product/components/ProductImagesV3/components/feature-gallery/FeatureImageWithGallery.js +0 -77
- package/dist/cjs/product/components/ProductImagesV3/components/feature-gallery/FeatureImageWithGallery.liquid.js +0 -300
- package/dist/cjs/product/components/ProductImagesV3/components/feature-only/OnlyFeatureImage.js +0 -44
- package/dist/cjs/product/components/ProductImagesV3/components/gallery-carousel/GalleryCarousel.js +0 -83
- package/dist/cjs/product/components/ProductImagesV3/components/gallery-carousel/GalleryCarousel.liquid.js +0 -182
- package/dist/cjs/product/components/ProductImagesV3/components/gallery-grid/GalleryGrid.js +0 -30
- package/dist/cjs/product/components/ProductImagesV3/components/gallery-grid/GalleryGrid.liquid.js +0 -239
- package/dist/cjs/product/components/ProductImagesV3/components/lightbox/ButtonOpenLightBox.js +0 -28
- package/dist/cjs/product/components/ProductImagesV3/components/lightbox/ProductImagesLightBox.js +0 -144
- package/dist/cjs/product/components/ProductImagesV3/composables/getProductImagesAttr.js +0 -14
- package/dist/cjs/product/components/ProductImagesV3/composables/getProductImagesClassName.js +0 -54
- package/dist/cjs/product/components/ProductImagesV3/composables/getProductImagesStyles.js +0 -53
- package/dist/cjs/product/components/ProductImagesV3/hooks/useFeatureImageWithGallery.js +0 -55
- package/dist/cjs/product/components/ProductImagesV3/hooks/useFilterImagesByVariant.js +0 -41
- package/dist/cjs/product/components/ProductImagesV3/hooks/useGalleryCarousel.js +0 -134
- package/dist/cjs/product/components/ProductImagesV3/hooks/useProductFeaturedImageCarousel.js +0 -203
- package/dist/cjs/product/components/ProductImagesV3/hooks/useProductGalleryGrid.js +0 -87
- package/dist/cjs/product/components/ProductImagesV3/index.js +0 -291
- package/dist/cjs/product/components/ProductImagesV3/index.liquid.js +0 -153
- package/dist/cjs/product/setting/product-image-v3/ProductFeatureImage.js +0 -252
- package/dist/cjs/product/setting/product-image-v3/ProductGalleryImage.js +0 -251
- package/dist/cjs/product/setting/product-image-v3/ProductImages.js +0 -74
- package/dist/cjs/product/setting/product-image-v3/configs/setting-v2/ProductFeatureImage.js +0 -388
- package/dist/cjs/product/setting/product-image-v3/configs/setting-v2/ProductGalleryImage.js +0 -519
- package/dist/cjs/product/setting/product-image-v3/configs/setting-v2/index.js +0 -337
- package/dist/cjs/product/setting/product-image-v3/configs/ui/FeatureNavigation.js +0 -118
- package/dist/cjs/product/setting/product-image-v3/configs/ui/ImageListNavigation.js +0 -119
- package/dist/cjs/product/setting/product-image-v3/configs/uiV1.js +0 -237
- package/dist/cjs/product/setting/product-image-v3/configs/uiV2.js +0 -491
- package/dist/cjs/swiper-carousel/arrow/Arrow.js +0 -52
- package/dist/cjs/swiper-carousel/arrow/Arrow.liquid.js +0 -46
- package/dist/cjs/swiper-carousel/arrow/common/common.js +0 -119
- package/dist/cjs/swiper-carousel/arrow/common/getClass.js +0 -50
- package/dist/cjs/swiper-carousel/arrow/common/getStyle.js +0 -84
- package/dist/cjs/swiper-carousel/carousel-item/SwiperItem.js +0 -34
- package/dist/cjs/swiper-carousel/carousel-item/SwiperItem.liquid.js +0 -38
- package/dist/cjs/swiper-carousel/carousel-item/common/getClass.js +0 -29
- package/dist/cjs/swiper-carousel/carousel-item/common/getStyle.js +0 -79
- package/dist/cjs/swiper-carousel/carousel-item/hook/useCarouseItem.js +0 -22
- package/dist/cjs/swiper-carousel/components/common/carousel.js +0 -98
- package/dist/cjs/swiper-carousel/components/const/index.js +0 -5
- package/dist/cjs/swiper-carousel/components/hooks/useTrackPreviewPause.js +0 -34
- package/dist/cjs/swiper-carousel/components/plugins/AnimationPlugin.js +0 -42
- package/dist/cjs/swiper-carousel/components/plugins/AutoPlayPlugin.js +0 -105
- package/dist/cjs/swiper-carousel/components/plugins/FixSliderMoveBackwards.js +0 -15
- package/dist/cjs/swiper-carousel/components/plugins/MutationPlugin.js +0 -45
- package/dist/cjs/swiper-carousel/dots/Dots.js +0 -51
- package/dist/cjs/swiper-carousel/dots/Dots.liquid.js +0 -26
- package/dist/cjs/swiper-carousel/dots/common/common.js +0 -28
- package/dist/cjs/swiper-carousel/dots/common/getClass.js +0 -40
- package/dist/cjs/swiper-carousel/dots/common/getStyle.js +0 -33
- package/dist/cjs/swiper-carousel/dots/hook/useDotsSetting.js +0 -21
- package/dist/cjs/swiper-carousel/index.js +0 -17
- package/dist/cjs/swiper-carousel/next.js +0 -22
- package/dist/cjs/swiper-carousel/root/Swiper.js +0 -128
- package/dist/cjs/swiper-carousel/root/Swiper.liquid.js +0 -104
- package/dist/cjs/swiper-carousel/root/common/getAttr.js +0 -25
- package/dist/cjs/swiper-carousel/root/common/getClass.js +0 -135
- package/dist/cjs/swiper-carousel/root/common/getData.js +0 -56
- package/dist/cjs/swiper-carousel/root/common/getStyle.js +0 -66
- package/dist/cjs/swiper-carousel/root/hook/useCarousel.js +0 -482
- package/dist/cjs/swiper-carousel/setting/Swiper.js +0 -42
- package/dist/cjs/swiper-carousel/setting/SwiperItem.js +0 -40
- package/dist/cjs/swiper-carousel/setting/configs/presets.js +0 -87
- package/dist/cjs/swiper-carousel/setting/configs/settingV2.js +0 -822
- package/dist/cjs/swiper-carousel/setting/configs/uiV2.js +0 -718
- package/dist/esm/product/components/ProductImagesV3/common/common.js +0 -344
- package/dist/esm/product/components/ProductImagesV3/common/getAttr.js +0 -189
- package/dist/esm/product/components/ProductImagesV3/common/getBorderActiveCss.js +0 -24
- package/dist/esm/product/components/ProductImagesV3/common/getClasses.js +0 -83
- package/dist/esm/product/components/ProductImagesV3/common/getStyle.js +0 -292
- package/dist/esm/product/components/ProductImagesV3/common/hoverAction.js +0 -92
- package/dist/esm/product/components/ProductImagesV3/common/productFeaturedImage.js +0 -53
- package/dist/esm/product/components/ProductImagesV3/common/productGallery.js +0 -251
- package/dist/esm/product/components/ProductImagesV3/components/child/MediaIcon.js +0 -59
- package/dist/esm/product/components/ProductImagesV3/components/child/ProductFeatureVideo.js +0 -32
- package/dist/esm/product/components/ProductImagesV3/components/child/ProductFeaturedImageCarousel.js +0 -105
- package/dist/esm/product/components/ProductImagesV3/components/child/ProductFeaturedImageOnly.js +0 -135
- package/dist/esm/product/components/ProductImagesV3/components/child/ProductGalleryGrid.js +0 -96
- package/dist/esm/product/components/ProductImagesV3/components/feature-gallery/FeatureImageWithGallery.js +0 -73
- package/dist/esm/product/components/ProductImagesV3/components/feature-gallery/FeatureImageWithGallery.liquid.js +0 -296
- package/dist/esm/product/components/ProductImagesV3/components/feature-only/OnlyFeatureImage.js +0 -40
- package/dist/esm/product/components/ProductImagesV3/components/gallery-carousel/GalleryCarousel.js +0 -79
- package/dist/esm/product/components/ProductImagesV3/components/gallery-carousel/GalleryCarousel.liquid.js +0 -178
- package/dist/esm/product/components/ProductImagesV3/components/gallery-grid/GalleryGrid.js +0 -26
- package/dist/esm/product/components/ProductImagesV3/components/gallery-grid/GalleryGrid.liquid.js +0 -235
- package/dist/esm/product/components/ProductImagesV3/components/lightbox/ButtonOpenLightBox.js +0 -24
- package/dist/esm/product/components/ProductImagesV3/components/lightbox/ProductImagesLightBox.js +0 -140
- package/dist/esm/product/components/ProductImagesV3/composables/getProductImagesAttr.js +0 -12
- package/dist/esm/product/components/ProductImagesV3/composables/getProductImagesClassName.js +0 -52
- package/dist/esm/product/components/ProductImagesV3/composables/getProductImagesStyles.js +0 -51
- package/dist/esm/product/components/ProductImagesV3/hooks/useFeatureImageWithGallery.js +0 -53
- package/dist/esm/product/components/ProductImagesV3/hooks/useFilterImagesByVariant.js +0 -39
- package/dist/esm/product/components/ProductImagesV3/hooks/useGalleryCarousel.js +0 -132
- package/dist/esm/product/components/ProductImagesV3/hooks/useProductFeaturedImageCarousel.js +0 -201
- package/dist/esm/product/components/ProductImagesV3/hooks/useProductGalleryGrid.js +0 -85
- package/dist/esm/product/components/ProductImagesV3/index.js +0 -287
- package/dist/esm/product/components/ProductImagesV3/index.liquid.js +0 -149
- package/dist/esm/product/setting/product-image-v3/ProductFeatureImage.js +0 -248
- package/dist/esm/product/setting/product-image-v3/ProductGalleryImage.js +0 -248
- package/dist/esm/product/setting/product-image-v3/ProductImages.js +0 -70
- package/dist/esm/product/setting/product-image-v3/configs/setting-v2/ProductFeatureImage.js +0 -384
- package/dist/esm/product/setting/product-image-v3/configs/setting-v2/ProductGalleryImage.js +0 -516
- package/dist/esm/product/setting/product-image-v3/configs/setting-v2/index.js +0 -335
- package/dist/esm/product/setting/product-image-v3/configs/ui/FeatureNavigation.js +0 -116
- package/dist/esm/product/setting/product-image-v3/configs/ui/ImageListNavigation.js +0 -117
- package/dist/esm/product/setting/product-image-v3/configs/uiV1.js +0 -235
- package/dist/esm/product/setting/product-image-v3/configs/uiV2.js +0 -489
- package/dist/esm/swiper-carousel/arrow/Arrow.js +0 -48
- package/dist/esm/swiper-carousel/arrow/Arrow.liquid.js +0 -42
- package/dist/esm/swiper-carousel/arrow/common/common.js +0 -111
- package/dist/esm/swiper-carousel/arrow/common/getClass.js +0 -48
- package/dist/esm/swiper-carousel/arrow/common/getStyle.js +0 -82
- package/dist/esm/swiper-carousel/carousel-item/SwiperItem.js +0 -30
- package/dist/esm/swiper-carousel/carousel-item/SwiperItem.liquid.js +0 -34
- package/dist/esm/swiper-carousel/carousel-item/common/getClass.js +0 -27
- package/dist/esm/swiper-carousel/carousel-item/common/getStyle.js +0 -77
- package/dist/esm/swiper-carousel/carousel-item/hook/useCarouseItem.js +0 -20
- package/dist/esm/swiper-carousel/components/common/carousel.js +0 -93
- package/dist/esm/swiper-carousel/components/const/index.js +0 -3
- package/dist/esm/swiper-carousel/components/hooks/useTrackPreviewPause.js +0 -30
- package/dist/esm/swiper-carousel/components/plugins/AnimationPlugin.js +0 -35
- package/dist/esm/swiper-carousel/components/plugins/AutoPlayPlugin.js +0 -103
- package/dist/esm/swiper-carousel/components/plugins/FixSliderMoveBackwards.js +0 -13
- package/dist/esm/swiper-carousel/components/plugins/MutationPlugin.js +0 -43
- package/dist/esm/swiper-carousel/dots/Dots.js +0 -47
- package/dist/esm/swiper-carousel/dots/Dots.liquid.js +0 -22
- package/dist/esm/swiper-carousel/dots/common/common.js +0 -26
- package/dist/esm/swiper-carousel/dots/common/getClass.js +0 -38
- package/dist/esm/swiper-carousel/dots/common/getStyle.js +0 -31
- package/dist/esm/swiper-carousel/dots/hook/useDotsSetting.js +0 -19
- package/dist/esm/swiper-carousel/index.js +0 -15
- package/dist/esm/swiper-carousel/next.js +0 -18
- package/dist/esm/swiper-carousel/root/Swiper.js +0 -124
- package/dist/esm/swiper-carousel/root/Swiper.liquid.js +0 -100
- package/dist/esm/swiper-carousel/root/common/getAttr.js +0 -23
- package/dist/esm/swiper-carousel/root/common/getClass.js +0 -133
- package/dist/esm/swiper-carousel/root/common/getData.js +0 -54
- package/dist/esm/swiper-carousel/root/common/getStyle.js +0 -64
- package/dist/esm/swiper-carousel/root/hook/useCarousel.js +0 -480
- package/dist/esm/swiper-carousel/setting/Swiper.js +0 -38
- package/dist/esm/swiper-carousel/setting/SwiperItem.js +0 -36
- package/dist/esm/swiper-carousel/setting/configs/presets.js +0 -85
- package/dist/esm/swiper-carousel/setting/configs/settingV2.js +0 -818
- package/dist/esm/swiper-carousel/setting/configs/uiV2.js +0 -713
package/dist/cjs/product/components/ProductImagesV3/composables/getProductImagesClassName.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var system = require('@gem-sdk/system');
|
|
4
|
-
var getClasses = require('../common/getClasses.js');
|
|
5
|
-
var common = require('../common/common.js');
|
|
6
|
-
|
|
7
|
-
const getProductImagesClassName = (props)=>{
|
|
8
|
-
const { setting, style } = props;
|
|
9
|
-
const productImagesProps = common.setDefaultWhenUndefineSetting(props);
|
|
10
|
-
const { builderProps, advanced } = productImagesProps;
|
|
11
|
-
const extraClass = advanced?.cssClass;
|
|
12
|
-
const wrapperClasses = system.createClass(getClasses.getWrapperClasses({
|
|
13
|
-
extraClass: `${builderProps?.uid} ${extraClass ?? ''} `,
|
|
14
|
-
isAddOverFlowClass: common.checkAddOverFlowClass(style)
|
|
15
|
-
}));
|
|
16
|
-
const productImagesGalleryClasses = system.createClass(getClasses.getGalleryWrapperClasses({}));
|
|
17
|
-
const galleryGridWrapperClasses = system.createClass(getClasses.getGalleryGridWrapperClasses({}));
|
|
18
|
-
const galleryItemClasses = (className)=>system.createClass(getClasses.getGalleryItemClasses({
|
|
19
|
-
extraClass: `${className ?? ''}`
|
|
20
|
-
}));
|
|
21
|
-
const ftImageGalleryClasses = system.createClass(getClasses.getFtImageWithGalleryClasses({
|
|
22
|
-
extraClass: `gp-product-images-feature--${builderProps?.uid}`
|
|
23
|
-
}));
|
|
24
|
-
const imageGalleryWrapperClasses = system.createClass(getClasses.getImageGalleryWrapperClasses({
|
|
25
|
-
extraClass: `gp-product-images-gallery-${builderProps?.uid}`
|
|
26
|
-
}));
|
|
27
|
-
const featuredImageCarouselClasses = system.createClass(getClasses.getFeaturedImageCarouselClasses({
|
|
28
|
-
extraClass: `gp-product-images-gallery-${builderProps?.uid}`
|
|
29
|
-
}));
|
|
30
|
-
const featuredImageGalleryClasses = system.createClass(getClasses.getFeaturedImageGalleryClasses({
|
|
31
|
-
settings: setting
|
|
32
|
-
}));
|
|
33
|
-
const featureImageOnlyOneImageClasses = system.createClass(getClasses.getFeaturedImageClasses({
|
|
34
|
-
setting,
|
|
35
|
-
extraClass: `gp-flex gp-relative gp-product-images-gallery-${builderProps?.uid} gp-overflow-hidden gp-flex gp-w-full gp-items-center gp-justify-center `
|
|
36
|
-
}));
|
|
37
|
-
const featuredCarouselItemClasses = (className)=>system.createClass(getClasses.getFeaturedCarouselItemClasses({
|
|
38
|
-
extraClass: `${className ?? ''}`
|
|
39
|
-
}));
|
|
40
|
-
return {
|
|
41
|
-
wrapperClasses,
|
|
42
|
-
productImagesGalleryClasses,
|
|
43
|
-
galleryGridWrapperClasses,
|
|
44
|
-
galleryItemClasses,
|
|
45
|
-
ftImageGalleryClasses,
|
|
46
|
-
imageGalleryWrapperClasses,
|
|
47
|
-
featuredImageCarouselClasses,
|
|
48
|
-
featuredImageGalleryClasses,
|
|
49
|
-
featureImageOnlyOneImageClasses,
|
|
50
|
-
featuredCarouselItemClasses
|
|
51
|
-
};
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
exports.getProductImagesClassName = getProductImagesClassName;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var system = require('@gem-sdk/system');
|
|
4
|
-
var getStyle = require('../common/getStyle.js');
|
|
5
|
-
|
|
6
|
-
const getProductImagesStyles = (settings, options)=>{
|
|
7
|
-
const wrapContainerStyle = system.createStyle(getStyle.getWrapContainerStyle(settings));
|
|
8
|
-
const wrapContainerStyleOnlyOneImage = system.createStyle(getStyle.getWrapContainerStyle(settings, true));
|
|
9
|
-
const wrapperFeaturedImageStyle = system.createStyle(getStyle.getWrapContainerStyle(settings, options?.gallery && options?.gallery?.length < 2));
|
|
10
|
-
const featureImageStyle = system.createStyle(getStyle.getFeatureImageStyle(settings, {
|
|
11
|
-
enableOrder: true,
|
|
12
|
-
enableDisplay: true
|
|
13
|
-
}));
|
|
14
|
-
const featureImageOnlyOneImageStyle = system.createStyle(getStyle.getFeaturedImageOnlyOneImageStyle({
|
|
15
|
-
settings,
|
|
16
|
-
options: {
|
|
17
|
-
enableRadius: true,
|
|
18
|
-
enableHeight: true
|
|
19
|
-
}
|
|
20
|
-
}));
|
|
21
|
-
const galleryImageStyle = system.createStyle(getStyle.getGalleryImageStyle(settings, options?.featureImageHeight));
|
|
22
|
-
const featuredImageCarouselStyle = system.createStyle(getStyle.getFeaturedImageCarouselStyle(settings));
|
|
23
|
-
const featureImageCarouselItemStyle = system.createStyle({
|
|
24
|
-
...getStyle.getFeatureImageCarouselItemStyle(settings)
|
|
25
|
-
});
|
|
26
|
-
const featureImageCarouselOnlyOneImageStyle = system.createStyle({
|
|
27
|
-
...getStyle.getFeatureImageCarouselItemStyle(settings),
|
|
28
|
-
...{
|
|
29
|
-
width: '{{productImageWidth}}px'
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
const galleryGridStyles = system.createStyle(getStyle.getGalleryGridStyle(settings));
|
|
33
|
-
const galleryGridItemStyles = system.createStyle(getStyle.getGalleryGridItemStyle(settings));
|
|
34
|
-
const galleryCarouselStyle = system.createStyle(getStyle.getGalleryCarouselStyle(settings));
|
|
35
|
-
const galleryCarouselItemStyle = system.createStyle(getStyle.getGalleryCarouselItemStyle(settings));
|
|
36
|
-
return {
|
|
37
|
-
wrapContainerStyle,
|
|
38
|
-
wrapContainerStyleOnlyOneImage,
|
|
39
|
-
wrapperFeaturedImageStyle,
|
|
40
|
-
featureImageStyle,
|
|
41
|
-
featureImageOnlyOneImageStyle,
|
|
42
|
-
galleryImageStyle,
|
|
43
|
-
featuredImageCarouselStyle,
|
|
44
|
-
featureImageCarouselItemStyle,
|
|
45
|
-
featureImageCarouselOnlyOneImageStyle,
|
|
46
|
-
galleryGridStyles,
|
|
47
|
-
galleryGridItemStyles,
|
|
48
|
-
galleryCarouselStyle,
|
|
49
|
-
galleryCarouselItemStyle
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
exports.getProductImagesStyles = getProductImagesStyles;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var core = require('@gem-sdk/core');
|
|
4
|
-
var React = require('react');
|
|
5
|
-
var common = require('../common/common.js');
|
|
6
|
-
|
|
7
|
-
const useFeatureImageWithGallery = (props)=>{
|
|
8
|
-
const { setting, styles } = props;
|
|
9
|
-
const settings = {
|
|
10
|
-
...setting,
|
|
11
|
-
...styles
|
|
12
|
-
};
|
|
13
|
-
const currentDevice = core.useCurrentDevice();
|
|
14
|
-
const timeout = React.useRef(null);
|
|
15
|
-
const featureWrapperImage = React.useRef(null);
|
|
16
|
-
const [onClickFeatureArrow, setOnClickFeatureArrow] = React.useState('');
|
|
17
|
-
const [featureImageHeight, setFeatureImageHeight] = React.useState(100);
|
|
18
|
-
const [activeIndexFromFeatureImage, setActiveIndexFromFeatureImage] = React.useState();
|
|
19
|
-
const position = core.getResponsiveValueByScreen(settings?.position, currentDevice);
|
|
20
|
-
const isShowCarousel = common.getTypeWidthDevice(settings?.type)[currentDevice] === 'slider' || [
|
|
21
|
-
'left',
|
|
22
|
-
'right',
|
|
23
|
-
'inside-left',
|
|
24
|
-
'inside-right'
|
|
25
|
-
].includes(position);
|
|
26
|
-
const onHandleLoadedFeatureImage = (status, timeOut = 200)=>{
|
|
27
|
-
if (status) {
|
|
28
|
-
if (timeout.current) clearTimeout(timeout.current);
|
|
29
|
-
timeout.current = setTimeout(()=>setFeatureImageHeight(featureWrapperImage?.current?.offsetHeight || 200), timeOut);
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
React.useEffect(()=>{
|
|
33
|
-
const element = featureWrapperImage?.current;
|
|
34
|
-
if (!element) return;
|
|
35
|
-
const observer = new ResizeObserver(()=>{
|
|
36
|
-
setFeatureImageHeight(element.offsetHeight || 200);
|
|
37
|
-
});
|
|
38
|
-
observer.observe(element);
|
|
39
|
-
return ()=>{
|
|
40
|
-
observer.disconnect();
|
|
41
|
-
};
|
|
42
|
-
});
|
|
43
|
-
return {
|
|
44
|
-
isShowCarousel,
|
|
45
|
-
featureImageHeight,
|
|
46
|
-
featureWrapperImage,
|
|
47
|
-
onClickFeatureArrow,
|
|
48
|
-
activeIndexFromFeatureImage,
|
|
49
|
-
setOnClickFeatureArrow,
|
|
50
|
-
onHandleLoadedFeatureImage,
|
|
51
|
-
setActiveIndexFromFeatureImage
|
|
52
|
-
};
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
exports.useFeatureImageWithGallery = useFeatureImageWithGallery;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var core = require('@gem-sdk/core');
|
|
4
|
-
var React = require('react');
|
|
5
|
-
|
|
6
|
-
const useFilterImagesByVariant = ({ productImages, displayByVariant, variantSelect })=>{
|
|
7
|
-
const currentVariant = core.useCurrentVariant();
|
|
8
|
-
const getSelectedVariantOptionValue = React.useCallback(()=>{
|
|
9
|
-
const selectedVariantOptions = currentVariant?.selectedOptions ?? [];
|
|
10
|
-
const variantOption = selectedVariantOptions.find((item)=>item.name === variantSelect);
|
|
11
|
-
return variantOption?.value?.toLowerCase() ?? '';
|
|
12
|
-
}, [
|
|
13
|
-
currentVariant?.selectedOptions,
|
|
14
|
-
variantSelect
|
|
15
|
-
]);
|
|
16
|
-
const filteredProductImages = React.useMemo(()=>{
|
|
17
|
-
if (!displayByVariant || !variantSelect || !productImages) {
|
|
18
|
-
return productImages;
|
|
19
|
-
}
|
|
20
|
-
const selectedValue = getSelectedVariantOptionValue();
|
|
21
|
-
if (!selectedValue) {
|
|
22
|
-
return productImages;
|
|
23
|
-
}
|
|
24
|
-
const filteredImages = productImages.filter((image)=>{
|
|
25
|
-
const imageAlt = (image.alt || '').toLowerCase();
|
|
26
|
-
return imageAlt.includes(selectedValue);
|
|
27
|
-
});
|
|
28
|
-
return filteredImages.length > 0 ? filteredImages : productImages;
|
|
29
|
-
}, [
|
|
30
|
-
displayByVariant,
|
|
31
|
-
variantSelect,
|
|
32
|
-
productImages,
|
|
33
|
-
getSelectedVariantOptionValue
|
|
34
|
-
]);
|
|
35
|
-
return {
|
|
36
|
-
filteredProductImages,
|
|
37
|
-
selectedVariantValue: getSelectedVariantOptionValue()
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
exports.useFilterImagesByVariant = useFilterImagesByVariant;
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var core = require('@gem-sdk/core');
|
|
4
|
-
var React = require('react');
|
|
5
|
-
var useFilterImagesByVariant = require('./useFilterImagesByVariant.js');
|
|
6
|
-
var getSrcSet = require('../../../../image/helpers/getSrcSet.js');
|
|
7
|
-
var productGallery = require('../common/productGallery.js');
|
|
8
|
-
|
|
9
|
-
const useGalleryCarousel = (props)=>{
|
|
10
|
-
const { builderPropUID, productImages, onHandleClick, activeIndexFormFeatureImage, onClickFeatureArrow, builderPropsClass, arrow, priorityFeatureImage, ...setting } = props;
|
|
11
|
-
const currentDevice = core.useCurrentDevice();
|
|
12
|
-
const featuredImageGlobal = core.useFeaturedImageGlobal();
|
|
13
|
-
const [hasClickFeatureArrow, setHasClickFeatureArrow] = React.useState(onClickFeatureArrow || '');
|
|
14
|
-
const mode = core.useEditorMode();
|
|
15
|
-
const [moveToIdx, setMoveToIdx] = React.useState(0);
|
|
16
|
-
const { filteredProductImages } = useFilterImagesByVariant.useFilterImagesByVariant({
|
|
17
|
-
productImages,
|
|
18
|
-
displayByVariant: setting?.displayByVariant,
|
|
19
|
-
variantSelect: setting?.variantSelect
|
|
20
|
-
});
|
|
21
|
-
React.useEffect(()=>{
|
|
22
|
-
setHasClickFeatureArrow(onClickFeatureArrow || '');
|
|
23
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
24
|
-
}, [
|
|
25
|
-
onClickFeatureArrow
|
|
26
|
-
]);
|
|
27
|
-
React.useEffect(()=>{
|
|
28
|
-
if (hasClickFeatureArrow) {
|
|
29
|
-
setMoveToIdx(activeIndexFormFeatureImage || 0);
|
|
30
|
-
setHasClickFeatureArrow('');
|
|
31
|
-
}
|
|
32
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
33
|
-
}, [
|
|
34
|
-
activeIndexFormFeatureImage
|
|
35
|
-
]);
|
|
36
|
-
React.useEffect(()=>{
|
|
37
|
-
if (priorityFeatureImage) {
|
|
38
|
-
const indexPriorityFeatureImage = filteredProductImages?.findIndex((item)=>item.id === priorityFeatureImage.id) || 0;
|
|
39
|
-
setMoveToIdx(indexPriorityFeatureImage);
|
|
40
|
-
setHasClickFeatureArrow('');
|
|
41
|
-
}
|
|
42
|
-
}, [
|
|
43
|
-
priorityFeatureImage,
|
|
44
|
-
filteredProductImages
|
|
45
|
-
]);
|
|
46
|
-
React.useEffect(()=>{
|
|
47
|
-
const index = filteredProductImages?.findIndex((item)=>item.id === featuredImageGlobal?.id);
|
|
48
|
-
setMoveToIdx(index || 0);
|
|
49
|
-
setHasClickFeatureArrow('');
|
|
50
|
-
}, [
|
|
51
|
-
featuredImageGlobal,
|
|
52
|
-
filteredProductImages
|
|
53
|
-
]);
|
|
54
|
-
const shapeByLayout = React.useMemo(()=>{
|
|
55
|
-
return productGallery.getShapeByLayout({
|
|
56
|
-
shape: setting.shape,
|
|
57
|
-
shapeForBottom: setting.shapeForBottom,
|
|
58
|
-
shapeFor1Col: setting.shapeFor1Col,
|
|
59
|
-
shapeFor2Col: setting.shapeFor2Col,
|
|
60
|
-
shapeForFtOnly: setting.shapeForFtOnly,
|
|
61
|
-
shapeForInsideBottom: setting.shapeForInsideBottom,
|
|
62
|
-
shapeForInside: setting.shapeForInside
|
|
63
|
-
}, setting.position);
|
|
64
|
-
}, [
|
|
65
|
-
setting.shape,
|
|
66
|
-
setting.shapeForBottom,
|
|
67
|
-
setting.shapeFor1Col,
|
|
68
|
-
setting.shapeFor2Col,
|
|
69
|
-
setting.shapeForFtOnly,
|
|
70
|
-
setting.position,
|
|
71
|
-
setting.shapeForInsideBottom,
|
|
72
|
-
setting.shapeForInside
|
|
73
|
-
]);
|
|
74
|
-
const handleSetSrc = React.useCallback(()=>{
|
|
75
|
-
getSrcSet.handleSetSrcForProductImageList({
|
|
76
|
-
builderPropUID,
|
|
77
|
-
shapeByLayout,
|
|
78
|
-
qualityType: setting.qualityType,
|
|
79
|
-
qualityPercent: setting.qualityPercent
|
|
80
|
-
});
|
|
81
|
-
}, [
|
|
82
|
-
shapeByLayout,
|
|
83
|
-
setting.qualityPercent,
|
|
84
|
-
setting.qualityType,
|
|
85
|
-
builderPropUID
|
|
86
|
-
]);
|
|
87
|
-
React.useEffect(()=>{
|
|
88
|
-
if (mode === 'edit') return;
|
|
89
|
-
const $galleryImageGrid = document?.querySelector(`.gem-slider-item-${builderPropUID} .product-list-image`);
|
|
90
|
-
if (!$galleryImageGrid) return;
|
|
91
|
-
handleSetSrc();
|
|
92
|
-
const observer = new ResizeObserver(()=>{
|
|
93
|
-
handleSetSrc();
|
|
94
|
-
});
|
|
95
|
-
observer?.observe($galleryImageGrid, {});
|
|
96
|
-
return ()=>{
|
|
97
|
-
observer?.disconnect();
|
|
98
|
-
};
|
|
99
|
-
}, [
|
|
100
|
-
handleSetSrc,
|
|
101
|
-
builderPropUID,
|
|
102
|
-
mode
|
|
103
|
-
]);
|
|
104
|
-
const enableOpenLightBox = core.getResponsiveValueByScreen(setting.clickOpenLightBox, currentDevice);
|
|
105
|
-
const isDisplay = React.useMemo(()=>{
|
|
106
|
-
const isDisplayByWidth = productGallery.checkDisplayGalleryByWidth({
|
|
107
|
-
shapeByLayout
|
|
108
|
-
});
|
|
109
|
-
return core.getResponsiveValueByScreen(isDisplayByWidth, currentDevice);
|
|
110
|
-
}, [
|
|
111
|
-
shapeByLayout,
|
|
112
|
-
currentDevice
|
|
113
|
-
]);
|
|
114
|
-
const isEnableBorderActive = React.useMemo(()=>{
|
|
115
|
-
return setting?.borderActive?.border !== 'none';
|
|
116
|
-
}, [
|
|
117
|
-
setting?.borderActive?.border
|
|
118
|
-
]);
|
|
119
|
-
const isShowButtonLightbox = core.getResponsiveValueByScreen(setting?.clickOpenLightBox, currentDevice);
|
|
120
|
-
const handleClickCarouselItem = (imageId)=>{
|
|
121
|
-
onHandleClick && onHandleClick(imageId || '', enableOpenLightBox);
|
|
122
|
-
};
|
|
123
|
-
return {
|
|
124
|
-
moveToIdx,
|
|
125
|
-
isDisplay,
|
|
126
|
-
shapeByLayout,
|
|
127
|
-
isEnableBorderActive,
|
|
128
|
-
isShowButtonLightbox,
|
|
129
|
-
filteredProductImages,
|
|
130
|
-
handleClickCarouselItem
|
|
131
|
-
};
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
exports.useGalleryCarousel = useGalleryCarousel;
|
package/dist/cjs/product/components/ProductImagesV3/hooks/useProductFeaturedImageCarousel.js
DELETED
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var core = require('@gem-sdk/core');
|
|
4
|
-
var React = require('react');
|
|
5
|
-
var getSrcSet = require('../../../../image/helpers/getSrcSet.js');
|
|
6
|
-
var common = require('../common/common.js');
|
|
7
|
-
var productFeaturedImage = require('../common/productFeaturedImage.js');
|
|
8
|
-
var useFilterImagesByVariant = require('./useFilterImagesByVariant.js');
|
|
9
|
-
|
|
10
|
-
const useProductFeaturedImageCarousel = (props)=>{
|
|
11
|
-
const { productImages, imgRef, onHandleClick, onClickArrow, onHandleLoaded, onHandleUpdateActiveIndex, builderPropUID, builderPropsClass, children, parentUid, ...setting } = props;
|
|
12
|
-
const featuredImageGlobal = core.useFeaturedImageGlobal();
|
|
13
|
-
const currentDevice = core.useCurrentDevice();
|
|
14
|
-
const carouselRef = React.createRef();
|
|
15
|
-
const { onListener, ref } = core.useInteraction();
|
|
16
|
-
let delayTimeout;
|
|
17
|
-
const mode = core.useEditorMode();
|
|
18
|
-
const { filteredProductImages } = useFilterImagesByVariant.useFilterImagesByVariant({
|
|
19
|
-
productImages,
|
|
20
|
-
displayByVariant: setting?.displayByVariant,
|
|
21
|
-
variantSelect: setting?.variantSelect
|
|
22
|
-
});
|
|
23
|
-
const imageActiveIndex = React.useMemo(()=>{
|
|
24
|
-
const index = filteredProductImages?.findIndex((item)=>item.id === featuredImageGlobal?.id);
|
|
25
|
-
return index;
|
|
26
|
-
}, [
|
|
27
|
-
filteredProductImages,
|
|
28
|
-
featuredImageGlobal
|
|
29
|
-
]);
|
|
30
|
-
const isRenderFeatureCarousel = React.useMemo(()=>productFeaturedImage.checkRenderFeaturedCarousel(setting), [
|
|
31
|
-
setting
|
|
32
|
-
]);
|
|
33
|
-
const imageActive = React.useMemo(()=>{
|
|
34
|
-
if (filteredProductImages?.length) return featuredImageGlobal || filteredProductImages?.[0];
|
|
35
|
-
}, [
|
|
36
|
-
filteredProductImages,
|
|
37
|
-
featuredImageGlobal
|
|
38
|
-
]);
|
|
39
|
-
const enableOpenLightBox = React.useMemo(()=>{
|
|
40
|
-
return core.getResponsiveValueByScreen(setting.ftClickOpenLightBox, currentDevice) === 'popup';
|
|
41
|
-
}, [
|
|
42
|
-
setting.ftClickOpenLightBox,
|
|
43
|
-
currentDevice
|
|
44
|
-
]);
|
|
45
|
-
const indexHover = React.useMemo(()=>{
|
|
46
|
-
if (!setting?.otherImage) {
|
|
47
|
-
return 0;
|
|
48
|
-
}
|
|
49
|
-
if (filteredProductImages && setting.otherImage >= filteredProductImages.length - 1) {
|
|
50
|
-
return filteredProductImages.length - 1;
|
|
51
|
-
}
|
|
52
|
-
if (filteredProductImages && setting.otherImage === -1) {
|
|
53
|
-
return filteredProductImages.length - 1;
|
|
54
|
-
}
|
|
55
|
-
return setting.otherImage;
|
|
56
|
-
}, [
|
|
57
|
-
setting?.otherImage,
|
|
58
|
-
filteredProductImages
|
|
59
|
-
]);
|
|
60
|
-
const imageShowWhenHover = React.useMemo(()=>{
|
|
61
|
-
return setting?.hoverEffect === 'other' ? filteredProductImages?.[indexHover] : filteredProductImages?.find((item)=>item.id === featuredImageGlobal?.id) || filteredProductImages?.[0];
|
|
62
|
-
}, [
|
|
63
|
-
featuredImageGlobal?.id,
|
|
64
|
-
indexHover,
|
|
65
|
-
filteredProductImages,
|
|
66
|
-
setting?.hoverEffect
|
|
67
|
-
]);
|
|
68
|
-
const genRandomKey = function() {
|
|
69
|
-
return Math.random().toString(36).substr(2, 5);
|
|
70
|
-
};
|
|
71
|
-
const emitUpdateActiveIndex = (index)=>{
|
|
72
|
-
delayTimeout && clearTimeout(delayTimeout);
|
|
73
|
-
delayTimeout = setTimeout(()=>onHandleUpdateActiveIndex && onHandleUpdateActiveIndex(index), 500);
|
|
74
|
-
};
|
|
75
|
-
const getDefaultAspectRatio = (image)=>{
|
|
76
|
-
let result = '1/1';
|
|
77
|
-
let ratio = 0;
|
|
78
|
-
if (image) {
|
|
79
|
-
if (image.width && image.height) {
|
|
80
|
-
result = `${image.width}/${image.height}`;
|
|
81
|
-
}
|
|
82
|
-
} else {
|
|
83
|
-
filteredProductImages?.forEach((item)=>{
|
|
84
|
-
if (item.width && item.height) {
|
|
85
|
-
const r = item.height / item.width;
|
|
86
|
-
if (r > ratio) {
|
|
87
|
-
ratio = r;
|
|
88
|
-
result = `${item.width}/${item.height}`;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
return result;
|
|
94
|
-
};
|
|
95
|
-
const getAspectRatioFinal = (image)=>{
|
|
96
|
-
const result = common.getAspectRatio(setting.ftShape);
|
|
97
|
-
const defaultRatio = getDefaultAspectRatio(image);
|
|
98
|
-
return {
|
|
99
|
-
desktop: result.desktop ?? defaultRatio,
|
|
100
|
-
tablet: result.tablet ?? defaultRatio,
|
|
101
|
-
mobile: result.mobile ?? defaultRatio
|
|
102
|
-
};
|
|
103
|
-
};
|
|
104
|
-
const handleSetSrc = React.useCallback(()=>{
|
|
105
|
-
getSrcSet.handleSetSrcForFeatureProductImage({
|
|
106
|
-
builderPropUID,
|
|
107
|
-
ftShape: setting.ftShape,
|
|
108
|
-
qualityType: setting.qualityType,
|
|
109
|
-
qualityPercent: setting.qualityPercent
|
|
110
|
-
});
|
|
111
|
-
}, [
|
|
112
|
-
setting.ftShape,
|
|
113
|
-
setting.qualityPercent,
|
|
114
|
-
setting.qualityType,
|
|
115
|
-
builderPropUID
|
|
116
|
-
]);
|
|
117
|
-
const onListenerInteraction = ()=>{
|
|
118
|
-
const eventName = 'gp:change-image-step';
|
|
119
|
-
const selector = `[data-id="${builderPropUID}"]`;
|
|
120
|
-
onListener({
|
|
121
|
-
event: eventName,
|
|
122
|
-
selector
|
|
123
|
-
}, (params)=>{
|
|
124
|
-
const element = (ref.current || document).querySelector(selector);
|
|
125
|
-
const { data, isRollback, uniqueStorageKey } = params || {};
|
|
126
|
-
carouselRef?.current?.moveToSlideInteraction({
|
|
127
|
-
element,
|
|
128
|
-
data,
|
|
129
|
-
isRollback,
|
|
130
|
-
key: uniqueStorageKey
|
|
131
|
-
});
|
|
132
|
-
});
|
|
133
|
-
onListener({
|
|
134
|
-
event: 'gp:change-next-slide',
|
|
135
|
-
selector
|
|
136
|
-
}, (params)=>{
|
|
137
|
-
const element = (ref.current || document).querySelector(selector);
|
|
138
|
-
const { data, isRollback, uniqueStorageKey } = params || {};
|
|
139
|
-
carouselRef?.current?.nextSlideInteraction({
|
|
140
|
-
element,
|
|
141
|
-
data,
|
|
142
|
-
isRollback,
|
|
143
|
-
key: uniqueStorageKey
|
|
144
|
-
});
|
|
145
|
-
});
|
|
146
|
-
onListener({
|
|
147
|
-
event: 'gp:change-previous-slide',
|
|
148
|
-
selector
|
|
149
|
-
}, (params)=>{
|
|
150
|
-
const element = (ref.current || document).querySelector(selector);
|
|
151
|
-
const { data, isRollback, uniqueStorageKey } = params || {};
|
|
152
|
-
carouselRef?.current?.previousSlideInteraction({
|
|
153
|
-
element,
|
|
154
|
-
data,
|
|
155
|
-
isRollback,
|
|
156
|
-
key: uniqueStorageKey
|
|
157
|
-
});
|
|
158
|
-
});
|
|
159
|
-
};
|
|
160
|
-
React.useEffect(()=>{
|
|
161
|
-
if (mode === 'edit') return;
|
|
162
|
-
const $featuredImage = document?.querySelector(`.gem-slider-item-${builderPropUID} .featured-image-only`);
|
|
163
|
-
if (!$featuredImage) return;
|
|
164
|
-
handleSetSrc();
|
|
165
|
-
const observer = new ResizeObserver(()=>{
|
|
166
|
-
handleSetSrc();
|
|
167
|
-
});
|
|
168
|
-
observer?.observe($featuredImage, {});
|
|
169
|
-
return ()=>{
|
|
170
|
-
observer?.disconnect();
|
|
171
|
-
};
|
|
172
|
-
}, [
|
|
173
|
-
handleSetSrc,
|
|
174
|
-
builderPropUID,
|
|
175
|
-
mode
|
|
176
|
-
]);
|
|
177
|
-
React.useEffect(()=>{
|
|
178
|
-
onListenerInteraction();
|
|
179
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
180
|
-
}, []);
|
|
181
|
-
React.useEffect(()=>{
|
|
182
|
-
if (!isRenderFeatureCarousel) {
|
|
183
|
-
onHandleLoaded && onHandleLoaded(true, 0);
|
|
184
|
-
}
|
|
185
|
-
}, [
|
|
186
|
-
isRenderFeatureCarousel,
|
|
187
|
-
onHandleLoaded
|
|
188
|
-
]);
|
|
189
|
-
return {
|
|
190
|
-
ref,
|
|
191
|
-
imageActive,
|
|
192
|
-
imageActiveIndex,
|
|
193
|
-
imageShowWhenHover,
|
|
194
|
-
enableOpenLightBox,
|
|
195
|
-
filteredProductImages,
|
|
196
|
-
isRenderFeatureCarousel,
|
|
197
|
-
genRandomKey,
|
|
198
|
-
getAspectRatioFinal,
|
|
199
|
-
emitUpdateActiveIndex
|
|
200
|
-
};
|
|
201
|
-
};
|
|
202
|
-
|
|
203
|
-
exports.useProductFeaturedImageCarousel = useProductFeaturedImageCarousel;
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var core = require('@gem-sdk/core');
|
|
4
|
-
var React = require('react');
|
|
5
|
-
var getSrcSet = require('../../../../image/helpers/getSrcSet.js');
|
|
6
|
-
var productGallery = require('../common/productGallery.js');
|
|
7
|
-
var useFilterImagesByVariant = require('./useFilterImagesByVariant.js');
|
|
8
|
-
|
|
9
|
-
const useProductGalleryGrid = (props)=>{
|
|
10
|
-
const { builderPropUID, productImages, activeIndexFormFeatureImage, children, isHiddenInteraction, ...setting } = props;
|
|
11
|
-
const currentDevice = core.useCurrentDevice();
|
|
12
|
-
const featuredImageGlobal = core.useFeaturedImageGlobal();
|
|
13
|
-
const [imageActiveIndex, setImageActiveIndex] = React.useState(0);
|
|
14
|
-
const mode = core.useEditorMode();
|
|
15
|
-
const { filteredProductImages } = useFilterImagesByVariant.useFilterImagesByVariant({
|
|
16
|
-
productImages,
|
|
17
|
-
displayByVariant: setting?.displayByVariant,
|
|
18
|
-
variantSelect: setting?.variantSelect
|
|
19
|
-
});
|
|
20
|
-
const shapeByLayout = productGallery.getShapeByLayout({
|
|
21
|
-
shape: setting.shape,
|
|
22
|
-
shapeForBottom: setting.shapeForBottom,
|
|
23
|
-
shapeFor1Col: setting.shapeFor1Col,
|
|
24
|
-
shapeFor2Col: setting.shapeFor2Col,
|
|
25
|
-
shapeForFtOnly: setting.shapeForFtOnly,
|
|
26
|
-
shapeForInsideBottom: setting.shapeForInsideBottom,
|
|
27
|
-
shapeForInside: setting.shapeForInside
|
|
28
|
-
}, setting.position);
|
|
29
|
-
const enableOpenLightBox = core.getResponsiveValueByScreen(setting.clickOpenLightBox, currentDevice);
|
|
30
|
-
const isDisplayByWidth = productGallery.checkDisplayGalleryByWidth({
|
|
31
|
-
shapeByLayout
|
|
32
|
-
});
|
|
33
|
-
const isDisplay = core.getResponsiveValueByScreen(isDisplayByWidth, currentDevice);
|
|
34
|
-
const isEnableBorderActive = setting?.borderActive?.border !== 'none';
|
|
35
|
-
const handleSetSrc = React.useCallback(()=>{
|
|
36
|
-
getSrcSet.handleSetSrcForProductImageList({
|
|
37
|
-
builderPropUID,
|
|
38
|
-
shapeByLayout,
|
|
39
|
-
qualityType: setting.qualityType,
|
|
40
|
-
qualityPercent: setting.qualityPercent
|
|
41
|
-
});
|
|
42
|
-
}, [
|
|
43
|
-
shapeByLayout,
|
|
44
|
-
setting.qualityPercent,
|
|
45
|
-
setting.qualityType,
|
|
46
|
-
builderPropUID
|
|
47
|
-
]);
|
|
48
|
-
React.useEffect(()=>{
|
|
49
|
-
setImageActiveIndex(activeIndexFormFeatureImage || 0);
|
|
50
|
-
}, [
|
|
51
|
-
activeIndexFormFeatureImage
|
|
52
|
-
]);
|
|
53
|
-
React.useEffect(()=>{
|
|
54
|
-
const index = filteredProductImages?.findIndex((item)=>item.id === featuredImageGlobal?.id);
|
|
55
|
-
setImageActiveIndex(index && index > 0 ? index : 0);
|
|
56
|
-
}, [
|
|
57
|
-
featuredImageGlobal,
|
|
58
|
-
filteredProductImages
|
|
59
|
-
]);
|
|
60
|
-
React.useEffect(()=>{
|
|
61
|
-
if (mode === 'edit') return;
|
|
62
|
-
const $galleryImageGrid = document?.querySelector('.grid-gallery');
|
|
63
|
-
if (!$galleryImageGrid) return;
|
|
64
|
-
handleSetSrc();
|
|
65
|
-
const observer = new ResizeObserver(()=>{
|
|
66
|
-
handleSetSrc();
|
|
67
|
-
});
|
|
68
|
-
observer?.observe($galleryImageGrid, {});
|
|
69
|
-
return ()=>{
|
|
70
|
-
observer?.disconnect();
|
|
71
|
-
};
|
|
72
|
-
}, [
|
|
73
|
-
handleSetSrc,
|
|
74
|
-
builderPropUID,
|
|
75
|
-
mode
|
|
76
|
-
]);
|
|
77
|
-
return {
|
|
78
|
-
isDisplay,
|
|
79
|
-
shapeByLayout,
|
|
80
|
-
imageActiveIndex,
|
|
81
|
-
enableOpenLightBox,
|
|
82
|
-
isEnableBorderActive,
|
|
83
|
-
filteredProductImages
|
|
84
|
-
};
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
exports.useProductGalleryGrid = useProductGalleryGrid;
|