@profitliga/ui 1.0.9 → 1.0.10
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/utils/index.d.ts +2 -2
- package/dist/utils/index.js +70 -82
- package/dist/utils/priceFormat.util.d.ts +2 -1
- package/package.json +1 -1
package/dist/utils/index.d.ts
CHANGED
|
@@ -6,5 +6,5 @@ export * from './useBodyScroll.util';
|
|
|
6
6
|
export * from './dayjs.util';
|
|
7
7
|
export * from './uploadFile.util';
|
|
8
8
|
export * from './internationalized.utils';
|
|
9
|
-
export * from './breakpoints.util
|
|
10
|
-
export * from './priceFormat.util
|
|
9
|
+
export * from './breakpoints.util';
|
|
10
|
+
export * from './priceFormat.util';
|
package/dist/utils/index.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { toValue as
|
|
2
|
-
import { p as
|
|
3
|
-
import { b as
|
|
1
|
+
import { toValue as y, unref as x } from "vue";
|
|
2
|
+
import { p as S } from "../breakpoints.util-FHc0ZUGk.js";
|
|
3
|
+
import { b as D } from "../breakpoints.util-FHc0ZUGk.js";
|
|
4
4
|
export * from "@internationalized/date";
|
|
5
5
|
import { default as q } from "dayjs";
|
|
6
|
-
function
|
|
6
|
+
function z() {
|
|
7
7
|
const e = /* @__PURE__ */ new Map();
|
|
8
8
|
return {
|
|
9
|
-
on(
|
|
10
|
-
const r = e.get(
|
|
11
|
-
r.push(
|
|
9
|
+
on(t, n) {
|
|
10
|
+
const r = e.get(t) ?? [];
|
|
11
|
+
r.push(n), e.set(t, r);
|
|
12
12
|
},
|
|
13
|
-
off(
|
|
14
|
-
const r = e.get(
|
|
13
|
+
off(t, n) {
|
|
14
|
+
const r = e.get(t);
|
|
15
15
|
r && e.set(
|
|
16
|
-
|
|
17
|
-
r.filter((
|
|
16
|
+
t,
|
|
17
|
+
r.filter((c) => c !== n)
|
|
18
18
|
);
|
|
19
19
|
},
|
|
20
|
-
emit(
|
|
21
|
-
const r = e.get(
|
|
20
|
+
emit(t, n) {
|
|
21
|
+
const r = e.get(t);
|
|
22
22
|
r && r.forEach(
|
|
23
|
-
(
|
|
23
|
+
(c) => c(n)
|
|
24
24
|
);
|
|
25
25
|
},
|
|
26
26
|
clear() {
|
|
@@ -29,43 +29,43 @@ function k() {
|
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
31
|
const d = /* @__PURE__ */ new WeakMap();
|
|
32
|
-
function
|
|
33
|
-
const
|
|
34
|
-
return
|
|
32
|
+
function p(e) {
|
|
33
|
+
const t = x(e);
|
|
34
|
+
return t?.$el ?? t;
|
|
35
35
|
}
|
|
36
36
|
function w(e) {
|
|
37
|
-
return typeof e == "string" ? document.querySelector(e) :
|
|
37
|
+
return typeof e == "string" ? document.querySelector(e) : p(e);
|
|
38
38
|
}
|
|
39
|
-
function
|
|
39
|
+
function k(e, t, n = {}) {
|
|
40
40
|
const r = w(e);
|
|
41
41
|
if (!r) return () => {
|
|
42
42
|
};
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
const
|
|
46
|
-
const
|
|
47
|
-
if (!
|
|
48
|
-
const
|
|
49
|
-
r.contains(
|
|
43
|
+
const c = d.get(r);
|
|
44
|
+
c && (c(), d.delete(r));
|
|
45
|
+
const l = (s) => {
|
|
46
|
+
const i = s.target instanceof Node ? s.target : null;
|
|
47
|
+
if (!i) return;
|
|
48
|
+
const g = (y(n.ignore) ?? []).map((a) => typeof a == "string" ? document.querySelector(a) : p(a)).filter((a) => a != null);
|
|
49
|
+
r.contains(i) || g.some((a) => a.contains(i)) || t(s);
|
|
50
50
|
};
|
|
51
|
-
document.addEventListener("mousedown",
|
|
51
|
+
document.addEventListener("mousedown", l, { capture: !0 }), document.addEventListener("touchstart", l, { capture: !0 });
|
|
52
52
|
const o = () => {
|
|
53
|
-
document.removeEventListener("mousedown",
|
|
53
|
+
document.removeEventListener("mousedown", l, { capture: !0 }), document.removeEventListener("touchstart", l, { capture: !0 }), d.delete(r);
|
|
54
54
|
};
|
|
55
55
|
return d.set(r, o), o;
|
|
56
56
|
}
|
|
57
|
-
function
|
|
57
|
+
function C(e, t = "₽", n = 2) {
|
|
58
58
|
return `${e.toLocaleString("en-US", {
|
|
59
|
-
minimumFractionDigits:
|
|
60
|
-
maximumFractionDigits:
|
|
61
|
-
}).replace(/,/g, " ")} ${
|
|
62
|
-
}
|
|
63
|
-
function M(e) {
|
|
64
|
-
return e.reduce((n, t) => n + t, 0);
|
|
59
|
+
minimumFractionDigits: n,
|
|
60
|
+
maximumFractionDigits: n
|
|
61
|
+
}).replace(/,/g, " ")} ${t}`;
|
|
65
62
|
}
|
|
66
63
|
function U(e) {
|
|
67
|
-
|
|
68
|
-
|
|
64
|
+
return e.reduce((t, n) => t + n, 0);
|
|
65
|
+
}
|
|
66
|
+
function A(e) {
|
|
67
|
+
const t = e.replace(/[^\d.,]/g, "").replace(",", ".");
|
|
68
|
+
return parseFloat(t) || 0;
|
|
69
69
|
}
|
|
70
70
|
let u = null, m = 0;
|
|
71
71
|
function v() {
|
|
@@ -74,17 +74,17 @@ function v() {
|
|
|
74
74
|
document.body.style.position = "", document.body.style.top = "", window.scrollTo(0, e);
|
|
75
75
|
};
|
|
76
76
|
}
|
|
77
|
-
const
|
|
77
|
+
const h = () => {
|
|
78
78
|
m++, m === 1 && !u && (u = v());
|
|
79
|
-
},
|
|
79
|
+
}, F = () => {
|
|
80
80
|
m > 0 && m--, m === 0 && u && (u(), u = null);
|
|
81
|
-
},
|
|
82
|
-
unlockScroll:
|
|
83
|
-
lockScroll:
|
|
81
|
+
}, M = () => ({
|
|
82
|
+
unlockScroll: F,
|
|
83
|
+
lockScroll: h
|
|
84
84
|
});
|
|
85
85
|
function E(e) {
|
|
86
86
|
if (!e) return;
|
|
87
|
-
const
|
|
87
|
+
const t = Array.isArray(e) ? e : [e], n = {
|
|
88
88
|
image: ["image/*"],
|
|
89
89
|
pdf: ["application/pdf"],
|
|
90
90
|
excel: [
|
|
@@ -97,55 +97,43 @@ function E(e) {
|
|
|
97
97
|
],
|
|
98
98
|
all: ["*/*"]
|
|
99
99
|
};
|
|
100
|
-
return
|
|
100
|
+
return t.flatMap((r) => n[r] || []).join(",");
|
|
101
101
|
}
|
|
102
|
-
function
|
|
103
|
-
return new Promise((
|
|
104
|
-
const
|
|
105
|
-
|
|
102
|
+
function P(e = {}) {
|
|
103
|
+
return new Promise((t) => {
|
|
104
|
+
const n = document.createElement("input");
|
|
105
|
+
n.type = "file", n.style.display = "none", e.multiple && e.maxFiles && e.maxFiles > 1 && (n.multiple = !0);
|
|
106
106
|
const r = E(e.accept);
|
|
107
|
-
r && (
|
|
108
|
-
const
|
|
107
|
+
r && (n.accept = r), n.addEventListener("change", (c) => {
|
|
108
|
+
const l = c.target;
|
|
109
109
|
let o = [];
|
|
110
|
-
if (
|
|
111
|
-
const
|
|
112
|
-
o = o.filter((f) => f.size <=
|
|
110
|
+
if (l.files && l.files.length > 0 && (o = Array.from(l.files), e.maxFiles && o.length > e.maxFiles && (o = o.slice(0, e.maxFiles)), e.maxFileSize)) {
|
|
111
|
+
const i = S(e.maxFileSize);
|
|
112
|
+
o = o.filter((f) => f.size <= i);
|
|
113
113
|
}
|
|
114
|
-
if (document.body.removeChild(
|
|
115
|
-
|
|
114
|
+
if (document.body.removeChild(n), e.returnType === "raw") {
|
|
115
|
+
t(o);
|
|
116
116
|
return;
|
|
117
117
|
}
|
|
118
|
-
const
|
|
118
|
+
const s = o.map((i) => ({
|
|
119
119
|
id: crypto.randomUUID(),
|
|
120
|
-
url: URL.createObjectURL(
|
|
121
|
-
name:
|
|
122
|
-
mime:
|
|
123
|
-
size:
|
|
120
|
+
url: URL.createObjectURL(i),
|
|
121
|
+
name: i.name,
|
|
122
|
+
mime: i.type,
|
|
123
|
+
size: i.size
|
|
124
124
|
}));
|
|
125
|
-
|
|
126
|
-
}), document.body.appendChild(
|
|
125
|
+
t(s);
|
|
126
|
+
}), document.body.appendChild(n), n.click();
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
|
-
const D = (e, n = !0) => {
|
|
130
|
-
const t = typeof e == "string" ? parseFloat(e) : e;
|
|
131
|
-
if (isNaN(t))
|
|
132
|
-
return "<span>0.<small>00</small>₽</span>";
|
|
133
|
-
const r = Math.floor(t), l = Math.round((t - r) * 100), i = r.toLocaleString("ru-RU"), o = l.toString().padStart(2, "0");
|
|
134
|
-
return n ? `<span class="price-number">${i}.<small style="margin-right: 4px">${o}</small>₽</span>` : p("span", { class: "price-number" }, [
|
|
135
|
-
`${i}.`,
|
|
136
|
-
p("small", { style: { marginRight: "4px" } }, o),
|
|
137
|
-
"₽"
|
|
138
|
-
]);
|
|
139
|
-
};
|
|
140
129
|
export {
|
|
141
|
-
|
|
142
|
-
|
|
130
|
+
z as EventBus,
|
|
131
|
+
D as breakpoints,
|
|
143
132
|
q as dayjs,
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
M as
|
|
150
|
-
C as useBodyScroll
|
|
133
|
+
C as formatPrice,
|
|
134
|
+
k as onClickOutside,
|
|
135
|
+
P as openFileDialog,
|
|
136
|
+
A as parsePrice,
|
|
137
|
+
U as sumPrices,
|
|
138
|
+
M as useBodyScroll
|
|
151
139
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { VNode, RendererNode, RendererElement } from 'vue';
|
|
2
|
-
|
|
2
|
+
declare const priceFormat: (price: string | number, returnHtml?: boolean) => string | VNode<RendererNode, RendererElement, {
|
|
3
3
|
[key: string]: any;
|
|
4
4
|
}>;
|
|
5
|
+
export default priceFormat;
|