@phila/phila-ui-core 1.0.21 → 1.0.24
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/phila-ui-core.js +68 -137
- package/package.json +4 -4
package/dist/phila-ui-core.js
CHANGED
|
@@ -131,38 +131,25 @@ function G(u) {
|
|
|
131
131
|
return u.replace(/([.*+?^=!:${}()|[\]/\\])/g, "\\$1");
|
|
132
132
|
}
|
|
133
133
|
function L(u, t) {
|
|
134
|
-
if (t === u)
|
|
135
|
-
return !0;
|
|
134
|
+
if (t === u) return !0;
|
|
136
135
|
const e = Array.isArray(t), s = Array.isArray(u);
|
|
137
136
|
let i;
|
|
138
137
|
if (e && s) {
|
|
139
|
-
if (t.length != u.length)
|
|
140
|
-
|
|
141
|
-
for (i = 0; i < t.length; i++)
|
|
142
|
-
if (!L(t[i], u[i]))
|
|
143
|
-
return !1;
|
|
138
|
+
if (t.length != u.length) return !1;
|
|
139
|
+
for (i = 0; i < t.length; i++) if (!L(t[i], u[i])) return !1;
|
|
144
140
|
return !0;
|
|
145
141
|
}
|
|
146
|
-
if (e != s)
|
|
147
|
-
return !1;
|
|
142
|
+
if (e != s) return !1;
|
|
148
143
|
if (t && u && typeof t == "object" && typeof u == "object") {
|
|
149
144
|
const a = t instanceof Date, n = u instanceof Date;
|
|
150
|
-
if (a && n)
|
|
151
|
-
|
|
152
|
-
if (a != n)
|
|
153
|
-
return !1;
|
|
145
|
+
if (a && n) return t.getTime() == u.getTime();
|
|
146
|
+
if (a != n) return !1;
|
|
154
147
|
const r = t instanceof RegExp, l = u instanceof RegExp;
|
|
155
|
-
if (r && l)
|
|
156
|
-
|
|
157
|
-
if (r != l)
|
|
158
|
-
return !1;
|
|
148
|
+
if (r && l) return t.toString() == u.toString();
|
|
149
|
+
if (r != l) return !1;
|
|
159
150
|
const o = Object.keys(t);
|
|
160
|
-
for (i = 0; i < o.length; i++)
|
|
161
|
-
|
|
162
|
-
return !1;
|
|
163
|
-
for (i = 0; i < o.length; i++)
|
|
164
|
-
if (!L(u[o[i]], t[o[i]]))
|
|
165
|
-
return !1;
|
|
151
|
+
for (i = 0; i < o.length; i++) if (!Object.prototype.hasOwnProperty.call(u, o[i])) return !1;
|
|
152
|
+
for (i = 0; i < o.length; i++) if (!L(u[o[i]], t[o[i]])) return !1;
|
|
166
153
|
return !0;
|
|
167
154
|
} else if (t && u && typeof t == "function" && typeof u == "function")
|
|
168
155
|
return t.toString() === u.toString();
|
|
@@ -219,18 +206,15 @@ function p(u, t) {
|
|
|
219
206
|
return new p.InputMask(u, t);
|
|
220
207
|
}
|
|
221
208
|
function lt(u) {
|
|
222
|
-
if (u == null)
|
|
223
|
-
throw new Error("mask property should be defined");
|
|
209
|
+
if (u == null) throw new Error("mask property should be defined");
|
|
224
210
|
return u instanceof RegExp ? p.MaskedRegExp : S(u) ? p.MaskedPattern : u === Date ? p.MaskedDate : u === Number ? p.MaskedNumber : Array.isArray(u) || u === Array ? p.MaskedDynamic : p.Masked && u.prototype instanceof p.Masked ? u : p.Masked && u instanceof p.Masked ? u.constructor : u instanceof Function ? p.MaskedFunction : (console.warn("Mask not found for mask", u), p.Masked);
|
|
225
211
|
}
|
|
226
212
|
function w(u) {
|
|
227
|
-
if (!u)
|
|
228
|
-
throw new Error("Options in not defined");
|
|
213
|
+
if (!u) throw new Error("Options in not defined");
|
|
229
214
|
if (p.Masked) {
|
|
230
|
-
if (u.prototype instanceof p.Masked)
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
};
|
|
215
|
+
if (u.prototype instanceof p.Masked) return {
|
|
216
|
+
mask: u
|
|
217
|
+
};
|
|
234
218
|
const {
|
|
235
219
|
mask: t = void 0,
|
|
236
220
|
...e
|
|
@@ -254,11 +238,9 @@ function w(u) {
|
|
|
254
238
|
};
|
|
255
239
|
}
|
|
256
240
|
function y(u) {
|
|
257
|
-
if (p.Masked && u instanceof p.Masked)
|
|
258
|
-
return u;
|
|
241
|
+
if (p.Masked && u instanceof p.Masked) return u;
|
|
259
242
|
const t = w(u), e = lt(t.mask);
|
|
260
|
-
if (!e)
|
|
261
|
-
throw new Error("Masked class is not found for provided mask " + t.mask + ", appropriate module needs to be imported manually before creating mask.");
|
|
243
|
+
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.");
|
|
262
244
|
return t.mask === e && delete t.mask, t._mask && (t.mask = t._mask, delete t._mask), new e(t);
|
|
263
245
|
}
|
|
264
246
|
p.createMask = y;
|
|
@@ -382,8 +364,7 @@ class ot extends U {
|
|
|
382
364
|
}
|
|
383
365
|
/** Sets HTMLElement selection */
|
|
384
366
|
_unsafeSelect(t, e) {
|
|
385
|
-
if (!this.rootElement.createRange)
|
|
386
|
-
return;
|
|
367
|
+
if (!this.rootElement.createRange) return;
|
|
387
368
|
const s = this.rootElement.createRange();
|
|
388
369
|
s.setStart(this.input.firstChild || this.input, t), s.setEnd(this.input.lastChild || this.input, e);
|
|
389
370
|
const i = this.rootElement, a = i.getSelection && i.getSelection();
|
|
@@ -442,8 +423,7 @@ class wt {
|
|
|
442
423
|
return this.masked.mask;
|
|
443
424
|
}
|
|
444
425
|
set mask(t) {
|
|
445
|
-
if (this.maskEquals(t))
|
|
446
|
-
return;
|
|
426
|
+
if (this.maskEquals(t)) return;
|
|
447
427
|
if (!(t instanceof p.Masked) && this.masked.constructor === lt(t)) {
|
|
448
428
|
this.masked.updateOptions({
|
|
449
429
|
mask: t
|
|
@@ -582,8 +562,7 @@ class wt {
|
|
|
582
562
|
}
|
|
583
563
|
/** Removes custom event listener */
|
|
584
564
|
off(t, e) {
|
|
585
|
-
if (!this._listeners[t])
|
|
586
|
-
return this;
|
|
565
|
+
if (!this._listeners[t]) return this;
|
|
587
566
|
if (!e)
|
|
588
567
|
return delete this._listeners[t], this;
|
|
589
568
|
const s = this._listeners[t].indexOf(e);
|
|
@@ -698,14 +677,12 @@ class F {
|
|
|
698
677
|
Object.assign(this, t);
|
|
699
678
|
}
|
|
700
679
|
unshift(t) {
|
|
701
|
-
if (!this.value.length || t != null && this.from >= t)
|
|
702
|
-
return "";
|
|
680
|
+
if (!this.value.length || t != null && this.from >= t) return "";
|
|
703
681
|
const e = this.value[0];
|
|
704
682
|
return this.value = this.value.slice(1), e;
|
|
705
683
|
}
|
|
706
684
|
shift() {
|
|
707
|
-
if (!this.value.length)
|
|
708
|
-
return "";
|
|
685
|
+
if (!this.value.length) return "";
|
|
709
686
|
const t = this.value[this.value.length - 1];
|
|
710
687
|
return this.value = this.value.slice(0, -1), t;
|
|
711
688
|
}
|
|
@@ -868,16 +845,14 @@ class _ {
|
|
|
868
845
|
}
|
|
869
846
|
/** Appends symbols considering flags */
|
|
870
847
|
append(t, e, s) {
|
|
871
|
-
if (!S(t))
|
|
872
|
-
throw new Error("value should be string");
|
|
848
|
+
if (!S(t)) throw new Error("value should be string");
|
|
873
849
|
const i = S(s) ? new F(String(s)) : s;
|
|
874
850
|
e != null && e.tail && (e._beforeTailState = this.state);
|
|
875
851
|
let a;
|
|
876
852
|
[t, a] = this.doPrepare(t, e);
|
|
877
853
|
for (let n = 0; n < t.length; ++n) {
|
|
878
854
|
const r = this._appendChar(t[n], e, i);
|
|
879
|
-
if (!r.rawInserted && !this.doSkipInvalid(t[n], e, i))
|
|
880
|
-
break;
|
|
855
|
+
if (!r.rawInserted && !this.doSkipInvalid(t[n], e, i)) break;
|
|
881
856
|
a.aggregate(r);
|
|
882
857
|
}
|
|
883
858
|
return (this.eager === !0 || this.eager === "append") && e != null && e.input && t && a.aggregate(this._appendEager()), i != null && (a.tailShift += this.appendTail(i).tailShift), a;
|
|
@@ -887,15 +862,13 @@ class _ {
|
|
|
887
862
|
}
|
|
888
863
|
/** Calls function and reapplies current value */
|
|
889
864
|
withValueRefresh(t) {
|
|
890
|
-
if (this._refreshing || !this._initialized)
|
|
891
|
-
return t();
|
|
865
|
+
if (this._refreshing || !this._initialized) return t();
|
|
892
866
|
this._refreshing = !0;
|
|
893
867
|
const e = this.rawInputValue, s = this.value, i = t();
|
|
894
868
|
return this.rawInputValue = e, this.value && this.value !== s && s.indexOf(this.value) === 0 && (this.append(s.slice(this.displayValue.length), {}, ""), this.doCommit()), delete this._refreshing, i;
|
|
895
869
|
}
|
|
896
870
|
runIsolated(t) {
|
|
897
|
-
if (this._isolated || !this._initialized)
|
|
898
|
-
return t(this);
|
|
871
|
+
if (this._isolated || !this._initialized) return t(this);
|
|
899
872
|
this._isolated = !0;
|
|
900
873
|
const e = this.state, s = t(this);
|
|
901
874
|
return this.state = e, delete this._isolated, s;
|
|
@@ -937,8 +910,7 @@ class _ {
|
|
|
937
910
|
f.aggregate(new c({
|
|
938
911
|
tailShift: -1
|
|
939
912
|
})).aggregate(this.remove(m - 1));
|
|
940
|
-
} else
|
|
941
|
-
i === h.FORCE_RIGHT && r.unshift();
|
|
913
|
+
} else i === h.FORCE_RIGHT && r.unshift();
|
|
942
914
|
return f.aggregate(this.append(s, a, r));
|
|
943
915
|
}
|
|
944
916
|
maskEquals(t) {
|
|
@@ -969,8 +941,7 @@ class b {
|
|
|
969
941
|
return this.chunks.map(String).join("");
|
|
970
942
|
}
|
|
971
943
|
extend(t) {
|
|
972
|
-
if (!String(t))
|
|
973
|
-
return;
|
|
944
|
+
if (!String(t)) return;
|
|
974
945
|
t = S(t) ? new F(String(t)) : t;
|
|
975
946
|
const e = this.chunks[this.chunks.length - 1], s = e && // if stops are same or tail has no stop
|
|
976
947
|
(e.stop === t.stop || t.stop == null) && // if tail chunk goes just after last chunk
|
|
@@ -1028,37 +999,31 @@ class b {
|
|
|
1028
999
|
});
|
|
1029
1000
|
}
|
|
1030
1001
|
unshift(t) {
|
|
1031
|
-
if (!this.chunks.length || t != null && this.from >= t)
|
|
1032
|
-
return "";
|
|
1002
|
+
if (!this.chunks.length || t != null && this.from >= t) return "";
|
|
1033
1003
|
const e = t != null ? t - this.from : t;
|
|
1034
1004
|
let s = 0;
|
|
1035
1005
|
for (; s < this.chunks.length; ) {
|
|
1036
1006
|
const i = this.chunks[s], a = i.unshift(e);
|
|
1037
1007
|
if (i.toString()) {
|
|
1038
|
-
if (!a)
|
|
1039
|
-
break;
|
|
1008
|
+
if (!a) break;
|
|
1040
1009
|
++s;
|
|
1041
1010
|
} else
|
|
1042
1011
|
this.chunks.splice(s, 1);
|
|
1043
|
-
if (a)
|
|
1044
|
-
return a;
|
|
1012
|
+
if (a) return a;
|
|
1045
1013
|
}
|
|
1046
1014
|
return "";
|
|
1047
1015
|
}
|
|
1048
1016
|
shift() {
|
|
1049
|
-
if (!this.chunks.length)
|
|
1050
|
-
return "";
|
|
1017
|
+
if (!this.chunks.length) return "";
|
|
1051
1018
|
let t = this.chunks.length - 1;
|
|
1052
1019
|
for (; 0 <= t; ) {
|
|
1053
1020
|
const e = this.chunks[t], s = e.shift();
|
|
1054
1021
|
if (e.toString()) {
|
|
1055
|
-
if (!s)
|
|
1056
|
-
break;
|
|
1022
|
+
if (!s) break;
|
|
1057
1023
|
--t;
|
|
1058
1024
|
} else
|
|
1059
1025
|
this.chunks.splice(t, 1);
|
|
1060
|
-
if (s)
|
|
1061
|
-
return s;
|
|
1026
|
+
if (s) return s;
|
|
1062
1027
|
}
|
|
1063
1028
|
return "";
|
|
1064
1029
|
}
|
|
@@ -1113,15 +1078,13 @@ class Tt {
|
|
|
1113
1078
|
_pushLeft(t) {
|
|
1114
1079
|
for (this.pushState(), this.bindBlock(); 0 <= this.index; --this.index, this.offset = ((e = this.block) == null ? void 0 : e.displayValue.length) || 0) {
|
|
1115
1080
|
var e;
|
|
1116
|
-
if (t())
|
|
1117
|
-
return this.ok = !0;
|
|
1081
|
+
if (t()) return this.ok = !0;
|
|
1118
1082
|
}
|
|
1119
1083
|
return this.ok = !1;
|
|
1120
1084
|
}
|
|
1121
1085
|
_pushRight(t) {
|
|
1122
1086
|
for (this.pushState(), this.bindBlock(); this.index < this.masked._blocks.length; ++this.index, this.offset = 0)
|
|
1123
|
-
if (t())
|
|
1124
|
-
return this.ok = !0;
|
|
1087
|
+
if (t()) return this.ok = !0;
|
|
1125
1088
|
return this.ok = !1;
|
|
1126
1089
|
}
|
|
1127
1090
|
pushLeftBeforeFilled() {
|
|
@@ -1216,8 +1179,7 @@ class ht {
|
|
|
1216
1179
|
return !!this._value;
|
|
1217
1180
|
}
|
|
1218
1181
|
_appendChar(t, e) {
|
|
1219
|
-
if (e === void 0 && (e = {}), this.isFilled)
|
|
1220
|
-
return new c();
|
|
1182
|
+
if (e === void 0 && (e = {}), this.isFilled) return new c();
|
|
1221
1183
|
const s = this.eager === !0 || this.eager === "append", a = this.char === t && (this.isUnmasking || e.input || e.raw) && (!e.raw || !s) && !e.tail, n = new c({
|
|
1222
1184
|
inserted: this.char,
|
|
1223
1185
|
rawInserted: a ? this.char : ""
|
|
@@ -1308,8 +1270,7 @@ class N {
|
|
|
1308
1270
|
return !!this.masked.value || this.isOptional;
|
|
1309
1271
|
}
|
|
1310
1272
|
_appendChar(t, e) {
|
|
1311
|
-
if (e === void 0 && (e = {}), this.isFilled)
|
|
1312
|
-
return new c();
|
|
1273
|
+
if (e === void 0 && (e = {}), this.isFilled) return new c();
|
|
1313
1274
|
const s = this.masked.state;
|
|
1314
1275
|
let i = this.masked._appendChar(t, this.currentMaskFlags(e));
|
|
1315
1276
|
return i.inserted && this.doValidate(e) === !1 && (i = new c(), this.masked.state = s), !i.inserted && !this.isOptional && !this.lazy && !e.input && (i.inserted = this.placeholderChar), i.skip = !i.inserted && !this.isOptional, this.isFilled = !!i.inserted, i;
|
|
@@ -1428,8 +1389,7 @@ class v extends _ {
|
|
|
1428
1389
|
const t = this.definitions;
|
|
1429
1390
|
this._blocks = [], this.exposeBlock = void 0, this._stops = [], this._maskedBlocks = {};
|
|
1430
1391
|
const e = this.mask;
|
|
1431
|
-
if (!e || !t)
|
|
1432
|
-
return;
|
|
1392
|
+
if (!e || !t) return;
|
|
1433
1393
|
let s = !1, i = !1;
|
|
1434
1394
|
for (let a = 0; a < e.length; ++a) {
|
|
1435
1395
|
if (this.blocks) {
|
|
@@ -1473,8 +1433,7 @@ class v extends _ {
|
|
|
1473
1433
|
continue;
|
|
1474
1434
|
}
|
|
1475
1435
|
if (n === v.ESCAPE_CHAR) {
|
|
1476
|
-
if (++a, n = e[a], !n)
|
|
1477
|
-
break;
|
|
1436
|
+
if (++a, n = e[a], !n) break;
|
|
1478
1437
|
r = !1;
|
|
1479
1438
|
}
|
|
1480
1439
|
const l = r ? new N({
|
|
@@ -1535,8 +1494,7 @@ class v extends _ {
|
|
|
1535
1494
|
if (this.exposeBlock) {
|
|
1536
1495
|
const e = this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock)) + this.exposeBlock.displayValue.length);
|
|
1537
1496
|
this.exposeBlock.unmaskedValue = t, this.appendTail(e), this.doCommit();
|
|
1538
|
-
} else
|
|
1539
|
-
super.unmaskedValue = t;
|
|
1497
|
+
} else super.unmaskedValue = t;
|
|
1540
1498
|
}
|
|
1541
1499
|
get value() {
|
|
1542
1500
|
return this.exposeBlock ? this.exposeBlock.value : (
|
|
@@ -1548,8 +1506,7 @@ class v extends _ {
|
|
|
1548
1506
|
if (this.exposeBlock) {
|
|
1549
1507
|
const e = this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock)) + this.exposeBlock.displayValue.length);
|
|
1550
1508
|
this.exposeBlock.value = t, this.appendTail(e), this.doCommit();
|
|
1551
|
-
} else
|
|
1552
|
-
super.value = t;
|
|
1509
|
+
} else super.value = t;
|
|
1553
1510
|
}
|
|
1554
1511
|
get typedValue() {
|
|
1555
1512
|
return this.exposeBlock ? this.exposeBlock.typedValue : super.typedValue;
|
|
@@ -1558,8 +1515,7 @@ class v extends _ {
|
|
|
1558
1515
|
if (this.exposeBlock) {
|
|
1559
1516
|
const e = this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock)) + this.exposeBlock.displayValue.length);
|
|
1560
1517
|
this.exposeBlock.typedValue = t, this.appendTail(e), this.doCommit();
|
|
1561
|
-
} else
|
|
1562
|
-
super.typedValue = t;
|
|
1518
|
+
} else super.typedValue = t;
|
|
1563
1519
|
}
|
|
1564
1520
|
get displayValue() {
|
|
1565
1521
|
return this._blocks.reduce((t, e) => t += e.displayValue, "");
|
|
@@ -1571,13 +1527,11 @@ class v extends _ {
|
|
|
1571
1527
|
var t;
|
|
1572
1528
|
const e = new c();
|
|
1573
1529
|
let s = (t = this._mapPosToBlock(this.displayValue.length)) == null ? void 0 : t.index;
|
|
1574
|
-
if (s == null)
|
|
1575
|
-
return e;
|
|
1530
|
+
if (s == null) return e;
|
|
1576
1531
|
this._blocks[s].isFilled && ++s;
|
|
1577
1532
|
for (let i = s; i < this._blocks.length; ++i) {
|
|
1578
1533
|
const a = this._blocks[i]._appendEager();
|
|
1579
|
-
if (!a.inserted)
|
|
1580
|
-
break;
|
|
1534
|
+
if (!a.inserted) break;
|
|
1581
1535
|
e.aggregate(a);
|
|
1582
1536
|
}
|
|
1583
1537
|
return e;
|
|
@@ -1585,16 +1539,14 @@ class v extends _ {
|
|
|
1585
1539
|
_appendCharRaw(t, e) {
|
|
1586
1540
|
e === void 0 && (e = {});
|
|
1587
1541
|
const s = this._mapPosToBlock(this.displayValue.length), i = new c();
|
|
1588
|
-
if (!s)
|
|
1589
|
-
return i;
|
|
1542
|
+
if (!s) return i;
|
|
1590
1543
|
for (let n = s.index, r; r = this._blocks[n]; ++n) {
|
|
1591
1544
|
var a;
|
|
1592
1545
|
const l = r._appendChar(t, {
|
|
1593
1546
|
...e,
|
|
1594
1547
|
_beforeTailState: (a = e._beforeTailState) == null || (a = a._blocks) == null ? void 0 : a[n]
|
|
1595
1548
|
});
|
|
1596
|
-
if (i.aggregate(l), l.consumed)
|
|
1597
|
-
break;
|
|
1549
|
+
if (i.aggregate(l), l.consumed) break;
|
|
1598
1550
|
}
|
|
1599
1551
|
return i;
|
|
1600
1552
|
}
|
|
@@ -1607,8 +1559,7 @@ class v extends _ {
|
|
|
1607
1559
|
}), s;
|
|
1608
1560
|
}
|
|
1609
1561
|
extractInput(t, e, s) {
|
|
1610
|
-
if (t === void 0 && (t = 0), e === void 0 && (e = this.displayValue.length), s === void 0 && (s = {}), t === e)
|
|
1611
|
-
return "";
|
|
1562
|
+
if (t === void 0 && (t = 0), e === void 0 && (e = this.displayValue.length), s === void 0 && (s = {}), t === e) return "";
|
|
1612
1563
|
let i = "";
|
|
1613
1564
|
return this._forEachBlocksInRange(t, e, (a, n, r, l) => {
|
|
1614
1565
|
i += a.extractInput(r, l, s);
|
|
@@ -1618,21 +1569,17 @@ class v extends _ {
|
|
|
1618
1569
|
let e;
|
|
1619
1570
|
for (let s = 0; s < this._stops.length; ++s) {
|
|
1620
1571
|
const i = this._stops[s];
|
|
1621
|
-
if (i <= t)
|
|
1622
|
-
|
|
1623
|
-
else
|
|
1624
|
-
break;
|
|
1572
|
+
if (i <= t) e = i;
|
|
1573
|
+
else break;
|
|
1625
1574
|
}
|
|
1626
1575
|
return e;
|
|
1627
1576
|
}
|
|
1628
1577
|
/** Appends placeholder depending on laziness */
|
|
1629
1578
|
_appendPlaceholder(t) {
|
|
1630
1579
|
const e = new c();
|
|
1631
|
-
if (this.lazy && t == null)
|
|
1632
|
-
return e;
|
|
1580
|
+
if (this.lazy && t == null) return e;
|
|
1633
1581
|
const s = this._mapPosToBlock(this.displayValue.length);
|
|
1634
|
-
if (!s)
|
|
1635
|
-
return e;
|
|
1582
|
+
if (!s) return e;
|
|
1636
1583
|
const i = s.index, a = t ?? this._blocks.length;
|
|
1637
1584
|
return this._blocks.slice(i, a).forEach((n) => {
|
|
1638
1585
|
if (!n.lazy || t != null) {
|
|
@@ -1676,20 +1623,17 @@ class v extends _ {
|
|
|
1676
1623
|
}), s;
|
|
1677
1624
|
}
|
|
1678
1625
|
nearestInputPos(t, e) {
|
|
1679
|
-
if (e === void 0 && (e = h.NONE), !this._blocks.length)
|
|
1680
|
-
return 0;
|
|
1626
|
+
if (e === void 0 && (e = h.NONE), !this._blocks.length) return 0;
|
|
1681
1627
|
const s = new Tt(this, t);
|
|
1682
1628
|
if (e === h.NONE)
|
|
1683
1629
|
return s.pushRightBeforeInput() || (s.popState(), s.pushLeftBeforeInput()) ? s.pos : this.displayValue.length;
|
|
1684
1630
|
if (e === h.LEFT || e === h.FORCE_LEFT) {
|
|
1685
1631
|
if (e === h.LEFT) {
|
|
1686
|
-
if (s.pushRightBeforeFilled(), s.ok && s.pos === t)
|
|
1687
|
-
return t;
|
|
1632
|
+
if (s.pushRightBeforeFilled(), s.ok && s.pos === t) return t;
|
|
1688
1633
|
s.popState();
|
|
1689
1634
|
}
|
|
1690
1635
|
if (s.pushLeftBeforeInput(), s.pushLeftBeforeRequired(), s.pushLeftBeforeFilled(), e === h.LEFT) {
|
|
1691
|
-
if (s.pushRightBeforeInput(), s.pushRightBeforeRequired(), s.ok && s.pos <= t || (s.popState(), s.ok && s.pos <= t))
|
|
1692
|
-
return s.pos;
|
|
1636
|
+
if (s.pushRightBeforeInput(), s.pushRightBeforeRequired(), s.ok && s.pos <= t || (s.popState(), s.ok && s.pos <= t)) return s.pos;
|
|
1693
1637
|
s.popState();
|
|
1694
1638
|
}
|
|
1695
1639
|
return s.ok ? s.pos : e === h.FORCE_LEFT ? 0 : (s.popState(), s.ok || (s.popState(), s.ok) ? s.pos : 0);
|
|
@@ -1754,8 +1698,7 @@ class O extends v {
|
|
|
1754
1698
|
this.to = e, this.from = s, this.maxLength = Math.max(String(e).length, i), this.autofix = a;
|
|
1755
1699
|
const r = String(this.from).padStart(this.maxLength, "0"), l = String(this.to).padStart(this.maxLength, "0");
|
|
1756
1700
|
let o = 0;
|
|
1757
|
-
for (; o < l.length && l[o] === r[o]; )
|
|
1758
|
-
++o;
|
|
1701
|
+
for (; o < l.length && l[o] === r[o]; ) ++o;
|
|
1759
1702
|
n.mask = l.slice(0, o).replace(/0/g, "\\0") + "0".repeat(this.maxLength - o), super._update(n);
|
|
1760
1703
|
}
|
|
1761
1704
|
get isComplete() {
|
|
@@ -1772,22 +1715,19 @@ class O extends v {
|
|
|
1772
1715
|
return [t, s] = super.doPrepareChar(t.replace(/\D/g, ""), e), t || (s.skip = !this.isComplete), [t, s];
|
|
1773
1716
|
}
|
|
1774
1717
|
_appendCharRaw(t, e) {
|
|
1775
|
-
if (e === void 0 && (e = {}), !this.autofix || this.value.length + 1 > this.maxLength)
|
|
1776
|
-
return super._appendCharRaw(t, e);
|
|
1718
|
+
if (e === void 0 && (e = {}), !this.autofix || this.value.length + 1 > this.maxLength) return super._appendCharRaw(t, e);
|
|
1777
1719
|
const s = String(this.from).padStart(this.maxLength, "0"), i = String(this.to).padStart(this.maxLength, "0"), [a, n] = this.boundaries(this.value + t);
|
|
1778
1720
|
return Number(n) < this.from ? super._appendCharRaw(s[this.value.length], e) : Number(a) > 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);
|
|
1779
1721
|
}
|
|
1780
1722
|
doValidate(t) {
|
|
1781
1723
|
const e = this.value;
|
|
1782
|
-
if (e.search(/[^0]/) === -1 && e.length <= this._matchFrom)
|
|
1783
|
-
return !0;
|
|
1724
|
+
if (e.search(/[^0]/) === -1 && e.length <= this._matchFrom) return !0;
|
|
1784
1725
|
const [i, a] = this.boundaries(e);
|
|
1785
1726
|
return this.from <= Number(a) && Number(i) <= this.to && super.doValidate(t);
|
|
1786
1727
|
}
|
|
1787
1728
|
pad(t) {
|
|
1788
1729
|
const e = new c();
|
|
1789
|
-
if (this.value.length === this.maxLength)
|
|
1790
|
-
return e;
|
|
1730
|
+
if (this.value.length === this.maxLength) return e;
|
|
1791
1731
|
const s = this.value, i = this.maxLength - this.value.length;
|
|
1792
1732
|
if (i) {
|
|
1793
1733
|
this.reset();
|
|
@@ -1894,8 +1834,7 @@ x.DEFAULTS = {
|
|
|
1894
1834
|
mask: Date,
|
|
1895
1835
|
pattern: Ot,
|
|
1896
1836
|
format: (u, t) => {
|
|
1897
|
-
if (!u)
|
|
1898
|
-
return "";
|
|
1837
|
+
if (!u) return "";
|
|
1899
1838
|
const e = String(u.getDate()).padStart(2, "0"), s = String(u.getMonth() + 1).padStart(2, "0"), i = u.getFullYear();
|
|
1900
1839
|
return [e, s, i].join(".");
|
|
1901
1840
|
},
|
|
@@ -2088,8 +2027,7 @@ class j extends _ {
|
|
|
2088
2027
|
}
|
|
2089
2028
|
maskEquals(t) {
|
|
2090
2029
|
return Array.isArray(t) ? this.compiledMasks.every((e, s) => {
|
|
2091
|
-
if (!t[s])
|
|
2092
|
-
return;
|
|
2030
|
+
if (!t[s]) return;
|
|
2093
2031
|
const {
|
|
2094
2032
|
mask: i,
|
|
2095
2033
|
...a
|
|
@@ -2105,8 +2043,7 @@ class j extends _ {
|
|
|
2105
2043
|
j.DEFAULTS = {
|
|
2106
2044
|
..._.DEFAULTS,
|
|
2107
2045
|
dispatch: (u, t, e, s) => {
|
|
2108
|
-
if (!t.compiledMasks.length)
|
|
2109
|
-
return;
|
|
2046
|
+
if (!t.compiledMasks.length) return;
|
|
2110
2047
|
const i = t.rawInputValue, a = t.compiledMasks.map((n, r) => {
|
|
2111
2048
|
const l = t.currentMask === n, o = l ? n.displayValue.length : n.nearestInputPos(n.displayValue.length, h.FORCE_LEFT);
|
|
2112
2049
|
return n.rawInputValue !== i ? (n.reset(), n.append(i, {
|
|
@@ -2161,8 +2098,7 @@ class H extends v {
|
|
|
2161
2098
|
return t === void 0 && (t = 0), e === void 0 && (e = this.displayValue.length), new F("", t);
|
|
2162
2099
|
}
|
|
2163
2100
|
remove(t, e) {
|
|
2164
|
-
if (t === void 0 && (t = 0), e === void 0 && (e = this.displayValue.length), t === e)
|
|
2165
|
-
return new c();
|
|
2101
|
+
if (t === void 0 && (t = 0), e === void 0 && (e = this.displayValue.length), t === e) return new c();
|
|
2166
2102
|
const s = Math.min(super.nearestInputPos(0, h.FORCE_RIGHT), this.value.length);
|
|
2167
2103
|
let i;
|
|
2168
2104
|
for (i = t; i >= 0 && !(this.enum.filter((r) => this.matchValue(r, this.value.slice(s, i), s)).length > 1); --i)
|
|
@@ -2285,8 +2221,7 @@ class C extends _ {
|
|
|
2285
2221
|
_findSeparatorAround(t) {
|
|
2286
2222
|
if (this.thousandsSeparator) {
|
|
2287
2223
|
const e = t - this.thousandsSeparator.length + 1, s = this.value.indexOf(this.thousandsSeparator, e);
|
|
2288
|
-
if (s <= t)
|
|
2289
|
-
return s;
|
|
2224
|
+
if (s <= t) return s;
|
|
2290
2225
|
}
|
|
2291
2226
|
return -1;
|
|
2292
2227
|
}
|
|
@@ -2306,8 +2241,7 @@ class C extends _ {
|
|
|
2306
2241
|
});
|
|
2307
2242
|
}
|
|
2308
2243
|
nearestInputPos(t, e) {
|
|
2309
|
-
if (!this.thousandsSeparator)
|
|
2310
|
-
return t;
|
|
2244
|
+
if (!this.thousandsSeparator) return t;
|
|
2311
2245
|
switch (e) {
|
|
2312
2246
|
case h.NONE:
|
|
2313
2247
|
case h.LEFT:
|
|
@@ -2344,8 +2278,7 @@ class C extends _ {
|
|
|
2344
2278
|
return e[0] = e[0].replace(/^(\D*)(0*)(\d*)/, (s, i, a, n) => i + n), 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));
|
|
2345
2279
|
}
|
|
2346
2280
|
_padFractionalZeros(t) {
|
|
2347
|
-
if (!t)
|
|
2348
|
-
return t;
|
|
2281
|
+
if (!t) return t;
|
|
2349
2282
|
const e = t.split(this.radix);
|
|
2350
2283
|
return e.length < 2 && e.push(""), e[1] = e[1].padEnd(this.scale, "0"), e.join(this.radix);
|
|
2351
2284
|
}
|
|
@@ -2457,8 +2390,7 @@ class Ut extends v {
|
|
|
2457
2390
|
});
|
|
2458
2391
|
}
|
|
2459
2392
|
_allocateBlock(t) {
|
|
2460
|
-
if (t < this._blocks.length)
|
|
2461
|
-
return this._blocks[t];
|
|
2393
|
+
if (t < this._blocks.length) return this._blocks[t];
|
|
2462
2394
|
if (this.repeatTo === 1 / 0 || this._blocks.length < this.repeatTo)
|
|
2463
2395
|
return this._blocks.push(y(this._blockOpts)), this.mask += "m", this._blocks[this._blocks.length - 1];
|
|
2464
2396
|
}
|
|
@@ -2481,8 +2413,7 @@ class Ut extends v {
|
|
|
2481
2413
|
this._blocks.pop(), this.mask = this.mask.slice(1);
|
|
2482
2414
|
break;
|
|
2483
2415
|
}
|
|
2484
|
-
if (s.aggregate(f), f.consumed)
|
|
2485
|
-
break;
|
|
2416
|
+
if (s.aggregate(f), f.consumed) break;
|
|
2486
2417
|
}
|
|
2487
2418
|
return s;
|
|
2488
2419
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phila/phila-ui-core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.24",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
6
|
"files": [
|
|
@@ -25,11 +25,11 @@
|
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@types/node": "^20.10.3",
|
|
27
27
|
"@vitejs/plugin-vue": "^4.5.0",
|
|
28
|
-
"typescript": "^5.
|
|
28
|
+
"typescript": "^5.8.2",
|
|
29
29
|
"vite": "^5.0.0",
|
|
30
30
|
"vite-plugin-dts": "^3.6.4",
|
|
31
31
|
"vite-plugin-lib-inject-css": "^1.3.0",
|
|
32
|
-
"vue-tsc": "^
|
|
32
|
+
"vue-tsc": "^2.2.8"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"bulma": "^0.9.4",
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"registry": "https://registry.npmjs.com/",
|
|
42
42
|
"access": "public"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "09f2b67c1d3db773c813231e21b62b37e34aefbd"
|
|
45
45
|
}
|