@gem-sdk/components 2.0.0-dev.573 → 2.0.0-dev.575
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/carousel/setting/configs/uiV2.js +9 -9
- package/dist/cjs/marquee/setting/configs/childImageTemplate.js +1 -1
- package/dist/cjs/product/components/ProductImagesV2/index.js +10 -11
- package/dist/cjs/product/components/ProductList/common/getClass.js +2 -2
- package/dist/cjs/product/setting/product-image-v2/configs/setting-v2/index.js +19 -19
- package/dist/cjs/product/setting/product-image-v2/configs/uiV2.js +2 -2
- package/dist/esm/carousel/setting/configs/uiV2.js +9 -9
- package/dist/esm/marquee/setting/configs/childImageTemplate.js +1 -1
- package/dist/esm/product/components/ProductImagesV2/index.js +11 -12
- package/dist/esm/product/components/ProductList/common/getClass.js +2 -2
- package/dist/esm/product/setting/product-image-v2/configs/setting-v2/index.js +19 -19
- package/dist/esm/product/setting/product-image-v2/configs/uiV2.js +2 -2
- package/package.json +2 -2
|
@@ -73,7 +73,7 @@ const carouselNavigationSettings = {
|
|
|
73
73
|
en: 'Padding'
|
|
74
74
|
},
|
|
75
75
|
controlConfig: {
|
|
76
|
-
id: 'padding',
|
|
76
|
+
id: 'arrow-button-padding',
|
|
77
77
|
type: 'padding-v2',
|
|
78
78
|
linkWithSetting: {
|
|
79
79
|
name: 'arrowButtonSize',
|
|
@@ -262,18 +262,18 @@ const carouselEffectsSettings = {
|
|
|
262
262
|
setting: {
|
|
263
263
|
id: 'loop'
|
|
264
264
|
}
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
label: {
|
|
268
|
+
en: 'Drag / swipe'
|
|
269
|
+
},
|
|
270
|
+
setting: {
|
|
271
|
+
id: 'enableDrag'
|
|
272
|
+
}
|
|
265
273
|
}
|
|
266
274
|
],
|
|
267
275
|
moreSettings: {
|
|
268
276
|
controls: [
|
|
269
|
-
{
|
|
270
|
-
label: {
|
|
271
|
-
en: 'Drag / swipe'
|
|
272
|
-
},
|
|
273
|
-
setting: {
|
|
274
|
-
id: 'enableDrag'
|
|
275
|
-
}
|
|
276
|
-
},
|
|
277
277
|
{
|
|
278
278
|
label: {
|
|
279
279
|
en: 'Slide speed'
|
|
@@ -40,11 +40,11 @@ const ProductImagesV2 = (props)=>{
|
|
|
40
40
|
const product = core.useProduct();
|
|
41
41
|
const currentDevice = core.useCurrentDevice();
|
|
42
42
|
const currentVariant = core.useCurrentVariant();
|
|
43
|
+
const { isChangeSelectedOption } = core.useSelectedOption();
|
|
43
44
|
const mode = core.useEditorMode();
|
|
44
45
|
const setProductFeaturedImage = core.useProductStore((s)=>s.setProductFeaturedImage);
|
|
45
46
|
// State
|
|
46
47
|
const [openLightBox, setOpenLightBox] = React.useState(false);
|
|
47
|
-
const [hasVariantAvailable, setHasVariantAvailable] = React.useState(true);
|
|
48
48
|
const getFirstVideo = (product)=>{
|
|
49
49
|
return product?.medias?.edges.find((item)=>[
|
|
50
50
|
'VIDEO',
|
|
@@ -57,36 +57,35 @@ const ProductImagesV2 = (props)=>{
|
|
|
57
57
|
const getFirst3DModal = (product)=>{
|
|
58
58
|
return product?.medias?.edges.find((item)=>item?.node?.contentType === 'MODEL_3D')?.node;
|
|
59
59
|
};
|
|
60
|
+
const isFirstActiveFeatureImage = React.useMemo(()=>setting?.typeDisplay === 'all-images' && !isChangeSelectedOption, [
|
|
61
|
+
isChangeSelectedOption,
|
|
62
|
+
setting?.typeDisplay
|
|
63
|
+
]);
|
|
60
64
|
const priorityFeatureImage = React.useMemo(()=>{
|
|
61
|
-
if (
|
|
62
|
-
setHasVariantAvailable(true);
|
|
65
|
+
if (isFirstActiveFeatureImage) {
|
|
63
66
|
let priorityItem;
|
|
64
67
|
switch(setting?.preDisplay){
|
|
65
68
|
case '1st-images':
|
|
66
69
|
priorityItem = getFirstImage(product);
|
|
67
|
-
setHasVariantAvailable(false);
|
|
68
70
|
break;
|
|
69
71
|
case '1st-3d-mode':
|
|
70
72
|
priorityItem = getFirst3DModal(product);
|
|
71
|
-
setHasVariantAvailable(false);
|
|
72
73
|
break;
|
|
73
74
|
case '1st-video':
|
|
74
75
|
priorityItem = getFirstVideo(product);
|
|
75
|
-
setHasVariantAvailable(false);
|
|
76
76
|
break;
|
|
77
77
|
case '1st-available-variant':
|
|
78
78
|
priorityItem = currentVariant?.media;
|
|
79
|
-
setHasVariantAvailable(false);
|
|
80
79
|
break;
|
|
81
80
|
}
|
|
82
81
|
setProductFeaturedImage(priorityItem);
|
|
83
82
|
return priorityItem;
|
|
84
83
|
}
|
|
85
84
|
}, [
|
|
86
|
-
|
|
85
|
+
isFirstActiveFeatureImage,
|
|
87
86
|
setting?.preDisplay,
|
|
88
|
-
product,
|
|
89
87
|
setProductFeaturedImage,
|
|
88
|
+
product,
|
|
90
89
|
currentVariant?.media
|
|
91
90
|
]);
|
|
92
91
|
const gallery = React.useMemo(()=>{
|
|
@@ -140,7 +139,7 @@ const ProductImagesV2 = (props)=>{
|
|
|
140
139
|
}
|
|
141
140
|
};
|
|
142
141
|
React.useEffect(()=>{
|
|
143
|
-
if (currentVariant &&
|
|
142
|
+
if (currentVariant && !isFirstActiveFeatureImage) {
|
|
144
143
|
const index = galleryIndex[currentVariant?.mediaId];
|
|
145
144
|
if (index !== undefined) {
|
|
146
145
|
const fImage = gallery[index] ?? product?.featuredImage;
|
|
@@ -155,7 +154,7 @@ const ProductImagesV2 = (props)=>{
|
|
|
155
154
|
gallery,
|
|
156
155
|
product?.featuredImage,
|
|
157
156
|
setProductFeaturedImage,
|
|
158
|
-
|
|
157
|
+
isFirstActiveFeatureImage
|
|
159
158
|
]);
|
|
160
159
|
const isRenderLightBox = React.useMemo(()=>{
|
|
161
160
|
const isRender = core.getResponsiveValueByScreen(setting?.ftClickOpenLightBox, currentDevice) === 'popup' || core.getResponsiveValueByScreen(setting?.clickOpenLightBox, currentDevice);
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var system = require('@gem-sdk/system');
|
|
4
4
|
|
|
5
5
|
const getClass = (props)=>{
|
|
6
|
-
const { setting, className, builderProps, advanced } = props;
|
|
6
|
+
const { setting, className, builderProps, advanced, styles } = props;
|
|
7
7
|
const gridLayoutClass = system.createClass({
|
|
8
8
|
...className && {
|
|
9
9
|
[className]: true
|
|
@@ -18,7 +18,7 @@ const getClass = (props)=>{
|
|
|
18
18
|
'gp-relative gp-flex': true
|
|
19
19
|
});
|
|
20
20
|
const gpProductClass = system.createClass({
|
|
21
|
-
'gp-contents': setting?.sameHeight
|
|
21
|
+
'gp-contents': setting?.sameHeight && styles?.layout === 'grid'
|
|
22
22
|
});
|
|
23
23
|
const carouselClass = system.createClass({
|
|
24
24
|
'gp-justify-center': true,
|
|
@@ -205,25 +205,6 @@ const ProductImageSettingsV2 = [
|
|
|
205
205
|
type: 'p-image-layout',
|
|
206
206
|
iconName: 'gp-product-image-layout-right'
|
|
207
207
|
},
|
|
208
|
-
{
|
|
209
|
-
label: 'Featured only',
|
|
210
|
-
value: 'only-feature',
|
|
211
|
-
type: 'p-image-layout',
|
|
212
|
-
iconName: 'gp-product-image-layout-featured-only'
|
|
213
|
-
},
|
|
214
|
-
{
|
|
215
|
-
label: 'Image list 2 col',
|
|
216
|
-
value: 'two-col',
|
|
217
|
-
type: 'p-image-layout',
|
|
218
|
-
iconName: 'gp-product-image-layout-two-col'
|
|
219
|
-
},
|
|
220
|
-
{
|
|
221
|
-
label: 'Image list 1 col',
|
|
222
|
-
value: 'one-col',
|
|
223
|
-
type: 'p-image-layout',
|
|
224
|
-
iconName: 'gp-product-image-layout-one-col',
|
|
225
|
-
noPadding: 'y'
|
|
226
|
-
},
|
|
227
208
|
{
|
|
228
209
|
label: 'Image list inside bottom',
|
|
229
210
|
value: 'inside-bottom',
|
|
@@ -241,6 +222,25 @@ const ProductImageSettingsV2 = [
|
|
|
241
222
|
value: 'inside-right',
|
|
242
223
|
type: 'p-image-layout',
|
|
243
224
|
iconName: 'gp-product-image-layout-right-inside'
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
label: 'Featured only',
|
|
228
|
+
value: 'only-feature',
|
|
229
|
+
type: 'p-image-layout',
|
|
230
|
+
iconName: 'gp-product-image-layout-featured-only'
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
label: 'Image list 1 col',
|
|
234
|
+
value: 'one-col',
|
|
235
|
+
type: 'p-image-layout',
|
|
236
|
+
iconName: 'gp-product-image-layout-one-col',
|
|
237
|
+
noPadding: 'y'
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
label: 'Image list 2 col',
|
|
241
|
+
value: 'two-col',
|
|
242
|
+
type: 'p-image-layout',
|
|
243
|
+
iconName: 'gp-product-image-layout-two-col'
|
|
244
244
|
}
|
|
245
245
|
],
|
|
246
246
|
devices: {
|
|
@@ -423,13 +423,13 @@ const SettingUIV2 = [
|
|
|
423
423
|
},
|
|
424
424
|
{
|
|
425
425
|
label: {
|
|
426
|
-
en: '
|
|
426
|
+
en: 'Display condition'
|
|
427
427
|
},
|
|
428
428
|
conditionDisplay: '["bottom-center", "left", "right", "only-feature", "inside-bottom", "inside-left", "inside-right"].includes(position)',
|
|
429
429
|
controls: [
|
|
430
430
|
{
|
|
431
431
|
label: {
|
|
432
|
-
en: '
|
|
432
|
+
en: 'Default item'
|
|
433
433
|
},
|
|
434
434
|
setting: {
|
|
435
435
|
id: 'preDisplay'
|
|
@@ -71,7 +71,7 @@ const carouselNavigationSettings = {
|
|
|
71
71
|
en: 'Padding'
|
|
72
72
|
},
|
|
73
73
|
controlConfig: {
|
|
74
|
-
id: 'padding',
|
|
74
|
+
id: 'arrow-button-padding',
|
|
75
75
|
type: 'padding-v2',
|
|
76
76
|
linkWithSetting: {
|
|
77
77
|
name: 'arrowButtonSize',
|
|
@@ -260,18 +260,18 @@ const carouselEffectsSettings = {
|
|
|
260
260
|
setting: {
|
|
261
261
|
id: 'loop'
|
|
262
262
|
}
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
label: {
|
|
266
|
+
en: 'Drag / swipe'
|
|
267
|
+
},
|
|
268
|
+
setting: {
|
|
269
|
+
id: 'enableDrag'
|
|
270
|
+
}
|
|
263
271
|
}
|
|
264
272
|
],
|
|
265
273
|
moreSettings: {
|
|
266
274
|
controls: [
|
|
267
|
-
{
|
|
268
|
-
label: {
|
|
269
|
-
en: 'Drag / swipe'
|
|
270
|
-
},
|
|
271
|
-
setting: {
|
|
272
|
-
id: 'enableDrag'
|
|
273
|
-
}
|
|
274
|
-
},
|
|
275
275
|
{
|
|
276
276
|
label: {
|
|
277
277
|
en: 'Slide speed'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { setDefaultWhenUndefineSetting, getAspectRatio } from './common/common.js';
|
|
4
|
-
import { useProductShopifyEditLink, useProduct, useCurrentDevice, useCurrentVariant, useEditorMode, useProductStore, getResponsiveValueByScreen, filterToolbarPreview } from '@gem-sdk/core';
|
|
4
|
+
import { useProductShopifyEditLink, useProduct, useCurrentDevice, useCurrentVariant, useSelectedOption, useEditorMode, useProductStore, getResponsiveValueByScreen, filterToolbarPreview } from '@gem-sdk/core';
|
|
5
5
|
import { useMemo, useState, useEffect, Children, isValidElement } from 'react';
|
|
6
6
|
import FeatureImageWithGallery from './components/feature-gallery/FeatureImageWithGallery.js';
|
|
7
7
|
import OnlyFeatureImage from './components/feature-only/OnlyFeatureImage.js';
|
|
@@ -36,11 +36,11 @@ const ProductImagesV2 = (props)=>{
|
|
|
36
36
|
const product = useProduct();
|
|
37
37
|
const currentDevice = useCurrentDevice();
|
|
38
38
|
const currentVariant = useCurrentVariant();
|
|
39
|
+
const { isChangeSelectedOption } = useSelectedOption();
|
|
39
40
|
const mode = useEditorMode();
|
|
40
41
|
const setProductFeaturedImage = useProductStore((s)=>s.setProductFeaturedImage);
|
|
41
42
|
// State
|
|
42
43
|
const [openLightBox, setOpenLightBox] = useState(false);
|
|
43
|
-
const [hasVariantAvailable, setHasVariantAvailable] = useState(true);
|
|
44
44
|
const getFirstVideo = (product)=>{
|
|
45
45
|
return product?.medias?.edges.find((item)=>[
|
|
46
46
|
'VIDEO',
|
|
@@ -53,36 +53,35 @@ const ProductImagesV2 = (props)=>{
|
|
|
53
53
|
const getFirst3DModal = (product)=>{
|
|
54
54
|
return product?.medias?.edges.find((item)=>item?.node?.contentType === 'MODEL_3D')?.node;
|
|
55
55
|
};
|
|
56
|
+
const isFirstActiveFeatureImage = useMemo(()=>setting?.typeDisplay === 'all-images' && !isChangeSelectedOption, [
|
|
57
|
+
isChangeSelectedOption,
|
|
58
|
+
setting?.typeDisplay
|
|
59
|
+
]);
|
|
56
60
|
const priorityFeatureImage = useMemo(()=>{
|
|
57
|
-
if (
|
|
58
|
-
setHasVariantAvailable(true);
|
|
61
|
+
if (isFirstActiveFeatureImage) {
|
|
59
62
|
let priorityItem;
|
|
60
63
|
switch(setting?.preDisplay){
|
|
61
64
|
case '1st-images':
|
|
62
65
|
priorityItem = getFirstImage(product);
|
|
63
|
-
setHasVariantAvailable(false);
|
|
64
66
|
break;
|
|
65
67
|
case '1st-3d-mode':
|
|
66
68
|
priorityItem = getFirst3DModal(product);
|
|
67
|
-
setHasVariantAvailable(false);
|
|
68
69
|
break;
|
|
69
70
|
case '1st-video':
|
|
70
71
|
priorityItem = getFirstVideo(product);
|
|
71
|
-
setHasVariantAvailable(false);
|
|
72
72
|
break;
|
|
73
73
|
case '1st-available-variant':
|
|
74
74
|
priorityItem = currentVariant?.media;
|
|
75
|
-
setHasVariantAvailable(false);
|
|
76
75
|
break;
|
|
77
76
|
}
|
|
78
77
|
setProductFeaturedImage(priorityItem);
|
|
79
78
|
return priorityItem;
|
|
80
79
|
}
|
|
81
80
|
}, [
|
|
82
|
-
|
|
81
|
+
isFirstActiveFeatureImage,
|
|
83
82
|
setting?.preDisplay,
|
|
84
|
-
product,
|
|
85
83
|
setProductFeaturedImage,
|
|
84
|
+
product,
|
|
86
85
|
currentVariant?.media
|
|
87
86
|
]);
|
|
88
87
|
const gallery = useMemo(()=>{
|
|
@@ -136,7 +135,7 @@ const ProductImagesV2 = (props)=>{
|
|
|
136
135
|
}
|
|
137
136
|
};
|
|
138
137
|
useEffect(()=>{
|
|
139
|
-
if (currentVariant &&
|
|
138
|
+
if (currentVariant && !isFirstActiveFeatureImage) {
|
|
140
139
|
const index = galleryIndex[currentVariant?.mediaId];
|
|
141
140
|
if (index !== undefined) {
|
|
142
141
|
const fImage = gallery[index] ?? product?.featuredImage;
|
|
@@ -151,7 +150,7 @@ const ProductImagesV2 = (props)=>{
|
|
|
151
150
|
gallery,
|
|
152
151
|
product?.featuredImage,
|
|
153
152
|
setProductFeaturedImage,
|
|
154
|
-
|
|
153
|
+
isFirstActiveFeatureImage
|
|
155
154
|
]);
|
|
156
155
|
const isRenderLightBox = useMemo(()=>{
|
|
157
156
|
const isRender = getResponsiveValueByScreen(setting?.ftClickOpenLightBox, currentDevice) === 'popup' || getResponsiveValueByScreen(setting?.clickOpenLightBox, currentDevice);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createClass } from '@gem-sdk/system';
|
|
2
2
|
|
|
3
3
|
const getClass = (props)=>{
|
|
4
|
-
const { setting, className, builderProps, advanced } = props;
|
|
4
|
+
const { setting, className, builderProps, advanced, styles } = props;
|
|
5
5
|
const gridLayoutClass = createClass({
|
|
6
6
|
...className && {
|
|
7
7
|
[className]: true
|
|
@@ -16,7 +16,7 @@ const getClass = (props)=>{
|
|
|
16
16
|
'gp-relative gp-flex': true
|
|
17
17
|
});
|
|
18
18
|
const gpProductClass = createClass({
|
|
19
|
-
'gp-contents': setting?.sameHeight
|
|
19
|
+
'gp-contents': setting?.sameHeight && styles?.layout === 'grid'
|
|
20
20
|
});
|
|
21
21
|
const carouselClass = createClass({
|
|
22
22
|
'gp-justify-center': true,
|
|
@@ -203,25 +203,6 @@ const ProductImageSettingsV2 = [
|
|
|
203
203
|
type: 'p-image-layout',
|
|
204
204
|
iconName: 'gp-product-image-layout-right'
|
|
205
205
|
},
|
|
206
|
-
{
|
|
207
|
-
label: 'Featured only',
|
|
208
|
-
value: 'only-feature',
|
|
209
|
-
type: 'p-image-layout',
|
|
210
|
-
iconName: 'gp-product-image-layout-featured-only'
|
|
211
|
-
},
|
|
212
|
-
{
|
|
213
|
-
label: 'Image list 2 col',
|
|
214
|
-
value: 'two-col',
|
|
215
|
-
type: 'p-image-layout',
|
|
216
|
-
iconName: 'gp-product-image-layout-two-col'
|
|
217
|
-
},
|
|
218
|
-
{
|
|
219
|
-
label: 'Image list 1 col',
|
|
220
|
-
value: 'one-col',
|
|
221
|
-
type: 'p-image-layout',
|
|
222
|
-
iconName: 'gp-product-image-layout-one-col',
|
|
223
|
-
noPadding: 'y'
|
|
224
|
-
},
|
|
225
206
|
{
|
|
226
207
|
label: 'Image list inside bottom',
|
|
227
208
|
value: 'inside-bottom',
|
|
@@ -239,6 +220,25 @@ const ProductImageSettingsV2 = [
|
|
|
239
220
|
value: 'inside-right',
|
|
240
221
|
type: 'p-image-layout',
|
|
241
222
|
iconName: 'gp-product-image-layout-right-inside'
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
label: 'Featured only',
|
|
226
|
+
value: 'only-feature',
|
|
227
|
+
type: 'p-image-layout',
|
|
228
|
+
iconName: 'gp-product-image-layout-featured-only'
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
label: 'Image list 1 col',
|
|
232
|
+
value: 'one-col',
|
|
233
|
+
type: 'p-image-layout',
|
|
234
|
+
iconName: 'gp-product-image-layout-one-col',
|
|
235
|
+
noPadding: 'y'
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
label: 'Image list 2 col',
|
|
239
|
+
value: 'two-col',
|
|
240
|
+
type: 'p-image-layout',
|
|
241
|
+
iconName: 'gp-product-image-layout-two-col'
|
|
242
242
|
}
|
|
243
243
|
],
|
|
244
244
|
devices: {
|
|
@@ -421,13 +421,13 @@ const SettingUIV2 = [
|
|
|
421
421
|
},
|
|
422
422
|
{
|
|
423
423
|
label: {
|
|
424
|
-
en: '
|
|
424
|
+
en: 'Display condition'
|
|
425
425
|
},
|
|
426
426
|
conditionDisplay: '["bottom-center", "left", "right", "only-feature", "inside-bottom", "inside-left", "inside-right"].includes(position)',
|
|
427
427
|
controls: [
|
|
428
428
|
{
|
|
429
429
|
label: {
|
|
430
|
-
en: '
|
|
430
|
+
en: 'Default item'
|
|
431
431
|
},
|
|
432
432
|
setting: {
|
|
433
433
|
id: 'preDisplay'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gem-sdk/components",
|
|
3
|
-
"version": "2.0.0-dev.
|
|
3
|
+
"version": "2.0.0-dev.575",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"update-img-src-3rd": "node ./scripts/update-img-src-3rd.js"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@gem-sdk/core": "2.0.0-dev.
|
|
26
|
+
"@gem-sdk/core": "2.0.0-dev.575",
|
|
27
27
|
"@gem-sdk/styles": "2.0.0-dev.571",
|
|
28
28
|
"@gem-sdk/system": "2.0.0-dev.504",
|
|
29
29
|
"@types/react-transition-group": "^4.4.5"
|