vuesp-components 2.0.9 → 2.1.0

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 (45) hide show
  1. package/dist/App.vue.d.ts +1 -1
  2. package/dist/App.vue.d.ts.map +1 -1
  3. package/dist/components/dashboard/cards/CardBase.vue.d.ts +28 -0
  4. package/dist/components/dashboard/cards/CardBase.vue.d.ts.map +1 -1
  5. package/dist/components/dashboard/cards/CardButton.vue.d.ts +29 -1
  6. package/dist/components/dashboard/cards/CardButton.vue.d.ts.map +1 -1
  7. package/dist/components/dashboard/cards/CardDate.vue.d.ts +29 -1
  8. package/dist/components/dashboard/cards/CardDate.vue.d.ts.map +1 -1
  9. package/dist/components/dashboard/cards/CardDimmer.vue.d.ts +29 -1
  10. package/dist/components/dashboard/cards/CardDimmer.vue.d.ts.map +1 -1
  11. package/dist/components/dashboard/cards/CardInfo.vue.d.ts +14 -0
  12. package/dist/components/dashboard/cards/CardInfo.vue.d.ts.map +1 -1
  13. package/dist/components/dashboard/cards/CardInput.vue.d.ts +29 -1
  14. package/dist/components/dashboard/cards/CardInput.vue.d.ts.map +1 -1
  15. package/dist/components/dashboard/cards/CardList.vue.d.ts +29 -1
  16. package/dist/components/dashboard/cards/CardList.vue.d.ts.map +1 -1
  17. package/dist/components/dashboard/edit/ItemEdit.vue.d.ts +3 -0
  18. package/dist/components/dashboard/edit/ItemEdit.vue.d.ts.map +1 -1
  19. package/dist/components/dashboard/edit/types.d.ts +2 -0
  20. package/dist/components/dashboard/edit/types.d.ts.map +1 -1
  21. package/dist/components/ui/dialog/VDialog.vue.d.ts +7 -2
  22. package/dist/components/ui/dialog/VDialog.vue.d.ts.map +1 -1
  23. package/dist/components/ui/dialog/VPopup.vue.d.ts +4 -1
  24. package/dist/components/ui/dialog/VPopup.vue.d.ts.map +1 -1
  25. package/dist/components/ui/dropdown/VDropdown.vue.d.ts.map +1 -1
  26. package/dist/components/ui/dropdown/types.d.ts +2 -0
  27. package/dist/components/ui/dropdown/types.d.ts.map +1 -1
  28. package/dist/components/ui/list/VList.vue.d.ts.map +1 -1
  29. package/dist/components/ui/select/VSelect.vue.d.ts.map +1 -1
  30. package/dist/components/ui/select/types.d.ts +2 -1
  31. package/dist/components/ui/select/types.d.ts.map +1 -1
  32. package/dist/composables/index.es.js +115 -108
  33. package/dist/dashboard/index.d.ts +1 -0
  34. package/dist/dashboard/index.d.ts.map +1 -1
  35. package/dist/dashboard/index.es.js +39 -32
  36. package/dist/helpers/index.es.js +56 -46
  37. package/dist/index.es.js +2630 -2281
  38. package/dist/plugins/index.es.js +59 -57
  39. package/dist/style.css +1 -0
  40. package/dist/useSwipeDown-E8KeNvRa.js +436 -0
  41. package/package.json +3 -3
  42. package/dist/dashboard/lists.d.ts +0 -4
  43. package/dist/dashboard/lists.d.ts.map +0 -1
  44. package/dist/useDialog-Biu5-ZSJ.js +0 -396
  45. package/dist/vuesp-components.css +0 -2
@@ -1,109 +1,116 @@
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
- };
1
+ import { ref as z, reactive as y, watch as B, computed as k } from "vue";
2
+ import { u as R, a as W } from "../useSwipeDown-E8KeNvRa.js";
3
+ function I(w) {
4
+ const { validationSchema: l, initialValues: m = {} } = w, d = typeof l == "function", v = z(
5
+ d ? l(m) : l
6
+ ), F = (t) => {
7
+ v.value = t;
8
+ const e = Object.keys(t), o = Object.keys(c);
9
+ e.forEach((s) => {
10
+ s in c || (c[s] = m[s] ?? "", a[s] = [], u[s] = !1, h[s] = !1);
11
+ }), o.forEach((s) => {
12
+ e.includes(s) || (delete c[s], delete a[s], delete u[s], delete h[s]);
13
+ }), E();
14
+ }, c = y({}), a = y({}), u = y({}), h = y({}), f = /* @__PURE__ */ new Map(), D = () => {
15
+ Object.keys(v.value).forEach((t) => {
16
+ c[t] = m[t] ?? "", a[t] = [], u[t] = !1, h[t] = !1;
17
+ });
18
+ }, i = () => d ? l(c) : v.value, g = (t, e) => {
19
+ const s = i()[t] || [], n = [];
20
+ for (const r of s) {
21
+ const p = r(e, c);
22
+ p !== !0 && n.push(p);
23
+ }
24
+ return a[t] = n, n.length === 0;
25
+ }, S = (t, e) => {
26
+ const o = i();
27
+ if (!o[t]) return;
28
+ g(t, e);
29
+ const s = f.get(t);
30
+ s && s.forEach((n) => {
31
+ o[n] && g(n, c[n]);
32
+ });
33
+ }, E = () => {
34
+ f.clear();
35
+ const t = i();
36
+ Object.keys(t).forEach((e) => {
37
+ (t[e] || []).forEach((s) => {
38
+ if (typeof s == "function" && s.name === "sameAs") {
39
+ const n = s.toString().match(/['"](.*?)['"]/);
40
+ if (n) {
41
+ const r = n[1];
42
+ f.has(r) || f.set(r, /* @__PURE__ */ new Set()), f.get(r).add(e);
43
+ }
44
+ }
45
+ });
46
+ });
47
+ }, O = () => {
48
+ const t = i();
49
+ let e = !0;
50
+ return Object.keys(t).forEach((o) => {
51
+ g(o, c[o]) || (e = !1);
52
+ }), e;
53
+ }, V = (t, e = {}) => {
54
+ i()[t] || console.warn(`Field "${t}" not found in current validationSchema`);
55
+ const s = k({
56
+ get: () => c[t],
57
+ set: (r) => {
58
+ c[t] = r, h[t] = !0, S(t, r);
59
+ }
60
+ }), n = k(() => {
61
+ var j;
62
+ const r = {
63
+ errors: a[t] || [],
64
+ touched: u[t] || !1,
65
+ dirty: h[t] || !1
66
+ }, p = {
67
+ message: (j = a[t]) == null ? void 0 : j[0],
68
+ onInput: (b) => {
69
+ const K = b.target;
70
+ s.value = K.value;
71
+ },
72
+ onBlur: () => {
73
+ u[t] = !0, S(t, c[t]);
74
+ }
75
+ };
76
+ if (e.props) {
77
+ const b = e.props(r);
78
+ return { ...p, ...b };
79
+ }
80
+ return p;
81
+ });
82
+ return [s, n];
83
+ }, x = (t) => async (e) => {
84
+ e && e.preventDefault();
85
+ const o = i();
86
+ Object.keys(o).forEach((n) => {
87
+ u[n] = !0;
88
+ }), O() && await t(c);
89
+ }, A = () => {
90
+ const t = i();
91
+ Object.keys(t).forEach((e) => {
92
+ c[e] = m[e] || "", a[e] = [], u[e] = !1, h[e] = !1;
93
+ });
94
+ };
95
+ return D(), E(), d && B(
96
+ () => c,
97
+ () => {
98
+ const t = l(c), e = v.value, o = Object.keys(t), s = Object.keys(e);
99
+ (o.length !== s.length || o.some((n) => !s.includes(n))) && F(t);
100
+ },
101
+ { deep: !0 }
102
+ ), {
103
+ values: c,
104
+ errors: a,
105
+ defineField: V,
106
+ handleSubmit: x,
107
+ resetForm: A,
108
+ validate: O,
109
+ updateSchema: F
110
+ };
107
111
  }
108
- //#endregion
109
- export { t as useDialog, o as useForm, e as useSwipeDown };
112
+ export {
113
+ R as useDialog,
114
+ I as useForm,
115
+ W as useSwipeDown
116
+ };
@@ -1,4 +1,5 @@
1
1
  import { TypeGetDataValue, TypeGetParamsData, IDashboardItem, GetTypeByPath } from '../types/types';
2
+ export declare const dashboardCards: string[];
2
3
  export declare const getDataValue: TypeGetDataValue;
3
4
  export declare const getParamsData: TypeGetParamsData;
4
5
  export declare const getFunction: (body: string | undefined) => Function | null;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dashboard/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAExG,eAAO,MAAM,YAAY,EAAE,gBAY1B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,iBAE3B,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,MAAM,MAAM,GAAG,SAAS,oBAInD,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,CAAC,EAAE,MAAM,cAAc,EAAE,OAAO,OAAO,EAAE,QAAQ,CAAC,QAU9E,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,CAAC,EAAE,MAAM,cAAc,EAAE,QAAQ,CAAC;;;;;;;;;;;;CAkB9D,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dashboard/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAExG,eAAO,MAAM,cAAc,UAAwD,CAAC;AAEpF,eAAO,MAAM,YAAY,EAAE,gBAY1B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,iBAE3B,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,MAAM,MAAM,GAAG,SAAS,oBAInD,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,CAAC,EAAE,MAAM,cAAc,EAAE,OAAO,OAAO,EAAE,QAAQ,CAAC,QAU9E,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,CAAC,EAAE,MAAM,cAAc,EAAE,QAAQ,CAAC;;;;;;;;;;;;CAkB9D,CAAC"}
@@ -1,33 +1,40 @@
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
- };
1
+ const v = ["button", "info", "dimmer", "date", "input", "list"], p = (t, r) => {
2
+ const c = t.split(".");
3
+ let n = r;
4
+ for (const e of c)
5
+ if (n !== null && typeof n == "object" && e in n)
6
+ n = n[e];
7
+ else
8
+ return;
9
+ return n;
10
+ }, f = ({ args: t }, r) => t.map((c) => p(c, r)), u = (t) => t ? (t = t.includes("return") ? t : `return ${t}`, new Function("v", "a", "b", "c", t)) : null, F = (t, r, c) => {
11
+ const [, ...n] = f(t, c);
12
+ let e = null;
13
+ try {
14
+ const o = u(t.set);
15
+ o && (e = o(r, ...n));
16
+ } catch (o) {
17
+ console.warn(o);
18
+ }
19
+ return e;
20
+ }, d = (t, r) => {
21
+ const c = f(t, r), [n, e, o, l] = c;
22
+ let s = n ?? "", i = s;
23
+ try {
24
+ const a = u(t.get);
25
+ a && (s = a(s, e, o, l));
26
+ const g = u(t.getTo);
27
+ g && (i = g(s, e, o, l));
28
+ } catch (a) {
29
+ console.warn(a);
30
+ }
31
+ return { ...t, value: s, valueTo: i };
32
+ };
33
+ export {
34
+ v as dashboardCards,
35
+ p as getDataValue,
36
+ u as getFunction,
37
+ f as getParamsData,
38
+ d as getStateItem,
39
+ F as setStateItem
31
40
  };
32
- //#endregion
33
- export { e as getDataValue, n as getFunction, t as getParamsData, i as getStateItem, r as setStateItem };
@@ -1,46 +1,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 };
1
+ const c = (t) => {
2
+ try {
3
+ return t ? JSON.parse(t) : null;
4
+ } catch (e) {
5
+ return console.warn(e), t;
6
+ }
7
+ }, s = (t) => typeof t == "object" ? JSON.stringify(t) : t, g = (t) => c(s(t)), h = (t) => {
8
+ const e = ["B", "KB", "MB"];
9
+ if (t == 0) return "0 B";
10
+ let o = Math.floor(Math.log(t) / Math.log(1024));
11
+ return o > 1 && (o = 1), Math.round(t / Math.pow(1024, o)) + " " + e[o];
12
+ }, f = (t, e = { year: "numeric", month: "numeric", day: "numeric" }, o = []) => new Date(t).toLocaleDateString(o, e), S = (t, e = { minute: "2-digit", hour: "2-digit" }, o = []) => new Date(t).toLocaleTimeString(o, e), r = (t) => t >= 10 ? t : `0${t}`, p = (t) => {
13
+ const e = Math.floor(t % 31536e3 % 2628e3 / 86400), o = Math.floor(t % (3600 * 24) / 3600), n = Math.floor(t % 3600 / 60), m = Math.floor(t % 60);
14
+ return `${e ? e + " days " : ""} ${r(o)}:${r(n)}:${r(m)}`;
15
+ }, w = (t) => t.join("."), y = (t) => t.split(".").map((e) => +e), M = (t, e = "file") => {
16
+ const o = document.createElement("a");
17
+ o.setAttribute("download", e), o.href = t, document.body.appendChild(o), o.click(), o.remove();
18
+ }, T = (t) => new Promise((e, o) => {
19
+ const n = document.createElement("script");
20
+ n.src = t, n.type = "text/javascript", n.async = !0, n.onload = () => e(n), n.onerror = () => o(new Error(`Ошибка загрузки скрипта: ${t}`)), document.head.appendChild(n);
21
+ }), i = (t) => (e, o) => o ? c(t.getItem(e)) : t.getItem(e), l = (t) => (e, o) => {
22
+ t && t.setItem(e, typeof o == "string" ? o : s(o));
23
+ }, u = i(localStorage), a = l(localStorage), E = i(sessionStorage), L = l(sessionStorage), $ = (t = "isShow") => {
24
+ const e = u(t);
25
+ return e || a(t, "true"), !e;
26
+ }, j = (t) => {
27
+ a("theme", t), document.documentElement.classList.remove("dark"), document.documentElement.classList.remove("light"), document.documentElement.classList.add(t);
28
+ }, d = (t, e) => {
29
+ if (!t) return null;
30
+ for (const o of t)
31
+ if (!(e === "/" || o.path === "/") && (o.path === e || e.includes(o.path)))
32
+ return o;
33
+ return null;
34
+ }, B = (t, e) => d(t, e);
35
+ export {
36
+ r as addZero,
37
+ w as arrToStr,
38
+ j as changeTheme,
39
+ g as clone,
40
+ M as createDownloadLink,
41
+ f as dateUtcToString,
42
+ d as findMenuItem,
43
+ B as getPageTitle,
44
+ $ as isNewVersion,
45
+ c as jsonParse,
46
+ s as jsonString,
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
+ };