@redneckz/wildless-cms-uni-blocks 0.3.64 → 0.3.65

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 (84) hide show
  1. package/bundle/blocks.schema.json +1 -1
  2. package/bundle/bundle.umd.js +9 -14
  3. package/bundle/bundle.umd.min.js +1 -1
  4. package/dist/components/Calculator/Calculator.js +5 -7
  5. package/dist/components/Calculator/Calculator.js.map +1 -1
  6. package/dist/components/Calculator/CalculatorContent.d.ts +52 -11
  7. package/dist/components/Calculator/renderCalculatorBlock.d.ts +2 -0
  8. package/dist/components/Calculator/renderCalculatorBlock.js +14 -0
  9. package/dist/components/Calculator/renderCalculatorBlock.js.map +1 -0
  10. package/dist/components/CreditCalculator/CreditCalculatorContent.d.ts +3 -0
  11. package/dist/components/GroupBlock/BlocksTypeProps.d.ts +2 -5
  12. package/dist/components/ProductGallery/ProductGallery.js +1 -1
  13. package/dist/model/EmptyOptionType.d.ts +4 -0
  14. package/dist/model/EmptyOptionType.js +2 -0
  15. package/dist/model/EmptyOptionType.js.map +1 -0
  16. package/dist/ui-kit/BlocksList/BlocksListProps.d.ts +4 -7
  17. package/lib/common.css +1 -1
  18. package/lib/components/Calculator/Calculator.js +5 -7
  19. package/lib/components/Calculator/Calculator.js.map +1 -1
  20. package/lib/components/Calculator/CalculatorContent.d.ts +52 -11
  21. package/lib/components/Calculator/renderCalculatorBlock.d.ts +2 -0
  22. package/lib/components/Calculator/renderCalculatorBlock.js +11 -0
  23. package/lib/components/Calculator/renderCalculatorBlock.js.map +1 -0
  24. package/lib/components/CreditCalculator/CreditCalculatorContent.d.ts +3 -0
  25. package/lib/components/GroupBlock/BlocksTypeProps.d.ts +2 -5
  26. package/lib/components/ProductGallery/ProductGallery.js +1 -1
  27. package/lib/model/EmptyOptionType.d.ts +4 -0
  28. package/lib/model/EmptyOptionType.js +2 -0
  29. package/lib/model/EmptyOptionType.js.map +1 -0
  30. package/lib/ui-kit/BlocksList/BlocksListProps.d.ts +4 -7
  31. package/mobile/dist/components/Calculator/Calculator.js +5 -7
  32. package/mobile/dist/components/Calculator/Calculator.js.map +1 -1
  33. package/mobile/dist/components/Calculator/CalculatorContent.d.ts +52 -11
  34. package/mobile/dist/components/Calculator/renderCalculatorBlock.d.ts +2 -0
  35. package/mobile/dist/components/Calculator/renderCalculatorBlock.js +14 -0
  36. package/mobile/dist/components/Calculator/renderCalculatorBlock.js.map +1 -0
  37. package/mobile/dist/components/CreditCalculator/CreditCalculatorContent.d.ts +3 -0
  38. package/mobile/dist/components/GroupBlock/BlocksTypeProps.d.ts +2 -5
  39. package/mobile/dist/model/EmptyOptionType.d.ts +4 -0
  40. package/mobile/dist/model/EmptyOptionType.js +2 -0
  41. package/mobile/dist/model/EmptyOptionType.js.map +1 -0
  42. package/mobile/dist/ui-kit/BlocksList/BlocksListProps.d.ts +4 -7
  43. package/mobile/lib/components/Calculator/Calculator.js +5 -7
  44. package/mobile/lib/components/Calculator/Calculator.js.map +1 -1
  45. package/mobile/lib/components/Calculator/CalculatorContent.d.ts +52 -11
  46. package/mobile/lib/components/Calculator/renderCalculatorBlock.d.ts +2 -0
  47. package/mobile/lib/components/Calculator/renderCalculatorBlock.js +11 -0
  48. package/mobile/lib/components/Calculator/renderCalculatorBlock.js.map +1 -0
  49. package/mobile/lib/components/CreditCalculator/CreditCalculatorContent.d.ts +3 -0
  50. package/mobile/lib/components/GroupBlock/BlocksTypeProps.d.ts +2 -5
  51. package/mobile/lib/model/EmptyOptionType.d.ts +4 -0
  52. package/mobile/lib/model/EmptyOptionType.js +2 -0
  53. package/mobile/lib/model/EmptyOptionType.js.map +1 -0
  54. package/mobile/lib/ui-kit/BlocksList/BlocksListProps.d.ts +4 -7
  55. package/mobile/src/components/Calculator/Calculator.example.json +21 -0
  56. package/mobile/src/components/Calculator/Calculator.tsx +6 -8
  57. package/mobile/src/components/Calculator/CalculatorContent.ts +53 -12
  58. package/mobile/src/components/Calculator/{renderCalculatorList.tsx → renderCalculatorBlock.tsx} +5 -17
  59. package/mobile/src/components/CreditCalculator/CreditCalculatorContent.ts +3 -0
  60. package/mobile/src/components/GroupBlock/BlocksTypeProps.ts +2 -6
  61. package/mobile/src/model/EmptyOptionType.ts +4 -0
  62. package/mobile/src/ui-kit/BlocksList/BlocksListProps.ts +4 -8
  63. package/package.json +1 -1
  64. package/src/components/Calculator/Calculator.example.json +21 -0
  65. package/src/components/Calculator/Calculator.tsx +6 -8
  66. package/src/components/Calculator/CalculatorContent.ts +53 -12
  67. package/src/components/Calculator/{renderCalculatorList.tsx → renderCalculatorBlock.tsx} +5 -17
  68. package/src/components/CreditCalculator/CreditCalculatorContent.ts +3 -0
  69. package/src/components/GroupBlock/BlocksTypeProps.ts +2 -6
  70. package/src/components/ProductGallery/ProductGallery.tsx +2 -2
  71. package/src/model/EmptyOptionType.ts +4 -0
  72. package/src/ui-kit/BlocksList/BlocksListProps.ts +4 -8
  73. package/dist/components/Calculator/renderCalculatorList.d.ts +0 -10
  74. package/dist/components/Calculator/renderCalculatorList.js +0 -17
  75. package/dist/components/Calculator/renderCalculatorList.js.map +0 -1
  76. package/lib/components/Calculator/renderCalculatorList.d.ts +0 -10
  77. package/lib/components/Calculator/renderCalculatorList.js +0 -14
  78. package/lib/components/Calculator/renderCalculatorList.js.map +0 -1
  79. package/mobile/dist/components/Calculator/renderCalculatorList.d.ts +0 -10
  80. package/mobile/dist/components/Calculator/renderCalculatorList.js +0 -17
  81. package/mobile/dist/components/Calculator/renderCalculatorList.js.map +0 -1
  82. package/mobile/lib/components/Calculator/renderCalculatorList.d.ts +0 -10
  83. package/mobile/lib/components/Calculator/renderCalculatorList.js +0 -14
  84. package/mobile/lib/components/Calculator/renderCalculatorList.js.map +0 -1
@@ -1,6 +1,7 @@
1
+ import { ContentPageContext } from '../../components/ContentPage/ContentPageContext';
1
2
  import type { ProductBlockContent } from '../../components/ProductBlock/ProductBlockContent';
2
3
  import type { ProductTileContent } from '../../components/ProductTile/ProductTileContent';
3
- import { ContentPageContext } from '../../components/ContentPage/ContentPageContext';
4
+ import type { EmptyOption } from '../../model/EmptyOptionType';
4
5
  export interface ActiveHandler {
5
6
  context: ContentPageContext;
6
7
  blocks?: GroupBlockDef[];
@@ -26,10 +27,6 @@ export declare type ProductBlockDef = ProductBlockContent & GroupBlockCommonProp
26
27
  export declare type ProductTileDef = ProductTileContent & GroupBlockCommonProps & {
27
28
  blockType: 'ProductTile';
28
29
  };
29
- /**
30
- * @title Выберите блок
31
- */
32
- export declare type EmptyOption = null;
33
30
  /**
34
31
  * @title Содержимое блока
35
32
  */
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Выберите блок
3
+ */
4
+ export declare type EmptyOption = null;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=EmptyOptionType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EmptyOptionType.js","sourceRoot":"","sources":["../../src/model/EmptyOptionType.ts"],"names":[],"mappings":""}
@@ -1,14 +1,15 @@
1
+ import { ContentPageContext } from '../../components/ContentPage/ContentPageContext';
1
2
  import type { GalleryContent } from '../../components/Gallery/GalleryContent';
2
3
  import type { HeadlineContent } from '../../components/Headline/HeadlineContent';
3
4
  import type { LinkDocsContent } from '../../components/LinkDocs/LinkDocsContent';
5
+ import type { LinkListContent } from '../../components/LinkList/LinkListContent';
4
6
  import type { MiniGalleryContent } from '../../components/MiniGallery/MiniGalleryContent';
5
7
  import type { PictureTextContent } from '../../components/PictureText/PictureTextContent';
6
8
  import type { ProductBlockContent } from '../../components/ProductBlock/ProductBlockContent';
7
9
  import type { ProductTileContent } from '../../components/ProductTile/ProductTileContent';
8
10
  import type { TextBlockContent } from '../../components/TextBlock/TextBlockContent';
9
11
  import type { TileContent } from '../../components/Tile/TileContent';
10
- import type { LinkListContent } from '../../components/LinkList/LinkListContent';
11
- import { ContentPageContext } from '../../components/ContentPage/ContentPageContext';
12
+ import type { EmptyOption } from '../../model/EmptyOptionType';
12
13
  export interface ActiveHandler {
13
14
  context: ContentPageContext;
14
15
  blocks?: BlockDef[];
@@ -69,7 +70,7 @@ export declare type ProductTileBlockListDef = ProductTileContent & {
69
70
  blockListType: 'ProductTile';
70
71
  };
71
72
  /**
72
- * @title Галлерея
73
+ * @title Галерея
73
74
  * @default {"blockListType": "Gallery"}
74
75
  */
75
76
  export declare type GalleryBlockListDef = GalleryContent & {
@@ -89,10 +90,6 @@ export declare type MiniGalleryBlockListDef = MiniGalleryContent & {
89
90
  export declare type LinkListBlockListDef = LinkListContent & {
90
91
  blockListType: 'LinkList';
91
92
  };
92
- /**
93
- * @title Выберите блок
94
- */
95
- export declare type EmptyOption = null;
96
93
  /**
97
94
  * @title Содержимое блока
98
95
  */
@@ -0,0 +1,21 @@
1
+ {
2
+ "calcTabs": [
3
+ {
4
+ "nav": {
5
+ "title": "Вкладка 1",
6
+ "description": "Описание вкладки 1",
7
+ "icon": { "icon": "CalendarIcon" }
8
+ },
9
+ "calculatorBlock": {
10
+ "calcType": "CreditCalculatorForm",
11
+ "buttons": [
12
+ {
13
+ "href": "#",
14
+ "text": "Кнопка 1",
15
+ "version": "primary"
16
+ }
17
+ ]
18
+ }
19
+ }
20
+ ]
21
+ }
@@ -1,10 +1,10 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
2
  import type { UniBlockProps } from '../../types';
3
- import type { CalculatorContent, CalculatorBlockDef } from './CalculatorContent';
4
3
  import { ArrowButton } from '../../ui-kit/Button/ArrowButton';
5
4
  import { Img } from '../../ui-kit/Img/Img';
6
- import { renderCalculatorList } from './renderCalculatorList';
5
+ import type { CalculatorBlockDef, CalculatorContent } from './CalculatorContent';
7
6
  import { CalculatorNav } from './CalculatorContent';
7
+ import { renderCalculatorBlock } from './renderCalculatorBlock';
8
8
 
9
9
  export interface CalculatorProps extends CalculatorContent, UniBlockProps {}
10
10
 
@@ -72,11 +72,9 @@ export const Calculator = JSX<CalculatorProps>(
72
72
  style={{ transform: `translateX(-${activeSlideIndex}00%)` }}
73
73
  role="list"
74
74
  >
75
- {renderCalculatorList({
76
- context,
77
- className,
78
- blockCalcTabs,
79
- })}
75
+ {blockCalcTabs?.length
76
+ ? blockCalcTabs.map(renderCalculatorBlock({ context, className }))
77
+ : null}
80
78
  </div>
81
79
  </section>
82
80
  );
@@ -99,7 +97,7 @@ function renderNavButton({ tab, i, activeSlideIndex, onClick }: NavButtonProps)
99
97
  key={String(i)}
100
98
  onClick={onClick}
101
99
  aria-label={tab?.title}
102
- className={`box-border font-sans relative border-[1px] border-main-stroke cursor-pointer text-left border-b-0 flex
100
+ className={`box-border font-sans relative border border-main-stroke cursor-pointer text-left border-b-0 flex
103
101
  ${btnClassName}`}
104
102
  >
105
103
  <Img
@@ -1,49 +1,96 @@
1
- import { Picture } from '../../model/Picture';
1
+ import type { EmptyOption } from '../../model/EmptyOptionType';
2
+ import type { Picture } from '../../model/Picture';
2
3
  import type { ButtonWithIconProps } from '../../ui-kit/Button/ButtonProps';
3
4
 
4
5
  export interface CommonCalculatorProps {
6
+ /** @title Кнопки */
5
7
  buttons?: ButtonWithIconProps[];
6
8
  }
7
9
 
10
+ /**
11
+ * TODO: данные из справочника
12
+ **/
8
13
  export interface CreditCalculatorParams {
14
+ /** @hidden */
9
15
  isSalary?: boolean;
16
+ /** @hidden */
10
17
  isInsurance?: boolean;
18
+ /** @hidden */
11
19
  isAnnuity?: boolean;
20
+ /** @hidden */
12
21
  minSum?: number;
22
+ /** @hidden */
13
23
  maxSum?: number;
24
+ /** @hidden */
14
25
  minMonths?: number;
26
+ /** @hidden */
15
27
  maxMonths?: number;
28
+ /** @hidden */
16
29
  rateWithInsurance?: number;
30
+ /** @hidden */
17
31
  rateWithoutInsurance?: number;
18
32
  }
19
33
 
34
+ /**
35
+ * TODO: данные из справочника
36
+ **/
20
37
  export interface MortgageCalculatorParams {
38
+ /** @hidden */
21
39
  isAnnuity?: boolean;
40
+ /** @hidden */
22
41
  minInitialContribution?: number;
42
+ /** @hidden */
23
43
  minSum?: number;
44
+ /** @hidden */
24
45
  maxSum?: number;
46
+ /** @hidden */
25
47
  minMonths?: number;
48
+ /** @hidden */
26
49
  maxMonths?: number;
50
+ /** @hidden */
27
51
  rateWithInsurance?: number;
52
+ /** @hidden */
28
53
  rateWithoutInsurance?: number;
29
54
  }
30
55
 
56
+ /**
57
+ * TODO: данные из справочника
58
+ **/
31
59
  export interface DepositCalculatorParams {
60
+ /** @hidden */
32
61
  minSum?: number;
62
+ /** @hidden */
33
63
  maxSum?: number;
64
+ /** @hidden */
34
65
  minMonths?: number;
66
+ /** @hidden */
35
67
  maxMonths?: number;
68
+ /** @hidden */
36
69
  rate?: number;
37
70
  }
38
71
 
72
+ /**
73
+ * TODO: данные из справочника
74
+ **/
75
+
39
76
  export interface BonusCalculatorParams {
77
+ /** @hidden */
40
78
  bonus?: number;
79
+ /** @hidden */
41
80
  minSumTrip?: number;
81
+ /** @hidden */
42
82
  maxSumTrip?: number;
83
+ /** @hidden */
43
84
  minSumOther?: number;
85
+ /** @hidden */
44
86
  maxSumOther?: number;
45
87
  }
46
88
 
89
+ /**
90
+ * ? Общий интерфейс для всех типов калькуляторов?
91
+ * ? Используется во вложенных функциях. Может быть как то разбить это и вынести отсюда?
92
+ * @hidden
93
+ */
47
94
  export interface CalculatorParams {
48
95
  isAnnuity?: boolean;
49
96
  minSum?: number;
@@ -55,7 +102,7 @@ export interface CalculatorParams {
55
102
  }
56
103
 
57
104
  /**
58
- * @title Заголовок
105
+ * @title Кредитный калькулятор
59
106
  * @default {"calcType": "CreditCalculatorForm"}
60
107
  */
61
108
  export type CreditCalculatorParamsDef = CreditCalculatorParams &
@@ -64,7 +111,7 @@ export type CreditCalculatorParamsDef = CreditCalculatorParams &
64
111
  };
65
112
 
66
113
  /**
67
- * @title Заголовок
114
+ * @title Ипотечный калькулятор
68
115
  * @default {"calcType": "MortgageCalculatorForm"}
69
116
  */
70
117
  export type MortgageCalculatorParamsDef = MortgageCalculatorParams &
@@ -73,7 +120,7 @@ export type MortgageCalculatorParamsDef = MortgageCalculatorParams &
73
120
  };
74
121
 
75
122
  /**
76
- * @title Заголовок
123
+ * @title Калькулятор вкладов
77
124
  * @default {"calcType": "DepositCalculatorForm"}
78
125
  */
79
126
  export type DepositCalculatorParamsDef = DepositCalculatorParams &
@@ -82,7 +129,7 @@ export type DepositCalculatorParamsDef = DepositCalculatorParams &
82
129
  };
83
130
 
84
131
  /**
85
- * @title Заголовок
132
+ * @title Калькулятор бонусов
86
133
  * @default {"calcType": "BonusCalculatorForm"}
87
134
  */
88
135
  export type BonusCalculatorParamsDef = BonusCalculatorParams &
@@ -91,12 +138,7 @@ export type BonusCalculatorParamsDef = BonusCalculatorParams &
91
138
  };
92
139
 
93
140
  /**
94
- * @title Выберите калькулятор
95
- */
96
- export type EmptyOption = null;
97
-
98
- /**
99
- * @title Калькулятор
141
+ * @title Настройки калькулятора
100
142
  */
101
143
  export type CalculatorBlockDef =
102
144
  | EmptyOption
@@ -121,7 +163,6 @@ export interface CalculatorNav {
121
163
  */
122
164
  export interface CalculatorTab {
123
165
  nav?: CalculatorNav;
124
- /** @title Настройки калькулятора */
125
166
  calculatorBlock?: CalculatorBlockDef;
126
167
  }
127
168
 
@@ -9,15 +9,7 @@ type EmbeddableCalcBlocks = {
9
9
  className?: string;
10
10
  };
11
11
 
12
- export const renderCalculatorList = ({
13
- blockCalcTabs,
14
- context,
15
- className,
16
- }: EmbeddableCalcBlocks) => {
17
- return blockCalcTabs?.length ? blockCalcTabs.map(renderBlock({ context, className })) : null;
18
- };
19
-
20
- const renderBlock =
12
+ export const renderCalculatorBlock =
21
13
  ({ context, className }: any) =>
22
14
  (blockCalcTabs: CalculatorBlockDef, i: number) => {
23
15
  const type = blockCalcTabs?.calcType;
@@ -27,16 +19,12 @@ const renderBlock =
27
19
  const EmbeddedBlock: JSXBlock<EmbeddableCalcProps> = EmbeddableCalcBlocks[type];
28
20
  return (
29
21
  <section
30
- key={`${String(i)}`}
31
- className={`box-border relative flex grow-0 shrink-0 basis-full ${className}`}
22
+ key={String(i)}
23
+ className={`box-border relative flex shrink-0 basis-full ${className}`}
32
24
  role="listitem"
33
25
  >
34
- <div className={`box-border p-9 w-full`}>
35
- <EmbeddedBlock
36
- context={context}
37
- {...blockCalcTabs}
38
- className="!p-0 flex justify-between"
39
- />
26
+ <div className="box-border p-9 w-full">
27
+ <EmbeddedBlock context={context} {...blockCalcTabs} className="flex justify-between" />
40
28
  </div>
41
29
  </section>
42
30
  );
@@ -1,5 +1,8 @@
1
1
  import type { Tab } from '../../ui-kit/Tabs/TabsProps';
2
2
 
3
+ /**
4
+ * @hidden
5
+ */
3
6
  export interface CalculatorParams {
4
7
  isAnnuity?: boolean;
5
8
  minSum?: number;
@@ -1,6 +1,7 @@
1
+ import { ContentPageContext } from '../../components/ContentPage/ContentPageContext';
1
2
  import type { ProductBlockContent } from '../../components/ProductBlock/ProductBlockContent';
2
3
  import type { ProductTileContent } from '../../components/ProductTile/ProductTileContent';
3
- import { ContentPageContext } from '../../components/ContentPage/ContentPageContext';
4
+ import type { EmptyOption } from '../../model/EmptyOptionType';
4
5
 
5
6
  export interface ActiveHandler {
6
7
  context: ContentPageContext;
@@ -29,11 +30,6 @@ export type ProductBlockDef = ProductBlockContent &
29
30
  export type ProductTileDef = ProductTileContent &
30
31
  GroupBlockCommonProps & { blockType: 'ProductTile' };
31
32
 
32
- /**
33
- * @title Выберите блок
34
- */
35
- export type EmptyOption = null;
36
-
37
33
  /**
38
34
  * @title Содержимое блока
39
35
  */
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Выберите блок
3
+ */
4
+ export type EmptyOption = null;
@@ -1,14 +1,15 @@
1
+ import { ContentPageContext } from '../../components/ContentPage/ContentPageContext';
1
2
  import type { GalleryContent } from '../../components/Gallery/GalleryContent';
2
3
  import type { HeadlineContent } from '../../components/Headline/HeadlineContent';
3
4
  import type { LinkDocsContent } from '../../components/LinkDocs/LinkDocsContent';
5
+ import type { LinkListContent } from '../../components/LinkList/LinkListContent';
4
6
  import type { MiniGalleryContent } from '../../components/MiniGallery/MiniGalleryContent';
5
7
  import type { PictureTextContent } from '../../components/PictureText/PictureTextContent';
6
8
  import type { ProductBlockContent } from '../../components/ProductBlock/ProductBlockContent';
7
9
  import type { ProductTileContent } from '../../components/ProductTile/ProductTileContent';
8
10
  import type { TextBlockContent } from '../../components/TextBlock/TextBlockContent';
9
11
  import type { TileContent } from '../../components/Tile/TileContent';
10
- import type { LinkListContent } from '../../components/LinkList/LinkListContent';
11
- import { ContentPageContext } from '../../components/ContentPage/ContentPageContext';
12
+ import type { EmptyOption } from '../../model/EmptyOptionType';
12
13
 
13
14
  export interface ActiveHandler {
14
15
  context: ContentPageContext;
@@ -65,7 +66,7 @@ export type TileBlockListDef = TileContent & { blockListType: 'Tile' };
65
66
  export type ProductTileBlockListDef = ProductTileContent & { blockListType: 'ProductTile' };
66
67
 
67
68
  /**
68
- * @title Галлерея
69
+ * @title Галерея
69
70
  * @default {"blockListType": "Gallery"}
70
71
  */
71
72
  export type GalleryBlockListDef = GalleryContent & { blockListType: 'Gallery' };
@@ -82,11 +83,6 @@ export type MiniGalleryBlockListDef = MiniGalleryContent & { blockListType: 'Min
82
83
  */
83
84
  export type LinkListBlockListDef = LinkListContent & { blockListType: 'LinkList' };
84
85
 
85
- /**
86
- * @title Выберите блок
87
- */
88
- export type EmptyOption = null;
89
-
90
86
  /**
91
87
  * @title Содержимое блока
92
88
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redneckz/wildless-cms-uni-blocks",
3
- "version": "0.3.64",
3
+ "version": "0.3.65",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "author": "ЦК",
@@ -0,0 +1,21 @@
1
+ {
2
+ "calcTabs": [
3
+ {
4
+ "nav": {
5
+ "title": "Вкладка 1",
6
+ "description": "Описание вкладки 1",
7
+ "icon": { "icon": "CalendarIcon" }
8
+ },
9
+ "calculatorBlock": {
10
+ "calcType": "CreditCalculatorForm",
11
+ "buttons": [
12
+ {
13
+ "href": "#",
14
+ "text": "Кнопка 1",
15
+ "version": "primary"
16
+ }
17
+ ]
18
+ }
19
+ }
20
+ ]
21
+ }
@@ -1,10 +1,10 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
2
  import type { UniBlockProps } from '../../types';
3
- import type { CalculatorContent, CalculatorBlockDef } from './CalculatorContent';
4
3
  import { ArrowButton } from '../../ui-kit/Button/ArrowButton';
5
4
  import { Img } from '../../ui-kit/Img/Img';
6
- import { renderCalculatorList } from './renderCalculatorList';
5
+ import type { CalculatorBlockDef, CalculatorContent } from './CalculatorContent';
7
6
  import { CalculatorNav } from './CalculatorContent';
7
+ import { renderCalculatorBlock } from './renderCalculatorBlock';
8
8
 
9
9
  export interface CalculatorProps extends CalculatorContent, UniBlockProps {}
10
10
 
@@ -72,11 +72,9 @@ export const Calculator = JSX<CalculatorProps>(
72
72
  style={{ transform: `translateX(-${activeSlideIndex}00%)` }}
73
73
  role="list"
74
74
  >
75
- {renderCalculatorList({
76
- context,
77
- className,
78
- blockCalcTabs,
79
- })}
75
+ {blockCalcTabs?.length
76
+ ? blockCalcTabs.map(renderCalculatorBlock({ context, className }))
77
+ : null}
80
78
  </div>
81
79
  </section>
82
80
  );
@@ -99,7 +97,7 @@ function renderNavButton({ tab, i, activeSlideIndex, onClick }: NavButtonProps)
99
97
  key={String(i)}
100
98
  onClick={onClick}
101
99
  aria-label={tab?.title}
102
- className={`box-border font-sans relative border-[1px] border-main-stroke cursor-pointer text-left border-b-0 flex
100
+ className={`box-border font-sans relative border border-main-stroke cursor-pointer text-left border-b-0 flex
103
101
  ${btnClassName}`}
104
102
  >
105
103
  <Img
@@ -1,49 +1,96 @@
1
- import { Picture } from '../../model/Picture';
1
+ import type { EmptyOption } from '../../model/EmptyOptionType';
2
+ import type { Picture } from '../../model/Picture';
2
3
  import type { ButtonWithIconProps } from '../../ui-kit/Button/ButtonProps';
3
4
 
4
5
  export interface CommonCalculatorProps {
6
+ /** @title Кнопки */
5
7
  buttons?: ButtonWithIconProps[];
6
8
  }
7
9
 
10
+ /**
11
+ * TODO: данные из справочника
12
+ **/
8
13
  export interface CreditCalculatorParams {
14
+ /** @hidden */
9
15
  isSalary?: boolean;
16
+ /** @hidden */
10
17
  isInsurance?: boolean;
18
+ /** @hidden */
11
19
  isAnnuity?: boolean;
20
+ /** @hidden */
12
21
  minSum?: number;
22
+ /** @hidden */
13
23
  maxSum?: number;
24
+ /** @hidden */
14
25
  minMonths?: number;
26
+ /** @hidden */
15
27
  maxMonths?: number;
28
+ /** @hidden */
16
29
  rateWithInsurance?: number;
30
+ /** @hidden */
17
31
  rateWithoutInsurance?: number;
18
32
  }
19
33
 
34
+ /**
35
+ * TODO: данные из справочника
36
+ **/
20
37
  export interface MortgageCalculatorParams {
38
+ /** @hidden */
21
39
  isAnnuity?: boolean;
40
+ /** @hidden */
22
41
  minInitialContribution?: number;
42
+ /** @hidden */
23
43
  minSum?: number;
44
+ /** @hidden */
24
45
  maxSum?: number;
46
+ /** @hidden */
25
47
  minMonths?: number;
48
+ /** @hidden */
26
49
  maxMonths?: number;
50
+ /** @hidden */
27
51
  rateWithInsurance?: number;
52
+ /** @hidden */
28
53
  rateWithoutInsurance?: number;
29
54
  }
30
55
 
56
+ /**
57
+ * TODO: данные из справочника
58
+ **/
31
59
  export interface DepositCalculatorParams {
60
+ /** @hidden */
32
61
  minSum?: number;
62
+ /** @hidden */
33
63
  maxSum?: number;
64
+ /** @hidden */
34
65
  minMonths?: number;
66
+ /** @hidden */
35
67
  maxMonths?: number;
68
+ /** @hidden */
36
69
  rate?: number;
37
70
  }
38
71
 
72
+ /**
73
+ * TODO: данные из справочника
74
+ **/
75
+
39
76
  export interface BonusCalculatorParams {
77
+ /** @hidden */
40
78
  bonus?: number;
79
+ /** @hidden */
41
80
  minSumTrip?: number;
81
+ /** @hidden */
42
82
  maxSumTrip?: number;
83
+ /** @hidden */
43
84
  minSumOther?: number;
85
+ /** @hidden */
44
86
  maxSumOther?: number;
45
87
  }
46
88
 
89
+ /**
90
+ * ? Общий интерфейс для всех типов калькуляторов?
91
+ * ? Используется во вложенных функциях. Может быть как то разбить это и вынести отсюда?
92
+ * @hidden
93
+ */
47
94
  export interface CalculatorParams {
48
95
  isAnnuity?: boolean;
49
96
  minSum?: number;
@@ -55,7 +102,7 @@ export interface CalculatorParams {
55
102
  }
56
103
 
57
104
  /**
58
- * @title Заголовок
105
+ * @title Кредитный калькулятор
59
106
  * @default {"calcType": "CreditCalculatorForm"}
60
107
  */
61
108
  export type CreditCalculatorParamsDef = CreditCalculatorParams &
@@ -64,7 +111,7 @@ export type CreditCalculatorParamsDef = CreditCalculatorParams &
64
111
  };
65
112
 
66
113
  /**
67
- * @title Заголовок
114
+ * @title Ипотечный калькулятор
68
115
  * @default {"calcType": "MortgageCalculatorForm"}
69
116
  */
70
117
  export type MortgageCalculatorParamsDef = MortgageCalculatorParams &
@@ -73,7 +120,7 @@ export type MortgageCalculatorParamsDef = MortgageCalculatorParams &
73
120
  };
74
121
 
75
122
  /**
76
- * @title Заголовок
123
+ * @title Калькулятор вкладов
77
124
  * @default {"calcType": "DepositCalculatorForm"}
78
125
  */
79
126
  export type DepositCalculatorParamsDef = DepositCalculatorParams &
@@ -82,7 +129,7 @@ export type DepositCalculatorParamsDef = DepositCalculatorParams &
82
129
  };
83
130
 
84
131
  /**
85
- * @title Заголовок
132
+ * @title Калькулятор бонусов
86
133
  * @default {"calcType": "BonusCalculatorForm"}
87
134
  */
88
135
  export type BonusCalculatorParamsDef = BonusCalculatorParams &
@@ -91,12 +138,7 @@ export type BonusCalculatorParamsDef = BonusCalculatorParams &
91
138
  };
92
139
 
93
140
  /**
94
- * @title Выберите калькулятор
95
- */
96
- export type EmptyOption = null;
97
-
98
- /**
99
- * @title Калькулятор
141
+ * @title Настройки калькулятора
100
142
  */
101
143
  export type CalculatorBlockDef =
102
144
  | EmptyOption
@@ -121,7 +163,6 @@ export interface CalculatorNav {
121
163
  */
122
164
  export interface CalculatorTab {
123
165
  nav?: CalculatorNav;
124
- /** @title Настройки калькулятора */
125
166
  calculatorBlock?: CalculatorBlockDef;
126
167
  }
127
168
 
@@ -9,15 +9,7 @@ type EmbeddableCalcBlocks = {
9
9
  className?: string;
10
10
  };
11
11
 
12
- export const renderCalculatorList = ({
13
- blockCalcTabs,
14
- context,
15
- className,
16
- }: EmbeddableCalcBlocks) => {
17
- return blockCalcTabs?.length ? blockCalcTabs.map(renderBlock({ context, className })) : null;
18
- };
19
-
20
- const renderBlock =
12
+ export const renderCalculatorBlock =
21
13
  ({ context, className }: any) =>
22
14
  (blockCalcTabs: CalculatorBlockDef, i: number) => {
23
15
  const type = blockCalcTabs?.calcType;
@@ -27,16 +19,12 @@ const renderBlock =
27
19
  const EmbeddedBlock: JSXBlock<EmbeddableCalcProps> = EmbeddableCalcBlocks[type];
28
20
  return (
29
21
  <section
30
- key={`${String(i)}`}
31
- className={`box-border relative flex grow-0 shrink-0 basis-full ${className}`}
22
+ key={String(i)}
23
+ className={`box-border relative flex shrink-0 basis-full ${className}`}
32
24
  role="listitem"
33
25
  >
34
- <div className={`box-border p-9 w-full`}>
35
- <EmbeddedBlock
36
- context={context}
37
- {...blockCalcTabs}
38
- className="!p-0 flex justify-between"
39
- />
26
+ <div className="box-border p-9 w-full">
27
+ <EmbeddedBlock context={context} {...blockCalcTabs} className="flex justify-between" />
40
28
  </div>
41
29
  </section>
42
30
  );
@@ -1,5 +1,8 @@
1
1
  import type { Tab } from '../../ui-kit/Tabs/TabsProps';
2
2
 
3
+ /**
4
+ * @hidden
5
+ */
3
6
  export interface CalculatorParams {
4
7
  isAnnuity?: boolean;
5
8
  minSum?: number;