mhz-ui 1.1.28 → 1.1.30

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.
@@ -48,13 +48,13 @@ const A = { render: q }, G = ["onClick", "onKeydown", "onMouseenter", "data-curr
48
48
  },
49
49
  emits: ["update:modelValue", "reachedBottom"],
50
50
  setup(k, { emit: i }) {
51
- 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
+ const e = k, V = 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"), h = m(() => {
52
52
  if (!e.options) return [];
53
- let t = e.isLocaleField ? e.options.map((o) => ({ _id: o._id, title: o.title_en })) : [...e.options];
53
+ let t = [...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 === V.value.length || e.isFilter || F.value[t]?.focus();
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,11 +65,11 @@ const A = { render: q }, G = ["onClick", "onKeydown", "onMouseenter", "data-curr
65
65
  }, 100));
66
66
  }
67
67
  function $(t) {
68
- h("update:modelValue", C.value ? t : t._id), p();
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 && h("reachedBottom");
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, () => {
@@ -83,7 +83,7 @@ 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",
@@ -104,7 +104,7 @@ const A = { render: q }, G = ["onClick", "onKeydown", "onMouseenter", "data-curr
104
104
  ], 2)) : b("", !0),
105
105
  e.isClearable && e.modelValue ? (s(), n("button", {
106
106
  key: 1,
107
- onClick: o[2] || (o[2] = (l) => h("update:modelValue", void 0)),
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)
@@ -115,12 +115,12 @@ const A = { render: q }, G = ["onClick", "onKeydown", "onMouseenter", "data-curr
115
115
  ref_key: "optionsElement",
116
116
  ref: a
117
117
  }, [
118
- V.value.length ? (s(), n("div", {
118
+ h.value.length ? (s(), n("div", {
119
119
  key: 0,
120
120
  ref_key: "optionsInnerElement",
121
121
  ref: y
122
122
  }, [
123
- (s(!0), n(N, null, R(V.value, (l, g) => (s(), n("div", {
123
+ (s(!0), n(N, null, R(h.value, (l, g) => (s(), n("div", {
124
124
  key: `${l}-${g}`,
125
125
  onClick: (d) => $(l),
126
126
  onKeydown: [
@@ -137,7 +137,7 @@ const A = { render: q }, G = ["onClick", "onKeydown", "onMouseenter", "data-curr
137
137
  ref_key: "optionElement",
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
- }, z(l.title), 43, G))), 128))
140
+ }, z(e.isLocaleField ? l.title_en : l.title), 43, G))), 128))
141
141
  ], 512)) : (s(), n("div", {
142
142
  key: 1,
143
143
  onClick: p,
@@ -1,4 +1,8 @@
1
- export declare const MODEL_VALUE = "";
1
+ export declare const MODEL_VALUE: {
2
+ _id: string;
3
+ title: string;
4
+ title_en: string;
5
+ };
2
6
  export declare const IS_FILTER = false;
3
7
  export declare const OPTIONS: string[];
4
8
  export declare const OPTIONS_OBJECTS: {
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.28",
4
+ "version": "1.1.30",
5
5
  "author": "Alexandr Dergunov <dergunovs@mail.ru> (https://github.com/dergunovs)",
6
6
  "license": "MIT",
7
7
  "type": "module",