@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.
@@ -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.ts';
10
- export * from './priceFormat.util.ts';
9
+ export * from './breakpoints.util';
10
+ export * from './priceFormat.util';
@@ -1,26 +1,26 @@
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";
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 k() {
6
+ function z() {
7
7
  const e = /* @__PURE__ */ new Map();
8
8
  return {
9
- on(n, t) {
10
- const r = e.get(n) ?? [];
11
- r.push(t), e.set(n, r);
9
+ on(t, n) {
10
+ const r = e.get(t) ?? [];
11
+ r.push(n), e.set(t, r);
12
12
  },
13
- off(n, t) {
14
- const r = e.get(n);
13
+ off(t, n) {
14
+ const r = e.get(t);
15
15
  r && e.set(
16
- n,
17
- r.filter((l) => l !== t)
16
+ t,
17
+ r.filter((c) => c !== n)
18
18
  );
19
19
  },
20
- emit(n, t) {
21
- const r = e.get(n);
20
+ emit(t, n) {
21
+ const r = e.get(t);
22
22
  r && r.forEach(
23
- (l) => l(t)
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 g(e) {
33
- const n = S(e);
34
- return n?.$el ?? n;
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) : g(e);
37
+ return typeof e == "string" ? document.querySelector(e) : p(e);
38
38
  }
39
- function P(e, n, t = {}) {
39
+ function k(e, t, n = {}) {
40
40
  const r = w(e);
41
41
  if (!r) return () => {
42
42
  };
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);
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", i, { capture: !0 }), document.addEventListener("touchstart", i, { capture: !0 });
51
+ document.addEventListener("mousedown", l, { capture: !0 }), document.addEventListener("touchstart", l, { capture: !0 });
52
52
  const o = () => {
53
- document.removeEventListener("mousedown", i, { capture: !0 }), document.removeEventListener("touchstart", i, { capture: !0 }), d.delete(r);
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 $(e, n = "₽", t = 2) {
57
+ function C(e, t = "₽", n = 2) {
58
58
  return `${e.toLocaleString("en-US", {
59
- minimumFractionDigits: t,
60
- maximumFractionDigits: t
61
- }).replace(/,/g, " ")} ${n}`;
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
- const n = e.replace(/[^\d.,]/g, "").replace(",", ".");
68
- return parseFloat(n) || 0;
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 F = () => {
77
+ const h = () => {
78
78
  m++, m === 1 && !u && (u = v());
79
- }, b = () => {
79
+ }, F = () => {
80
80
  m > 0 && m--, m === 0 && u && (u(), u = null);
81
- }, C = () => ({
82
- unlockScroll: b,
83
- lockScroll: F
81
+ }, M = () => ({
82
+ unlockScroll: F,
83
+ lockScroll: h
84
84
  });
85
85
  function E(e) {
86
86
  if (!e) return;
87
- const n = Array.isArray(e) ? e : [e], t = {
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 n.flatMap((r) => t[r] || []).join(",");
100
+ return t.flatMap((r) => n[r] || []).join(",");
101
101
  }
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);
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 && (t.accept = r), t.addEventListener("change", (l) => {
108
- const i = l.target;
107
+ r && (n.accept = r), n.addEventListener("change", (c) => {
108
+ const l = c.target;
109
109
  let o = [];
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);
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(t), e.returnType === "raw") {
115
- n(o);
114
+ if (document.body.removeChild(n), e.returnType === "raw") {
115
+ t(o);
116
116
  return;
117
117
  }
118
- const c = o.map((a) => ({
118
+ const s = o.map((i) => ({
119
119
  id: crypto.randomUUID(),
120
- url: URL.createObjectURL(a),
121
- name: a.name,
122
- mime: a.type,
123
- size: a.size
120
+ url: URL.createObjectURL(i),
121
+ name: i.name,
122
+ mime: i.type,
123
+ size: i.size
124
124
  }));
125
- n(c);
126
- }), document.body.appendChild(t), t.click();
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
- k as EventBus,
142
- R as breakpoints,
130
+ z as EventBus,
131
+ D as breakpoints,
143
132
  q as dayjs,
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
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
- export declare const priceFormat: (price: string | number, returnHtml?: boolean) => string | VNode<RendererNode, RendererElement, {
2
+ declare const priceFormat: (price: string | number, returnHtml?: boolean) => string | VNode<RendererNode, RendererElement, {
3
3
  [key: string]: any;
4
4
  }>;
5
+ export default priceFormat;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@profitliga/ui",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
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",