prlg-ui 1.8.296 → 1.8.298

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.
@@ -1,260 +0,0 @@
1
- import { inject as O, ref as h, onMounted as z, onUnmounted as T, watch as V, provide as R, defineComponent as w, useId as C, computed as I, createElementBlock as d, openBlock as o, normalizeClass as x, createCommentVNode as f, createBlock as b, createVNode as _, unref as v, resolveDynamicComponent as N, toDisplayString as y, Teleport as A, Transition as P, withCtx as Z, normalizeStyle as j, createElementVNode as m, useTemplateRef as W, Fragment as Y } from "vue";
2
- import { F as D, E as L, W as K, P as U } from "./FileIcon-D68SKu3j.js";
3
- import { C as E, _ as F, E as q } from "./EyeIcon-D6SZWKKH.js";
4
- import { f as M } from "./parseFileSize.util-EJk-rAI5.js";
5
- class G {
6
- stack = [];
7
- baseZIndex = {
8
- confirm: 1400,
9
- modal: 1300,
10
- drawer: 1200,
11
- popover: 1100,
12
- tooltip: 1e3
13
- };
14
- step = 10;
15
- // шаг между "корневыми" оверлеями одного типа
16
- childStep = 50;
17
- // шаг для вложенных (popover внутри modal и т.д.) - увеличиваем для гарантии
18
- idCounter = 0;
19
- listeners = /* @__PURE__ */ new Set();
20
- subscribe(a) {
21
- return this.listeners.add(a), () => this.listeners.delete(a);
22
- }
23
- notify() {
24
- this.listeners.forEach((a) => a());
25
- }
26
- register(a, l) {
27
- const i = ++this.idCounter, t = l ? this.stack.find((c) => c.id === l) : void 0;
28
- let n;
29
- if (t)
30
- n = t.zIndex + this.childStep;
31
- else {
32
- const c = this.stack.filter((u) => u.type === a && !u.parentId);
33
- n = (c.length ? Math.max(...c.map((u) => u.zIndex)) : this.baseZIndex[a]) + this.step;
34
- }
35
- const s = { id: i, type: a, parentId: l ?? null, zIndex: n };
36
- return this.stack.push(s), this.notify(), s;
37
- }
38
- unregister(a) {
39
- this.stack = this.stack.filter((l) => l.id !== a), this.notify();
40
- }
41
- getTop() {
42
- return this.stack.length ? this.stack[this.stack.length - 1] : null;
43
- }
44
- isTop(a) {
45
- return this.getTop()?.id === a;
46
- }
47
- getStack() {
48
- return [...this.stack];
49
- }
50
- }
51
- const k = new G(), S = Symbol("OVERLAY_PARENT");
52
- function H(e) {
53
- const a = O(S, null), l = h(null);
54
- return z(() => {
55
- l.value = k.register(e, a ?? null);
56
- }), T(() => {
57
- l.value && k.unregister(l.value.id);
58
- }), V(l, (i) => {
59
- i && R(S, i.id);
60
- }, { immediate: !0 }), {
61
- zIndex: l,
62
- isTop: () => l.value ? k.isTop(l.value.id) : !1
63
- };
64
- }
65
- function J(e) {
66
- return e.startsWith("image/") ? "image" : e === "application/pdf" ? "pdf" : e === "application/msword" || e === "application/vnd.openxmlformats-officedocument.wordprocessingml.document" ? "word" : e === "application/vnd.ms-excel" || e === "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" ? "excel" : "other";
67
- }
68
- const Q = {
69
- key: 1,
70
- class: "file__title"
71
- }, X = {
72
- key: 2,
73
- class: "file__info"
74
- }, ee = {
75
- key: 0,
76
- class: "file__type"
77
- }, te = {
78
- key: 1,
79
- class: "file__info-separator"
80
- }, le = {
81
- key: 2,
82
- class: "file__size"
83
- }, se = /* @__PURE__ */ w({
84
- __name: "File",
85
- props: {
86
- file: {},
87
- viewName: { type: Boolean, default: !1 },
88
- outlined: { type: Boolean, default: !0 },
89
- removable: { type: Boolean }
90
- },
91
- emits: ["remove"],
92
- setup(e, { emit: a }) {
93
- const l = a, i = C(), t = h(null);
94
- async function n(r, u = "image") {
95
- const p = await (await fetch(r)).blob(), $ = p.type.split("/")[1] || "", B = $ ? `${u}.${$}` : u;
96
- return new File([p], B, { type: p.type });
97
- }
98
- const s = I(() => t.value && t.value.mime ? J(t.value.mime) : null), c = I(() => {
99
- switch (s.value) {
100
- case "pdf":
101
- return U;
102
- case "word":
103
- return K;
104
- case "excel":
105
- return L;
106
- case "other":
107
- default:
108
- return D;
109
- }
110
- });
111
- return z(async () => {
112
- if (typeof e.file == "string") {
113
- const r = await n(e.file);
114
- t.value = {
115
- id: i,
116
- url: e.file,
117
- name: r.name,
118
- mime: r.type,
119
- size: r.size
120
- };
121
- } else
122
- t.value = e.file;
123
- }), (r, u) => (o(), d("div", {
124
- class: x(["file", { "file--outlined": r.outlined }])
125
- }, [
126
- r.removable && typeof r.file != "string" ? (o(), d("button", {
127
- key: 0,
128
- class: "file__remove",
129
- onClick: u[0] || (u[0] = (g) => l("remove", r.file))
130
- }, [
131
- _(v(E))
132
- ])) : f("", !0),
133
- (o(), b(N(c.value), { class: "file__icon" })),
134
- t.value && t.value.name && r.viewName ? (o(), d("div", Q, y(t.value ? t.value.name.split(".")[0] : "unknown"), 1)) : f("", !0),
135
- t.value ? (o(), d("div", X, [
136
- t.value.mime ? (o(), d("div", ee, y(s.value), 1)) : f("", !0),
137
- t.value.mime && t.value.size ? (o(), d("div", te)) : f("", !0),
138
- t.value.size ? (o(), d("div", le, y(t.value ? v(M)(t.value.size) : "0 Б"), 1)) : f("", !0)
139
- ])) : f("", !0)
140
- ], 2));
141
- }
142
- }), _e = /* @__PURE__ */ F(se, [["__scopeId", "data-v-7c3d1c11"]]), ae = { class: "image-full-modal__wrapper" }, ie = { class: "image-full-modal__header" }, ne = { class: "image-full-modal__main" }, oe = ["src", "alt"], re = /* @__PURE__ */ w({
143
- __name: "ImageFullModal",
144
- props: {
145
- src: {},
146
- alt: {}
147
- },
148
- setup(e, { expose: a }) {
149
- const l = h(!1), { zIndex: i } = H("modal");
150
- return a({
151
- open: () => {
152
- l.value = !0;
153
- },
154
- close: () => {
155
- l.value = !1;
156
- }
157
- }), (t, n) => (o(), b(A, { to: "body" }, [
158
- _(P, { name: "fade" }, {
159
- default: Z(() => [
160
- l.value ? (o(), d("div", {
161
- key: 0,
162
- class: "image-full-modal",
163
- style: j({ zIndex: v(i)?.zIndex })
164
- }, [
165
- m("div", {
166
- class: "image-full-modal__overlay",
167
- onClick: n[0] || (n[0] = (s) => l.value = !1)
168
- }),
169
- m("div", ae, [
170
- m("div", ie, [
171
- m("button", {
172
- class: "image-full-modal__close",
173
- onClick: n[1] || (n[1] = (s) => l.value = !1)
174
- }, [
175
- _(v(E))
176
- ])
177
- ]),
178
- m("div", ne, [
179
- m("img", {
180
- src: t.src,
181
- alt: t.alt
182
- }, null, 8, oe)
183
- ]),
184
- n[2] || (n[2] = m("div", { class: "image-full-modal__footer" }, null, -1))
185
- ])
186
- ], 4)) : f("", !0)
187
- ]),
188
- _: 1
189
- })
190
- ]));
191
- }
192
- }), ue = /* @__PURE__ */ F(re, [["__scopeId", "data-v-26b5c867"]]), ce = ["src", "alt"], de = {
193
- key: 1,
194
- class: "image__info"
195
- }, fe = {
196
- key: 0,
197
- class: "image__size"
198
- }, me = /* @__PURE__ */ w({
199
- __name: "Image",
200
- props: {
201
- file: {},
202
- alt: {},
203
- size: { default: "medium" },
204
- fullScreen: { type: Boolean },
205
- viewInfo: { type: Boolean, default: !1 }
206
- },
207
- setup(e) {
208
- const a = C(), l = W("imageFullModal"), i = h(null);
209
- async function t(s, c = "image") {
210
- const u = await (await fetch(s)).blob(), g = u.type.split("/")[1] || "", p = g ? `${c}.${g}` : c;
211
- return new File([u], p, { type: u.type });
212
- }
213
- const n = I(() => typeof e.file == "string" ? e.file : e.file.url);
214
- return z(async () => {
215
- if (e.viewInfo)
216
- if (typeof e.file == "string") {
217
- const s = await t(e.file);
218
- i.value = {
219
- id: a,
220
- url: e.file,
221
- name: s.name,
222
- mime: s.type,
223
- size: s.size
224
- };
225
- } else
226
- i.value = e.file;
227
- }), (s, c) => (o(), d(Y, null, [
228
- m("div", {
229
- class: x(["image", `image--${s.size}`, { "image--full-screen": s.fullScreen }])
230
- }, [
231
- s.fullScreen ? (o(), d("div", {
232
- key: 0,
233
- class: "image__overlay",
234
- onClick: c[0] || (c[0] = (r) => l.value?.open())
235
- }, [
236
- _(v(q))
237
- ])) : f("", !0),
238
- m("img", {
239
- src: n.value,
240
- alt: s.alt
241
- }, null, 8, ce),
242
- s.viewInfo && i.value && (i.value.mime || i.value.size) && s.size === "large" ? (o(), d("div", de, [
243
- i.value.size ? (o(), d("div", fe, y(i.value ? v(M)(i.value.size) : "0 Б"), 1)) : f("", !0)
244
- ])) : f("", !0)
245
- ], 2),
246
- s.fullScreen ? (o(), b(ue, {
247
- key: 0,
248
- ref: "imageFullModal",
249
- src: n.value,
250
- alt: s.alt
251
- }, null, 8, ["src", "alt"])) : f("", !0)
252
- ], 64));
253
- }
254
- }), he = /* @__PURE__ */ F(me, [["__scopeId", "data-v-903c99cc"]]);
255
- export {
256
- _e as F,
257
- he as I,
258
- J as g,
259
- H as u
260
- };
@@ -1 +0,0 @@
1
- "use strict";const m=require("vue"),e=require("./ru-aZ6Jw9om.cjs"),u=new WeakMap;function f(n){const r=m.unref(n);return r?.$el??r}function x(n){return typeof n=="string"?document.querySelector(n):f(n)}function y(n,r,o={}){const t=x(n);if(!t)return()=>{};const i=u.get(t);i&&(i(),u.delete(t));const a=d=>{const c=d.target instanceof Node?d.target:null;if(!c)return;const p=(m.toValue(o.ignore)??[]).map(s=>typeof s=="string"?document.querySelector(s):f(s)).filter(s=>s!=null);t.contains(c)||p.some(s=>s.contains(c))||r(d)};document.addEventListener("mousedown",a,{capture:!0}),document.addEventListener("touchstart",a,{capture:!0});const l=()=>{document.removeEventListener("mousedown",a,{capture:!0}),document.removeEventListener("touchstart",a,{capture:!0}),u.delete(t)};return u.set(t,l),l}e.dayjs.extend(e.localizedFormat);e.dayjs.extend(e.relativeTime);e.dayjs.extend(e.isToday);e.dayjs.extend(e.isBetween);e.dayjs.extend(e.isSameOrBefore);e.dayjs.extend(e.isSameOrAfter);e.dayjs.extend(e.duration);e.dayjs.extend(e.customParseFormat);e.dayjs.extend(e.dayOfYear);e.dayjs.locale("ru");const g=n=>{const r=["b","kb","mb","gb","tb"],o=n.match(/[a-zA-Z]+/)?.[0]||"b",t=parseFloat(n.replace(o,"")),i=r.indexOf(o.toLowerCase());return t*Math.pow(1024,i)};function v(n){if(isNaN(n)||n<0)return"0 Б";const r=["Б","КБ","МБ","ГБ","ТБ"];let o=0,t=n;for(;t>=1024&&o<r.length-1;)t=t/1024,o++;return`${t%1===0?t:t.toFixed(0)} ${r[o]}`}exports.formatFileSize=v;exports.onClickOutside=y;exports.parseFileSize=g;
@@ -1,55 +0,0 @@
1
- import { toValue as p, unref as x } from "vue";
2
- import { d as n, l as g, r as v, i as w, a as E, b as h, c as F, e as L, f as S, g as b } from "./ru-DQ91TLXh.js";
3
- const u = /* @__PURE__ */ new WeakMap();
4
- function m(t) {
5
- const r = x(t);
6
- return r?.$el ?? r;
7
- }
8
- function y(t) {
9
- return typeof t == "string" ? document.querySelector(t) : m(t);
10
- }
11
- function z(t, r, o = {}) {
12
- const e = y(t);
13
- if (!e) return () => {
14
- };
15
- const s = u.get(e);
16
- s && (s(), u.delete(e));
17
- const i = (c) => {
18
- const d = c.target instanceof Node ? c.target : null;
19
- if (!d) return;
20
- const f = (p(o.ignore) ?? []).map((a) => typeof a == "string" ? document.querySelector(a) : m(a)).filter((a) => a != null);
21
- e.contains(d) || f.some((a) => a.contains(d)) || r(c);
22
- };
23
- document.addEventListener("mousedown", i, { capture: !0 }), document.addEventListener("touchstart", i, { capture: !0 });
24
- const l = () => {
25
- document.removeEventListener("mousedown", i, { capture: !0 }), document.removeEventListener("touchstart", i, { capture: !0 }), u.delete(e);
26
- };
27
- return u.set(e, l), l;
28
- }
29
- n.extend(g);
30
- n.extend(v);
31
- n.extend(w);
32
- n.extend(E);
33
- n.extend(h);
34
- n.extend(F);
35
- n.extend(L);
36
- n.extend(S);
37
- n.extend(b);
38
- n.locale("ru");
39
- const C = (t) => {
40
- const r = ["b", "kb", "mb", "gb", "tb"], o = t.match(/[a-zA-Z]+/)?.[0] || "b", e = parseFloat(t.replace(o, "")), s = r.indexOf(o.toLowerCase());
41
- return e * Math.pow(1024, s);
42
- };
43
- function T(t) {
44
- if (isNaN(t) || t < 0) return "0 Б";
45
- const r = ["Б", "КБ", "МБ", "ГБ", "ТБ"];
46
- let o = 0, e = t;
47
- for (; e >= 1024 && o < r.length - 1; )
48
- e = e / 1024, o++;
49
- return `${e % 1 === 0 ? e : e.toFixed(0)} ${r[o]}`;
50
- }
51
- export {
52
- T as f,
53
- z as o,
54
- C as p
55
- };