@dmsi/wedgekit-react 0.0.854 → 0.0.856
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/{chunk-T7NSOCGM.js → chunk-RESDUVMA.js} +76 -17
- package/dist/components/CalendarRange.cjs +77 -34
- package/dist/components/CalendarRange.js +3 -3
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.cjs +75 -34
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.js +3 -3
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.cjs +75 -34
- package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.js +3 -3
- package/dist/components/DataGrid/PinnedColumns.cjs +75 -34
- package/dist/components/DataGrid/PinnedColumns.js +3 -3
- package/dist/components/DataGrid/TableBody/LoadingCell.cjs +75 -34
- package/dist/components/DataGrid/TableBody/LoadingCell.js +3 -3
- package/dist/components/DataGrid/TableBody/TableBodyRow.cjs +75 -34
- package/dist/components/DataGrid/TableBody/TableBodyRow.js +3 -3
- package/dist/components/DataGrid/TableBody/index.cjs +75 -34
- package/dist/components/DataGrid/TableBody/index.js +3 -3
- package/dist/components/DataGrid/index.cjs +75 -34
- package/dist/components/DataGrid/index.js +3 -3
- package/dist/components/DataGrid/utils.cjs +75 -34
- package/dist/components/DataGrid/utils.js +3 -3
- package/dist/components/DateInput.cjs +75 -34
- package/dist/components/DateInput.js +3 -3
- package/dist/components/DateRangeInput.cjs +77 -14
- package/dist/components/DateRangeInput.js +3 -3
- package/dist/components/MobileDataGrid/ColumnSelector/index.cjs +75 -34
- package/dist/components/MobileDataGrid/ColumnSelector/index.js +3 -3
- package/dist/components/MobileDataGrid/MobileDataGridHeader.cjs +75 -34
- package/dist/components/MobileDataGrid/MobileDataGridHeader.js +3 -3
- package/dist/components/MobileDataGrid/index.cjs +75 -34
- package/dist/components/MobileDataGrid/index.js +3 -3
- package/dist/components/ProductImagePreview/index.js +2 -2
- package/dist/components/index.cjs +75 -34
- package/dist/components/index.js +3 -3
- package/package.json +1 -1
- package/dist/{chunk-C5DKGJ4E.js → chunk-Y75MQKNY.js} +3 -3
|
@@ -55,9 +55,7 @@ import {
|
|
|
55
55
|
import {
|
|
56
56
|
calculateCursorPosition,
|
|
57
57
|
formatDate,
|
|
58
|
-
|
|
59
|
-
isValidDate,
|
|
60
|
-
parseInputDate
|
|
58
|
+
isValidDate
|
|
61
59
|
} from "./chunk-MMZTPVYB.js";
|
|
62
60
|
import {
|
|
63
61
|
formatCurrencyDisplay
|
|
@@ -921,6 +919,10 @@ function DataGrid({
|
|
|
921
919
|
useSensor(KeyboardSensor)
|
|
922
920
|
);
|
|
923
921
|
const visibleColumns = table.getVisibleLeafColumns();
|
|
922
|
+
const nonPinnedColumnIds = table.getCenterLeafColumns().map((col) => col.id);
|
|
923
|
+
const sortableColumnOrder = columnOrder.filter(
|
|
924
|
+
(id2) => nonPinnedColumnIds.includes(id2)
|
|
925
|
+
);
|
|
924
926
|
const columnVirtualizer = useVirtualizer2({
|
|
925
927
|
count: visibleColumns.length,
|
|
926
928
|
estimateSize: (index) => visibleColumns[index].getSize(),
|
|
@@ -949,7 +951,7 @@ function DataGrid({
|
|
|
949
951
|
children: /* @__PURE__ */ jsx7(
|
|
950
952
|
SortableContext,
|
|
951
953
|
{
|
|
952
|
-
items:
|
|
954
|
+
items: sortableColumnOrder,
|
|
953
955
|
strategy: horizontalListSortingStrategy,
|
|
954
956
|
children: /* @__PURE__ */ jsxs5(
|
|
955
957
|
"div",
|
|
@@ -1740,6 +1742,60 @@ function CalendarPane({
|
|
|
1740
1742
|
}
|
|
1741
1743
|
var CalendarRange_default = CalendarRange;
|
|
1742
1744
|
|
|
1745
|
+
// src/utils/date-patch-dashes.ts
|
|
1746
|
+
function formatInputValueWithDashes(value, dateInDashes) {
|
|
1747
|
+
const digits = value.replace(/\D/g, "");
|
|
1748
|
+
if (dateInDashes) {
|
|
1749
|
+
if (digits.length <= 4) return digits;
|
|
1750
|
+
if (digits.length <= 6) return `${digits.slice(0, 4)}-${digits.slice(4)}`;
|
|
1751
|
+
return `${digits.slice(4, 6)}-${digits.slice(6, 8)}-${digits.slice(0, 4)}`;
|
|
1752
|
+
} else {
|
|
1753
|
+
if (digits.length <= 2) return digits;
|
|
1754
|
+
if (digits.length <= 4) return `${digits.slice(0, 2)}/${digits.slice(2)}`;
|
|
1755
|
+
return `${digits.slice(0, 2)}/${digits.slice(2, 4)}/${digits.slice(4, 8)}`;
|
|
1756
|
+
}
|
|
1757
|
+
}
|
|
1758
|
+
function formatDateWithDashes(value, dateInDashes) {
|
|
1759
|
+
if (!value) return "";
|
|
1760
|
+
let year = "", month = "", day = "";
|
|
1761
|
+
if (/^\d{4}-\d{2}-\d{2}$/.test(value)) {
|
|
1762
|
+
[year, month, day] = value.split("-");
|
|
1763
|
+
} else if (/^\d{2}-\d{2}-\d{4}$/.test(value)) {
|
|
1764
|
+
[month, day, year] = value.split("-");
|
|
1765
|
+
} else if (/^\d{2}\/\d{2}\/\d{4}$/.test(value)) {
|
|
1766
|
+
[month, day, year] = value.split("/");
|
|
1767
|
+
} else {
|
|
1768
|
+
return value;
|
|
1769
|
+
}
|
|
1770
|
+
if (!year || !month || !day) return value;
|
|
1771
|
+
if (dateInDashes) {
|
|
1772
|
+
return `${month}-${day}-${year}`;
|
|
1773
|
+
}
|
|
1774
|
+
return `${month}/${day}/${year}`;
|
|
1775
|
+
}
|
|
1776
|
+
function parseInputDateWithDashes(value, dateInDashes) {
|
|
1777
|
+
if (!value) return "";
|
|
1778
|
+
let year = "", month = "", day = "";
|
|
1779
|
+
if (dateInDashes) {
|
|
1780
|
+
let match = value.match(/^(\d{2})-(\d{2})-(\d{4})$/);
|
|
1781
|
+
if (match) {
|
|
1782
|
+
[, month, day, year] = match;
|
|
1783
|
+
} else {
|
|
1784
|
+
match = value.match(/^(\d{4})-(\d{2})-(\d{2})$/);
|
|
1785
|
+
if (match) {
|
|
1786
|
+
[, year, month, day] = match;
|
|
1787
|
+
}
|
|
1788
|
+
}
|
|
1789
|
+
} else {
|
|
1790
|
+
const match = value.match(/^(\d{2})\/(\d{2})\/(\d{4})$/);
|
|
1791
|
+
if (match) {
|
|
1792
|
+
[, month, day, year] = match;
|
|
1793
|
+
}
|
|
1794
|
+
}
|
|
1795
|
+
if (!year || !month || !day) return "";
|
|
1796
|
+
return `${month}-${day}-${year}`;
|
|
1797
|
+
}
|
|
1798
|
+
|
|
1743
1799
|
// src/components/DateInput.tsx
|
|
1744
1800
|
import { Fragment, jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1745
1801
|
var DateInput = (_a) => {
|
|
@@ -1753,7 +1809,8 @@ var DateInput = (_a) => {
|
|
|
1753
1809
|
readOnly = false,
|
|
1754
1810
|
label,
|
|
1755
1811
|
isDateAvailable,
|
|
1756
|
-
disableManualInput
|
|
1812
|
+
disableManualInput,
|
|
1813
|
+
dateInDashes = false
|
|
1757
1814
|
} = _b, props = __objRest(_b, [
|
|
1758
1815
|
"id",
|
|
1759
1816
|
"testid",
|
|
@@ -1764,7 +1821,8 @@ var DateInput = (_a) => {
|
|
|
1764
1821
|
"readOnly",
|
|
1765
1822
|
"label",
|
|
1766
1823
|
"isDateAvailable",
|
|
1767
|
-
"disableManualInput"
|
|
1824
|
+
"disableManualInput",
|
|
1825
|
+
"dateInDashes"
|
|
1768
1826
|
]);
|
|
1769
1827
|
const [visible, setVisible] = useState5(false);
|
|
1770
1828
|
const [inputValue, setInputValue] = useState5("");
|
|
@@ -1780,9 +1838,9 @@ var DateInput = (_a) => {
|
|
|
1780
1838
|
const [from, to] = [value, ""];
|
|
1781
1839
|
useEffect3(() => {
|
|
1782
1840
|
if (!isTyping) {
|
|
1783
|
-
setInputValue(formatDisplayValue(from));
|
|
1841
|
+
setInputValue(formatDisplayValue(from, dateInDashes));
|
|
1784
1842
|
}
|
|
1785
|
-
}, [from, isTyping]);
|
|
1843
|
+
}, [from, isTyping, dateInDashes]);
|
|
1786
1844
|
useLayoutEffect(() => {
|
|
1787
1845
|
if (visible) {
|
|
1788
1846
|
updatePosition();
|
|
@@ -1845,7 +1903,7 @@ var DateInput = (_a) => {
|
|
|
1845
1903
|
const rawValue = event.target.value;
|
|
1846
1904
|
const cursorPosition = event.target.selectionStart || 0;
|
|
1847
1905
|
setIsTyping(true);
|
|
1848
|
-
const formattedValue =
|
|
1906
|
+
const formattedValue = formatInputValueWithDashes(rawValue, dateInDashes);
|
|
1849
1907
|
setInputValue(formattedValue);
|
|
1850
1908
|
requestAnimationFrame(() => {
|
|
1851
1909
|
if (triggerRef.current) {
|
|
@@ -1857,16 +1915,16 @@ var DateInput = (_a) => {
|
|
|
1857
1915
|
triggerRef.current.setSelectionRange(newPosition, newPosition);
|
|
1858
1916
|
}
|
|
1859
1917
|
});
|
|
1860
|
-
const parsedDate =
|
|
1918
|
+
const parsedDate = parseInputDateWithDashes(formattedValue, dateInDashes);
|
|
1861
1919
|
if (parsedDate && isValidDate(parsedDate)) {
|
|
1862
1920
|
onChange(parsedDate);
|
|
1863
1921
|
}
|
|
1864
1922
|
};
|
|
1865
1923
|
const handleBlur = () => {
|
|
1866
1924
|
setIsTyping(false);
|
|
1867
|
-
const parsedDate =
|
|
1925
|
+
const parsedDate = parseInputDateWithDashes(inputValue, dateInDashes);
|
|
1868
1926
|
if (!parsedDate || !isValidDate(parsedDate)) {
|
|
1869
|
-
setInputValue(formatDisplayValue(from));
|
|
1927
|
+
setInputValue(formatDisplayValue(from, dateInDashes));
|
|
1870
1928
|
}
|
|
1871
1929
|
};
|
|
1872
1930
|
const handleKeyDown = (event) => {
|
|
@@ -1874,10 +1932,11 @@ var DateInput = (_a) => {
|
|
|
1874
1932
|
const input = event.target;
|
|
1875
1933
|
const cursorPosition = input.selectionStart || 0;
|
|
1876
1934
|
const value2 = input.value;
|
|
1877
|
-
|
|
1935
|
+
const sep = dateInDashes ? "-" : "/";
|
|
1936
|
+
if (cursorPosition > 0 && value2[cursorPosition - 1] === sep) {
|
|
1878
1937
|
event.preventDefault();
|
|
1879
1938
|
const newValue = value2.slice(0, cursorPosition - 2) + value2.slice(cursorPosition);
|
|
1880
|
-
const formattedValue =
|
|
1939
|
+
const formattedValue = formatInputValueWithDashes(newValue, dateInDashes);
|
|
1881
1940
|
setInputValue(formattedValue);
|
|
1882
1941
|
requestAnimationFrame(() => {
|
|
1883
1942
|
if (triggerRef.current) {
|
|
@@ -1890,7 +1949,7 @@ var DateInput = (_a) => {
|
|
|
1890
1949
|
}
|
|
1891
1950
|
}
|
|
1892
1951
|
if (event.key === "Enter") {
|
|
1893
|
-
const parsedDate =
|
|
1952
|
+
const parsedDate = parseInputDateWithDashes(inputValue, dateInDashes);
|
|
1894
1953
|
if (parsedDate && isValidDate(parsedDate)) {
|
|
1895
1954
|
onChange(parsedDate);
|
|
1896
1955
|
setVisible(false);
|
|
@@ -1979,14 +2038,14 @@ var DateInput = (_a) => {
|
|
|
1979
2038
|
] });
|
|
1980
2039
|
};
|
|
1981
2040
|
DateInput.displayName = "DateInput";
|
|
1982
|
-
function formatDisplayValue(from) {
|
|
2041
|
+
function formatDisplayValue(from, dateInDashes) {
|
|
1983
2042
|
if (!from) {
|
|
1984
2043
|
return "";
|
|
1985
2044
|
}
|
|
1986
2045
|
if (!isValidDate(from)) {
|
|
1987
2046
|
return "";
|
|
1988
2047
|
}
|
|
1989
|
-
return
|
|
2048
|
+
return formatDateWithDashes(from, dateInDashes);
|
|
1990
2049
|
}
|
|
1991
2050
|
|
|
1992
2051
|
// src/components/MobileDataGrid/ColumnSelector/index.tsx
|
|
@@ -482,30 +482,10 @@ function formatCurrencyDisplay(value) {
|
|
|
482
482
|
}
|
|
483
483
|
|
|
484
484
|
// src/utils/date.ts
|
|
485
|
-
function parseInputDate(input) {
|
|
486
|
-
const match = input.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/);
|
|
487
|
-
if (!match) {
|
|
488
|
-
return null;
|
|
489
|
-
}
|
|
490
|
-
const [, month, day, year] = match;
|
|
491
|
-
const paddedMonth = month.padStart(2, "0");
|
|
492
|
-
const paddedDay = day.padStart(2, "0");
|
|
493
|
-
return `${year}-${paddedMonth}-${paddedDay}`;
|
|
494
|
-
}
|
|
495
485
|
function isValidDate(dateString) {
|
|
496
486
|
const date = new Date(dateString);
|
|
497
487
|
return date instanceof Date && !isNaN(date.getTime()) && dateString === date.toISOString().split("T")[0];
|
|
498
488
|
}
|
|
499
|
-
function formatInputValue(value) {
|
|
500
|
-
const digits = value.replace(/\D/g, "");
|
|
501
|
-
if (digits.length < 2) {
|
|
502
|
-
return digits;
|
|
503
|
-
}
|
|
504
|
-
if (digits.length >= 4) {
|
|
505
|
-
return `${digits.slice(0, 2)}/${digits.slice(2, 4)}/${digits.slice(4, 8)}`;
|
|
506
|
-
}
|
|
507
|
-
return `${digits.slice(0, 2)}/${digits.slice(2)}`;
|
|
508
|
-
}
|
|
509
489
|
function isDigit(character) {
|
|
510
490
|
return /\d/.test(character);
|
|
511
491
|
}
|
|
@@ -3499,6 +3479,10 @@ function DataGrid({
|
|
|
3499
3479
|
(0, import_core.useSensor)(import_core.KeyboardSensor)
|
|
3500
3480
|
);
|
|
3501
3481
|
const visibleColumns = table.getVisibleLeafColumns();
|
|
3482
|
+
const nonPinnedColumnIds = table.getCenterLeafColumns().map((col) => col.id);
|
|
3483
|
+
const sortableColumnOrder = columnOrder.filter(
|
|
3484
|
+
(id2) => nonPinnedColumnIds.includes(id2)
|
|
3485
|
+
);
|
|
3502
3486
|
const columnVirtualizer = (0, import_react_virtual2.useVirtualizer)({
|
|
3503
3487
|
count: visibleColumns.length,
|
|
3504
3488
|
estimateSize: (index) => visibleColumns[index].getSize(),
|
|
@@ -3527,7 +3511,7 @@ function DataGrid({
|
|
|
3527
3511
|
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3528
3512
|
import_sortable2.SortableContext,
|
|
3529
3513
|
{
|
|
3530
|
-
items:
|
|
3514
|
+
items: sortableColumnOrder,
|
|
3531
3515
|
strategy: import_sortable2.horizontalListSortingStrategy,
|
|
3532
3516
|
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
3533
3517
|
"div",
|
|
@@ -4420,6 +4404,62 @@ Tooltip.displayName = "Tooltip";
|
|
|
4420
4404
|
// src/components/DateInput.tsx
|
|
4421
4405
|
var import_react20 = require("react");
|
|
4422
4406
|
var import_react_dom3 = require("react-dom");
|
|
4407
|
+
|
|
4408
|
+
// src/utils/date-patch-dashes.ts
|
|
4409
|
+
function formatInputValueWithDashes(value, dateInDashes) {
|
|
4410
|
+
const digits = value.replace(/\D/g, "");
|
|
4411
|
+
if (dateInDashes) {
|
|
4412
|
+
if (digits.length <= 4) return digits;
|
|
4413
|
+
if (digits.length <= 6) return `${digits.slice(0, 4)}-${digits.slice(4)}`;
|
|
4414
|
+
return `${digits.slice(4, 6)}-${digits.slice(6, 8)}-${digits.slice(0, 4)}`;
|
|
4415
|
+
} else {
|
|
4416
|
+
if (digits.length <= 2) return digits;
|
|
4417
|
+
if (digits.length <= 4) return `${digits.slice(0, 2)}/${digits.slice(2)}`;
|
|
4418
|
+
return `${digits.slice(0, 2)}/${digits.slice(2, 4)}/${digits.slice(4, 8)}`;
|
|
4419
|
+
}
|
|
4420
|
+
}
|
|
4421
|
+
function formatDateWithDashes(value, dateInDashes) {
|
|
4422
|
+
if (!value) return "";
|
|
4423
|
+
let year = "", month = "", day = "";
|
|
4424
|
+
if (/^\d{4}-\d{2}-\d{2}$/.test(value)) {
|
|
4425
|
+
[year, month, day] = value.split("-");
|
|
4426
|
+
} else if (/^\d{2}-\d{2}-\d{4}$/.test(value)) {
|
|
4427
|
+
[month, day, year] = value.split("-");
|
|
4428
|
+
} else if (/^\d{2}\/\d{2}\/\d{4}$/.test(value)) {
|
|
4429
|
+
[month, day, year] = value.split("/");
|
|
4430
|
+
} else {
|
|
4431
|
+
return value;
|
|
4432
|
+
}
|
|
4433
|
+
if (!year || !month || !day) return value;
|
|
4434
|
+
if (dateInDashes) {
|
|
4435
|
+
return `${month}-${day}-${year}`;
|
|
4436
|
+
}
|
|
4437
|
+
return `${month}/${day}/${year}`;
|
|
4438
|
+
}
|
|
4439
|
+
function parseInputDateWithDashes(value, dateInDashes) {
|
|
4440
|
+
if (!value) return "";
|
|
4441
|
+
let year = "", month = "", day = "";
|
|
4442
|
+
if (dateInDashes) {
|
|
4443
|
+
let match = value.match(/^(\d{2})-(\d{2})-(\d{4})$/);
|
|
4444
|
+
if (match) {
|
|
4445
|
+
[, month, day, year] = match;
|
|
4446
|
+
} else {
|
|
4447
|
+
match = value.match(/^(\d{4})-(\d{2})-(\d{2})$/);
|
|
4448
|
+
if (match) {
|
|
4449
|
+
[, year, month, day] = match;
|
|
4450
|
+
}
|
|
4451
|
+
}
|
|
4452
|
+
} else {
|
|
4453
|
+
const match = value.match(/^(\d{2})\/(\d{2})\/(\d{4})$/);
|
|
4454
|
+
if (match) {
|
|
4455
|
+
[, month, day, year] = match;
|
|
4456
|
+
}
|
|
4457
|
+
}
|
|
4458
|
+
if (!year || !month || !day) return "";
|
|
4459
|
+
return `${month}-${day}-${year}`;
|
|
4460
|
+
}
|
|
4461
|
+
|
|
4462
|
+
// src/components/DateInput.tsx
|
|
4423
4463
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
4424
4464
|
var DateInput = (_a) => {
|
|
4425
4465
|
var _b = _a, {
|
|
@@ -4432,7 +4472,8 @@ var DateInput = (_a) => {
|
|
|
4432
4472
|
readOnly = false,
|
|
4433
4473
|
label,
|
|
4434
4474
|
isDateAvailable,
|
|
4435
|
-
disableManualInput
|
|
4475
|
+
disableManualInput,
|
|
4476
|
+
dateInDashes = false
|
|
4436
4477
|
} = _b, props = __objRest(_b, [
|
|
4437
4478
|
"id",
|
|
4438
4479
|
"testid",
|
|
@@ -4443,7 +4484,8 @@ var DateInput = (_a) => {
|
|
|
4443
4484
|
"readOnly",
|
|
4444
4485
|
"label",
|
|
4445
4486
|
"isDateAvailable",
|
|
4446
|
-
"disableManualInput"
|
|
4487
|
+
"disableManualInput",
|
|
4488
|
+
"dateInDashes"
|
|
4447
4489
|
]);
|
|
4448
4490
|
const [visible, setVisible] = (0, import_react20.useState)(false);
|
|
4449
4491
|
const [inputValue, setInputValue] = (0, import_react20.useState)("");
|
|
@@ -4459,9 +4501,9 @@ var DateInput = (_a) => {
|
|
|
4459
4501
|
const [from, to] = [value, ""];
|
|
4460
4502
|
(0, import_react20.useEffect)(() => {
|
|
4461
4503
|
if (!isTyping) {
|
|
4462
|
-
setInputValue(formatDisplayValue(from));
|
|
4504
|
+
setInputValue(formatDisplayValue(from, dateInDashes));
|
|
4463
4505
|
}
|
|
4464
|
-
}, [from, isTyping]);
|
|
4506
|
+
}, [from, isTyping, dateInDashes]);
|
|
4465
4507
|
(0, import_react20.useLayoutEffect)(() => {
|
|
4466
4508
|
if (visible) {
|
|
4467
4509
|
updatePosition();
|
|
@@ -4524,7 +4566,7 @@ var DateInput = (_a) => {
|
|
|
4524
4566
|
const rawValue = event.target.value;
|
|
4525
4567
|
const cursorPosition = event.target.selectionStart || 0;
|
|
4526
4568
|
setIsTyping(true);
|
|
4527
|
-
const formattedValue =
|
|
4569
|
+
const formattedValue = formatInputValueWithDashes(rawValue, dateInDashes);
|
|
4528
4570
|
setInputValue(formattedValue);
|
|
4529
4571
|
requestAnimationFrame(() => {
|
|
4530
4572
|
if (triggerRef.current) {
|
|
@@ -4536,16 +4578,16 @@ var DateInput = (_a) => {
|
|
|
4536
4578
|
triggerRef.current.setSelectionRange(newPosition, newPosition);
|
|
4537
4579
|
}
|
|
4538
4580
|
});
|
|
4539
|
-
const parsedDate =
|
|
4581
|
+
const parsedDate = parseInputDateWithDashes(formattedValue, dateInDashes);
|
|
4540
4582
|
if (parsedDate && isValidDate(parsedDate)) {
|
|
4541
4583
|
onChange(parsedDate);
|
|
4542
4584
|
}
|
|
4543
4585
|
};
|
|
4544
4586
|
const handleBlur = () => {
|
|
4545
4587
|
setIsTyping(false);
|
|
4546
|
-
const parsedDate =
|
|
4588
|
+
const parsedDate = parseInputDateWithDashes(inputValue, dateInDashes);
|
|
4547
4589
|
if (!parsedDate || !isValidDate(parsedDate)) {
|
|
4548
|
-
setInputValue(formatDisplayValue(from));
|
|
4590
|
+
setInputValue(formatDisplayValue(from, dateInDashes));
|
|
4549
4591
|
}
|
|
4550
4592
|
};
|
|
4551
4593
|
const handleKeyDown = (event) => {
|
|
@@ -4553,10 +4595,11 @@ var DateInput = (_a) => {
|
|
|
4553
4595
|
const input = event.target;
|
|
4554
4596
|
const cursorPosition = input.selectionStart || 0;
|
|
4555
4597
|
const value2 = input.value;
|
|
4556
|
-
|
|
4598
|
+
const sep = dateInDashes ? "-" : "/";
|
|
4599
|
+
if (cursorPosition > 0 && value2[cursorPosition - 1] === sep) {
|
|
4557
4600
|
event.preventDefault();
|
|
4558
4601
|
const newValue = value2.slice(0, cursorPosition - 2) + value2.slice(cursorPosition);
|
|
4559
|
-
const formattedValue =
|
|
4602
|
+
const formattedValue = formatInputValueWithDashes(newValue, dateInDashes);
|
|
4560
4603
|
setInputValue(formattedValue);
|
|
4561
4604
|
requestAnimationFrame(() => {
|
|
4562
4605
|
if (triggerRef.current) {
|
|
@@ -4569,7 +4612,7 @@ var DateInput = (_a) => {
|
|
|
4569
4612
|
}
|
|
4570
4613
|
}
|
|
4571
4614
|
if (event.key === "Enter") {
|
|
4572
|
-
const parsedDate =
|
|
4615
|
+
const parsedDate = parseInputDateWithDashes(inputValue, dateInDashes);
|
|
4573
4616
|
if (parsedDate && isValidDate(parsedDate)) {
|
|
4574
4617
|
onChange(parsedDate);
|
|
4575
4618
|
setVisible(false);
|
|
@@ -4658,14 +4701,14 @@ var DateInput = (_a) => {
|
|
|
4658
4701
|
] });
|
|
4659
4702
|
};
|
|
4660
4703
|
DateInput.displayName = "DateInput";
|
|
4661
|
-
function formatDisplayValue(from) {
|
|
4704
|
+
function formatDisplayValue(from, dateInDashes) {
|
|
4662
4705
|
if (!from) {
|
|
4663
4706
|
return "";
|
|
4664
4707
|
}
|
|
4665
4708
|
if (!isValidDate(from)) {
|
|
4666
4709
|
return "";
|
|
4667
4710
|
}
|
|
4668
|
-
return
|
|
4711
|
+
return formatDateWithDashes(from, dateInDashes);
|
|
4669
4712
|
}
|
|
4670
4713
|
|
|
4671
4714
|
// src/components/Accordion.tsx
|
|
@@ -2,17 +2,17 @@ import {
|
|
|
2
2
|
CalendarRange,
|
|
3
3
|
CalendarRange_default,
|
|
4
4
|
isWeekend
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-RESDUVMA.js";
|
|
6
6
|
import "../chunk-WJJB7IJZ.js";
|
|
7
7
|
import "../chunk-Q4YDNW7N.js";
|
|
8
8
|
import "../chunk-M7INAUAJ.js";
|
|
9
|
-
import "../chunk-
|
|
9
|
+
import "../chunk-Y75MQKNY.js";
|
|
10
|
+
import "../chunk-MBZ55T2D.js";
|
|
10
11
|
import "../chunk-2IKT6IHB.js";
|
|
11
12
|
import "../chunk-YCDDBSVU.js";
|
|
12
13
|
import "../chunk-3X3Y4TMS.js";
|
|
13
14
|
import "../chunk-BQNPOGD5.js";
|
|
14
15
|
import "../chunk-Y5GD2FJA.js";
|
|
15
|
-
import "../chunk-MBZ55T2D.js";
|
|
16
16
|
import "../chunk-SZ47M32R.js";
|
|
17
17
|
import "../chunk-B4AE3DCA.js";
|
|
18
18
|
import "../chunk-FP3Y5JJN.js";
|
|
@@ -476,30 +476,10 @@ function formatCurrencyDisplay(value) {
|
|
|
476
476
|
}
|
|
477
477
|
|
|
478
478
|
// src/utils/date.ts
|
|
479
|
-
function parseInputDate(input) {
|
|
480
|
-
const match = input.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/);
|
|
481
|
-
if (!match) {
|
|
482
|
-
return null;
|
|
483
|
-
}
|
|
484
|
-
const [, month, day, year] = match;
|
|
485
|
-
const paddedMonth = month.padStart(2, "0");
|
|
486
|
-
const paddedDay = day.padStart(2, "0");
|
|
487
|
-
return `${year}-${paddedMonth}-${paddedDay}`;
|
|
488
|
-
}
|
|
489
479
|
function isValidDate(dateString) {
|
|
490
480
|
const date = new Date(dateString);
|
|
491
481
|
return date instanceof Date && !isNaN(date.getTime()) && dateString === date.toISOString().split("T")[0];
|
|
492
482
|
}
|
|
493
|
-
function formatInputValue(value) {
|
|
494
|
-
const digits = value.replace(/\D/g, "");
|
|
495
|
-
if (digits.length < 2) {
|
|
496
|
-
return digits;
|
|
497
|
-
}
|
|
498
|
-
if (digits.length >= 4) {
|
|
499
|
-
return `${digits.slice(0, 2)}/${digits.slice(2, 4)}/${digits.slice(4, 8)}`;
|
|
500
|
-
}
|
|
501
|
-
return `${digits.slice(0, 2)}/${digits.slice(2)}`;
|
|
502
|
-
}
|
|
503
483
|
function isDigit(character) {
|
|
504
484
|
return /\d/.test(character);
|
|
505
485
|
}
|
|
@@ -3465,6 +3445,10 @@ function DataGrid({
|
|
|
3465
3445
|
(0, import_core.useSensor)(import_core.KeyboardSensor)
|
|
3466
3446
|
);
|
|
3467
3447
|
const visibleColumns = table.getVisibleLeafColumns();
|
|
3448
|
+
const nonPinnedColumnIds = table.getCenterLeafColumns().map((col) => col.id);
|
|
3449
|
+
const sortableColumnOrder = columnOrder.filter(
|
|
3450
|
+
(id2) => nonPinnedColumnIds.includes(id2)
|
|
3451
|
+
);
|
|
3468
3452
|
const columnVirtualizer = (0, import_react_virtual2.useVirtualizer)({
|
|
3469
3453
|
count: visibleColumns.length,
|
|
3470
3454
|
estimateSize: (index) => visibleColumns[index].getSize(),
|
|
@@ -3493,7 +3477,7 @@ function DataGrid({
|
|
|
3493
3477
|
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3494
3478
|
import_sortable2.SortableContext,
|
|
3495
3479
|
{
|
|
3496
|
-
items:
|
|
3480
|
+
items: sortableColumnOrder,
|
|
3497
3481
|
strategy: import_sortable2.horizontalListSortingStrategy,
|
|
3498
3482
|
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
3499
3483
|
"div",
|
|
@@ -4852,6 +4836,60 @@ function CalendarPane({
|
|
|
4852
4836
|
] }, month.name + month.year);
|
|
4853
4837
|
}
|
|
4854
4838
|
|
|
4839
|
+
// src/utils/date-patch-dashes.ts
|
|
4840
|
+
function formatInputValueWithDashes(value, dateInDashes) {
|
|
4841
|
+
const digits = value.replace(/\D/g, "");
|
|
4842
|
+
if (dateInDashes) {
|
|
4843
|
+
if (digits.length <= 4) return digits;
|
|
4844
|
+
if (digits.length <= 6) return `${digits.slice(0, 4)}-${digits.slice(4)}`;
|
|
4845
|
+
return `${digits.slice(4, 6)}-${digits.slice(6, 8)}-${digits.slice(0, 4)}`;
|
|
4846
|
+
} else {
|
|
4847
|
+
if (digits.length <= 2) return digits;
|
|
4848
|
+
if (digits.length <= 4) return `${digits.slice(0, 2)}/${digits.slice(2)}`;
|
|
4849
|
+
return `${digits.slice(0, 2)}/${digits.slice(2, 4)}/${digits.slice(4, 8)}`;
|
|
4850
|
+
}
|
|
4851
|
+
}
|
|
4852
|
+
function formatDateWithDashes(value, dateInDashes) {
|
|
4853
|
+
if (!value) return "";
|
|
4854
|
+
let year = "", month = "", day = "";
|
|
4855
|
+
if (/^\d{4}-\d{2}-\d{2}$/.test(value)) {
|
|
4856
|
+
[year, month, day] = value.split("-");
|
|
4857
|
+
} else if (/^\d{2}-\d{2}-\d{4}$/.test(value)) {
|
|
4858
|
+
[month, day, year] = value.split("-");
|
|
4859
|
+
} else if (/^\d{2}\/\d{2}\/\d{4}$/.test(value)) {
|
|
4860
|
+
[month, day, year] = value.split("/");
|
|
4861
|
+
} else {
|
|
4862
|
+
return value;
|
|
4863
|
+
}
|
|
4864
|
+
if (!year || !month || !day) return value;
|
|
4865
|
+
if (dateInDashes) {
|
|
4866
|
+
return `${month}-${day}-${year}`;
|
|
4867
|
+
}
|
|
4868
|
+
return `${month}/${day}/${year}`;
|
|
4869
|
+
}
|
|
4870
|
+
function parseInputDateWithDashes(value, dateInDashes) {
|
|
4871
|
+
if (!value) return "";
|
|
4872
|
+
let year = "", month = "", day = "";
|
|
4873
|
+
if (dateInDashes) {
|
|
4874
|
+
let match = value.match(/^(\d{2})-(\d{2})-(\d{4})$/);
|
|
4875
|
+
if (match) {
|
|
4876
|
+
[, month, day, year] = match;
|
|
4877
|
+
} else {
|
|
4878
|
+
match = value.match(/^(\d{4})-(\d{2})-(\d{2})$/);
|
|
4879
|
+
if (match) {
|
|
4880
|
+
[, year, month, day] = match;
|
|
4881
|
+
}
|
|
4882
|
+
}
|
|
4883
|
+
} else {
|
|
4884
|
+
const match = value.match(/^(\d{2})\/(\d{2})\/(\d{4})$/);
|
|
4885
|
+
if (match) {
|
|
4886
|
+
[, month, day, year] = match;
|
|
4887
|
+
}
|
|
4888
|
+
}
|
|
4889
|
+
if (!year || !month || !day) return "";
|
|
4890
|
+
return `${month}-${day}-${year}`;
|
|
4891
|
+
}
|
|
4892
|
+
|
|
4855
4893
|
// src/components/DateInput.tsx
|
|
4856
4894
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
4857
4895
|
var DateInput = (_a) => {
|
|
@@ -4865,7 +4903,8 @@ var DateInput = (_a) => {
|
|
|
4865
4903
|
readOnly = false,
|
|
4866
4904
|
label,
|
|
4867
4905
|
isDateAvailable,
|
|
4868
|
-
disableManualInput
|
|
4906
|
+
disableManualInput,
|
|
4907
|
+
dateInDashes = false
|
|
4869
4908
|
} = _b, props = __objRest(_b, [
|
|
4870
4909
|
"id",
|
|
4871
4910
|
"testid",
|
|
@@ -4876,7 +4915,8 @@ var DateInput = (_a) => {
|
|
|
4876
4915
|
"readOnly",
|
|
4877
4916
|
"label",
|
|
4878
4917
|
"isDateAvailable",
|
|
4879
|
-
"disableManualInput"
|
|
4918
|
+
"disableManualInput",
|
|
4919
|
+
"dateInDashes"
|
|
4880
4920
|
]);
|
|
4881
4921
|
const [visible, setVisible] = (0, import_react20.useState)(false);
|
|
4882
4922
|
const [inputValue, setInputValue] = (0, import_react20.useState)("");
|
|
@@ -4892,9 +4932,9 @@ var DateInput = (_a) => {
|
|
|
4892
4932
|
const [from, to] = [value, ""];
|
|
4893
4933
|
(0, import_react20.useEffect)(() => {
|
|
4894
4934
|
if (!isTyping) {
|
|
4895
|
-
setInputValue(formatDisplayValue(from));
|
|
4935
|
+
setInputValue(formatDisplayValue(from, dateInDashes));
|
|
4896
4936
|
}
|
|
4897
|
-
}, [from, isTyping]);
|
|
4937
|
+
}, [from, isTyping, dateInDashes]);
|
|
4898
4938
|
(0, import_react20.useLayoutEffect)(() => {
|
|
4899
4939
|
if (visible) {
|
|
4900
4940
|
updatePosition();
|
|
@@ -4957,7 +4997,7 @@ var DateInput = (_a) => {
|
|
|
4957
4997
|
const rawValue = event.target.value;
|
|
4958
4998
|
const cursorPosition = event.target.selectionStart || 0;
|
|
4959
4999
|
setIsTyping(true);
|
|
4960
|
-
const formattedValue =
|
|
5000
|
+
const formattedValue = formatInputValueWithDashes(rawValue, dateInDashes);
|
|
4961
5001
|
setInputValue(formattedValue);
|
|
4962
5002
|
requestAnimationFrame(() => {
|
|
4963
5003
|
if (triggerRef.current) {
|
|
@@ -4969,16 +5009,16 @@ var DateInput = (_a) => {
|
|
|
4969
5009
|
triggerRef.current.setSelectionRange(newPosition, newPosition);
|
|
4970
5010
|
}
|
|
4971
5011
|
});
|
|
4972
|
-
const parsedDate =
|
|
5012
|
+
const parsedDate = parseInputDateWithDashes(formattedValue, dateInDashes);
|
|
4973
5013
|
if (parsedDate && isValidDate(parsedDate)) {
|
|
4974
5014
|
onChange(parsedDate);
|
|
4975
5015
|
}
|
|
4976
5016
|
};
|
|
4977
5017
|
const handleBlur = () => {
|
|
4978
5018
|
setIsTyping(false);
|
|
4979
|
-
const parsedDate =
|
|
5019
|
+
const parsedDate = parseInputDateWithDashes(inputValue, dateInDashes);
|
|
4980
5020
|
if (!parsedDate || !isValidDate(parsedDate)) {
|
|
4981
|
-
setInputValue(formatDisplayValue(from));
|
|
5021
|
+
setInputValue(formatDisplayValue(from, dateInDashes));
|
|
4982
5022
|
}
|
|
4983
5023
|
};
|
|
4984
5024
|
const handleKeyDown = (event) => {
|
|
@@ -4986,10 +5026,11 @@ var DateInput = (_a) => {
|
|
|
4986
5026
|
const input = event.target;
|
|
4987
5027
|
const cursorPosition = input.selectionStart || 0;
|
|
4988
5028
|
const value2 = input.value;
|
|
4989
|
-
|
|
5029
|
+
const sep = dateInDashes ? "-" : "/";
|
|
5030
|
+
if (cursorPosition > 0 && value2[cursorPosition - 1] === sep) {
|
|
4990
5031
|
event.preventDefault();
|
|
4991
5032
|
const newValue = value2.slice(0, cursorPosition - 2) + value2.slice(cursorPosition);
|
|
4992
|
-
const formattedValue =
|
|
5033
|
+
const formattedValue = formatInputValueWithDashes(newValue, dateInDashes);
|
|
4993
5034
|
setInputValue(formattedValue);
|
|
4994
5035
|
requestAnimationFrame(() => {
|
|
4995
5036
|
if (triggerRef.current) {
|
|
@@ -5002,7 +5043,7 @@ var DateInput = (_a) => {
|
|
|
5002
5043
|
}
|
|
5003
5044
|
}
|
|
5004
5045
|
if (event.key === "Enter") {
|
|
5005
|
-
const parsedDate =
|
|
5046
|
+
const parsedDate = parseInputDateWithDashes(inputValue, dateInDashes);
|
|
5006
5047
|
if (parsedDate && isValidDate(parsedDate)) {
|
|
5007
5048
|
onChange(parsedDate);
|
|
5008
5049
|
setVisible(false);
|
|
@@ -5091,14 +5132,14 @@ var DateInput = (_a) => {
|
|
|
5091
5132
|
] });
|
|
5092
5133
|
};
|
|
5093
5134
|
DateInput.displayName = "DateInput";
|
|
5094
|
-
function formatDisplayValue(from) {
|
|
5135
|
+
function formatDisplayValue(from, dateInDashes) {
|
|
5095
5136
|
if (!from) {
|
|
5096
5137
|
return "";
|
|
5097
5138
|
}
|
|
5098
5139
|
if (!isValidDate(from)) {
|
|
5099
5140
|
return "";
|
|
5100
5141
|
}
|
|
5101
|
-
return
|
|
5142
|
+
return formatDateWithDashes(from, dateInDashes);
|
|
5102
5143
|
}
|
|
5103
5144
|
|
|
5104
5145
|
// src/components/Accordion.tsx
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ColumnSelectorMenuOption
|
|
3
|
-
} from "../../../chunk-
|
|
3
|
+
} from "../../../chunk-RESDUVMA.js";
|
|
4
4
|
import "../../../chunk-WJJB7IJZ.js";
|
|
5
5
|
import "../../../chunk-Q4YDNW7N.js";
|
|
6
6
|
import "../../../chunk-M7INAUAJ.js";
|
|
7
|
-
import "../../../chunk-
|
|
7
|
+
import "../../../chunk-Y75MQKNY.js";
|
|
8
|
+
import "../../../chunk-MBZ55T2D.js";
|
|
8
9
|
import "../../../chunk-2IKT6IHB.js";
|
|
9
10
|
import "../../../chunk-YCDDBSVU.js";
|
|
10
11
|
import "../../../chunk-3X3Y4TMS.js";
|
|
11
12
|
import "../../../chunk-BQNPOGD5.js";
|
|
12
13
|
import "../../../chunk-Y5GD2FJA.js";
|
|
13
|
-
import "../../../chunk-MBZ55T2D.js";
|
|
14
14
|
import "../../../chunk-SZ47M32R.js";
|
|
15
15
|
import "../../../chunk-B4AE3DCA.js";
|
|
16
16
|
import "../../../chunk-FP3Y5JJN.js";
|