m-tool-store 1.0.7 → 1.0.8
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/lib/m-tool-store.js +300 -298
- package/lib/m-tool-store.umd.cjs +1 -1
- package/package.json +3 -4
- package/lib/index.d.ts +0 -1
- package/types/global.d.ts +0 -42
- package/types/index.d.ts +0 -58
- package/types/shims-vue.d.ts +0 -19
package/lib/m-tool-store.js
CHANGED
|
@@ -1,346 +1,348 @@
|
|
|
1
|
-
class
|
|
1
|
+
class ut {
|
|
2
2
|
//金额格式化 , 千分位
|
|
3
3
|
static formatMoney(Y, y) {
|
|
4
4
|
if (Y == null) return "";
|
|
5
5
|
let m = Number(Y);
|
|
6
6
|
if (isNaN(m)) return Y;
|
|
7
|
-
let
|
|
8
|
-
return F + 1 === M || (F + 1 - M) % 3 === 0 ? O +
|
|
7
|
+
let D = /([\-\+]?)(\d*)(\.\d+)?/g.exec("" + m), w = D && D[1] || "", f = (D && D[2] || "").split(""), u = D && D[3] || "", M = f.length % 3, _ = f.reduce(function(O, g, F) {
|
|
8
|
+
return F + 1 === M || (F + 1 - M) % 3 === 0 ? O + g + "," : O + g;
|
|
9
9
|
}, "").replace(/\,$/g, "");
|
|
10
|
-
return
|
|
10
|
+
return _ === "" && (_ = "0"), y != null && (y == 0 ? u && parseFloat(u) > 0.5 ? (u = "", _ = parseInt(_) + 1 + "") : u = "" : y > 0 && (!u || u == "0" || u == ".0" ? u = "." + "0".repeat(y) : (u = parseFloat(u).toFixed(2), u >= "1" && (_ = parseInt(_) + 1 + "", u = "." + "0".repeat(y)))), u = (u || "").replace("0.", ".")), w + _ + u;
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
var J = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
14
|
-
function
|
|
14
|
+
function R(d) {
|
|
15
15
|
return d && d.__esModule && Object.prototype.hasOwnProperty.call(d, "default") ? d.default : d;
|
|
16
16
|
}
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
(function(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
var
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
return !r && e && (W = e), e || !r && W;
|
|
58
|
-
}, h = function(s, n) {
|
|
59
|
-
if (E(s)) return s.clone();
|
|
60
|
-
var t = typeof n == "object" ? n : {};
|
|
61
|
-
return t.date = s, t.args = arguments, new U(t);
|
|
62
|
-
}, o = et;
|
|
63
|
-
o.l = A, o.i = E, o.w = function(s, n) {
|
|
64
|
-
return h(s, { locale: n.$L, utc: n.$u, x: n.$x, $offset: n.$offset });
|
|
65
|
-
};
|
|
66
|
-
var U = function() {
|
|
67
|
-
function s(t) {
|
|
68
|
-
this.$L = A(t.locale, null, !0), this.parse(t), this.$x = this.$x || t.x || {}, this[P] = !0;
|
|
69
|
-
}
|
|
70
|
-
var n = s.prototype;
|
|
71
|
-
return n.parse = function(t) {
|
|
72
|
-
this.$d = function(r) {
|
|
73
|
-
var e = r.date, i = r.utc;
|
|
74
|
-
if (e === null) return /* @__PURE__ */ new Date(NaN);
|
|
75
|
-
if (o.u(e)) return /* @__PURE__ */ new Date();
|
|
76
|
-
if (e instanceof Date) return new Date(e);
|
|
77
|
-
if (typeof e == "string" && !/Z$/i.test(e)) {
|
|
78
|
-
var a = e.match(R);
|
|
79
|
-
if (a) {
|
|
80
|
-
var c = a[2] - 1 || 0, l = (a[7] || "0").substring(0, 3);
|
|
81
|
-
return i ? new Date(Date.UTC(a[1], c, a[3] || 1, a[4] || 0, a[5] || 0, a[6] || 0, l)) : new Date(a[1], c, a[3] || 1, a[4] || 0, a[5] || 0, a[6] || 0, l);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
return new Date(e);
|
|
85
|
-
}(t), this.init();
|
|
86
|
-
}, n.init = function() {
|
|
87
|
-
var t = this.$d;
|
|
88
|
-
this.$y = t.getFullYear(), this.$M = t.getMonth(), this.$D = t.getDate(), this.$W = t.getDay(), this.$H = t.getHours(), this.$m = t.getMinutes(), this.$s = t.getSeconds(), this.$ms = t.getMilliseconds();
|
|
89
|
-
}, n.$utils = function() {
|
|
90
|
-
return o;
|
|
91
|
-
}, n.isValid = function() {
|
|
92
|
-
return this.$d.toString() !== q;
|
|
93
|
-
}, n.isSame = function(t, r) {
|
|
94
|
-
var e = h(t);
|
|
95
|
-
return this.startOf(r) <= e && e <= this.endOf(r);
|
|
96
|
-
}, n.isAfter = function(t, r) {
|
|
97
|
-
return h(t) < this.startOf(r);
|
|
98
|
-
}, n.isBefore = function(t, r) {
|
|
99
|
-
return this.endOf(r) < h(t);
|
|
100
|
-
}, n.$g = function(t, r, e) {
|
|
101
|
-
return o.u(t) ? this[r] : this.set(e, t);
|
|
102
|
-
}, n.unix = function() {
|
|
103
|
-
return Math.floor(this.valueOf() / 1e3);
|
|
104
|
-
}, n.valueOf = function() {
|
|
105
|
-
return this.$d.getTime();
|
|
106
|
-
}, n.startOf = function(t, r) {
|
|
107
|
-
var e = this, i = !!o.u(r) || r, a = o.p(t), c = function(H, v) {
|
|
108
|
-
var b = o.w(e.$u ? Date.UTC(e.$y, v, H) : new Date(e.$y, v, H), e);
|
|
109
|
-
return i ? b : b.endOf(p);
|
|
110
|
-
}, l = function(H, v) {
|
|
111
|
-
return o.w(e.toDate()[H].apply(e.toDate("s"), (i ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(v)), e);
|
|
112
|
-
}, $ = this.$W, _ = this.$M, x = this.$D, j = "set" + (this.$u ? "UTC" : "");
|
|
113
|
-
switch (a) {
|
|
114
|
-
case S:
|
|
115
|
-
return i ? c(1, 0) : c(31, 11);
|
|
116
|
-
case D:
|
|
117
|
-
return i ? c(1, _) : c(0, _ + 1);
|
|
118
|
-
case O:
|
|
119
|
-
var L = this.$locale().weekStart || 0, C = ($ < L ? $ + 7 : $) - L;
|
|
120
|
-
return c(i ? x - C : x + (6 - C), _);
|
|
121
|
-
case p:
|
|
122
|
-
case T:
|
|
123
|
-
return l(j + "Hours", 0);
|
|
124
|
-
case M:
|
|
125
|
-
return l(j + "Minutes", 1);
|
|
126
|
-
case u:
|
|
127
|
-
return l(j + "Seconds", 2);
|
|
128
|
-
case f:
|
|
129
|
-
return l(j + "Milliseconds", 3);
|
|
130
|
-
default:
|
|
131
|
-
return this.clone();
|
|
17
|
+
var E = { exports: {} }, Q;
|
|
18
|
+
function V() {
|
|
19
|
+
return Q || (Q = 1, function(d, Y) {
|
|
20
|
+
(function(y, m) {
|
|
21
|
+
d.exports = m();
|
|
22
|
+
})(J, function() {
|
|
23
|
+
var y = 1e3, m = 6e4, D = 36e5, w = "millisecond", f = "second", u = "minute", M = "hour", _ = "day", O = "week", g = "month", F = "quarter", S = "year", T = "date", P = "Invalid Date", X = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, tt = /\[([^\]]+)]|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, et = { 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(s) {
|
|
24
|
+
var n = ["th", "st", "nd", "rd"], t = s % 100;
|
|
25
|
+
return "[" + s + (n[(t - 20) % 10] || n[t] || n[0]) + "]";
|
|
26
|
+
} }, z = function(s, n, t) {
|
|
27
|
+
var r = String(s);
|
|
28
|
+
return !r || r.length >= n ? s : "" + Array(n + 1 - r.length).join(t) + s;
|
|
29
|
+
}, nt = { s: z, z: function(s) {
|
|
30
|
+
var n = -s.utcOffset(), t = Math.abs(n), r = Math.floor(t / 60), e = t % 60;
|
|
31
|
+
return (n <= 0 ? "+" : "-") + z(r, 2, "0") + ":" + z(e, 2, "0");
|
|
32
|
+
}, m: function s(n, t) {
|
|
33
|
+
if (n.date() < t.date()) return -s(t, n);
|
|
34
|
+
var r = 12 * (t.year() - n.year()) + (t.month() - n.month()), e = n.clone().add(r, g), i = t - e < 0, a = n.clone().add(r + (i ? -1 : 1), g);
|
|
35
|
+
return +(-(r + (t - e) / (i ? e - a : a - e)) || 0);
|
|
36
|
+
}, a: function(s) {
|
|
37
|
+
return s < 0 ? Math.ceil(s) || 0 : Math.floor(s);
|
|
38
|
+
}, p: function(s) {
|
|
39
|
+
return { M: g, y: S, w: O, d: _, D: T, h: M, m: u, s: f, ms: w, Q: F }[s] || String(s || "").toLowerCase().replace(/s$/, "");
|
|
40
|
+
}, u: function(s) {
|
|
41
|
+
return s === void 0;
|
|
42
|
+
} }, W = "en", k = {};
|
|
43
|
+
k[W] = et;
|
|
44
|
+
var B = "$isDayjsObject", q = function(s) {
|
|
45
|
+
return s instanceof U || !(!s || !s[B]);
|
|
46
|
+
}, A = function s(n, t, r) {
|
|
47
|
+
var e;
|
|
48
|
+
if (!n) return W;
|
|
49
|
+
if (typeof n == "string") {
|
|
50
|
+
var i = n.toLowerCase();
|
|
51
|
+
k[i] && (e = i), t && (k[i] = t, e = i);
|
|
52
|
+
var a = n.split("-");
|
|
53
|
+
if (!e && a.length > 1) return s(a[0]);
|
|
54
|
+
} else {
|
|
55
|
+
var c = n.name;
|
|
56
|
+
k[c] = n, e = c;
|
|
132
57
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
var
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}, n.subtract = function(t, r) {
|
|
160
|
-
return this.add(-1 * t, r);
|
|
161
|
-
}, n.format = function(t) {
|
|
162
|
-
var r = this, e = this.$locale();
|
|
163
|
-
if (!this.isValid()) return e.invalidDate || q;
|
|
164
|
-
var i = t || "YYYY-MM-DDTHH:mm:ssZ", a = o.z(this), c = this.$H, l = this.$m, $ = this.$M, _ = e.weekdays, x = e.months, j = e.meridiem, L = function(v, b, I, N) {
|
|
165
|
-
return v && (v[b] || v(r, i)) || I[b].slice(0, N);
|
|
166
|
-
}, C = function(v) {
|
|
167
|
-
return o.s(c % 12 || 12, v, "0");
|
|
168
|
-
}, H = j || function(v, b, I) {
|
|
169
|
-
var N = v < 12 ? "AM" : "PM";
|
|
170
|
-
return I ? N.toLowerCase() : N;
|
|
171
|
-
};
|
|
172
|
-
return i.replace(X, function(v, b) {
|
|
173
|
-
return b || function(I) {
|
|
174
|
-
switch (I) {
|
|
175
|
-
case "YY":
|
|
176
|
-
return String(r.$y).slice(-2);
|
|
177
|
-
case "YYYY":
|
|
178
|
-
return o.s(r.$y, 4, "0");
|
|
179
|
-
case "M":
|
|
180
|
-
return $ + 1;
|
|
181
|
-
case "MM":
|
|
182
|
-
return o.s($ + 1, 2, "0");
|
|
183
|
-
case "MMM":
|
|
184
|
-
return L(e.monthsShort, $, x, 3);
|
|
185
|
-
case "MMMM":
|
|
186
|
-
return L(x, $);
|
|
187
|
-
case "D":
|
|
188
|
-
return r.$D;
|
|
189
|
-
case "DD":
|
|
190
|
-
return o.s(r.$D, 2, "0");
|
|
191
|
-
case "d":
|
|
192
|
-
return String(r.$W);
|
|
193
|
-
case "dd":
|
|
194
|
-
return L(e.weekdaysMin, r.$W, _, 2);
|
|
195
|
-
case "ddd":
|
|
196
|
-
return L(e.weekdaysShort, r.$W, _, 3);
|
|
197
|
-
case "dddd":
|
|
198
|
-
return _[r.$W];
|
|
199
|
-
case "H":
|
|
200
|
-
return String(c);
|
|
201
|
-
case "HH":
|
|
202
|
-
return o.s(c, 2, "0");
|
|
203
|
-
case "h":
|
|
204
|
-
return C(1);
|
|
205
|
-
case "hh":
|
|
206
|
-
return C(2);
|
|
207
|
-
case "a":
|
|
208
|
-
return H(c, l, !0);
|
|
209
|
-
case "A":
|
|
210
|
-
return H(c, l, !1);
|
|
211
|
-
case "m":
|
|
212
|
-
return String(l);
|
|
213
|
-
case "mm":
|
|
214
|
-
return o.s(l, 2, "0");
|
|
215
|
-
case "s":
|
|
216
|
-
return String(r.$s);
|
|
217
|
-
case "ss":
|
|
218
|
-
return o.s(r.$s, 2, "0");
|
|
219
|
-
case "SSS":
|
|
220
|
-
return o.s(r.$ms, 3, "0");
|
|
221
|
-
case "Z":
|
|
222
|
-
return a;
|
|
58
|
+
return !r && e && (W = e), e || !r && W;
|
|
59
|
+
}, h = function(s, n) {
|
|
60
|
+
if (q(s)) return s.clone();
|
|
61
|
+
var t = typeof n == "object" ? n : {};
|
|
62
|
+
return t.date = s, t.args = arguments, new U(t);
|
|
63
|
+
}, o = nt;
|
|
64
|
+
o.l = A, o.i = q, o.w = function(s, n) {
|
|
65
|
+
return h(s, { locale: n.$L, utc: n.$u, x: n.$x, $offset: n.$offset });
|
|
66
|
+
};
|
|
67
|
+
var U = function() {
|
|
68
|
+
function s(t) {
|
|
69
|
+
this.$L = A(t.locale, null, !0), this.parse(t), this.$x = this.$x || t.x || {}, this[B] = !0;
|
|
70
|
+
}
|
|
71
|
+
var n = s.prototype;
|
|
72
|
+
return n.parse = function(t) {
|
|
73
|
+
this.$d = function(r) {
|
|
74
|
+
var e = r.date, i = r.utc;
|
|
75
|
+
if (e === null) return /* @__PURE__ */ new Date(NaN);
|
|
76
|
+
if (o.u(e)) return /* @__PURE__ */ new Date();
|
|
77
|
+
if (e instanceof Date) return new Date(e);
|
|
78
|
+
if (typeof e == "string" && !/Z$/i.test(e)) {
|
|
79
|
+
var a = e.match(X);
|
|
80
|
+
if (a) {
|
|
81
|
+
var c = a[2] - 1 || 0, l = (a[7] || "0").substring(0, 3);
|
|
82
|
+
return i ? new Date(Date.UTC(a[1], c, a[3] || 1, a[4] || 0, a[5] || 0, a[6] || 0, l)) : new Date(a[1], c, a[3] || 1, a[4] || 0, a[5] || 0, a[6] || 0, l);
|
|
83
|
+
}
|
|
223
84
|
}
|
|
224
|
-
return
|
|
225
|
-
}(
|
|
226
|
-
})
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
85
|
+
return new Date(e);
|
|
86
|
+
}(t), this.init();
|
|
87
|
+
}, n.init = function() {
|
|
88
|
+
var t = this.$d;
|
|
89
|
+
this.$y = t.getFullYear(), this.$M = t.getMonth(), this.$D = t.getDate(), this.$W = t.getDay(), this.$H = t.getHours(), this.$m = t.getMinutes(), this.$s = t.getSeconds(), this.$ms = t.getMilliseconds();
|
|
90
|
+
}, n.$utils = function() {
|
|
91
|
+
return o;
|
|
92
|
+
}, n.isValid = function() {
|
|
93
|
+
return this.$d.toString() !== P;
|
|
94
|
+
}, n.isSame = function(t, r) {
|
|
95
|
+
var e = h(t);
|
|
96
|
+
return this.startOf(r) <= e && e <= this.endOf(r);
|
|
97
|
+
}, n.isAfter = function(t, r) {
|
|
98
|
+
return h(t) < this.startOf(r);
|
|
99
|
+
}, n.isBefore = function(t, r) {
|
|
100
|
+
return this.endOf(r) < h(t);
|
|
101
|
+
}, n.$g = function(t, r, e) {
|
|
102
|
+
return o.u(t) ? this[r] : this.set(e, t);
|
|
103
|
+
}, n.unix = function() {
|
|
104
|
+
return Math.floor(this.valueOf() / 1e3);
|
|
105
|
+
}, n.valueOf = function() {
|
|
106
|
+
return this.$d.getTime();
|
|
107
|
+
}, n.startOf = function(t, r) {
|
|
108
|
+
var e = this, i = !!o.u(r) || r, a = o.p(t), c = function(H, v) {
|
|
109
|
+
var b = o.w(e.$u ? Date.UTC(e.$y, v, H) : new Date(e.$y, v, H), e);
|
|
110
|
+
return i ? b : b.endOf(_);
|
|
111
|
+
}, l = function(H, v) {
|
|
112
|
+
return o.w(e.toDate()[H].apply(e.toDate("s"), (i ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(v)), e);
|
|
113
|
+
}, $ = this.$W, p = this.$M, x = this.$D, j = "set" + (this.$u ? "UTC" : "");
|
|
114
|
+
switch (a) {
|
|
115
|
+
case S:
|
|
116
|
+
return i ? c(1, 0) : c(31, 11);
|
|
117
|
+
case g:
|
|
118
|
+
return i ? c(1, p) : c(0, p + 1);
|
|
119
|
+
case O:
|
|
120
|
+
var L = this.$locale().weekStart || 0, C = ($ < L ? $ + 7 : $) - L;
|
|
121
|
+
return c(i ? x - C : x + (6 - C), p);
|
|
122
|
+
case _:
|
|
123
|
+
case T:
|
|
124
|
+
return l(j + "Hours", 0);
|
|
125
|
+
case M:
|
|
126
|
+
return l(j + "Minutes", 1);
|
|
127
|
+
case u:
|
|
128
|
+
return l(j + "Seconds", 2);
|
|
129
|
+
case f:
|
|
130
|
+
return l(j + "Milliseconds", 3);
|
|
131
|
+
default:
|
|
132
|
+
return this.clone();
|
|
133
|
+
}
|
|
134
|
+
}, n.endOf = function(t) {
|
|
135
|
+
return this.startOf(t, !1);
|
|
136
|
+
}, n.$set = function(t, r) {
|
|
137
|
+
var e, i = o.p(t), a = "set" + (this.$u ? "UTC" : ""), c = (e = {}, e[_] = a + "Date", e[T] = a + "Date", e[g] = a + "Month", e[S] = a + "FullYear", e[M] = a + "Hours", e[u] = a + "Minutes", e[f] = a + "Seconds", e[w] = a + "Milliseconds", e)[i], l = i === _ ? this.$D + (r - this.$W) : r;
|
|
138
|
+
if (i === g || i === S) {
|
|
139
|
+
var $ = this.clone().set(T, 1);
|
|
140
|
+
$.$d[c](l), $.init(), this.$d = $.set(T, Math.min(this.$D, $.daysInMonth())).$d;
|
|
141
|
+
} else c && this.$d[c](l);
|
|
142
|
+
return this.init(), this;
|
|
143
|
+
}, n.set = function(t, r) {
|
|
144
|
+
return this.clone().$set(t, r);
|
|
145
|
+
}, n.get = function(t) {
|
|
146
|
+
return this[o.p(t)]();
|
|
147
|
+
}, n.add = function(t, r) {
|
|
148
|
+
var e, i = this;
|
|
149
|
+
t = Number(t);
|
|
150
|
+
var a = o.p(r), c = function(p) {
|
|
151
|
+
var x = h(i);
|
|
152
|
+
return o.w(x.date(x.date() + Math.round(p * t)), i);
|
|
153
|
+
};
|
|
154
|
+
if (a === g) return this.set(g, this.$M + t);
|
|
155
|
+
if (a === S) return this.set(S, this.$y + t);
|
|
156
|
+
if (a === _) return c(1);
|
|
157
|
+
if (a === O) return c(7);
|
|
158
|
+
var l = (e = {}, e[u] = m, e[M] = D, e[f] = y, e)[a] || 1, $ = this.$d.getTime() + t * l;
|
|
159
|
+
return o.w($, this);
|
|
160
|
+
}, n.subtract = function(t, r) {
|
|
161
|
+
return this.add(-1 * t, r);
|
|
162
|
+
}, n.format = function(t) {
|
|
163
|
+
var r = this, e = this.$locale();
|
|
164
|
+
if (!this.isValid()) return e.invalidDate || P;
|
|
165
|
+
var i = t || "YYYY-MM-DDTHH:mm:ssZ", a = o.z(this), c = this.$H, l = this.$m, $ = this.$M, p = e.weekdays, x = e.months, j = e.meridiem, L = function(v, b, I, N) {
|
|
166
|
+
return v && (v[b] || v(r, i)) || I[b].slice(0, N);
|
|
167
|
+
}, C = function(v) {
|
|
168
|
+
return o.s(c % 12 || 12, v, "0");
|
|
169
|
+
}, H = j || function(v, b, I) {
|
|
170
|
+
var N = v < 12 ? "AM" : "PM";
|
|
171
|
+
return I ? N.toLowerCase() : N;
|
|
172
|
+
};
|
|
173
|
+
return i.replace(tt, function(v, b) {
|
|
174
|
+
return b || function(I) {
|
|
175
|
+
switch (I) {
|
|
176
|
+
case "YY":
|
|
177
|
+
return String(r.$y).slice(-2);
|
|
178
|
+
case "YYYY":
|
|
179
|
+
return o.s(r.$y, 4, "0");
|
|
180
|
+
case "M":
|
|
181
|
+
return $ + 1;
|
|
182
|
+
case "MM":
|
|
183
|
+
return o.s($ + 1, 2, "0");
|
|
184
|
+
case "MMM":
|
|
185
|
+
return L(e.monthsShort, $, x, 3);
|
|
186
|
+
case "MMMM":
|
|
187
|
+
return L(x, $);
|
|
188
|
+
case "D":
|
|
189
|
+
return r.$D;
|
|
190
|
+
case "DD":
|
|
191
|
+
return o.s(r.$D, 2, "0");
|
|
192
|
+
case "d":
|
|
193
|
+
return String(r.$W);
|
|
194
|
+
case "dd":
|
|
195
|
+
return L(e.weekdaysMin, r.$W, p, 2);
|
|
196
|
+
case "ddd":
|
|
197
|
+
return L(e.weekdaysShort, r.$W, p, 3);
|
|
198
|
+
case "dddd":
|
|
199
|
+
return p[r.$W];
|
|
200
|
+
case "H":
|
|
201
|
+
return String(c);
|
|
202
|
+
case "HH":
|
|
203
|
+
return o.s(c, 2, "0");
|
|
204
|
+
case "h":
|
|
205
|
+
return C(1);
|
|
206
|
+
case "hh":
|
|
207
|
+
return C(2);
|
|
208
|
+
case "a":
|
|
209
|
+
return H(c, l, !0);
|
|
210
|
+
case "A":
|
|
211
|
+
return H(c, l, !1);
|
|
212
|
+
case "m":
|
|
213
|
+
return String(l);
|
|
214
|
+
case "mm":
|
|
215
|
+
return o.s(l, 2, "0");
|
|
216
|
+
case "s":
|
|
217
|
+
return String(r.$s);
|
|
218
|
+
case "ss":
|
|
219
|
+
return o.s(r.$s, 2, "0");
|
|
220
|
+
case "SSS":
|
|
221
|
+
return o.s(r.$ms, 3, "0");
|
|
222
|
+
case "Z":
|
|
223
|
+
return a;
|
|
224
|
+
}
|
|
225
|
+
return null;
|
|
226
|
+
}(v) || a.replace(":", "");
|
|
227
|
+
});
|
|
228
|
+
}, n.utcOffset = function() {
|
|
229
|
+
return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
|
|
230
|
+
}, n.diff = function(t, r, e) {
|
|
231
|
+
var i, a = this, c = o.p(r), l = h(t), $ = (l.utcOffset() - this.utcOffset()) * m, p = this - l, x = function() {
|
|
232
|
+
return o.m(a, l);
|
|
233
|
+
};
|
|
234
|
+
switch (c) {
|
|
235
|
+
case S:
|
|
236
|
+
i = x() / 12;
|
|
237
|
+
break;
|
|
238
|
+
case g:
|
|
239
|
+
i = x();
|
|
240
|
+
break;
|
|
241
|
+
case F:
|
|
242
|
+
i = x() / 3;
|
|
243
|
+
break;
|
|
244
|
+
case O:
|
|
245
|
+
i = (p - $) / 6048e5;
|
|
246
|
+
break;
|
|
247
|
+
case _:
|
|
248
|
+
i = (p - $) / 864e5;
|
|
249
|
+
break;
|
|
250
|
+
case M:
|
|
251
|
+
i = p / D;
|
|
252
|
+
break;
|
|
253
|
+
case u:
|
|
254
|
+
i = p / m;
|
|
255
|
+
break;
|
|
256
|
+
case f:
|
|
257
|
+
i = p / y;
|
|
258
|
+
break;
|
|
259
|
+
default:
|
|
260
|
+
i = p;
|
|
261
|
+
}
|
|
262
|
+
return e ? i : o.a(i);
|
|
263
|
+
}, n.daysInMonth = function() {
|
|
264
|
+
return this.endOf(g).$D;
|
|
265
|
+
}, n.$locale = function() {
|
|
266
|
+
return k[this.$L];
|
|
267
|
+
}, n.locale = function(t, r) {
|
|
268
|
+
if (!t) return this.$L;
|
|
269
|
+
var e = this.clone(), i = A(t, r, !0);
|
|
270
|
+
return i && (e.$L = i), e;
|
|
271
|
+
}, n.clone = function() {
|
|
272
|
+
return o.w(this.$d, this);
|
|
273
|
+
}, n.toDate = function() {
|
|
274
|
+
return new Date(this.valueOf());
|
|
275
|
+
}, n.toJSON = function() {
|
|
276
|
+
return this.isValid() ? this.toISOString() : null;
|
|
277
|
+
}, n.toISOString = function() {
|
|
278
|
+
return this.$d.toISOString();
|
|
279
|
+
}, n.toString = function() {
|
|
280
|
+
return this.$d.toUTCString();
|
|
281
|
+
}, s;
|
|
282
|
+
}(), G = U.prototype;
|
|
283
|
+
return h.prototype = G, [["$ms", w], ["$s", f], ["$m", u], ["$H", M], ["$W", _], ["$M", g], ["$y", S], ["$D", T]].forEach(function(s) {
|
|
284
|
+
G[s[1]] = function(n) {
|
|
285
|
+
return this.$g(n, s[0], s[1]);
|
|
232
286
|
};
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
case O:
|
|
244
|
-
i = (_ - $) / 6048e5;
|
|
245
|
-
break;
|
|
246
|
-
case p:
|
|
247
|
-
i = (_ - $) / 864e5;
|
|
248
|
-
break;
|
|
249
|
-
case M:
|
|
250
|
-
i = _ / g;
|
|
251
|
-
break;
|
|
252
|
-
case u:
|
|
253
|
-
i = _ / m;
|
|
254
|
-
break;
|
|
255
|
-
case f:
|
|
256
|
-
i = _ / y;
|
|
257
|
-
break;
|
|
258
|
-
default:
|
|
259
|
-
i = _;
|
|
260
|
-
}
|
|
261
|
-
return e ? i : o.a(i);
|
|
262
|
-
}, n.daysInMonth = function() {
|
|
263
|
-
return this.endOf(D).$D;
|
|
264
|
-
}, n.$locale = function() {
|
|
265
|
-
return k[this.$L];
|
|
266
|
-
}, n.locale = function(t, r) {
|
|
267
|
-
if (!t) return this.$L;
|
|
268
|
-
var e = this.clone(), i = A(t, r, !0);
|
|
269
|
-
return i && (e.$L = i), e;
|
|
270
|
-
}, n.clone = function() {
|
|
271
|
-
return o.w(this.$d, this);
|
|
272
|
-
}, n.toDate = function() {
|
|
273
|
-
return new Date(this.valueOf());
|
|
274
|
-
}, n.toJSON = function() {
|
|
275
|
-
return this.isValid() ? this.toISOString() : null;
|
|
276
|
-
}, n.toISOString = function() {
|
|
277
|
-
return this.$d.toISOString();
|
|
278
|
-
}, n.toString = function() {
|
|
279
|
-
return this.$d.toUTCString();
|
|
280
|
-
}, s;
|
|
281
|
-
}(), B = U.prototype;
|
|
282
|
-
return h.prototype = B, [["$ms", w], ["$s", f], ["$m", u], ["$H", M], ["$W", p], ["$M", D], ["$y", S], ["$D", T]].forEach(function(s) {
|
|
283
|
-
B[s[1]] = function(n) {
|
|
284
|
-
return this.$g(n, s[0], s[1]);
|
|
285
|
-
};
|
|
286
|
-
}), h.extend = function(s, n) {
|
|
287
|
-
return s.$i || (s(n, U, h), s.$i = !0), h;
|
|
288
|
-
}, h.locale = A, h.isDayjs = E, h.unix = function(s) {
|
|
289
|
-
return h(1e3 * s);
|
|
290
|
-
}, h.en = k[W], h.Ls = k, h.p = {}, h;
|
|
291
|
-
});
|
|
292
|
-
})(Q);
|
|
293
|
-
var V = Q.exports;
|
|
294
|
-
const Z = /* @__PURE__ */ G(V);
|
|
287
|
+
}), h.extend = function(s, n) {
|
|
288
|
+
return s.$i || (s(n, U, h), s.$i = !0), h;
|
|
289
|
+
}, h.locale = A, h.isDayjs = q, h.unix = function(s) {
|
|
290
|
+
return h(1e3 * s);
|
|
291
|
+
}, h.en = k[W], h.Ls = k, h.p = {}, h;
|
|
292
|
+
});
|
|
293
|
+
}(E)), E.exports;
|
|
294
|
+
}
|
|
295
|
+
var rt = V();
|
|
296
|
+
const Z = /* @__PURE__ */ R(rt);
|
|
295
297
|
var K = { exports: {} };
|
|
296
298
|
(function(d, Y) {
|
|
297
299
|
(function(y, m) {
|
|
298
300
|
d.exports = m();
|
|
299
301
|
})(J, function() {
|
|
300
302
|
return function(y, m) {
|
|
301
|
-
m.prototype.weekday = function(
|
|
303
|
+
m.prototype.weekday = function(D) {
|
|
302
304
|
var w = this.$locale().weekStart || 0, f = this.$W, u = (f < w ? f + 7 : f) - w;
|
|
303
|
-
return this.$utils().u(
|
|
305
|
+
return this.$utils().u(D) ? u : this.subtract(u, "day").add(D, "day");
|
|
304
306
|
};
|
|
305
307
|
};
|
|
306
308
|
});
|
|
307
309
|
})(K);
|
|
308
|
-
var
|
|
309
|
-
const
|
|
310
|
-
var
|
|
310
|
+
var st = K.exports;
|
|
311
|
+
const it = /* @__PURE__ */ R(st);
|
|
312
|
+
var at = { exports: {} };
|
|
311
313
|
(function(d, Y) {
|
|
312
314
|
(function(y, m) {
|
|
313
|
-
d.exports = m(V);
|
|
315
|
+
d.exports = m(V());
|
|
314
316
|
})(J, function(y) {
|
|
315
317
|
function m(f) {
|
|
316
318
|
return f && typeof f == "object" && "default" in f ? f : { default: f };
|
|
317
319
|
}
|
|
318
|
-
var
|
|
320
|
+
var D = m(y), w = { 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(f, u) {
|
|
319
321
|
return u === "W" ? f + "周" : f + "日";
|
|
320
322
|
}, 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(f, u) {
|
|
321
323
|
var M = 100 * f + u;
|
|
322
324
|
return M < 600 ? "凌晨" : M < 900 ? "早上" : M < 1100 ? "上午" : M < 1300 ? "中午" : M < 1800 ? "下午" : "晚上";
|
|
323
325
|
} };
|
|
324
|
-
return
|
|
326
|
+
return D.default.locale(w, null, !0), w;
|
|
325
327
|
});
|
|
326
|
-
})(
|
|
327
|
-
Z.extend(
|
|
328
|
+
})(at);
|
|
329
|
+
Z.extend(it);
|
|
328
330
|
Z.locale("zh-cn");
|
|
329
|
-
const
|
|
330
|
-
function
|
|
331
|
+
const ot = (d, Y = "YYYY-MM-DD") => Z(d).format(Y), ct = (d) => (console.log("🌸 信息输出 ~ testFunc ~ record:", d), "testFunc");
|
|
332
|
+
function ft() {
|
|
331
333
|
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(d) {
|
|
332
334
|
const Y = Math.random() * 16 | 0;
|
|
333
335
|
return (d == "x" ? Y : Y & 3 | 8).toString(16);
|
|
334
336
|
});
|
|
335
337
|
}
|
|
336
|
-
function
|
|
338
|
+
function lt() {
|
|
337
339
|
return Date.now().toString(36) + Math.random().toString(36).substr(2);
|
|
338
340
|
}
|
|
339
341
|
export {
|
|
340
|
-
|
|
342
|
+
ut as FormatterUtils,
|
|
341
343
|
Z as dayjs,
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
344
|
+
ot as formatDate,
|
|
345
|
+
ft as generateUUID,
|
|
346
|
+
lt as generateUniqueId,
|
|
347
|
+
ct as testFunc
|
|
346
348
|
};
|
package/lib/m-tool-store.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(Y,U){typeof exports=="object"&&typeof module<"u"?U(exports):typeof define=="function"&&define.amd?define(["exports"],U):(Y=typeof globalThis<"u"?globalThis:Y||self,U(Y.MToolStore={}))})(this,function(Y){"use strict";class U{static formatMoney(S,_){if(S==null)return"";let m=Number(S);if(isNaN(m))return S;let g=/([\-\+]?)(\d*)(\.\d+)?/g.exec(""+m),w=g&&g[1]||"",f=(g&&g[2]||"").split(""),
|
|
1
|
+
(function(Y,U){typeof exports=="object"&&typeof module<"u"?U(exports):typeof define=="function"&&define.amd?define(["exports"],U):(Y=typeof globalThis<"u"?globalThis:Y||self,U(Y.MToolStore={}))})(this,function(Y){"use strict";class U{static formatMoney(S,_){if(S==null)return"";let m=Number(S);if(isNaN(m))return S;let g=/([\-\+]?)(\d*)(\.\d+)?/g.exec(""+m),w=g&&g[1]||"",f=(g&&g[2]||"").split(""),a=g&&g[3]||"",M=f.length%3,y=f.reduce(function(k,D,I){return I+1===M||(I+1-M)%3===0?k+D+",":k+D},"").replace(/\,$/g,"");return y===""&&(y="0"),_!=null&&(_==0?a&&parseFloat(a)>.5?(a="",y=parseInt(y)+1+""):a="":_>0&&(!a||a=="0"||a==".0"?a="."+"0".repeat(_):(a=parseFloat(a).toFixed(2),a>="1"&&(y=parseInt(y)+1+"",a="."+"0".repeat(_)))),a=(a||"").replace("0.",".")),w+y+a}}var J=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function G(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}var Z={exports:{}},Q;function R(){return Q||(Q=1,function(l,S){(function(_,m){l.exports=m()})(J,function(){var _=1e3,m=6e4,g=36e5,w="millisecond",f="second",a="minute",M="hour",y="day",k="week",D="month",I="quarter",b="year",j="date",K="Invalid Date",ct=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,ft=/\[([^\]]+)]|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,dt={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){var n=["th","st","nd","rd"],t=i%100;return"["+i+(n[(t-20)%10]||n[t]||n[0])+"]"}},P=function(i,n,t){var r=String(i);return!r||r.length>=n?i:""+Array(n+1-r.length).join(t)+i},lt={s:P,z:function(i){var n=-i.utcOffset(),t=Math.abs(n),r=Math.floor(t/60),e=t%60;return(n<=0?"+":"-")+P(r,2,"0")+":"+P(e,2,"0")},m:function i(n,t){if(n.date()<t.date())return-i(t,n);var r=12*(t.year()-n.year())+(t.month()-n.month()),e=n.clone().add(r,D),s=t-e<0,u=n.clone().add(r+(s?-1:1),D);return+(-(r+(t-e)/(s?e-u:u-e))||0)},a:function(i){return i<0?Math.ceil(i)||0:Math.floor(i)},p:function(i){return{M:D,y:b,w:k,d:y,D:j,h:M,m:a,s:f,ms:w,Q:I}[i]||String(i||"").toLowerCase().replace(/s$/,"")},u:function(i){return i===void 0}},W="en",L={};L[W]=dt;var X="$isDayjsObject",B=function(i){return i instanceof q||!(!i||!i[X])},z=function i(n,t,r){var e;if(!n)return W;if(typeof n=="string"){var s=n.toLowerCase();L[s]&&(e=s),t&&(L[s]=t,e=s);var u=n.split("-");if(!e&&u.length>1)return i(u[0])}else{var c=n.name;L[c]=n,e=c}return!r&&e&&(W=e),e||!r&&W},h=function(i,n){if(B(i))return i.clone();var t=typeof n=="object"?n:{};return t.date=i,t.args=arguments,new q(t)},o=lt;o.l=z,o.i=B,o.w=function(i,n){return h(i,{locale:n.$L,utc:n.$u,x:n.$x,$offset:n.$offset})};var q=function(){function i(t){this.$L=z(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[X]=!0}var n=i.prototype;return n.parse=function(t){this.$d=function(r){var e=r.date,s=r.utc;if(e===null)return new Date(NaN);if(o.u(e))return new Date;if(e instanceof Date)return new Date(e);if(typeof e=="string"&&!/Z$/i.test(e)){var u=e.match(ct);if(u){var c=u[2]-1||0,d=(u[7]||"0").substring(0,3);return s?new Date(Date.UTC(u[1],c,u[3]||1,u[4]||0,u[5]||0,u[6]||0,d)):new Date(u[1],c,u[3]||1,u[4]||0,u[5]||0,u[6]||0,d)}}return new Date(e)}(t),this.init()},n.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},n.$utils=function(){return o},n.isValid=function(){return this.$d.toString()!==K},n.isSame=function(t,r){var e=h(t);return this.startOf(r)<=e&&e<=this.endOf(r)},n.isAfter=function(t,r){return h(t)<this.startOf(r)},n.isBefore=function(t,r){return this.endOf(r)<h(t)},n.$g=function(t,r,e){return o.u(t)?this[r]:this.set(e,t)},n.unix=function(){return Math.floor(this.valueOf()/1e3)},n.valueOf=function(){return this.$d.getTime()},n.startOf=function(t,r){var e=this,s=!!o.u(r)||r,u=o.p(t),c=function(H,v){var O=o.w(e.$u?Date.UTC(e.$y,v,H):new Date(e.$y,v,H),e);return s?O:O.endOf(y)},d=function(H,v){return o.w(e.toDate()[H].apply(e.toDate("s"),(s?[0,0,0,0]:[23,59,59,999]).slice(v)),e)},$=this.$W,p=this.$M,x=this.$D,F="set"+(this.$u?"UTC":"");switch(u){case b:return s?c(1,0):c(31,11);case D:return s?c(1,p):c(0,p+1);case k:var T=this.$locale().weekStart||0,C=($<T?$+7:$)-T;return c(s?x-C:x+(6-C),p);case y:case j:return d(F+"Hours",0);case M:return d(F+"Minutes",1);case a:return d(F+"Seconds",2);case f:return d(F+"Milliseconds",3);default:return this.clone()}},n.endOf=function(t){return this.startOf(t,!1)},n.$set=function(t,r){var e,s=o.p(t),u="set"+(this.$u?"UTC":""),c=(e={},e[y]=u+"Date",e[j]=u+"Date",e[D]=u+"Month",e[b]=u+"FullYear",e[M]=u+"Hours",e[a]=u+"Minutes",e[f]=u+"Seconds",e[w]=u+"Milliseconds",e)[s],d=s===y?this.$D+(r-this.$W):r;if(s===D||s===b){var $=this.clone().set(j,1);$.$d[c](d),$.init(),this.$d=$.set(j,Math.min(this.$D,$.daysInMonth())).$d}else c&&this.$d[c](d);return this.init(),this},n.set=function(t,r){return this.clone().$set(t,r)},n.get=function(t){return this[o.p(t)]()},n.add=function(t,r){var e,s=this;t=Number(t);var u=o.p(r),c=function(p){var x=h(s);return o.w(x.date(x.date()+Math.round(p*t)),s)};if(u===D)return this.set(D,this.$M+t);if(u===b)return this.set(b,this.$y+t);if(u===y)return c(1);if(u===k)return c(7);var d=(e={},e[a]=m,e[M]=g,e[f]=_,e)[u]||1,$=this.$d.getTime()+t*d;return o.w($,this)},n.subtract=function(t,r){return this.add(-1*t,r)},n.format=function(t){var r=this,e=this.$locale();if(!this.isValid())return e.invalidDate||K;var s=t||"YYYY-MM-DDTHH:mm:ssZ",u=o.z(this),c=this.$H,d=this.$m,$=this.$M,p=e.weekdays,x=e.months,F=e.meridiem,T=function(v,O,A,E){return v&&(v[O]||v(r,s))||A[O].slice(0,E)},C=function(v){return o.s(c%12||12,v,"0")},H=F||function(v,O,A){var E=v<12?"AM":"PM";return A?E.toLowerCase():E};return s.replace(ft,function(v,O){return O||function(A){switch(A){case"YY":return String(r.$y).slice(-2);case"YYYY":return o.s(r.$y,4,"0");case"M":return $+1;case"MM":return o.s($+1,2,"0");case"MMM":return T(e.monthsShort,$,x,3);case"MMMM":return T(x,$);case"D":return r.$D;case"DD":return o.s(r.$D,2,"0");case"d":return String(r.$W);case"dd":return T(e.weekdaysMin,r.$W,p,2);case"ddd":return T(e.weekdaysShort,r.$W,p,3);case"dddd":return p[r.$W];case"H":return String(c);case"HH":return o.s(c,2,"0");case"h":return C(1);case"hh":return C(2);case"a":return H(c,d,!0);case"A":return H(c,d,!1);case"m":return String(d);case"mm":return o.s(d,2,"0");case"s":return String(r.$s);case"ss":return o.s(r.$s,2,"0");case"SSS":return o.s(r.$ms,3,"0");case"Z":return u}return null}(v)||u.replace(":","")})},n.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},n.diff=function(t,r,e){var s,u=this,c=o.p(r),d=h(t),$=(d.utcOffset()-this.utcOffset())*m,p=this-d,x=function(){return o.m(u,d)};switch(c){case b:s=x()/12;break;case D:s=x();break;case I:s=x()/3;break;case k:s=(p-$)/6048e5;break;case y:s=(p-$)/864e5;break;case M:s=p/g;break;case a:s=p/m;break;case f:s=p/_;break;default:s=p}return e?s:o.a(s)},n.daysInMonth=function(){return this.endOf(D).$D},n.$locale=function(){return L[this.$L]},n.locale=function(t,r){if(!t)return this.$L;var e=this.clone(),s=z(t,r,!0);return s&&(e.$L=s),e},n.clone=function(){return o.w(this.$d,this)},n.toDate=function(){return new Date(this.valueOf())},n.toJSON=function(){return this.isValid()?this.toISOString():null},n.toISOString=function(){return this.$d.toISOString()},n.toString=function(){return this.$d.toUTCString()},i}(),tt=q.prototype;return h.prototype=tt,[["$ms",w],["$s",f],["$m",a],["$H",M],["$W",y],["$M",D],["$y",b],["$D",j]].forEach(function(i){tt[i[1]]=function(n){return this.$g(n,i[0],i[1])}}),h.extend=function(i,n){return i.$i||(i(n,q,h),i.$i=!0),h},h.locale=z,h.isDayjs=B,h.unix=function(i){return h(1e3*i)},h.en=L[W],h.Ls=L,h.p={},h})}(Z)),Z.exports}var et=R();const N=G(et);var V={exports:{}};(function(l,S){(function(_,m){l.exports=m()})(J,function(){return function(_,m){m.prototype.weekday=function(g){var w=this.$locale().weekStart||0,f=this.$W,a=(f<w?f+7:f)-w;return this.$utils().u(g)?a:this.subtract(a,"day").add(g,"day")}}})})(V);var nt=V.exports;const rt=G(nt);var it={exports:{}};(function(l,S){(function(_,m){l.exports=m(R())})(J,function(_){function m(f){return f&&typeof f=="object"&&"default"in f?f:{default:f}}var g=m(_),w={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(f,a){return a==="W"?f+"周":f+"日"},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(f,a){var M=100*f+a;return M<600?"凌晨":M<900?"早上":M<1100?"上午":M<1300?"中午":M<1800?"下午":"晚上"}};return g.default.locale(w,null,!0),w})})(it),N.extend(rt),N.locale("zh-cn");const st=(l,S="YYYY-MM-DD")=>N(l).format(S),ut=l=>(console.log("🌸 信息输出 ~ testFunc ~ record:",l),"testFunc");function at(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(l){const S=Math.random()*16|0;return(l=="x"?S:S&3|8).toString(16)})}function ot(){return Date.now().toString(36)+Math.random().toString(36).substr(2)}Y.FormatterUtils=U,Y.dayjs=N,Y.formatDate=st,Y.generateUUID=at,Y.generateUniqueId=ot,Y.testFunc=ut,Object.defineProperty(Y,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "m-tool-store",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "JavaScript 工具库",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "Mmm",
|
|
7
7
|
"license": "ISC",
|
|
8
8
|
"main": "lib/m-tool-store.umd.cjs",
|
|
9
9
|
"module": "lib/m-tool-store.js",
|
|
10
|
-
"types": "lib/index.d.ts",
|
|
10
|
+
"types": "lib/types/index.d.ts",
|
|
11
11
|
"exports": {
|
|
12
12
|
".": {
|
|
13
13
|
"import": "./lib/m-tool-store.js",
|
|
@@ -16,8 +16,7 @@
|
|
|
16
16
|
},
|
|
17
17
|
"files": [
|
|
18
18
|
"lib",
|
|
19
|
-
"app"
|
|
20
|
-
"types"
|
|
19
|
+
"app"
|
|
21
20
|
],
|
|
22
21
|
"publishConfig": {
|
|
23
22
|
"access": "public",
|
package/lib/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {}
|
package/types/global.d.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* vite全局类声明 , 和类声明 导出后在文件中实际使用引入的区别:
|
|
3
|
-
*
|
|
4
|
-
* 运行时 vs 编译时
|
|
5
|
-
类声明:在运行时实际存在,会被打包到最终代码中,占用实际的代码体积
|
|
6
|
-
全局类型声明:仅在编译时使用,打包时会被完全移除,不占用运行时体积
|
|
7
|
-
用途差异
|
|
8
|
-
|
|
9
|
-
类声明:
|
|
10
|
-
提供实际的实现逻辑
|
|
11
|
-
可以被实例化:new MenuItemType()
|
|
12
|
-
包含方法和属性的具体实现
|
|
13
|
-
全局类型声明:
|
|
14
|
-
仅提供类型检查信息
|
|
15
|
-
不能被实例化
|
|
16
|
-
仅用于开发时的类型提示和检查
|
|
17
|
-
*
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
export interface MenuItemType {
|
|
22
|
-
label: string;
|
|
23
|
-
path?: string;
|
|
24
|
-
icon?: string;
|
|
25
|
-
children?: MenuItemType[];
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
export interface glyphsItemType {
|
|
30
|
-
"icon_id": string,
|
|
31
|
-
"name":string,
|
|
32
|
-
"font_class": string,
|
|
33
|
-
"unicode": string,
|
|
34
|
-
"unicode_decimal": number
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
interface glyphsItemType123 {
|
|
38
|
-
"icon_id": string,
|
|
39
|
-
"name":string,
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
type testFuncType = (record:glyphsItemType) => string;
|
package/types/index.d.ts
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ***** 本文件描述:
|
|
3
|
-
* 在打包工具库时,需要将此文件加入打包范围 ,在package.json文件加入配置: "types": "types/index.d.ts",
|
|
4
|
-
* 这个配置就是我们在引入npm库的时候引入ts文件时,会自动引入types/index.d.ts文件 检查类型
|
|
5
|
-
* 平时我们引入工具报错:文件“d:/CODE/m-ui/node_modules/m-tool-store”不是模块。或者找不到模块 , 就是找不到这个声明文件
|
|
6
|
-
* 1. 在这里添加export declare const FormatterUtils
|
|
7
|
-
* 2. 在其他项目引入工具库 import时,编辑器会进行代码引入提示
|
|
8
|
-
*
|
|
9
|
-
* **
|
|
10
|
-
* 在添加了"types": "types/index.d.ts"并且"files": ["dist","types"]包含types的情况下(files添加后会在npm publish时加入npm的包)
|
|
11
|
-
* 在引入项目中可以直接引入工具库的类声明使用:
|
|
12
|
-
* import { glyphsItemType } from "m-tool-store/types/global";
|
|
13
|
-
* let a: glyphsItemType = {};
|
|
14
|
-
* */
|
|
15
|
-
|
|
16
|
-
export { MenuItemType } from './global.d'
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* 格式化工具类
|
|
20
|
-
* 提供各种数据格式化方法
|
|
21
|
-
*/
|
|
22
|
-
export declare const FormatterUtils: {
|
|
23
|
-
// 根据实际类型定义方法
|
|
24
|
-
formatMoney(num: any, dec?: number): string;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* 时间格式化函数
|
|
29
|
-
* @param date - 要格式化的日期
|
|
30
|
-
* @param format - 格式化字符串,默认为 'YYYY-MM-DD'
|
|
31
|
-
* @returns 格式化后的日期字符串
|
|
32
|
-
*/
|
|
33
|
-
export declare function formatDate(date: string | Date | number, format?: string): string;
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* dayjs对象 - 日期处理库实例
|
|
37
|
-
*/
|
|
38
|
-
export declare const dayjs: typeof import('dayjs');
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* 测试方法
|
|
42
|
-
* 测试后, 必须在type入口文件声明对应的方法 , 不然会找不到模块, 会报错
|
|
43
|
-
* 造成实际导出了文件, 但ide报错的问题
|
|
44
|
-
* 解决方法:
|
|
45
|
-
* 1. 在本文件添加对应声明
|
|
46
|
-
* 2. 在引入的项目中添加声明:
|
|
47
|
-
* declare module '@mumm/mu-ui/libs/mu-ui.mjs' {
|
|
48
|
-
const testFunc: any;
|
|
49
|
-
export { testFunc };
|
|
50
|
-
}
|
|
51
|
-
*/
|
|
52
|
-
export declare const testFunc:any;
|
|
53
|
-
|
|
54
|
-
// 生成唯一UUID
|
|
55
|
-
export declare function generateUUID(): string;
|
|
56
|
-
|
|
57
|
-
// 生成唯一ID
|
|
58
|
-
export declare function generateUniqueId(): string;
|
package/types/shims-vue.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
declare module '*.vue' {
|
|
3
|
-
import { DefineComponent } from 'vue'
|
|
4
|
-
const component: DefineComponent<{}, {}, any>
|
|
5
|
-
export default component
|
|
6
|
-
}
|
|
7
|
-
declare module 'types/*' {
|
|
8
|
-
const Obj: any
|
|
9
|
-
export default Obj
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
declare module 'view-ui-plus/dist/locale/en-US' {
|
|
14
|
-
const locale: any
|
|
15
|
-
export default locale
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|