datex-ui 1.2.3 → 1.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +41 -21
- package/dist/types/datex-types.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -64,10 +64,10 @@ function f(l, t) {
|
|
|
64
64
|
function w(l) {
|
|
65
65
|
return new Date(l.getFullYear(), l.getMonth(), 1);
|
|
66
66
|
}
|
|
67
|
-
function
|
|
67
|
+
function I(l) {
|
|
68
68
|
return new Date(l.getFullYear(), l.getMonth() + 1, 0);
|
|
69
69
|
}
|
|
70
|
-
function
|
|
70
|
+
function B(l, t = 1) {
|
|
71
71
|
const a = (l.getDay() - t + 7) % 7, i = new Date(l);
|
|
72
72
|
return i.setDate(l.getDate() - a), i;
|
|
73
73
|
}
|
|
@@ -433,7 +433,11 @@ class H {
|
|
|
433
433
|
line-height: 1em !important;
|
|
434
434
|
width: 278px !important;
|
|
435
435
|
z-index: 999999; /* Removed !important to allow JavaScript override */
|
|
436
|
-
margin-top:7px;
|
|
436
|
+
margin-top: 7px;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
.datex-picker.drop-up {
|
|
440
|
+
margin-top: 0 !important;
|
|
437
441
|
}
|
|
438
442
|
|
|
439
443
|
/* Base arrow styles - creates the dropdown arrow */
|
|
@@ -1531,6 +1535,10 @@ class E {
|
|
|
1531
1535
|
*/
|
|
1532
1536
|
updateZIndex() {
|
|
1533
1537
|
if (!this.container) return;
|
|
1538
|
+
if (this.options.zIndex !== "auto") {
|
|
1539
|
+
this.container.style.zIndex = this.options.zIndex.toString(), this.updateInternalElementsZIndex(this.options.zIndex);
|
|
1540
|
+
return;
|
|
1541
|
+
}
|
|
1534
1542
|
const t = this.getHighestZIndex(), e = parseInt(this.container.style.zIndex || "0");
|
|
1535
1543
|
if (t >= e) {
|
|
1536
1544
|
const a = t + 1;
|
|
@@ -1549,15 +1557,20 @@ class E {
|
|
|
1549
1557
|
}
|
|
1550
1558
|
positionForMobile() {
|
|
1551
1559
|
this.container.style.position = "fixed", this.container.style.bottom = "0", this.container.style.left = "0", this.container.style.right = "0", this.container.style.top = "auto", this.container.style.width = "100%", this.container.style.maxWidth = "100vw", this.container.style.minWidth = "100vw", this.container.style.borderRadius = "12px 12px 0 0", this.container.style.zIndex = "999999", this.container.style.margin = "0", this.container.style.padding = "0", this.container.style.boxSizing = "border-box", this.container.style.transform = "none", this.container.style.maxHeight = "85vh", this.container.style.isolation = "isolate", this.container.style.contain = "layout style", this.container.style.pointerEvents = "auto", this.container.style.touchAction = "manipulation", this.container.classList.add("drop-up", "mobile-view"), this.container.classList.remove("opensleft", "opensright", "openscenter"), this.showMobileHeader();
|
|
1552
|
-
|
|
1553
|
-
this.
|
|
1560
|
+
let t;
|
|
1561
|
+
if (this.options.zIndex !== "auto")
|
|
1562
|
+
t = this.options.zIndex;
|
|
1563
|
+
else {
|
|
1564
|
+
const e = this.getHighestZIndex(), a = 999999;
|
|
1565
|
+
t = e >= a ? e + 1 : a;
|
|
1566
|
+
}
|
|
1567
|
+
this.container.style.zIndex = t.toString(), this.updateInternalElementsZIndex(t);
|
|
1554
1568
|
}
|
|
1555
1569
|
getHighestZIndex() {
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
!isNaN(i) && i > e && (e = i);
|
|
1570
|
+
let t = this.element, e = 0;
|
|
1571
|
+
for (; t && t instanceof HTMLElement && t !== document.body; ) {
|
|
1572
|
+
const a = window.getComputedStyle(t), i = parseInt(a.zIndex);
|
|
1573
|
+
!isNaN(i) && i > e && (e = i), t = t.parentElement;
|
|
1561
1574
|
}
|
|
1562
1575
|
return e;
|
|
1563
1576
|
}
|
|
@@ -1580,13 +1593,13 @@ class E {
|
|
|
1580
1593
|
let a, i = this.options.drops;
|
|
1581
1594
|
switch (i) {
|
|
1582
1595
|
case "auto":
|
|
1583
|
-
a = t.bottom
|
|
1596
|
+
a = t.bottom, a + e >= window.innerHeight && (a = t.top - e - 7, i = "up");
|
|
1584
1597
|
break;
|
|
1585
1598
|
case "up":
|
|
1586
|
-
a = t.top - e -
|
|
1599
|
+
a = t.top - e - 7;
|
|
1587
1600
|
break;
|
|
1588
1601
|
default:
|
|
1589
|
-
a = t.bottom
|
|
1602
|
+
a = t.bottom;
|
|
1590
1603
|
break;
|
|
1591
1604
|
}
|
|
1592
1605
|
return { top: Math.max(9, a), drops: i };
|
|
@@ -1611,8 +1624,14 @@ class E {
|
|
|
1611
1624
|
}
|
|
1612
1625
|
applyFinalPosition(t, e) {
|
|
1613
1626
|
this.container.style.top = `${t}px`, this.container.style.left = `${e}px`, this.container.style.right = "auto";
|
|
1614
|
-
|
|
1615
|
-
this.
|
|
1627
|
+
let a;
|
|
1628
|
+
if (this.options.zIndex !== "auto")
|
|
1629
|
+
a = this.options.zIndex;
|
|
1630
|
+
else {
|
|
1631
|
+
const i = this.getHighestZIndex(), o = 99999;
|
|
1632
|
+
a = i >= o ? i + 1 : o;
|
|
1633
|
+
}
|
|
1634
|
+
this.container.style.zIndex = a.toString(), this.updateInternalElementsZIndex(a);
|
|
1616
1635
|
}
|
|
1617
1636
|
updateInternalElementsZIndex(t) {
|
|
1618
1637
|
this.container.querySelectorAll("select").forEach((i) => {
|
|
@@ -1639,7 +1658,7 @@ class L {
|
|
|
1639
1658
|
this.options = t, this.locale = e;
|
|
1640
1659
|
}
|
|
1641
1660
|
buildCalendarMatrix(t) {
|
|
1642
|
-
const e = w(t), a =
|
|
1661
|
+
const e = w(t), a = B(e, this.locale.firstDay), i = [];
|
|
1643
1662
|
let o = [];
|
|
1644
1663
|
const n = new Date(a);
|
|
1645
1664
|
for (let r = 0; r < 42; r++) {
|
|
@@ -1797,10 +1816,10 @@ class L {
|
|
|
1797
1816
|
return !this.options.minDate || y(w(t), this.options.minDate);
|
|
1798
1817
|
}
|
|
1799
1818
|
canNavigateNext(t) {
|
|
1800
|
-
return !this.options.maxDate || x(
|
|
1819
|
+
return !this.options.maxDate || x(I(t), this.options.maxDate);
|
|
1801
1820
|
}
|
|
1802
1821
|
}
|
|
1803
|
-
class
|
|
1822
|
+
class F {
|
|
1804
1823
|
constructor(t = {}) {
|
|
1805
1824
|
this.validation = t;
|
|
1806
1825
|
}
|
|
@@ -1893,7 +1912,7 @@ class A {
|
|
|
1893
1912
|
return ((e = this.validation.holidays) == null ? void 0 : e.some((a) => this.isSameDate(a, t))) || !1;
|
|
1894
1913
|
}
|
|
1895
1914
|
}
|
|
1896
|
-
class
|
|
1915
|
+
class A {
|
|
1897
1916
|
constructor(t, e = {}) {
|
|
1898
1917
|
this.currentFocusedDate = null, this.isActive = !1, this.container = t, this.options = {
|
|
1899
1918
|
enabled: !1,
|
|
@@ -2179,7 +2198,8 @@ class R {
|
|
|
2179
2198
|
cancelButtonClasses: t.cancelButtonClasses || "datex-btn-danger",
|
|
2180
2199
|
theme: t.theme || M,
|
|
2181
2200
|
validation: t.validation || {},
|
|
2182
|
-
events: t.events || {}
|
|
2201
|
+
events: t.events || {},
|
|
2202
|
+
zIndex: t.zIndex ?? "auto"
|
|
2183
2203
|
};
|
|
2184
2204
|
return a.timePicker && a.autoApply && (a.autoApply = !1), a;
|
|
2185
2205
|
}
|
|
@@ -2250,7 +2270,7 @@ class R {
|
|
|
2250
2270
|
this.element,
|
|
2251
2271
|
this.container,
|
|
2252
2272
|
this.options
|
|
2253
|
-
), this.validationService = new
|
|
2273
|
+
), this.validationService = new F(this.options.validation), this.keyboardService = new A(this.container, {
|
|
2254
2274
|
enabled: !1
|
|
2255
2275
|
// Deshabilitado por defecto para evitar conflictos
|
|
2256
2276
|
}), this.keyboardService.setHandlers({
|
|
@@ -71,6 +71,7 @@ export interface DatexOptions {
|
|
|
71
71
|
theme?: DatexTheme;
|
|
72
72
|
validation?: DatexValidation;
|
|
73
73
|
events?: DatexEvents;
|
|
74
|
+
zIndex?: number | "auto";
|
|
74
75
|
}
|
|
75
76
|
export type DatexCallback = (startDate: Date, endDate: Date, label?: string) => void;
|
|
76
77
|
export interface CalendarState {
|
package/package.json
CHANGED