mhz-ui 1.1.21 → 1.1.23

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.
@@ -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;
@@ -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"), $ = m(() => {
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 === $.value.length || e.isFilter || F.value[t]?.focus();
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 V(t) {
66
+ function $(t) {
67
67
  h("update:modelValue", C.value ? t : t._id), p();
68
68
  }
69
69
  function B() {
@@ -101,7 +101,7 @@ const A = { render: q }, G = ["onClick", "onKeydown", "onMouseenter", "data-curr
101
101
  isFocus: ""
102
102
  }, null, 8, ["modelValue", "disabled", "placeholder"])
103
103
  ], 2)) : b("", !0),
104
- e.isClearable ? (s(), l("button", {
104
+ e.isClearable && e.modelValue ? (s(), l("button", {
105
105
  key: 1,
106
106
  onClick: o[2] || (o[2] = (n) => h("update:modelValue", void 0)),
107
107
  type: "button",
@@ -114,17 +114,17 @@ const A = { render: q }, G = ["onClick", "onKeydown", "onMouseenter", "data-curr
114
114
  ref_key: "optionsElement",
115
115
  ref: a
116
116
  }, [
117
- $.value.length ? (s(), l("div", {
117
+ V.value.length ? (s(), l("div", {
118
118
  key: 0,
119
119
  ref_key: "optionsInnerElement",
120
120
  ref: y
121
121
  }, [
122
- (s(!0), l(N, null, R($.value, (n, g) => (s(), l("div", {
122
+ (s(!0), l(N, null, R(V.value, (n, g) => (s(), l("div", {
123
123
  key: `${n}-${g}`,
124
- onClick: (d) => V(n),
124
+ onClick: (d) => $(n),
125
125
  onKeydown: [
126
- v((d) => V(n), ["enter"]),
127
- v((d) => V(n), ["space"]),
126
+ v((d) => $(n), ["enter"]),
127
+ v((d) => $(n), ["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"]))
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mhz-ui",
3
3
  "description": "Mhz ui kit",
4
- "version": "1.1.21",
4
+ "version": "1.1.23",
5
5
  "author": "Alexandr Dergunov <dergunovs@mail.ru> (https://github.com/dergunovs)",
6
6
  "license": "MIT",
7
7
  "type": "module",