@reformer/core 11.0.0-beta.6 → 11.0.0-beta.7

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 (76) hide show
  1. package/dist/behaviors.js +124 -124
  2. package/dist/create-model-B8U-COv-.js +103 -0
  3. package/dist/en-CjAqn7h0.js +41 -0
  4. package/dist/form/behaviors/internals.d.ts +9 -0
  5. package/dist/form/types/contracts.d.ts +6 -0
  6. package/dist/form/types/validation-schema.d.ts +13 -1
  7. package/dist/form/validation/operators.d.ts +6 -1
  8. package/dist/form/validators/validation-error.d.ts +8 -0
  9. package/dist/i18n/descriptor.d.ts +54 -0
  10. package/dist/i18n/en.json.d.ts +45 -0
  11. package/dist/i18n/loader.d.ts +71 -0
  12. package/dist/i18n/locale-store.d.ts +39 -0
  13. package/dist/i18n/locale.d.ts +90 -0
  14. package/dist/i18n/message-format.d.ts +116 -0
  15. package/dist/i18n/resolve-localized.d.ts +17 -0
  16. package/dist/i18n/ru.json.d.ts +45 -0
  17. package/dist/i18n/translator.d.ts +50 -0
  18. package/dist/i18n/validation-message.d.ts +18 -0
  19. package/dist/i18n.d.ts +31 -0
  20. package/dist/i18n.js +303 -0
  21. package/dist/index-BrNkQj1y.js +105 -0
  22. package/dist/index.js +639 -736
  23. package/dist/loader-Dv_Hl7JC.js +216 -0
  24. package/dist/locale/en.d.ts +2 -0
  25. package/dist/locale/en.js +5 -0
  26. package/dist/locale/en.json +42 -0
  27. package/dist/locale/index.d.ts +18 -0
  28. package/dist/locale/ru.d.ts +2 -0
  29. package/dist/locale/ru.js +41 -0
  30. package/dist/locale/ru.json +42 -0
  31. package/dist/locale.d.ts +2 -0
  32. package/dist/locale.js +9 -0
  33. package/dist/model/create-model.d.ts +17 -3
  34. package/dist/model/index.d.ts +3 -3
  35. package/dist/model/model-signals-proxy.d.ts +25 -0
  36. package/dist/model/types.d.ts +19 -5
  37. package/dist/model-signals-proxy-2vqS243J.js +250 -0
  38. package/dist/model.js +18 -16
  39. package/dist/platforms/react/hooks/types.d.ts +6 -3
  40. package/dist/platforms/react/hooks/useFormControlValue.d.ts +2 -1
  41. package/dist/platforms/react/i18n/context.d.ts +13 -0
  42. package/dist/platforms/react/i18n/hooks.d.ts +59 -0
  43. package/dist/platforms/react/i18n/provider.d.ts +52 -0
  44. package/dist/{strategy-DA3JwxsR.js → strategy-BXS_gBfz.js} +7 -7
  45. package/dist/validation-error-B-U3RsV0.js +11 -0
  46. package/dist/validation.js +1 -1
  47. package/dist/validators/email.js +5 -8
  48. package/dist/validators/future-date.js +8 -11
  49. package/dist/validators/integer.js +4 -7
  50. package/dist/validators/is-date.js +5 -8
  51. package/dist/validators/is-number.js +4 -7
  52. package/dist/validators/max-age.js +8 -11
  53. package/dist/validators/max-date.js +8 -11
  54. package/dist/validators/max-length.js +5 -8
  55. package/dist/validators/max.js +4 -7
  56. package/dist/validators/min-age.js +8 -11
  57. package/dist/validators/min-date.js +8 -11
  58. package/dist/validators/min-length.js +5 -8
  59. package/dist/validators/min.js +4 -7
  60. package/dist/validators/multiple-of.js +5 -8
  61. package/dist/validators/non-negative.js +4 -7
  62. package/dist/validators/non-zero.js +4 -7
  63. package/dist/validators/past-date.js +8 -11
  64. package/dist/validators/pattern.js +5 -8
  65. package/dist/validators/phone.js +6 -9
  66. package/dist/validators/required.js +4 -7
  67. package/dist/validators/url.js +9 -14
  68. package/dist/validators.js +84 -106
  69. package/docs/llms/03-api-signatures.md +6 -0
  70. package/docs/llms/10-arrays.md +30 -0
  71. package/docs/llms/34-i18n.md +272 -0
  72. package/llms-index.json +1 -1
  73. package/llms.txt +1589 -98
  74. package/package.json +22 -3
  75. package/dist/create-model-Dxh9cfLp.js +0 -97
  76. package/dist/model-signals-proxy-mV3WGdlO.js +0 -233
@@ -1,19 +1,16 @@
1
- import { p as s, c as l } from "../date-utils-dTT_x_Be.js";
2
- function c(e, a) {
1
+ import { p as o, c as i } from "../date-utils-dTT_x_Be.js";
2
+ import { v as l } from "../validation-error-B-U3RsV0.js";
3
+ function s(n, a) {
3
4
  return (r) => {
4
5
  if (r == null || r === "")
5
6
  return null;
6
- const n = s(r);
7
- if (n === null)
7
+ const t = o(r);
8
+ if (t === null)
8
9
  return null;
9
- const t = l(n);
10
- return t > e ? {
11
- code: "date_max_age",
12
- message: a?.message ?? "invalid",
13
- params: { maxAge: e, currentAge: t, ...a?.params }
14
- } : null;
10
+ const e = i(t);
11
+ return e > n ? l("date_max_age", a, { maxAge: n, currentAge: e }) : null;
15
12
  };
16
13
  }
17
14
  export {
18
- c as maxAge
15
+ s as maxAge
19
16
  };
@@ -1,19 +1,16 @@
1
- import { p as m, n as t } from "../date-utils-dTT_x_Be.js";
2
- function o(n, a) {
1
+ import { p as l, n as o } from "../date-utils-dTT_x_Be.js";
2
+ import { v as m } from "../validation-error-B-U3RsV0.js";
3
+ function d(n, a) {
3
4
  return (r) => {
4
5
  if (r == null || r === "")
5
6
  return null;
6
- const e = m(r);
7
- if (e === null)
7
+ const t = l(r);
8
+ if (t === null)
8
9
  return null;
9
- const s = t(e), l = t(n);
10
- return s > l ? {
11
- code: "date_max",
12
- message: a?.message ?? "invalid",
13
- params: { maxDate: n, ...a?.params }
14
- } : null;
10
+ const e = o(t), i = o(n);
11
+ return e > i ? m("date_max", a, { maxDate: n }) : null;
15
12
  };
16
13
  }
17
14
  export {
18
- o as maxDate
15
+ d as maxDate
19
16
  };
@@ -1,15 +1,12 @@
1
- function l(r, t) {
1
+ import { v as l } from "../validation-error-B-U3RsV0.js";
2
+ function u(t, e) {
2
3
  return (n) => {
3
4
  if (n == null || n === "")
4
5
  return null;
5
- const e = n.length;
6
- return typeof e != "number" ? null : e > r ? {
7
- code: "maxLength",
8
- message: t?.message ?? "invalid",
9
- params: { maxLength: r, actualLength: e, ...t?.params }
10
- } : null;
6
+ const r = n.length;
7
+ return typeof r != "number" ? null : r > t ? l("maxLength", e, { maxLength: t, actualLength: r }) : null;
11
8
  };
12
9
  }
13
10
  export {
14
- l as maxLength
11
+ u as maxLength
15
12
  };
@@ -1,10 +1,7 @@
1
- function e(n, a) {
2
- return (r) => r == null ? null : r > n ? {
3
- code: "max",
4
- message: a?.message ?? "invalid",
5
- params: { max: n, actual: r, ...a?.params }
6
- } : null;
1
+ import { v as i } from "../validation-error-B-U3RsV0.js";
2
+ function u(n, t) {
3
+ return (r) => r == null ? null : r > n ? i("max", t, { max: n, actual: r }) : null;
7
4
  }
8
5
  export {
9
- e as max
6
+ u as max
10
7
  };
@@ -1,19 +1,16 @@
1
- import { p as s, c as i } from "../date-utils-dTT_x_Be.js";
2
- function u(e, n) {
1
+ import { p as o, c as a } from "../date-utils-dTT_x_Be.js";
2
+ import { v as l } from "../validation-error-B-U3RsV0.js";
3
+ function s(n, i) {
3
4
  return (r) => {
4
5
  if (r == null || r === "")
5
6
  return null;
6
- const a = s(r);
7
- if (a === null)
7
+ const t = o(r);
8
+ if (t === null)
8
9
  return null;
9
- const t = i(a);
10
- return t < e ? {
11
- code: "date_min_age",
12
- message: n?.message ?? "invalid",
13
- params: { minAge: e, currentAge: t, ...n?.params }
14
- } : null;
10
+ const e = a(t);
11
+ return e < n ? l("date_min_age", i, { minAge: n, currentAge: e }) : null;
15
12
  };
16
13
  }
17
14
  export {
18
- u as minAge
15
+ s as minAge
19
16
  };
@@ -1,19 +1,16 @@
1
- import { p as l, n as t } from "../date-utils-dTT_x_Be.js";
2
- function o(r, e) {
1
+ import { p as l, n as i } from "../date-utils-dTT_x_Be.js";
2
+ import { v as m } from "../validation-error-B-U3RsV0.js";
3
+ function d(r, o) {
3
4
  return (n) => {
4
5
  if (n == null || n === "")
5
6
  return null;
6
- const a = l(n);
7
- if (a === null)
7
+ const t = l(n);
8
+ if (t === null)
8
9
  return null;
9
- const i = t(a), s = t(r);
10
- return i < s ? {
11
- code: "date_min",
12
- message: e?.message ?? "invalid",
13
- params: { minDate: r, ...e?.params }
14
- } : null;
10
+ const e = i(t), a = i(r);
11
+ return e < a ? m("date_min", o, { minDate: r }) : null;
15
12
  };
16
13
  }
17
14
  export {
18
- o as minDate
15
+ d as minDate
19
16
  };
@@ -1,15 +1,12 @@
1
- function l(r, t) {
1
+ import { v as i } from "../validation-error-B-U3RsV0.js";
2
+ function o(t, e) {
2
3
  return (n) => {
3
4
  if (n == null || n === "")
4
5
  return null;
5
- const e = n.length;
6
- return typeof e != "number" ? null : e < r ? {
7
- code: "minLength",
8
- message: t?.message ?? "invalid",
9
- params: { minLength: r, actualLength: e, ...t?.params }
10
- } : null;
6
+ const r = n.length;
7
+ return typeof r != "number" ? null : r < t ? i("minLength", e, { minLength: t, actualLength: r }) : null;
11
8
  };
12
9
  }
13
10
  export {
14
- l as minLength
11
+ o as minLength
15
12
  };
@@ -1,10 +1,7 @@
1
- function e(r, i) {
2
- return (n) => n == null ? null : n < r ? {
3
- code: "min",
4
- message: i?.message ?? "invalid",
5
- params: { min: r, actual: n, ...i?.params }
6
- } : null;
1
+ import { v as t } from "../validation-error-B-U3RsV0.js";
2
+ function u(n, i) {
3
+ return (r) => r == null ? null : r < n ? t("min", i, { min: n, actual: r }) : null;
7
4
  }
8
5
  export {
9
- e as min
6
+ u as min
10
7
  };
@@ -1,14 +1,11 @@
1
- function u(e, n) {
1
+ import { v as i } from "../validation-error-B-U3RsV0.js";
2
+ function o(n, l) {
2
3
  return (t) => {
3
4
  if (t == null || typeof t != "number" || isNaN(t)) return null;
4
- const l = Math.abs(t % e);
5
- return l <= 1e-9 || Math.abs(l - Math.abs(e)) <= 1e-9 ? null : {
6
- code: "multipleOf",
7
- message: n?.message ?? "invalid",
8
- params: { multipleOf: e, ...n?.params }
9
- };
5
+ const r = Math.abs(t % n);
6
+ return r <= 1e-9 || Math.abs(r - Math.abs(n)) <= 1e-9 ? null : i("multipleOf", l, { multipleOf: n });
10
7
  };
11
8
  }
12
9
  export {
13
- u as multipleOf
10
+ o as multipleOf
14
11
  };
@@ -1,10 +1,7 @@
1
- function e(r) {
2
- return (n) => n == null || typeof n != "number" || isNaN(n) ? null : n < 0 ? {
3
- code: "nonNegative",
4
- message: r?.message ?? "invalid",
5
- params: r?.params
6
- } : null;
1
+ import { v as t } from "../validation-error-B-U3RsV0.js";
2
+ function o(r) {
3
+ return (n) => n == null || typeof n != "number" || isNaN(n) ? null : n < 0 ? t("nonNegative", r) : null;
7
4
  }
8
5
  export {
9
- e as nonNegative
6
+ o as nonNegative
10
7
  };
@@ -1,10 +1,7 @@
1
- function e(r) {
2
- return (n) => n == null || typeof n != "number" || isNaN(n) ? null : n === 0 ? {
3
- code: "nonZero",
4
- message: r?.message ?? "invalid",
5
- params: r?.params
6
- } : null;
1
+ import { v as o } from "../validation-error-B-U3RsV0.js";
2
+ function i(n) {
3
+ return (r) => r == null || typeof r != "number" || isNaN(r) ? null : r === 0 ? o("nonZero", n) : null;
7
4
  }
8
5
  export {
9
- e as nonZero
6
+ i as nonZero
10
7
  };
@@ -1,19 +1,16 @@
1
- import { p as s, n as l, g as o } from "../date-utils-dTT_x_Be.js";
2
- function i(a) {
1
+ import { p as e, n as i, g as l } from "../date-utils-dTT_x_Be.js";
2
+ import { v as u } from "../validation-error-B-U3RsV0.js";
3
+ function f(n) {
3
4
  return (r) => {
4
5
  if (r == null || r === "")
5
6
  return null;
6
- const e = s(r);
7
- if (e === null)
7
+ const t = e(r);
8
+ if (t === null)
8
9
  return null;
9
- const n = l(e), t = o();
10
- return n > t ? {
11
- code: "date_future",
12
- message: a?.message ?? "invalid",
13
- params: a?.params
14
- } : null;
10
+ const o = i(t), a = l();
11
+ return o > a ? u("date_future", n) : null;
15
12
  };
16
13
  }
17
14
  export {
18
- i as pastDate
15
+ f as pastDate
19
16
  };
@@ -1,11 +1,8 @@
1
- function s(e, r) {
2
- const t = new RegExp(e.source, e.flags);
3
- return (n) => n ? (t.lastIndex = 0, t.test(n) ? null : {
4
- code: "pattern",
5
- message: r?.message ?? "",
6
- params: { pattern: e.source, ...r?.params }
7
- }) : null;
1
+ import { v as o } from "../validation-error-B-U3RsV0.js";
2
+ function a(r, e) {
3
+ const t = new RegExp(r.source, r.flags);
4
+ return (n) => n ? (t.lastIndex = 0, t.test(n) ? null : o("pattern", e, { pattern: r.source })) : null;
8
5
  }
9
6
  export {
10
- s as pattern
7
+ a as pattern
11
8
  };
@@ -1,17 +1,14 @@
1
- const t = {
1
+ import { v as o } from "../validation-error-B-U3RsV0.js";
2
+ const e = {
2
3
  international: /^\+?[1-9]\d{1,14}$/,
3
4
  ru: /^(\+7|7|8)?[\s-]?\(?[489][0-9]{2}\)?[\s-]?[0-9]{3}[\s-]?[0-9]{2}[\s-]?[0-9]{2}$/,
4
5
  us: /^(\+?1)?[\s-]?\(?[2-9]\d{2}\)?[\s-]?\d{3}[\s-]?\d{4}$/,
5
6
  any: /^\+?\(?[0-9]{1,4}\)?[-\s.]?\(?[0-9]{1,4}\)?[-\s.]?[0-9]{1,9}$/
6
7
  };
7
- function a(s) {
8
- const n = s?.format ?? "any", e = t[n];
9
- return (r) => r ? e.test(r) ? null : {
10
- code: "phone",
11
- message: s?.message ?? "invalid",
12
- params: { format: n, ...s?.params }
13
- } : null;
8
+ function u(r) {
9
+ const n = r?.format ?? "any", s = e[n];
10
+ return (t) => t ? s.test(t) ? null : o("phone", r, { format: n }) : null;
14
11
  }
15
12
  export {
16
- a as phone
13
+ u as phone
17
14
  };
@@ -1,10 +1,7 @@
1
- function n(e) {
2
- return (r) => r == null || r === "" || Array.isArray(r) && r.length === 0 || typeof r == "boolean" && r !== !0 ? {
3
- code: "required",
4
- message: e?.message ?? "",
5
- params: e?.params
6
- } : null;
1
+ import { v as i } from "../validation-error-B-U3RsV0.js";
2
+ function e(t) {
3
+ return (r) => r == null || r === "" || Array.isArray(r) && r.length === 0 || typeof r == "boolean" && r !== !0 ? i("required", t) : null;
7
4
  }
8
5
  export {
9
- n as required
6
+ e as required
10
7
  };
@@ -1,22 +1,17 @@
1
- const a = /^(https?:\/\/)?([\da-z.-]+)\.([a-z.]{2,6})([/\w .-]*)*\/?$/i, t = /^https?:\/\/([\da-z.-]+)\.([a-z.]{2,6})([/\w .-]*)*\/?$/i;
2
- function d(e) {
1
+ import { v as t } from "../validation-error-B-U3RsV0.js";
2
+ const a = /^(https?:\/\/)?([\da-z.-]+)\.([a-z.]{2,6})([/\w .-]*)*\/?$/i, c = /^https?:\/\/([\da-z.-]+)\.([a-z.]{2,6})([/\w .-]*)*\/?$/i;
3
+ function n(o) {
3
4
  return (r) => {
4
5
  if (!r)
5
6
  return null;
6
7
  const l = r;
7
- return (e?.requireProtocol ? t : a).test(l) ? e?.allowedProtocols && e.allowedProtocols.length > 0 && !e.allowedProtocols.some(
8
- (o) => l.toLowerCase().startsWith(`${o}://`)
9
- ) ? {
10
- code: "url_protocol",
11
- message: e?.message ?? "invalid",
12
- params: { allowedProtocols: e.allowedProtocols, ...e?.params }
13
- } : null : {
14
- code: "url",
15
- message: e?.message ?? "invalid",
16
- params: e?.params
17
- };
8
+ return (o?.requireProtocol ? c : a).test(l) ? o?.allowedProtocols && o.allowedProtocols.length > 0 && !o.allowedProtocols.some(
9
+ (e) => l.toLowerCase().startsWith(`${e}://`)
10
+ ) ? t("url_protocol", o, {
11
+ allowedProtocols: o.allowedProtocols
12
+ }) : null : t("url", o);
18
13
  };
19
14
  }
20
15
  export {
21
- d as url
16
+ n as url
22
17
  };
@@ -1,56 +1,52 @@
1
- import { required as z } from "./validators/required.js";
2
- import { min as y } from "./validators/min.js";
3
- import { max as b } from "./validators/max.js";
4
- import { minLength as L } from "./validators/min-length.js";
5
- import { maxLength as D } from "./validators/max-length.js";
6
- import { email as T } from "./validators/email.js";
7
- import { pattern as w } from "./validators/pattern.js";
8
- import { url as k } from "./validators/url.js";
9
- import { phone as B } from "./validators/phone.js";
10
- import { isNumber as Z } from "./validators/is-number.js";
11
- import { integer as G } from "./validators/integer.js";
12
- import { multipleOf as I } from "./validators/multiple-of.js";
13
- import { nonNegative as K } from "./validators/non-negative.js";
14
- import { nonZero as P } from "./validators/non-zero.js";
15
- import { isDate as R } from "./validators/is-date.js";
16
- import { minDate as V } from "./validators/min-date.js";
17
- import { maxDate as Y } from "./validators/max-date.js";
18
- import { pastDate as $ } from "./validators/past-date.js";
19
- import { futureDate as ee } from "./validators/future-date.js";
20
- import { minAge as ne } from "./validators/min-age.js";
21
- import { maxAge as ie } from "./validators/max-age.js";
1
+ import { required as d } from "./validators/required.js";
2
+ import { min as b } from "./validators/min.js";
3
+ import { max as L } from "./validators/max.js";
4
+ import { minLength as D } from "./validators/min-length.js";
5
+ import { maxLength as T } from "./validators/max-length.js";
6
+ import { email as w } from "./validators/email.js";
7
+ import { pattern as k } from "./validators/pattern.js";
8
+ import { url as B } from "./validators/url.js";
9
+ import { phone as O } from "./validators/phone.js";
10
+ import { isNumber as G } from "./validators/is-number.js";
11
+ import { integer as I } from "./validators/integer.js";
12
+ import { multipleOf as K } from "./validators/multiple-of.js";
13
+ import { nonNegative as P } from "./validators/non-negative.js";
14
+ import { nonZero as R } from "./validators/non-zero.js";
15
+ import { isDate as V } from "./validators/is-date.js";
16
+ import { minDate as Y } from "./validators/min-date.js";
17
+ import { maxDate as $ } from "./validators/max-date.js";
18
+ import { pastDate as ee } from "./validators/past-date.js";
19
+ import { futureDate as ne } from "./validators/future-date.js";
20
+ import { minAge as ie } from "./validators/min-age.js";
21
+ import { maxAge as le } from "./validators/max-age.js";
22
+ import { v as l } from "./validation-error-B-U3RsV0.js";
22
23
  function s(r) {
23
24
  if (typeof r != "object" || r === null) return !1;
24
25
  const t = r;
25
26
  return !(typeof t.name != "string" || t.size !== void 0 && typeof t.size != "number" || t.type !== void 0 && typeof t.type != "string");
26
27
  }
27
- function o(r) {
28
+ function f(r) {
28
29
  return Array.isArray(r) ? r.filter(s) : s(r) ? [r] : null;
29
30
  }
30
- function u(r, t) {
31
- const e = t.split(",").map((l) => l.trim().toLowerCase()).filter(Boolean);
31
+ function m(r, t) {
32
+ const e = t.split(",").map((o) => o.trim().toLowerCase()).filter(Boolean);
32
33
  if (e.length === 0) return !0;
33
34
  const n = r.name.toLowerCase(), i = (r.type ?? "").toLowerCase();
34
- return e.some((l) => l.startsWith(".") ? n.endsWith(l) : l.endsWith("/*") ? i.startsWith(l.slice(0, -1)) : l.includes("/") ? i === l : !1);
35
+ return e.some((o) => o.startsWith(".") ? n.endsWith(o) : o.endsWith("/*") ? i.startsWith(o.slice(0, -1)) : o.includes("/") ? i === o : !1);
35
36
  }
36
- function m(r, t) {
37
+ function c(r, t) {
37
38
  return (e) => {
38
39
  if (e == null || e === "")
39
40
  return null;
40
- const n = o(e);
41
+ const n = f(e);
41
42
  if (n === null || n.length === 0) return null;
42
43
  for (const i of n)
43
44
  if (typeof i.size == "number" && i.size > r)
44
- return {
45
- code: "maxFileSize",
46
- message: t?.message ?? "invalid",
47
- params: {
48
- maxFileSize: r,
49
- fileName: i.name,
50
- actualSize: i.size,
51
- ...t?.params
52
- }
53
- };
45
+ return l("maxFileSize", t, {
46
+ maxFileSize: r,
47
+ fileName: i.name,
48
+ actualSize: i.size
49
+ });
54
50
  return null;
55
51
  };
56
52
  }
@@ -58,109 +54,91 @@ function a(r, t) {
58
54
  return (e) => {
59
55
  if (e == null || e === "")
60
56
  return null;
61
- const n = o(e);
57
+ const n = f(e);
62
58
  if (n === null || n.length === 0) return null;
63
59
  for (const i of n)
64
60
  if (typeof i.size == "number" && i.size < r)
65
- return {
66
- code: "minFileSize",
67
- message: t?.message ?? "invalid",
68
- params: {
69
- minFileSize: r,
70
- fileName: i.name,
71
- actualSize: i.size,
72
- ...t?.params
73
- }
74
- };
61
+ return l("minFileSize", t, {
62
+ minFileSize: r,
63
+ fileName: i.name,
64
+ actualSize: i.size
65
+ });
75
66
  return null;
76
67
  };
77
68
  }
78
- function p(r, t) {
69
+ function x(r, t) {
79
70
  return (e) => {
80
71
  if (e == null || e === "")
81
72
  return null;
82
- const n = o(e);
73
+ const n = f(e);
83
74
  if (n === null || n.length === 0) return null;
84
75
  for (const i of n)
85
- if (!u(i, r))
86
- return {
87
- code: "fileType",
88
- message: t?.message ?? "invalid",
89
- params: { accept: r, fileName: i.name, ...t?.params }
90
- };
76
+ if (!m(i, r))
77
+ return l("fileType", t, { accept: r, fileName: i.name });
91
78
  return null;
92
79
  };
93
80
  }
94
- function c(r, t) {
81
+ function g(r, t) {
95
82
  return (e) => {
96
83
  if (e == null || e === "")
97
84
  return null;
98
- const n = o(e);
99
- return n === null || n.length === 0 ? null : n.length > r ? {
100
- code: "maxFiles",
101
- message: t?.message ?? "invalid",
102
- params: { maxFiles: r, actualCount: n.length, ...t?.params }
103
- } : null;
85
+ const n = f(e);
86
+ return n === null || n.length === 0 ? null : n.length > r ? l("maxFiles", t, { maxFiles: r, actualCount: n.length }) : null;
104
87
  };
105
88
  }
106
- function x(r, t) {
89
+ function h(r, t) {
107
90
  return (e) => {
108
91
  if (e == null || e === "")
109
92
  return null;
110
- const n = o(e);
111
- return n === null || n.length === 0 ? null : n.length < r ? {
112
- code: "minFiles",
113
- message: t?.message ?? "invalid",
114
- params: { minFiles: r, actualCount: n.length, ...t?.params }
115
- } : null;
93
+ const n = f(e);
94
+ return n === null || n.length === 0 ? null : n.length < r ? l("minFiles", t, { minFiles: r, actualCount: n.length }) : null;
116
95
  };
117
96
  }
118
- function g(r, t) {
97
+ function z(r, t) {
119
98
  return (e) => {
120
99
  if (e == null || e === "")
121
100
  return null;
122
- const n = o(e);
101
+ const n = f(e);
123
102
  if (n === null || n.length === 0) return null;
124
103
  const i = n.reduce(
125
- (l, f) => l + (typeof f.size == "number" ? f.size : 0),
104
+ (o, u) => o + (typeof u.size == "number" ? u.size : 0),
126
105
  0
127
106
  );
128
- return i > r ? {
129
- code: "maxTotalFileSize",
130
- message: t?.message ?? "invalid",
131
- params: { maxTotalFileSize: r, actualTotal: i, ...t?.params }
132
- } : null;
107
+ return i > r ? l("maxTotalFileSize", t, {
108
+ maxTotalFileSize: r,
109
+ actualTotal: i
110
+ }) : null;
133
111
  };
134
112
  }
135
113
  export {
136
- T as email,
137
- p as fileType,
138
- ee as futureDate,
139
- G as integer,
140
- R as isDate,
114
+ w as email,
115
+ x as fileType,
116
+ ne as futureDate,
117
+ I as integer,
118
+ V as isDate,
141
119
  s as isFileLike,
142
- Z as isNumber,
143
- u as matchesFileAccept,
144
- b as max,
145
- ie as maxAge,
146
- Y as maxDate,
147
- m as maxFileSize,
148
- c as maxFiles,
149
- D as maxLength,
150
- g as maxTotalFileSize,
151
- y as min,
152
- ne as minAge,
153
- V as minDate,
120
+ G as isNumber,
121
+ m as matchesFileAccept,
122
+ L as max,
123
+ le as maxAge,
124
+ $ as maxDate,
125
+ c as maxFileSize,
126
+ g as maxFiles,
127
+ T as maxLength,
128
+ z as maxTotalFileSize,
129
+ b as min,
130
+ ie as minAge,
131
+ Y as minDate,
154
132
  a as minFileSize,
155
- x as minFiles,
156
- L as minLength,
157
- I as multipleOf,
158
- K as nonNegative,
159
- P as nonZero,
160
- $ as pastDate,
161
- w as pattern,
162
- B as phone,
163
- z as required,
164
- o as toFileArray,
165
- k as url
133
+ h as minFiles,
134
+ D as minLength,
135
+ K as multipleOf,
136
+ P as nonNegative,
137
+ R as nonZero,
138
+ ee as pastDate,
139
+ k as pattern,
140
+ O as phone,
141
+ d as required,
142
+ f as toFileArray,
143
+ B as url
166
144
  };
@@ -57,6 +57,12 @@ minAge(years: number, options?: { message?: string })
57
57
  maxAge(years: number, options?: { message?: string })
58
58
  ```
59
59
 
60
+ Кроме `message`, каждое правило принимает `messageKey` (ключ словаря приложения) и `params`.
61
+ Без `message` правило кладёт в ошибку пустую строку, а текст при отображении берётся из словаря
62
+ локали по коду (`validation.<code>`): «Обязательное поле» под русской локалью, английская фраза без
63
+ провайдера. Явное `message` важнее словаря, но языком не переключается; для локализуемого текста —
64
+ `messageKey`. Подробно — [34-i18n.md](./34-i18n.md).
65
+
60
66
  Использование: layout-дерево `createForm` привязывает поля к сигналам, правила живут отдельной
61
67
  `ValidationSchema` и гоняются раннером `validateModel` по требованию.
62
68