mhz-ui 1.2.52 → 1.2.53
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/UiModal/UiModal.css +1 -1
- package/dist/UiModal/UiModal.js +22 -22
- package/dist/UiSelect/UiSelect.js +83 -78
- package/package.json +1 -1
package/dist/UiModal/UiModal.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._backdrop_jn54y_1{position:fixed;inset:0;z-index:998;display:flex;align-items:center;justify-content:center;background-color:var(--color-gray-transparent)}._dialog_jn54y_11{z-index:999;padding:0;outline:none;background-color:var(--color-white);border:none;border-radius:16px}._modal_jn54y_20{display:flex;flex-direction:column;gap:12px;width:var(--v1c45205f);max-width:100%;height:auto;padding:24px;outline:none;box-shadow:0 0 16px 0 var(--color-gray-transparent)}._modal_jn54y_20[data-scrollable=true]{max-height:64dvh;overflow-y:auto}._header_jn54y_36{display:flex;justify-content:flex-end}._buttons_jn54y_41{display:flex;gap:16px}.dark ._modal_jn54y_20{background-color:var(--color-black);box-shadow:0 0 16px 0 var(--color-black-transparent)}.dark ._slot_jn54y_50{color:var(--color-white)}
|
package/dist/UiModal/UiModal.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import "./UiModal.css";
|
|
2
|
-
import { defineComponent as
|
|
2
|
+
import { defineComponent as V, useCssVars as $, computed as w, ref as B, onMounted as S, watch as j, createBlock as E, openBlock as n, Teleport as N, createElementBlock as c, createCommentVNode as u, normalizeClass as l, createElementVNode as a, mergeProps as U, withModifiers as m, createVNode as d, renderSlot as T, withCtx as f, createTextVNode as p, toDisplayString as _, unref as y, nextTick as A } from "vue";
|
|
3
3
|
import g from "../UiButton/UiButton.js";
|
|
4
4
|
import D from "../UiClose/UiClose.js";
|
|
5
|
-
import { M as
|
|
5
|
+
import { M as h } from "../index-DajWja1y.js";
|
|
6
6
|
import { _ as R } from "../_plugin-vue_export-helper-CHgC5LLL.js";
|
|
7
|
-
const z = ["data-scrollable"], G = /* @__PURE__ */
|
|
7
|
+
const z = ["data-scrollable"], G = /* @__PURE__ */ V({
|
|
8
8
|
inheritAttrs: !1,
|
|
9
9
|
__name: "UiModal",
|
|
10
10
|
props: {
|
|
@@ -15,31 +15,31 @@ const z = ["data-scrollable"], G = /* @__PURE__ */ v({
|
|
|
15
15
|
lang: { default: "ru" }
|
|
16
16
|
},
|
|
17
17
|
emits: ["update:modelValue", "confirm"],
|
|
18
|
-
setup(
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
setup(k, { emit: C }) {
|
|
19
|
+
$((e) => ({
|
|
20
|
+
v1c45205f: b.value
|
|
21
21
|
}));
|
|
22
|
-
const o =
|
|
23
|
-
function
|
|
22
|
+
const o = k, r = C, b = w(() => `${o.width}px`), s = B(null);
|
|
23
|
+
function v() {
|
|
24
24
|
A(() => {
|
|
25
25
|
s.value?.open ? s.value.close() : s.value?.showModal();
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
function M() {
|
|
29
|
-
|
|
29
|
+
r("confirm"), t();
|
|
30
30
|
}
|
|
31
31
|
function t() {
|
|
32
|
-
|
|
32
|
+
r("update:modelValue", !1);
|
|
33
33
|
}
|
|
34
|
-
return
|
|
35
|
-
|
|
34
|
+
return S(() => {
|
|
35
|
+
j(
|
|
36
36
|
() => o.modelValue,
|
|
37
37
|
() => {
|
|
38
|
-
|
|
38
|
+
v();
|
|
39
39
|
},
|
|
40
40
|
{ immediate: !0 }
|
|
41
41
|
);
|
|
42
|
-
}), (e,
|
|
42
|
+
}), (e, i) => (n(), E(N, { to: "body" }, [
|
|
43
43
|
o.modelValue ? (n(), c("div", {
|
|
44
44
|
key: 0,
|
|
45
45
|
class: l(e.$style.backdrop),
|
|
@@ -53,14 +53,14 @@ const z = ["data-scrollable"], G = /* @__PURE__ */ v({
|
|
|
53
53
|
}, e.$attrs), [
|
|
54
54
|
a("div", {
|
|
55
55
|
class: l(e.$style.modal),
|
|
56
|
-
onMousedown:
|
|
56
|
+
onMousedown: i[0] || (i[0] = m(() => {
|
|
57
57
|
}, ["stop"])),
|
|
58
58
|
"data-scrollable": o.isScrollable
|
|
59
59
|
}, [
|
|
60
60
|
a("div", {
|
|
61
61
|
class: l(e.$style.header)
|
|
62
62
|
}, [
|
|
63
|
-
|
|
63
|
+
d(D, { onClick: t })
|
|
64
64
|
], 2),
|
|
65
65
|
a("div", {
|
|
66
66
|
class: l(e.$style.slot)
|
|
@@ -71,18 +71,18 @@ const z = ["data-scrollable"], G = /* @__PURE__ */ v({
|
|
|
71
71
|
key: 0,
|
|
72
72
|
class: l(e.$style.buttons)
|
|
73
73
|
}, [
|
|
74
|
-
|
|
74
|
+
d(g, { onClick: M }, {
|
|
75
75
|
default: f(() => [
|
|
76
|
-
p(_(y(
|
|
76
|
+
p(_(y(h)[o.lang].confirm), 1)
|
|
77
77
|
]),
|
|
78
78
|
_: 1
|
|
79
79
|
}),
|
|
80
|
-
|
|
80
|
+
d(g, {
|
|
81
81
|
layout: "secondary",
|
|
82
82
|
onClick: t
|
|
83
83
|
}, {
|
|
84
84
|
default: f(() => [
|
|
85
|
-
p(_(y(
|
|
85
|
+
p(_(y(h)[o.lang].cancel), 1)
|
|
86
86
|
]),
|
|
87
87
|
_: 1
|
|
88
88
|
})
|
|
@@ -92,9 +92,9 @@ const z = ["data-scrollable"], G = /* @__PURE__ */ v({
|
|
|
92
92
|
], 34)) : u("", !0)
|
|
93
93
|
]));
|
|
94
94
|
}
|
|
95
|
-
}), P = "
|
|
95
|
+
}), P = "_backdrop_jn54y_1", q = "_dialog_jn54y_11", x = "_modal_jn54y_20", F = "_header_jn54y_36", H = "_buttons_jn54y_41", I = "_slot_jn54y_50", J = {
|
|
96
96
|
backdrop: P,
|
|
97
|
-
dialog:
|
|
97
|
+
dialog: q,
|
|
98
98
|
modal: x,
|
|
99
99
|
header: F,
|
|
100
100
|
buttons: H,
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import "./UiSelect.css";
|
|
2
|
-
import { createElementBlock as l, openBlock as s, createElementVNode as
|
|
3
|
-
import { o as
|
|
4
|
-
import
|
|
2
|
+
import { createElementBlock as l, openBlock as s, createElementVNode as B, defineComponent as W, ref as u, computed as b, normalizeClass as p, createCommentVNode as F, createVNode as M, unref as m, Fragment as X, renderList as Y, withKeys as f, withModifiers as D, toDisplayString as T } from "vue";
|
|
3
|
+
import { o as Z } from "../index-CGEFkmQc.js";
|
|
4
|
+
import N from "../UiInput/UiInput.js";
|
|
5
5
|
import { M as O } from "../index-DajWja1y.js";
|
|
6
|
-
import { _ as
|
|
7
|
-
const
|
|
6
|
+
import { _ as x } from "../_plugin-vue_export-helper-CHgC5LLL.js";
|
|
7
|
+
const ee = {
|
|
8
8
|
xmlns: "http://www.w3.org/2000/svg",
|
|
9
9
|
width: "16",
|
|
10
10
|
height: "16",
|
|
11
11
|
fill: "none"
|
|
12
12
|
};
|
|
13
|
-
function
|
|
14
|
-
return s(), l("svg",
|
|
15
|
-
|
|
13
|
+
function te(h, i) {
|
|
14
|
+
return s(), l("svg", ee, [...i[0] || (i[0] = [
|
|
15
|
+
B("path", {
|
|
16
16
|
stroke: "#1F1F1F",
|
|
17
17
|
"stroke-linecap": "round",
|
|
18
18
|
"stroke-linejoin": "round",
|
|
@@ -20,15 +20,15 @@ function X(h, i) {
|
|
|
20
20
|
}, null, -1)
|
|
21
21
|
])]);
|
|
22
22
|
}
|
|
23
|
-
const
|
|
23
|
+
const oe = { render: te }, ne = {
|
|
24
24
|
xmlns: "http://www.w3.org/2000/svg",
|
|
25
25
|
width: "16",
|
|
26
26
|
height: "16",
|
|
27
27
|
fill: "none"
|
|
28
28
|
};
|
|
29
|
-
function
|
|
30
|
-
return s(), l("svg",
|
|
31
|
-
|
|
29
|
+
function le(h, i) {
|
|
30
|
+
return s(), l("svg", ne, [...i[0] || (i[0] = [
|
|
31
|
+
B("path", {
|
|
32
32
|
stroke: "#1F1F1F",
|
|
33
33
|
"stroke-linecap": "round",
|
|
34
34
|
"stroke-linejoin": "round",
|
|
@@ -36,7 +36,7 @@ function x(h, i) {
|
|
|
36
36
|
}, null, -1)
|
|
37
37
|
])]);
|
|
38
38
|
}
|
|
39
|
-
const
|
|
39
|
+
const se = { render: le }, ie = { key: 0 }, re = ["onClick", "onKeydown", "onMouseenter", "data-current"], j = 232, ae = /* @__PURE__ */ W({
|
|
40
40
|
__name: "UiSelect",
|
|
41
41
|
props: {
|
|
42
42
|
modelValue: { default: void 0 },
|
|
@@ -49,123 +49,128 @@ const ee = { render: x }, te = { key: 0 }, oe = ["onClick", "onKeydown", "onMous
|
|
|
49
49
|
},
|
|
50
50
|
emits: ["update:modelValue", "reachedBottom"],
|
|
51
51
|
setup(h, { emit: i }) {
|
|
52
|
-
const t = h, k = i,
|
|
52
|
+
const t = h, k = i, v = u(""), c = u(!1), V = u(!1), d = u(), r = u(), g = u(), E = u([]), $ = b(() => {
|
|
53
53
|
const e = t.options?.[0];
|
|
54
54
|
return e != null && typeof e == "object";
|
|
55
|
-
}),
|
|
55
|
+
}), I = (e) => e !== null && (typeof e == "string" || typeof e == "number"), w = b(() => {
|
|
56
56
|
if (!t.options?.length) return [];
|
|
57
57
|
const e = $.value ? [...t.options] : t.options.map((o) => ({ _id: String(o), title: String(o) }));
|
|
58
|
-
return t.isFilter ? e.filter((o) => o.title.toLowerCase().includes(
|
|
59
|
-
}),
|
|
60
|
-
if (
|
|
58
|
+
return t.isFilter ? e.filter((o) => o.title.toLowerCase().includes(v.value.toLowerCase())) : e;
|
|
59
|
+
}), A = b(() => {
|
|
60
|
+
if (I(t.modelValue)) return t.modelValue;
|
|
61
61
|
if (!t.modelValue) return "";
|
|
62
62
|
const e = t.modelValue;
|
|
63
63
|
return t.isLocaleField ? e.title_en ?? "" : e.title ?? "";
|
|
64
|
-
}),
|
|
65
|
-
e < 0 || e >= w.value.length || t.isFilter ||
|
|
66
|
-
},
|
|
67
|
-
|
|
68
|
-
},
|
|
69
|
-
if (!
|
|
70
|
-
const e =
|
|
71
|
-
|
|
64
|
+
}), H = (e, o) => `${e._id || e.title}-${o}`, K = (e) => t.isLocaleField ? e.title_en : e.title, P = (e) => I(t.modelValue) ? t.modelValue === (e._id || e.title) : t.modelValue ? t.modelValue._id === e._id : !1, _ = (e) => {
|
|
65
|
+
e < 0 || e >= w.value.length || t.isFilter || E.value[e]?.focus();
|
|
66
|
+
}, G = () => k("update:modelValue", void 0), S = () => {
|
|
67
|
+
c.value ? y() : Q();
|
|
68
|
+
}, z = () => {
|
|
69
|
+
if (!d.value) return !1;
|
|
70
|
+
const e = d.value.closest("dialog");
|
|
71
|
+
if (!e) {
|
|
72
|
+
const R = d.value.getBoundingClientRect(), U = window.innerHeight - R.bottom, J = R.top;
|
|
73
|
+
return U < j && J > U;
|
|
74
|
+
}
|
|
75
|
+
const o = e.getBoundingClientRect(), n = d.value.getBoundingClientRect(), a = o.bottom - n.bottom, q = n.top - o.top;
|
|
76
|
+
return a < j && q > a;
|
|
72
77
|
};
|
|
73
78
|
function y() {
|
|
74
|
-
r.value?.removeEventListener("scroll",
|
|
79
|
+
r.value?.removeEventListener("scroll", L, !0), v.value = "", c.value = !1, V.value = !1;
|
|
75
80
|
}
|
|
76
|
-
function
|
|
77
|
-
t.isDisabled || (V.value =
|
|
78
|
-
r.value?.scrollTo(0, 0),
|
|
81
|
+
function Q() {
|
|
82
|
+
t.isDisabled || (V.value = z(), c.value = !0, t.isFilter || setTimeout(() => {
|
|
83
|
+
r.value?.scrollTo(0, 0), _(0), r.value?.addEventListener("scroll", L, !0);
|
|
79
84
|
}, 100));
|
|
80
85
|
}
|
|
81
86
|
function C(e) {
|
|
82
87
|
const o = $.value ? e : e._id || e.title;
|
|
83
88
|
k("update:modelValue", o), y();
|
|
84
89
|
}
|
|
85
|
-
function
|
|
86
|
-
if (!r.value || !
|
|
87
|
-
r.value.getBoundingClientRect().y -
|
|
90
|
+
function L() {
|
|
91
|
+
if (!r.value || !g.value) return;
|
|
92
|
+
r.value.getBoundingClientRect().y - g.value.getBoundingClientRect().y - g.value.scrollHeight + r.value.getBoundingClientRect().height > -100 && k("reachedBottom");
|
|
88
93
|
}
|
|
89
|
-
return
|
|
90
|
-
class:
|
|
94
|
+
return Z(d, y), (e, o) => (s(), l("div", {
|
|
95
|
+
class: p(e.$style.container),
|
|
91
96
|
ref_key: "containerElement",
|
|
92
|
-
ref:
|
|
97
|
+
ref: d
|
|
93
98
|
}, [
|
|
94
|
-
|
|
95
|
-
class:
|
|
99
|
+
B("div", {
|
|
100
|
+
class: p(e.$style.input)
|
|
96
101
|
}, [
|
|
97
|
-
M(
|
|
98
|
-
modelValue:
|
|
102
|
+
M(N, {
|
|
103
|
+
modelValue: A.value,
|
|
99
104
|
disabled: t.isDisabled,
|
|
100
|
-
onToggle:
|
|
105
|
+
onToggle: S,
|
|
101
106
|
mode: "select",
|
|
102
|
-
placeholder:
|
|
103
|
-
appendIcon:
|
|
107
|
+
placeholder: m(O)[t.lang].choose,
|
|
108
|
+
appendIcon: c.value ? m(se) : m(oe)
|
|
104
109
|
}, null, 8, ["modelValue", "disabled", "placeholder", "appendIcon"]),
|
|
105
|
-
t.isFilter &&
|
|
106
|
-
M(
|
|
107
|
-
modelValue:
|
|
108
|
-
"onUpdate:modelValue": o[0] || (o[0] = (n) =>
|
|
110
|
+
t.isFilter && c.value ? (s(), l("div", ie, [
|
|
111
|
+
M(N, {
|
|
112
|
+
modelValue: v.value,
|
|
113
|
+
"onUpdate:modelValue": o[0] || (o[0] = (n) => v.value = n),
|
|
109
114
|
disabled: t.isDisabled,
|
|
110
|
-
placeholder:
|
|
115
|
+
placeholder: m(O)[t.lang].filter,
|
|
111
116
|
isFocus: ""
|
|
112
117
|
}, null, 8, ["modelValue", "disabled", "placeholder"])
|
|
113
118
|
])) : F("", !0),
|
|
114
119
|
t.isClearable && t.modelValue ? (s(), l("button", {
|
|
115
120
|
key: 1,
|
|
116
|
-
onClick:
|
|
121
|
+
onClick: G,
|
|
117
122
|
type: "button",
|
|
118
|
-
class:
|
|
123
|
+
class: p(e.$style.clear)
|
|
119
124
|
}, " × ", 2)) : F("", !0)
|
|
120
125
|
], 2),
|
|
121
|
-
|
|
126
|
+
c.value ? (s(), l("div", {
|
|
122
127
|
key: 0,
|
|
123
|
-
class:
|
|
128
|
+
class: p([e.$style.options, { [e.$style.optionsUp]: V.value }]),
|
|
124
129
|
ref_key: "optionsElement",
|
|
125
130
|
ref: r
|
|
126
131
|
}, [
|
|
127
132
|
w.value.length > 0 ? (s(), l("div", {
|
|
128
133
|
key: 0,
|
|
129
134
|
ref_key: "optionsInnerElement",
|
|
130
|
-
ref:
|
|
135
|
+
ref: g
|
|
131
136
|
}, [
|
|
132
|
-
(s(!0), l(
|
|
133
|
-
key:
|
|
137
|
+
(s(!0), l(X, null, Y(w.value, (n, a) => (s(), l("div", {
|
|
138
|
+
key: H(n, a),
|
|
134
139
|
onClick: () => C(n),
|
|
135
140
|
onKeydown: [
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
+
f(() => C(n), ["enter"]),
|
|
142
|
+
f(() => C(n), ["space"]),
|
|
143
|
+
f(D(() => _(a - 1), ["prevent"]), ["up"]),
|
|
144
|
+
f(D(() => _(a + 1), ["prevent"]), ["down"]),
|
|
145
|
+
f(S, ["esc"])
|
|
141
146
|
],
|
|
142
|
-
onMouseenter: () =>
|
|
143
|
-
class:
|
|
147
|
+
onMouseenter: () => _(a),
|
|
148
|
+
class: p(e.$style.option),
|
|
144
149
|
tabindex: "0",
|
|
145
150
|
ref_for: !0,
|
|
146
151
|
ref_key: "optionElement",
|
|
147
|
-
ref:
|
|
148
|
-
"data-current":
|
|
149
|
-
},
|
|
152
|
+
ref: E,
|
|
153
|
+
"data-current": P(n)
|
|
154
|
+
}, T(K(n)), 43, re))), 128))
|
|
150
155
|
], 512)) : (s(), l("div", {
|
|
151
156
|
key: 1,
|
|
152
157
|
onClick: y,
|
|
153
|
-
class:
|
|
158
|
+
class: p(e.$style.option),
|
|
154
159
|
tabindex: "0"
|
|
155
|
-
},
|
|
160
|
+
}, T(m(O)[t.lang].noResults), 3))
|
|
156
161
|
], 2)) : F("", !0)
|
|
157
162
|
], 2));
|
|
158
163
|
}
|
|
159
|
-
}),
|
|
160
|
-
container:
|
|
161
|
-
input:
|
|
162
|
-
clear:
|
|
163
|
-
options:
|
|
164
|
-
optionsUp:
|
|
165
|
-
option:
|
|
166
|
-
},
|
|
167
|
-
$style:
|
|
168
|
-
},
|
|
164
|
+
}), ue = "_container_1m448_1", ce = "_input_1m448_10", de = "_clear_1m448_16", pe = "_options_1m448_31", me = "_optionsUp_1m448_44", fe = "_option_1m448_31", ve = {
|
|
165
|
+
container: ue,
|
|
166
|
+
input: ce,
|
|
167
|
+
clear: de,
|
|
168
|
+
options: pe,
|
|
169
|
+
optionsUp: me,
|
|
170
|
+
option: fe
|
|
171
|
+
}, ge = {
|
|
172
|
+
$style: ve
|
|
173
|
+
}, we = /* @__PURE__ */ x(ae, [["__cssModules", ge]]);
|
|
169
174
|
export {
|
|
170
|
-
|
|
175
|
+
we as default
|
|
171
176
|
};
|