mhz-ui 1.3.14 → 1.3.15
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._container_6dq6w_1{width:100%;overflow:hidden;border:1px solid var(--color-gray);border-radius:8px}._container_6dq6w_1 ._titleBar_6dq6w_7{display:flex;align-items:center;justify-content:space-between;height:40px;padding:8px;font-weight:700;background-color:var(--color-gray-light-extra);border-bottom:1px solid var(--color-gray);border-top-left-radius:8px;border-top-right-radius:8px}._container_6dq6w_1 ._titleBar_6dq6w_7 ._navButton_6dq6w_19{padding:0 8px;font-size:1.25rem;cursor:pointer;background:none;border:none}._container_6dq6w_1 ._headings_6dq6w_26{display:grid;grid-template-columns:repeat(7,1fr);height:37px;border-bottom:1px solid var(--color-gray)}._container_6dq6w_1 ._headings_6dq6w_26 ._weekday_6dq6w_32{display:flex;align-items:center;justify-content:center;text-transform:capitalize}._container_6dq6w_1 ._body_6dq6w_38{display:grid;grid-template-columns:repeat(7,1fr);grid-auto-rows:minmax(72px,auto);gap:0}._container_6dq6w_1 ._cell_6dq6w_44{display:flex;flex-direction:column;gap:2px;align-items:center;justify-content:flex-start;min-height:72px;padding:2px;background-color:var(--color-white);box-shadow:0 0 0 .2px var(--color-gray) inset}._container_6dq6w_1 ._cell_6dq6w_44._today_6dq6w_55 ._cellDate_6dq6w_55{font-weight:700}._container_6dq6w_1 ._cell_6dq6w_44[data-choose=true]{cursor:pointer}._container_6dq6w_1 ._cell_6dq6w_44._outOfRange_6dq6w_61{cursor:not-allowed}._container_6dq6w_1 ._cell_6dq6w_44._outOfRange_6dq6w_61 ._cellDate_6dq6w_55{color:var(--color-gray)}._container_6dq6w_1 ._cellDate_6dq6w_55{display:flex;align-items:center;justify-content:center}._container_6dq6w_1 ._cellEvents_6dq6w_72{display:flex;flex-direction:column;gap:4px;align-items:center;justify-content:flex-start;max-height:calc(100% - 24px);padding-bottom:6px}._container_6dq6w_1 ._event_6dq6w_81{display:flex;align-items:center;justify-content:center;width:36px;height:36px;padding:0;cursor:pointer;-webkit-user-select:none;user-select:none;border:none;border-radius:12px;-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none}._container_6dq6w_1 ._title_6dq6w_7{display:flex;align-items:center;justify-content:center;width:100%;height:100%;font-size:1.125rem;font-weight:700;line-height:1;color:var(--color-gray-light)}.dark ._container_6dq6w_1{border-color:var(--color-gray-dark-extra)}.dark ._container_6dq6w_1 ._header_6dq6w_111{color:var(--color-white);background-color:var(--color-primary-dark);border-bottom-color:var(--color-gray-dark-extra)}.dark ._container_6dq6w_1 ._header_6dq6w_111 ._titleBar_6dq6w_7{background-color:var(--color-primary-dark);border-bottom-color:var(--color-gray-dark-extra)}.dark ._container_6dq6w_1 ._header_6dq6w_111 ._navButton_6dq6w_19{color:var(--color-gray-dark)}.dark ._container_6dq6w_1 ._header_6dq6w_111 ._headings_6dq6w_26{color:var(--color-white);background-color:var(--color-black);border-right:1px solid var(--color-gray-dark-extra);border-bottom:none;border-left:1px solid var(--color-gray-dark-extra)}.dark ._container_6dq6w_1 ._cell_6dq6w_44{background-color:var(--color-black);box-shadow:0 0 0 .2px var(--color-gray-dark) inset}.dark ._container_6dq6w_1 ._cell_6dq6w_44 ._cellDate_6dq6w_55{color:var(--color-white)}.dark ._container_6dq6w_1 ._cell_6dq6w_44._outOfRange_6dq6w_61 ._cellDate_6dq6w_55{color:var(--color-gray-dark)}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./UiCalendar.css";
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
import { _ as
|
|
4
|
-
const
|
|
2
|
+
import { defineComponent as U, ref as H, computed as D, onBeforeMount as L, createElementBlock as c, openBlock as u, normalizeClass as a, createElementVNode as l, toDisplayString as d, Fragment as h, renderList as w, withModifiers as P, normalizeStyle as z } from "vue";
|
|
3
|
+
import { _ as A } from "../_plugin-vue_export-helper-CHgC5LLL.js";
|
|
4
|
+
const N = ["onClick", "data-choose"], V = ["onClick"], W = /* @__PURE__ */ U({
|
|
5
5
|
__name: "UiCalendar",
|
|
6
6
|
props: {
|
|
7
7
|
isDisablePastDates: { type: Boolean },
|
|
@@ -9,68 +9,71 @@ const V = ["onClick"], W = ["onClick"], j = /* @__PURE__ */ L({
|
|
|
9
9
|
lang: { default: "ru" }
|
|
10
10
|
},
|
|
11
11
|
emits: ["update", "eventClick", "chooseDate"],
|
|
12
|
-
setup(C, { emit:
|
|
13
|
-
const
|
|
12
|
+
setup(C, { emit: q }) {
|
|
13
|
+
const i = C, y = q, s = H(/* @__PURE__ */ new Date()), m = D(() => {
|
|
14
14
|
const e = /* @__PURE__ */ new Date();
|
|
15
15
|
return e.setHours(0, 0, 0, 0), e;
|
|
16
|
-
}), p =
|
|
16
|
+
}), p = D(() => new Date(s.value.getFullYear(), s.value.getMonth(), 1)), B = D(() => {
|
|
17
17
|
const e = { month: "long", year: "numeric" };
|
|
18
|
-
let t = p.value.toLocaleDateString(
|
|
19
|
-
return t.length > 0 && (t = t.charAt(0).toUpperCase() + t.slice(1)),
|
|
20
|
-
}), b =
|
|
18
|
+
let t = p.value.toLocaleDateString(i.lang, e);
|
|
19
|
+
return t.length > 0 && (t = t.charAt(0).toUpperCase() + t.slice(1)), i.lang === "ru" && (t = t.replace(/ г\.$/, "")), t;
|
|
20
|
+
}), b = D(() => {
|
|
21
21
|
const e = new Date(p.value);
|
|
22
22
|
e.setDate(1);
|
|
23
23
|
const t = (e.getDay() + 6) % 7;
|
|
24
24
|
return e.setDate(e.getDate() - t), Array.from({ length: 7 }, (n, r) => {
|
|
25
25
|
const o = new Date(e);
|
|
26
|
-
return o.setDate(e.getDate() + r), o.toLocaleDateString(
|
|
26
|
+
return o.setDate(e.getDate() + r), o.toLocaleDateString(i.lang, { weekday: "short" });
|
|
27
27
|
});
|
|
28
|
-
}), g =
|
|
28
|
+
}), g = D(() => {
|
|
29
29
|
const e = new Date(s.value.getFullYear(), s.value.getMonth(), 1), t = new Date(s.value.getFullYear(), s.value.getMonth() + 1, 0), n = (e.getDay() + 6) % 7, r = new Date(e);
|
|
30
30
|
r.setDate(e.getDate() - n);
|
|
31
31
|
const o = (7 - t.getDay()) % 7, f = new Date(t);
|
|
32
32
|
f.setDate(t.getDate() + o);
|
|
33
|
-
const
|
|
34
|
-
for (let _ = 0; _ <
|
|
33
|
+
const T = Math.floor((f.getTime() - r.getTime()) / (1e3 * 60 * 60 * 24)) + 1, M = [];
|
|
34
|
+
for (let _ = 0; _ < T; _++) {
|
|
35
35
|
const $ = new Date(r);
|
|
36
36
|
$.setDate(r.getDate() + _), M.push($);
|
|
37
37
|
}
|
|
38
38
|
return M;
|
|
39
39
|
});
|
|
40
40
|
function v() {
|
|
41
|
-
const e = {
|
|
42
|
-
|
|
41
|
+
const e = {
|
|
42
|
+
dateFrom: g.value[0],
|
|
43
|
+
dateTo: new Date(g.value.at(-1)?.setHours(23, 59, 59))
|
|
44
|
+
};
|
|
45
|
+
y("update", e);
|
|
43
46
|
}
|
|
44
|
-
function
|
|
45
|
-
return
|
|
47
|
+
function O(e) {
|
|
48
|
+
return i.events.filter((t) => {
|
|
46
49
|
if (!t.start) return !1;
|
|
47
50
|
const n = new Date(t.start);
|
|
48
51
|
return n.getDate() === e.getDate() && n.getMonth() === e.getMonth() && n.getFullYear() === e.getFullYear();
|
|
49
52
|
});
|
|
50
53
|
}
|
|
51
|
-
function
|
|
54
|
+
function F(e) {
|
|
52
55
|
return e.toDateString() === m.value.toDateString();
|
|
53
56
|
}
|
|
54
|
-
function
|
|
55
|
-
if (
|
|
57
|
+
function k(e) {
|
|
58
|
+
if (i.isDisablePastDates) {
|
|
56
59
|
const t = new Date(e);
|
|
57
60
|
if (t.setHours(0, 0, 0, 0), t < m.value) return !0;
|
|
58
61
|
}
|
|
59
62
|
return !1;
|
|
60
63
|
}
|
|
61
|
-
function
|
|
64
|
+
function E() {
|
|
62
65
|
s.value = new Date(s.value.getFullYear(), s.value.getMonth() - 1, 1), v();
|
|
63
66
|
}
|
|
64
|
-
function
|
|
67
|
+
function Y() {
|
|
65
68
|
s.value = new Date(s.value.getFullYear(), s.value.getMonth() + 1, 1), v();
|
|
66
69
|
}
|
|
67
|
-
function
|
|
68
|
-
|
|
70
|
+
function S(e) {
|
|
71
|
+
y("eventClick", e);
|
|
69
72
|
}
|
|
70
|
-
function
|
|
71
|
-
|
|
73
|
+
function R(e) {
|
|
74
|
+
k(e) || y("chooseDate", e);
|
|
72
75
|
}
|
|
73
|
-
return
|
|
76
|
+
return L(() => {
|
|
74
77
|
v();
|
|
75
78
|
}), (e, t) => (u(), c("div", {
|
|
76
79
|
class: a(e.$style.container)
|
|
@@ -82,57 +85,58 @@ const V = ["onClick"], W = ["onClick"], j = /* @__PURE__ */ L({
|
|
|
82
85
|
class: a(e.$style.titleBar)
|
|
83
86
|
}, [
|
|
84
87
|
l("button", {
|
|
85
|
-
onClick:
|
|
88
|
+
onClick: E,
|
|
86
89
|
class: a(e.$style.navButton),
|
|
87
90
|
type: "button"
|
|
88
|
-
},
|
|
89
|
-
l("span", null,
|
|
91
|
+
}, d("<"), 2),
|
|
92
|
+
l("span", null, d(B.value), 1),
|
|
90
93
|
l("button", {
|
|
91
|
-
onClick:
|
|
94
|
+
onClick: Y,
|
|
92
95
|
class: a(e.$style.navButton),
|
|
93
96
|
type: "button"
|
|
94
|
-
},
|
|
97
|
+
}, d(">"), 2)
|
|
95
98
|
], 2),
|
|
96
99
|
l("div", {
|
|
97
100
|
class: a(e.$style.headings)
|
|
98
101
|
}, [
|
|
99
|
-
(u(!0), c(h, null,
|
|
102
|
+
(u(!0), c(h, null, w(b.value, (n) => (u(), c("div", {
|
|
100
103
|
key: n,
|
|
101
104
|
class: a(e.$style.weekday)
|
|
102
|
-
},
|
|
105
|
+
}, d(n), 3))), 128))
|
|
103
106
|
], 2)
|
|
104
107
|
], 2),
|
|
105
108
|
l("div", {
|
|
106
109
|
class: a(e.$style.body)
|
|
107
110
|
}, [
|
|
108
|
-
(u(!0), c(h, null,
|
|
111
|
+
(u(!0), c(h, null, w(g.value, (n, r) => (u(), c("div", {
|
|
109
112
|
key: r,
|
|
110
|
-
class: a([e.$style.cell, { [e.$style.today]:
|
|
111
|
-
onClick: (o) =>
|
|
113
|
+
class: a([e.$style.cell, { [e.$style.today]: F(n), [e.$style.outOfRange]: k(n) }]),
|
|
114
|
+
onClick: (o) => R(n),
|
|
115
|
+
"data-choose": i.isDisablePastDates
|
|
112
116
|
}, [
|
|
113
117
|
l("div", {
|
|
114
118
|
class: a(e.$style.cellDate)
|
|
115
|
-
},
|
|
119
|
+
}, d(n.getDate()), 3),
|
|
116
120
|
l("div", {
|
|
117
121
|
class: a(e.$style.cellEvents)
|
|
118
122
|
}, [
|
|
119
|
-
(u(!0), c(h, null,
|
|
123
|
+
(u(!0), c(h, null, w(O(n), (o) => (u(), c("div", {
|
|
120
124
|
key: o.id,
|
|
121
125
|
class: a(e.$style.event),
|
|
122
|
-
style:
|
|
123
|
-
onClick:
|
|
126
|
+
style: z({ background: o.color }),
|
|
127
|
+
onClick: P((f) => S(o), ["stop"])
|
|
124
128
|
}, [
|
|
125
129
|
l("div", {
|
|
126
130
|
class: a(e.$style.title)
|
|
127
|
-
},
|
|
128
|
-
], 14,
|
|
131
|
+
}, d(o.title), 3)
|
|
132
|
+
], 14, V))), 128))
|
|
129
133
|
], 2)
|
|
130
|
-
], 10,
|
|
134
|
+
], 10, N))), 128))
|
|
131
135
|
], 2)
|
|
132
136
|
], 2));
|
|
133
137
|
}
|
|
134
|
-
}),
|
|
135
|
-
container:
|
|
138
|
+
}), j = "_container_6dq6w_1", G = "_titleBar_6dq6w_7", I = "_navButton_6dq6w_19", J = "_headings_6dq6w_26", K = "_weekday_6dq6w_32", Q = "_body_6dq6w_38", X = "_cell_6dq6w_44", Z = "_today_6dq6w_55", x = "_cellDate_6dq6w_55", ee = "_outOfRange_6dq6w_61", te = "_cellEvents_6dq6w_72", ne = "_event_6dq6w_81", ae = "_title_6dq6w_7", se = "_header_6dq6w_111", oe = {
|
|
139
|
+
container: j,
|
|
136
140
|
titleBar: G,
|
|
137
141
|
navButton: I,
|
|
138
142
|
headings: J,
|
|
@@ -148,7 +152,7 @@ const V = ["onClick"], W = ["onClick"], j = /* @__PURE__ */ L({
|
|
|
148
152
|
header: se
|
|
149
153
|
}, le = {
|
|
150
154
|
$style: oe
|
|
151
|
-
}, ue = /* @__PURE__ */
|
|
155
|
+
}, ue = /* @__PURE__ */ A(W, [["__cssModules", le]]);
|
|
152
156
|
export {
|
|
153
157
|
ue as default
|
|
154
158
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mhz-ui",
|
|
3
3
|
"description": "Mhz ui kit",
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.15",
|
|
5
5
|
"author": "Alexandr Dergunov <dergunovs@mail.ru> (https://github.com/dergunovs)",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"type": "module",
|
|
@@ -40,10 +40,10 @@
|
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@eslint/js": "9.39.1",
|
|
43
|
-
"@storybook/addon-docs": "10.1.
|
|
44
|
-
"@storybook/addon-themes": "10.1.
|
|
45
|
-
"@storybook/vue3": "10.1.
|
|
46
|
-
"@storybook/vue3-vite": "10.1.
|
|
43
|
+
"@storybook/addon-docs": "10.1.2",
|
|
44
|
+
"@storybook/addon-themes": "10.1.2",
|
|
45
|
+
"@storybook/vue3": "10.1.2",
|
|
46
|
+
"@storybook/vue3-vite": "10.1.2",
|
|
47
47
|
"@types/node": "24.10.1",
|
|
48
48
|
"@vitejs/plugin-vue": "6.0.2",
|
|
49
49
|
"@vitest/coverage-v8": "4.0.14",
|
|
@@ -60,10 +60,10 @@
|
|
|
60
60
|
"happy-dom": "20.0.11",
|
|
61
61
|
"postcss-html": "1.8.0",
|
|
62
62
|
"postcss-scss": "4.0.9",
|
|
63
|
-
"prettier": "3.7.
|
|
63
|
+
"prettier": "3.7.3",
|
|
64
64
|
"sass-embedded": "1.93.3",
|
|
65
|
-
"storybook": "10.1.
|
|
66
|
-
"stylelint": "16.26.
|
|
65
|
+
"storybook": "10.1.2",
|
|
66
|
+
"stylelint": "16.26.1",
|
|
67
67
|
"stylelint-config-recess-order": "7.4.0",
|
|
68
68
|
"stylelint-config-recommended-scss": "16.0.2",
|
|
69
69
|
"stylelint-config-recommended-vue": "1.6.1",
|