@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
|
@@ -146,30 +146,10 @@ function formatCurrencyDisplay(value) {
|
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
// src/utils/date.ts
|
|
149
|
-
function parseInputDate(input) {
|
|
150
|
-
const match = input.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/);
|
|
151
|
-
if (!match) {
|
|
152
|
-
return null;
|
|
153
|
-
}
|
|
154
|
-
const [, month, day, year] = match;
|
|
155
|
-
const paddedMonth = month.padStart(2, "0");
|
|
156
|
-
const paddedDay = day.padStart(2, "0");
|
|
157
|
-
return `${year}-${paddedMonth}-${paddedDay}`;
|
|
158
|
-
}
|
|
159
149
|
function isValidDate(dateString) {
|
|
160
150
|
const date = new Date(dateString);
|
|
161
151
|
return date instanceof Date && !isNaN(date.getTime()) && dateString === date.toISOString().split("T")[0];
|
|
162
152
|
}
|
|
163
|
-
function formatInputValue(value) {
|
|
164
|
-
const digits = value.replace(/\D/g, "");
|
|
165
|
-
if (digits.length < 2) {
|
|
166
|
-
return digits;
|
|
167
|
-
}
|
|
168
|
-
if (digits.length >= 4) {
|
|
169
|
-
return `${digits.slice(0, 2)}/${digits.slice(2, 4)}/${digits.slice(4, 8)}`;
|
|
170
|
-
}
|
|
171
|
-
return `${digits.slice(0, 2)}/${digits.slice(2)}`;
|
|
172
|
-
}
|
|
173
153
|
function isDigit(character) {
|
|
174
154
|
return /\d/.test(character);
|
|
175
155
|
}
|
|
@@ -3715,6 +3695,60 @@ function CalendarPane({
|
|
|
3715
3695
|
] }, month.name + month.year);
|
|
3716
3696
|
}
|
|
3717
3697
|
|
|
3698
|
+
// src/utils/date-patch-dashes.ts
|
|
3699
|
+
function formatInputValueWithDashes(value, dateInDashes) {
|
|
3700
|
+
const digits = value.replace(/\D/g, "");
|
|
3701
|
+
if (dateInDashes) {
|
|
3702
|
+
if (digits.length <= 4) return digits;
|
|
3703
|
+
if (digits.length <= 6) return `${digits.slice(0, 4)}-${digits.slice(4)}`;
|
|
3704
|
+
return `${digits.slice(4, 6)}-${digits.slice(6, 8)}-${digits.slice(0, 4)}`;
|
|
3705
|
+
} else {
|
|
3706
|
+
if (digits.length <= 2) return digits;
|
|
3707
|
+
if (digits.length <= 4) return `${digits.slice(0, 2)}/${digits.slice(2)}`;
|
|
3708
|
+
return `${digits.slice(0, 2)}/${digits.slice(2, 4)}/${digits.slice(4, 8)}`;
|
|
3709
|
+
}
|
|
3710
|
+
}
|
|
3711
|
+
function formatDateWithDashes(value, dateInDashes) {
|
|
3712
|
+
if (!value) return "";
|
|
3713
|
+
let year = "", month = "", day = "";
|
|
3714
|
+
if (/^\d{4}-\d{2}-\d{2}$/.test(value)) {
|
|
3715
|
+
[year, month, day] = value.split("-");
|
|
3716
|
+
} else if (/^\d{2}-\d{2}-\d{4}$/.test(value)) {
|
|
3717
|
+
[month, day, year] = value.split("-");
|
|
3718
|
+
} else if (/^\d{2}\/\d{2}\/\d{4}$/.test(value)) {
|
|
3719
|
+
[month, day, year] = value.split("/");
|
|
3720
|
+
} else {
|
|
3721
|
+
return value;
|
|
3722
|
+
}
|
|
3723
|
+
if (!year || !month || !day) return value;
|
|
3724
|
+
if (dateInDashes) {
|
|
3725
|
+
return `${month}-${day}-${year}`;
|
|
3726
|
+
}
|
|
3727
|
+
return `${month}/${day}/${year}`;
|
|
3728
|
+
}
|
|
3729
|
+
function parseInputDateWithDashes(value, dateInDashes) {
|
|
3730
|
+
if (!value) return "";
|
|
3731
|
+
let year = "", month = "", day = "";
|
|
3732
|
+
if (dateInDashes) {
|
|
3733
|
+
let match = value.match(/^(\d{2})-(\d{2})-(\d{4})$/);
|
|
3734
|
+
if (match) {
|
|
3735
|
+
[, month, day, year] = match;
|
|
3736
|
+
} else {
|
|
3737
|
+
match = value.match(/^(\d{4})-(\d{2})-(\d{2})$/);
|
|
3738
|
+
if (match) {
|
|
3739
|
+
[, year, month, day] = match;
|
|
3740
|
+
}
|
|
3741
|
+
}
|
|
3742
|
+
} else {
|
|
3743
|
+
const match = value.match(/^(\d{2})\/(\d{2})\/(\d{4})$/);
|
|
3744
|
+
if (match) {
|
|
3745
|
+
[, month, day, year] = match;
|
|
3746
|
+
}
|
|
3747
|
+
}
|
|
3748
|
+
if (!year || !month || !day) return "";
|
|
3749
|
+
return `${month}-${day}-${year}`;
|
|
3750
|
+
}
|
|
3751
|
+
|
|
3718
3752
|
// src/components/DateInput.tsx
|
|
3719
3753
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
3720
3754
|
var DateInput = (_a) => {
|
|
@@ -3728,7 +3762,8 @@ var DateInput = (_a) => {
|
|
|
3728
3762
|
readOnly = false,
|
|
3729
3763
|
label,
|
|
3730
3764
|
isDateAvailable,
|
|
3731
|
-
disableManualInput
|
|
3765
|
+
disableManualInput,
|
|
3766
|
+
dateInDashes = false
|
|
3732
3767
|
} = _b, props = __objRest(_b, [
|
|
3733
3768
|
"id",
|
|
3734
3769
|
"testid",
|
|
@@ -3739,7 +3774,8 @@ var DateInput = (_a) => {
|
|
|
3739
3774
|
"readOnly",
|
|
3740
3775
|
"label",
|
|
3741
3776
|
"isDateAvailable",
|
|
3742
|
-
"disableManualInput"
|
|
3777
|
+
"disableManualInput",
|
|
3778
|
+
"dateInDashes"
|
|
3743
3779
|
]);
|
|
3744
3780
|
const [visible, setVisible] = (0, import_react16.useState)(false);
|
|
3745
3781
|
const [inputValue, setInputValue] = (0, import_react16.useState)("");
|
|
@@ -3755,9 +3791,9 @@ var DateInput = (_a) => {
|
|
|
3755
3791
|
const [from, to] = [value, ""];
|
|
3756
3792
|
(0, import_react16.useEffect)(() => {
|
|
3757
3793
|
if (!isTyping) {
|
|
3758
|
-
setInputValue(formatDisplayValue(from));
|
|
3794
|
+
setInputValue(formatDisplayValue(from, dateInDashes));
|
|
3759
3795
|
}
|
|
3760
|
-
}, [from, isTyping]);
|
|
3796
|
+
}, [from, isTyping, dateInDashes]);
|
|
3761
3797
|
(0, import_react16.useLayoutEffect)(() => {
|
|
3762
3798
|
if (visible) {
|
|
3763
3799
|
updatePosition();
|
|
@@ -3820,7 +3856,7 @@ var DateInput = (_a) => {
|
|
|
3820
3856
|
const rawValue = event.target.value;
|
|
3821
3857
|
const cursorPosition = event.target.selectionStart || 0;
|
|
3822
3858
|
setIsTyping(true);
|
|
3823
|
-
const formattedValue =
|
|
3859
|
+
const formattedValue = formatInputValueWithDashes(rawValue, dateInDashes);
|
|
3824
3860
|
setInputValue(formattedValue);
|
|
3825
3861
|
requestAnimationFrame(() => {
|
|
3826
3862
|
if (triggerRef.current) {
|
|
@@ -3832,16 +3868,16 @@ var DateInput = (_a) => {
|
|
|
3832
3868
|
triggerRef.current.setSelectionRange(newPosition, newPosition);
|
|
3833
3869
|
}
|
|
3834
3870
|
});
|
|
3835
|
-
const parsedDate =
|
|
3871
|
+
const parsedDate = parseInputDateWithDashes(formattedValue, dateInDashes);
|
|
3836
3872
|
if (parsedDate && isValidDate(parsedDate)) {
|
|
3837
3873
|
onChange(parsedDate);
|
|
3838
3874
|
}
|
|
3839
3875
|
};
|
|
3840
3876
|
const handleBlur = () => {
|
|
3841
3877
|
setIsTyping(false);
|
|
3842
|
-
const parsedDate =
|
|
3878
|
+
const parsedDate = parseInputDateWithDashes(inputValue, dateInDashes);
|
|
3843
3879
|
if (!parsedDate || !isValidDate(parsedDate)) {
|
|
3844
|
-
setInputValue(formatDisplayValue(from));
|
|
3880
|
+
setInputValue(formatDisplayValue(from, dateInDashes));
|
|
3845
3881
|
}
|
|
3846
3882
|
};
|
|
3847
3883
|
const handleKeyDown = (event) => {
|
|
@@ -3849,10 +3885,11 @@ var DateInput = (_a) => {
|
|
|
3849
3885
|
const input = event.target;
|
|
3850
3886
|
const cursorPosition = input.selectionStart || 0;
|
|
3851
3887
|
const value2 = input.value;
|
|
3852
|
-
|
|
3888
|
+
const sep = dateInDashes ? "-" : "/";
|
|
3889
|
+
if (cursorPosition > 0 && value2[cursorPosition - 1] === sep) {
|
|
3853
3890
|
event.preventDefault();
|
|
3854
3891
|
const newValue = value2.slice(0, cursorPosition - 2) + value2.slice(cursorPosition);
|
|
3855
|
-
const formattedValue =
|
|
3892
|
+
const formattedValue = formatInputValueWithDashes(newValue, dateInDashes);
|
|
3856
3893
|
setInputValue(formattedValue);
|
|
3857
3894
|
requestAnimationFrame(() => {
|
|
3858
3895
|
if (triggerRef.current) {
|
|
@@ -3865,7 +3902,7 @@ var DateInput = (_a) => {
|
|
|
3865
3902
|
}
|
|
3866
3903
|
}
|
|
3867
3904
|
if (event.key === "Enter") {
|
|
3868
|
-
const parsedDate =
|
|
3905
|
+
const parsedDate = parseInputDateWithDashes(inputValue, dateInDashes);
|
|
3869
3906
|
if (parsedDate && isValidDate(parsedDate)) {
|
|
3870
3907
|
onChange(parsedDate);
|
|
3871
3908
|
setVisible(false);
|
|
@@ -3954,14 +3991,14 @@ var DateInput = (_a) => {
|
|
|
3954
3991
|
] });
|
|
3955
3992
|
};
|
|
3956
3993
|
DateInput.displayName = "DateInput";
|
|
3957
|
-
function formatDisplayValue(from) {
|
|
3994
|
+
function formatDisplayValue(from, dateInDashes) {
|
|
3958
3995
|
if (!from) {
|
|
3959
3996
|
return "";
|
|
3960
3997
|
}
|
|
3961
3998
|
if (!isValidDate(from)) {
|
|
3962
3999
|
return "";
|
|
3963
4000
|
}
|
|
3964
|
-
return
|
|
4001
|
+
return formatDateWithDashes(from, dateInDashes);
|
|
3965
4002
|
}
|
|
3966
4003
|
|
|
3967
4004
|
// src/components/Accordion.tsx
|
|
@@ -5735,6 +5772,10 @@ function DataGrid({
|
|
|
5735
5772
|
(0, import_core.useSensor)(import_core.KeyboardSensor)
|
|
5736
5773
|
);
|
|
5737
5774
|
const visibleColumns = table.getVisibleLeafColumns();
|
|
5775
|
+
const nonPinnedColumnIds = table.getCenterLeafColumns().map((col) => col.id);
|
|
5776
|
+
const sortableColumnOrder = columnOrder.filter(
|
|
5777
|
+
(id2) => nonPinnedColumnIds.includes(id2)
|
|
5778
|
+
);
|
|
5738
5779
|
const columnVirtualizer = (0, import_react_virtual2.useVirtualizer)({
|
|
5739
5780
|
count: visibleColumns.length,
|
|
5740
5781
|
estimateSize: (index) => visibleColumns[index].getSize(),
|
|
@@ -5763,7 +5804,7 @@ function DataGrid({
|
|
|
5763
5804
|
children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
5764
5805
|
import_sortable2.SortableContext,
|
|
5765
5806
|
{
|
|
5766
|
-
items:
|
|
5807
|
+
items: sortableColumnOrder,
|
|
5767
5808
|
strategy: import_sortable2.horizontalListSortingStrategy,
|
|
5768
5809
|
children: /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
|
|
5769
5810
|
"div",
|
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
import {
|
|
3
3
|
DataGrid,
|
|
4
4
|
DataGrid_default
|
|
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
|
}
|
|
@@ -3476,6 +3456,10 @@ function DataGrid({
|
|
|
3476
3456
|
(0, import_core.useSensor)(import_core.KeyboardSensor)
|
|
3477
3457
|
);
|
|
3478
3458
|
const visibleColumns = table.getVisibleLeafColumns();
|
|
3459
|
+
const nonPinnedColumnIds = table.getCenterLeafColumns().map((col) => col.id);
|
|
3460
|
+
const sortableColumnOrder = columnOrder.filter(
|
|
3461
|
+
(id2) => nonPinnedColumnIds.includes(id2)
|
|
3462
|
+
);
|
|
3479
3463
|
const columnVirtualizer = (0, import_react_virtual2.useVirtualizer)({
|
|
3480
3464
|
count: visibleColumns.length,
|
|
3481
3465
|
estimateSize: (index) => visibleColumns[index].getSize(),
|
|
@@ -3504,7 +3488,7 @@ function DataGrid({
|
|
|
3504
3488
|
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3505
3489
|
import_sortable2.SortableContext,
|
|
3506
3490
|
{
|
|
3507
|
-
items:
|
|
3491
|
+
items: sortableColumnOrder,
|
|
3508
3492
|
strategy: import_sortable2.horizontalListSortingStrategy,
|
|
3509
3493
|
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
3510
3494
|
"div",
|
|
@@ -4863,6 +4847,60 @@ function CalendarPane({
|
|
|
4863
4847
|
] }, month.name + month.year);
|
|
4864
4848
|
}
|
|
4865
4849
|
|
|
4850
|
+
// src/utils/date-patch-dashes.ts
|
|
4851
|
+
function formatInputValueWithDashes(value, dateInDashes) {
|
|
4852
|
+
const digits = value.replace(/\D/g, "");
|
|
4853
|
+
if (dateInDashes) {
|
|
4854
|
+
if (digits.length <= 4) return digits;
|
|
4855
|
+
if (digits.length <= 6) return `${digits.slice(0, 4)}-${digits.slice(4)}`;
|
|
4856
|
+
return `${digits.slice(4, 6)}-${digits.slice(6, 8)}-${digits.slice(0, 4)}`;
|
|
4857
|
+
} else {
|
|
4858
|
+
if (digits.length <= 2) return digits;
|
|
4859
|
+
if (digits.length <= 4) return `${digits.slice(0, 2)}/${digits.slice(2)}`;
|
|
4860
|
+
return `${digits.slice(0, 2)}/${digits.slice(2, 4)}/${digits.slice(4, 8)}`;
|
|
4861
|
+
}
|
|
4862
|
+
}
|
|
4863
|
+
function formatDateWithDashes(value, dateInDashes) {
|
|
4864
|
+
if (!value) return "";
|
|
4865
|
+
let year = "", month = "", day = "";
|
|
4866
|
+
if (/^\d{4}-\d{2}-\d{2}$/.test(value)) {
|
|
4867
|
+
[year, month, day] = value.split("-");
|
|
4868
|
+
} else if (/^\d{2}-\d{2}-\d{4}$/.test(value)) {
|
|
4869
|
+
[month, day, year] = value.split("-");
|
|
4870
|
+
} else if (/^\d{2}\/\d{2}\/\d{4}$/.test(value)) {
|
|
4871
|
+
[month, day, year] = value.split("/");
|
|
4872
|
+
} else {
|
|
4873
|
+
return value;
|
|
4874
|
+
}
|
|
4875
|
+
if (!year || !month || !day) return value;
|
|
4876
|
+
if (dateInDashes) {
|
|
4877
|
+
return `${month}-${day}-${year}`;
|
|
4878
|
+
}
|
|
4879
|
+
return `${month}/${day}/${year}`;
|
|
4880
|
+
}
|
|
4881
|
+
function parseInputDateWithDashes(value, dateInDashes) {
|
|
4882
|
+
if (!value) return "";
|
|
4883
|
+
let year = "", month = "", day = "";
|
|
4884
|
+
if (dateInDashes) {
|
|
4885
|
+
let match = value.match(/^(\d{2})-(\d{2})-(\d{4})$/);
|
|
4886
|
+
if (match) {
|
|
4887
|
+
[, month, day, year] = match;
|
|
4888
|
+
} else {
|
|
4889
|
+
match = value.match(/^(\d{4})-(\d{2})-(\d{2})$/);
|
|
4890
|
+
if (match) {
|
|
4891
|
+
[, year, month, day] = match;
|
|
4892
|
+
}
|
|
4893
|
+
}
|
|
4894
|
+
} else {
|
|
4895
|
+
const match = value.match(/^(\d{2})\/(\d{2})\/(\d{4})$/);
|
|
4896
|
+
if (match) {
|
|
4897
|
+
[, month, day, year] = match;
|
|
4898
|
+
}
|
|
4899
|
+
}
|
|
4900
|
+
if (!year || !month || !day) return "";
|
|
4901
|
+
return `${month}-${day}-${year}`;
|
|
4902
|
+
}
|
|
4903
|
+
|
|
4866
4904
|
// src/components/DateInput.tsx
|
|
4867
4905
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
4868
4906
|
var DateInput = (_a) => {
|
|
@@ -4876,7 +4914,8 @@ var DateInput = (_a) => {
|
|
|
4876
4914
|
readOnly = false,
|
|
4877
4915
|
label,
|
|
4878
4916
|
isDateAvailable,
|
|
4879
|
-
disableManualInput
|
|
4917
|
+
disableManualInput,
|
|
4918
|
+
dateInDashes = false
|
|
4880
4919
|
} = _b, props = __objRest(_b, [
|
|
4881
4920
|
"id",
|
|
4882
4921
|
"testid",
|
|
@@ -4887,7 +4926,8 @@ var DateInput = (_a) => {
|
|
|
4887
4926
|
"readOnly",
|
|
4888
4927
|
"label",
|
|
4889
4928
|
"isDateAvailable",
|
|
4890
|
-
"disableManualInput"
|
|
4929
|
+
"disableManualInput",
|
|
4930
|
+
"dateInDashes"
|
|
4891
4931
|
]);
|
|
4892
4932
|
const [visible, setVisible] = (0, import_react21.useState)(false);
|
|
4893
4933
|
const [inputValue, setInputValue] = (0, import_react21.useState)("");
|
|
@@ -4903,9 +4943,9 @@ var DateInput = (_a) => {
|
|
|
4903
4943
|
const [from, to] = [value, ""];
|
|
4904
4944
|
(0, import_react21.useEffect)(() => {
|
|
4905
4945
|
if (!isTyping) {
|
|
4906
|
-
setInputValue(formatDisplayValue(from));
|
|
4946
|
+
setInputValue(formatDisplayValue(from, dateInDashes));
|
|
4907
4947
|
}
|
|
4908
|
-
}, [from, isTyping]);
|
|
4948
|
+
}, [from, isTyping, dateInDashes]);
|
|
4909
4949
|
(0, import_react21.useLayoutEffect)(() => {
|
|
4910
4950
|
if (visible) {
|
|
4911
4951
|
updatePosition();
|
|
@@ -4968,7 +5008,7 @@ var DateInput = (_a) => {
|
|
|
4968
5008
|
const rawValue = event.target.value;
|
|
4969
5009
|
const cursorPosition = event.target.selectionStart || 0;
|
|
4970
5010
|
setIsTyping(true);
|
|
4971
|
-
const formattedValue =
|
|
5011
|
+
const formattedValue = formatInputValueWithDashes(rawValue, dateInDashes);
|
|
4972
5012
|
setInputValue(formattedValue);
|
|
4973
5013
|
requestAnimationFrame(() => {
|
|
4974
5014
|
if (triggerRef.current) {
|
|
@@ -4980,16 +5020,16 @@ var DateInput = (_a) => {
|
|
|
4980
5020
|
triggerRef.current.setSelectionRange(newPosition, newPosition);
|
|
4981
5021
|
}
|
|
4982
5022
|
});
|
|
4983
|
-
const parsedDate =
|
|
5023
|
+
const parsedDate = parseInputDateWithDashes(formattedValue, dateInDashes);
|
|
4984
5024
|
if (parsedDate && isValidDate(parsedDate)) {
|
|
4985
5025
|
onChange(parsedDate);
|
|
4986
5026
|
}
|
|
4987
5027
|
};
|
|
4988
5028
|
const handleBlur = () => {
|
|
4989
5029
|
setIsTyping(false);
|
|
4990
|
-
const parsedDate =
|
|
5030
|
+
const parsedDate = parseInputDateWithDashes(inputValue, dateInDashes);
|
|
4991
5031
|
if (!parsedDate || !isValidDate(parsedDate)) {
|
|
4992
|
-
setInputValue(formatDisplayValue(from));
|
|
5032
|
+
setInputValue(formatDisplayValue(from, dateInDashes));
|
|
4993
5033
|
}
|
|
4994
5034
|
};
|
|
4995
5035
|
const handleKeyDown = (event) => {
|
|
@@ -4997,10 +5037,11 @@ var DateInput = (_a) => {
|
|
|
4997
5037
|
const input = event.target;
|
|
4998
5038
|
const cursorPosition = input.selectionStart || 0;
|
|
4999
5039
|
const value2 = input.value;
|
|
5000
|
-
|
|
5040
|
+
const sep = dateInDashes ? "-" : "/";
|
|
5041
|
+
if (cursorPosition > 0 && value2[cursorPosition - 1] === sep) {
|
|
5001
5042
|
event.preventDefault();
|
|
5002
5043
|
const newValue = value2.slice(0, cursorPosition - 2) + value2.slice(cursorPosition);
|
|
5003
|
-
const formattedValue =
|
|
5044
|
+
const formattedValue = formatInputValueWithDashes(newValue, dateInDashes);
|
|
5004
5045
|
setInputValue(formattedValue);
|
|
5005
5046
|
requestAnimationFrame(() => {
|
|
5006
5047
|
if (triggerRef.current) {
|
|
@@ -5013,7 +5054,7 @@ var DateInput = (_a) => {
|
|
|
5013
5054
|
}
|
|
5014
5055
|
}
|
|
5015
5056
|
if (event.key === "Enter") {
|
|
5016
|
-
const parsedDate =
|
|
5057
|
+
const parsedDate = parseInputDateWithDashes(inputValue, dateInDashes);
|
|
5017
5058
|
if (parsedDate && isValidDate(parsedDate)) {
|
|
5018
5059
|
onChange(parsedDate);
|
|
5019
5060
|
setVisible(false);
|
|
@@ -5102,14 +5143,14 @@ var DateInput = (_a) => {
|
|
|
5102
5143
|
] });
|
|
5103
5144
|
};
|
|
5104
5145
|
DateInput.displayName = "DateInput";
|
|
5105
|
-
function formatDisplayValue(from) {
|
|
5146
|
+
function formatDisplayValue(from, dateInDashes) {
|
|
5106
5147
|
if (!from) {
|
|
5107
5148
|
return "";
|
|
5108
5149
|
}
|
|
5109
5150
|
if (!isValidDate(from)) {
|
|
5110
5151
|
return "";
|
|
5111
5152
|
}
|
|
5112
|
-
return
|
|
5153
|
+
return formatDateWithDashes(from, dateInDashes);
|
|
5113
5154
|
}
|
|
5114
5155
|
|
|
5115
5156
|
// src/components/Accordion.tsx
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getSortIcon
|
|
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";
|
|
@@ -944,30 +944,10 @@ var useMatchesMedia = (query) => {
|
|
|
944
944
|
var useMatchesMobile = () => useMatchesMedia("(width < 48rem)");
|
|
945
945
|
|
|
946
946
|
// src/utils/date.ts
|
|
947
|
-
function parseInputDate(input) {
|
|
948
|
-
const match = input.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/);
|
|
949
|
-
if (!match) {
|
|
950
|
-
return null;
|
|
951
|
-
}
|
|
952
|
-
const [, month, day, year] = match;
|
|
953
|
-
const paddedMonth = month.padStart(2, "0");
|
|
954
|
-
const paddedDay = day.padStart(2, "0");
|
|
955
|
-
return `${year}-${paddedMonth}-${paddedDay}`;
|
|
956
|
-
}
|
|
957
947
|
function isValidDate(dateString) {
|
|
958
948
|
const date = new Date(dateString);
|
|
959
949
|
return date instanceof Date && !isNaN(date.getTime()) && dateString === date.toISOString().split("T")[0];
|
|
960
950
|
}
|
|
961
|
-
function formatInputValue(value) {
|
|
962
|
-
const digits = value.replace(/\D/g, "");
|
|
963
|
-
if (digits.length < 2) {
|
|
964
|
-
return digits;
|
|
965
|
-
}
|
|
966
|
-
if (digits.length >= 4) {
|
|
967
|
-
return `${digits.slice(0, 2)}/${digits.slice(2, 4)}/${digits.slice(4, 8)}`;
|
|
968
|
-
}
|
|
969
|
-
return `${digits.slice(0, 2)}/${digits.slice(2)}`;
|
|
970
|
-
}
|
|
971
951
|
function isDigit(character) {
|
|
972
952
|
return /\d/.test(character);
|
|
973
953
|
}
|
|
@@ -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",
|
|
@@ -5829,6 +5813,60 @@ function CalendarPane({
|
|
|
5829
5813
|
] }, month.name + month.year);
|
|
5830
5814
|
}
|
|
5831
5815
|
|
|
5816
|
+
// src/utils/date-patch-dashes.ts
|
|
5817
|
+
function formatInputValueWithDashes(value, dateInDashes) {
|
|
5818
|
+
const digits = value.replace(/\D/g, "");
|
|
5819
|
+
if (dateInDashes) {
|
|
5820
|
+
if (digits.length <= 4) return digits;
|
|
5821
|
+
if (digits.length <= 6) return `${digits.slice(0, 4)}-${digits.slice(4)}`;
|
|
5822
|
+
return `${digits.slice(4, 6)}-${digits.slice(6, 8)}-${digits.slice(0, 4)}`;
|
|
5823
|
+
} else {
|
|
5824
|
+
if (digits.length <= 2) return digits;
|
|
5825
|
+
if (digits.length <= 4) return `${digits.slice(0, 2)}/${digits.slice(2)}`;
|
|
5826
|
+
return `${digits.slice(0, 2)}/${digits.slice(2, 4)}/${digits.slice(4, 8)}`;
|
|
5827
|
+
}
|
|
5828
|
+
}
|
|
5829
|
+
function formatDateWithDashes(value, dateInDashes) {
|
|
5830
|
+
if (!value) return "";
|
|
5831
|
+
let year = "", month = "", day = "";
|
|
5832
|
+
if (/^\d{4}-\d{2}-\d{2}$/.test(value)) {
|
|
5833
|
+
[year, month, day] = value.split("-");
|
|
5834
|
+
} else if (/^\d{2}-\d{2}-\d{4}$/.test(value)) {
|
|
5835
|
+
[month, day, year] = value.split("-");
|
|
5836
|
+
} else if (/^\d{2}\/\d{2}\/\d{4}$/.test(value)) {
|
|
5837
|
+
[month, day, year] = value.split("/");
|
|
5838
|
+
} else {
|
|
5839
|
+
return value;
|
|
5840
|
+
}
|
|
5841
|
+
if (!year || !month || !day) return value;
|
|
5842
|
+
if (dateInDashes) {
|
|
5843
|
+
return `${month}-${day}-${year}`;
|
|
5844
|
+
}
|
|
5845
|
+
return `${month}/${day}/${year}`;
|
|
5846
|
+
}
|
|
5847
|
+
function parseInputDateWithDashes(value, dateInDashes) {
|
|
5848
|
+
if (!value) return "";
|
|
5849
|
+
let year = "", month = "", day = "";
|
|
5850
|
+
if (dateInDashes) {
|
|
5851
|
+
let match = value.match(/^(\d{2})-(\d{2})-(\d{4})$/);
|
|
5852
|
+
if (match) {
|
|
5853
|
+
[, month, day, year] = match;
|
|
5854
|
+
} else {
|
|
5855
|
+
match = value.match(/^(\d{4})-(\d{2})-(\d{2})$/);
|
|
5856
|
+
if (match) {
|
|
5857
|
+
[, year, month, day] = match;
|
|
5858
|
+
}
|
|
5859
|
+
}
|
|
5860
|
+
} else {
|
|
5861
|
+
const match = value.match(/^(\d{2})\/(\d{2})\/(\d{4})$/);
|
|
5862
|
+
if (match) {
|
|
5863
|
+
[, month, day, year] = match;
|
|
5864
|
+
}
|
|
5865
|
+
}
|
|
5866
|
+
if (!year || !month || !day) return "";
|
|
5867
|
+
return `${month}-${day}-${year}`;
|
|
5868
|
+
}
|
|
5869
|
+
|
|
5832
5870
|
// src/components/DateInput.tsx
|
|
5833
5871
|
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
5834
5872
|
var DateInput = (_a) => {
|
|
@@ -5842,7 +5880,8 @@ var DateInput = (_a) => {
|
|
|
5842
5880
|
readOnly = false,
|
|
5843
5881
|
label,
|
|
5844
5882
|
isDateAvailable,
|
|
5845
|
-
disableManualInput
|
|
5883
|
+
disableManualInput,
|
|
5884
|
+
dateInDashes = false
|
|
5846
5885
|
} = _b, props = __objRest(_b, [
|
|
5847
5886
|
"id",
|
|
5848
5887
|
"testid",
|
|
@@ -5853,7 +5892,8 @@ var DateInput = (_a) => {
|
|
|
5853
5892
|
"readOnly",
|
|
5854
5893
|
"label",
|
|
5855
5894
|
"isDateAvailable",
|
|
5856
|
-
"disableManualInput"
|
|
5895
|
+
"disableManualInput",
|
|
5896
|
+
"dateInDashes"
|
|
5857
5897
|
]);
|
|
5858
5898
|
const [visible, setVisible] = (0, import_react40.useState)(false);
|
|
5859
5899
|
const [inputValue, setInputValue] = (0, import_react40.useState)("");
|
|
@@ -5869,9 +5909,9 @@ var DateInput = (_a) => {
|
|
|
5869
5909
|
const [from, to] = [value, ""];
|
|
5870
5910
|
(0, import_react40.useEffect)(() => {
|
|
5871
5911
|
if (!isTyping) {
|
|
5872
|
-
setInputValue(formatDisplayValue(from));
|
|
5912
|
+
setInputValue(formatDisplayValue(from, dateInDashes));
|
|
5873
5913
|
}
|
|
5874
|
-
}, [from, isTyping]);
|
|
5914
|
+
}, [from, isTyping, dateInDashes]);
|
|
5875
5915
|
(0, import_react40.useLayoutEffect)(() => {
|
|
5876
5916
|
if (visible) {
|
|
5877
5917
|
updatePosition();
|
|
@@ -5934,7 +5974,7 @@ var DateInput = (_a) => {
|
|
|
5934
5974
|
const rawValue = event.target.value;
|
|
5935
5975
|
const cursorPosition = event.target.selectionStart || 0;
|
|
5936
5976
|
setIsTyping(true);
|
|
5937
|
-
const formattedValue =
|
|
5977
|
+
const formattedValue = formatInputValueWithDashes(rawValue, dateInDashes);
|
|
5938
5978
|
setInputValue(formattedValue);
|
|
5939
5979
|
requestAnimationFrame(() => {
|
|
5940
5980
|
if (triggerRef.current) {
|
|
@@ -5946,16 +5986,16 @@ var DateInput = (_a) => {
|
|
|
5946
5986
|
triggerRef.current.setSelectionRange(newPosition, newPosition);
|
|
5947
5987
|
}
|
|
5948
5988
|
});
|
|
5949
|
-
const parsedDate =
|
|
5989
|
+
const parsedDate = parseInputDateWithDashes(formattedValue, dateInDashes);
|
|
5950
5990
|
if (parsedDate && isValidDate(parsedDate)) {
|
|
5951
5991
|
onChange(parsedDate);
|
|
5952
5992
|
}
|
|
5953
5993
|
};
|
|
5954
5994
|
const handleBlur = () => {
|
|
5955
5995
|
setIsTyping(false);
|
|
5956
|
-
const parsedDate =
|
|
5996
|
+
const parsedDate = parseInputDateWithDashes(inputValue, dateInDashes);
|
|
5957
5997
|
if (!parsedDate || !isValidDate(parsedDate)) {
|
|
5958
|
-
setInputValue(formatDisplayValue(from));
|
|
5998
|
+
setInputValue(formatDisplayValue(from, dateInDashes));
|
|
5959
5999
|
}
|
|
5960
6000
|
};
|
|
5961
6001
|
const handleKeyDown = (event) => {
|
|
@@ -5963,10 +6003,11 @@ var DateInput = (_a) => {
|
|
|
5963
6003
|
const input = event.target;
|
|
5964
6004
|
const cursorPosition = input.selectionStart || 0;
|
|
5965
6005
|
const value2 = input.value;
|
|
5966
|
-
|
|
6006
|
+
const sep = dateInDashes ? "-" : "/";
|
|
6007
|
+
if (cursorPosition > 0 && value2[cursorPosition - 1] === sep) {
|
|
5967
6008
|
event.preventDefault();
|
|
5968
6009
|
const newValue = value2.slice(0, cursorPosition - 2) + value2.slice(cursorPosition);
|
|
5969
|
-
const formattedValue =
|
|
6010
|
+
const formattedValue = formatInputValueWithDashes(newValue, dateInDashes);
|
|
5970
6011
|
setInputValue(formattedValue);
|
|
5971
6012
|
requestAnimationFrame(() => {
|
|
5972
6013
|
if (triggerRef.current) {
|
|
@@ -5979,7 +6020,7 @@ var DateInput = (_a) => {
|
|
|
5979
6020
|
}
|
|
5980
6021
|
}
|
|
5981
6022
|
if (event.key === "Enter") {
|
|
5982
|
-
const parsedDate =
|
|
6023
|
+
const parsedDate = parseInputDateWithDashes(inputValue, dateInDashes);
|
|
5983
6024
|
if (parsedDate && isValidDate(parsedDate)) {
|
|
5984
6025
|
onChange(parsedDate);
|
|
5985
6026
|
setVisible(false);
|
|
@@ -6068,14 +6109,14 @@ var DateInput = (_a) => {
|
|
|
6068
6109
|
] });
|
|
6069
6110
|
};
|
|
6070
6111
|
DateInput.displayName = "DateInput";
|
|
6071
|
-
function formatDisplayValue(from) {
|
|
6112
|
+
function formatDisplayValue(from, dateInDashes) {
|
|
6072
6113
|
if (!from) {
|
|
6073
6114
|
return "";
|
|
6074
6115
|
}
|
|
6075
6116
|
if (!isValidDate(from)) {
|
|
6076
6117
|
return "";
|
|
6077
6118
|
}
|
|
6078
|
-
return
|
|
6119
|
+
return formatDateWithDashes(from, dateInDashes);
|
|
6079
6120
|
}
|
|
6080
6121
|
// Annotate the CommonJS export names for ESM import in node:
|
|
6081
6122
|
0 && (module.exports = {
|