vuesp-components 2.0.8 → 2.0.9
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/dist/composables/index.es.js +108 -115
- package/dist/dashboard/index.es.js +32 -38
- package/dist/helpers/index.es.js +46 -56
- package/dist/index.es.js +2281 -2605
- package/dist/plugins/i18n/types.d.ts +1 -1
- package/dist/plugins/i18n/types.d.ts.map +1 -1
- package/dist/plugins/index.es.js +57 -59
- package/dist/useDialog-Biu5-ZSJ.js +396 -0
- package/dist/vuesp-components.css +2 -0
- package/package.json +3 -3
- package/dist/style.css +0 -1
- package/dist/useSwipeDown-E8KeNvRa.js +0 -436
|
@@ -1,116 +1,109 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
resetForm: A,
|
|
108
|
-
validate: O,
|
|
109
|
-
updateSchema: F
|
|
110
|
-
};
|
|
1
|
+
import { n as e, t } from "../useDialog-Biu5-ZSJ.js";
|
|
2
|
+
import { computed as n, reactive as r, ref as i, watch as a } from "vue";
|
|
3
|
+
//#region src/composables/useForms.ts
|
|
4
|
+
function o(e) {
|
|
5
|
+
let { validationSchema: t, initialValues: o = {} } = e, s = typeof t == "function", c = i(s ? t(o) : t), l = (e) => {
|
|
6
|
+
c.value = e;
|
|
7
|
+
let t = Object.keys(e), n = Object.keys(u);
|
|
8
|
+
t.forEach((e) => {
|
|
9
|
+
e in u || (u[e] = o[e] ?? "", d[e] = [], f[e] = !1, p[e] = !1);
|
|
10
|
+
}), n.forEach((e) => {
|
|
11
|
+
t.includes(e) || (delete u[e], delete d[e], delete f[e], delete p[e]);
|
|
12
|
+
}), y();
|
|
13
|
+
}, u = r({}), d = r({}), f = r({}), p = r({}), m = /* @__PURE__ */ new Map(), h = () => {
|
|
14
|
+
Object.keys(c.value).forEach((e) => {
|
|
15
|
+
u[e] = o[e] ?? "", d[e] = [], f[e] = !1, p[e] = !1;
|
|
16
|
+
});
|
|
17
|
+
}, g = () => s ? t(u) : c.value, _ = (e, t) => {
|
|
18
|
+
let n = g()[e] || [], r = [];
|
|
19
|
+
for (let e of n) {
|
|
20
|
+
let n = e(t, u);
|
|
21
|
+
n !== !0 && r.push(n);
|
|
22
|
+
}
|
|
23
|
+
return d[e] = r, r.length === 0;
|
|
24
|
+
}, v = (e, t) => {
|
|
25
|
+
let n = g();
|
|
26
|
+
if (!n[e]) return;
|
|
27
|
+
_(e, t);
|
|
28
|
+
let r = m.get(e);
|
|
29
|
+
r && r.forEach((e) => {
|
|
30
|
+
n[e] && _(e, u[e]);
|
|
31
|
+
});
|
|
32
|
+
}, y = () => {
|
|
33
|
+
m.clear();
|
|
34
|
+
let e = g();
|
|
35
|
+
Object.keys(e).forEach((t) => {
|
|
36
|
+
(e[t] || []).forEach((e) => {
|
|
37
|
+
if (typeof e == "function" && e.name === "sameAs") {
|
|
38
|
+
let n = e.toString().match(/['"](.*?)['"]/);
|
|
39
|
+
if (n) {
|
|
40
|
+
let e = n[1];
|
|
41
|
+
m.has(e) || m.set(e, /* @__PURE__ */ new Set()), m.get(e).add(t);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
}, b = () => {
|
|
47
|
+
let e = g(), t = !0;
|
|
48
|
+
return Object.keys(e).forEach((e) => {
|
|
49
|
+
_(e, u[e]) || (t = !1);
|
|
50
|
+
}), t;
|
|
51
|
+
};
|
|
52
|
+
return h(), y(), s && a(() => u, () => {
|
|
53
|
+
let e = t(u), n = c.value, r = Object.keys(e), i = Object.keys(n);
|
|
54
|
+
(r.length !== i.length || r.some((e) => !i.includes(e))) && l(e);
|
|
55
|
+
}, { deep: !0 }), {
|
|
56
|
+
values: u,
|
|
57
|
+
errors: d,
|
|
58
|
+
defineField: (e, t = {}) => {
|
|
59
|
+
g()[e] || console.warn(`Field "${e}" not found in current validationSchema`);
|
|
60
|
+
let r = n({
|
|
61
|
+
get: () => u[e],
|
|
62
|
+
set: (t) => {
|
|
63
|
+
u[e] = t, p[e] = !0, v(e, t);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
return [r, n(() => {
|
|
67
|
+
let n = {
|
|
68
|
+
errors: d[e] || [],
|
|
69
|
+
touched: f[e] || !1,
|
|
70
|
+
dirty: p[e] || !1
|
|
71
|
+
}, i = {
|
|
72
|
+
message: d[e]?.[0],
|
|
73
|
+
onInput: (e) => {
|
|
74
|
+
let t = e.target;
|
|
75
|
+
r.value = t.value;
|
|
76
|
+
},
|
|
77
|
+
onBlur: () => {
|
|
78
|
+
f[e] = !0, v(e, u[e]);
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
if (t.props) {
|
|
82
|
+
let e = t.props(n);
|
|
83
|
+
return {
|
|
84
|
+
...i,
|
|
85
|
+
...e
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
return i;
|
|
89
|
+
})];
|
|
90
|
+
},
|
|
91
|
+
handleSubmit: (e) => async (t) => {
|
|
92
|
+
t && t.preventDefault();
|
|
93
|
+
let n = g();
|
|
94
|
+
Object.keys(n).forEach((e) => {
|
|
95
|
+
f[e] = !0;
|
|
96
|
+
}), b() && await e(u);
|
|
97
|
+
},
|
|
98
|
+
resetForm: () => {
|
|
99
|
+
let e = g();
|
|
100
|
+
Object.keys(e).forEach((e) => {
|
|
101
|
+
u[e] = o[e] || "", d[e] = [], f[e] = !1, p[e] = !1;
|
|
102
|
+
});
|
|
103
|
+
},
|
|
104
|
+
validate: b,
|
|
105
|
+
updateSchema: l
|
|
106
|
+
};
|
|
111
107
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
I as useForm,
|
|
115
|
-
W as useSwipeDown
|
|
116
|
-
};
|
|
108
|
+
//#endregion
|
|
109
|
+
export { t as useDialog, o as useForm, e as useSwipeDown };
|
|
@@ -1,39 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return { ...t, value: s, valueTo: g };
|
|
32
|
-
};
|
|
33
|
-
export {
|
|
34
|
-
v as getDataValue,
|
|
35
|
-
u as getFunction,
|
|
36
|
-
i as getParamsData,
|
|
37
|
-
p as getStateItem,
|
|
38
|
-
F as setStateItem
|
|
1
|
+
//#region src/dashboard/index.ts
|
|
2
|
+
var e = (e, t) => {
|
|
3
|
+
let n = e.split("."), r = t;
|
|
4
|
+
for (let e of n) if (typeof r == "object" && r && e in r) r = r[e];
|
|
5
|
+
else return;
|
|
6
|
+
return r;
|
|
7
|
+
}, t = ({ args: t }, n) => t.map((t) => e(t, n)), n = (e) => e ? (e = e.includes("return") ? e : `return ${e}`, Function("v", "a", "b", "c", e)) : null, r = (e, r, i) => {
|
|
8
|
+
let [, ...a] = t(e, i), o = null;
|
|
9
|
+
try {
|
|
10
|
+
let t = n(e.set);
|
|
11
|
+
t && (o = t(r, ...a));
|
|
12
|
+
} catch (e) {
|
|
13
|
+
console.warn(e);
|
|
14
|
+
}
|
|
15
|
+
return o;
|
|
16
|
+
}, i = (e, r) => {
|
|
17
|
+
let [i, a, o, s] = t(e, r), c = i ?? "", l = c;
|
|
18
|
+
try {
|
|
19
|
+
let t = n(e.get);
|
|
20
|
+
t && (c = t(c, a, o, s));
|
|
21
|
+
let r = n(e.getTo);
|
|
22
|
+
r && (l = r(c, a, o, s));
|
|
23
|
+
} catch (e) {
|
|
24
|
+
console.warn(e);
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
...e,
|
|
28
|
+
value: c,
|
|
29
|
+
valueTo: l
|
|
30
|
+
};
|
|
39
31
|
};
|
|
32
|
+
//#endregion
|
|
33
|
+
export { e as getDataValue, n as getFunction, t as getParamsData, i as getStateItem, r as setStateItem };
|
package/dist/helpers/index.es.js
CHANGED
|
@@ -1,56 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
T as loadScript,
|
|
48
|
-
u as localGet,
|
|
49
|
-
a as localSet,
|
|
50
|
-
p as secToTime,
|
|
51
|
-
E as sessionGet,
|
|
52
|
-
L as sessionSet,
|
|
53
|
-
y as strToArr,
|
|
54
|
-
S as timeUtcToString,
|
|
55
|
-
h as toByte
|
|
56
|
-
};
|
|
1
|
+
//#region src/helpers/general.ts
|
|
2
|
+
var e = (e) => {
|
|
3
|
+
try {
|
|
4
|
+
return e ? JSON.parse(e) : null;
|
|
5
|
+
} catch (t) {
|
|
6
|
+
return console.warn(t), e;
|
|
7
|
+
}
|
|
8
|
+
}, t = (e) => typeof e == "object" ? JSON.stringify(e) : e, n = (n) => e(t(n)), r = (e) => {
|
|
9
|
+
let t = [
|
|
10
|
+
"B",
|
|
11
|
+
"KB",
|
|
12
|
+
"MB"
|
|
13
|
+
];
|
|
14
|
+
if (e == 0) return "0 B";
|
|
15
|
+
let n = Math.floor(Math.log(e) / Math.log(1024));
|
|
16
|
+
return n > 1 && (n = 1), Math.round(e / 1024 ** n) + " " + t[n];
|
|
17
|
+
}, i = (e, t = {
|
|
18
|
+
year: "numeric",
|
|
19
|
+
month: "numeric",
|
|
20
|
+
day: "numeric"
|
|
21
|
+
}, n = []) => new Date(e).toLocaleDateString(n, t), a = (e, t = {
|
|
22
|
+
minute: "2-digit",
|
|
23
|
+
hour: "2-digit"
|
|
24
|
+
}, n = []) => new Date(e).toLocaleTimeString(n, t), o = (e) => e >= 10 ? e : `0${e}`, s = (e) => {
|
|
25
|
+
let t = Math.floor(e % 31536e3 % 2628e3 / 86400), n = Math.floor(e % (3600 * 24) / 3600), r = Math.floor(e % 3600 / 60), i = Math.floor(e % 60);
|
|
26
|
+
return `${t ? t + " days " : ""} ${o(n)}:${o(r)}:${o(i)}`;
|
|
27
|
+
}, c = (e) => e.join("."), l = (e) => e.split(".").map((e) => +e), u = (e, t = "file") => {
|
|
28
|
+
let n = document.createElement("a");
|
|
29
|
+
n.setAttribute("download", t), n.href = e, document.body.appendChild(n), n.click(), n.remove();
|
|
30
|
+
}, d = (e) => new Promise((t, n) => {
|
|
31
|
+
let r = document.createElement("script");
|
|
32
|
+
r.src = e, r.type = "text/javascript", r.async = !0, r.onload = () => t(r), r.onerror = () => n(/* @__PURE__ */ Error(`Ошибка загрузки скрипта: ${e}`)), document.head.appendChild(r);
|
|
33
|
+
}), f = (t) => (n, r) => r ? e(t.getItem(n)) : t.getItem(n), p = (e) => (n, r) => {
|
|
34
|
+
e && e.setItem(n, typeof r == "string" ? r : t(r));
|
|
35
|
+
}, m = f(localStorage), h = p(localStorage), g = f(sessionStorage), _ = p(sessionStorage), v = (e = "isShow") => {
|
|
36
|
+
let t = m(e);
|
|
37
|
+
return t || h(e, "true"), !t;
|
|
38
|
+
}, y = (e) => {
|
|
39
|
+
h("theme", e), document.documentElement.classList.remove("dark"), document.documentElement.classList.remove("light"), document.documentElement.classList.add(e);
|
|
40
|
+
}, b = (e, t) => {
|
|
41
|
+
if (!e) return null;
|
|
42
|
+
for (let n of e) if (!(t === "/" || n.path === "/") && (n.path === t || t.includes(n.path))) return n;
|
|
43
|
+
return null;
|
|
44
|
+
}, x = (e, t) => b(e, t);
|
|
45
|
+
//#endregion
|
|
46
|
+
export { o as addZero, c as arrToStr, y as changeTheme, n as clone, u as createDownloadLink, i as dateUtcToString, b as findMenuItem, x as getPageTitle, v as isNewVersion, e as jsonParse, t as jsonString, d as loadScript, m as localGet, h as localSet, s as secToTime, g as sessionGet, _ as sessionSet, l as strToArr, a as timeUtcToString, r as toByte };
|