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