@websolutespa/bom-mixer-ui 1.7.14 → 1.7.15

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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @websolutespa/bom-mixer-ui
2
2
 
3
+ ## 1.7.15
4
+
5
+ ### Patch Changes
6
+
7
+ - Fixing: MediaImage getMediaRatio
8
+ - Updated dependencies
9
+ - @websolutespa/bom-mixer-models@1.7.9
10
+
3
11
  ## 1.7.14
4
12
 
5
13
  ### Patch Changes
package/dist/cjs/index.js CHANGED
@@ -4439,7 +4439,7 @@ function getMediaSizes(mediaQuery, ratio, size, maxWidth, maxHeight) {
4439
4439
  if (maxHeight === void 0) {
4440
4440
  maxHeight = Number.POSITIVE_INFINITY;
4441
4441
  }
4442
- // console.log('getMediaSizes', size, ratio, maxWidth);
4442
+ // console.log('getMediaSizes', mediaQuery, ratio, size, maxWidth, maxHeight);
4443
4443
  let sizes = [];
4444
4444
  if (size) {
4445
4445
  if (typeof size === 'number') {
@@ -4506,7 +4506,7 @@ function getImageProps(_a, mediaQuery) {
4506
4506
  } else if (typeof height === 'number') {
4507
4507
  useHeight = height;
4508
4508
  }
4509
- const ratio = getMediaRatio(props);
4509
+ const ratio = getMediaRatio(useWidth, useHeight, props.aspectRatio, props.aspectRatioSm, props.aspectRatioMd, props.aspectRatioLg, props.aspectRatioXl);
4510
4510
  const sizes = getMediaSizes(mediaQuery, ratio, useSize, props.mediaWidth, props.mediaHeight);
4511
4511
  const imageSrc = getImageSrc(src, sizes[0][0], sizes[0][2]);
4512
4512
  const imageSrcSet = getImageSrcset(src, sizes);
@@ -4520,23 +4520,14 @@ function getImageProps(_a, mediaQuery) {
4520
4520
  height: useHeight ? `${useHeight}px` : undefined
4521
4521
  }, otherProps);
4522
4522
  }
4523
- function getMediaRatio(props) {
4524
- let width = undefined;
4525
- let height = undefined;
4526
- if (props.width) {
4527
- width = parseInt(String(props.width));
4528
- }
4529
- props.width = width;
4530
- if (props.height) {
4531
- height = parseInt(String(props.height));
4532
- }
4533
- props.height = height;
4523
+ function getMediaRatio(width, height, aspectRatio, aspectRatioSm, aspectRatioMd, aspectRatioLg, aspectRatioXl) {
4524
+ // console.log('getMediaRatio', width, height, aspectRatio);
4534
4525
  const defaultRatio = width && height ? width / height : 0;
4535
- const xs = getRatio(props.aspectRatio, defaultRatio);
4536
- const sm = getRatio(props.aspectRatioSm, xs);
4537
- const md = getRatio(props.aspectRatioMd, sm);
4538
- const lg = getRatio(props.aspectRatioLg, md);
4539
- const xl = getRatio(props.aspectRatioXl, lg);
4526
+ const xs = getRatio(aspectRatio, defaultRatio);
4527
+ const sm = getRatio(aspectRatioSm, xs);
4528
+ const md = getRatio(aspectRatioMd, sm);
4529
+ const lg = getRatio(aspectRatioLg, md);
4530
+ const xl = getRatio(aspectRatioXl, lg);
4540
4531
  const ratio = {
4541
4532
  xs,
4542
4533
  sm,
@@ -4620,16 +4611,15 @@ const MediaVideo = _a => {
4620
4611
  };
4621
4612
  React.useEffect(() => {
4622
4613
  if (videoRef.current && canLoad) {
4623
- if (videoRef.current.readyState && videoRef.current.readyState >= 2) {
4614
+ const video = videoRef.current;
4615
+ if (video.readyState && video.readyState >= 2) {
4624
4616
  if (typeof onLoaded === 'function') {
4625
4617
  onLoaded(videoRef);
4626
4618
  }
4627
4619
  } else {
4628
- videoRef.current.addEventListener('loadeddata', onLoad);
4620
+ video.addEventListener('loadeddata', onLoad);
4629
4621
  return () => {
4630
- if (videoRef.current) {
4631
- videoRef.current.removeEventListener('loadeddata', onLoad);
4632
- }
4622
+ video.removeEventListener('loadeddata', onLoad);
4633
4623
  };
4634
4624
  }
4635
4625
  }