@jirawatpyk/aura-react 5.1.1 → 5.2.0
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/README.md +10 -0
- package/dist/aura.bundle.js +144 -35
- package/dist/cjs/index.cjs +144 -35
- package/dist/esm/DataTable.js +72 -15
- package/dist/esm/DatePicker.js +4 -4
- package/dist/esm/FileUpload.js +2 -1
- package/dist/esm/Popover.js +15 -4
- package/dist/esm/TimePicker.js +2 -1
- package/dist/esm/dates.js +28 -10
- package/dist/esm/strings.js +21 -0
- package/dist/esm/text.js +1 -0
- package/dist/index.d.cts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/server/index.cjs +45 -6
- package/dist/server/index.d.cts +6 -0
- package/dist/server/index.d.ts +6 -0
- package/dist/server/index.js +45 -6
- package/dist/styles.css +7 -2
- package/dist/styles.layer.css +7 -2
- package/package.json +1 -1
- package/scripts/aura-theme.mjs +31 -6
package/dist/cjs/index.cjs
CHANGED
|
@@ -360,6 +360,12 @@ var STRINGS = {
|
|
|
360
360
|
page: function(p, total) {
|
|
361
361
|
return "Page " + p + " of " + total;
|
|
362
362
|
},
|
|
363
|
+
rangeOpen: function(a, b) {
|
|
364
|
+
return a + "\u2013" + b + " of many";
|
|
365
|
+
},
|
|
366
|
+
pageOpen: function(p) {
|
|
367
|
+
return "Page " + p;
|
|
368
|
+
},
|
|
363
369
|
prevPage: "Previous page",
|
|
364
370
|
nextPage: "Next page",
|
|
365
371
|
totals: "Totals",
|
|
@@ -373,6 +379,7 @@ var STRINGS = {
|
|
|
373
379
|
timeOutOfRange: function(a, b) {
|
|
374
380
|
return "Choose a time between " + a + " and " + b;
|
|
375
381
|
},
|
|
382
|
+
timeUnavailable: "That time isn't available. Choose another.",
|
|
376
383
|
dropFiles: "Drag files here or",
|
|
377
384
|
browse: "Choose files",
|
|
378
385
|
browseOne: "Choose a file",
|
|
@@ -474,6 +481,12 @@ var STRINGS = {
|
|
|
474
481
|
page: function(p, total) {
|
|
475
482
|
return "\u0E2B\u0E19\u0E49\u0E32 " + p + " / " + total;
|
|
476
483
|
},
|
|
484
|
+
rangeOpen: function(a, b) {
|
|
485
|
+
return a + "\u2013" + b + " \u0E08\u0E32\u0E01\u0E2B\u0E25\u0E32\u0E22\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23";
|
|
486
|
+
},
|
|
487
|
+
pageOpen: function(p) {
|
|
488
|
+
return "\u0E2B\u0E19\u0E49\u0E32 " + p;
|
|
489
|
+
},
|
|
477
490
|
prevPage: "\u0E2B\u0E19\u0E49\u0E32\u0E01\u0E48\u0E2D\u0E19\u0E2B\u0E19\u0E49\u0E32",
|
|
478
491
|
nextPage: "\u0E2B\u0E19\u0E49\u0E32\u0E16\u0E31\u0E14\u0E44\u0E1B",
|
|
479
492
|
totals: "\u0E23\u0E27\u0E21",
|
|
@@ -487,6 +500,7 @@ var STRINGS = {
|
|
|
487
500
|
timeOutOfRange: function(a, b) {
|
|
488
501
|
return "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E40\u0E27\u0E25\u0E32\u0E23\u0E30\u0E2B\u0E27\u0E48\u0E32\u0E07 " + a + "\u2013" + b + " \u0E19.";
|
|
489
502
|
},
|
|
503
|
+
timeUnavailable: "\u0E40\u0E27\u0E25\u0E32\u0E19\u0E35\u0E49\u0E44\u0E21\u0E48\u0E27\u0E48\u0E32\u0E07 \u0E40\u0E25\u0E37\u0E2D\u0E01\u0E40\u0E27\u0E25\u0E32\u0E2D\u0E37\u0E48\u0E19",
|
|
490
504
|
dropFiles: "\u0E25\u0E32\u0E01\u0E44\u0E1F\u0E25\u0E4C\u0E21\u0E32\u0E27\u0E32\u0E07 \u0E2B\u0E23\u0E37\u0E2D",
|
|
491
505
|
browse: "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E44\u0E1F\u0E25\u0E4C",
|
|
492
506
|
browseOne: "\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E44\u0E1F\u0E25\u0E4C",
|
|
@@ -588,6 +602,12 @@ var STRINGS = {
|
|
|
588
602
|
page: function(p, total) {
|
|
589
603
|
return "Sida " + p + " av " + total;
|
|
590
604
|
},
|
|
605
|
+
rangeOpen: function(a, b) {
|
|
606
|
+
return a + "\u2013" + b + " av m\xE5nga";
|
|
607
|
+
},
|
|
608
|
+
pageOpen: function(p) {
|
|
609
|
+
return "Sida " + p;
|
|
610
|
+
},
|
|
591
611
|
prevPage: "F\xF6reg\xE5ende sida",
|
|
592
612
|
nextPage: "N\xE4sta sida",
|
|
593
613
|
totals: "Summa",
|
|
@@ -601,6 +621,7 @@ var STRINGS = {
|
|
|
601
621
|
timeOutOfRange: function(a, b) {
|
|
602
622
|
return "V\xE4lj en tid mellan " + a + " och " + b;
|
|
603
623
|
},
|
|
624
|
+
timeUnavailable: "Den tiden \xE4r inte ledig. V\xE4lj en annan.",
|
|
604
625
|
dropFiles: "Dra filer hit eller",
|
|
605
626
|
browse: "V\xE4lj filer",
|
|
606
627
|
browseOne: "V\xE4lj en fil",
|
|
@@ -1672,20 +1693,29 @@ var pad = function(n2) {
|
|
|
1672
1693
|
return (n2 < 10 ? "0" : "") + n2;
|
|
1673
1694
|
};
|
|
1674
1695
|
function toISO(d) {
|
|
1675
|
-
|
|
1696
|
+
if (!d) return null;
|
|
1697
|
+
const y = String(d.getFullYear());
|
|
1698
|
+
return ("000" + y).slice(-Math.max(4, y.length)) + "-" + pad(d.getMonth() + 1) + "-" + pad(d.getDate());
|
|
1699
|
+
}
|
|
1700
|
+
function makeDate(y, monthIndex2, day) {
|
|
1701
|
+
const d = new Date(2e3, 0, 1);
|
|
1702
|
+
d.setFullYear(y, monthIndex2, day);
|
|
1703
|
+
return d;
|
|
1676
1704
|
}
|
|
1677
1705
|
function fromISO(s) {
|
|
1678
1706
|
if (!s) return null;
|
|
1679
1707
|
const m = /^(\d{4})-(\d{2})-(\d{2})$/.exec(s);
|
|
1680
|
-
|
|
1708
|
+
if (!m) return null;
|
|
1709
|
+
const d = makeDate(+m[1], +m[2] - 1, +m[3]);
|
|
1710
|
+
return d.getMonth() === +m[2] - 1 && d.getDate() === +m[3] ? d : null;
|
|
1681
1711
|
}
|
|
1682
1712
|
function addDays(d, n2) {
|
|
1683
|
-
return
|
|
1713
|
+
return makeDate(d.getFullYear(), d.getMonth(), d.getDate() + n2);
|
|
1684
1714
|
}
|
|
1685
1715
|
function addMonths(d, n2) {
|
|
1686
|
-
const t =
|
|
1687
|
-
const last =
|
|
1688
|
-
return
|
|
1716
|
+
const t = makeDate(d.getFullYear(), d.getMonth() + n2, 1);
|
|
1717
|
+
const last = makeDate(t.getFullYear(), t.getMonth() + 1, 0).getDate();
|
|
1718
|
+
return makeDate(t.getFullYear(), t.getMonth(), Math.min(d.getDate(), last));
|
|
1689
1719
|
}
|
|
1690
1720
|
function same(a, b) {
|
|
1691
1721
|
return !!a && !!b && a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();
|
|
@@ -1793,7 +1823,15 @@ function monthIndex(word) {
|
|
|
1793
1823
|
return MONTHS[k] != null ? MONTHS[k] : -1;
|
|
1794
1824
|
}
|
|
1795
1825
|
function parseDate(text) {
|
|
1796
|
-
const
|
|
1826
|
+
const raw = String(text || "").trim();
|
|
1827
|
+
const gregorian = /ค\.ศ\.|\d\s*(AD|CE)\b|^\s*(AD|CE)\s/i.test(raw);
|
|
1828
|
+
let s = raw.replace(/พ\.ศ\.|ค\.ศ\./g, " ").replace(/(\d)\s*(BE|AD|CE)\b/gi, "$1 ").replace(/^\s*(BE|AD|CE)\s+/i, " ").replace(/\s+/g, " ").trim();
|
|
1829
|
+
const eight = /^(\d{2})(\d{2})(\d{4})$/.exec(s);
|
|
1830
|
+
if (eight) {
|
|
1831
|
+
const a = +eight[3] >= 1e3 ? parseDate(eight[1] + "/" + eight[2] + "/" + eight[3] + (gregorian ? " \u0E04.\u0E28." : "")) : null;
|
|
1832
|
+
if (a) return a;
|
|
1833
|
+
s = s.slice(0, 4) + "-" + s.slice(4, 6) + "-" + s.slice(6);
|
|
1834
|
+
}
|
|
1797
1835
|
let m = /^(\d{4})-(\d{1,2})-(\d{1,2})$/.exec(s), y, mo, d;
|
|
1798
1836
|
if (m) {
|
|
1799
1837
|
y = +m[1];
|
|
@@ -1803,13 +1841,13 @@ function parseDate(text) {
|
|
|
1803
1841
|
d = +m[1];
|
|
1804
1842
|
mo = +m[2];
|
|
1805
1843
|
y = +m[3];
|
|
1806
|
-
} else if ((m = /^(\d{1,2})\s+(\S+)\s+(\d{4})$/.exec(s
|
|
1844
|
+
} else if ((m = /^(\d{1,2})\s+(\S+)\s+(\d{4})$/.exec(s)) && monthIndex(m[2]) >= 0) {
|
|
1807
1845
|
d = +m[1];
|
|
1808
1846
|
mo = monthIndex(m[2]) + 1;
|
|
1809
1847
|
y = +m[3];
|
|
1810
1848
|
} else return null;
|
|
1811
|
-
if (y >= 2400) y -= 543;
|
|
1812
|
-
const dt =
|
|
1849
|
+
if (y >= 2400 && !gregorian) y -= 543;
|
|
1850
|
+
const dt = makeDate(y, mo - 1, d);
|
|
1813
1851
|
return dt.getMonth() === mo - 1 && dt.getDate() === d ? toISO(dt) : null;
|
|
1814
1852
|
}
|
|
1815
1853
|
function todayIn(timeZone) {
|
|
@@ -2100,16 +2138,16 @@ function useCalendarPopover(boxRef) {
|
|
|
2100
2138
|
const pos = React17.useState(null), popRef = React17.useRef(null), mounted = useMounted();
|
|
2101
2139
|
function place() {
|
|
2102
2140
|
if (!boxRef.current) return;
|
|
2103
|
-
const r = boxRef.current.getBoundingClientRect(), H = 380;
|
|
2104
|
-
const up = window.innerHeight - r.bottom < H && r.top > H;
|
|
2105
|
-
const left = Math.max(8, Math.min(r.left, window.innerWidth -
|
|
2141
|
+
const el = popRef.current, r = boxRef.current.getBoundingClientRect(), W = el ? el.offsetWidth : 320, H = el ? el.offsetHeight : 380;
|
|
2142
|
+
const up = window.innerHeight - r.bottom < H + 12 && r.top > H + 12;
|
|
2143
|
+
const left = Math.max(8, Math.min(r.left, window.innerWidth - W - 8));
|
|
2106
2144
|
pos[1](up ? { left, bottom: window.innerHeight - r.top + 4 } : { left, top: r.bottom + 4 });
|
|
2107
2145
|
}
|
|
2108
2146
|
useIsoLayoutEffect(
|
|
2109
2147
|
function() {
|
|
2110
2148
|
if (open) place();
|
|
2111
2149
|
},
|
|
2112
|
-
[open]
|
|
2150
|
+
[open, !!pos[0]]
|
|
2113
2151
|
);
|
|
2114
2152
|
React17.useEffect(
|
|
2115
2153
|
function() {
|
|
@@ -3678,11 +3716,12 @@ var DataTable = React28.forwardRef(function DataTable2(props, ref) {
|
|
|
3678
3716
|
if (lv && boxWidth[0] == null) hideTerms += " + " + w + "px * var(--aura-h" + lv + "-on, 1)";
|
|
3679
3717
|
else fixedSum += w;
|
|
3680
3718
|
});
|
|
3681
|
-
let pinOffsets = {}, acc =
|
|
3719
|
+
let pinOffsets = {}, acc = "0px";
|
|
3682
3720
|
vis.forEach(function(c) {
|
|
3683
3721
|
if (isPinned(c)) {
|
|
3684
3722
|
pinOffsets[c.key] = acc;
|
|
3685
|
-
|
|
3723
|
+
const lv = hideLevel(c);
|
|
3724
|
+
acc += " + " + widthOf(c) + "px" + (lv && boxWidth[0] == null ? " * var(--aura-h" + lv + "-on, 1)" : "");
|
|
3686
3725
|
}
|
|
3687
3726
|
});
|
|
3688
3727
|
const selW = selectable ? " + var(--aura-table-select-width)" : "";
|
|
@@ -3697,7 +3736,7 @@ var DataTable = React28.forwardRef(function DataTable2(props, ref) {
|
|
|
3697
3736
|
s["--aura-cell-flex"] = !hasFlex && i === vis.length - 1 ? "1 0 auto" : "none";
|
|
3698
3737
|
s["--aura-cell-w"] = w + "px";
|
|
3699
3738
|
}
|
|
3700
|
-
if (isPinned(c)) s["--aura-cell-left"] = "calc(var(--aura-space-6)" + selW + " + " + pinOffsets[c.key] + "
|
|
3739
|
+
if (isPinned(c)) s["--aura-cell-left"] = "calc(var(--aura-space-6)" + selW + " + " + pinOffsets[c.key] + ")";
|
|
3701
3740
|
return s;
|
|
3702
3741
|
}
|
|
3703
3742
|
const sortCol = sort && sort.key ? byKey[sort.key] : void 0;
|
|
@@ -3743,6 +3782,20 @@ var DataTable = React28.forwardRef(function DataTable2(props, ref) {
|
|
|
3743
3782
|
const pageRows = pageSize && !manual ? view.slice(first, first + pageSize) : view;
|
|
3744
3783
|
const canSortAny = !busy && (manual ? total > 1 : rows.length > 1);
|
|
3745
3784
|
const shownTotal = manual && props.totalRows == null ? first + rows.length : total;
|
|
3785
|
+
const prevCount = React28.useRef(pageCount);
|
|
3786
|
+
React28.useEffect(
|
|
3787
|
+
function() {
|
|
3788
|
+
if (busy) return;
|
|
3789
|
+
const before = prevCount.current;
|
|
3790
|
+
prevCount.current = pageCount;
|
|
3791
|
+
const asked = pageState[0] || 1;
|
|
3792
|
+
if (asked === page || pageCount >= before || asked > before) return;
|
|
3793
|
+
if (props.getPageHref && !props.onPageChange && !props.onStateChange) return;
|
|
3794
|
+
pageState[1](page);
|
|
3795
|
+
emit(sort, page);
|
|
3796
|
+
},
|
|
3797
|
+
[pageState[0], page, busy, pageCount]
|
|
3798
|
+
);
|
|
3746
3799
|
const linkPaging = !!props.getPageHref && !props.onPageChange && !oneCallback;
|
|
3747
3800
|
const prevLink = React28.useRef(null), nextLink = React28.useRef(null), jumpLink = React28.useRef(null);
|
|
3748
3801
|
const jumpState = React28.useState(null);
|
|
@@ -3811,9 +3864,10 @@ var DataTable = React28.forwardRef(function DataTable2(props, ref) {
|
|
|
3811
3864
|
const visibleRows = Math.max(1, Math.floor(bodyH / ROW_H));
|
|
3812
3865
|
const nCols = vis.length + (selectable ? 1 : 0);
|
|
3813
3866
|
const nRows = loading ? 0 : pageRows.length;
|
|
3867
|
+
const hasTotal = !!(props.footer && rows.length && !loading), T = nRows + 1, lastR = nRows + (hasTotal ? 1 : 0);
|
|
3814
3868
|
const active = activeState[0];
|
|
3815
|
-
const ar = Math.min(active.r,
|
|
3816
|
-
const activeRendered = ar === 0 || ar - 1 >= start && ar - 1 < end;
|
|
3869
|
+
const ar = Math.min(active.r, lastR), ac = Math.min(active.c, nCols - 1);
|
|
3870
|
+
const activeRendered = ar === 0 || hasTotal && ar === T || ar - 1 >= start && ar - 1 < end;
|
|
3817
3871
|
function colAt(ci) {
|
|
3818
3872
|
return selectable ? ci === 0 ? null : vis[ci - 1] : vis[ci];
|
|
3819
3873
|
}
|
|
@@ -3844,12 +3898,33 @@ var DataTable = React28.forwardRef(function DataTable2(props, ref) {
|
|
|
3844
3898
|
}
|
|
3845
3899
|
});
|
|
3846
3900
|
function focusCell(r, c) {
|
|
3847
|
-
r = Math.max(0, Math.min(r,
|
|
3901
|
+
r = Math.max(0, Math.min(r, lastR));
|
|
3848
3902
|
c = Math.max(0, Math.min(c, nCols - 1));
|
|
3849
3903
|
if (stacked && r === 0 && nRows > 0 && !(selectable && c === 0)) r = 1;
|
|
3904
|
+
if (gridRef.current && r === T && hasTotal) {
|
|
3905
|
+
const shown2 = function(cc) {
|
|
3906
|
+
const e = gridRef.current.querySelector('[data-rc="' + r + ":" + cc + '"]');
|
|
3907
|
+
return !!e && e.getClientRects().length > 0;
|
|
3908
|
+
};
|
|
3909
|
+
if (!shown2(c))
|
|
3910
|
+
for (let d = 1; d < nCols; d++) {
|
|
3911
|
+
if (c + d < nCols && shown2(c + d)) {
|
|
3912
|
+
c = c + d;
|
|
3913
|
+
break;
|
|
3914
|
+
}
|
|
3915
|
+
if (c - d >= 0 && shown2(c - d)) {
|
|
3916
|
+
c = c - d;
|
|
3917
|
+
break;
|
|
3918
|
+
}
|
|
3919
|
+
}
|
|
3920
|
+
}
|
|
3850
3921
|
activeState[1]({ r, c });
|
|
3851
3922
|
pending.current = { r, c };
|
|
3852
|
-
if (virtual && r
|
|
3923
|
+
if (virtual && hasTotal && r === T && !props.stickyFooter) {
|
|
3924
|
+
const sc = scrollRef.current;
|
|
3925
|
+
sc.scrollTop = sc.scrollHeight;
|
|
3926
|
+
setScrollTop(sc.scrollTop);
|
|
3927
|
+
} else if (virtual && r > 0 && r <= nRows) {
|
|
3853
3928
|
const sc = scrollRef.current, top = (r - 1) * ROW_H;
|
|
3854
3929
|
if (top < sc.scrollTop) sc.scrollTop = top;
|
|
3855
3930
|
else if (top + ROW_H > sc.scrollTop + bodyH) sc.scrollTop = top + ROW_H - bodyH;
|
|
@@ -4092,7 +4167,7 @@ var DataTable = React28.forwardRef(function DataTable2(props, ref) {
|
|
|
4092
4167
|
return;
|
|
4093
4168
|
}
|
|
4094
4169
|
const p = rc.split(":"), r = +p[0], c = +p[1], k = e.key, col = colAt(c);
|
|
4095
|
-
const row = r > 0 ? pageRows[r - 1] : null;
|
|
4170
|
+
const row = r > 0 && r <= nRows ? pageRows[r - 1] : null, isTotal = hasTotal && r === T;
|
|
4096
4171
|
let handled = true;
|
|
4097
4172
|
if (r === 0 && col && e.altKey && (k === "ArrowLeft" || k === "ArrowRight") && canResize(col))
|
|
4098
4173
|
setW(col, widthOf(col) + (k === "ArrowLeft" ? -1 : 1) * (e.shiftKey ? 48 : 16), true);
|
|
@@ -4103,21 +4178,23 @@ var DataTable = React28.forwardRef(function DataTable2(props, ref) {
|
|
|
4103
4178
|
else if (k === "ArrowRight") focusCell(r, c + 1);
|
|
4104
4179
|
else if (k === "ArrowLeft") focusCell(r, c - 1);
|
|
4105
4180
|
else if (k === "ArrowDown") {
|
|
4106
|
-
if (r <
|
|
4181
|
+
if (r < lastR) focusCell(r + 1, c);
|
|
4107
4182
|
else if (pageSize && page < pageCount && goPage(page + 1, { r: 1, c })) activeState[1]({ r: 1, c });
|
|
4108
4183
|
} else if (k === "ArrowUp") {
|
|
4109
4184
|
if (r > 1 || r === 1 && !(pageSize && page > 1)) focusCell(r - 1, c);
|
|
4110
4185
|
else if (r === 1 && goPage(page - 1, { r: pageSize, c })) activeState[1]({ r: pageSize, c });
|
|
4111
4186
|
} else if (k === "Home") focusCell(e.ctrlKey ? 1 : r, 0);
|
|
4112
|
-
else if (k === "End") focusCell(e.ctrlKey ?
|
|
4187
|
+
else if (k === "End") focusCell(e.ctrlKey ? lastR : r, nCols - 1);
|
|
4113
4188
|
else if (k === "PageDown") {
|
|
4114
4189
|
if (pageSize) {
|
|
4115
4190
|
if (goPage(page + 1, { r: 1, c })) activeState[1]({ r: 1, c });
|
|
4116
|
-
} else focusCell(Math.min(
|
|
4191
|
+
} else focusCell(Math.min(lastR, r + visibleRows), c);
|
|
4117
4192
|
} else if (k === "PageUp") {
|
|
4118
4193
|
if (pageSize) {
|
|
4119
4194
|
if (goPage(page - 1, { r: 1, c })) activeState[1]({ r: 1, c });
|
|
4120
4195
|
} else focusCell(Math.max(1, r - visibleRows), c);
|
|
4196
|
+
} else if (isTotal && (k === " " || k === "Enter" || k === "F2")) {
|
|
4197
|
+
handled = false;
|
|
4121
4198
|
} else if (k === "F2" && r > 0) {
|
|
4122
4199
|
const inner = target.querySelector("button, a[href], input, select, textarea");
|
|
4123
4200
|
if (inner) inner.focus();
|
|
@@ -4488,9 +4565,10 @@ var DataTable = React28.forwardRef(function DataTable2(props, ref) {
|
|
|
4488
4565
|
}
|
|
4489
4566
|
);
|
|
4490
4567
|
}
|
|
4568
|
+
const openTotal = manual && props.totalRows == null && !!pageSize && rows.length >= pageSize;
|
|
4491
4569
|
if (pageSize && (rows.length || busy || page > 1)) {
|
|
4492
4570
|
const from = rows.length ? first + 1 : 0, to = manual ? first + rows.length : Math.min(first + pageSize, view.length);
|
|
4493
|
-
foot = /* @__PURE__ */ React28.createElement("div", { className: "aura-table__foot" }, /* @__PURE__ */ React28.createElement("span", { "aria-live": "polite" }, busy ? t.loading : t.range(from, to, shownTotal)), /* @__PURE__ */ React28.createElement("span", { className: "aura-table__pager" }, /* @__PURE__ */ React28.createElement("span", null, t.page(page, pageCount)), pagerButton(-1), pagerButton(1)));
|
|
4571
|
+
foot = /* @__PURE__ */ React28.createElement("div", { className: "aura-table__foot" }, /* @__PURE__ */ React28.createElement("span", { "aria-live": "polite" }, busy ? t.loading : openTotal ? t.rangeOpen(from, to) : t.range(from, to, shownTotal)), /* @__PURE__ */ React28.createElement("span", { className: "aura-table__pager" }, /* @__PURE__ */ React28.createElement("span", null, openTotal ? t.pageOpen(page) : t.page(page, pageCount)), pagerButton(-1), pagerButton(1)));
|
|
4494
4572
|
} else if (height && rows.length && !loading) {
|
|
4495
4573
|
foot = /* @__PURE__ */ React28.createElement("div", { className: "aura-table__foot" }, /* @__PURE__ */ React28.createElement("span", null, t.rowCount(shownTotal)), selectable && selected.length ? /* @__PURE__ */ React28.createElement("span", null, t.selectedCount(selected.length)) : /* @__PURE__ */ React28.createElement("span", null));
|
|
4496
4574
|
}
|
|
@@ -4504,15 +4582,32 @@ var DataTable = React28.forwardRef(function DataTable2(props, ref) {
|
|
|
4504
4582
|
style: rowStyle
|
|
4505
4583
|
},
|
|
4506
4584
|
/* @__PURE__ */ React28.createElement("span", { className: "aura-table__gutter", "aria-hidden": true }),
|
|
4507
|
-
selectable ? /* @__PURE__ */ React28.createElement(
|
|
4585
|
+
selectable ? /* @__PURE__ */ React28.createElement(
|
|
4586
|
+
"span",
|
|
4587
|
+
{
|
|
4588
|
+
role: "gridcell",
|
|
4589
|
+
"aria-colindex": 1,
|
|
4590
|
+
className: cx("aura-table__sel", nPinned && "is-pinned"),
|
|
4591
|
+
tabIndex: tabFor(T, 0),
|
|
4592
|
+
"data-rc": T + ":0",
|
|
4593
|
+
onFocus: function() {
|
|
4594
|
+
activeState[1]({ r: T, c: 0 });
|
|
4595
|
+
}
|
|
4596
|
+
}
|
|
4597
|
+
) : null,
|
|
4508
4598
|
vis.map(function(c, j) {
|
|
4509
|
-
const pin = isPinned(c);
|
|
4599
|
+
const pin = isPinned(c), ci = j + (selectable ? 1 : 0);
|
|
4510
4600
|
return /* @__PURE__ */ React28.createElement(
|
|
4511
4601
|
"span",
|
|
4512
4602
|
{
|
|
4513
4603
|
key: c.key,
|
|
4514
4604
|
role: "gridcell",
|
|
4515
4605
|
"aria-colindex": j + (selectable ? 2 : 1),
|
|
4606
|
+
tabIndex: tabFor(T, ci),
|
|
4607
|
+
"data-rc": T + ":" + ci,
|
|
4608
|
+
onFocus: function() {
|
|
4609
|
+
if (activeState[0].r !== T || activeState[0].c !== ci) activeState[1]({ r: T, c: ci });
|
|
4610
|
+
},
|
|
4516
4611
|
className: cx(
|
|
4517
4612
|
"aura-table__td",
|
|
4518
4613
|
c.mono && "aura-table__mono",
|
|
@@ -4538,7 +4633,7 @@ var DataTable = React28.forwardRef(function DataTable2(props, ref) {
|
|
|
4538
4633
|
)
|
|
4539
4634
|
) : null;
|
|
4540
4635
|
const scrollStyle = {
|
|
4541
|
-
scrollPaddingLeft: "calc(var(--aura-space-6)" + selW + " + " + acc + "
|
|
4636
|
+
scrollPaddingLeft: "calc(var(--aura-space-6)" + selW + " + " + acc + ")",
|
|
4542
4637
|
scrollPaddingTop: ROW_H + "px",
|
|
4543
4638
|
scrollPaddingBottom: stickyTotal ? ROW_H + "px" : void 0
|
|
4544
4639
|
};
|
|
@@ -5450,6 +5545,7 @@ function parseTime(text) {
|
|
|
5450
5545
|
const m = /^(\d{1,2})(?:[:.](\d{2}))?$/.exec(s) || /^(\d{1,2})(\d{2})$/.exec(s);
|
|
5451
5546
|
if (!m) return null;
|
|
5452
5547
|
let hh = +m[1], mm = m[2] ? +m[2] : 0;
|
|
5548
|
+
if ((am || pm) && (hh < 1 || hh > 12)) return null;
|
|
5453
5549
|
if (pm && hh < 12) hh += 12;
|
|
5454
5550
|
if (am && hh === 12) hh = 0;
|
|
5455
5551
|
if (hh > 23 || mm > 59) return null;
|
|
@@ -5564,7 +5660,8 @@ var TimePicker = React45.forwardRef(function TimePicker2(props, ref) {
|
|
|
5564
5660
|
return true;
|
|
5565
5661
|
}
|
|
5566
5662
|
if (blocked(v)) {
|
|
5567
|
-
|
|
5663
|
+
const n2 = toMin(v);
|
|
5664
|
+
errState[1](n2 != null && n2 >= lo && n2 <= hi ? t.timeUnavailable : t.timeOutOfRange(fromMin(lo), fromMin(hi)));
|
|
5568
5665
|
return false;
|
|
5569
5666
|
}
|
|
5570
5667
|
errState[1](null);
|
|
@@ -5823,6 +5920,7 @@ var FileUpload = React46.forwardRef(function FileUpload2(props, ref) {
|
|
|
5823
5920
|
[items2, props.name]
|
|
5824
5921
|
);
|
|
5825
5922
|
function thumb(it) {
|
|
5923
|
+
if (!it.file && it.url && /^image\//.test(it.type || "")) return it.url;
|
|
5826
5924
|
if (!it.file || !/^image\//.test(it.type || "") || typeof URL === "undefined" || !URL.createObjectURL) return null;
|
|
5827
5925
|
if (!urls.current[it.id]) urls.current[it.id] = URL.createObjectURL(it.file);
|
|
5828
5926
|
return urls.current[it.id];
|
|
@@ -5928,7 +6026,7 @@ var FileUpload = React46.forwardRef(function FileUpload2(props, ref) {
|
|
|
5928
6026
|
),
|
|
5929
6027
|
items2.length ? /* @__PURE__ */ React46.createElement("ul", { className: "aura-upload__list", "aria-live": "polite" }, items2.map(function(it) {
|
|
5930
6028
|
const src = thumb(it);
|
|
5931
|
-
return /* @__PURE__ */ React46.createElement("li", { key: it.id, className: cx("aura-upload__item", it.error && "is-error") }, src ? /* @__PURE__ */ React46.createElement("img", { className: "aura-upload__thumb", src, alt: "" }) : /* @__PURE__ */ React46.createElement("span", { className: "aura-upload__thumb is-icon", "aria-hidden": true }, /* @__PURE__ */ React46.createElement(Icon, { name: /^image\//.test(it.type || "") ? "image" : "file", size: "md" })), /* @__PURE__ */ React46.createElement("span", { className: "aura-upload__meta" }, /* @__PURE__ */ React46.createElement("span", { className: "aura-upload__name" }, it.name), /* @__PURE__ */ React46.createElement("span", { className: "aura-upload__sub" }, it.error ? /* @__PURE__ */ React46.createElement(React46.Fragment, null, /* @__PURE__ */ React46.createElement(Icon, { name: "circle-alert", size: 12 }), it.error) : it.status === "uploading" ? t.uploading + (it.progress != null ? " " + Math.round(it.progress) + "%" : "") : it.status === "done" ? /* @__PURE__ */ React46.createElement(React46.Fragment, null, /* @__PURE__ */ React46.createElement(Icon, { name: "circle-check", size: 12 }), formatBytes(it.size)) : formatBytes(it.size)), it.status === "uploading" ? /* @__PURE__ */ React46.createElement(
|
|
6029
|
+
return /* @__PURE__ */ React46.createElement("li", { key: it.id, className: cx("aura-upload__item", it.error && "is-error") }, src ? /* @__PURE__ */ React46.createElement("img", { className: "aura-upload__thumb", src, alt: "" }) : /* @__PURE__ */ React46.createElement("span", { className: "aura-upload__thumb is-icon", "aria-hidden": true }, /* @__PURE__ */ React46.createElement(Icon, { name: /^image\//.test(it.type || "") ? "image" : "file", size: "md" })), /* @__PURE__ */ React46.createElement("span", { className: "aura-upload__meta" }, it.url && !it.error ? /* @__PURE__ */ React46.createElement("a", { className: "aura-upload__name", href: it.url, target: "_blank", rel: "noreferrer" }, it.name) : /* @__PURE__ */ React46.createElement("span", { className: "aura-upload__name" }, it.name), /* @__PURE__ */ React46.createElement("span", { className: "aura-upload__sub" }, it.error ? /* @__PURE__ */ React46.createElement(React46.Fragment, null, /* @__PURE__ */ React46.createElement(Icon, { name: "circle-alert", size: 12 }), it.error) : it.status === "uploading" ? t.uploading + (it.progress != null ? " " + Math.round(it.progress) + "%" : "") : it.status === "done" ? /* @__PURE__ */ React46.createElement(React46.Fragment, null, /* @__PURE__ */ React46.createElement(Icon, { name: "circle-check", size: 12 }), formatBytes(it.size)) : formatBytes(it.size)), it.status === "uploading" ? /* @__PURE__ */ React46.createElement(
|
|
5932
6030
|
"span",
|
|
5933
6031
|
{
|
|
5934
6032
|
className: "aura-upload__bar",
|
|
@@ -6633,13 +6731,20 @@ var Accordion = React54.forwardRef(function Accordion2(props, ref) {
|
|
|
6633
6731
|
var React55 = __toESM(require("react"), 1);
|
|
6634
6732
|
var import_react_dom11 = require("react-dom");
|
|
6635
6733
|
function position(anchor, pop, placement) {
|
|
6636
|
-
const r = anchor.getBoundingClientRect(), pw = pop.offsetWidth, ph = pop.
|
|
6734
|
+
const r = anchor.getBoundingClientRect(), pw = pop.offsetWidth, ph = pop.scrollHeight, vw = window.innerWidth, vh = window.innerHeight, gap = 6;
|
|
6637
6735
|
let side = (placement || "bottom-start").split("-")[0], align = (placement || "bottom-start").split("-")[1] || "start";
|
|
6638
6736
|
if (side === "bottom" && r.bottom + gap + ph > vh - 8 && r.top - gap - ph > 8) side = "top";
|
|
6639
6737
|
else if (side === "top" && r.top - gap - ph < 8 && r.bottom + gap + ph < vh - 8) side = "bottom";
|
|
6640
|
-
const
|
|
6738
|
+
const below2 = vh - r.bottom - gap - 8, above = r.top - gap - 8;
|
|
6739
|
+
let maxHeight;
|
|
6740
|
+
if (ph > below2 && ph > above) {
|
|
6741
|
+
side = above > below2 ? "top" : "bottom";
|
|
6742
|
+
maxHeight = Math.max(120, side === "top" ? above : below2);
|
|
6743
|
+
}
|
|
6744
|
+
const h9 = maxHeight ? Math.min(ph, maxHeight) : ph;
|
|
6745
|
+
const top = side === "top" ? r.top - gap - h9 : r.bottom + gap;
|
|
6641
6746
|
const left = align === "end" ? r.right - pw : align === "center" ? r.left + r.width / 2 - pw / 2 : r.left;
|
|
6642
|
-
return { top: Math.max(8, top), left: Math.max(8, Math.min(left, vw - pw - 8)), side };
|
|
6747
|
+
return { top: Math.max(8, top), left: Math.max(8, Math.min(left, vw - pw - 8)), side, maxHeight };
|
|
6643
6748
|
}
|
|
6644
6749
|
var Popover = React55.forwardRef(function Popover2(props, ref) {
|
|
6645
6750
|
const t = useStrings();
|
|
@@ -6719,7 +6824,11 @@ var Popover = React55.forwardRef(function Popover2(props, ref) {
|
|
|
6719
6824
|
},
|
|
6720
6825
|
className: cx("aura-popover", pos[0] && "is-" + pos[0].side, props.className),
|
|
6721
6826
|
style: Object.assign(
|
|
6722
|
-
{
|
|
6827
|
+
{
|
|
6828
|
+
top: pos[0] ? pos[0].top : -9999,
|
|
6829
|
+
left: pos[0] ? pos[0].left : -9999,
|
|
6830
|
+
maxHeight: pos[0] && pos[0].maxHeight ? pos[0].maxHeight : void 0
|
|
6831
|
+
},
|
|
6723
6832
|
props.width ? { width: props.width } : null
|
|
6724
6833
|
),
|
|
6725
6834
|
onKeyDown: function(e) {
|
package/dist/esm/DataTable.js
CHANGED
|
@@ -243,11 +243,12 @@ const DataTable = React.forwardRef(function DataTable2(props, ref) {
|
|
|
243
243
|
if (lv && boxWidth[0] == null) hideTerms += " + " + w + "px * var(--aura-h" + lv + "-on, 1)";
|
|
244
244
|
else fixedSum += w;
|
|
245
245
|
});
|
|
246
|
-
let pinOffsets = {}, acc =
|
|
246
|
+
let pinOffsets = {}, acc = "0px";
|
|
247
247
|
vis.forEach(function(c) {
|
|
248
248
|
if (isPinned(c)) {
|
|
249
249
|
pinOffsets[c.key] = acc;
|
|
250
|
-
|
|
250
|
+
const lv = hideLevel(c);
|
|
251
|
+
acc += " + " + widthOf(c) + "px" + (lv && boxWidth[0] == null ? " * var(--aura-h" + lv + "-on, 1)" : "");
|
|
251
252
|
}
|
|
252
253
|
});
|
|
253
254
|
const selW = selectable ? " + var(--aura-table-select-width)" : "";
|
|
@@ -262,7 +263,7 @@ const DataTable = React.forwardRef(function DataTable2(props, ref) {
|
|
|
262
263
|
s["--aura-cell-flex"] = !hasFlex && i === vis.length - 1 ? "1 0 auto" : "none";
|
|
263
264
|
s["--aura-cell-w"] = w + "px";
|
|
264
265
|
}
|
|
265
|
-
if (isPinned(c)) s["--aura-cell-left"] = "calc(var(--aura-space-6)" + selW + " + " + pinOffsets[c.key] + "
|
|
266
|
+
if (isPinned(c)) s["--aura-cell-left"] = "calc(var(--aura-space-6)" + selW + " + " + pinOffsets[c.key] + ")";
|
|
266
267
|
return s;
|
|
267
268
|
}
|
|
268
269
|
const sortCol = sort && sort.key ? byKey[sort.key] : void 0;
|
|
@@ -308,6 +309,20 @@ const DataTable = React.forwardRef(function DataTable2(props, ref) {
|
|
|
308
309
|
const pageRows = pageSize && !manual ? view.slice(first, first + pageSize) : view;
|
|
309
310
|
const canSortAny = !busy && (manual ? total > 1 : rows.length > 1);
|
|
310
311
|
const shownTotal = manual && props.totalRows == null ? first + rows.length : total;
|
|
312
|
+
const prevCount = React.useRef(pageCount);
|
|
313
|
+
React.useEffect(
|
|
314
|
+
function() {
|
|
315
|
+
if (busy) return;
|
|
316
|
+
const before = prevCount.current;
|
|
317
|
+
prevCount.current = pageCount;
|
|
318
|
+
const asked = pageState[0] || 1;
|
|
319
|
+
if (asked === page || pageCount >= before || asked > before) return;
|
|
320
|
+
if (props.getPageHref && !props.onPageChange && !props.onStateChange) return;
|
|
321
|
+
pageState[1](page);
|
|
322
|
+
emit(sort, page);
|
|
323
|
+
},
|
|
324
|
+
[pageState[0], page, busy, pageCount]
|
|
325
|
+
);
|
|
311
326
|
const linkPaging = !!props.getPageHref && !props.onPageChange && !oneCallback;
|
|
312
327
|
const prevLink = React.useRef(null), nextLink = React.useRef(null), jumpLink = React.useRef(null);
|
|
313
328
|
const jumpState = React.useState(null);
|
|
@@ -376,9 +391,10 @@ const DataTable = React.forwardRef(function DataTable2(props, ref) {
|
|
|
376
391
|
const visibleRows = Math.max(1, Math.floor(bodyH / ROW_H));
|
|
377
392
|
const nCols = vis.length + (selectable ? 1 : 0);
|
|
378
393
|
const nRows = loading ? 0 : pageRows.length;
|
|
394
|
+
const hasTotal = !!(props.footer && rows.length && !loading), T = nRows + 1, lastR = nRows + (hasTotal ? 1 : 0);
|
|
379
395
|
const active = activeState[0];
|
|
380
|
-
const ar = Math.min(active.r,
|
|
381
|
-
const activeRendered = ar === 0 || ar - 1 >= start && ar - 1 < end;
|
|
396
|
+
const ar = Math.min(active.r, lastR), ac = Math.min(active.c, nCols - 1);
|
|
397
|
+
const activeRendered = ar === 0 || hasTotal && ar === T || ar - 1 >= start && ar - 1 < end;
|
|
382
398
|
function colAt(ci) {
|
|
383
399
|
return selectable ? ci === 0 ? null : vis[ci - 1] : vis[ci];
|
|
384
400
|
}
|
|
@@ -409,12 +425,33 @@ const DataTable = React.forwardRef(function DataTable2(props, ref) {
|
|
|
409
425
|
}
|
|
410
426
|
});
|
|
411
427
|
function focusCell(r, c) {
|
|
412
|
-
r = Math.max(0, Math.min(r,
|
|
428
|
+
r = Math.max(0, Math.min(r, lastR));
|
|
413
429
|
c = Math.max(0, Math.min(c, nCols - 1));
|
|
414
430
|
if (stacked && r === 0 && nRows > 0 && !(selectable && c === 0)) r = 1;
|
|
431
|
+
if (gridRef.current && r === T && hasTotal) {
|
|
432
|
+
const shown2 = function(cc) {
|
|
433
|
+
const e = gridRef.current.querySelector('[data-rc="' + r + ":" + cc + '"]');
|
|
434
|
+
return !!e && e.getClientRects().length > 0;
|
|
435
|
+
};
|
|
436
|
+
if (!shown2(c))
|
|
437
|
+
for (let d = 1; d < nCols; d++) {
|
|
438
|
+
if (c + d < nCols && shown2(c + d)) {
|
|
439
|
+
c = c + d;
|
|
440
|
+
break;
|
|
441
|
+
}
|
|
442
|
+
if (c - d >= 0 && shown2(c - d)) {
|
|
443
|
+
c = c - d;
|
|
444
|
+
break;
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
}
|
|
415
448
|
activeState[1]({ r, c });
|
|
416
449
|
pending.current = { r, c };
|
|
417
|
-
if (virtual && r
|
|
450
|
+
if (virtual && hasTotal && r === T && !props.stickyFooter) {
|
|
451
|
+
const sc = scrollRef.current;
|
|
452
|
+
sc.scrollTop = sc.scrollHeight;
|
|
453
|
+
setScrollTop(sc.scrollTop);
|
|
454
|
+
} else if (virtual && r > 0 && r <= nRows) {
|
|
418
455
|
const sc = scrollRef.current, top = (r - 1) * ROW_H;
|
|
419
456
|
if (top < sc.scrollTop) sc.scrollTop = top;
|
|
420
457
|
else if (top + ROW_H > sc.scrollTop + bodyH) sc.scrollTop = top + ROW_H - bodyH;
|
|
@@ -657,7 +694,7 @@ const DataTable = React.forwardRef(function DataTable2(props, ref) {
|
|
|
657
694
|
return;
|
|
658
695
|
}
|
|
659
696
|
const p = rc.split(":"), r = +p[0], c = +p[1], k = e.key, col = colAt(c);
|
|
660
|
-
const row = r > 0 ? pageRows[r - 1] : null;
|
|
697
|
+
const row = r > 0 && r <= nRows ? pageRows[r - 1] : null, isTotal = hasTotal && r === T;
|
|
661
698
|
let handled = true;
|
|
662
699
|
if (r === 0 && col && e.altKey && (k === "ArrowLeft" || k === "ArrowRight") && canResize(col))
|
|
663
700
|
setW(col, widthOf(col) + (k === "ArrowLeft" ? -1 : 1) * (e.shiftKey ? 48 : 16), true);
|
|
@@ -668,21 +705,23 @@ const DataTable = React.forwardRef(function DataTable2(props, ref) {
|
|
|
668
705
|
else if (k === "ArrowRight") focusCell(r, c + 1);
|
|
669
706
|
else if (k === "ArrowLeft") focusCell(r, c - 1);
|
|
670
707
|
else if (k === "ArrowDown") {
|
|
671
|
-
if (r <
|
|
708
|
+
if (r < lastR) focusCell(r + 1, c);
|
|
672
709
|
else if (pageSize && page < pageCount && goPage(page + 1, { r: 1, c })) activeState[1]({ r: 1, c });
|
|
673
710
|
} else if (k === "ArrowUp") {
|
|
674
711
|
if (r > 1 || r === 1 && !(pageSize && page > 1)) focusCell(r - 1, c);
|
|
675
712
|
else if (r === 1 && goPage(page - 1, { r: pageSize, c })) activeState[1]({ r: pageSize, c });
|
|
676
713
|
} else if (k === "Home") focusCell(e.ctrlKey ? 1 : r, 0);
|
|
677
|
-
else if (k === "End") focusCell(e.ctrlKey ?
|
|
714
|
+
else if (k === "End") focusCell(e.ctrlKey ? lastR : r, nCols - 1);
|
|
678
715
|
else if (k === "PageDown") {
|
|
679
716
|
if (pageSize) {
|
|
680
717
|
if (goPage(page + 1, { r: 1, c })) activeState[1]({ r: 1, c });
|
|
681
|
-
} else focusCell(Math.min(
|
|
718
|
+
} else focusCell(Math.min(lastR, r + visibleRows), c);
|
|
682
719
|
} else if (k === "PageUp") {
|
|
683
720
|
if (pageSize) {
|
|
684
721
|
if (goPage(page - 1, { r: 1, c })) activeState[1]({ r: 1, c });
|
|
685
722
|
} else focusCell(Math.max(1, r - visibleRows), c);
|
|
723
|
+
} else if (isTotal && (k === " " || k === "Enter" || k === "F2")) {
|
|
724
|
+
handled = false;
|
|
686
725
|
} else if (k === "F2" && r > 0) {
|
|
687
726
|
const inner = target.querySelector("button, a[href], input, select, textarea");
|
|
688
727
|
if (inner) inner.focus();
|
|
@@ -1053,9 +1092,10 @@ const DataTable = React.forwardRef(function DataTable2(props, ref) {
|
|
|
1053
1092
|
}
|
|
1054
1093
|
);
|
|
1055
1094
|
}
|
|
1095
|
+
const openTotal = manual && props.totalRows == null && !!pageSize && rows.length >= pageSize;
|
|
1056
1096
|
if (pageSize && (rows.length || busy || page > 1)) {
|
|
1057
1097
|
const from = rows.length ? first + 1 : 0, to = manual ? first + rows.length : Math.min(first + pageSize, view.length);
|
|
1058
|
-
foot = /* @__PURE__ */ React.createElement("div", { className: "aura-table__foot" }, /* @__PURE__ */ React.createElement("span", { "aria-live": "polite" }, busy ? t.loading : t.range(from, to, shownTotal)), /* @__PURE__ */ React.createElement("span", { className: "aura-table__pager" }, /* @__PURE__ */ React.createElement("span", null, t.page(page, pageCount)), pagerButton(-1), pagerButton(1)));
|
|
1098
|
+
foot = /* @__PURE__ */ React.createElement("div", { className: "aura-table__foot" }, /* @__PURE__ */ React.createElement("span", { "aria-live": "polite" }, busy ? t.loading : openTotal ? t.rangeOpen(from, to) : t.range(from, to, shownTotal)), /* @__PURE__ */ React.createElement("span", { className: "aura-table__pager" }, /* @__PURE__ */ React.createElement("span", null, openTotal ? t.pageOpen(page) : t.page(page, pageCount)), pagerButton(-1), pagerButton(1)));
|
|
1059
1099
|
} else if (height && rows.length && !loading) {
|
|
1060
1100
|
foot = /* @__PURE__ */ React.createElement("div", { className: "aura-table__foot" }, /* @__PURE__ */ React.createElement("span", null, t.rowCount(shownTotal)), selectable && selected.length ? /* @__PURE__ */ React.createElement("span", null, t.selectedCount(selected.length)) : /* @__PURE__ */ React.createElement("span", null));
|
|
1061
1101
|
}
|
|
@@ -1069,15 +1109,32 @@ const DataTable = React.forwardRef(function DataTable2(props, ref) {
|
|
|
1069
1109
|
style: rowStyle
|
|
1070
1110
|
},
|
|
1071
1111
|
/* @__PURE__ */ React.createElement("span", { className: "aura-table__gutter", "aria-hidden": true }),
|
|
1072
|
-
selectable ? /* @__PURE__ */ React.createElement(
|
|
1112
|
+
selectable ? /* @__PURE__ */ React.createElement(
|
|
1113
|
+
"span",
|
|
1114
|
+
{
|
|
1115
|
+
role: "gridcell",
|
|
1116
|
+
"aria-colindex": 1,
|
|
1117
|
+
className: cx("aura-table__sel", nPinned && "is-pinned"),
|
|
1118
|
+
tabIndex: tabFor(T, 0),
|
|
1119
|
+
"data-rc": T + ":0",
|
|
1120
|
+
onFocus: function() {
|
|
1121
|
+
activeState[1]({ r: T, c: 0 });
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
1124
|
+
) : null,
|
|
1073
1125
|
vis.map(function(c, j) {
|
|
1074
|
-
const pin = isPinned(c);
|
|
1126
|
+
const pin = isPinned(c), ci = j + (selectable ? 1 : 0);
|
|
1075
1127
|
return /* @__PURE__ */ React.createElement(
|
|
1076
1128
|
"span",
|
|
1077
1129
|
{
|
|
1078
1130
|
key: c.key,
|
|
1079
1131
|
role: "gridcell",
|
|
1080
1132
|
"aria-colindex": j + (selectable ? 2 : 1),
|
|
1133
|
+
tabIndex: tabFor(T, ci),
|
|
1134
|
+
"data-rc": T + ":" + ci,
|
|
1135
|
+
onFocus: function() {
|
|
1136
|
+
if (activeState[0].r !== T || activeState[0].c !== ci) activeState[1]({ r: T, c: ci });
|
|
1137
|
+
},
|
|
1081
1138
|
className: cx(
|
|
1082
1139
|
"aura-table__td",
|
|
1083
1140
|
c.mono && "aura-table__mono",
|
|
@@ -1103,7 +1160,7 @@ const DataTable = React.forwardRef(function DataTable2(props, ref) {
|
|
|
1103
1160
|
)
|
|
1104
1161
|
) : null;
|
|
1105
1162
|
const scrollStyle = {
|
|
1106
|
-
scrollPaddingLeft: "calc(var(--aura-space-6)" + selW + " + " + acc + "
|
|
1163
|
+
scrollPaddingLeft: "calc(var(--aura-space-6)" + selW + " + " + acc + ")",
|
|
1107
1164
|
scrollPaddingTop: ROW_H + "px",
|
|
1108
1165
|
scrollPaddingBottom: stickyTotal ? ROW_H + "px" : void 0
|
|
1109
1166
|
};
|
package/dist/esm/DatePicker.js
CHANGED
|
@@ -294,16 +294,16 @@ function useCalendarPopover(boxRef) {
|
|
|
294
294
|
const pos = React.useState(null), popRef = React.useRef(null), mounted = useMounted();
|
|
295
295
|
function place() {
|
|
296
296
|
if (!boxRef.current) return;
|
|
297
|
-
const r = boxRef.current.getBoundingClientRect(), H = 380;
|
|
298
|
-
const up = window.innerHeight - r.bottom < H && r.top > H;
|
|
299
|
-
const left = Math.max(8, Math.min(r.left, window.innerWidth -
|
|
297
|
+
const el = popRef.current, r = boxRef.current.getBoundingClientRect(), W = el ? el.offsetWidth : 320, H = el ? el.offsetHeight : 380;
|
|
298
|
+
const up = window.innerHeight - r.bottom < H + 12 && r.top > H + 12;
|
|
299
|
+
const left = Math.max(8, Math.min(r.left, window.innerWidth - W - 8));
|
|
300
300
|
pos[1](up ? { left, bottom: window.innerHeight - r.top + 4 } : { left, top: r.bottom + 4 });
|
|
301
301
|
}
|
|
302
302
|
useIsoLayoutEffect(
|
|
303
303
|
function() {
|
|
304
304
|
if (open) place();
|
|
305
305
|
},
|
|
306
|
-
[open]
|
|
306
|
+
[open, !!pos[0]]
|
|
307
307
|
);
|
|
308
308
|
React.useEffect(
|
|
309
309
|
function() {
|
package/dist/esm/FileUpload.js
CHANGED
|
@@ -62,6 +62,7 @@ const FileUpload = React.forwardRef(function FileUpload2(props, ref) {
|
|
|
62
62
|
[items, props.name]
|
|
63
63
|
);
|
|
64
64
|
function thumb(it) {
|
|
65
|
+
if (!it.file && it.url && /^image\//.test(it.type || "")) return it.url;
|
|
65
66
|
if (!it.file || !/^image\//.test(it.type || "") || typeof URL === "undefined" || !URL.createObjectURL) return null;
|
|
66
67
|
if (!urls.current[it.id]) urls.current[it.id] = URL.createObjectURL(it.file);
|
|
67
68
|
return urls.current[it.id];
|
|
@@ -167,7 +168,7 @@ const FileUpload = React.forwardRef(function FileUpload2(props, ref) {
|
|
|
167
168
|
),
|
|
168
169
|
items.length ? /* @__PURE__ */ React.createElement("ul", { className: "aura-upload__list", "aria-live": "polite" }, items.map(function(it) {
|
|
169
170
|
const src = thumb(it);
|
|
170
|
-
return /* @__PURE__ */ React.createElement("li", { key: it.id, className: cx("aura-upload__item", it.error && "is-error") }, src ? /* @__PURE__ */ React.createElement("img", { className: "aura-upload__thumb", src, alt: "" }) : /* @__PURE__ */ React.createElement("span", { className: "aura-upload__thumb is-icon", "aria-hidden": true }, /* @__PURE__ */ React.createElement(Icon, { name: /^image\//.test(it.type || "") ? "image" : "file", size: "md" })), /* @__PURE__ */ React.createElement("span", { className: "aura-upload__meta" }, /* @__PURE__ */ React.createElement("span", { className: "aura-upload__name" }, it.name), /* @__PURE__ */ React.createElement("span", { className: "aura-upload__sub" }, it.error ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Icon, { name: "circle-alert", size: 12 }), it.error) : it.status === "uploading" ? t.uploading + (it.progress != null ? " " + Math.round(it.progress) + "%" : "") : it.status === "done" ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Icon, { name: "circle-check", size: 12 }), formatBytes(it.size)) : formatBytes(it.size)), it.status === "uploading" ? /* @__PURE__ */ React.createElement(
|
|
171
|
+
return /* @__PURE__ */ React.createElement("li", { key: it.id, className: cx("aura-upload__item", it.error && "is-error") }, src ? /* @__PURE__ */ React.createElement("img", { className: "aura-upload__thumb", src, alt: "" }) : /* @__PURE__ */ React.createElement("span", { className: "aura-upload__thumb is-icon", "aria-hidden": true }, /* @__PURE__ */ React.createElement(Icon, { name: /^image\//.test(it.type || "") ? "image" : "file", size: "md" })), /* @__PURE__ */ React.createElement("span", { className: "aura-upload__meta" }, it.url && !it.error ? /* @__PURE__ */ React.createElement("a", { className: "aura-upload__name", href: it.url, target: "_blank", rel: "noreferrer" }, it.name) : /* @__PURE__ */ React.createElement("span", { className: "aura-upload__name" }, it.name), /* @__PURE__ */ React.createElement("span", { className: "aura-upload__sub" }, it.error ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Icon, { name: "circle-alert", size: 12 }), it.error) : it.status === "uploading" ? t.uploading + (it.progress != null ? " " + Math.round(it.progress) + "%" : "") : it.status === "done" ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Icon, { name: "circle-check", size: 12 }), formatBytes(it.size)) : formatBytes(it.size)), it.status === "uploading" ? /* @__PURE__ */ React.createElement(
|
|
171
172
|
"span",
|
|
172
173
|
{
|
|
173
174
|
className: "aura-upload__bar",
|