@gem-sdk/components 2.0.0-dev.705 → 2.0.0-dev.706

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.
@@ -72,9 +72,10 @@ const getBackgroundImageHeroBanner = (background, enableLazyImage = false, isNot
72
72
  const srcSet = getBgImage(background);
73
73
  let result = {};
74
74
  core.DEVICES.forEach((device)=>{
75
+ const bg = core.getValueByDevice(background, device);
75
76
  result = {
76
77
  ...result,
77
- [device]: `url('${!enableLazyImage ? getSrcSet.getImageSrc(core.getResponsiveValueByScreen(srcSet, device), device, isNotLiquid) : imagePlaceholder(background)}')`
78
+ [device]: bg.type === 'color' ? 'url()' : `url('${!enableLazyImage ? getSrcSet.getImageSrc(core.getResponsiveValueByScreen(srcSet, device), device, isNotLiquid) : imagePlaceholder(background)}')`
78
79
  };
79
80
  });
80
81
  return core.makeStyleResponsive('bgi', result);
@@ -456,6 +457,7 @@ const showVideoType = (background)=>{
456
457
  ];
457
458
  return DEVICES.some((item)=>{
458
459
  const bg = core.getValueByDevice(background, item);
460
+ if (bg.type === 'color' || bg.type === 'image') return false;
459
461
  if (bg) return bg.videoType === 'html5' && bg.videoHtml5 || bg.videoType === 'youtube' && bg.video;
460
462
  return false;
461
463
  });
@@ -23,7 +23,7 @@ const getStyle = (styles, setting, style)=>{
23
23
  return filterTruthyStyles(composeStyles);
24
24
  };
25
25
  const getContainerStyle = (styles, setting)=>{
26
- const { sizeSetting, background, borderBg, cornerBg, shadowBg } = styles ?? {};
26
+ const { sizeSetting, background, borderBg, cornerBg, shadowBg, hasActiveShadow } = styles ?? {};
27
27
  const { ratioOptions, aspectRatio } = setting ?? {};
28
28
  const composeStyles = {
29
29
  ...core.makeStyleResponsive('h', core.getHeightByShapeGlobalSize(sizeSetting)),
@@ -43,7 +43,7 @@ const getContainerStyle = (styles, setting)=>{
43
43
  ...core.getStyleShadow({
44
44
  value: shadowBg,
45
45
  styleAppliedFor: 'box-shadow',
46
- isEnableShadow: shadowBg?.type !== 'none'
46
+ isEnableShadow: hasActiveShadow
47
47
  })
48
48
  };
49
49
  return filterTruthyStyles(composeStyles);
@@ -299,6 +299,47 @@ const SettingUIV2 = [
299
299
  },
300
300
  setting: {
301
301
  id: 'shadowBg'
302
+ },
303
+ options: {
304
+ updateFields: [
305
+ {
306
+ field: 'enable',
307
+ settingId: 'hasActiveShadow'
308
+ }
309
+ ]
310
+ },
311
+ controlChangeTrigger: {
312
+ settings: [
313
+ {
314
+ condition: `shadowBg.enable === true`,
315
+ source: [
316
+ 'shadowBg',
317
+ 'hasActiveShadow'
318
+ ],
319
+ action: {
320
+ controlId: 'hasActiveShadow',
321
+ groupType: 'style',
322
+ controlType: 'style',
323
+ newValue: true
324
+ }
325
+ },
326
+ {
327
+ condition: `shadowBg.enable === false`,
328
+ source: [
329
+ 'shadowBg',
330
+ 'hasActiveShadow'
331
+ ],
332
+ action: {
333
+ controlId: 'hasActiveShadow',
334
+ groupType: 'style',
335
+ controlType: 'style',
336
+ newValue: false
337
+ }
338
+ }
339
+ ],
340
+ options: {
341
+ noRecordHistory: true
342
+ }
302
343
  }
303
344
  }
304
345
  ]
@@ -70,9 +70,10 @@ const getBackgroundImageHeroBanner = (background, enableLazyImage = false, isNot
70
70
  const srcSet = getBgImage(background);
71
71
  let result = {};
72
72
  DEVICES.forEach((device)=>{
73
+ const bg = getValueByDevice(background, device);
73
74
  result = {
74
75
  ...result,
75
- [device]: `url('${!enableLazyImage ? getImageSrc(getResponsiveValueByScreen(srcSet, device), device, isNotLiquid) : imagePlaceholder(background)}')`
76
+ [device]: bg.type === 'color' ? 'url()' : `url('${!enableLazyImage ? getImageSrc(getResponsiveValueByScreen(srcSet, device), device, isNotLiquid) : imagePlaceholder(background)}')`
76
77
  };
77
78
  });
78
79
  return makeStyleResponsive('bgi', result);
@@ -454,6 +455,7 @@ const showVideoType = (background)=>{
454
455
  ];
455
456
  return DEVICES.some((item)=>{
456
457
  const bg = getValueByDevice(background, item);
458
+ if (bg.type === 'color' || bg.type === 'image') return false;
457
459
  if (bg) return bg.videoType === 'html5' && bg.videoHtml5 || bg.videoType === 'youtube' && bg.video;
458
460
  return false;
459
461
  });
@@ -21,7 +21,7 @@ const getStyle = (styles, setting, style)=>{
21
21
  return filterTruthyStyles(composeStyles);
22
22
  };
23
23
  const getContainerStyle = (styles, setting)=>{
24
- const { sizeSetting, background, borderBg, cornerBg, shadowBg } = styles ?? {};
24
+ const { sizeSetting, background, borderBg, cornerBg, shadowBg, hasActiveShadow } = styles ?? {};
25
25
  const { ratioOptions, aspectRatio } = setting ?? {};
26
26
  const composeStyles = {
27
27
  ...makeStyleResponsive('h', getHeightByShapeGlobalSize(sizeSetting)),
@@ -41,7 +41,7 @@ const getContainerStyle = (styles, setting)=>{
41
41
  ...getStyleShadow({
42
42
  value: shadowBg,
43
43
  styleAppliedFor: 'box-shadow',
44
- isEnableShadow: shadowBg?.type !== 'none'
44
+ isEnableShadow: hasActiveShadow
45
45
  })
46
46
  };
47
47
  return filterTruthyStyles(composeStyles);
@@ -297,6 +297,47 @@ const SettingUIV2 = [
297
297
  },
298
298
  setting: {
299
299
  id: 'shadowBg'
300
+ },
301
+ options: {
302
+ updateFields: [
303
+ {
304
+ field: 'enable',
305
+ settingId: 'hasActiveShadow'
306
+ }
307
+ ]
308
+ },
309
+ controlChangeTrigger: {
310
+ settings: [
311
+ {
312
+ condition: `shadowBg.enable === true`,
313
+ source: [
314
+ 'shadowBg',
315
+ 'hasActiveShadow'
316
+ ],
317
+ action: {
318
+ controlId: 'hasActiveShadow',
319
+ groupType: 'style',
320
+ controlType: 'style',
321
+ newValue: true
322
+ }
323
+ },
324
+ {
325
+ condition: `shadowBg.enable === false`,
326
+ source: [
327
+ 'shadowBg',
328
+ 'hasActiveShadow'
329
+ ],
330
+ action: {
331
+ controlId: 'hasActiveShadow',
332
+ groupType: 'style',
333
+ controlType: 'style',
334
+ newValue: false
335
+ }
336
+ }
337
+ ],
338
+ options: {
339
+ noRecordHistory: true
340
+ }
300
341
  }
301
342
  }
302
343
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/components",
3
- "version": "2.0.0-dev.705",
3
+ "version": "2.0.0-dev.706",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",