@phila/phila-ui-date-field 0.0.9 → 0.1.0-beta.6
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/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +868 -905
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent as ve, toRef as
|
|
2
|
-
import { cn as
|
|
1
|
+
import { defineComponent as ve, toRef as Ce, watch as se, h as ut, useAttrs as Je, computed as N, ref as W, createElementBlock as H, openBlock as w, normalizeClass as Ye, createCommentVNode as de, createElementVNode as K, toDisplayString as X, withModifiers as ce, createBlock as ue, renderSlot as ye, unref as T, withDirectives as lt, mergeProps as ie, vModelDynamic as ot, createVNode as fe, createTextVNode as Ee, isRef as ht, readonly as dt, onMounted as ct, onUnmounted as pt, withCtx as ge, normalizeProps as Be, guardReactiveProps as we, Fragment as De, renderList as Se, nextTick as qe, useTemplateRef as Ke, withKeys as ft } from "vue";
|
|
2
|
+
import { cn as Ae, Icon as Ne, BaseLink as Qe, ActionContent as Ie, generateRandomId as mt, useVisibility as gt } from "@phila/phila-ui-core";
|
|
3
3
|
import './index.css';const vt = ["disabled"], kt = /* @__PURE__ */ ve({
|
|
4
4
|
inheritAttrs: !1,
|
|
5
5
|
__name: "PhlButton",
|
|
@@ -22,14 +22,14 @@ import './index.css';const vt = ["disabled"], kt = /* @__PURE__ */ ve({
|
|
|
22
22
|
svgRaw: {}
|
|
23
23
|
},
|
|
24
24
|
setup(r) {
|
|
25
|
-
const e = r, t = (n) => "href" in n && n.href !== void 0 || "to" in n && n.to !== void 0, s =
|
|
25
|
+
const e = r, t = (n) => "href" in n && n.href !== void 0 || "to" in n && n.to !== void 0, s = N(() => Ae(
|
|
26
26
|
"phila-button",
|
|
27
27
|
`phila-button--${e.variant}`,
|
|
28
28
|
e.size && `is-${e.size}`,
|
|
29
29
|
e.iconOnly && "icon-button",
|
|
30
30
|
e.iconOnly && e.variant === "standard" && "icon-button--standard",
|
|
31
31
|
e.className
|
|
32
|
-
)),
|
|
32
|
+
)), i = N(() => t(e) ? "to" in e && e.to !== void 0 ? {
|
|
33
33
|
to: e.to,
|
|
34
34
|
disabled: e.disabled,
|
|
35
35
|
className: s.value
|
|
@@ -39,7 +39,7 @@ import './index.css';const vt = ["disabled"], kt = /* @__PURE__ */ ve({
|
|
|
39
39
|
rel: e.rel,
|
|
40
40
|
disabled: e.disabled,
|
|
41
41
|
className: s.value
|
|
42
|
-
} : {}),
|
|
42
|
+
} : {}), a = N(
|
|
43
43
|
() => ({
|
|
44
44
|
iconDefinition: e.iconDefinition,
|
|
45
45
|
iconClass: e.iconClass,
|
|
@@ -50,28 +50,28 @@ import './index.css';const vt = ["disabled"], kt = /* @__PURE__ */ ve({
|
|
|
50
50
|
size: e.size
|
|
51
51
|
})
|
|
52
52
|
);
|
|
53
|
-
return (n, u) => t(e) ? (w(),
|
|
54
|
-
default:
|
|
55
|
-
|
|
56
|
-
default:
|
|
57
|
-
|
|
58
|
-
|
|
53
|
+
return (n, u) => t(e) ? (w(), ue(T(Qe), ie({ key: 0 }, { ...i.value, ...n.$attrs }, { role: "button" }), {
|
|
54
|
+
default: ge(() => [
|
|
55
|
+
fe(T(Ie), Be(we(a.value)), {
|
|
56
|
+
default: ge(() => [
|
|
57
|
+
ye(n.$slots, "default", {}, () => [
|
|
58
|
+
Ee(X(e.text), 1)
|
|
59
59
|
])
|
|
60
60
|
]),
|
|
61
61
|
_: 3
|
|
62
62
|
}, 16)
|
|
63
63
|
]),
|
|
64
64
|
_: 3
|
|
65
|
-
}, 16)) : (w(),
|
|
65
|
+
}, 16)) : (w(), H("button", ie({
|
|
66
66
|
key: 1,
|
|
67
67
|
type: "button",
|
|
68
68
|
disabled: e.disabled,
|
|
69
69
|
class: s.value
|
|
70
70
|
}, n.$attrs), [
|
|
71
|
-
|
|
72
|
-
default:
|
|
73
|
-
|
|
74
|
-
|
|
71
|
+
fe(T(Ie), Be(we(a.value)), {
|
|
72
|
+
default: ge(() => [
|
|
73
|
+
ye(n.$slots, "default", {}, () => [
|
|
74
|
+
Ee(X(e.text), 1)
|
|
75
75
|
])
|
|
76
76
|
]),
|
|
77
77
|
_: 3
|
|
@@ -88,20 +88,20 @@ var _t = {
|
|
|
88
88
|
iconName: "xmark",
|
|
89
89
|
icon: [384, 512, [128473, 10005, 10006, 10060, 215, "close", "multiply", "remove", "times"], "f00d", "M55.1 73.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L147.2 256 9.9 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192.5 301.3 329.9 438.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.8 256 375.1 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192.5 210.7 55.1 73.4z"]
|
|
90
90
|
}, Et = yt;
|
|
91
|
-
function
|
|
91
|
+
function le(r) {
|
|
92
92
|
return typeof r == "string" || r instanceof String;
|
|
93
93
|
}
|
|
94
|
-
function
|
|
94
|
+
function Ge(r) {
|
|
95
95
|
var e;
|
|
96
96
|
return typeof r == "object" && r != null && (r == null || (e = r.constructor) == null ? void 0 : e.name) === "Object";
|
|
97
97
|
}
|
|
98
|
-
function
|
|
99
|
-
return Array.isArray(e) ?
|
|
100
|
-
let [
|
|
101
|
-
return e(
|
|
98
|
+
function et(r, e) {
|
|
99
|
+
return Array.isArray(e) ? et(r, (t, s) => e.includes(s)) : Object.entries(r).reduce((t, s) => {
|
|
100
|
+
let [i, a] = s;
|
|
101
|
+
return e(a, i) && (t[i] = a), t;
|
|
102
102
|
}, {});
|
|
103
103
|
}
|
|
104
|
-
const
|
|
104
|
+
const f = {
|
|
105
105
|
NONE: "NONE",
|
|
106
106
|
LEFT: "LEFT",
|
|
107
107
|
FORCE_LEFT: "FORCE_LEFT",
|
|
@@ -110,10 +110,10 @@ const m = {
|
|
|
110
110
|
};
|
|
111
111
|
function At(r) {
|
|
112
112
|
switch (r) {
|
|
113
|
-
case
|
|
114
|
-
return
|
|
115
|
-
case
|
|
116
|
-
return
|
|
113
|
+
case f.LEFT:
|
|
114
|
+
return f.FORCE_LEFT;
|
|
115
|
+
case f.RIGHT:
|
|
116
|
+
return f.FORCE_RIGHT;
|
|
117
117
|
default:
|
|
118
118
|
return r;
|
|
119
119
|
}
|
|
@@ -124,23 +124,23 @@ function Ue(r) {
|
|
|
124
124
|
function Te(r, e) {
|
|
125
125
|
if (e === r) return !0;
|
|
126
126
|
const t = Array.isArray(e), s = Array.isArray(r);
|
|
127
|
-
let
|
|
127
|
+
let i;
|
|
128
128
|
if (t && s) {
|
|
129
129
|
if (e.length != r.length) return !1;
|
|
130
|
-
for (
|
|
130
|
+
for (i = 0; i < e.length; i++) if (!Te(e[i], r[i])) return !1;
|
|
131
131
|
return !0;
|
|
132
132
|
}
|
|
133
133
|
if (t != s) return !1;
|
|
134
134
|
if (e && r && typeof e == "object" && typeof r == "object") {
|
|
135
|
-
const
|
|
136
|
-
if (
|
|
137
|
-
if (
|
|
135
|
+
const a = e instanceof Date, n = r instanceof Date;
|
|
136
|
+
if (a && n) return e.getTime() == r.getTime();
|
|
137
|
+
if (a != n) return !1;
|
|
138
138
|
const u = e instanceof RegExp, l = r instanceof RegExp;
|
|
139
139
|
if (u && l) return e.toString() == r.toString();
|
|
140
140
|
if (u != l) return !1;
|
|
141
141
|
const o = Object.keys(e);
|
|
142
|
-
for (
|
|
143
|
-
for (
|
|
142
|
+
for (i = 0; i < o.length; i++) if (!Object.prototype.hasOwnProperty.call(r, o[i])) return !1;
|
|
143
|
+
for (i = 0; i < o.length; i++) if (!Te(r[o[i]], e[o[i]])) return !1;
|
|
144
144
|
return !0;
|
|
145
145
|
} else if (e && r && typeof e == "function" && typeof r == "function")
|
|
146
146
|
return e.toString() === r.toString();
|
|
@@ -189,53 +189,53 @@ class bt {
|
|
|
189
189
|
}
|
|
190
190
|
/** Remove direction */
|
|
191
191
|
get removeDirection() {
|
|
192
|
-
return !this.removedCount || this.insertedCount ?
|
|
193
|
-
this.oldSelection.end === this.oldSelection.start ?
|
|
192
|
+
return !this.removedCount || this.insertedCount ? f.NONE : (this.oldSelection.end === this.cursorPos || this.oldSelection.start === this.cursorPos) && // if not range removed (event with backspace)
|
|
193
|
+
this.oldSelection.end === this.oldSelection.start ? f.RIGHT : f.LEFT;
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
|
-
function
|
|
197
|
-
return new
|
|
196
|
+
function _(r, e) {
|
|
197
|
+
return new _.InputMask(r, e);
|
|
198
198
|
}
|
|
199
|
-
function
|
|
199
|
+
function tt(r) {
|
|
200
200
|
if (r == null) throw new Error("mask property should be defined");
|
|
201
|
-
return r instanceof RegExp ?
|
|
201
|
+
return r instanceof RegExp ? _.MaskedRegExp : le(r) ? _.MaskedPattern : r === Date ? _.MaskedDate : r === Number ? _.MaskedNumber : Array.isArray(r) || r === Array ? _.MaskedDynamic : _.Masked && r.prototype instanceof _.Masked ? r : _.Masked && r instanceof _.Masked ? r.constructor : r instanceof Function ? _.MaskedFunction : _.Masked;
|
|
202
202
|
}
|
|
203
|
-
function
|
|
203
|
+
function be(r) {
|
|
204
204
|
if (!r) throw new Error("Options in not defined");
|
|
205
|
-
if (
|
|
206
|
-
if (r.prototype instanceof
|
|
205
|
+
if (_.Masked) {
|
|
206
|
+
if (r.prototype instanceof _.Masked) return {
|
|
207
207
|
mask: r
|
|
208
208
|
};
|
|
209
209
|
const {
|
|
210
210
|
mask: e = void 0,
|
|
211
211
|
...t
|
|
212
|
-
} = r instanceof
|
|
212
|
+
} = r instanceof _.Masked ? {
|
|
213
213
|
mask: r
|
|
214
|
-
} :
|
|
214
|
+
} : Ge(r) && r.mask instanceof _.Masked ? r : {};
|
|
215
215
|
if (e) {
|
|
216
216
|
const s = e.mask;
|
|
217
217
|
return {
|
|
218
|
-
...
|
|
218
|
+
...et(e, (i, a) => !a.startsWith("_")),
|
|
219
219
|
mask: e.constructor,
|
|
220
220
|
_mask: s,
|
|
221
221
|
...t
|
|
222
222
|
};
|
|
223
223
|
}
|
|
224
224
|
}
|
|
225
|
-
return
|
|
225
|
+
return Ge(r) ? {
|
|
226
226
|
...r
|
|
227
227
|
} : {
|
|
228
228
|
mask: r
|
|
229
229
|
};
|
|
230
230
|
}
|
|
231
|
-
function
|
|
232
|
-
if (
|
|
233
|
-
const e =
|
|
231
|
+
function ae(r) {
|
|
232
|
+
if (_.Masked && r instanceof _.Masked) return r;
|
|
233
|
+
const e = be(r), t = tt(e.mask);
|
|
234
234
|
if (!t) throw new Error("Masked class is not found for provided mask " + e.mask + ", appropriate module needs to be imported manually before creating mask.");
|
|
235
235
|
return e.mask === t && delete e.mask, e._mask && (e.mask = e._mask, delete e._mask), new t(e);
|
|
236
236
|
}
|
|
237
|
-
|
|
238
|
-
class
|
|
237
|
+
_.createMask = ae;
|
|
238
|
+
class ze {
|
|
239
239
|
/** */
|
|
240
240
|
/** */
|
|
241
241
|
/** */
|
|
@@ -273,9 +273,9 @@ class He {
|
|
|
273
273
|
/** */
|
|
274
274
|
/** */
|
|
275
275
|
}
|
|
276
|
-
|
|
277
|
-
const
|
|
278
|
-
class
|
|
276
|
+
_.MaskElement = ze;
|
|
277
|
+
const Ze = 90, Ft = 89;
|
|
278
|
+
class Oe extends ze {
|
|
279
279
|
/** HTMLElement to use mask on */
|
|
280
280
|
constructor(e) {
|
|
281
281
|
super(), this.input = e, this._onKeydown = this._onKeydown.bind(this), this._onInput = this._onInput.bind(this), this._onBeforeinput = this._onBeforeinput.bind(this), this._onCompositionEnd = this._onCompositionEnd.bind(this);
|
|
@@ -293,9 +293,9 @@ class Re extends He {
|
|
|
293
293
|
this.input.addEventListener("keydown", this._onKeydown), this.input.addEventListener("input", this._onInput), this.input.addEventListener("beforeinput", this._onBeforeinput), this.input.addEventListener("compositionend", this._onCompositionEnd), this.input.addEventListener("drop", e.drop), this.input.addEventListener("click", e.click), this.input.addEventListener("focus", e.focus), this.input.addEventListener("blur", e.commit), this._handlers = e;
|
|
294
294
|
}
|
|
295
295
|
_onKeydown(e) {
|
|
296
|
-
if (this._handlers.redo && (e.keyCode ===
|
|
296
|
+
if (this._handlers.redo && (e.keyCode === Ze && e.shiftKey && (e.metaKey || e.ctrlKey) || e.keyCode === Ft && e.ctrlKey))
|
|
297
297
|
return e.preventDefault(), this._handlers.redo(e);
|
|
298
|
-
if (this._handlers.undo && e.keyCode ===
|
|
298
|
+
if (this._handlers.undo && e.keyCode === Ze && (e.metaKey || e.ctrlKey))
|
|
299
299
|
return e.preventDefault(), this._handlers.undo(e);
|
|
300
300
|
e.isComposing || this._handlers.selectionChange(e);
|
|
301
301
|
}
|
|
@@ -316,8 +316,8 @@ class Re extends He {
|
|
|
316
316
|
this.input.removeEventListener("keydown", this._onKeydown), this.input.removeEventListener("input", this._onInput), this.input.removeEventListener("beforeinput", this._onBeforeinput), this.input.removeEventListener("compositionend", this._onCompositionEnd), this.input.removeEventListener("drop", this._handlers.drop), this.input.removeEventListener("click", this._handlers.click), this.input.removeEventListener("focus", this._handlers.focus), this.input.removeEventListener("blur", this._handlers.commit), this._handlers = {};
|
|
317
317
|
}
|
|
318
318
|
}
|
|
319
|
-
|
|
320
|
-
class xt extends
|
|
319
|
+
_.HTMLMaskElement = Oe;
|
|
320
|
+
class xt extends Oe {
|
|
321
321
|
/** InputElement to use mask on */
|
|
322
322
|
constructor(e) {
|
|
323
323
|
super(e), this.input = e;
|
|
@@ -341,25 +341,25 @@ class xt extends Re {
|
|
|
341
341
|
this.input.value = e;
|
|
342
342
|
}
|
|
343
343
|
}
|
|
344
|
-
|
|
345
|
-
class
|
|
344
|
+
_.HTMLMaskElement = Oe;
|
|
345
|
+
class st extends Oe {
|
|
346
346
|
/** Returns HTMLElement selection start */
|
|
347
347
|
get _unsafeSelectionStart() {
|
|
348
|
-
const e = this.rootElement, t = e.getSelection && e.getSelection(), s = t && t.anchorOffset,
|
|
349
|
-
return
|
|
348
|
+
const e = this.rootElement, t = e.getSelection && e.getSelection(), s = t && t.anchorOffset, i = t && t.focusOffset;
|
|
349
|
+
return i == null || s == null || s < i ? s : i;
|
|
350
350
|
}
|
|
351
351
|
/** Returns HTMLElement selection end */
|
|
352
352
|
get _unsafeSelectionEnd() {
|
|
353
|
-
const e = this.rootElement, t = e.getSelection && e.getSelection(), s = t && t.anchorOffset,
|
|
354
|
-
return
|
|
353
|
+
const e = this.rootElement, t = e.getSelection && e.getSelection(), s = t && t.anchorOffset, i = t && t.focusOffset;
|
|
354
|
+
return i == null || s == null || s > i ? s : i;
|
|
355
355
|
}
|
|
356
356
|
/** Sets HTMLElement selection */
|
|
357
357
|
_unsafeSelect(e, t) {
|
|
358
358
|
if (!this.rootElement.createRange) return;
|
|
359
359
|
const s = this.rootElement.createRange();
|
|
360
360
|
s.setStart(this.input.firstChild || this.input, e), s.setEnd(this.input.lastChild || this.input, t);
|
|
361
|
-
const
|
|
362
|
-
|
|
361
|
+
const i = this.rootElement, a = i.getSelection && i.getSelection();
|
|
362
|
+
a && (a.removeAllRanges(), a.addRange(s));
|
|
363
363
|
}
|
|
364
364
|
/** HTMLElement value */
|
|
365
365
|
get value() {
|
|
@@ -369,7 +369,7 @@ class tt extends Re {
|
|
|
369
369
|
this.input.textContent = e;
|
|
370
370
|
}
|
|
371
371
|
}
|
|
372
|
-
|
|
372
|
+
_.HTMLContenteditableMaskElement = st;
|
|
373
373
|
class Pe {
|
|
374
374
|
constructor() {
|
|
375
375
|
this.states = [], this.currentIndex = 0;
|
|
@@ -403,7 +403,7 @@ class Dt {
|
|
|
403
403
|
*/
|
|
404
404
|
/** Internal {@link Masked} model */
|
|
405
405
|
constructor(e, t) {
|
|
406
|
-
this.el = e instanceof
|
|
406
|
+
this.el = e instanceof ze ? e : e.isContentEditable && e.tagName !== "INPUT" && e.tagName !== "TEXTAREA" ? new st(e) : new xt(e), this.masked = ae(t), this._listeners = {}, this._value = "", this._unmaskedValue = "", this._rawInputValue = "", this.history = new Pe(), this._saveSelection = this._saveSelection.bind(this), this._onInput = this._onInput.bind(this), this._onChange = this._onChange.bind(this), this._onDrop = this._onDrop.bind(this), this._onFocus = this._onFocus.bind(this), this._onClick = this._onClick.bind(this), this._onUndo = this._onUndo.bind(this), this._onRedo = this._onRedo.bind(this), this.alignCursor = this.alignCursor.bind(this), this.alignCursorFriendly = this.alignCursorFriendly.bind(this), this._bindEvents(), this.updateValue(), this._onChange();
|
|
407
407
|
}
|
|
408
408
|
maskEquals(e) {
|
|
409
409
|
var t;
|
|
@@ -415,13 +415,13 @@ class Dt {
|
|
|
415
415
|
}
|
|
416
416
|
set mask(e) {
|
|
417
417
|
if (this.maskEquals(e)) return;
|
|
418
|
-
if (!(e instanceof
|
|
418
|
+
if (!(e instanceof _.Masked) && this.masked.constructor === tt(e)) {
|
|
419
419
|
this.masked.updateOptions({
|
|
420
420
|
mask: e
|
|
421
421
|
});
|
|
422
422
|
return;
|
|
423
423
|
}
|
|
424
|
-
const t = e instanceof
|
|
424
|
+
const t = e instanceof _.Masked ? e : ae({
|
|
425
425
|
mask: e
|
|
426
426
|
});
|
|
427
427
|
t.unmaskedValue = this.masked.unmaskedValue, this.masked = t;
|
|
@@ -478,7 +478,7 @@ class Dt {
|
|
|
478
478
|
/** Fires custom event */
|
|
479
479
|
_fireEvent(e, t) {
|
|
480
480
|
const s = this._listeners[e];
|
|
481
|
-
s && s.forEach((
|
|
481
|
+
s && s.forEach((i) => i(t));
|
|
482
482
|
}
|
|
483
483
|
/** Current selection start */
|
|
484
484
|
get selectionStart() {
|
|
@@ -504,8 +504,8 @@ class Dt {
|
|
|
504
504
|
}
|
|
505
505
|
/** Syncronizes view from model value, fires change events */
|
|
506
506
|
updateControl(e) {
|
|
507
|
-
const t = this.masked.unmaskedValue, s = this.masked.value,
|
|
508
|
-
this._unmaskedValue = t, this._value = s, this._rawInputValue =
|
|
507
|
+
const t = this.masked.unmaskedValue, s = this.masked.value, i = this.masked.rawInputValue, a = this.displayValue, n = this.unmaskedValue !== t || this.value !== s || this._rawInputValue !== i;
|
|
508
|
+
this._unmaskedValue = t, this._value = s, this._rawInputValue = i, this.el.value !== a && (this.el.value = a), e === "auto" ? this.alignCursor() : e != null && (this.cursorPos = e), n && this._fireChangeEvents(), !this._historyChanging && (n || this.history.isEmpty) && this.history.push({
|
|
509
509
|
unmaskedValue: t,
|
|
510
510
|
selection: {
|
|
511
511
|
start: this.selectionStart,
|
|
@@ -518,8 +518,8 @@ class Dt {
|
|
|
518
518
|
const {
|
|
519
519
|
mask: t,
|
|
520
520
|
...s
|
|
521
|
-
} = e,
|
|
522
|
-
|
|
521
|
+
} = e, i = !this.maskEquals(t), a = this.masked.optionsIsChanged(s);
|
|
522
|
+
i && (this.mask = t), a && this.masked.updateOptions(s), (i || a) && this.updateControl();
|
|
523
523
|
}
|
|
524
524
|
/** Updates cursor */
|
|
525
525
|
updateCursor(e) {
|
|
@@ -541,7 +541,7 @@ class Dt {
|
|
|
541
541
|
}
|
|
542
542
|
/** Aligns cursor to nearest available position */
|
|
543
543
|
alignCursor() {
|
|
544
|
-
this.cursorPos = this.masked.nearestInputPos(this.masked.nearestInputPos(this.cursorPos,
|
|
544
|
+
this.cursorPos = this.masked.nearestInputPos(this.masked.nearestInputPos(this.cursorPos, f.LEFT));
|
|
545
545
|
}
|
|
546
546
|
/** Aligns cursor only if selection is empty */
|
|
547
547
|
alignCursorFriendly() {
|
|
@@ -569,12 +569,12 @@ class Dt {
|
|
|
569
569
|
// old state
|
|
570
570
|
oldValue: this.displayValue,
|
|
571
571
|
oldSelection: this._selection
|
|
572
|
-
}), s = this.masked.rawInputValue,
|
|
572
|
+
}), s = this.masked.rawInputValue, i = this.masked.splice(t.startChangePos, t.removed.length, t.inserted, t.removeDirection, {
|
|
573
573
|
input: !0,
|
|
574
574
|
raw: !0
|
|
575
|
-
}).offset,
|
|
576
|
-
let n = this.masked.nearestInputPos(t.startChangePos +
|
|
577
|
-
|
|
575
|
+
}).offset, a = s === this.masked.rawInputValue ? t.removeDirection : f.NONE;
|
|
576
|
+
let n = this.masked.nearestInputPos(t.startChangePos + i, a);
|
|
577
|
+
a !== f.NONE && (n = this.masked.nearestInputPos(n, f.NONE)), this.updateControl(n), delete this._inputEvent;
|
|
578
578
|
}
|
|
579
579
|
/** Handles view change event and commits model value */
|
|
580
580
|
_onChange() {
|
|
@@ -606,7 +606,7 @@ class Dt {
|
|
|
606
606
|
this._unbindEvents(), this._listeners.length = 0, delete this.el;
|
|
607
607
|
}
|
|
608
608
|
}
|
|
609
|
-
|
|
609
|
+
_.InputMask = Dt;
|
|
610
610
|
class F {
|
|
611
611
|
/** Inserted symbols */
|
|
612
612
|
/** Additional offset if any changes occurred before tail */
|
|
@@ -638,7 +638,7 @@ class F {
|
|
|
638
638
|
return this.inserted === e.inserted && this.tailShift === e.tailShift && this.rawInserted === e.rawInserted && this.skip === e.skip;
|
|
639
639
|
}
|
|
640
640
|
}
|
|
641
|
-
|
|
641
|
+
_.ChangeDetails = F;
|
|
642
642
|
class Q {
|
|
643
643
|
/** Tail value as string */
|
|
644
644
|
/** Tail start position */
|
|
@@ -783,7 +783,7 @@ class z {
|
|
|
783
783
|
}
|
|
784
784
|
/** Appends tail */
|
|
785
785
|
appendTail(e) {
|
|
786
|
-
return
|
|
786
|
+
return le(e) && (e = new Q(String(e))), e.appendTo(this);
|
|
787
787
|
}
|
|
788
788
|
/** Appends char */
|
|
789
789
|
_appendCharRaw(e, t) {
|
|
@@ -795,36 +795,36 @@ class z {
|
|
|
795
795
|
/** Appends char */
|
|
796
796
|
_appendChar(e, t, s) {
|
|
797
797
|
t === void 0 && (t = {});
|
|
798
|
-
const
|
|
799
|
-
let
|
|
800
|
-
if ([e,
|
|
798
|
+
const i = this.state;
|
|
799
|
+
let a;
|
|
800
|
+
if ([e, a] = this.doPrepareChar(e, t), e && (a = a.aggregate(this._appendCharRaw(e, t)), !a.rawInserted && this.autofix === "pad")) {
|
|
801
801
|
const n = this.state;
|
|
802
|
-
this.state =
|
|
802
|
+
this.state = i;
|
|
803
803
|
let u = this.pad(t);
|
|
804
804
|
const l = this._appendCharRaw(e, t);
|
|
805
|
-
u = u.aggregate(l), l.rawInserted || u.equals(
|
|
805
|
+
u = u.aggregate(l), l.rawInserted || u.equals(a) ? a = u : this.state = n;
|
|
806
806
|
}
|
|
807
|
-
if (
|
|
807
|
+
if (a.inserted) {
|
|
808
808
|
let n, u = this.doValidate(t) !== !1;
|
|
809
809
|
if (u && s != null) {
|
|
810
810
|
const l = this.state;
|
|
811
811
|
if (this.overwrite === !0) {
|
|
812
812
|
n = s.state;
|
|
813
|
-
for (let
|
|
814
|
-
s.unshift(this.displayValue.length -
|
|
813
|
+
for (let p = 0; p < a.rawInserted.length; ++p)
|
|
814
|
+
s.unshift(this.displayValue.length - a.tailShift);
|
|
815
815
|
}
|
|
816
816
|
let o = this.appendTail(s);
|
|
817
817
|
if (u = o.rawInserted.length === s.toString().length, !(u && o.inserted) && this.overwrite === "shift") {
|
|
818
818
|
this.state = l, n = s.state;
|
|
819
|
-
for (let
|
|
819
|
+
for (let p = 0; p < a.rawInserted.length; ++p)
|
|
820
820
|
s.shift();
|
|
821
821
|
o = this.appendTail(s), u = o.rawInserted.length === s.toString().length;
|
|
822
822
|
}
|
|
823
823
|
u && o.inserted && (this.state = l);
|
|
824
824
|
}
|
|
825
|
-
u || (
|
|
825
|
+
u || (a = new F(), this.state = i, s && n && (s.state = n));
|
|
826
826
|
}
|
|
827
|
-
return
|
|
827
|
+
return a;
|
|
828
828
|
}
|
|
829
829
|
/** Appends optional placeholder at the end */
|
|
830
830
|
_appendPlaceholder() {
|
|
@@ -836,17 +836,17 @@ class z {
|
|
|
836
836
|
}
|
|
837
837
|
/** Appends symbols considering flags */
|
|
838
838
|
append(e, t, s) {
|
|
839
|
-
if (!
|
|
840
|
-
const
|
|
839
|
+
if (!le(e)) throw new Error("value should be string");
|
|
840
|
+
const i = le(s) ? new Q(String(s)) : s;
|
|
841
841
|
t != null && t.tail && (t._beforeTailState = this.state);
|
|
842
|
-
let
|
|
843
|
-
[e,
|
|
842
|
+
let a;
|
|
843
|
+
[e, a] = this.doPrepare(e, t);
|
|
844
844
|
for (let n = 0; n < e.length; ++n) {
|
|
845
|
-
const u = this._appendChar(e[n], t,
|
|
846
|
-
if (!u.rawInserted && !this.doSkipInvalid(e[n], t,
|
|
847
|
-
|
|
845
|
+
const u = this._appendChar(e[n], t, i);
|
|
846
|
+
if (!u.rawInserted && !this.doSkipInvalid(e[n], t, i)) break;
|
|
847
|
+
a.aggregate(u);
|
|
848
848
|
}
|
|
849
|
-
return (this.eager === !0 || this.eager === "append") && t != null && t.input && e &&
|
|
849
|
+
return (this.eager === !0 || this.eager === "append") && t != null && t.input && e && a.aggregate(this._appendEager()), i != null && (a.tailShift += this.appendTail(i).tailShift), a;
|
|
850
850
|
}
|
|
851
851
|
remove(e, t) {
|
|
852
852
|
return e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length), this._value = this.displayValue.slice(0, e) + this.displayValue.slice(t), new F();
|
|
@@ -855,8 +855,8 @@ class z {
|
|
|
855
855
|
withValueRefresh(e) {
|
|
856
856
|
if (this._refreshing || !this._initialized) return e();
|
|
857
857
|
this._refreshing = !0;
|
|
858
|
-
const t = this.rawInputValue, s = this.value,
|
|
859
|
-
return this.rawInputValue = t, this.value && this.value !== s && s.indexOf(this.value) === 0 && (this.append(s.slice(this.displayValue.length), {}, ""), this.doCommit()), delete this._refreshing,
|
|
858
|
+
const t = this.rawInputValue, s = this.value, i = e();
|
|
859
|
+
return this.rawInputValue = t, this.value && this.value !== s && s.indexOf(this.value) === 0 && (this.append(s.slice(this.displayValue.length), {}, ""), this.doCommit()), delete this._refreshing, i;
|
|
860
860
|
}
|
|
861
861
|
runIsolated(e) {
|
|
862
862
|
if (this._isolated || !this._initialized) return e(this);
|
|
@@ -883,26 +883,26 @@ class z {
|
|
|
883
883
|
doCommit() {
|
|
884
884
|
this.commit && this.commit(this.value, this);
|
|
885
885
|
}
|
|
886
|
-
splice(e, t, s,
|
|
887
|
-
s === void 0 && (s = ""),
|
|
886
|
+
splice(e, t, s, i, a) {
|
|
887
|
+
s === void 0 && (s = ""), i === void 0 && (i = f.NONE), a === void 0 && (a = {
|
|
888
888
|
input: !0
|
|
889
889
|
});
|
|
890
890
|
const n = e + t, u = this.extractTail(n), l = this.eager === !0 || this.eager === "remove";
|
|
891
891
|
let o;
|
|
892
|
-
l && (
|
|
892
|
+
l && (i = At(i), o = this.extractInput(0, n, {
|
|
893
893
|
raw: !0
|
|
894
894
|
}));
|
|
895
|
-
let
|
|
896
|
-
const
|
|
897
|
-
if (
|
|
898
|
-
if (
|
|
899
|
-
let
|
|
900
|
-
for (; o === this.rawInputValue && (
|
|
901
|
-
|
|
895
|
+
let p = e;
|
|
896
|
+
const m = new F();
|
|
897
|
+
if (i !== f.NONE && (p = this.nearestInputPos(e, t > 1 && e !== 0 && !l ? f.NONE : i), m.tailShift = p - e), m.aggregate(this.remove(p)), l && i !== f.NONE && o === this.rawInputValue)
|
|
898
|
+
if (i === f.FORCE_LEFT) {
|
|
899
|
+
let A;
|
|
900
|
+
for (; o === this.rawInputValue && (A = this.displayValue.length); )
|
|
901
|
+
m.aggregate(new F({
|
|
902
902
|
tailShift: -1
|
|
903
|
-
})).aggregate(this.remove(
|
|
904
|
-
} else
|
|
905
|
-
return
|
|
903
|
+
})).aggregate(this.remove(A - 1));
|
|
904
|
+
} else i === f.FORCE_RIGHT && u.unshift();
|
|
905
|
+
return m.aggregate(this.append(s, a, u));
|
|
906
906
|
}
|
|
907
907
|
maskEquals(e) {
|
|
908
908
|
return this.mask === e;
|
|
@@ -922,8 +922,8 @@ z.DEFAULTS = {
|
|
|
922
922
|
skipInvalid: !0
|
|
923
923
|
};
|
|
924
924
|
z.EMPTY_VALUES = [void 0, null, ""];
|
|
925
|
-
|
|
926
|
-
class
|
|
925
|
+
_.Masked = z;
|
|
926
|
+
class pe {
|
|
927
927
|
/** */
|
|
928
928
|
constructor(e, t) {
|
|
929
929
|
e === void 0 && (e = []), t === void 0 && (t = 0), this.chunks = e, this.from = t;
|
|
@@ -933,39 +933,39 @@ class fe {
|
|
|
933
933
|
}
|
|
934
934
|
extend(e) {
|
|
935
935
|
if (!String(e)) return;
|
|
936
|
-
e =
|
|
936
|
+
e = le(e) ? new Q(String(e)) : e;
|
|
937
937
|
const t = this.chunks[this.chunks.length - 1], s = t && // if stops are same or tail has no stop
|
|
938
938
|
(t.stop === e.stop || e.stop == null) && // if tail chunk goes just after last chunk
|
|
939
939
|
e.from === t.from + t.toString().length;
|
|
940
940
|
if (e instanceof Q)
|
|
941
941
|
s ? t.extend(e.toString()) : this.chunks.push(e);
|
|
942
|
-
else if (e instanceof
|
|
942
|
+
else if (e instanceof pe) {
|
|
943
943
|
if (e.stop == null) {
|
|
944
|
-
let
|
|
944
|
+
let i;
|
|
945
945
|
for (; e.chunks.length && e.chunks[0].stop == null; )
|
|
946
|
-
|
|
946
|
+
i = e.chunks.shift(), i.from += e.from, this.extend(i);
|
|
947
947
|
}
|
|
948
948
|
e.toString() && (e.stop = e.blockIndex, this.chunks.push(e));
|
|
949
949
|
}
|
|
950
950
|
}
|
|
951
951
|
appendTo(e) {
|
|
952
|
-
if (!(e instanceof
|
|
952
|
+
if (!(e instanceof _.MaskedPattern))
|
|
953
953
|
return new Q(this.toString()).appendTo(e);
|
|
954
954
|
const t = new F();
|
|
955
955
|
for (let s = 0; s < this.chunks.length; ++s) {
|
|
956
|
-
const
|
|
956
|
+
const i = this.chunks[s], a = e._mapPosToBlock(e.displayValue.length), n = i.stop;
|
|
957
957
|
let u;
|
|
958
958
|
if (n != null && // if block not found or stop is behind lastBlock
|
|
959
|
-
(!
|
|
960
|
-
e._stops.indexOf(n) >= 0) && t.aggregate(e._appendPlaceholder(n)), u =
|
|
961
|
-
const l = u.appendTail(
|
|
959
|
+
(!a || a.index <= n) && ((i instanceof pe || // for continuous block also check if stop is exist
|
|
960
|
+
e._stops.indexOf(n) >= 0) && t.aggregate(e._appendPlaceholder(n)), u = i instanceof pe && e._blocks[n]), u) {
|
|
961
|
+
const l = u.appendTail(i);
|
|
962
962
|
t.aggregate(l);
|
|
963
|
-
const o =
|
|
963
|
+
const o = i.toString().slice(l.rawInserted.length);
|
|
964
964
|
o && t.aggregate(e.append(o, {
|
|
965
965
|
tail: !0
|
|
966
966
|
}));
|
|
967
967
|
} else
|
|
968
|
-
t.aggregate(e.append(
|
|
968
|
+
t.aggregate(e.append(i.toString(), {
|
|
969
969
|
tail: !0
|
|
970
970
|
}));
|
|
971
971
|
}
|
|
@@ -984,9 +984,9 @@ class fe {
|
|
|
984
984
|
chunks: t,
|
|
985
985
|
...s
|
|
986
986
|
} = e;
|
|
987
|
-
Object.assign(this, s), this.chunks = t.map((
|
|
988
|
-
const
|
|
989
|
-
return
|
|
987
|
+
Object.assign(this, s), this.chunks = t.map((i) => {
|
|
988
|
+
const a = "chunks" in i ? new pe() : new Q();
|
|
989
|
+
return a.state = i, a;
|
|
990
990
|
});
|
|
991
991
|
}
|
|
992
992
|
unshift(e) {
|
|
@@ -994,13 +994,13 @@ class fe {
|
|
|
994
994
|
const t = e != null ? e - this.from : e;
|
|
995
995
|
let s = 0;
|
|
996
996
|
for (; s < this.chunks.length; ) {
|
|
997
|
-
const
|
|
998
|
-
if (
|
|
999
|
-
if (!
|
|
997
|
+
const i = this.chunks[s], a = i.unshift(t);
|
|
998
|
+
if (i.toString()) {
|
|
999
|
+
if (!a) break;
|
|
1000
1000
|
++s;
|
|
1001
1001
|
} else
|
|
1002
1002
|
this.chunks.splice(s, 1);
|
|
1003
|
-
if (
|
|
1003
|
+
if (a) return a;
|
|
1004
1004
|
}
|
|
1005
1005
|
return "";
|
|
1006
1006
|
}
|
|
@@ -1024,7 +1024,7 @@ class St {
|
|
|
1024
1024
|
this.masked = e, this._log = [];
|
|
1025
1025
|
const {
|
|
1026
1026
|
offset: s,
|
|
1027
|
-
index:
|
|
1027
|
+
index: i
|
|
1028
1028
|
} = e._mapPosToBlock(t) || (t < 0 ? (
|
|
1029
1029
|
// first
|
|
1030
1030
|
{
|
|
@@ -1038,7 +1038,7 @@ class St {
|
|
|
1038
1038
|
offset: 0
|
|
1039
1039
|
}
|
|
1040
1040
|
));
|
|
1041
|
-
this.offset = s, this.index =
|
|
1041
|
+
this.offset = s, this.index = i, this.ok = !1;
|
|
1042
1042
|
}
|
|
1043
1043
|
get block() {
|
|
1044
1044
|
return this.masked._blocks[this.index];
|
|
@@ -1080,42 +1080,42 @@ class St {
|
|
|
1080
1080
|
}
|
|
1081
1081
|
pushLeftBeforeFilled() {
|
|
1082
1082
|
return this._pushLeft(() => {
|
|
1083
|
-
if (!(this.block.isFixed || !this.block.value) && (this.offset = this.block.nearestInputPos(this.offset,
|
|
1083
|
+
if (!(this.block.isFixed || !this.block.value) && (this.offset = this.block.nearestInputPos(this.offset, f.FORCE_LEFT), this.offset !== 0))
|
|
1084
1084
|
return !0;
|
|
1085
1085
|
});
|
|
1086
1086
|
}
|
|
1087
1087
|
pushLeftBeforeInput() {
|
|
1088
1088
|
return this._pushLeft(() => {
|
|
1089
1089
|
if (!this.block.isFixed)
|
|
1090
|
-
return this.offset = this.block.nearestInputPos(this.offset,
|
|
1090
|
+
return this.offset = this.block.nearestInputPos(this.offset, f.LEFT), !0;
|
|
1091
1091
|
});
|
|
1092
1092
|
}
|
|
1093
1093
|
pushLeftBeforeRequired() {
|
|
1094
1094
|
return this._pushLeft(() => {
|
|
1095
1095
|
if (!(this.block.isFixed || this.block.isOptional && !this.block.value))
|
|
1096
|
-
return this.offset = this.block.nearestInputPos(this.offset,
|
|
1096
|
+
return this.offset = this.block.nearestInputPos(this.offset, f.LEFT), !0;
|
|
1097
1097
|
});
|
|
1098
1098
|
}
|
|
1099
1099
|
pushRightBeforeFilled() {
|
|
1100
1100
|
return this._pushRight(() => {
|
|
1101
|
-
if (!(this.block.isFixed || !this.block.value) && (this.offset = this.block.nearestInputPos(this.offset,
|
|
1101
|
+
if (!(this.block.isFixed || !this.block.value) && (this.offset = this.block.nearestInputPos(this.offset, f.FORCE_RIGHT), this.offset !== this.block.value.length))
|
|
1102
1102
|
return !0;
|
|
1103
1103
|
});
|
|
1104
1104
|
}
|
|
1105
1105
|
pushRightBeforeInput() {
|
|
1106
1106
|
return this._pushRight(() => {
|
|
1107
1107
|
if (!this.block.isFixed)
|
|
1108
|
-
return this.offset = this.block.nearestInputPos(this.offset,
|
|
1108
|
+
return this.offset = this.block.nearestInputPos(this.offset, f.NONE), !0;
|
|
1109
1109
|
});
|
|
1110
1110
|
}
|
|
1111
1111
|
pushRightBeforeRequired() {
|
|
1112
1112
|
return this._pushRight(() => {
|
|
1113
1113
|
if (!(this.block.isFixed || this.block.isOptional && !this.block.value))
|
|
1114
|
-
return this.offset = this.block.nearestInputPos(this.offset,
|
|
1114
|
+
return this.offset = this.block.nearestInputPos(this.offset, f.NONE), !0;
|
|
1115
1115
|
});
|
|
1116
1116
|
}
|
|
1117
1117
|
}
|
|
1118
|
-
class
|
|
1118
|
+
class it {
|
|
1119
1119
|
/** */
|
|
1120
1120
|
/** */
|
|
1121
1121
|
/** */
|
|
@@ -1144,17 +1144,17 @@ class st {
|
|
|
1144
1144
|
return e === void 0 && (e = 0), t === void 0 && (t = this._value.length), this._value = this._value.slice(0, e) + this._value.slice(t), this._value || (this._isRawInput = !1), new F();
|
|
1145
1145
|
}
|
|
1146
1146
|
nearestInputPos(e, t) {
|
|
1147
|
-
t === void 0 && (t =
|
|
1148
|
-
const s = 0,
|
|
1147
|
+
t === void 0 && (t = f.NONE);
|
|
1148
|
+
const s = 0, i = this._value.length;
|
|
1149
1149
|
switch (t) {
|
|
1150
|
-
case
|
|
1151
|
-
case
|
|
1150
|
+
case f.LEFT:
|
|
1151
|
+
case f.FORCE_LEFT:
|
|
1152
1152
|
return s;
|
|
1153
|
-
case
|
|
1154
|
-
case
|
|
1155
|
-
case
|
|
1153
|
+
case f.NONE:
|
|
1154
|
+
case f.RIGHT:
|
|
1155
|
+
case f.FORCE_RIGHT:
|
|
1156
1156
|
default:
|
|
1157
|
-
return
|
|
1157
|
+
return i;
|
|
1158
1158
|
}
|
|
1159
1159
|
}
|
|
1160
1160
|
totalInputPositions(e, t) {
|
|
@@ -1171,11 +1171,11 @@ class st {
|
|
|
1171
1171
|
}
|
|
1172
1172
|
_appendChar(e, t) {
|
|
1173
1173
|
if (t === void 0 && (t = {}), this.isFilled) return new F();
|
|
1174
|
-
const s = this.eager === !0 || this.eager === "append",
|
|
1174
|
+
const s = this.eager === !0 || this.eager === "append", i = this.char === e && (this.isUnmasking || t.input || t.raw) && (!t.raw || !s) && !t.tail, a = new F({
|
|
1175
1175
|
inserted: this.char,
|
|
1176
|
-
rawInserted:
|
|
1176
|
+
rawInserted: i ? this.char : ""
|
|
1177
1177
|
});
|
|
1178
|
-
return this._value = this.char, this._isRawInput =
|
|
1178
|
+
return this._value = this.char, this._isRawInput = i && (t.raw || t.input), a;
|
|
1179
1179
|
}
|
|
1180
1180
|
_appendEager() {
|
|
1181
1181
|
return this._appendChar(this.char, {
|
|
@@ -1190,11 +1190,11 @@ class st {
|
|
|
1190
1190
|
return new Q("");
|
|
1191
1191
|
}
|
|
1192
1192
|
appendTail(e) {
|
|
1193
|
-
return
|
|
1193
|
+
return le(e) && (e = new Q(String(e))), e.appendTo(this);
|
|
1194
1194
|
}
|
|
1195
1195
|
append(e, t, s) {
|
|
1196
|
-
const
|
|
1197
|
-
return s != null && (
|
|
1196
|
+
const i = this._appendChar(e[0], t);
|
|
1197
|
+
return s != null && (i.tailShift += this.appendTail(s).tailShift), i;
|
|
1198
1198
|
}
|
|
1199
1199
|
doCommit() {
|
|
1200
1200
|
}
|
|
@@ -1211,7 +1211,7 @@ class st {
|
|
|
1211
1211
|
return this._appendPlaceholder();
|
|
1212
1212
|
}
|
|
1213
1213
|
}
|
|
1214
|
-
class
|
|
1214
|
+
class Re {
|
|
1215
1215
|
/** */
|
|
1216
1216
|
/** */
|
|
1217
1217
|
/** */
|
|
@@ -1224,17 +1224,17 @@ class Oe {
|
|
|
1224
1224
|
const {
|
|
1225
1225
|
parent: t,
|
|
1226
1226
|
isOptional: s,
|
|
1227
|
-
placeholderChar:
|
|
1228
|
-
displayChar:
|
|
1227
|
+
placeholderChar: i,
|
|
1228
|
+
displayChar: a,
|
|
1229
1229
|
lazy: n,
|
|
1230
1230
|
eager: u,
|
|
1231
1231
|
...l
|
|
1232
1232
|
} = e;
|
|
1233
|
-
this.masked =
|
|
1233
|
+
this.masked = ae(l), Object.assign(this, {
|
|
1234
1234
|
parent: t,
|
|
1235
1235
|
isOptional: s,
|
|
1236
|
-
placeholderChar:
|
|
1237
|
-
displayChar:
|
|
1236
|
+
placeholderChar: i,
|
|
1237
|
+
displayChar: a,
|
|
1238
1238
|
lazy: n,
|
|
1239
1239
|
eager: u
|
|
1240
1240
|
});
|
|
@@ -1263,8 +1263,8 @@ class Oe {
|
|
|
1263
1263
|
_appendChar(e, t) {
|
|
1264
1264
|
if (t === void 0 && (t = {}), this.isFilled) return new F();
|
|
1265
1265
|
const s = this.masked.state;
|
|
1266
|
-
let
|
|
1267
|
-
return
|
|
1266
|
+
let i = this.masked._appendChar(e, this.currentMaskFlags(t));
|
|
1267
|
+
return i.inserted && this.doValidate(t) === !1 && (i = new F(), this.masked.state = s), !i.inserted && !this.isOptional && !this.lazy && !t.input && (i.inserted = this.placeholderChar), i.skip = !i.inserted && !this.isOptional, this.isFilled = !!i.inserted, i;
|
|
1268
1268
|
}
|
|
1269
1269
|
append(e, t, s) {
|
|
1270
1270
|
return this.masked.append(e, this.currentMaskFlags(t), s);
|
|
@@ -1287,18 +1287,18 @@ class Oe {
|
|
|
1287
1287
|
return e === void 0 && (e = 0), t === void 0 && (t = this.value.length), this.masked.extractInput(e, t, s);
|
|
1288
1288
|
}
|
|
1289
1289
|
nearestInputPos(e, t) {
|
|
1290
|
-
t === void 0 && (t =
|
|
1291
|
-
const s = 0,
|
|
1290
|
+
t === void 0 && (t = f.NONE);
|
|
1291
|
+
const s = 0, i = this.value.length, a = Math.min(Math.max(e, s), i);
|
|
1292
1292
|
switch (t) {
|
|
1293
|
-
case
|
|
1294
|
-
case
|
|
1295
|
-
return this.isComplete ?
|
|
1296
|
-
case
|
|
1297
|
-
case
|
|
1298
|
-
return this.isComplete ?
|
|
1299
|
-
case
|
|
1293
|
+
case f.LEFT:
|
|
1294
|
+
case f.FORCE_LEFT:
|
|
1295
|
+
return this.isComplete ? a : s;
|
|
1296
|
+
case f.RIGHT:
|
|
1297
|
+
case f.FORCE_RIGHT:
|
|
1298
|
+
return this.isComplete ? a : i;
|
|
1299
|
+
case f.NONE:
|
|
1300
1300
|
default:
|
|
1301
|
-
return
|
|
1301
|
+
return a;
|
|
1302
1302
|
}
|
|
1303
1303
|
}
|
|
1304
1304
|
totalInputPositions(e, t) {
|
|
@@ -1332,7 +1332,7 @@ class Oe {
|
|
|
1332
1332
|
return new F();
|
|
1333
1333
|
}
|
|
1334
1334
|
}
|
|
1335
|
-
|
|
1335
|
+
Re.DEFAULT_DEFINITIONS = {
|
|
1336
1336
|
0: /\d/,
|
|
1337
1337
|
a: /[\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,
|
|
1338
1338
|
// http://stackoverflow.com/a/22075070
|
|
@@ -1352,8 +1352,8 @@ class Mt extends z {
|
|
|
1352
1352
|
t && (e.validate = (s) => s.search(t) >= 0), super._update(e);
|
|
1353
1353
|
}
|
|
1354
1354
|
}
|
|
1355
|
-
|
|
1356
|
-
class
|
|
1355
|
+
_.MaskedRegExp = Mt;
|
|
1356
|
+
class j extends z {
|
|
1357
1357
|
/** */
|
|
1358
1358
|
/** */
|
|
1359
1359
|
/** Single char for empty input */
|
|
@@ -1365,9 +1365,9 @@ class H extends z {
|
|
|
1365
1365
|
/** */
|
|
1366
1366
|
constructor(e) {
|
|
1367
1367
|
super({
|
|
1368
|
-
...
|
|
1368
|
+
...j.DEFAULTS,
|
|
1369
1369
|
...e,
|
|
1370
|
-
definitions: Object.assign({},
|
|
1370
|
+
definitions: Object.assign({}, Re.DEFAULT_DEFINITIONS, e?.definitions)
|
|
1371
1371
|
});
|
|
1372
1372
|
}
|
|
1373
1373
|
updateOptions(e) {
|
|
@@ -1381,37 +1381,37 @@ class H extends z {
|
|
|
1381
1381
|
this._blocks = [], this.exposeBlock = void 0, this._stops = [], this._maskedBlocks = {};
|
|
1382
1382
|
const t = this.mask;
|
|
1383
1383
|
if (!t || !e) return;
|
|
1384
|
-
let s = !1,
|
|
1385
|
-
for (let
|
|
1384
|
+
let s = !1, i = !1;
|
|
1385
|
+
for (let a = 0; a < t.length; ++a) {
|
|
1386
1386
|
if (this.blocks) {
|
|
1387
|
-
const o = t.slice(
|
|
1388
|
-
|
|
1389
|
-
const
|
|
1390
|
-
if (
|
|
1387
|
+
const o = t.slice(a), p = Object.keys(this.blocks).filter((A) => o.indexOf(A) === 0);
|
|
1388
|
+
p.sort((A, v) => v.length - A.length);
|
|
1389
|
+
const m = p[0];
|
|
1390
|
+
if (m) {
|
|
1391
1391
|
const {
|
|
1392
|
-
expose:
|
|
1392
|
+
expose: A,
|
|
1393
1393
|
repeat: v,
|
|
1394
|
-
...
|
|
1395
|
-
} =
|
|
1394
|
+
...V
|
|
1395
|
+
} = be(this.blocks[m]), x = {
|
|
1396
1396
|
lazy: this.lazy,
|
|
1397
1397
|
eager: this.eager,
|
|
1398
1398
|
placeholderChar: this.placeholderChar,
|
|
1399
1399
|
displayChar: this.displayChar,
|
|
1400
1400
|
overwrite: this.overwrite,
|
|
1401
1401
|
autofix: this.autofix,
|
|
1402
|
-
...
|
|
1402
|
+
...V,
|
|
1403
1403
|
repeat: v,
|
|
1404
1404
|
parent: this
|
|
1405
|
-
},
|
|
1406
|
-
|
|
1405
|
+
}, M = v != null ? new _.RepeatBlock(
|
|
1406
|
+
x
|
|
1407
1407
|
/* TODO */
|
|
1408
|
-
) :
|
|
1409
|
-
|
|
1408
|
+
) : ae(x);
|
|
1409
|
+
M && (this._blocks.push(M), A && (this.exposeBlock = M), this._maskedBlocks[m] || (this._maskedBlocks[m] = []), this._maskedBlocks[m].push(this._blocks.length - 1)), a += m.length - 1;
|
|
1410
1410
|
continue;
|
|
1411
1411
|
}
|
|
1412
1412
|
}
|
|
1413
|
-
let n = t[
|
|
1414
|
-
if (n ===
|
|
1413
|
+
let n = t[a], u = n in e;
|
|
1414
|
+
if (n === j.STOP_CHAR) {
|
|
1415
1415
|
this._stops.push(this._blocks.length);
|
|
1416
1416
|
continue;
|
|
1417
1417
|
}
|
|
@@ -1420,22 +1420,22 @@ class H extends z {
|
|
|
1420
1420
|
continue;
|
|
1421
1421
|
}
|
|
1422
1422
|
if (n === "[" || n === "]") {
|
|
1423
|
-
|
|
1423
|
+
i = !i;
|
|
1424
1424
|
continue;
|
|
1425
1425
|
}
|
|
1426
|
-
if (n ===
|
|
1427
|
-
if (++
|
|
1426
|
+
if (n === j.ESCAPE_CHAR) {
|
|
1427
|
+
if (++a, n = t[a], !n) break;
|
|
1428
1428
|
u = !1;
|
|
1429
1429
|
}
|
|
1430
|
-
const l = u ? new
|
|
1431
|
-
isOptional:
|
|
1430
|
+
const l = u ? new Re({
|
|
1431
|
+
isOptional: i,
|
|
1432
1432
|
lazy: this.lazy,
|
|
1433
1433
|
eager: this.eager,
|
|
1434
1434
|
placeholderChar: this.placeholderChar,
|
|
1435
1435
|
displayChar: this.displayChar,
|
|
1436
|
-
...
|
|
1436
|
+
...be(e[n]),
|
|
1437
1437
|
parent: this
|
|
1438
|
-
}) : new
|
|
1438
|
+
}) : new it({
|
|
1439
1439
|
char: n,
|
|
1440
1440
|
eager: this.eager,
|
|
1441
1441
|
isUnmasking: s
|
|
@@ -1458,7 +1458,7 @@ class H extends z {
|
|
|
1458
1458
|
_blocks: t,
|
|
1459
1459
|
...s
|
|
1460
1460
|
} = e;
|
|
1461
|
-
this._blocks.forEach((
|
|
1461
|
+
this._blocks.forEach((i, a) => i.state = t[a]), super.state = s;
|
|
1462
1462
|
}
|
|
1463
1463
|
reset() {
|
|
1464
1464
|
super.reset(), this._blocks.forEach((e) => e.reset());
|
|
@@ -1520,47 +1520,47 @@ class H extends z {
|
|
|
1520
1520
|
let s = (e = this._mapPosToBlock(this.displayValue.length)) == null ? void 0 : e.index;
|
|
1521
1521
|
if (s == null) return t;
|
|
1522
1522
|
this._blocks[s].isFilled && ++s;
|
|
1523
|
-
for (let
|
|
1524
|
-
const
|
|
1525
|
-
if (!
|
|
1526
|
-
t.aggregate(
|
|
1523
|
+
for (let i = s; i < this._blocks.length; ++i) {
|
|
1524
|
+
const a = this._blocks[i]._appendEager();
|
|
1525
|
+
if (!a.inserted) break;
|
|
1526
|
+
t.aggregate(a);
|
|
1527
1527
|
}
|
|
1528
1528
|
return t;
|
|
1529
1529
|
}
|
|
1530
1530
|
_appendCharRaw(e, t) {
|
|
1531
1531
|
t === void 0 && (t = {});
|
|
1532
|
-
const s = this._mapPosToBlock(this.displayValue.length),
|
|
1533
|
-
if (!s) return
|
|
1532
|
+
const s = this._mapPosToBlock(this.displayValue.length), i = new F();
|
|
1533
|
+
if (!s) return i;
|
|
1534
1534
|
for (let n = s.index, u; u = this._blocks[n]; ++n) {
|
|
1535
|
-
var
|
|
1535
|
+
var a;
|
|
1536
1536
|
const l = u._appendChar(e, {
|
|
1537
1537
|
...t,
|
|
1538
|
-
_beforeTailState: (
|
|
1538
|
+
_beforeTailState: (a = t._beforeTailState) == null || (a = a._blocks) == null ? void 0 : a[n]
|
|
1539
1539
|
});
|
|
1540
|
-
if (
|
|
1540
|
+
if (i.aggregate(l), l.consumed) break;
|
|
1541
1541
|
}
|
|
1542
|
-
return
|
|
1542
|
+
return i;
|
|
1543
1543
|
}
|
|
1544
1544
|
extractTail(e, t) {
|
|
1545
1545
|
e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length);
|
|
1546
|
-
const s = new
|
|
1547
|
-
return e === t || this._forEachBlocksInRange(e, t, (
|
|
1548
|
-
const l =
|
|
1549
|
-
l.stop = this._findStopBefore(
|
|
1546
|
+
const s = new pe();
|
|
1547
|
+
return e === t || this._forEachBlocksInRange(e, t, (i, a, n, u) => {
|
|
1548
|
+
const l = i.extractTail(n, u);
|
|
1549
|
+
l.stop = this._findStopBefore(a), l.from = this._blockStartPos(a), l instanceof pe && (l.blockIndex = a), s.extend(l);
|
|
1550
1550
|
}), s;
|
|
1551
1551
|
}
|
|
1552
1552
|
extractInput(e, t, s) {
|
|
1553
1553
|
if (e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length), s === void 0 && (s = {}), e === t) return "";
|
|
1554
|
-
let
|
|
1555
|
-
return this._forEachBlocksInRange(e, t, (
|
|
1556
|
-
|
|
1557
|
-
}),
|
|
1554
|
+
let i = "";
|
|
1555
|
+
return this._forEachBlocksInRange(e, t, (a, n, u, l) => {
|
|
1556
|
+
i += a.extractInput(u, l, s);
|
|
1557
|
+
}), i;
|
|
1558
1558
|
}
|
|
1559
1559
|
_findStopBefore(e) {
|
|
1560
1560
|
let t;
|
|
1561
1561
|
for (let s = 0; s < this._stops.length; ++s) {
|
|
1562
|
-
const
|
|
1563
|
-
if (
|
|
1562
|
+
const i = this._stops[s];
|
|
1563
|
+
if (i <= e) t = i;
|
|
1564
1564
|
else break;
|
|
1565
1565
|
}
|
|
1566
1566
|
return t;
|
|
@@ -1571,8 +1571,8 @@ class H extends z {
|
|
|
1571
1571
|
if (this.lazy && e == null) return t;
|
|
1572
1572
|
const s = this._mapPosToBlock(this.displayValue.length);
|
|
1573
1573
|
if (!s) return t;
|
|
1574
|
-
const
|
|
1575
|
-
return this._blocks.slice(
|
|
1574
|
+
const i = s.index, a = e ?? this._blocks.length;
|
|
1575
|
+
return this._blocks.slice(i, a).forEach((n) => {
|
|
1576
1576
|
if (!n.lazy || e != null) {
|
|
1577
1577
|
var u;
|
|
1578
1578
|
t.aggregate(n._appendPlaceholder((u = n._blocks) == null ? void 0 : u.length));
|
|
@@ -1583,11 +1583,11 @@ class H extends z {
|
|
|
1583
1583
|
_mapPosToBlock(e) {
|
|
1584
1584
|
let t = "";
|
|
1585
1585
|
for (let s = 0; s < this._blocks.length; ++s) {
|
|
1586
|
-
const
|
|
1587
|
-
if (t +=
|
|
1586
|
+
const i = this._blocks[s], a = t.length;
|
|
1587
|
+
if (t += i.displayValue, e <= t.length)
|
|
1588
1588
|
return {
|
|
1589
1589
|
index: s,
|
|
1590
|
-
offset: e -
|
|
1590
|
+
offset: e - a
|
|
1591
1591
|
};
|
|
1592
1592
|
}
|
|
1593
1593
|
}
|
|
@@ -1596,46 +1596,46 @@ class H extends z {
|
|
|
1596
1596
|
}
|
|
1597
1597
|
_forEachBlocksInRange(e, t, s) {
|
|
1598
1598
|
t === void 0 && (t = this.displayValue.length);
|
|
1599
|
-
const
|
|
1600
|
-
if (
|
|
1601
|
-
const
|
|
1602
|
-
if (s(this._blocks[
|
|
1603
|
-
for (let o =
|
|
1599
|
+
const i = this._mapPosToBlock(e);
|
|
1600
|
+
if (i) {
|
|
1601
|
+
const a = this._mapPosToBlock(t), n = a && i.index === a.index, u = i.offset, l = a && n ? a.offset : this._blocks[i.index].displayValue.length;
|
|
1602
|
+
if (s(this._blocks[i.index], i.index, u, l), a && !n) {
|
|
1603
|
+
for (let o = i.index + 1; o < a.index; ++o)
|
|
1604
1604
|
s(this._blocks[o], o, 0, this._blocks[o].displayValue.length);
|
|
1605
|
-
s(this._blocks[
|
|
1605
|
+
s(this._blocks[a.index], a.index, 0, a.offset);
|
|
1606
1606
|
}
|
|
1607
1607
|
}
|
|
1608
1608
|
}
|
|
1609
1609
|
remove(e, t) {
|
|
1610
1610
|
e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length);
|
|
1611
1611
|
const s = super.remove(e, t);
|
|
1612
|
-
return this._forEachBlocksInRange(e, t, (
|
|
1613
|
-
s.aggregate(
|
|
1612
|
+
return this._forEachBlocksInRange(e, t, (i, a, n, u) => {
|
|
1613
|
+
s.aggregate(i.remove(n, u));
|
|
1614
1614
|
}), s;
|
|
1615
1615
|
}
|
|
1616
1616
|
nearestInputPos(e, t) {
|
|
1617
|
-
if (t === void 0 && (t =
|
|
1617
|
+
if (t === void 0 && (t = f.NONE), !this._blocks.length) return 0;
|
|
1618
1618
|
const s = new St(this, e);
|
|
1619
|
-
if (t ===
|
|
1619
|
+
if (t === f.NONE)
|
|
1620
1620
|
return s.pushRightBeforeInput() || (s.popState(), s.pushLeftBeforeInput()) ? s.pos : this.displayValue.length;
|
|
1621
|
-
if (t ===
|
|
1622
|
-
if (t ===
|
|
1621
|
+
if (t === f.LEFT || t === f.FORCE_LEFT) {
|
|
1622
|
+
if (t === f.LEFT) {
|
|
1623
1623
|
if (s.pushRightBeforeFilled(), s.ok && s.pos === e) return e;
|
|
1624
1624
|
s.popState();
|
|
1625
1625
|
}
|
|
1626
|
-
if (s.pushLeftBeforeInput(), s.pushLeftBeforeRequired(), s.pushLeftBeforeFilled(), t ===
|
|
1626
|
+
if (s.pushLeftBeforeInput(), s.pushLeftBeforeRequired(), s.pushLeftBeforeFilled(), t === f.LEFT) {
|
|
1627
1627
|
if (s.pushRightBeforeInput(), s.pushRightBeforeRequired(), s.ok && s.pos <= e || (s.popState(), s.ok && s.pos <= e)) return s.pos;
|
|
1628
1628
|
s.popState();
|
|
1629
1629
|
}
|
|
1630
|
-
return s.ok ? s.pos : t ===
|
|
1630
|
+
return s.ok ? s.pos : t === f.FORCE_LEFT ? 0 : (s.popState(), s.ok || (s.popState(), s.ok) ? s.pos : 0);
|
|
1631
1631
|
}
|
|
1632
|
-
return t ===
|
|
1632
|
+
return t === f.RIGHT || t === f.FORCE_RIGHT ? (s.pushRightBeforeInput(), s.pushRightBeforeRequired(), s.pushRightBeforeFilled() ? s.pos : t === f.FORCE_RIGHT ? this.displayValue.length : (s.popState(), s.ok || (s.popState(), s.ok) ? s.pos : this.nearestInputPos(e, f.LEFT))) : e;
|
|
1633
1633
|
}
|
|
1634
1634
|
totalInputPositions(e, t) {
|
|
1635
1635
|
e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length);
|
|
1636
1636
|
let s = 0;
|
|
1637
|
-
return this._forEachBlocksInRange(e, t, (
|
|
1638
|
-
s +=
|
|
1637
|
+
return this._forEachBlocksInRange(e, t, (i, a, n, u) => {
|
|
1638
|
+
s += i.totalInputPositions(n, u);
|
|
1639
1639
|
}), s;
|
|
1640
1640
|
}
|
|
1641
1641
|
/** Get block by name */
|
|
@@ -1652,17 +1652,17 @@ class H extends z {
|
|
|
1652
1652
|
return this._forEachBlocksInRange(0, this.displayValue.length, (s) => t.aggregate(s.pad(e))), t;
|
|
1653
1653
|
}
|
|
1654
1654
|
}
|
|
1655
|
-
|
|
1655
|
+
j.DEFAULTS = {
|
|
1656
1656
|
...z.DEFAULTS,
|
|
1657
1657
|
lazy: !0,
|
|
1658
1658
|
placeholderChar: "_"
|
|
1659
1659
|
};
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
class
|
|
1660
|
+
j.STOP_CHAR = "`";
|
|
1661
|
+
j.ESCAPE_CHAR = "\\";
|
|
1662
|
+
j.InputDefinition = Re;
|
|
1663
|
+
j.FixedDefinition = it;
|
|
1664
|
+
_.MaskedPattern = j;
|
|
1665
|
+
class Me extends j {
|
|
1666
1666
|
/**
|
|
1667
1667
|
Optionally sets max length of pattern.
|
|
1668
1668
|
Used when pattern length is longer then `to` param length. Pads zeros at start in this case.
|
|
@@ -1682,11 +1682,11 @@ class Ve extends H {
|
|
|
1682
1682
|
const {
|
|
1683
1683
|
to: t = this.to || 0,
|
|
1684
1684
|
from: s = this.from || 0,
|
|
1685
|
-
maxLength:
|
|
1686
|
-
autofix:
|
|
1685
|
+
maxLength: i = this.maxLength || 0,
|
|
1686
|
+
autofix: a = this.autofix,
|
|
1687
1687
|
...n
|
|
1688
1688
|
} = e;
|
|
1689
|
-
this.to = t, this.from = s, this.maxLength = Math.max(String(t).length,
|
|
1689
|
+
this.to = t, this.from = s, this.maxLength = Math.max(String(t).length, i), this.autofix = a;
|
|
1690
1690
|
const u = String(this.from).padStart(this.maxLength, "0"), l = String(this.to).padStart(this.maxLength, "0");
|
|
1691
1691
|
let o = 0;
|
|
1692
1692
|
for (; o < l.length && l[o] === u[o]; ) ++o;
|
|
@@ -1697,8 +1697,8 @@ class Ve extends H {
|
|
|
1697
1697
|
}
|
|
1698
1698
|
boundaries(e) {
|
|
1699
1699
|
let t = "", s = "";
|
|
1700
|
-
const [,
|
|
1701
|
-
return
|
|
1700
|
+
const [, i, a] = e.match(/^(\D*)(\d*)(\D*)/) || [];
|
|
1701
|
+
return a && (t = "0".repeat(i.length) + a, s = "9".repeat(i.length) + a), t = t.padEnd(this.maxLength, "0"), s = s.padEnd(this.maxLength, "9"), [t, s];
|
|
1702
1702
|
}
|
|
1703
1703
|
doPrepareChar(e, t) {
|
|
1704
1704
|
t === void 0 && (t = {});
|
|
@@ -1707,40 +1707,40 @@ class Ve extends H {
|
|
|
1707
1707
|
}
|
|
1708
1708
|
_appendCharRaw(e, t) {
|
|
1709
1709
|
if (t === void 0 && (t = {}), !this.autofix || this.value.length + 1 > this.maxLength) return super._appendCharRaw(e, t);
|
|
1710
|
-
const s = String(this.from).padStart(this.maxLength, "0"),
|
|
1711
|
-
return Number(n) < this.from ? super._appendCharRaw(s[this.value.length], t) : Number(
|
|
1710
|
+
const s = String(this.from).padStart(this.maxLength, "0"), i = String(this.to).padStart(this.maxLength, "0"), [a, n] = this.boundaries(this.value + e);
|
|
1711
|
+
return Number(n) < this.from ? super._appendCharRaw(s[this.value.length], t) : Number(a) > this.to ? !t.tail && this.autofix === "pad" && this.value.length + 1 < this.maxLength ? super._appendCharRaw(s[this.value.length], t).aggregate(this._appendCharRaw(e, t)) : super._appendCharRaw(i[this.value.length], t) : super._appendCharRaw(e, t);
|
|
1712
1712
|
}
|
|
1713
1713
|
doValidate(e) {
|
|
1714
1714
|
const t = this.value;
|
|
1715
1715
|
if (t.search(/[^0]/) === -1 && t.length <= this._matchFrom) return !0;
|
|
1716
|
-
const [s,
|
|
1717
|
-
return this.from <= Number(
|
|
1716
|
+
const [s, i] = this.boundaries(t);
|
|
1717
|
+
return this.from <= Number(i) && Number(s) <= this.to && super.doValidate(e);
|
|
1718
1718
|
}
|
|
1719
1719
|
pad(e) {
|
|
1720
1720
|
const t = new F();
|
|
1721
1721
|
if (this.value.length === this.maxLength) return t;
|
|
1722
|
-
const s = this.value,
|
|
1723
|
-
if (
|
|
1722
|
+
const s = this.value, i = this.maxLength - this.value.length;
|
|
1723
|
+
if (i) {
|
|
1724
1724
|
this.reset();
|
|
1725
|
-
for (let
|
|
1725
|
+
for (let a = 0; a < i; ++a)
|
|
1726
1726
|
t.aggregate(super._appendCharRaw("0", e));
|
|
1727
|
-
s.split("").forEach((
|
|
1727
|
+
s.split("").forEach((a) => this._appendCharRaw(a));
|
|
1728
1728
|
}
|
|
1729
1729
|
return t;
|
|
1730
1730
|
}
|
|
1731
1731
|
}
|
|
1732
|
-
|
|
1733
|
-
const
|
|
1734
|
-
class
|
|
1732
|
+
_.MaskedRange = Me;
|
|
1733
|
+
const Vt = "d{.}`m{.}`Y";
|
|
1734
|
+
class te extends j {
|
|
1735
1735
|
static extractPatternOptions(e) {
|
|
1736
1736
|
const {
|
|
1737
1737
|
mask: t,
|
|
1738
1738
|
pattern: s,
|
|
1739
|
-
...
|
|
1739
|
+
...i
|
|
1740
1740
|
} = e;
|
|
1741
1741
|
return {
|
|
1742
|
-
...
|
|
1743
|
-
mask:
|
|
1742
|
+
...i,
|
|
1743
|
+
mask: le(t) ? t : s
|
|
1744
1744
|
};
|
|
1745
1745
|
}
|
|
1746
1746
|
/** Pattern mask for date according to {@link MaskedDate#format} */
|
|
@@ -1749,8 +1749,8 @@ class se extends H {
|
|
|
1749
1749
|
/** Format typed value to string */
|
|
1750
1750
|
/** Parse string to get typed value */
|
|
1751
1751
|
constructor(e) {
|
|
1752
|
-
super(
|
|
1753
|
-
...
|
|
1752
|
+
super(te.extractPatternOptions({
|
|
1753
|
+
...te.DEFAULTS,
|
|
1754
1754
|
...e
|
|
1755
1755
|
}));
|
|
1756
1756
|
}
|
|
@@ -1761,15 +1761,15 @@ class se extends H {
|
|
|
1761
1761
|
const {
|
|
1762
1762
|
mask: t,
|
|
1763
1763
|
pattern: s,
|
|
1764
|
-
blocks:
|
|
1765
|
-
...
|
|
1764
|
+
blocks: i,
|
|
1765
|
+
...a
|
|
1766
1766
|
} = {
|
|
1767
|
-
...
|
|
1767
|
+
...te.DEFAULTS,
|
|
1768
1768
|
...e
|
|
1769
|
-
}, n = Object.assign({},
|
|
1770
|
-
e.min && (n.Y.from = e.min.getFullYear()), e.max && (n.Y.to = e.max.getFullYear()), e.min && e.max && n.Y.from === n.Y.to && (n.m.from = e.min.getMonth() + 1, n.m.to = e.max.getMonth() + 1, n.m.from === n.m.to && (n.d.from = e.min.getDate(), n.d.to = e.max.getDate())), Object.assign(n, this.blocks,
|
|
1771
|
-
...
|
|
1772
|
-
mask:
|
|
1769
|
+
}, n = Object.assign({}, te.GET_DEFAULT_BLOCKS());
|
|
1770
|
+
e.min && (n.Y.from = e.min.getFullYear()), e.max && (n.Y.to = e.max.getFullYear()), e.min && e.max && n.Y.from === n.Y.to && (n.m.from = e.min.getMonth() + 1, n.m.to = e.max.getMonth() + 1, n.m.from === n.m.to && (n.d.from = e.min.getDate(), n.d.to = e.max.getDate())), Object.assign(n, this.blocks, i), super._update({
|
|
1771
|
+
...a,
|
|
1772
|
+
mask: le(t) ? t : s,
|
|
1773
1773
|
blocks: n
|
|
1774
1774
|
});
|
|
1775
1775
|
}
|
|
@@ -1798,43 +1798,43 @@ class se extends H {
|
|
|
1798
1798
|
return e === Date || super.maskEquals(e);
|
|
1799
1799
|
}
|
|
1800
1800
|
optionsIsChanged(e) {
|
|
1801
|
-
return super.optionsIsChanged(
|
|
1801
|
+
return super.optionsIsChanged(te.extractPatternOptions(e));
|
|
1802
1802
|
}
|
|
1803
1803
|
}
|
|
1804
|
-
|
|
1804
|
+
te.GET_DEFAULT_BLOCKS = () => ({
|
|
1805
1805
|
d: {
|
|
1806
|
-
mask:
|
|
1806
|
+
mask: Me,
|
|
1807
1807
|
from: 1,
|
|
1808
1808
|
to: 31,
|
|
1809
1809
|
maxLength: 2
|
|
1810
1810
|
},
|
|
1811
1811
|
m: {
|
|
1812
|
-
mask:
|
|
1812
|
+
mask: Me,
|
|
1813
1813
|
from: 1,
|
|
1814
1814
|
to: 12,
|
|
1815
1815
|
maxLength: 2
|
|
1816
1816
|
},
|
|
1817
1817
|
Y: {
|
|
1818
|
-
mask:
|
|
1818
|
+
mask: Me,
|
|
1819
1819
|
from: 1900,
|
|
1820
1820
|
to: 9999
|
|
1821
1821
|
}
|
|
1822
1822
|
});
|
|
1823
|
-
|
|
1824
|
-
...
|
|
1823
|
+
te.DEFAULTS = {
|
|
1824
|
+
...j.DEFAULTS,
|
|
1825
1825
|
mask: Date,
|
|
1826
|
-
pattern:
|
|
1826
|
+
pattern: Vt,
|
|
1827
1827
|
format: (r, e) => {
|
|
1828
1828
|
if (!r) return "";
|
|
1829
|
-
const t = String(r.getDate()).padStart(2, "0"), s = String(r.getMonth() + 1).padStart(2, "0"),
|
|
1830
|
-
return [t, s,
|
|
1829
|
+
const t = String(r.getDate()).padStart(2, "0"), s = String(r.getMonth() + 1).padStart(2, "0"), i = r.getFullYear();
|
|
1830
|
+
return [t, s, i].join(".");
|
|
1831
1831
|
},
|
|
1832
1832
|
parse: (r, e) => {
|
|
1833
|
-
const [t, s,
|
|
1834
|
-
return new Date(
|
|
1833
|
+
const [t, s, i] = r.split(".").map(Number);
|
|
1834
|
+
return new Date(i, s - 1, t);
|
|
1835
1835
|
}
|
|
1836
1836
|
};
|
|
1837
|
-
|
|
1837
|
+
_.MaskedDate = te;
|
|
1838
1838
|
class Le extends z {
|
|
1839
1839
|
constructor(e) {
|
|
1840
1840
|
super({
|
|
@@ -1849,14 +1849,14 @@ class Le extends z {
|
|
|
1849
1849
|
super._update(e), "mask" in e && (this.exposeMask = void 0, this.compiledMasks = Array.isArray(e.mask) ? e.mask.map((t) => {
|
|
1850
1850
|
const {
|
|
1851
1851
|
expose: s,
|
|
1852
|
-
...
|
|
1853
|
-
} =
|
|
1852
|
+
...i
|
|
1853
|
+
} = be(t), a = ae({
|
|
1854
1854
|
overwrite: this._overwrite,
|
|
1855
1855
|
eager: this._eager,
|
|
1856
1856
|
skipInvalid: this._skipInvalid,
|
|
1857
|
-
...
|
|
1857
|
+
...i
|
|
1858
1858
|
});
|
|
1859
|
-
return s && (this.exposeMask =
|
|
1859
|
+
return s && (this.exposeMask = a), a;
|
|
1860
1860
|
}) : []);
|
|
1861
1861
|
}
|
|
1862
1862
|
_appendCharRaw(e, t) {
|
|
@@ -1866,15 +1866,15 @@ class Le extends z {
|
|
|
1866
1866
|
}
|
|
1867
1867
|
_applyDispatch(e, t, s) {
|
|
1868
1868
|
e === void 0 && (e = ""), t === void 0 && (t = {}), s === void 0 && (s = "");
|
|
1869
|
-
const
|
|
1869
|
+
const i = t.tail && t._beforeTailState != null ? t._beforeTailState._value : this.value, a = this.rawInputValue, n = t.tail && t._beforeTailState != null ? t._beforeTailState._rawInputValue : a, u = a.slice(n.length), l = this.currentMask, o = new F(), p = l?.state;
|
|
1870
1870
|
return this.currentMask = this.doDispatch(e, {
|
|
1871
1871
|
...t
|
|
1872
1872
|
}, s), this.currentMask && (this.currentMask !== l ? (this.currentMask.reset(), n && (this.currentMask.append(n, {
|
|
1873
1873
|
raw: !0
|
|
1874
|
-
}), o.tailShift = this.currentMask.value.length -
|
|
1874
|
+
}), o.tailShift = this.currentMask.value.length - i.length), u && (o.tailShift += this.currentMask.append(u, {
|
|
1875
1875
|
raw: !0,
|
|
1876
1876
|
tail: !0
|
|
1877
|
-
}).tailShift)) :
|
|
1877
|
+
}).tailShift)) : p && (this.currentMask.state = p)), o;
|
|
1878
1878
|
}
|
|
1879
1879
|
_appendPlaceholder() {
|
|
1880
1880
|
const e = this._applyDispatch();
|
|
@@ -1903,21 +1903,21 @@ class Le extends z {
|
|
|
1903
1903
|
}
|
|
1904
1904
|
doPrepare(e, t) {
|
|
1905
1905
|
t === void 0 && (t = {});
|
|
1906
|
-
let [s,
|
|
1906
|
+
let [s, i] = super.doPrepare(e, t);
|
|
1907
1907
|
if (this.currentMask) {
|
|
1908
|
-
let
|
|
1909
|
-
[s,
|
|
1908
|
+
let a;
|
|
1909
|
+
[s, a] = super.doPrepare(s, this.currentMaskFlags(t)), i = i.aggregate(a);
|
|
1910
1910
|
}
|
|
1911
|
-
return [s,
|
|
1911
|
+
return [s, i];
|
|
1912
1912
|
}
|
|
1913
1913
|
doPrepareChar(e, t) {
|
|
1914
1914
|
t === void 0 && (t = {});
|
|
1915
|
-
let [s,
|
|
1915
|
+
let [s, i] = super.doPrepareChar(e, t);
|
|
1916
1916
|
if (this.currentMask) {
|
|
1917
|
-
let
|
|
1918
|
-
[s,
|
|
1917
|
+
let a;
|
|
1918
|
+
[s, a] = super.doPrepareChar(s, this.currentMaskFlags(t)), i = i.aggregate(a);
|
|
1919
1919
|
}
|
|
1920
|
-
return [s,
|
|
1920
|
+
return [s, i];
|
|
1921
1921
|
}
|
|
1922
1922
|
reset() {
|
|
1923
1923
|
var e;
|
|
@@ -1975,10 +1975,10 @@ class Le extends z {
|
|
|
1975
1975
|
const {
|
|
1976
1976
|
compiledMasks: t,
|
|
1977
1977
|
currentMaskRef: s,
|
|
1978
|
-
currentMask:
|
|
1979
|
-
...
|
|
1978
|
+
currentMask: i,
|
|
1979
|
+
...a
|
|
1980
1980
|
} = e;
|
|
1981
|
-
t && this.compiledMasks.forEach((n, u) => n.state = t[u]), s != null && (this.currentMask = s, this.currentMask.state =
|
|
1981
|
+
t && this.compiledMasks.forEach((n, u) => n.state = t[u]), s != null && (this.currentMask = s, this.currentMask.state = i), super.state = a;
|
|
1982
1982
|
}
|
|
1983
1983
|
extractInput(e, t, s) {
|
|
1984
1984
|
return this.currentMask ? this.currentMask.extractInput(e, t, s) : "";
|
|
@@ -2020,10 +2020,10 @@ class Le extends z {
|
|
|
2020
2020
|
return Array.isArray(e) ? this.compiledMasks.every((t, s) => {
|
|
2021
2021
|
if (!e[s]) return;
|
|
2022
2022
|
const {
|
|
2023
|
-
mask:
|
|
2024
|
-
...
|
|
2023
|
+
mask: i,
|
|
2024
|
+
...a
|
|
2025
2025
|
} = e[s];
|
|
2026
|
-
return Te(t,
|
|
2026
|
+
return Te(t, a) && t.maskEquals(i);
|
|
2027
2027
|
}) : super.maskEquals(e);
|
|
2028
2028
|
}
|
|
2029
2029
|
typedValueEquals(e) {
|
|
@@ -2035,21 +2035,21 @@ Le.DEFAULTS = {
|
|
|
2035
2035
|
...z.DEFAULTS,
|
|
2036
2036
|
dispatch: (r, e, t, s) => {
|
|
2037
2037
|
if (!e.compiledMasks.length) return;
|
|
2038
|
-
const
|
|
2039
|
-
const l = e.currentMask === n, o = l ? n.displayValue.length : n.nearestInputPos(n.displayValue.length,
|
|
2040
|
-
return n.rawInputValue !==
|
|
2038
|
+
const i = e.rawInputValue, a = e.compiledMasks.map((n, u) => {
|
|
2039
|
+
const l = e.currentMask === n, o = l ? n.displayValue.length : n.nearestInputPos(n.displayValue.length, f.FORCE_LEFT);
|
|
2040
|
+
return n.rawInputValue !== i ? (n.reset(), n.append(i, {
|
|
2041
2041
|
raw: !0
|
|
2042
2042
|
})) : l || n.remove(o), n.append(r, e.currentMaskFlags(t)), n.appendTail(s), {
|
|
2043
2043
|
index: u,
|
|
2044
2044
|
weight: n.rawInputValue.length,
|
|
2045
|
-
totalInputPositions: n.totalInputPositions(0, Math.max(o, n.nearestInputPos(n.displayValue.length,
|
|
2045
|
+
totalInputPositions: n.totalInputPositions(0, Math.max(o, n.nearestInputPos(n.displayValue.length, f.FORCE_LEFT)))
|
|
2046
2046
|
};
|
|
2047
2047
|
});
|
|
2048
|
-
return
|
|
2048
|
+
return a.sort((n, u) => u.weight - n.weight || u.totalInputPositions - n.totalInputPositions), e.compiledMasks[a[0].index];
|
|
2049
2049
|
}
|
|
2050
2050
|
};
|
|
2051
|
-
|
|
2052
|
-
class $e extends
|
|
2051
|
+
_.MaskedDynamic = Le;
|
|
2052
|
+
class $e extends j {
|
|
2053
2053
|
constructor(e) {
|
|
2054
2054
|
super({
|
|
2055
2055
|
...$e.DEFAULTS,
|
|
@@ -2065,21 +2065,21 @@ class $e extends H {
|
|
|
2065
2065
|
...s
|
|
2066
2066
|
} = e;
|
|
2067
2067
|
if (t) {
|
|
2068
|
-
const
|
|
2069
|
-
s.mask = "*".repeat(
|
|
2068
|
+
const i = t.map((u) => u.length), a = Math.min(...i), n = Math.max(...i) - a;
|
|
2069
|
+
s.mask = "*".repeat(a), n && (s.mask += "[" + "*".repeat(n) + "]"), this.enum = t;
|
|
2070
2070
|
}
|
|
2071
2071
|
super._update(s);
|
|
2072
2072
|
}
|
|
2073
2073
|
_appendCharRaw(e, t) {
|
|
2074
2074
|
t === void 0 && (t = {});
|
|
2075
|
-
const s = Math.min(this.nearestInputPos(0,
|
|
2076
|
-
if (
|
|
2077
|
-
|
|
2078
|
-
const l =
|
|
2075
|
+
const s = Math.min(this.nearestInputPos(0, f.FORCE_RIGHT), this.value.length), i = this.enum.filter((a) => this.matchValue(a, this.unmaskedValue + e, s));
|
|
2076
|
+
if (i.length) {
|
|
2077
|
+
i.length === 1 && this._forEachBlocksInRange(0, this.value.length, (n, u) => {
|
|
2078
|
+
const l = i[0][u];
|
|
2079
2079
|
u >= this.value.length || l === n.value || (n.reset(), n._appendChar(l, t));
|
|
2080
2080
|
});
|
|
2081
|
-
const
|
|
2082
|
-
return
|
|
2081
|
+
const a = super._appendCharRaw(i[0][this.value.length], t);
|
|
2082
|
+
return i.length === 1 && i[0].slice(this.unmaskedValue.length).split("").forEach((n) => a.aggregate(super._appendCharRaw(n))), a;
|
|
2083
2083
|
}
|
|
2084
2084
|
return new F({
|
|
2085
2085
|
skip: !this.isComplete
|
|
@@ -2090,23 +2090,23 @@ class $e extends H {
|
|
|
2090
2090
|
}
|
|
2091
2091
|
remove(e, t) {
|
|
2092
2092
|
if (e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length), e === t) return new F();
|
|
2093
|
-
const s = Math.min(super.nearestInputPos(0,
|
|
2094
|
-
let
|
|
2095
|
-
for (
|
|
2093
|
+
const s = Math.min(super.nearestInputPos(0, f.FORCE_RIGHT), this.value.length);
|
|
2094
|
+
let i;
|
|
2095
|
+
for (i = e; i >= 0 && !(this.enum.filter((n) => this.matchValue(n, this.value.slice(s, i), s)).length > 1); --i)
|
|
2096
2096
|
;
|
|
2097
|
-
const
|
|
2098
|
-
return
|
|
2097
|
+
const a = super.remove(i, t);
|
|
2098
|
+
return a.tailShift += i - e, a;
|
|
2099
2099
|
}
|
|
2100
2100
|
get isComplete() {
|
|
2101
2101
|
return this.enum.indexOf(this.value) >= 0;
|
|
2102
2102
|
}
|
|
2103
2103
|
}
|
|
2104
2104
|
$e.DEFAULTS = {
|
|
2105
|
-
...
|
|
2105
|
+
...j.DEFAULTS,
|
|
2106
2106
|
matchValue: (r, e, t) => r.indexOf(e, t) === t
|
|
2107
2107
|
};
|
|
2108
|
-
|
|
2109
|
-
class
|
|
2108
|
+
_.MaskedEnum = $e;
|
|
2109
|
+
class Bt extends z {
|
|
2110
2110
|
/** */
|
|
2111
2111
|
/** Enable characters overwriting */
|
|
2112
2112
|
/** */
|
|
@@ -2122,9 +2122,9 @@ class Vt extends z {
|
|
|
2122
2122
|
});
|
|
2123
2123
|
}
|
|
2124
2124
|
}
|
|
2125
|
-
|
|
2125
|
+
_.MaskedFunction = Bt;
|
|
2126
2126
|
var at;
|
|
2127
|
-
class
|
|
2127
|
+
class G extends z {
|
|
2128
2128
|
/** Single char */
|
|
2129
2129
|
/** Single char */
|
|
2130
2130
|
/** Array of single chars */
|
|
@@ -2141,7 +2141,7 @@ class K extends z {
|
|
|
2141
2141
|
/** Parse string to get typed value */
|
|
2142
2142
|
constructor(e) {
|
|
2143
2143
|
super({
|
|
2144
|
-
...
|
|
2144
|
+
...G.DEFAULTS,
|
|
2145
2145
|
...e
|
|
2146
2146
|
});
|
|
2147
2147
|
}
|
|
@@ -2164,7 +2164,7 @@ class K extends z {
|
|
|
2164
2164
|
}
|
|
2165
2165
|
doPrepareChar(e, t) {
|
|
2166
2166
|
t === void 0 && (t = {});
|
|
2167
|
-
const [s,
|
|
2167
|
+
const [s, i] = super.doPrepareChar(this._removeThousandsSeparators(this.scale && this.mapToRadix.length && /*
|
|
2168
2168
|
radix should be mapped when
|
|
2169
2169
|
1) input is done from keyboard = flags.input && flags.raw
|
|
2170
2170
|
2) unmasked value is set = !flags.input && !flags.raw
|
|
@@ -2173,13 +2173,13 @@ class K extends z {
|
|
|
2173
2173
|
2) raw value is set = !flags.input && flags.raw
|
|
2174
2174
|
*/
|
|
2175
2175
|
(t.input && t.raw || !t.input && !t.raw) ? e.replace(this._mapToRadixRegExp, this.radix) : e), t);
|
|
2176
|
-
return e && !s && (
|
|
2176
|
+
return e && !s && (i.skip = !0), s && !this.allowPositive && !this.value && s !== "-" && i.aggregate(this._appendChar("-")), [s, i];
|
|
2177
2177
|
}
|
|
2178
2178
|
_separatorsCount(e, t) {
|
|
2179
2179
|
t === void 0 && (t = !1);
|
|
2180
2180
|
let s = 0;
|
|
2181
|
-
for (let
|
|
2182
|
-
this._value.indexOf(this.thousandsSeparator,
|
|
2181
|
+
for (let i = 0; i < e; ++i)
|
|
2182
|
+
this._value.indexOf(this.thousandsSeparator, i) === i && (++s, t && (e += this.thousandsSeparator.length));
|
|
2183
2183
|
return s;
|
|
2184
2184
|
}
|
|
2185
2185
|
_separatorsCountFromSlice(e) {
|
|
@@ -2190,24 +2190,24 @@ class K extends z {
|
|
|
2190
2190
|
}
|
|
2191
2191
|
_appendCharRaw(e, t) {
|
|
2192
2192
|
t === void 0 && (t = {});
|
|
2193
|
-
const s = t.tail && t._beforeTailState ? t._beforeTailState._value : this._value,
|
|
2193
|
+
const s = t.tail && t._beforeTailState ? t._beforeTailState._value : this._value, i = this._separatorsCountFromSlice(s);
|
|
2194
2194
|
this._value = this._removeThousandsSeparators(this.value);
|
|
2195
|
-
const
|
|
2195
|
+
const a = this._value;
|
|
2196
2196
|
this._value += e;
|
|
2197
2197
|
const n = this.number;
|
|
2198
2198
|
let u = !isNaN(n), l = !1;
|
|
2199
2199
|
if (u) {
|
|
2200
|
-
let
|
|
2201
|
-
this.min != null && this.min < 0 && this.number < this.min && (
|
|
2200
|
+
let A;
|
|
2201
|
+
this.min != null && this.min < 0 && this.number < this.min && (A = this.min), this.max != null && this.max > 0 && this.number > this.max && (A = this.max), A != null && (this.autofix ? (this._value = this.format(A, this).replace(G.UNMASKED_RADIX, this.radix), l || (l = a === this._value && !t.tail)) : u = !1), u && (u = !!this._value.match(this._numberRegExp));
|
|
2202
2202
|
}
|
|
2203
2203
|
let o;
|
|
2204
2204
|
u ? o = new F({
|
|
2205
|
-
inserted: this._value.slice(
|
|
2205
|
+
inserted: this._value.slice(a.length),
|
|
2206
2206
|
rawInserted: l ? "" : e,
|
|
2207
2207
|
skip: l
|
|
2208
|
-
}) : (this._value =
|
|
2209
|
-
const
|
|
2210
|
-
return o.tailShift += (
|
|
2208
|
+
}) : (this._value = a, o = new F()), this._value = this._insertThousandsSeparators(this._value);
|
|
2209
|
+
const p = t.tail && t._beforeTailState ? t._beforeTailState._value : this._value, m = this._separatorsCountFromSlice(p);
|
|
2210
|
+
return o.tailShift += (m - i) * this.thousandsSeparator.length, o;
|
|
2211
2211
|
}
|
|
2212
2212
|
_findSeparatorAround(e) {
|
|
2213
2213
|
if (this.thousandsSeparator) {
|
|
@@ -2219,34 +2219,34 @@ class K extends z {
|
|
|
2219
2219
|
_adjustRangeWithSeparators(e, t) {
|
|
2220
2220
|
const s = this._findSeparatorAround(e);
|
|
2221
2221
|
s >= 0 && (e = s);
|
|
2222
|
-
const
|
|
2223
|
-
return
|
|
2222
|
+
const i = this._findSeparatorAround(t);
|
|
2223
|
+
return i >= 0 && (t = i + this.thousandsSeparator.length), [e, t];
|
|
2224
2224
|
}
|
|
2225
2225
|
remove(e, t) {
|
|
2226
2226
|
e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length), [e, t] = this._adjustRangeWithSeparators(e, t);
|
|
2227
|
-
const s = this.value.slice(0, e),
|
|
2228
|
-
this._value = this._insertThousandsSeparators(this._removeThousandsSeparators(s +
|
|
2227
|
+
const s = this.value.slice(0, e), i = this.value.slice(t), a = this._separatorsCount(s.length);
|
|
2228
|
+
this._value = this._insertThousandsSeparators(this._removeThousandsSeparators(s + i));
|
|
2229
2229
|
const n = this._separatorsCountFromSlice(s);
|
|
2230
2230
|
return new F({
|
|
2231
|
-
tailShift: (n -
|
|
2231
|
+
tailShift: (n - a) * this.thousandsSeparator.length
|
|
2232
2232
|
});
|
|
2233
2233
|
}
|
|
2234
2234
|
nearestInputPos(e, t) {
|
|
2235
2235
|
if (!this.thousandsSeparator) return e;
|
|
2236
2236
|
switch (t) {
|
|
2237
|
-
case
|
|
2238
|
-
case
|
|
2239
|
-
case
|
|
2237
|
+
case f.NONE:
|
|
2238
|
+
case f.LEFT:
|
|
2239
|
+
case f.FORCE_LEFT: {
|
|
2240
2240
|
const s = this._findSeparatorAround(e - 1);
|
|
2241
2241
|
if (s >= 0) {
|
|
2242
|
-
const
|
|
2243
|
-
if (e <
|
|
2242
|
+
const i = s + this.thousandsSeparator.length;
|
|
2243
|
+
if (e < i || this.value.length <= i || t === f.FORCE_LEFT)
|
|
2244
2244
|
return s;
|
|
2245
2245
|
}
|
|
2246
2246
|
break;
|
|
2247
2247
|
}
|
|
2248
|
-
case
|
|
2249
|
-
case
|
|
2248
|
+
case f.RIGHT:
|
|
2249
|
+
case f.FORCE_RIGHT: {
|
|
2250
2250
|
const s = this._findSeparatorAround(e);
|
|
2251
2251
|
if (s >= 0)
|
|
2252
2252
|
return s + this.thousandsSeparator.length;
|
|
@@ -2266,7 +2266,7 @@ class K extends z {
|
|
|
2266
2266
|
}
|
|
2267
2267
|
_normalizeZeros(e) {
|
|
2268
2268
|
const t = this._removeThousandsSeparators(e).split(this.radix);
|
|
2269
|
-
return t[0] = t[0].replace(/^(\D*)(0*)(\d*)/, (s,
|
|
2269
|
+
return t[0] = t[0].replace(/^(\D*)(0*)(\d*)/, (s, i, a, n) => i + n), e.length && !/\d$/.test(t[0]) && (t[0] = t[0] + "0"), t.length > 1 && (t[1] = t[1].replace(/0*$/, ""), t[1].length || (t.length = 1)), this._insertThousandsSeparators(t.join(this.radix));
|
|
2270
2270
|
}
|
|
2271
2271
|
_padFractionalZeros(e) {
|
|
2272
2272
|
if (!e) return e;
|
|
@@ -2275,11 +2275,11 @@ class K extends z {
|
|
|
2275
2275
|
}
|
|
2276
2276
|
doSkipInvalid(e, t, s) {
|
|
2277
2277
|
t === void 0 && (t = {});
|
|
2278
|
-
const
|
|
2279
|
-
return super.doSkipInvalid(e, t, s) && !
|
|
2278
|
+
const i = this.scale === 0 && e !== this.thousandsSeparator && (e === this.radix || e === G.UNMASKED_RADIX || this.mapToRadix.includes(e));
|
|
2279
|
+
return super.doSkipInvalid(e, t, s) && !i;
|
|
2280
2280
|
}
|
|
2281
2281
|
get unmaskedValue() {
|
|
2282
|
-
return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,
|
|
2282
|
+
return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix, G.UNMASKED_RADIX);
|
|
2283
2283
|
}
|
|
2284
2284
|
set unmaskedValue(e) {
|
|
2285
2285
|
super.unmaskedValue = e;
|
|
@@ -2288,7 +2288,7 @@ class K extends z {
|
|
|
2288
2288
|
return this.parse(this.unmaskedValue, this);
|
|
2289
2289
|
}
|
|
2290
2290
|
set typedValue(e) {
|
|
2291
|
-
this.rawInputValue = this.format(e, this).replace(
|
|
2291
|
+
this.rawInputValue = this.format(e, this).replace(G.UNMASKED_RADIX, this.radix);
|
|
2292
2292
|
}
|
|
2293
2293
|
/** Parsed Number */
|
|
2294
2294
|
get number() {
|
|
@@ -2304,13 +2304,13 @@ class K extends z {
|
|
|
2304
2304
|
return this.min != null && this.min > 0 || this.max != null && this.max > 0;
|
|
2305
2305
|
}
|
|
2306
2306
|
typedValueEquals(e) {
|
|
2307
|
-
return (super.typedValueEquals(e) ||
|
|
2307
|
+
return (super.typedValueEquals(e) || G.EMPTY_VALUES.includes(e) && G.EMPTY_VALUES.includes(this.typedValue)) && !(e === 0 && this.value === "");
|
|
2308
2308
|
}
|
|
2309
2309
|
}
|
|
2310
|
-
at =
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2310
|
+
at = G;
|
|
2311
|
+
G.UNMASKED_RADIX = ".";
|
|
2312
|
+
G.EMPTY_VALUES = [...z.EMPTY_VALUES, 0];
|
|
2313
|
+
G.DEFAULTS = {
|
|
2314
2314
|
...z.DEFAULTS,
|
|
2315
2315
|
mask: Number,
|
|
2316
2316
|
radix: ",",
|
|
@@ -2327,24 +2327,24 @@ K.DEFAULTS = {
|
|
|
2327
2327
|
maximumFractionDigits: 20
|
|
2328
2328
|
})
|
|
2329
2329
|
};
|
|
2330
|
-
|
|
2331
|
-
const
|
|
2330
|
+
_.MaskedNumber = G;
|
|
2331
|
+
const He = {
|
|
2332
2332
|
MASKED: "value",
|
|
2333
2333
|
UNMASKED: "unmaskedValue",
|
|
2334
2334
|
TYPED: "typedValue"
|
|
2335
2335
|
};
|
|
2336
|
-
function
|
|
2337
|
-
e === void 0 && (e =
|
|
2338
|
-
const s =
|
|
2339
|
-
return (
|
|
2336
|
+
function nt(r, e, t) {
|
|
2337
|
+
e === void 0 && (e = He.MASKED), t === void 0 && (t = He.MASKED);
|
|
2338
|
+
const s = ae(r);
|
|
2339
|
+
return (i) => s.runIsolated((a) => (a[e] = i, a[t]));
|
|
2340
2340
|
}
|
|
2341
2341
|
function wt(r, e, t, s) {
|
|
2342
|
-
return
|
|
2342
|
+
return nt(e, t, s)(r);
|
|
2343
2343
|
}
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
class It extends
|
|
2344
|
+
_.PIPE_TYPE = He;
|
|
2345
|
+
_.createPipe = nt;
|
|
2346
|
+
_.pipe = wt;
|
|
2347
|
+
class It extends j {
|
|
2348
2348
|
get repeatFrom() {
|
|
2349
2349
|
var e;
|
|
2350
2350
|
return (e = Array.isArray(this.repeat) ? this.repeat[0] : this.repeat === 1 / 0 ? 0 : this.repeat) != null ? e : 0;
|
|
@@ -2360,15 +2360,15 @@ class It extends H {
|
|
|
2360
2360
|
super.updateOptions(e);
|
|
2361
2361
|
}
|
|
2362
2362
|
_update(e) {
|
|
2363
|
-
var t, s,
|
|
2363
|
+
var t, s, i;
|
|
2364
2364
|
const {
|
|
2365
|
-
repeat:
|
|
2365
|
+
repeat: a,
|
|
2366
2366
|
...n
|
|
2367
|
-
} =
|
|
2367
|
+
} = be(e);
|
|
2368
2368
|
this._blockOpts = Object.assign({}, this._blockOpts, n);
|
|
2369
|
-
const u =
|
|
2370
|
-
this.repeat = (t = (s =
|
|
2371
|
-
mask: "m".repeat(Math.max(this.repeatTo === 1 / 0 && ((
|
|
2369
|
+
const u = ae(this._blockOpts);
|
|
2370
|
+
this.repeat = (t = (s = a ?? u.repeat) != null ? s : this.repeat) != null ? t : 1 / 0, super._update({
|
|
2371
|
+
mask: "m".repeat(Math.max(this.repeatTo === 1 / 0 && ((i = this._blocks) == null ? void 0 : i.length) || 0, this.repeatFrom)),
|
|
2372
2372
|
blocks: {
|
|
2373
2373
|
m: u
|
|
2374
2374
|
},
|
|
@@ -2383,39 +2383,39 @@ class It extends H {
|
|
|
2383
2383
|
_allocateBlock(e) {
|
|
2384
2384
|
if (e < this._blocks.length) return this._blocks[e];
|
|
2385
2385
|
if (this.repeatTo === 1 / 0 || this._blocks.length < this.repeatTo)
|
|
2386
|
-
return this._blocks.push(
|
|
2386
|
+
return this._blocks.push(ae(this._blockOpts)), this.mask += "m", this._blocks[this._blocks.length - 1];
|
|
2387
2387
|
}
|
|
2388
2388
|
_appendCharRaw(e, t) {
|
|
2389
2389
|
t === void 0 && (t = {});
|
|
2390
2390
|
const s = new F();
|
|
2391
2391
|
for (
|
|
2392
|
-
let l = (
|
|
2392
|
+
let l = (i = (a = this._mapPosToBlock(this.displayValue.length)) == null ? void 0 : a.index) != null ? i : Math.max(this._blocks.length - 1, 0), o, p;
|
|
2393
2393
|
// try to get a block or
|
|
2394
2394
|
// try to allocate a new block if not allocated already
|
|
2395
|
-
o = (n = this._blocks[l]) != null ? n :
|
|
2395
|
+
o = (n = this._blocks[l]) != null ? n : p = !p && this._allocateBlock(l);
|
|
2396
2396
|
++l
|
|
2397
2397
|
) {
|
|
2398
|
-
var
|
|
2399
|
-
const
|
|
2398
|
+
var i, a, n, u;
|
|
2399
|
+
const m = o._appendChar(e, {
|
|
2400
2400
|
...t,
|
|
2401
2401
|
_beforeTailState: (u = t._beforeTailState) == null || (u = u._blocks) == null ? void 0 : u[l]
|
|
2402
2402
|
});
|
|
2403
|
-
if (
|
|
2403
|
+
if (m.skip && p) {
|
|
2404
2404
|
this._blocks.pop(), this.mask = this.mask.slice(1);
|
|
2405
2405
|
break;
|
|
2406
2406
|
}
|
|
2407
|
-
if (s.aggregate(
|
|
2407
|
+
if (s.aggregate(m), m.consumed) break;
|
|
2408
2408
|
}
|
|
2409
2409
|
return s;
|
|
2410
2410
|
}
|
|
2411
2411
|
_trimEmptyTail(e, t) {
|
|
2412
|
-
var s,
|
|
2412
|
+
var s, i;
|
|
2413
2413
|
e === void 0 && (e = 0);
|
|
2414
|
-
const
|
|
2414
|
+
const a = Math.max(((s = this._mapPosToBlock(e)) == null ? void 0 : s.index) || 0, this.repeatFrom, 0);
|
|
2415
2415
|
let n;
|
|
2416
|
-
t != null && (n = (
|
|
2416
|
+
t != null && (n = (i = this._mapPosToBlock(t)) == null ? void 0 : i.index), n == null && (n = this._blocks.length - 1);
|
|
2417
2417
|
let u = 0;
|
|
2418
|
-
for (let l = n;
|
|
2418
|
+
for (let l = n; a <= l && !this._blocks[l].unmaskedValue; --l, ++u)
|
|
2419
2419
|
;
|
|
2420
2420
|
u && (this._blocks.splice(n - u + 1, u), this.mask = this.mask.slice(u));
|
|
2421
2421
|
}
|
|
@@ -2437,9 +2437,9 @@ class It extends H {
|
|
|
2437
2437
|
this._blocks.length = e._blocks.length, this.mask = this.mask.slice(0, this._blocks.length), super.state = e;
|
|
2438
2438
|
}
|
|
2439
2439
|
}
|
|
2440
|
-
|
|
2440
|
+
_.RepeatBlock = It;
|
|
2441
2441
|
try {
|
|
2442
|
-
globalThis.IMask =
|
|
2442
|
+
globalThis.IMask = _;
|
|
2443
2443
|
} catch {
|
|
2444
2444
|
}
|
|
2445
2445
|
var Tt = {
|
|
@@ -2509,59 +2509,59 @@ var Tt = {
|
|
|
2509
2509
|
// dynamic
|
|
2510
2510
|
dispatch: Function
|
|
2511
2511
|
};
|
|
2512
|
-
function
|
|
2512
|
+
function Rt(r, e) {
|
|
2513
2513
|
let {
|
|
2514
2514
|
emit: t,
|
|
2515
2515
|
onAccept: s,
|
|
2516
|
-
onComplete:
|
|
2517
|
-
defaultValue:
|
|
2516
|
+
onComplete: i,
|
|
2517
|
+
defaultValue: a,
|
|
2518
2518
|
defaultUnmaskedValue: n,
|
|
2519
2519
|
defaultTypedValue: u
|
|
2520
2520
|
} = e === void 0 ? {} : e;
|
|
2521
|
-
const l =
|
|
2522
|
-
let
|
|
2521
|
+
const l = ht(r) ? r : W(r), o = W(), p = W(), m = W(""), A = W(""), v = W();
|
|
2522
|
+
let V, x = m.value, M = A.value, P = v.value;
|
|
2523
2523
|
function ne() {
|
|
2524
|
-
|
|
2524
|
+
P = v.value = p.value.typedValue, M = A.value = p.value.unmaskedValue, x = m.value = p.value.value;
|
|
2525
2525
|
}
|
|
2526
2526
|
function D(b) {
|
|
2527
|
-
ne(), t && (t("accept",
|
|
2527
|
+
ne(), t && (t("accept", m.value, b), t("accept:masked", m.value, b), t("accept:typed", v.value, b), t("accept:unmasked", A.value, b)), s?.(b);
|
|
2528
2528
|
}
|
|
2529
|
-
function
|
|
2530
|
-
t && (t("complete",
|
|
2529
|
+
function O(b) {
|
|
2530
|
+
t && (t("complete", p.value.value, b), t("complete:masked", p.value.value, b), t("complete:typed", p.value.typedValue, b), t("complete:unmasked", p.value.unmaskedValue, b)), i?.(b);
|
|
2531
2531
|
}
|
|
2532
|
-
const
|
|
2533
|
-
!
|
|
2532
|
+
const C = () => {
|
|
2533
|
+
!p.value || A.value === void 0 || (M !== A.value && (p.value.unmaskedValue = A.value, p.value.unmaskedValue !== A.value && D()), M = void 0);
|
|
2534
2534
|
};
|
|
2535
|
-
|
|
2535
|
+
se(A, C);
|
|
2536
2536
|
const I = () => {
|
|
2537
|
-
!
|
|
2537
|
+
!p.value || m.value === void 0 || (x !== m.value && (p.value.value = m.value, p.value.value !== m.value && D()), x = void 0);
|
|
2538
2538
|
};
|
|
2539
|
-
|
|
2540
|
-
const
|
|
2541
|
-
!
|
|
2539
|
+
se(m, I);
|
|
2540
|
+
const U = () => {
|
|
2541
|
+
!p.value || v.value === void 0 || (P !== v.value && (p.value.typedValue = v.value, p.value.masked.typedValueEquals(v.value) || D()), P = void 0);
|
|
2542
2542
|
};
|
|
2543
|
-
|
|
2544
|
-
function
|
|
2545
|
-
|
|
2543
|
+
se(v, U);
|
|
2544
|
+
function L() {
|
|
2545
|
+
V = o.value;
|
|
2546
2546
|
const b = l.value;
|
|
2547
|
-
!
|
|
2547
|
+
!V || !(b != null && b.mask) || (p.value = _(V, b), a !== void 0 && (m.value = a), n !== void 0 && (A.value = n), u !== void 0 && (v.value = u), C(), I(), U(), ne(), p.value.on("accept", D).on("complete", O));
|
|
2548
2548
|
}
|
|
2549
|
-
function
|
|
2549
|
+
function ee() {
|
|
2550
2550
|
var b;
|
|
2551
|
-
(b =
|
|
2551
|
+
(b = p.value) == null || b.destroy(), p.value = void 0;
|
|
2552
2552
|
}
|
|
2553
|
-
return
|
|
2553
|
+
return ct(L), pt(ee), se([o, l], () => {
|
|
2554
2554
|
const b = o.value, S = l.value;
|
|
2555
|
-
(!(S != null && S.mask) || b !==
|
|
2555
|
+
(!(S != null && S.mask) || b !== V) && ee(), b && (p.value ? p.value.updateOptions(S) : L());
|
|
2556
2556
|
}), {
|
|
2557
2557
|
el: o,
|
|
2558
|
-
mask:
|
|
2559
|
-
masked:
|
|
2560
|
-
unmasked:
|
|
2558
|
+
mask: dt(p),
|
|
2559
|
+
masked: m,
|
|
2560
|
+
unmasked: A,
|
|
2561
2561
|
typed: v
|
|
2562
2562
|
};
|
|
2563
2563
|
}
|
|
2564
|
-
function
|
|
2564
|
+
function Ot(r, e) {
|
|
2565
2565
|
return r = {
|
|
2566
2566
|
...r
|
|
2567
2567
|
}, Object.keys(r).forEach((t) => {
|
|
@@ -2589,40 +2589,40 @@ var Lt = ve({
|
|
|
2589
2589
|
emit: s
|
|
2590
2590
|
} = e;
|
|
2591
2591
|
const {
|
|
2592
|
-
el:
|
|
2593
|
-
mask:
|
|
2592
|
+
el: i,
|
|
2593
|
+
mask: a,
|
|
2594
2594
|
masked: n,
|
|
2595
2595
|
unmasked: u,
|
|
2596
2596
|
typed: l
|
|
2597
|
-
} = Ot(
|
|
2597
|
+
} = Rt(Ot(r, Pt), {
|
|
2598
2598
|
emit: s,
|
|
2599
2599
|
onAccept: (v) => {
|
|
2600
|
-
const
|
|
2601
|
-
s("accept:value",
|
|
2600
|
+
const V = n.value;
|
|
2601
|
+
s("accept:value", V, v), s("update:value", V, v), s("update:masked", V, v), s("update:modelValue", V, v), s("update:unmasked", u.value, v), s("update:typed", l.value, v);
|
|
2602
2602
|
},
|
|
2603
2603
|
onComplete: (v) => {
|
|
2604
2604
|
s("complete:value", n.value, v);
|
|
2605
2605
|
}
|
|
2606
|
-
}), o =
|
|
2607
|
-
return n.value =
|
|
2606
|
+
}), o = Ce(r, "value"), p = Ce(r, "modelValue"), m = Ce(r, "unmasked"), A = Ce(r, "typed");
|
|
2607
|
+
return n.value = p.value || o.value || "", u.value = m.value || "", l.value = A.value, se(o, (v) => n.value = v), se(p, (v) => n.value = v), se(m, (v) => u.value = v), se(A, (v) => l.value = v), () => {
|
|
2608
2608
|
const v = {
|
|
2609
2609
|
...t,
|
|
2610
|
-
value: r.value != null ? r.value : r.modelValue != null ? r.modelValue :
|
|
2611
|
-
ref:
|
|
2610
|
+
value: r.value != null ? r.value : r.modelValue != null ? r.modelValue : a.value ? a.value.displayValue : "",
|
|
2611
|
+
ref: i
|
|
2612
2612
|
};
|
|
2613
|
-
return r.mask || (v.onInput = (
|
|
2614
|
-
s("update:modelValue",
|
|
2615
|
-
}),
|
|
2613
|
+
return r.mask || (v.onInput = (V) => {
|
|
2614
|
+
s("update:modelValue", V.target.value), s("update:value", V.target.value);
|
|
2615
|
+
}), ut("input", v);
|
|
2616
2616
|
};
|
|
2617
2617
|
}
|
|
2618
2618
|
}), $t = Lt;
|
|
2619
|
-
const Nt = ["for"], Ut = { class: "state-layer" }, Yt = { class: "content" },
|
|
2619
|
+
const Nt = ["for"], Ut = { class: "state-layer" }, Yt = { class: "content" }, Ht = { class: "input-text-container" }, zt = ["id", "placeholder", "aria-label"], jt = {
|
|
2620
2620
|
key: 1,
|
|
2621
2621
|
class: "has-text-body-small phila-supporting-text"
|
|
2622
2622
|
}, qt = {
|
|
2623
2623
|
key: 2,
|
|
2624
2624
|
class: "has-text-body-small phila-error-text"
|
|
2625
|
-
},
|
|
2625
|
+
}, We = /* @__PURE__ */ ve({
|
|
2626
2626
|
inheritAttrs: !1,
|
|
2627
2627
|
__name: "TextField",
|
|
2628
2628
|
props: {
|
|
@@ -2641,146 +2641,97 @@ const Nt = ["for"], Ut = { class: "state-layer" }, Yt = { class: "content" }, zt
|
|
|
2641
2641
|
},
|
|
2642
2642
|
emits: ["update:modelValue", "complete"],
|
|
2643
2643
|
setup(r, { expose: e, emit: t }) {
|
|
2644
|
-
const s =
|
|
2645
|
-
get: () =>
|
|
2646
|
-
set: (
|
|
2647
|
-
u("update:modelValue",
|
|
2644
|
+
const s = Je(), i = r, a = N(() => typeof i.error == "string" ? i.error : i.error[0]), n = Ce(i, "id"), u = t, l = W(""), o = N({
|
|
2645
|
+
get: () => i.modelValue !== void 0 ? i.modelValue : l.value,
|
|
2646
|
+
set: (x) => {
|
|
2647
|
+
u("update:modelValue", x), l.value = x;
|
|
2648
2648
|
}
|
|
2649
|
-
}),
|
|
2650
|
-
const
|
|
2651
|
-
return s.disabled != null &&
|
|
2652
|
-
}),
|
|
2653
|
-
const
|
|
2654
|
-
return o.value !== "" &&
|
|
2655
|
-
}),
|
|
2656
|
-
if (!(
|
|
2657
|
-
return
|
|
2658
|
-
}), v = W(null),
|
|
2659
|
-
|
|
2649
|
+
}), p = N(() => {
|
|
2650
|
+
const x = ["default-class"];
|
|
2651
|
+
return s.disabled != null && x.push("phila-input--disabled"), a.value && x.push("phila-input--error"), s.required != null && x.push("phila-input--required"), Ae(...x);
|
|
2652
|
+
}), m = N(() => {
|
|
2653
|
+
const x = [];
|
|
2654
|
+
return o.value !== "" && x.push("phila-text-field--filled"), i.className && x.push(i.className), Ae(...x);
|
|
2655
|
+
}), A = N(() => {
|
|
2656
|
+
if (!(i.label || s["aria-label"]))
|
|
2657
|
+
return i.placeholder || void 0;
|
|
2658
|
+
}), v = W(null), V = (x) => {
|
|
2659
|
+
x.target.closest("button") || v.value?.focus();
|
|
2660
2660
|
};
|
|
2661
|
-
return e({ inputRef: v }), (
|
|
2662
|
-
class: Ye(["phila-input",
|
|
2661
|
+
return e({ inputRef: v }), (x, M) => (w(), H("div", {
|
|
2662
|
+
class: Ye(["phila-input", p.value])
|
|
2663
2663
|
}, [
|
|
2664
|
-
|
|
2664
|
+
i.label ? (w(), H("label", {
|
|
2665
2665
|
key: 0,
|
|
2666
2666
|
for: n.value,
|
|
2667
2667
|
class: "has-text-label-small phila-label"
|
|
2668
|
-
}, X(
|
|
2669
|
-
|
|
2670
|
-
class: Ye(["phila-text-field",
|
|
2671
|
-
onClick:
|
|
2668
|
+
}, X(i.label), 9, Nt)) : de("", !0),
|
|
2669
|
+
K("div", {
|
|
2670
|
+
class: Ye(["phila-text-field", m.value]),
|
|
2671
|
+
onClick: ce(V, ["prevent"])
|
|
2672
2672
|
}, [
|
|
2673
|
-
|
|
2674
|
-
|
|
2673
|
+
K("div", Ut, [
|
|
2674
|
+
i.leadingIcon ? (w(), ue(T(Ne), {
|
|
2675
2675
|
key: 0,
|
|
2676
|
-
"icon-class":
|
|
2676
|
+
"icon-class": i.leadingIcon,
|
|
2677
2677
|
inline: "",
|
|
2678
2678
|
decorative: ""
|
|
2679
|
-
}, null, 8, ["icon-class"])) :
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2679
|
+
}, null, 8, ["icon-class"])) : de("", !0),
|
|
2680
|
+
K("div", Yt, [
|
|
2681
|
+
K("div", Ht, [
|
|
2682
|
+
i.imaskProps?.mask ? (w(), ue(T($t), ie({ key: 0 }, { ...T(s), ...i.imaskProps }, {
|
|
2683
2683
|
id: n.value,
|
|
2684
2684
|
modelValue: o.value,
|
|
2685
|
-
"onUpdate:modelValue":
|
|
2685
|
+
"onUpdate:modelValue": M[0] || (M[0] = (P) => o.value = P),
|
|
2686
2686
|
class: "phila-text-field-input has-text-body-default",
|
|
2687
|
-
placeholder:
|
|
2688
|
-
onComplete:
|
|
2689
|
-
}), null, 16, ["id", "modelValue", "placeholder"])) :
|
|
2687
|
+
placeholder: i.placeholder,
|
|
2688
|
+
onComplete: M[1] || (M[1] = () => u("complete", l.value))
|
|
2689
|
+
}), null, 16, ["id", "modelValue", "placeholder"])) : lt((w(), H("input", ie({
|
|
2690
2690
|
key: 1,
|
|
2691
2691
|
id: n.value,
|
|
2692
2692
|
ref_key: "inputRef",
|
|
2693
2693
|
ref: v
|
|
2694
|
-
},
|
|
2695
|
-
"onUpdate:modelValue":
|
|
2694
|
+
}, T(s), {
|
|
2695
|
+
"onUpdate:modelValue": M[2] || (M[2] = (P) => o.value = P),
|
|
2696
2696
|
class: "phila-text-field-input has-text-body-default",
|
|
2697
|
-
placeholder:
|
|
2698
|
-
"aria-label":
|
|
2699
|
-
}), null, 16,
|
|
2700
|
-
[
|
|
2697
|
+
placeholder: i.placeholder,
|
|
2698
|
+
"aria-label": A.value
|
|
2699
|
+
}), null, 16, zt)), [
|
|
2700
|
+
[ot, o.value]
|
|
2701
2701
|
])
|
|
2702
2702
|
])
|
|
2703
2703
|
]),
|
|
2704
|
-
o.value != "" ? (w(),
|
|
2704
|
+
o.value != "" ? (w(), ue(T(kt), {
|
|
2705
2705
|
key: 1,
|
|
2706
2706
|
variant: "standard",
|
|
2707
2707
|
size: "small",
|
|
2708
2708
|
"icon-only": "",
|
|
2709
|
-
"icon-definition":
|
|
2710
|
-
onClick:
|
|
2711
|
-
}, null, 8, ["icon-definition"])) :
|
|
2712
|
-
|
|
2709
|
+
"icon-definition": T(Et),
|
|
2710
|
+
onClick: M[3] || (M[3] = (P) => o.value = "")
|
|
2711
|
+
}, null, 8, ["icon-definition"])) : de("", !0),
|
|
2712
|
+
i.trailingIcon ? (w(), ue(T(Ne), {
|
|
2713
2713
|
key: 2,
|
|
2714
2714
|
size: "small",
|
|
2715
|
-
"icon-class":
|
|
2715
|
+
"icon-class": i.trailingIcon,
|
|
2716
2716
|
inline: "",
|
|
2717
2717
|
decorative: ""
|
|
2718
|
-
}, null, 8, ["icon-class"])) :
|
|
2719
|
-
|
|
2718
|
+
}, null, 8, ["icon-class"])) : de("", !0),
|
|
2719
|
+
ye(x.$slots, "trailing-action")
|
|
2720
2720
|
])
|
|
2721
2721
|
], 2),
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
"icon-definition":
|
|
2722
|
+
i.supportingText ? (w(), H("div", jt, X(i.supportingText), 1)) : de("", !0),
|
|
2723
|
+
a.value ? (w(), H("div", qt, [
|
|
2724
|
+
fe(T(Ne), {
|
|
2725
|
+
"icon-definition": T(Ct),
|
|
2726
2726
|
size: "small",
|
|
2727
2727
|
inline: "",
|
|
2728
2728
|
decorative: ""
|
|
2729
2729
|
}, null, 8, ["icon-definition"]),
|
|
2730
|
-
|
|
2731
|
-
])) :
|
|
2730
|
+
Ee(" " + X(a.value), 1)
|
|
2731
|
+
])) : de("", !0)
|
|
2732
2732
|
], 2));
|
|
2733
2733
|
}
|
|
2734
|
-
}), Kt = ["
|
|
2735
|
-
__name: "CollapsePanel",
|
|
2736
|
-
props: {
|
|
2737
|
-
className: {},
|
|
2738
|
-
id: {},
|
|
2739
|
-
group: { default: void 0 },
|
|
2740
|
-
blurClose: { type: Boolean, default: !1 },
|
|
2741
|
-
openSingle: { type: Boolean, default: !1 },
|
|
2742
|
-
mouseOverToggle: { type: Boolean, default: !1 },
|
|
2743
|
-
outsideClickClose: { type: Boolean, default: !1 },
|
|
2744
|
-
escapeKeyClose: { type: Boolean, default: !1 },
|
|
2745
|
-
toggleAttrs: { default: void 0 }
|
|
2746
|
-
},
|
|
2747
|
-
setup(r) {
|
|
2748
|
-
const e = r, { isCollapsed: t, onMouseEnter: s, onMouseLeave: a, onClickToggle: i, onClickOpen: n, focusChange: u } = mt(e), l = Y(() => t(e.id));
|
|
2749
|
-
return (o, h) => (w(), U("div", {
|
|
2750
|
-
onMouseenter: h[1] || (h[1] = //@ts-ignore
|
|
2751
|
-
(...c) => x(s) && x(s)(...c)),
|
|
2752
|
-
onMouseleave: h[2] || (h[2] = //@ts-ignore
|
|
2753
|
-
(...c) => x(a) && x(a)(...c)),
|
|
2754
|
-
onFocusout: h[3] || (h[3] = //@ts-ignore
|
|
2755
|
-
(...c) => x(u) && x(u)(...c))
|
|
2756
|
-
}, [
|
|
2757
|
-
me(o.$slots, "toggle", _e(Ce({
|
|
2758
|
-
open: l.value,
|
|
2759
|
-
ariaLabel: l.value ? "Close panel" : "Open panel",
|
|
2760
|
-
ariaExpanded: l.value,
|
|
2761
|
-
ariaControls: r.id,
|
|
2762
|
-
onClickToggle: x(i),
|
|
2763
|
-
onClickOpen: x(n),
|
|
2764
|
-
focusChange: x(u),
|
|
2765
|
-
onClick: x(i)
|
|
2766
|
-
})), () => [
|
|
2767
|
-
j("button", ee({
|
|
2768
|
-
"data-toggle": r.id,
|
|
2769
|
-
"aria-label": l.value ? "Close panel" : "Open panel",
|
|
2770
|
-
"aria-expanded": l.value,
|
|
2771
|
-
"aria-controls": r.id
|
|
2772
|
-
}, r.toggleAttrs, {
|
|
2773
|
-
onClick: h[0] || (h[0] = ue(
|
|
2774
|
-
//@ts-ignore
|
|
2775
|
-
(...c) => x(i) && x(i)(...c),
|
|
2776
|
-
["prevent"]
|
|
2777
|
-
))
|
|
2778
|
-
}), null, 16, Kt)
|
|
2779
|
-
]),
|
|
2780
|
-
me(o.$slots, "default", _e(Ce({ id: r.id, open: l.value, onClickToggle: x(i), focusChange: x(u), hidden: !l.value })))
|
|
2781
|
-
], 32));
|
|
2782
|
-
}
|
|
2783
|
-
}), Zt = ["disabled"], Wt = /* @__PURE__ */ ve({
|
|
2734
|
+
}), Kt = ["disabled"], Gt = /* @__PURE__ */ ve({
|
|
2784
2735
|
inheritAttrs: !1,
|
|
2785
2736
|
__name: "PhlButton",
|
|
2786
2737
|
props: {
|
|
@@ -2802,14 +2753,14 @@ const Nt = ["for"], Ut = { class: "state-layer" }, Yt = { class: "content" }, zt
|
|
|
2802
2753
|
svgRaw: {}
|
|
2803
2754
|
},
|
|
2804
2755
|
setup(r) {
|
|
2805
|
-
const e = r, t = (n) => "href" in n && n.href !== void 0 || "to" in n && n.to !== void 0, s =
|
|
2756
|
+
const e = r, t = (n) => "href" in n && n.href !== void 0 || "to" in n && n.to !== void 0, s = N(() => Ae(
|
|
2806
2757
|
"phila-button",
|
|
2807
2758
|
`phila-button--${e.variant}`,
|
|
2808
2759
|
e.size && `is-${e.size}`,
|
|
2809
2760
|
e.iconOnly && "icon-button",
|
|
2810
2761
|
e.iconOnly && e.variant === "standard" && "icon-button--standard",
|
|
2811
2762
|
e.className
|
|
2812
|
-
)),
|
|
2763
|
+
)), i = N(() => t(e) ? "to" in e && e.to !== void 0 ? {
|
|
2813
2764
|
to: e.to,
|
|
2814
2765
|
disabled: e.disabled,
|
|
2815
2766
|
className: s.value
|
|
@@ -2819,7 +2770,7 @@ const Nt = ["for"], Ut = { class: "state-layer" }, Yt = { class: "content" }, zt
|
|
|
2819
2770
|
rel: e.rel,
|
|
2820
2771
|
disabled: e.disabled,
|
|
2821
2772
|
className: s.value
|
|
2822
|
-
} : {}),
|
|
2773
|
+
} : {}), a = N(
|
|
2823
2774
|
() => ({
|
|
2824
2775
|
iconDefinition: e.iconDefinition,
|
|
2825
2776
|
iconClass: e.iconClass,
|
|
@@ -2830,214 +2781,214 @@ const Nt = ["for"], Ut = { class: "state-layer" }, Yt = { class: "content" }, zt
|
|
|
2830
2781
|
size: e.size
|
|
2831
2782
|
})
|
|
2832
2783
|
);
|
|
2833
|
-
return (n, u) => t(e) ? (w(),
|
|
2834
|
-
default:
|
|
2835
|
-
|
|
2836
|
-
default:
|
|
2837
|
-
|
|
2838
|
-
|
|
2784
|
+
return (n, u) => t(e) ? (w(), ue(T(Qe), ie({ key: 0 }, { ...i.value, ...n.$attrs }, { role: "button" }), {
|
|
2785
|
+
default: ge(() => [
|
|
2786
|
+
fe(T(Ie), Be(we(a.value)), {
|
|
2787
|
+
default: ge(() => [
|
|
2788
|
+
ye(n.$slots, "default", {}, () => [
|
|
2789
|
+
Ee(X(e.text), 1)
|
|
2839
2790
|
])
|
|
2840
2791
|
]),
|
|
2841
2792
|
_: 3
|
|
2842
2793
|
}, 16)
|
|
2843
2794
|
]),
|
|
2844
2795
|
_: 3
|
|
2845
|
-
}, 16)) : (w(),
|
|
2796
|
+
}, 16)) : (w(), H("button", ie({
|
|
2846
2797
|
key: 1,
|
|
2847
2798
|
type: "button",
|
|
2848
2799
|
disabled: e.disabled,
|
|
2849
2800
|
class: s.value
|
|
2850
2801
|
}, n.$attrs), [
|
|
2851
|
-
|
|
2852
|
-
default:
|
|
2853
|
-
|
|
2854
|
-
|
|
2802
|
+
fe(T(Ie), Be(we(a.value)), {
|
|
2803
|
+
default: ge(() => [
|
|
2804
|
+
ye(n.$slots, "default", {}, () => [
|
|
2805
|
+
Ee(X(e.text), 1)
|
|
2855
2806
|
])
|
|
2856
2807
|
]),
|
|
2857
2808
|
_: 3
|
|
2858
2809
|
}, 16)
|
|
2859
|
-
], 16,
|
|
2810
|
+
], 16, Kt));
|
|
2860
2811
|
}
|
|
2861
2812
|
});
|
|
2862
|
-
var
|
|
2813
|
+
var Zt = {
|
|
2863
2814
|
prefix: "fas",
|
|
2864
2815
|
iconName: "xmark",
|
|
2865
2816
|
icon: [384, 512, [128473, 10005, 10006, 10060, 215, "close", "multiply", "remove", "times"], "f00d", "M55.1 73.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L147.2 256 9.9 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192.5 301.3 329.9 438.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.8 256 375.1 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192.5 210.7 55.1 73.4z"]
|
|
2866
|
-
},
|
|
2867
|
-
function
|
|
2817
|
+
}, Wt = Zt;
|
|
2818
|
+
function Xt(r) {
|
|
2868
2819
|
return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
|
|
2869
2820
|
}
|
|
2870
|
-
var
|
|
2871
|
-
function
|
|
2872
|
-
return
|
|
2821
|
+
var Ve = { exports: {} }, Jt = Ve.exports, Xe;
|
|
2822
|
+
function Qt() {
|
|
2823
|
+
return Xe || (Xe = 1, (function(r, e) {
|
|
2873
2824
|
(function(t, s) {
|
|
2874
2825
|
r.exports = s();
|
|
2875
|
-
})(
|
|
2876
|
-
var t = 1e3, s = 6e4,
|
|
2877
|
-
var
|
|
2878
|
-
return "[" +
|
|
2879
|
-
} }, D = function(
|
|
2880
|
-
var g = String(
|
|
2881
|
-
return !g || g.length >=
|
|
2882
|
-
},
|
|
2883
|
-
var
|
|
2884
|
-
return (
|
|
2885
|
-
}, m: function
|
|
2886
|
-
if (
|
|
2887
|
-
var g = 12 * (
|
|
2888
|
-
return +(-(g + (
|
|
2889
|
-
}, a: function(
|
|
2890
|
-
return
|
|
2891
|
-
}, p: function(
|
|
2892
|
-
return { M:
|
|
2893
|
-
}, u: function(
|
|
2894
|
-
return
|
|
2895
|
-
} },
|
|
2896
|
-
I[
|
|
2897
|
-
var
|
|
2898
|
-
return
|
|
2899
|
-
},
|
|
2900
|
-
var
|
|
2901
|
-
if (!
|
|
2902
|
-
if (typeof
|
|
2903
|
-
var
|
|
2904
|
-
I[
|
|
2905
|
-
var
|
|
2906
|
-
if (!
|
|
2826
|
+
})(Jt, (function() {
|
|
2827
|
+
var t = 1e3, s = 6e4, i = 36e5, a = "millisecond", n = "second", u = "minute", l = "hour", o = "day", p = "week", m = "month", A = "quarter", v = "year", V = "date", x = "Invalid Date", M = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, P = /\[([^\]]+)]|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, ne = { 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(k) {
|
|
2828
|
+
var c = ["th", "st", "nd", "rd"], h = k % 100;
|
|
2829
|
+
return "[" + k + (c[(h - 20) % 10] || c[h] || c[0]) + "]";
|
|
2830
|
+
} }, D = function(k, c, h) {
|
|
2831
|
+
var g = String(k);
|
|
2832
|
+
return !g || g.length >= c ? k : "" + Array(c + 1 - g.length).join(h) + k;
|
|
2833
|
+
}, O = { s: D, z: function(k) {
|
|
2834
|
+
var c = -k.utcOffset(), h = Math.abs(c), g = Math.floor(h / 60), d = h % 60;
|
|
2835
|
+
return (c <= 0 ? "+" : "-") + D(g, 2, "0") + ":" + D(d, 2, "0");
|
|
2836
|
+
}, m: function k(c, h) {
|
|
2837
|
+
if (c.date() < h.date()) return -k(h, c);
|
|
2838
|
+
var g = 12 * (h.year() - c.year()) + (h.month() - c.month()), d = c.clone().add(g, m), y = h - d < 0, E = c.clone().add(g + (y ? -1 : 1), m);
|
|
2839
|
+
return +(-(g + (h - d) / (y ? d - E : E - d)) || 0);
|
|
2840
|
+
}, a: function(k) {
|
|
2841
|
+
return k < 0 ? Math.ceil(k) || 0 : Math.floor(k);
|
|
2842
|
+
}, p: function(k) {
|
|
2843
|
+
return { M: m, y: v, w: p, d: o, D: V, h: l, m: u, s: n, ms: a, Q: A }[k] || String(k || "").toLowerCase().replace(/s$/, "");
|
|
2844
|
+
}, u: function(k) {
|
|
2845
|
+
return k === void 0;
|
|
2846
|
+
} }, C = "en", I = {};
|
|
2847
|
+
I[C] = ne;
|
|
2848
|
+
var U = "$isDayjsObject", L = function(k) {
|
|
2849
|
+
return k instanceof Fe || !(!k || !k[U]);
|
|
2850
|
+
}, ee = function k(c, h, g) {
|
|
2851
|
+
var d;
|
|
2852
|
+
if (!c) return C;
|
|
2853
|
+
if (typeof c == "string") {
|
|
2854
|
+
var y = c.toLowerCase();
|
|
2855
|
+
I[y] && (d = y), h && (I[y] = h, d = y);
|
|
2856
|
+
var E = c.split("-");
|
|
2857
|
+
if (!d && E.length > 1) return k(E[0]);
|
|
2907
2858
|
} else {
|
|
2908
|
-
var
|
|
2909
|
-
I[
|
|
2859
|
+
var B = c.name;
|
|
2860
|
+
I[B] = c, d = B;
|
|
2910
2861
|
}
|
|
2911
|
-
return !g &&
|
|
2912
|
-
}, b = function(
|
|
2913
|
-
if (
|
|
2914
|
-
var
|
|
2915
|
-
return
|
|
2916
|
-
}, S =
|
|
2917
|
-
S.l =
|
|
2918
|
-
return b(
|
|
2862
|
+
return !g && d && (C = d), d || !g && C;
|
|
2863
|
+
}, b = function(k, c) {
|
|
2864
|
+
if (L(k)) return k.clone();
|
|
2865
|
+
var h = typeof c == "object" ? c : {};
|
|
2866
|
+
return h.date = k, h.args = arguments, new Fe(h);
|
|
2867
|
+
}, S = O;
|
|
2868
|
+
S.l = ee, S.i = L, S.w = function(k, c) {
|
|
2869
|
+
return b(k, { locale: c.$L, utc: c.$u, x: c.$x, $offset: c.$offset });
|
|
2919
2870
|
};
|
|
2920
|
-
var
|
|
2921
|
-
function
|
|
2922
|
-
this.$L =
|
|
2871
|
+
var Fe = (function() {
|
|
2872
|
+
function k(h) {
|
|
2873
|
+
this.$L = ee(h.locale, null, !0), this.parse(h), this.$x = this.$x || h.x || {}, this[U] = !0;
|
|
2923
2874
|
}
|
|
2924
|
-
var
|
|
2925
|
-
return
|
|
2875
|
+
var c = k.prototype;
|
|
2876
|
+
return c.parse = function(h) {
|
|
2926
2877
|
this.$d = (function(g) {
|
|
2927
|
-
var
|
|
2928
|
-
if (
|
|
2929
|
-
if (S.u(
|
|
2930
|
-
if (
|
|
2931
|
-
if (typeof
|
|
2932
|
-
var
|
|
2933
|
-
if (
|
|
2934
|
-
var
|
|
2935
|
-
return
|
|
2878
|
+
var d = g.date, y = g.utc;
|
|
2879
|
+
if (d === null) return /* @__PURE__ */ new Date(NaN);
|
|
2880
|
+
if (S.u(d)) return /* @__PURE__ */ new Date();
|
|
2881
|
+
if (d instanceof Date) return new Date(d);
|
|
2882
|
+
if (typeof d == "string" && !/Z$/i.test(d)) {
|
|
2883
|
+
var E = d.match(M);
|
|
2884
|
+
if (E) {
|
|
2885
|
+
var B = E[2] - 1 || 0, R = (E[7] || "0").substring(0, 3);
|
|
2886
|
+
return y ? new Date(Date.UTC(E[1], B, E[3] || 1, E[4] || 0, E[5] || 0, E[6] || 0, R)) : new Date(E[1], B, E[3] || 1, E[4] || 0, E[5] || 0, E[6] || 0, R);
|
|
2936
2887
|
}
|
|
2937
2888
|
}
|
|
2938
|
-
return new Date(
|
|
2939
|
-
})(
|
|
2940
|
-
},
|
|
2941
|
-
var
|
|
2942
|
-
this.$y =
|
|
2943
|
-
},
|
|
2889
|
+
return new Date(d);
|
|
2890
|
+
})(h), this.init();
|
|
2891
|
+
}, c.init = function() {
|
|
2892
|
+
var h = this.$d;
|
|
2893
|
+
this.$y = h.getFullYear(), this.$M = h.getMonth(), this.$D = h.getDate(), this.$W = h.getDay(), this.$H = h.getHours(), this.$m = h.getMinutes(), this.$s = h.getSeconds(), this.$ms = h.getMilliseconds();
|
|
2894
|
+
}, c.$utils = function() {
|
|
2944
2895
|
return S;
|
|
2945
|
-
},
|
|
2946
|
-
return this.$d.toString() !==
|
|
2947
|
-
},
|
|
2948
|
-
var
|
|
2949
|
-
return this.startOf(g) <=
|
|
2950
|
-
},
|
|
2951
|
-
return b(
|
|
2952
|
-
},
|
|
2953
|
-
return this.endOf(g) < b(
|
|
2954
|
-
},
|
|
2955
|
-
return S.u(
|
|
2956
|
-
},
|
|
2896
|
+
}, c.isValid = function() {
|
|
2897
|
+
return this.$d.toString() !== x;
|
|
2898
|
+
}, c.isSame = function(h, g) {
|
|
2899
|
+
var d = b(h);
|
|
2900
|
+
return this.startOf(g) <= d && d <= this.endOf(g);
|
|
2901
|
+
}, c.isAfter = function(h, g) {
|
|
2902
|
+
return b(h) < this.startOf(g);
|
|
2903
|
+
}, c.isBefore = function(h, g) {
|
|
2904
|
+
return this.endOf(g) < b(h);
|
|
2905
|
+
}, c.$g = function(h, g, d) {
|
|
2906
|
+
return S.u(h) ? this[g] : this.set(d, h);
|
|
2907
|
+
}, c.unix = function() {
|
|
2957
2908
|
return Math.floor(this.valueOf() / 1e3);
|
|
2958
|
-
},
|
|
2909
|
+
}, c.valueOf = function() {
|
|
2959
2910
|
return this.$d.getTime();
|
|
2960
|
-
},
|
|
2961
|
-
var
|
|
2962
|
-
var re = S.w(
|
|
2963
|
-
return
|
|
2964
|
-
},
|
|
2965
|
-
return S.w(
|
|
2966
|
-
},
|
|
2967
|
-
switch (
|
|
2911
|
+
}, c.startOf = function(h, g) {
|
|
2912
|
+
var d = this, y = !!S.u(g) || g, E = S.p(h), B = function(he, q) {
|
|
2913
|
+
var re = S.w(d.$u ? Date.UTC(d.$y, q, he) : new Date(d.$y, q, he), d);
|
|
2914
|
+
return y ? re : re.endOf(o);
|
|
2915
|
+
}, R = function(he, q) {
|
|
2916
|
+
return S.w(d.toDate()[he].apply(d.toDate("s"), (y ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(q)), d);
|
|
2917
|
+
}, $ = this.$W, Y = this.$M, Z = this.$D, me = "set" + (this.$u ? "UTC" : "");
|
|
2918
|
+
switch (E) {
|
|
2968
2919
|
case v:
|
|
2969
|
-
return
|
|
2970
|
-
case
|
|
2971
|
-
return
|
|
2972
|
-
case
|
|
2973
|
-
var
|
|
2974
|
-
return
|
|
2920
|
+
return y ? B(1, 0) : B(31, 11);
|
|
2921
|
+
case m:
|
|
2922
|
+
return y ? B(1, Y) : B(0, Y + 1);
|
|
2923
|
+
case p:
|
|
2924
|
+
var oe = this.$locale().weekStart || 0, ke = ($ < oe ? $ + 7 : $) - oe;
|
|
2925
|
+
return B(y ? Z - ke : Z + (6 - ke), Y);
|
|
2975
2926
|
case o:
|
|
2976
|
-
case
|
|
2977
|
-
return
|
|
2927
|
+
case V:
|
|
2928
|
+
return R(me + "Hours", 0);
|
|
2978
2929
|
case l:
|
|
2979
|
-
return
|
|
2930
|
+
return R(me + "Minutes", 1);
|
|
2980
2931
|
case u:
|
|
2981
|
-
return
|
|
2932
|
+
return R(me + "Seconds", 2);
|
|
2982
2933
|
case n:
|
|
2983
|
-
return
|
|
2934
|
+
return R(me + "Milliseconds", 3);
|
|
2984
2935
|
default:
|
|
2985
2936
|
return this.clone();
|
|
2986
2937
|
}
|
|
2987
|
-
},
|
|
2988
|
-
return this.startOf(
|
|
2989
|
-
},
|
|
2990
|
-
var
|
|
2991
|
-
if (
|
|
2992
|
-
var
|
|
2993
|
-
|
|
2994
|
-
} else
|
|
2938
|
+
}, c.endOf = function(h) {
|
|
2939
|
+
return this.startOf(h, !1);
|
|
2940
|
+
}, c.$set = function(h, g) {
|
|
2941
|
+
var d, y = S.p(h), E = "set" + (this.$u ? "UTC" : ""), B = (d = {}, d[o] = E + "Date", d[V] = E + "Date", d[m] = E + "Month", d[v] = E + "FullYear", d[l] = E + "Hours", d[u] = E + "Minutes", d[n] = E + "Seconds", d[a] = E + "Milliseconds", d)[y], R = y === o ? this.$D + (g - this.$W) : g;
|
|
2942
|
+
if (y === m || y === v) {
|
|
2943
|
+
var $ = this.clone().set(V, 1);
|
|
2944
|
+
$.$d[B](R), $.init(), this.$d = $.set(V, Math.min(this.$D, $.daysInMonth())).$d;
|
|
2945
|
+
} else B && this.$d[B](R);
|
|
2995
2946
|
return this.init(), this;
|
|
2996
|
-
},
|
|
2997
|
-
return this.clone().$set(
|
|
2998
|
-
},
|
|
2999
|
-
return this[S.p(
|
|
3000
|
-
},
|
|
3001
|
-
var
|
|
3002
|
-
|
|
3003
|
-
var
|
|
3004
|
-
var Z = b(
|
|
3005
|
-
return S.w(Z.date(Z.date() + Math.round(
|
|
2947
|
+
}, c.set = function(h, g) {
|
|
2948
|
+
return this.clone().$set(h, g);
|
|
2949
|
+
}, c.get = function(h) {
|
|
2950
|
+
return this[S.p(h)]();
|
|
2951
|
+
}, c.add = function(h, g) {
|
|
2952
|
+
var d, y = this;
|
|
2953
|
+
h = Number(h);
|
|
2954
|
+
var E = S.p(g), B = function(Y) {
|
|
2955
|
+
var Z = b(y);
|
|
2956
|
+
return S.w(Z.date(Z.date() + Math.round(Y * h)), y);
|
|
3006
2957
|
};
|
|
3007
|
-
if (
|
|
3008
|
-
if (
|
|
3009
|
-
if (
|
|
3010
|
-
if (
|
|
3011
|
-
var
|
|
3012
|
-
return S.w(
|
|
3013
|
-
},
|
|
3014
|
-
return this.add(-1 *
|
|
3015
|
-
},
|
|
3016
|
-
var g = this,
|
|
3017
|
-
if (!this.isValid()) return
|
|
3018
|
-
var
|
|
3019
|
-
return q && (q[re] || q(g,
|
|
3020
|
-
},
|
|
3021
|
-
return S.s(
|
|
3022
|
-
},
|
|
3023
|
-
var
|
|
3024
|
-
return
|
|
2958
|
+
if (E === m) return this.set(m, this.$M + h);
|
|
2959
|
+
if (E === v) return this.set(v, this.$y + h);
|
|
2960
|
+
if (E === o) return B(1);
|
|
2961
|
+
if (E === p) return B(7);
|
|
2962
|
+
var R = (d = {}, d[u] = s, d[l] = i, d[n] = t, d)[E] || 1, $ = this.$d.getTime() + h * R;
|
|
2963
|
+
return S.w($, this);
|
|
2964
|
+
}, c.subtract = function(h, g) {
|
|
2965
|
+
return this.add(-1 * h, g);
|
|
2966
|
+
}, c.format = function(h) {
|
|
2967
|
+
var g = this, d = this.$locale();
|
|
2968
|
+
if (!this.isValid()) return d.invalidDate || x;
|
|
2969
|
+
var y = h || "YYYY-MM-DDTHH:mm:ssZ", E = S.z(this), B = this.$H, R = this.$m, $ = this.$M, Y = d.weekdays, Z = d.months, me = d.meridiem, oe = function(q, re, _e, xe) {
|
|
2970
|
+
return q && (q[re] || q(g, y)) || _e[re].slice(0, xe);
|
|
2971
|
+
}, ke = function(q) {
|
|
2972
|
+
return S.s(B % 12 || 12, q, "0");
|
|
2973
|
+
}, he = me || function(q, re, _e) {
|
|
2974
|
+
var xe = q < 12 ? "AM" : "PM";
|
|
2975
|
+
return _e ? xe.toLowerCase() : xe;
|
|
3025
2976
|
};
|
|
3026
|
-
return
|
|
3027
|
-
return re || (function(
|
|
3028
|
-
switch (
|
|
2977
|
+
return y.replace(P, (function(q, re) {
|
|
2978
|
+
return re || (function(_e) {
|
|
2979
|
+
switch (_e) {
|
|
3029
2980
|
case "YY":
|
|
3030
2981
|
return String(g.$y).slice(-2);
|
|
3031
2982
|
case "YYYY":
|
|
3032
2983
|
return S.s(g.$y, 4, "0");
|
|
3033
2984
|
case "M":
|
|
3034
|
-
return
|
|
2985
|
+
return $ + 1;
|
|
3035
2986
|
case "MM":
|
|
3036
|
-
return S.s(
|
|
2987
|
+
return S.s($ + 1, 2, "0");
|
|
3037
2988
|
case "MMM":
|
|
3038
|
-
return
|
|
2989
|
+
return oe(d.monthsShort, $, Z, 3);
|
|
3039
2990
|
case "MMMM":
|
|
3040
|
-
return
|
|
2991
|
+
return oe(Z, $);
|
|
3041
2992
|
case "D":
|
|
3042
2993
|
return g.$D;
|
|
3043
2994
|
case "DD":
|
|
@@ -3045,27 +2996,27 @@ function ts() {
|
|
|
3045
2996
|
case "d":
|
|
3046
2997
|
return String(g.$W);
|
|
3047
2998
|
case "dd":
|
|
3048
|
-
return
|
|
2999
|
+
return oe(d.weekdaysMin, g.$W, Y, 2);
|
|
3049
3000
|
case "ddd":
|
|
3050
|
-
return
|
|
3001
|
+
return oe(d.weekdaysShort, g.$W, Y, 3);
|
|
3051
3002
|
case "dddd":
|
|
3052
|
-
return
|
|
3003
|
+
return Y[g.$W];
|
|
3053
3004
|
case "H":
|
|
3054
|
-
return String(
|
|
3005
|
+
return String(B);
|
|
3055
3006
|
case "HH":
|
|
3056
|
-
return S.s(
|
|
3007
|
+
return S.s(B, 2, "0");
|
|
3057
3008
|
case "h":
|
|
3058
|
-
return
|
|
3009
|
+
return ke(1);
|
|
3059
3010
|
case "hh":
|
|
3060
|
-
return
|
|
3011
|
+
return ke(2);
|
|
3061
3012
|
case "a":
|
|
3062
|
-
return
|
|
3013
|
+
return he(B, R, !0);
|
|
3063
3014
|
case "A":
|
|
3064
|
-
return
|
|
3015
|
+
return he(B, R, !1);
|
|
3065
3016
|
case "m":
|
|
3066
|
-
return String(
|
|
3017
|
+
return String(R);
|
|
3067
3018
|
case "mm":
|
|
3068
|
-
return S.s(
|
|
3019
|
+
return S.s(R, 2, "0");
|
|
3069
3020
|
case "s":
|
|
3070
3021
|
return String(g.$s);
|
|
3071
3022
|
case "ss":
|
|
@@ -3073,80 +3024,80 @@ function ts() {
|
|
|
3073
3024
|
case "SSS":
|
|
3074
3025
|
return S.s(g.$ms, 3, "0");
|
|
3075
3026
|
case "Z":
|
|
3076
|
-
return
|
|
3027
|
+
return E;
|
|
3077
3028
|
}
|
|
3078
3029
|
return null;
|
|
3079
|
-
})(q) ||
|
|
3030
|
+
})(q) || E.replace(":", "");
|
|
3080
3031
|
}));
|
|
3081
|
-
},
|
|
3032
|
+
}, c.utcOffset = function() {
|
|
3082
3033
|
return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
|
|
3083
|
-
},
|
|
3084
|
-
var
|
|
3085
|
-
return S.m(
|
|
3034
|
+
}, c.diff = function(h, g, d) {
|
|
3035
|
+
var y, E = this, B = S.p(g), R = b(h), $ = (R.utcOffset() - this.utcOffset()) * s, Y = this - R, Z = function() {
|
|
3036
|
+
return S.m(E, R);
|
|
3086
3037
|
};
|
|
3087
|
-
switch (
|
|
3038
|
+
switch (B) {
|
|
3088
3039
|
case v:
|
|
3089
|
-
|
|
3040
|
+
y = Z() / 12;
|
|
3090
3041
|
break;
|
|
3091
|
-
case
|
|
3092
|
-
|
|
3042
|
+
case m:
|
|
3043
|
+
y = Z();
|
|
3093
3044
|
break;
|
|
3094
|
-
case
|
|
3095
|
-
|
|
3045
|
+
case A:
|
|
3046
|
+
y = Z() / 3;
|
|
3096
3047
|
break;
|
|
3097
|
-
case
|
|
3098
|
-
|
|
3048
|
+
case p:
|
|
3049
|
+
y = (Y - $) / 6048e5;
|
|
3099
3050
|
break;
|
|
3100
3051
|
case o:
|
|
3101
|
-
|
|
3052
|
+
y = (Y - $) / 864e5;
|
|
3102
3053
|
break;
|
|
3103
3054
|
case l:
|
|
3104
|
-
|
|
3055
|
+
y = Y / i;
|
|
3105
3056
|
break;
|
|
3106
3057
|
case u:
|
|
3107
|
-
|
|
3058
|
+
y = Y / s;
|
|
3108
3059
|
break;
|
|
3109
3060
|
case n:
|
|
3110
|
-
|
|
3061
|
+
y = Y / t;
|
|
3111
3062
|
break;
|
|
3112
3063
|
default:
|
|
3113
|
-
|
|
3064
|
+
y = Y;
|
|
3114
3065
|
}
|
|
3115
|
-
return
|
|
3116
|
-
},
|
|
3117
|
-
return this.endOf(
|
|
3118
|
-
},
|
|
3066
|
+
return d ? y : S.a(y);
|
|
3067
|
+
}, c.daysInMonth = function() {
|
|
3068
|
+
return this.endOf(m).$D;
|
|
3069
|
+
}, c.$locale = function() {
|
|
3119
3070
|
return I[this.$L];
|
|
3120
|
-
},
|
|
3121
|
-
if (!
|
|
3122
|
-
var
|
|
3123
|
-
return
|
|
3124
|
-
},
|
|
3071
|
+
}, c.locale = function(h, g) {
|
|
3072
|
+
if (!h) return this.$L;
|
|
3073
|
+
var d = this.clone(), y = ee(h, g, !0);
|
|
3074
|
+
return y && (d.$L = y), d;
|
|
3075
|
+
}, c.clone = function() {
|
|
3125
3076
|
return S.w(this.$d, this);
|
|
3126
|
-
},
|
|
3077
|
+
}, c.toDate = function() {
|
|
3127
3078
|
return new Date(this.valueOf());
|
|
3128
|
-
},
|
|
3079
|
+
}, c.toJSON = function() {
|
|
3129
3080
|
return this.isValid() ? this.toISOString() : null;
|
|
3130
|
-
},
|
|
3081
|
+
}, c.toISOString = function() {
|
|
3131
3082
|
return this.$d.toISOString();
|
|
3132
|
-
},
|
|
3083
|
+
}, c.toString = function() {
|
|
3133
3084
|
return this.$d.toUTCString();
|
|
3134
|
-
},
|
|
3135
|
-
})(), je =
|
|
3136
|
-
return b.prototype = je, [["$ms",
|
|
3137
|
-
je[
|
|
3138
|
-
return this.$g(
|
|
3085
|
+
}, k;
|
|
3086
|
+
})(), je = Fe.prototype;
|
|
3087
|
+
return b.prototype = je, [["$ms", a], ["$s", n], ["$m", u], ["$H", l], ["$W", o], ["$M", m], ["$y", v], ["$D", V]].forEach((function(k) {
|
|
3088
|
+
je[k[1]] = function(c) {
|
|
3089
|
+
return this.$g(c, k[0], k[1]);
|
|
3139
3090
|
};
|
|
3140
|
-
})), b.extend = function(
|
|
3141
|
-
return
|
|
3142
|
-
}, b.locale =
|
|
3143
|
-
return b(1e3 *
|
|
3144
|
-
}, b.en = I[
|
|
3091
|
+
})), b.extend = function(k, c) {
|
|
3092
|
+
return k.$i || (k(c, Fe, b), k.$i = !0), b;
|
|
3093
|
+
}, b.locale = ee, b.isDayjs = L, b.unix = function(k) {
|
|
3094
|
+
return b(1e3 * k);
|
|
3095
|
+
}, b.en = I[C], b.Ls = I, b.p = {}, b;
|
|
3145
3096
|
}));
|
|
3146
|
-
})(
|
|
3097
|
+
})(Ve)), Ve.exports;
|
|
3147
3098
|
}
|
|
3148
|
-
var
|
|
3149
|
-
const J = /* @__PURE__ */
|
|
3099
|
+
var es = Qt();
|
|
3100
|
+
const J = /* @__PURE__ */ Xt(es), ts = ["id"], ss = { class: "date-picker-close is-flex is-justify-flex-end" }, is = { class: "date-picker-header is-flex is-justify-space-between is-align-center mb-2 content" }, as = { class: "calendar is-flex is-flex-wrap content" }, ns = ["title", "tabindex", "disabled", "onClick"], rs = ["id", "title", "tabindex", "disabled", "onClick"], us = ["title", "disabled", "onClick"], ls = /* @__PURE__ */ ve({
|
|
3150
3101
|
__name: "DatePicker",
|
|
3151
3102
|
props: {
|
|
3152
3103
|
id: {},
|
|
@@ -3158,65 +3109,65 @@ const J = /* @__PURE__ */ Qt(ss), as = ["id"], is = { class: "date-picker-close
|
|
|
3158
3109
|
},
|
|
3159
3110
|
emits: ["update:modelValue"],
|
|
3160
3111
|
setup(r, { expose: e, emit: t }) {
|
|
3161
|
-
const s = r,
|
|
3112
|
+
const s = r, i = t, a = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], n = W(J(s.initialValue === "" ? void 0 : s.initialValue)), u = W(n.value), l = N(() => {
|
|
3162
3113
|
const D = u.value.daysInMonth();
|
|
3163
|
-
return Array.from({ length: D }, (
|
|
3164
|
-
}), o =
|
|
3114
|
+
return Array.from({ length: D }, (O, C) => u.value.date(C + 1));
|
|
3115
|
+
}), o = N(() => Array.from(
|
|
3165
3116
|
{
|
|
3166
3117
|
length: u.value.date(1).day()
|
|
3167
3118
|
},
|
|
3168
|
-
(
|
|
3169
|
-
).reverse()),
|
|
3119
|
+
(O, C) => u.value.date(-C)
|
|
3120
|
+
).reverse()), p = N(() => Array.from(
|
|
3170
3121
|
{
|
|
3171
3122
|
length: 6 - u.value.endOf("month").day()
|
|
3172
3123
|
},
|
|
3173
|
-
(
|
|
3174
|
-
)),
|
|
3175
|
-
n.value = D,
|
|
3124
|
+
(O, C) => u.value.endOf("month").add(C + 1, "day")
|
|
3125
|
+
)), m = (D) => !rt(D, s.min, s.max), A = (D) => {
|
|
3126
|
+
n.value = D, i("update:modelValue", n.value.format(s.format)), s.close();
|
|
3176
3127
|
}, v = (D) => {
|
|
3177
|
-
|
|
3178
|
-
},
|
|
3128
|
+
i("update:modelValue", D), D ? (n.value = J(D, s.format), u.value = n.value) : (n.value = J(), u.value = J());
|
|
3129
|
+
}, V = () => {
|
|
3179
3130
|
u.value = u.value.add(1, "month");
|
|
3180
|
-
},
|
|
3131
|
+
}, x = () => {
|
|
3181
3132
|
u.value = u.value.subtract(1, "month");
|
|
3182
|
-
},
|
|
3183
|
-
const
|
|
3184
|
-
|
|
3185
|
-
},
|
|
3186
|
-
const
|
|
3187
|
-
|
|
3133
|
+
}, M = (D) => {
|
|
3134
|
+
const O = document.querySelector("#selected-day");
|
|
3135
|
+
O instanceof HTMLButtonElement && (D.preventDefault(), O.focus());
|
|
3136
|
+
}, P = (D) => {
|
|
3137
|
+
const O = document.querySelector(`#${s.id} button`);
|
|
3138
|
+
O instanceof HTMLButtonElement && (D.preventDefault(), O.focus());
|
|
3188
3139
|
}, ne = (D) => {
|
|
3189
|
-
if (D.key === "Tab" && !D.shiftKey &&
|
|
3140
|
+
if (D.key === "Tab" && !D.shiftKey && P(D), ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", "Home", "End"].includes(D.key)) {
|
|
3190
3141
|
D.preventDefault();
|
|
3191
|
-
const
|
|
3192
|
-
if (
|
|
3142
|
+
const C = document.activeElement;
|
|
3143
|
+
if (C instanceof HTMLButtonElement) {
|
|
3193
3144
|
const I = Array.from(document.querySelectorAll(".calendar button")).filter(
|
|
3194
|
-
(
|
|
3195
|
-
),
|
|
3196
|
-
let
|
|
3145
|
+
(ee) => !ee.disabled
|
|
3146
|
+
), U = I.indexOf(C);
|
|
3147
|
+
let L = U;
|
|
3197
3148
|
switch (D.key) {
|
|
3198
3149
|
case "ArrowUp":
|
|
3199
|
-
|
|
3150
|
+
L = U - 7;
|
|
3200
3151
|
break;
|
|
3201
3152
|
case "ArrowDown":
|
|
3202
|
-
|
|
3153
|
+
L = U + 7;
|
|
3203
3154
|
break;
|
|
3204
3155
|
case "ArrowLeft":
|
|
3205
|
-
|
|
3156
|
+
L = U - 1;
|
|
3206
3157
|
break;
|
|
3207
3158
|
case "ArrowRight":
|
|
3208
|
-
|
|
3159
|
+
L = U + 1;
|
|
3209
3160
|
break;
|
|
3210
3161
|
case "Home":
|
|
3211
|
-
|
|
3162
|
+
L = 0;
|
|
3212
3163
|
break;
|
|
3213
3164
|
case "End":
|
|
3214
|
-
|
|
3165
|
+
L = I.length - 1;
|
|
3215
3166
|
break;
|
|
3216
3167
|
}
|
|
3217
|
-
|
|
3168
|
+
L >= 0 && L < I.length ? I[L].focus() : L < 0 ? (x(), qe(() => {
|
|
3218
3169
|
document.querySelector(".calendar > span:last-of-type button:last-of-type")?.focus();
|
|
3219
|
-
})) :
|
|
3170
|
+
})) : L >= I.length && (V(), qe(() => {
|
|
3220
3171
|
document.querySelector(".calendar button")?.focus();
|
|
3221
3172
|
}));
|
|
3222
3173
|
}
|
|
@@ -3224,89 +3175,89 @@ const J = /* @__PURE__ */ Qt(ss), as = ["id"], is = { class: "date-picker-close
|
|
|
3224
3175
|
};
|
|
3225
3176
|
return e({
|
|
3226
3177
|
update: v,
|
|
3227
|
-
focusDatePicker:
|
|
3228
|
-
}), (D,
|
|
3178
|
+
focusDatePicker: M
|
|
3179
|
+
}), (D, O) => (w(), H("div", {
|
|
3229
3180
|
id: r.id,
|
|
3230
3181
|
class: "date-picker"
|
|
3231
3182
|
}, [
|
|
3232
|
-
|
|
3233
|
-
|
|
3183
|
+
K("div", ss, [
|
|
3184
|
+
fe(T(Gt), {
|
|
3234
3185
|
id: `${r.id}-date-picker-toggle`,
|
|
3235
3186
|
variant: "standard",
|
|
3236
3187
|
size: "extra-small",
|
|
3237
3188
|
"icon-only": "",
|
|
3238
|
-
"icon-definition":
|
|
3189
|
+
"icon-definition": T(Wt),
|
|
3239
3190
|
"aria-label": "close date picker",
|
|
3240
|
-
onClick:
|
|
3191
|
+
onClick: ce(r.close, ["prevent"])
|
|
3241
3192
|
}, null, 8, ["id", "icon-definition", "onClick"])
|
|
3242
3193
|
]),
|
|
3243
|
-
|
|
3244
|
-
|
|
3194
|
+
K("div", is, [
|
|
3195
|
+
K("button", {
|
|
3245
3196
|
class: "phila-button icon-button--secondary is-extra-small",
|
|
3246
|
-
onClick:
|
|
3197
|
+
onClick: ce(x, ["prevent"])
|
|
3247
3198
|
}, " Prev "),
|
|
3248
|
-
|
|
3249
|
-
|
|
3199
|
+
K("span", null, X(u.value.format("MMMM YYYY")), 1),
|
|
3200
|
+
K("button", {
|
|
3250
3201
|
class: "phila-button is-extra-small",
|
|
3251
|
-
onClick:
|
|
3202
|
+
onClick: ce(V, ["prevent"])
|
|
3252
3203
|
}, "Next")
|
|
3253
3204
|
]),
|
|
3254
|
-
|
|
3255
|
-
(w(),
|
|
3256
|
-
key:
|
|
3205
|
+
K("div", as, [
|
|
3206
|
+
(w(), H(De, null, Se(a, (C) => K("span", {
|
|
3207
|
+
key: C,
|
|
3257
3208
|
class: "calendar-day is-5 has-text-weight-bold"
|
|
3258
|
-
}, X(
|
|
3259
|
-
(w(!0),
|
|
3260
|
-
key: "day-in-previous-month-" +
|
|
3209
|
+
}, X(C), 1)), 64)),
|
|
3210
|
+
(w(!0), H(De, null, Se(o.value, (C, I) => (w(), H("span", {
|
|
3211
|
+
key: "day-in-previous-month-" + C.date(),
|
|
3261
3212
|
class: "calendar-day outside-month is-5"
|
|
3262
3213
|
}, [
|
|
3263
|
-
|
|
3214
|
+
K("button", {
|
|
3264
3215
|
class: "phila-button is-extra-small p-2",
|
|
3265
|
-
title: `${
|
|
3216
|
+
title: `${C.format("MMMM D, YYYY")}`,
|
|
3266
3217
|
tabindex: I === 0 ? 0 : -1,
|
|
3267
|
-
disabled:
|
|
3268
|
-
onKeydown:
|
|
3269
|
-
onClick:
|
|
3270
|
-
}, X(
|
|
3218
|
+
disabled: m(C),
|
|
3219
|
+
onKeydown: O[0] || (O[0] = (U) => ne(U)),
|
|
3220
|
+
onClick: ce((U) => A(C), ["prevent"])
|
|
3221
|
+
}, X(C.date()), 41, ns)
|
|
3271
3222
|
]))), 128)),
|
|
3272
|
-
(w(!0),
|
|
3273
|
-
key: `day-in-current-month-${
|
|
3223
|
+
(w(!0), H(De, null, Se(l.value, (C, I) => (w(), H("span", {
|
|
3224
|
+
key: `day-in-current-month-${C.date()}`,
|
|
3274
3225
|
class: "calendar-day is-5"
|
|
3275
3226
|
}, [
|
|
3276
|
-
|
|
3277
|
-
id:
|
|
3227
|
+
K("button", {
|
|
3228
|
+
id: C.isSame(n.value, "day") ? "selected-day" : void 0,
|
|
3278
3229
|
class: Ye(["phila-button is-extra-small p-2", {
|
|
3279
|
-
active:
|
|
3230
|
+
active: C.isSame(n.value, "day")
|
|
3280
3231
|
}]),
|
|
3281
|
-
title:
|
|
3282
|
-
tabindex:
|
|
3283
|
-
disabled:
|
|
3284
|
-
onKeydown:
|
|
3285
|
-
onClick:
|
|
3286
|
-
}, X(
|
|
3232
|
+
title: C.format("MMMM D, YYYY"),
|
|
3233
|
+
tabindex: C.isSame(n.value, "day") || C.month() !== n.value.month() && I === 0 ? 0 : -1,
|
|
3234
|
+
disabled: m(C),
|
|
3235
|
+
onKeydown: O[1] || (O[1] = (U) => ne(U)),
|
|
3236
|
+
onClick: ce(() => A(C), ["prevent"])
|
|
3237
|
+
}, X(C.date()), 43, rs)
|
|
3287
3238
|
]))), 128)),
|
|
3288
|
-
(w(!0),
|
|
3289
|
-
key: "day-in-next-month-" +
|
|
3239
|
+
(w(!0), H(De, null, Se(p.value, (C) => (w(), H("span", {
|
|
3240
|
+
key: "day-in-next-month-" + C.date(),
|
|
3290
3241
|
class: "calendar-day outside-month is-5"
|
|
3291
3242
|
}, [
|
|
3292
|
-
|
|
3243
|
+
K("button", {
|
|
3293
3244
|
class: "phila-button is-extra-small p-2",
|
|
3294
|
-
title: `${
|
|
3245
|
+
title: `${C.format("MMMM D, YYYY")}`,
|
|
3295
3246
|
tabindex: "-1",
|
|
3296
|
-
disabled:
|
|
3297
|
-
onKeydown:
|
|
3298
|
-
onClick:
|
|
3299
|
-
}, X(
|
|
3247
|
+
disabled: m(C),
|
|
3248
|
+
onKeydown: O[2] || (O[2] = (I) => ne(I)),
|
|
3249
|
+
onClick: ce((I) => A(C), ["prevent"])
|
|
3250
|
+
}, X(C.date()), 41, us)
|
|
3300
3251
|
]))), 128))
|
|
3301
3252
|
])
|
|
3302
|
-
], 8,
|
|
3253
|
+
], 8, ts));
|
|
3303
3254
|
}
|
|
3304
|
-
}),
|
|
3255
|
+
}), os = (r, e) => {
|
|
3305
3256
|
const t = r.__vccOpts || r;
|
|
3306
|
-
for (const [s,
|
|
3307
|
-
t[s] =
|
|
3257
|
+
for (const [s, i] of e)
|
|
3258
|
+
t[s] = i;
|
|
3308
3259
|
return t;
|
|
3309
|
-
},
|
|
3260
|
+
}, hs = /* @__PURE__ */ os(ls, [["__scopeId", "data-v-225c8851"]]), ds = { key: 0 }, fs = /* @__PURE__ */ ve({
|
|
3310
3261
|
inheritAttrs: !1,
|
|
3311
3262
|
__name: "DateField",
|
|
3312
3263
|
props: {
|
|
@@ -3322,9 +3273,16 @@ const J = /* @__PURE__ */ Qt(ss), as = ["id"], is = { class: "date-picker-close
|
|
|
3322
3273
|
min: {},
|
|
3323
3274
|
max: {},
|
|
3324
3275
|
className: {},
|
|
3276
|
+
id: { default: () => mt("phila-date-field-") },
|
|
3277
|
+
group: {},
|
|
3278
|
+
blurHide: { type: Boolean },
|
|
3279
|
+
showSingle: { type: Boolean, default: !0 },
|
|
3280
|
+
mouseOverToggle: { type: Boolean },
|
|
3281
|
+
outsideClickHide: { type: Boolean, default: !0 },
|
|
3282
|
+
escapeKeyHide: { type: Boolean, default: !0 },
|
|
3283
|
+
visibleOnMount: { type: Boolean },
|
|
3325
3284
|
modelValue: {},
|
|
3326
3285
|
label: {},
|
|
3327
|
-
id: { default: () => gt("phila-date-field-") },
|
|
3328
3286
|
supportingText: {},
|
|
3329
3287
|
placeholder: {},
|
|
3330
3288
|
leadingIcon: {},
|
|
@@ -3332,73 +3290,78 @@ const J = /* @__PURE__ */ Qt(ss), as = ["id"], is = { class: "date-picker-close
|
|
|
3332
3290
|
error: {}
|
|
3333
3291
|
},
|
|
3334
3292
|
setup(r) {
|
|
3335
|
-
const e = r,
|
|
3336
|
-
a.value = o;
|
|
3337
|
-
}, l = (o) => {
|
|
3338
|
-
(e.min || e.max) && (nt(o, e.min, e.max) ? i.value = "" : i.value = "Selected date should be between " + J(e.min).format(e.format) + " and " + J(e.max).format(e.format)), s.value?.update(o);
|
|
3339
|
-
};
|
|
3340
|
-
return (o, h) => r.datePicker ? (w(), ae(x(Gt), {
|
|
3341
|
-
key: 0,
|
|
3293
|
+
const e = r, { setVisibility: t, isVisible: s, toggleProps: i } = gt({
|
|
3342
3294
|
id: `${e.id}-date-picker`,
|
|
3343
|
-
group: "date-picker",
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
}, {
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
"
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
]),
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3295
|
+
group: e.group ?? "date-picker",
|
|
3296
|
+
outsideClickHide: e.outsideClickHide,
|
|
3297
|
+
escapeKeyHide: e.escapeKeyHide,
|
|
3298
|
+
showSingle: e.showSingle
|
|
3299
|
+
}), a = N(() => s()), n = Je(), u = Ke("datePicker"), l = Ke("text-field"), o = W(e.modelValue), p = W(""), m = N(() => Ae("default-class", e.className)), A = (x) => {
|
|
3300
|
+
o.value = x;
|
|
3301
|
+
}, v = (x) => {
|
|
3302
|
+
(e.min || e.max) && (rt(x, e.min, e.max) ? p.value = "" : p.value = "Selected date should be between " + J(e.min).format(e.format) + " and " + J(e.max).format(e.format)), u.value?.update(x);
|
|
3303
|
+
}, V = N(() => a.value ? null : () => t(!0));
|
|
3304
|
+
return se(
|
|
3305
|
+
() => a.value,
|
|
3306
|
+
(x) => {
|
|
3307
|
+
if (!x) {
|
|
3308
|
+
const M = l.value?.$el.querySelector("input");
|
|
3309
|
+
M && M.focus();
|
|
3310
|
+
}
|
|
3311
|
+
},
|
|
3312
|
+
{ immediate: !0 }
|
|
3313
|
+
), (x, M) => r.datePicker ? (w(), H("div", ds, [
|
|
3314
|
+
fe(T(We), ie({ ...T(n), ...e }, {
|
|
3315
|
+
ref: "text-field",
|
|
3316
|
+
modelValue: o.value,
|
|
3317
|
+
"onUpdate:modelValue": [
|
|
3318
|
+
M[0] || (M[0] = (P) => o.value = P),
|
|
3319
|
+
A
|
|
3320
|
+
],
|
|
3321
|
+
class: m.value,
|
|
3322
|
+
"aria-controls": `${e.id}-date-picker`,
|
|
3323
|
+
"trailing-icon": "fa-solid fa-calendar",
|
|
3324
|
+
min: void 0,
|
|
3325
|
+
max: void 0,
|
|
3326
|
+
error: p.value || e.error,
|
|
3327
|
+
"data-toggle": T(i)?.["data-toggle"],
|
|
3328
|
+
onFocus: V.value,
|
|
3329
|
+
onClick: V.value,
|
|
3330
|
+
onKeydown: M[1] || (M[1] = ft((P) => u.value?.focusDatePicker(P), ["tab"])),
|
|
3331
|
+
onComplete: v
|
|
3332
|
+
}), null, 16, ["modelValue", "class", "aria-controls", "error", "data-toggle", "onFocus", "onClick"]),
|
|
3333
|
+
a.value ? (w(), ue(hs, ie({
|
|
3334
|
+
key: 0,
|
|
3335
|
+
id: `${e.id}-date-picker`,
|
|
3336
|
+
ref: "datePicker"
|
|
3337
|
+
}, e.datePickerOptions, {
|
|
3338
|
+
"initial-value": o.value,
|
|
3339
|
+
min: e.min,
|
|
3340
|
+
max: e.max,
|
|
3341
|
+
format: e.format,
|
|
3342
|
+
close: () => T(t)(!1),
|
|
3343
|
+
"onUpdate:modelValue": A
|
|
3344
|
+
}), null, 16, ["id", "initial-value", "min", "max", "format", "close"])) : de("", !0)
|
|
3345
|
+
])) : (w(), ue(T(We), ie({ key: 1 }, { ...T(n), ...e }, {
|
|
3346
|
+
modelValue: o.value,
|
|
3384
3347
|
"onUpdate:modelValue": [
|
|
3385
|
-
|
|
3386
|
-
|
|
3348
|
+
M[2] || (M[2] = (P) => o.value = P),
|
|
3349
|
+
A
|
|
3387
3350
|
],
|
|
3388
|
-
class:
|
|
3351
|
+
class: m.value,
|
|
3389
3352
|
label: "Date field",
|
|
3390
3353
|
"trailing-icon": "fa-solid fa-calendar",
|
|
3391
|
-
errors:
|
|
3354
|
+
errors: p.value || e.error,
|
|
3392
3355
|
min: void 0,
|
|
3393
3356
|
max: void 0
|
|
3394
3357
|
}), null, 16, ["modelValue", "class", "errors"]));
|
|
3395
3358
|
}
|
|
3396
|
-
}),
|
|
3359
|
+
}), rt = (r, e, t) => {
|
|
3397
3360
|
typeof r == "string" && (r = J(r));
|
|
3398
|
-
const s = e ? J(e) : null,
|
|
3399
|
-
return !(s && r.isBefore(s, "day") ||
|
|
3361
|
+
const s = e ? J(e) : null, i = t ? J(t) : null;
|
|
3362
|
+
return !(s && r.isBefore(s, "day") || i && r.isAfter(i, "day"));
|
|
3400
3363
|
};
|
|
3401
3364
|
export {
|
|
3402
|
-
|
|
3403
|
-
|
|
3365
|
+
fs as DateField,
|
|
3366
|
+
rt as isInDateRange
|
|
3404
3367
|
};
|