@progress/kendo-vue-dateinputs 10.0.1-develop.3 → 10.0.1-develop.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dateinput/DateInput.d.ts +4 -2
- package/dateinput/DateInput.js +1 -1
- package/dateinput/DateInput.mjs +154 -111
- package/dateinput/interfaces/DateInputMethods.d.ts +2 -1
- package/dateinput/models/kendo-date.d.ts +3 -1
- package/dateinput/models/kendo-date.js +1 -1
- package/dateinput/models/kendo-date.mjs +54 -49
- package/dist/cdn/js/kendo-vue-dateinputs.js +1 -1
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +8 -8
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import { getDate as
|
|
9
|
-
import { Mask as
|
|
10
|
-
import { dateSymbolMap as
|
|
11
|
-
class
|
|
8
|
+
import { getDate as x, isEqual as F, cloneDate as g, addMonths as v, lastDayOfMonth as P, createDate as w } from "@progress/kendo-date-math";
|
|
9
|
+
import { Mask as E } from "./mask.mjs";
|
|
10
|
+
import { dateSymbolMap as b } from "../utils.mjs";
|
|
11
|
+
class S {
|
|
12
12
|
constructor(t, e, s) {
|
|
13
13
|
this.year = !0, this.month = !0, this.date = !0, this.hours = !0, this.minutes = !0, this.seconds = !0, this.milliseconds = !0, this.leadingZero = null, this.typedMonthPart = "", this.knownParts = "adHhmMsEy", this.symbols = {
|
|
14
14
|
E: "E",
|
|
@@ -20,7 +20,7 @@ class k {
|
|
|
20
20
|
m: "m",
|
|
21
21
|
s: "s",
|
|
22
22
|
y: "y"
|
|
23
|
-
}, this._value =
|
|
23
|
+
}, this._value = x(/* @__PURE__ */ new Date()), this.intlProvider = t, this.formatPlaceholder = e, this.format = s, this.monthNames = this.allFormatedMonths();
|
|
24
24
|
}
|
|
25
25
|
get intl() {
|
|
26
26
|
return this.intlProvider();
|
|
@@ -29,7 +29,7 @@ class k {
|
|
|
29
29
|
return this._value;
|
|
30
30
|
}
|
|
31
31
|
setValue(t) {
|
|
32
|
-
t ?
|
|
32
|
+
t ? F(t, this._value) || (this._value = g(t), this.modifyExisting(!0)) : (this._value = x(/* @__PURE__ */ new Date()), this.modifyExisting(!1));
|
|
33
33
|
}
|
|
34
34
|
hasValue() {
|
|
35
35
|
const t = (e, s) => e || s.type !== "literal" && s.type !== "dayperiod" && this.getExisting(s.pattern[0]);
|
|
@@ -39,7 +39,7 @@ class k {
|
|
|
39
39
|
for (let t = 0; t < this.knownParts.length; t++)
|
|
40
40
|
if (!this.getExisting(this.knownParts[t]))
|
|
41
41
|
return null;
|
|
42
|
-
return
|
|
42
|
+
return g(this.value);
|
|
43
43
|
}
|
|
44
44
|
getTextAndFormat() {
|
|
45
45
|
return this.merge(
|
|
@@ -100,13 +100,13 @@ class k {
|
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
modifyPart(t, e) {
|
|
103
|
-
let s =
|
|
103
|
+
let s = g(this.value);
|
|
104
104
|
switch (t) {
|
|
105
105
|
case "y":
|
|
106
106
|
s.setFullYear(s.getFullYear() + e);
|
|
107
107
|
break;
|
|
108
108
|
case "M":
|
|
109
|
-
s =
|
|
109
|
+
s = v(this.value, e);
|
|
110
110
|
break;
|
|
111
111
|
case "d":
|
|
112
112
|
case "E":
|
|
@@ -128,43 +128,48 @@ class k {
|
|
|
128
128
|
}
|
|
129
129
|
this.setExisting(t, !0), this._value = s;
|
|
130
130
|
}
|
|
131
|
-
parsePart(t, e) {
|
|
131
|
+
parsePart(t, e, s = !1) {
|
|
132
132
|
if (this.resetLeadingZero(), !e)
|
|
133
133
|
return this.setExisting(t, !1), { value: null };
|
|
134
|
-
const
|
|
135
|
-
let
|
|
136
|
-
for (let
|
|
137
|
-
h[
|
|
134
|
+
const r = this.intl.formatDate(this.value, this.format), n = this.dateFormatString(this.value, this.format), h = n.symbols;
|
|
135
|
+
let i = !1, l = "", o = "", c = "";
|
|
136
|
+
for (let u = 0; u < r.length; u++)
|
|
137
|
+
h[u] === t ? (o += this.getExisting(t) ? r[u] : "0", i = !0) : i ? c += r[u] : l += r[u];
|
|
138
138
|
let a = null;
|
|
139
|
-
const
|
|
140
|
-
for (;
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
139
|
+
const f = this.matchMonth(e);
|
|
140
|
+
for (; o.length > 0 && o.charAt(0) === "0"; )
|
|
141
|
+
o = o.slice(1);
|
|
142
|
+
if (t === "y" && o.length >= 4 && !s)
|
|
143
|
+
return { value: null, isComplete: !0 };
|
|
144
|
+
for (let u = 0; u < 2; u++) {
|
|
145
|
+
let p = o + e, d = parseInt(p, 10);
|
|
146
|
+
if (a = this.intl.parseDate(l + p + c, this.format), !a && !isNaN(d) && !isNaN(parseInt(e, 10))) {
|
|
147
|
+
if (t === "M" && !f) {
|
|
148
|
+
const m = d - 1;
|
|
149
|
+
m > -1 && m < 12 && (a = g(this.value), a.setMonth(m), a.getMonth() !== m && (a = P(v(a, -1))));
|
|
149
150
|
}
|
|
150
|
-
t === "y" && (a =
|
|
151
|
-
parseInt(
|
|
151
|
+
t === "y" && (a = w(
|
|
152
|
+
parseInt(p, 10),
|
|
152
153
|
this.month ? this.value.getMonth() : 0,
|
|
153
154
|
this.date ? this.value.getDate() : 1,
|
|
154
155
|
this.hours ? this.value.getHours() : 0,
|
|
155
156
|
this.minutes ? this.value.getMinutes() : 0,
|
|
156
157
|
this.seconds ? this.value.getSeconds() : 0,
|
|
157
158
|
this.milliseconds ? this.value.getMilliseconds() : 0
|
|
158
|
-
), this.date && a.getDate() !== this.value.getDate() && (a =
|
|
159
|
+
), this.date && a.getDate() !== this.value.getDate() && (a = P(v(a, -1))));
|
|
159
160
|
}
|
|
160
|
-
if (a)
|
|
161
|
-
|
|
162
|
-
|
|
161
|
+
if (a) {
|
|
162
|
+
this._value = a, this.setExisting(t, !0);
|
|
163
|
+
const m = h.split("").filter((D) => D === t).length, M = o.length + 1;
|
|
164
|
+
let y = M >= m;
|
|
165
|
+
return t === "M" ? y = d >= 2 || M >= 2 : t === "d" && (y = d >= 4 || M >= 2), { value: this.value, switchToNext: y };
|
|
166
|
+
}
|
|
167
|
+
o = "";
|
|
163
168
|
}
|
|
164
|
-
return
|
|
169
|
+
return f && (a = this.intl.parseDate(l + f + c, this.format), a) ? (this._value = a, this.setExisting(t, !0), { value: this.value, switchToNext: !0 }) : (e === "0" && (this.leadingZero = this.isAbbrMonth(n.partMap, t) ? null : { [t]: !0 }, this.setExisting(t, !1)), { value: null });
|
|
165
170
|
}
|
|
166
171
|
symbolMap(t) {
|
|
167
|
-
return this.intl.splitDateFormat(this.format).reduce(
|
|
172
|
+
return this.intl.splitDateFormat(this.format).reduce(b, {})[t];
|
|
168
173
|
}
|
|
169
174
|
resetLeadingZero() {
|
|
170
175
|
const t = this.leadingZero !== null;
|
|
@@ -199,31 +204,31 @@ class k {
|
|
|
199
204
|
return [];
|
|
200
205
|
}
|
|
201
206
|
dateFormatString(t, e) {
|
|
202
|
-
const s = this.intl.splitDateFormat(e),
|
|
207
|
+
const s = this.intl.splitDateFormat(e), r = [], n = [];
|
|
203
208
|
for (let i = 0; i < s.length; i++) {
|
|
204
|
-
let
|
|
205
|
-
for (;
|
|
206
|
-
|
|
209
|
+
let l = this.intl.formatDate(t, { pattern: s[i].pattern }).length;
|
|
210
|
+
for (; l > 0; )
|
|
211
|
+
r.push(this.symbols[s[i].pattern[0]] || "_"), n.push(s[i]), l--;
|
|
207
212
|
}
|
|
208
|
-
const
|
|
209
|
-
return
|
|
213
|
+
const h = new E();
|
|
214
|
+
return h.symbols = r.join(""), h.partMap = n, h;
|
|
210
215
|
}
|
|
211
216
|
merge(t, e) {
|
|
212
|
-
var
|
|
213
|
-
let s = "",
|
|
214
|
-
for (let i =
|
|
215
|
-
if (this.knownParts.indexOf(
|
|
216
|
-
s = t[i] + s,
|
|
217
|
+
var h;
|
|
218
|
+
let s = "", r = "", n = e.symbols;
|
|
219
|
+
for (let i = n.length - 1; i >= 0; ) {
|
|
220
|
+
if (this.knownParts.indexOf(n[i]) === -1 || this.getExisting(n[i]))
|
|
221
|
+
s = t[i] + s, r = n[i] + r;
|
|
217
222
|
else {
|
|
218
|
-
const
|
|
219
|
-
for (; i >= 0 &&
|
|
223
|
+
const l = n[i];
|
|
224
|
+
for (; i >= 0 && l === n[i]; )
|
|
220
225
|
i--;
|
|
221
|
-
for (i++, (
|
|
222
|
-
|
|
226
|
+
for (i++, (h = this.leadingZero) != null && h[l] ? s = "0" + s : s = this.dateFieldName(e.partMap[i]) + s; r.length < s.length; )
|
|
227
|
+
r = n[i] + r;
|
|
223
228
|
}
|
|
224
229
|
i--;
|
|
225
230
|
}
|
|
226
|
-
return { text: s, format:
|
|
231
|
+
return { text: s, format: r };
|
|
227
232
|
}
|
|
228
233
|
dateFieldName(t) {
|
|
229
234
|
const e = this.formatPlaceholder || "wide";
|
|
@@ -231,5 +236,5 @@ class k {
|
|
|
231
236
|
}
|
|
232
237
|
}
|
|
233
238
|
export {
|
|
234
|
-
|
|
239
|
+
S as KendoDate
|
|
235
240
|
};
|