easy-component-ui 3.0.13 → 3.0.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.
- package/README.md +162 -162
- package/dist/components/Base.js +380 -313
- package/dist/components/ea-calendar2.js +159 -159
- package/dist/components/ea-icon.js +37 -36
- package/dist/components/ea-input.js +13 -13
- package/dist/components/ea-message.js +0 -1
- package/dist/components/ea-table.js +29 -27
- package/dist/components/ea-tabs.js +16 -14
- package/dist/core/FormBase.js +17 -17
- package/package.json +8 -2
|
@@ -4,7 +4,7 @@ var _t = (f) => {
|
|
|
4
4
|
};
|
|
5
5
|
var At = (f, y, t) => y in f ? Ot(f, y, { enumerable: !0, configurable: !0, writable: !0, value: t }) : f[y] = t;
|
|
6
6
|
var St = (f, y, t) => At(f, typeof y != "symbol" ? y + "" : y, t), Mt = (f, y, t) => y.has(f) || _t("Cannot " + t);
|
|
7
|
-
var
|
|
7
|
+
var s = (f, y, t) => (Mt(f, y, "read from private field"), t ? t.call(f) : y.get(f)), C = (f, y, t) => y.has(f) ? _t("Cannot add the same private member more than once") : y instanceof WeakSet ? y.add(f) : y.set(f, t), z = (f, y, t, e) => (Mt(f, y, "write to private field"), e ? e.call(f, t) : y.set(f, t), t), Dt = (f, y, t) => (Mt(f, y, "access private method"), t);
|
|
8
8
|
import { B as Tt } from "./Base.js";
|
|
9
9
|
import { s as Rt } from "../css/ea-calendar.style.js";
|
|
10
10
|
import "./ea-button.js";
|
|
@@ -34,42 +34,42 @@ function xt() {
|
|
|
34
34
|
(function(t, e) {
|
|
35
35
|
f.exports = e();
|
|
36
36
|
})(Lt, function() {
|
|
37
|
-
var t = 1e3, e = 6e4, h = 36e5, p = "millisecond", d = "second",
|
|
37
|
+
var t = 1e3, e = 6e4, h = 36e5, p = "millisecond", d = "second", v = "minute", b = "hour", $ = "day", L = "week", g = "month", F = "quarter", k = "year", m = "date", I = "Invalid Date", B = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, U = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, P = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(i) {
|
|
38
38
|
var a = ["th", "st", "nd", "rd"], n = i % 100;
|
|
39
39
|
return "[" + i + (a[(n - 20) % 10] || a[n] || a[0]) + "]";
|
|
40
40
|
} }, H = function(i, a, n) {
|
|
41
|
-
var
|
|
42
|
-
return !
|
|
41
|
+
var o = String(i);
|
|
42
|
+
return !o || o.length >= a ? i : "" + Array(a + 1 - o.length).join(n) + i;
|
|
43
43
|
}, bt = { s: H, z: function(i) {
|
|
44
|
-
var a = -i.utcOffset(), n = Math.abs(a),
|
|
45
|
-
return (a <= 0 ? "+" : "-") + H(
|
|
44
|
+
var a = -i.utcOffset(), n = Math.abs(a), o = Math.floor(n / 60), r = n % 60;
|
|
45
|
+
return (a <= 0 ? "+" : "-") + H(o, 2, "0") + ":" + H(r, 2, "0");
|
|
46
46
|
}, m: function i(a, n) {
|
|
47
47
|
if (a.date() < n.date()) return -i(n, a);
|
|
48
|
-
var
|
|
49
|
-
return +(-(
|
|
48
|
+
var o = 12 * (n.year() - a.year()) + (n.month() - a.month()), r = a.clone().add(o, g), l = n - r < 0, c = a.clone().add(o + (l ? -1 : 1), g);
|
|
49
|
+
return +(-(o + (n - r) / (l ? r - c : c - r)) || 0);
|
|
50
50
|
}, a: function(i) {
|
|
51
51
|
return i < 0 ? Math.ceil(i) || 0 : Math.floor(i);
|
|
52
52
|
}, p: function(i) {
|
|
53
|
-
return { M: g, y: k, w:
|
|
53
|
+
return { M: g, y: k, w: L, d: $, D: m, h: b, m: v, s: d, ms: p, Q: F }[i] || String(i || "").toLowerCase().replace(/s$/, "");
|
|
54
54
|
}, u: function(i) {
|
|
55
55
|
return i === void 0;
|
|
56
|
-
} },
|
|
57
|
-
T[
|
|
56
|
+
} }, M = "en", T = {};
|
|
57
|
+
T[M] = P;
|
|
58
58
|
var K = "$isDayjsObject", X = function(i) {
|
|
59
59
|
return i instanceof q || !(!i || !i[K]);
|
|
60
|
-
}, W = function i(a, n,
|
|
60
|
+
}, W = function i(a, n, o) {
|
|
61
61
|
var r;
|
|
62
|
-
if (!a) return
|
|
62
|
+
if (!a) return M;
|
|
63
63
|
if (typeof a == "string") {
|
|
64
64
|
var l = a.toLowerCase();
|
|
65
65
|
T[l] && (r = l), n && (T[l] = n, r = l);
|
|
66
66
|
var c = a.split("-");
|
|
67
67
|
if (!r && c.length > 1) return i(c[0]);
|
|
68
68
|
} else {
|
|
69
|
-
var
|
|
70
|
-
T[
|
|
69
|
+
var D = a.name;
|
|
70
|
+
T[D] = a, r = D;
|
|
71
71
|
}
|
|
72
|
-
return !
|
|
72
|
+
return !o && r && (M = r), r || !o && M;
|
|
73
73
|
}, w = function(i, a) {
|
|
74
74
|
if (X(i)) return i.clone();
|
|
75
75
|
var n = typeof a == "object" ? a : {};
|
|
@@ -84,16 +84,16 @@ function xt() {
|
|
|
84
84
|
}
|
|
85
85
|
var a = i.prototype;
|
|
86
86
|
return a.parse = function(n) {
|
|
87
|
-
this.$d = function(
|
|
88
|
-
var r =
|
|
87
|
+
this.$d = function(o) {
|
|
88
|
+
var r = o.date, l = o.utc;
|
|
89
89
|
if (r === null) return /* @__PURE__ */ new Date(NaN);
|
|
90
90
|
if (u.u(r)) return /* @__PURE__ */ new Date();
|
|
91
91
|
if (r instanceof Date) return new Date(r);
|
|
92
92
|
if (typeof r == "string" && !/Z$/i.test(r)) {
|
|
93
93
|
var c = r.match(B);
|
|
94
94
|
if (c) {
|
|
95
|
-
var
|
|
96
|
-
return l ? new Date(Date.UTC(c[1],
|
|
95
|
+
var D = c[2] - 1 || 0, S = (c[7] || "0").substring(0, 3);
|
|
96
|
+
return l ? new Date(Date.UTC(c[1], D, c[3] || 1, c[4] || 0, c[5] || 0, c[6] || 0, S)) : new Date(c[1], D, c[3] || 1, c[4] || 0, c[5] || 0, c[6] || 0, S);
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
return new Date(r);
|
|
@@ -105,40 +105,40 @@ function xt() {
|
|
|
105
105
|
return u;
|
|
106
106
|
}, a.isValid = function() {
|
|
107
107
|
return this.$d.toString() !== I;
|
|
108
|
-
}, a.isSame = function(n,
|
|
108
|
+
}, a.isSame = function(n, o) {
|
|
109
109
|
var r = w(n);
|
|
110
|
-
return this.startOf(
|
|
111
|
-
}, a.isAfter = function(n,
|
|
112
|
-
return w(n) < this.startOf(
|
|
113
|
-
}, a.isBefore = function(n,
|
|
114
|
-
return this.endOf(
|
|
115
|
-
}, a.$g = function(n,
|
|
116
|
-
return u.u(n) ? this[
|
|
110
|
+
return this.startOf(o) <= r && r <= this.endOf(o);
|
|
111
|
+
}, a.isAfter = function(n, o) {
|
|
112
|
+
return w(n) < this.startOf(o);
|
|
113
|
+
}, a.isBefore = function(n, o) {
|
|
114
|
+
return this.endOf(o) < w(n);
|
|
115
|
+
}, a.$g = function(n, o, r) {
|
|
116
|
+
return u.u(n) ? this[o] : this.set(r, n);
|
|
117
117
|
}, a.unix = function() {
|
|
118
118
|
return Math.floor(this.valueOf() / 1e3);
|
|
119
119
|
}, a.valueOf = function() {
|
|
120
120
|
return this.$d.getTime();
|
|
121
|
-
}, a.startOf = function(n,
|
|
122
|
-
var r = this, l = !!u.u(
|
|
123
|
-
var J = u.w(r.$u ? Date.UTC(r.$y,
|
|
121
|
+
}, a.startOf = function(n, o) {
|
|
122
|
+
var r = this, l = !!u.u(o) || o, c = u.p(n), D = function(V, O) {
|
|
123
|
+
var J = u.w(r.$u ? Date.UTC(r.$y, O, V) : new Date(r.$y, O, V), r);
|
|
124
124
|
return l ? J : J.endOf($);
|
|
125
|
-
}, S = function(V,
|
|
126
|
-
return u.w(r.toDate()[V].apply(r.toDate("s"), (l ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(
|
|
125
|
+
}, S = function(V, O) {
|
|
126
|
+
return u.w(r.toDate()[V].apply(r.toDate("s"), (l ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(O)), r);
|
|
127
127
|
}, x = this.$W, E = this.$M, j = this.$D, tt = "set" + (this.$u ? "UTC" : "");
|
|
128
128
|
switch (c) {
|
|
129
129
|
case k:
|
|
130
|
-
return l ?
|
|
130
|
+
return l ? D(1, 0) : D(31, 11);
|
|
131
131
|
case g:
|
|
132
|
-
return l ?
|
|
133
|
-
case
|
|
132
|
+
return l ? D(1, E) : D(0, E + 1);
|
|
133
|
+
case L:
|
|
134
134
|
var Z = this.$locale().weekStart || 0, nt = (x < Z ? x + 7 : x) - Z;
|
|
135
|
-
return
|
|
135
|
+
return D(l ? j - nt : j + (6 - nt), E);
|
|
136
136
|
case $:
|
|
137
137
|
case m:
|
|
138
138
|
return S(tt + "Hours", 0);
|
|
139
139
|
case b:
|
|
140
140
|
return S(tt + "Minutes", 1);
|
|
141
|
-
case
|
|
141
|
+
case v:
|
|
142
142
|
return S(tt + "Seconds", 2);
|
|
143
143
|
case d:
|
|
144
144
|
return S(tt + "Milliseconds", 3);
|
|
@@ -147,50 +147,50 @@ function xt() {
|
|
|
147
147
|
}
|
|
148
148
|
}, a.endOf = function(n) {
|
|
149
149
|
return this.startOf(n, !1);
|
|
150
|
-
}, a.$set = function(n,
|
|
151
|
-
var r, l = u.p(n), c = "set" + (this.$u ? "UTC" : ""),
|
|
150
|
+
}, a.$set = function(n, o) {
|
|
151
|
+
var r, l = u.p(n), c = "set" + (this.$u ? "UTC" : ""), D = (r = {}, r[$] = c + "Date", r[m] = c + "Date", r[g] = c + "Month", r[k] = c + "FullYear", r[b] = c + "Hours", r[v] = c + "Minutes", r[d] = c + "Seconds", r[p] = c + "Milliseconds", r)[l], S = l === $ ? this.$D + (o - this.$W) : o;
|
|
152
152
|
if (l === g || l === k) {
|
|
153
153
|
var x = this.clone().set(m, 1);
|
|
154
|
-
x.$d[
|
|
155
|
-
} else
|
|
154
|
+
x.$d[D](S), x.init(), this.$d = x.set(m, Math.min(this.$D, x.daysInMonth())).$d;
|
|
155
|
+
} else D && this.$d[D](S);
|
|
156
156
|
return this.init(), this;
|
|
157
|
-
}, a.set = function(n,
|
|
158
|
-
return this.clone().$set(n,
|
|
157
|
+
}, a.set = function(n, o) {
|
|
158
|
+
return this.clone().$set(n, o);
|
|
159
159
|
}, a.get = function(n) {
|
|
160
160
|
return this[u.p(n)]();
|
|
161
|
-
}, a.add = function(n,
|
|
161
|
+
}, a.add = function(n, o) {
|
|
162
162
|
var r, l = this;
|
|
163
163
|
n = Number(n);
|
|
164
|
-
var c = u.p(
|
|
164
|
+
var c = u.p(o), D = function(E) {
|
|
165
165
|
var j = w(l);
|
|
166
166
|
return u.w(j.date(j.date() + Math.round(E * n)), l);
|
|
167
167
|
};
|
|
168
168
|
if (c === g) return this.set(g, this.$M + n);
|
|
169
169
|
if (c === k) return this.set(k, this.$y + n);
|
|
170
|
-
if (c === $) return
|
|
171
|
-
if (c ===
|
|
172
|
-
var S = (r = {}, r[
|
|
170
|
+
if (c === $) return D(1);
|
|
171
|
+
if (c === L) return D(7);
|
|
172
|
+
var S = (r = {}, r[v] = e, r[b] = h, r[d] = t, r)[c] || 1, x = this.$d.getTime() + n * S;
|
|
173
173
|
return u.w(x, this);
|
|
174
|
-
}, a.subtract = function(n,
|
|
175
|
-
return this.add(-1 * n,
|
|
174
|
+
}, a.subtract = function(n, o) {
|
|
175
|
+
return this.add(-1 * n, o);
|
|
176
176
|
}, a.format = function(n) {
|
|
177
|
-
var
|
|
177
|
+
var o = this, r = this.$locale();
|
|
178
178
|
if (!this.isValid()) return r.invalidDate || I;
|
|
179
|
-
var l = n || "YYYY-MM-DDTHH:mm:ssZ", c = u.z(this),
|
|
180
|
-
return
|
|
181
|
-
}, nt = function(
|
|
182
|
-
return u.s(
|
|
183
|
-
}, V = tt || function(
|
|
184
|
-
var ut =
|
|
179
|
+
var l = n || "YYYY-MM-DDTHH:mm:ssZ", c = u.z(this), D = this.$H, S = this.$m, x = this.$M, E = r.weekdays, j = r.months, tt = r.meridiem, Z = function(O, J, rt, ut) {
|
|
180
|
+
return O && (O[J] || O(o, l)) || rt[J].slice(0, ut);
|
|
181
|
+
}, nt = function(O) {
|
|
182
|
+
return u.s(D % 12 || 12, O, "0");
|
|
183
|
+
}, V = tt || function(O, J, rt) {
|
|
184
|
+
var ut = O < 12 ? "AM" : "PM";
|
|
185
185
|
return rt ? ut.toLowerCase() : ut;
|
|
186
186
|
};
|
|
187
|
-
return l.replace(U, function(
|
|
187
|
+
return l.replace(U, function(O, J) {
|
|
188
188
|
return J || function(rt) {
|
|
189
189
|
switch (rt) {
|
|
190
190
|
case "YY":
|
|
191
|
-
return String(
|
|
191
|
+
return String(o.$y).slice(-2);
|
|
192
192
|
case "YYYY":
|
|
193
|
-
return u.s(
|
|
193
|
+
return u.s(o.$y, 4, "0");
|
|
194
194
|
case "M":
|
|
195
195
|
return x + 1;
|
|
196
196
|
case "MM":
|
|
@@ -200,52 +200,52 @@ function xt() {
|
|
|
200
200
|
case "MMMM":
|
|
201
201
|
return Z(j, x);
|
|
202
202
|
case "D":
|
|
203
|
-
return
|
|
203
|
+
return o.$D;
|
|
204
204
|
case "DD":
|
|
205
|
-
return u.s(
|
|
205
|
+
return u.s(o.$D, 2, "0");
|
|
206
206
|
case "d":
|
|
207
|
-
return String(
|
|
207
|
+
return String(o.$W);
|
|
208
208
|
case "dd":
|
|
209
|
-
return Z(r.weekdaysMin,
|
|
209
|
+
return Z(r.weekdaysMin, o.$W, E, 2);
|
|
210
210
|
case "ddd":
|
|
211
|
-
return Z(r.weekdaysShort,
|
|
211
|
+
return Z(r.weekdaysShort, o.$W, E, 3);
|
|
212
212
|
case "dddd":
|
|
213
|
-
return E[
|
|
213
|
+
return E[o.$W];
|
|
214
214
|
case "H":
|
|
215
|
-
return String(
|
|
215
|
+
return String(D);
|
|
216
216
|
case "HH":
|
|
217
|
-
return u.s(
|
|
217
|
+
return u.s(D, 2, "0");
|
|
218
218
|
case "h":
|
|
219
219
|
return nt(1);
|
|
220
220
|
case "hh":
|
|
221
221
|
return nt(2);
|
|
222
222
|
case "a":
|
|
223
|
-
return V(
|
|
223
|
+
return V(D, S, !0);
|
|
224
224
|
case "A":
|
|
225
|
-
return V(
|
|
225
|
+
return V(D, S, !1);
|
|
226
226
|
case "m":
|
|
227
227
|
return String(S);
|
|
228
228
|
case "mm":
|
|
229
229
|
return u.s(S, 2, "0");
|
|
230
230
|
case "s":
|
|
231
|
-
return String(
|
|
231
|
+
return String(o.$s);
|
|
232
232
|
case "ss":
|
|
233
|
-
return u.s(
|
|
233
|
+
return u.s(o.$s, 2, "0");
|
|
234
234
|
case "SSS":
|
|
235
|
-
return u.s(
|
|
235
|
+
return u.s(o.$ms, 3, "0");
|
|
236
236
|
case "Z":
|
|
237
237
|
return c;
|
|
238
238
|
}
|
|
239
239
|
return null;
|
|
240
|
-
}(
|
|
240
|
+
}(O) || c.replace(":", "");
|
|
241
241
|
});
|
|
242
242
|
}, a.utcOffset = function() {
|
|
243
243
|
return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
|
|
244
|
-
}, a.diff = function(n,
|
|
245
|
-
var l, c = this,
|
|
244
|
+
}, a.diff = function(n, o, r) {
|
|
245
|
+
var l, c = this, D = u.p(o), S = w(n), x = (S.utcOffset() - this.utcOffset()) * e, E = this - S, j = function() {
|
|
246
246
|
return u.m(c, S);
|
|
247
247
|
};
|
|
248
|
-
switch (
|
|
248
|
+
switch (D) {
|
|
249
249
|
case k:
|
|
250
250
|
l = j() / 12;
|
|
251
251
|
break;
|
|
@@ -255,7 +255,7 @@ function xt() {
|
|
|
255
255
|
case F:
|
|
256
256
|
l = j() / 3;
|
|
257
257
|
break;
|
|
258
|
-
case
|
|
258
|
+
case L:
|
|
259
259
|
l = (E - x) / 6048e5;
|
|
260
260
|
break;
|
|
261
261
|
case $:
|
|
@@ -264,7 +264,7 @@ function xt() {
|
|
|
264
264
|
case b:
|
|
265
265
|
l = E / h;
|
|
266
266
|
break;
|
|
267
|
-
case
|
|
267
|
+
case v:
|
|
268
268
|
l = E / e;
|
|
269
269
|
break;
|
|
270
270
|
case d:
|
|
@@ -278,9 +278,9 @@ function xt() {
|
|
|
278
278
|
return this.endOf(g).$D;
|
|
279
279
|
}, a.$locale = function() {
|
|
280
280
|
return T[this.$L];
|
|
281
|
-
}, a.locale = function(n,
|
|
281
|
+
}, a.locale = function(n, o) {
|
|
282
282
|
if (!n) return this.$L;
|
|
283
|
-
var r = this.clone(), l = W(n,
|
|
283
|
+
var r = this.clone(), l = W(n, o, !0);
|
|
284
284
|
return l && (r.$L = l), r;
|
|
285
285
|
}, a.clone = function() {
|
|
286
286
|
return u.w(this.$d, this);
|
|
@@ -294,7 +294,7 @@ function xt() {
|
|
|
294
294
|
return this.$d.toUTCString();
|
|
295
295
|
}, i;
|
|
296
296
|
}(), wt = q.prototype;
|
|
297
|
-
return w.prototype = wt, [["$ms", p], ["$s", d], ["$m",
|
|
297
|
+
return w.prototype = wt, [["$ms", p], ["$s", d], ["$m", v], ["$H", b], ["$W", $], ["$M", g], ["$y", k], ["$D", m]].forEach(function(i) {
|
|
298
298
|
wt[i[1]] = function(a) {
|
|
299
299
|
return this.$g(a, i[0], i[1]);
|
|
300
300
|
};
|
|
@@ -302,12 +302,12 @@ function xt() {
|
|
|
302
302
|
return i.$i || (i(a, q, w), i.$i = !0), w;
|
|
303
303
|
}, w.locale = W, w.isDayjs = X, w.unix = function(i) {
|
|
304
304
|
return w(1e3 * i);
|
|
305
|
-
}, w.en = T[
|
|
305
|
+
}, w.en = T[M], w.Ls = T, w.p = {}, w;
|
|
306
306
|
});
|
|
307
307
|
}(vt)), vt.exports;
|
|
308
308
|
}
|
|
309
309
|
var qt = xt();
|
|
310
|
-
const
|
|
310
|
+
const A = /* @__PURE__ */ jt(qt);
|
|
311
311
|
var It = { exports: {} };
|
|
312
312
|
(function(f, y) {
|
|
313
313
|
(function(t, e) {
|
|
@@ -316,16 +316,16 @@ var It = { exports: {} };
|
|
|
316
316
|
function e(d) {
|
|
317
317
|
return d && typeof d == "object" && "default" in d ? d : { default: d };
|
|
318
318
|
}
|
|
319
|
-
var h = e(t), p = { name: "zh-cn", weekdays: "星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"), weekdaysShort: "周日_周一_周二_周三_周四_周五_周六".split("_"), weekdaysMin: "日_一_二_三_四_五_六".split("_"), months: "一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"), monthsShort: "1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"), ordinal: function(d,
|
|
320
|
-
return
|
|
321
|
-
}, weekStart: 1, yearStart: 4, formats: { LT: "HH:mm", LTS: "HH:mm:ss", L: "YYYY/MM/DD", LL: "YYYY年M月D日", LLL: "YYYY年M月D日Ah点mm分", LLLL: "YYYY年M月D日ddddAh点mm分", l: "YYYY/M/D", ll: "YYYY年M月D日", lll: "YYYY年M月D日 HH:mm", llll: "YYYY年M月D日dddd HH:mm" }, relativeTime: { future: "%s内", past: "%s前", s: "几秒", m: "1 分钟", mm: "%d 分钟", h: "1 小时", hh: "%d 小时", d: "1 天", dd: "%d 天", M: "1 个月", MM: "%d 个月", y: "1 年", yy: "%d 年" }, meridiem: function(d,
|
|
322
|
-
var b = 100 * d +
|
|
319
|
+
var h = e(t), p = { name: "zh-cn", weekdays: "星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"), weekdaysShort: "周日_周一_周二_周三_周四_周五_周六".split("_"), weekdaysMin: "日_一_二_三_四_五_六".split("_"), months: "一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"), monthsShort: "1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"), ordinal: function(d, v) {
|
|
320
|
+
return v === "W" ? d + "周" : d + "日";
|
|
321
|
+
}, weekStart: 1, yearStart: 4, formats: { LT: "HH:mm", LTS: "HH:mm:ss", L: "YYYY/MM/DD", LL: "YYYY年M月D日", LLL: "YYYY年M月D日Ah点mm分", LLLL: "YYYY年M月D日ddddAh点mm分", l: "YYYY/M/D", ll: "YYYY年M月D日", lll: "YYYY年M月D日 HH:mm", llll: "YYYY年M月D日dddd HH:mm" }, relativeTime: { future: "%s内", past: "%s前", s: "几秒", m: "1 分钟", mm: "%d 分钟", h: "1 小时", hh: "%d 小时", d: "1 天", dd: "%d 天", M: "1 个月", MM: "%d 个月", y: "1 年", yy: "%d 年" }, meridiem: function(d, v) {
|
|
322
|
+
var b = 100 * d + v;
|
|
323
323
|
return b < 600 ? "凌晨" : b < 900 ? "早上" : b < 1100 ? "上午" : b < 1300 ? "中午" : b < 1800 ? "下午" : "晚上";
|
|
324
324
|
} };
|
|
325
325
|
return h.default.locale(p, null, !0), p;
|
|
326
326
|
});
|
|
327
327
|
})(It);
|
|
328
|
-
var at, ht, G, st, dt, ot, N, Q, R,
|
|
328
|
+
var at, ht, G, st, dt, ot, N, Q, R, Y, ft, it, mt, yt, pt, et, kt, $t, lt, gt, Et, ct;
|
|
329
329
|
class Bt extends Tt {
|
|
330
330
|
constructor() {
|
|
331
331
|
super();
|
|
@@ -350,17 +350,17 @@ class Bt extends Tt {
|
|
|
350
350
|
/** @type {AbortController | null} */
|
|
351
351
|
dateChangeAbortController: null
|
|
352
352
|
});
|
|
353
|
-
C(this,
|
|
353
|
+
C(this, Y, {
|
|
354
354
|
isEaSelectImported: !1,
|
|
355
355
|
isEaButtonImported: !1,
|
|
356
|
-
displayDate:
|
|
356
|
+
displayDate: A()
|
|
357
357
|
});
|
|
358
358
|
St(this, "state", this.properties({
|
|
359
359
|
"controller-type": {
|
|
360
360
|
type: ["button", "select"],
|
|
361
361
|
default: "button",
|
|
362
362
|
observer: (t) => {
|
|
363
|
-
|
|
363
|
+
s(this, it).call(this, t);
|
|
364
364
|
}
|
|
365
365
|
}
|
|
366
366
|
}));
|
|
@@ -368,9 +368,9 @@ class Bt extends Tt {
|
|
|
368
368
|
* 今天按钮点击时的事件
|
|
369
369
|
*/
|
|
370
370
|
C(this, ft, () => {
|
|
371
|
-
_.locale = this.locale,
|
|
372
|
-
const t =
|
|
373
|
-
|
|
371
|
+
_.locale = this.locale, A.locale(this.locale.toLowerCase());
|
|
372
|
+
const t = A();
|
|
373
|
+
s(this, Y).displayDate = t, s(this, G).textContent = `${t.get("year")} ${_.t("calendar.months")[t.get("month")]}`, this.value = t;
|
|
374
374
|
});
|
|
375
375
|
/**
|
|
376
376
|
* controller-type 的渲染器
|
|
@@ -378,9 +378,9 @@ class Bt extends Tt {
|
|
|
378
378
|
* @return {string} 属性值
|
|
379
379
|
*/
|
|
380
380
|
C(this, it, async (t = this["controller-type"]) => {
|
|
381
|
-
var
|
|
382
|
-
_.locale = this.locale,
|
|
383
|
-
const e = this.ns, h =
|
|
381
|
+
var v;
|
|
382
|
+
_.locale = this.locale, A.locale(this.locale.toLowerCase());
|
|
383
|
+
const e = this.ns, h = s(this, Y).displayDate.get("year"), p = {
|
|
384
384
|
button: () => this.html(`
|
|
385
385
|
<ea-button-group class='${e.e("controller-group")}' part='controller-group' size="small">
|
|
386
386
|
<ea-button class='${e.e("controller")} ${e.e("controller-prev")}' part='controller prev'>
|
|
@@ -397,10 +397,10 @@ class Bt extends Tt {
|
|
|
397
397
|
select: () => {
|
|
398
398
|
const b = Array.from(
|
|
399
399
|
{ length: 20 },
|
|
400
|
-
(
|
|
400
|
+
(L, g) => `<ea-option value="${h - 10 + g}">${h - 10 + g}</ea-option>`
|
|
401
401
|
).join(""), $ = Array.from(
|
|
402
402
|
{ length: 12 },
|
|
403
|
-
(
|
|
403
|
+
(L, g) => `<ea-option value="${g + 1}">${g + 1}</ea-option>`
|
|
404
404
|
).join("");
|
|
405
405
|
return this.html(`
|
|
406
406
|
<section class='${e.e("controller-group")}' part='controller-group'>
|
|
@@ -417,46 +417,46 @@ class Bt extends Tt {
|
|
|
417
417
|
`);
|
|
418
418
|
}
|
|
419
419
|
};
|
|
420
|
-
(
|
|
420
|
+
(v = s(this, R).dateChangeAbortController) == null || v.abort(), s(this, R).dateChangeAbortController = new AbortController(), s(this, st).innerHTML = p[t](), t === "select" ? s(this, yt).call(this) : s(this, mt).call(this);
|
|
421
421
|
const d = this.shadowRoot.querySelector(e.ce("controller-today"));
|
|
422
|
-
d && d.addEventListener("click",
|
|
423
|
-
signal:
|
|
422
|
+
d && d.addEventListener("click", s(this, ft), {
|
|
423
|
+
signal: s(this, R).dateChangeAbortController.signal
|
|
424
424
|
});
|
|
425
425
|
});
|
|
426
426
|
/**
|
|
427
427
|
* 初始化控制器为 button 的事件
|
|
428
428
|
*/
|
|
429
429
|
C(this, mt, async () => {
|
|
430
|
-
|
|
430
|
+
s(this, Y).isEaButtonImported || (await customElements.whenDefined("ea-button"), s(this, Y).isEaButtonImported = !0);
|
|
431
431
|
const t = this.ns, e = this.shadowRoot.querySelector(t.ce("controller-prev")), h = this.shadowRoot.querySelector(t.ce("controller-next")), p = () => {
|
|
432
|
-
this.value =
|
|
432
|
+
this.value = s(this, Y).displayDate.subtract(1, "month").set("date", 1);
|
|
433
433
|
}, d = () => {
|
|
434
|
-
this.value =
|
|
434
|
+
this.value = s(this, Y).displayDate.add(1, "month").set("date", 1);
|
|
435
435
|
};
|
|
436
436
|
e && e.addEventListener("click", p, {
|
|
437
|
-
signal:
|
|
437
|
+
signal: s(this, R).dateChangeAbortController.signal
|
|
438
438
|
}), h && h.addEventListener("click", d, {
|
|
439
|
-
signal:
|
|
439
|
+
signal: s(this, R).dateChangeAbortController.signal
|
|
440
440
|
});
|
|
441
441
|
});
|
|
442
442
|
/**
|
|
443
443
|
* 初始化控制器为 select 的事件
|
|
444
444
|
*/
|
|
445
445
|
C(this, yt, async () => {
|
|
446
|
-
|
|
447
|
-
const t = this.ns, e =
|
|
446
|
+
s(this, Y).isEaSelectImported || (await customElements.whenDefined("ea-select"), s(this, Y).isEaSelectImported = !0);
|
|
447
|
+
const t = this.ns, e = s(this, Y).displayDate.get("year"), h = s(this, Y).displayDate.get("month") + 1, p = this.shadowRoot.querySelector(t.ce("controller-year")), d = this.shadowRoot.querySelector(t.ce("controller-month")), v = ($) => {
|
|
448
448
|
$.stopImmediatePropagation();
|
|
449
|
-
const
|
|
450
|
-
this.value =
|
|
449
|
+
const L = parseInt($.target.value), g = s(this, Y).displayDate.get("month") + 1;
|
|
450
|
+
this.value = A(`${L}-${g}-01`);
|
|
451
451
|
}, b = ($) => {
|
|
452
452
|
$.stopImmediatePropagation();
|
|
453
|
-
const
|
|
454
|
-
this.value =
|
|
453
|
+
const L = s(this, Y).displayDate.get("year"), g = parseInt($.target.value).toString().padStart(2, "0");
|
|
454
|
+
this.value = A(`${L}-${g}-01`);
|
|
455
455
|
};
|
|
456
|
-
p && (p.value = e), d && (d.value = h), await Ct.sleep(0), p.addEventListener("change",
|
|
457
|
-
signal:
|
|
456
|
+
p && (p.value = e), d && (d.value = h), await Ct.sleep(0), p.addEventListener("change", v, {
|
|
457
|
+
signal: s(this, R).dateChangeAbortController.signal
|
|
458
458
|
}), d.addEventListener("change", b, {
|
|
459
|
-
signal:
|
|
459
|
+
signal: s(this, R).dateChangeAbortController.signal
|
|
460
460
|
});
|
|
461
461
|
});
|
|
462
462
|
/**
|
|
@@ -471,14 +471,14 @@ class Bt extends Tt {
|
|
|
471
471
|
*/
|
|
472
472
|
C(this, $t, (t) => {
|
|
473
473
|
let e = t.target.closest(this.ns.ce("day"));
|
|
474
|
-
if (!e || e ===
|
|
475
|
-
const h = parseInt(e.dataset.year), p = parseInt(e.dataset.month), d = parseInt(e.dataset.date),
|
|
476
|
-
this.value =
|
|
474
|
+
if (!e || e === s(this, N)) return;
|
|
475
|
+
const h = parseInt(e.dataset.year), p = parseInt(e.dataset.month), d = parseInt(e.dataset.date), v = A(`${h}-${p}-${d}`);
|
|
476
|
+
this.value = v, this.emit("select", {
|
|
477
477
|
detail: {
|
|
478
478
|
year: h,
|
|
479
479
|
month: p,
|
|
480
480
|
date: d,
|
|
481
|
-
day:
|
|
481
|
+
day: v.day(),
|
|
482
482
|
fullDate: `${h}-${p}-${d}`
|
|
483
483
|
},
|
|
484
484
|
bubbles: !0,
|
|
@@ -490,18 +490,18 @@ class Bt extends Tt {
|
|
|
490
490
|
* @param {dayjs.Dayjs} [refDate] 参考日期,默认为当前日期
|
|
491
491
|
* @return {DayOption}
|
|
492
492
|
*/
|
|
493
|
-
C(this, lt, (t =
|
|
494
|
-
const e = t, p = e.subtract(1, "month").daysInMonth(), d = e.startOf("month").day(),
|
|
493
|
+
C(this, lt, (t = A()) => {
|
|
494
|
+
const e = t, p = e.subtract(1, "month").daysInMonth(), d = e.startOf("month").day(), v = e.endOf("month").day(), b = e.daysInMonth(), $ = e.startOf("week").get("day"), L = Array.from(
|
|
495
495
|
{ length: d - $ },
|
|
496
496
|
(k, m) => p - m
|
|
497
497
|
).reverse(), g = Array.from(
|
|
498
498
|
{ length: b },
|
|
499
499
|
(k, m) => m + 1
|
|
500
500
|
), F = Array.from(
|
|
501
|
-
{ length: 6 -
|
|
501
|
+
{ length: 6 - v + $ },
|
|
502
502
|
(k, m) => m + 1
|
|
503
503
|
);
|
|
504
|
-
return { lastMonRemainingDays:
|
|
504
|
+
return { lastMonRemainingDays: L, currentMonDays: g, nextMonRemainingDays: F };
|
|
505
505
|
});
|
|
506
506
|
/**
|
|
507
507
|
* 查找指定日期的单元格
|
|
@@ -509,7 +509,7 @@ class Bt extends Tt {
|
|
|
509
509
|
* @param {Number} month
|
|
510
510
|
* @param {Number} date
|
|
511
511
|
*/
|
|
512
|
-
C(this, gt, (t, e, h) =>
|
|
512
|
+
C(this, gt, (t, e, h) => s(this, N).querySelector(
|
|
513
513
|
`td[data-year="${t}"][data-month="${e}"][data-date="${h}"]`
|
|
514
514
|
));
|
|
515
515
|
/**
|
|
@@ -517,7 +517,7 @@ class Bt extends Tt {
|
|
|
517
517
|
* @returns {String}
|
|
518
518
|
*/
|
|
519
519
|
C(this, ct, () => {
|
|
520
|
-
const t = this.ns, e =
|
|
520
|
+
const t = this.ns, e = s(this, Y).displayDate, h = e.get("year"), p = e.get("month") + 1, { lastMonRemainingDays: d, currentMonDays: v, nextMonRemainingDays: b } = s(this, lt).call(this, e), $ = (m, I, B = { isSelected: !1, isToday: !1, isCurrent: !1 }) => {
|
|
521
521
|
let U, P;
|
|
522
522
|
if (m === "last-mon") {
|
|
523
523
|
const H = e.subtract(1, "month");
|
|
@@ -546,9 +546,9 @@ class Bt extends Tt {
|
|
|
546
546
|
},
|
|
547
547
|
I
|
|
548
548
|
);
|
|
549
|
-
},
|
|
549
|
+
}, L = d.map(
|
|
550
550
|
(m) => $("last-mon", m)
|
|
551
|
-
), g =
|
|
551
|
+
), g = v.map(
|
|
552
552
|
(m) => $("current-mon", m, {
|
|
553
553
|
isToday: m === e.get("date"),
|
|
554
554
|
isCurrent: m === e.get("date")
|
|
@@ -556,7 +556,7 @@ class Bt extends Tt {
|
|
|
556
556
|
), F = b.map(
|
|
557
557
|
(m) => $("next-mon", m)
|
|
558
558
|
);
|
|
559
|
-
return
|
|
559
|
+
return L.concat(g).concat(F).reduce((m, I, B) => (B % 7 === 0 && m.push([]), m[m.length - 1].push(I), m), []).map((m) => `<tr class="${t.e("row")}">${m.join("")}</tr>`).join("");
|
|
560
560
|
});
|
|
561
561
|
this.stylesheet = Rt, this.$render();
|
|
562
562
|
}
|
|
@@ -566,15 +566,15 @@ class Bt extends Tt {
|
|
|
566
566
|
// ------- value -------
|
|
567
567
|
// #region
|
|
568
568
|
get value() {
|
|
569
|
-
return
|
|
569
|
+
return s(this, Y).displayDate;
|
|
570
570
|
}
|
|
571
571
|
set value(t) {
|
|
572
|
-
this.setAttribute("value",
|
|
572
|
+
this.setAttribute("value", A(t));
|
|
573
573
|
}
|
|
574
574
|
// #endregion
|
|
575
575
|
// ------- end -------
|
|
576
576
|
attributeChangedCallback(t, e, h) {
|
|
577
|
-
super.attributeChangedCallback(t, e, h), h !== e && t === "value" && (
|
|
577
|
+
super.attributeChangedCallback(t, e, h), h !== e && t === "value" && (s(this, Y).displayDate = A(h), Dt(this, et, kt).call(this, s(this, Y).displayDate));
|
|
578
578
|
}
|
|
579
579
|
/**
|
|
580
580
|
* 获取 classlist 列表
|
|
@@ -584,11 +584,11 @@ class Bt extends Tt {
|
|
|
584
584
|
const t = this.computedClasslist("ea-calendar", {
|
|
585
585
|
// ['--' + this.type]: this.type,
|
|
586
586
|
});
|
|
587
|
-
return
|
|
587
|
+
return s(this, at).className = t, t;
|
|
588
588
|
}
|
|
589
589
|
$render() {
|
|
590
590
|
const t = Ht("calendar"), e = /* @__PURE__ */ new Date(), h = e.getFullYear(), p = e.getMonth();
|
|
591
|
-
_.locale = this.locale,
|
|
591
|
+
_.locale = this.locale, A.locale(this.locale), this.ns = t, this.shadowRoot.innerHTML = this.html(`
|
|
592
592
|
<div class='${t.b()}' part='container'>
|
|
593
593
|
<header class='${t.e("header")}' part='header'>
|
|
594
594
|
<slot name="header">
|
|
@@ -602,10 +602,10 @@ class Bt extends Tt {
|
|
|
602
602
|
<table class='${t.e("body")}' part='body'>
|
|
603
603
|
<thead class='${t.e("thead")}' part='thead'>
|
|
604
604
|
<tr class='${t.e("week")}' part='thead-tr tr'>
|
|
605
|
-
${
|
|
605
|
+
${s(this, pt).call(this, _.t("calendar.weekDays"))}
|
|
606
606
|
</tr>
|
|
607
607
|
</thead>
|
|
608
|
-
<tbody class='${t.e("tbody")}' part='tbody'>${
|
|
608
|
+
<tbody class='${t.e("tbody")}' part='tbody'>${s(this, ct).call(this)}</tbody>
|
|
609
609
|
</table>
|
|
610
610
|
</div>
|
|
611
611
|
`), z(this, at, this.shadowRoot.querySelector(t.cb())), z(this, ht, this.shadowRoot.querySelector(t.ce("header"))), z(this, G, this.shadowRoot.querySelector(t.ce("title"))), z(this, st, this.shadowRoot.querySelector(
|
|
@@ -613,61 +613,61 @@ class Bt extends Tt {
|
|
|
613
613
|
)), z(this, dt, this.shadowRoot.querySelector(t.ce("body"))), z(this, ot, this.shadowRoot.querySelector(t.ce("thead"))), z(this, N, this.shadowRoot.querySelector(t.ce("tbody")));
|
|
614
614
|
}
|
|
615
615
|
$updateLocalization(t) {
|
|
616
|
-
_.locale = t,
|
|
617
|
-
const e = this.ns, h = this.shadowRoot.querySelector(e.ce("controller-prev")), p = this.shadowRoot.querySelector(e.ce("controller-today")), d = this.shadowRoot.querySelector(e.ce("controller-next")),
|
|
618
|
-
if (h && (h.textContent = _.t("calendar.prevMonth")), p && (p.textContent = _.t("calendar.today")), d && (d.textContent = _.t("calendar.nextMonth")),
|
|
619
|
-
|
|
620
|
-
}), H.forEach((
|
|
621
|
-
const K = B[T], X = Dt(this, et, Et).call(this,
|
|
616
|
+
_.locale = t, A.locale(this.locale.toLowerCase());
|
|
617
|
+
const e = this.ns, h = this.shadowRoot.querySelector(e.ce("controller-prev")), p = this.shadowRoot.querySelector(e.ce("controller-today")), d = this.shadowRoot.querySelector(e.ce("controller-next")), v = this.shadowRoot.querySelector(e.ce("controller-year")), b = this.shadowRoot.querySelector(e.ce("controller-month")), $ = s(this, Y).displayDate, L = $.get("year"), g = $.get("month"), F = $.get("date"), { lastMonRemainingDays: k, currentMonDays: m, nextMonRemainingDays: I } = s(this, lt).call(this, $), B = k.concat(m).concat(I), U = _.t("calendar.weekDays"), P = s(this, ot).querySelectorAll(".ea-calendar__th"), H = [...s(this, N).querySelectorAll(".ea-calendar__day")];
|
|
618
|
+
if (h && (h.textContent = _.t("calendar.prevMonth")), p && (p.textContent = _.t("calendar.today")), d && (d.textContent = _.t("calendar.nextMonth")), v && (v.placeholder = _.t("calendar.selectYear")), b && (b.placeholder = _.t("calendar.selectMonth")), s(this, G).textContent = `${L} ${_.t("calendar.months")[g]}`, P.forEach((M, T) => {
|
|
619
|
+
M.textContent = U[T];
|
|
620
|
+
}), H.forEach((M, T) => {
|
|
621
|
+
const K = B[T], X = Dt(this, et, Et).call(this, L, g, K);
|
|
622
622
|
let W, w, u;
|
|
623
623
|
if (T < k.length) {
|
|
624
624
|
const q = $.subtract(1, "month");
|
|
625
625
|
W = q.get("year"), w = q.get("month") + 1, u = "last";
|
|
626
626
|
} else if (T < k.length + m.length)
|
|
627
|
-
W =
|
|
627
|
+
W = L, w = g + 1, u = "current";
|
|
628
628
|
else {
|
|
629
629
|
const q = $.add(1, "month");
|
|
630
630
|
W = q.get("year"), w = q.get("month") + 1, u = "next";
|
|
631
631
|
}
|
|
632
|
-
|
|
633
|
-
}), !H.some((
|
|
634
|
-
const
|
|
635
|
-
|
|
632
|
+
M.dataset.year = W, M.dataset.month = w, M.dataset.date = K, M.textContent = K, M.classList.toggle("is-today", X), M.classList.toggle("is-current", X), M.classList.toggle("is-last-mon", u === "last"), M.classList.toggle("is-current-mon", u === "current"), M.classList.toggle("is-next-mon", u === "next"), M.part && (M.part.toggle("last-mon", u === "last"), M.part.toggle("current-mon", u === "current"), M.part.toggle("next-mon", u === "next"));
|
|
633
|
+
}), !H.some((M) => M.classList.contains("is-current"))) {
|
|
634
|
+
const M = s(this, gt).call(this, L, g + 1, F);
|
|
635
|
+
M && M.classList.add("is-current");
|
|
636
636
|
}
|
|
637
637
|
}
|
|
638
638
|
connectedCallback() {
|
|
639
639
|
var t;
|
|
640
|
-
super.connectedCallback(), (t =
|
|
641
|
-
signal:
|
|
640
|
+
super.connectedCallback(), (t = s(this, Q)) == null || t.abort(), z(this, Q, new AbortController()), s(this, it).call(this), s(this, N).addEventListener("click", s(this, $t), {
|
|
641
|
+
signal: s(this, Q).signal
|
|
642
642
|
});
|
|
643
643
|
}
|
|
644
644
|
$beforeUnmounted() {
|
|
645
645
|
var t, e;
|
|
646
|
-
(t =
|
|
647
|
-
for (const h in
|
|
648
|
-
(e =
|
|
646
|
+
(t = s(this, Q)) == null || t.abort();
|
|
647
|
+
for (const h in s(this, R))
|
|
648
|
+
(e = s(this, R)[h]) == null || e.abort(), s(this, R)[h] = null;
|
|
649
649
|
}
|
|
650
650
|
}
|
|
651
|
-
at = new WeakMap(), ht = new WeakMap(), G = new WeakMap(), st = new WeakMap(), dt = new WeakMap(), ot = new WeakMap(), N = new WeakMap(), Q = new WeakMap(), R = new WeakMap(),
|
|
651
|
+
at = new WeakMap(), ht = new WeakMap(), G = new WeakMap(), st = new WeakMap(), dt = new WeakMap(), ot = new WeakMap(), N = new WeakMap(), Q = new WeakMap(), R = new WeakMap(), Y = new WeakMap(), ft = new WeakMap(), it = new WeakMap(), mt = new WeakMap(), yt = new WeakMap(), pt = new WeakMap(), et = new WeakSet(), /**
|
|
652
652
|
* 渲染日历天数
|
|
653
653
|
* @param {dayjs.Dayjs} date
|
|
654
654
|
*/
|
|
655
655
|
kt = function(t) {
|
|
656
|
-
_.locale = this.locale,
|
|
656
|
+
_.locale = this.locale, A.locale(this.locale.toLowerCase());
|
|
657
657
|
const e = t.get("year"), h = t.get("month");
|
|
658
|
-
|
|
658
|
+
s(this, G).textContent = `${e} ${_.t("calendar.months")[h]}`, s(this, N).innerHTML = s(this, ct).call(this);
|
|
659
659
|
}, $t = new WeakMap(), lt = new WeakMap(), gt = new WeakMap(), /**
|
|
660
660
|
* 判断是否是今天
|
|
661
661
|
*/
|
|
662
662
|
Et = function(t, e, h) {
|
|
663
|
-
const p =
|
|
663
|
+
const p = A();
|
|
664
664
|
return t === p.get("year") && e === p.get("month") && h === p.get("date");
|
|
665
665
|
}, ct = new WeakMap();
|
|
666
666
|
window.customElements.get("ea-calendar") || window.customElements.define("ea-calendar", Bt);
|
|
667
667
|
export {
|
|
668
668
|
Bt as E,
|
|
669
669
|
Lt as c,
|
|
670
|
-
|
|
670
|
+
A as d,
|
|
671
671
|
jt as g,
|
|
672
672
|
Ht as n
|
|
673
673
|
};
|