brd-ui-kit 0.1.70 → 0.1.71
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/brd-ui-kit.css +1 -1
- package/dist/components/ui/radio-group/radio-group.styles.d.ts +1 -1
- package/dist/components/ui/sonner/sonner.styles.d.ts +1 -1
- package/dist/components/ui/switch/switch.styles.d.ts +1 -1
- package/dist/components-input-phone-input-phone.cjs +1 -29
- package/dist/components-input-phone-input-phone.cjs.map +1 -1
- package/dist/components-input-phone-input-phone.js +469 -814
- package/dist/components-input-phone-input-phone.js.map +1 -1
- package/dist/components-ui-card-card.styles.cjs +2 -2
- package/dist/components-ui-card-card.styles.cjs.map +1 -1
- package/dist/components-ui-card-card.styles.js +6 -6
- package/dist/components-ui-card-card.styles.js.map +1 -1
- package/dist/components-ui-checkbox-checkbox.styles.cjs +1 -1
- package/dist/components-ui-checkbox-checkbox.styles.cjs.map +1 -1
- package/dist/components-ui-checkbox-checkbox.styles.js +2 -2
- package/dist/components-ui-checkbox-checkbox.styles.js.map +1 -1
- package/dist/components-ui-combobox-combobox.js +14 -14
- package/dist/components-ui-field-field.js +13 -13
- package/dist/components-ui-popover-popover.js +4 -4
- package/dist/components-ui-radio-group-radio-group.styles.cjs +1 -1
- package/dist/components-ui-radio-group-radio-group.styles.cjs.map +1 -1
- package/dist/components-ui-radio-group-radio-group.styles.js +2 -2
- package/dist/components-ui-radio-group-radio-group.styles.js.map +1 -1
- package/dist/components-ui-select-select.js +9 -9
- package/dist/components-ui-sonner-sonner.styles.cjs +1 -1
- package/dist/components-ui-sonner-sonner.styles.cjs.map +1 -1
- package/dist/components-ui-sonner-sonner.styles.js +1 -1
- package/dist/components-ui-sonner-sonner.styles.js.map +1 -1
- package/dist/components-ui-switch-switch.styles.cjs +1 -1
- package/dist/components-ui-switch-switch.styles.cjs.map +1 -1
- package/dist/components-ui-switch-switch.styles.js +2 -2
- package/dist/components-ui-switch-switch.styles.js.map +1 -1
- package/dist/components-ui-tabs-tabs.styles.cjs +1 -1
- package/dist/components-ui-tabs-tabs.styles.cjs.map +1 -1
- package/dist/components-ui-tabs-tabs.styles.js +1 -1
- package/dist/components-ui-tabs-tabs.styles.js.map +1 -1
- package/package.json +16 -15
|
@@ -1,411 +1,66 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import { extendTailwindMerge as ut } from "tailwind-merge";
|
|
6
|
-
import * as Y from "@radix-ui/react-label";
|
|
7
|
-
import { P as o } from "./index-Mf4QF1FW.js";
|
|
8
|
-
const lt = ut({
|
|
9
|
-
extend: {
|
|
10
|
-
theme: {
|
|
11
|
-
text: ["xxs", "xxl", "h-xs", "h-sm", "h-md", "h-lg", "h-xl", "h-xxl"]
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
function b(...r) {
|
|
16
|
-
return lt(rt(r));
|
|
17
|
-
}
|
|
18
|
-
const ot = {
|
|
19
|
-
"h-xxl-regular": "text-h-xxl font-normal",
|
|
20
|
-
"h-xxl-medium": "text-h-xxl font-medium",
|
|
21
|
-
"h-xl-regular": "text-h-xl font-normal",
|
|
22
|
-
"h-xl-medium": "text-h-xl font-medium",
|
|
23
|
-
"h-lg-regular": "text-h-lg font-normal",
|
|
24
|
-
"h-lg-medium": "text-h-lg font-medium",
|
|
25
|
-
"h-md-regular": "text-h-md font-normal",
|
|
26
|
-
"h-md-medium": "text-h-md font-medium",
|
|
27
|
-
"h-sm-regular": "text-h-sm font-normal",
|
|
28
|
-
"h-sm-medium": "text-h-sm font-medium",
|
|
29
|
-
"h-xs-regular": "text-h-xs font-normal",
|
|
30
|
-
"h-xs-medium": "text-h-xs font-medium",
|
|
31
|
-
"body-xxl-regular": "text-xxl font-normal",
|
|
32
|
-
"body-xxl-medium": "text-xxl font-medium",
|
|
33
|
-
"body-xxl-semibold": "text-xxl font-semibold",
|
|
34
|
-
"body-xl-regular": "text-xl font-normal",
|
|
35
|
-
"body-xl-medium": "text-xl font-medium",
|
|
36
|
-
"body-xl-semibold": "text-xl font-semibold",
|
|
37
|
-
"body-lg-regular": "text-lg font-normal",
|
|
38
|
-
"body-lg-medium": "text-lg font-medium",
|
|
39
|
-
"body-lg-semibold": "text-lg font-semibold",
|
|
40
|
-
"body-md-regular": "text-base font-normal",
|
|
41
|
-
"body-md-medium": "text-base font-medium",
|
|
42
|
-
"body-md-semibold": "text-base font-semibold",
|
|
43
|
-
"body-sm-regular": "text-sm font-normal",
|
|
44
|
-
"body-sm-medium": "text-sm font-medium",
|
|
45
|
-
"body-sm-semibold": "text-sm font-semibold",
|
|
46
|
-
"body-xs-regular": "text-xs font-normal",
|
|
47
|
-
"body-xs-medium": "text-xs font-medium",
|
|
48
|
-
"body-xs-semibold": "text-xs font-semibold",
|
|
49
|
-
"body-xxs-regular": "text-xxs font-normal",
|
|
50
|
-
"body-xxs-medium": "text-xxs font-medium",
|
|
51
|
-
"body-xxs-semibold": "text-xxs font-semibold"
|
|
52
|
-
}, ht = B("tracking-normal", {
|
|
53
|
-
variants: {
|
|
54
|
-
variant: ot
|
|
55
|
-
},
|
|
56
|
-
defaultVariants: {
|
|
57
|
-
variant: "body-md-regular"
|
|
58
|
-
}
|
|
59
|
-
}), j = (r = "body-md-regular") => ht({
|
|
60
|
-
variant: r
|
|
61
|
-
}), dt = B(j("body-sm-regular")), $ = ({ className: r, ref: t, ...e }) => /* @__PURE__ */ m(
|
|
62
|
-
Y.Root,
|
|
63
|
-
{
|
|
64
|
-
ref: t,
|
|
65
|
-
className: b(dt(), r),
|
|
66
|
-
...e
|
|
67
|
-
}
|
|
68
|
-
);
|
|
69
|
-
$.displayName = Y.Root.displayName;
|
|
70
|
-
const pt = B(
|
|
71
|
-
"group/field data-[invalid=true]:text-error-text flex h-full w-full gap-2",
|
|
72
|
-
{
|
|
73
|
-
variants: {
|
|
74
|
-
orientation: {
|
|
75
|
-
vertical: ["flex-col"],
|
|
76
|
-
horizontal: [
|
|
77
|
-
"flex-row items-center",
|
|
78
|
-
"*:data-[slot=field-label]:flex-auto",
|
|
79
|
-
`has-[>[data-slot=field-content]]:items-start
|
|
80
|
-
has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`
|
|
81
|
-
]
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
defaultVariants: {
|
|
85
|
-
orientation: "vertical"
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
), ct = "flex flex-col gap-6 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3", ft = "group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4", mt = [
|
|
89
|
-
`group/field-label peer/field-label text-primary-text flex w-fit gap-2 text-sm
|
|
90
|
-
leading-[150%] font-normal tracking-normal
|
|
91
|
-
group-data-[disabled=true]/field:opacity-50`,
|
|
92
|
-
"aria-invalid:text-error-text aria-valid:text-success-text disabled:text-disabled-text",
|
|
93
|
-
`has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col
|
|
94
|
-
has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border
|
|
95
|
-
*:data-[slot=field]:p-4`,
|
|
96
|
-
`has-data-[state=checked]:bg-primary/5 has-data-[state=checked]:border-primary
|
|
97
|
-
dark:has-data-[state=checked]:bg-primary/10`
|
|
98
|
-
].join(" ");
|
|
99
|
-
[
|
|
100
|
-
`text-primary-text flex w-fit items-center gap-2
|
|
101
|
-
group-data-[disabled=true]/field:opacity-50`,
|
|
102
|
-
j("body-sm-regular")
|
|
103
|
-
].join(" ");
|
|
104
|
-
const gt = [
|
|
105
|
-
"text-sub-label-text group-has-data-[orientation=horizontal]/field:text-balance",
|
|
106
|
-
"aria-invalid:text-error-text aria-valid:text-success-text disabled:text-disabled-text",
|
|
107
|
-
j("body-xs-regular"),
|
|
108
|
-
"last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5",
|
|
109
|
-
"[&>a:hover]:text-primary-text [&>a]:underline [&>a]:underline-offset-4"
|
|
110
|
-
].join(" ");
|
|
111
|
-
function kt({ className: r, ...t }) {
|
|
112
|
-
return /* @__PURE__ */ m(
|
|
113
|
-
"fieldset",
|
|
114
|
-
{
|
|
115
|
-
"data-slot": "field-set",
|
|
116
|
-
className: b(ct, r, "min-w-0 flex-1 w-full"),
|
|
117
|
-
...t
|
|
118
|
-
}
|
|
119
|
-
);
|
|
120
|
-
}
|
|
121
|
-
function _t({ className: r, ...t }) {
|
|
122
|
-
return /* @__PURE__ */ m(
|
|
123
|
-
"div",
|
|
124
|
-
{
|
|
125
|
-
"data-slot": "field-group",
|
|
126
|
-
className: b(ft, r),
|
|
127
|
-
...t
|
|
128
|
-
}
|
|
129
|
-
);
|
|
130
|
-
}
|
|
131
|
-
function vt({
|
|
132
|
-
className: r,
|
|
133
|
-
orientation: t = "vertical",
|
|
134
|
-
...e
|
|
135
|
-
}) {
|
|
136
|
-
return /* @__PURE__ */ m(
|
|
137
|
-
"div",
|
|
138
|
-
{
|
|
139
|
-
role: "group",
|
|
140
|
-
"data-slot": "field",
|
|
141
|
-
"data-orientation": t,
|
|
142
|
-
className: b(pt({ orientation: t }), r),
|
|
143
|
-
...e
|
|
144
|
-
}
|
|
145
|
-
);
|
|
146
|
-
}
|
|
147
|
-
function xt({ className: r, ...t }) {
|
|
148
|
-
return /* @__PURE__ */ m(
|
|
149
|
-
$,
|
|
150
|
-
{
|
|
151
|
-
"data-slot": "field-label",
|
|
152
|
-
className: b(mt, r),
|
|
153
|
-
...t
|
|
154
|
-
}
|
|
155
|
-
);
|
|
156
|
-
}
|
|
157
|
-
function Et({ className: r, ...t }) {
|
|
158
|
-
return /* @__PURE__ */ m(
|
|
159
|
-
"p",
|
|
160
|
-
{
|
|
161
|
-
"data-slot": "field-description",
|
|
162
|
-
className: b(gt, r),
|
|
163
|
-
...t
|
|
164
|
-
}
|
|
165
|
-
);
|
|
166
|
-
}
|
|
167
|
-
const bt = B(
|
|
168
|
-
`text-primary-text hover:border-inp-hover-border focus:border-inp-focus-border
|
|
169
|
-
placeholder:text-placeholder-text disabled:border-inp-disabled-border bg-primary-bg
|
|
170
|
-
disabled:bg-disabled-bg disabled:text-disabled-text
|
|
171
|
-
disabled:placeholder:text-disabled-text aria-invalid:border-error-text
|
|
172
|
-
aria-valid:border-success-text w-full rounded-xl border px-3 py-2.5 tracking-normal
|
|
173
|
-
placeholder:text-sm focus:outline-none focus-visible:ring-0
|
|
174
|
-
disabled:pointer-events-none`,
|
|
175
|
-
{
|
|
176
|
-
variants: {
|
|
177
|
-
variant: {
|
|
178
|
-
primary: "border-inp-default-border"
|
|
179
|
-
},
|
|
180
|
-
sizeInput: {
|
|
181
|
-
lg: "h-12 text-base",
|
|
182
|
-
md: "h-10 text-sm",
|
|
183
|
-
sm: "h-8 text-sm",
|
|
184
|
-
xs: "h-6 text-xs"
|
|
185
|
-
}
|
|
186
|
-
},
|
|
187
|
-
defaultVariants: {
|
|
188
|
-
variant: "primary",
|
|
189
|
-
sizeInput: "md"
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
), Z = ({ className: r, sizeInput: t, type: e, variant: s, ...i }) => /* @__PURE__ */ m(
|
|
193
|
-
"input",
|
|
194
|
-
{
|
|
195
|
-
"data-slot": "input",
|
|
196
|
-
type: e || "text",
|
|
197
|
-
className: b(bt({ variant: s, sizeInput: t }), r),
|
|
198
|
-
...i
|
|
199
|
-
}
|
|
200
|
-
), Ct = B(
|
|
201
|
-
`text-secondary-text group-data-[disabled=true]/input-group:text-disabled-text flex
|
|
202
|
-
h-auto shrink-0 cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium
|
|
203
|
-
select-none [&>kbd]:rounded-[calc(var(--radius)-5px)]
|
|
204
|
-
[&>svg:not([class*='size-'])]:size-4`,
|
|
205
|
-
{
|
|
206
|
-
variants: {
|
|
207
|
-
align: {
|
|
208
|
-
"inline-start": "order-first pl-3 has-[>button]:ml-[-0.45rem] has-[>kbd]:ml-[-0.35rem]",
|
|
209
|
-
"inline-end": "order-last pr-3 has-[>button]:mr-[-0.4rem] has-[>kbd]:mr-[-0.35rem]",
|
|
210
|
-
"block-start": `order-first w-full justify-start px-3 pt-3
|
|
211
|
-
group-has-[>input]/input-group:pt-2.5 [.border-b]:pb-3`,
|
|
212
|
-
"block-end": `order-last w-full justify-start px-3 pb-3
|
|
213
|
-
group-has-[>input]/input-group:pb-2.5 [.border-t]:pt-3`
|
|
214
|
-
}
|
|
215
|
-
},
|
|
216
|
-
defaultVariants: {
|
|
217
|
-
align: "inline-start"
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
);
|
|
221
|
-
B(
|
|
222
|
-
"flex items-center gap-2 text-sm shadow-none",
|
|
223
|
-
{
|
|
224
|
-
variants: {
|
|
225
|
-
size: {
|
|
226
|
-
xs: `h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-2 has-[>svg]:px-2
|
|
227
|
-
[&>svg:not([class*='size-'])]:size-3.5`,
|
|
228
|
-
sm: "h-8 gap-1.5 rounded-md px-2.5 has-[>svg]:px-2.5",
|
|
229
|
-
"icon-xs": "size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0",
|
|
230
|
-
"icon-sm": "size-8 p-0 has-[>svg]:p-0"
|
|
231
|
-
}
|
|
232
|
-
},
|
|
233
|
-
defaultVariants: {
|
|
234
|
-
size: "xs"
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
);
|
|
238
|
-
function At({ className: r, ...t }) {
|
|
239
|
-
return /* @__PURE__ */ m(
|
|
240
|
-
"div",
|
|
241
|
-
{
|
|
242
|
-
"data-slot": "input-group",
|
|
243
|
-
role: "group",
|
|
244
|
-
className: b(
|
|
245
|
-
`group/input-group border-inp-default-border bg-primary-bg relative flex w-full
|
|
246
|
-
items-center rounded-xl border transition-[color,box-shadow] outline-none`,
|
|
247
|
-
"h-10 has-[>textarea]:h-auto",
|
|
248
|
-
"hover:border-inp-hover-border",
|
|
249
|
-
"has-[>[data-align=inline-start]]:[&>input]:pl-2",
|
|
250
|
-
"has-[>[data-align=inline-end]]:[&>input]:pr-2",
|
|
251
|
-
`has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col
|
|
252
|
-
has-[>[data-align=block-start]]:[&>input]:pb-3`,
|
|
253
|
-
`has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col
|
|
254
|
-
has-[>[data-align=block-end]]:[&>input]:pt-3`,
|
|
255
|
-
`has-[[data-slot=input-group-control]:focus-visible]:ring-inp-focus-border/20
|
|
256
|
-
has-[[data-slot=input-group-control]:focus-visible]:border-inp-focus-border`,
|
|
257
|
-
"has-[[data-slot=input-group-control][aria-invalid=true]]:border-error-text",
|
|
258
|
-
"has-[[data-slot=input-group-control][aria-valid=true]]:border-success-text",
|
|
259
|
-
`has-[[data-slot=input-group-control][disabled]]:border-inp-disabled-border
|
|
260
|
-
has-[[data-slot=input-group-control][disabled]]:bg-disabled-bg
|
|
261
|
-
has-[[data-slot=input-group-control][disabled]]:text-disabled-text
|
|
262
|
-
has-[[data-slot=input-group-control][disabled]]:[&_svg]:text-disabled-text`,
|
|
263
|
-
r
|
|
264
|
-
),
|
|
265
|
-
...t
|
|
266
|
-
}
|
|
267
|
-
);
|
|
268
|
-
}
|
|
269
|
-
function Ft({
|
|
270
|
-
className: r,
|
|
271
|
-
align: t = "inline-start",
|
|
272
|
-
...e
|
|
273
|
-
}) {
|
|
274
|
-
return /* @__PURE__ */ m(
|
|
275
|
-
"div",
|
|
276
|
-
{
|
|
277
|
-
role: "group",
|
|
278
|
-
"data-slot": "input-group-addon",
|
|
279
|
-
"data-align": t,
|
|
280
|
-
className: b(Ct({ align: t }), r),
|
|
281
|
-
onClick: (s) => {
|
|
282
|
-
s.target.closest("button") || s.currentTarget.parentElement?.querySelector("input")?.focus();
|
|
283
|
-
},
|
|
284
|
-
...e
|
|
285
|
-
}
|
|
286
|
-
);
|
|
287
|
-
}
|
|
288
|
-
function yt(r) {
|
|
289
|
-
return /* @__PURE__ */ m(
|
|
290
|
-
Z,
|
|
291
|
-
{
|
|
292
|
-
"data-slot": "input-group-control",
|
|
293
|
-
className: b(
|
|
294
|
-
`w-0 min-w-0 flex-1 rounded-none border-0 bg-transparent shadow-none
|
|
295
|
-
focus-visible:ring-0 disabled:border-0 disabled:bg-transparent
|
|
296
|
-
dark:bg-transparent`,
|
|
297
|
-
r.className
|
|
298
|
-
),
|
|
299
|
-
...r
|
|
300
|
-
}
|
|
301
|
-
);
|
|
302
|
-
}
|
|
303
|
-
const St = ({
|
|
304
|
-
date: r = [],
|
|
305
|
-
isValid: t,
|
|
306
|
-
disabled: e = !1,
|
|
307
|
-
label: s,
|
|
308
|
-
description: i,
|
|
309
|
-
classes: a,
|
|
310
|
-
ref: n,
|
|
311
|
-
...u
|
|
312
|
-
}) => {
|
|
313
|
-
const l = {
|
|
314
|
-
...t === !0 && !e && { "aria-valid": !0 },
|
|
315
|
-
...t === !1 && !e && { "aria-invalid": !0 },
|
|
316
|
-
disabled: e
|
|
317
|
-
};
|
|
318
|
-
return /* @__PURE__ */ m(kt, { className: a?.fieldset, children: /* @__PURE__ */ m(_t, { className: a?.fieldgroup, children: /* @__PURE__ */ K(vt, { className: a?.field, children: [
|
|
319
|
-
s && /* @__PURE__ */ m(xt, { ...l, children: s }),
|
|
320
|
-
r.length > 0 ? /* @__PURE__ */ K(At, { "data-slot": !0, children: [
|
|
321
|
-
/* @__PURE__ */ m(
|
|
322
|
-
yt,
|
|
323
|
-
{
|
|
324
|
-
ref: n,
|
|
325
|
-
...u,
|
|
326
|
-
...l,
|
|
327
|
-
disabled: e
|
|
328
|
-
}
|
|
329
|
-
),
|
|
330
|
-
r.map((d) => /* @__PURE__ */ m(
|
|
331
|
-
Ft,
|
|
332
|
-
{
|
|
333
|
-
align: d.position,
|
|
334
|
-
children: d.component
|
|
335
|
-
},
|
|
336
|
-
d.id
|
|
337
|
-
))
|
|
338
|
-
] }) : /* @__PURE__ */ m(
|
|
339
|
-
Z,
|
|
340
|
-
{
|
|
341
|
-
ref: n,
|
|
342
|
-
...u,
|
|
343
|
-
...l,
|
|
344
|
-
disabled: e
|
|
345
|
-
}
|
|
346
|
-
),
|
|
347
|
-
i && /* @__PURE__ */ m(Et, { ...l, children: i })
|
|
348
|
-
] }) }) });
|
|
349
|
-
};
|
|
1
|
+
import { jsx as H } from "react/jsx-runtime";
|
|
2
|
+
import { InputField as Q } from "./components-input-field-input-field.js";
|
|
3
|
+
import x from "react";
|
|
4
|
+
import { P as l } from "./index-Mf4QF1FW.js";
|
|
350
5
|
function F(r) {
|
|
351
6
|
return typeof r == "string" || r instanceof String;
|
|
352
7
|
}
|
|
353
|
-
function
|
|
8
|
+
function U(r) {
|
|
354
9
|
var t;
|
|
355
10
|
return typeof r == "object" && r != null && (r == null || (t = r.constructor) == null ? void 0 : t.name) === "Object";
|
|
356
11
|
}
|
|
357
|
-
function
|
|
358
|
-
return Array.isArray(t) ?
|
|
359
|
-
let [i,
|
|
360
|
-
return t(
|
|
12
|
+
function K(r, t) {
|
|
13
|
+
return Array.isArray(t) ? K(r, (e, s) => t.includes(s)) : Object.entries(r).reduce((e, s) => {
|
|
14
|
+
let [i, n] = s;
|
|
15
|
+
return t(n, i) && (e[i] = n), e;
|
|
361
16
|
}, {});
|
|
362
17
|
}
|
|
363
|
-
const
|
|
18
|
+
const o = {
|
|
364
19
|
NONE: "NONE",
|
|
365
20
|
LEFT: "LEFT",
|
|
366
21
|
FORCE_LEFT: "FORCE_LEFT",
|
|
367
22
|
RIGHT: "RIGHT",
|
|
368
23
|
FORCE_RIGHT: "FORCE_RIGHT"
|
|
369
24
|
};
|
|
370
|
-
function
|
|
25
|
+
function tt(r) {
|
|
371
26
|
switch (r) {
|
|
372
|
-
case
|
|
373
|
-
return
|
|
374
|
-
case
|
|
375
|
-
return
|
|
27
|
+
case o.LEFT:
|
|
28
|
+
return o.FORCE_LEFT;
|
|
29
|
+
case o.RIGHT:
|
|
30
|
+
return o.FORCE_RIGHT;
|
|
376
31
|
default:
|
|
377
32
|
return r;
|
|
378
33
|
}
|
|
379
34
|
}
|
|
380
|
-
function
|
|
35
|
+
function O(r) {
|
|
381
36
|
return r.replace(/([.*+?^=!:${}()|[\]/\\])/g, "\\$1");
|
|
382
37
|
}
|
|
383
|
-
function
|
|
38
|
+
function b(r, t) {
|
|
384
39
|
if (t === r) return !0;
|
|
385
40
|
const e = Array.isArray(t), s = Array.isArray(r);
|
|
386
41
|
let i;
|
|
387
42
|
if (e && s) {
|
|
388
43
|
if (t.length != r.length) return !1;
|
|
389
|
-
for (i = 0; i < t.length; i++) if (!
|
|
44
|
+
for (i = 0; i < t.length; i++) if (!b(t[i], r[i])) return !1;
|
|
390
45
|
return !0;
|
|
391
46
|
}
|
|
392
47
|
if (e != s) return !1;
|
|
393
48
|
if (t && r && typeof t == "object" && typeof r == "object") {
|
|
394
|
-
const
|
|
395
|
-
if (
|
|
396
|
-
if (
|
|
397
|
-
const u = t instanceof RegExp,
|
|
398
|
-
if (u &&
|
|
399
|
-
if (u !=
|
|
400
|
-
const
|
|
401
|
-
for (i = 0; i <
|
|
402
|
-
for (i = 0; i <
|
|
49
|
+
const n = t instanceof Date, a = r instanceof Date;
|
|
50
|
+
if (n && a) return t.getTime() == r.getTime();
|
|
51
|
+
if (n != a) return !1;
|
|
52
|
+
const u = t instanceof RegExp, h = r instanceof RegExp;
|
|
53
|
+
if (u && h) return t.toString() == r.toString();
|
|
54
|
+
if (u != h) return !1;
|
|
55
|
+
const p = Object.keys(t);
|
|
56
|
+
for (i = 0; i < p.length; i++) if (!Object.prototype.hasOwnProperty.call(r, p[i])) return !1;
|
|
57
|
+
for (i = 0; i < p.length; i++) if (!b(r[p[i]], t[p[i]])) return !1;
|
|
403
58
|
return !0;
|
|
404
59
|
} else if (t && r && typeof t == "function" && typeof r == "function")
|
|
405
60
|
return t.toString() === r.toString();
|
|
406
61
|
return !1;
|
|
407
62
|
}
|
|
408
|
-
class
|
|
63
|
+
class et {
|
|
409
64
|
/** Current input value */
|
|
410
65
|
/** Current cursor position */
|
|
411
66
|
/** Old input value */
|
|
@@ -448,53 +103,53 @@ class It {
|
|
|
448
103
|
}
|
|
449
104
|
/** Remove direction */
|
|
450
105
|
get removeDirection() {
|
|
451
|
-
return !this.removedCount || this.insertedCount ?
|
|
452
|
-
this.oldSelection.end === this.oldSelection.start ?
|
|
106
|
+
return !this.removedCount || this.insertedCount ? o.NONE : (this.oldSelection.end === this.cursorPos || this.oldSelection.start === this.cursorPos) && // if not range removed (event with backspace)
|
|
107
|
+
this.oldSelection.end === this.oldSelection.start ? o.RIGHT : o.LEFT;
|
|
453
108
|
}
|
|
454
109
|
}
|
|
455
|
-
function
|
|
456
|
-
return new
|
|
110
|
+
function d(r, t) {
|
|
111
|
+
return new d.InputMask(r, t);
|
|
457
112
|
}
|
|
458
|
-
function
|
|
113
|
+
function z(r) {
|
|
459
114
|
if (r == null) throw new Error("mask property should be defined");
|
|
460
|
-
return r instanceof RegExp ?
|
|
115
|
+
return r instanceof RegExp ? d.MaskedRegExp : F(r) ? d.MaskedPattern : r === Date ? d.MaskedDate : r === Number ? d.MaskedNumber : Array.isArray(r) || r === Array ? d.MaskedDynamic : d.Masked && r.prototype instanceof d.Masked ? r : d.Masked && r instanceof d.Masked ? r.constructor : r instanceof Function ? d.MaskedFunction : (console.warn("Mask not found for mask", r), d.Masked);
|
|
461
116
|
}
|
|
462
|
-
function
|
|
117
|
+
function B(r) {
|
|
463
118
|
if (!r) throw new Error("Options in not defined");
|
|
464
|
-
if (
|
|
465
|
-
if (r.prototype instanceof
|
|
119
|
+
if (d.Masked) {
|
|
120
|
+
if (r.prototype instanceof d.Masked) return {
|
|
466
121
|
mask: r
|
|
467
122
|
};
|
|
468
123
|
const {
|
|
469
124
|
mask: t = void 0,
|
|
470
125
|
...e
|
|
471
|
-
} = r instanceof
|
|
126
|
+
} = r instanceof d.Masked ? {
|
|
472
127
|
mask: r
|
|
473
|
-
} :
|
|
128
|
+
} : U(r) && r.mask instanceof d.Masked ? r : {};
|
|
474
129
|
if (t) {
|
|
475
130
|
const s = t.mask;
|
|
476
131
|
return {
|
|
477
|
-
...
|
|
132
|
+
...K(t, (i, n) => !n.startsWith("_")),
|
|
478
133
|
mask: t.constructor,
|
|
479
134
|
_mask: s,
|
|
480
135
|
...e
|
|
481
136
|
};
|
|
482
137
|
}
|
|
483
138
|
}
|
|
484
|
-
return
|
|
139
|
+
return U(r) ? {
|
|
485
140
|
...r
|
|
486
141
|
} : {
|
|
487
142
|
mask: r
|
|
488
143
|
};
|
|
489
144
|
}
|
|
490
145
|
function A(r) {
|
|
491
|
-
if (
|
|
492
|
-
const t =
|
|
146
|
+
if (d.Masked && r instanceof d.Masked) return r;
|
|
147
|
+
const t = B(r), e = z(t.mask);
|
|
493
148
|
if (!e) throw new Error("Masked class is not found for provided mask " + t.mask + ", appropriate module needs to be imported manually before creating mask.");
|
|
494
149
|
return t.mask === e && delete t.mask, t._mask && (t.mask = t._mask, delete t._mask), new e(t);
|
|
495
150
|
}
|
|
496
|
-
|
|
497
|
-
class
|
|
151
|
+
d.createMask = A;
|
|
152
|
+
class N {
|
|
498
153
|
/** */
|
|
499
154
|
/** */
|
|
500
155
|
/** */
|
|
@@ -532,9 +187,9 @@ class z {
|
|
|
532
187
|
/** */
|
|
533
188
|
/** */
|
|
534
189
|
}
|
|
535
|
-
|
|
536
|
-
const
|
|
537
|
-
class
|
|
190
|
+
d.MaskElement = N;
|
|
191
|
+
const j = 90, st = 89;
|
|
192
|
+
class D extends N {
|
|
538
193
|
/** HTMLElement to use mask on */
|
|
539
194
|
constructor(t) {
|
|
540
195
|
super(), this.input = t, this._onKeydown = this._onKeydown.bind(this), this._onInput = this._onInput.bind(this), this._onBeforeinput = this._onBeforeinput.bind(this), this._onCompositionEnd = this._onCompositionEnd.bind(this);
|
|
@@ -552,9 +207,9 @@ class T extends z {
|
|
|
552
207
|
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", t.drop), this.input.addEventListener("click", t.click), this.input.addEventListener("focus", t.focus), this.input.addEventListener("blur", t.commit), this._handlers = t;
|
|
553
208
|
}
|
|
554
209
|
_onKeydown(t) {
|
|
555
|
-
if (this._handlers.redo && (t.keyCode ===
|
|
210
|
+
if (this._handlers.redo && (t.keyCode === j && t.shiftKey && (t.metaKey || t.ctrlKey) || t.keyCode === st && t.ctrlKey))
|
|
556
211
|
return t.preventDefault(), this._handlers.redo(t);
|
|
557
|
-
if (this._handlers.undo && t.keyCode ===
|
|
212
|
+
if (this._handlers.undo && t.keyCode === j && (t.metaKey || t.ctrlKey))
|
|
558
213
|
return t.preventDefault(), this._handlers.undo(t);
|
|
559
214
|
t.isComposing || this._handlers.selectionChange(t);
|
|
560
215
|
}
|
|
@@ -575,8 +230,8 @@ class T extends z {
|
|
|
575
230
|
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 = {};
|
|
576
231
|
}
|
|
577
232
|
}
|
|
578
|
-
|
|
579
|
-
class
|
|
233
|
+
d.HTMLMaskElement = D;
|
|
234
|
+
class it extends D {
|
|
580
235
|
/** InputElement to use mask on */
|
|
581
236
|
constructor(t) {
|
|
582
237
|
super(t), this.input = t;
|
|
@@ -600,8 +255,8 @@ class wt extends T {
|
|
|
600
255
|
this.input.value = t;
|
|
601
256
|
}
|
|
602
257
|
}
|
|
603
|
-
|
|
604
|
-
class
|
|
258
|
+
d.HTMLMaskElement = D;
|
|
259
|
+
class G extends D {
|
|
605
260
|
/** Returns HTMLElement selection start */
|
|
606
261
|
get _unsafeSelectionStart() {
|
|
607
262
|
const t = this.rootElement, e = t.getSelection && t.getSelection(), s = e && e.anchorOffset, i = e && e.focusOffset;
|
|
@@ -617,8 +272,8 @@ class J extends T {
|
|
|
617
272
|
if (!this.rootElement.createRange) return;
|
|
618
273
|
const s = this.rootElement.createRange();
|
|
619
274
|
s.setStart(this.input.firstChild || this.input, t), s.setEnd(this.input.lastChild || this.input, e);
|
|
620
|
-
const i = this.rootElement,
|
|
621
|
-
|
|
275
|
+
const i = this.rootElement, n = i.getSelection && i.getSelection();
|
|
276
|
+
n && (n.removeAllRanges(), n.addRange(s));
|
|
622
277
|
}
|
|
623
278
|
/** HTMLElement value */
|
|
624
279
|
get value() {
|
|
@@ -628,8 +283,8 @@ class J extends T {
|
|
|
628
283
|
this.input.textContent = t;
|
|
629
284
|
}
|
|
630
285
|
}
|
|
631
|
-
|
|
632
|
-
class
|
|
286
|
+
d.HTMLContenteditableMaskElement = G;
|
|
287
|
+
class M {
|
|
633
288
|
constructor() {
|
|
634
289
|
this.states = [], this.currentIndex = 0;
|
|
635
290
|
}
|
|
@@ -640,7 +295,7 @@ class R {
|
|
|
640
295
|
return this.states.length === 0;
|
|
641
296
|
}
|
|
642
297
|
push(t) {
|
|
643
|
-
this.currentIndex < this.states.length - 1 && (this.states.length = this.currentIndex + 1), this.states.push(t), this.states.length >
|
|
298
|
+
this.currentIndex < this.states.length - 1 && (this.states.length = this.currentIndex + 1), this.states.push(t), this.states.length > M.MAX_LENGTH && this.states.shift(), this.currentIndex = this.states.length - 1;
|
|
644
299
|
}
|
|
645
300
|
go(t) {
|
|
646
301
|
return this.currentIndex = Math.min(Math.max(this.currentIndex + t, 0), this.states.length - 1), this.currentState;
|
|
@@ -655,14 +310,14 @@ class R {
|
|
|
655
310
|
this.states.length = 0, this.currentIndex = 0;
|
|
656
311
|
}
|
|
657
312
|
}
|
|
658
|
-
|
|
659
|
-
class
|
|
313
|
+
M.MAX_LENGTH = 100;
|
|
314
|
+
class nt {
|
|
660
315
|
/**
|
|
661
316
|
View element
|
|
662
317
|
*/
|
|
663
318
|
/** Internal {@link Masked} model */
|
|
664
319
|
constructor(t, e) {
|
|
665
|
-
this.el = t instanceof
|
|
320
|
+
this.el = t instanceof N ? t : t.isContentEditable && t.tagName !== "INPUT" && t.tagName !== "TEXTAREA" ? new G(t) : new it(t), this.masked = A(e), this._listeners = {}, this._value = "", this._unmaskedValue = "", this._rawInputValue = "", this.history = new M(), 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();
|
|
666
321
|
}
|
|
667
322
|
maskEquals(t) {
|
|
668
323
|
var e;
|
|
@@ -674,13 +329,13 @@ class Mt {
|
|
|
674
329
|
}
|
|
675
330
|
set mask(t) {
|
|
676
331
|
if (this.maskEquals(t)) return;
|
|
677
|
-
if (!(t instanceof
|
|
332
|
+
if (!(t instanceof d.Masked) && this.masked.constructor === z(t)) {
|
|
678
333
|
this.masked.updateOptions({
|
|
679
334
|
mask: t
|
|
680
335
|
});
|
|
681
336
|
return;
|
|
682
337
|
}
|
|
683
|
-
const e = t instanceof
|
|
338
|
+
const e = t instanceof d.Masked ? t : A({
|
|
684
339
|
mask: t
|
|
685
340
|
});
|
|
686
341
|
e.unmaskedValue = this.masked.unmaskedValue, this.masked = e;
|
|
@@ -763,8 +418,8 @@ class Mt {
|
|
|
763
418
|
}
|
|
764
419
|
/** Syncronizes view from model value, fires change events */
|
|
765
420
|
updateControl(t) {
|
|
766
|
-
const e = this.masked.unmaskedValue, s = this.masked.value, i = this.masked.rawInputValue,
|
|
767
|
-
this._unmaskedValue = e, this._value = s, this._rawInputValue = i, this.el.value !==
|
|
421
|
+
const e = this.masked.unmaskedValue, s = this.masked.value, i = this.masked.rawInputValue, n = this.displayValue, a = this.unmaskedValue !== e || this.value !== s || this._rawInputValue !== i;
|
|
422
|
+
this._unmaskedValue = e, this._value = s, this._rawInputValue = i, this.el.value !== n && (this.el.value = n), t === "auto" ? this.alignCursor() : t != null && (this.cursorPos = t), a && this._fireChangeEvents(), !this._historyChanging && (a || this.history.isEmpty) && this.history.push({
|
|
768
423
|
unmaskedValue: e,
|
|
769
424
|
selection: {
|
|
770
425
|
start: this.selectionStart,
|
|
@@ -777,8 +432,8 @@ class Mt {
|
|
|
777
432
|
const {
|
|
778
433
|
mask: e,
|
|
779
434
|
...s
|
|
780
|
-
} = t, i = !this.maskEquals(e),
|
|
781
|
-
i && (this.mask = e),
|
|
435
|
+
} = t, i = !this.maskEquals(e), n = this.masked.optionsIsChanged(s);
|
|
436
|
+
i && (this.mask = e), n && this.masked.updateOptions(s), (i || n) && this.updateControl();
|
|
782
437
|
}
|
|
783
438
|
/** Updates cursor */
|
|
784
439
|
updateCursor(t) {
|
|
@@ -800,7 +455,7 @@ class Mt {
|
|
|
800
455
|
}
|
|
801
456
|
/** Aligns cursor to nearest available position */
|
|
802
457
|
alignCursor() {
|
|
803
|
-
this.cursorPos = this.masked.nearestInputPos(this.masked.nearestInputPos(this.cursorPos,
|
|
458
|
+
this.cursorPos = this.masked.nearestInputPos(this.masked.nearestInputPos(this.cursorPos, o.LEFT));
|
|
804
459
|
}
|
|
805
460
|
/** Aligns cursor only if selection is empty */
|
|
806
461
|
alignCursorFriendly() {
|
|
@@ -821,7 +476,7 @@ class Mt {
|
|
|
821
476
|
/** Handles view input event */
|
|
822
477
|
_onInput(t) {
|
|
823
478
|
this._inputEvent = t, this._abortUpdateCursor();
|
|
824
|
-
const e = new
|
|
479
|
+
const e = new et({
|
|
825
480
|
// new state
|
|
826
481
|
value: this.el.value,
|
|
827
482
|
cursorPos: this.cursorPos,
|
|
@@ -831,9 +486,9 @@ class Mt {
|
|
|
831
486
|
}), s = this.masked.rawInputValue, i = this.masked.splice(e.startChangePos, e.removed.length, e.inserted, e.removeDirection, {
|
|
832
487
|
input: !0,
|
|
833
488
|
raw: !0
|
|
834
|
-
}).offset,
|
|
835
|
-
let
|
|
836
|
-
|
|
489
|
+
}).offset, n = s === this.masked.rawInputValue ? e.removeDirection : o.NONE;
|
|
490
|
+
let a = this.masked.nearestInputPos(e.startChangePos + i, n);
|
|
491
|
+
n !== o.NONE && (a = this.masked.nearestInputPos(a, o.NONE)), this.updateControl(a), delete this._inputEvent;
|
|
837
492
|
}
|
|
838
493
|
/** Handles view change event and commits model value */
|
|
839
494
|
_onChange() {
|
|
@@ -865,7 +520,7 @@ class Mt {
|
|
|
865
520
|
this._unbindEvents(), this._listeners.length = 0, delete this.el;
|
|
866
521
|
}
|
|
867
522
|
}
|
|
868
|
-
|
|
523
|
+
d.InputMask = nt;
|
|
869
524
|
class c {
|
|
870
525
|
/** Inserted symbols */
|
|
871
526
|
/** Additional offset if any changes occurred before tail */
|
|
@@ -897,7 +552,7 @@ class c {
|
|
|
897
552
|
return this.inserted === t.inserted && this.tailShift === t.tailShift && this.rawInserted === t.rawInserted && this.skip === t.skip;
|
|
898
553
|
}
|
|
899
554
|
}
|
|
900
|
-
|
|
555
|
+
d.ChangeDetails = c;
|
|
901
556
|
class E {
|
|
902
557
|
/** Tail value as string */
|
|
903
558
|
/** Tail start position */
|
|
@@ -937,7 +592,7 @@ class E {
|
|
|
937
592
|
return this.value = this.value.slice(0, -1), t;
|
|
938
593
|
}
|
|
939
594
|
}
|
|
940
|
-
class
|
|
595
|
+
class m {
|
|
941
596
|
/** */
|
|
942
597
|
/** */
|
|
943
598
|
/** Transforms value before mask processing */
|
|
@@ -953,7 +608,7 @@ class k {
|
|
|
953
608
|
/** */
|
|
954
609
|
constructor(t) {
|
|
955
610
|
this._value = "", this._update({
|
|
956
|
-
...
|
|
611
|
+
...m.DEFAULTS,
|
|
957
612
|
...t
|
|
958
613
|
}), this._initialized = !0;
|
|
959
614
|
}
|
|
@@ -1055,35 +710,35 @@ class k {
|
|
|
1055
710
|
_appendChar(t, e, s) {
|
|
1056
711
|
e === void 0 && (e = {});
|
|
1057
712
|
const i = this.state;
|
|
1058
|
-
let
|
|
1059
|
-
if ([t,
|
|
1060
|
-
const
|
|
713
|
+
let n;
|
|
714
|
+
if ([t, n] = this.doPrepareChar(t, e), t && (n = n.aggregate(this._appendCharRaw(t, e)), !n.rawInserted && this.autofix === "pad")) {
|
|
715
|
+
const a = this.state;
|
|
1061
716
|
this.state = i;
|
|
1062
717
|
let u = this.pad(e);
|
|
1063
|
-
const
|
|
1064
|
-
u = u.aggregate(
|
|
718
|
+
const h = this._appendCharRaw(t, e);
|
|
719
|
+
u = u.aggregate(h), h.rawInserted || u.equals(n) ? n = u : this.state = a;
|
|
1065
720
|
}
|
|
1066
|
-
if (
|
|
1067
|
-
let
|
|
721
|
+
if (n.inserted) {
|
|
722
|
+
let a, u = this.doValidate(e) !== !1;
|
|
1068
723
|
if (u && s != null) {
|
|
1069
|
-
const
|
|
724
|
+
const h = this.state;
|
|
1070
725
|
if (this.overwrite === !0) {
|
|
1071
|
-
|
|
1072
|
-
for (let f = 0; f <
|
|
1073
|
-
s.unshift(this.displayValue.length -
|
|
726
|
+
a = s.state;
|
|
727
|
+
for (let f = 0; f < n.rawInserted.length; ++f)
|
|
728
|
+
s.unshift(this.displayValue.length - n.tailShift);
|
|
1074
729
|
}
|
|
1075
|
-
let
|
|
1076
|
-
if (u =
|
|
1077
|
-
this.state =
|
|
1078
|
-
for (let f = 0; f <
|
|
730
|
+
let p = this.appendTail(s);
|
|
731
|
+
if (u = p.rawInserted.length === s.toString().length, !(u && p.inserted) && this.overwrite === "shift") {
|
|
732
|
+
this.state = h, a = s.state;
|
|
733
|
+
for (let f = 0; f < n.rawInserted.length; ++f)
|
|
1079
734
|
s.shift();
|
|
1080
|
-
|
|
735
|
+
p = this.appendTail(s), u = p.rawInserted.length === s.toString().length;
|
|
1081
736
|
}
|
|
1082
|
-
u &&
|
|
737
|
+
u && p.inserted && (this.state = h);
|
|
1083
738
|
}
|
|
1084
|
-
u || (
|
|
739
|
+
u || (n = new c(), this.state = i, s && a && (s.state = a));
|
|
1085
740
|
}
|
|
1086
|
-
return
|
|
741
|
+
return n;
|
|
1087
742
|
}
|
|
1088
743
|
/** Appends optional placeholder at the end */
|
|
1089
744
|
_appendPlaceholder() {
|
|
@@ -1098,14 +753,14 @@ class k {
|
|
|
1098
753
|
if (!F(t)) throw new Error("value should be string");
|
|
1099
754
|
const i = F(s) ? new E(String(s)) : s;
|
|
1100
755
|
e != null && e.tail && (e._beforeTailState = this.state);
|
|
1101
|
-
let
|
|
1102
|
-
[t,
|
|
1103
|
-
for (let
|
|
1104
|
-
const u = this._appendChar(t[
|
|
1105
|
-
if (!u.rawInserted && !this.doSkipInvalid(t[
|
|
1106
|
-
|
|
756
|
+
let n;
|
|
757
|
+
[t, n] = this.doPrepare(t, e);
|
|
758
|
+
for (let a = 0; a < t.length; ++a) {
|
|
759
|
+
const u = this._appendChar(t[a], e, i);
|
|
760
|
+
if (!u.rawInserted && !this.doSkipInvalid(t[a], e, i)) break;
|
|
761
|
+
n.aggregate(u);
|
|
1107
762
|
}
|
|
1108
|
-
return (this.eager === !0 || this.eager === "append") && e != null && e.input && t &&
|
|
763
|
+
return (this.eager === !0 || this.eager === "append") && e != null && e.input && t && n.aggregate(this._appendEager()), i != null && (n.tailShift += this.appendTail(i).tailShift), n;
|
|
1109
764
|
}
|
|
1110
765
|
remove(t, e) {
|
|
1111
766
|
return t === void 0 && (t = 0), e === void 0 && (e = this.displayValue.length), this._value = this.displayValue.slice(0, t) + this.displayValue.slice(e), new c();
|
|
@@ -1142,46 +797,46 @@ class k {
|
|
|
1142
797
|
doCommit() {
|
|
1143
798
|
this.commit && this.commit(this.value, this);
|
|
1144
799
|
}
|
|
1145
|
-
splice(t, e, s, i,
|
|
1146
|
-
s === void 0 && (s = ""), i === void 0 && (i =
|
|
800
|
+
splice(t, e, s, i, n) {
|
|
801
|
+
s === void 0 && (s = ""), i === void 0 && (i = o.NONE), n === void 0 && (n = {
|
|
1147
802
|
input: !0
|
|
1148
803
|
});
|
|
1149
|
-
const
|
|
1150
|
-
let
|
|
1151
|
-
|
|
804
|
+
const a = t + e, u = this.extractTail(a), h = this.eager === !0 || this.eager === "remove";
|
|
805
|
+
let p;
|
|
806
|
+
h && (i = tt(i), p = this.extractInput(0, a, {
|
|
1152
807
|
raw: !0
|
|
1153
808
|
}));
|
|
1154
809
|
let f = t;
|
|
1155
|
-
const
|
|
1156
|
-
if (i !==
|
|
1157
|
-
if (i ===
|
|
1158
|
-
let
|
|
1159
|
-
for (;
|
|
1160
|
-
|
|
810
|
+
const k = new c();
|
|
811
|
+
if (i !== o.NONE && (f = this.nearestInputPos(t, e > 1 && t !== 0 && !h ? o.NONE : i), k.tailShift = f - t), k.aggregate(this.remove(f)), h && i !== o.NONE && p === this.rawInputValue)
|
|
812
|
+
if (i === o.FORCE_LEFT) {
|
|
813
|
+
let _;
|
|
814
|
+
for (; p === this.rawInputValue && (_ = this.displayValue.length); )
|
|
815
|
+
k.aggregate(new c({
|
|
1161
816
|
tailShift: -1
|
|
1162
|
-
})).aggregate(this.remove(
|
|
1163
|
-
} else i ===
|
|
1164
|
-
return
|
|
817
|
+
})).aggregate(this.remove(_ - 1));
|
|
818
|
+
} else i === o.FORCE_RIGHT && u.unshift();
|
|
819
|
+
return k.aggregate(this.append(s, n, u));
|
|
1165
820
|
}
|
|
1166
821
|
maskEquals(t) {
|
|
1167
822
|
return this.mask === t;
|
|
1168
823
|
}
|
|
1169
824
|
optionsIsChanged(t) {
|
|
1170
|
-
return !
|
|
825
|
+
return !b(this, t);
|
|
1171
826
|
}
|
|
1172
827
|
typedValueEquals(t) {
|
|
1173
828
|
const e = this.typedValue;
|
|
1174
|
-
return t === e ||
|
|
829
|
+
return t === e || m.EMPTY_VALUES.includes(t) && m.EMPTY_VALUES.includes(e) || (this.format ? this.format(t, this) === this.format(this.typedValue, this) : !1);
|
|
1175
830
|
}
|
|
1176
831
|
pad(t) {
|
|
1177
832
|
return new c();
|
|
1178
833
|
}
|
|
1179
834
|
}
|
|
1180
|
-
|
|
835
|
+
m.DEFAULTS = {
|
|
1181
836
|
skipInvalid: !0
|
|
1182
837
|
};
|
|
1183
|
-
|
|
1184
|
-
|
|
838
|
+
m.EMPTY_VALUES = [void 0, null, ""];
|
|
839
|
+
d.Masked = m;
|
|
1185
840
|
class S {
|
|
1186
841
|
/** */
|
|
1187
842
|
constructor(t, e) {
|
|
@@ -1208,19 +863,19 @@ class S {
|
|
|
1208
863
|
}
|
|
1209
864
|
}
|
|
1210
865
|
appendTo(t) {
|
|
1211
|
-
if (!(t instanceof
|
|
866
|
+
if (!(t instanceof d.MaskedPattern))
|
|
1212
867
|
return new E(this.toString()).appendTo(t);
|
|
1213
868
|
const e = new c();
|
|
1214
869
|
for (let s = 0; s < this.chunks.length; ++s) {
|
|
1215
|
-
const i = this.chunks[s],
|
|
870
|
+
const i = this.chunks[s], n = t._mapPosToBlock(t.displayValue.length), a = i.stop;
|
|
1216
871
|
let u;
|
|
1217
|
-
if (
|
|
1218
|
-
(!
|
|
1219
|
-
t._stops.indexOf(
|
|
1220
|
-
const
|
|
1221
|
-
e.aggregate(
|
|
1222
|
-
const
|
|
1223
|
-
|
|
872
|
+
if (a != null && // if block not found or stop is behind lastBlock
|
|
873
|
+
(!n || n.index <= a) && ((i instanceof S || // for continuous block also check if stop is exist
|
|
874
|
+
t._stops.indexOf(a) >= 0) && e.aggregate(t._appendPlaceholder(a)), u = i instanceof S && t._blocks[a]), u) {
|
|
875
|
+
const h = u.appendTail(i);
|
|
876
|
+
e.aggregate(h);
|
|
877
|
+
const p = i.toString().slice(h.rawInserted.length);
|
|
878
|
+
p && e.aggregate(t.append(p, {
|
|
1224
879
|
tail: !0
|
|
1225
880
|
}));
|
|
1226
881
|
} else
|
|
@@ -1244,8 +899,8 @@ class S {
|
|
|
1244
899
|
...s
|
|
1245
900
|
} = t;
|
|
1246
901
|
Object.assign(this, s), this.chunks = e.map((i) => {
|
|
1247
|
-
const
|
|
1248
|
-
return
|
|
902
|
+
const n = "chunks" in i ? new S() : new E();
|
|
903
|
+
return n.state = i, n;
|
|
1249
904
|
});
|
|
1250
905
|
}
|
|
1251
906
|
unshift(t) {
|
|
@@ -1253,13 +908,13 @@ class S {
|
|
|
1253
908
|
const e = t != null ? t - this.from : t;
|
|
1254
909
|
let s = 0;
|
|
1255
910
|
for (; s < this.chunks.length; ) {
|
|
1256
|
-
const i = this.chunks[s],
|
|
911
|
+
const i = this.chunks[s], n = i.unshift(e);
|
|
1257
912
|
if (i.toString()) {
|
|
1258
|
-
if (!
|
|
913
|
+
if (!n) break;
|
|
1259
914
|
++s;
|
|
1260
915
|
} else
|
|
1261
916
|
this.chunks.splice(s, 1);
|
|
1262
|
-
if (
|
|
917
|
+
if (n) return n;
|
|
1263
918
|
}
|
|
1264
919
|
return "";
|
|
1265
920
|
}
|
|
@@ -1278,7 +933,7 @@ class S {
|
|
|
1278
933
|
return "";
|
|
1279
934
|
}
|
|
1280
935
|
}
|
|
1281
|
-
class
|
|
936
|
+
class at {
|
|
1282
937
|
constructor(t, e) {
|
|
1283
938
|
this.masked = t, this._log = [];
|
|
1284
939
|
const {
|
|
@@ -1339,42 +994,42 @@ class Dt {
|
|
|
1339
994
|
}
|
|
1340
995
|
pushLeftBeforeFilled() {
|
|
1341
996
|
return this._pushLeft(() => {
|
|
1342
|
-
if (!(this.block.isFixed || !this.block.value) && (this.offset = this.block.nearestInputPos(this.offset,
|
|
997
|
+
if (!(this.block.isFixed || !this.block.value) && (this.offset = this.block.nearestInputPos(this.offset, o.FORCE_LEFT), this.offset !== 0))
|
|
1343
998
|
return !0;
|
|
1344
999
|
});
|
|
1345
1000
|
}
|
|
1346
1001
|
pushLeftBeforeInput() {
|
|
1347
1002
|
return this._pushLeft(() => {
|
|
1348
1003
|
if (!this.block.isFixed)
|
|
1349
|
-
return this.offset = this.block.nearestInputPos(this.offset,
|
|
1004
|
+
return this.offset = this.block.nearestInputPos(this.offset, o.LEFT), !0;
|
|
1350
1005
|
});
|
|
1351
1006
|
}
|
|
1352
1007
|
pushLeftBeforeRequired() {
|
|
1353
1008
|
return this._pushLeft(() => {
|
|
1354
1009
|
if (!(this.block.isFixed || this.block.isOptional && !this.block.value))
|
|
1355
|
-
return this.offset = this.block.nearestInputPos(this.offset,
|
|
1010
|
+
return this.offset = this.block.nearestInputPos(this.offset, o.LEFT), !0;
|
|
1356
1011
|
});
|
|
1357
1012
|
}
|
|
1358
1013
|
pushRightBeforeFilled() {
|
|
1359
1014
|
return this._pushRight(() => {
|
|
1360
|
-
if (!(this.block.isFixed || !this.block.value) && (this.offset = this.block.nearestInputPos(this.offset,
|
|
1015
|
+
if (!(this.block.isFixed || !this.block.value) && (this.offset = this.block.nearestInputPos(this.offset, o.FORCE_RIGHT), this.offset !== this.block.value.length))
|
|
1361
1016
|
return !0;
|
|
1362
1017
|
});
|
|
1363
1018
|
}
|
|
1364
1019
|
pushRightBeforeInput() {
|
|
1365
1020
|
return this._pushRight(() => {
|
|
1366
1021
|
if (!this.block.isFixed)
|
|
1367
|
-
return this.offset = this.block.nearestInputPos(this.offset,
|
|
1022
|
+
return this.offset = this.block.nearestInputPos(this.offset, o.NONE), !0;
|
|
1368
1023
|
});
|
|
1369
1024
|
}
|
|
1370
1025
|
pushRightBeforeRequired() {
|
|
1371
1026
|
return this._pushRight(() => {
|
|
1372
1027
|
if (!(this.block.isFixed || this.block.isOptional && !this.block.value))
|
|
1373
|
-
return this.offset = this.block.nearestInputPos(this.offset,
|
|
1028
|
+
return this.offset = this.block.nearestInputPos(this.offset, o.NONE), !0;
|
|
1374
1029
|
});
|
|
1375
1030
|
}
|
|
1376
1031
|
}
|
|
1377
|
-
class
|
|
1032
|
+
class q {
|
|
1378
1033
|
/** */
|
|
1379
1034
|
/** */
|
|
1380
1035
|
/** */
|
|
@@ -1403,15 +1058,15 @@ class Q {
|
|
|
1403
1058
|
return t === void 0 && (t = 0), e === void 0 && (e = this._value.length), this._value = this._value.slice(0, t) + this._value.slice(e), this._value || (this._isRawInput = !1), new c();
|
|
1404
1059
|
}
|
|
1405
1060
|
nearestInputPos(t, e) {
|
|
1406
|
-
e === void 0 && (e =
|
|
1061
|
+
e === void 0 && (e = o.NONE);
|
|
1407
1062
|
const s = 0, i = this._value.length;
|
|
1408
1063
|
switch (e) {
|
|
1409
|
-
case
|
|
1410
|
-
case
|
|
1064
|
+
case o.LEFT:
|
|
1065
|
+
case o.FORCE_LEFT:
|
|
1411
1066
|
return s;
|
|
1412
|
-
case
|
|
1413
|
-
case
|
|
1414
|
-
case
|
|
1067
|
+
case o.NONE:
|
|
1068
|
+
case o.RIGHT:
|
|
1069
|
+
case o.FORCE_RIGHT:
|
|
1415
1070
|
default:
|
|
1416
1071
|
return i;
|
|
1417
1072
|
}
|
|
@@ -1430,11 +1085,11 @@ class Q {
|
|
|
1430
1085
|
}
|
|
1431
1086
|
_appendChar(t, e) {
|
|
1432
1087
|
if (e === void 0 && (e = {}), this.isFilled) return new c();
|
|
1433
|
-
const s = this.eager === !0 || this.eager === "append",
|
|
1088
|
+
const s = this.eager === !0 || this.eager === "append", n = this.char === t && (this.isUnmasking || e.input || e.raw) && (!e.raw || !s) && !e.tail, a = new c({
|
|
1434
1089
|
inserted: this.char,
|
|
1435
|
-
rawInserted:
|
|
1090
|
+
rawInserted: n ? this.char : ""
|
|
1436
1091
|
});
|
|
1437
|
-
return this._value = this.char, this._isRawInput =
|
|
1092
|
+
return this._value = this.char, this._isRawInput = n && (e.raw || e.input), a;
|
|
1438
1093
|
}
|
|
1439
1094
|
_appendEager() {
|
|
1440
1095
|
return this._appendChar(this.char, {
|
|
@@ -1470,7 +1125,7 @@ class Q {
|
|
|
1470
1125
|
return this._appendPlaceholder();
|
|
1471
1126
|
}
|
|
1472
1127
|
}
|
|
1473
|
-
class
|
|
1128
|
+
class V {
|
|
1474
1129
|
/** */
|
|
1475
1130
|
/** */
|
|
1476
1131
|
/** */
|
|
@@ -1484,17 +1139,17 @@ class D {
|
|
|
1484
1139
|
parent: e,
|
|
1485
1140
|
isOptional: s,
|
|
1486
1141
|
placeholderChar: i,
|
|
1487
|
-
displayChar:
|
|
1488
|
-
lazy:
|
|
1142
|
+
displayChar: n,
|
|
1143
|
+
lazy: a,
|
|
1489
1144
|
eager: u,
|
|
1490
|
-
...
|
|
1145
|
+
...h
|
|
1491
1146
|
} = t;
|
|
1492
|
-
this.masked = A(
|
|
1147
|
+
this.masked = A(h), Object.assign(this, {
|
|
1493
1148
|
parent: e,
|
|
1494
1149
|
isOptional: s,
|
|
1495
1150
|
placeholderChar: i,
|
|
1496
|
-
displayChar:
|
|
1497
|
-
lazy:
|
|
1151
|
+
displayChar: n,
|
|
1152
|
+
lazy: a,
|
|
1498
1153
|
eager: u
|
|
1499
1154
|
});
|
|
1500
1155
|
}
|
|
@@ -1546,18 +1201,18 @@ class D {
|
|
|
1546
1201
|
return t === void 0 && (t = 0), e === void 0 && (e = this.value.length), this.masked.extractInput(t, e, s);
|
|
1547
1202
|
}
|
|
1548
1203
|
nearestInputPos(t, e) {
|
|
1549
|
-
e === void 0 && (e =
|
|
1550
|
-
const s = 0, i = this.value.length,
|
|
1204
|
+
e === void 0 && (e = o.NONE);
|
|
1205
|
+
const s = 0, i = this.value.length, n = Math.min(Math.max(t, s), i);
|
|
1551
1206
|
switch (e) {
|
|
1552
|
-
case
|
|
1553
|
-
case
|
|
1554
|
-
return this.isComplete ?
|
|
1555
|
-
case
|
|
1556
|
-
case
|
|
1557
|
-
return this.isComplete ?
|
|
1558
|
-
case
|
|
1207
|
+
case o.LEFT:
|
|
1208
|
+
case o.FORCE_LEFT:
|
|
1209
|
+
return this.isComplete ? n : s;
|
|
1210
|
+
case o.RIGHT:
|
|
1211
|
+
case o.FORCE_RIGHT:
|
|
1212
|
+
return this.isComplete ? n : i;
|
|
1213
|
+
case o.NONE:
|
|
1559
1214
|
default:
|
|
1560
|
-
return
|
|
1215
|
+
return n;
|
|
1561
1216
|
}
|
|
1562
1217
|
}
|
|
1563
1218
|
totalInputPositions(t, e) {
|
|
@@ -1591,13 +1246,13 @@ class D {
|
|
|
1591
1246
|
return new c();
|
|
1592
1247
|
}
|
|
1593
1248
|
}
|
|
1594
|
-
|
|
1249
|
+
V.DEFAULT_DEFINITIONS = {
|
|
1595
1250
|
0: /\d/,
|
|
1596
1251
|
a: /[\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,
|
|
1597
1252
|
// http://stackoverflow.com/a/22075070
|
|
1598
1253
|
"*": /./
|
|
1599
1254
|
};
|
|
1600
|
-
class
|
|
1255
|
+
class rt extends m {
|
|
1601
1256
|
/** */
|
|
1602
1257
|
/** Enable characters overwriting */
|
|
1603
1258
|
/** */
|
|
@@ -1611,8 +1266,8 @@ class Tt extends k {
|
|
|
1611
1266
|
e && (t.validate = (s) => s.search(e) >= 0), super._update(t);
|
|
1612
1267
|
}
|
|
1613
1268
|
}
|
|
1614
|
-
|
|
1615
|
-
class
|
|
1269
|
+
d.MaskedRegExp = rt;
|
|
1270
|
+
class g extends m {
|
|
1616
1271
|
/** */
|
|
1617
1272
|
/** */
|
|
1618
1273
|
/** Single char for empty input */
|
|
@@ -1624,9 +1279,9 @@ class _ extends k {
|
|
|
1624
1279
|
/** */
|
|
1625
1280
|
constructor(t) {
|
|
1626
1281
|
super({
|
|
1627
|
-
...
|
|
1282
|
+
...g.DEFAULTS,
|
|
1628
1283
|
...t,
|
|
1629
|
-
definitions: Object.assign({},
|
|
1284
|
+
definitions: Object.assign({}, V.DEFAULT_DEFINITIONS, t?.definitions)
|
|
1630
1285
|
});
|
|
1631
1286
|
}
|
|
1632
1287
|
updateOptions(t) {
|
|
@@ -1641,65 +1296,65 @@ class _ extends k {
|
|
|
1641
1296
|
const e = this.mask;
|
|
1642
1297
|
if (!e || !t) return;
|
|
1643
1298
|
let s = !1, i = !1;
|
|
1644
|
-
for (let
|
|
1299
|
+
for (let n = 0; n < e.length; ++n) {
|
|
1645
1300
|
if (this.blocks) {
|
|
1646
|
-
const
|
|
1647
|
-
f.sort((
|
|
1648
|
-
const
|
|
1649
|
-
if (
|
|
1301
|
+
const p = e.slice(n), f = Object.keys(this.blocks).filter((_) => p.indexOf(_) === 0);
|
|
1302
|
+
f.sort((_, y) => y.length - _.length);
|
|
1303
|
+
const k = f[0];
|
|
1304
|
+
if (k) {
|
|
1650
1305
|
const {
|
|
1651
|
-
expose:
|
|
1652
|
-
repeat:
|
|
1653
|
-
...
|
|
1654
|
-
} =
|
|
1306
|
+
expose: _,
|
|
1307
|
+
repeat: y,
|
|
1308
|
+
...J
|
|
1309
|
+
} = B(this.blocks[k]), P = {
|
|
1655
1310
|
lazy: this.lazy,
|
|
1656
1311
|
eager: this.eager,
|
|
1657
1312
|
placeholderChar: this.placeholderChar,
|
|
1658
1313
|
displayChar: this.displayChar,
|
|
1659
1314
|
overwrite: this.overwrite,
|
|
1660
1315
|
autofix: this.autofix,
|
|
1661
|
-
...
|
|
1662
|
-
repeat:
|
|
1316
|
+
...J,
|
|
1317
|
+
repeat: y,
|
|
1663
1318
|
parent: this
|
|
1664
|
-
},
|
|
1665
|
-
|
|
1319
|
+
}, R = y != null ? new d.RepeatBlock(
|
|
1320
|
+
P
|
|
1666
1321
|
/* TODO */
|
|
1667
|
-
) : A(
|
|
1668
|
-
|
|
1322
|
+
) : A(P);
|
|
1323
|
+
R && (this._blocks.push(R), _ && (this.exposeBlock = R), this._maskedBlocks[k] || (this._maskedBlocks[k] = []), this._maskedBlocks[k].push(this._blocks.length - 1)), n += k.length - 1;
|
|
1669
1324
|
continue;
|
|
1670
1325
|
}
|
|
1671
1326
|
}
|
|
1672
|
-
let
|
|
1673
|
-
if (
|
|
1327
|
+
let a = e[n], u = a in t;
|
|
1328
|
+
if (a === g.STOP_CHAR) {
|
|
1674
1329
|
this._stops.push(this._blocks.length);
|
|
1675
1330
|
continue;
|
|
1676
1331
|
}
|
|
1677
|
-
if (
|
|
1332
|
+
if (a === "{" || a === "}") {
|
|
1678
1333
|
s = !s;
|
|
1679
1334
|
continue;
|
|
1680
1335
|
}
|
|
1681
|
-
if (
|
|
1336
|
+
if (a === "[" || a === "]") {
|
|
1682
1337
|
i = !i;
|
|
1683
1338
|
continue;
|
|
1684
1339
|
}
|
|
1685
|
-
if (
|
|
1686
|
-
if (++
|
|
1340
|
+
if (a === g.ESCAPE_CHAR) {
|
|
1341
|
+
if (++n, a = e[n], !a) break;
|
|
1687
1342
|
u = !1;
|
|
1688
1343
|
}
|
|
1689
|
-
const
|
|
1344
|
+
const h = u ? new V({
|
|
1690
1345
|
isOptional: i,
|
|
1691
1346
|
lazy: this.lazy,
|
|
1692
1347
|
eager: this.eager,
|
|
1693
1348
|
placeholderChar: this.placeholderChar,
|
|
1694
1349
|
displayChar: this.displayChar,
|
|
1695
|
-
...
|
|
1350
|
+
...B(t[a]),
|
|
1696
1351
|
parent: this
|
|
1697
|
-
}) : new
|
|
1698
|
-
char:
|
|
1352
|
+
}) : new q({
|
|
1353
|
+
char: a,
|
|
1699
1354
|
eager: this.eager,
|
|
1700
1355
|
isUnmasking: s
|
|
1701
1356
|
});
|
|
1702
|
-
this._blocks.push(
|
|
1357
|
+
this._blocks.push(h);
|
|
1703
1358
|
}
|
|
1704
1359
|
}
|
|
1705
1360
|
get state() {
|
|
@@ -1717,7 +1372,7 @@ class _ extends k {
|
|
|
1717
1372
|
_blocks: e,
|
|
1718
1373
|
...s
|
|
1719
1374
|
} = t;
|
|
1720
|
-
this._blocks.forEach((i,
|
|
1375
|
+
this._blocks.forEach((i, n) => i.state = e[n]), super.state = s;
|
|
1721
1376
|
}
|
|
1722
1377
|
reset() {
|
|
1723
1378
|
super.reset(), this._blocks.forEach((t) => t.reset());
|
|
@@ -1780,9 +1435,9 @@ class _ extends k {
|
|
|
1780
1435
|
if (s == null) return e;
|
|
1781
1436
|
this._blocks[s].isFilled && ++s;
|
|
1782
1437
|
for (let i = s; i < this._blocks.length; ++i) {
|
|
1783
|
-
const
|
|
1784
|
-
if (!
|
|
1785
|
-
e.aggregate(
|
|
1438
|
+
const n = this._blocks[i]._appendEager();
|
|
1439
|
+
if (!n.inserted) break;
|
|
1440
|
+
e.aggregate(n);
|
|
1786
1441
|
}
|
|
1787
1442
|
return e;
|
|
1788
1443
|
}
|
|
@@ -1790,29 +1445,29 @@ class _ extends k {
|
|
|
1790
1445
|
e === void 0 && (e = {});
|
|
1791
1446
|
const s = this._mapPosToBlock(this.displayValue.length), i = new c();
|
|
1792
1447
|
if (!s) return i;
|
|
1793
|
-
for (let
|
|
1794
|
-
var
|
|
1795
|
-
const
|
|
1448
|
+
for (let a = s.index, u; u = this._blocks[a]; ++a) {
|
|
1449
|
+
var n;
|
|
1450
|
+
const h = u._appendChar(t, {
|
|
1796
1451
|
...e,
|
|
1797
|
-
_beforeTailState: (
|
|
1452
|
+
_beforeTailState: (n = e._beforeTailState) == null || (n = n._blocks) == null ? void 0 : n[a]
|
|
1798
1453
|
});
|
|
1799
|
-
if (i.aggregate(
|
|
1454
|
+
if (i.aggregate(h), h.consumed) break;
|
|
1800
1455
|
}
|
|
1801
1456
|
return i;
|
|
1802
1457
|
}
|
|
1803
1458
|
extractTail(t, e) {
|
|
1804
1459
|
t === void 0 && (t = 0), e === void 0 && (e = this.displayValue.length);
|
|
1805
1460
|
const s = new S();
|
|
1806
|
-
return t === e || this._forEachBlocksInRange(t, e, (i,
|
|
1807
|
-
const
|
|
1808
|
-
|
|
1461
|
+
return t === e || this._forEachBlocksInRange(t, e, (i, n, a, u) => {
|
|
1462
|
+
const h = i.extractTail(a, u);
|
|
1463
|
+
h.stop = this._findStopBefore(n), h.from = this._blockStartPos(n), h instanceof S && (h.blockIndex = n), s.extend(h);
|
|
1809
1464
|
}), s;
|
|
1810
1465
|
}
|
|
1811
1466
|
extractInput(t, e, s) {
|
|
1812
1467
|
if (t === void 0 && (t = 0), e === void 0 && (e = this.displayValue.length), s === void 0 && (s = {}), t === e) return "";
|
|
1813
1468
|
let i = "";
|
|
1814
|
-
return this._forEachBlocksInRange(t, e, (
|
|
1815
|
-
i +=
|
|
1469
|
+
return this._forEachBlocksInRange(t, e, (n, a, u, h) => {
|
|
1470
|
+
i += n.extractInput(u, h, s);
|
|
1816
1471
|
}), i;
|
|
1817
1472
|
}
|
|
1818
1473
|
_findStopBefore(t) {
|
|
@@ -1830,11 +1485,11 @@ class _ extends k {
|
|
|
1830
1485
|
if (this.lazy && t == null) return e;
|
|
1831
1486
|
const s = this._mapPosToBlock(this.displayValue.length);
|
|
1832
1487
|
if (!s) return e;
|
|
1833
|
-
const i = s.index,
|
|
1834
|
-
return this._blocks.slice(i,
|
|
1835
|
-
if (!
|
|
1488
|
+
const i = s.index, n = t ?? this._blocks.length;
|
|
1489
|
+
return this._blocks.slice(i, n).forEach((a) => {
|
|
1490
|
+
if (!a.lazy || t != null) {
|
|
1836
1491
|
var u;
|
|
1837
|
-
e.aggregate(
|
|
1492
|
+
e.aggregate(a._appendPlaceholder((u = a._blocks) == null ? void 0 : u.length));
|
|
1838
1493
|
}
|
|
1839
1494
|
}), e;
|
|
1840
1495
|
}
|
|
@@ -1842,11 +1497,11 @@ class _ extends k {
|
|
|
1842
1497
|
_mapPosToBlock(t) {
|
|
1843
1498
|
let e = "";
|
|
1844
1499
|
for (let s = 0; s < this._blocks.length; ++s) {
|
|
1845
|
-
const i = this._blocks[s],
|
|
1500
|
+
const i = this._blocks[s], n = e.length;
|
|
1846
1501
|
if (e += i.displayValue, t <= e.length)
|
|
1847
1502
|
return {
|
|
1848
1503
|
index: s,
|
|
1849
|
-
offset: t -
|
|
1504
|
+
offset: t - n
|
|
1850
1505
|
};
|
|
1851
1506
|
}
|
|
1852
1507
|
}
|
|
@@ -1857,44 +1512,44 @@ class _ extends k {
|
|
|
1857
1512
|
e === void 0 && (e = this.displayValue.length);
|
|
1858
1513
|
const i = this._mapPosToBlock(t);
|
|
1859
1514
|
if (i) {
|
|
1860
|
-
const
|
|
1861
|
-
if (s(this._blocks[i.index], i.index, u,
|
|
1862
|
-
for (let
|
|
1863
|
-
s(this._blocks[
|
|
1864
|
-
s(this._blocks[
|
|
1515
|
+
const n = this._mapPosToBlock(e), a = n && i.index === n.index, u = i.offset, h = n && a ? n.offset : this._blocks[i.index].displayValue.length;
|
|
1516
|
+
if (s(this._blocks[i.index], i.index, u, h), n && !a) {
|
|
1517
|
+
for (let p = i.index + 1; p < n.index; ++p)
|
|
1518
|
+
s(this._blocks[p], p, 0, this._blocks[p].displayValue.length);
|
|
1519
|
+
s(this._blocks[n.index], n.index, 0, n.offset);
|
|
1865
1520
|
}
|
|
1866
1521
|
}
|
|
1867
1522
|
}
|
|
1868
1523
|
remove(t, e) {
|
|
1869
1524
|
t === void 0 && (t = 0), e === void 0 && (e = this.displayValue.length);
|
|
1870
1525
|
const s = super.remove(t, e);
|
|
1871
|
-
return this._forEachBlocksInRange(t, e, (i,
|
|
1872
|
-
s.aggregate(i.remove(
|
|
1526
|
+
return this._forEachBlocksInRange(t, e, (i, n, a, u) => {
|
|
1527
|
+
s.aggregate(i.remove(a, u));
|
|
1873
1528
|
}), s;
|
|
1874
1529
|
}
|
|
1875
1530
|
nearestInputPos(t, e) {
|
|
1876
|
-
if (e === void 0 && (e =
|
|
1877
|
-
const s = new
|
|
1878
|
-
if (e ===
|
|
1531
|
+
if (e === void 0 && (e = o.NONE), !this._blocks.length) return 0;
|
|
1532
|
+
const s = new at(this, t);
|
|
1533
|
+
if (e === o.NONE)
|
|
1879
1534
|
return s.pushRightBeforeInput() || (s.popState(), s.pushLeftBeforeInput()) ? s.pos : this.displayValue.length;
|
|
1880
|
-
if (e ===
|
|
1881
|
-
if (e ===
|
|
1535
|
+
if (e === o.LEFT || e === o.FORCE_LEFT) {
|
|
1536
|
+
if (e === o.LEFT) {
|
|
1882
1537
|
if (s.pushRightBeforeFilled(), s.ok && s.pos === t) return t;
|
|
1883
1538
|
s.popState();
|
|
1884
1539
|
}
|
|
1885
|
-
if (s.pushLeftBeforeInput(), s.pushLeftBeforeRequired(), s.pushLeftBeforeFilled(), e ===
|
|
1540
|
+
if (s.pushLeftBeforeInput(), s.pushLeftBeforeRequired(), s.pushLeftBeforeFilled(), e === o.LEFT) {
|
|
1886
1541
|
if (s.pushRightBeforeInput(), s.pushRightBeforeRequired(), s.ok && s.pos <= t || (s.popState(), s.ok && s.pos <= t)) return s.pos;
|
|
1887
1542
|
s.popState();
|
|
1888
1543
|
}
|
|
1889
|
-
return s.ok ? s.pos : e ===
|
|
1544
|
+
return s.ok ? s.pos : e === o.FORCE_LEFT ? 0 : (s.popState(), s.ok || (s.popState(), s.ok) ? s.pos : 0);
|
|
1890
1545
|
}
|
|
1891
|
-
return e ===
|
|
1546
|
+
return e === o.RIGHT || e === o.FORCE_RIGHT ? (s.pushRightBeforeInput(), s.pushRightBeforeRequired(), s.pushRightBeforeFilled() ? s.pos : e === o.FORCE_RIGHT ? this.displayValue.length : (s.popState(), s.ok || (s.popState(), s.ok) ? s.pos : this.nearestInputPos(t, o.LEFT))) : t;
|
|
1892
1547
|
}
|
|
1893
1548
|
totalInputPositions(t, e) {
|
|
1894
1549
|
t === void 0 && (t = 0), e === void 0 && (e = this.displayValue.length);
|
|
1895
1550
|
let s = 0;
|
|
1896
|
-
return this._forEachBlocksInRange(t, e, (i,
|
|
1897
|
-
s += i.totalInputPositions(
|
|
1551
|
+
return this._forEachBlocksInRange(t, e, (i, n, a, u) => {
|
|
1552
|
+
s += i.totalInputPositions(a, u);
|
|
1898
1553
|
}), s;
|
|
1899
1554
|
}
|
|
1900
1555
|
/** Get block by name */
|
|
@@ -1911,17 +1566,17 @@ class _ extends k {
|
|
|
1911
1566
|
return this._forEachBlocksInRange(0, this.displayValue.length, (s) => e.aggregate(s.pad(t))), e;
|
|
1912
1567
|
}
|
|
1913
1568
|
}
|
|
1914
|
-
|
|
1915
|
-
...
|
|
1569
|
+
g.DEFAULTS = {
|
|
1570
|
+
...m.DEFAULTS,
|
|
1916
1571
|
lazy: !0,
|
|
1917
1572
|
placeholderChar: "_"
|
|
1918
1573
|
};
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
class
|
|
1574
|
+
g.STOP_CHAR = "`";
|
|
1575
|
+
g.ESCAPE_CHAR = "\\";
|
|
1576
|
+
g.InputDefinition = V;
|
|
1577
|
+
g.FixedDefinition = q;
|
|
1578
|
+
d.MaskedPattern = g;
|
|
1579
|
+
class I extends g {
|
|
1925
1580
|
/**
|
|
1926
1581
|
Optionally sets max length of pattern.
|
|
1927
1582
|
Used when pattern length is longer then `to` param length. Pads zeros at start in this case.
|
|
@@ -1942,22 +1597,22 @@ class w extends _ {
|
|
|
1942
1597
|
to: e = this.to || 0,
|
|
1943
1598
|
from: s = this.from || 0,
|
|
1944
1599
|
maxLength: i = this.maxLength || 0,
|
|
1945
|
-
autofix:
|
|
1946
|
-
...
|
|
1600
|
+
autofix: n = this.autofix,
|
|
1601
|
+
...a
|
|
1947
1602
|
} = t;
|
|
1948
|
-
this.to = e, this.from = s, this.maxLength = Math.max(String(e).length, i), this.autofix =
|
|
1949
|
-
const u = String(this.from).padStart(this.maxLength, "0"),
|
|
1950
|
-
let
|
|
1951
|
-
for (;
|
|
1952
|
-
|
|
1603
|
+
this.to = e, this.from = s, this.maxLength = Math.max(String(e).length, i), this.autofix = n;
|
|
1604
|
+
const u = String(this.from).padStart(this.maxLength, "0"), h = String(this.to).padStart(this.maxLength, "0");
|
|
1605
|
+
let p = 0;
|
|
1606
|
+
for (; p < h.length && h[p] === u[p]; ) ++p;
|
|
1607
|
+
a.mask = h.slice(0, p).replace(/0/g, "\\0") + "0".repeat(this.maxLength - p), super._update(a);
|
|
1953
1608
|
}
|
|
1954
1609
|
get isComplete() {
|
|
1955
1610
|
return super.isComplete && !!this.value;
|
|
1956
1611
|
}
|
|
1957
1612
|
boundaries(t) {
|
|
1958
1613
|
let e = "", s = "";
|
|
1959
|
-
const [, i,
|
|
1960
|
-
return
|
|
1614
|
+
const [, i, n] = t.match(/^(\D*)(\d*)(\D*)/) || [];
|
|
1615
|
+
return n && (e = "0".repeat(i.length) + n, s = "9".repeat(i.length) + n), e = e.padEnd(this.maxLength, "0"), s = s.padEnd(this.maxLength, "9"), [e, s];
|
|
1961
1616
|
}
|
|
1962
1617
|
doPrepareChar(t, e) {
|
|
1963
1618
|
e === void 0 && (e = {});
|
|
@@ -1966,14 +1621,14 @@ class w extends _ {
|
|
|
1966
1621
|
}
|
|
1967
1622
|
_appendCharRaw(t, e) {
|
|
1968
1623
|
if (e === void 0 && (e = {}), !this.autofix || this.value.length + 1 > this.maxLength) return super._appendCharRaw(t, e);
|
|
1969
|
-
const s = String(this.from).padStart(this.maxLength, "0"), i = String(this.to).padStart(this.maxLength, "0"), [
|
|
1970
|
-
return Number(
|
|
1624
|
+
const s = String(this.from).padStart(this.maxLength, "0"), i = String(this.to).padStart(this.maxLength, "0"), [n, a] = this.boundaries(this.value + t);
|
|
1625
|
+
return Number(a) < this.from ? super._appendCharRaw(s[this.value.length], e) : Number(n) > this.to ? !e.tail && this.autofix === "pad" && this.value.length + 1 < this.maxLength ? super._appendCharRaw(s[this.value.length], e).aggregate(this._appendCharRaw(t, e)) : super._appendCharRaw(i[this.value.length], e) : super._appendCharRaw(t, e);
|
|
1971
1626
|
}
|
|
1972
1627
|
doValidate(t) {
|
|
1973
1628
|
const e = this.value;
|
|
1974
1629
|
if (e.search(/[^0]/) === -1 && e.length <= this._matchFrom) return !0;
|
|
1975
|
-
const [i,
|
|
1976
|
-
return this.from <= Number(
|
|
1630
|
+
const [i, n] = this.boundaries(e);
|
|
1631
|
+
return this.from <= Number(n) && Number(i) <= this.to && super.doValidate(t);
|
|
1977
1632
|
}
|
|
1978
1633
|
pad(t) {
|
|
1979
1634
|
const e = new c();
|
|
@@ -1981,16 +1636,16 @@ class w extends _ {
|
|
|
1981
1636
|
const s = this.value, i = this.maxLength - this.value.length;
|
|
1982
1637
|
if (i) {
|
|
1983
1638
|
this.reset();
|
|
1984
|
-
for (let
|
|
1639
|
+
for (let n = 0; n < i; ++n)
|
|
1985
1640
|
e.aggregate(super._appendCharRaw("0", t));
|
|
1986
|
-
s.split("").forEach((
|
|
1641
|
+
s.split("").forEach((n) => this._appendCharRaw(n));
|
|
1987
1642
|
}
|
|
1988
1643
|
return e;
|
|
1989
1644
|
}
|
|
1990
1645
|
}
|
|
1991
|
-
|
|
1992
|
-
const
|
|
1993
|
-
class C extends
|
|
1646
|
+
d.MaskedRange = I;
|
|
1647
|
+
const ut = "d{.}`m{.}`Y";
|
|
1648
|
+
class C extends g {
|
|
1994
1649
|
static extractPatternOptions(t) {
|
|
1995
1650
|
const {
|
|
1996
1651
|
mask: e,
|
|
@@ -2021,15 +1676,15 @@ class C extends _ {
|
|
|
2021
1676
|
mask: e,
|
|
2022
1677
|
pattern: s,
|
|
2023
1678
|
blocks: i,
|
|
2024
|
-
...
|
|
1679
|
+
...n
|
|
2025
1680
|
} = {
|
|
2026
1681
|
...C.DEFAULTS,
|
|
2027
1682
|
...t
|
|
2028
|
-
},
|
|
2029
|
-
t.min && (
|
|
2030
|
-
...
|
|
1683
|
+
}, a = Object.assign({}, C.GET_DEFAULT_BLOCKS());
|
|
1684
|
+
t.min && (a.Y.from = t.min.getFullYear()), t.max && (a.Y.to = t.max.getFullYear()), t.min && t.max && a.Y.from === a.Y.to && (a.m.from = t.min.getMonth() + 1, a.m.to = t.max.getMonth() + 1, a.m.from === a.m.to && (a.d.from = t.min.getDate(), a.d.to = t.max.getDate())), Object.assign(a, this.blocks, i), super._update({
|
|
1685
|
+
...n,
|
|
2031
1686
|
mask: F(e) ? e : s,
|
|
2032
|
-
blocks:
|
|
1687
|
+
blocks: a
|
|
2033
1688
|
});
|
|
2034
1689
|
}
|
|
2035
1690
|
doValidate(t) {
|
|
@@ -2062,27 +1717,27 @@ class C extends _ {
|
|
|
2062
1717
|
}
|
|
2063
1718
|
C.GET_DEFAULT_BLOCKS = () => ({
|
|
2064
1719
|
d: {
|
|
2065
|
-
mask:
|
|
1720
|
+
mask: I,
|
|
2066
1721
|
from: 1,
|
|
2067
1722
|
to: 31,
|
|
2068
1723
|
maxLength: 2
|
|
2069
1724
|
},
|
|
2070
1725
|
m: {
|
|
2071
|
-
mask:
|
|
1726
|
+
mask: I,
|
|
2072
1727
|
from: 1,
|
|
2073
1728
|
to: 12,
|
|
2074
1729
|
maxLength: 2
|
|
2075
1730
|
},
|
|
2076
1731
|
Y: {
|
|
2077
|
-
mask:
|
|
1732
|
+
mask: I,
|
|
2078
1733
|
from: 1900,
|
|
2079
1734
|
to: 9999
|
|
2080
1735
|
}
|
|
2081
1736
|
});
|
|
2082
1737
|
C.DEFAULTS = {
|
|
2083
|
-
...
|
|
1738
|
+
...g.DEFAULTS,
|
|
2084
1739
|
mask: Date,
|
|
2085
|
-
pattern:
|
|
1740
|
+
pattern: ut,
|
|
2086
1741
|
format: (r, t) => {
|
|
2087
1742
|
if (!r) return "";
|
|
2088
1743
|
const e = String(r.getDate()).padStart(2, "0"), s = String(r.getMonth() + 1).padStart(2, "0"), i = r.getFullYear();
|
|
@@ -2093,11 +1748,11 @@ C.DEFAULTS = {
|
|
|
2093
1748
|
return new Date(i, s - 1, e);
|
|
2094
1749
|
}
|
|
2095
1750
|
};
|
|
2096
|
-
|
|
2097
|
-
class
|
|
1751
|
+
d.MaskedDate = C;
|
|
1752
|
+
class w extends m {
|
|
2098
1753
|
constructor(t) {
|
|
2099
1754
|
super({
|
|
2100
|
-
...
|
|
1755
|
+
...w.DEFAULTS,
|
|
2101
1756
|
...t
|
|
2102
1757
|
}), this.currentMask = void 0;
|
|
2103
1758
|
}
|
|
@@ -2109,13 +1764,13 @@ class O extends k {
|
|
|
2109
1764
|
const {
|
|
2110
1765
|
expose: s,
|
|
2111
1766
|
...i
|
|
2112
|
-
} =
|
|
1767
|
+
} = B(e), n = A({
|
|
2113
1768
|
overwrite: this._overwrite,
|
|
2114
1769
|
eager: this._eager,
|
|
2115
1770
|
skipInvalid: this._skipInvalid,
|
|
2116
1771
|
...i
|
|
2117
1772
|
});
|
|
2118
|
-
return s && (this.exposeMask =
|
|
1773
|
+
return s && (this.exposeMask = n), n;
|
|
2119
1774
|
}) : []);
|
|
2120
1775
|
}
|
|
2121
1776
|
_appendCharRaw(t, e) {
|
|
@@ -2125,15 +1780,15 @@ class O extends k {
|
|
|
2125
1780
|
}
|
|
2126
1781
|
_applyDispatch(t, e, s) {
|
|
2127
1782
|
t === void 0 && (t = ""), e === void 0 && (e = {}), s === void 0 && (s = "");
|
|
2128
|
-
const i = e.tail && e._beforeTailState != null ? e._beforeTailState._value : this.value,
|
|
1783
|
+
const i = e.tail && e._beforeTailState != null ? e._beforeTailState._value : this.value, n = this.rawInputValue, a = e.tail && e._beforeTailState != null ? e._beforeTailState._rawInputValue : n, u = n.slice(a.length), h = this.currentMask, p = new c(), f = h?.state;
|
|
2129
1784
|
return this.currentMask = this.doDispatch(t, {
|
|
2130
1785
|
...e
|
|
2131
|
-
}, s), this.currentMask && (this.currentMask !==
|
|
1786
|
+
}, s), this.currentMask && (this.currentMask !== h ? (this.currentMask.reset(), a && (this.currentMask.append(a, {
|
|
2132
1787
|
raw: !0
|
|
2133
|
-
}),
|
|
1788
|
+
}), p.tailShift = this.currentMask.value.length - i.length), u && (p.tailShift += this.currentMask.append(u, {
|
|
2134
1789
|
raw: !0,
|
|
2135
1790
|
tail: !0
|
|
2136
|
-
}).tailShift)) : f && (this.currentMask.state = f)),
|
|
1791
|
+
}).tailShift)) : f && (this.currentMask.state = f)), p;
|
|
2137
1792
|
}
|
|
2138
1793
|
_appendPlaceholder() {
|
|
2139
1794
|
const t = this._applyDispatch();
|
|
@@ -2164,8 +1819,8 @@ class O extends k {
|
|
|
2164
1819
|
e === void 0 && (e = {});
|
|
2165
1820
|
let [s, i] = super.doPrepare(t, e);
|
|
2166
1821
|
if (this.currentMask) {
|
|
2167
|
-
let
|
|
2168
|
-
[s,
|
|
1822
|
+
let n;
|
|
1823
|
+
[s, n] = super.doPrepare(s, this.currentMaskFlags(e)), i = i.aggregate(n);
|
|
2169
1824
|
}
|
|
2170
1825
|
return [s, i];
|
|
2171
1826
|
}
|
|
@@ -2173,8 +1828,8 @@ class O extends k {
|
|
|
2173
1828
|
e === void 0 && (e = {});
|
|
2174
1829
|
let [s, i] = super.doPrepareChar(t, e);
|
|
2175
1830
|
if (this.currentMask) {
|
|
2176
|
-
let
|
|
2177
|
-
[s,
|
|
1831
|
+
let n;
|
|
1832
|
+
[s, n] = super.doPrepareChar(s, this.currentMaskFlags(e)), i = i.aggregate(n);
|
|
2178
1833
|
}
|
|
2179
1834
|
return [s, i];
|
|
2180
1835
|
}
|
|
@@ -2235,9 +1890,9 @@ class O extends k {
|
|
|
2235
1890
|
compiledMasks: e,
|
|
2236
1891
|
currentMaskRef: s,
|
|
2237
1892
|
currentMask: i,
|
|
2238
|
-
...
|
|
1893
|
+
...n
|
|
2239
1894
|
} = t;
|
|
2240
|
-
e && this.compiledMasks.forEach((
|
|
1895
|
+
e && this.compiledMasks.forEach((a, u) => a.state = e[u]), s != null && (this.currentMask = s, this.currentMask.state = i), super.state = n;
|
|
2241
1896
|
}
|
|
2242
1897
|
extractInput(t, e, s) {
|
|
2243
1898
|
return this.currentMask ? this.currentMask.extractInput(t, e, s) : "";
|
|
@@ -2280,9 +1935,9 @@ class O extends k {
|
|
|
2280
1935
|
if (!t[s]) return;
|
|
2281
1936
|
const {
|
|
2282
1937
|
mask: i,
|
|
2283
|
-
...
|
|
1938
|
+
...n
|
|
2284
1939
|
} = t[s];
|
|
2285
|
-
return
|
|
1940
|
+
return b(e, n) && e.maskEquals(i);
|
|
2286
1941
|
}) : super.maskEquals(t);
|
|
2287
1942
|
}
|
|
2288
1943
|
typedValueEquals(t) {
|
|
@@ -2290,28 +1945,28 @@ class O extends k {
|
|
|
2290
1945
|
return !!((e = this.currentMask) != null && e.typedValueEquals(t));
|
|
2291
1946
|
}
|
|
2292
1947
|
}
|
|
2293
|
-
|
|
2294
|
-
...
|
|
1948
|
+
w.DEFAULTS = {
|
|
1949
|
+
...m.DEFAULTS,
|
|
2295
1950
|
dispatch: (r, t, e, s) => {
|
|
2296
1951
|
if (!t.compiledMasks.length) return;
|
|
2297
|
-
const i = t.rawInputValue,
|
|
2298
|
-
const
|
|
2299
|
-
return
|
|
1952
|
+
const i = t.rawInputValue, n = t.compiledMasks.map((a, u) => {
|
|
1953
|
+
const h = t.currentMask === a, p = h ? a.displayValue.length : a.nearestInputPos(a.displayValue.length, o.FORCE_LEFT);
|
|
1954
|
+
return a.rawInputValue !== i ? (a.reset(), a.append(i, {
|
|
2300
1955
|
raw: !0
|
|
2301
|
-
})) :
|
|
1956
|
+
})) : h || a.remove(p), a.append(r, t.currentMaskFlags(e)), a.appendTail(s), {
|
|
2302
1957
|
index: u,
|
|
2303
|
-
weight:
|
|
2304
|
-
totalInputPositions:
|
|
1958
|
+
weight: a.rawInputValue.length,
|
|
1959
|
+
totalInputPositions: a.totalInputPositions(0, Math.max(p, a.nearestInputPos(a.displayValue.length, o.FORCE_LEFT)))
|
|
2305
1960
|
};
|
|
2306
1961
|
});
|
|
2307
|
-
return
|
|
1962
|
+
return n.sort((a, u) => u.weight - a.weight || u.totalInputPositions - a.totalInputPositions), t.compiledMasks[n[0].index];
|
|
2308
1963
|
}
|
|
2309
1964
|
};
|
|
2310
|
-
|
|
2311
|
-
class
|
|
1965
|
+
d.MaskedDynamic = w;
|
|
1966
|
+
class T extends g {
|
|
2312
1967
|
constructor(t) {
|
|
2313
1968
|
super({
|
|
2314
|
-
...
|
|
1969
|
+
...T.DEFAULTS,
|
|
2315
1970
|
...t
|
|
2316
1971
|
});
|
|
2317
1972
|
}
|
|
@@ -2324,21 +1979,21 @@ class L extends _ {
|
|
|
2324
1979
|
...s
|
|
2325
1980
|
} = t;
|
|
2326
1981
|
if (e) {
|
|
2327
|
-
const i = e.map((u) => u.length),
|
|
2328
|
-
s.mask = "*".repeat(
|
|
1982
|
+
const i = e.map((u) => u.length), n = Math.min(...i), a = Math.max(...i) - n;
|
|
1983
|
+
s.mask = "*".repeat(n), a && (s.mask += "[" + "*".repeat(a) + "]"), this.enum = e;
|
|
2329
1984
|
}
|
|
2330
1985
|
super._update(s);
|
|
2331
1986
|
}
|
|
2332
1987
|
_appendCharRaw(t, e) {
|
|
2333
1988
|
e === void 0 && (e = {});
|
|
2334
|
-
const s = Math.min(this.nearestInputPos(0,
|
|
1989
|
+
const s = Math.min(this.nearestInputPos(0, o.FORCE_RIGHT), this.value.length), i = this.enum.filter((n) => this.matchValue(n, this.unmaskedValue + t, s));
|
|
2335
1990
|
if (i.length) {
|
|
2336
|
-
i.length === 1 && this._forEachBlocksInRange(0, this.value.length, (
|
|
2337
|
-
const
|
|
2338
|
-
u >= this.value.length ||
|
|
1991
|
+
i.length === 1 && this._forEachBlocksInRange(0, this.value.length, (a, u) => {
|
|
1992
|
+
const h = i[0][u];
|
|
1993
|
+
u >= this.value.length || h === a.value || (a.reset(), a._appendChar(h, e));
|
|
2339
1994
|
});
|
|
2340
|
-
const
|
|
2341
|
-
return i.length === 1 && i[0].slice(this.unmaskedValue.length).split("").forEach((
|
|
1995
|
+
const n = super._appendCharRaw(i[0][this.value.length], e);
|
|
1996
|
+
return i.length === 1 && i[0].slice(this.unmaskedValue.length).split("").forEach((a) => n.aggregate(super._appendCharRaw(a))), n;
|
|
2342
1997
|
}
|
|
2343
1998
|
return new c({
|
|
2344
1999
|
skip: !this.isComplete
|
|
@@ -2349,23 +2004,23 @@ class L extends _ {
|
|
|
2349
2004
|
}
|
|
2350
2005
|
remove(t, e) {
|
|
2351
2006
|
if (t === void 0 && (t = 0), e === void 0 && (e = this.displayValue.length), t === e) return new c();
|
|
2352
|
-
const s = Math.min(super.nearestInputPos(0,
|
|
2007
|
+
const s = Math.min(super.nearestInputPos(0, o.FORCE_RIGHT), this.value.length);
|
|
2353
2008
|
let i;
|
|
2354
2009
|
for (i = t; i >= 0 && !(this.enum.filter((u) => this.matchValue(u, this.value.slice(s, i), s)).length > 1); --i)
|
|
2355
2010
|
;
|
|
2356
|
-
const
|
|
2357
|
-
return
|
|
2011
|
+
const n = super.remove(i, e);
|
|
2012
|
+
return n.tailShift += i - t, n;
|
|
2358
2013
|
}
|
|
2359
2014
|
get isComplete() {
|
|
2360
2015
|
return this.enum.indexOf(this.value) >= 0;
|
|
2361
2016
|
}
|
|
2362
2017
|
}
|
|
2363
|
-
|
|
2364
|
-
...
|
|
2018
|
+
T.DEFAULTS = {
|
|
2019
|
+
...g.DEFAULTS,
|
|
2365
2020
|
matchValue: (r, t, e) => r.indexOf(t, e) === e
|
|
2366
2021
|
};
|
|
2367
|
-
|
|
2368
|
-
class
|
|
2022
|
+
d.MaskedEnum = T;
|
|
2023
|
+
class ht extends m {
|
|
2369
2024
|
/** */
|
|
2370
2025
|
/** Enable characters overwriting */
|
|
2371
2026
|
/** */
|
|
@@ -2381,9 +2036,9 @@ class Ot extends k {
|
|
|
2381
2036
|
});
|
|
2382
2037
|
}
|
|
2383
2038
|
}
|
|
2384
|
-
|
|
2385
|
-
var
|
|
2386
|
-
class
|
|
2039
|
+
d.MaskedFunction = ht;
|
|
2040
|
+
var Y;
|
|
2041
|
+
class v extends m {
|
|
2387
2042
|
/** Single char */
|
|
2388
2043
|
/** Single char */
|
|
2389
2044
|
/** Array of single chars */
|
|
@@ -2400,7 +2055,7 @@ class x extends k {
|
|
|
2400
2055
|
/** Parse string to get typed value */
|
|
2401
2056
|
constructor(t) {
|
|
2402
2057
|
super({
|
|
2403
|
-
...
|
|
2058
|
+
...v.DEFAULTS,
|
|
2404
2059
|
...t
|
|
2405
2060
|
});
|
|
2406
2061
|
}
|
|
@@ -2411,8 +2066,8 @@ class x extends k {
|
|
|
2411
2066
|
super._update(t), this._updateRegExps();
|
|
2412
2067
|
}
|
|
2413
2068
|
_updateRegExps() {
|
|
2414
|
-
const t = "^" + (this.allowNegative ? "[+|\\-]?" : ""), e = "\\d*", s = (this.scale ? "(" +
|
|
2415
|
-
this._numberRegExp = new RegExp(t + e + s), this._mapToRadixRegExp = new RegExp("[" + this.mapToRadix.map(
|
|
2069
|
+
const t = "^" + (this.allowNegative ? "[+|\\-]?" : ""), e = "\\d*", s = (this.scale ? "(" + O(this.radix) + "\\d{0," + this.scale + "})?" : "") + "$";
|
|
2070
|
+
this._numberRegExp = new RegExp(t + e + s), this._mapToRadixRegExp = new RegExp("[" + this.mapToRadix.map(O).join("") + "]", "g"), this._thousandsSeparatorRegExp = new RegExp(O(this.thousandsSeparator), "g");
|
|
2416
2071
|
}
|
|
2417
2072
|
_removeThousandsSeparators(t) {
|
|
2418
2073
|
return t.replace(this._thousandsSeparatorRegExp, "");
|
|
@@ -2451,22 +2106,22 @@ class x extends k {
|
|
|
2451
2106
|
e === void 0 && (e = {});
|
|
2452
2107
|
const s = e.tail && e._beforeTailState ? e._beforeTailState._value : this._value, i = this._separatorsCountFromSlice(s);
|
|
2453
2108
|
this._value = this._removeThousandsSeparators(this.value);
|
|
2454
|
-
const
|
|
2109
|
+
const n = this._value;
|
|
2455
2110
|
this._value += t;
|
|
2456
|
-
const
|
|
2457
|
-
let u = !isNaN(
|
|
2111
|
+
const a = this.number;
|
|
2112
|
+
let u = !isNaN(a), h = !1;
|
|
2458
2113
|
if (u) {
|
|
2459
|
-
let
|
|
2460
|
-
this.min != null && this.min < 0 && this.number < this.min && (
|
|
2114
|
+
let _;
|
|
2115
|
+
this.min != null && this.min < 0 && this.number < this.min && (_ = this.min), this.max != null && this.max > 0 && this.number > this.max && (_ = this.max), _ != null && (this.autofix ? (this._value = this.format(_, this).replace(v.UNMASKED_RADIX, this.radix), h || (h = n === this._value && !e.tail)) : u = !1), u && (u = !!this._value.match(this._numberRegExp));
|
|
2461
2116
|
}
|
|
2462
|
-
let
|
|
2463
|
-
u ?
|
|
2464
|
-
inserted: this._value.slice(
|
|
2465
|
-
rawInserted:
|
|
2466
|
-
skip:
|
|
2467
|
-
}) : (this._value =
|
|
2468
|
-
const f = e.tail && e._beforeTailState ? e._beforeTailState._value : this._value,
|
|
2469
|
-
return
|
|
2117
|
+
let p;
|
|
2118
|
+
u ? p = new c({
|
|
2119
|
+
inserted: this._value.slice(n.length),
|
|
2120
|
+
rawInserted: h ? "" : t,
|
|
2121
|
+
skip: h
|
|
2122
|
+
}) : (this._value = n, p = new c()), this._value = this._insertThousandsSeparators(this._value);
|
|
2123
|
+
const f = e.tail && e._beforeTailState ? e._beforeTailState._value : this._value, k = this._separatorsCountFromSlice(f);
|
|
2124
|
+
return p.tailShift += (k - i) * this.thousandsSeparator.length, p;
|
|
2470
2125
|
}
|
|
2471
2126
|
_findSeparatorAround(t) {
|
|
2472
2127
|
if (this.thousandsSeparator) {
|
|
@@ -2483,29 +2138,29 @@ class x extends k {
|
|
|
2483
2138
|
}
|
|
2484
2139
|
remove(t, e) {
|
|
2485
2140
|
t === void 0 && (t = 0), e === void 0 && (e = this.displayValue.length), [t, e] = this._adjustRangeWithSeparators(t, e);
|
|
2486
|
-
const s = this.value.slice(0, t), i = this.value.slice(e),
|
|
2141
|
+
const s = this.value.slice(0, t), i = this.value.slice(e), n = this._separatorsCount(s.length);
|
|
2487
2142
|
this._value = this._insertThousandsSeparators(this._removeThousandsSeparators(s + i));
|
|
2488
|
-
const
|
|
2143
|
+
const a = this._separatorsCountFromSlice(s);
|
|
2489
2144
|
return new c({
|
|
2490
|
-
tailShift: (
|
|
2145
|
+
tailShift: (a - n) * this.thousandsSeparator.length
|
|
2491
2146
|
});
|
|
2492
2147
|
}
|
|
2493
2148
|
nearestInputPos(t, e) {
|
|
2494
2149
|
if (!this.thousandsSeparator) return t;
|
|
2495
2150
|
switch (e) {
|
|
2496
|
-
case
|
|
2497
|
-
case
|
|
2498
|
-
case
|
|
2151
|
+
case o.NONE:
|
|
2152
|
+
case o.LEFT:
|
|
2153
|
+
case o.FORCE_LEFT: {
|
|
2499
2154
|
const s = this._findSeparatorAround(t - 1);
|
|
2500
2155
|
if (s >= 0) {
|
|
2501
2156
|
const i = s + this.thousandsSeparator.length;
|
|
2502
|
-
if (t < i || this.value.length <= i || e ===
|
|
2157
|
+
if (t < i || this.value.length <= i || e === o.FORCE_LEFT)
|
|
2503
2158
|
return s;
|
|
2504
2159
|
}
|
|
2505
2160
|
break;
|
|
2506
2161
|
}
|
|
2507
|
-
case
|
|
2508
|
-
case
|
|
2162
|
+
case o.RIGHT:
|
|
2163
|
+
case o.FORCE_RIGHT: {
|
|
2509
2164
|
const s = this._findSeparatorAround(t);
|
|
2510
2165
|
if (s >= 0)
|
|
2511
2166
|
return s + this.thousandsSeparator.length;
|
|
@@ -2525,7 +2180,7 @@ class x extends k {
|
|
|
2525
2180
|
}
|
|
2526
2181
|
_normalizeZeros(t) {
|
|
2527
2182
|
const e = this._removeThousandsSeparators(t).split(this.radix);
|
|
2528
|
-
return e[0] = e[0].replace(/^(\D*)(0*)(\d*)/, (s, i,
|
|
2183
|
+
return e[0] = e[0].replace(/^(\D*)(0*)(\d*)/, (s, i, n, a) => i + a), t.length && !/\d$/.test(e[0]) && (e[0] = e[0] + "0"), e.length > 1 && (e[1] = e[1].replace(/0*$/, ""), e[1].length || (e.length = 1)), this._insertThousandsSeparators(e.join(this.radix));
|
|
2529
2184
|
}
|
|
2530
2185
|
_padFractionalZeros(t) {
|
|
2531
2186
|
if (!t) return t;
|
|
@@ -2534,11 +2189,11 @@ class x extends k {
|
|
|
2534
2189
|
}
|
|
2535
2190
|
doSkipInvalid(t, e, s) {
|
|
2536
2191
|
e === void 0 && (e = {});
|
|
2537
|
-
const i = this.scale === 0 && t !== this.thousandsSeparator && (t === this.radix || t ===
|
|
2192
|
+
const i = this.scale === 0 && t !== this.thousandsSeparator && (t === this.radix || t === v.UNMASKED_RADIX || this.mapToRadix.includes(t));
|
|
2538
2193
|
return super.doSkipInvalid(t, e, s) && !i;
|
|
2539
2194
|
}
|
|
2540
2195
|
get unmaskedValue() {
|
|
2541
|
-
return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,
|
|
2196
|
+
return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix, v.UNMASKED_RADIX);
|
|
2542
2197
|
}
|
|
2543
2198
|
set unmaskedValue(t) {
|
|
2544
2199
|
super.unmaskedValue = t;
|
|
@@ -2547,7 +2202,7 @@ class x extends k {
|
|
|
2547
2202
|
return this.parse(this.unmaskedValue, this);
|
|
2548
2203
|
}
|
|
2549
2204
|
set typedValue(t) {
|
|
2550
|
-
this.rawInputValue = this.format(t, this).replace(
|
|
2205
|
+
this.rawInputValue = this.format(t, this).replace(v.UNMASKED_RADIX, this.radix);
|
|
2551
2206
|
}
|
|
2552
2207
|
/** Parsed Number */
|
|
2553
2208
|
get number() {
|
|
@@ -2563,18 +2218,18 @@ class x extends k {
|
|
|
2563
2218
|
return this.min != null && this.min > 0 || this.max != null && this.max > 0;
|
|
2564
2219
|
}
|
|
2565
2220
|
typedValueEquals(t) {
|
|
2566
|
-
return (super.typedValueEquals(t) ||
|
|
2221
|
+
return (super.typedValueEquals(t) || v.EMPTY_VALUES.includes(t) && v.EMPTY_VALUES.includes(this.typedValue)) && !(t === 0 && this.value === "");
|
|
2567
2222
|
}
|
|
2568
2223
|
}
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
...
|
|
2224
|
+
Y = v;
|
|
2225
|
+
v.UNMASKED_RADIX = ".";
|
|
2226
|
+
v.EMPTY_VALUES = [...m.EMPTY_VALUES, 0];
|
|
2227
|
+
v.DEFAULTS = {
|
|
2228
|
+
...m.DEFAULTS,
|
|
2574
2229
|
mask: Number,
|
|
2575
2230
|
radix: ",",
|
|
2576
2231
|
thousandsSeparator: "",
|
|
2577
|
-
mapToRadix: [
|
|
2232
|
+
mapToRadix: [Y.UNMASKED_RADIX],
|
|
2578
2233
|
min: Number.MIN_SAFE_INTEGER,
|
|
2579
2234
|
max: Number.MAX_SAFE_INTEGER,
|
|
2580
2235
|
scale: 2,
|
|
@@ -2586,24 +2241,24 @@ x.DEFAULTS = {
|
|
|
2586
2241
|
maximumFractionDigits: 20
|
|
2587
2242
|
})
|
|
2588
2243
|
};
|
|
2589
|
-
|
|
2590
|
-
const
|
|
2244
|
+
d.MaskedNumber = v;
|
|
2245
|
+
const L = {
|
|
2591
2246
|
MASKED: "value",
|
|
2592
2247
|
UNMASKED: "unmaskedValue",
|
|
2593
2248
|
TYPED: "typedValue"
|
|
2594
2249
|
};
|
|
2595
|
-
function
|
|
2596
|
-
t === void 0 && (t =
|
|
2250
|
+
function Z(r, t, e) {
|
|
2251
|
+
t === void 0 && (t = L.MASKED), e === void 0 && (e = L.MASKED);
|
|
2597
2252
|
const s = A(r);
|
|
2598
|
-
return (i) => s.runIsolated((
|
|
2253
|
+
return (i) => s.runIsolated((n) => (n[t] = i, n[e]));
|
|
2599
2254
|
}
|
|
2600
|
-
function
|
|
2601
|
-
return
|
|
2255
|
+
function lt(r, t, e, s) {
|
|
2256
|
+
return Z(t, e, s)(r);
|
|
2602
2257
|
}
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
class
|
|
2258
|
+
d.PIPE_TYPE = L;
|
|
2259
|
+
d.createPipe = Z;
|
|
2260
|
+
d.pipe = lt;
|
|
2261
|
+
class ot extends g {
|
|
2607
2262
|
get repeatFrom() {
|
|
2608
2263
|
var t;
|
|
2609
2264
|
return (t = Array.isArray(this.repeat) ? this.repeat[0] : this.repeat === 1 / 0 ? 0 : this.repeat) != null ? t : 0;
|
|
@@ -2621,12 +2276,12 @@ class Nt extends _ {
|
|
|
2621
2276
|
_update(t) {
|
|
2622
2277
|
var e, s, i;
|
|
2623
2278
|
const {
|
|
2624
|
-
repeat:
|
|
2625
|
-
...
|
|
2626
|
-
} =
|
|
2627
|
-
this._blockOpts = Object.assign({}, this._blockOpts,
|
|
2279
|
+
repeat: n,
|
|
2280
|
+
...a
|
|
2281
|
+
} = B(t);
|
|
2282
|
+
this._blockOpts = Object.assign({}, this._blockOpts, a);
|
|
2628
2283
|
const u = A(this._blockOpts);
|
|
2629
|
-
this.repeat = (e = (s =
|
|
2284
|
+
this.repeat = (e = (s = n ?? u.repeat) != null ? s : this.repeat) != null ? e : 1 / 0, super._update({
|
|
2630
2285
|
mask: "m".repeat(Math.max(this.repeatTo === 1 / 0 && ((i = this._blocks) == null ? void 0 : i.length) || 0, this.repeatFrom)),
|
|
2631
2286
|
blocks: {
|
|
2632
2287
|
m: u
|
|
@@ -2648,35 +2303,35 @@ class Nt extends _ {
|
|
|
2648
2303
|
e === void 0 && (e = {});
|
|
2649
2304
|
const s = new c();
|
|
2650
2305
|
for (
|
|
2651
|
-
let
|
|
2306
|
+
let h = (i = (n = this._mapPosToBlock(this.displayValue.length)) == null ? void 0 : n.index) != null ? i : Math.max(this._blocks.length - 1, 0), p, f;
|
|
2652
2307
|
// try to get a block or
|
|
2653
2308
|
// try to allocate a new block if not allocated already
|
|
2654
|
-
|
|
2655
|
-
++
|
|
2309
|
+
p = (a = this._blocks[h]) != null ? a : f = !f && this._allocateBlock(h);
|
|
2310
|
+
++h
|
|
2656
2311
|
) {
|
|
2657
|
-
var i,
|
|
2658
|
-
const
|
|
2312
|
+
var i, n, a, u;
|
|
2313
|
+
const k = p._appendChar(t, {
|
|
2659
2314
|
...e,
|
|
2660
|
-
_beforeTailState: (u = e._beforeTailState) == null || (u = u._blocks) == null ? void 0 : u[
|
|
2315
|
+
_beforeTailState: (u = e._beforeTailState) == null || (u = u._blocks) == null ? void 0 : u[h]
|
|
2661
2316
|
});
|
|
2662
|
-
if (
|
|
2317
|
+
if (k.skip && f) {
|
|
2663
2318
|
this._blocks.pop(), this.mask = this.mask.slice(1);
|
|
2664
2319
|
break;
|
|
2665
2320
|
}
|
|
2666
|
-
if (s.aggregate(
|
|
2321
|
+
if (s.aggregate(k), k.consumed) break;
|
|
2667
2322
|
}
|
|
2668
2323
|
return s;
|
|
2669
2324
|
}
|
|
2670
2325
|
_trimEmptyTail(t, e) {
|
|
2671
2326
|
var s, i;
|
|
2672
2327
|
t === void 0 && (t = 0);
|
|
2673
|
-
const
|
|
2674
|
-
let
|
|
2675
|
-
e != null && (
|
|
2328
|
+
const n = Math.max(((s = this._mapPosToBlock(t)) == null ? void 0 : s.index) || 0, this.repeatFrom, 0);
|
|
2329
|
+
let a;
|
|
2330
|
+
e != null && (a = (i = this._mapPosToBlock(e)) == null ? void 0 : i.index), a == null && (a = this._blocks.length - 1);
|
|
2676
2331
|
let u = 0;
|
|
2677
|
-
for (let
|
|
2332
|
+
for (let h = a; n <= h && !this._blocks[h].unmaskedValue; --h, ++u)
|
|
2678
2333
|
;
|
|
2679
|
-
u && (this._blocks.splice(
|
|
2334
|
+
u && (this._blocks.splice(a - u + 1, u), this.mask = this.mask.slice(u));
|
|
2680
2335
|
}
|
|
2681
2336
|
reset() {
|
|
2682
2337
|
super.reset(), this._trimEmptyTail();
|
|
@@ -2696,151 +2351,151 @@ class Nt extends _ {
|
|
|
2696
2351
|
this._blocks.length = t._blocks.length, this.mask = this.mask.slice(0, this._blocks.length), super.state = t;
|
|
2697
2352
|
}
|
|
2698
2353
|
}
|
|
2699
|
-
|
|
2354
|
+
d.RepeatBlock = ot;
|
|
2700
2355
|
try {
|
|
2701
|
-
globalThis.IMask =
|
|
2356
|
+
globalThis.IMask = d;
|
|
2702
2357
|
} catch {
|
|
2703
2358
|
}
|
|
2704
|
-
const
|
|
2359
|
+
const X = {
|
|
2705
2360
|
// common
|
|
2706
|
-
mask:
|
|
2707
|
-
value:
|
|
2708
|
-
unmask:
|
|
2709
|
-
prepare:
|
|
2710
|
-
prepareChar:
|
|
2711
|
-
validate:
|
|
2712
|
-
commit:
|
|
2713
|
-
overwrite:
|
|
2714
|
-
eager:
|
|
2715
|
-
skipInvalid:
|
|
2361
|
+
mask: l.oneOfType([l.array, l.func, l.string, l.instanceOf(RegExp), l.oneOf([Date, Number, d.Masked]), l.instanceOf(d.Masked)]),
|
|
2362
|
+
value: l.any,
|
|
2363
|
+
unmask: l.oneOfType([l.bool, l.oneOf(["typed"])]),
|
|
2364
|
+
prepare: l.func,
|
|
2365
|
+
prepareChar: l.func,
|
|
2366
|
+
validate: l.func,
|
|
2367
|
+
commit: l.func,
|
|
2368
|
+
overwrite: l.oneOfType([l.bool, l.oneOf(["shift"])]),
|
|
2369
|
+
eager: l.oneOfType([l.bool, l.oneOf(["append", "remove"])]),
|
|
2370
|
+
skipInvalid: l.bool,
|
|
2716
2371
|
// events
|
|
2717
|
-
onAccept:
|
|
2718
|
-
onComplete:
|
|
2372
|
+
onAccept: l.func,
|
|
2373
|
+
onComplete: l.func,
|
|
2719
2374
|
// pattern
|
|
2720
|
-
placeholderChar:
|
|
2721
|
-
displayChar:
|
|
2722
|
-
lazy:
|
|
2723
|
-
definitions:
|
|
2724
|
-
blocks:
|
|
2375
|
+
placeholderChar: l.string,
|
|
2376
|
+
displayChar: l.string,
|
|
2377
|
+
lazy: l.bool,
|
|
2378
|
+
definitions: l.object,
|
|
2379
|
+
blocks: l.object,
|
|
2725
2380
|
// enum
|
|
2726
|
-
enum:
|
|
2381
|
+
enum: l.arrayOf(l.string),
|
|
2727
2382
|
// range
|
|
2728
|
-
maxLength:
|
|
2729
|
-
from:
|
|
2730
|
-
to:
|
|
2383
|
+
maxLength: l.number,
|
|
2384
|
+
from: l.number,
|
|
2385
|
+
to: l.number,
|
|
2731
2386
|
// date
|
|
2732
|
-
pattern:
|
|
2733
|
-
format:
|
|
2734
|
-
parse:
|
|
2735
|
-
autofix:
|
|
2387
|
+
pattern: l.string,
|
|
2388
|
+
format: l.func,
|
|
2389
|
+
parse: l.func,
|
|
2390
|
+
autofix: l.oneOfType([l.bool, l.oneOf(["pad"])]),
|
|
2736
2391
|
// number
|
|
2737
|
-
radix:
|
|
2738
|
-
thousandsSeparator:
|
|
2739
|
-
mapToRadix:
|
|
2740
|
-
scale:
|
|
2741
|
-
normalizeZeros:
|
|
2742
|
-
padFractionalZeros:
|
|
2743
|
-
min:
|
|
2744
|
-
max:
|
|
2392
|
+
radix: l.string,
|
|
2393
|
+
thousandsSeparator: l.string,
|
|
2394
|
+
mapToRadix: l.arrayOf(l.string),
|
|
2395
|
+
scale: l.number,
|
|
2396
|
+
normalizeZeros: l.bool,
|
|
2397
|
+
padFractionalZeros: l.bool,
|
|
2398
|
+
min: l.oneOfType([l.number, l.instanceOf(Date)]),
|
|
2399
|
+
max: l.oneOfType([l.number, l.instanceOf(Date)]),
|
|
2745
2400
|
// dynamic
|
|
2746
|
-
dispatch:
|
|
2401
|
+
dispatch: l.func,
|
|
2747
2402
|
// ref
|
|
2748
|
-
inputRef:
|
|
2749
|
-
current:
|
|
2403
|
+
inputRef: l.oneOfType([l.func, l.shape({
|
|
2404
|
+
current: l.object
|
|
2750
2405
|
})])
|
|
2751
|
-
},
|
|
2752
|
-
function
|
|
2406
|
+
}, $ = Object.keys(X).filter((r) => r !== "value"), pt = ["value", "unmask", "onAccept", "onComplete", "inputRef"], dt = $.filter((r) => pt.indexOf(r) < 0);
|
|
2407
|
+
function W(r) {
|
|
2753
2408
|
var t;
|
|
2754
|
-
const e = (t = class extends
|
|
2755
|
-
constructor(
|
|
2756
|
-
super(
|
|
2409
|
+
const e = (t = class extends x.Component {
|
|
2410
|
+
constructor(n) {
|
|
2411
|
+
super(n), this._inputRef = this._inputRef.bind(this);
|
|
2757
2412
|
}
|
|
2758
2413
|
componentDidMount() {
|
|
2759
2414
|
this.props.mask && this.initMask();
|
|
2760
2415
|
}
|
|
2761
2416
|
componentDidUpdate() {
|
|
2762
|
-
const
|
|
2763
|
-
if (
|
|
2764
|
-
this.maskRef ? (this.maskRef.updateOptions(
|
|
2765
|
-
else if (this.destroyMask(), "value" in
|
|
2417
|
+
const n = this.props, a = this._extractMaskOptionsFromProps(n);
|
|
2418
|
+
if (a.mask)
|
|
2419
|
+
this.maskRef ? (this.maskRef.updateOptions(a), "value" in n && n.value !== void 0 && (this.maskValue = n.value)) : this.initMask(a);
|
|
2420
|
+
else if (this.destroyMask(), "value" in n && n.value !== void 0) {
|
|
2766
2421
|
var u;
|
|
2767
|
-
(u = this.element) != null && u.isContentEditable && this.element.tagName !== "INPUT" && this.element.tagName !== "TEXTAREA" ? this.element.textContent =
|
|
2422
|
+
(u = this.element) != null && u.isContentEditable && this.element.tagName !== "INPUT" && this.element.tagName !== "TEXTAREA" ? this.element.textContent = n.value : this.element.value = n.value;
|
|
2768
2423
|
}
|
|
2769
2424
|
}
|
|
2770
2425
|
componentWillUnmount() {
|
|
2771
2426
|
this.destroyMask();
|
|
2772
2427
|
}
|
|
2773
|
-
_inputRef(
|
|
2774
|
-
this.element =
|
|
2428
|
+
_inputRef(n) {
|
|
2429
|
+
this.element = n, this.props.inputRef && (Object.prototype.hasOwnProperty.call(this.props.inputRef, "current") ? this.props.inputRef.current = n : this.props.inputRef(n));
|
|
2775
2430
|
}
|
|
2776
|
-
initMask(
|
|
2777
|
-
|
|
2431
|
+
initMask(n) {
|
|
2432
|
+
n === void 0 && (n = this._extractMaskOptionsFromProps(this.props)), this.maskRef = d(this.element, n).on("accept", this._onAccept.bind(this)).on("complete", this._onComplete.bind(this)), "value" in this.props && this.props.value !== void 0 && (this.maskValue = this.props.value);
|
|
2778
2433
|
}
|
|
2779
2434
|
destroyMask() {
|
|
2780
2435
|
this.maskRef && (this.maskRef.destroy(), delete this.maskRef);
|
|
2781
2436
|
}
|
|
2782
|
-
_extractMaskOptionsFromProps(
|
|
2437
|
+
_extractMaskOptionsFromProps(n) {
|
|
2783
2438
|
const {
|
|
2784
|
-
...
|
|
2785
|
-
} =
|
|
2786
|
-
return Object.keys(
|
|
2787
|
-
delete
|
|
2788
|
-
}),
|
|
2439
|
+
...a
|
|
2440
|
+
} = n;
|
|
2441
|
+
return Object.keys(a).filter((u) => dt.indexOf(u) < 0).forEach((u) => {
|
|
2442
|
+
delete a[u];
|
|
2443
|
+
}), a;
|
|
2789
2444
|
}
|
|
2790
|
-
_extractNonMaskProps(
|
|
2445
|
+
_extractNonMaskProps(n) {
|
|
2791
2446
|
const {
|
|
2792
|
-
...
|
|
2793
|
-
} =
|
|
2794
|
-
return
|
|
2795
|
-
u !== "maxLength" && delete
|
|
2796
|
-
}), "defaultValue" in
|
|
2447
|
+
...a
|
|
2448
|
+
} = n;
|
|
2449
|
+
return $.forEach((u) => {
|
|
2450
|
+
u !== "maxLength" && delete a[u];
|
|
2451
|
+
}), "defaultValue" in a || (a.defaultValue = n.mask ? "" : a.value), delete a.value, a;
|
|
2797
2452
|
}
|
|
2798
2453
|
get maskValue() {
|
|
2799
2454
|
return this.maskRef ? this.props.unmask === "typed" ? this.maskRef.typedValue : this.props.unmask ? this.maskRef.unmaskedValue : this.maskRef.value : "";
|
|
2800
2455
|
}
|
|
2801
|
-
set maskValue(
|
|
2802
|
-
this.maskRef && (
|
|
2456
|
+
set maskValue(n) {
|
|
2457
|
+
this.maskRef && (n = n == null && this.props.unmask !== "typed" ? "" : n, this.props.unmask === "typed" ? this.maskRef.typedValue = n : this.props.unmask ? this.maskRef.unmaskedValue = n : this.maskRef.value = n);
|
|
2803
2458
|
}
|
|
2804
|
-
_onAccept(
|
|
2805
|
-
this.props.onAccept && this.maskRef && this.props.onAccept(this.maskValue, this.maskRef,
|
|
2459
|
+
_onAccept(n) {
|
|
2460
|
+
this.props.onAccept && this.maskRef && this.props.onAccept(this.maskValue, this.maskRef, n);
|
|
2806
2461
|
}
|
|
2807
|
-
_onComplete(
|
|
2808
|
-
this.props.onComplete && this.maskRef && this.props.onComplete(this.maskValue, this.maskRef,
|
|
2462
|
+
_onComplete(n) {
|
|
2463
|
+
this.props.onComplete && this.maskRef && this.props.onComplete(this.maskValue, this.maskRef, n);
|
|
2809
2464
|
}
|
|
2810
2465
|
render() {
|
|
2811
|
-
return
|
|
2466
|
+
return x.createElement(r, {
|
|
2812
2467
|
...this._extractNonMaskProps(this.props),
|
|
2813
2468
|
inputRef: this._inputRef
|
|
2814
2469
|
});
|
|
2815
2470
|
}
|
|
2816
2471
|
}, t.displayName = void 0, t.propTypes = void 0, t), s = r.displayName || r.name || "Component";
|
|
2817
|
-
return e.displayName = "IMask(" + s + ")", e.propTypes =
|
|
2472
|
+
return e.displayName = "IMask(" + s + ")", e.propTypes = X, x.forwardRef((i, n) => x.createElement(e, {
|
|
2818
2473
|
...i,
|
|
2819
|
-
ref:
|
|
2474
|
+
ref: n
|
|
2820
2475
|
}));
|
|
2821
2476
|
}
|
|
2822
|
-
const
|
|
2477
|
+
const ct = W((r) => {
|
|
2823
2478
|
let {
|
|
2824
2479
|
inputRef: t,
|
|
2825
2480
|
...e
|
|
2826
2481
|
} = r;
|
|
2827
|
-
return
|
|
2482
|
+
return x.createElement("input", {
|
|
2828
2483
|
...e,
|
|
2829
2484
|
ref: t
|
|
2830
2485
|
});
|
|
2831
|
-
}),
|
|
2486
|
+
}), ft = (r, t) => x.createElement(ct, {
|
|
2832
2487
|
...r,
|
|
2833
2488
|
ref: t
|
|
2834
2489
|
});
|
|
2835
|
-
|
|
2836
|
-
const
|
|
2837
|
-
|
|
2490
|
+
x.forwardRef(ft);
|
|
2491
|
+
const kt = W(({ inputRef: r, ...t }) => /* @__PURE__ */ H(
|
|
2492
|
+
Q,
|
|
2838
2493
|
{
|
|
2839
2494
|
...t,
|
|
2840
2495
|
ref: r
|
|
2841
2496
|
}
|
|
2842
|
-
)),
|
|
2497
|
+
)), Ct = (r) => /* @__PURE__ */ H(kt, { ...r });
|
|
2843
2498
|
export {
|
|
2844
|
-
|
|
2499
|
+
Ct as InputPhone
|
|
2845
2500
|
};
|
|
2846
2501
|
//# sourceMappingURL=components-input-phone-input-phone.js.map
|