mhz-ui 1.0.4 → 1.0.5
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/UiPagination/UiPagination.js +17 -17
- package/dist/UiSelect/UiSelect.js +120 -114
- package/dist/base.scss +1 -0
- package/package.json +4 -4
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import "./UiPagination.css";
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
import { _ as
|
|
4
|
-
const
|
|
2
|
+
import { defineComponent as u, openBlock as b, createElementBlock as r, normalizeClass as e, createElementVNode as n, toDisplayString as i } from "vue";
|
|
3
|
+
import { _ as m } from "../_plugin-vue_export-helper-dad06003.js";
|
|
4
|
+
const g = ["disabled"], y = ["disabled"], $ = ["disabled"], f = ["disabled"], c = /* @__PURE__ */ u({
|
|
5
5
|
__name: "UiPagination",
|
|
6
6
|
props: {
|
|
7
7
|
page: {},
|
|
8
8
|
total: {}
|
|
9
9
|
},
|
|
10
10
|
emits: ["update"],
|
|
11
|
-
setup(
|
|
12
|
-
const a =
|
|
11
|
+
setup(d, { emit: p }) {
|
|
12
|
+
const a = d;
|
|
13
13
|
function s(t) {
|
|
14
|
-
|
|
14
|
+
p("update", t), document.querySelector("main")?.scrollTo(0, 0);
|
|
15
15
|
}
|
|
16
|
-
return (t, o) => (
|
|
16
|
+
return (t, o) => (b(), r("div", {
|
|
17
17
|
class: e(t.$style.pagination)
|
|
18
18
|
}, [
|
|
19
19
|
n("button", {
|
|
@@ -21,37 +21,37 @@ const y = ["disabled"], $ = ["disabled"], f = ["disabled"], c = ["disabled"], v
|
|
|
21
21
|
disabled: t.page === 1,
|
|
22
22
|
class: e(t.$style.button),
|
|
23
23
|
type: "button"
|
|
24
|
-
}, "<<", 10,
|
|
24
|
+
}, "<<", 10, g),
|
|
25
25
|
n("button", {
|
|
26
26
|
onClick: o[1] || (o[1] = (l) => s(a.page - 1)),
|
|
27
27
|
disabled: t.page === 1,
|
|
28
28
|
class: e(t.$style.button),
|
|
29
29
|
type: "button"
|
|
30
|
-
}, " < ", 10,
|
|
30
|
+
}, " < ", 10, y),
|
|
31
31
|
n("div", {
|
|
32
32
|
class: e(t.$style.text)
|
|
33
|
-
},
|
|
33
|
+
}, i(t.page) + " of " + i(t.total), 3),
|
|
34
34
|
n("button", {
|
|
35
35
|
onClick: o[2] || (o[2] = (l) => s(a.page + 1)),
|
|
36
36
|
disabled: t.page === t.total,
|
|
37
37
|
class: e(t.$style.button),
|
|
38
38
|
type: "button"
|
|
39
|
-
}, " > ", 10,
|
|
39
|
+
}, " > ", 10, $),
|
|
40
40
|
n("button", {
|
|
41
41
|
onClick: o[3] || (o[3] = (l) => s(a.total)),
|
|
42
42
|
disabled: t.page === t.total,
|
|
43
43
|
class: e(t.$style.button),
|
|
44
44
|
type: "button"
|
|
45
|
-
}, " >> ", 10,
|
|
45
|
+
}, " >> ", 10, f)
|
|
46
46
|
], 2));
|
|
47
47
|
}
|
|
48
|
-
}), k = "_pagination_3h5xm_1",
|
|
48
|
+
}), k = "_pagination_3h5xm_1", v = "_button_3h5xm_9", C = "_text_3h5xm_30", _ = {
|
|
49
49
|
pagination: k,
|
|
50
|
-
button:
|
|
51
|
-
text:
|
|
50
|
+
button: v,
|
|
51
|
+
text: C
|
|
52
52
|
}, U = {
|
|
53
|
-
$style:
|
|
54
|
-
}, M = /* @__PURE__ */
|
|
53
|
+
$style: _
|
|
54
|
+
}, M = /* @__PURE__ */ m(c, [["__cssModules", U]]);
|
|
55
55
|
export {
|
|
56
56
|
M as default
|
|
57
57
|
};
|
|
@@ -1,114 +1,120 @@
|
|
|
1
1
|
import "./UiSelect.css";
|
|
2
|
-
import { getCurrentScope as N, onScopeDispose as R, unref as
|
|
3
|
-
import
|
|
2
|
+
import { getCurrentScope as N, onScopeDispose as R, unref as O, watch as T, openBlock as h, createElementBlock as y, createElementVNode as B, defineComponent as D, ref as w, computed as K, normalizeClass as E, createVNode as S, createCommentVNode as A, Fragment as W, renderList as q, withKeys as $, toDisplayString as z } from "vue";
|
|
3
|
+
import L from "../UiInput/UiInput.js";
|
|
4
4
|
import { _ as H } from "../_plugin-vue_export-helper-dad06003.js";
|
|
5
|
-
function Q(
|
|
6
|
-
return N() ? (R(
|
|
5
|
+
function Q(o) {
|
|
6
|
+
return N() ? (R(o), !0) : !1;
|
|
7
7
|
}
|
|
8
|
-
function P(
|
|
9
|
-
return typeof
|
|
8
|
+
function P(o) {
|
|
9
|
+
return typeof o == "function" ? o() : O(o);
|
|
10
10
|
}
|
|
11
|
-
const M = typeof window < "u" && typeof document < "u",
|
|
12
|
-
},
|
|
13
|
-
function
|
|
14
|
-
|
|
11
|
+
const M = typeof window < "u" && typeof document < "u", x = Object.prototype.toString, G = (o) => x.call(o) === "[object Object]", j = () => {
|
|
12
|
+
}, J = /* @__PURE__ */ X();
|
|
13
|
+
function X() {
|
|
14
|
+
var o;
|
|
15
|
+
return M && ((o = window?.navigator) == null ? void 0 : o.userAgent) && /* @__PURE__ */ /iP(ad|hone|od)/.test(window.navigator.userAgent);
|
|
15
16
|
}
|
|
16
|
-
function C(
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
function C(o) {
|
|
18
|
+
var s;
|
|
19
|
+
const t = P(o);
|
|
20
|
+
return (s = t?.$el) != null ? s : t;
|
|
19
21
|
}
|
|
20
22
|
const U = M ? window : void 0;
|
|
21
|
-
function
|
|
22
|
-
let
|
|
23
|
-
if (typeof
|
|
24
|
-
return
|
|
25
|
-
Array.isArray(t) || (t = [t]), Array.isArray(
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
},
|
|
29
|
-
() => [C(
|
|
30
|
-
([i,
|
|
31
|
-
|
|
32
|
-
|
|
23
|
+
function b(...o) {
|
|
24
|
+
let s, t, r, m;
|
|
25
|
+
if (typeof o[0] == "string" || Array.isArray(o[0]) ? ([t, r, m] = o, s = U) : [s, t, r, m] = o, !s)
|
|
26
|
+
return j;
|
|
27
|
+
Array.isArray(t) || (t = [t]), Array.isArray(r) || (r = [r]);
|
|
28
|
+
const c = [], d = () => {
|
|
29
|
+
c.forEach((i) => i()), c.length = 0;
|
|
30
|
+
}, p = (i, a, e, n) => (i.addEventListener(a, e, n), () => i.removeEventListener(a, e, n)), _ = T(
|
|
31
|
+
() => [C(s), P(m)],
|
|
32
|
+
([i, a]) => {
|
|
33
|
+
if (d(), !i)
|
|
34
|
+
return;
|
|
35
|
+
const e = G(a) ? { ...a } : a;
|
|
36
|
+
c.push(
|
|
37
|
+
...t.flatMap((n) => r.map((u) => p(i, n, u, e)))
|
|
33
38
|
);
|
|
34
39
|
},
|
|
35
40
|
{ immediate: !0, flush: "post" }
|
|
36
41
|
), k = () => {
|
|
37
|
-
_(),
|
|
42
|
+
_(), d();
|
|
38
43
|
};
|
|
39
44
|
return Q(k), k;
|
|
40
45
|
}
|
|
41
46
|
let F = !1;
|
|
42
|
-
function
|
|
43
|
-
const { window:
|
|
44
|
-
if (!
|
|
47
|
+
function Y(o, s, t = {}) {
|
|
48
|
+
const { window: r = U, ignore: m = [], capture: c = !0, detectIframe: d = !1 } = t;
|
|
49
|
+
if (!r)
|
|
45
50
|
return;
|
|
46
|
-
|
|
47
|
-
let
|
|
48
|
-
const _ = (e) =>
|
|
51
|
+
J && !F && (F = !0, Array.from(r.document.body.children).forEach((e) => e.addEventListener("click", j)), r.document.documentElement.addEventListener("click", j));
|
|
52
|
+
let p = !0;
|
|
53
|
+
const _ = (e) => m.some((n) => {
|
|
49
54
|
if (typeof n == "string")
|
|
50
|
-
return Array.from(
|
|
55
|
+
return Array.from(r.document.querySelectorAll(n)).some((u) => u === e.target || e.composedPath().includes(u));
|
|
51
56
|
{
|
|
52
|
-
const
|
|
53
|
-
return
|
|
57
|
+
const u = C(n);
|
|
58
|
+
return u && (e.target === u || e.composedPath().includes(u));
|
|
54
59
|
}
|
|
55
60
|
}), i = [
|
|
56
|
-
|
|
57
|
-
const n = C(
|
|
61
|
+
b(r, "click", (e) => {
|
|
62
|
+
const n = C(o);
|
|
58
63
|
if (!(!n || n === e.target || e.composedPath().includes(n))) {
|
|
59
|
-
if (e.detail === 0 && (
|
|
60
|
-
|
|
64
|
+
if (e.detail === 0 && (p = !_(e)), !p) {
|
|
65
|
+
p = !0;
|
|
61
66
|
return;
|
|
62
67
|
}
|
|
63
|
-
|
|
68
|
+
s(e);
|
|
64
69
|
}
|
|
65
|
-
}, { passive: !0, capture:
|
|
66
|
-
|
|
67
|
-
const n = C(
|
|
68
|
-
n && (
|
|
70
|
+
}, { passive: !0, capture: c }),
|
|
71
|
+
b(r, "pointerdown", (e) => {
|
|
72
|
+
const n = C(o);
|
|
73
|
+
n && (p = !e.composedPath().includes(n) && !_(e));
|
|
69
74
|
}, { passive: !0 }),
|
|
70
|
-
|
|
75
|
+
d && b(r, "blur", (e) => {
|
|
71
76
|
setTimeout(() => {
|
|
72
|
-
|
|
73
|
-
|
|
77
|
+
var n;
|
|
78
|
+
const u = C(o);
|
|
79
|
+
((n = r.document.activeElement) == null ? void 0 : n.tagName) === "IFRAME" && !u?.contains(r.document.activeElement) && s(e);
|
|
74
80
|
}, 0);
|
|
75
81
|
})
|
|
76
82
|
].filter(Boolean);
|
|
77
83
|
return () => i.forEach((e) => e());
|
|
78
84
|
}
|
|
79
|
-
const
|
|
85
|
+
const Z = {
|
|
80
86
|
xmlns: "http://www.w3.org/2000/svg",
|
|
81
87
|
width: "15",
|
|
82
88
|
height: "8",
|
|
83
89
|
fill: "none"
|
|
84
|
-
},
|
|
90
|
+
}, ee = /* @__PURE__ */ B("path", {
|
|
85
91
|
stroke: "currentColor",
|
|
86
92
|
"stroke-linecap": "round",
|
|
87
93
|
"stroke-linejoin": "round",
|
|
88
94
|
d: "m.5 1 7.17 6 6.83-6"
|
|
89
|
-
}, null, -1),
|
|
90
|
-
|
|
95
|
+
}, null, -1), te = [
|
|
96
|
+
ee
|
|
91
97
|
];
|
|
92
|
-
function
|
|
93
|
-
return h(), y("svg",
|
|
98
|
+
function oe(o, s) {
|
|
99
|
+
return h(), y("svg", Z, te);
|
|
94
100
|
}
|
|
95
|
-
const
|
|
101
|
+
const ne = { render: oe }, re = {
|
|
96
102
|
xmlns: "http://www.w3.org/2000/svg",
|
|
97
103
|
width: "15",
|
|
98
104
|
height: "8",
|
|
99
105
|
fill: "none"
|
|
100
|
-
},
|
|
106
|
+
}, le = /* @__PURE__ */ B("path", {
|
|
101
107
|
stroke: "currentColor",
|
|
102
108
|
"stroke-linecap": "round",
|
|
103
109
|
"stroke-linejoin": "round",
|
|
104
110
|
d: "m.5 7 7.17-6 6.83 6"
|
|
105
|
-
}, null, -1),
|
|
106
|
-
|
|
111
|
+
}, null, -1), se = [
|
|
112
|
+
le
|
|
107
113
|
];
|
|
108
|
-
function
|
|
109
|
-
return h(), y("svg",
|
|
114
|
+
function ie(o, s) {
|
|
115
|
+
return h(), y("svg", re, se);
|
|
110
116
|
}
|
|
111
|
-
const
|
|
117
|
+
const ue = { render: ie }, ce = ["onClick", "onKeydown", "onMouseenter", "data-current"], ae = /* @__PURE__ */ D({
|
|
112
118
|
__name: "UiSelect",
|
|
113
119
|
props: {
|
|
114
120
|
modelValue: {},
|
|
@@ -116,74 +122,74 @@ const le = { render: se }, ie = ["onClick", "onKeydown", "onMouseenter", "data-c
|
|
|
116
122
|
isFilter: { type: Boolean }
|
|
117
123
|
},
|
|
118
124
|
emits: ["update:modelValue", "reachedBottom"],
|
|
119
|
-
setup(
|
|
120
|
-
const t =
|
|
125
|
+
setup(o, { emit: s }) {
|
|
126
|
+
const t = o, r = w(""), m = K(() => {
|
|
121
127
|
if (!t.options)
|
|
122
128
|
return [];
|
|
123
|
-
let
|
|
124
|
-
return typeof t.options[0] != "object" && (
|
|
125
|
-
}),
|
|
126
|
-
function k(
|
|
127
|
-
|
|
129
|
+
let l = t.options;
|
|
130
|
+
return typeof t.options[0] != "object" && (l = t.options.map((f) => ({ _id: f, title: f }))), t.isFilter ? l.filter((f) => f.title.toLowerCase().includes(r.value.toLowerCase())) : l;
|
|
131
|
+
}), c = w(!1), d = w(), p = w(), _ = w([]);
|
|
132
|
+
function k(l) {
|
|
133
|
+
s("update:modelValue", l);
|
|
128
134
|
}
|
|
129
|
-
function i(
|
|
130
|
-
|
|
135
|
+
function i(l) {
|
|
136
|
+
l < 0 || l === m.value.length || t.isFilter || _.value[l]?.focus();
|
|
131
137
|
}
|
|
132
|
-
function
|
|
133
|
-
|
|
138
|
+
function a() {
|
|
139
|
+
d.value?.removeEventListener("scroll", u, !0), r.value = "", c.value = !1;
|
|
134
140
|
}
|
|
135
141
|
function e() {
|
|
136
|
-
|
|
137
|
-
|
|
142
|
+
c.value = !0, t.isFilter || setTimeout(() => {
|
|
143
|
+
d.value?.scrollTo(0, 0), i(0), d.value?.addEventListener("scroll", u, !0);
|
|
138
144
|
}, 100);
|
|
139
145
|
}
|
|
140
|
-
function n(
|
|
141
|
-
|
|
146
|
+
function n(l) {
|
|
147
|
+
s("update:modelValue", typeof t.modelValue == "object" ? l : l._id), a();
|
|
142
148
|
}
|
|
143
|
-
function
|
|
144
|
-
if (!
|
|
149
|
+
function u() {
|
|
150
|
+
if (!d.value || !p.value)
|
|
145
151
|
return;
|
|
146
|
-
|
|
152
|
+
d.value.getBoundingClientRect().y - p.value.getBoundingClientRect().y - p.value.scrollHeight + d.value.getBoundingClientRect().height > -100 && s("reachedBottom");
|
|
147
153
|
}
|
|
148
|
-
const
|
|
149
|
-
return
|
|
150
|
-
|
|
151
|
-
}), (
|
|
152
|
-
class: E(
|
|
154
|
+
const I = w();
|
|
155
|
+
return Y(I, () => {
|
|
156
|
+
a();
|
|
157
|
+
}), (l, f) => (h(), y("div", {
|
|
158
|
+
class: E(l.$style.container),
|
|
153
159
|
ref_key: "containerElement",
|
|
154
|
-
ref:
|
|
160
|
+
ref: I
|
|
155
161
|
}, [
|
|
156
|
-
S(
|
|
162
|
+
S(L, {
|
|
157
163
|
modelValue: typeof t.modelValue == "object" ? t.modelValue.title : t.modelValue,
|
|
158
164
|
onUpdate: k,
|
|
159
|
-
onToggle:
|
|
165
|
+
onToggle: f[0] || (f[0] = (v) => c.value ? a() : e()),
|
|
160
166
|
mode: "select",
|
|
161
167
|
placeholder: "Choose variant",
|
|
162
|
-
appendIcon:
|
|
168
|
+
appendIcon: c.value ? O(ue) : O(ne)
|
|
163
169
|
}, null, 8, ["modelValue", "appendIcon"]),
|
|
164
|
-
t.isFilter &&
|
|
170
|
+
t.isFilter && c.value ? (h(), y("div", {
|
|
165
171
|
key: 0,
|
|
166
|
-
class: E(
|
|
172
|
+
class: E(l.$style.filter)
|
|
167
173
|
}, [
|
|
168
|
-
S(
|
|
169
|
-
modelValue:
|
|
170
|
-
"onUpdate:modelValue":
|
|
174
|
+
S(L, {
|
|
175
|
+
modelValue: r.value,
|
|
176
|
+
"onUpdate:modelValue": f[1] || (f[1] = (v) => r.value = v),
|
|
171
177
|
placeholder: "Filter Variants",
|
|
172
178
|
isFocus: ""
|
|
173
179
|
}, null, 8, ["modelValue"])
|
|
174
|
-
], 2)) :
|
|
175
|
-
|
|
180
|
+
], 2)) : A("", !0),
|
|
181
|
+
c.value ? (h(), y("div", {
|
|
176
182
|
key: 1,
|
|
177
|
-
class: E(
|
|
183
|
+
class: E(l.$style.options),
|
|
178
184
|
ref_key: "optionsElement",
|
|
179
|
-
ref:
|
|
185
|
+
ref: d
|
|
180
186
|
}, [
|
|
181
|
-
|
|
187
|
+
m.value.length ? (h(), y("div", {
|
|
182
188
|
key: 0,
|
|
183
189
|
ref_key: "optionsInnerElement",
|
|
184
|
-
ref:
|
|
190
|
+
ref: p
|
|
185
191
|
}, [
|
|
186
|
-
(h(!0), y(W, null, q(
|
|
192
|
+
(h(!0), y(W, null, q(m.value, (v, V) => (h(), y("div", {
|
|
187
193
|
key: `${v}-${V}`,
|
|
188
194
|
onClick: (g) => n(v),
|
|
189
195
|
onKeydown: [
|
|
@@ -191,33 +197,33 @@ const le = { render: se }, ie = ["onClick", "onKeydown", "onMouseenter", "data-c
|
|
|
191
197
|
$((g) => n(v), ["space"]),
|
|
192
198
|
$((g) => i(V - 1), ["up"]),
|
|
193
199
|
$((g) => i(V + 1), ["down"]),
|
|
194
|
-
|
|
200
|
+
f[2] || (f[2] = $((g) => c.value ? a() : e(), ["esc"]))
|
|
195
201
|
],
|
|
196
202
|
onMouseenter: (g) => i(V),
|
|
197
|
-
class: E(
|
|
203
|
+
class: E(l.$style.option),
|
|
198
204
|
tabindex: "0",
|
|
199
205
|
ref_for: !0,
|
|
200
206
|
ref_key: "optionElement",
|
|
201
207
|
ref: _,
|
|
202
208
|
"data-current": t.modelValue === v._id
|
|
203
|
-
}, z(v.title), 43,
|
|
209
|
+
}, z(v.title), 43, ce))), 128))
|
|
204
210
|
], 512)) : (h(), y("div", {
|
|
205
211
|
key: 1,
|
|
206
|
-
onClick:
|
|
207
|
-
class: E(
|
|
212
|
+
onClick: a,
|
|
213
|
+
class: E(l.$style.option),
|
|
208
214
|
tabindex: "0"
|
|
209
215
|
}, "No results", 2))
|
|
210
|
-
], 2)) :
|
|
216
|
+
], 2)) : A("", !0)
|
|
211
217
|
], 2));
|
|
212
218
|
}
|
|
213
|
-
}),
|
|
214
|
-
container:
|
|
215
|
-
filter:
|
|
216
|
-
options:
|
|
217
|
-
option:
|
|
218
|
-
},
|
|
219
|
-
$style:
|
|
220
|
-
},
|
|
219
|
+
}), de = "_container_1bjom_1", pe = "_filter_1bjom_5", fe = "_options_1bjom_9", me = "_option_1bjom_9", ve = {
|
|
220
|
+
container: de,
|
|
221
|
+
filter: pe,
|
|
222
|
+
options: fe,
|
|
223
|
+
option: me
|
|
224
|
+
}, he = {
|
|
225
|
+
$style: ve
|
|
226
|
+
}, we = /* @__PURE__ */ H(ae, [["__cssModules", he]]);
|
|
221
227
|
export {
|
|
222
|
-
|
|
228
|
+
we as default
|
|
223
229
|
};
|
package/dist/base.scss
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mhz-ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "mhz-ui",
|
|
5
5
|
"author": "dergunov.com",
|
|
6
6
|
"license": "MIT",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"@tiptap/pm": "2.1.7",
|
|
27
27
|
"@tiptap/starter-kit": "2.1.7",
|
|
28
28
|
"@tiptap/vue-3": "2.1.7",
|
|
29
|
-
"@vueuse/core": "10.4.
|
|
30
|
-
"@vueuse/integrations": "10.4.
|
|
29
|
+
"@vueuse/core": "10.4.1",
|
|
30
|
+
"@vueuse/integrations": "10.4.1",
|
|
31
31
|
"vue": "3.3.4",
|
|
32
32
|
"vue-router": "4.2.4"
|
|
33
33
|
},
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@storybook/preview-api": "7.3.2",
|
|
41
41
|
"@storybook/vue3": "7.3.2",
|
|
42
42
|
"@storybook/vue3-vite": "7.3.2",
|
|
43
|
-
"@types/node": "20.5.
|
|
43
|
+
"@types/node": "20.5.7",
|
|
44
44
|
"@typescript-eslint/eslint-plugin": "6.4.1",
|
|
45
45
|
"@typescript-eslint/parser": "6.4.1",
|
|
46
46
|
"@vitejs/plugin-vue": "4.3.3",
|