@progress/kendo-vue-dateinputs 10.0.1-develop.3 → 10.0.1-develop.4

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.
@@ -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 M, isEqual as v, cloneDate as m, addMonths as f, lastDayOfMonth as y, createDate as P } from "@progress/kendo-date-math";
9
- import { Mask as x } from "./mask.mjs";
10
- import { dateSymbolMap as D } from "../utils.mjs";
11
- class k {
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 = M(/* @__PURE__ */ new Date()), this.intlProvider = t, this.formatPlaceholder = e, this.format = s, this.monthNames = this.allFormatedMonths();
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 ? v(t, this._value) || (this._value = m(t), this.modifyExisting(!0)) : (this._value = M(/* @__PURE__ */ new Date()), this.modifyExisting(!1));
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 m(this.value);
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 = m(this.value);
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 = f(this.value, e);
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 s = this.intl.formatDate(this.value, this.format), n = this.dateFormatString(this.value, this.format), h = n.symbols;
135
- let l = !1, i = "", r = "", d = "";
136
- for (let o = 0; o < s.length; o++)
137
- h[o] === t ? (r += this.getExisting(t) ? s[o] : "0", l = !0) : l ? d += s[o] : i += s[o];
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 g = this.matchMonth(e);
140
- for (; r.length > 0 && r.charAt(0) === "0"; )
141
- r = r.slice(1);
142
- r.length >= 4 && (r = "");
143
- for (let o = 0; o < 2; o++) {
144
- let c = r + e, p = parseInt(c, 10);
145
- if (a = this.intl.parseDate(i + c + d, this.format), !a && !isNaN(p) && !isNaN(parseInt(e, 10))) {
146
- if (t === "M" && !g) {
147
- const u = p - 1;
148
- u > -1 && u < 12 && (a = m(this.value), a.setMonth(u), a.getMonth() !== u && (a = y(f(a, -1))));
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 = P(
151
- parseInt(c, 10),
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 = y(f(a, -1))));
159
+ ), this.date && a.getDate() !== this.value.getDate() && (a = P(v(a, -1))));
159
160
  }
160
- if (a)
161
- return this._value = a, this.setExisting(t, !0), { value: this.value };
162
- r = "";
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 g && (a = this.intl.parseDate(i + g + d, this.format), a) ? (this._value = a, this.setExisting(t, !0), { value: this.value }) : (e === "0" && (this.leadingZero = this.isAbbrMonth(n.partMap, t) ? null : { [t]: !0 }, this.setExisting(t, !1)), { value: null });
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(D, {})[t];
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), n = [], h = [];
207
+ const s = this.intl.splitDateFormat(e), r = [], n = [];
203
208
  for (let i = 0; i < s.length; i++) {
204
- let r = this.intl.formatDate(t, { pattern: s[i].pattern }).length;
205
- for (; r > 0; )
206
- n.push(this.symbols[s[i].pattern[0]] || "_"), h.push(s[i]), r--;
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 l = new x();
209
- return l.symbols = n.join(""), l.partMap = h, l;
213
+ const h = new E();
214
+ return h.symbols = r.join(""), h.partMap = n, h;
210
215
  }
211
216
  merge(t, e) {
212
- var l;
213
- let s = "", n = "", h = e.symbols;
214
- for (let i = h.length - 1; i >= 0; ) {
215
- if (this.knownParts.indexOf(h[i]) === -1 || this.getExisting(h[i]))
216
- s = t[i] + s, n = h[i] + n;
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 r = h[i];
219
- for (; i >= 0 && r === h[i]; )
223
+ const l = n[i];
224
+ for (; i >= 0 && l === n[i]; )
220
225
  i--;
221
- for (i++, (l = this.leadingZero) != null && l[r] ? s = "0" + s : s = this.dateFieldName(e.partMap[i]) + s; n.length < s.length; )
222
- n = h[i] + n;
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: n };
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
- k as KendoDate
239
+ S as KendoDate
235
240
  };