@memobit/libs 3.8.1 → 3.8.3
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/components/Calendar/Calendar2.js +59 -57
- package/dist/components/DataView/DataView2.js +95 -95
- package/dist/components/DatePicker/DatePicker.css +1 -1
- package/dist/components/DatePicker/DatePicker2.js +51 -49
- package/dist/helpers/VersionInfo.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/styles/base.scss +36 -36
- package/dist/styles/effects.scss +72 -72
- package/dist/styles/scrollbars.scss +30 -30
- package/dist/styles/utilities.scss +238 -238
- package/dist/styles/utility-classes.scss +93 -93
- package/dist/styles/variables.scss +73 -73
- package/dist/version.js +2 -2
- package/dist/version.json +4 -4
- package/package.json +142 -136
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import './Calendar.css';
|
|
2
|
-
import { Tooltip as
|
|
3
|
-
import { addMonths as H,
|
|
2
|
+
import { Tooltip as _ } from "../Tooltip/Tooltip2.js";
|
|
3
|
+
import { addMonths as H, formatDate as ue, getMonthMatrix as _e, isAfter as he, isBefore as A, isSameDay as h, isToday as me, isWeekend as fe } from "../../helpers/Datetime.js";
|
|
4
4
|
/* empty css */
|
|
5
|
-
import { useMemo as
|
|
6
|
-
import { Fragment as V, jsx as n, jsxs as
|
|
7
|
-
var d = 12,
|
|
5
|
+
import { useMemo as ye, useState as M } from "react";
|
|
6
|
+
import { Fragment as V, jsx as n, jsxs as m } from "react/jsx-runtime";
|
|
7
|
+
var d = 12, S = [
|
|
8
8
|
"January",
|
|
9
9
|
"February",
|
|
10
10
|
"March",
|
|
@@ -17,7 +17,7 @@ var d = 12, T = [
|
|
|
17
17
|
"October",
|
|
18
18
|
"November",
|
|
19
19
|
"December"
|
|
20
|
-
],
|
|
20
|
+
], ge = [
|
|
21
21
|
"Sun",
|
|
22
22
|
"Mon",
|
|
23
23
|
"Tue",
|
|
@@ -25,7 +25,7 @@ var d = 12, T = [
|
|
|
25
25
|
"Thu",
|
|
26
26
|
"Fri",
|
|
27
27
|
"Sat"
|
|
28
|
-
],
|
|
28
|
+
], be = [
|
|
29
29
|
"Mon",
|
|
30
30
|
"Tue",
|
|
31
31
|
"Wed",
|
|
@@ -33,7 +33,7 @@ var d = 12, T = [
|
|
|
33
33
|
"Fri",
|
|
34
34
|
"Sat",
|
|
35
35
|
"Sun"
|
|
36
|
-
],
|
|
36
|
+
], we = ({ value: r, onChange: f, mode: i = "single", minDate: T, maxDate: v, disabledDates: p, firstDayOfWeek: D = 0, showToday: j = !0, yearOnly: R = !1, className: G = "", currentMonth: I, onMonthChange: c, showHeader: F = !0, rangeStart: J, onRangeStartChange: Y }) => {
|
|
37
37
|
const [P, u] = M(() => {
|
|
38
38
|
if (r) {
|
|
39
39
|
if (r instanceof Date) return new Date(r.getFullYear(), r.getMonth(), 1);
|
|
@@ -41,17 +41,17 @@ var d = 12, T = [
|
|
|
41
41
|
if (Array.isArray(r) && r.length > 0) return new Date(r[0].getFullYear(), r[0].getMonth(), 1);
|
|
42
42
|
}
|
|
43
43
|
return new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), 1);
|
|
44
|
-
}), [y, g] = M("days"), [b,
|
|
45
|
-
const e = (
|
|
44
|
+
}), [y, g] = M("days"), [b, k] = M(() => {
|
|
45
|
+
const e = (I ?? P).getFullYear();
|
|
46
46
|
return Math.floor(e / d) * d;
|
|
47
|
-
}), [O, E] = M(null), a =
|
|
47
|
+
}), [O, E] = M(null), a = I ?? P, o = J ?? O, B = ye(() => _e(a.getFullYear(), a.getMonth(), D), [a, D]), W = D === 1 ? be : ge, w = (e) => T && A(e, T) || v && he(e, v) ? !0 : p ? typeof p == "function" ? p(e) : p.some((t) => h(t, e)) : !1, q = (e) => {
|
|
48
48
|
if (!r) return !1;
|
|
49
|
-
if (i === "single" && r instanceof Date) return
|
|
49
|
+
if (i === "single" && r instanceof Date) return h(e, r);
|
|
50
50
|
if (i === "range") {
|
|
51
|
-
if (o) return
|
|
52
|
-
if (r && "start" in r) return
|
|
51
|
+
if (o) return h(e, o);
|
|
52
|
+
if (r && "start" in r) return h(e, r.start) || h(e, r.end);
|
|
53
53
|
}
|
|
54
|
-
return i === "multiple" && Array.isArray(r) ? r.some((t) =>
|
|
54
|
+
return i === "multiple" && Array.isArray(r) ? r.some((t) => h(t, e)) : !1;
|
|
55
55
|
}, z = (e) => {
|
|
56
56
|
if (i === "range" && r && "start" in r) {
|
|
57
57
|
const { start: t, end: l } = r, s = e.getTime();
|
|
@@ -59,24 +59,24 @@ var d = 12, T = [
|
|
|
59
59
|
}
|
|
60
60
|
return !1;
|
|
61
61
|
}, K = (e) => i === "range" && o ? e.getTime() > o.getTime() : !1, L = (e) => e.getMonth() === a.getMonth(), Q = (e) => {
|
|
62
|
-
if (!
|
|
63
|
-
if (i === "single")
|
|
62
|
+
if (!w(e)) {
|
|
63
|
+
if (i === "single") f?.(e);
|
|
64
64
|
else if (i === "range")
|
|
65
65
|
if (!o)
|
|
66
|
-
Y ? Y(e) : (E(e),
|
|
66
|
+
Y ? Y(e) : (E(e), f?.(void 0));
|
|
67
67
|
else {
|
|
68
|
-
const t =
|
|
69
|
-
|
|
68
|
+
const t = A(e, o) ? e : o, l = A(e, o) ? o : e;
|
|
69
|
+
f?.({
|
|
70
70
|
start: t,
|
|
71
71
|
end: l
|
|
72
72
|
}), Y ? Y(null) : E(null);
|
|
73
73
|
}
|
|
74
74
|
else if (i === "multiple") {
|
|
75
|
-
const t = Array.isArray(r) ? r : [], l = t.findIndex((s) =>
|
|
75
|
+
const t = Array.isArray(r) ? r : [], l = t.findIndex((s) => h(s, e));
|
|
76
76
|
if (l >= 0) {
|
|
77
|
-
const s = t.filter((
|
|
78
|
-
|
|
79
|
-
} else
|
|
77
|
+
const s = t.filter((x, N) => N !== l);
|
|
78
|
+
f?.(s.length > 0 ? s : void 0);
|
|
79
|
+
} else f?.([...t, e]);
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
}, U = () => {
|
|
@@ -87,11 +87,11 @@ var d = 12, T = [
|
|
|
87
87
|
c ? c(e) : u(e);
|
|
88
88
|
}, Z = () => {
|
|
89
89
|
const e = /* @__PURE__ */ new Date(), t = new Date(e.getFullYear(), e.getMonth(), 1);
|
|
90
|
-
c ? c(t) : u(t), g("days"), i === "single" &&
|
|
90
|
+
c ? c(t) : u(t), g("days"), i === "single" && f?.(e);
|
|
91
91
|
}, C = () => {
|
|
92
92
|
F && g("months");
|
|
93
93
|
}, $ = () => {
|
|
94
|
-
F && (
|
|
94
|
+
F && (k(Math.floor(a.getFullYear() / d) * d), g("years"));
|
|
95
95
|
}, ee = (e) => {
|
|
96
96
|
const t = new Date(a.getFullYear(), e, 1);
|
|
97
97
|
c ? c(t) : u(t), g("days");
|
|
@@ -99,9 +99,9 @@ var d = 12, T = [
|
|
|
99
99
|
const t = new Date(e, a.getMonth(), 1);
|
|
100
100
|
c ? c(t) : u(t), g("months");
|
|
101
101
|
}, ne = () => {
|
|
102
|
-
|
|
102
|
+
k(b - d);
|
|
103
103
|
}, re = () => {
|
|
104
|
-
|
|
104
|
+
k(b + d);
|
|
105
105
|
}, ae = () => {
|
|
106
106
|
const e = new Date(a.getFullYear() - 1, a.getMonth(), 1);
|
|
107
107
|
c ? c(e) : u(e);
|
|
@@ -114,11 +114,11 @@ var d = 12, T = [
|
|
|
114
114
|
return e;
|
|
115
115
|
}, ce = (e) => {
|
|
116
116
|
const t = ["calendar__day"];
|
|
117
|
-
return L(e) ? (q(e) && t.push("calendar__day--selected"), z(e) && t.push("calendar__day--in-range"), K(e) && t.push("calendar__day--hover-range")) : t.push("calendar__day--other-month"),
|
|
118
|
-
}, ie = () => y === "years" ? /* @__PURE__ */
|
|
117
|
+
return L(e) ? (q(e) && t.push("calendar__day--selected"), z(e) && t.push("calendar__day--in-range"), K(e) && t.push("calendar__day--hover-range")) : t.push("calendar__day--other-month"), me(e) && t.push("calendar__day--today"), fe(e) && t.push("calendar__day--weekend"), w(e) && t.push("calendar__day--disabled"), t.join(" ");
|
|
118
|
+
}, ie = () => y === "years" ? /* @__PURE__ */ m("div", {
|
|
119
119
|
className: "calendar__header",
|
|
120
120
|
children: [
|
|
121
|
-
/* @__PURE__ */ n(
|
|
121
|
+
/* @__PURE__ */ n(_, {
|
|
122
122
|
title: "Previous years",
|
|
123
123
|
children: /* @__PURE__ */ n("button", {
|
|
124
124
|
type: "button",
|
|
@@ -127,7 +127,7 @@ var d = 12, T = [
|
|
|
127
127
|
children: "‹"
|
|
128
128
|
})
|
|
129
129
|
}),
|
|
130
|
-
/* @__PURE__ */
|
|
130
|
+
/* @__PURE__ */ m("div", {
|
|
131
131
|
className: "calendar__month-year",
|
|
132
132
|
children: [
|
|
133
133
|
b,
|
|
@@ -135,7 +135,7 @@ var d = 12, T = [
|
|
|
135
135
|
b + d - 1
|
|
136
136
|
]
|
|
137
137
|
}),
|
|
138
|
-
/* @__PURE__ */ n(
|
|
138
|
+
/* @__PURE__ */ n(_, {
|
|
139
139
|
title: "Next years",
|
|
140
140
|
children: /* @__PURE__ */ n("button", {
|
|
141
141
|
type: "button",
|
|
@@ -145,10 +145,10 @@ var d = 12, T = [
|
|
|
145
145
|
})
|
|
146
146
|
})
|
|
147
147
|
]
|
|
148
|
-
}) : y === "months" ? /* @__PURE__ */
|
|
148
|
+
}) : y === "months" ? /* @__PURE__ */ m("div", {
|
|
149
149
|
className: "calendar__header",
|
|
150
150
|
children: [
|
|
151
|
-
/* @__PURE__ */ n(
|
|
151
|
+
/* @__PURE__ */ n(_, {
|
|
152
152
|
title: "Previous year",
|
|
153
153
|
children: /* @__PURE__ */ n("button", {
|
|
154
154
|
type: "button",
|
|
@@ -163,7 +163,7 @@ var d = 12, T = [
|
|
|
163
163
|
onClick: $,
|
|
164
164
|
children: a.getFullYear()
|
|
165
165
|
}),
|
|
166
|
-
/* @__PURE__ */ n(
|
|
166
|
+
/* @__PURE__ */ n(_, {
|
|
167
167
|
title: "Next year",
|
|
168
168
|
children: /* @__PURE__ */ n("button", {
|
|
169
169
|
type: "button",
|
|
@@ -173,10 +173,10 @@ var d = 12, T = [
|
|
|
173
173
|
})
|
|
174
174
|
})
|
|
175
175
|
]
|
|
176
|
-
}) : /* @__PURE__ */
|
|
176
|
+
}) : /* @__PURE__ */ m("div", {
|
|
177
177
|
className: "calendar__header",
|
|
178
178
|
children: [
|
|
179
|
-
/* @__PURE__ */ n(
|
|
179
|
+
/* @__PURE__ */ n(_, {
|
|
180
180
|
title: "Previous month",
|
|
181
181
|
children: /* @__PURE__ */ n("button", {
|
|
182
182
|
type: "button",
|
|
@@ -187,14 +187,14 @@ var d = 12, T = [
|
|
|
187
187
|
}),
|
|
188
188
|
/* @__PURE__ */ n("div", {
|
|
189
189
|
className: "calendar__month-year",
|
|
190
|
-
children:
|
|
190
|
+
children: R ? /* @__PURE__ */ n("span", {
|
|
191
191
|
className: "calendar__header-label",
|
|
192
|
-
children:
|
|
193
|
-
}) : /* @__PURE__ */
|
|
192
|
+
children: S[a.getMonth()]
|
|
193
|
+
}) : /* @__PURE__ */ m(V, { children: [/* @__PURE__ */ n("button", {
|
|
194
194
|
type: "button",
|
|
195
195
|
className: "calendar__header-button",
|
|
196
196
|
onClick: C,
|
|
197
|
-
children:
|
|
197
|
+
children: S[a.getMonth()]
|
|
198
198
|
}), /* @__PURE__ */ n("button", {
|
|
199
199
|
type: "button",
|
|
200
200
|
className: "calendar__header-button",
|
|
@@ -202,7 +202,7 @@ var d = 12, T = [
|
|
|
202
202
|
children: a.getFullYear()
|
|
203
203
|
})] })
|
|
204
204
|
}),
|
|
205
|
-
/* @__PURE__ */ n(
|
|
205
|
+
/* @__PURE__ */ n(_, {
|
|
206
206
|
title: "Next month",
|
|
207
207
|
children: /* @__PURE__ */ n("button", {
|
|
208
208
|
type: "button",
|
|
@@ -227,22 +227,22 @@ var d = 12, T = [
|
|
|
227
227
|
const e = (/* @__PURE__ */ new Date()).getMonth(), t = (/* @__PURE__ */ new Date()).getFullYear(), l = a.getMonth(), s = a.getFullYear();
|
|
228
228
|
return /* @__PURE__ */ n("div", {
|
|
229
229
|
className: "calendar__months-grid",
|
|
230
|
-
children:
|
|
230
|
+
children: S.map((x, N) => /* @__PURE__ */ n("button", {
|
|
231
231
|
type: "button",
|
|
232
232
|
className: `calendar__month-item ${N === l && s === a.getFullYear() ? "calendar__month-item--selected" : ""} ${N === e && t === a.getFullYear() ? "calendar__month-item--current" : ""}`,
|
|
233
233
|
onClick: () => ee(N),
|
|
234
|
-
children:
|
|
235
|
-
},
|
|
234
|
+
children: x.substring(0, 3)
|
|
235
|
+
}, x))
|
|
236
236
|
});
|
|
237
237
|
};
|
|
238
|
-
return /* @__PURE__ */
|
|
238
|
+
return /* @__PURE__ */ m("div", {
|
|
239
239
|
className: `calendar ${G}`,
|
|
240
240
|
children: [
|
|
241
241
|
F && ie(),
|
|
242
242
|
y === "years" && oe(),
|
|
243
243
|
y === "months" && de(),
|
|
244
|
-
y === "days" && /* @__PURE__ */
|
|
245
|
-
j && !
|
|
244
|
+
y === "days" && /* @__PURE__ */ m(V, { children: [
|
|
245
|
+
j && !R && /* @__PURE__ */ n("div", {
|
|
246
246
|
className: "calendar__today-section",
|
|
247
247
|
children: /* @__PURE__ */ n("button", {
|
|
248
248
|
type: "button",
|
|
@@ -262,13 +262,15 @@ var d = 12, T = [
|
|
|
262
262
|
className: "calendar__days",
|
|
263
263
|
children: B.map((e, t) => /* @__PURE__ */ n("div", {
|
|
264
264
|
className: "calendar__week",
|
|
265
|
-
children: e.map((l, s) => /* @__PURE__ */ n(
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
265
|
+
children: e.map((l, s) => /* @__PURE__ */ n(_, {
|
|
266
|
+
title: ue(l, "DD MMM YYYY"),
|
|
267
|
+
children: /* @__PURE__ */ n("button", {
|
|
268
|
+
type: "button",
|
|
269
|
+
className: ce(l),
|
|
270
|
+
onClick: () => Q(l),
|
|
271
|
+
disabled: w(l),
|
|
272
|
+
children: l.getDate()
|
|
273
|
+
})
|
|
272
274
|
}, s))
|
|
273
275
|
}, t))
|
|
274
276
|
})
|
|
@@ -277,5 +279,5 @@ var d = 12, T = [
|
|
|
277
279
|
});
|
|
278
280
|
};
|
|
279
281
|
export {
|
|
280
|
-
|
|
282
|
+
we as Calendar
|
|
281
283
|
};
|