@redneckz/wildless-cms-uni-blocks 0.14.515 → 0.14.517

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.
Files changed (56) hide show
  1. package/bundle/blocks.schema.json +1 -1
  2. package/bundle/bundle.umd.js +14 -10
  3. package/bundle/bundle.umd.min.js +1 -1
  4. package/bundle/ui-kit/BaseFiltration/FiltrationSchemaContent.d.ts +2 -2
  5. package/dist/components/OfficesAtmsMap/OfficesAtmsMapLayout.js +2 -1
  6. package/dist/components/OfficesAtmsMap/OfficesAtmsMapLayout.js.map +1 -1
  7. package/dist/ui-kit/BaseFiltration/FiltrationSchemaContent.d.ts +2 -2
  8. package/dist/ui-kit/YandexMap/YandexMap.js +12 -8
  9. package/dist/ui-kit/YandexMap/YandexMap.js.map +1 -1
  10. package/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.js +2 -1
  11. package/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.js.map +1 -1
  12. package/lib/ui-kit/BaseFiltration/FiltrationSchemaContent.d.ts +2 -2
  13. package/lib/ui-kit/YandexMap/YandexMap.js +12 -8
  14. package/lib/ui-kit/YandexMap/YandexMap.js.map +1 -1
  15. package/mobile/bundle/bundle.umd.js +14 -10
  16. package/mobile/bundle/bundle.umd.min.js +1 -1
  17. package/mobile/bundle/ui-kit/BaseFiltration/FiltrationSchemaContent.d.ts +2 -2
  18. package/mobile/dist/components/OfficesAtmsMap/OfficesAtmsMapLayout.js +2 -1
  19. package/mobile/dist/components/OfficesAtmsMap/OfficesAtmsMapLayout.js.map +1 -1
  20. package/mobile/dist/ui-kit/BaseFiltration/FiltrationSchemaContent.d.ts +2 -2
  21. package/mobile/dist/ui-kit/YandexMap/YandexMap.js +12 -8
  22. package/mobile/dist/ui-kit/YandexMap/YandexMap.js.map +1 -1
  23. package/mobile/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.js +2 -1
  24. package/mobile/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.js.map +1 -1
  25. package/mobile/lib/ui-kit/BaseFiltration/FiltrationSchemaContent.d.ts +2 -2
  26. package/mobile/lib/ui-kit/YandexMap/YandexMap.js +12 -8
  27. package/mobile/lib/ui-kit/YandexMap/YandexMap.js.map +1 -1
  28. package/mobile/src/components/BankAccountFiltration/BankAccountFiltration.example.json +1 -1
  29. package/mobile/src/components/BankAccountFiltration/BankAccountFiltration.ui.json +8 -3
  30. package/mobile/src/components/CalculatorBonus/CalculatorBonus.example.json +6 -1
  31. package/mobile/src/components/CalculatorBusinessDeposit/CalculatorBusinessDeposit.example.json +6 -0
  32. package/mobile/src/components/CalculatorCredit/CalculatorCredit.example.json +6 -0
  33. package/mobile/src/components/CalculatorDeposit/CalculatorDeposit.example.json +6 -0
  34. package/mobile/src/components/CalculatorRefinancing/CalculatorRefinancing.example.json +6 -0
  35. package/mobile/src/components/DepositFiltration/DepositFiltration.example.json +1 -1
  36. package/mobile/src/components/DepositFiltration/DepositFiltration.ui.json +8 -3
  37. package/mobile/src/components/MortgageFiltration/MortgageFiltration.example.json +1 -1
  38. package/mobile/src/components/MortgageFiltration/MortgageFiltration.ui.json +8 -3
  39. package/mobile/src/components/OfficesAtmsMap/OfficesAtmsMapLayout.tsx +2 -1
  40. package/mobile/src/ui-kit/BaseFiltration/FiltrationSchemaContent.ts +2 -2
  41. package/mobile/src/ui-kit/YandexMap/YandexMap.tsx +14 -8
  42. package/package.json +1 -1
  43. package/src/components/BankAccountFiltration/BankAccountFiltration.example.json +1 -1
  44. package/src/components/BankAccountFiltration/BankAccountFiltration.ui.json +8 -3
  45. package/src/components/CalculatorBonus/CalculatorBonus.example.json +6 -1
  46. package/src/components/CalculatorBusinessDeposit/CalculatorBusinessDeposit.example.json +6 -0
  47. package/src/components/CalculatorCredit/CalculatorCredit.example.json +6 -0
  48. package/src/components/CalculatorDeposit/CalculatorDeposit.example.json +6 -0
  49. package/src/components/CalculatorRefinancing/CalculatorRefinancing.example.json +6 -0
  50. package/src/components/DepositFiltration/DepositFiltration.example.json +1 -1
  51. package/src/components/DepositFiltration/DepositFiltration.ui.json +8 -3
  52. package/src/components/MortgageFiltration/MortgageFiltration.example.json +1 -1
  53. package/src/components/MortgageFiltration/MortgageFiltration.ui.json +8 -3
  54. package/src/components/OfficesAtmsMap/OfficesAtmsMapLayout.tsx +2 -1
  55. package/src/ui-kit/BaseFiltration/FiltrationSchemaContent.ts +2 -2
  56. package/src/ui-kit/YandexMap/YandexMap.tsx +14 -8
@@ -28,6 +28,10 @@ export const YandexMap = JSX<YandexMapProps>(({ points, className = '', zoom = 5
28
28
  const yandexMaps = useYandexMaps();
29
29
 
30
30
  useEffect(() => {
31
+ if (!points?.length) {
32
+ return;
33
+ }
34
+
31
35
  if (!map?.current) {
32
36
  yandexMaps?.ready(() => {
33
37
  // Ready function may be called few times, but must be called once
@@ -36,7 +40,7 @@ export const YandexMap = JSX<YandexMapProps>(({ points, className = '', zoom = 5
36
40
  }
37
41
 
38
42
  map.current = new yandexMaps.Map('map', {
39
- center: points ? getCenterPoint(points) : DEFAULT_CENTER_COORDS,
43
+ center: getCenterPoint(points),
40
44
  zoom,
41
45
  controls: [],
42
46
  suppressMapOpenBlock: true,
@@ -47,9 +51,7 @@ export const YandexMap = JSX<YandexMapProps>(({ points, className = '', zoom = 5
47
51
  } else if (yandexMaps) {
48
52
  renderClusterer({ yandexMaps, map: map.current, points });
49
53
 
50
- if (!points?.length) {
51
- map.current.setCenter(DEFAULT_CENTER_COORDS);
52
- }
54
+ map.current.setCenter(getCenterPoint(points));
53
55
  }
54
56
  }, [yandexMaps, points, zoom]);
55
57
 
@@ -75,10 +77,14 @@ export const YandexMap = JSX<YandexMapProps>(({ points, className = '', zoom = 5
75
77
  );
76
78
  });
77
79
 
78
- const getCenterPoint = (points: BalloonPoints[]) => [
79
- getArraySumAndAverage(mapByIndex(points, 0)),
80
- getArraySumAndAverage(mapByIndex(points, 1)),
81
- ];
80
+ const getCenterPoint = (points?: BalloonPoints[]) => {
81
+ const centerCoords = [
82
+ getArraySumAndAverage(mapByIndex(points, 0)),
83
+ getArraySumAndAverage(mapByIndex(points, 1)),
84
+ ];
85
+
86
+ return centerCoords.every((_) => _) ? centerCoords : DEFAULT_CENTER_COORDS;
87
+ };
82
88
 
83
89
  const mapByIndex = (points: BalloonPoints[], index: number) => points.map((_) => _.coords[index]);
84
90