@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
|
@@ -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
|
}
|
|
@@ -3387,6 +3367,10 @@ function DataGrid({
|
|
|
3387
3367
|
(0, import_core.useSensor)(import_core.KeyboardSensor)
|
|
3388
3368
|
);
|
|
3389
3369
|
const visibleColumns = table.getVisibleLeafColumns();
|
|
3370
|
+
const nonPinnedColumnIds = table.getCenterLeafColumns().map((col) => col.id);
|
|
3371
|
+
const sortableColumnOrder = columnOrder.filter(
|
|
3372
|
+
(id2) => nonPinnedColumnIds.includes(id2)
|
|
3373
|
+
);
|
|
3390
3374
|
const columnVirtualizer = (0, import_react_virtual2.useVirtualizer)({
|
|
3391
3375
|
count: visibleColumns.length,
|
|
3392
3376
|
estimateSize: (index) => visibleColumns[index].getSize(),
|
|
@@ -3415,7 +3399,7 @@ function DataGrid({
|
|
|
3415
3399
|
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3416
3400
|
import_sortable2.SortableContext,
|
|
3417
3401
|
{
|
|
3418
|
-
items:
|
|
3402
|
+
items: sortableColumnOrder,
|
|
3419
3403
|
strategy: import_sortable2.horizontalListSortingStrategy,
|
|
3420
3404
|
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
3421
3405
|
"div",
|
|
@@ -4774,6 +4758,60 @@ function CalendarPane({
|
|
|
4774
4758
|
] }, month.name + month.year);
|
|
4775
4759
|
}
|
|
4776
4760
|
|
|
4761
|
+
// src/utils/date-patch-dashes.ts
|
|
4762
|
+
function formatInputValueWithDashes(value, dateInDashes) {
|
|
4763
|
+
const digits = value.replace(/\D/g, "");
|
|
4764
|
+
if (dateInDashes) {
|
|
4765
|
+
if (digits.length <= 4) return digits;
|
|
4766
|
+
if (digits.length <= 6) return `${digits.slice(0, 4)}-${digits.slice(4)}`;
|
|
4767
|
+
return `${digits.slice(4, 6)}-${digits.slice(6, 8)}-${digits.slice(0, 4)}`;
|
|
4768
|
+
} else {
|
|
4769
|
+
if (digits.length <= 2) return digits;
|
|
4770
|
+
if (digits.length <= 4) return `${digits.slice(0, 2)}/${digits.slice(2)}`;
|
|
4771
|
+
return `${digits.slice(0, 2)}/${digits.slice(2, 4)}/${digits.slice(4, 8)}`;
|
|
4772
|
+
}
|
|
4773
|
+
}
|
|
4774
|
+
function formatDateWithDashes(value, dateInDashes) {
|
|
4775
|
+
if (!value) return "";
|
|
4776
|
+
let year = "", month = "", day = "";
|
|
4777
|
+
if (/^\d{4}-\d{2}-\d{2}$/.test(value)) {
|
|
4778
|
+
[year, month, day] = value.split("-");
|
|
4779
|
+
} else if (/^\d{2}-\d{2}-\d{4}$/.test(value)) {
|
|
4780
|
+
[month, day, year] = value.split("-");
|
|
4781
|
+
} else if (/^\d{2}\/\d{2}\/\d{4}$/.test(value)) {
|
|
4782
|
+
[month, day, year] = value.split("/");
|
|
4783
|
+
} else {
|
|
4784
|
+
return value;
|
|
4785
|
+
}
|
|
4786
|
+
if (!year || !month || !day) return value;
|
|
4787
|
+
if (dateInDashes) {
|
|
4788
|
+
return `${month}-${day}-${year}`;
|
|
4789
|
+
}
|
|
4790
|
+
return `${month}/${day}/${year}`;
|
|
4791
|
+
}
|
|
4792
|
+
function parseInputDateWithDashes(value, dateInDashes) {
|
|
4793
|
+
if (!value) return "";
|
|
4794
|
+
let year = "", month = "", day = "";
|
|
4795
|
+
if (dateInDashes) {
|
|
4796
|
+
let match = value.match(/^(\d{2})-(\d{2})-(\d{4})$/);
|
|
4797
|
+
if (match) {
|
|
4798
|
+
[, month, day, year] = match;
|
|
4799
|
+
} else {
|
|
4800
|
+
match = value.match(/^(\d{4})-(\d{2})-(\d{2})$/);
|
|
4801
|
+
if (match) {
|
|
4802
|
+
[, year, month, day] = match;
|
|
4803
|
+
}
|
|
4804
|
+
}
|
|
4805
|
+
} else {
|
|
4806
|
+
const match = value.match(/^(\d{2})\/(\d{2})\/(\d{4})$/);
|
|
4807
|
+
if (match) {
|
|
4808
|
+
[, month, day, year] = match;
|
|
4809
|
+
}
|
|
4810
|
+
}
|
|
4811
|
+
if (!year || !month || !day) return "";
|
|
4812
|
+
return `${month}-${day}-${year}`;
|
|
4813
|
+
}
|
|
4814
|
+
|
|
4777
4815
|
// src/components/DateInput.tsx
|
|
4778
4816
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
4779
4817
|
var DateInput = (_a) => {
|
|
@@ -4787,7 +4825,8 @@ var DateInput = (_a) => {
|
|
|
4787
4825
|
readOnly = false,
|
|
4788
4826
|
label,
|
|
4789
4827
|
isDateAvailable,
|
|
4790
|
-
disableManualInput
|
|
4828
|
+
disableManualInput,
|
|
4829
|
+
dateInDashes = false
|
|
4791
4830
|
} = _b, props = __objRest(_b, [
|
|
4792
4831
|
"id",
|
|
4793
4832
|
"testid",
|
|
@@ -4798,7 +4837,8 @@ var DateInput = (_a) => {
|
|
|
4798
4837
|
"readOnly",
|
|
4799
4838
|
"label",
|
|
4800
4839
|
"isDateAvailable",
|
|
4801
|
-
"disableManualInput"
|
|
4840
|
+
"disableManualInput",
|
|
4841
|
+
"dateInDashes"
|
|
4802
4842
|
]);
|
|
4803
4843
|
const [visible, setVisible] = (0, import_react19.useState)(false);
|
|
4804
4844
|
const [inputValue, setInputValue] = (0, import_react19.useState)("");
|
|
@@ -4814,9 +4854,9 @@ var DateInput = (_a) => {
|
|
|
4814
4854
|
const [from, to] = [value, ""];
|
|
4815
4855
|
(0, import_react19.useEffect)(() => {
|
|
4816
4856
|
if (!isTyping) {
|
|
4817
|
-
setInputValue(formatDisplayValue(from));
|
|
4857
|
+
setInputValue(formatDisplayValue(from, dateInDashes));
|
|
4818
4858
|
}
|
|
4819
|
-
}, [from, isTyping]);
|
|
4859
|
+
}, [from, isTyping, dateInDashes]);
|
|
4820
4860
|
(0, import_react19.useLayoutEffect)(() => {
|
|
4821
4861
|
if (visible) {
|
|
4822
4862
|
updatePosition();
|
|
@@ -4879,7 +4919,7 @@ var DateInput = (_a) => {
|
|
|
4879
4919
|
const rawValue = event.target.value;
|
|
4880
4920
|
const cursorPosition = event.target.selectionStart || 0;
|
|
4881
4921
|
setIsTyping(true);
|
|
4882
|
-
const formattedValue =
|
|
4922
|
+
const formattedValue = formatInputValueWithDashes(rawValue, dateInDashes);
|
|
4883
4923
|
setInputValue(formattedValue);
|
|
4884
4924
|
requestAnimationFrame(() => {
|
|
4885
4925
|
if (triggerRef.current) {
|
|
@@ -4891,16 +4931,16 @@ var DateInput = (_a) => {
|
|
|
4891
4931
|
triggerRef.current.setSelectionRange(newPosition, newPosition);
|
|
4892
4932
|
}
|
|
4893
4933
|
});
|
|
4894
|
-
const parsedDate =
|
|
4934
|
+
const parsedDate = parseInputDateWithDashes(formattedValue, dateInDashes);
|
|
4895
4935
|
if (parsedDate && isValidDate(parsedDate)) {
|
|
4896
4936
|
onChange(parsedDate);
|
|
4897
4937
|
}
|
|
4898
4938
|
};
|
|
4899
4939
|
const handleBlur = () => {
|
|
4900
4940
|
setIsTyping(false);
|
|
4901
|
-
const parsedDate =
|
|
4941
|
+
const parsedDate = parseInputDateWithDashes(inputValue, dateInDashes);
|
|
4902
4942
|
if (!parsedDate || !isValidDate(parsedDate)) {
|
|
4903
|
-
setInputValue(formatDisplayValue(from));
|
|
4943
|
+
setInputValue(formatDisplayValue(from, dateInDashes));
|
|
4904
4944
|
}
|
|
4905
4945
|
};
|
|
4906
4946
|
const handleKeyDown = (event) => {
|
|
@@ -4908,10 +4948,11 @@ var DateInput = (_a) => {
|
|
|
4908
4948
|
const input = event.target;
|
|
4909
4949
|
const cursorPosition = input.selectionStart || 0;
|
|
4910
4950
|
const value2 = input.value;
|
|
4911
|
-
|
|
4951
|
+
const sep = dateInDashes ? "-" : "/";
|
|
4952
|
+
if (cursorPosition > 0 && value2[cursorPosition - 1] === sep) {
|
|
4912
4953
|
event.preventDefault();
|
|
4913
4954
|
const newValue = value2.slice(0, cursorPosition - 2) + value2.slice(cursorPosition);
|
|
4914
|
-
const formattedValue =
|
|
4955
|
+
const formattedValue = formatInputValueWithDashes(newValue, dateInDashes);
|
|
4915
4956
|
setInputValue(formattedValue);
|
|
4916
4957
|
requestAnimationFrame(() => {
|
|
4917
4958
|
if (triggerRef.current) {
|
|
@@ -4924,7 +4965,7 @@ var DateInput = (_a) => {
|
|
|
4924
4965
|
}
|
|
4925
4966
|
}
|
|
4926
4967
|
if (event.key === "Enter") {
|
|
4927
|
-
const parsedDate =
|
|
4968
|
+
const parsedDate = parseInputDateWithDashes(inputValue, dateInDashes);
|
|
4928
4969
|
if (parsedDate && isValidDate(parsedDate)) {
|
|
4929
4970
|
onChange(parsedDate);
|
|
4930
4971
|
setVisible(false);
|
|
@@ -5013,14 +5054,14 @@ var DateInput = (_a) => {
|
|
|
5013
5054
|
] });
|
|
5014
5055
|
};
|
|
5015
5056
|
DateInput.displayName = "DateInput";
|
|
5016
|
-
function formatDisplayValue(from) {
|
|
5057
|
+
function formatDisplayValue(from, dateInDashes) {
|
|
5017
5058
|
if (!from) {
|
|
5018
5059
|
return "";
|
|
5019
5060
|
}
|
|
5020
5061
|
if (!isValidDate(from)) {
|
|
5021
5062
|
return "";
|
|
5022
5063
|
}
|
|
5023
|
-
return
|
|
5064
|
+
return formatDateWithDashes(from, dateInDashes);
|
|
5024
5065
|
}
|
|
5025
5066
|
|
|
5026
5067
|
// src/components/Accordion.tsx
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ColumnSelectorHeaderCell
|
|
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";
|
|
@@ -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
|
}
|
|
@@ -3232,6 +3212,10 @@ function DataGrid({
|
|
|
3232
3212
|
(0, import_core.useSensor)(import_core.KeyboardSensor)
|
|
3233
3213
|
);
|
|
3234
3214
|
const visibleColumns = table.getVisibleLeafColumns();
|
|
3215
|
+
const nonPinnedColumnIds = table.getCenterLeafColumns().map((col) => col.id);
|
|
3216
|
+
const sortableColumnOrder = columnOrder.filter(
|
|
3217
|
+
(id2) => nonPinnedColumnIds.includes(id2)
|
|
3218
|
+
);
|
|
3235
3219
|
const columnVirtualizer = (0, import_react_virtual2.useVirtualizer)({
|
|
3236
3220
|
count: visibleColumns.length,
|
|
3237
3221
|
estimateSize: (index) => visibleColumns[index].getSize(),
|
|
@@ -3260,7 +3244,7 @@ function DataGrid({
|
|
|
3260
3244
|
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3261
3245
|
import_sortable2.SortableContext,
|
|
3262
3246
|
{
|
|
3263
|
-
items:
|
|
3247
|
+
items: sortableColumnOrder,
|
|
3264
3248
|
strategy: import_sortable2.horizontalListSortingStrategy,
|
|
3265
3249
|
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
3266
3250
|
"div",
|
|
@@ -4619,6 +4603,60 @@ function CalendarPane({
|
|
|
4619
4603
|
] }, month.name + month.year);
|
|
4620
4604
|
}
|
|
4621
4605
|
|
|
4606
|
+
// src/utils/date-patch-dashes.ts
|
|
4607
|
+
function formatInputValueWithDashes(value, dateInDashes) {
|
|
4608
|
+
const digits = value.replace(/\D/g, "");
|
|
4609
|
+
if (dateInDashes) {
|
|
4610
|
+
if (digits.length <= 4) return digits;
|
|
4611
|
+
if (digits.length <= 6) return `${digits.slice(0, 4)}-${digits.slice(4)}`;
|
|
4612
|
+
return `${digits.slice(4, 6)}-${digits.slice(6, 8)}-${digits.slice(0, 4)}`;
|
|
4613
|
+
} else {
|
|
4614
|
+
if (digits.length <= 2) return digits;
|
|
4615
|
+
if (digits.length <= 4) return `${digits.slice(0, 2)}/${digits.slice(2)}`;
|
|
4616
|
+
return `${digits.slice(0, 2)}/${digits.slice(2, 4)}/${digits.slice(4, 8)}`;
|
|
4617
|
+
}
|
|
4618
|
+
}
|
|
4619
|
+
function formatDateWithDashes(value, dateInDashes) {
|
|
4620
|
+
if (!value) return "";
|
|
4621
|
+
let year = "", month = "", day = "";
|
|
4622
|
+
if (/^\d{4}-\d{2}-\d{2}$/.test(value)) {
|
|
4623
|
+
[year, month, day] = value.split("-");
|
|
4624
|
+
} else if (/^\d{2}-\d{2}-\d{4}$/.test(value)) {
|
|
4625
|
+
[month, day, year] = value.split("-");
|
|
4626
|
+
} else if (/^\d{2}\/\d{2}\/\d{4}$/.test(value)) {
|
|
4627
|
+
[month, day, year] = value.split("/");
|
|
4628
|
+
} else {
|
|
4629
|
+
return value;
|
|
4630
|
+
}
|
|
4631
|
+
if (!year || !month || !day) return value;
|
|
4632
|
+
if (dateInDashes) {
|
|
4633
|
+
return `${month}-${day}-${year}`;
|
|
4634
|
+
}
|
|
4635
|
+
return `${month}/${day}/${year}`;
|
|
4636
|
+
}
|
|
4637
|
+
function parseInputDateWithDashes(value, dateInDashes) {
|
|
4638
|
+
if (!value) return "";
|
|
4639
|
+
let year = "", month = "", day = "";
|
|
4640
|
+
if (dateInDashes) {
|
|
4641
|
+
let match = value.match(/^(\d{2})-(\d{2})-(\d{4})$/);
|
|
4642
|
+
if (match) {
|
|
4643
|
+
[, month, day, year] = match;
|
|
4644
|
+
} else {
|
|
4645
|
+
match = value.match(/^(\d{4})-(\d{2})-(\d{2})$/);
|
|
4646
|
+
if (match) {
|
|
4647
|
+
[, year, month, day] = match;
|
|
4648
|
+
}
|
|
4649
|
+
}
|
|
4650
|
+
} else {
|
|
4651
|
+
const match = value.match(/^(\d{2})\/(\d{2})\/(\d{4})$/);
|
|
4652
|
+
if (match) {
|
|
4653
|
+
[, month, day, year] = match;
|
|
4654
|
+
}
|
|
4655
|
+
}
|
|
4656
|
+
if (!year || !month || !day) return "";
|
|
4657
|
+
return `${month}-${day}-${year}`;
|
|
4658
|
+
}
|
|
4659
|
+
|
|
4622
4660
|
// src/components/DateInput.tsx
|
|
4623
4661
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
4624
4662
|
var DateInput = (_a) => {
|
|
@@ -4632,7 +4670,8 @@ var DateInput = (_a) => {
|
|
|
4632
4670
|
readOnly = false,
|
|
4633
4671
|
label,
|
|
4634
4672
|
isDateAvailable,
|
|
4635
|
-
disableManualInput
|
|
4673
|
+
disableManualInput,
|
|
4674
|
+
dateInDashes = false
|
|
4636
4675
|
} = _b, props = __objRest(_b, [
|
|
4637
4676
|
"id",
|
|
4638
4677
|
"testid",
|
|
@@ -4643,7 +4682,8 @@ var DateInput = (_a) => {
|
|
|
4643
4682
|
"readOnly",
|
|
4644
4683
|
"label",
|
|
4645
4684
|
"isDateAvailable",
|
|
4646
|
-
"disableManualInput"
|
|
4685
|
+
"disableManualInput",
|
|
4686
|
+
"dateInDashes"
|
|
4647
4687
|
]);
|
|
4648
4688
|
const [visible, setVisible] = (0, import_react18.useState)(false);
|
|
4649
4689
|
const [inputValue, setInputValue] = (0, import_react18.useState)("");
|
|
@@ -4659,9 +4699,9 @@ var DateInput = (_a) => {
|
|
|
4659
4699
|
const [from, to] = [value, ""];
|
|
4660
4700
|
(0, import_react18.useEffect)(() => {
|
|
4661
4701
|
if (!isTyping) {
|
|
4662
|
-
setInputValue(formatDisplayValue(from));
|
|
4702
|
+
setInputValue(formatDisplayValue(from, dateInDashes));
|
|
4663
4703
|
}
|
|
4664
|
-
}, [from, isTyping]);
|
|
4704
|
+
}, [from, isTyping, dateInDashes]);
|
|
4665
4705
|
(0, import_react18.useLayoutEffect)(() => {
|
|
4666
4706
|
if (visible) {
|
|
4667
4707
|
updatePosition();
|
|
@@ -4724,7 +4764,7 @@ var DateInput = (_a) => {
|
|
|
4724
4764
|
const rawValue = event.target.value;
|
|
4725
4765
|
const cursorPosition = event.target.selectionStart || 0;
|
|
4726
4766
|
setIsTyping(true);
|
|
4727
|
-
const formattedValue =
|
|
4767
|
+
const formattedValue = formatInputValueWithDashes(rawValue, dateInDashes);
|
|
4728
4768
|
setInputValue(formattedValue);
|
|
4729
4769
|
requestAnimationFrame(() => {
|
|
4730
4770
|
if (triggerRef.current) {
|
|
@@ -4736,16 +4776,16 @@ var DateInput = (_a) => {
|
|
|
4736
4776
|
triggerRef.current.setSelectionRange(newPosition, newPosition);
|
|
4737
4777
|
}
|
|
4738
4778
|
});
|
|
4739
|
-
const parsedDate =
|
|
4779
|
+
const parsedDate = parseInputDateWithDashes(formattedValue, dateInDashes);
|
|
4740
4780
|
if (parsedDate && isValidDate(parsedDate)) {
|
|
4741
4781
|
onChange(parsedDate);
|
|
4742
4782
|
}
|
|
4743
4783
|
};
|
|
4744
4784
|
const handleBlur = () => {
|
|
4745
4785
|
setIsTyping(false);
|
|
4746
|
-
const parsedDate =
|
|
4786
|
+
const parsedDate = parseInputDateWithDashes(inputValue, dateInDashes);
|
|
4747
4787
|
if (!parsedDate || !isValidDate(parsedDate)) {
|
|
4748
|
-
setInputValue(formatDisplayValue(from));
|
|
4788
|
+
setInputValue(formatDisplayValue(from, dateInDashes));
|
|
4749
4789
|
}
|
|
4750
4790
|
};
|
|
4751
4791
|
const handleKeyDown = (event) => {
|
|
@@ -4753,10 +4793,11 @@ var DateInput = (_a) => {
|
|
|
4753
4793
|
const input = event.target;
|
|
4754
4794
|
const cursorPosition = input.selectionStart || 0;
|
|
4755
4795
|
const value2 = input.value;
|
|
4756
|
-
|
|
4796
|
+
const sep = dateInDashes ? "-" : "/";
|
|
4797
|
+
if (cursorPosition > 0 && value2[cursorPosition - 1] === sep) {
|
|
4757
4798
|
event.preventDefault();
|
|
4758
4799
|
const newValue = value2.slice(0, cursorPosition - 2) + value2.slice(cursorPosition);
|
|
4759
|
-
const formattedValue =
|
|
4800
|
+
const formattedValue = formatInputValueWithDashes(newValue, dateInDashes);
|
|
4760
4801
|
setInputValue(formattedValue);
|
|
4761
4802
|
requestAnimationFrame(() => {
|
|
4762
4803
|
if (triggerRef.current) {
|
|
@@ -4769,7 +4810,7 @@ var DateInput = (_a) => {
|
|
|
4769
4810
|
}
|
|
4770
4811
|
}
|
|
4771
4812
|
if (event.key === "Enter") {
|
|
4772
|
-
const parsedDate =
|
|
4813
|
+
const parsedDate = parseInputDateWithDashes(inputValue, dateInDashes);
|
|
4773
4814
|
if (parsedDate && isValidDate(parsedDate)) {
|
|
4774
4815
|
onChange(parsedDate);
|
|
4775
4816
|
setVisible(false);
|
|
@@ -4858,14 +4899,14 @@ var DateInput = (_a) => {
|
|
|
4858
4899
|
] });
|
|
4859
4900
|
};
|
|
4860
4901
|
DateInput.displayName = "DateInput";
|
|
4861
|
-
function formatDisplayValue(from) {
|
|
4902
|
+
function formatDisplayValue(from, dateInDashes) {
|
|
4862
4903
|
if (!from) {
|
|
4863
4904
|
return "";
|
|
4864
4905
|
}
|
|
4865
4906
|
if (!isValidDate(from)) {
|
|
4866
4907
|
return "";
|
|
4867
4908
|
}
|
|
4868
|
-
return
|
|
4909
|
+
return formatDateWithDashes(from, dateInDashes);
|
|
4869
4910
|
}
|
|
4870
4911
|
|
|
4871
4912
|
// src/components/Accordion.tsx
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
PinnedColumns
|
|
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";
|
|
@@ -475,30 +475,10 @@ function formatCurrencyDisplay(value) {
|
|
|
475
475
|
}
|
|
476
476
|
|
|
477
477
|
// src/utils/date.ts
|
|
478
|
-
function parseInputDate(input) {
|
|
479
|
-
const match = input.match(/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/);
|
|
480
|
-
if (!match) {
|
|
481
|
-
return null;
|
|
482
|
-
}
|
|
483
|
-
const [, month, day, year] = match;
|
|
484
|
-
const paddedMonth = month.padStart(2, "0");
|
|
485
|
-
const paddedDay = day.padStart(2, "0");
|
|
486
|
-
return `${year}-${paddedMonth}-${paddedDay}`;
|
|
487
|
-
}
|
|
488
478
|
function isValidDate(dateString) {
|
|
489
479
|
const date = new Date(dateString);
|
|
490
480
|
return date instanceof Date && !isNaN(date.getTime()) && dateString === date.toISOString().split("T")[0];
|
|
491
481
|
}
|
|
492
|
-
function formatInputValue(value) {
|
|
493
|
-
const digits = value.replace(/\D/g, "");
|
|
494
|
-
if (digits.length < 2) {
|
|
495
|
-
return digits;
|
|
496
|
-
}
|
|
497
|
-
if (digits.length >= 4) {
|
|
498
|
-
return `${digits.slice(0, 2)}/${digits.slice(2, 4)}/${digits.slice(4, 8)}`;
|
|
499
|
-
}
|
|
500
|
-
return `${digits.slice(0, 2)}/${digits.slice(2)}`;
|
|
501
|
-
}
|
|
502
482
|
function isDigit(character) {
|
|
503
483
|
return /\d/.test(character);
|
|
504
484
|
}
|
|
@@ -3457,6 +3437,10 @@ function DataGrid({
|
|
|
3457
3437
|
(0, import_core.useSensor)(import_core.KeyboardSensor)
|
|
3458
3438
|
);
|
|
3459
3439
|
const visibleColumns = table.getVisibleLeafColumns();
|
|
3440
|
+
const nonPinnedColumnIds = table.getCenterLeafColumns().map((col) => col.id);
|
|
3441
|
+
const sortableColumnOrder = columnOrder.filter(
|
|
3442
|
+
(id2) => nonPinnedColumnIds.includes(id2)
|
|
3443
|
+
);
|
|
3460
3444
|
const columnVirtualizer = (0, import_react_virtual2.useVirtualizer)({
|
|
3461
3445
|
count: visibleColumns.length,
|
|
3462
3446
|
estimateSize: (index) => visibleColumns[index].getSize(),
|
|
@@ -3485,7 +3469,7 @@ function DataGrid({
|
|
|
3485
3469
|
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3486
3470
|
import_sortable2.SortableContext,
|
|
3487
3471
|
{
|
|
3488
|
-
items:
|
|
3472
|
+
items: sortableColumnOrder,
|
|
3489
3473
|
strategy: import_sortable2.horizontalListSortingStrategy,
|
|
3490
3474
|
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
3491
3475
|
"div",
|
|
@@ -4844,6 +4828,60 @@ function CalendarPane({
|
|
|
4844
4828
|
] }, month.name + month.year);
|
|
4845
4829
|
}
|
|
4846
4830
|
|
|
4831
|
+
// src/utils/date-patch-dashes.ts
|
|
4832
|
+
function formatInputValueWithDashes(value, dateInDashes) {
|
|
4833
|
+
const digits = value.replace(/\D/g, "");
|
|
4834
|
+
if (dateInDashes) {
|
|
4835
|
+
if (digits.length <= 4) return digits;
|
|
4836
|
+
if (digits.length <= 6) return `${digits.slice(0, 4)}-${digits.slice(4)}`;
|
|
4837
|
+
return `${digits.slice(4, 6)}-${digits.slice(6, 8)}-${digits.slice(0, 4)}`;
|
|
4838
|
+
} else {
|
|
4839
|
+
if (digits.length <= 2) return digits;
|
|
4840
|
+
if (digits.length <= 4) return `${digits.slice(0, 2)}/${digits.slice(2)}`;
|
|
4841
|
+
return `${digits.slice(0, 2)}/${digits.slice(2, 4)}/${digits.slice(4, 8)}`;
|
|
4842
|
+
}
|
|
4843
|
+
}
|
|
4844
|
+
function formatDateWithDashes(value, dateInDashes) {
|
|
4845
|
+
if (!value) return "";
|
|
4846
|
+
let year = "", month = "", day = "";
|
|
4847
|
+
if (/^\d{4}-\d{2}-\d{2}$/.test(value)) {
|
|
4848
|
+
[year, month, day] = value.split("-");
|
|
4849
|
+
} else if (/^\d{2}-\d{2}-\d{4}$/.test(value)) {
|
|
4850
|
+
[month, day, year] = value.split("-");
|
|
4851
|
+
} else if (/^\d{2}\/\d{2}\/\d{4}$/.test(value)) {
|
|
4852
|
+
[month, day, year] = value.split("/");
|
|
4853
|
+
} else {
|
|
4854
|
+
return value;
|
|
4855
|
+
}
|
|
4856
|
+
if (!year || !month || !day) return value;
|
|
4857
|
+
if (dateInDashes) {
|
|
4858
|
+
return `${month}-${day}-${year}`;
|
|
4859
|
+
}
|
|
4860
|
+
return `${month}/${day}/${year}`;
|
|
4861
|
+
}
|
|
4862
|
+
function parseInputDateWithDashes(value, dateInDashes) {
|
|
4863
|
+
if (!value) return "";
|
|
4864
|
+
let year = "", month = "", day = "";
|
|
4865
|
+
if (dateInDashes) {
|
|
4866
|
+
let match = value.match(/^(\d{2})-(\d{2})-(\d{4})$/);
|
|
4867
|
+
if (match) {
|
|
4868
|
+
[, month, day, year] = match;
|
|
4869
|
+
} else {
|
|
4870
|
+
match = value.match(/^(\d{4})-(\d{2})-(\d{2})$/);
|
|
4871
|
+
if (match) {
|
|
4872
|
+
[, year, month, day] = match;
|
|
4873
|
+
}
|
|
4874
|
+
}
|
|
4875
|
+
} else {
|
|
4876
|
+
const match = value.match(/^(\d{2})\/(\d{2})\/(\d{4})$/);
|
|
4877
|
+
if (match) {
|
|
4878
|
+
[, month, day, year] = match;
|
|
4879
|
+
}
|
|
4880
|
+
}
|
|
4881
|
+
if (!year || !month || !day) return "";
|
|
4882
|
+
return `${month}-${day}-${year}`;
|
|
4883
|
+
}
|
|
4884
|
+
|
|
4847
4885
|
// src/components/DateInput.tsx
|
|
4848
4886
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
4849
4887
|
var DateInput = (_a) => {
|
|
@@ -4857,7 +4895,8 @@ var DateInput = (_a) => {
|
|
|
4857
4895
|
readOnly = false,
|
|
4858
4896
|
label,
|
|
4859
4897
|
isDateAvailable,
|
|
4860
|
-
disableManualInput
|
|
4898
|
+
disableManualInput,
|
|
4899
|
+
dateInDashes = false
|
|
4861
4900
|
} = _b, props = __objRest(_b, [
|
|
4862
4901
|
"id",
|
|
4863
4902
|
"testid",
|
|
@@ -4868,7 +4907,8 @@ var DateInput = (_a) => {
|
|
|
4868
4907
|
"readOnly",
|
|
4869
4908
|
"label",
|
|
4870
4909
|
"isDateAvailable",
|
|
4871
|
-
"disableManualInput"
|
|
4910
|
+
"disableManualInput",
|
|
4911
|
+
"dateInDashes"
|
|
4872
4912
|
]);
|
|
4873
4913
|
const [visible, setVisible] = (0, import_react21.useState)(false);
|
|
4874
4914
|
const [inputValue, setInputValue] = (0, import_react21.useState)("");
|
|
@@ -4884,9 +4924,9 @@ var DateInput = (_a) => {
|
|
|
4884
4924
|
const [from, to] = [value, ""];
|
|
4885
4925
|
(0, import_react21.useEffect)(() => {
|
|
4886
4926
|
if (!isTyping) {
|
|
4887
|
-
setInputValue(formatDisplayValue(from));
|
|
4927
|
+
setInputValue(formatDisplayValue(from, dateInDashes));
|
|
4888
4928
|
}
|
|
4889
|
-
}, [from, isTyping]);
|
|
4929
|
+
}, [from, isTyping, dateInDashes]);
|
|
4890
4930
|
(0, import_react21.useLayoutEffect)(() => {
|
|
4891
4931
|
if (visible) {
|
|
4892
4932
|
updatePosition();
|
|
@@ -4949,7 +4989,7 @@ var DateInput = (_a) => {
|
|
|
4949
4989
|
const rawValue = event.target.value;
|
|
4950
4990
|
const cursorPosition = event.target.selectionStart || 0;
|
|
4951
4991
|
setIsTyping(true);
|
|
4952
|
-
const formattedValue =
|
|
4992
|
+
const formattedValue = formatInputValueWithDashes(rawValue, dateInDashes);
|
|
4953
4993
|
setInputValue(formattedValue);
|
|
4954
4994
|
requestAnimationFrame(() => {
|
|
4955
4995
|
if (triggerRef.current) {
|
|
@@ -4961,16 +5001,16 @@ var DateInput = (_a) => {
|
|
|
4961
5001
|
triggerRef.current.setSelectionRange(newPosition, newPosition);
|
|
4962
5002
|
}
|
|
4963
5003
|
});
|
|
4964
|
-
const parsedDate =
|
|
5004
|
+
const parsedDate = parseInputDateWithDashes(formattedValue, dateInDashes);
|
|
4965
5005
|
if (parsedDate && isValidDate(parsedDate)) {
|
|
4966
5006
|
onChange(parsedDate);
|
|
4967
5007
|
}
|
|
4968
5008
|
};
|
|
4969
5009
|
const handleBlur = () => {
|
|
4970
5010
|
setIsTyping(false);
|
|
4971
|
-
const parsedDate =
|
|
5011
|
+
const parsedDate = parseInputDateWithDashes(inputValue, dateInDashes);
|
|
4972
5012
|
if (!parsedDate || !isValidDate(parsedDate)) {
|
|
4973
|
-
setInputValue(formatDisplayValue(from));
|
|
5013
|
+
setInputValue(formatDisplayValue(from, dateInDashes));
|
|
4974
5014
|
}
|
|
4975
5015
|
};
|
|
4976
5016
|
const handleKeyDown = (event) => {
|
|
@@ -4978,10 +5018,11 @@ var DateInput = (_a) => {
|
|
|
4978
5018
|
const input = event.target;
|
|
4979
5019
|
const cursorPosition = input.selectionStart || 0;
|
|
4980
5020
|
const value2 = input.value;
|
|
4981
|
-
|
|
5021
|
+
const sep = dateInDashes ? "-" : "/";
|
|
5022
|
+
if (cursorPosition > 0 && value2[cursorPosition - 1] === sep) {
|
|
4982
5023
|
event.preventDefault();
|
|
4983
5024
|
const newValue = value2.slice(0, cursorPosition - 2) + value2.slice(cursorPosition);
|
|
4984
|
-
const formattedValue =
|
|
5025
|
+
const formattedValue = formatInputValueWithDashes(newValue, dateInDashes);
|
|
4985
5026
|
setInputValue(formattedValue);
|
|
4986
5027
|
requestAnimationFrame(() => {
|
|
4987
5028
|
if (triggerRef.current) {
|
|
@@ -4994,7 +5035,7 @@ var DateInput = (_a) => {
|
|
|
4994
5035
|
}
|
|
4995
5036
|
}
|
|
4996
5037
|
if (event.key === "Enter") {
|
|
4997
|
-
const parsedDate =
|
|
5038
|
+
const parsedDate = parseInputDateWithDashes(inputValue, dateInDashes);
|
|
4998
5039
|
if (parsedDate && isValidDate(parsedDate)) {
|
|
4999
5040
|
onChange(parsedDate);
|
|
5000
5041
|
setVisible(false);
|
|
@@ -5083,14 +5124,14 @@ var DateInput = (_a) => {
|
|
|
5083
5124
|
] });
|
|
5084
5125
|
};
|
|
5085
5126
|
DateInput.displayName = "DateInput";
|
|
5086
|
-
function formatDisplayValue(from) {
|
|
5127
|
+
function formatDisplayValue(from, dateInDashes) {
|
|
5087
5128
|
if (!from) {
|
|
5088
5129
|
return "";
|
|
5089
5130
|
}
|
|
5090
5131
|
if (!isValidDate(from)) {
|
|
5091
5132
|
return "";
|
|
5092
5133
|
}
|
|
5093
|
-
return
|
|
5134
|
+
return formatDateWithDashes(from, dateInDashes);
|
|
5094
5135
|
}
|
|
5095
5136
|
|
|
5096
5137
|
// src/components/Accordion.tsx
|