@redneckz/wildless-cms-uni-blocks 0.14.634 → 0.14.636
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 +99 -48
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/ApplicationLeadForm/getInitialFormState.d.ts +1 -0
- package/bundle/components/CreditForm/getInitialFormState.d.ts +1 -0
- package/bundle/ui-kit/FormField/Fields/AddressFactField.d.ts +2 -0
- package/bundle/ui-kit/FormField/Fields/AddressMatchField.d.ts +2 -0
- package/bundle/ui-kit/FormField/NameFieldDef.d.ts +1 -1
- package/dist/components/ApplicationLeadForm/getInitialFormState.d.ts +1 -0
- package/dist/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
- package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +1 -0
- package/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
- package/dist/components/CreditForm/creditFormStepsData.js +16 -7
- package/dist/components/CreditForm/creditFormStepsData.js.map +1 -1
- package/dist/components/CreditForm/getInitialFormState.d.ts +1 -0
- package/dist/components/CreditForm/getInitialFormState.js +1 -0
- package/dist/components/CreditForm/getInitialFormState.js.map +1 -1
- package/dist/ui-kit/ConsentBkiDialog/useConsentBkiDialog.js +2 -2
- package/dist/ui-kit/ConsentBkiDialog/useConsentBkiDialog.js.map +1 -1
- package/dist/ui-kit/FormField/Fields/AddressFactField.d.ts +2 -0
- package/dist/ui-kit/FormField/Fields/AddressFactField.js +42 -0
- package/dist/ui-kit/FormField/Fields/AddressFactField.js.map +1 -0
- package/dist/ui-kit/FormField/Fields/AddressMatchField.d.ts +2 -0
- package/dist/ui-kit/FormField/Fields/AddressMatchField.js +11 -0
- package/dist/ui-kit/FormField/Fields/AddressMatchField.js.map +1 -0
- package/dist/ui-kit/FormField/NameFieldDef.d.ts +1 -1
- package/dist/ui-kit/FormField/getField.js +4 -1
- package/dist/ui-kit/FormField/getField.js.map +1 -1
- package/dist/ui-kit/FormField/getObjectValidator.js +1 -0
- package/dist/ui-kit/FormField/getObjectValidator.js.map +1 -1
- package/dist/ui-kit/Input/InputControl.js +2 -2
- package/dist/ui-kit/Input/InputControl.js.map +1 -1
- package/lib/components/ApplicationLeadForm/getInitialFormState.d.ts +1 -0
- package/lib/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
- package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +1 -0
- package/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
- package/lib/components/CreditForm/creditFormStepsData.js +16 -7
- package/lib/components/CreditForm/creditFormStepsData.js.map +1 -1
- package/lib/components/CreditForm/getInitialFormState.d.ts +1 -0
- package/lib/components/CreditForm/getInitialFormState.js +1 -0
- package/lib/components/CreditForm/getInitialFormState.js.map +1 -1
- package/lib/ui-kit/ConsentBkiDialog/useConsentBkiDialog.js +2 -2
- package/lib/ui-kit/ConsentBkiDialog/useConsentBkiDialog.js.map +1 -1
- package/lib/ui-kit/FormField/Fields/AddressFactField.d.ts +2 -0
- package/lib/ui-kit/FormField/Fields/AddressFactField.js +40 -0
- package/lib/ui-kit/FormField/Fields/AddressFactField.js.map +1 -0
- package/lib/ui-kit/FormField/Fields/AddressMatchField.d.ts +2 -0
- package/lib/ui-kit/FormField/Fields/AddressMatchField.js +9 -0
- package/lib/ui-kit/FormField/Fields/AddressMatchField.js.map +1 -0
- package/lib/ui-kit/FormField/NameFieldDef.d.ts +1 -1
- package/lib/ui-kit/FormField/getField.js +4 -1
- package/lib/ui-kit/FormField/getField.js.map +1 -1
- package/lib/ui-kit/FormField/getObjectValidator.js +1 -0
- package/lib/ui-kit/FormField/getObjectValidator.js.map +1 -1
- package/lib/ui-kit/Input/InputControl.js +2 -2
- package/lib/ui-kit/Input/InputControl.js.map +1 -1
- package/mobile/bundle/bundle.umd.js +99 -48
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/components/ApplicationLeadForm/getInitialFormState.d.ts +1 -0
- package/mobile/bundle/components/CreditForm/getInitialFormState.d.ts +1 -0
- package/mobile/bundle/ui-kit/FormField/Fields/AddressFactField.d.ts +2 -0
- package/mobile/bundle/ui-kit/FormField/Fields/AddressMatchField.d.ts +2 -0
- package/mobile/bundle/ui-kit/FormField/NameFieldDef.d.ts +1 -1
- package/mobile/dist/components/ApplicationLeadForm/getInitialFormState.d.ts +1 -0
- package/mobile/dist/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
- package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js +1 -0
- package/mobile/dist/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
- package/mobile/dist/components/CreditForm/creditFormStepsData.js +16 -7
- package/mobile/dist/components/CreditForm/creditFormStepsData.js.map +1 -1
- package/mobile/dist/components/CreditForm/getInitialFormState.d.ts +1 -0
- package/mobile/dist/components/CreditForm/getInitialFormState.js +1 -0
- package/mobile/dist/components/CreditForm/getInitialFormState.js.map +1 -1
- package/mobile/dist/ui-kit/ConsentBkiDialog/useConsentBkiDialog.js +2 -2
- package/mobile/dist/ui-kit/ConsentBkiDialog/useConsentBkiDialog.js.map +1 -1
- package/mobile/dist/ui-kit/FormField/Fields/AddressFactField.d.ts +2 -0
- package/mobile/dist/ui-kit/FormField/Fields/AddressFactField.js +42 -0
- package/mobile/dist/ui-kit/FormField/Fields/AddressFactField.js.map +1 -0
- package/mobile/dist/ui-kit/FormField/Fields/AddressMatchField.d.ts +2 -0
- package/mobile/dist/ui-kit/FormField/Fields/AddressMatchField.js +11 -0
- package/mobile/dist/ui-kit/FormField/Fields/AddressMatchField.js.map +1 -0
- package/mobile/dist/ui-kit/FormField/NameFieldDef.d.ts +1 -1
- package/mobile/dist/ui-kit/FormField/getField.js +4 -1
- package/mobile/dist/ui-kit/FormField/getField.js.map +1 -1
- package/mobile/dist/ui-kit/FormField/getObjectValidator.js +1 -0
- package/mobile/dist/ui-kit/FormField/getObjectValidator.js.map +1 -1
- package/mobile/dist/ui-kit/Input/InputControl.js +2 -2
- package/mobile/dist/ui-kit/Input/InputControl.js.map +1 -1
- package/mobile/lib/components/ApplicationLeadForm/getInitialFormState.d.ts +1 -0
- package/mobile/lib/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
- package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js +1 -0
- package/mobile/lib/components/ApplicationLeadForm/useApplicationLeadApi.js.map +1 -1
- package/mobile/lib/components/CreditForm/creditFormStepsData.js +16 -7
- package/mobile/lib/components/CreditForm/creditFormStepsData.js.map +1 -1
- package/mobile/lib/components/CreditForm/getInitialFormState.d.ts +1 -0
- package/mobile/lib/components/CreditForm/getInitialFormState.js +1 -0
- package/mobile/lib/components/CreditForm/getInitialFormState.js.map +1 -1
- package/mobile/lib/ui-kit/ConsentBkiDialog/useConsentBkiDialog.js +2 -2
- package/mobile/lib/ui-kit/ConsentBkiDialog/useConsentBkiDialog.js.map +1 -1
- package/mobile/lib/ui-kit/FormField/Fields/AddressFactField.d.ts +2 -0
- package/mobile/lib/ui-kit/FormField/Fields/AddressFactField.js +40 -0
- package/mobile/lib/ui-kit/FormField/Fields/AddressFactField.js.map +1 -0
- package/mobile/lib/ui-kit/FormField/Fields/AddressMatchField.d.ts +2 -0
- package/mobile/lib/ui-kit/FormField/Fields/AddressMatchField.js +9 -0
- package/mobile/lib/ui-kit/FormField/Fields/AddressMatchField.js.map +1 -0
- package/mobile/lib/ui-kit/FormField/NameFieldDef.d.ts +1 -1
- package/mobile/lib/ui-kit/FormField/getField.js +4 -1
- package/mobile/lib/ui-kit/FormField/getField.js.map +1 -1
- package/mobile/lib/ui-kit/FormField/getObjectValidator.js +1 -0
- package/mobile/lib/ui-kit/FormField/getObjectValidator.js.map +1 -1
- package/mobile/lib/ui-kit/Input/InputControl.js +2 -2
- package/mobile/lib/ui-kit/Input/InputControl.js.map +1 -1
- package/mobile/src/components/ApplicationLeadForm/getInitialFormState.tsx +1 -0
- package/mobile/src/components/ApplicationLeadForm/useApplicationLeadApi.ts +1 -0
- package/mobile/src/components/CreditForm/creditFormStepsData.tsx +16 -7
- package/mobile/src/components/CreditForm/getInitialFormState.tsx +3 -0
- package/mobile/src/ui-kit/ConsentBkiDialog/useConsentBkiDialog.tsx +2 -2
- package/mobile/src/ui-kit/FormField/Fields/AddressFactField.tsx +55 -0
- package/mobile/src/ui-kit/FormField/Fields/AddressMatchField.tsx +14 -0
- package/mobile/src/ui-kit/FormField/NameFieldDef.ts +2 -1
- package/mobile/src/ui-kit/FormField/getField.tsx +4 -1
- package/mobile/src/ui-kit/FormField/getObjectValidator.tsx +1 -0
- package/mobile/src/ui-kit/Input/InputControl.tsx +2 -0
- package/package.json +1 -1
- package/src/components/ApplicationLeadForm/getInitialFormState.tsx +1 -0
- package/src/components/ApplicationLeadForm/useApplicationLeadApi.ts +1 -0
- package/src/components/CreditForm/creditFormStepsData.tsx +16 -7
- package/src/components/CreditForm/getInitialFormState.tsx +3 -0
- package/src/ui-kit/ConsentBkiDialog/useConsentBkiDialog.tsx +2 -2
- package/src/ui-kit/FormField/Fields/AddressFactField.tsx +55 -0
- package/src/ui-kit/FormField/Fields/AddressMatchField.tsx +14 -0
- package/src/ui-kit/FormField/NameFieldDef.ts +2 -1
- package/src/ui-kit/FormField/getField.tsx +4 -1
- package/src/ui-kit/FormField/getObjectValidator.tsx +1 -0
- package/src/ui-kit/Input/InputControl.tsx +2 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
+
import { useCallback, useEffect } from '@redneckz/uni-jsx/lib/hooks';
|
|
3
|
+
import { type DaDataSuggestion } from '../../../api/dadataHints/dadataHintsType';
|
|
4
|
+
import { InputControl } from '../../Input/InputControl';
|
|
5
|
+
import { type CustomFieldProps } from '../CustomFieldProps';
|
|
6
|
+
import { validatorObj } from '../getObjectValidator';
|
|
7
|
+
import { getValidation } from '../getValidation';
|
|
8
|
+
|
|
9
|
+
export const AddressFactField = JSX<CustomFieldProps>(({ field, input }) => {
|
|
10
|
+
const fieldName = 'addressFact';
|
|
11
|
+
const fieldValue = field(fieldName).value;
|
|
12
|
+
const { value } = field('addressMatch');
|
|
13
|
+
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
if (value) {
|
|
16
|
+
field('addressFact')?.onChange?.(field('addressRegistration').value);
|
|
17
|
+
}
|
|
18
|
+
}, [value]);
|
|
19
|
+
|
|
20
|
+
const onDaDataChange = useCallback((item: DaDataSuggestion) => {
|
|
21
|
+
field?.(fieldName)?.onChange?.({
|
|
22
|
+
apartment: item?.data?.flat,
|
|
23
|
+
city: item?.data?.city,
|
|
24
|
+
district: item?.data?.area_with_type,
|
|
25
|
+
fullAddress: item?.value,
|
|
26
|
+
fiasCode: item?.data?.fias_id,
|
|
27
|
+
house: item?.data?.house,
|
|
28
|
+
locality: item?.data?.settlement_with_type,
|
|
29
|
+
okatoRegionCode: item?.data?.okato,
|
|
30
|
+
postcode: item?.data?.postal_code,
|
|
31
|
+
region: item?.data?.region,
|
|
32
|
+
regionCode: item?.data?.region_kladr_id ? item?.data?.region_kladr_id.substring(0, 2) : '',
|
|
33
|
+
street: item?.data?.house,
|
|
34
|
+
});
|
|
35
|
+
}, []);
|
|
36
|
+
|
|
37
|
+
const onChange = useCallback((val: string) => {
|
|
38
|
+
field?.(fieldName)?.onChange?.({
|
|
39
|
+
...field(fieldName).value,
|
|
40
|
+
fullAddress: val,
|
|
41
|
+
});
|
|
42
|
+
}, []);
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<InputControl
|
|
46
|
+
label="Адрес"
|
|
47
|
+
disabled={value}
|
|
48
|
+
{...getValidation(field(fieldName), validatorObj[fieldName], input?.required)}
|
|
49
|
+
value={fieldValue.fullAddress}
|
|
50
|
+
onChange={onChange}
|
|
51
|
+
{...input}
|
|
52
|
+
onDaDataChange={onDaDataChange}
|
|
53
|
+
/>
|
|
54
|
+
);
|
|
55
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
+
import { CheckboxWithError } from '../../Checkbox/CheckboxWithError';
|
|
3
|
+
import { type CustomFieldProps } from '../CustomFieldProps';
|
|
4
|
+
import { validatorObj } from '../getObjectValidator';
|
|
5
|
+
import { getValidation } from '../getValidation';
|
|
6
|
+
|
|
7
|
+
export const AddressMatchField = JSX<CustomFieldProps>(({ field }) => {
|
|
8
|
+
return (
|
|
9
|
+
<CheckboxWithError
|
|
10
|
+
text="Адрес фактического места жительства совпадает с адресом регистрации"
|
|
11
|
+
{...getValidation(field('addressMatch'), validatorObj.addressMatch)}
|
|
12
|
+
/>
|
|
13
|
+
);
|
|
14
|
+
});
|
|
@@ -5,7 +5,9 @@ import { type FormFieldRegisterer } from '../../hooks/useForm';
|
|
|
5
5
|
import { InputControl } from '../Input/InputControl';
|
|
6
6
|
import { AcquiringField } from './Fields/AcquiringField';
|
|
7
7
|
import { AddressBranchField } from './Fields/AddressBranchField';
|
|
8
|
+
import { AddressFactField } from './Fields/AddressFactField';
|
|
8
9
|
import { AddressField } from './Fields/AddressField';
|
|
10
|
+
import { AddressMatchField } from './Fields/AddressMatchField';
|
|
9
11
|
import { AmountField } from './Fields/AmountField';
|
|
10
12
|
import { AmountWorkersField } from './Fields/AmountWorkersField';
|
|
11
13
|
import { AnnualRevenueField } from './Fields/AnnualRevenueField';
|
|
@@ -107,7 +109,7 @@ export const getField =
|
|
|
107
109
|
experience5Years: <Experience5YearsField field={field} input={input} />,
|
|
108
110
|
jobsNumber: <JobsNumberField field={field} input={input} />,
|
|
109
111
|
beginDate: <BeginDateField field={field} input={input} />,
|
|
110
|
-
addressFact: <
|
|
112
|
+
addressFact: <AddressFactField field={field} input={input} />,
|
|
111
113
|
organizationAddress: <AddressField field={field} input={input} />,
|
|
112
114
|
comment: <CommentField field={field} input={input} />,
|
|
113
115
|
addressBranch: <AddressBranchField field={field} input={input} isPremium={isPremium} />,
|
|
@@ -184,6 +186,7 @@ export const getField =
|
|
|
184
186
|
partInBusiness: <PartInBusinessField field={field} input={input} />,
|
|
185
187
|
regionRetail: <RetailRegionField field={field} input={input} />,
|
|
186
188
|
addressRetail: <RetailAddressField field={field} input={input} />,
|
|
189
|
+
addressMatch: <AddressMatchField field={field} input={input} />,
|
|
187
190
|
};
|
|
188
191
|
|
|
189
192
|
return isRenderField({ input, field }) ? (
|
|
@@ -95,6 +95,7 @@ export const validatorObj: Record<string, Validator> = {
|
|
|
95
95
|
partInBusiness: defaultValidator(),
|
|
96
96
|
regionRetail: defaultSelectValidator('Выберите филиал банка'),
|
|
97
97
|
addressRetail: defaultSelectValidator('Выберите адрес банка'),
|
|
98
|
+
addressMatch: defaultValidator(),
|
|
98
99
|
};
|
|
99
100
|
|
|
100
101
|
export const getObjectValidator = (inputs: FieldDef[]): Record<string, Validator> => {
|
|
@@ -27,6 +27,7 @@ export const InputControl = JSX<InputProps>(
|
|
|
27
27
|
daDataQueryPrefix,
|
|
28
28
|
inputLength,
|
|
29
29
|
dadata = false,
|
|
30
|
+
disabled = false,
|
|
30
31
|
}) => {
|
|
31
32
|
const [isOpen, { setFalse: close, setTrue: open }] = useBool();
|
|
32
33
|
const popupRef = useOutsideClick<HTMLDivElement>(close);
|
|
@@ -54,6 +55,7 @@ export const InputControl = JSX<InputProps>(
|
|
|
54
55
|
>
|
|
55
56
|
<div ref={inputRef}>
|
|
56
57
|
<Input
|
|
58
|
+
disabled={disabled}
|
|
57
59
|
type={type || 'text'}
|
|
58
60
|
aria-label={label}
|
|
59
61
|
label={getRequiredLabel({ label, errors })}
|