@redneckz/wildless-cms-uni-blocks 0.14.914 → 0.14.916

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 (258) hide show
  1. package/bin/migration-scripts/0.14.910.js +27 -0
  2. package/bundle/api/LeadServiceAPI.d.ts +0 -1
  3. package/bundle/api/getSubmitBody.d.ts +120 -96
  4. package/bundle/blocks.schema.json +1 -1
  5. package/bundle/bundle.umd.js +138 -87
  6. package/bundle/bundle.umd.min.js +1 -1
  7. package/bundle/components/ApplicationForm/getInitialFormState.d.ts +3 -0
  8. package/bundle/components/Footer/LinkList.d.ts +0 -1
  9. package/bundle/hooks/useDadataParty.d.ts +6 -0
  10. package/bundle/model/AspectsProps.d.ts +9 -1
  11. package/bundle/ui-kit/FormField/Fields/DadataPartySelectField.d.ts +6 -0
  12. package/bundle/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  13. package/bundle/ui-kit/Select/Option.d.ts +3 -6
  14. package/bundle/ui-kit/Select/Select.d.ts +2 -1
  15. package/bundle/ui-kit/Select/SelectPopup.d.ts +6 -2
  16. package/bundle/ui-kit/Select/useSelectPopup.d.ts +2 -1
  17. package/bundle/ui-kit/Sitemap/SitemapProps.d.ts +1 -0
  18. package/dist/api/LeadServiceAPI.d.ts +0 -1
  19. package/dist/api/LeadServiceAPI.js.map +1 -1
  20. package/dist/api/getSubmitBody.d.ts +120 -96
  21. package/dist/api/getSubmitBody.js +1 -6
  22. package/dist/api/getSubmitBody.js.map +1 -1
  23. package/dist/components/ApplicationForm/getFormatData.js +11 -1
  24. package/dist/components/ApplicationForm/getFormatData.js.map +1 -1
  25. package/dist/components/ApplicationForm/getInitialFormState.d.ts +3 -0
  26. package/dist/components/ApplicationForm/getInitialFormState.js.map +1 -1
  27. package/dist/components/Footer/LinkList.d.ts +0 -1
  28. package/dist/components/Footer/LinkList.js +2 -2
  29. package/dist/components/Footer/LinkList.js.map +1 -1
  30. package/dist/hooks/useDadataParty.d.ts +6 -0
  31. package/dist/hooks/{useInn.js → useDadataParty.js} +4 -4
  32. package/dist/hooks/useDadataParty.js.map +1 -0
  33. package/dist/model/AspectsProps.d.ts +9 -1
  34. package/dist/ui-kit/FormField/Fields/DadataPartySelectField.d.ts +6 -0
  35. package/dist/ui-kit/FormField/Fields/DadataPartySelectField.js +84 -0
  36. package/dist/ui-kit/FormField/Fields/DadataPartySelectField.js.map +1 -0
  37. package/dist/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  38. package/dist/ui-kit/FormField/getField.js +3 -4
  39. package/dist/ui-kit/FormField/getField.js.map +1 -1
  40. package/dist/ui-kit/FormField/getObjectValidator.js +3 -3
  41. package/dist/ui-kit/FormField/getObjectValidator.js.map +1 -1
  42. package/dist/ui-kit/Select/Option.d.ts +3 -6
  43. package/dist/ui-kit/Select/Select.d.ts +2 -1
  44. package/dist/ui-kit/Select/Select.js +4 -4
  45. package/dist/ui-kit/Select/Select.js.map +1 -1
  46. package/dist/ui-kit/Select/SelectPopup.d.ts +6 -2
  47. package/dist/ui-kit/Select/SelectPopup.js +5 -3
  48. package/dist/ui-kit/Select/SelectPopup.js.map +1 -1
  49. package/dist/ui-kit/Select/useSelectPopup.d.ts +2 -1
  50. package/dist/ui-kit/Select/useSelectPopup.js +6 -3
  51. package/dist/ui-kit/Select/useSelectPopup.js.map +1 -1
  52. package/dist/ui-kit/Sitemap/Sitemap.js +3 -3
  53. package/dist/ui-kit/Sitemap/Sitemap.js.map +1 -1
  54. package/dist/ui-kit/Sitemap/SitemapProps.d.ts +1 -0
  55. package/lib/api/LeadServiceAPI.d.ts +0 -1
  56. package/lib/api/LeadServiceAPI.js.map +1 -1
  57. package/lib/api/getSubmitBody.d.ts +120 -96
  58. package/lib/api/getSubmitBody.js +1 -6
  59. package/lib/api/getSubmitBody.js.map +1 -1
  60. package/lib/components/ApplicationForm/ApplicationForm.fixture.mobile.d.ts +1 -0
  61. package/lib/components/ApplicationForm/getFormatData.js +11 -1
  62. package/lib/components/ApplicationForm/getFormatData.js.map +1 -1
  63. package/lib/components/ApplicationForm/getInitialFormState.d.ts +3 -0
  64. package/lib/components/ApplicationForm/getInitialFormState.js.map +1 -1
  65. package/lib/components/Footer/LinkList.d.ts +0 -1
  66. package/lib/components/Footer/LinkList.js +2 -2
  67. package/lib/components/Footer/LinkList.js.map +1 -1
  68. package/lib/hooks/useDadataParty.d.ts +6 -0
  69. package/lib/hooks/{useInn.js → useDadataParty.js} +2 -2
  70. package/lib/hooks/useDadataParty.js.map +1 -0
  71. package/lib/model/AspectsProps.d.ts +9 -1
  72. package/lib/retail/components/DraftDialog/utils.d.ts +3 -3
  73. package/lib/ui-kit/FormField/Fields/DadataPartySelectField.d.ts +6 -0
  74. package/lib/ui-kit/FormField/Fields/DadataPartySelectField.js +82 -0
  75. package/lib/ui-kit/FormField/Fields/DadataPartySelectField.js.map +1 -0
  76. package/lib/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  77. package/lib/ui-kit/FormField/getField.js +3 -4
  78. package/lib/ui-kit/FormField/getField.js.map +1 -1
  79. package/lib/ui-kit/FormField/getObjectValidator.js +3 -3
  80. package/lib/ui-kit/FormField/getObjectValidator.js.map +1 -1
  81. package/lib/ui-kit/Select/Option.d.ts +3 -6
  82. package/lib/ui-kit/Select/Select.d.ts +2 -1
  83. package/lib/ui-kit/Select/Select.js +4 -4
  84. package/lib/ui-kit/Select/Select.js.map +1 -1
  85. package/lib/ui-kit/Select/SelectPopup.d.ts +6 -2
  86. package/lib/ui-kit/Select/SelectPopup.js +5 -3
  87. package/lib/ui-kit/Select/SelectPopup.js.map +1 -1
  88. package/lib/ui-kit/Select/useSelectPopup.d.ts +2 -1
  89. package/lib/ui-kit/Select/useSelectPopup.js +6 -3
  90. package/lib/ui-kit/Select/useSelectPopup.js.map +1 -1
  91. package/lib/ui-kit/Sitemap/Sitemap.js +3 -3
  92. package/lib/ui-kit/Sitemap/Sitemap.js.map +1 -1
  93. package/lib/ui-kit/Sitemap/SitemapProps.d.ts +1 -0
  94. package/mobile/bundle/api/LeadServiceAPI.d.ts +0 -1
  95. package/mobile/bundle/api/getSubmitBody.d.ts +120 -96
  96. package/mobile/bundle/bundle.umd.js +135 -84
  97. package/mobile/bundle/bundle.umd.min.js +1 -1
  98. package/mobile/bundle/components/ApplicationForm/getInitialFormState.d.ts +3 -0
  99. package/mobile/bundle/components/Footer/LinkList.d.ts +0 -1
  100. package/mobile/bundle/hooks/useDadataParty.d.ts +6 -0
  101. package/mobile/bundle/model/AspectsProps.d.ts +9 -1
  102. package/mobile/bundle/ui-kit/FormField/Fields/DadataPartySelectField.d.ts +6 -0
  103. package/mobile/bundle/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  104. package/mobile/bundle/ui-kit/Select/Option.d.ts +3 -6
  105. package/mobile/bundle/ui-kit/Select/Select.d.ts +2 -1
  106. package/mobile/bundle/ui-kit/Select/SelectPopup.d.ts +6 -2
  107. package/mobile/bundle/ui-kit/Select/useSelectPopup.d.ts +2 -1
  108. package/mobile/bundle/ui-kit/Sitemap/SitemapProps.d.ts +1 -0
  109. package/mobile/dist/api/LeadServiceAPI.d.ts +0 -1
  110. package/mobile/dist/api/LeadServiceAPI.js.map +1 -1
  111. package/mobile/dist/api/getSubmitBody.d.ts +120 -96
  112. package/mobile/dist/api/getSubmitBody.js +1 -6
  113. package/mobile/dist/api/getSubmitBody.js.map +1 -1
  114. package/mobile/dist/components/ApplicationForm/getFormatData.js +11 -1
  115. package/mobile/dist/components/ApplicationForm/getFormatData.js.map +1 -1
  116. package/mobile/dist/components/ApplicationForm/getInitialFormState.d.ts +3 -0
  117. package/mobile/dist/components/ApplicationForm/getInitialFormState.js.map +1 -1
  118. package/mobile/dist/components/Footer/LinkList.d.ts +0 -1
  119. package/mobile/dist/components/Footer/LinkList.js +2 -2
  120. package/mobile/dist/components/Footer/LinkList.js.map +1 -1
  121. package/mobile/dist/hooks/useDadataParty.d.ts +6 -0
  122. package/mobile/dist/hooks/{useInn.js → useDadataParty.js} +4 -4
  123. package/mobile/dist/hooks/useDadataParty.js.map +1 -0
  124. package/mobile/dist/model/AspectsProps.d.ts +9 -1
  125. package/mobile/dist/ui-kit/FormField/Fields/DadataPartySelectField.d.ts +6 -0
  126. package/mobile/dist/ui-kit/FormField/Fields/DadataPartySelectField.js +84 -0
  127. package/mobile/dist/ui-kit/FormField/Fields/DadataPartySelectField.js.map +1 -0
  128. package/mobile/dist/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  129. package/mobile/dist/ui-kit/FormField/getField.js +3 -4
  130. package/mobile/dist/ui-kit/FormField/getField.js.map +1 -1
  131. package/mobile/dist/ui-kit/FormField/getObjectValidator.js +3 -3
  132. package/mobile/dist/ui-kit/FormField/getObjectValidator.js.map +1 -1
  133. package/mobile/dist/ui-kit/Select/Option.d.ts +3 -6
  134. package/mobile/dist/ui-kit/Select/Select.d.ts +2 -1
  135. package/mobile/dist/ui-kit/Select/Select.js +4 -4
  136. package/mobile/dist/ui-kit/Select/Select.js.map +1 -1
  137. package/mobile/dist/ui-kit/Select/SelectPopup.d.ts +6 -2
  138. package/mobile/dist/ui-kit/Select/SelectPopup.js +5 -3
  139. package/mobile/dist/ui-kit/Select/SelectPopup.js.map +1 -1
  140. package/mobile/dist/ui-kit/Select/useSelectPopup.d.ts +2 -1
  141. package/mobile/dist/ui-kit/Select/useSelectPopup.js +6 -3
  142. package/mobile/dist/ui-kit/Select/useSelectPopup.js.map +1 -1
  143. package/mobile/dist/ui-kit/Sitemap/SitemapProps.d.ts +1 -0
  144. package/mobile/lib/api/LeadServiceAPI.d.ts +0 -1
  145. package/mobile/lib/api/LeadServiceAPI.js.map +1 -1
  146. package/mobile/lib/api/getSubmitBody.d.ts +120 -96
  147. package/mobile/lib/api/getSubmitBody.js +1 -6
  148. package/mobile/lib/api/getSubmitBody.js.map +1 -1
  149. package/mobile/lib/components/ApplicationForm/getFormatData.js +11 -1
  150. package/mobile/lib/components/ApplicationForm/getFormatData.js.map +1 -1
  151. package/mobile/lib/components/ApplicationForm/getInitialFormState.d.ts +3 -0
  152. package/mobile/lib/components/ApplicationForm/getInitialFormState.js.map +1 -1
  153. package/mobile/lib/components/Footer/LinkList.d.ts +0 -1
  154. package/mobile/lib/components/Footer/LinkList.js +2 -2
  155. package/mobile/lib/components/Footer/LinkList.js.map +1 -1
  156. package/mobile/lib/hooks/useDadataParty.d.ts +6 -0
  157. package/mobile/lib/hooks/{useInn.js → useDadataParty.js} +2 -2
  158. package/mobile/lib/hooks/useDadataParty.js.map +1 -0
  159. package/mobile/lib/model/AspectsProps.d.ts +9 -1
  160. package/mobile/lib/ui-kit/FormField/Fields/DadataPartySelectField.d.ts +6 -0
  161. package/mobile/lib/ui-kit/FormField/Fields/DadataPartySelectField.js +82 -0
  162. package/mobile/lib/ui-kit/FormField/Fields/DadataPartySelectField.js.map +1 -0
  163. package/mobile/lib/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  164. package/mobile/lib/ui-kit/FormField/getField.js +3 -4
  165. package/mobile/lib/ui-kit/FormField/getField.js.map +1 -1
  166. package/mobile/lib/ui-kit/FormField/getObjectValidator.js +3 -3
  167. package/mobile/lib/ui-kit/FormField/getObjectValidator.js.map +1 -1
  168. package/mobile/lib/ui-kit/Select/Option.d.ts +3 -6
  169. package/mobile/lib/ui-kit/Select/Select.d.ts +2 -1
  170. package/mobile/lib/ui-kit/Select/Select.js +4 -4
  171. package/mobile/lib/ui-kit/Select/Select.js.map +1 -1
  172. package/mobile/lib/ui-kit/Select/SelectPopup.d.ts +6 -2
  173. package/mobile/lib/ui-kit/Select/SelectPopup.js +5 -3
  174. package/mobile/lib/ui-kit/Select/SelectPopup.js.map +1 -1
  175. package/mobile/lib/ui-kit/Select/useSelectPopup.d.ts +2 -1
  176. package/mobile/lib/ui-kit/Select/useSelectPopup.js +6 -3
  177. package/mobile/lib/ui-kit/Select/useSelectPopup.js.map +1 -1
  178. package/mobile/lib/ui-kit/Sitemap/SitemapProps.d.ts +1 -0
  179. package/mobile/src/api/LeadServiceAPI.ts +0 -1
  180. package/mobile/src/api/getSubmitBody.ts +0 -11
  181. package/mobile/src/components/ApplicationForm/ApplicationForm.example.json +22 -43
  182. package/mobile/src/components/ApplicationForm/getFormatData.tsx +16 -0
  183. package/mobile/src/components/ApplicationForm/getInitialFormState.tsx +3 -0
  184. package/mobile/src/components/Footer/LinkList.tsx +2 -7
  185. package/mobile/src/hooks/{useInn.ts → useDadataParty.ts} +2 -2
  186. package/mobile/src/model/AspectsProps.ts +11 -1
  187. package/mobile/src/ui-kit/FormField/Fields/DadataPartySelectField.tsx +150 -0
  188. package/mobile/src/ui-kit/FormField/NameFieldDef.ts +3 -3
  189. package/mobile/src/ui-kit/FormField/getField.tsx +3 -4
  190. package/mobile/src/ui-kit/FormField/getObjectValidator.tsx +3 -3
  191. package/mobile/src/ui-kit/Select/Option.ts +4 -6
  192. package/mobile/src/ui-kit/Select/Select.tsx +6 -4
  193. package/mobile/src/ui-kit/Select/SelectPopup.tsx +15 -21
  194. package/mobile/src/ui-kit/Select/useSelectPopup.tsx +9 -1
  195. package/mobile/src/ui-kit/Sitemap/SitemapProps.ts +1 -0
  196. package/package.json +1 -1
  197. package/src/api/LeadServiceAPI.ts +0 -1
  198. package/src/api/getSubmitBody.ts +0 -11
  199. package/src/components/ApplicationForm/ApplicationForm.example.json +22 -43
  200. package/src/components/ApplicationForm/ApplicationForm.fixture.mobile.tsx +36 -13
  201. package/src/components/ApplicationForm/ApplicationForm.fixture.tsx +13 -12
  202. package/src/components/ApplicationForm/getFormatData.tsx +16 -0
  203. package/src/components/ApplicationForm/getInitialFormState.tsx +3 -0
  204. package/src/components/Footer/LinkList.tsx +2 -7
  205. package/src/hooks/{useInn.ts → useDadataParty.ts} +2 -2
  206. package/src/model/AspectsProps.ts +11 -1
  207. package/src/ui-kit/FormField/Fields/DadataPartySelectField.tsx +150 -0
  208. package/src/ui-kit/FormField/NameFieldDef.ts +3 -3
  209. package/src/ui-kit/FormField/getField.tsx +3 -4
  210. package/src/ui-kit/FormField/getObjectValidator.tsx +3 -3
  211. package/src/ui-kit/Select/Option.ts +4 -6
  212. package/src/ui-kit/Select/Select.tsx +6 -4
  213. package/src/ui-kit/Select/SelectPopup.tsx +15 -21
  214. package/src/ui-kit/Select/useSelectPopup.tsx +9 -1
  215. package/src/ui-kit/Sitemap/Sitemap.tsx +29 -29
  216. package/src/ui-kit/Sitemap/SitemapProps.ts +1 -0
  217. package/bundle/hooks/useInn.d.ts +0 -7
  218. package/bundle/ui-kit/FormField/Fields/CompanyNameByInnField.d.ts +0 -2
  219. package/bundle/ui-kit/FormField/Fields/InnDadataField.d.ts +0 -2
  220. package/dist/hooks/useInn.d.ts +0 -7
  221. package/dist/hooks/useInn.js.map +0 -1
  222. package/dist/ui-kit/FormField/Fields/CompanyNameByInnField.d.ts +0 -2
  223. package/dist/ui-kit/FormField/Fields/CompanyNameByInnField.js +0 -17
  224. package/dist/ui-kit/FormField/Fields/CompanyNameByInnField.js.map +0 -1
  225. package/dist/ui-kit/FormField/Fields/InnDadataField.d.ts +0 -2
  226. package/dist/ui-kit/FormField/Fields/InnDadataField.js +0 -32
  227. package/dist/ui-kit/FormField/Fields/InnDadataField.js.map +0 -1
  228. package/lib/hooks/useInn.d.ts +0 -7
  229. package/lib/hooks/useInn.js.map +0 -1
  230. package/lib/ui-kit/FormField/Fields/CompanyNameByInnField.d.ts +0 -2
  231. package/lib/ui-kit/FormField/Fields/CompanyNameByInnField.js +0 -15
  232. package/lib/ui-kit/FormField/Fields/CompanyNameByInnField.js.map +0 -1
  233. package/lib/ui-kit/FormField/Fields/InnDadataField.d.ts +0 -2
  234. package/lib/ui-kit/FormField/Fields/InnDadataField.js +0 -30
  235. package/lib/ui-kit/FormField/Fields/InnDadataField.js.map +0 -1
  236. package/mobile/bundle/hooks/useInn.d.ts +0 -7
  237. package/mobile/bundle/ui-kit/FormField/Fields/CompanyNameByInnField.d.ts +0 -2
  238. package/mobile/bundle/ui-kit/FormField/Fields/InnDadataField.d.ts +0 -2
  239. package/mobile/dist/hooks/useInn.d.ts +0 -7
  240. package/mobile/dist/hooks/useInn.js.map +0 -1
  241. package/mobile/dist/ui-kit/FormField/Fields/CompanyNameByInnField.d.ts +0 -2
  242. package/mobile/dist/ui-kit/FormField/Fields/CompanyNameByInnField.js +0 -17
  243. package/mobile/dist/ui-kit/FormField/Fields/CompanyNameByInnField.js.map +0 -1
  244. package/mobile/dist/ui-kit/FormField/Fields/InnDadataField.d.ts +0 -2
  245. package/mobile/dist/ui-kit/FormField/Fields/InnDadataField.js +0 -32
  246. package/mobile/dist/ui-kit/FormField/Fields/InnDadataField.js.map +0 -1
  247. package/mobile/lib/hooks/useInn.d.ts +0 -7
  248. package/mobile/lib/hooks/useInn.js.map +0 -1
  249. package/mobile/lib/ui-kit/FormField/Fields/CompanyNameByInnField.d.ts +0 -2
  250. package/mobile/lib/ui-kit/FormField/Fields/CompanyNameByInnField.js +0 -15
  251. package/mobile/lib/ui-kit/FormField/Fields/CompanyNameByInnField.js.map +0 -1
  252. package/mobile/lib/ui-kit/FormField/Fields/InnDadataField.d.ts +0 -2
  253. package/mobile/lib/ui-kit/FormField/Fields/InnDadataField.js +0 -30
  254. package/mobile/lib/ui-kit/FormField/Fields/InnDadataField.js.map +0 -1
  255. package/mobile/src/ui-kit/FormField/Fields/CompanyNameByInnField.tsx +0 -24
  256. package/mobile/src/ui-kit/FormField/Fields/InnDadataField.tsx +0 -52
  257. package/src/ui-kit/FormField/Fields/CompanyNameByInnField.tsx +0 -24
  258. package/src/ui-kit/FormField/Fields/InnDadataField.tsx +0 -52
@@ -0,0 +1,150 @@
1
+ import { JSX } from '@redneckz/uni-jsx';
2
+ import { useMemo, useState } from '@redneckz/uni-jsx/lib/hooks';
3
+ import { useAsyncEffect } from '../../../hooks/useAsyncEffect';
4
+ import { useDadataParty, type DaDataPartyHint } from '../../../hooks/useDadataParty';
5
+ import { type OptionWithData } from '../../Select/Option';
6
+ import { SelectControl } from '../../Select/SelectControl';
7
+ import { Text } from '../../Text/Text';
8
+ import { type CustomFieldProps } from '../CustomFieldProps';
9
+
10
+ type FieldType = 'dadataPartyInnSelect' | 'dadataPartyNameSelect';
11
+
12
+ type FieldConfig = {
13
+ label: string;
14
+ placeholder: string;
15
+ inputProps?: {
16
+ isInteger?: boolean;
17
+ maxLength?: number;
18
+ };
19
+ };
20
+
21
+ type FieldMappingValue = {
22
+ fieldValue: string;
23
+ linkedFieldName: string;
24
+ linkedFieldValue: string;
25
+ };
26
+
27
+ const FIELD_MAPPING: Record<FieldType, FieldMappingValue> = {
28
+ dadataPartyInnSelect: {
29
+ fieldValue: 'inn',
30
+ linkedFieldName: 'dadataPartyNameSelect',
31
+ linkedFieldValue: 'fullName',
32
+ },
33
+ dadataPartyNameSelect: {
34
+ fieldValue: 'fullName',
35
+ linkedFieldName: 'dadataPartyInnSelect',
36
+ linkedFieldValue: 'inn',
37
+ },
38
+ };
39
+
40
+ const FIELD_CONFIG: Record<FieldType, FieldConfig> = {
41
+ dadataPartyInnSelect: {
42
+ label: 'ИНН',
43
+ placeholder: 'Введите ИНН',
44
+ inputProps: {
45
+ isInteger: true,
46
+ maxLength: 12,
47
+ },
48
+ },
49
+ dadataPartyNameSelect: {
50
+ label: 'Полное наименование',
51
+ placeholder: 'Введите полное наименование',
52
+ },
53
+ };
54
+
55
+ export const DadataPartySelectField = JSX<CustomFieldProps>(({ field, input = {} }) => {
56
+ const fieldName = input.name ?? '';
57
+
58
+ const linkedField = FIELD_MAPPING[fieldName].linkedFieldName;
59
+ const linkedFieldValue = field(linkedField).value;
60
+ const linkedFieldValueData = linkedFieldValue?.data;
61
+
62
+ useAsyncEffect(async () => {
63
+ if (
64
+ linkedFieldValueData?.fullName &&
65
+ linkedFieldValueData?.fullName !== field(fieldName)?.value?.data?.fullName
66
+ ) {
67
+ const fieldValues = getFieldValues(linkedFieldValue as OptionWithData<DaDataPartyHint>);
68
+ const { fullName, address, inn } = fieldValues;
69
+
70
+ const optionTextValue = getLinkedFieldValue(fieldValues, linkedField as string);
71
+ const dadataFields = useDadataParty(optionTextValue);
72
+ setSearchQuery(optionTextValue);
73
+
74
+ setOptions(await dadataFields);
75
+
76
+ field(fieldName)?.onChange?.({
77
+ key: inn,
78
+ text: optionTextValue,
79
+ data: {
80
+ fullName,
81
+ address,
82
+ },
83
+ });
84
+ }
85
+ }, [linkedFieldValueData]);
86
+
87
+ const [options, setOptions] = useState<DaDataPartyHint[]>([]); // InnSuggestion
88
+ const [searchQuery, setSearchQuery] = useState('');
89
+
90
+ useAsyncEffect(async () => {
91
+ const dadataFields = useDadataParty(searchQuery);
92
+ setOptions(await dadataFields);
93
+
94
+ return options;
95
+ }, [searchQuery]);
96
+
97
+ const getOptions = useMemo(
98
+ () =>
99
+ (options || []).map((item = {}) => ({
100
+ key: item.inn ?? '',
101
+ text: item[FIELD_MAPPING[fieldName].fieldValue],
102
+ data: {
103
+ fullName: item.fullName,
104
+ address: item.address,
105
+ },
106
+ })),
107
+ [options],
108
+ );
109
+
110
+ return (
111
+ <SelectControl
112
+ {...FIELD_CONFIG[fieldName]}
113
+ options={getOptions}
114
+ {...field(input.name ?? '')}
115
+ isSearch
116
+ isManualInput
117
+ disableFilterOptions={true}
118
+ onSearchQuery={setSearchQuery}
119
+ renderOptions={renderOptions}
120
+ />
121
+ );
122
+ });
123
+
124
+ export type CompanyDataProps = {
125
+ fullName?: string;
126
+ address?: string;
127
+ };
128
+
129
+ const getFieldValues = (value: OptionWithData<CompanyDataProps>): DaDataPartyHint => ({
130
+ inn: value?.key,
131
+ fullName: value?.data?.fullName,
132
+ address: value?.data?.address,
133
+ });
134
+
135
+ const renderOptions = (option: OptionWithData<CompanyDataProps>) => (
136
+ <span>
137
+ <Text size="text-s">{option?.data?.fullName}</Text>
138
+ <div className="space-x-2">
139
+ <Text size="text-s" font="font-light">
140
+ {option?.key}
141
+ </Text>
142
+ <Text size="text-s" font="font-light">
143
+ {option?.data?.address}
144
+ </Text>
145
+ </div>
146
+ </span>
147
+ );
148
+
149
+ const getLinkedFieldValue = (fieldValues: DaDataPartyHint, linkedField: string): string =>
150
+ fieldValues?.[FIELD_MAPPING[linkedField].linkedFieldValue];
@@ -40,8 +40,8 @@ type NameFieldApplicationDef =
40
40
  | 'consentToReceiveMaterials'
41
41
  | 'consentDataProcessing'
42
42
  | 'partnerSymbolCode'
43
- | 'innDadata'
44
- | 'companyNameByInn'
45
- | 'partnerName';
43
+ | 'partnerName'
44
+ | 'dadataPartyNameSelect'
45
+ | 'dadataPartyInnSelect';
46
46
 
47
47
  export type NameFieldDef = NameFieldApplicationDef;
@@ -13,13 +13,12 @@ import { BankEmpoleeField } from './Fields/BankEmpoleeField';
13
13
  import { BirthdayField } from './Fields/BirthdayField';
14
14
  import { CollectionCountField } from './Fields/CollectionCountField';
15
15
  import { CommentField } from './Fields/CommentField';
16
- import { CompanyNameByInnField } from './Fields/CompanyNameByInnField';
16
+ import { DadataPartySelectField } from './Fields/DadataPartySelectField';
17
17
  import { DesiredMeetingDateField } from './Fields/DesiredMeetingDateField';
18
18
  import { EmailField } from './Fields/EmailField';
19
19
  import { FeedbackMethodField } from './Fields/FeedbackMethodField';
20
20
  import { FullNameField } from './Fields/FullNameField';
21
21
  import { FullRegionField } from './Fields/FullRegionField';
22
- import { InnDadataField } from './Fields/InnDadataField';
23
22
  import { InnField } from './Fields/InnField';
24
23
  import { IsClientField } from './Fields/IsClientField';
25
24
  import { LocalitiesField } from './Fields/LocalitiesField';
@@ -100,9 +99,9 @@ const InputsMap = {
100
99
  partnerSymbolCode: (props: CustomFieldProps) => (
101
100
  <PartnerSymbolCodeField {...props} source={AGENTS_REF} />
102
101
  ),
103
- innDadata: InnDadataField,
104
- companyNameByInn: CompanyNameByInnField,
105
102
  partnerName: (props: CustomFieldProps) => <PartnerNameField {...props} source={AGENTS_REF} />,
103
+ dadataPartyNameSelect: DadataPartySelectField,
104
+ dadataPartyInnSelect: DadataPartySelectField,
106
105
  };
107
106
 
108
107
  export const getField =
@@ -41,9 +41,9 @@ export const validatorObj: Record<string, Validator> = {
41
41
  typeForm: defaultValidator(),
42
42
  consentToReceiveMaterials: agreementValidator,
43
43
  consentDataProcessing: agreementValidator,
44
- partnerSymbolCode: defaultValidator(),
45
- innDadata: innDadataValidator('Укажите ИНН'),
46
- companyNameByInn: defaultValidator(),
44
+ partnerSymbolCode: defaultValidator('Укажите идентификатор партнёра'),
45
+ dadataPartyInnSelect: innDadataValidator('Укажите ИНН'),
46
+ dadataPartyNameSelect: defaultValidator('Укажите наименование организации'),
47
47
  };
48
48
 
49
49
  export const getFormValidator = <FormState extends Record<string, any>, F extends BaseFieldDef>(
@@ -1,11 +1,9 @@
1
1
  import type { TextProps } from '../../model/HeadlineType';
2
2
 
3
- type companyData = {
4
- companyName?: string;
5
- companyAddress?: string;
6
- };
7
-
8
3
  export type Option = TextProps & {
9
4
  key: string;
10
- innDaData?: companyData;
5
+ };
6
+
7
+ export type OptionWithData<T = unknown> = Option & {
8
+ data?: T;
11
9
  };
@@ -8,7 +8,7 @@ import { debounce } from '../../utils/debounce';
8
8
  import { noop } from '../../utils/noop';
9
9
  import { style } from '../../utils/style';
10
10
  import { renderLabel } from '../Input/renderLabel';
11
- import { type Option } from './Option';
11
+ import { type Option, type OptionWithData } from './Option';
12
12
  import { renderSearchInput } from './renderSearchInput';
13
13
  import { renderSelectContainer } from './renderSelectContainer';
14
14
  import { useSelectPopup } from './useSelectPopup';
@@ -23,6 +23,7 @@ export interface SelectProps extends DefaultControlType, ControlProps<Option> {
23
23
  inputProps?: InputTypeProps;
24
24
  disableFilterOptions?: boolean;
25
25
  onSearchQuery?: (value: string) => void;
26
+ renderOptions?: (option?: OptionWithData) => void;
26
27
  }
27
28
 
28
29
  export type InputTypeProps = {
@@ -44,6 +45,7 @@ export const Select = JSX<SelectProps>(
44
45
  onSearchQuery = noop,
45
46
  inputProps,
46
47
  disableFilterOptions = false,
48
+ renderOptions,
47
49
  ...rest
48
50
  }) => {
49
51
  const [isOpen, { setFalse: close, setTrue: open }] = useBool();
@@ -61,19 +63,19 @@ export const Select = JSX<SelectProps>(
61
63
  }, [isDisabled]);
62
64
 
63
65
  const handleClose = useCallback(() => {
64
- !isManualInput && setQuery('');
66
+ !isSearch && setQuery('');
65
67
  close();
66
68
  }, [isManualInput]);
67
69
 
68
70
  const handleChangeQuery = useCallback(
69
71
  (newQuery: string) => {
70
72
  setQuery(newQuery);
71
- isManualInput && onChange?.({ key: newQuery, text: newQuery, innDaData: {} });
73
+ isManualInput && onChange?.({ key: newQuery, text: newQuery });
72
74
  debouncedOnSearchQuery?.(newQuery);
73
75
  },
74
76
  [isManualInput, onChange, debouncedOnSearchQuery],
75
77
  );
76
- const selectState = { query, value, options, isOpen, iconVersion };
78
+ const selectState = { query, value, options, isOpen, iconVersion, renderOptions, isSearch };
77
79
  const inputRef = useSelectPopup({
78
80
  onChange,
79
81
  onClose: handleClose,
@@ -3,15 +3,18 @@ import { type ControlProps } from '../../model/ControlProps';
3
3
  import { type IconVersion } from '../../model/IconVersion';
4
4
  import { style } from '../../utils/style';
5
5
  import { Icon } from '../Icon/Icon';
6
- import { Text } from '../Text/Text';
7
6
  import { filterOptions } from './filterOptions';
8
7
  import { formatOption } from './formatOption';
9
- import { type Option } from './Option';
8
+ import { type Option, type OptionWithData } from './Option';
10
9
 
11
- export interface SelectPopupProps extends ControlProps<Option> {
10
+ export interface SelectPopupProps extends ControlProps<Option>, SelectSearchProps {
12
11
  iconVersion?: IconVersion;
13
12
  options?: Option[];
14
13
  popupRef?: { current: HTMLDivElement | null };
14
+ renderOptions?: (option: OptionWithData) => void;
15
+ }
16
+
17
+ interface SelectSearchProps {
15
18
  query?: string;
16
19
  onChangeQuery?: (value: string) => void;
17
20
  disableFilterOptions?: boolean;
@@ -22,11 +25,13 @@ export const SelectPopup = JSX<SelectPopupProps>(
22
25
  popupRef,
23
26
  options,
24
27
  value,
25
- query,
26
28
  iconVersion,
27
- disableFilterOptions,
28
29
  onChange,
30
+ renderOptions = renderDefaultOptions,
31
+ // TODO: вынести в хук отвечающий за фильтрацию
32
+ query,
29
33
  onChangeQuery,
34
+ disableFilterOptions,
30
35
  }) =>
31
36
  options?.length ? (
32
37
  <div
@@ -48,22 +53,7 @@ export const SelectPopup = JSX<SelectPopupProps>(
48
53
  }
49
54
  }}
50
55
  >
51
- {option?.innDaData ? (
52
- <span>
53
- <Text size="text-s">{option?.innDaData?.companyName}</Text>
54
- <div className="space-x-2">
55
- <Text size="text-s" font="font-light">
56
- {formatOption(option)}
57
- </Text>
58
- <Text size="text-s" font="font-light">
59
- {option?.innDaData?.companyAddress}
60
- </Text>
61
- </div>
62
- </span>
63
- ) : (
64
- <span className="min-h-6">{formatOption(option)}</span>
65
- )}
66
-
56
+ {renderOptions(option)}
67
57
  <Icon
68
58
  name="DoneSimpleIcon"
69
59
  width="16"
@@ -78,3 +68,7 @@ export const SelectPopup = JSX<SelectPopupProps>(
78
68
  </div>
79
69
  ) : null,
80
70
  );
71
+
72
+ const renderDefaultOptions = (option: Option) => (
73
+ <span className="min-h-6">{formatOption(option)}</span>
74
+ );
@@ -10,6 +10,7 @@ interface SelectPopupOptions extends SelectPopupProps, OnCloseProps {
10
10
  isOpen?: boolean;
11
11
  onChangeQuery?: (value: string) => void;
12
12
  disableFilterOptions?: boolean;
13
+ isSearch?: boolean;
13
14
  }
14
15
 
15
16
  export function useSelectPopup({
@@ -22,6 +23,8 @@ export function useSelectPopup({
22
23
  iconVersion,
23
24
  disableFilterOptions = false,
24
25
  onChangeQuery = noop,
26
+ renderOptions,
27
+ isSearch = false,
25
28
  }: SelectPopupOptions) {
26
29
  const popup = usePopupManager();
27
30
 
@@ -34,11 +37,15 @@ export function useSelectPopup({
34
37
  (option: Option) => {
35
38
  close();
36
39
  onChange(option);
37
- onChangeQuery('');
40
+ onChangeQuery(isSearch && option?.text ? option.text : '');
38
41
  },
39
42
  [close, onChange],
40
43
  );
41
44
 
45
+ useEffect(() => {
46
+ onChangeQuery(isSearch && value?.text ? value.text : '');
47
+ }, [value]);
48
+
42
49
  const inputRef = useRef<HTMLDivElement | null>(null);
43
50
  const popupRef = useOutsideClick<HTMLDivElement>(close);
44
51
 
@@ -61,6 +68,7 @@ export function useSelectPopup({
61
68
  disableFilterOptions={disableFilterOptions}
62
69
  onChange={handleChange}
63
70
  onChangeQuery={onChangeQuery}
71
+ renderOptions={renderOptions}
64
72
  />
65
73
  ),
66
74
  top: top + window.scrollY + height,
@@ -11,37 +11,35 @@ import { type SitemapProps } from './SitemapProps';
11
11
  const FOOTER_AREA_KEYS = ['all', 'footer'];
12
12
  const IS_SINGLE_SEARCH_INDEX = Boolean(env.SINGLE_SEARCH_INDEX);
13
13
 
14
- export const Sitemap = JSX<SitemapProps>(({ className, navigationItems }) => {
15
- const link = useLink();
14
+ export const Sitemap = JSX<SitemapProps>(
15
+ ({ className, navigationItems, isSearchPanel = false }) => {
16
+ const link = useLink();
16
17
 
17
- const filteredItems = navigationItems?.filter(isVisibleItem(FOOTER_AREA_KEYS))?.map(link) ?? [];
18
+ const filteredItems = navigationItems?.filter(isVisibleItem(FOOTER_AREA_KEYS))?.map(link) ?? [];
18
19
 
19
- const [firstItem] = filteredItems;
20
+ const [firstItem] = filteredItems;
20
21
 
21
- return (
22
- <div className="space-y-2">
23
- {IS_SINGLE_SEARCH_INDEX ? (
24
- <div>
25
- <LinkList
26
- className="columns-3 space-y-3 gap-x-6xl"
27
- items={firstItem?.items}
28
- isFlex={false}
29
- />
30
- </div>
31
- ) : (
32
- <div
33
- role="menu"
34
- className={style(
35
- 'w-full flex items-start justify-between flex-col md:flex-row gap-y-m lg:order-2',
36
- className,
37
- )}
38
- >
39
- {filteredItems?.map(renderColumn)}
40
- </div>
41
- )}
42
- </div>
43
- );
44
- });
22
+ return (
23
+ <div className="space-y-2">
24
+ {IS_SINGLE_SEARCH_INDEX && isSearchPanel ? (
25
+ <div>
26
+ <LinkList className="block columns-3 space-y-3 gap-x-6xl" items={firstItem?.items} />
27
+ </div>
28
+ ) : (
29
+ <div
30
+ role="menu"
31
+ className={style(
32
+ 'w-full flex items-start justify-between flex-col md:flex-row gap-m lg:order-2',
33
+ className,
34
+ )}
35
+ >
36
+ {filteredItems?.map(renderColumn)}
37
+ </div>
38
+ )}
39
+ </div>
40
+ );
41
+ },
42
+ );
45
43
 
46
44
  const renderColumn = (menuItem: TopMenuItemProps & { onClick: () => void }, index: number) => {
47
45
  const { text, items = [], href, target = '_self', onClick, dataFooter } = menuItem;
@@ -60,7 +58,9 @@ const renderColumn = (menuItem: TopMenuItemProps & { onClick: () => void }, inde
60
58
  >
61
59
  {text}
62
60
  </a>
63
- {visibleSubItems ? <LinkList items={visibleSubItems} /> : null}
61
+ {visibleSubItems ? (
62
+ <LinkList className="flex flex-col gap-s" items={visibleSubItems} />
63
+ ) : null}
64
64
  </div>
65
65
  );
66
66
  };
@@ -3,4 +3,5 @@ import { type ComponentType } from '../../model/ComponentType';
3
3
 
4
4
  export interface SitemapProps extends ComponentType {
5
5
  navigationItems?: TopMenuItemProps[];
6
+ isSearchPanel?: boolean;
6
7
  }
@@ -1,7 +0,0 @@
1
- interface InnHint {
2
- fullName?: string;
3
- address?: string;
4
- inn?: string;
5
- }
6
- export declare const useInn: (searchQuery: string) => Promise<InnHint[]>;
7
- export {};
@@ -1,2 +0,0 @@
1
- import { type CustomFieldProps } from '../CustomFieldProps';
2
- export declare const CompanyNameByInnField: import("@redneckz/uni-jsx").UNIComponent<CustomFieldProps, any, any>;
@@ -1,2 +0,0 @@
1
- import { type CustomFieldProps } from '../CustomFieldProps';
2
- export declare const InnDadataField: import("@redneckz/uni-jsx").UNIComponent<CustomFieldProps, any, any>;
@@ -1,7 +0,0 @@
1
- interface InnHint {
2
- fullName?: string;
3
- address?: string;
4
- inn?: string;
5
- }
6
- export declare const useInn: (searchQuery: string) => Promise<InnHint[]>;
7
- export {};
@@ -1 +0,0 @@
1
- {"version":3,"file":"useInn.js","sourceRoot":"","sources":["../../src/hooks/useInn.ts"],"names":[],"mappings":";;AAAA,uEAAuE;AAEvE,MAAM,cAAc,GAAG,eAAe,CAAC;AAQhC,MAAM,MAAM,GAAG,KAAK,EAAE,WAAmB,EAAsB,EAAE,CACtE,CAAC,MAAM,IAAA,4BAAc,EAAC,EAAE,GAAG,EAAE,cAAc,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAC9E,QAAQ,EAAE,CAAC,EAAE,KAAK;IAClB,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK;IAChC,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,GAAG;CAClB,CAAC,CAAC,CAAC;AALO,QAAA,MAAM,UAKb"}
@@ -1,2 +0,0 @@
1
- import { type CustomFieldProps } from '../CustomFieldProps';
2
- export declare const CompanyNameByInnField: import("@redneckz/uni-jsx").UNIComponent<CustomFieldProps, any, any>;
@@ -1,17 +0,0 @@
1
- Object.defineProperty(exports, "__esModule", { value: true });
2
- exports.CompanyNameByInnField = void 0;
3
- const jsx_runtime_1 = require("@redneckz/uni-jsx/jsx-runtime");
4
- const uni_jsx_1 = require("@redneckz/uni-jsx");
5
- const hooks_1 = require("@redneckz/uni-jsx/lib/hooks");
6
- const InputControl_1 = require("../../Input/InputControl");
7
- exports.CompanyNameByInnField = (0, uni_jsx_1.JSX)(({ field, input }) => {
8
- const fieldInn = field('innDadata');
9
- (0, hooks_1.useEffect)(() => {
10
- if (fieldInn?.value?.key !== '') {
11
- const companyName = fieldInn?.value?.innDaData?.companyName;
12
- companyName && field?.('companyNameByInn')?.onChange?.(companyName);
13
- }
14
- }, [fieldInn?.value]);
15
- return ((0, jsx_runtime_1.jsx)(InputControl_1.InputControl, { maxLength: 60, label: "\u041F\u043E\u043B\u043D\u043E\u0435 \u043D\u0430\u0438\u043C\u0435\u043D\u043E\u0432\u0430\u043D\u0438\u0435", ...field(input?.name ?? ''), ...input }));
16
- });
17
- //# sourceMappingURL=CompanyNameByInnField.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CompanyNameByInnField.js","sourceRoot":"","sources":["../../../../src/ui-kit/FormField/Fields/CompanyNameByInnField.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AACxC,uDAAwD;AACxD,2DAAwD;AAG3C,QAAA,qBAAqB,GAAG,IAAA,aAAG,EAAmB,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE;IAC9E,MAAM,QAAQ,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC;IAEpC,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,QAAQ,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE;YAC/B,MAAM,WAAW,GAAG,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,CAAC;YAC5D,WAAW,IAAI,KAAK,EAAE,CAAC,kBAAkB,CAAC,EAAE,QAAQ,EAAE,CAAC,WAAW,CAAC,CAAC;SACrE;IACH,CAAC,EAAE,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;IAEtB,OAAO,CACL,uBAAC,2BAAY,IACX,SAAS,EAAE,EAAE,EACb,KAAK,EAAC,+GAAqB,KACvB,KAAK,CAAC,KAAK,EAAE,IAAI,IAAI,EAAE,CAAC,KACxB,KAAK,GACT,CACH,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- import { type CustomFieldProps } from '../CustomFieldProps';
2
- export declare const InnDadataField: import("@redneckz/uni-jsx").UNIComponent<CustomFieldProps, any, any>;
@@ -1,32 +0,0 @@
1
- Object.defineProperty(exports, "__esModule", { value: true });
2
- exports.InnDadataField = void 0;
3
- const jsx_runtime_1 = require("@redneckz/uni-jsx/jsx-runtime");
4
- const uni_jsx_1 = require("@redneckz/uni-jsx");
5
- const hooks_1 = require("@redneckz/uni-jsx/lib/hooks");
6
- const useAsyncEffect_1 = require("../../../hooks/useAsyncEffect");
7
- const useInn_1 = require("../../../hooks/useInn");
8
- const SelectControl_1 = require("../../Select/SelectControl");
9
- exports.InnDadataField = (0, uni_jsx_1.JSX)(({ field, input = {} }) => {
10
- const [options, setOptions] = (0, hooks_1.useState)([]);
11
- const [searchQuery, setSearchQuery] = (0, hooks_1.useState)('');
12
- (0, useAsyncEffect_1.useAsyncEffect)(async () => {
13
- const fieldInns = (0, useInn_1.useInn)(searchQuery);
14
- setOptions(await fieldInns);
15
- return options;
16
- }, [searchQuery]);
17
- const getOptions = (0, hooks_1.useMemo)(() => {
18
- return (options || []).map((item) => ({
19
- key: item?.inn ?? '',
20
- text: item?.inn,
21
- innDaData: {
22
- companyName: item?.fullName,
23
- companyAddress: item?.address,
24
- },
25
- }));
26
- }, [options]);
27
- return ((0, jsx_runtime_1.jsx)(SelectControl_1.SelectControl, { label: "\u0418\u041D\u041D", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0418\u041D\u041D", options: getOptions, ...field(input.name ?? ''), isSearch: true, isManualInput: true, inputProps: {
28
- isInteger: true,
29
- maxLength: 12,
30
- }, disableFilterOptions: true, onSearchQuery: setSearchQuery }));
31
- });
32
- //# sourceMappingURL=InnDadataField.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"InnDadataField.js","sourceRoot":"","sources":["../../../../src/ui-kit/FormField/Fields/InnDadataField.tsx"],"names":[],"mappings":";;;AAAA,+CAAwC;AACxC,uDAAgE;AAChE,kEAA+D;AAC/D,kDAA+C;AAC/C,8DAA2D;AAS9C,QAAA,cAAc,GAAG,IAAA,aAAG,EAAmB,CAAC,EAAE,KAAK,EAAE,KAAK,GAAG,EAAE,EAAE,EAAE,EAAE;IAC5E,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,IAAA,gBAAQ,EAAkB,EAAE,CAAC,CAAC;IAC5D,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,IAAA,gBAAQ,EAAC,EAAE,CAAC,CAAC;IAEnD,IAAA,+BAAc,EAAC,KAAK,IAAI,EAAE;QACxB,MAAM,SAAS,GAAG,IAAA,eAAM,EAAC,WAAW,CAAC,CAAC;QACtC,UAAU,CAAC,MAAM,SAAS,CAAC,CAAC;QAE5B,OAAO,OAAO,CAAC;IACjB,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;IAElB,MAAM,UAAU,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE;QAC9B,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YACpC,GAAG,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE;YACpB,IAAI,EAAE,IAAI,EAAE,GAAG;YACf,SAAS,EAAE;gBACT,WAAW,EAAE,IAAI,EAAE,QAAQ;gBAC3B,cAAc,EAAE,IAAI,EAAE,OAAO;aAC9B;SACF,CAAC,CAAC,CAAC;IACN,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAEd,OAAO,CACL,uBAAC,6BAAa,IACZ,KAAK,EAAC,oBAAK,EACX,WAAW,EAAC,+DAAa,EACzB,OAAO,EAAE,UAAU,KACf,KAAK,CAAC,KAAK,CAAC,IAAI,IAAI,EAAE,CAAC,EAC3B,QAAQ,QACR,aAAa,QACb,UAAU,EAAE;YACV,SAAS,EAAE,IAAI;YACf,SAAS,EAAE,EAAE;SACd,EACD,oBAAoB,EAAE,IAAI,EAC1B,aAAa,EAAE,cAAc,GAC7B,CACH,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -1,7 +0,0 @@
1
- interface InnHint {
2
- fullName?: string;
3
- address?: string;
4
- inn?: string;
5
- }
6
- export declare const useInn: (searchQuery: string) => Promise<InnHint[]>;
7
- export {};
@@ -1 +0,0 @@
1
- {"version":3,"file":"useInn.js","sourceRoot":"","sources":["../../src/hooks/useInn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAEvE,MAAM,cAAc,GAAG,eAAe,CAAC;AAQvC,MAAM,CAAC,MAAM,MAAM,GAAG,KAAK,EAAE,WAAmB,EAAsB,EAAE,CACtE,CAAC,MAAM,cAAc,CAAC,EAAE,GAAG,EAAE,cAAc,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAC9E,QAAQ,EAAE,CAAC,EAAE,KAAK;IAClB,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK;IAChC,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,GAAG;CAClB,CAAC,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- import { type CustomFieldProps } from '../CustomFieldProps';
2
- export declare const CompanyNameByInnField: import("@redneckz/uni-jsx").UNIComponent<CustomFieldProps, any, any>;
@@ -1,15 +0,0 @@
1
- import { jsx as _jsx } from "@redneckz/uni-jsx/jsx-runtime";
2
- import { JSX } from '@redneckz/uni-jsx';
3
- import { useEffect } from '@redneckz/uni-jsx/lib/hooks';
4
- import { InputControl } from '../../Input/InputControl.js';
5
- export const CompanyNameByInnField = JSX(({ field, input }) => {
6
- const fieldInn = field('innDadata');
7
- useEffect(() => {
8
- if (fieldInn?.value?.key !== '') {
9
- const companyName = fieldInn?.value?.innDaData?.companyName;
10
- companyName && field?.('companyNameByInn')?.onChange?.(companyName);
11
- }
12
- }, [fieldInn?.value]);
13
- return (_jsx(InputControl, { maxLength: 60, label: "\u041F\u043E\u043B\u043D\u043E\u0435 \u043D\u0430\u0438\u043C\u0435\u043D\u043E\u0432\u0430\u043D\u0438\u0435", ...field(input?.name ?? ''), ...input }));
14
- });
15
- //# sourceMappingURL=CompanyNameByInnField.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CompanyNameByInnField.js","sourceRoot":"","sources":["../../../../src/ui-kit/FormField/Fields/CompanyNameByInnField.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAGxD,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,CAAmB,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE;IAC9E,MAAM,QAAQ,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC;IAEpC,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,QAAQ,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE;YAC/B,MAAM,WAAW,GAAG,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,CAAC;YAC5D,WAAW,IAAI,KAAK,EAAE,CAAC,kBAAkB,CAAC,EAAE,QAAQ,EAAE,CAAC,WAAW,CAAC,CAAC;SACrE;IACH,CAAC,EAAE,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;IAEtB,OAAO,CACL,KAAC,YAAY,IACX,SAAS,EAAE,EAAE,EACb,KAAK,EAAC,+GAAqB,KACvB,KAAK,CAAC,KAAK,EAAE,IAAI,IAAI,EAAE,CAAC,KACxB,KAAK,GACT,CACH,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- import { type CustomFieldProps } from '../CustomFieldProps';
2
- export declare const InnDadataField: import("@redneckz/uni-jsx").UNIComponent<CustomFieldProps, any, any>;
@@ -1,30 +0,0 @@
1
- import { jsx as _jsx } from "@redneckz/uni-jsx/jsx-runtime";
2
- import { JSX } from '@redneckz/uni-jsx';
3
- import { useMemo, useState } from '@redneckz/uni-jsx/lib/hooks';
4
- import { useAsyncEffect } from '../../../hooks/useAsyncEffect.js';
5
- import { useInn } from '../../../hooks/useInn.js';
6
- import { SelectControl } from '../../Select/SelectControl.js';
7
- export const InnDadataField = JSX(({ field, input = {} }) => {
8
- const [options, setOptions] = useState([]);
9
- const [searchQuery, setSearchQuery] = useState('');
10
- useAsyncEffect(async () => {
11
- const fieldInns = useInn(searchQuery);
12
- setOptions(await fieldInns);
13
- return options;
14
- }, [searchQuery]);
15
- const getOptions = useMemo(() => {
16
- return (options || []).map((item) => ({
17
- key: item?.inn ?? '',
18
- text: item?.inn,
19
- innDaData: {
20
- companyName: item?.fullName,
21
- companyAddress: item?.address,
22
- },
23
- }));
24
- }, [options]);
25
- return (_jsx(SelectControl, { label: "\u0418\u041D\u041D", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0418\u041D\u041D", options: getOptions, ...field(input.name ?? ''), isSearch: true, isManualInput: true, inputProps: {
26
- isInteger: true,
27
- maxLength: 12,
28
- }, disableFilterOptions: true, onSearchQuery: setSearchQuery }));
29
- });
30
- //# sourceMappingURL=InnDadataField.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"InnDadataField.js","sourceRoot":"","sources":["../../../../src/ui-kit/FormField/Fields/InnDadataField.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAS3D,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,CAAmB,CAAC,EAAE,KAAK,EAAE,KAAK,GAAG,EAAE,EAAE,EAAE,EAAE;IAC5E,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAkB,EAAE,CAAC,CAAC;IAC5D,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IAEnD,cAAc,CAAC,KAAK,IAAI,EAAE;QACxB,MAAM,SAAS,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC;QACtC,UAAU,CAAC,MAAM,SAAS,CAAC,CAAC;QAE5B,OAAO,OAAO,CAAC;IACjB,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;IAElB,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE;QAC9B,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YACpC,GAAG,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE;YACpB,IAAI,EAAE,IAAI,EAAE,GAAG;YACf,SAAS,EAAE;gBACT,WAAW,EAAE,IAAI,EAAE,QAAQ;gBAC3B,cAAc,EAAE,IAAI,EAAE,OAAO;aAC9B;SACF,CAAC,CAAC,CAAC;IACN,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAEd,OAAO,CACL,KAAC,aAAa,IACZ,KAAK,EAAC,oBAAK,EACX,WAAW,EAAC,+DAAa,EACzB,OAAO,EAAE,UAAU,KACf,KAAK,CAAC,KAAK,CAAC,IAAI,IAAI,EAAE,CAAC,EAC3B,QAAQ,QACR,aAAa,QACb,UAAU,EAAE;YACV,SAAS,EAAE,IAAI;YACf,SAAS,EAAE,EAAE;SACd,EACD,oBAAoB,EAAE,IAAI,EAC1B,aAAa,EAAE,cAAc,GAC7B,CACH,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -1,7 +0,0 @@
1
- interface InnHint {
2
- fullName?: string;
3
- address?: string;
4
- inn?: string;
5
- }
6
- export declare const useInn: (searchQuery: string) => Promise<InnHint[]>;
7
- export {};