@phila/phila-ui-date-field 0.0.9 → 0.1.0-beta.10
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.css +1 -1
- 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 +898 -952
- package/package.json +5 -6
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { defineComponent as ve, toRef as
|
|
2
|
-
import { cn as
|
|
3
|
-
import
|
|
1
|
+
import { defineComponent as ve, toRef as Ce, watch as se, h as ot, useAttrs as Qe, computed as N, ref as W, createElementBlock as H, openBlock as I, normalizeClass as Ye, createCommentVNode as de, createElementVNode as K, toDisplayString as X, withModifiers as ce, createBlock as ue, renderSlot as ye, unref as w, withDirectives as ht, mergeProps as ie, vModelDynamic as dt, createVNode as fe, createTextVNode as Ee, isRef as ct, readonly as pt, onMounted as ft, onUnmounted as mt, withCtx as ge, normalizeProps as Be, guardReactiveProps as we, Fragment as De, renderList as Se, nextTick as qe, useTemplateRef as Ke, withKeys as gt } from "vue";
|
|
2
|
+
import { cn as Ae, Icon as Ne, BaseLink as et, ActionContent as Ie, generateRandomId as vt, useVisibility as kt } from "@phila/phila-ui-core";
|
|
3
|
+
import { IconClose as tt, IconCircleExclamation as _t, IconCalendar as Ge } from "@phila/phila-ui-core/icons";
|
|
4
|
+
import './index.css';const Ct = ["disabled"], yt = /* @__PURE__ */ ve({
|
|
4
5
|
inheritAttrs: !1,
|
|
5
6
|
__name: "PhlButton",
|
|
6
7
|
props: {
|
|
@@ -16,20 +17,19 @@ import './index.css';const vt = ["disabled"], kt = /* @__PURE__ */ ve({
|
|
|
16
17
|
iconRight: { type: Boolean },
|
|
17
18
|
text: {},
|
|
18
19
|
className: {},
|
|
19
|
-
|
|
20
|
-
iconClass: {},
|
|
20
|
+
icon: {},
|
|
21
21
|
src: {},
|
|
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,10 +39,9 @@ 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
|
-
|
|
45
|
-
iconClass: e.iconClass,
|
|
44
|
+
icon: e.icon,
|
|
46
45
|
src: e.src,
|
|
47
46
|
iconRight: e.iconRight,
|
|
48
47
|
iconOnly: e.iconOnly,
|
|
@@ -50,70 +49,61 @@ import './index.css';const vt = ["disabled"], kt = /* @__PURE__ */ ve({
|
|
|
50
49
|
size: e.size
|
|
51
50
|
})
|
|
52
51
|
);
|
|
53
|
-
return (n, u) => t(e) ? (
|
|
54
|
-
default:
|
|
55
|
-
|
|
56
|
-
default:
|
|
57
|
-
|
|
58
|
-
|
|
52
|
+
return (n, u) => t(e) ? (I(), ue(w(et), ie({ key: 0 }, { ...i.value, ...n.$attrs }, { role: "button" }), {
|
|
53
|
+
default: ge(() => [
|
|
54
|
+
fe(w(Ie), Be(we(a.value)), {
|
|
55
|
+
default: ge(() => [
|
|
56
|
+
ye(n.$slots, "default", {}, () => [
|
|
57
|
+
Ee(X(e.text), 1)
|
|
59
58
|
])
|
|
60
59
|
]),
|
|
61
60
|
_: 3
|
|
62
61
|
}, 16)
|
|
63
62
|
]),
|
|
64
63
|
_: 3
|
|
65
|
-
}, 16)) : (
|
|
64
|
+
}, 16)) : (I(), H("button", ie({
|
|
66
65
|
key: 1,
|
|
67
66
|
type: "button",
|
|
68
67
|
disabled: e.disabled,
|
|
69
68
|
class: s.value
|
|
70
69
|
}, n.$attrs), [
|
|
71
|
-
|
|
72
|
-
default:
|
|
73
|
-
|
|
74
|
-
|
|
70
|
+
fe(w(Ie), Be(we(a.value)), {
|
|
71
|
+
default: ge(() => [
|
|
72
|
+
ye(n.$slots, "default", {}, () => [
|
|
73
|
+
Ee(X(e.text), 1)
|
|
75
74
|
])
|
|
76
75
|
]),
|
|
77
76
|
_: 3
|
|
78
77
|
}, 16)
|
|
79
|
-
], 16,
|
|
78
|
+
], 16, Ct));
|
|
80
79
|
}
|
|
81
80
|
});
|
|
82
|
-
|
|
83
|
-
prefix: "fas",
|
|
84
|
-
iconName: "circle-exclamation",
|
|
85
|
-
icon: [512, 512, ["exclamation-circle"], "f06a", "M256 512a256 256 0 1 1 0-512 256 256 0 1 1 0 512zm0-192a32 32 0 1 0 0 64 32 32 0 1 0 0-64zm0-192c-18.2 0-32.7 15.5-31.4 33.7l7.4 104c.9 12.6 11.4 22.3 23.9 22.3 12.6 0 23-9.7 23.9-22.3l7.4-104c1.3-18.2-13.1-33.7-31.4-33.7z"]
|
|
86
|
-
}, Ct = _t, yt = {
|
|
87
|
-
prefix: "fas",
|
|
88
|
-
iconName: "xmark",
|
|
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
|
-
}, Et = yt;
|
|
91
|
-
function he(r) {
|
|
81
|
+
function le(r) {
|
|
92
82
|
return typeof r == "string" || r instanceof String;
|
|
93
83
|
}
|
|
94
|
-
function
|
|
84
|
+
function Ze(r) {
|
|
95
85
|
var e;
|
|
96
86
|
return typeof r == "object" && r != null && (r == null || (e = r.constructor) == null ? void 0 : e.name) === "Object";
|
|
97
87
|
}
|
|
98
|
-
function
|
|
99
|
-
return Array.isArray(e) ?
|
|
100
|
-
let [
|
|
101
|
-
return e(
|
|
88
|
+
function st(r, e) {
|
|
89
|
+
return Array.isArray(e) ? st(r, (t, s) => e.includes(s)) : Object.entries(r).reduce((t, s) => {
|
|
90
|
+
let [i, a] = s;
|
|
91
|
+
return e(a, i) && (t[i] = a), t;
|
|
102
92
|
}, {});
|
|
103
93
|
}
|
|
104
|
-
const
|
|
94
|
+
const f = {
|
|
105
95
|
NONE: "NONE",
|
|
106
96
|
LEFT: "LEFT",
|
|
107
97
|
FORCE_LEFT: "FORCE_LEFT",
|
|
108
98
|
RIGHT: "RIGHT",
|
|
109
99
|
FORCE_RIGHT: "FORCE_RIGHT"
|
|
110
100
|
};
|
|
111
|
-
function
|
|
101
|
+
function Et(r) {
|
|
112
102
|
switch (r) {
|
|
113
|
-
case
|
|
114
|
-
return
|
|
115
|
-
case
|
|
116
|
-
return
|
|
103
|
+
case f.LEFT:
|
|
104
|
+
return f.FORCE_LEFT;
|
|
105
|
+
case f.RIGHT:
|
|
106
|
+
return f.FORCE_RIGHT;
|
|
117
107
|
default:
|
|
118
108
|
return r;
|
|
119
109
|
}
|
|
@@ -124,29 +114,29 @@ function Ue(r) {
|
|
|
124
114
|
function Te(r, e) {
|
|
125
115
|
if (e === r) return !0;
|
|
126
116
|
const t = Array.isArray(e), s = Array.isArray(r);
|
|
127
|
-
let
|
|
117
|
+
let i;
|
|
128
118
|
if (t && s) {
|
|
129
119
|
if (e.length != r.length) return !1;
|
|
130
|
-
for (
|
|
120
|
+
for (i = 0; i < e.length; i++) if (!Te(e[i], r[i])) return !1;
|
|
131
121
|
return !0;
|
|
132
122
|
}
|
|
133
123
|
if (t != s) return !1;
|
|
134
124
|
if (e && r && typeof e == "object" && typeof r == "object") {
|
|
135
|
-
const
|
|
136
|
-
if (
|
|
137
|
-
if (
|
|
125
|
+
const a = e instanceof Date, n = r instanceof Date;
|
|
126
|
+
if (a && n) return e.getTime() == r.getTime();
|
|
127
|
+
if (a != n) return !1;
|
|
138
128
|
const u = e instanceof RegExp, l = r instanceof RegExp;
|
|
139
129
|
if (u && l) return e.toString() == r.toString();
|
|
140
130
|
if (u != l) return !1;
|
|
141
131
|
const o = Object.keys(e);
|
|
142
|
-
for (
|
|
143
|
-
for (
|
|
132
|
+
for (i = 0; i < o.length; i++) if (!Object.prototype.hasOwnProperty.call(r, o[i])) return !1;
|
|
133
|
+
for (i = 0; i < o.length; i++) if (!Te(r[o[i]], e[o[i]])) return !1;
|
|
144
134
|
return !0;
|
|
145
135
|
} else if (e && r && typeof e == "function" && typeof r == "function")
|
|
146
136
|
return e.toString() === r.toString();
|
|
147
137
|
return !1;
|
|
148
138
|
}
|
|
149
|
-
class
|
|
139
|
+
class At {
|
|
150
140
|
/** Current input value */
|
|
151
141
|
/** Current cursor position */
|
|
152
142
|
/** Old input value */
|
|
@@ -189,53 +179,53 @@ class bt {
|
|
|
189
179
|
}
|
|
190
180
|
/** Remove direction */
|
|
191
181
|
get removeDirection() {
|
|
192
|
-
return !this.removedCount || this.insertedCount ?
|
|
193
|
-
this.oldSelection.end === this.oldSelection.start ?
|
|
182
|
+
return !this.removedCount || this.insertedCount ? f.NONE : (this.oldSelection.end === this.cursorPos || this.oldSelection.start === this.cursorPos) && // if not range removed (event with backspace)
|
|
183
|
+
this.oldSelection.end === this.oldSelection.start ? f.RIGHT : f.LEFT;
|
|
194
184
|
}
|
|
195
185
|
}
|
|
196
|
-
function
|
|
197
|
-
return new
|
|
186
|
+
function _(r, e) {
|
|
187
|
+
return new _.InputMask(r, e);
|
|
198
188
|
}
|
|
199
|
-
function
|
|
189
|
+
function it(r) {
|
|
200
190
|
if (r == null) throw new Error("mask property should be defined");
|
|
201
|
-
return r instanceof RegExp ?
|
|
191
|
+
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
192
|
}
|
|
203
|
-
function
|
|
193
|
+
function be(r) {
|
|
204
194
|
if (!r) throw new Error("Options in not defined");
|
|
205
|
-
if (
|
|
206
|
-
if (r.prototype instanceof
|
|
195
|
+
if (_.Masked) {
|
|
196
|
+
if (r.prototype instanceof _.Masked) return {
|
|
207
197
|
mask: r
|
|
208
198
|
};
|
|
209
199
|
const {
|
|
210
200
|
mask: e = void 0,
|
|
211
201
|
...t
|
|
212
|
-
} = r instanceof
|
|
202
|
+
} = r instanceof _.Masked ? {
|
|
213
203
|
mask: r
|
|
214
|
-
} :
|
|
204
|
+
} : Ze(r) && r.mask instanceof _.Masked ? r : {};
|
|
215
205
|
if (e) {
|
|
216
206
|
const s = e.mask;
|
|
217
207
|
return {
|
|
218
|
-
...
|
|
208
|
+
...st(e, (i, a) => !a.startsWith("_")),
|
|
219
209
|
mask: e.constructor,
|
|
220
210
|
_mask: s,
|
|
221
211
|
...t
|
|
222
212
|
};
|
|
223
213
|
}
|
|
224
214
|
}
|
|
225
|
-
return
|
|
215
|
+
return Ze(r) ? {
|
|
226
216
|
...r
|
|
227
217
|
} : {
|
|
228
218
|
mask: r
|
|
229
219
|
};
|
|
230
220
|
}
|
|
231
|
-
function
|
|
232
|
-
if (
|
|
233
|
-
const e =
|
|
221
|
+
function ae(r) {
|
|
222
|
+
if (_.Masked && r instanceof _.Masked) return r;
|
|
223
|
+
const e = be(r), t = it(e.mask);
|
|
234
224
|
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
225
|
return e.mask === t && delete e.mask, e._mask && (e.mask = e._mask, delete e._mask), new t(e);
|
|
236
226
|
}
|
|
237
|
-
|
|
238
|
-
class
|
|
227
|
+
_.createMask = ae;
|
|
228
|
+
class je {
|
|
239
229
|
/** */
|
|
240
230
|
/** */
|
|
241
231
|
/** */
|
|
@@ -273,9 +263,9 @@ class He {
|
|
|
273
263
|
/** */
|
|
274
264
|
/** */
|
|
275
265
|
}
|
|
276
|
-
|
|
277
|
-
const
|
|
278
|
-
class Re extends
|
|
266
|
+
_.MaskElement = je;
|
|
267
|
+
const We = 90, bt = 89;
|
|
268
|
+
class Re extends je {
|
|
279
269
|
/** HTMLElement to use mask on */
|
|
280
270
|
constructor(e) {
|
|
281
271
|
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 +283,9 @@ class Re extends He {
|
|
|
293
283
|
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
284
|
}
|
|
295
285
|
_onKeydown(e) {
|
|
296
|
-
if (this._handlers.redo && (e.keyCode ===
|
|
286
|
+
if (this._handlers.redo && (e.keyCode === We && e.shiftKey && (e.metaKey || e.ctrlKey) || e.keyCode === bt && e.ctrlKey))
|
|
297
287
|
return e.preventDefault(), this._handlers.redo(e);
|
|
298
|
-
if (this._handlers.undo && e.keyCode ===
|
|
288
|
+
if (this._handlers.undo && e.keyCode === We && (e.metaKey || e.ctrlKey))
|
|
299
289
|
return e.preventDefault(), this._handlers.undo(e);
|
|
300
290
|
e.isComposing || this._handlers.selectionChange(e);
|
|
301
291
|
}
|
|
@@ -316,8 +306,8 @@ class Re extends He {
|
|
|
316
306
|
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
307
|
}
|
|
318
308
|
}
|
|
319
|
-
|
|
320
|
-
class
|
|
309
|
+
_.HTMLMaskElement = Re;
|
|
310
|
+
class Ft extends Re {
|
|
321
311
|
/** InputElement to use mask on */
|
|
322
312
|
constructor(e) {
|
|
323
313
|
super(e), this.input = e;
|
|
@@ -341,25 +331,25 @@ class xt extends Re {
|
|
|
341
331
|
this.input.value = e;
|
|
342
332
|
}
|
|
343
333
|
}
|
|
344
|
-
|
|
345
|
-
class
|
|
334
|
+
_.HTMLMaskElement = Re;
|
|
335
|
+
class at extends Re {
|
|
346
336
|
/** Returns HTMLElement selection start */
|
|
347
337
|
get _unsafeSelectionStart() {
|
|
348
|
-
const e = this.rootElement, t = e.getSelection && e.getSelection(), s = t && t.anchorOffset,
|
|
349
|
-
return
|
|
338
|
+
const e = this.rootElement, t = e.getSelection && e.getSelection(), s = t && t.anchorOffset, i = t && t.focusOffset;
|
|
339
|
+
return i == null || s == null || s < i ? s : i;
|
|
350
340
|
}
|
|
351
341
|
/** Returns HTMLElement selection end */
|
|
352
342
|
get _unsafeSelectionEnd() {
|
|
353
|
-
const e = this.rootElement, t = e.getSelection && e.getSelection(), s = t && t.anchorOffset,
|
|
354
|
-
return
|
|
343
|
+
const e = this.rootElement, t = e.getSelection && e.getSelection(), s = t && t.anchorOffset, i = t && t.focusOffset;
|
|
344
|
+
return i == null || s == null || s > i ? s : i;
|
|
355
345
|
}
|
|
356
346
|
/** Sets HTMLElement selection */
|
|
357
347
|
_unsafeSelect(e, t) {
|
|
358
348
|
if (!this.rootElement.createRange) return;
|
|
359
349
|
const s = this.rootElement.createRange();
|
|
360
350
|
s.setStart(this.input.firstChild || this.input, e), s.setEnd(this.input.lastChild || this.input, t);
|
|
361
|
-
const
|
|
362
|
-
|
|
351
|
+
const i = this.rootElement, a = i.getSelection && i.getSelection();
|
|
352
|
+
a && (a.removeAllRanges(), a.addRange(s));
|
|
363
353
|
}
|
|
364
354
|
/** HTMLElement value */
|
|
365
355
|
get value() {
|
|
@@ -369,7 +359,7 @@ class tt extends Re {
|
|
|
369
359
|
this.input.textContent = e;
|
|
370
360
|
}
|
|
371
361
|
}
|
|
372
|
-
|
|
362
|
+
_.HTMLContenteditableMaskElement = at;
|
|
373
363
|
class Pe {
|
|
374
364
|
constructor() {
|
|
375
365
|
this.states = [], this.currentIndex = 0;
|
|
@@ -397,13 +387,13 @@ class Pe {
|
|
|
397
387
|
}
|
|
398
388
|
}
|
|
399
389
|
Pe.MAX_LENGTH = 100;
|
|
400
|
-
class
|
|
390
|
+
class xt {
|
|
401
391
|
/**
|
|
402
392
|
View element
|
|
403
393
|
*/
|
|
404
394
|
/** Internal {@link Masked} model */
|
|
405
395
|
constructor(e, t) {
|
|
406
|
-
this.el = e instanceof
|
|
396
|
+
this.el = e instanceof je ? e : e.isContentEditable && e.tagName !== "INPUT" && e.tagName !== "TEXTAREA" ? new at(e) : new Ft(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
397
|
}
|
|
408
398
|
maskEquals(e) {
|
|
409
399
|
var t;
|
|
@@ -415,13 +405,13 @@ class Dt {
|
|
|
415
405
|
}
|
|
416
406
|
set mask(e) {
|
|
417
407
|
if (this.maskEquals(e)) return;
|
|
418
|
-
if (!(e instanceof
|
|
408
|
+
if (!(e instanceof _.Masked) && this.masked.constructor === it(e)) {
|
|
419
409
|
this.masked.updateOptions({
|
|
420
410
|
mask: e
|
|
421
411
|
});
|
|
422
412
|
return;
|
|
423
413
|
}
|
|
424
|
-
const t = e instanceof
|
|
414
|
+
const t = e instanceof _.Masked ? e : ae({
|
|
425
415
|
mask: e
|
|
426
416
|
});
|
|
427
417
|
t.unmaskedValue = this.masked.unmaskedValue, this.masked = t;
|
|
@@ -478,7 +468,7 @@ class Dt {
|
|
|
478
468
|
/** Fires custom event */
|
|
479
469
|
_fireEvent(e, t) {
|
|
480
470
|
const s = this._listeners[e];
|
|
481
|
-
s && s.forEach((
|
|
471
|
+
s && s.forEach((i) => i(t));
|
|
482
472
|
}
|
|
483
473
|
/** Current selection start */
|
|
484
474
|
get selectionStart() {
|
|
@@ -504,8 +494,8 @@ class Dt {
|
|
|
504
494
|
}
|
|
505
495
|
/** Syncronizes view from model value, fires change events */
|
|
506
496
|
updateControl(e) {
|
|
507
|
-
const t = this.masked.unmaskedValue, s = this.masked.value,
|
|
508
|
-
this._unmaskedValue = t, this._value = s, this._rawInputValue =
|
|
497
|
+
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;
|
|
498
|
+
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
499
|
unmaskedValue: t,
|
|
510
500
|
selection: {
|
|
511
501
|
start: this.selectionStart,
|
|
@@ -518,8 +508,8 @@ class Dt {
|
|
|
518
508
|
const {
|
|
519
509
|
mask: t,
|
|
520
510
|
...s
|
|
521
|
-
} = e,
|
|
522
|
-
|
|
511
|
+
} = e, i = !this.maskEquals(t), a = this.masked.optionsIsChanged(s);
|
|
512
|
+
i && (this.mask = t), a && this.masked.updateOptions(s), (i || a) && this.updateControl();
|
|
523
513
|
}
|
|
524
514
|
/** Updates cursor */
|
|
525
515
|
updateCursor(e) {
|
|
@@ -541,7 +531,7 @@ class Dt {
|
|
|
541
531
|
}
|
|
542
532
|
/** Aligns cursor to nearest available position */
|
|
543
533
|
alignCursor() {
|
|
544
|
-
this.cursorPos = this.masked.nearestInputPos(this.masked.nearestInputPos(this.cursorPos,
|
|
534
|
+
this.cursorPos = this.masked.nearestInputPos(this.masked.nearestInputPos(this.cursorPos, f.LEFT));
|
|
545
535
|
}
|
|
546
536
|
/** Aligns cursor only if selection is empty */
|
|
547
537
|
alignCursorFriendly() {
|
|
@@ -562,19 +552,19 @@ class Dt {
|
|
|
562
552
|
/** Handles view input event */
|
|
563
553
|
_onInput(e) {
|
|
564
554
|
this._inputEvent = e, this._abortUpdateCursor();
|
|
565
|
-
const t = new
|
|
555
|
+
const t = new At({
|
|
566
556
|
// new state
|
|
567
557
|
value: this.el.value,
|
|
568
558
|
cursorPos: this.cursorPos,
|
|
569
559
|
// old state
|
|
570
560
|
oldValue: this.displayValue,
|
|
571
561
|
oldSelection: this._selection
|
|
572
|
-
}), s = this.masked.rawInputValue,
|
|
562
|
+
}), s = this.masked.rawInputValue, i = this.masked.splice(t.startChangePos, t.removed.length, t.inserted, t.removeDirection, {
|
|
573
563
|
input: !0,
|
|
574
564
|
raw: !0
|
|
575
|
-
}).offset,
|
|
576
|
-
let n = this.masked.nearestInputPos(t.startChangePos +
|
|
577
|
-
|
|
565
|
+
}).offset, a = s === this.masked.rawInputValue ? t.removeDirection : f.NONE;
|
|
566
|
+
let n = this.masked.nearestInputPos(t.startChangePos + i, a);
|
|
567
|
+
a !== f.NONE && (n = this.masked.nearestInputPos(n, f.NONE)), this.updateControl(n), delete this._inputEvent;
|
|
578
568
|
}
|
|
579
569
|
/** Handles view change event and commits model value */
|
|
580
570
|
_onChange() {
|
|
@@ -606,7 +596,7 @@ class Dt {
|
|
|
606
596
|
this._unbindEvents(), this._listeners.length = 0, delete this.el;
|
|
607
597
|
}
|
|
608
598
|
}
|
|
609
|
-
|
|
599
|
+
_.InputMask = xt;
|
|
610
600
|
class F {
|
|
611
601
|
/** Inserted symbols */
|
|
612
602
|
/** Additional offset if any changes occurred before tail */
|
|
@@ -638,7 +628,7 @@ class F {
|
|
|
638
628
|
return this.inserted === e.inserted && this.tailShift === e.tailShift && this.rawInserted === e.rawInserted && this.skip === e.skip;
|
|
639
629
|
}
|
|
640
630
|
}
|
|
641
|
-
|
|
631
|
+
_.ChangeDetails = F;
|
|
642
632
|
class Q {
|
|
643
633
|
/** Tail value as string */
|
|
644
634
|
/** Tail start position */
|
|
@@ -678,7 +668,7 @@ class Q {
|
|
|
678
668
|
return this.value = this.value.slice(0, -1), e;
|
|
679
669
|
}
|
|
680
670
|
}
|
|
681
|
-
class
|
|
671
|
+
class j {
|
|
682
672
|
/** */
|
|
683
673
|
/** */
|
|
684
674
|
/** Transforms value before mask processing */
|
|
@@ -694,7 +684,7 @@ class z {
|
|
|
694
684
|
/** */
|
|
695
685
|
constructor(e) {
|
|
696
686
|
this._value = "", this._update({
|
|
697
|
-
...
|
|
687
|
+
...j.DEFAULTS,
|
|
698
688
|
...e
|
|
699
689
|
}), this._initialized = !0;
|
|
700
690
|
}
|
|
@@ -783,7 +773,7 @@ class z {
|
|
|
783
773
|
}
|
|
784
774
|
/** Appends tail */
|
|
785
775
|
appendTail(e) {
|
|
786
|
-
return
|
|
776
|
+
return le(e) && (e = new Q(String(e))), e.appendTo(this);
|
|
787
777
|
}
|
|
788
778
|
/** Appends char */
|
|
789
779
|
_appendCharRaw(e, t) {
|
|
@@ -795,36 +785,36 @@ class z {
|
|
|
795
785
|
/** Appends char */
|
|
796
786
|
_appendChar(e, t, s) {
|
|
797
787
|
t === void 0 && (t = {});
|
|
798
|
-
const
|
|
799
|
-
let
|
|
800
|
-
if ([e,
|
|
788
|
+
const i = this.state;
|
|
789
|
+
let a;
|
|
790
|
+
if ([e, a] = this.doPrepareChar(e, t), e && (a = a.aggregate(this._appendCharRaw(e, t)), !a.rawInserted && this.autofix === "pad")) {
|
|
801
791
|
const n = this.state;
|
|
802
|
-
this.state =
|
|
792
|
+
this.state = i;
|
|
803
793
|
let u = this.pad(t);
|
|
804
794
|
const l = this._appendCharRaw(e, t);
|
|
805
|
-
u = u.aggregate(l), l.rawInserted || u.equals(
|
|
795
|
+
u = u.aggregate(l), l.rawInserted || u.equals(a) ? a = u : this.state = n;
|
|
806
796
|
}
|
|
807
|
-
if (
|
|
797
|
+
if (a.inserted) {
|
|
808
798
|
let n, u = this.doValidate(t) !== !1;
|
|
809
799
|
if (u && s != null) {
|
|
810
800
|
const l = this.state;
|
|
811
801
|
if (this.overwrite === !0) {
|
|
812
802
|
n = s.state;
|
|
813
|
-
for (let
|
|
814
|
-
s.unshift(this.displayValue.length -
|
|
803
|
+
for (let p = 0; p < a.rawInserted.length; ++p)
|
|
804
|
+
s.unshift(this.displayValue.length - a.tailShift);
|
|
815
805
|
}
|
|
816
806
|
let o = this.appendTail(s);
|
|
817
807
|
if (u = o.rawInserted.length === s.toString().length, !(u && o.inserted) && this.overwrite === "shift") {
|
|
818
808
|
this.state = l, n = s.state;
|
|
819
|
-
for (let
|
|
809
|
+
for (let p = 0; p < a.rawInserted.length; ++p)
|
|
820
810
|
s.shift();
|
|
821
811
|
o = this.appendTail(s), u = o.rawInserted.length === s.toString().length;
|
|
822
812
|
}
|
|
823
813
|
u && o.inserted && (this.state = l);
|
|
824
814
|
}
|
|
825
|
-
u || (
|
|
815
|
+
u || (a = new F(), this.state = i, s && n && (s.state = n));
|
|
826
816
|
}
|
|
827
|
-
return
|
|
817
|
+
return a;
|
|
828
818
|
}
|
|
829
819
|
/** Appends optional placeholder at the end */
|
|
830
820
|
_appendPlaceholder() {
|
|
@@ -836,17 +826,17 @@ class z {
|
|
|
836
826
|
}
|
|
837
827
|
/** Appends symbols considering flags */
|
|
838
828
|
append(e, t, s) {
|
|
839
|
-
if (!
|
|
840
|
-
const
|
|
829
|
+
if (!le(e)) throw new Error("value should be string");
|
|
830
|
+
const i = le(s) ? new Q(String(s)) : s;
|
|
841
831
|
t != null && t.tail && (t._beforeTailState = this.state);
|
|
842
|
-
let
|
|
843
|
-
[e,
|
|
832
|
+
let a;
|
|
833
|
+
[e, a] = this.doPrepare(e, t);
|
|
844
834
|
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
|
-
|
|
835
|
+
const u = this._appendChar(e[n], t, i);
|
|
836
|
+
if (!u.rawInserted && !this.doSkipInvalid(e[n], t, i)) break;
|
|
837
|
+
a.aggregate(u);
|
|
848
838
|
}
|
|
849
|
-
return (this.eager === !0 || this.eager === "append") && t != null && t.input && e &&
|
|
839
|
+
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
840
|
}
|
|
851
841
|
remove(e, t) {
|
|
852
842
|
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 +845,8 @@ class z {
|
|
|
855
845
|
withValueRefresh(e) {
|
|
856
846
|
if (this._refreshing || !this._initialized) return e();
|
|
857
847
|
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,
|
|
848
|
+
const t = this.rawInputValue, s = this.value, i = e();
|
|
849
|
+
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
850
|
}
|
|
861
851
|
runIsolated(e) {
|
|
862
852
|
if (this._isolated || !this._initialized) return e(this);
|
|
@@ -883,26 +873,26 @@ class z {
|
|
|
883
873
|
doCommit() {
|
|
884
874
|
this.commit && this.commit(this.value, this);
|
|
885
875
|
}
|
|
886
|
-
splice(e, t, s,
|
|
887
|
-
s === void 0 && (s = ""),
|
|
876
|
+
splice(e, t, s, i, a) {
|
|
877
|
+
s === void 0 && (s = ""), i === void 0 && (i = f.NONE), a === void 0 && (a = {
|
|
888
878
|
input: !0
|
|
889
879
|
});
|
|
890
880
|
const n = e + t, u = this.extractTail(n), l = this.eager === !0 || this.eager === "remove";
|
|
891
881
|
let o;
|
|
892
|
-
l && (
|
|
882
|
+
l && (i = Et(i), o = this.extractInput(0, n, {
|
|
893
883
|
raw: !0
|
|
894
884
|
}));
|
|
895
|
-
let
|
|
896
|
-
const
|
|
897
|
-
if (
|
|
898
|
-
if (
|
|
899
|
-
let
|
|
900
|
-
for (; o === this.rawInputValue && (
|
|
901
|
-
|
|
885
|
+
let p = e;
|
|
886
|
+
const m = new F();
|
|
887
|
+
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)
|
|
888
|
+
if (i === f.FORCE_LEFT) {
|
|
889
|
+
let A;
|
|
890
|
+
for (; o === this.rawInputValue && (A = this.displayValue.length); )
|
|
891
|
+
m.aggregate(new F({
|
|
902
892
|
tailShift: -1
|
|
903
|
-
})).aggregate(this.remove(
|
|
904
|
-
} else
|
|
905
|
-
return
|
|
893
|
+
})).aggregate(this.remove(A - 1));
|
|
894
|
+
} else i === f.FORCE_RIGHT && u.unshift();
|
|
895
|
+
return m.aggregate(this.append(s, a, u));
|
|
906
896
|
}
|
|
907
897
|
maskEquals(e) {
|
|
908
898
|
return this.mask === e;
|
|
@@ -912,18 +902,18 @@ class z {
|
|
|
912
902
|
}
|
|
913
903
|
typedValueEquals(e) {
|
|
914
904
|
const t = this.typedValue;
|
|
915
|
-
return e === t ||
|
|
905
|
+
return e === t || j.EMPTY_VALUES.includes(e) && j.EMPTY_VALUES.includes(t) || (this.format ? this.format(e, this) === this.format(this.typedValue, this) : !1);
|
|
916
906
|
}
|
|
917
907
|
pad(e) {
|
|
918
908
|
return new F();
|
|
919
909
|
}
|
|
920
910
|
}
|
|
921
|
-
|
|
911
|
+
j.DEFAULTS = {
|
|
922
912
|
skipInvalid: !0
|
|
923
913
|
};
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
class
|
|
914
|
+
j.EMPTY_VALUES = [void 0, null, ""];
|
|
915
|
+
_.Masked = j;
|
|
916
|
+
class pe {
|
|
927
917
|
/** */
|
|
928
918
|
constructor(e, t) {
|
|
929
919
|
e === void 0 && (e = []), t === void 0 && (t = 0), this.chunks = e, this.from = t;
|
|
@@ -933,39 +923,39 @@ class fe {
|
|
|
933
923
|
}
|
|
934
924
|
extend(e) {
|
|
935
925
|
if (!String(e)) return;
|
|
936
|
-
e =
|
|
926
|
+
e = le(e) ? new Q(String(e)) : e;
|
|
937
927
|
const t = this.chunks[this.chunks.length - 1], s = t && // if stops are same or tail has no stop
|
|
938
928
|
(t.stop === e.stop || e.stop == null) && // if tail chunk goes just after last chunk
|
|
939
929
|
e.from === t.from + t.toString().length;
|
|
940
930
|
if (e instanceof Q)
|
|
941
931
|
s ? t.extend(e.toString()) : this.chunks.push(e);
|
|
942
|
-
else if (e instanceof
|
|
932
|
+
else if (e instanceof pe) {
|
|
943
933
|
if (e.stop == null) {
|
|
944
|
-
let
|
|
934
|
+
let i;
|
|
945
935
|
for (; e.chunks.length && e.chunks[0].stop == null; )
|
|
946
|
-
|
|
936
|
+
i = e.chunks.shift(), i.from += e.from, this.extend(i);
|
|
947
937
|
}
|
|
948
938
|
e.toString() && (e.stop = e.blockIndex, this.chunks.push(e));
|
|
949
939
|
}
|
|
950
940
|
}
|
|
951
941
|
appendTo(e) {
|
|
952
|
-
if (!(e instanceof
|
|
942
|
+
if (!(e instanceof _.MaskedPattern))
|
|
953
943
|
return new Q(this.toString()).appendTo(e);
|
|
954
944
|
const t = new F();
|
|
955
945
|
for (let s = 0; s < this.chunks.length; ++s) {
|
|
956
|
-
const
|
|
946
|
+
const i = this.chunks[s], a = e._mapPosToBlock(e.displayValue.length), n = i.stop;
|
|
957
947
|
let u;
|
|
958
948
|
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(
|
|
949
|
+
(!a || a.index <= n) && ((i instanceof pe || // for continuous block also check if stop is exist
|
|
950
|
+
e._stops.indexOf(n) >= 0) && t.aggregate(e._appendPlaceholder(n)), u = i instanceof pe && e._blocks[n]), u) {
|
|
951
|
+
const l = u.appendTail(i);
|
|
962
952
|
t.aggregate(l);
|
|
963
|
-
const o =
|
|
953
|
+
const o = i.toString().slice(l.rawInserted.length);
|
|
964
954
|
o && t.aggregate(e.append(o, {
|
|
965
955
|
tail: !0
|
|
966
956
|
}));
|
|
967
957
|
} else
|
|
968
|
-
t.aggregate(e.append(
|
|
958
|
+
t.aggregate(e.append(i.toString(), {
|
|
969
959
|
tail: !0
|
|
970
960
|
}));
|
|
971
961
|
}
|
|
@@ -984,9 +974,9 @@ class fe {
|
|
|
984
974
|
chunks: t,
|
|
985
975
|
...s
|
|
986
976
|
} = e;
|
|
987
|
-
Object.assign(this, s), this.chunks = t.map((
|
|
988
|
-
const
|
|
989
|
-
return
|
|
977
|
+
Object.assign(this, s), this.chunks = t.map((i) => {
|
|
978
|
+
const a = "chunks" in i ? new pe() : new Q();
|
|
979
|
+
return a.state = i, a;
|
|
990
980
|
});
|
|
991
981
|
}
|
|
992
982
|
unshift(e) {
|
|
@@ -994,13 +984,13 @@ class fe {
|
|
|
994
984
|
const t = e != null ? e - this.from : e;
|
|
995
985
|
let s = 0;
|
|
996
986
|
for (; s < this.chunks.length; ) {
|
|
997
|
-
const
|
|
998
|
-
if (
|
|
999
|
-
if (!
|
|
987
|
+
const i = this.chunks[s], a = i.unshift(t);
|
|
988
|
+
if (i.toString()) {
|
|
989
|
+
if (!a) break;
|
|
1000
990
|
++s;
|
|
1001
991
|
} else
|
|
1002
992
|
this.chunks.splice(s, 1);
|
|
1003
|
-
if (
|
|
993
|
+
if (a) return a;
|
|
1004
994
|
}
|
|
1005
995
|
return "";
|
|
1006
996
|
}
|
|
@@ -1019,12 +1009,12 @@ class fe {
|
|
|
1019
1009
|
return "";
|
|
1020
1010
|
}
|
|
1021
1011
|
}
|
|
1022
|
-
class
|
|
1012
|
+
class Dt {
|
|
1023
1013
|
constructor(e, t) {
|
|
1024
1014
|
this.masked = e, this._log = [];
|
|
1025
1015
|
const {
|
|
1026
1016
|
offset: s,
|
|
1027
|
-
index:
|
|
1017
|
+
index: i
|
|
1028
1018
|
} = e._mapPosToBlock(t) || (t < 0 ? (
|
|
1029
1019
|
// first
|
|
1030
1020
|
{
|
|
@@ -1038,7 +1028,7 @@ class St {
|
|
|
1038
1028
|
offset: 0
|
|
1039
1029
|
}
|
|
1040
1030
|
));
|
|
1041
|
-
this.offset = s, this.index =
|
|
1031
|
+
this.offset = s, this.index = i, this.ok = !1;
|
|
1042
1032
|
}
|
|
1043
1033
|
get block() {
|
|
1044
1034
|
return this.masked._blocks[this.index];
|
|
@@ -1080,42 +1070,42 @@ class St {
|
|
|
1080
1070
|
}
|
|
1081
1071
|
pushLeftBeforeFilled() {
|
|
1082
1072
|
return this._pushLeft(() => {
|
|
1083
|
-
if (!(this.block.isFixed || !this.block.value) && (this.offset = this.block.nearestInputPos(this.offset,
|
|
1073
|
+
if (!(this.block.isFixed || !this.block.value) && (this.offset = this.block.nearestInputPos(this.offset, f.FORCE_LEFT), this.offset !== 0))
|
|
1084
1074
|
return !0;
|
|
1085
1075
|
});
|
|
1086
1076
|
}
|
|
1087
1077
|
pushLeftBeforeInput() {
|
|
1088
1078
|
return this._pushLeft(() => {
|
|
1089
1079
|
if (!this.block.isFixed)
|
|
1090
|
-
return this.offset = this.block.nearestInputPos(this.offset,
|
|
1080
|
+
return this.offset = this.block.nearestInputPos(this.offset, f.LEFT), !0;
|
|
1091
1081
|
});
|
|
1092
1082
|
}
|
|
1093
1083
|
pushLeftBeforeRequired() {
|
|
1094
1084
|
return this._pushLeft(() => {
|
|
1095
1085
|
if (!(this.block.isFixed || this.block.isOptional && !this.block.value))
|
|
1096
|
-
return this.offset = this.block.nearestInputPos(this.offset,
|
|
1086
|
+
return this.offset = this.block.nearestInputPos(this.offset, f.LEFT), !0;
|
|
1097
1087
|
});
|
|
1098
1088
|
}
|
|
1099
1089
|
pushRightBeforeFilled() {
|
|
1100
1090
|
return this._pushRight(() => {
|
|
1101
|
-
if (!(this.block.isFixed || !this.block.value) && (this.offset = this.block.nearestInputPos(this.offset,
|
|
1091
|
+
if (!(this.block.isFixed || !this.block.value) && (this.offset = this.block.nearestInputPos(this.offset, f.FORCE_RIGHT), this.offset !== this.block.value.length))
|
|
1102
1092
|
return !0;
|
|
1103
1093
|
});
|
|
1104
1094
|
}
|
|
1105
1095
|
pushRightBeforeInput() {
|
|
1106
1096
|
return this._pushRight(() => {
|
|
1107
1097
|
if (!this.block.isFixed)
|
|
1108
|
-
return this.offset = this.block.nearestInputPos(this.offset,
|
|
1098
|
+
return this.offset = this.block.nearestInputPos(this.offset, f.NONE), !0;
|
|
1109
1099
|
});
|
|
1110
1100
|
}
|
|
1111
1101
|
pushRightBeforeRequired() {
|
|
1112
1102
|
return this._pushRight(() => {
|
|
1113
1103
|
if (!(this.block.isFixed || this.block.isOptional && !this.block.value))
|
|
1114
|
-
return this.offset = this.block.nearestInputPos(this.offset,
|
|
1104
|
+
return this.offset = this.block.nearestInputPos(this.offset, f.NONE), !0;
|
|
1115
1105
|
});
|
|
1116
1106
|
}
|
|
1117
1107
|
}
|
|
1118
|
-
class
|
|
1108
|
+
class nt {
|
|
1119
1109
|
/** */
|
|
1120
1110
|
/** */
|
|
1121
1111
|
/** */
|
|
@@ -1144,17 +1134,17 @@ class st {
|
|
|
1144
1134
|
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
1135
|
}
|
|
1146
1136
|
nearestInputPos(e, t) {
|
|
1147
|
-
t === void 0 && (t =
|
|
1148
|
-
const s = 0,
|
|
1137
|
+
t === void 0 && (t = f.NONE);
|
|
1138
|
+
const s = 0, i = this._value.length;
|
|
1149
1139
|
switch (t) {
|
|
1150
|
-
case
|
|
1151
|
-
case
|
|
1140
|
+
case f.LEFT:
|
|
1141
|
+
case f.FORCE_LEFT:
|
|
1152
1142
|
return s;
|
|
1153
|
-
case
|
|
1154
|
-
case
|
|
1155
|
-
case
|
|
1143
|
+
case f.NONE:
|
|
1144
|
+
case f.RIGHT:
|
|
1145
|
+
case f.FORCE_RIGHT:
|
|
1156
1146
|
default:
|
|
1157
|
-
return
|
|
1147
|
+
return i;
|
|
1158
1148
|
}
|
|
1159
1149
|
}
|
|
1160
1150
|
totalInputPositions(e, t) {
|
|
@@ -1171,11 +1161,11 @@ class st {
|
|
|
1171
1161
|
}
|
|
1172
1162
|
_appendChar(e, t) {
|
|
1173
1163
|
if (t === void 0 && (t = {}), this.isFilled) return new F();
|
|
1174
|
-
const s = this.eager === !0 || this.eager === "append",
|
|
1164
|
+
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
1165
|
inserted: this.char,
|
|
1176
|
-
rawInserted:
|
|
1166
|
+
rawInserted: i ? this.char : ""
|
|
1177
1167
|
});
|
|
1178
|
-
return this._value = this.char, this._isRawInput =
|
|
1168
|
+
return this._value = this.char, this._isRawInput = i && (t.raw || t.input), a;
|
|
1179
1169
|
}
|
|
1180
1170
|
_appendEager() {
|
|
1181
1171
|
return this._appendChar(this.char, {
|
|
@@ -1190,11 +1180,11 @@ class st {
|
|
|
1190
1180
|
return new Q("");
|
|
1191
1181
|
}
|
|
1192
1182
|
appendTail(e) {
|
|
1193
|
-
return
|
|
1183
|
+
return le(e) && (e = new Q(String(e))), e.appendTo(this);
|
|
1194
1184
|
}
|
|
1195
1185
|
append(e, t, s) {
|
|
1196
|
-
const
|
|
1197
|
-
return s != null && (
|
|
1186
|
+
const i = this._appendChar(e[0], t);
|
|
1187
|
+
return s != null && (i.tailShift += this.appendTail(s).tailShift), i;
|
|
1198
1188
|
}
|
|
1199
1189
|
doCommit() {
|
|
1200
1190
|
}
|
|
@@ -1224,17 +1214,17 @@ class Oe {
|
|
|
1224
1214
|
const {
|
|
1225
1215
|
parent: t,
|
|
1226
1216
|
isOptional: s,
|
|
1227
|
-
placeholderChar:
|
|
1228
|
-
displayChar:
|
|
1217
|
+
placeholderChar: i,
|
|
1218
|
+
displayChar: a,
|
|
1229
1219
|
lazy: n,
|
|
1230
1220
|
eager: u,
|
|
1231
1221
|
...l
|
|
1232
1222
|
} = e;
|
|
1233
|
-
this.masked =
|
|
1223
|
+
this.masked = ae(l), Object.assign(this, {
|
|
1234
1224
|
parent: t,
|
|
1235
1225
|
isOptional: s,
|
|
1236
|
-
placeholderChar:
|
|
1237
|
-
displayChar:
|
|
1226
|
+
placeholderChar: i,
|
|
1227
|
+
displayChar: a,
|
|
1238
1228
|
lazy: n,
|
|
1239
1229
|
eager: u
|
|
1240
1230
|
});
|
|
@@ -1263,8 +1253,8 @@ class Oe {
|
|
|
1263
1253
|
_appendChar(e, t) {
|
|
1264
1254
|
if (t === void 0 && (t = {}), this.isFilled) return new F();
|
|
1265
1255
|
const s = this.masked.state;
|
|
1266
|
-
let
|
|
1267
|
-
return
|
|
1256
|
+
let i = this.masked._appendChar(e, this.currentMaskFlags(t));
|
|
1257
|
+
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
1258
|
}
|
|
1269
1259
|
append(e, t, s) {
|
|
1270
1260
|
return this.masked.append(e, this.currentMaskFlags(t), s);
|
|
@@ -1287,18 +1277,18 @@ class Oe {
|
|
|
1287
1277
|
return e === void 0 && (e = 0), t === void 0 && (t = this.value.length), this.masked.extractInput(e, t, s);
|
|
1288
1278
|
}
|
|
1289
1279
|
nearestInputPos(e, t) {
|
|
1290
|
-
t === void 0 && (t =
|
|
1291
|
-
const s = 0,
|
|
1280
|
+
t === void 0 && (t = f.NONE);
|
|
1281
|
+
const s = 0, i = this.value.length, a = Math.min(Math.max(e, s), i);
|
|
1292
1282
|
switch (t) {
|
|
1293
|
-
case
|
|
1294
|
-
case
|
|
1295
|
-
return this.isComplete ?
|
|
1296
|
-
case
|
|
1297
|
-
case
|
|
1298
|
-
return this.isComplete ?
|
|
1299
|
-
case
|
|
1283
|
+
case f.LEFT:
|
|
1284
|
+
case f.FORCE_LEFT:
|
|
1285
|
+
return this.isComplete ? a : s;
|
|
1286
|
+
case f.RIGHT:
|
|
1287
|
+
case f.FORCE_RIGHT:
|
|
1288
|
+
return this.isComplete ? a : i;
|
|
1289
|
+
case f.NONE:
|
|
1300
1290
|
default:
|
|
1301
|
-
return
|
|
1291
|
+
return a;
|
|
1302
1292
|
}
|
|
1303
1293
|
}
|
|
1304
1294
|
totalInputPositions(e, t) {
|
|
@@ -1338,7 +1328,7 @@ Oe.DEFAULT_DEFINITIONS = {
|
|
|
1338
1328
|
// http://stackoverflow.com/a/22075070
|
|
1339
1329
|
"*": /./
|
|
1340
1330
|
};
|
|
1341
|
-
class
|
|
1331
|
+
class St extends j {
|
|
1342
1332
|
/** */
|
|
1343
1333
|
/** Enable characters overwriting */
|
|
1344
1334
|
/** */
|
|
@@ -1352,8 +1342,8 @@ class Mt extends z {
|
|
|
1352
1342
|
t && (e.validate = (s) => s.search(t) >= 0), super._update(e);
|
|
1353
1343
|
}
|
|
1354
1344
|
}
|
|
1355
|
-
|
|
1356
|
-
class
|
|
1345
|
+
_.MaskedRegExp = St;
|
|
1346
|
+
class z extends j {
|
|
1357
1347
|
/** */
|
|
1358
1348
|
/** */
|
|
1359
1349
|
/** Single char for empty input */
|
|
@@ -1365,7 +1355,7 @@ class H extends z {
|
|
|
1365
1355
|
/** */
|
|
1366
1356
|
constructor(e) {
|
|
1367
1357
|
super({
|
|
1368
|
-
...
|
|
1358
|
+
...z.DEFAULTS,
|
|
1369
1359
|
...e,
|
|
1370
1360
|
definitions: Object.assign({}, Oe.DEFAULT_DEFINITIONS, e?.definitions)
|
|
1371
1361
|
});
|
|
@@ -1381,37 +1371,37 @@ class H extends z {
|
|
|
1381
1371
|
this._blocks = [], this.exposeBlock = void 0, this._stops = [], this._maskedBlocks = {};
|
|
1382
1372
|
const t = this.mask;
|
|
1383
1373
|
if (!t || !e) return;
|
|
1384
|
-
let s = !1,
|
|
1385
|
-
for (let
|
|
1374
|
+
let s = !1, i = !1;
|
|
1375
|
+
for (let a = 0; a < t.length; ++a) {
|
|
1386
1376
|
if (this.blocks) {
|
|
1387
|
-
const o = t.slice(
|
|
1388
|
-
|
|
1389
|
-
const
|
|
1390
|
-
if (
|
|
1377
|
+
const o = t.slice(a), p = Object.keys(this.blocks).filter((A) => o.indexOf(A) === 0);
|
|
1378
|
+
p.sort((A, v) => v.length - A.length);
|
|
1379
|
+
const m = p[0];
|
|
1380
|
+
if (m) {
|
|
1391
1381
|
const {
|
|
1392
|
-
expose:
|
|
1382
|
+
expose: A,
|
|
1393
1383
|
repeat: v,
|
|
1394
|
-
...
|
|
1395
|
-
} =
|
|
1384
|
+
...V
|
|
1385
|
+
} = be(this.blocks[m]), x = {
|
|
1396
1386
|
lazy: this.lazy,
|
|
1397
1387
|
eager: this.eager,
|
|
1398
1388
|
placeholderChar: this.placeholderChar,
|
|
1399
1389
|
displayChar: this.displayChar,
|
|
1400
1390
|
overwrite: this.overwrite,
|
|
1401
1391
|
autofix: this.autofix,
|
|
1402
|
-
...
|
|
1392
|
+
...V,
|
|
1403
1393
|
repeat: v,
|
|
1404
1394
|
parent: this
|
|
1405
|
-
},
|
|
1406
|
-
|
|
1395
|
+
}, M = v != null ? new _.RepeatBlock(
|
|
1396
|
+
x
|
|
1407
1397
|
/* TODO */
|
|
1408
|
-
) :
|
|
1409
|
-
|
|
1398
|
+
) : ae(x);
|
|
1399
|
+
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
1400
|
continue;
|
|
1411
1401
|
}
|
|
1412
1402
|
}
|
|
1413
|
-
let n = t[
|
|
1414
|
-
if (n ===
|
|
1403
|
+
let n = t[a], u = n in e;
|
|
1404
|
+
if (n === z.STOP_CHAR) {
|
|
1415
1405
|
this._stops.push(this._blocks.length);
|
|
1416
1406
|
continue;
|
|
1417
1407
|
}
|
|
@@ -1420,22 +1410,22 @@ class H extends z {
|
|
|
1420
1410
|
continue;
|
|
1421
1411
|
}
|
|
1422
1412
|
if (n === "[" || n === "]") {
|
|
1423
|
-
|
|
1413
|
+
i = !i;
|
|
1424
1414
|
continue;
|
|
1425
1415
|
}
|
|
1426
|
-
if (n ===
|
|
1427
|
-
if (++
|
|
1416
|
+
if (n === z.ESCAPE_CHAR) {
|
|
1417
|
+
if (++a, n = t[a], !n) break;
|
|
1428
1418
|
u = !1;
|
|
1429
1419
|
}
|
|
1430
1420
|
const l = u ? new Oe({
|
|
1431
|
-
isOptional:
|
|
1421
|
+
isOptional: i,
|
|
1432
1422
|
lazy: this.lazy,
|
|
1433
1423
|
eager: this.eager,
|
|
1434
1424
|
placeholderChar: this.placeholderChar,
|
|
1435
1425
|
displayChar: this.displayChar,
|
|
1436
|
-
...
|
|
1426
|
+
...be(e[n]),
|
|
1437
1427
|
parent: this
|
|
1438
|
-
}) : new
|
|
1428
|
+
}) : new nt({
|
|
1439
1429
|
char: n,
|
|
1440
1430
|
eager: this.eager,
|
|
1441
1431
|
isUnmasking: s
|
|
@@ -1458,7 +1448,7 @@ class H extends z {
|
|
|
1458
1448
|
_blocks: t,
|
|
1459
1449
|
...s
|
|
1460
1450
|
} = e;
|
|
1461
|
-
this._blocks.forEach((
|
|
1451
|
+
this._blocks.forEach((i, a) => i.state = t[a]), super.state = s;
|
|
1462
1452
|
}
|
|
1463
1453
|
reset() {
|
|
1464
1454
|
super.reset(), this._blocks.forEach((e) => e.reset());
|
|
@@ -1520,47 +1510,47 @@ class H extends z {
|
|
|
1520
1510
|
let s = (e = this._mapPosToBlock(this.displayValue.length)) == null ? void 0 : e.index;
|
|
1521
1511
|
if (s == null) return t;
|
|
1522
1512
|
this._blocks[s].isFilled && ++s;
|
|
1523
|
-
for (let
|
|
1524
|
-
const
|
|
1525
|
-
if (!
|
|
1526
|
-
t.aggregate(
|
|
1513
|
+
for (let i = s; i < this._blocks.length; ++i) {
|
|
1514
|
+
const a = this._blocks[i]._appendEager();
|
|
1515
|
+
if (!a.inserted) break;
|
|
1516
|
+
t.aggregate(a);
|
|
1527
1517
|
}
|
|
1528
1518
|
return t;
|
|
1529
1519
|
}
|
|
1530
1520
|
_appendCharRaw(e, t) {
|
|
1531
1521
|
t === void 0 && (t = {});
|
|
1532
|
-
const s = this._mapPosToBlock(this.displayValue.length),
|
|
1533
|
-
if (!s) return
|
|
1522
|
+
const s = this._mapPosToBlock(this.displayValue.length), i = new F();
|
|
1523
|
+
if (!s) return i;
|
|
1534
1524
|
for (let n = s.index, u; u = this._blocks[n]; ++n) {
|
|
1535
|
-
var
|
|
1525
|
+
var a;
|
|
1536
1526
|
const l = u._appendChar(e, {
|
|
1537
1527
|
...t,
|
|
1538
|
-
_beforeTailState: (
|
|
1528
|
+
_beforeTailState: (a = t._beforeTailState) == null || (a = a._blocks) == null ? void 0 : a[n]
|
|
1539
1529
|
});
|
|
1540
|
-
if (
|
|
1530
|
+
if (i.aggregate(l), l.consumed) break;
|
|
1541
1531
|
}
|
|
1542
|
-
return
|
|
1532
|
+
return i;
|
|
1543
1533
|
}
|
|
1544
1534
|
extractTail(e, t) {
|
|
1545
1535
|
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(
|
|
1536
|
+
const s = new pe();
|
|
1537
|
+
return e === t || this._forEachBlocksInRange(e, t, (i, a, n, u) => {
|
|
1538
|
+
const l = i.extractTail(n, u);
|
|
1539
|
+
l.stop = this._findStopBefore(a), l.from = this._blockStartPos(a), l instanceof pe && (l.blockIndex = a), s.extend(l);
|
|
1550
1540
|
}), s;
|
|
1551
1541
|
}
|
|
1552
1542
|
extractInput(e, t, s) {
|
|
1553
1543
|
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
|
-
}),
|
|
1544
|
+
let i = "";
|
|
1545
|
+
return this._forEachBlocksInRange(e, t, (a, n, u, l) => {
|
|
1546
|
+
i += a.extractInput(u, l, s);
|
|
1547
|
+
}), i;
|
|
1558
1548
|
}
|
|
1559
1549
|
_findStopBefore(e) {
|
|
1560
1550
|
let t;
|
|
1561
1551
|
for (let s = 0; s < this._stops.length; ++s) {
|
|
1562
|
-
const
|
|
1563
|
-
if (
|
|
1552
|
+
const i = this._stops[s];
|
|
1553
|
+
if (i <= e) t = i;
|
|
1564
1554
|
else break;
|
|
1565
1555
|
}
|
|
1566
1556
|
return t;
|
|
@@ -1571,8 +1561,8 @@ class H extends z {
|
|
|
1571
1561
|
if (this.lazy && e == null) return t;
|
|
1572
1562
|
const s = this._mapPosToBlock(this.displayValue.length);
|
|
1573
1563
|
if (!s) return t;
|
|
1574
|
-
const
|
|
1575
|
-
return this._blocks.slice(
|
|
1564
|
+
const i = s.index, a = e ?? this._blocks.length;
|
|
1565
|
+
return this._blocks.slice(i, a).forEach((n) => {
|
|
1576
1566
|
if (!n.lazy || e != null) {
|
|
1577
1567
|
var u;
|
|
1578
1568
|
t.aggregate(n._appendPlaceholder((u = n._blocks) == null ? void 0 : u.length));
|
|
@@ -1583,11 +1573,11 @@ class H extends z {
|
|
|
1583
1573
|
_mapPosToBlock(e) {
|
|
1584
1574
|
let t = "";
|
|
1585
1575
|
for (let s = 0; s < this._blocks.length; ++s) {
|
|
1586
|
-
const
|
|
1587
|
-
if (t +=
|
|
1576
|
+
const i = this._blocks[s], a = t.length;
|
|
1577
|
+
if (t += i.displayValue, e <= t.length)
|
|
1588
1578
|
return {
|
|
1589
1579
|
index: s,
|
|
1590
|
-
offset: e -
|
|
1580
|
+
offset: e - a
|
|
1591
1581
|
};
|
|
1592
1582
|
}
|
|
1593
1583
|
}
|
|
@@ -1596,46 +1586,46 @@ class H extends z {
|
|
|
1596
1586
|
}
|
|
1597
1587
|
_forEachBlocksInRange(e, t, s) {
|
|
1598
1588
|
t === void 0 && (t = this.displayValue.length);
|
|
1599
|
-
const
|
|
1600
|
-
if (
|
|
1601
|
-
const
|
|
1602
|
-
if (s(this._blocks[
|
|
1603
|
-
for (let o =
|
|
1589
|
+
const i = this._mapPosToBlock(e);
|
|
1590
|
+
if (i) {
|
|
1591
|
+
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;
|
|
1592
|
+
if (s(this._blocks[i.index], i.index, u, l), a && !n) {
|
|
1593
|
+
for (let o = i.index + 1; o < a.index; ++o)
|
|
1604
1594
|
s(this._blocks[o], o, 0, this._blocks[o].displayValue.length);
|
|
1605
|
-
s(this._blocks[
|
|
1595
|
+
s(this._blocks[a.index], a.index, 0, a.offset);
|
|
1606
1596
|
}
|
|
1607
1597
|
}
|
|
1608
1598
|
}
|
|
1609
1599
|
remove(e, t) {
|
|
1610
1600
|
e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length);
|
|
1611
1601
|
const s = super.remove(e, t);
|
|
1612
|
-
return this._forEachBlocksInRange(e, t, (
|
|
1613
|
-
s.aggregate(
|
|
1602
|
+
return this._forEachBlocksInRange(e, t, (i, a, n, u) => {
|
|
1603
|
+
s.aggregate(i.remove(n, u));
|
|
1614
1604
|
}), s;
|
|
1615
1605
|
}
|
|
1616
1606
|
nearestInputPos(e, t) {
|
|
1617
|
-
if (t === void 0 && (t =
|
|
1618
|
-
const s = new
|
|
1619
|
-
if (t ===
|
|
1607
|
+
if (t === void 0 && (t = f.NONE), !this._blocks.length) return 0;
|
|
1608
|
+
const s = new Dt(this, e);
|
|
1609
|
+
if (t === f.NONE)
|
|
1620
1610
|
return s.pushRightBeforeInput() || (s.popState(), s.pushLeftBeforeInput()) ? s.pos : this.displayValue.length;
|
|
1621
|
-
if (t ===
|
|
1622
|
-
if (t ===
|
|
1611
|
+
if (t === f.LEFT || t === f.FORCE_LEFT) {
|
|
1612
|
+
if (t === f.LEFT) {
|
|
1623
1613
|
if (s.pushRightBeforeFilled(), s.ok && s.pos === e) return e;
|
|
1624
1614
|
s.popState();
|
|
1625
1615
|
}
|
|
1626
|
-
if (s.pushLeftBeforeInput(), s.pushLeftBeforeRequired(), s.pushLeftBeforeFilled(), t ===
|
|
1616
|
+
if (s.pushLeftBeforeInput(), s.pushLeftBeforeRequired(), s.pushLeftBeforeFilled(), t === f.LEFT) {
|
|
1627
1617
|
if (s.pushRightBeforeInput(), s.pushRightBeforeRequired(), s.ok && s.pos <= e || (s.popState(), s.ok && s.pos <= e)) return s.pos;
|
|
1628
1618
|
s.popState();
|
|
1629
1619
|
}
|
|
1630
|
-
return s.ok ? s.pos : t ===
|
|
1620
|
+
return s.ok ? s.pos : t === f.FORCE_LEFT ? 0 : (s.popState(), s.ok || (s.popState(), s.ok) ? s.pos : 0);
|
|
1631
1621
|
}
|
|
1632
|
-
return t ===
|
|
1622
|
+
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
1623
|
}
|
|
1634
1624
|
totalInputPositions(e, t) {
|
|
1635
1625
|
e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length);
|
|
1636
1626
|
let s = 0;
|
|
1637
|
-
return this._forEachBlocksInRange(e, t, (
|
|
1638
|
-
s +=
|
|
1627
|
+
return this._forEachBlocksInRange(e, t, (i, a, n, u) => {
|
|
1628
|
+
s += i.totalInputPositions(n, u);
|
|
1639
1629
|
}), s;
|
|
1640
1630
|
}
|
|
1641
1631
|
/** Get block by name */
|
|
@@ -1652,17 +1642,17 @@ class H extends z {
|
|
|
1652
1642
|
return this._forEachBlocksInRange(0, this.displayValue.length, (s) => t.aggregate(s.pad(e))), t;
|
|
1653
1643
|
}
|
|
1654
1644
|
}
|
|
1655
|
-
|
|
1656
|
-
...
|
|
1645
|
+
z.DEFAULTS = {
|
|
1646
|
+
...j.DEFAULTS,
|
|
1657
1647
|
lazy: !0,
|
|
1658
1648
|
placeholderChar: "_"
|
|
1659
1649
|
};
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
class
|
|
1650
|
+
z.STOP_CHAR = "`";
|
|
1651
|
+
z.ESCAPE_CHAR = "\\";
|
|
1652
|
+
z.InputDefinition = Oe;
|
|
1653
|
+
z.FixedDefinition = nt;
|
|
1654
|
+
_.MaskedPattern = z;
|
|
1655
|
+
class Me extends z {
|
|
1666
1656
|
/**
|
|
1667
1657
|
Optionally sets max length of pattern.
|
|
1668
1658
|
Used when pattern length is longer then `to` param length. Pads zeros at start in this case.
|
|
@@ -1682,11 +1672,11 @@ class Ve extends H {
|
|
|
1682
1672
|
const {
|
|
1683
1673
|
to: t = this.to || 0,
|
|
1684
1674
|
from: s = this.from || 0,
|
|
1685
|
-
maxLength:
|
|
1686
|
-
autofix:
|
|
1675
|
+
maxLength: i = this.maxLength || 0,
|
|
1676
|
+
autofix: a = this.autofix,
|
|
1687
1677
|
...n
|
|
1688
1678
|
} = e;
|
|
1689
|
-
this.to = t, this.from = s, this.maxLength = Math.max(String(t).length,
|
|
1679
|
+
this.to = t, this.from = s, this.maxLength = Math.max(String(t).length, i), this.autofix = a;
|
|
1690
1680
|
const u = String(this.from).padStart(this.maxLength, "0"), l = String(this.to).padStart(this.maxLength, "0");
|
|
1691
1681
|
let o = 0;
|
|
1692
1682
|
for (; o < l.length && l[o] === u[o]; ) ++o;
|
|
@@ -1697,8 +1687,8 @@ class Ve extends H {
|
|
|
1697
1687
|
}
|
|
1698
1688
|
boundaries(e) {
|
|
1699
1689
|
let t = "", s = "";
|
|
1700
|
-
const [,
|
|
1701
|
-
return
|
|
1690
|
+
const [, i, a] = e.match(/^(\D*)(\d*)(\D*)/) || [];
|
|
1691
|
+
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
1692
|
}
|
|
1703
1693
|
doPrepareChar(e, t) {
|
|
1704
1694
|
t === void 0 && (t = {});
|
|
@@ -1707,40 +1697,40 @@ class Ve extends H {
|
|
|
1707
1697
|
}
|
|
1708
1698
|
_appendCharRaw(e, t) {
|
|
1709
1699
|
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(
|
|
1700
|
+
const s = String(this.from).padStart(this.maxLength, "0"), i = String(this.to).padStart(this.maxLength, "0"), [a, n] = this.boundaries(this.value + e);
|
|
1701
|
+
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
1702
|
}
|
|
1713
1703
|
doValidate(e) {
|
|
1714
1704
|
const t = this.value;
|
|
1715
1705
|
if (t.search(/[^0]/) === -1 && t.length <= this._matchFrom) return !0;
|
|
1716
|
-
const [s,
|
|
1717
|
-
return this.from <= Number(
|
|
1706
|
+
const [s, i] = this.boundaries(t);
|
|
1707
|
+
return this.from <= Number(i) && Number(s) <= this.to && super.doValidate(e);
|
|
1718
1708
|
}
|
|
1719
1709
|
pad(e) {
|
|
1720
1710
|
const t = new F();
|
|
1721
1711
|
if (this.value.length === this.maxLength) return t;
|
|
1722
|
-
const s = this.value,
|
|
1723
|
-
if (
|
|
1712
|
+
const s = this.value, i = this.maxLength - this.value.length;
|
|
1713
|
+
if (i) {
|
|
1724
1714
|
this.reset();
|
|
1725
|
-
for (let
|
|
1715
|
+
for (let a = 0; a < i; ++a)
|
|
1726
1716
|
t.aggregate(super._appendCharRaw("0", e));
|
|
1727
|
-
s.split("").forEach((
|
|
1717
|
+
s.split("").forEach((a) => this._appendCharRaw(a));
|
|
1728
1718
|
}
|
|
1729
1719
|
return t;
|
|
1730
1720
|
}
|
|
1731
1721
|
}
|
|
1732
|
-
|
|
1733
|
-
const
|
|
1734
|
-
class
|
|
1722
|
+
_.MaskedRange = Me;
|
|
1723
|
+
const Mt = "d{.}`m{.}`Y";
|
|
1724
|
+
class te extends z {
|
|
1735
1725
|
static extractPatternOptions(e) {
|
|
1736
1726
|
const {
|
|
1737
1727
|
mask: t,
|
|
1738
1728
|
pattern: s,
|
|
1739
|
-
...
|
|
1729
|
+
...i
|
|
1740
1730
|
} = e;
|
|
1741
1731
|
return {
|
|
1742
|
-
...
|
|
1743
|
-
mask:
|
|
1732
|
+
...i,
|
|
1733
|
+
mask: le(t) ? t : s
|
|
1744
1734
|
};
|
|
1745
1735
|
}
|
|
1746
1736
|
/** Pattern mask for date according to {@link MaskedDate#format} */
|
|
@@ -1749,8 +1739,8 @@ class se extends H {
|
|
|
1749
1739
|
/** Format typed value to string */
|
|
1750
1740
|
/** Parse string to get typed value */
|
|
1751
1741
|
constructor(e) {
|
|
1752
|
-
super(
|
|
1753
|
-
...
|
|
1742
|
+
super(te.extractPatternOptions({
|
|
1743
|
+
...te.DEFAULTS,
|
|
1754
1744
|
...e
|
|
1755
1745
|
}));
|
|
1756
1746
|
}
|
|
@@ -1761,15 +1751,15 @@ class se extends H {
|
|
|
1761
1751
|
const {
|
|
1762
1752
|
mask: t,
|
|
1763
1753
|
pattern: s,
|
|
1764
|
-
blocks:
|
|
1765
|
-
...
|
|
1754
|
+
blocks: i,
|
|
1755
|
+
...a
|
|
1766
1756
|
} = {
|
|
1767
|
-
...
|
|
1757
|
+
...te.DEFAULTS,
|
|
1768
1758
|
...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:
|
|
1759
|
+
}, n = Object.assign({}, te.GET_DEFAULT_BLOCKS());
|
|
1760
|
+
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({
|
|
1761
|
+
...a,
|
|
1762
|
+
mask: le(t) ? t : s,
|
|
1773
1763
|
blocks: n
|
|
1774
1764
|
});
|
|
1775
1765
|
}
|
|
@@ -1798,47 +1788,47 @@ class se extends H {
|
|
|
1798
1788
|
return e === Date || super.maskEquals(e);
|
|
1799
1789
|
}
|
|
1800
1790
|
optionsIsChanged(e) {
|
|
1801
|
-
return super.optionsIsChanged(
|
|
1791
|
+
return super.optionsIsChanged(te.extractPatternOptions(e));
|
|
1802
1792
|
}
|
|
1803
1793
|
}
|
|
1804
|
-
|
|
1794
|
+
te.GET_DEFAULT_BLOCKS = () => ({
|
|
1805
1795
|
d: {
|
|
1806
|
-
mask:
|
|
1796
|
+
mask: Me,
|
|
1807
1797
|
from: 1,
|
|
1808
1798
|
to: 31,
|
|
1809
1799
|
maxLength: 2
|
|
1810
1800
|
},
|
|
1811
1801
|
m: {
|
|
1812
|
-
mask:
|
|
1802
|
+
mask: Me,
|
|
1813
1803
|
from: 1,
|
|
1814
1804
|
to: 12,
|
|
1815
1805
|
maxLength: 2
|
|
1816
1806
|
},
|
|
1817
1807
|
Y: {
|
|
1818
|
-
mask:
|
|
1808
|
+
mask: Me,
|
|
1819
1809
|
from: 1900,
|
|
1820
1810
|
to: 9999
|
|
1821
1811
|
}
|
|
1822
1812
|
});
|
|
1823
|
-
|
|
1824
|
-
...
|
|
1813
|
+
te.DEFAULTS = {
|
|
1814
|
+
...z.DEFAULTS,
|
|
1825
1815
|
mask: Date,
|
|
1826
|
-
pattern:
|
|
1816
|
+
pattern: Mt,
|
|
1827
1817
|
format: (r, e) => {
|
|
1828
1818
|
if (!r) return "";
|
|
1829
|
-
const t = String(r.getDate()).padStart(2, "0"), s = String(r.getMonth() + 1).padStart(2, "0"),
|
|
1830
|
-
return [t, s,
|
|
1819
|
+
const t = String(r.getDate()).padStart(2, "0"), s = String(r.getMonth() + 1).padStart(2, "0"), i = r.getFullYear();
|
|
1820
|
+
return [t, s, i].join(".");
|
|
1831
1821
|
},
|
|
1832
1822
|
parse: (r, e) => {
|
|
1833
|
-
const [t, s,
|
|
1834
|
-
return new Date(
|
|
1823
|
+
const [t, s, i] = r.split(".").map(Number);
|
|
1824
|
+
return new Date(i, s - 1, t);
|
|
1835
1825
|
}
|
|
1836
1826
|
};
|
|
1837
|
-
|
|
1838
|
-
class
|
|
1827
|
+
_.MaskedDate = te;
|
|
1828
|
+
class $e extends j {
|
|
1839
1829
|
constructor(e) {
|
|
1840
1830
|
super({
|
|
1841
|
-
|
|
1831
|
+
...$e.DEFAULTS,
|
|
1842
1832
|
...e
|
|
1843
1833
|
}), this.currentMask = void 0;
|
|
1844
1834
|
}
|
|
@@ -1849,14 +1839,14 @@ class Le extends z {
|
|
|
1849
1839
|
super._update(e), "mask" in e && (this.exposeMask = void 0, this.compiledMasks = Array.isArray(e.mask) ? e.mask.map((t) => {
|
|
1850
1840
|
const {
|
|
1851
1841
|
expose: s,
|
|
1852
|
-
...
|
|
1853
|
-
} =
|
|
1842
|
+
...i
|
|
1843
|
+
} = be(t), a = ae({
|
|
1854
1844
|
overwrite: this._overwrite,
|
|
1855
1845
|
eager: this._eager,
|
|
1856
1846
|
skipInvalid: this._skipInvalid,
|
|
1857
|
-
...
|
|
1847
|
+
...i
|
|
1858
1848
|
});
|
|
1859
|
-
return s && (this.exposeMask =
|
|
1849
|
+
return s && (this.exposeMask = a), a;
|
|
1860
1850
|
}) : []);
|
|
1861
1851
|
}
|
|
1862
1852
|
_appendCharRaw(e, t) {
|
|
@@ -1866,15 +1856,15 @@ class Le extends z {
|
|
|
1866
1856
|
}
|
|
1867
1857
|
_applyDispatch(e, t, s) {
|
|
1868
1858
|
e === void 0 && (e = ""), t === void 0 && (t = {}), s === void 0 && (s = "");
|
|
1869
|
-
const
|
|
1859
|
+
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
1860
|
return this.currentMask = this.doDispatch(e, {
|
|
1871
1861
|
...t
|
|
1872
1862
|
}, s), this.currentMask && (this.currentMask !== l ? (this.currentMask.reset(), n && (this.currentMask.append(n, {
|
|
1873
1863
|
raw: !0
|
|
1874
|
-
}), o.tailShift = this.currentMask.value.length -
|
|
1864
|
+
}), o.tailShift = this.currentMask.value.length - i.length), u && (o.tailShift += this.currentMask.append(u, {
|
|
1875
1865
|
raw: !0,
|
|
1876
1866
|
tail: !0
|
|
1877
|
-
}).tailShift)) :
|
|
1867
|
+
}).tailShift)) : p && (this.currentMask.state = p)), o;
|
|
1878
1868
|
}
|
|
1879
1869
|
_appendPlaceholder() {
|
|
1880
1870
|
const e = this._applyDispatch();
|
|
@@ -1903,21 +1893,21 @@ class Le extends z {
|
|
|
1903
1893
|
}
|
|
1904
1894
|
doPrepare(e, t) {
|
|
1905
1895
|
t === void 0 && (t = {});
|
|
1906
|
-
let [s,
|
|
1896
|
+
let [s, i] = super.doPrepare(e, t);
|
|
1907
1897
|
if (this.currentMask) {
|
|
1908
|
-
let
|
|
1909
|
-
[s,
|
|
1898
|
+
let a;
|
|
1899
|
+
[s, a] = super.doPrepare(s, this.currentMaskFlags(t)), i = i.aggregate(a);
|
|
1910
1900
|
}
|
|
1911
|
-
return [s,
|
|
1901
|
+
return [s, i];
|
|
1912
1902
|
}
|
|
1913
1903
|
doPrepareChar(e, t) {
|
|
1914
1904
|
t === void 0 && (t = {});
|
|
1915
|
-
let [s,
|
|
1905
|
+
let [s, i] = super.doPrepareChar(e, t);
|
|
1916
1906
|
if (this.currentMask) {
|
|
1917
|
-
let
|
|
1918
|
-
[s,
|
|
1907
|
+
let a;
|
|
1908
|
+
[s, a] = super.doPrepareChar(s, this.currentMaskFlags(t)), i = i.aggregate(a);
|
|
1919
1909
|
}
|
|
1920
|
-
return [s,
|
|
1910
|
+
return [s, i];
|
|
1921
1911
|
}
|
|
1922
1912
|
reset() {
|
|
1923
1913
|
var e;
|
|
@@ -1975,10 +1965,10 @@ class Le extends z {
|
|
|
1975
1965
|
const {
|
|
1976
1966
|
compiledMasks: t,
|
|
1977
1967
|
currentMaskRef: s,
|
|
1978
|
-
currentMask:
|
|
1979
|
-
...
|
|
1968
|
+
currentMask: i,
|
|
1969
|
+
...a
|
|
1980
1970
|
} = e;
|
|
1981
|
-
t && this.compiledMasks.forEach((n, u) => n.state = t[u]), s != null && (this.currentMask = s, this.currentMask.state =
|
|
1971
|
+
t && this.compiledMasks.forEach((n, u) => n.state = t[u]), s != null && (this.currentMask = s, this.currentMask.state = i), super.state = a;
|
|
1982
1972
|
}
|
|
1983
1973
|
extractInput(e, t, s) {
|
|
1984
1974
|
return this.currentMask ? this.currentMask.extractInput(e, t, s) : "";
|
|
@@ -2020,10 +2010,10 @@ class Le extends z {
|
|
|
2020
2010
|
return Array.isArray(e) ? this.compiledMasks.every((t, s) => {
|
|
2021
2011
|
if (!e[s]) return;
|
|
2022
2012
|
const {
|
|
2023
|
-
mask:
|
|
2024
|
-
...
|
|
2013
|
+
mask: i,
|
|
2014
|
+
...a
|
|
2025
2015
|
} = e[s];
|
|
2026
|
-
return Te(t,
|
|
2016
|
+
return Te(t, a) && t.maskEquals(i);
|
|
2027
2017
|
}) : super.maskEquals(e);
|
|
2028
2018
|
}
|
|
2029
2019
|
typedValueEquals(e) {
|
|
@@ -2031,28 +2021,28 @@ class Le extends z {
|
|
|
2031
2021
|
return !!((t = this.currentMask) != null && t.typedValueEquals(e));
|
|
2032
2022
|
}
|
|
2033
2023
|
}
|
|
2034
|
-
|
|
2035
|
-
...
|
|
2024
|
+
$e.DEFAULTS = {
|
|
2025
|
+
...j.DEFAULTS,
|
|
2036
2026
|
dispatch: (r, e, t, s) => {
|
|
2037
2027
|
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 !==
|
|
2028
|
+
const i = e.rawInputValue, a = e.compiledMasks.map((n, u) => {
|
|
2029
|
+
const l = e.currentMask === n, o = l ? n.displayValue.length : n.nearestInputPos(n.displayValue.length, f.FORCE_LEFT);
|
|
2030
|
+
return n.rawInputValue !== i ? (n.reset(), n.append(i, {
|
|
2041
2031
|
raw: !0
|
|
2042
2032
|
})) : l || n.remove(o), n.append(r, e.currentMaskFlags(t)), n.appendTail(s), {
|
|
2043
2033
|
index: u,
|
|
2044
2034
|
weight: n.rawInputValue.length,
|
|
2045
|
-
totalInputPositions: n.totalInputPositions(0, Math.max(o, n.nearestInputPos(n.displayValue.length,
|
|
2035
|
+
totalInputPositions: n.totalInputPositions(0, Math.max(o, n.nearestInputPos(n.displayValue.length, f.FORCE_LEFT)))
|
|
2046
2036
|
};
|
|
2047
2037
|
});
|
|
2048
|
-
return
|
|
2038
|
+
return a.sort((n, u) => u.weight - n.weight || u.totalInputPositions - n.totalInputPositions), e.compiledMasks[a[0].index];
|
|
2049
2039
|
}
|
|
2050
2040
|
};
|
|
2051
|
-
|
|
2052
|
-
class
|
|
2041
|
+
_.MaskedDynamic = $e;
|
|
2042
|
+
class Le extends z {
|
|
2053
2043
|
constructor(e) {
|
|
2054
2044
|
super({
|
|
2055
|
-
|
|
2045
|
+
...Le.DEFAULTS,
|
|
2056
2046
|
...e
|
|
2057
2047
|
});
|
|
2058
2048
|
}
|
|
@@ -2065,21 +2055,21 @@ class $e extends H {
|
|
|
2065
2055
|
...s
|
|
2066
2056
|
} = e;
|
|
2067
2057
|
if (t) {
|
|
2068
|
-
const
|
|
2069
|
-
s.mask = "*".repeat(
|
|
2058
|
+
const i = t.map((u) => u.length), a = Math.min(...i), n = Math.max(...i) - a;
|
|
2059
|
+
s.mask = "*".repeat(a), n && (s.mask += "[" + "*".repeat(n) + "]"), this.enum = t;
|
|
2070
2060
|
}
|
|
2071
2061
|
super._update(s);
|
|
2072
2062
|
}
|
|
2073
2063
|
_appendCharRaw(e, t) {
|
|
2074
2064
|
t === void 0 && (t = {});
|
|
2075
|
-
const s = Math.min(this.nearestInputPos(0,
|
|
2076
|
-
if (
|
|
2077
|
-
|
|
2078
|
-
const l =
|
|
2065
|
+
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));
|
|
2066
|
+
if (i.length) {
|
|
2067
|
+
i.length === 1 && this._forEachBlocksInRange(0, this.value.length, (n, u) => {
|
|
2068
|
+
const l = i[0][u];
|
|
2079
2069
|
u >= this.value.length || l === n.value || (n.reset(), n._appendChar(l, t));
|
|
2080
2070
|
});
|
|
2081
|
-
const
|
|
2082
|
-
return
|
|
2071
|
+
const a = super._appendCharRaw(i[0][this.value.length], t);
|
|
2072
|
+
return i.length === 1 && i[0].slice(this.unmaskedValue.length).split("").forEach((n) => a.aggregate(super._appendCharRaw(n))), a;
|
|
2083
2073
|
}
|
|
2084
2074
|
return new F({
|
|
2085
2075
|
skip: !this.isComplete
|
|
@@ -2090,23 +2080,23 @@ class $e extends H {
|
|
|
2090
2080
|
}
|
|
2091
2081
|
remove(e, t) {
|
|
2092
2082
|
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 (
|
|
2083
|
+
const s = Math.min(super.nearestInputPos(0, f.FORCE_RIGHT), this.value.length);
|
|
2084
|
+
let i;
|
|
2085
|
+
for (i = e; i >= 0 && !(this.enum.filter((n) => this.matchValue(n, this.value.slice(s, i), s)).length > 1); --i)
|
|
2096
2086
|
;
|
|
2097
|
-
const
|
|
2098
|
-
return
|
|
2087
|
+
const a = super.remove(i, t);
|
|
2088
|
+
return a.tailShift += i - e, a;
|
|
2099
2089
|
}
|
|
2100
2090
|
get isComplete() {
|
|
2101
2091
|
return this.enum.indexOf(this.value) >= 0;
|
|
2102
2092
|
}
|
|
2103
2093
|
}
|
|
2104
|
-
|
|
2105
|
-
...
|
|
2094
|
+
Le.DEFAULTS = {
|
|
2095
|
+
...z.DEFAULTS,
|
|
2106
2096
|
matchValue: (r, e, t) => r.indexOf(e, t) === t
|
|
2107
2097
|
};
|
|
2108
|
-
|
|
2109
|
-
class Vt extends
|
|
2098
|
+
_.MaskedEnum = Le;
|
|
2099
|
+
class Vt extends j {
|
|
2110
2100
|
/** */
|
|
2111
2101
|
/** Enable characters overwriting */
|
|
2112
2102
|
/** */
|
|
@@ -2122,9 +2112,9 @@ class Vt extends z {
|
|
|
2122
2112
|
});
|
|
2123
2113
|
}
|
|
2124
2114
|
}
|
|
2125
|
-
|
|
2126
|
-
var
|
|
2127
|
-
class
|
|
2115
|
+
_.MaskedFunction = Vt;
|
|
2116
|
+
var rt;
|
|
2117
|
+
class G extends j {
|
|
2128
2118
|
/** Single char */
|
|
2129
2119
|
/** Single char */
|
|
2130
2120
|
/** Array of single chars */
|
|
@@ -2141,7 +2131,7 @@ class K extends z {
|
|
|
2141
2131
|
/** Parse string to get typed value */
|
|
2142
2132
|
constructor(e) {
|
|
2143
2133
|
super({
|
|
2144
|
-
...
|
|
2134
|
+
...G.DEFAULTS,
|
|
2145
2135
|
...e
|
|
2146
2136
|
});
|
|
2147
2137
|
}
|
|
@@ -2164,7 +2154,7 @@ class K extends z {
|
|
|
2164
2154
|
}
|
|
2165
2155
|
doPrepareChar(e, t) {
|
|
2166
2156
|
t === void 0 && (t = {});
|
|
2167
|
-
const [s,
|
|
2157
|
+
const [s, i] = super.doPrepareChar(this._removeThousandsSeparators(this.scale && this.mapToRadix.length && /*
|
|
2168
2158
|
radix should be mapped when
|
|
2169
2159
|
1) input is done from keyboard = flags.input && flags.raw
|
|
2170
2160
|
2) unmasked value is set = !flags.input && !flags.raw
|
|
@@ -2173,13 +2163,13 @@ class K extends z {
|
|
|
2173
2163
|
2) raw value is set = !flags.input && flags.raw
|
|
2174
2164
|
*/
|
|
2175
2165
|
(t.input && t.raw || !t.input && !t.raw) ? e.replace(this._mapToRadixRegExp, this.radix) : e), t);
|
|
2176
|
-
return e && !s && (
|
|
2166
|
+
return e && !s && (i.skip = !0), s && !this.allowPositive && !this.value && s !== "-" && i.aggregate(this._appendChar("-")), [s, i];
|
|
2177
2167
|
}
|
|
2178
2168
|
_separatorsCount(e, t) {
|
|
2179
2169
|
t === void 0 && (t = !1);
|
|
2180
2170
|
let s = 0;
|
|
2181
|
-
for (let
|
|
2182
|
-
this._value.indexOf(this.thousandsSeparator,
|
|
2171
|
+
for (let i = 0; i < e; ++i)
|
|
2172
|
+
this._value.indexOf(this.thousandsSeparator, i) === i && (++s, t && (e += this.thousandsSeparator.length));
|
|
2183
2173
|
return s;
|
|
2184
2174
|
}
|
|
2185
2175
|
_separatorsCountFromSlice(e) {
|
|
@@ -2190,24 +2180,24 @@ class K extends z {
|
|
|
2190
2180
|
}
|
|
2191
2181
|
_appendCharRaw(e, t) {
|
|
2192
2182
|
t === void 0 && (t = {});
|
|
2193
|
-
const s = t.tail && t._beforeTailState ? t._beforeTailState._value : this._value,
|
|
2183
|
+
const s = t.tail && t._beforeTailState ? t._beforeTailState._value : this._value, i = this._separatorsCountFromSlice(s);
|
|
2194
2184
|
this._value = this._removeThousandsSeparators(this.value);
|
|
2195
|
-
const
|
|
2185
|
+
const a = this._value;
|
|
2196
2186
|
this._value += e;
|
|
2197
2187
|
const n = this.number;
|
|
2198
2188
|
let u = !isNaN(n), l = !1;
|
|
2199
2189
|
if (u) {
|
|
2200
|
-
let
|
|
2201
|
-
this.min != null && this.min < 0 && this.number < this.min && (
|
|
2190
|
+
let A;
|
|
2191
|
+
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
2192
|
}
|
|
2203
2193
|
let o;
|
|
2204
2194
|
u ? o = new F({
|
|
2205
|
-
inserted: this._value.slice(
|
|
2195
|
+
inserted: this._value.slice(a.length),
|
|
2206
2196
|
rawInserted: l ? "" : e,
|
|
2207
2197
|
skip: l
|
|
2208
|
-
}) : (this._value =
|
|
2209
|
-
const
|
|
2210
|
-
return o.tailShift += (
|
|
2198
|
+
}) : (this._value = a, o = new F()), this._value = this._insertThousandsSeparators(this._value);
|
|
2199
|
+
const p = t.tail && t._beforeTailState ? t._beforeTailState._value : this._value, m = this._separatorsCountFromSlice(p);
|
|
2200
|
+
return o.tailShift += (m - i) * this.thousandsSeparator.length, o;
|
|
2211
2201
|
}
|
|
2212
2202
|
_findSeparatorAround(e) {
|
|
2213
2203
|
if (this.thousandsSeparator) {
|
|
@@ -2219,34 +2209,34 @@ class K extends z {
|
|
|
2219
2209
|
_adjustRangeWithSeparators(e, t) {
|
|
2220
2210
|
const s = this._findSeparatorAround(e);
|
|
2221
2211
|
s >= 0 && (e = s);
|
|
2222
|
-
const
|
|
2223
|
-
return
|
|
2212
|
+
const i = this._findSeparatorAround(t);
|
|
2213
|
+
return i >= 0 && (t = i + this.thousandsSeparator.length), [e, t];
|
|
2224
2214
|
}
|
|
2225
2215
|
remove(e, t) {
|
|
2226
2216
|
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 +
|
|
2217
|
+
const s = this.value.slice(0, e), i = this.value.slice(t), a = this._separatorsCount(s.length);
|
|
2218
|
+
this._value = this._insertThousandsSeparators(this._removeThousandsSeparators(s + i));
|
|
2229
2219
|
const n = this._separatorsCountFromSlice(s);
|
|
2230
2220
|
return new F({
|
|
2231
|
-
tailShift: (n -
|
|
2221
|
+
tailShift: (n - a) * this.thousandsSeparator.length
|
|
2232
2222
|
});
|
|
2233
2223
|
}
|
|
2234
2224
|
nearestInputPos(e, t) {
|
|
2235
2225
|
if (!this.thousandsSeparator) return e;
|
|
2236
2226
|
switch (t) {
|
|
2237
|
-
case
|
|
2238
|
-
case
|
|
2239
|
-
case
|
|
2227
|
+
case f.NONE:
|
|
2228
|
+
case f.LEFT:
|
|
2229
|
+
case f.FORCE_LEFT: {
|
|
2240
2230
|
const s = this._findSeparatorAround(e - 1);
|
|
2241
2231
|
if (s >= 0) {
|
|
2242
|
-
const
|
|
2243
|
-
if (e <
|
|
2232
|
+
const i = s + this.thousandsSeparator.length;
|
|
2233
|
+
if (e < i || this.value.length <= i || t === f.FORCE_LEFT)
|
|
2244
2234
|
return s;
|
|
2245
2235
|
}
|
|
2246
2236
|
break;
|
|
2247
2237
|
}
|
|
2248
|
-
case
|
|
2249
|
-
case
|
|
2238
|
+
case f.RIGHT:
|
|
2239
|
+
case f.FORCE_RIGHT: {
|
|
2250
2240
|
const s = this._findSeparatorAround(e);
|
|
2251
2241
|
if (s >= 0)
|
|
2252
2242
|
return s + this.thousandsSeparator.length;
|
|
@@ -2266,7 +2256,7 @@ class K extends z {
|
|
|
2266
2256
|
}
|
|
2267
2257
|
_normalizeZeros(e) {
|
|
2268
2258
|
const t = this._removeThousandsSeparators(e).split(this.radix);
|
|
2269
|
-
return t[0] = t[0].replace(/^(\D*)(0*)(\d*)/, (s,
|
|
2259
|
+
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
2260
|
}
|
|
2271
2261
|
_padFractionalZeros(e) {
|
|
2272
2262
|
if (!e) return e;
|
|
@@ -2275,11 +2265,11 @@ class K extends z {
|
|
|
2275
2265
|
}
|
|
2276
2266
|
doSkipInvalid(e, t, s) {
|
|
2277
2267
|
t === void 0 && (t = {});
|
|
2278
|
-
const
|
|
2279
|
-
return super.doSkipInvalid(e, t, s) && !
|
|
2268
|
+
const i = this.scale === 0 && e !== this.thousandsSeparator && (e === this.radix || e === G.UNMASKED_RADIX || this.mapToRadix.includes(e));
|
|
2269
|
+
return super.doSkipInvalid(e, t, s) && !i;
|
|
2280
2270
|
}
|
|
2281
2271
|
get unmaskedValue() {
|
|
2282
|
-
return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,
|
|
2272
|
+
return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix, G.UNMASKED_RADIX);
|
|
2283
2273
|
}
|
|
2284
2274
|
set unmaskedValue(e) {
|
|
2285
2275
|
super.unmaskedValue = e;
|
|
@@ -2288,7 +2278,7 @@ class K extends z {
|
|
|
2288
2278
|
return this.parse(this.unmaskedValue, this);
|
|
2289
2279
|
}
|
|
2290
2280
|
set typedValue(e) {
|
|
2291
|
-
this.rawInputValue = this.format(e, this).replace(
|
|
2281
|
+
this.rawInputValue = this.format(e, this).replace(G.UNMASKED_RADIX, this.radix);
|
|
2292
2282
|
}
|
|
2293
2283
|
/** Parsed Number */
|
|
2294
2284
|
get number() {
|
|
@@ -2304,18 +2294,18 @@ class K extends z {
|
|
|
2304
2294
|
return this.min != null && this.min > 0 || this.max != null && this.max > 0;
|
|
2305
2295
|
}
|
|
2306
2296
|
typedValueEquals(e) {
|
|
2307
|
-
return (super.typedValueEquals(e) ||
|
|
2297
|
+
return (super.typedValueEquals(e) || G.EMPTY_VALUES.includes(e) && G.EMPTY_VALUES.includes(this.typedValue)) && !(e === 0 && this.value === "");
|
|
2308
2298
|
}
|
|
2309
2299
|
}
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
...
|
|
2300
|
+
rt = G;
|
|
2301
|
+
G.UNMASKED_RADIX = ".";
|
|
2302
|
+
G.EMPTY_VALUES = [...j.EMPTY_VALUES, 0];
|
|
2303
|
+
G.DEFAULTS = {
|
|
2304
|
+
...j.DEFAULTS,
|
|
2315
2305
|
mask: Number,
|
|
2316
2306
|
radix: ",",
|
|
2317
2307
|
thousandsSeparator: "",
|
|
2318
|
-
mapToRadix: [
|
|
2308
|
+
mapToRadix: [rt.UNMASKED_RADIX],
|
|
2319
2309
|
min: Number.MIN_SAFE_INTEGER,
|
|
2320
2310
|
max: Number.MAX_SAFE_INTEGER,
|
|
2321
2311
|
scale: 2,
|
|
@@ -2327,24 +2317,24 @@ K.DEFAULTS = {
|
|
|
2327
2317
|
maximumFractionDigits: 20
|
|
2328
2318
|
})
|
|
2329
2319
|
};
|
|
2330
|
-
|
|
2331
|
-
const
|
|
2320
|
+
_.MaskedNumber = G;
|
|
2321
|
+
const He = {
|
|
2332
2322
|
MASKED: "value",
|
|
2333
2323
|
UNMASKED: "unmaskedValue",
|
|
2334
2324
|
TYPED: "typedValue"
|
|
2335
2325
|
};
|
|
2336
|
-
function
|
|
2337
|
-
e === void 0 && (e =
|
|
2338
|
-
const s =
|
|
2339
|
-
return (
|
|
2326
|
+
function ut(r, e, t) {
|
|
2327
|
+
e === void 0 && (e = He.MASKED), t === void 0 && (t = He.MASKED);
|
|
2328
|
+
const s = ae(r);
|
|
2329
|
+
return (i) => s.runIsolated((a) => (a[e] = i, a[t]));
|
|
2340
2330
|
}
|
|
2341
|
-
function
|
|
2342
|
-
return
|
|
2331
|
+
function Bt(r, e, t, s) {
|
|
2332
|
+
return ut(e, t, s)(r);
|
|
2343
2333
|
}
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
class
|
|
2334
|
+
_.PIPE_TYPE = He;
|
|
2335
|
+
_.createPipe = ut;
|
|
2336
|
+
_.pipe = Bt;
|
|
2337
|
+
class wt extends z {
|
|
2348
2338
|
get repeatFrom() {
|
|
2349
2339
|
var e;
|
|
2350
2340
|
return (e = Array.isArray(this.repeat) ? this.repeat[0] : this.repeat === 1 / 0 ? 0 : this.repeat) != null ? e : 0;
|
|
@@ -2360,15 +2350,15 @@ class It extends H {
|
|
|
2360
2350
|
super.updateOptions(e);
|
|
2361
2351
|
}
|
|
2362
2352
|
_update(e) {
|
|
2363
|
-
var t, s,
|
|
2353
|
+
var t, s, i;
|
|
2364
2354
|
const {
|
|
2365
|
-
repeat:
|
|
2355
|
+
repeat: a,
|
|
2366
2356
|
...n
|
|
2367
|
-
} =
|
|
2357
|
+
} = be(e);
|
|
2368
2358
|
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 && ((
|
|
2359
|
+
const u = ae(this._blockOpts);
|
|
2360
|
+
this.repeat = (t = (s = a ?? u.repeat) != null ? s : this.repeat) != null ? t : 1 / 0, super._update({
|
|
2361
|
+
mask: "m".repeat(Math.max(this.repeatTo === 1 / 0 && ((i = this._blocks) == null ? void 0 : i.length) || 0, this.repeatFrom)),
|
|
2372
2362
|
blocks: {
|
|
2373
2363
|
m: u
|
|
2374
2364
|
},
|
|
@@ -2383,39 +2373,39 @@ class It extends H {
|
|
|
2383
2373
|
_allocateBlock(e) {
|
|
2384
2374
|
if (e < this._blocks.length) return this._blocks[e];
|
|
2385
2375
|
if (this.repeatTo === 1 / 0 || this._blocks.length < this.repeatTo)
|
|
2386
|
-
return this._blocks.push(
|
|
2376
|
+
return this._blocks.push(ae(this._blockOpts)), this.mask += "m", this._blocks[this._blocks.length - 1];
|
|
2387
2377
|
}
|
|
2388
2378
|
_appendCharRaw(e, t) {
|
|
2389
2379
|
t === void 0 && (t = {});
|
|
2390
2380
|
const s = new F();
|
|
2391
2381
|
for (
|
|
2392
|
-
let l = (
|
|
2382
|
+
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
2383
|
// try to get a block or
|
|
2394
2384
|
// try to allocate a new block if not allocated already
|
|
2395
|
-
o = (n = this._blocks[l]) != null ? n :
|
|
2385
|
+
o = (n = this._blocks[l]) != null ? n : p = !p && this._allocateBlock(l);
|
|
2396
2386
|
++l
|
|
2397
2387
|
) {
|
|
2398
|
-
var
|
|
2399
|
-
const
|
|
2388
|
+
var i, a, n, u;
|
|
2389
|
+
const m = o._appendChar(e, {
|
|
2400
2390
|
...t,
|
|
2401
2391
|
_beforeTailState: (u = t._beforeTailState) == null || (u = u._blocks) == null ? void 0 : u[l]
|
|
2402
2392
|
});
|
|
2403
|
-
if (
|
|
2393
|
+
if (m.skip && p) {
|
|
2404
2394
|
this._blocks.pop(), this.mask = this.mask.slice(1);
|
|
2405
2395
|
break;
|
|
2406
2396
|
}
|
|
2407
|
-
if (s.aggregate(
|
|
2397
|
+
if (s.aggregate(m), m.consumed) break;
|
|
2408
2398
|
}
|
|
2409
2399
|
return s;
|
|
2410
2400
|
}
|
|
2411
2401
|
_trimEmptyTail(e, t) {
|
|
2412
|
-
var s,
|
|
2402
|
+
var s, i;
|
|
2413
2403
|
e === void 0 && (e = 0);
|
|
2414
|
-
const
|
|
2404
|
+
const a = Math.max(((s = this._mapPosToBlock(e)) == null ? void 0 : s.index) || 0, this.repeatFrom, 0);
|
|
2415
2405
|
let n;
|
|
2416
|
-
t != null && (n = (
|
|
2406
|
+
t != null && (n = (i = this._mapPosToBlock(t)) == null ? void 0 : i.index), n == null && (n = this._blocks.length - 1);
|
|
2417
2407
|
let u = 0;
|
|
2418
|
-
for (let l = n;
|
|
2408
|
+
for (let l = n; a <= l && !this._blocks[l].unmaskedValue; --l, ++u)
|
|
2419
2409
|
;
|
|
2420
2410
|
u && (this._blocks.splice(n - u + 1, u), this.mask = this.mask.slice(u));
|
|
2421
2411
|
}
|
|
@@ -2437,12 +2427,12 @@ class It extends H {
|
|
|
2437
2427
|
this._blocks.length = e._blocks.length, this.mask = this.mask.slice(0, this._blocks.length), super.state = e;
|
|
2438
2428
|
}
|
|
2439
2429
|
}
|
|
2440
|
-
|
|
2430
|
+
_.RepeatBlock = wt;
|
|
2441
2431
|
try {
|
|
2442
|
-
globalThis.IMask =
|
|
2432
|
+
globalThis.IMask = _;
|
|
2443
2433
|
} catch {
|
|
2444
2434
|
}
|
|
2445
|
-
var
|
|
2435
|
+
var It = {
|
|
2446
2436
|
// common
|
|
2447
2437
|
mask: void 0,
|
|
2448
2438
|
prepare: Function,
|
|
@@ -2509,67 +2499,67 @@ var Tt = {
|
|
|
2509
2499
|
// dynamic
|
|
2510
2500
|
dispatch: Function
|
|
2511
2501
|
};
|
|
2512
|
-
function
|
|
2502
|
+
function Tt(r, e) {
|
|
2513
2503
|
let {
|
|
2514
2504
|
emit: t,
|
|
2515
2505
|
onAccept: s,
|
|
2516
|
-
onComplete:
|
|
2517
|
-
defaultValue:
|
|
2506
|
+
onComplete: i,
|
|
2507
|
+
defaultValue: a,
|
|
2518
2508
|
defaultUnmaskedValue: n,
|
|
2519
2509
|
defaultTypedValue: u
|
|
2520
2510
|
} = e === void 0 ? {} : e;
|
|
2521
|
-
const l =
|
|
2522
|
-
let
|
|
2511
|
+
const l = ct(r) ? r : W(r), o = W(), p = W(), m = W(""), A = W(""), v = W();
|
|
2512
|
+
let V, x = m.value, M = A.value, P = v.value;
|
|
2523
2513
|
function ne() {
|
|
2524
|
-
|
|
2514
|
+
P = v.value = p.value.typedValue, M = A.value = p.value.unmaskedValue, x = m.value = p.value.value;
|
|
2525
2515
|
}
|
|
2526
2516
|
function D(b) {
|
|
2527
|
-
ne(), t && (t("accept",
|
|
2517
|
+
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
2518
|
}
|
|
2529
2519
|
function R(b) {
|
|
2530
|
-
t && (t("complete",
|
|
2520
|
+
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
2521
|
}
|
|
2532
|
-
const
|
|
2533
|
-
!
|
|
2522
|
+
const C = () => {
|
|
2523
|
+
!p.value || A.value === void 0 || (M !== A.value && (p.value.unmaskedValue = A.value, p.value.unmaskedValue !== A.value && D()), M = void 0);
|
|
2534
2524
|
};
|
|
2535
|
-
|
|
2536
|
-
const
|
|
2537
|
-
!
|
|
2525
|
+
se(A, C);
|
|
2526
|
+
const T = () => {
|
|
2527
|
+
!p.value || m.value === void 0 || (x !== m.value && (p.value.value = m.value, p.value.value !== m.value && D()), x = void 0);
|
|
2538
2528
|
};
|
|
2539
|
-
|
|
2540
|
-
const
|
|
2541
|
-
!
|
|
2529
|
+
se(m, T);
|
|
2530
|
+
const U = () => {
|
|
2531
|
+
!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
2532
|
};
|
|
2543
|
-
|
|
2544
|
-
function
|
|
2545
|
-
|
|
2533
|
+
se(v, U);
|
|
2534
|
+
function $() {
|
|
2535
|
+
V = o.value;
|
|
2546
2536
|
const b = l.value;
|
|
2547
|
-
!
|
|
2537
|
+
!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(), T(), U(), ne(), p.value.on("accept", D).on("complete", R));
|
|
2548
2538
|
}
|
|
2549
|
-
function
|
|
2539
|
+
function ee() {
|
|
2550
2540
|
var b;
|
|
2551
|
-
(b =
|
|
2541
|
+
(b = p.value) == null || b.destroy(), p.value = void 0;
|
|
2552
2542
|
}
|
|
2553
|
-
return
|
|
2543
|
+
return ft($), mt(ee), se([o, l], () => {
|
|
2554
2544
|
const b = o.value, S = l.value;
|
|
2555
|
-
(!(S != null && S.mask) || b !==
|
|
2545
|
+
(!(S != null && S.mask) || b !== V) && ee(), b && (p.value ? p.value.updateOptions(S) : $());
|
|
2556
2546
|
}), {
|
|
2557
2547
|
el: o,
|
|
2558
|
-
mask:
|
|
2559
|
-
masked:
|
|
2560
|
-
unmasked:
|
|
2548
|
+
mask: pt(p),
|
|
2549
|
+
masked: m,
|
|
2550
|
+
unmasked: A,
|
|
2561
2551
|
typed: v
|
|
2562
2552
|
};
|
|
2563
2553
|
}
|
|
2564
|
-
function
|
|
2554
|
+
function Ot(r, e) {
|
|
2565
2555
|
return r = {
|
|
2566
2556
|
...r
|
|
2567
2557
|
}, Object.keys(r).forEach((t) => {
|
|
2568
2558
|
(r[t] === void 0 || e.includes(t)) && delete r[t];
|
|
2569
2559
|
}), r;
|
|
2570
2560
|
}
|
|
2571
|
-
const
|
|
2572
|
-
var
|
|
2561
|
+
const Rt = ["typed", "unmasked", "value", "modelValue"];
|
|
2562
|
+
var Pt = ve({
|
|
2573
2563
|
name: "imask-input",
|
|
2574
2564
|
inheritAttrs: !1,
|
|
2575
2565
|
props: {
|
|
@@ -2580,7 +2570,7 @@ var Lt = ve({
|
|
|
2580
2570
|
typed: {
|
|
2581
2571
|
validator: () => !0
|
|
2582
2572
|
},
|
|
2583
|
-
...
|
|
2573
|
+
...It
|
|
2584
2574
|
},
|
|
2585
2575
|
emits: ["update:modelValue", "update:masked", "update:value", "update:unmasked", "update:typed", "accept", "accept:value", "accept:masked", "accept:unmasked", "accept:typed", "complete", "complete:value", "complete:masked", "complete:unmasked", "complete:typed"],
|
|
2586
2576
|
setup(r, e) {
|
|
@@ -2589,40 +2579,40 @@ var Lt = ve({
|
|
|
2589
2579
|
emit: s
|
|
2590
2580
|
} = e;
|
|
2591
2581
|
const {
|
|
2592
|
-
el:
|
|
2593
|
-
mask:
|
|
2582
|
+
el: i,
|
|
2583
|
+
mask: a,
|
|
2594
2584
|
masked: n,
|
|
2595
2585
|
unmasked: u,
|
|
2596
2586
|
typed: l
|
|
2597
|
-
} = Ot(
|
|
2587
|
+
} = Tt(Ot(r, Rt), {
|
|
2598
2588
|
emit: s,
|
|
2599
2589
|
onAccept: (v) => {
|
|
2600
|
-
const
|
|
2601
|
-
s("accept:value",
|
|
2590
|
+
const V = n.value;
|
|
2591
|
+
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
2592
|
},
|
|
2603
2593
|
onComplete: (v) => {
|
|
2604
2594
|
s("complete:value", n.value, v);
|
|
2605
2595
|
}
|
|
2606
|
-
}), o =
|
|
2607
|
-
return n.value =
|
|
2596
|
+
}), o = Ce(r, "value"), p = Ce(r, "modelValue"), m = Ce(r, "unmasked"), A = Ce(r, "typed");
|
|
2597
|
+
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
2598
|
const v = {
|
|
2609
2599
|
...t,
|
|
2610
|
-
value: r.value != null ? r.value : r.modelValue != null ? r.modelValue :
|
|
2611
|
-
ref:
|
|
2600
|
+
value: r.value != null ? r.value : r.modelValue != null ? r.modelValue : a.value ? a.value.displayValue : "",
|
|
2601
|
+
ref: i
|
|
2612
2602
|
};
|
|
2613
|
-
return r.mask || (v.onInput = (
|
|
2614
|
-
s("update:modelValue",
|
|
2615
|
-
}),
|
|
2603
|
+
return r.mask || (v.onInput = (V) => {
|
|
2604
|
+
s("update:modelValue", V.target.value), s("update:value", V.target.value);
|
|
2605
|
+
}), ot("input", v);
|
|
2616
2606
|
};
|
|
2617
2607
|
}
|
|
2618
|
-
}), $t =
|
|
2619
|
-
const
|
|
2608
|
+
}), $t = Pt;
|
|
2609
|
+
const Lt = ["for"], Nt = { class: "state-layer" }, Ut = { class: "content" }, Yt = { class: "input-text-container" }, Ht = ["id", "placeholder", "aria-label"], jt = {
|
|
2620
2610
|
key: 1,
|
|
2621
2611
|
class: "has-text-body-small phila-supporting-text"
|
|
2622
|
-
},
|
|
2612
|
+
}, zt = {
|
|
2623
2613
|
key: 2,
|
|
2624
2614
|
class: "has-text-body-small phila-error-text"
|
|
2625
|
-
},
|
|
2615
|
+
}, Xe = /* @__PURE__ */ ve({
|
|
2626
2616
|
inheritAttrs: !1,
|
|
2627
2617
|
__name: "TextField",
|
|
2628
2618
|
props: {
|
|
@@ -2633,154 +2623,105 @@ const Nt = ["for"], Ut = { class: "state-layer" }, Yt = { class: "content" }, zt
|
|
|
2633
2623
|
imaskProps: { default: void 0 },
|
|
2634
2624
|
supportingText: { default: "" },
|
|
2635
2625
|
placeholder: { default: "" },
|
|
2636
|
-
leadingIcon: { default:
|
|
2637
|
-
trailingIcon: { default:
|
|
2626
|
+
leadingIcon: { type: [Function, Object], default: void 0 },
|
|
2627
|
+
trailingIcon: { type: [Function, Object], default: void 0 },
|
|
2638
2628
|
error: { default() {
|
|
2639
2629
|
return [];
|
|
2640
2630
|
} }
|
|
2641
2631
|
},
|
|
2642
2632
|
emits: ["update:modelValue", "complete"],
|
|
2643
2633
|
setup(r, { expose: e, emit: t }) {
|
|
2644
|
-
const s =
|
|
2645
|
-
get: () =>
|
|
2646
|
-
set: (
|
|
2647
|
-
u("update:modelValue",
|
|
2634
|
+
const s = Qe(), i = r, a = N(() => typeof i.error == "string" ? i.error : i.error[0]), n = Ce(i, "id"), u = t, l = W(""), o = N({
|
|
2635
|
+
get: () => i.modelValue !== void 0 ? i.modelValue : l.value,
|
|
2636
|
+
set: (x) => {
|
|
2637
|
+
u("update:modelValue", x), l.value = x;
|
|
2648
2638
|
}
|
|
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
|
-
|
|
2639
|
+
}), p = N(() => {
|
|
2640
|
+
const x = ["default-class"];
|
|
2641
|
+
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);
|
|
2642
|
+
}), m = N(() => {
|
|
2643
|
+
const x = [];
|
|
2644
|
+
return o.value !== "" && x.push("phila-text-field--filled"), i.className && x.push(i.className), Ae(...x);
|
|
2645
|
+
}), A = N(() => {
|
|
2646
|
+
if (!(i.label || s["aria-label"]))
|
|
2647
|
+
return i.placeholder || void 0;
|
|
2648
|
+
}), v = W(null), V = (x) => {
|
|
2649
|
+
x.target.closest("button") || v.value?.focus();
|
|
2660
2650
|
};
|
|
2661
|
-
return e({ inputRef: v }), (
|
|
2662
|
-
class: Ye(["phila-input",
|
|
2651
|
+
return e({ inputRef: v }), (x, M) => (I(), H("div", {
|
|
2652
|
+
class: Ye(["phila-input", p.value])
|
|
2663
2653
|
}, [
|
|
2664
|
-
|
|
2654
|
+
i.label ? (I(), H("label", {
|
|
2665
2655
|
key: 0,
|
|
2666
2656
|
for: n.value,
|
|
2667
2657
|
class: "has-text-label-small phila-label"
|
|
2668
|
-
}, X(
|
|
2669
|
-
|
|
2670
|
-
class: Ye(["phila-text-field",
|
|
2671
|
-
onClick:
|
|
2658
|
+
}, X(i.label), 9, Lt)) : de("", !0),
|
|
2659
|
+
K("div", {
|
|
2660
|
+
class: Ye(["phila-text-field", m.value]),
|
|
2661
|
+
onClick: ce(V, ["prevent"])
|
|
2672
2662
|
}, [
|
|
2673
|
-
|
|
2674
|
-
|
|
2663
|
+
K("div", Nt, [
|
|
2664
|
+
i.leadingIcon ? (I(), ue(w(Ne), {
|
|
2675
2665
|
key: 0,
|
|
2676
|
-
|
|
2666
|
+
icon: i.leadingIcon,
|
|
2677
2667
|
inline: "",
|
|
2678
2668
|
decorative: ""
|
|
2679
|
-
}, null, 8, ["icon
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2669
|
+
}, null, 8, ["icon"])) : de("", !0),
|
|
2670
|
+
K("div", Ut, [
|
|
2671
|
+
K("div", Yt, [
|
|
2672
|
+
i.imaskProps?.mask ? (I(), ue(w($t), ie({ key: 0 }, { ...w(s), ...i.imaskProps }, {
|
|
2683
2673
|
id: n.value,
|
|
2684
2674
|
modelValue: o.value,
|
|
2685
|
-
"onUpdate:modelValue":
|
|
2675
|
+
"onUpdate:modelValue": M[0] || (M[0] = (P) => o.value = P),
|
|
2686
2676
|
class: "phila-text-field-input has-text-body-default",
|
|
2687
|
-
placeholder:
|
|
2688
|
-
onComplete:
|
|
2689
|
-
}), null, 16, ["id", "modelValue", "placeholder"])) :
|
|
2677
|
+
placeholder: i.placeholder,
|
|
2678
|
+
onComplete: M[1] || (M[1] = () => u("complete", l.value))
|
|
2679
|
+
}), null, 16, ["id", "modelValue", "placeholder"])) : ht((I(), H("input", ie({
|
|
2690
2680
|
key: 1,
|
|
2691
2681
|
id: n.value,
|
|
2692
2682
|
ref_key: "inputRef",
|
|
2693
2683
|
ref: v
|
|
2694
|
-
},
|
|
2695
|
-
"onUpdate:modelValue":
|
|
2684
|
+
}, w(s), {
|
|
2685
|
+
"onUpdate:modelValue": M[2] || (M[2] = (P) => o.value = P),
|
|
2696
2686
|
class: "phila-text-field-input has-text-body-default",
|
|
2697
|
-
placeholder:
|
|
2698
|
-
"aria-label":
|
|
2687
|
+
placeholder: i.placeholder,
|
|
2688
|
+
"aria-label": A.value
|
|
2699
2689
|
}), null, 16, Ht)), [
|
|
2700
|
-
[
|
|
2690
|
+
[dt, o.value]
|
|
2701
2691
|
])
|
|
2702
2692
|
])
|
|
2703
2693
|
]),
|
|
2704
|
-
o.value != "" ? (
|
|
2694
|
+
o.value != "" ? (I(), ue(w(yt), {
|
|
2705
2695
|
key: 1,
|
|
2706
2696
|
variant: "standard",
|
|
2707
2697
|
size: "small",
|
|
2708
2698
|
"icon-only": "",
|
|
2709
|
-
|
|
2710
|
-
onClick:
|
|
2711
|
-
}, null, 8, ["icon
|
|
2712
|
-
|
|
2699
|
+
icon: w(tt),
|
|
2700
|
+
onClick: M[3] || (M[3] = (P) => o.value = "")
|
|
2701
|
+
}, null, 8, ["icon"])) : de("", !0),
|
|
2702
|
+
i.trailingIcon ? (I(), ue(w(Ne), {
|
|
2713
2703
|
key: 2,
|
|
2714
2704
|
size: "small",
|
|
2715
|
-
|
|
2705
|
+
icon: i.trailingIcon,
|
|
2716
2706
|
inline: "",
|
|
2717
2707
|
decorative: ""
|
|
2718
|
-
}, null, 8, ["icon
|
|
2719
|
-
|
|
2708
|
+
}, null, 8, ["icon"])) : de("", !0),
|
|
2709
|
+
ye(x.$slots, "trailing-action")
|
|
2720
2710
|
])
|
|
2721
2711
|
], 2),
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2712
|
+
i.supportingText ? (I(), H("div", jt, X(i.supportingText), 1)) : de("", !0),
|
|
2713
|
+
a.value ? (I(), H("div", zt, [
|
|
2714
|
+
fe(w(Ne), {
|
|
2715
|
+
icon: w(_t),
|
|
2726
2716
|
size: "small",
|
|
2727
2717
|
inline: "",
|
|
2728
2718
|
decorative: ""
|
|
2729
|
-
}, null, 8, ["icon
|
|
2730
|
-
|
|
2731
|
-
])) :
|
|
2719
|
+
}, null, 8, ["icon"]),
|
|
2720
|
+
Ee(" " + X(a.value), 1)
|
|
2721
|
+
])) : de("", !0)
|
|
2732
2722
|
], 2));
|
|
2733
2723
|
}
|
|
2734
|
-
}),
|
|
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({
|
|
2724
|
+
}), qt = ["disabled"], Kt = /* @__PURE__ */ ve({
|
|
2784
2725
|
inheritAttrs: !1,
|
|
2785
2726
|
__name: "PhlButton",
|
|
2786
2727
|
props: {
|
|
@@ -2796,20 +2737,19 @@ const Nt = ["for"], Ut = { class: "state-layer" }, Yt = { class: "content" }, zt
|
|
|
2796
2737
|
iconRight: { type: Boolean },
|
|
2797
2738
|
text: {},
|
|
2798
2739
|
className: {},
|
|
2799
|
-
|
|
2800
|
-
iconClass: {},
|
|
2740
|
+
icon: {},
|
|
2801
2741
|
src: {},
|
|
2802
2742
|
svgRaw: {}
|
|
2803
2743
|
},
|
|
2804
2744
|
setup(r) {
|
|
2805
|
-
const e = r, t = (n) => "href" in n && n.href !== void 0 || "to" in n && n.to !== void 0, s =
|
|
2745
|
+
const e = r, t = (n) => "href" in n && n.href !== void 0 || "to" in n && n.to !== void 0, s = N(() => Ae(
|
|
2806
2746
|
"phila-button",
|
|
2807
2747
|
`phila-button--${e.variant}`,
|
|
2808
2748
|
e.size && `is-${e.size}`,
|
|
2809
2749
|
e.iconOnly && "icon-button",
|
|
2810
2750
|
e.iconOnly && e.variant === "standard" && "icon-button--standard",
|
|
2811
2751
|
e.className
|
|
2812
|
-
)),
|
|
2752
|
+
)), i = N(() => t(e) ? "to" in e && e.to !== void 0 ? {
|
|
2813
2753
|
to: e.to,
|
|
2814
2754
|
disabled: e.disabled,
|
|
2815
2755
|
className: s.value
|
|
@@ -2819,10 +2759,9 @@ const Nt = ["for"], Ut = { class: "state-layer" }, Yt = { class: "content" }, zt
|
|
|
2819
2759
|
rel: e.rel,
|
|
2820
2760
|
disabled: e.disabled,
|
|
2821
2761
|
className: s.value
|
|
2822
|
-
} : {}),
|
|
2762
|
+
} : {}), a = N(
|
|
2823
2763
|
() => ({
|
|
2824
|
-
|
|
2825
|
-
iconClass: e.iconClass,
|
|
2764
|
+
icon: e.icon,
|
|
2826
2765
|
src: e.src,
|
|
2827
2766
|
iconRight: e.iconRight,
|
|
2828
2767
|
iconOnly: e.iconOnly,
|
|
@@ -2830,202 +2769,197 @@ const Nt = ["for"], Ut = { class: "state-layer" }, Yt = { class: "content" }, zt
|
|
|
2830
2769
|
size: e.size
|
|
2831
2770
|
})
|
|
2832
2771
|
);
|
|
2833
|
-
return (n, u) => t(e) ? (
|
|
2834
|
-
default:
|
|
2835
|
-
|
|
2836
|
-
default:
|
|
2837
|
-
|
|
2838
|
-
|
|
2772
|
+
return (n, u) => t(e) ? (I(), ue(w(et), ie({ key: 0 }, { ...i.value, ...n.$attrs }, { role: "button" }), {
|
|
2773
|
+
default: ge(() => [
|
|
2774
|
+
fe(w(Ie), Be(we(a.value)), {
|
|
2775
|
+
default: ge(() => [
|
|
2776
|
+
ye(n.$slots, "default", {}, () => [
|
|
2777
|
+
Ee(X(e.text), 1)
|
|
2839
2778
|
])
|
|
2840
2779
|
]),
|
|
2841
2780
|
_: 3
|
|
2842
2781
|
}, 16)
|
|
2843
2782
|
]),
|
|
2844
2783
|
_: 3
|
|
2845
|
-
}, 16)) : (
|
|
2784
|
+
}, 16)) : (I(), H("button", ie({
|
|
2846
2785
|
key: 1,
|
|
2847
2786
|
type: "button",
|
|
2848
2787
|
disabled: e.disabled,
|
|
2849
2788
|
class: s.value
|
|
2850
2789
|
}, n.$attrs), [
|
|
2851
|
-
|
|
2852
|
-
default:
|
|
2853
|
-
|
|
2854
|
-
|
|
2790
|
+
fe(w(Ie), Be(we(a.value)), {
|
|
2791
|
+
default: ge(() => [
|
|
2792
|
+
ye(n.$slots, "default", {}, () => [
|
|
2793
|
+
Ee(X(e.text), 1)
|
|
2855
2794
|
])
|
|
2856
2795
|
]),
|
|
2857
2796
|
_: 3
|
|
2858
2797
|
}, 16)
|
|
2859
|
-
], 16,
|
|
2798
|
+
], 16, qt));
|
|
2860
2799
|
}
|
|
2861
2800
|
});
|
|
2862
|
-
|
|
2863
|
-
prefix: "fas",
|
|
2864
|
-
iconName: "xmark",
|
|
2865
|
-
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
|
-
}, Jt = Xt;
|
|
2867
|
-
function Qt(r) {
|
|
2801
|
+
function Gt(r) {
|
|
2868
2802
|
return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
|
|
2869
2803
|
}
|
|
2870
|
-
var
|
|
2871
|
-
function
|
|
2872
|
-
return
|
|
2804
|
+
var Ve = { exports: {} }, Zt = Ve.exports, Je;
|
|
2805
|
+
function Wt() {
|
|
2806
|
+
return Je || (Je = 1, (function(r, e) {
|
|
2873
2807
|
(function(t, s) {
|
|
2874
2808
|
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
|
-
}, R = { s: D, z: function(
|
|
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
|
-
|
|
2897
|
-
var
|
|
2898
|
-
return
|
|
2899
|
-
},
|
|
2900
|
-
var
|
|
2901
|
-
if (!
|
|
2902
|
-
if (typeof
|
|
2903
|
-
var
|
|
2904
|
-
|
|
2905
|
-
var
|
|
2906
|
-
if (!
|
|
2809
|
+
})(Zt, (function() {
|
|
2810
|
+
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) {
|
|
2811
|
+
var c = ["th", "st", "nd", "rd"], h = k % 100;
|
|
2812
|
+
return "[" + k + (c[(h - 20) % 10] || c[h] || c[0]) + "]";
|
|
2813
|
+
} }, D = function(k, c, h) {
|
|
2814
|
+
var g = String(k);
|
|
2815
|
+
return !g || g.length >= c ? k : "" + Array(c + 1 - g.length).join(h) + k;
|
|
2816
|
+
}, R = { s: D, z: function(k) {
|
|
2817
|
+
var c = -k.utcOffset(), h = Math.abs(c), g = Math.floor(h / 60), d = h % 60;
|
|
2818
|
+
return (c <= 0 ? "+" : "-") + D(g, 2, "0") + ":" + D(d, 2, "0");
|
|
2819
|
+
}, m: function k(c, h) {
|
|
2820
|
+
if (c.date() < h.date()) return -k(h, c);
|
|
2821
|
+
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);
|
|
2822
|
+
return +(-(g + (h - d) / (y ? d - E : E - d)) || 0);
|
|
2823
|
+
}, a: function(k) {
|
|
2824
|
+
return k < 0 ? Math.ceil(k) || 0 : Math.floor(k);
|
|
2825
|
+
}, p: function(k) {
|
|
2826
|
+
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$/, "");
|
|
2827
|
+
}, u: function(k) {
|
|
2828
|
+
return k === void 0;
|
|
2829
|
+
} }, C = "en", T = {};
|
|
2830
|
+
T[C] = ne;
|
|
2831
|
+
var U = "$isDayjsObject", $ = function(k) {
|
|
2832
|
+
return k instanceof Fe || !(!k || !k[U]);
|
|
2833
|
+
}, ee = function k(c, h, g) {
|
|
2834
|
+
var d;
|
|
2835
|
+
if (!c) return C;
|
|
2836
|
+
if (typeof c == "string") {
|
|
2837
|
+
var y = c.toLowerCase();
|
|
2838
|
+
T[y] && (d = y), h && (T[y] = h, d = y);
|
|
2839
|
+
var E = c.split("-");
|
|
2840
|
+
if (!d && E.length > 1) return k(E[0]);
|
|
2907
2841
|
} else {
|
|
2908
|
-
var
|
|
2909
|
-
|
|
2842
|
+
var B = c.name;
|
|
2843
|
+
T[B] = c, d = B;
|
|
2910
2844
|
}
|
|
2911
|
-
return !g &&
|
|
2912
|
-
}, b = function(
|
|
2913
|
-
if (
|
|
2914
|
-
var
|
|
2915
|
-
return
|
|
2845
|
+
return !g && d && (C = d), d || !g && C;
|
|
2846
|
+
}, b = function(k, c) {
|
|
2847
|
+
if ($(k)) return k.clone();
|
|
2848
|
+
var h = typeof c == "object" ? c : {};
|
|
2849
|
+
return h.date = k, h.args = arguments, new Fe(h);
|
|
2916
2850
|
}, S = R;
|
|
2917
|
-
S.l =
|
|
2918
|
-
return b(
|
|
2851
|
+
S.l = ee, S.i = $, S.w = function(k, c) {
|
|
2852
|
+
return b(k, { locale: c.$L, utc: c.$u, x: c.$x, $offset: c.$offset });
|
|
2919
2853
|
};
|
|
2920
|
-
var
|
|
2921
|
-
function
|
|
2922
|
-
this.$L =
|
|
2854
|
+
var Fe = (function() {
|
|
2855
|
+
function k(h) {
|
|
2856
|
+
this.$L = ee(h.locale, null, !0), this.parse(h), this.$x = this.$x || h.x || {}, this[U] = !0;
|
|
2923
2857
|
}
|
|
2924
|
-
var
|
|
2925
|
-
return
|
|
2858
|
+
var c = k.prototype;
|
|
2859
|
+
return c.parse = function(h) {
|
|
2926
2860
|
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
|
|
2861
|
+
var d = g.date, y = g.utc;
|
|
2862
|
+
if (d === null) return /* @__PURE__ */ new Date(NaN);
|
|
2863
|
+
if (S.u(d)) return /* @__PURE__ */ new Date();
|
|
2864
|
+
if (d instanceof Date) return new Date(d);
|
|
2865
|
+
if (typeof d == "string" && !/Z$/i.test(d)) {
|
|
2866
|
+
var E = d.match(M);
|
|
2867
|
+
if (E) {
|
|
2868
|
+
var B = E[2] - 1 || 0, O = (E[7] || "0").substring(0, 3);
|
|
2869
|
+
return y ? new Date(Date.UTC(E[1], B, E[3] || 1, E[4] || 0, E[5] || 0, E[6] || 0, O)) : new Date(E[1], B, E[3] || 1, E[4] || 0, E[5] || 0, E[6] || 0, O);
|
|
2936
2870
|
}
|
|
2937
2871
|
}
|
|
2938
|
-
return new Date(
|
|
2939
|
-
})(
|
|
2940
|
-
},
|
|
2941
|
-
var
|
|
2942
|
-
this.$y =
|
|
2943
|
-
},
|
|
2872
|
+
return new Date(d);
|
|
2873
|
+
})(h), this.init();
|
|
2874
|
+
}, c.init = function() {
|
|
2875
|
+
var h = this.$d;
|
|
2876
|
+
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();
|
|
2877
|
+
}, c.$utils = function() {
|
|
2944
2878
|
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
|
-
},
|
|
2879
|
+
}, c.isValid = function() {
|
|
2880
|
+
return this.$d.toString() !== x;
|
|
2881
|
+
}, c.isSame = function(h, g) {
|
|
2882
|
+
var d = b(h);
|
|
2883
|
+
return this.startOf(g) <= d && d <= this.endOf(g);
|
|
2884
|
+
}, c.isAfter = function(h, g) {
|
|
2885
|
+
return b(h) < this.startOf(g);
|
|
2886
|
+
}, c.isBefore = function(h, g) {
|
|
2887
|
+
return this.endOf(g) < b(h);
|
|
2888
|
+
}, c.$g = function(h, g, d) {
|
|
2889
|
+
return S.u(h) ? this[g] : this.set(d, h);
|
|
2890
|
+
}, c.unix = function() {
|
|
2957
2891
|
return Math.floor(this.valueOf() / 1e3);
|
|
2958
|
-
},
|
|
2892
|
+
}, c.valueOf = function() {
|
|
2959
2893
|
return this.$d.getTime();
|
|
2960
|
-
},
|
|
2961
|
-
var
|
|
2962
|
-
var re = S.w(
|
|
2963
|
-
return
|
|
2964
|
-
},
|
|
2965
|
-
return S.w(
|
|
2966
|
-
}, L = this.$W,
|
|
2967
|
-
switch (
|
|
2894
|
+
}, c.startOf = function(h, g) {
|
|
2895
|
+
var d = this, y = !!S.u(g) || g, E = S.p(h), B = function(he, q) {
|
|
2896
|
+
var re = S.w(d.$u ? Date.UTC(d.$y, q, he) : new Date(d.$y, q, he), d);
|
|
2897
|
+
return y ? re : re.endOf(o);
|
|
2898
|
+
}, O = function(he, q) {
|
|
2899
|
+
return S.w(d.toDate()[he].apply(d.toDate("s"), (y ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(q)), d);
|
|
2900
|
+
}, L = this.$W, Y = this.$M, Z = this.$D, me = "set" + (this.$u ? "UTC" : "");
|
|
2901
|
+
switch (E) {
|
|
2968
2902
|
case v:
|
|
2969
|
-
return
|
|
2970
|
-
case
|
|
2971
|
-
return
|
|
2972
|
-
case
|
|
2973
|
-
var
|
|
2974
|
-
return
|
|
2903
|
+
return y ? B(1, 0) : B(31, 11);
|
|
2904
|
+
case m:
|
|
2905
|
+
return y ? B(1, Y) : B(0, Y + 1);
|
|
2906
|
+
case p:
|
|
2907
|
+
var oe = this.$locale().weekStart || 0, ke = (L < oe ? L + 7 : L) - oe;
|
|
2908
|
+
return B(y ? Z - ke : Z + (6 - ke), Y);
|
|
2975
2909
|
case o:
|
|
2976
|
-
case
|
|
2977
|
-
return
|
|
2910
|
+
case V:
|
|
2911
|
+
return O(me + "Hours", 0);
|
|
2978
2912
|
case l:
|
|
2979
|
-
return
|
|
2913
|
+
return O(me + "Minutes", 1);
|
|
2980
2914
|
case u:
|
|
2981
|
-
return
|
|
2915
|
+
return O(me + "Seconds", 2);
|
|
2982
2916
|
case n:
|
|
2983
|
-
return
|
|
2917
|
+
return O(me + "Milliseconds", 3);
|
|
2984
2918
|
default:
|
|
2985
2919
|
return this.clone();
|
|
2986
2920
|
}
|
|
2987
|
-
},
|
|
2988
|
-
return this.startOf(
|
|
2989
|
-
},
|
|
2990
|
-
var
|
|
2991
|
-
if (
|
|
2992
|
-
var L = this.clone().set(
|
|
2993
|
-
L.$d[
|
|
2994
|
-
} else
|
|
2921
|
+
}, c.endOf = function(h) {
|
|
2922
|
+
return this.startOf(h, !1);
|
|
2923
|
+
}, c.$set = function(h, g) {
|
|
2924
|
+
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], O = y === o ? this.$D + (g - this.$W) : g;
|
|
2925
|
+
if (y === m || y === v) {
|
|
2926
|
+
var L = this.clone().set(V, 1);
|
|
2927
|
+
L.$d[B](O), L.init(), this.$d = L.set(V, Math.min(this.$D, L.daysInMonth())).$d;
|
|
2928
|
+
} else B && this.$d[B](O);
|
|
2995
2929
|
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(
|
|
2930
|
+
}, c.set = function(h, g) {
|
|
2931
|
+
return this.clone().$set(h, g);
|
|
2932
|
+
}, c.get = function(h) {
|
|
2933
|
+
return this[S.p(h)]();
|
|
2934
|
+
}, c.add = function(h, g) {
|
|
2935
|
+
var d, y = this;
|
|
2936
|
+
h = Number(h);
|
|
2937
|
+
var E = S.p(g), B = function(Y) {
|
|
2938
|
+
var Z = b(y);
|
|
2939
|
+
return S.w(Z.date(Z.date() + Math.round(Y * h)), y);
|
|
3006
2940
|
};
|
|
3007
|
-
if (
|
|
3008
|
-
if (
|
|
3009
|
-
if (
|
|
3010
|
-
if (
|
|
3011
|
-
var
|
|
2941
|
+
if (E === m) return this.set(m, this.$M + h);
|
|
2942
|
+
if (E === v) return this.set(v, this.$y + h);
|
|
2943
|
+
if (E === o) return B(1);
|
|
2944
|
+
if (E === p) return B(7);
|
|
2945
|
+
var O = (d = {}, d[u] = s, d[l] = i, d[n] = t, d)[E] || 1, L = this.$d.getTime() + h * O;
|
|
3012
2946
|
return S.w(L, this);
|
|
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
|
|
2947
|
+
}, c.subtract = function(h, g) {
|
|
2948
|
+
return this.add(-1 * h, g);
|
|
2949
|
+
}, c.format = function(h) {
|
|
2950
|
+
var g = this, d = this.$locale();
|
|
2951
|
+
if (!this.isValid()) return d.invalidDate || x;
|
|
2952
|
+
var y = h || "YYYY-MM-DDTHH:mm:ssZ", E = S.z(this), B = this.$H, O = this.$m, L = this.$M, Y = d.weekdays, Z = d.months, me = d.meridiem, oe = function(q, re, _e, xe) {
|
|
2953
|
+
return q && (q[re] || q(g, y)) || _e[re].slice(0, xe);
|
|
2954
|
+
}, ke = function(q) {
|
|
2955
|
+
return S.s(B % 12 || 12, q, "0");
|
|
2956
|
+
}, he = me || function(q, re, _e) {
|
|
2957
|
+
var xe = q < 12 ? "AM" : "PM";
|
|
2958
|
+
return _e ? xe.toLowerCase() : xe;
|
|
3025
2959
|
};
|
|
3026
|
-
return
|
|
3027
|
-
return re || (function(
|
|
3028
|
-
switch (
|
|
2960
|
+
return y.replace(P, (function(q, re) {
|
|
2961
|
+
return re || (function(_e) {
|
|
2962
|
+
switch (_e) {
|
|
3029
2963
|
case "YY":
|
|
3030
2964
|
return String(g.$y).slice(-2);
|
|
3031
2965
|
case "YYYY":
|
|
@@ -3035,9 +2969,9 @@ function ts() {
|
|
|
3035
2969
|
case "MM":
|
|
3036
2970
|
return S.s(L + 1, 2, "0");
|
|
3037
2971
|
case "MMM":
|
|
3038
|
-
return
|
|
2972
|
+
return oe(d.monthsShort, L, Z, 3);
|
|
3039
2973
|
case "MMMM":
|
|
3040
|
-
return
|
|
2974
|
+
return oe(Z, L);
|
|
3041
2975
|
case "D":
|
|
3042
2976
|
return g.$D;
|
|
3043
2977
|
case "DD":
|
|
@@ -3045,27 +2979,27 @@ function ts() {
|
|
|
3045
2979
|
case "d":
|
|
3046
2980
|
return String(g.$W);
|
|
3047
2981
|
case "dd":
|
|
3048
|
-
return
|
|
2982
|
+
return oe(d.weekdaysMin, g.$W, Y, 2);
|
|
3049
2983
|
case "ddd":
|
|
3050
|
-
return
|
|
2984
|
+
return oe(d.weekdaysShort, g.$W, Y, 3);
|
|
3051
2985
|
case "dddd":
|
|
3052
|
-
return
|
|
2986
|
+
return Y[g.$W];
|
|
3053
2987
|
case "H":
|
|
3054
|
-
return String(
|
|
2988
|
+
return String(B);
|
|
3055
2989
|
case "HH":
|
|
3056
|
-
return S.s(
|
|
2990
|
+
return S.s(B, 2, "0");
|
|
3057
2991
|
case "h":
|
|
3058
|
-
return
|
|
2992
|
+
return ke(1);
|
|
3059
2993
|
case "hh":
|
|
3060
|
-
return
|
|
2994
|
+
return ke(2);
|
|
3061
2995
|
case "a":
|
|
3062
|
-
return
|
|
2996
|
+
return he(B, O, !0);
|
|
3063
2997
|
case "A":
|
|
3064
|
-
return
|
|
2998
|
+
return he(B, O, !1);
|
|
3065
2999
|
case "m":
|
|
3066
|
-
return String(
|
|
3000
|
+
return String(O);
|
|
3067
3001
|
case "mm":
|
|
3068
|
-
return S.s(
|
|
3002
|
+
return S.s(O, 2, "0");
|
|
3069
3003
|
case "s":
|
|
3070
3004
|
return String(g.$s);
|
|
3071
3005
|
case "ss":
|
|
@@ -3073,80 +3007,80 @@ function ts() {
|
|
|
3073
3007
|
case "SSS":
|
|
3074
3008
|
return S.s(g.$ms, 3, "0");
|
|
3075
3009
|
case "Z":
|
|
3076
|
-
return
|
|
3010
|
+
return E;
|
|
3077
3011
|
}
|
|
3078
3012
|
return null;
|
|
3079
|
-
})(q) ||
|
|
3013
|
+
})(q) || E.replace(":", "");
|
|
3080
3014
|
}));
|
|
3081
|
-
},
|
|
3015
|
+
}, c.utcOffset = function() {
|
|
3082
3016
|
return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
|
|
3083
|
-
},
|
|
3084
|
-
var
|
|
3085
|
-
return S.m(
|
|
3017
|
+
}, c.diff = function(h, g, d) {
|
|
3018
|
+
var y, E = this, B = S.p(g), O = b(h), L = (O.utcOffset() - this.utcOffset()) * s, Y = this - O, Z = function() {
|
|
3019
|
+
return S.m(E, O);
|
|
3086
3020
|
};
|
|
3087
|
-
switch (
|
|
3021
|
+
switch (B) {
|
|
3088
3022
|
case v:
|
|
3089
|
-
|
|
3023
|
+
y = Z() / 12;
|
|
3090
3024
|
break;
|
|
3091
|
-
case
|
|
3092
|
-
|
|
3025
|
+
case m:
|
|
3026
|
+
y = Z();
|
|
3093
3027
|
break;
|
|
3094
|
-
case
|
|
3095
|
-
|
|
3028
|
+
case A:
|
|
3029
|
+
y = Z() / 3;
|
|
3096
3030
|
break;
|
|
3097
|
-
case
|
|
3098
|
-
|
|
3031
|
+
case p:
|
|
3032
|
+
y = (Y - L) / 6048e5;
|
|
3099
3033
|
break;
|
|
3100
3034
|
case o:
|
|
3101
|
-
|
|
3035
|
+
y = (Y - L) / 864e5;
|
|
3102
3036
|
break;
|
|
3103
3037
|
case l:
|
|
3104
|
-
|
|
3038
|
+
y = Y / i;
|
|
3105
3039
|
break;
|
|
3106
3040
|
case u:
|
|
3107
|
-
|
|
3041
|
+
y = Y / s;
|
|
3108
3042
|
break;
|
|
3109
3043
|
case n:
|
|
3110
|
-
|
|
3044
|
+
y = Y / t;
|
|
3111
3045
|
break;
|
|
3112
3046
|
default:
|
|
3113
|
-
|
|
3047
|
+
y = Y;
|
|
3114
3048
|
}
|
|
3115
|
-
return
|
|
3116
|
-
},
|
|
3117
|
-
return this.endOf(
|
|
3118
|
-
},
|
|
3119
|
-
return
|
|
3120
|
-
},
|
|
3121
|
-
if (!
|
|
3122
|
-
var
|
|
3123
|
-
return
|
|
3124
|
-
},
|
|
3049
|
+
return d ? y : S.a(y);
|
|
3050
|
+
}, c.daysInMonth = function() {
|
|
3051
|
+
return this.endOf(m).$D;
|
|
3052
|
+
}, c.$locale = function() {
|
|
3053
|
+
return T[this.$L];
|
|
3054
|
+
}, c.locale = function(h, g) {
|
|
3055
|
+
if (!h) return this.$L;
|
|
3056
|
+
var d = this.clone(), y = ee(h, g, !0);
|
|
3057
|
+
return y && (d.$L = y), d;
|
|
3058
|
+
}, c.clone = function() {
|
|
3125
3059
|
return S.w(this.$d, this);
|
|
3126
|
-
},
|
|
3060
|
+
}, c.toDate = function() {
|
|
3127
3061
|
return new Date(this.valueOf());
|
|
3128
|
-
},
|
|
3062
|
+
}, c.toJSON = function() {
|
|
3129
3063
|
return this.isValid() ? this.toISOString() : null;
|
|
3130
|
-
},
|
|
3064
|
+
}, c.toISOString = function() {
|
|
3131
3065
|
return this.$d.toISOString();
|
|
3132
|
-
},
|
|
3066
|
+
}, c.toString = function() {
|
|
3133
3067
|
return this.$d.toUTCString();
|
|
3134
|
-
},
|
|
3135
|
-
})(),
|
|
3136
|
-
return b.prototype =
|
|
3137
|
-
|
|
3138
|
-
return this.$g(
|
|
3068
|
+
}, k;
|
|
3069
|
+
})(), ze = Fe.prototype;
|
|
3070
|
+
return b.prototype = ze, [["$ms", a], ["$s", n], ["$m", u], ["$H", l], ["$W", o], ["$M", m], ["$y", v], ["$D", V]].forEach((function(k) {
|
|
3071
|
+
ze[k[1]] = function(c) {
|
|
3072
|
+
return this.$g(c, k[0], k[1]);
|
|
3139
3073
|
};
|
|
3140
|
-
})), b.extend = function(
|
|
3141
|
-
return
|
|
3142
|
-
}, b.locale =
|
|
3143
|
-
return b(1e3 *
|
|
3144
|
-
}, b.en =
|
|
3074
|
+
})), b.extend = function(k, c) {
|
|
3075
|
+
return k.$i || (k(c, Fe, b), k.$i = !0), b;
|
|
3076
|
+
}, b.locale = ee, b.isDayjs = $, b.unix = function(k) {
|
|
3077
|
+
return b(1e3 * k);
|
|
3078
|
+
}, b.en = T[C], b.Ls = T, b.p = {}, b;
|
|
3145
3079
|
}));
|
|
3146
|
-
})(
|
|
3080
|
+
})(Ve)), Ve.exports;
|
|
3147
3081
|
}
|
|
3148
|
-
var
|
|
3149
|
-
const J = /* @__PURE__ */
|
|
3082
|
+
var Xt = Wt();
|
|
3083
|
+
const J = /* @__PURE__ */ Gt(Xt), Jt = ["id"], Qt = { class: "date-picker-close is-flex is-justify-flex-end" }, es = { class: "date-picker-header is-flex is-justify-space-between is-align-center mb-2 content" }, ts = { class: "calendar is-flex is-flex-wrap content" }, ss = ["title", "tabindex", "disabled", "onClick"], is = ["id", "title", "tabindex", "disabled", "onClick"], as = ["title", "disabled", "onClick"], ns = /* @__PURE__ */ ve({
|
|
3150
3084
|
__name: "DatePicker",
|
|
3151
3085
|
props: {
|
|
3152
3086
|
id: {},
|
|
@@ -3158,65 +3092,65 @@ const J = /* @__PURE__ */ Qt(ss), as = ["id"], is = { class: "date-picker-close
|
|
|
3158
3092
|
},
|
|
3159
3093
|
emits: ["update:modelValue"],
|
|
3160
3094
|
setup(r, { expose: e, emit: t }) {
|
|
3161
|
-
const s = r,
|
|
3095
|
+
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
3096
|
const D = u.value.daysInMonth();
|
|
3163
|
-
return Array.from({ length: D }, (R,
|
|
3164
|
-
}), o =
|
|
3097
|
+
return Array.from({ length: D }, (R, C) => u.value.date(C + 1));
|
|
3098
|
+
}), o = N(() => Array.from(
|
|
3165
3099
|
{
|
|
3166
3100
|
length: u.value.date(1).day()
|
|
3167
3101
|
},
|
|
3168
|
-
(R,
|
|
3169
|
-
).reverse()),
|
|
3102
|
+
(R, C) => u.value.date(-C)
|
|
3103
|
+
).reverse()), p = N(() => Array.from(
|
|
3170
3104
|
{
|
|
3171
3105
|
length: 6 - u.value.endOf("month").day()
|
|
3172
3106
|
},
|
|
3173
|
-
(R,
|
|
3174
|
-
)),
|
|
3175
|
-
n.value = D,
|
|
3107
|
+
(R, C) => u.value.endOf("month").add(C + 1, "day")
|
|
3108
|
+
)), m = (D) => !lt(D, s.min, s.max), A = (D) => {
|
|
3109
|
+
n.value = D, i("update:modelValue", n.value.format(s.format)), s.close();
|
|
3176
3110
|
}, v = (D) => {
|
|
3177
|
-
|
|
3178
|
-
},
|
|
3111
|
+
i("update:modelValue", D), D ? (n.value = J(D, s.format), u.value = n.value) : (n.value = J(), u.value = J());
|
|
3112
|
+
}, V = () => {
|
|
3179
3113
|
u.value = u.value.add(1, "month");
|
|
3180
|
-
},
|
|
3114
|
+
}, x = () => {
|
|
3181
3115
|
u.value = u.value.subtract(1, "month");
|
|
3182
|
-
},
|
|
3116
|
+
}, M = (D) => {
|
|
3183
3117
|
const R = document.querySelector("#selected-day");
|
|
3184
3118
|
R instanceof HTMLButtonElement && (D.preventDefault(), R.focus());
|
|
3185
|
-
},
|
|
3119
|
+
}, P = (D) => {
|
|
3186
3120
|
const R = document.querySelector(`#${s.id} button`);
|
|
3187
3121
|
R instanceof HTMLButtonElement && (D.preventDefault(), R.focus());
|
|
3188
3122
|
}, ne = (D) => {
|
|
3189
|
-
if (D.key === "Tab" && !D.shiftKey &&
|
|
3123
|
+
if (D.key === "Tab" && !D.shiftKey && P(D), ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", "Home", "End"].includes(D.key)) {
|
|
3190
3124
|
D.preventDefault();
|
|
3191
|
-
const
|
|
3192
|
-
if (
|
|
3193
|
-
const
|
|
3194
|
-
(
|
|
3195
|
-
),
|
|
3196
|
-
let
|
|
3125
|
+
const C = document.activeElement;
|
|
3126
|
+
if (C instanceof HTMLButtonElement) {
|
|
3127
|
+
const T = Array.from(document.querySelectorAll(".calendar button")).filter(
|
|
3128
|
+
(ee) => !ee.disabled
|
|
3129
|
+
), U = T.indexOf(C);
|
|
3130
|
+
let $ = U;
|
|
3197
3131
|
switch (D.key) {
|
|
3198
3132
|
case "ArrowUp":
|
|
3199
|
-
|
|
3133
|
+
$ = U - 7;
|
|
3200
3134
|
break;
|
|
3201
3135
|
case "ArrowDown":
|
|
3202
|
-
|
|
3136
|
+
$ = U + 7;
|
|
3203
3137
|
break;
|
|
3204
3138
|
case "ArrowLeft":
|
|
3205
|
-
|
|
3139
|
+
$ = U - 1;
|
|
3206
3140
|
break;
|
|
3207
3141
|
case "ArrowRight":
|
|
3208
|
-
|
|
3142
|
+
$ = U + 1;
|
|
3209
3143
|
break;
|
|
3210
3144
|
case "Home":
|
|
3211
|
-
|
|
3145
|
+
$ = 0;
|
|
3212
3146
|
break;
|
|
3213
3147
|
case "End":
|
|
3214
|
-
|
|
3148
|
+
$ = T.length - 1;
|
|
3215
3149
|
break;
|
|
3216
3150
|
}
|
|
3217
|
-
|
|
3151
|
+
$ >= 0 && $ < T.length ? T[$].focus() : $ < 0 ? (x(), qe(() => {
|
|
3218
3152
|
document.querySelector(".calendar > span:last-of-type button:last-of-type")?.focus();
|
|
3219
|
-
})) :
|
|
3153
|
+
})) : $ >= T.length && (V(), qe(() => {
|
|
3220
3154
|
document.querySelector(".calendar button")?.focus();
|
|
3221
3155
|
}));
|
|
3222
3156
|
}
|
|
@@ -3224,89 +3158,89 @@ const J = /* @__PURE__ */ Qt(ss), as = ["id"], is = { class: "date-picker-close
|
|
|
3224
3158
|
};
|
|
3225
3159
|
return e({
|
|
3226
3160
|
update: v,
|
|
3227
|
-
focusDatePicker:
|
|
3228
|
-
}), (D, R) => (
|
|
3161
|
+
focusDatePicker: M
|
|
3162
|
+
}), (D, R) => (I(), H("div", {
|
|
3229
3163
|
id: r.id,
|
|
3230
3164
|
class: "date-picker"
|
|
3231
3165
|
}, [
|
|
3232
|
-
|
|
3233
|
-
|
|
3166
|
+
K("div", Qt, [
|
|
3167
|
+
fe(w(Kt), {
|
|
3234
3168
|
id: `${r.id}-date-picker-toggle`,
|
|
3235
3169
|
variant: "standard",
|
|
3236
3170
|
size: "extra-small",
|
|
3237
3171
|
"icon-only": "",
|
|
3238
|
-
|
|
3172
|
+
icon: w(tt),
|
|
3239
3173
|
"aria-label": "close date picker",
|
|
3240
|
-
onClick:
|
|
3241
|
-
}, null, 8, ["id", "icon
|
|
3174
|
+
onClick: ce(r.close, ["prevent"])
|
|
3175
|
+
}, null, 8, ["id", "icon", "onClick"])
|
|
3242
3176
|
]),
|
|
3243
|
-
|
|
3244
|
-
|
|
3177
|
+
K("div", es, [
|
|
3178
|
+
K("button", {
|
|
3245
3179
|
class: "phila-button icon-button--secondary is-extra-small",
|
|
3246
|
-
onClick:
|
|
3180
|
+
onClick: ce(x, ["prevent"])
|
|
3247
3181
|
}, " Prev "),
|
|
3248
|
-
|
|
3249
|
-
|
|
3182
|
+
K("span", null, X(u.value.format("MMMM YYYY")), 1),
|
|
3183
|
+
K("button", {
|
|
3250
3184
|
class: "phila-button is-extra-small",
|
|
3251
|
-
onClick:
|
|
3185
|
+
onClick: ce(V, ["prevent"])
|
|
3252
3186
|
}, "Next")
|
|
3253
3187
|
]),
|
|
3254
|
-
|
|
3255
|
-
(
|
|
3256
|
-
key:
|
|
3188
|
+
K("div", ts, [
|
|
3189
|
+
(I(), H(De, null, Se(a, (C) => K("span", {
|
|
3190
|
+
key: C,
|
|
3257
3191
|
class: "calendar-day is-5 has-text-weight-bold"
|
|
3258
|
-
}, X(
|
|
3259
|
-
(
|
|
3260
|
-
key: "day-in-previous-month-" +
|
|
3192
|
+
}, X(C), 1)), 64)),
|
|
3193
|
+
(I(!0), H(De, null, Se(o.value, (C, T) => (I(), H("span", {
|
|
3194
|
+
key: "day-in-previous-month-" + C.date(),
|
|
3261
3195
|
class: "calendar-day outside-month is-5"
|
|
3262
3196
|
}, [
|
|
3263
|
-
|
|
3197
|
+
K("button", {
|
|
3264
3198
|
class: "phila-button is-extra-small p-2",
|
|
3265
|
-
title: `${
|
|
3266
|
-
tabindex:
|
|
3267
|
-
disabled:
|
|
3268
|
-
onKeydown: R[0] || (R[0] = (
|
|
3269
|
-
onClick:
|
|
3270
|
-
}, X(
|
|
3199
|
+
title: `${C.format("MMMM D, YYYY")}`,
|
|
3200
|
+
tabindex: T === 0 ? 0 : -1,
|
|
3201
|
+
disabled: m(C),
|
|
3202
|
+
onKeydown: R[0] || (R[0] = (U) => ne(U)),
|
|
3203
|
+
onClick: ce((U) => A(C), ["prevent"])
|
|
3204
|
+
}, X(C.date()), 41, ss)
|
|
3271
3205
|
]))), 128)),
|
|
3272
|
-
(
|
|
3273
|
-
key: `day-in-current-month-${
|
|
3206
|
+
(I(!0), H(De, null, Se(l.value, (C, T) => (I(), H("span", {
|
|
3207
|
+
key: `day-in-current-month-${C.date()}`,
|
|
3274
3208
|
class: "calendar-day is-5"
|
|
3275
3209
|
}, [
|
|
3276
|
-
|
|
3277
|
-
id:
|
|
3210
|
+
K("button", {
|
|
3211
|
+
id: C.isSame(n.value, "day") ? "selected-day" : void 0,
|
|
3278
3212
|
class: Ye(["phila-button is-extra-small p-2", {
|
|
3279
|
-
active:
|
|
3213
|
+
active: C.isSame(n.value, "day")
|
|
3280
3214
|
}]),
|
|
3281
|
-
title:
|
|
3282
|
-
tabindex:
|
|
3283
|
-
disabled:
|
|
3284
|
-
onKeydown: R[1] || (R[1] = (
|
|
3285
|
-
onClick:
|
|
3286
|
-
}, X(
|
|
3215
|
+
title: C.format("MMMM D, YYYY"),
|
|
3216
|
+
tabindex: C.isSame(n.value, "day") || C.month() !== n.value.month() && T === 0 ? 0 : -1,
|
|
3217
|
+
disabled: m(C),
|
|
3218
|
+
onKeydown: R[1] || (R[1] = (U) => ne(U)),
|
|
3219
|
+
onClick: ce(() => A(C), ["prevent"])
|
|
3220
|
+
}, X(C.date()), 43, is)
|
|
3287
3221
|
]))), 128)),
|
|
3288
|
-
(
|
|
3289
|
-
key: "day-in-next-month-" +
|
|
3222
|
+
(I(!0), H(De, null, Se(p.value, (C) => (I(), H("span", {
|
|
3223
|
+
key: "day-in-next-month-" + C.date(),
|
|
3290
3224
|
class: "calendar-day outside-month is-5"
|
|
3291
3225
|
}, [
|
|
3292
|
-
|
|
3226
|
+
K("button", {
|
|
3293
3227
|
class: "phila-button is-extra-small p-2",
|
|
3294
|
-
title: `${
|
|
3228
|
+
title: `${C.format("MMMM D, YYYY")}`,
|
|
3295
3229
|
tabindex: "-1",
|
|
3296
|
-
disabled:
|
|
3297
|
-
onKeydown: R[2] || (R[2] = (
|
|
3298
|
-
onClick:
|
|
3299
|
-
}, X(
|
|
3230
|
+
disabled: m(C),
|
|
3231
|
+
onKeydown: R[2] || (R[2] = (T) => ne(T)),
|
|
3232
|
+
onClick: ce((T) => A(C), ["prevent"])
|
|
3233
|
+
}, X(C.date()), 41, as)
|
|
3300
3234
|
]))), 128))
|
|
3301
3235
|
])
|
|
3302
|
-
], 8,
|
|
3236
|
+
], 8, Jt));
|
|
3303
3237
|
}
|
|
3304
|
-
}),
|
|
3238
|
+
}), rs = (r, e) => {
|
|
3305
3239
|
const t = r.__vccOpts || r;
|
|
3306
|
-
for (const [s,
|
|
3307
|
-
t[s] =
|
|
3240
|
+
for (const [s, i] of e)
|
|
3241
|
+
t[s] = i;
|
|
3308
3242
|
return t;
|
|
3309
|
-
},
|
|
3243
|
+
}, us = /* @__PURE__ */ rs(ns, [["__scopeId", "data-v-b781fd7a"]]), ls = { key: 0 }, cs = /* @__PURE__ */ ve({
|
|
3310
3244
|
inheritAttrs: !1,
|
|
3311
3245
|
__name: "DateField",
|
|
3312
3246
|
props: {
|
|
@@ -3322,9 +3256,16 @@ const J = /* @__PURE__ */ Qt(ss), as = ["id"], is = { class: "date-picker-close
|
|
|
3322
3256
|
min: {},
|
|
3323
3257
|
max: {},
|
|
3324
3258
|
className: {},
|
|
3259
|
+
id: { default: () => vt("phila-date-field-") },
|
|
3260
|
+
group: {},
|
|
3261
|
+
blurHide: { type: Boolean },
|
|
3262
|
+
showSingle: { type: Boolean, default: !0 },
|
|
3263
|
+
mouseOverToggle: { type: Boolean },
|
|
3264
|
+
outsideClickHide: { type: Boolean, default: !0 },
|
|
3265
|
+
escapeKeyHide: { type: Boolean, default: !0 },
|
|
3266
|
+
visibleOnMount: { type: Boolean },
|
|
3325
3267
|
modelValue: {},
|
|
3326
3268
|
label: {},
|
|
3327
|
-
id: { default: () => gt("phila-date-field-") },
|
|
3328
3269
|
supportingText: {},
|
|
3329
3270
|
placeholder: {},
|
|
3330
3271
|
leadingIcon: {},
|
|
@@ -3332,73 +3273,78 @@ const J = /* @__PURE__ */ Qt(ss), as = ["id"], is = { class: "date-picker-close
|
|
|
3332
3273
|
error: {}
|
|
3333
3274
|
},
|
|
3334
3275
|
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,
|
|
3276
|
+
const e = r, { setVisibility: t, isVisible: s, toggleProps: i } = kt({
|
|
3342
3277
|
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
|
-
|
|
3278
|
+
group: e.group ?? "date-picker",
|
|
3279
|
+
outsideClickHide: e.outsideClickHide,
|
|
3280
|
+
escapeKeyHide: e.escapeKeyHide,
|
|
3281
|
+
showSingle: e.showSingle
|
|
3282
|
+
}), a = N(() => s()), n = Qe(), u = Ke("datePicker"), l = Ke("text-field"), o = W(e.modelValue), p = W(""), m = N(() => Ae("default-class", e.className)), A = (x) => {
|
|
3283
|
+
o.value = x;
|
|
3284
|
+
}, v = (x) => {
|
|
3285
|
+
(e.min || e.max) && (lt(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);
|
|
3286
|
+
}, V = N(() => a.value ? null : () => t(!0));
|
|
3287
|
+
return se(
|
|
3288
|
+
() => a.value,
|
|
3289
|
+
(x) => {
|
|
3290
|
+
if (!x) {
|
|
3291
|
+
const M = l.value?.$el.querySelector("input");
|
|
3292
|
+
M && M.focus();
|
|
3293
|
+
}
|
|
3294
|
+
},
|
|
3295
|
+
{ immediate: !0 }
|
|
3296
|
+
), (x, M) => r.datePicker ? (I(), H("div", ls, [
|
|
3297
|
+
fe(w(Xe), ie({ ...w(n), ...e }, {
|
|
3298
|
+
ref: "text-field",
|
|
3299
|
+
modelValue: o.value,
|
|
3300
|
+
"onUpdate:modelValue": [
|
|
3301
|
+
M[0] || (M[0] = (P) => o.value = P),
|
|
3302
|
+
A
|
|
3303
|
+
],
|
|
3304
|
+
class: m.value,
|
|
3305
|
+
"aria-controls": `${e.id}-date-picker`,
|
|
3306
|
+
"trailing-icon": w(Ge),
|
|
3307
|
+
min: void 0,
|
|
3308
|
+
max: void 0,
|
|
3309
|
+
error: p.value || e.error,
|
|
3310
|
+
"data-toggle": w(i)?.["data-toggle"],
|
|
3311
|
+
onFocus: V.value,
|
|
3312
|
+
onClick: V.value,
|
|
3313
|
+
onKeydown: M[1] || (M[1] = gt((P) => u.value?.focusDatePicker(P), ["tab"])),
|
|
3314
|
+
onComplete: v
|
|
3315
|
+
}), null, 16, ["modelValue", "class", "aria-controls", "trailing-icon", "error", "data-toggle", "onFocus", "onClick"]),
|
|
3316
|
+
a.value ? (I(), ue(us, ie({
|
|
3317
|
+
key: 0,
|
|
3318
|
+
id: `${e.id}-date-picker`,
|
|
3319
|
+
ref: "datePicker"
|
|
3320
|
+
}, e.datePickerOptions, {
|
|
3321
|
+
"initial-value": o.value,
|
|
3322
|
+
min: e.min,
|
|
3323
|
+
max: e.max,
|
|
3324
|
+
format: e.format,
|
|
3325
|
+
close: () => w(t)(!1),
|
|
3326
|
+
"onUpdate:modelValue": A
|
|
3327
|
+
}), null, 16, ["id", "initial-value", "min", "max", "format", "close"])) : de("", !0)
|
|
3328
|
+
])) : (I(), ue(w(Xe), ie({ key: 1 }, { ...w(n), ...e }, {
|
|
3329
|
+
modelValue: o.value,
|
|
3384
3330
|
"onUpdate:modelValue": [
|
|
3385
|
-
|
|
3386
|
-
|
|
3331
|
+
M[2] || (M[2] = (P) => o.value = P),
|
|
3332
|
+
A
|
|
3387
3333
|
],
|
|
3388
|
-
class:
|
|
3334
|
+
class: m.value,
|
|
3389
3335
|
label: "Date field",
|
|
3390
|
-
"trailing-icon":
|
|
3391
|
-
errors:
|
|
3336
|
+
"trailing-icon": w(Ge),
|
|
3337
|
+
errors: p.value || e.error,
|
|
3392
3338
|
min: void 0,
|
|
3393
3339
|
max: void 0
|
|
3394
|
-
}), null, 16, ["modelValue", "class", "errors"]));
|
|
3340
|
+
}), null, 16, ["modelValue", "class", "trailing-icon", "errors"]));
|
|
3395
3341
|
}
|
|
3396
|
-
}),
|
|
3342
|
+
}), lt = (r, e, t) => {
|
|
3397
3343
|
typeof r == "string" && (r = J(r));
|
|
3398
|
-
const s = e ? J(e) : null,
|
|
3399
|
-
return !(s && r.isBefore(s, "day") ||
|
|
3344
|
+
const s = e ? J(e) : null, i = t ? J(t) : null;
|
|
3345
|
+
return !(s && r.isBefore(s, "day") || i && r.isAfter(i, "day"));
|
|
3400
3346
|
};
|
|
3401
3347
|
export {
|
|
3402
|
-
|
|
3403
|
-
|
|
3348
|
+
cs as DateField,
|
|
3349
|
+
lt as isInDateRange
|
|
3404
3350
|
};
|