triafly-ui-kit 1.0.22 → 1.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +93 -93
- package/package.json +106 -106
- package/dist/_commonjsHelpers-C6fGbg64.js +0 -6
- package/dist/assets/Accordeon.css +0 -1
- package/dist/assets/Alert.css +0 -1
- package/dist/assets/Avatar.css +0 -1
- package/dist/assets/Badge.css +0 -1
- package/dist/assets/Button.css +0 -1
- package/dist/assets/ButtonsArray.css +0 -1
- package/dist/assets/Checkbox.css +0 -1
- package/dist/assets/CliTextareaInput.css +0 -1
- package/dist/assets/CustomLink.css +0 -1
- package/dist/assets/DropdownInput.css +0 -1
- package/dist/assets/DropdownMenu.css +0 -1
- package/dist/assets/FileUpload.css +0 -1
- package/dist/assets/FormRoot.css +0 -1
- package/dist/assets/Loader.css +0 -1
- package/dist/assets/ModalWindow.css +0 -1
- package/dist/assets/Pagination.css +0 -1
- package/dist/assets/Radio.css +0 -1
- package/dist/assets/SearchInput.css +0 -1
- package/dist/assets/Skeleton.css +0 -1
- package/dist/assets/Switch.css +0 -1
- package/dist/assets/Table.css +0 -1
- package/dist/assets/Tabs.css +0 -1
- package/dist/assets/TextInput.css +0 -1
- package/dist/assets/TextareaInput.css +0 -1
- package/dist/assets/ToastContext.css +0 -1
- package/dist/assets/Tooltip.css +0 -1
- package/dist/assets/Tooltip2.css +0 -1
- package/dist/assets/fonts/FiraCode-Regular.ttf +0 -0
- package/dist/assets/fonts/Manrope-Bold.ttf +0 -0
- package/dist/assets/fonts/Manrope-Regular.ttf +0 -0
- package/dist/assets/fonts/Manrope-SemiBold.ttf +0 -0
- package/dist/assets/fonts/RobotoSlab-SemiBold.ttf +0 -0
- package/dist/components/Ui/Accordeon/Accordeon.js +0 -33
- package/dist/components/Ui/Accordeon/Accordeon.stories.js +0 -72
- package/dist/components/Ui/Accordeon/index.js +0 -4
- package/dist/components/Ui/Alert/Alert.js +0 -14
- package/dist/components/Ui/Alert/index.js +0 -4
- package/dist/components/Ui/Avatar/Avatar.js +0 -10
- package/dist/components/Ui/Avatar/index.js +0 -4
- package/dist/components/Ui/Badge/Badge.js +0 -43
- package/dist/components/Ui/Badge/index.js +0 -4
- package/dist/components/Ui/Button/Button.js +0 -49
- package/dist/components/Ui/Button/index.js +0 -4
- package/dist/components/Ui/ButtonsArray/ButtonsArray.js +0 -28
- package/dist/components/Ui/ButtonsArray/ButtonsArray.stories.js +0 -78
- package/dist/components/Ui/ButtonsArray/index.js +0 -4
- package/dist/components/Ui/Checkbox/Checkbox.js +0 -39
- package/dist/components/Ui/Checkbox/Checkbox.stories.js +0 -120
- package/dist/components/Ui/Checkbox/index.js +0 -4
- package/dist/components/Ui/CliTextareaInput/CliTextareaInput.js +0 -121
- package/dist/components/Ui/CliTextareaInput/index.js +0 -23
- package/dist/components/Ui/CliTextareaInput/utils/escapeHtml/escapeHtml.js +0 -4
- package/dist/components/Ui/CliTextareaInput/utils/fixJson/fixJson.js +0 -12
- package/dist/components/Ui/CliTextareaInput/utils/highlightSyntax/highlightSyntax.js +0 -20
- package/dist/components/Ui/CliTextareaInput/utils/highlightSyntax/index.js +0 -4
- package/dist/components/Ui/CliTextareaInput/utils/hooks/index.js +0 -17
- package/dist/components/Ui/CliTextareaInput/utils/hooks/useFixFormat/index.js +0 -4
- package/dist/components/Ui/CliTextareaInput/utils/hooks/useFixFormat/useFixFormat.js +0 -29
- package/dist/components/Ui/CliTextareaInput/utils/hooks/useHistoryNavigation/index.js +0 -4
- package/dist/components/Ui/CliTextareaInput/utils/hooks/useHistoryNavigation/useHistoryNavigation.js +0 -34
- package/dist/components/Ui/CliTextareaInput/utils/hooks/useKeyHandlers/index.js +0 -4
- package/dist/components/Ui/CliTextareaInput/utils/hooks/useKeyHandlers/useKeyHandlers.js +0 -45
- package/dist/components/Ui/CliTextareaInput/utils/hooks/useLineNumbers/index.js +0 -5
- package/dist/components/Ui/CliTextareaInput/utils/hooks/useLineNumbers/useLineNumbers.js +0 -17
- package/dist/components/Ui/CliTextareaInput/utils/hooks/useScrollSync/index.js +0 -4
- package/dist/components/Ui/CliTextareaInput/utils/hooks/useScrollSync/useScrollSync.js +0 -13
- package/dist/components/Ui/CliTextareaInput/utils/hooks/useTextActions/index.js +0 -4
- package/dist/components/Ui/CliTextareaInput/utils/hooks/useTextActions/useTextActions.js +0 -37
- package/dist/components/Ui/CliTextareaInput/utils/hooks/useTextCoursore/index.js +0 -4
- package/dist/components/Ui/CliTextareaInput/utils/hooks/useTextCoursore/useTextCoursore.js +0 -14
- package/dist/components/Ui/CliTextareaInput/utils/index.js +0 -21
- package/dist/components/Ui/CliTextareaInput/utils/processJson/index.js +0 -4
- package/dist/components/Ui/CliTextareaInput/utils/processJson/processJson.js +0 -11
- package/dist/components/Ui/CliTextareaInput/utils/processXml/processXml.js +0 -8
- package/dist/components/Ui/CliTextareaInput/utils/processYml/processYml.js +0 -27
- package/dist/components/Ui/CliTextareaInput/utils/types.js +0 -1
- package/dist/components/Ui/CustomLink/CustomLink.js +0 -49
- package/dist/components/Ui/CustomLink/index.js +0 -4
- package/dist/components/Ui/DropdownInput/DropdownInput.js +0 -91
- package/dist/components/Ui/DropdownInput/DropdownInput.stories.js +0 -77
- package/dist/components/Ui/DropdownInput/index.js +0 -4
- package/dist/components/Ui/DropdownMenu/DropdownMenu.js +0 -83
- package/dist/components/Ui/DropdownMenu/DropdownMenu.stories.js +0 -50
- package/dist/components/Ui/DropdownMenu/index.js +0 -4
- package/dist/components/Ui/FileUpload/FileUpload.js +0 -615
- package/dist/components/Ui/FileUpload/fn.js +0 -10
- package/dist/components/Ui/FileUpload/index.js +0 -4
- package/dist/components/Ui/FileUpload/types.js +0 -1
- package/dist/components/Ui/Form/FormContext/FormContext.js +0 -5
- package/dist/components/Ui/Form/FormItem/FormItem.js +0 -107
- package/dist/components/Ui/Form/FormItem/fn.js +0 -25
- package/dist/components/Ui/Form/FormItem/types.js +0 -1
- package/dist/components/Ui/Form/FormRoot/FormRoot.js +0 -25
- package/dist/components/Ui/Form/FormRoot/index.js +0 -4
- package/dist/components/Ui/Form/FormRoot/types.js +0 -1
- package/dist/components/Ui/Form/index.js +0 -6
- package/dist/components/Ui/Form/useForm/index.js +0 -4
- package/dist/components/Ui/Form/useForm/useForm.js +0 -111
- package/dist/components/Ui/Form/utils/fn.js +0 -31
- package/dist/components/Ui/Form/utils/types.js +0 -1
- package/dist/components/Ui/Icons/Icons.js +0 -577
- package/dist/components/Ui/Icons/index.js +0 -97
- package/dist/components/Ui/Icons/utils/CreateIcon.js +0 -23
- package/dist/components/Ui/Loader/Loader.js +0 -6
- package/dist/components/Ui/Loader/index.js +0 -4
- package/dist/components/Ui/ModalWindow/ModalWindow.js +0 -50
- package/dist/components/Ui/ModalWindow/index.js +0 -4
- package/dist/components/Ui/Pagination/Pagination.js +0 -294
- package/dist/components/Ui/Pagination/index.js +0 -4
- package/dist/components/Ui/Radio/Radio.js +0 -30
- package/dist/components/Ui/Radio/Radio.stories.js +0 -42
- package/dist/components/Ui/Radio/index.js +0 -4
- package/dist/components/Ui/SearchInput/SearchData.js +0 -30
- package/dist/components/Ui/SearchInput/SearchInput.js +0 -109
- package/dist/components/Ui/Skeleton/Skeleton.js +0 -28
- package/dist/components/Ui/Skeleton/index.js +0 -4
- package/dist/components/Ui/Switch/Switch.js +0 -25
- package/dist/components/Ui/Switch/index.js +0 -4
- package/dist/components/Ui/Table/MemoizedRow/MemoizedRow.js +0 -79
- package/dist/components/Ui/Table/Table.js +0 -160
- package/dist/components/Ui/Table/TableTypes.js +0 -1
- package/dist/components/Ui/Table/index.js +0 -4
- package/dist/components/Ui/Tabs/Tabs.js +0 -24
- package/dist/components/Ui/Tabs/Tabs.stories.js +0 -67
- package/dist/components/Ui/Tabs/index.js +0 -4
- package/dist/components/Ui/TextInput/TextInput.js +0 -85
- package/dist/components/Ui/TextInput/TextInput.stories.js +0 -225
- package/dist/components/Ui/TextInput/index.js +0 -4
- package/dist/components/Ui/TextareaInput/TextareaInput.js +0 -68
- package/dist/components/Ui/TextareaInput/TextareaInput.stories.js +0 -19
- package/dist/components/Ui/TextareaInput/index.js +0 -4
- package/dist/components/Ui/Tooltip/Tooltip.js +0 -92
- package/dist/components/Ui/Tooltip/Tooltip.stories.js +0 -92
- package/dist/components/Ui/Tooltip/index.js +0 -4
- package/dist/context/ToastContext/ToastContext.js +0 -40
- package/dist/context/ToastContext/index.js +0 -5
- package/dist/context/TriaflyContext/TriaflyContext.types.js +0 -1
- package/dist/context/TriaflyContext/TriaflyProvider.js +0 -27
- package/dist/context/TriaflyContext/hooks/index.js +0 -8
- package/dist/context/TriaflyContext/hooks/useBreakpointValue/index.js +0 -4
- package/dist/context/TriaflyContext/hooks/useBreakpointValue/useBreakpointValue.js +0 -11
- package/dist/context/TriaflyContext/hooks/useModal/index.js +0 -4
- package/dist/context/TriaflyContext/hooks/useModal/useModal.js +0 -16
- package/dist/context/TriaflyContext/hooks/useTheme/index.js +0 -4
- package/dist/context/TriaflyContext/hooks/useTheme/useTheme.js +0 -17
- package/dist/context/TriaflyContext/index.js +0 -12
- package/dist/index-2QXL0WYc.js +0 -45
- package/dist/main.d.ts +0 -1229
- package/dist/main.js +0 -162
- package/dist/vite-env.d.js +0 -1
@@ -1,107 +0,0 @@
|
|
1
|
-
import { jsx as k } from "react/jsx-runtime";
|
2
|
-
import d, { useContext as A, useMemo as C, useEffect as E, useCallback as I } from "react";
|
3
|
-
import { FormContext as f } from "../FormContext/FormContext.js";
|
4
|
-
import { validateRule as D } from "../utils/fn.js";
|
5
|
-
import { getChildType as R } from "./fn.js";
|
6
|
-
const N = d.memo(
|
7
|
-
({
|
8
|
-
name: t,
|
9
|
-
children: r,
|
10
|
-
rules: c,
|
11
|
-
label: h,
|
12
|
-
isDisabled: p,
|
13
|
-
style: b,
|
14
|
-
classNameItem: m
|
15
|
-
}) => {
|
16
|
-
const e = A(f), [, v] = d.useReducer((a) => a + 1, 0), u = p || (e == null ? void 0 : e.disabled), s = C(() => Array.isArray(t) ? t : [t], [t]);
|
17
|
-
E(() => {
|
18
|
-
if (e)
|
19
|
-
return e.setFieldRules(s, c || []), e.subscribe(s, v);
|
20
|
-
}, [s, c, e]);
|
21
|
-
const n = e == null ? void 0 : e.getFieldValue(s), l = e == null ? void 0 : e.getFieldError(s), o = I(
|
22
|
-
(a) => {
|
23
|
-
if (!u && (e == null || e.setFieldValue(s, a), c)) {
|
24
|
-
const i = c.map((F) => D(F, a)).filter(Boolean);
|
25
|
-
e == null || e.setFieldError(s, i);
|
26
|
-
}
|
27
|
-
},
|
28
|
-
[s, c, u]
|
29
|
-
), g = R(r), y = C(() => {
|
30
|
-
const a = {
|
31
|
-
name: s,
|
32
|
-
label: h,
|
33
|
-
isDisabled: u,
|
34
|
-
hasError: !!(l != null && l.length),
|
35
|
-
errorMessage: l == null ? void 0 : l[0]
|
36
|
-
};
|
37
|
-
switch (g) {
|
38
|
-
case "TextareaInput":
|
39
|
-
return {
|
40
|
-
...a,
|
41
|
-
value: n || "",
|
42
|
-
onChange: o
|
43
|
-
};
|
44
|
-
case "DropdownInput":
|
45
|
-
return {
|
46
|
-
...a,
|
47
|
-
value: n,
|
48
|
-
onChange: o
|
49
|
-
};
|
50
|
-
case "TextInput":
|
51
|
-
return {
|
52
|
-
...a,
|
53
|
-
value: n || "",
|
54
|
-
onChange: (i) => o(i.target.value)
|
55
|
-
};
|
56
|
-
case "Checkbox":
|
57
|
-
return {
|
58
|
-
...a,
|
59
|
-
isChecked: !!n,
|
60
|
-
onChange: (i) => o(i.target.checked)
|
61
|
-
};
|
62
|
-
case "Radio":
|
63
|
-
return {
|
64
|
-
...a,
|
65
|
-
radioId: `radio-${Array.isArray(t) ? t.join("-") : t}`,
|
66
|
-
value: r.props.value,
|
67
|
-
isChecked: n === r.props.value,
|
68
|
-
onChange: () => o(r.props.value)
|
69
|
-
};
|
70
|
-
case "SearchInput":
|
71
|
-
return {
|
72
|
-
...a,
|
73
|
-
value: n,
|
74
|
-
onChange: o
|
75
|
-
};
|
76
|
-
case "Switch":
|
77
|
-
return {
|
78
|
-
...a,
|
79
|
-
isChecked: !!n,
|
80
|
-
onChange: (i) => o(i.target.checked)
|
81
|
-
};
|
82
|
-
case "FileUpload":
|
83
|
-
return {
|
84
|
-
...a,
|
85
|
-
value: Array.isArray(n) ? n : [],
|
86
|
-
onChange: (i) => o(i)
|
87
|
-
};
|
88
|
-
default:
|
89
|
-
return a;
|
90
|
-
}
|
91
|
-
}, [
|
92
|
-
s,
|
93
|
-
h,
|
94
|
-
l,
|
95
|
-
n,
|
96
|
-
g,
|
97
|
-
o,
|
98
|
-
r.props.value,
|
99
|
-
u
|
100
|
-
]);
|
101
|
-
return /* @__PURE__ */ k("div", { className: m, style: b, children: d.cloneElement(r, y) });
|
102
|
-
},
|
103
|
-
(t, r) => t.name === r.name && t.rules === r.rules && t.label === r.label && t.isDisabled === r.isDisabled
|
104
|
-
);
|
105
|
-
export {
|
106
|
-
N as FormItem
|
107
|
-
};
|
@@ -1,25 +0,0 @@
|
|
1
|
-
const p = (e) => {
|
2
|
-
var n, r, a, f;
|
3
|
-
if (typeof e == "string")
|
4
|
-
return e;
|
5
|
-
if (typeof e == "object" && e !== null) {
|
6
|
-
const t = e;
|
7
|
-
if (t.$$typeof === Symbol.for("react.forward_ref")) {
|
8
|
-
const o = e;
|
9
|
-
return o.displayName || ((n = o.render) == null ? void 0 : n.displayName) || ((r = o.render) == null ? void 0 : r.name) || "ForwardRefComponent";
|
10
|
-
}
|
11
|
-
if (t.$$typeof === Symbol.for("react.memo")) {
|
12
|
-
const o = e;
|
13
|
-
return o.displayName || ((a = o.type) == null ? void 0 : a.displayName) || ((f = o.type) == null ? void 0 : f.name) || "MemoComponent";
|
14
|
-
}
|
15
|
-
}
|
16
|
-
if (typeof e == "function") {
|
17
|
-
const t = e;
|
18
|
-
return t.displayName || t.name || "FunctionComponent";
|
19
|
-
}
|
20
|
-
return "UnknownComponent";
|
21
|
-
}, m = (e) => e.props.name || p(e.type);
|
22
|
-
export {
|
23
|
-
m as getChildType,
|
24
|
-
p as getComponentName
|
25
|
-
};
|
@@ -1 +0,0 @@
|
|
1
|
-
|
@@ -1,25 +0,0 @@
|
|
1
|
-
import { jsx as a } from "react/jsx-runtime";
|
2
|
-
import { useMemo as l } from "react";
|
3
|
-
import { FormContext as f } from "../FormContext/FormContext.js";
|
4
|
-
import { FormItem as i } from "../FormItem/FormItem.js";
|
5
|
-
import { useForm as p } from "../useForm/useForm.js";
|
6
|
-
import '../../../../assets/FormRoot.css';const v = ({ form: m, children: c, onFinish: o, disabled: t = !1 }) => {
|
7
|
-
const n = p()[0], s = l(() => {
|
8
|
-
const r = m || n;
|
9
|
-
return r.disabled = t, r;
|
10
|
-
}, [m, n, t]), u = async (r) => {
|
11
|
-
r.preventDefault();
|
12
|
-
try {
|
13
|
-
if (t) return;
|
14
|
-
const e = await s.validateFields();
|
15
|
-
o == null || o(e);
|
16
|
-
} catch (e) {
|
17
|
-
console.error("Form submission error:", e);
|
18
|
-
}
|
19
|
-
};
|
20
|
-
return /* @__PURE__ */ a(f.Provider, { value: s || null, children: /* @__PURE__ */ a("form", { onSubmit: u, children: c }) });
|
21
|
-
};
|
22
|
-
v.Item = i;
|
23
|
-
export {
|
24
|
-
v as Form
|
25
|
-
};
|
@@ -1 +0,0 @@
|
|
1
|
-
|
@@ -1,111 +0,0 @@
|
|
1
|
-
import { useRef as y, useCallback as g } from "react";
|
2
|
-
import { normalizePath as i, validateRule as b, getFieldKey as f, getByPath as k, getNestedValue as V, setByPath as v } from "../utils/fn.js";
|
3
|
-
class O extends Error {
|
4
|
-
constructor(l) {
|
5
|
-
super("Form validation failed"), this.errorFields = l, this.name = "FormValidationError";
|
6
|
-
}
|
7
|
-
}
|
8
|
-
function N() {
|
9
|
-
const a = y({}), l = y({}), p = y({}), o = y({}), d = g((t) => {
|
10
|
-
const r = i(t), e = /* @__PURE__ */ new Set();
|
11
|
-
e.add(r.join("."));
|
12
|
-
for (let n = 1; n < r.length; n++)
|
13
|
-
e.add(r.slice(0, n).join("."));
|
14
|
-
e.forEach((n) => {
|
15
|
-
var s;
|
16
|
-
(s = o.current[n]) == null || s.forEach((c) => c());
|
17
|
-
});
|
18
|
-
}, []), m = g(
|
19
|
-
async (t, r, e) => {
|
20
|
-
if (!e) return [];
|
21
|
-
const n = (await Promise.all(e.map((c) => b(c, r)))).filter(Boolean), s = f(t);
|
22
|
-
return l.current[s] = n, d(s), n;
|
23
|
-
},
|
24
|
-
[d]
|
25
|
-
), w = g(
|
26
|
-
async (t) => {
|
27
|
-
const r = t || Object.keys(p.current).map((n) => n.includes(".") ? n.split(".") : n), e = {};
|
28
|
-
if (await Promise.all(
|
29
|
-
r.map(async (n) => {
|
30
|
-
const s = i(n), c = f(s), u = p.current[c] || [], F = k(a.current, s), h = await m(s, F, u);
|
31
|
-
h.length && (e[c] = h);
|
32
|
-
})
|
33
|
-
), Object.keys(e).length)
|
34
|
-
throw new O(
|
35
|
-
Object.entries(e).map(([n, s]) => ({
|
36
|
-
name: n,
|
37
|
-
errors: s
|
38
|
-
}))
|
39
|
-
);
|
40
|
-
return { ...a.current };
|
41
|
-
},
|
42
|
-
[m]
|
43
|
-
), E = (t) => Array.isArray(t) ? t : typeof t == "string" && t.includes(".") ? t.split(".") : [t], j = y({
|
44
|
-
resetFields: () => {
|
45
|
-
a.current = {}, l.current = {}, Object.keys(o.current).forEach(d);
|
46
|
-
},
|
47
|
-
setFieldsValue: (t) => {
|
48
|
-
const r = { ...a.current };
|
49
|
-
Object.entries(t).forEach(([e, n]) => {
|
50
|
-
const s = E(e);
|
51
|
-
v(r, s, n);
|
52
|
-
}), a.current = r, Object.keys(t).forEach((e) => {
|
53
|
-
d(Array.isArray(e) ? e.join(".") : e);
|
54
|
-
});
|
55
|
-
},
|
56
|
-
setFieldValue: (t, r) => {
|
57
|
-
const e = i(t), n = JSON.parse(JSON.stringify(a.current));
|
58
|
-
let s = n;
|
59
|
-
for (let c = 0; c < e.length - 1; c++) {
|
60
|
-
const u = e[c];
|
61
|
-
s[u] || (s[u] = {}), s = s[u];
|
62
|
-
}
|
63
|
-
s[e[e.length - 1]] = r, a.current = n, d(e);
|
64
|
-
},
|
65
|
-
getFieldValue: (t) => {
|
66
|
-
const r = i(t);
|
67
|
-
return V(a.current, r);
|
68
|
-
},
|
69
|
-
getFieldsValue: () => ({ ...a.current }),
|
70
|
-
submit: async () => {
|
71
|
-
await j.validateFields();
|
72
|
-
},
|
73
|
-
validateFields: w,
|
74
|
-
getFieldError: (t) => {
|
75
|
-
const r = f(i(t));
|
76
|
-
return l.current[r] || [];
|
77
|
-
},
|
78
|
-
setFieldError: (t, r) => {
|
79
|
-
const e = f(i(t));
|
80
|
-
l.current[e] = r, d(e);
|
81
|
-
},
|
82
|
-
getFieldRules: (t) => {
|
83
|
-
const r = f(i(t));
|
84
|
-
return p.current[r] || [];
|
85
|
-
},
|
86
|
-
setFieldRules: (t, r) => {
|
87
|
-
const e = f(i(t));
|
88
|
-
p.current[e] = r;
|
89
|
-
},
|
90
|
-
subscribe: (t, r) => {
|
91
|
-
const e = i(t), n = e.join(".");
|
92
|
-
if (o.current[n] || (o.current[n] = /* @__PURE__ */ new Set()), o.current[n].add(r), e.length > 1) {
|
93
|
-
const c = e.slice(0, -1).join(".");
|
94
|
-
o.current[c] || (o.current[c] = /* @__PURE__ */ new Set());
|
95
|
-
const u = () => r();
|
96
|
-
return o.current[c].add(u), () => {
|
97
|
-
var F, h;
|
98
|
-
(F = o.current[n]) == null || F.delete(r), (h = o.current[c]) == null || h.delete(u);
|
99
|
-
};
|
100
|
-
}
|
101
|
-
return () => {
|
102
|
-
var s;
|
103
|
-
return (s = o.current[n]) == null ? void 0 : s.delete(r);
|
104
|
-
};
|
105
|
-
}
|
106
|
-
}).current;
|
107
|
-
return [j];
|
108
|
-
}
|
109
|
-
export {
|
110
|
-
N as useForm
|
111
|
-
};
|
@@ -1,31 +0,0 @@
|
|
1
|
-
const f = /^[^\s@]+@[^\s@]+\.[^\s@]+$/, c = (t, s) => {
|
2
|
-
const e = s == null ? "" : String(s);
|
3
|
-
return t.required && e.trim() === "" ? t.message || "Это поле обязательно" : t.pattern && e && !t.pattern.test(e) ? t.message || "Некорректный формат" : t.type === "email" && e && !f.test(e) ? t.message || "Некорректный email" : t.validator ? t.validator(s) : typeof t.min == "number" && e.length < t.min ? t.message || `Минимум ${t.min} символов` : typeof t.max == "number" && e.length > t.max ? t.message || `Максимум ${t.max} символов` : null;
|
4
|
-
}, a = (t) => Array.isArray(t) ? t : [t], g = (t) => Array.isArray(t) ? t.join(".") : t, m = (t, s, e) => {
|
5
|
-
const n = a(s);
|
6
|
-
let r = t;
|
7
|
-
for (let i = 0; i < n.length - 1; i++) {
|
8
|
-
const o = n[i];
|
9
|
-
(!r[o] || typeof r[o] != "object") && (r[o] = {}), r = r[o];
|
10
|
-
}
|
11
|
-
r[n[n.length - 1]] = e;
|
12
|
-
}, p = (t, s) => {
|
13
|
-
const e = a(s);
|
14
|
-
let n = t;
|
15
|
-
for (const r of e) {
|
16
|
-
if (!n || typeof n != "object") return;
|
17
|
-
n = n[r];
|
18
|
-
}
|
19
|
-
return n;
|
20
|
-
}, y = (t, s) => s.reduce((e, n) => {
|
21
|
-
if (e && typeof e == "object" && n in e)
|
22
|
-
return e[n];
|
23
|
-
}, t);
|
24
|
-
export {
|
25
|
-
p as getByPath,
|
26
|
-
g as getFieldKey,
|
27
|
-
y as getNestedValue,
|
28
|
-
a as normalizePath,
|
29
|
-
m as setByPath,
|
30
|
-
c as validateRule
|
31
|
-
};
|
@@ -1 +0,0 @@
|
|
1
|
-
|