@redneckz/wildless-cms-uni-blocks 0.14.590 → 0.14.592

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 (51) hide show
  1. package/bundle/bundle.umd.js +63 -61
  2. package/bundle/bundle.umd.min.js +1 -1
  3. package/bundle/ui-kit/FormField/validators.d.ts +9 -9
  4. package/dist/ui-kit/FormField/Fields/MiddleNameField.js +3 -1
  5. package/dist/ui-kit/FormField/Fields/MiddleNameField.js.map +1 -1
  6. package/dist/ui-kit/FormField/getObjectValidator.js +46 -45
  7. package/dist/ui-kit/FormField/getObjectValidator.js.map +1 -1
  8. package/dist/ui-kit/FormField/validators.d.ts +9 -9
  9. package/dist/ui-kit/FormField/validators.js +17 -9
  10. package/dist/ui-kit/FormField/validators.js.map +1 -1
  11. package/dist/ui-kit/Input/Input.js +3 -2
  12. package/dist/ui-kit/Input/Input.js.map +1 -1
  13. package/lib/ui-kit/FormField/Fields/MiddleNameField.js +3 -1
  14. package/lib/ui-kit/FormField/Fields/MiddleNameField.js.map +1 -1
  15. package/lib/ui-kit/FormField/getObjectValidator.js +46 -45
  16. package/lib/ui-kit/FormField/getObjectValidator.js.map +1 -1
  17. package/lib/ui-kit/FormField/validators.d.ts +9 -9
  18. package/lib/ui-kit/FormField/validators.js +9 -9
  19. package/lib/ui-kit/FormField/validators.js.map +1 -1
  20. package/lib/ui-kit/Input/Input.js +3 -2
  21. package/lib/ui-kit/Input/Input.js.map +1 -1
  22. package/mobile/bundle/bundle.umd.js +63 -61
  23. package/mobile/bundle/bundle.umd.min.js +1 -1
  24. package/mobile/bundle/ui-kit/FormField/validators.d.ts +9 -9
  25. package/mobile/dist/ui-kit/FormField/Fields/MiddleNameField.js +3 -1
  26. package/mobile/dist/ui-kit/FormField/Fields/MiddleNameField.js.map +1 -1
  27. package/mobile/dist/ui-kit/FormField/getObjectValidator.js +46 -45
  28. package/mobile/dist/ui-kit/FormField/getObjectValidator.js.map +1 -1
  29. package/mobile/dist/ui-kit/FormField/validators.d.ts +9 -9
  30. package/mobile/dist/ui-kit/FormField/validators.js +17 -9
  31. package/mobile/dist/ui-kit/FormField/validators.js.map +1 -1
  32. package/mobile/dist/ui-kit/Input/Input.js +3 -2
  33. package/mobile/dist/ui-kit/Input/Input.js.map +1 -1
  34. package/mobile/lib/ui-kit/FormField/Fields/MiddleNameField.js +3 -1
  35. package/mobile/lib/ui-kit/FormField/Fields/MiddleNameField.js.map +1 -1
  36. package/mobile/lib/ui-kit/FormField/getObjectValidator.js +46 -45
  37. package/mobile/lib/ui-kit/FormField/getObjectValidator.js.map +1 -1
  38. package/mobile/lib/ui-kit/FormField/validators.d.ts +9 -9
  39. package/mobile/lib/ui-kit/FormField/validators.js +9 -9
  40. package/mobile/lib/ui-kit/FormField/validators.js.map +1 -1
  41. package/mobile/lib/ui-kit/Input/Input.js +3 -2
  42. package/mobile/lib/ui-kit/Input/Input.js.map +1 -1
  43. package/mobile/src/ui-kit/FormField/Fields/MiddleNameField.tsx +7 -1
  44. package/mobile/src/ui-kit/FormField/getObjectValidator.tsx +46 -45
  45. package/mobile/src/ui-kit/FormField/validators.ts +19 -18
  46. package/mobile/src/ui-kit/Input/Input.tsx +6 -2
  47. package/package.json +2 -2
  48. package/src/ui-kit/FormField/Fields/MiddleNameField.tsx +7 -1
  49. package/src/ui-kit/FormField/getObjectValidator.tsx +46 -45
  50. package/src/ui-kit/FormField/validators.ts +19 -18
  51. package/src/ui-kit/Input/Input.tsx +6 -2
@@ -145,7 +145,7 @@
145
145
  const defaultBlockDecorator = ({ blockClassName, block, render }) => render({ blockClassName, block });
146
146
 
147
147
  const DEFAULT_ANCESTORS = [];
148
- const defaultStyle$1 = 'col-span-12';
148
+ const defaultStyle$2 = 'col-span-12';
149
149
  function renderBlock$1(block, options, { className, ...extraProps } = {}) {
150
150
  const { key, blockDecorator = defaultBlockDecorator, blocksRegistry = {}, ancestors = DEFAULT_ANCESTORS, } = options;
151
151
  const { type } = block;
@@ -154,7 +154,7 @@
154
154
  }
155
155
  const BlockComponent = type && blocksRegistry[type];
156
156
  return blockDecorator({
157
- blockClassName: style(block.style?.length ? block.style : defaultStyle$1, className),
157
+ blockClassName: style(block.style?.length ? block.style : defaultStyle$2, className),
158
158
  block,
159
159
  ancestors,
160
160
  // Adjusted by decorator block and blockClassName
@@ -1173,19 +1173,20 @@
1173
1173
  const Input = JSX(({ key, className = '', id, name, type = 'text', label, placeholder, value = '', valid = true, children, onChange, onFocus, onBlur, pattern, autoFocus = false, isTextarea = false, }) => {
1174
1174
  const inputRef = useRef(null);
1175
1175
  const handleChange = useCallback((e) => {
1176
- onChange && onChange(e.target?.value || '');
1176
+ const valueWithoutSpace = (e.target?.value || '').trimStart();
1177
+ onChange && onChange(valueWithoutSpace);
1177
1178
  }, [onChange]);
1178
1179
  useEffect(() => {
1179
1180
  if (autoFocus) {
1180
1181
  inputRef.current?.focus();
1181
1182
  }
1182
1183
  }, [autoFocus, inputRef]);
1183
- const defaultStyle = 'w-full border rounded-md text-primary-text outline-none p-m';
1184
1184
  const paddingStyle = children ? 'pr-3xl' : '';
1185
1185
  const validStyle = getValidStyle(valid);
1186
- return (jsxs("div", { className: style('relative', className), children: [jsxs("label", { className: "space-y-xs", children: [renderLabel(label), isTextarea ? (jsx("textarea", { className: style('block resize-y min-h-24', defaultStyle, validStyle), id: style('textarea', id), name: name || id, placeholder: placeholder, value: value, onChange: handleChange, onFocus: onFocus, onBlur: onBlur }, key)) : (jsx("input", { type: type, className: style('h-14', defaultStyle, paddingStyle, validStyle), ref: inputRef, id: id, name: name || id, placeholder: placeholder, value: value, onChange: handleChange, onFocus: onFocus, onBlur: onBlur, pattern: pattern }, key))] }), children] }));
1186
+ return (jsxs("div", { className: style('relative', className), children: [jsxs("label", { className: "space-y-xs", children: [renderLabel(label), isTextarea ? (jsx("textarea", { className: style('block resize-y min-h-24', defaultStyle$1, validStyle), id: style('textarea', id), name: name || id, placeholder: placeholder, value: value, onChange: handleChange, onFocus: onFocus, onBlur: onBlur }, key)) : (jsx("input", { type: type, className: style('h-14', defaultStyle$1, paddingStyle, validStyle), ref: inputRef, id: id, name: name || id, placeholder: placeholder, value: value, onChange: handleChange, onFocus: onFocus, onBlur: onBlur, pattern: pattern }, key))] }), children] }));
1187
1187
  });
1188
1188
  const getValidStyle = (valid) => (valid ? inputValidStyle : 'border-error');
1189
+ const defaultStyle$1 = 'w-full border rounded-md text-primary-text outline-none p-m';
1189
1190
 
1190
1191
  const DEFAULT_HINTS_COUNT = 10;
1191
1192
  const getResponseHandler = (response) => {
@@ -1417,14 +1418,14 @@
1417
1418
  const required = validator((_) => _ !== null && _ !== undefined && _ !== '');
1418
1419
 
1419
1420
  const ERROR_MESSAGE = 'Некорректно заполненное поле';
1420
- const defaultValidator = required(ERROR_MESSAGE);
1421
+ const defaultValidator = (errorMsg) => required(errorMsg ? errorMsg : ERROR_MESSAGE);
1421
1422
  const defaultSelectValidator = validator((_) => _?.key && _?.key !== '')(ERROR_MESSAGE);
1422
- const nameValidator = validator((_) => typeof _ === 'string' && _.length > 1)(ERROR_MESSAGE);
1423
- const lengthStringValidator = (maxLength) => validator((_) => typeof _ === 'string' && _.length >= 1 && _.length <= maxLength)(ERROR_MESSAGE);
1424
- const serieValidator = validator((_) => typeof _ === 'string' && _.length === 4)(ERROR_MESSAGE);
1425
- const numberValidator = validator((_) => typeof _ === 'string' && _.length === 6)(ERROR_MESSAGE);
1426
- const innValidator = validator((_) => typeof _ === 'string' && (_.length === 10 || _.length === 12))(ERROR_MESSAGE);
1427
- const phoneValidator = pattern(/^(\+7)?[\s-]?\(?[0-9]{3}\)?[\s-]?[0-9]{3}[\s-]?[0-9]{2}[\s-]?[0-9]{2}$/)(ERROR_MESSAGE);
1423
+ const nameValidator = (errorMsg) => validator((_) => typeof _ === 'string' && _.length > 1)(errorMsg ? errorMsg : ERROR_MESSAGE);
1424
+ const lengthStringValidator = (maxLength, errorMsg) => validator((_) => typeof _ === 'string' && _.length >= 1 && _.length <= maxLength)(errorMsg ? errorMsg : ERROR_MESSAGE);
1425
+ const serieValidator = (errorMsg) => validator((_) => typeof _ === 'string' && _.length === 4)(errorMsg);
1426
+ const numberValidator = (errorMsg) => validator((_) => typeof _ === 'string' && _.length === 6)(errorMsg);
1427
+ const innValidator = (errorMsg) => validator((_) => typeof _ === 'string' && (_.length === 10 || _.length === 12))(errorMsg);
1428
+ const phoneValidator = (errorMsg) => pattern(/^(\+7)?[\s-]?\(?[0-9]{3}\)?[\s-]?[0-9]{3}[\s-]?[0-9]{2}[\s-]?[0-9]{2}$/)(errorMsg);
1428
1429
  const agreementValidator = validator((_) => typeof _ === 'boolean' && _)('Согласие обязательно');
1429
1430
  const snilsValidate = (snils) => {
1430
1431
  const snl = String(snils).replace(/[^0-9]+/g, '');
@@ -1443,55 +1444,56 @@
1443
1444
  }
1444
1445
  return false;
1445
1446
  };
1446
- const snilsValidator = validator(snilsValidate)(ERROR_MESSAGE);
1447
+ const snilsValidator = (errorMsg) => validator(snilsValidate)(errorMsg);
1447
1448
  const emailValidate = (email) => /^[^\s@]+@[^\s@]+\.[a-zA-Z]{2}$/.test(email);
1448
- const emailValidator = validator((_) => emailValidate(_))(ERROR_MESSAGE);
1449
+ const emailValidator = (errorMsg) => validator((_) => emailValidate(_))(errorMsg);
1449
1450
 
1450
1451
  const validatorObj = {
1451
- typeForm: defaultValidator,
1452
- surname: nameValidator,
1453
- name: nameValidator,
1452
+ typeForm: defaultValidator(),
1453
+ surname: nameValidator('Укажите свою фамилию'),
1454
+ name: nameValidator('Укажите своё имя'),
1455
+ middleName: nameValidator('Укажите своё отчество'),
1454
1456
  region: defaultSelectValidator,
1455
1457
  addressBranch: defaultSelectValidator,
1456
- phone: phoneValidator,
1457
- secondaryPhone: phoneValidator,
1458
- birthday: defaultValidator,
1459
- education: defaultValidator,
1460
- housing: defaultValidator,
1461
- employment: defaultValidator,
1462
- organization: defaultValidator,
1463
- amountWorkers: defaultValidator,
1464
- employerActivities: defaultValidator,
1465
- employerOrganization: defaultValidator,
1466
- positionOrganization: defaultValidator,
1467
- email: emailValidator,
1468
- dulSerie: serieValidator,
1469
- dulNumber: numberValidator,
1470
- dulIssueDateField: defaultValidator,
1471
- dulSubdivisionCode: numberValidator,
1472
- dulIssuedBy: defaultValidator,
1473
- fullName: nameValidator,
1474
- inn: innValidator,
1475
- legalForm: defaultValidator,
1476
- organizationName: defaultValidator,
1477
- generalSeniority: defaultValidator,
1478
- lastJobExperience: defaultValidator,
1479
- experience5Years: defaultValidator,
1480
- jobsNumber: defaultValidator,
1481
- beginDate: defaultValidator,
1482
- fullAddress: defaultValidator,
1483
- partnerComments: defaultValidator,
1484
- collectionCount: defaultValidator,
1485
- comment: defaultValidator,
1458
+ phone: phoneValidator('Укажите номер телефона'),
1459
+ secondaryPhone: phoneValidator('Укажите номер телефона'),
1460
+ birthday: defaultValidator('Укажите дату рождения'),
1461
+ education: defaultValidator('Выберите ваше образование'),
1462
+ housing: defaultValidator('Выберите тип жилья'),
1463
+ employment: defaultValidator('Выберите информацию о трудоустройстве'),
1464
+ organization: defaultValidator('Выберите тип организации'),
1465
+ amountWorkers: defaultValidator('Выберите информацию о количестве сотрудников'),
1466
+ employerActivities: defaultValidator('Выберите вид деятельности организации'),
1467
+ employerOrganization: defaultValidator('Выберите вид организации'),
1468
+ positionOrganization: defaultValidator('Выберите вашу должность'),
1469
+ dulSerie: serieValidator('Укажите серию паспорта'),
1470
+ dulNumber: numberValidator('Укажите номер паспорта'),
1471
+ dulIssueDateField: defaultValidator('Укажите дату выдачи паспорта'),
1472
+ dulSubdivisionCode: numberValidator('Укажите код подразделения'),
1473
+ dulIssuedBy: defaultValidator('Укажите организацию, выдавшую паспорт'),
1474
+ email: emailValidator('Укажите электронную почту'),
1475
+ fullName: nameValidator(),
1476
+ inn: innValidator('Укажите ИНН'),
1477
+ legalForm: defaultValidator('Укажите ОПФ'),
1478
+ organizationName: defaultValidator('Укажите наименование организации'),
1479
+ generalSeniority: defaultValidator(),
1480
+ lastJobExperience: defaultValidator('Укажите стаж на последнем месте работы'),
1481
+ experience5Years: defaultValidator('Укажите общий стаж за последние 5 лет'),
1482
+ jobsNumber: defaultValidator('Укажите количество лет стажа'),
1483
+ beginDate: defaultValidator('Укажите дату заключения трудового договора'),
1484
+ fullAddress: defaultValidator(),
1485
+ partnerComments: defaultValidator(),
1486
+ collectionCount: defaultValidator(),
1487
+ comment: defaultValidator(),
1486
1488
  acquiringType: defaultSelectValidator,
1487
1489
  feedbackMethod: defaultSelectValidator,
1488
1490
  serviceType: defaultSelectValidator,
1489
1491
  serviceDirection: defaultSelectValidator,
1490
- meetingDay: defaultValidator,
1491
- product: defaultValidator,
1492
- localities: defaultValidator,
1492
+ meetingDay: defaultValidator(),
1493
+ product: defaultValidator(),
1494
+ localities: defaultValidator(),
1493
1495
  consentDataProcessing: agreementValidator,
1494
- annualRevenue: defaultValidator,
1496
+ annualRevenue: defaultValidator(),
1495
1497
  consentToReceiveMaterials: agreementValidator,
1496
1498
  processPersonalDataLeadFlg: agreementValidator,
1497
1499
  consentProviderFlg: agreementValidator,
@@ -1500,14 +1502,14 @@
1500
1502
  consentAssignmentClaimsFlg: agreementValidator,
1501
1503
  consentCollectionFlg: agreementValidator,
1502
1504
  consentInformFlg: agreementValidator,
1503
- familyStatus: defaultValidator,
1504
- children: lengthStringValidator(2),
1505
- familyMembers: lengthStringValidator(2),
1506
- dependents: lengthStringValidator(2),
1507
- totalIncome: lengthStringValidator(19),
1508
- expenses: lengthStringValidator(10),
1509
- snils: snilsValidator,
1510
- conscription: defaultValidator,
1505
+ familyStatus: defaultValidator('Выберите семейное положение'),
1506
+ children: lengthStringValidator(2, 'Укажите количество детей'),
1507
+ familyMembers: lengthStringValidator(2, 'Укажите количество членов семьи'),
1508
+ dependents: lengthStringValidator(2, 'Укажите количество иждивенцев'),
1509
+ totalIncome: lengthStringValidator(19, 'Укажите среднемесячный доход от основной зарплаты'),
1510
+ expenses: lengthStringValidator(10, 'Укажите сумму обязательных выплат'),
1511
+ snils: snilsValidator('Некорректный номер СНИЛС'),
1512
+ conscription: defaultValidator(),
1511
1513
  armyIdFlg: agreementValidator,
1512
1514
  };
1513
1515
  const getObjectValidator = (inputs) => {
@@ -2026,7 +2028,7 @@
2026
2028
  return (jsx(SelectControl, { label: "\u041D\u0430\u0441\u0435\u043B\u0435\u043D\u043D\u044B\u0439 \u043F\u0443\u043D\u043A\u0442", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0433\u043E\u0440\u043E\u0434, \u0433\u0434\u0435 \u0434\u043E\u0441\u0442\u0443\u043F\u0435\u043D \u0441\u0435\u0440\u0432\u0438\u0441", options: localities, ...getValidation(field('localities'), validatorObj.localities, input?.required), isSearch: true }));
2027
2029
  });
2028
2030
 
2029
- const MiddleNameField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041E\u0442\u0447\u0435\u0441\u0442\u0432\u043E (\u041E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u043E, \u043F\u0440\u0438 \u043D\u0430\u043B\u0438\u0447\u0438\u0438)", ...field('middleName'), ...input })));
2031
+ const MiddleNameField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041E\u0442\u0447\u0435\u0441\u0442\u0432\u043E (\u041E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u043E, \u043F\u0440\u0438 \u043D\u0430\u043B\u0438\u0447\u0438\u0438)", ...getValidation(field('middleName'), validatorObj.middleName), ...input })));
2030
2032
 
2031
2033
  const NameField = JSX(({ field, input }) => {
2032
2034
  const { required, ...rest } = input;
@@ -7431,7 +7433,7 @@
7431
7433
  slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
7432
7434
  });
7433
7435
 
7434
- const packageVersion = "0.14.589";
7436
+ const packageVersion = "0.14.591";
7435
7437
 
7436
7438
  exports.Blocks = Blocks;
7437
7439
  exports.ContentPage = ContentPage;