@profitliga/ui 1.2.75 → 1.2.77

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.
@@ -6,30 +6,30 @@ import { default as B } from "dayjs";
6
6
  function k() {
7
7
  const e = /* @__PURE__ */ new Map();
8
8
  return {
9
- on(r, t) {
10
- const n = e.get(r) ?? [];
11
- n.push(t), e.set(r, n);
9
+ on(t, n) {
10
+ const r = e.get(t) ?? [];
11
+ r.push(n), e.set(t, r);
12
12
  },
13
- off(r, t) {
14
- const n = e.get(r);
15
- n && e.set(
16
- r,
17
- n.filter((l) => l !== t)
13
+ off(t, n) {
14
+ const r = e.get(t);
15
+ r && e.set(
16
+ t,
17
+ r.filter((o) => o !== n)
18
18
  );
19
19
  },
20
- emit(r, t) {
21
- const n = e.get(r);
22
- n && n.forEach(
23
- (l) => l(t)
20
+ emit(t, n) {
21
+ const r = e.get(t);
22
+ r && r.forEach(
23
+ (o) => o(n)
24
24
  );
25
25
  },
26
- listeners(r) {
27
- const t = e.get(r);
28
- return t ? [...t] : [];
26
+ listeners(t) {
27
+ const n = e.get(t);
28
+ return n ? [...n] : [];
29
29
  },
30
30
  // Количество слушателей для события
31
- listenerCount(r) {
32
- return e.get(r)?.length ?? 0;
31
+ listenerCount(t) {
32
+ return e.get(t)?.length ?? 0;
33
33
  },
34
34
  // Список всех типов событий с зарегистрированными слушателями
35
35
  eventNames() {
@@ -42,61 +42,61 @@ function k() {
42
42
  }
43
43
  const d = /* @__PURE__ */ new WeakMap();
44
44
  function g(e) {
45
- const r = S(e);
46
- return r?.$el ?? r;
45
+ const t = S(e);
46
+ return t?.$el ?? t;
47
47
  }
48
- function v(e) {
48
+ function F(e) {
49
49
  return typeof e == "string" ? document.querySelector(e) : g(e);
50
50
  }
51
- function P(e, r, t = {}) {
52
- const n = v(e);
53
- if (!n) return () => {
51
+ function $(e, t, n = {}) {
52
+ const r = F(e);
53
+ if (!r) return () => {
54
54
  };
55
- const l = d.get(n);
56
- l && (l(), d.delete(n));
55
+ const o = d.get(r);
56
+ o && (o(), d.delete(r));
57
57
  const i = (c) => {
58
- const a = c.target instanceof Node ? c.target : null;
59
- if (!a) return;
60
- const y = (x(t.ignore) ?? []).map((s) => typeof s == "string" ? document.querySelector(s) : g(s)).filter((s) => s != null);
61
- n.contains(a) || y.some((s) => s.contains(a)) || r(c);
58
+ const s = c.target instanceof Node ? c.target : null;
59
+ if (!s) return;
60
+ const y = (x(n.ignore) ?? []).map((a) => typeof a == "string" ? document.querySelector(a) : g(a)).filter((a) => a != null);
61
+ r.contains(s) || y.some((a) => a.contains(s)) || t(c);
62
62
  };
63
63
  document.addEventListener("mousedown", i, { capture: !0 }), document.addEventListener("touchstart", i, { capture: !0 });
64
- const o = () => {
65
- document.removeEventListener("mousedown", i, { capture: !0 }), document.removeEventListener("touchstart", i, { capture: !0 }), d.delete(n);
64
+ const l = () => {
65
+ document.removeEventListener("mousedown", i, { capture: !0 }), document.removeEventListener("touchstart", i, { capture: !0 }), d.delete(r);
66
66
  };
67
- return d.set(n, o), o;
67
+ return d.set(r, l), l;
68
68
  }
69
- function $(e, r = "₽", t = 2) {
69
+ function C(e, t = "₽", n = 2) {
70
70
  return `${e.toLocaleString("en-US", {
71
- minimumFractionDigits: t,
72
- maximumFractionDigits: t
73
- }).replace(/,/g, " ")} ${r}`;
71
+ minimumFractionDigits: n,
72
+ maximumFractionDigits: n
73
+ }).replace(/,/g, " ")} ${t}`;
74
74
  }
75
- function C(e) {
76
- return e.reduce((r, t) => r + t, 0);
75
+ function D(e) {
76
+ return e.reduce((t, n) => t + n, 0);
77
77
  }
78
- function M(e) {
79
- const r = e.replace(/[^\d.,]/g, "").replace(",", ".");
80
- return parseFloat(r) || 0;
78
+ function U(e) {
79
+ const t = e.replace(/[^\d.,]/g, "").replace(",", ".");
80
+ return parseFloat(t) || 0;
81
81
  }
82
82
  let u = null, m = 0;
83
- function w() {
83
+ function v() {
84
84
  const e = window.scrollY;
85
85
  return document.body.style.position = "fixed", document.body.style.top = `-${e}px`, () => {
86
86
  document.body.style.position = "", document.body.style.top = "", window.scrollTo(0, e);
87
87
  };
88
88
  }
89
- const F = () => {
90
- m++, m === 1 && !u && (u = w());
89
+ const w = () => {
90
+ m++, m === 1 && !u && (u = v());
91
91
  }, b = () => {
92
92
  m > 0 && m--, m === 0 && u && (u(), u = null);
93
- }, U = () => ({
93
+ }, A = () => ({
94
94
  unlockScroll: b,
95
- lockScroll: F
95
+ lockScroll: w
96
96
  });
97
97
  function E(e) {
98
98
  if (!e) return;
99
- const r = Array.isArray(e) ? e : [e], t = {
99
+ const t = Array.isArray(e) ? e : [e], n = {
100
100
  image: ["image/*"],
101
101
  pdf: ["application/pdf"],
102
102
  excel: [
@@ -109,43 +109,46 @@ function E(e) {
109
109
  ],
110
110
  all: ["*/*"]
111
111
  };
112
- return r.flatMap((n) => t[n] || []).join(",");
112
+ return t.flatMap((r) => n[r] || []).join(",");
113
113
  }
114
- function A(e = {}) {
115
- return new Promise((r) => {
116
- const t = document.createElement("input");
117
- t.type = "file", t.style.display = "none", e.multiple && e.maxFiles && e.maxFiles > 1 && (t.multiple = !0);
118
- const n = E(e.accept);
119
- n && (t.accept = n), t.addEventListener("change", (l) => {
120
- const i = l.target;
121
- let o = [];
122
- 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)) {
123
- const a = h(e.maxFileSize);
124
- o = o.filter((f) => f.size <= a);
114
+ function N(e = {}) {
115
+ return new Promise((t) => {
116
+ const n = document.createElement("input");
117
+ n.type = "file", n.style.display = "none", e.multiple && e.maxFiles && e.maxFiles > 1 && (n.multiple = !0);
118
+ const r = E(e.accept);
119
+ r && (n.accept = r), n.addEventListener("change", (o) => {
120
+ const i = o.target;
121
+ let l = [];
122
+ if (i.files && i.files.length > 0 && (l = Array.from(i.files), e.maxFiles && l.length > e.maxFiles && (l = l.slice(0, e.maxFiles)), e.maxFileSize)) {
123
+ const s = h(e.maxFileSize);
124
+ l = l.filter((f) => f.size <= s);
125
125
  }
126
- if (document.body.removeChild(t), e.returnType === "raw") {
127
- r(o);
126
+ if (document.body.removeChild(n), e.returnType === "raw") {
127
+ t(l);
128
128
  return;
129
129
  }
130
- const c = o.map((a) => ({
130
+ const c = l.map((s) => ({
131
131
  id: crypto.randomUUID(),
132
- url: URL.createObjectURL(a),
133
- name: a.name,
134
- mime: a.type,
135
- size: a.size
132
+ url: URL.createObjectURL(s),
133
+ name: s.name,
134
+ mime: s.type,
135
+ size: s.size
136
136
  }));
137
- r(c);
138
- }), document.body.appendChild(t), t.click();
137
+ t(c);
138
+ }), document.body.appendChild(n), n.click();
139
139
  });
140
140
  }
141
- const N = (e, r = !0) => {
142
- const t = typeof e == "string" ? parseFloat(e) : e;
143
- if (isNaN(t))
141
+ const P = (e, t = !0) => {
142
+ const n = typeof e == "string" ? parseFloat(e) : e;
143
+ if (isNaN(n))
144
144
  return "<span>0.<small>00</small>₽</span>";
145
- const n = Math.floor(t), l = Math.round((t - n) * 100), i = n.toLocaleString("ru-RU"), o = l.toString().padStart(2, "0");
146
- return r ? `<span class="price-number">${i}<small style="margin-right: 4px">.${o}</small>₽</span>` : p("span", { class: "price-number" }, [
147
- `${i}.`,
148
- p("small", { style: { marginRight: "4px" } }, o),
145
+ const r = n.toLocaleString("ru-RU", {
146
+ minimumFractionDigits: 2,
147
+ maximumFractionDigits: 2
148
+ }), [o, i = "00"] = r.split(",");
149
+ return t ? `<span class="price-number">${o}<small style="margin-right: 4px">.${i}</small>₽</span>` : p("span", { class: "price-number" }, [
150
+ `${o}.`,
151
+ p("small", { style: { marginRight: "4px" } }, i),
149
152
  "₽"
150
153
  ]);
151
154
  };
@@ -154,12 +157,12 @@ export {
154
157
  R as breakpoints,
155
158
  B as dayjs,
156
159
  j as formatFileSize,
157
- $ as formatPrice,
158
- P as onClickOutside,
159
- A as openFileDialog,
160
+ C as formatPrice,
161
+ $ as onClickOutside,
162
+ N as openFileDialog,
160
163
  h as parseFileSize,
161
- M as parsePrice,
162
- N as priceFormat,
163
- C as sumPrices,
164
- U as useBodyScroll
164
+ U as parsePrice,
165
+ P as priceFormat,
166
+ D as sumPrices,
167
+ A as useBodyScroll
165
168
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@profitliga/ui",
3
- "version": "1.2.75",
3
+ "version": "1.2.77",
4
4
  "author": "Profit League<dev@pr-lg.ru>",
5
5
  "license": "MIT",
6
6
  "description": "Vue 3 UI component library with TypeScript and SCSS",