mhz-ui 1.1.21 → 1.1.22
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.d.ts +3 -3
- package/dist/UiSelect/UiSelect.js +24 -24
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ interface IOption {
|
|
|
3
3
|
title: string;
|
|
4
4
|
}
|
|
5
5
|
interface IProps {
|
|
6
|
-
modelValue?: string | number | IOption;
|
|
6
|
+
modelValue?: string | number | IOption | null;
|
|
7
7
|
options?: string[] | number[] | IOption[];
|
|
8
8
|
isFilter?: boolean;
|
|
9
9
|
isDisabled?: boolean;
|
|
@@ -11,10 +11,10 @@ interface IProps {
|
|
|
11
11
|
isClearable?: boolean;
|
|
12
12
|
}
|
|
13
13
|
declare const _default: import('vue').DefineComponent<IProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
14
|
-
"update:modelValue": (value: string | number | IOption | undefined) => any;
|
|
14
|
+
"update:modelValue": (value: string | number | IOption | null | undefined) => any;
|
|
15
15
|
reachedBottom: () => any;
|
|
16
16
|
}, string, import('vue').PublicProps, Readonly<IProps> & Readonly<{
|
|
17
|
-
"onUpdate:modelValue"?: ((value: string | number | IOption | undefined) => any) | undefined;
|
|
17
|
+
"onUpdate:modelValue"?: ((value: string | number | IOption | null | undefined) => any) | undefined;
|
|
18
18
|
onReachedBottom?: (() => any) | undefined;
|
|
19
19
|
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
20
20
|
export default _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./UiSelect.css";
|
|
2
|
-
import { createElementBlock as
|
|
2
|
+
import { createElementBlock as n, openBlock as s, createElementVNode as w, defineComponent as M, ref as c, computed as m, normalizeClass as u, createCommentVNode as b, createVNode as I, unref as z, Fragment as N, renderList as R, withKeys as v, toDisplayString as L } 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";
|
|
@@ -10,7 +10,7 @@ const P = {
|
|
|
10
10
|
fill: "none"
|
|
11
11
|
};
|
|
12
12
|
function x(k, i) {
|
|
13
|
-
return s(),
|
|
13
|
+
return s(), n("svg", P, i[0] || (i[0] = [
|
|
14
14
|
w("path", {
|
|
15
15
|
stroke: "#1F1F1F",
|
|
16
16
|
"stroke-linecap": "round",
|
|
@@ -26,7 +26,7 @@ const H = { render: x }, Q = {
|
|
|
26
26
|
fill: "none"
|
|
27
27
|
};
|
|
28
28
|
function q(k, i) {
|
|
29
|
-
return s(),
|
|
29
|
+
return s(), n("svg", Q, i[0] || (i[0] = [
|
|
30
30
|
w("path", {
|
|
31
31
|
stroke: "#1F1F1F",
|
|
32
32
|
"stroke-linecap": "round",
|
|
@@ -47,13 +47,13 @@ const A = { render: q }, G = ["onClick", "onKeydown", "onMouseenter", "data-curr
|
|
|
47
47
|
},
|
|
48
48
|
emits: ["update:modelValue", "reachedBottom"],
|
|
49
49
|
setup(k, { emit: i }) {
|
|
50
|
-
const e = k, h = i, 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"),
|
|
50
|
+
const e = k, h = i, 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"), V = m(() => {
|
|
51
51
|
if (!e.options) return [];
|
|
52
52
|
let t = e.options;
|
|
53
53
|
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;
|
|
54
54
|
}), r = c(!1), a = c(), y = c(), F = c([]);
|
|
55
55
|
function _(t) {
|
|
56
|
-
t < 0 || t ===
|
|
56
|
+
t < 0 || t === V.value.length || e.isFilter || F.value[t]?.focus();
|
|
57
57
|
}
|
|
58
58
|
function p() {
|
|
59
59
|
a.value?.removeEventListener("scroll", B, !0), f.value = "", r.value = !1;
|
|
@@ -63,7 +63,7 @@ const A = { render: q }, G = ["onClick", "onKeydown", "onMouseenter", "data-curr
|
|
|
63
63
|
a.value?.scrollTo(0, 0), _(0), a.value?.addEventListener("scroll", B, !0);
|
|
64
64
|
}, 100));
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function $(t) {
|
|
67
67
|
h("update:modelValue", C.value ? t : t._id), p();
|
|
68
68
|
}
|
|
69
69
|
function B() {
|
|
@@ -73,7 +73,7 @@ const A = { render: q }, G = ["onClick", "onKeydown", "onMouseenter", "data-curr
|
|
|
73
73
|
const O = c();
|
|
74
74
|
return U(O, () => {
|
|
75
75
|
p();
|
|
76
|
-
}), (t, o) => (s(),
|
|
76
|
+
}), (t, o) => (s(), n("div", {
|
|
77
77
|
class: u(t.$style.container),
|
|
78
78
|
ref_key: "containerElement",
|
|
79
79
|
ref: O
|
|
@@ -84,47 +84,47 @@ const A = { render: q }, G = ["onClick", "onKeydown", "onMouseenter", "data-curr
|
|
|
84
84
|
I(T, {
|
|
85
85
|
modelValue: typeof e.modelValue == "string" || typeof e.modelValue == "number" ? e.modelValue : e.modelValue?.title,
|
|
86
86
|
disabled: e.isDisabled,
|
|
87
|
-
onToggle: o[0] || (o[0] = (
|
|
87
|
+
onToggle: o[0] || (o[0] = (l) => r.value ? p() : E()),
|
|
88
88
|
mode: "select",
|
|
89
89
|
placeholder: j.value,
|
|
90
90
|
appendIcon: r.value ? z(A) : z(H)
|
|
91
91
|
}, null, 8, ["modelValue", "disabled", "placeholder", "appendIcon"]),
|
|
92
|
-
e.isFilter && r.value ? (s(),
|
|
92
|
+
e.isFilter && r.value ? (s(), n("div", {
|
|
93
93
|
key: 0,
|
|
94
94
|
class: u(t.$style.filter)
|
|
95
95
|
}, [
|
|
96
96
|
I(T, {
|
|
97
97
|
modelValue: f.value,
|
|
98
|
-
"onUpdate:modelValue": o[1] || (o[1] = (
|
|
98
|
+
"onUpdate:modelValue": o[1] || (o[1] = (l) => f.value = l),
|
|
99
99
|
disabled: e.isDisabled,
|
|
100
100
|
placeholder: D.value,
|
|
101
101
|
isFocus: ""
|
|
102
102
|
}, null, 8, ["modelValue", "disabled", "placeholder"])
|
|
103
103
|
], 2)) : b("", !0),
|
|
104
|
-
e.isClearable ? (s(),
|
|
104
|
+
e.isClearable && e.modelValue ? (s(), n("button", {
|
|
105
105
|
key: 1,
|
|
106
|
-
onClick: o[2] || (o[2] = (
|
|
106
|
+
onClick: o[2] || (o[2] = (l) => h("update:modelValue", null)),
|
|
107
107
|
type: "button",
|
|
108
108
|
class: u(t.$style.clear)
|
|
109
109
|
}, " × ", 2)) : b("", !0)
|
|
110
110
|
], 2),
|
|
111
|
-
r.value ? (s(),
|
|
111
|
+
r.value ? (s(), n("div", {
|
|
112
112
|
key: 0,
|
|
113
113
|
class: u(t.$style.options),
|
|
114
114
|
ref_key: "optionsElement",
|
|
115
115
|
ref: a
|
|
116
116
|
}, [
|
|
117
|
-
|
|
117
|
+
V.value.length ? (s(), n("div", {
|
|
118
118
|
key: 0,
|
|
119
119
|
ref_key: "optionsInnerElement",
|
|
120
120
|
ref: y
|
|
121
121
|
}, [
|
|
122
|
-
(s(!0),
|
|
123
|
-
key: `${
|
|
124
|
-
onClick: (d) =>
|
|
122
|
+
(s(!0), n(N, null, R(V.value, (l, g) => (s(), n("div", {
|
|
123
|
+
key: `${l}-${g}`,
|
|
124
|
+
onClick: (d) => $(l),
|
|
125
125
|
onKeydown: [
|
|
126
|
-
v((d) =>
|
|
127
|
-
v((d) =>
|
|
126
|
+
v((d) => $(l), ["enter"]),
|
|
127
|
+
v((d) => $(l), ["space"]),
|
|
128
128
|
v((d) => _(g - 1), ["up"]),
|
|
129
129
|
v((d) => _(g + 1), ["down"]),
|
|
130
130
|
o[3] || (o[3] = v((d) => r.value ? p() : E(), ["esc"]))
|
|
@@ -135,9 +135,9 @@ const A = { render: q }, G = ["onClick", "onKeydown", "onMouseenter", "data-curr
|
|
|
135
135
|
ref_for: !0,
|
|
136
136
|
ref_key: "optionElement",
|
|
137
137
|
ref: F,
|
|
138
|
-
"data-current": typeof e.modelValue == "string" || typeof e.modelValue == "number" ? e.modelValue ===
|
|
139
|
-
}, L(
|
|
140
|
-
], 512)) : (s(),
|
|
138
|
+
"data-current": typeof e.modelValue == "string" || typeof e.modelValue == "number" ? e.modelValue === l._id : e.modelValue?._id === l._id
|
|
139
|
+
}, L(l.title), 43, G))), 128))
|
|
140
|
+
], 512)) : (s(), n("div", {
|
|
141
141
|
key: 1,
|
|
142
142
|
onClick: p,
|
|
143
143
|
class: u(t.$style.option),
|
|
@@ -153,9 +153,9 @@ const A = { render: q }, G = ["onClick", "onKeydown", "onMouseenter", "data-curr
|
|
|
153
153
|
filter: Z,
|
|
154
154
|
options: ee,
|
|
155
155
|
option: te
|
|
156
|
-
},
|
|
156
|
+
}, le = {
|
|
157
157
|
$style: oe
|
|
158
|
-
}, ae = /* @__PURE__ */ K(J, [["__cssModules",
|
|
158
|
+
}, ae = /* @__PURE__ */ K(J, [["__cssModules", le]]);
|
|
159
159
|
export {
|
|
160
160
|
ae as default
|
|
161
161
|
};
|