mhz-ui 1.1.28 → 1.1.29
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/UiSelect/UiSelect.js +19 -19
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./UiSelect.css";
|
|
2
|
-
import { createElementBlock as n, openBlock as
|
|
2
|
+
import { createElementBlock as n, openBlock as i, createElementVNode as w, defineComponent as M, ref as c, computed as m, normalizeClass as u, createCommentVNode as b, createVNode as O, unref as I, Fragment as N, renderList as R, withKeys as v, toDisplayString as z } from "vue";
|
|
3
3
|
import { o as U } from "../index-CVBkjluR.js";
|
|
4
4
|
import T from "../UiInput/UiInput.js";
|
|
5
5
|
import { _ as K } from "../_plugin-vue_export-helper-CHgC5LLL.js";
|
|
@@ -9,8 +9,8 @@ const P = {
|
|
|
9
9
|
height: "16",
|
|
10
10
|
fill: "none"
|
|
11
11
|
};
|
|
12
|
-
function x(k,
|
|
13
|
-
return
|
|
12
|
+
function x(k, s) {
|
|
13
|
+
return i(), n("svg", P, s[0] || (s[0] = [
|
|
14
14
|
w("path", {
|
|
15
15
|
stroke: "#1F1F1F",
|
|
16
16
|
"stroke-linecap": "round",
|
|
@@ -25,8 +25,8 @@ const H = { render: x }, Q = {
|
|
|
25
25
|
height: "16",
|
|
26
26
|
fill: "none"
|
|
27
27
|
};
|
|
28
|
-
function q(k,
|
|
29
|
-
return
|
|
28
|
+
function q(k, s) {
|
|
29
|
+
return i(), n("svg", Q, s[0] || (s[0] = [
|
|
30
30
|
w("path", {
|
|
31
31
|
stroke: "#1F1F1F",
|
|
32
32
|
"stroke-linecap": "round",
|
|
@@ -47,14 +47,14 @@ const A = { render: q }, G = ["onClick", "onKeydown", "onMouseenter", "data-curr
|
|
|
47
47
|
isClearable: { type: Boolean }
|
|
48
48
|
},
|
|
49
49
|
emits: ["update:modelValue", "reachedBottom"],
|
|
50
|
-
setup(k, { emit:
|
|
51
|
-
const e = k,
|
|
50
|
+
setup(k, { emit: s }) {
|
|
51
|
+
const e = k, V = s, f = c(""), j = m(() => e.lang === "en" ? "Choose variant" : "Выбрать"), D = m(() => e.lang === "en" ? "Filter Variants" : "Фильтровать"), S = m(() => e.lang === "en" ? "No results" : "Нет результатов"), C = m(() => typeof e.options?.[0] == "object"), h = m(() => {
|
|
52
52
|
if (!e.options) return [];
|
|
53
53
|
let t = e.isLocaleField ? e.options.map((o) => ({ _id: o._id, title: o.title_en })) : [...e.options];
|
|
54
54
|
return C.value || (t = e.options.map((o) => ({ _id: o, title: o }))), e.isFilter ? t.filter((o) => o.title.toLowerCase().includes(f.value.toLowerCase())) : t;
|
|
55
55
|
}), r = c(!1), a = c(), y = c(), F = c([]);
|
|
56
56
|
function _(t) {
|
|
57
|
-
t < 0 || t ===
|
|
57
|
+
t < 0 || t === h.value.length || e.isFilter || F.value[t]?.focus();
|
|
58
58
|
}
|
|
59
59
|
function p() {
|
|
60
60
|
a.value?.removeEventListener("scroll", B, !0), f.value = "", r.value = !1;
|
|
@@ -65,16 +65,16 @@ const A = { render: q }, G = ["onClick", "onKeydown", "onMouseenter", "data-curr
|
|
|
65
65
|
}, 100));
|
|
66
66
|
}
|
|
67
67
|
function $(t) {
|
|
68
|
-
|
|
68
|
+
V("update:modelValue", C.value ? t : t._id), p();
|
|
69
69
|
}
|
|
70
70
|
function B() {
|
|
71
71
|
if (!a.value || !y.value) return;
|
|
72
|
-
a.value.getBoundingClientRect().y - y.value.getBoundingClientRect().y - y.value.scrollHeight + a.value.getBoundingClientRect().height > -100 &&
|
|
72
|
+
a.value.getBoundingClientRect().y - y.value.getBoundingClientRect().y - y.value.scrollHeight + a.value.getBoundingClientRect().height > -100 && V("reachedBottom");
|
|
73
73
|
}
|
|
74
74
|
const L = c();
|
|
75
75
|
return U(L, () => {
|
|
76
76
|
p();
|
|
77
|
-
}), (t, o) => (
|
|
77
|
+
}), (t, o) => (i(), n("div", {
|
|
78
78
|
class: u(t.$style.container),
|
|
79
79
|
ref_key: "containerElement",
|
|
80
80
|
ref: L
|
|
@@ -83,14 +83,14 @@ const A = { render: q }, G = ["onClick", "onKeydown", "onMouseenter", "data-curr
|
|
|
83
83
|
class: u(t.$style.input)
|
|
84
84
|
}, [
|
|
85
85
|
O(T, {
|
|
86
|
-
modelValue: typeof e.modelValue == "string" || typeof e.modelValue == "number" ? e.modelValue : e.modelValue?.title,
|
|
86
|
+
modelValue: typeof e.modelValue == "string" || typeof e.modelValue == "number" ? e.modelValue : e.isLocaleField ? e.modelValue?.title_en : e.modelValue?.title,
|
|
87
87
|
disabled: e.isDisabled,
|
|
88
88
|
onToggle: o[0] || (o[0] = (l) => r.value ? p() : E()),
|
|
89
89
|
mode: "select",
|
|
90
90
|
placeholder: j.value,
|
|
91
91
|
appendIcon: r.value ? I(A) : I(H)
|
|
92
92
|
}, null, 8, ["modelValue", "disabled", "placeholder", "appendIcon"]),
|
|
93
|
-
e.isFilter && r.value ? (
|
|
93
|
+
e.isFilter && r.value ? (i(), n("div", {
|
|
94
94
|
key: 0,
|
|
95
95
|
class: u(t.$style.filter)
|
|
96
96
|
}, [
|
|
@@ -102,25 +102,25 @@ const A = { render: q }, G = ["onClick", "onKeydown", "onMouseenter", "data-curr
|
|
|
102
102
|
isFocus: ""
|
|
103
103
|
}, null, 8, ["modelValue", "disabled", "placeholder"])
|
|
104
104
|
], 2)) : b("", !0),
|
|
105
|
-
e.isClearable && e.modelValue ? (
|
|
105
|
+
e.isClearable && e.modelValue ? (i(), n("button", {
|
|
106
106
|
key: 1,
|
|
107
|
-
onClick: o[2] || (o[2] = (l) =>
|
|
107
|
+
onClick: o[2] || (o[2] = (l) => V("update:modelValue", void 0)),
|
|
108
108
|
type: "button",
|
|
109
109
|
class: u(t.$style.clear)
|
|
110
110
|
}, " × ", 2)) : b("", !0)
|
|
111
111
|
], 2),
|
|
112
|
-
r.value ? (
|
|
112
|
+
r.value ? (i(), n("div", {
|
|
113
113
|
key: 0,
|
|
114
114
|
class: u(t.$style.options),
|
|
115
115
|
ref_key: "optionsElement",
|
|
116
116
|
ref: a
|
|
117
117
|
}, [
|
|
118
|
-
|
|
118
|
+
h.value.length ? (i(), n("div", {
|
|
119
119
|
key: 0,
|
|
120
120
|
ref_key: "optionsInnerElement",
|
|
121
121
|
ref: y
|
|
122
122
|
}, [
|
|
123
|
-
(
|
|
123
|
+
(i(!0), n(N, null, R(h.value, (l, g) => (i(), n("div", {
|
|
124
124
|
key: `${l}-${g}`,
|
|
125
125
|
onClick: (d) => $(l),
|
|
126
126
|
onKeydown: [
|
|
@@ -138,7 +138,7 @@ const A = { render: q }, G = ["onClick", "onKeydown", "onMouseenter", "data-curr
|
|
|
138
138
|
ref: F,
|
|
139
139
|
"data-current": typeof e.modelValue == "string" || typeof e.modelValue == "number" ? e.modelValue === l._id : e.modelValue?._id === l._id
|
|
140
140
|
}, z(l.title), 43, G))), 128))
|
|
141
|
-
], 512)) : (
|
|
141
|
+
], 512)) : (i(), n("div", {
|
|
142
142
|
key: 1,
|
|
143
143
|
onClick: p,
|
|
144
144
|
class: u(t.$style.option),
|