@redneckz/wildless-cms-uni-blocks 0.14.913 → 0.14.915

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 (240) 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 +134 -83
  6. package/bundle/bundle.umd.min.js +1 -1
  7. package/bundle/components/ApplicationForm/getInitialFormState.d.ts +3 -0
  8. package/bundle/hooks/useDadataParty.d.ts +6 -0
  9. package/bundle/ui-kit/FormField/Fields/DadataPartySelectField.d.ts +6 -0
  10. package/bundle/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  11. package/bundle/ui-kit/Select/Option.d.ts +3 -6
  12. package/bundle/ui-kit/Select/Select.d.ts +2 -1
  13. package/bundle/ui-kit/Select/SelectPopup.d.ts +6 -2
  14. package/bundle/ui-kit/Select/useSelectPopup.d.ts +2 -1
  15. package/dist/api/LeadServiceAPI.d.ts +0 -1
  16. package/dist/api/LeadServiceAPI.js.map +1 -1
  17. package/dist/api/getSubmitBody.d.ts +120 -96
  18. package/dist/api/getSubmitBody.js +1 -6
  19. package/dist/api/getSubmitBody.js.map +1 -1
  20. package/dist/components/ApplicationForm/getFormatData.js +11 -1
  21. package/dist/components/ApplicationForm/getFormatData.js.map +1 -1
  22. package/dist/components/ApplicationForm/getInitialFormState.d.ts +3 -0
  23. package/dist/components/ApplicationForm/getInitialFormState.js.map +1 -1
  24. package/dist/hooks/useDadataParty.d.ts +6 -0
  25. package/dist/hooks/{useInn.js → useDadataParty.js} +4 -4
  26. package/dist/hooks/useDadataParty.js.map +1 -0
  27. package/dist/ui-kit/BaseTile/BaseTile.js +1 -1
  28. package/dist/ui-kit/BaseTile/BaseTile.js.map +1 -1
  29. package/dist/ui-kit/FormField/Fields/DadataPartySelectField.d.ts +6 -0
  30. package/dist/ui-kit/FormField/Fields/DadataPartySelectField.js +84 -0
  31. package/dist/ui-kit/FormField/Fields/DadataPartySelectField.js.map +1 -0
  32. package/dist/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  33. package/dist/ui-kit/FormField/getField.js +3 -4
  34. package/dist/ui-kit/FormField/getField.js.map +1 -1
  35. package/dist/ui-kit/FormField/getObjectValidator.js +3 -3
  36. package/dist/ui-kit/FormField/getObjectValidator.js.map +1 -1
  37. package/dist/ui-kit/Select/Option.d.ts +3 -6
  38. package/dist/ui-kit/Select/Select.d.ts +2 -1
  39. package/dist/ui-kit/Select/Select.js +4 -4
  40. package/dist/ui-kit/Select/Select.js.map +1 -1
  41. package/dist/ui-kit/Select/SelectPopup.d.ts +6 -2
  42. package/dist/ui-kit/Select/SelectPopup.js +5 -3
  43. package/dist/ui-kit/Select/SelectPopup.js.map +1 -1
  44. package/dist/ui-kit/Select/useSelectPopup.d.ts +2 -1
  45. package/dist/ui-kit/Select/useSelectPopup.js +6 -3
  46. package/dist/ui-kit/Select/useSelectPopup.js.map +1 -1
  47. package/lib/api/LeadServiceAPI.d.ts +0 -1
  48. package/lib/api/LeadServiceAPI.js.map +1 -1
  49. package/lib/api/getSubmitBody.d.ts +120 -96
  50. package/lib/api/getSubmitBody.js +1 -6
  51. package/lib/api/getSubmitBody.js.map +1 -1
  52. package/lib/components/ApplicationForm/ApplicationForm.fixture.mobile.d.ts +1 -0
  53. package/lib/components/ApplicationForm/getFormatData.js +11 -1
  54. package/lib/components/ApplicationForm/getFormatData.js.map +1 -1
  55. package/lib/components/ApplicationForm/getInitialFormState.d.ts +3 -0
  56. package/lib/components/ApplicationForm/getInitialFormState.js.map +1 -1
  57. package/lib/components/Carousel/Carousel.fixture.d.ts +1 -0
  58. package/lib/components/CarouselRecommendationCard/CarouselRecommendationCard.fixture.d.ts +1 -1
  59. package/lib/components/CarouselTariffsCard/CarouselTariffsCard.fixture.d.ts +2 -0
  60. package/lib/hooks/useDadataParty.d.ts +6 -0
  61. package/lib/hooks/{useInn.js → useDadataParty.js} +2 -2
  62. package/lib/hooks/useDadataParty.js.map +1 -0
  63. package/lib/retail/components/DraftDialog/utils.d.ts +3 -3
  64. package/lib/ui-kit/BaseTile/BaseTile.js +1 -1
  65. package/lib/ui-kit/BaseTile/BaseTile.js.map +1 -1
  66. package/lib/ui-kit/FormField/Fields/DadataPartySelectField.d.ts +6 -0
  67. package/lib/ui-kit/FormField/Fields/DadataPartySelectField.js +82 -0
  68. package/lib/ui-kit/FormField/Fields/DadataPartySelectField.js.map +1 -0
  69. package/lib/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  70. package/lib/ui-kit/FormField/getField.js +3 -4
  71. package/lib/ui-kit/FormField/getField.js.map +1 -1
  72. package/lib/ui-kit/FormField/getObjectValidator.js +3 -3
  73. package/lib/ui-kit/FormField/getObjectValidator.js.map +1 -1
  74. package/lib/ui-kit/Select/Option.d.ts +3 -6
  75. package/lib/ui-kit/Select/Select.d.ts +2 -1
  76. package/lib/ui-kit/Select/Select.js +4 -4
  77. package/lib/ui-kit/Select/Select.js.map +1 -1
  78. package/lib/ui-kit/Select/SelectPopup.d.ts +6 -2
  79. package/lib/ui-kit/Select/SelectPopup.js +5 -3
  80. package/lib/ui-kit/Select/SelectPopup.js.map +1 -1
  81. package/lib/ui-kit/Select/useSelectPopup.d.ts +2 -1
  82. package/lib/ui-kit/Select/useSelectPopup.js +6 -3
  83. package/lib/ui-kit/Select/useSelectPopup.js.map +1 -1
  84. package/mobile/bundle/api/LeadServiceAPI.d.ts +0 -1
  85. package/mobile/bundle/api/getSubmitBody.d.ts +120 -96
  86. package/mobile/bundle/bundle.umd.js +134 -83
  87. package/mobile/bundle/bundle.umd.min.js +1 -1
  88. package/mobile/bundle/components/ApplicationForm/getInitialFormState.d.ts +3 -0
  89. package/mobile/bundle/hooks/useDadataParty.d.ts +6 -0
  90. package/mobile/bundle/ui-kit/FormField/Fields/DadataPartySelectField.d.ts +6 -0
  91. package/mobile/bundle/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  92. package/mobile/bundle/ui-kit/Select/Option.d.ts +3 -6
  93. package/mobile/bundle/ui-kit/Select/Select.d.ts +2 -1
  94. package/mobile/bundle/ui-kit/Select/SelectPopup.d.ts +6 -2
  95. package/mobile/bundle/ui-kit/Select/useSelectPopup.d.ts +2 -1
  96. package/mobile/dist/api/LeadServiceAPI.d.ts +0 -1
  97. package/mobile/dist/api/LeadServiceAPI.js.map +1 -1
  98. package/mobile/dist/api/getSubmitBody.d.ts +120 -96
  99. package/mobile/dist/api/getSubmitBody.js +1 -6
  100. package/mobile/dist/api/getSubmitBody.js.map +1 -1
  101. package/mobile/dist/components/ApplicationForm/getFormatData.js +11 -1
  102. package/mobile/dist/components/ApplicationForm/getFormatData.js.map +1 -1
  103. package/mobile/dist/components/ApplicationForm/getInitialFormState.d.ts +3 -0
  104. package/mobile/dist/components/ApplicationForm/getInitialFormState.js.map +1 -1
  105. package/mobile/dist/hooks/useDadataParty.d.ts +6 -0
  106. package/mobile/dist/hooks/{useInn.js → useDadataParty.js} +4 -4
  107. package/mobile/dist/hooks/useDadataParty.js.map +1 -0
  108. package/mobile/dist/ui-kit/BaseTile/BaseTile.js +1 -1
  109. package/mobile/dist/ui-kit/BaseTile/BaseTile.js.map +1 -1
  110. package/mobile/dist/ui-kit/FormField/Fields/DadataPartySelectField.d.ts +6 -0
  111. package/mobile/dist/ui-kit/FormField/Fields/DadataPartySelectField.js +84 -0
  112. package/mobile/dist/ui-kit/FormField/Fields/DadataPartySelectField.js.map +1 -0
  113. package/mobile/dist/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  114. package/mobile/dist/ui-kit/FormField/getField.js +3 -4
  115. package/mobile/dist/ui-kit/FormField/getField.js.map +1 -1
  116. package/mobile/dist/ui-kit/FormField/getObjectValidator.js +3 -3
  117. package/mobile/dist/ui-kit/FormField/getObjectValidator.js.map +1 -1
  118. package/mobile/dist/ui-kit/Select/Option.d.ts +3 -6
  119. package/mobile/dist/ui-kit/Select/Select.d.ts +2 -1
  120. package/mobile/dist/ui-kit/Select/Select.js +4 -4
  121. package/mobile/dist/ui-kit/Select/Select.js.map +1 -1
  122. package/mobile/dist/ui-kit/Select/SelectPopup.d.ts +6 -2
  123. package/mobile/dist/ui-kit/Select/SelectPopup.js +5 -3
  124. package/mobile/dist/ui-kit/Select/SelectPopup.js.map +1 -1
  125. package/mobile/dist/ui-kit/Select/useSelectPopup.d.ts +2 -1
  126. package/mobile/dist/ui-kit/Select/useSelectPopup.js +6 -3
  127. package/mobile/dist/ui-kit/Select/useSelectPopup.js.map +1 -1
  128. package/mobile/lib/api/LeadServiceAPI.d.ts +0 -1
  129. package/mobile/lib/api/LeadServiceAPI.js.map +1 -1
  130. package/mobile/lib/api/getSubmitBody.d.ts +120 -96
  131. package/mobile/lib/api/getSubmitBody.js +1 -6
  132. package/mobile/lib/api/getSubmitBody.js.map +1 -1
  133. package/mobile/lib/components/ApplicationForm/getFormatData.js +11 -1
  134. package/mobile/lib/components/ApplicationForm/getFormatData.js.map +1 -1
  135. package/mobile/lib/components/ApplicationForm/getInitialFormState.d.ts +3 -0
  136. package/mobile/lib/components/ApplicationForm/getInitialFormState.js.map +1 -1
  137. package/mobile/lib/hooks/useDadataParty.d.ts +6 -0
  138. package/mobile/lib/hooks/{useInn.js → useDadataParty.js} +2 -2
  139. package/mobile/lib/hooks/useDadataParty.js.map +1 -0
  140. package/mobile/lib/ui-kit/BaseTile/BaseTile.js +1 -1
  141. package/mobile/lib/ui-kit/BaseTile/BaseTile.js.map +1 -1
  142. package/mobile/lib/ui-kit/FormField/Fields/DadataPartySelectField.d.ts +6 -0
  143. package/mobile/lib/ui-kit/FormField/Fields/DadataPartySelectField.js +82 -0
  144. package/mobile/lib/ui-kit/FormField/Fields/DadataPartySelectField.js.map +1 -0
  145. package/mobile/lib/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  146. package/mobile/lib/ui-kit/FormField/getField.js +3 -4
  147. package/mobile/lib/ui-kit/FormField/getField.js.map +1 -1
  148. package/mobile/lib/ui-kit/FormField/getObjectValidator.js +3 -3
  149. package/mobile/lib/ui-kit/FormField/getObjectValidator.js.map +1 -1
  150. package/mobile/lib/ui-kit/Select/Option.d.ts +3 -6
  151. package/mobile/lib/ui-kit/Select/Select.d.ts +2 -1
  152. package/mobile/lib/ui-kit/Select/Select.js +4 -4
  153. package/mobile/lib/ui-kit/Select/Select.js.map +1 -1
  154. package/mobile/lib/ui-kit/Select/SelectPopup.d.ts +6 -2
  155. package/mobile/lib/ui-kit/Select/SelectPopup.js +5 -3
  156. package/mobile/lib/ui-kit/Select/SelectPopup.js.map +1 -1
  157. package/mobile/lib/ui-kit/Select/useSelectPopup.d.ts +2 -1
  158. package/mobile/lib/ui-kit/Select/useSelectPopup.js +6 -3
  159. package/mobile/lib/ui-kit/Select/useSelectPopup.js.map +1 -1
  160. package/mobile/src/api/LeadServiceAPI.ts +0 -1
  161. package/mobile/src/api/getSubmitBody.ts +0 -11
  162. package/mobile/src/components/ApplicationForm/ApplicationForm.example.json +22 -43
  163. package/mobile/src/components/ApplicationForm/getFormatData.tsx +16 -0
  164. package/mobile/src/components/ApplicationForm/getInitialFormState.tsx +3 -0
  165. package/mobile/src/hooks/{useInn.ts → useDadataParty.ts} +2 -2
  166. package/mobile/src/ui-kit/BaseTile/BaseTile.tsx +1 -1
  167. package/mobile/src/ui-kit/FormField/Fields/DadataPartySelectField.tsx +150 -0
  168. package/mobile/src/ui-kit/FormField/NameFieldDef.ts +3 -3
  169. package/mobile/src/ui-kit/FormField/getField.tsx +3 -4
  170. package/mobile/src/ui-kit/FormField/getObjectValidator.tsx +3 -3
  171. package/mobile/src/ui-kit/Select/Option.ts +4 -6
  172. package/mobile/src/ui-kit/Select/Select.tsx +6 -4
  173. package/mobile/src/ui-kit/Select/SelectPopup.tsx +15 -21
  174. package/mobile/src/ui-kit/Select/useSelectPopup.tsx +9 -1
  175. package/package.json +1 -1
  176. package/src/api/LeadServiceAPI.ts +0 -1
  177. package/src/api/getSubmitBody.ts +0 -11
  178. package/src/components/ApplicationForm/ApplicationForm.example.json +22 -43
  179. package/src/components/ApplicationForm/ApplicationForm.fixture.mobile.tsx +36 -13
  180. package/src/components/ApplicationForm/ApplicationForm.fixture.tsx +13 -12
  181. package/src/components/ApplicationForm/getFormatData.tsx +16 -0
  182. package/src/components/ApplicationForm/getInitialFormState.tsx +3 -0
  183. package/src/components/Carousel/Carousel.fixture.mobile.tsx +16 -16
  184. package/src/components/Carousel/Carousel.fixture.tsx +42 -20
  185. package/src/components/CarouselRecommendationCard/CarouselRecommendationCard.fixture.mobile.tsx +19 -19
  186. package/src/components/CarouselRecommendationCard/CarouselRecommendationCard.fixture.tsx +44 -23
  187. package/src/components/CarouselTariffsCard/CarouselTariffsCard.fixture.tsx +12 -12
  188. package/src/hooks/{useInn.ts → useDadataParty.ts} +2 -2
  189. package/src/icons/IconName.ts +4 -4
  190. package/src/ui-kit/BaseTile/BaseTile.tsx +1 -1
  191. package/src/ui-kit/FormField/Fields/DadataPartySelectField.tsx +150 -0
  192. package/src/ui-kit/FormField/NameFieldDef.ts +3 -3
  193. package/src/ui-kit/FormField/getField.tsx +3 -4
  194. package/src/ui-kit/FormField/getObjectValidator.tsx +3 -3
  195. package/src/ui-kit/Select/Option.ts +4 -6
  196. package/src/ui-kit/Select/Select.tsx +6 -4
  197. package/src/ui-kit/Select/SelectPopup.tsx +15 -21
  198. package/src/ui-kit/Select/useSelectPopup.tsx +9 -1
  199. package/bundle/hooks/useInn.d.ts +0 -7
  200. package/bundle/ui-kit/FormField/Fields/CompanyNameByInnField.d.ts +0 -2
  201. package/bundle/ui-kit/FormField/Fields/InnDadataField.d.ts +0 -2
  202. package/dist/hooks/useInn.d.ts +0 -7
  203. package/dist/hooks/useInn.js.map +0 -1
  204. package/dist/ui-kit/FormField/Fields/CompanyNameByInnField.d.ts +0 -2
  205. package/dist/ui-kit/FormField/Fields/CompanyNameByInnField.js +0 -17
  206. package/dist/ui-kit/FormField/Fields/CompanyNameByInnField.js.map +0 -1
  207. package/dist/ui-kit/FormField/Fields/InnDadataField.d.ts +0 -2
  208. package/dist/ui-kit/FormField/Fields/InnDadataField.js +0 -32
  209. package/dist/ui-kit/FormField/Fields/InnDadataField.js.map +0 -1
  210. package/lib/hooks/useInn.d.ts +0 -7
  211. package/lib/hooks/useInn.js.map +0 -1
  212. package/lib/ui-kit/FormField/Fields/CompanyNameByInnField.d.ts +0 -2
  213. package/lib/ui-kit/FormField/Fields/CompanyNameByInnField.js +0 -15
  214. package/lib/ui-kit/FormField/Fields/CompanyNameByInnField.js.map +0 -1
  215. package/lib/ui-kit/FormField/Fields/InnDadataField.d.ts +0 -2
  216. package/lib/ui-kit/FormField/Fields/InnDadataField.js +0 -30
  217. package/lib/ui-kit/FormField/Fields/InnDadataField.js.map +0 -1
  218. package/mobile/bundle/hooks/useInn.d.ts +0 -7
  219. package/mobile/bundle/ui-kit/FormField/Fields/CompanyNameByInnField.d.ts +0 -2
  220. package/mobile/bundle/ui-kit/FormField/Fields/InnDadataField.d.ts +0 -2
  221. package/mobile/dist/hooks/useInn.d.ts +0 -7
  222. package/mobile/dist/hooks/useInn.js.map +0 -1
  223. package/mobile/dist/ui-kit/FormField/Fields/CompanyNameByInnField.d.ts +0 -2
  224. package/mobile/dist/ui-kit/FormField/Fields/CompanyNameByInnField.js +0 -17
  225. package/mobile/dist/ui-kit/FormField/Fields/CompanyNameByInnField.js.map +0 -1
  226. package/mobile/dist/ui-kit/FormField/Fields/InnDadataField.d.ts +0 -2
  227. package/mobile/dist/ui-kit/FormField/Fields/InnDadataField.js +0 -32
  228. package/mobile/dist/ui-kit/FormField/Fields/InnDadataField.js.map +0 -1
  229. package/mobile/lib/hooks/useInn.d.ts +0 -7
  230. package/mobile/lib/hooks/useInn.js.map +0 -1
  231. package/mobile/lib/ui-kit/FormField/Fields/CompanyNameByInnField.d.ts +0 -2
  232. package/mobile/lib/ui-kit/FormField/Fields/CompanyNameByInnField.js +0 -15
  233. package/mobile/lib/ui-kit/FormField/Fields/CompanyNameByInnField.js.map +0 -1
  234. package/mobile/lib/ui-kit/FormField/Fields/InnDadataField.d.ts +0 -2
  235. package/mobile/lib/ui-kit/FormField/Fields/InnDadataField.js +0 -30
  236. package/mobile/lib/ui-kit/FormField/Fields/InnDadataField.js.map +0 -1
  237. package/mobile/src/ui-kit/FormField/Fields/CompanyNameByInnField.tsx +0 -24
  238. package/mobile/src/ui-kit/FormField/Fields/InnDadataField.tsx +0 -52
  239. package/src/ui-kit/FormField/Fields/CompanyNameByInnField.tsx +0 -24
  240. 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,
@@ -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 {};
@@ -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>;