@redneckz/wildless-cms-uni-blocks 0.14.430 → 0.14.432
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/bundle/blocks.schema.json +1 -1
- package/bundle/bundle.umd.js +117 -35
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/CalculatorDeposit/CalculatorDepositContent.d.ts +10 -0
- package/bundle/components/CalculatorDeposit/getDepositCalculatorParams.d.ts +5 -0
- package/bundle/components/CalculatorDeposit/renderDepositParamsForm.d.ts +5 -0
- package/bundle/ui-kit/Calculator/renderRate.d.ts +3 -1
- package/dist/components/CalculatorDeposit/CalculatorDeposit.js +31 -26
- package/dist/components/CalculatorDeposit/CalculatorDeposit.js.map +1 -1
- package/dist/components/CalculatorDeposit/CalculatorDepositContent.d.ts +10 -0
- package/dist/components/CalculatorDeposit/getDepositCalculatorParams.d.ts +5 -0
- package/dist/components/CalculatorDeposit/getDepositCalculatorParams.js +19 -2
- package/dist/components/CalculatorDeposit/getDepositCalculatorParams.js.map +1 -1
- package/dist/components/CalculatorDeposit/renderDepositParamsForm.d.ts +5 -0
- package/dist/components/CalculatorDeposit/renderDepositParamsForm.js +45 -0
- package/dist/components/CalculatorDeposit/renderDepositParamsForm.js.map +1 -0
- package/dist/components/CalculatorDeposit/renderDepositResult.js +1 -1
- package/dist/components/CalculatorDeposit/renderDepositResult.js.map +1 -1
- package/dist/components/Header/DropdownMenu.js +26 -2
- package/dist/components/Header/DropdownMenu.js.map +1 -1
- package/dist/ui-kit/Calculator/CalculatorStyle.js +3 -3
- package/dist/ui-kit/Calculator/CalculatorStyle.js.map +1 -1
- package/dist/ui-kit/Calculator/renderBinaryRadioButtonGroup.js +1 -2
- package/dist/ui-kit/Calculator/renderBinaryRadioButtonGroup.js.map +1 -1
- package/dist/ui-kit/Calculator/renderRate.d.ts +3 -1
- package/dist/ui-kit/Calculator/renderRate.js +1 -1
- package/dist/ui-kit/Calculator/renderRate.js.map +1 -1
- package/lib/common.css +1 -1
- package/lib/components/CalculatorDeposit/CalculatorDeposit.fixture.d.ts +1 -0
- package/lib/components/CalculatorDeposit/CalculatorDeposit.js +30 -25
- package/lib/components/CalculatorDeposit/CalculatorDeposit.js.map +1 -1
- package/lib/components/CalculatorDeposit/CalculatorDepositContent.d.ts +10 -0
- package/lib/components/CalculatorDeposit/getDepositCalculatorParams.d.ts +5 -0
- package/lib/components/CalculatorDeposit/getDepositCalculatorParams.js +19 -2
- package/lib/components/CalculatorDeposit/getDepositCalculatorParams.js.map +1 -1
- package/lib/components/CalculatorDeposit/renderDepositParamsForm.d.ts +4 -0
- package/lib/components/CalculatorDeposit/renderDepositParamsForm.js +42 -0
- package/lib/components/CalculatorDeposit/renderDepositParamsForm.js.map +1 -0
- package/lib/components/CalculatorDeposit/renderDepositResult.js +1 -1
- package/lib/components/CalculatorDeposit/renderDepositResult.js.map +1 -1
- package/lib/components/Header/DropdownMenu.js +26 -2
- package/lib/components/Header/DropdownMenu.js.map +1 -1
- package/lib/ui-kit/Calculator/CalculatorStyle.js +3 -3
- package/lib/ui-kit/Calculator/CalculatorStyle.js.map +1 -1
- package/lib/ui-kit/Calculator/renderBinaryRadioButtonGroup.js +1 -2
- package/lib/ui-kit/Calculator/renderBinaryRadioButtonGroup.js.map +1 -1
- package/lib/ui-kit/Calculator/renderRate.d.ts +3 -1
- package/lib/ui-kit/Calculator/renderRate.js +1 -1
- package/lib/ui-kit/Calculator/renderRate.js.map +1 -1
- package/mobile/bundle/bundle.umd.js +93 -33
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/components/CalculatorDeposit/CalculatorDepositContent.d.ts +10 -0
- package/mobile/bundle/components/CalculatorDeposit/getDepositCalculatorParams.d.ts +5 -0
- package/mobile/bundle/components/CalculatorDeposit/renderDepositParamsForm.d.ts +5 -0
- package/mobile/bundle/ui-kit/Calculator/renderRate.d.ts +3 -1
- package/mobile/dist/components/CalculatorDeposit/CalculatorDeposit.js +31 -26
- package/mobile/dist/components/CalculatorDeposit/CalculatorDeposit.js.map +1 -1
- package/mobile/dist/components/CalculatorDeposit/CalculatorDepositContent.d.ts +10 -0
- package/mobile/dist/components/CalculatorDeposit/getDepositCalculatorParams.d.ts +5 -0
- package/mobile/dist/components/CalculatorDeposit/getDepositCalculatorParams.js +19 -2
- package/mobile/dist/components/CalculatorDeposit/getDepositCalculatorParams.js.map +1 -1
- package/mobile/dist/components/CalculatorDeposit/renderDepositParamsForm.d.ts +5 -0
- package/mobile/dist/components/CalculatorDeposit/renderDepositParamsForm.js +45 -0
- package/mobile/dist/components/CalculatorDeposit/renderDepositParamsForm.js.map +1 -0
- package/mobile/dist/components/CalculatorDeposit/renderDepositResult.js +1 -1
- package/mobile/dist/components/CalculatorDeposit/renderDepositResult.js.map +1 -1
- package/mobile/dist/components/Header/DropdownMenu.js +26 -2
- package/mobile/dist/components/Header/DropdownMenu.js.map +1 -1
- package/mobile/dist/ui-kit/Calculator/CalculatorStyle.js +3 -3
- package/mobile/dist/ui-kit/Calculator/CalculatorStyle.js.map +1 -1
- package/mobile/dist/ui-kit/Calculator/renderBinaryRadioButtonGroup.js +1 -2
- package/mobile/dist/ui-kit/Calculator/renderBinaryRadioButtonGroup.js.map +1 -1
- package/mobile/dist/ui-kit/Calculator/renderRate.d.ts +3 -1
- package/mobile/dist/ui-kit/Calculator/renderRate.js +1 -1
- package/mobile/dist/ui-kit/Calculator/renderRate.js.map +1 -1
- package/mobile/lib/common.css +1 -1
- package/mobile/lib/components/CalculatorDeposit/CalculatorDeposit.js +30 -25
- package/mobile/lib/components/CalculatorDeposit/CalculatorDeposit.js.map +1 -1
- package/mobile/lib/components/CalculatorDeposit/CalculatorDepositContent.d.ts +10 -0
- package/mobile/lib/components/CalculatorDeposit/getDepositCalculatorParams.d.ts +5 -0
- package/mobile/lib/components/CalculatorDeposit/getDepositCalculatorParams.js +19 -2
- package/mobile/lib/components/CalculatorDeposit/getDepositCalculatorParams.js.map +1 -1
- package/mobile/lib/components/CalculatorDeposit/renderDepositParamsForm.d.ts +5 -0
- package/mobile/lib/components/CalculatorDeposit/renderDepositParamsForm.js +42 -0
- package/mobile/lib/components/CalculatorDeposit/renderDepositParamsForm.js.map +1 -0
- package/mobile/lib/components/CalculatorDeposit/renderDepositResult.js +1 -1
- package/mobile/lib/components/CalculatorDeposit/renderDepositResult.js.map +1 -1
- package/mobile/lib/components/Header/DropdownMenu.js +26 -2
- package/mobile/lib/components/Header/DropdownMenu.js.map +1 -1
- package/mobile/lib/ui-kit/Calculator/CalculatorStyle.js +3 -3
- package/mobile/lib/ui-kit/Calculator/CalculatorStyle.js.map +1 -1
- package/mobile/lib/ui-kit/Calculator/renderBinaryRadioButtonGroup.js +1 -2
- package/mobile/lib/ui-kit/Calculator/renderBinaryRadioButtonGroup.js.map +1 -1
- package/mobile/lib/ui-kit/Calculator/renderRate.d.ts +3 -1
- package/mobile/lib/ui-kit/Calculator/renderRate.js +1 -1
- package/mobile/lib/ui-kit/Calculator/renderRate.js.map +1 -1
- package/mobile/src/components/CalculatorDeposit/CalculatorDeposit.tsx +45 -41
- package/mobile/src/components/CalculatorDeposit/CalculatorDepositContent.ts +10 -0
- package/mobile/src/components/CalculatorDeposit/getDepositCalculatorParams.ts +23 -0
- package/mobile/src/components/CalculatorDeposit/renderDepositParamsForm.tsx +59 -0
- package/mobile/src/components/CalculatorDeposit/renderDepositResult.tsx +1 -1
- package/mobile/src/components/Header/DropdownMenu.tsx +34 -2
- package/mobile/src/ui-kit/Calculator/CalculatorStyle.tsx +3 -3
- package/mobile/src/ui-kit/Calculator/renderBinaryRadioButtonGroup.tsx +2 -3
- package/mobile/src/ui-kit/Calculator/renderRate.tsx +5 -1
- package/package.json +1 -1
- package/src/components/CalculatorDeposit/CalculatorDeposit.fixture.tsx +20 -0
- package/src/components/CalculatorDeposit/CalculatorDeposit.tsx +45 -41
- package/src/components/CalculatorDeposit/CalculatorDepositContent.ts +10 -0
- package/src/components/CalculatorDeposit/getDepositCalculatorParams.ts +23 -0
- package/src/components/CalculatorDeposit/renderDepositParamsForm.tsx +59 -0
- package/src/components/CalculatorDeposit/renderDepositResult.tsx +1 -1
- package/src/components/Header/DropdownMenu.tsx +34 -2
- package/src/ui-kit/Calculator/CalculatorStyle.tsx +3 -3
- package/src/ui-kit/Calculator/renderBinaryRadioButtonGroup.tsx +2 -3
- package/src/ui-kit/Calculator/renderRate.tsx +5 -1
- package/tailwind.config.cjs +1 -1
- package/bundle/ui-kit/Breadcrumb.d.ts +0 -6
- package/dist/ui-kit/Breadcrumb.d.ts +0 -6
- package/dist/ui-kit/Breadcrumb.js +0 -11
- package/dist/ui-kit/Breadcrumb.js.map +0 -1
- package/lib/ui-kit/Breadcrumb.d.ts +0 -6
- package/lib/ui-kit/Breadcrumb.js +0 -9
- package/lib/ui-kit/Breadcrumb.js.map +0 -1
- package/mobile/bundle/ui-kit/Breadcrumb.d.ts +0 -6
- package/mobile/dist/ui-kit/Breadcrumb.d.ts +0 -6
- package/mobile/dist/ui-kit/Breadcrumb.js +0 -11
- package/mobile/dist/ui-kit/Breadcrumb.js.map +0 -1
- package/mobile/lib/ui-kit/Breadcrumb.d.ts +0 -6
- package/mobile/lib/ui-kit/Breadcrumb.js +0 -9
- package/mobile/lib/ui-kit/Breadcrumb.js.map +0 -1
- package/mobile/src/ui-kit/Breadcrumb.tsx +0 -21
- package/src/ui-kit/Breadcrumb.tsx +0 -21
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "@redneckz/uni-jsx/jsx-runtime";
|
|
2
2
|
import { RadioButtonGroup, } from '../../ui-kit/RadioButtonGroup/RadioButtonGroup.js';
|
|
3
3
|
import { Text } from '../../ui-kit/Text/Text.js';
|
|
4
|
-
|
|
5
|
-
export const renderBinaryRadioButtonGroup = ({ items, title, mobileTitle = title, orientation = 'horizontal', value, radioGroupClassName, onChange, }) => (_jsxs("div", { className: "space-y-s", children: [title ? (_jsx("div", { className: "hidden @5xl:block", children: _jsx(Text, { color: "text-secondary-text", font: "font-light", children: title }) })) : null, mobileTitle ? (_jsx("div", { className: "@5xl:hidden", children: _jsx(Text, { color: "text-secondary-text", font: "font-light", children: mobileTitle }) })) : null, _jsx(RadioButtonGroup, { orientation: orientation, items: items, checkedItem: items[value ? 0 : 1].id, className: style('flex-col sm:flex-row', radioGroupClassName), onChange: (_) => onChange && onChange(_ === items[0].id) })] }));
|
|
4
|
+
export const renderBinaryRadioButtonGroup = ({ items, title, mobileTitle = title, orientation = 'horizontal', value, radioGroupClassName, onChange, }) => (_jsxs("div", { className: "grid gap-s whitespace-nowrap", children: [title ? (_jsx("div", { className: "hidden @5xl:block", children: _jsx(Text, { color: "text-secondary-text", font: "font-light", children: title }) })) : null, mobileTitle ? (_jsx("div", { className: "@5xl:hidden", children: _jsx(Text, { color: "text-secondary-text", font: "font-light", children: mobileTitle }) })) : null, _jsx(RadioButtonGroup, { orientation: orientation, items: items, checkedItem: items[value ? 0 : 1].id, className: radioGroupClassName, onChange: (_) => onChange && onChange(_ === items[0].id) })] }));
|
|
6
5
|
//# sourceMappingURL=renderBinaryRadioButtonGroup.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderBinaryRadioButtonGroup.js","sourceRoot":"","sources":["../../../src/ui-kit/Calculator/renderBinaryRadioButtonGroup.tsx"],"names":[],"mappings":";AACA,OAAO,EACL,gBAAgB,GAEjB,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"renderBinaryRadioButtonGroup.js","sourceRoot":"","sources":["../../../src/ui-kit/Calculator/renderBinaryRadioButtonGroup.tsx"],"names":[],"mappings":";AACA,OAAO,EACL,gBAAgB,GAEjB,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAY9C,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,EAC3C,KAAK,EACL,KAAK,EACL,WAAW,GAAG,KAAK,EACnB,WAAW,GAAG,YAAY,EAC1B,KAAK,EACL,mBAAmB,EACnB,QAAQ,GACoB,EAAE,EAAE,CAAC,CACjC,eAAK,SAAS,EAAC,8BAA8B,aAC1C,KAAK,CAAC,CAAC,CAAC,CACP,cAAK,SAAS,EAAC,mBAAmB,YAChC,KAAC,IAAI,IAAC,KAAK,EAAC,qBAAqB,EAAC,IAAI,EAAC,YAAY,YAChD,KAAK,GACD,GACH,CACP,CAAC,CAAC,CAAC,IAAI,EACP,WAAW,CAAC,CAAC,CAAC,CACb,cAAK,SAAS,EAAC,aAAa,YAC1B,KAAC,IAAI,IAAC,KAAK,EAAC,qBAAqB,EAAC,IAAI,EAAC,YAAY,YAChD,WAAW,GACP,GACH,CACP,CAAC,CAAC,CAAC,IAAI,EAER,KAAC,gBAAgB,IACf,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EACpC,SAAS,EAAE,mBAAmB,EAC9B,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,IAAI,QAAQ,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GACxD,IACE,CACP,CAAC"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { type VNode } from '../../model/VNode';
|
|
2
3
|
import { type RateProps } from './Rate';
|
|
3
4
|
import { type UnknownRateProps } from './UnknownRate';
|
|
4
5
|
interface RenderRateProps extends RateProps, UnknownRateProps {
|
|
5
6
|
isUnknownRateShown?: boolean;
|
|
7
|
+
children?: VNode;
|
|
6
8
|
}
|
|
7
|
-
export declare const renderRate: ({ title, rate, unit, fractionDigits, isUnknownRateShown, color, ...rest }: RenderRateProps) => JSX.Element;
|
|
9
|
+
export declare const renderRate: ({ title, rate, unit, fractionDigits, isUnknownRateShown, color, children, ...rest }: RenderRateProps) => JSX.Element;
|
|
8
10
|
export {};
|
|
@@ -2,5 +2,5 @@ import { jsx as _jsx, jsxs as _jsxs } from "@redneckz/uni-jsx/jsx-runtime";
|
|
|
2
2
|
import { CalculatorValueBlock } from './CalculatorValueBlock.js';
|
|
3
3
|
import { Rate } from './Rate.js';
|
|
4
4
|
import { UnknownRate } from './UnknownRate.js';
|
|
5
|
-
export const renderRate = ({ title = 'Ставка', rate = 0, unit = '%', fractionDigits = 2, isUnknownRateShown = true, color = 'text-secondary-text', ...rest }) => isUnknownRateShown && rate === 0 ? (_jsx(UnknownRate, { title: title, ...rest })) : (_jsxs("div", { children: [_jsx("div", { className: "hidden @xl:block", children: _jsx(Rate, { title: title, rate: rate, unit: unit, fractionDigits: fractionDigits, color: color, ...rest }) }), _jsx("div", { className: "@xl:hidden", children: _jsx(CalculatorValueBlock, { title: title, value: rate, postfix: unit, fractionDigits: fractionDigits, fixed: true, color: color, ...rest }) })] }));
|
|
5
|
+
export const renderRate = ({ title = 'Ставка', rate = 0, unit = '%', fractionDigits = 2, isUnknownRateShown = true, color = 'text-secondary-text', children, ...rest }) => isUnknownRateShown && rate === 0 ? (_jsx(UnknownRate, { title: title, ...rest })) : (_jsxs("div", { children: [_jsx("div", { className: "hidden @xl:block min-w-96", children: _jsx(Rate, { title: title, rate: rate, unit: unit, fractionDigits: fractionDigits, color: color, ...rest }) }), _jsx("div", { className: "@xl:hidden", children: _jsx(CalculatorValueBlock, { title: title, value: rate, postfix: unit, fractionDigits: fractionDigits, fixed: true, color: color, ...rest }) }), children] }));
|
|
6
6
|
//# sourceMappingURL=renderRate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderRate.js","sourceRoot":"","sources":["../../../src/ui-kit/Calculator/renderRate.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"renderRate.js","sourceRoot":"","sources":["../../../src/ui-kit/Calculator/renderRate.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAkB,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAyB,MAAM,eAAe,CAAC;AAOnE,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,EACzB,KAAK,GAAG,QAAQ,EAChB,IAAI,GAAG,CAAC,EACR,IAAI,GAAG,GAAG,EACV,cAAc,GAAG,CAAC,EAClB,kBAAkB,GAAG,IAAI,EACzB,KAAK,GAAG,qBAAqB,EAC7B,QAAQ,EACR,GAAG,IAAI,EACS,EAAE,EAAE,CACpB,kBAAkB,IAAI,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,CACjC,KAAC,WAAW,IAAC,KAAK,EAAE,KAAK,KAAM,IAAI,GAAI,CACxC,CAAC,CAAC,CAAC,CACF,0BACE,cAAK,SAAS,EAAC,2BAA2B,YACxC,KAAC,IAAI,IACH,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,IAAI,EACV,cAAc,EAAE,cAAc,EAC9B,KAAK,EAAE,KAAK,KACR,IAAI,GACR,GACE,EACN,cAAK,SAAS,EAAC,YAAY,YACzB,KAAC,oBAAoB,IACnB,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,IAAI,EACX,OAAO,EAAE,IAAI,EACb,cAAc,EAAE,cAAc,EAC9B,KAAK,EAAE,IAAI,EACX,KAAK,EAAE,KAAK,KACR,IAAI,GACR,GACE,EACL,QAAQ,IACL,CACP,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/* eslint-disable max-lines, max-lines-per-function */
|
|
2
2
|
import { useEffect } from '@redneckz/uni-jsx/lib/hooks';
|
|
3
3
|
import { type JSONRefObject } from '../../data/JSONRefObject';
|
|
4
|
-
import { useForm
|
|
4
|
+
import { useForm } from '../../hooks/useForm';
|
|
5
|
+
import { Button } from '../../ui-kit/Button/Button';
|
|
5
6
|
import { CalculatorLayout } from '../../ui-kit/Calculator/CalculatorLayout';
|
|
6
7
|
import { CalculatorStyle } from '../../ui-kit/Calculator/CalculatorStyle';
|
|
7
8
|
import { getDefaultParamsMax } from '../../ui-kit/Calculator/getDefaultParams';
|
|
@@ -10,7 +11,6 @@ import {
|
|
|
10
11
|
getMonthsDefaultValue,
|
|
11
12
|
} from '../../ui-kit/Calculator/getDefaultValues';
|
|
12
13
|
import { renderMonthsInput } from '../../ui-kit/Calculator/renderMonthsInput';
|
|
13
|
-
import { renderPayout } from '../../ui-kit/Calculator/renderPayout';
|
|
14
14
|
import { renderRate } from '../../ui-kit/Calculator/renderRate';
|
|
15
15
|
import { renderWantedSumInput } from '../../ui-kit/Calculator/renderWantedSumInput';
|
|
16
16
|
import { setDefaultParamsCalc } from '../../ui-kit/Calculator/setDefaultParamsCalc';
|
|
@@ -19,22 +19,21 @@ import { type UniBlockProps } from '../../UniBlock/UniBlockProps';
|
|
|
19
19
|
import { clamp } from '../../utils/clamp';
|
|
20
20
|
import { style } from '../../utils/style';
|
|
21
21
|
import { isDefaultParams } from '../CalculatorCredit/isDefaultParams';
|
|
22
|
-
import {
|
|
23
|
-
type CalculatorDepositContent,
|
|
24
|
-
type CalculatorDepositParamsViewSettings,
|
|
25
|
-
} from './CalculatorDepositContent';
|
|
22
|
+
import { type CalculatorDepositContent } from './CalculatorDepositContent';
|
|
26
23
|
import {
|
|
27
24
|
getDepositCalculatorParams,
|
|
28
25
|
type DepositCalculatorData,
|
|
29
|
-
type DepositCalculatorParams,
|
|
30
26
|
type DepositCalculatorSourceBookParams,
|
|
27
|
+
type TariffsButtonContent,
|
|
31
28
|
} from './getDepositCalculatorParams';
|
|
29
|
+
import { renderDepositParamsForm } from './renderDepositParamsForm';
|
|
32
30
|
import { renderDepositResult } from './renderDepositResult';
|
|
33
|
-
import { renderRegistrationType } from './renderRegistrationType';
|
|
34
31
|
|
|
35
32
|
const MAP = {
|
|
36
33
|
isMonthlyInterestPayment: 'isMonthlyInterestPayment',
|
|
37
34
|
isRemoteRegistration: 'isRemoteRegistration',
|
|
35
|
+
isReplenish: 'isReplenish',
|
|
36
|
+
isWithdrawn: 'isWithdrawn',
|
|
38
37
|
moneyValue: 'minSum',
|
|
39
38
|
};
|
|
40
39
|
|
|
@@ -49,22 +48,24 @@ export const CalculatorDeposit = UniBlock<CalculatorDepositProps>(
|
|
|
49
48
|
className,
|
|
50
49
|
title,
|
|
51
50
|
calcSource,
|
|
52
|
-
buttons,
|
|
53
|
-
footnote,
|
|
51
|
+
buttons = [],
|
|
52
|
+
footnote = '',
|
|
54
53
|
paramsViewSettings,
|
|
55
54
|
defaultParams,
|
|
56
55
|
...rest
|
|
57
56
|
}) => {
|
|
58
57
|
const defParams = getDefaultParamsMax(calcSource?.rateRows);
|
|
58
|
+
|
|
59
59
|
const [userInputParams, { field }] = useForm({
|
|
60
60
|
moneyValue: getMoneyDefaultValue(defaultParams, DEPOSIT_DEFAULT_SUM),
|
|
61
61
|
monthsValue: getMonthsDefaultValue(defaultParams),
|
|
62
62
|
isMonthlyInterestPayment: Boolean(defaultParams?.isMonthlyInterestPayment),
|
|
63
63
|
isRemoteRegistration: Boolean(defaultParams?.isRemoteRegistration),
|
|
64
|
+
isReplenish: false,
|
|
65
|
+
isWithdrawn: Boolean(defaultParams?.isWithdrawn ?? false),
|
|
64
66
|
});
|
|
65
|
-
|
|
66
67
|
const calcParams = getDepositCalculatorParams(userInputParams, calcSource, paramsViewSettings);
|
|
67
|
-
const { defaultMonth, rate, income, finalSum } = calcParams;
|
|
68
|
+
const { defaultMonth, rate, income, finalSum, type = '' } = calcParams;
|
|
68
69
|
const { onChange: setMonthsValue } = field('monthsValue');
|
|
69
70
|
const { onChange: setMoneyValue } = field('moneyValue');
|
|
70
71
|
|
|
@@ -77,18 +78,23 @@ export const CalculatorDeposit = UniBlock<CalculatorDepositProps>(
|
|
|
77
78
|
setMoneyValue(clamp(userInputParams.moneyValue, calcParams.minSum, calcParams.maxSum));
|
|
78
79
|
}, [calcParams.minSum, calcParams.maxSum]);
|
|
79
80
|
|
|
81
|
+
const handleDefaultParamsCals = () =>
|
|
82
|
+
setDefaultParamsCalc({
|
|
83
|
+
field,
|
|
84
|
+
defParams: defParams as DepositCalculatorSourceBookParams,
|
|
85
|
+
calcParams,
|
|
86
|
+
monthsValue: 'minMonths',
|
|
87
|
+
map: MAP,
|
|
88
|
+
});
|
|
89
|
+
|
|
80
90
|
useEffect(() => {
|
|
81
91
|
if (!isDefaultParams(defaultParams) && defParams) {
|
|
82
|
-
|
|
83
|
-
field,
|
|
84
|
-
defParams: defParams as DepositCalculatorSourceBookParams,
|
|
85
|
-
calcParams,
|
|
86
|
-
monthsValue: 'minMonths',
|
|
87
|
-
map: MAP,
|
|
88
|
-
});
|
|
92
|
+
handleDefaultParamsCals();
|
|
89
93
|
}
|
|
90
94
|
}, [calcSource, defaultParams]);
|
|
91
95
|
|
|
96
|
+
const isMaxRate = rate === defParams?.rate;
|
|
97
|
+
|
|
92
98
|
return (
|
|
93
99
|
<CalculatorLayout className={className} title={title} {...rest}>
|
|
94
100
|
<section className={style(CalculatorStyle.wrapper, className)}>
|
|
@@ -112,32 +118,30 @@ export const CalculatorDeposit = UniBlock<CalculatorDepositProps>(
|
|
|
112
118
|
</div>
|
|
113
119
|
{renderRate({
|
|
114
120
|
rate,
|
|
121
|
+
children: renderMaxRateButton(handleDefaultParamsCals, isMaxRate),
|
|
122
|
+
})}
|
|
123
|
+
{renderDepositResult({
|
|
124
|
+
income,
|
|
125
|
+
finalSum,
|
|
126
|
+
buttons: [...buttons, getTariffButton(calcSource?.buttons, type)],
|
|
127
|
+
footnotes: [footnote],
|
|
115
128
|
})}
|
|
116
|
-
{renderDepositResult({ income, finalSum, buttons, footnotes: [footnote as string] })}
|
|
117
129
|
</section>
|
|
118
130
|
</CalculatorLayout>
|
|
119
131
|
);
|
|
120
132
|
},
|
|
121
133
|
);
|
|
122
134
|
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
? renderRegistrationType({
|
|
137
|
-
title: 'Оформление',
|
|
138
|
-
...field('isRemoteRegistration'),
|
|
139
|
-
value: params.isRemoteRegistration,
|
|
140
|
-
})
|
|
141
|
-
: null}
|
|
142
|
-
</div>
|
|
143
|
-
);
|
|
135
|
+
const getTariffButton = (buttons: TariffsButtonContent[] = [], btnType = '') => {
|
|
136
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
137
|
+
const { type, ...button } = buttons.find((_) => _.type === btnType) ?? {};
|
|
138
|
+
|
|
139
|
+
return button;
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
const renderMaxRateButton = (handleDefaultParamsCals: () => void, isMaxRate = false) =>
|
|
143
|
+
isMaxRate ? null : (
|
|
144
|
+
<Button type="button" version="secondary" onClick={handleDefaultParamsCals}>
|
|
145
|
+
Показать максимальную ставку
|
|
146
|
+
</Button>
|
|
147
|
+
);
|
|
@@ -15,13 +15,23 @@ export interface CalculatorDepositParamsViewSettings {
|
|
|
15
15
|
* @default true
|
|
16
16
|
*/
|
|
17
17
|
isShowRemoteRegistration?: boolean;
|
|
18
|
+
/** @title Пополнение */
|
|
19
|
+
isShowReplenish?: boolean;
|
|
20
|
+
/** @title Снятие */
|
|
21
|
+
isShowWithdrawn?: boolean;
|
|
18
22
|
}
|
|
19
23
|
|
|
20
24
|
export interface CommonDepositParams {
|
|
25
|
+
/** @title Возможность помолнять */
|
|
26
|
+
isReplenish?: boolean;
|
|
27
|
+
/** @title Возможно снимать */
|
|
28
|
+
isWithdrawn?: boolean;
|
|
21
29
|
/** @title Ежемесячная выплата процентов */
|
|
22
30
|
isMonthlyInterestPayment?: boolean;
|
|
23
31
|
/** @title Дистанционное оформление */
|
|
24
32
|
isRemoteRegistration?: boolean;
|
|
33
|
+
/** @title Тип депозита */
|
|
34
|
+
type?: string;
|
|
25
35
|
}
|
|
26
36
|
|
|
27
37
|
export interface DepositDefaultParams extends CommonDefaultParams, CommonDepositParams {}
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
type CalcValueProps,
|
|
4
4
|
} from '../../ui-kit/Calculator/CalculatorProps';
|
|
5
5
|
import { checkRangeByKeys, getRangeByKeys } from '../../ui-kit/Calculator/rangeHelpers';
|
|
6
|
+
import type { LinkButtonContent } from '../../ui-kit/LinkButton/LinkButtonContent';
|
|
6
7
|
import { arrayByRange } from '../../utils/arrayByRange';
|
|
7
8
|
import { mergeIntervals } from '../../utils/mergeIntervals';
|
|
8
9
|
import {
|
|
@@ -18,6 +19,9 @@ const DEFAULT_DEPOSIT_CALCULATOR_PARAMS: DepositCalculatorSourceBookParams = {
|
|
|
18
19
|
rate: 0,
|
|
19
20
|
isMonthlyInterestPayment: true,
|
|
20
21
|
isRemoteRegistration: true,
|
|
22
|
+
isReplenish: false,
|
|
23
|
+
isWithdrawn: false,
|
|
24
|
+
type: '',
|
|
21
25
|
};
|
|
22
26
|
|
|
23
27
|
export interface DepositCalculatorSourceBookParams
|
|
@@ -35,8 +39,13 @@ export interface DepositCalculatorParams
|
|
|
35
39
|
finalSum: number;
|
|
36
40
|
}
|
|
37
41
|
|
|
42
|
+
export type TariffsButtonContent = LinkButtonContent & {
|
|
43
|
+
type?: string;
|
|
44
|
+
};
|
|
45
|
+
|
|
38
46
|
export type DepositCalculatorData = {
|
|
39
47
|
rateRows?: DepositCalculatorSourceBookParams[];
|
|
48
|
+
buttons?: TariffsButtonContent[];
|
|
40
49
|
};
|
|
41
50
|
|
|
42
51
|
export const getDepositCalculatorParams = (
|
|
@@ -50,9 +59,23 @@ export const getDepositCalculatorParams = (
|
|
|
50
59
|
: 0;
|
|
51
60
|
const isExcludeMonthlyInterestPayment = !paramsViewSettings?.isShowMonthlyInterestPayment;
|
|
52
61
|
const isExcludeRemoteRegistration = !paramsViewSettings?.isShowRemoteRegistration;
|
|
62
|
+
const isExcludeReplenish = !paramsViewSettings?.isShowReplenish;
|
|
63
|
+
const isExcludeWithdrawn = !paramsViewSettings?.isShowWithdrawn;
|
|
53
64
|
const depositCalculatorSourceBookParams =
|
|
54
65
|
calcSource?.rateRows?.find(
|
|
55
66
|
(row) =>
|
|
67
|
+
checkRowByParam({
|
|
68
|
+
row,
|
|
69
|
+
userInputParams,
|
|
70
|
+
paramKey: 'isReplenish',
|
|
71
|
+
isExclude: isExcludeReplenish,
|
|
72
|
+
}) &&
|
|
73
|
+
checkRowByParam({
|
|
74
|
+
row,
|
|
75
|
+
userInputParams,
|
|
76
|
+
paramKey: 'isWithdrawn',
|
|
77
|
+
isExclude: isExcludeWithdrawn,
|
|
78
|
+
}) &&
|
|
56
79
|
checkRowByParam({
|
|
57
80
|
row,
|
|
58
81
|
userInputParams,
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { FormFieldRegisterer } from '../../hooks/useForm';
|
|
2
|
+
import { renderBinaryRadioButtonGroup } from '../../ui-kit/Calculator/renderBinaryRadioButtonGroup';
|
|
3
|
+
import { renderPayout } from '../../ui-kit/Calculator/renderPayout';
|
|
4
|
+
import type { CalculatorDepositParamsViewSettings } from './CalculatorDepositContent';
|
|
5
|
+
import type { DepositCalculatorParams } from './getDepositCalculatorParams';
|
|
6
|
+
import { renderRegistrationType } from './renderRegistrationType';
|
|
7
|
+
|
|
8
|
+
export const renderDepositParamsForm = (
|
|
9
|
+
params: DepositCalculatorParams & CalculatorDepositParamsViewSettings,
|
|
10
|
+
field: FormFieldRegisterer<any>,
|
|
11
|
+
) => (
|
|
12
|
+
<div className="grid gap-lg">
|
|
13
|
+
<div className="flex gap-lg">
|
|
14
|
+
{params.isShowReplenish
|
|
15
|
+
? renderBinaryRadioButtonGroup({
|
|
16
|
+
title: 'Пополнение',
|
|
17
|
+
...field('isReplenish'),
|
|
18
|
+
value: params.isReplenish,
|
|
19
|
+
orientation: 'vertical',
|
|
20
|
+
items: [
|
|
21
|
+
{ id: 'withReplenish', text: 'С пополнением' },
|
|
22
|
+
{ id: 'withoutReplenish', text: 'Без пополнения' },
|
|
23
|
+
],
|
|
24
|
+
})
|
|
25
|
+
: null}
|
|
26
|
+
{params.isShowWithdrawn
|
|
27
|
+
? renderBinaryRadioButtonGroup({
|
|
28
|
+
title: 'Снятие',
|
|
29
|
+
...field('isWithdrawn'),
|
|
30
|
+
value: params.isWithdrawn,
|
|
31
|
+
orientation: 'vertical',
|
|
32
|
+
items: [
|
|
33
|
+
{ id: 'wthDrawn', text: 'Со снятием' },
|
|
34
|
+
{ id: 'noWithdrawn', text: 'Без снятия' },
|
|
35
|
+
],
|
|
36
|
+
})
|
|
37
|
+
: null}
|
|
38
|
+
</div>
|
|
39
|
+
<div className="border-b border-main-divider w-full" />
|
|
40
|
+
<div className="flex gap-lg">
|
|
41
|
+
{params.isShowMonthlyInterestPayment
|
|
42
|
+
? renderPayout({
|
|
43
|
+
title: 'Выплата процентов',
|
|
44
|
+
...field('isMonthlyInterestPayment'),
|
|
45
|
+
value: params.isMonthlyInterestPayment,
|
|
46
|
+
orientation: 'vertical',
|
|
47
|
+
})
|
|
48
|
+
: null}
|
|
49
|
+
{params.isShowRemoteRegistration
|
|
50
|
+
? renderRegistrationType({
|
|
51
|
+
title: 'Оформление',
|
|
52
|
+
...field('isRemoteRegistration'),
|
|
53
|
+
value: params.isRemoteRegistration,
|
|
54
|
+
orientation: 'vertical',
|
|
55
|
+
})
|
|
56
|
+
: null}
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
);
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
+
import { useCallback, useEffect, useRef } from '@redneckz/uni-jsx/lib/hooks';
|
|
2
3
|
import { useBool } from '@redneckz/uni-jsx/lib/hooks/useBool';
|
|
4
|
+
import { useEventListener } from '@redneckz/uni-jsx/lib/hooks/useEventListener';
|
|
3
5
|
import { useOutsideClick } from '@redneckz/uni-jsx/lib/hooks/useOutsideClick';
|
|
4
6
|
import { useLink } from '../../hooks/useLink';
|
|
5
7
|
import { type LinkProps } from '../../model/LinkProps';
|
|
@@ -17,10 +19,39 @@ export const DropdownMenu = JSX<DropdownMenuProps>(
|
|
|
17
19
|
({ className = '', items, activeItem, ariaLabel }) => {
|
|
18
20
|
const [isVisible, { setFalse, toggle }] = useBool(false);
|
|
19
21
|
const ref = useOutsideClick<HTMLDivElement>(setFalse);
|
|
22
|
+
const dropdownRef = useRef<HTMLDivElement | null>(null);
|
|
23
|
+
|
|
24
|
+
const changeDropdownPosition = useCallback(
|
|
25
|
+
(isOpened: boolean, buttonRef, menuRef) => {
|
|
26
|
+
if (isOpened) {
|
|
27
|
+
const dropdownRect = menuRef?.current?.getBoundingClientRect();
|
|
28
|
+
const dropdownButtonRect = buttonRef?.current?.getBoundingClientRect();
|
|
29
|
+
|
|
30
|
+
if (menuRef.current && dropdownRect && dropdownButtonRect) {
|
|
31
|
+
if (dropdownRect?.right >= globalThis.innerWidth) {
|
|
32
|
+
menuRef.current.style.left = `${globalThis.innerWidth - dropdownRect.width}px`;
|
|
33
|
+
} else if (dropdownButtonRect?.left > dropdownRect.left) {
|
|
34
|
+
menuRef.current.style.left = `${globalThis.innerWidth - dropdownRect.width}px`;
|
|
35
|
+
} else {
|
|
36
|
+
menuRef.current.style.left = '';
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
[isVisible],
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
useEventListener(globalThis, 'resize', () =>
|
|
45
|
+
changeDropdownPosition(isVisible, ref, dropdownRef),
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
changeDropdownPosition(isVisible, ref, dropdownRef);
|
|
50
|
+
}, [isVisible]);
|
|
20
51
|
|
|
21
52
|
return (
|
|
22
53
|
<div
|
|
23
|
-
className={style(isVisible ? '
|
|
54
|
+
className={style(isVisible ? 'rounded-md shadow-blue-gray' : '', className)}
|
|
24
55
|
ref={ref}
|
|
25
56
|
role="navigation"
|
|
26
57
|
>
|
|
@@ -40,8 +71,9 @@ export const DropdownMenu = JSX<DropdownMenuProps>(
|
|
|
40
71
|
))}
|
|
41
72
|
</button>
|
|
42
73
|
<div
|
|
74
|
+
ref={dropdownRef}
|
|
43
75
|
className={style(
|
|
44
|
-
'absolute flex flex-col rounded-md bg-white p-xl pb-xs w-56 z-40
|
|
76
|
+
'absolute flex flex-col rounded-md bg-white p-xl pb-xs w-56 z-40',
|
|
45
77
|
isVisible ? '' : 'hidden',
|
|
46
78
|
)}
|
|
47
79
|
aria-hidden={!isVisible}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const CalculatorStyle = {
|
|
2
|
-
wrapper: 'flex flex-col justify-between @4xl:flex-row gap-x-
|
|
2
|
+
wrapper: 'flex flex-col justify-between @4xl:flex-row gap-x-s gap-y-7 @xl:gap-y-4xl',
|
|
3
3
|
input:
|
|
4
|
-
'flex flex-col
|
|
5
|
-
result: 'flex flex-col gap-y-xl
|
|
4
|
+
'flex flex-col lg:max-w-80 gap-2xl border-b border-b-main-divider @xl:border-none pb-3xl @xl:pb-0',
|
|
5
|
+
result: 'flex flex-col gap-y-xl',
|
|
6
6
|
};
|
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
type RadioButtonItem,
|
|
5
5
|
} from '../../ui-kit/RadioButtonGroup/RadioButtonGroup';
|
|
6
6
|
import { Text } from '../../ui-kit/Text/Text';
|
|
7
|
-
import { style } from '../../utils/style';
|
|
8
7
|
|
|
9
8
|
export interface BinaryRadioButtonGroupProps {
|
|
10
9
|
items: [truthy: RadioButtonItem, falsy: RadioButtonItem];
|
|
@@ -25,7 +24,7 @@ export const renderBinaryRadioButtonGroup = ({
|
|
|
25
24
|
radioGroupClassName,
|
|
26
25
|
onChange,
|
|
27
26
|
}: BinaryRadioButtonGroupProps) => (
|
|
28
|
-
<div className="
|
|
27
|
+
<div className="grid gap-s whitespace-nowrap">
|
|
29
28
|
{title ? (
|
|
30
29
|
<div className="hidden @5xl:block">
|
|
31
30
|
<Text color="text-secondary-text" font="font-light">
|
|
@@ -45,7 +44,7 @@ export const renderBinaryRadioButtonGroup = ({
|
|
|
45
44
|
orientation={orientation}
|
|
46
45
|
items={items}
|
|
47
46
|
checkedItem={items[value ? 0 : 1].id}
|
|
48
|
-
className={
|
|
47
|
+
className={radioGroupClassName}
|
|
49
48
|
onChange={(_) => onChange && onChange(_ === items[0].id)}
|
|
50
49
|
/>
|
|
51
50
|
</div>
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { type VNode } from '../../model/VNode';
|
|
1
2
|
import { CalculatorValueBlock } from './CalculatorValueBlock';
|
|
2
3
|
import { Rate, type RateProps } from './Rate';
|
|
3
4
|
import { UnknownRate, type UnknownRateProps } from './UnknownRate';
|
|
4
5
|
|
|
5
6
|
interface RenderRateProps extends RateProps, UnknownRateProps {
|
|
6
7
|
isUnknownRateShown?: boolean;
|
|
8
|
+
children?: VNode;
|
|
7
9
|
}
|
|
8
10
|
|
|
9
11
|
export const renderRate = ({
|
|
@@ -13,13 +15,14 @@ export const renderRate = ({
|
|
|
13
15
|
fractionDigits = 2,
|
|
14
16
|
isUnknownRateShown = true,
|
|
15
17
|
color = 'text-secondary-text',
|
|
18
|
+
children,
|
|
16
19
|
...rest
|
|
17
20
|
}: RenderRateProps) =>
|
|
18
21
|
isUnknownRateShown && rate === 0 ? (
|
|
19
22
|
<UnknownRate title={title} {...rest} />
|
|
20
23
|
) : (
|
|
21
24
|
<div>
|
|
22
|
-
<div className="hidden @xl:block">
|
|
25
|
+
<div className="hidden @xl:block min-w-96">
|
|
23
26
|
<Rate
|
|
24
27
|
title={title}
|
|
25
28
|
rate={rate}
|
|
@@ -40,5 +43,6 @@ export const renderRate = ({
|
|
|
40
43
|
{...rest}
|
|
41
44
|
/>
|
|
42
45
|
</div>
|
|
46
|
+
{children}
|
|
43
47
|
</div>
|
|
44
48
|
);
|
package/package.json
CHANGED
|
@@ -37,6 +37,8 @@ export default {
|
|
|
37
37
|
paramsViewSettings={{
|
|
38
38
|
isShowMonthlyInterestPayment: true,
|
|
39
39
|
isShowRemoteRegistration: true,
|
|
40
|
+
isShowReplenish: true,
|
|
41
|
+
isShowWithdrawn: true,
|
|
40
42
|
}}
|
|
41
43
|
/>
|
|
42
44
|
</div>
|
|
@@ -48,6 +50,24 @@ export default {
|
|
|
48
50
|
paramsViewSettings={{
|
|
49
51
|
isShowMonthlyInterestPayment: false,
|
|
50
52
|
isShowRemoteRegistration: true,
|
|
53
|
+
isShowReplenish: true,
|
|
54
|
+
isShowWithdrawn: true,
|
|
55
|
+
}}
|
|
56
|
+
/>
|
|
57
|
+
</div>
|
|
58
|
+
),
|
|
59
|
+
replenish: (
|
|
60
|
+
<div className="container grid grid-cols-12">
|
|
61
|
+
<CalculatorDeposit
|
|
62
|
+
{...calculator}
|
|
63
|
+
paramsViewSettings={{
|
|
64
|
+
isShowReplenish: true,
|
|
65
|
+
isShowWithdrawn: true,
|
|
66
|
+
isShowRemoteRegistration: true,
|
|
67
|
+
isShowMonthlyInterestPayment: true,
|
|
68
|
+
}}
|
|
69
|
+
calcSource={{
|
|
70
|
+
$ref: '/wcms-resources/vklad-calculator-main-data.json',
|
|
51
71
|
}}
|
|
52
72
|
/>
|
|
53
73
|
</div>
|