@redneckz/wildless-cms-uni-blocks 0.14.965 → 0.14.967
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 +25 -20
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/ApplicationForm/ApplicationFormContent.d.ts +3 -0
- package/bundle/components/ApplicationForm/handlers.d.ts +2 -1
- package/dist/components/ApplicationForm/ApplicationForm.js +2 -1
- package/dist/components/ApplicationForm/ApplicationForm.js.map +1 -1
- package/dist/components/ApplicationForm/ApplicationFormContent.d.ts +3 -0
- package/dist/components/ApplicationForm/handlers.d.ts +2 -1
- package/dist/components/ApplicationForm/handlers.js +20 -3
- package/dist/components/ApplicationForm/handlers.js.map +1 -1
- package/dist/retail/components/Fields/CreditCalcField.js +2 -15
- package/dist/retail/components/Fields/CreditCalcField.js.map +1 -1
- package/lib/components/ApplicationForm/ApplicationForm.fixture.d.ts +1 -0
- package/lib/components/ApplicationForm/ApplicationForm.js +2 -1
- package/lib/components/ApplicationForm/ApplicationForm.js.map +1 -1
- package/lib/components/ApplicationForm/ApplicationFormContent.d.ts +3 -0
- package/lib/components/ApplicationForm/handlers.d.ts +2 -1
- package/lib/components/ApplicationForm/handlers.js +20 -3
- package/lib/components/ApplicationForm/handlers.js.map +1 -1
- package/lib/retail/components/Fields/CreditCalcField.js +2 -15
- package/lib/retail/components/Fields/CreditCalcField.js.map +1 -1
- package/mobile/bundle/bundle.umd.js +25 -20
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/components/ApplicationForm/ApplicationFormContent.d.ts +3 -0
- package/mobile/bundle/components/ApplicationForm/handlers.d.ts +2 -1
- package/mobile/dist/components/ApplicationForm/ApplicationForm.js +2 -1
- package/mobile/dist/components/ApplicationForm/ApplicationForm.js.map +1 -1
- package/mobile/dist/components/ApplicationForm/ApplicationFormContent.d.ts +3 -0
- package/mobile/dist/components/ApplicationForm/handlers.d.ts +2 -1
- package/mobile/dist/components/ApplicationForm/handlers.js +20 -3
- package/mobile/dist/components/ApplicationForm/handlers.js.map +1 -1
- package/mobile/dist/retail/components/Fields/CreditCalcField.js +2 -15
- package/mobile/dist/retail/components/Fields/CreditCalcField.js.map +1 -1
- package/mobile/lib/components/ApplicationForm/ApplicationForm.js +2 -1
- package/mobile/lib/components/ApplicationForm/ApplicationForm.js.map +1 -1
- package/mobile/lib/components/ApplicationForm/ApplicationFormContent.d.ts +3 -0
- package/mobile/lib/components/ApplicationForm/handlers.d.ts +2 -1
- package/mobile/lib/components/ApplicationForm/handlers.js +20 -3
- package/mobile/lib/components/ApplicationForm/handlers.js.map +1 -1
- package/mobile/lib/retail/components/Fields/CreditCalcField.js +2 -15
- package/mobile/lib/retail/components/Fields/CreditCalcField.js.map +1 -1
- package/mobile/src/components/ApplicationForm/ApplicationForm.tsx +2 -0
- package/mobile/src/components/ApplicationForm/ApplicationFormContent.ts +3 -0
- package/mobile/src/components/ApplicationForm/handlers.ts +26 -3
- package/mobile/src/retail/components/Fields/CreditCalcField.tsx +3 -29
- package/package.json +1 -1
- package/src/components/ApplicationForm/ApplicationForm.fixture.tsx +25 -0
- package/src/components/ApplicationForm/ApplicationForm.tsx +2 -0
- package/src/components/ApplicationForm/ApplicationFormContent.ts +3 -0
- package/src/components/ApplicationForm/handlers.ts +26 -3
- package/src/retail/components/Fields/CreditCalcField.tsx +3 -29
|
@@ -1,49 +1,23 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
2
|
import { useCallback } from '@redneckz/uni-jsx/lib/hooks';
|
|
3
3
|
import { CalculatorCredit } from '../../../components/CalculatorCredit/CalculatorCredit';
|
|
4
|
-
import {
|
|
5
|
-
type CreditCalculatorUserInputParams,
|
|
6
|
-
type CreditDefaultParams,
|
|
7
|
-
} from '../../../components/CalculatorCredit/CalculatorCreditContent';
|
|
4
|
+
import { type CreditCalculatorUserInputParams } from '../../../components/CalculatorCredit/CalculatorCreditContent';
|
|
8
5
|
import { type CustomFieldProps } from '../../../ui-kit/FormField/CustomFieldProps';
|
|
9
6
|
|
|
10
7
|
const FIELD_NAME = 'calculator';
|
|
11
8
|
|
|
12
9
|
export const CreditCalcField = JSX<CustomFieldProps>(({ field, params }) => {
|
|
10
|
+
const defaultCalcSum = params?.calcData?.defaultParams?.sum ?? 0;
|
|
13
11
|
const handleChange = useCallback((_: CreditCalculatorUserInputParams) => {
|
|
14
12
|
field(FIELD_NAME).onChange?.(_);
|
|
15
13
|
}, []);
|
|
16
14
|
|
|
17
15
|
return (
|
|
18
16
|
<CalculatorCredit
|
|
17
|
+
key={defaultCalcSum}
|
|
19
18
|
{...params?.calcData}
|
|
20
19
|
padding="p-0"
|
|
21
|
-
defaultParams={defaultValueAdapter(
|
|
22
|
-
field(FIELD_NAME).value as CreditCalculatorUserInputParams,
|
|
23
|
-
)}
|
|
24
20
|
onChange={handleChange}
|
|
25
21
|
/>
|
|
26
22
|
);
|
|
27
23
|
});
|
|
28
|
-
|
|
29
|
-
const PARAMS_MAP = {
|
|
30
|
-
moneyValue: 'sum',
|
|
31
|
-
monthsValue: 'period',
|
|
32
|
-
isInsurance: 'isEnableInsurance',
|
|
33
|
-
isPensionClient: 'isEnablePensionClient',
|
|
34
|
-
isStateEmployee: 'isEnableStateEmployee',
|
|
35
|
-
isSalaryClient: 'isEnableSalaryClient',
|
|
36
|
-
isAnnuity: 'isAnnuity',
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
const defaultValueAdapter = (
|
|
40
|
-
value?: CreditCalculatorUserInputParams,
|
|
41
|
-
isInverse = false,
|
|
42
|
-
): CreditDefaultParams => {
|
|
43
|
-
const keysMap = isInverse ? swap(PARAMS_MAP) : PARAMS_MAP;
|
|
44
|
-
|
|
45
|
-
return Object.fromEntries(Object.entries(value ?? {}).map(([k, v]) => [keysMap[k], v]));
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
const swap = (_: Record<string, string>) =>
|
|
49
|
-
Object.fromEntries(Object.entries(_).map(([k, v]) => [v, k]));
|