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

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
  ]
@@ -189,6 +189,48 @@ const SettingUIV2 = [
189
189
  id: 'textBadgeShadow',
190
190
  state: 'normal'
191
191
  },
192
+ options: {
193
+ updateFields: [
194
+ {
195
+ field: 'enable',
196
+ settingId: 'hasShadow',
197
+ state: 'normal'
198
+ }
199
+ ]
200
+ },
201
+ controlChangeTrigger: {
202
+ settings: [
203
+ {
204
+ condition: `shapeShadow.normal.enable === true`,
205
+ source: [
206
+ 'shapeShadow',
207
+ 'hasShadow'
208
+ ],
209
+ action: {
210
+ controlId: 'hasShadow',
211
+ groupType: 'style',
212
+ controlType: 'style',
213
+ newValue: true
214
+ }
215
+ },
216
+ {
217
+ condition: `shapeShadow.normal.enable === false`,
218
+ source: [
219
+ 'shapeShadow',
220
+ 'hasShadow'
221
+ ],
222
+ action: {
223
+ controlId: 'hasShadow',
224
+ groupType: 'style',
225
+ controlType: 'style',
226
+ newValue: false
227
+ }
228
+ }
229
+ ],
230
+ options: {
231
+ noRecordHistory: true
232
+ }
233
+ },
192
234
  conditionDisplay: 'contentType == "text"'
193
235
  }
194
236
  ]
@@ -126,7 +126,8 @@ const ProductListPreset = [
126
126
  },
127
127
  styles: {
128
128
  position: {
129
- desktop: 'only-feature'
129
+ desktop: 'only-feature',
130
+ mobile: 'only-feature'
130
131
  }
131
132
  },
132
133
  advanced: {
@@ -519,7 +520,8 @@ const ProductListPreset = [
519
520
  },
520
521
  styles: {
521
522
  position: {
522
- desktop: 'only-feature'
523
+ desktop: 'only-feature',
524
+ mobile: 'only-feature'
523
525
  }
524
526
  },
525
527
  advanced: {
@@ -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
  ]
@@ -187,6 +187,48 @@ const SettingUIV2 = [
187
187
  id: 'textBadgeShadow',
188
188
  state: 'normal'
189
189
  },
190
+ options: {
191
+ updateFields: [
192
+ {
193
+ field: 'enable',
194
+ settingId: 'hasShadow',
195
+ state: 'normal'
196
+ }
197
+ ]
198
+ },
199
+ controlChangeTrigger: {
200
+ settings: [
201
+ {
202
+ condition: `shapeShadow.normal.enable === true`,
203
+ source: [
204
+ 'shapeShadow',
205
+ 'hasShadow'
206
+ ],
207
+ action: {
208
+ controlId: 'hasShadow',
209
+ groupType: 'style',
210
+ controlType: 'style',
211
+ newValue: true
212
+ }
213
+ },
214
+ {
215
+ condition: `shapeShadow.normal.enable === false`,
216
+ source: [
217
+ 'shapeShadow',
218
+ 'hasShadow'
219
+ ],
220
+ action: {
221
+ controlId: 'hasShadow',
222
+ groupType: 'style',
223
+ controlType: 'style',
224
+ newValue: false
225
+ }
226
+ }
227
+ ],
228
+ options: {
229
+ noRecordHistory: true
230
+ }
231
+ },
190
232
  conditionDisplay: 'contentType == "text"'
191
233
  }
192
234
  ]
@@ -124,7 +124,8 @@ const ProductListPreset = [
124
124
  },
125
125
  styles: {
126
126
  position: {
127
- desktop: 'only-feature'
127
+ desktop: 'only-feature',
128
+ mobile: 'only-feature'
128
129
  }
129
130
  },
130
131
  advanced: {
@@ -517,7 +518,8 @@ const ProductListPreset = [
517
518
  },
518
519
  styles: {
519
520
  position: {
520
- desktop: 'only-feature'
521
+ desktop: 'only-feature',
522
+ mobile: 'only-feature'
521
523
  }
522
524
  },
523
525
  advanced: {
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.707",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",