@ceed/cds 1.40.3-next.6 → 1.40.3-next.7
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/components/DataTable/utils.d.ts +6 -0
- package/dist/index.browser.js +6 -6
- package/dist/index.browser.js.map +3 -3
- package/dist/index.cjs +23 -11
- package/dist/index.js +151 -139
- package/dist/libs/slot-props.d.ts +2 -2
- package/framer/index.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -187,7 +187,7 @@ function Alert(inProps) {
|
|
|
187
187
|
Alert.displayName = "Alert";
|
|
188
188
|
|
|
189
189
|
// src/components/Autocomplete/Autocomplete.tsx
|
|
190
|
-
import React5, { useCallback as
|
|
190
|
+
import React5, { useCallback as useCallback3, useEffect as useEffect2, useMemo as useMemo2, useRef as useRef3 } from "react";
|
|
191
191
|
import {
|
|
192
192
|
Autocomplete as JoyAutocomplete,
|
|
193
193
|
AutocompleteOption as JoyAutocompleteOption,
|
|
@@ -295,7 +295,7 @@ function useControlledState(controlledValue, defaultValue, onChange) {
|
|
|
295
295
|
}
|
|
296
296
|
|
|
297
297
|
// src/libs/slot-props.ts
|
|
298
|
-
import { useMemo } from "react";
|
|
298
|
+
import { useCallback as useCallback2, useMemo, useRef as useRef2 } from "react";
|
|
299
299
|
function assignRef(ref, value) {
|
|
300
300
|
if (typeof ref === "function") ref(value);
|
|
301
301
|
else if (ref) ref.current = value;
|
|
@@ -313,16 +313,25 @@ function useSlotRef(slotProp, ref) {
|
|
|
313
313
|
const isFunctionForm = typeof slotProp === "function";
|
|
314
314
|
const slotRef = isFunctionForm ? void 0 : slotProp?.ref;
|
|
315
315
|
const mergedRef = useMergedRef(slotRef, ref);
|
|
316
|
+
const latestSlotRef = useRef2(null);
|
|
317
|
+
const stableMergedRef = useCallback2(
|
|
318
|
+
(value) => {
|
|
319
|
+
assignRef(latestSlotRef.current, value);
|
|
320
|
+
assignRef(ref, value);
|
|
321
|
+
},
|
|
322
|
+
[ref]
|
|
323
|
+
);
|
|
316
324
|
return useMemo(() => {
|
|
317
325
|
if (isFunctionForm) {
|
|
318
326
|
return ((ownerState) => {
|
|
319
327
|
const resolved = slotProp(ownerState) ?? {};
|
|
320
|
-
const
|
|
321
|
-
|
|
328
|
+
const resolvedRef = resolved.ref;
|
|
329
|
+
latestSlotRef.current = resolvedRef ?? null;
|
|
330
|
+
return resolvedRef || ref ? { ...resolved, ref: stableMergedRef } : { ...resolved };
|
|
322
331
|
});
|
|
323
332
|
}
|
|
324
333
|
return mergedRef ? { ...slotProp, ref: mergedRef } : { ...slotProp };
|
|
325
|
-
}, [isFunctionForm, slotProp, mergedRef, ref]);
|
|
334
|
+
}, [isFunctionForm, slotProp, mergedRef, ref, stableMergedRef]);
|
|
326
335
|
}
|
|
327
336
|
|
|
328
337
|
// src/components/Autocomplete/Autocomplete.tsx
|
|
@@ -347,7 +356,7 @@ var AutocompleteListBox = React5.forwardRef((props, ref) => {
|
|
|
347
356
|
ownerState: { loading, size: fontSize = "md" },
|
|
348
357
|
...innerProps
|
|
349
358
|
} = props;
|
|
350
|
-
const parentRef =
|
|
359
|
+
const parentRef = useRef3(null);
|
|
351
360
|
const isGrouped = children[0].every((child) => child.hasOwnProperty("group"));
|
|
352
361
|
const itemHeight = useMemo2(() => {
|
|
353
362
|
const heights = itemHeightMap[fontSize ?? "md"];
|
|
@@ -464,7 +473,7 @@ function AutocompleteInner(props, ref) {
|
|
|
464
473
|
const [rawValue, setValue] = useControlledState(
|
|
465
474
|
props.value,
|
|
466
475
|
props.defaultValue ?? null,
|
|
467
|
-
|
|
476
|
+
useCallback3(
|
|
468
477
|
(value2) => onChange?.({
|
|
469
478
|
target: {
|
|
470
479
|
value: value2,
|
|
@@ -507,7 +516,7 @@ function AutocompleteInner(props, ref) {
|
|
|
507
516
|
}
|
|
508
517
|
return optionMap.get(_value);
|
|
509
518
|
}, [_value, optionMap, props.loading]);
|
|
510
|
-
const applySize =
|
|
519
|
+
const applySize = useCallback3(
|
|
511
520
|
(node) => {
|
|
512
521
|
return React5.isValidElement(node) && !props.loading ? React5.cloneElement(node, { ...{ size } }) : node;
|
|
513
522
|
},
|
|
@@ -533,7 +542,7 @@ function AutocompleteInner(props, ref) {
|
|
|
533
542
|
}),
|
|
534
543
|
[options, props.slotProps, inputSlotProps]
|
|
535
544
|
);
|
|
536
|
-
const handleChange =
|
|
545
|
+
const handleChange = useCallback3(
|
|
537
546
|
(event, value2) => {
|
|
538
547
|
const newValue = value2;
|
|
539
548
|
const _value2 = Array.isArray(newValue) ? newValue.map((value3) => value3.value) : newValue?.value;
|
|
@@ -696,7 +705,7 @@ var MenuItem = JoyMenuItem;
|
|
|
696
705
|
var Menu_default = Menu;
|
|
697
706
|
|
|
698
707
|
// src/components/Dropdown/Dropdown.tsx
|
|
699
|
-
import React8, { createContext, useCallback as
|
|
708
|
+
import React8, { createContext, useCallback as useCallback4, useMemo as useMemo4, useState as useState2 } from "react";
|
|
700
709
|
import { Dropdown as JoyDropdown } from "@mui/joy";
|
|
701
710
|
import { MenuButton } from "@mui/joy";
|
|
702
711
|
import { useMenuButton } from "@mui/base/useMenuButton";
|
|
@@ -711,7 +720,7 @@ function Dropdown({ open: openProp, defaultOpen = false, onOpenChange, ...rest }
|
|
|
711
720
|
}),
|
|
712
721
|
[]
|
|
713
722
|
);
|
|
714
|
-
const handleOpenChange =
|
|
723
|
+
const handleOpenChange = useCallback4(
|
|
715
724
|
(event, isOpen) => {
|
|
716
725
|
if (nestedCount > 0 && !isOpen && event?.type === "blur") {
|
|
717
726
|
return;
|
|
@@ -774,7 +783,7 @@ Button.displayName = "Button";
|
|
|
774
783
|
var Button_default = Button;
|
|
775
784
|
|
|
776
785
|
// src/components/Calendar/Calendar.tsx
|
|
777
|
-
import React13, { Fragment, forwardRef as forwardRef4, useCallback as
|
|
786
|
+
import React13, { Fragment, forwardRef as forwardRef4, useCallback as useCallback7, useEffect as useEffect3, useMemo as useMemo6, useRef as useRef4, useState as useState5 } from "react";
|
|
778
787
|
import { styled as styled5 } from "@mui/joy";
|
|
779
788
|
import ChevronLeftIcon from "@mui/icons-material/ChevronLeft";
|
|
780
789
|
import ChevronRightIcon from "@mui/icons-material/ChevronRight";
|
|
@@ -868,7 +877,7 @@ var isSameMonth = (date1, date2) => {
|
|
|
868
877
|
};
|
|
869
878
|
|
|
870
879
|
// src/components/Calendar/hooks/use-calendar-props.ts
|
|
871
|
-
import { useCallback as
|
|
880
|
+
import { useCallback as useCallback5, useMemo as useMemo5, useState as useState3 } from "react";
|
|
872
881
|
import { useThemeProps as useThemeProps3 } from "@mui/joy";
|
|
873
882
|
var resolveView = (view, views) => {
|
|
874
883
|
return views.includes(view) ? view : views[0];
|
|
@@ -898,13 +907,13 @@ var useCalendarProps = (inProps) => {
|
|
|
898
907
|
maxDate.setHours(0, 0, 0, 0);
|
|
899
908
|
return maxDate;
|
|
900
909
|
}, [inProps.maxDate]);
|
|
901
|
-
const paginate =
|
|
910
|
+
const paginate = useCallback5(
|
|
902
911
|
(newDirection) => {
|
|
903
912
|
setPage([page + newDirection, newDirection]);
|
|
904
913
|
},
|
|
905
914
|
[page]
|
|
906
915
|
);
|
|
907
|
-
const handleViewMonthChange =
|
|
916
|
+
const handleViewMonthChange = useCallback5(
|
|
908
917
|
(newMonth) => {
|
|
909
918
|
setViewMonth(newMonth);
|
|
910
919
|
if (resolvedView === "month") {
|
|
@@ -957,7 +966,7 @@ var useCalendarProps = (inProps) => {
|
|
|
957
966
|
};
|
|
958
967
|
|
|
959
968
|
// src/components/Calendar/hooks/use-calendar.ts
|
|
960
|
-
import { useCallback as
|
|
969
|
+
import { useCallback as useCallback6, useState as useState4 } from "react";
|
|
961
970
|
var useCalendar = (ownerState) => {
|
|
962
971
|
const [localHoverDay, setLocalHoverDay] = useState4(null);
|
|
963
972
|
const [localHoverMonth, setLocalHoverMonth] = useState4(null);
|
|
@@ -967,7 +976,7 @@ var useCalendar = (ownerState) => {
|
|
|
967
976
|
const setHoverMonth = ownerState.onHoverMonthChange ?? setLocalHoverMonth;
|
|
968
977
|
return {
|
|
969
978
|
calendarTitle: ownerState.view === "month" ? getYearName(ownerState.viewMonth, ownerState.locale || "default") : getMonthName(ownerState.viewMonth, ownerState.locale || "default"),
|
|
970
|
-
onPrev:
|
|
979
|
+
onPrev: useCallback6(() => {
|
|
971
980
|
if (ownerState.view === "day") {
|
|
972
981
|
const currentDate = new Date(ownerState.viewMonth || /* @__PURE__ */ new Date());
|
|
973
982
|
const currentYear = currentDate.getFullYear();
|
|
@@ -984,7 +993,7 @@ var useCalendar = (ownerState) => {
|
|
|
984
993
|
ownerState.onMonthChange?.(prevYear);
|
|
985
994
|
}
|
|
986
995
|
}, [ownerState.onMonthChange, ownerState.viewMonth, ownerState.view]),
|
|
987
|
-
onNext:
|
|
996
|
+
onNext: useCallback6(() => {
|
|
988
997
|
if (ownerState.view === "day") {
|
|
989
998
|
const currentDate = new Date(ownerState.viewMonth || /* @__PURE__ */ new Date());
|
|
990
999
|
const currentYear = currentDate.getFullYear();
|
|
@@ -1001,7 +1010,7 @@ var useCalendar = (ownerState) => {
|
|
|
1001
1010
|
ownerState.onMonthChange?.(nextYear);
|
|
1002
1011
|
}
|
|
1003
1012
|
}, [ownerState.onMonthChange, ownerState.viewMonth, ownerState.view]),
|
|
1004
|
-
getDayCellProps:
|
|
1013
|
+
getDayCellProps: useCallback6(
|
|
1005
1014
|
(day) => {
|
|
1006
1015
|
const thisDay = new Date(ownerState.viewMonth || /* @__PURE__ */ new Date());
|
|
1007
1016
|
thisDay.setHours(0, 0, 0, 0);
|
|
@@ -1016,7 +1025,7 @@ var useCalendar = (ownerState) => {
|
|
|
1016
1025
|
},
|
|
1017
1026
|
[ownerState.rangeSelection, ownerState.value, ownerState.viewMonth, hoverDay]
|
|
1018
1027
|
),
|
|
1019
|
-
getMonthCellProps:
|
|
1028
|
+
getMonthCellProps: useCallback6(
|
|
1020
1029
|
(monthIndex) => {
|
|
1021
1030
|
const thisMonth = new Date(ownerState.viewMonth || /* @__PURE__ */ new Date());
|
|
1022
1031
|
thisMonth.setDate(1);
|
|
@@ -1033,7 +1042,7 @@ var useCalendar = (ownerState) => {
|
|
|
1033
1042
|
},
|
|
1034
1043
|
[ownerState.rangeSelection, ownerState.value, ownerState.viewMonth, hoverMonth]
|
|
1035
1044
|
),
|
|
1036
|
-
getPickerDayProps:
|
|
1045
|
+
getPickerDayProps: useCallback6(
|
|
1037
1046
|
(day) => {
|
|
1038
1047
|
const thisDay = new Date(ownerState.viewMonth || /* @__PURE__ */ new Date());
|
|
1039
1048
|
thisDay.setHours(0, 0, 0, 0);
|
|
@@ -1087,7 +1096,7 @@ var useCalendar = (ownerState) => {
|
|
|
1087
1096
|
hoverDay
|
|
1088
1097
|
]
|
|
1089
1098
|
),
|
|
1090
|
-
getPickerMonthProps:
|
|
1099
|
+
getPickerMonthProps: useCallback6(
|
|
1091
1100
|
(monthIndex) => {
|
|
1092
1101
|
const thisMonth = new Date(ownerState.viewMonth || /* @__PURE__ */ new Date());
|
|
1093
1102
|
thisMonth.setDate(1);
|
|
@@ -1617,9 +1626,9 @@ var Calendar = forwardRef4((inProps, ref) => {
|
|
|
1617
1626
|
} = props;
|
|
1618
1627
|
const { calendarTitle, onPrev, onNext } = useCalendar(ownerState);
|
|
1619
1628
|
const [isMonthViewAssistHintOpen, setIsMonthViewAssistHintOpen] = useState5(false);
|
|
1620
|
-
const monthNavClickTimestampsRef =
|
|
1621
|
-
const monthViewAssistHintShownInSessionRef =
|
|
1622
|
-
const monthViewAssistHintTimeoutRef =
|
|
1629
|
+
const monthNavClickTimestampsRef = useRef4([]);
|
|
1630
|
+
const monthViewAssistHintShownInSessionRef = useRef4(false);
|
|
1631
|
+
const monthViewAssistHintTimeoutRef = useRef4(null);
|
|
1623
1632
|
const [hoverDay, setHoverDay] = useState5(null);
|
|
1624
1633
|
const [hoverMonth, setHoverMonth] = useState5(null);
|
|
1625
1634
|
const resolvedNumberOfMonths = numberOfMonths ?? 1;
|
|
@@ -1640,14 +1649,14 @@ var Calendar = forwardRef4((inProps, ref) => {
|
|
|
1640
1649
|
}
|
|
1641
1650
|
};
|
|
1642
1651
|
}, []);
|
|
1643
|
-
const closeMonthViewAssistHint =
|
|
1652
|
+
const closeMonthViewAssistHint = useCallback7(() => {
|
|
1644
1653
|
if (monthViewAssistHintTimeoutRef.current) {
|
|
1645
1654
|
clearTimeout(monthViewAssistHintTimeoutRef.current);
|
|
1646
1655
|
monthViewAssistHintTimeoutRef.current = null;
|
|
1647
1656
|
}
|
|
1648
1657
|
setIsMonthViewAssistHintOpen(false);
|
|
1649
1658
|
}, []);
|
|
1650
|
-
const showMonthViewAssistHint =
|
|
1659
|
+
const showMonthViewAssistHint = useCallback7(() => {
|
|
1651
1660
|
const now = Date.now();
|
|
1652
1661
|
if (monthViewAssistHintShownInSessionRef.current) return;
|
|
1653
1662
|
if (now - lastMonthViewAssistHintShownAt < MONTH_VIEW_HINT_COOLDOWN_MS) return;
|
|
@@ -1662,7 +1671,7 @@ var Calendar = forwardRef4((inProps, ref) => {
|
|
|
1662
1671
|
monthViewAssistHintTimeoutRef.current = null;
|
|
1663
1672
|
}, MONTH_VIEW_HINT_DURATION_MS);
|
|
1664
1673
|
}, []);
|
|
1665
|
-
const trackFastMonthNavigation =
|
|
1674
|
+
const trackFastMonthNavigation = useCallback7(() => {
|
|
1666
1675
|
if (!isHintEligible) return;
|
|
1667
1676
|
const now = Date.now();
|
|
1668
1677
|
monthNavClickTimestampsRef.current = [
|
|
@@ -1673,15 +1682,15 @@ var Calendar = forwardRef4((inProps, ref) => {
|
|
|
1673
1682
|
showMonthViewAssistHint();
|
|
1674
1683
|
}
|
|
1675
1684
|
}, [isHintEligible, showMonthViewAssistHint]);
|
|
1676
|
-
const handlePrevClick =
|
|
1685
|
+
const handlePrevClick = useCallback7(() => {
|
|
1677
1686
|
onPrev();
|
|
1678
1687
|
trackFastMonthNavigation();
|
|
1679
1688
|
}, [onPrev, trackFastMonthNavigation]);
|
|
1680
|
-
const handleNextClick =
|
|
1689
|
+
const handleNextClick = useCallback7(() => {
|
|
1681
1690
|
onNext();
|
|
1682
1691
|
trackFastMonthNavigation();
|
|
1683
1692
|
}, [onNext, trackFastMonthNavigation]);
|
|
1684
|
-
const handleSwitchViewClick =
|
|
1693
|
+
const handleSwitchViewClick = useCallback7(() => {
|
|
1685
1694
|
closeMonthViewAssistHint();
|
|
1686
1695
|
onViewChange?.();
|
|
1687
1696
|
}, [closeMonthViewAssistHint, onViewChange]);
|
|
@@ -1851,11 +1860,11 @@ var Container = forwardRef5(function Container2(props, ref) {
|
|
|
1851
1860
|
Container.displayName = "Container";
|
|
1852
1861
|
|
|
1853
1862
|
// src/components/CurrencyInput/CurrencyInput.tsx
|
|
1854
|
-
import React17, { useCallback as
|
|
1863
|
+
import React17, { useCallback as useCallback9, useMemo as useMemo7 } from "react";
|
|
1855
1864
|
import { NumericFormat } from "react-number-format";
|
|
1856
1865
|
|
|
1857
1866
|
// src/components/Input/Input.tsx
|
|
1858
|
-
import React16, { useCallback as
|
|
1867
|
+
import React16, { useCallback as useCallback8, useState as useState6 } from "react";
|
|
1859
1868
|
import { Input as JoyInput } from "@mui/joy";
|
|
1860
1869
|
import { motion as motion16 } from "framer-motion";
|
|
1861
1870
|
import ClearIcon from "@mui/icons-material/Close";
|
|
@@ -1893,7 +1902,7 @@ var Input = React16.forwardRef((props, ref) => {
|
|
|
1893
1902
|
const [value, setValue] = useControlledState(
|
|
1894
1903
|
valueProp,
|
|
1895
1904
|
defaultValueProp ?? null,
|
|
1896
|
-
|
|
1905
|
+
useCallback8(
|
|
1897
1906
|
(value2) => {
|
|
1898
1907
|
onChange?.({
|
|
1899
1908
|
/**
|
|
@@ -2183,7 +2192,7 @@ var CurrencyInput = React17.forwardRef(function CurrencyInput2(inProps, ref) {
|
|
|
2183
2192
|
const [_value, setValue] = useControlledState(
|
|
2184
2193
|
props.value,
|
|
2185
2194
|
props.defaultValue ?? null,
|
|
2186
|
-
|
|
2195
|
+
useCallback9((value2) => onChange?.({ target: { name, value: value2 } }), [onChange, name])
|
|
2187
2196
|
);
|
|
2188
2197
|
const value = useMemo7(() => {
|
|
2189
2198
|
if (_value && useMinorUnit) {
|
|
@@ -2198,7 +2207,7 @@ var CurrencyInput = React17.forwardRef(function CurrencyInput2(inProps, ref) {
|
|
|
2198
2207
|
return props.max;
|
|
2199
2208
|
}, [props.max, useMinorUnit, decimalScale]);
|
|
2200
2209
|
const isOverLimit = useMemo7(() => max != null && value != null && value > max, [max, value]);
|
|
2201
|
-
const handleChange =
|
|
2210
|
+
const handleChange = useCallback9(
|
|
2202
2211
|
(event) => {
|
|
2203
2212
|
if (event.target.value === "") {
|
|
2204
2213
|
setValue(null);
|
|
@@ -2247,9 +2256,9 @@ var CurrencyInput_default = CurrencyInput;
|
|
|
2247
2256
|
|
|
2248
2257
|
// src/components/DataTable/DataTable.tsx
|
|
2249
2258
|
import React26, {
|
|
2250
|
-
useCallback as
|
|
2259
|
+
useCallback as useCallback14,
|
|
2251
2260
|
useMemo as useMemo12,
|
|
2252
|
-
useRef as
|
|
2261
|
+
useRef as useRef8,
|
|
2253
2262
|
useId,
|
|
2254
2263
|
forwardRef as forwardRef7,
|
|
2255
2264
|
useImperativeHandle as useImperativeHandle2,
|
|
@@ -2483,7 +2492,10 @@ function computeAutoFitWidth(params) {
|
|
|
2483
2492
|
return finalWidth;
|
|
2484
2493
|
}
|
|
2485
2494
|
function getHeaderCellId(tableId, columnId) {
|
|
2486
|
-
return `${tableId}_header_${columnId}
|
|
2495
|
+
return `${tableId}_header_${columnId}`;
|
|
2496
|
+
}
|
|
2497
|
+
function sanitizeColumnId(field) {
|
|
2498
|
+
return String(field).trim().replace(/\s+/g, "_");
|
|
2487
2499
|
}
|
|
2488
2500
|
|
|
2489
2501
|
// src/components/DataTable/styled.tsx
|
|
@@ -2673,11 +2685,11 @@ var Resizer = (ref, targetRef = ref, onResizeStateChange, onAutoFit) => /* @__PU
|
|
|
2673
2685
|
|
|
2674
2686
|
// src/components/DataTable/components.tsx
|
|
2675
2687
|
import React23, {
|
|
2676
|
-
useRef as
|
|
2688
|
+
useRef as useRef6,
|
|
2677
2689
|
useState as useState8,
|
|
2678
2690
|
useLayoutEffect,
|
|
2679
2691
|
useMemo as useMemo10,
|
|
2680
|
-
useCallback as
|
|
2692
|
+
useCallback as useCallback11,
|
|
2681
2693
|
useEffect as useEffect5,
|
|
2682
2694
|
memo,
|
|
2683
2695
|
createElement
|
|
@@ -2686,7 +2698,7 @@ import { styled as styled12, useTheme } from "@mui/joy";
|
|
|
2686
2698
|
import { AnimatePresence as AnimatePresence2 } from "framer-motion";
|
|
2687
2699
|
|
|
2688
2700
|
// src/components/DatePicker/DatePicker.tsx
|
|
2689
|
-
import React19, { forwardRef as forwardRef6, useCallback as
|
|
2701
|
+
import React19, { forwardRef as forwardRef6, useCallback as useCallback10, useEffect as useEffect4, useImperativeHandle, useRef as useRef5, useState as useState7 } from "react";
|
|
2690
2702
|
import { IMaskInput, IMask } from "react-imask";
|
|
2691
2703
|
import CalendarTodayIcon from "@mui/icons-material/CalendarToday";
|
|
2692
2704
|
import { styled as styled10, useThemeProps as useThemeProps5 } from "@mui/joy";
|
|
@@ -2903,12 +2915,12 @@ var DatePicker = forwardRef6((inProps, ref) => {
|
|
|
2903
2915
|
presets,
|
|
2904
2916
|
...innerProps
|
|
2905
2917
|
} = props;
|
|
2906
|
-
const innerRef =
|
|
2907
|
-
const buttonRef =
|
|
2918
|
+
const innerRef = useRef5(null);
|
|
2919
|
+
const buttonRef = useRef5(null);
|
|
2908
2920
|
const [rawValue, setValue] = useControlledState(
|
|
2909
2921
|
props.value,
|
|
2910
2922
|
props.defaultValue ?? null,
|
|
2911
|
-
|
|
2923
|
+
useCallback10(
|
|
2912
2924
|
(value2) => onChange?.({ target: { name: props.name, value: value2 ?? "" } }),
|
|
2913
2925
|
[props.name, onChange]
|
|
2914
2926
|
)
|
|
@@ -2936,7 +2948,7 @@ var DatePicker = forwardRef6((inProps, ref) => {
|
|
|
2936
2948
|
}
|
|
2937
2949
|
}, [displayFormat, displayValue, format, locale, value]);
|
|
2938
2950
|
useImperativeHandle(ref, () => innerRef.current, [innerRef]);
|
|
2939
|
-
const handleChange =
|
|
2951
|
+
const handleChange = useCallback10(
|
|
2940
2952
|
(event) => {
|
|
2941
2953
|
const value2 = event.target.value;
|
|
2942
2954
|
setDisplayValue(value2 ? formatValueString(parseDate(value2, format), displayFormat, locale) : value2);
|
|
@@ -2944,7 +2956,7 @@ var DatePicker = forwardRef6((inProps, ref) => {
|
|
|
2944
2956
|
},
|
|
2945
2957
|
[displayFormat, format, locale, setValue]
|
|
2946
2958
|
);
|
|
2947
|
-
const handleDisplayInputChange =
|
|
2959
|
+
const handleDisplayInputChange = useCallback10(
|
|
2948
2960
|
(event) => {
|
|
2949
2961
|
if (event.target.value === "") {
|
|
2950
2962
|
handleChange({
|
|
@@ -2969,7 +2981,7 @@ var DatePicker = forwardRef6((inProps, ref) => {
|
|
|
2969
2981
|
},
|
|
2970
2982
|
[displayFormat, format, handleChange, props.name]
|
|
2971
2983
|
);
|
|
2972
|
-
const handleCalendarToggle =
|
|
2984
|
+
const handleCalendarToggle = useCallback10(
|
|
2973
2985
|
(event) => {
|
|
2974
2986
|
setAnchorEl(anchorEl ? null : event.currentTarget);
|
|
2975
2987
|
setTimeout(() => {
|
|
@@ -2978,7 +2990,7 @@ var DatePicker = forwardRef6((inProps, ref) => {
|
|
|
2978
2990
|
},
|
|
2979
2991
|
[anchorEl, setAnchorEl, innerRef]
|
|
2980
2992
|
);
|
|
2981
|
-
const handleInputMouseDown =
|
|
2993
|
+
const handleInputMouseDown = useCallback10(
|
|
2982
2994
|
(event) => {
|
|
2983
2995
|
if (inputReadOnly || isAlphabeticDisplay) {
|
|
2984
2996
|
event.preventDefault();
|
|
@@ -2987,7 +2999,7 @@ var DatePicker = forwardRef6((inProps, ref) => {
|
|
|
2987
2999
|
},
|
|
2988
3000
|
[inputReadOnly, isAlphabeticDisplay, buttonRef]
|
|
2989
3001
|
);
|
|
2990
|
-
const handleInputClick =
|
|
3002
|
+
const handleInputClick = useCallback10(
|
|
2991
3003
|
(event) => {
|
|
2992
3004
|
if (inputReadOnly && !readOnly) {
|
|
2993
3005
|
handleCalendarToggle(event);
|
|
@@ -2995,7 +3007,7 @@ var DatePicker = forwardRef6((inProps, ref) => {
|
|
|
2995
3007
|
},
|
|
2996
3008
|
[inputReadOnly, readOnly, handleCalendarToggle]
|
|
2997
3009
|
);
|
|
2998
|
-
const handlePresetClick =
|
|
3010
|
+
const handlePresetClick = useCallback10(
|
|
2999
3011
|
(presetValue) => {
|
|
3000
3012
|
handleChange({
|
|
3001
3013
|
target: {
|
|
@@ -3007,7 +3019,7 @@ var DatePicker = forwardRef6((inProps, ref) => {
|
|
|
3007
3019
|
},
|
|
3008
3020
|
[handleChange, props.name]
|
|
3009
3021
|
);
|
|
3010
|
-
const isPresetDisabled =
|
|
3022
|
+
const isPresetDisabled = useCallback10(
|
|
3011
3023
|
(presetValue) => {
|
|
3012
3024
|
try {
|
|
3013
3025
|
const date = parseDate(presetValue, format);
|
|
@@ -3375,7 +3387,7 @@ var TextEllipsis = ({
|
|
|
3375
3387
|
lineClamp,
|
|
3376
3388
|
...rest
|
|
3377
3389
|
}) => {
|
|
3378
|
-
const textRef =
|
|
3390
|
+
const textRef = useRef6(null);
|
|
3379
3391
|
const [showTooltip, setShowTooltip] = useState8(false);
|
|
3380
3392
|
useLayoutEffect(() => {
|
|
3381
3393
|
const element = textRef.current;
|
|
@@ -3392,7 +3404,7 @@ var TextEllipsis = ({
|
|
|
3392
3404
|
return /* @__PURE__ */ React23.createElement(Tooltip_default, { title: showTooltip ? children : "", placement: "top" }, /* @__PURE__ */ React23.createElement(EllipsisDiv, { ref: textRef, lineClamp, ...rest }, children));
|
|
3393
3405
|
};
|
|
3394
3406
|
var CellTextEllipsis = ({ children }) => {
|
|
3395
|
-
const textRef =
|
|
3407
|
+
const textRef = useRef6(null);
|
|
3396
3408
|
const [showTooltip, setShowTooltip] = useState8(false);
|
|
3397
3409
|
useLayoutEffect(() => {
|
|
3398
3410
|
const element = textRef.current;
|
|
@@ -3448,14 +3460,14 @@ var HeadCell = (props) => {
|
|
|
3448
3460
|
const theme = useTheme();
|
|
3449
3461
|
const ref = headerRef;
|
|
3450
3462
|
const colRef = tableColRef;
|
|
3451
|
-
const localRef =
|
|
3463
|
+
const localRef = useRef6(null);
|
|
3452
3464
|
useLayoutEffect(() => {
|
|
3453
3465
|
ref.current = localRef.current;
|
|
3454
3466
|
}, [ref]);
|
|
3455
3467
|
const [isHovered, setIsHovered] = useState8(false);
|
|
3456
3468
|
const sortable = type === "actions" ? false : _sortable;
|
|
3457
3469
|
const headId = useMemo10(() => getHeaderCellId(tableId, columnId), [tableId, columnId]);
|
|
3458
|
-
const isResizingRef =
|
|
3470
|
+
const isResizingRef = useRef6(false);
|
|
3459
3471
|
const resizer = useMemo10(
|
|
3460
3472
|
() => resizable ?? true ? Resizer(
|
|
3461
3473
|
ref,
|
|
@@ -3539,7 +3551,7 @@ var HeadCell = (props) => {
|
|
|
3539
3551
|
ref: localRef,
|
|
3540
3552
|
key: field,
|
|
3541
3553
|
style,
|
|
3542
|
-
onClick:
|
|
3554
|
+
onClick: useCallback11(
|
|
3543
3555
|
(e) => {
|
|
3544
3556
|
if (isResizingRef.current) return;
|
|
3545
3557
|
if (!(e.target instanceof Element) || !e.currentTarget.contains(e.target)) return;
|
|
@@ -3579,7 +3591,7 @@ var BodyCell = (props) => {
|
|
|
3579
3591
|
} = props;
|
|
3580
3592
|
const theme = useTheme();
|
|
3581
3593
|
const [value, setValue] = useState8(row[field]);
|
|
3582
|
-
const cellRef =
|
|
3594
|
+
const cellRef = useRef6(null);
|
|
3583
3595
|
const params = useMemo10(
|
|
3584
3596
|
() => ({
|
|
3585
3597
|
row,
|
|
@@ -3800,10 +3812,10 @@ var VirtualizedTableRow = memo(StyledTableRow2, (prevProps, nextProps) => {
|
|
|
3800
3812
|
});
|
|
3801
3813
|
|
|
3802
3814
|
// src/components/DataTable/hooks.ts
|
|
3803
|
-
import { useState as useState9, useLayoutEffect as useLayoutEffect2, useRef as
|
|
3815
|
+
import { useState as useState9, useLayoutEffect as useLayoutEffect2, useRef as useRef7, useMemo as useMemo11, useCallback as useCallback12, useEffect as useEffect6, createRef } from "react";
|
|
3804
3816
|
function useColumnWidths(columnsById) {
|
|
3805
3817
|
const [widths, setWidths] = useState9({});
|
|
3806
|
-
const roRef =
|
|
3818
|
+
const roRef = useRef7();
|
|
3807
3819
|
useLayoutEffect2(() => {
|
|
3808
3820
|
if (roRef.current) roRef.current.disconnect();
|
|
3809
3821
|
roRef.current = new ResizeObserver((entries) => {
|
|
@@ -3835,8 +3847,8 @@ function useColumnWidths(columnsById) {
|
|
|
3835
3847
|
});
|
|
3836
3848
|
setWidths((prev) => {
|
|
3837
3849
|
const keys = Object.keys(measured);
|
|
3838
|
-
const same = keys.
|
|
3839
|
-
return same ? prev : measured;
|
|
3850
|
+
const same = keys.every((key) => prev[key] === measured[key]);
|
|
3851
|
+
return same ? prev : { ...prev, ...measured };
|
|
3840
3852
|
});
|
|
3841
3853
|
return () => roRef.current?.disconnect();
|
|
3842
3854
|
}, [columnsById]);
|
|
@@ -3871,19 +3883,19 @@ function useDataTableRenderer({
|
|
|
3871
3883
|
"You cannot use both `pinnedColumns` and `columnGroupingModel` at the same time. Please choose one of them."
|
|
3872
3884
|
);
|
|
3873
3885
|
}
|
|
3874
|
-
const onSelectionModelChangeRef =
|
|
3886
|
+
const onSelectionModelChangeRef = useRef7(onSelectionModelChange);
|
|
3875
3887
|
onSelectionModelChangeRef.current = onSelectionModelChange;
|
|
3876
3888
|
const [focusedRowId, setFocusedRowId] = useState9(null);
|
|
3877
3889
|
const [selectionAnchor, setSelectionAnchor] = useState9(null);
|
|
3878
3890
|
const [sortModel, setSortModel] = useControlledState(
|
|
3879
3891
|
controlledSortModel,
|
|
3880
3892
|
initialState?.sorting?.sortModel ?? [],
|
|
3881
|
-
|
|
3893
|
+
useCallback12((sortModel2) => onSortModelChange?.(sortModel2), [onSortModelChange])
|
|
3882
3894
|
);
|
|
3883
3895
|
const [visibilityModel] = useControlledState(
|
|
3884
3896
|
columnVisibilityModel,
|
|
3885
3897
|
initialState?.columns?.columnVisibilityModel ?? {},
|
|
3886
|
-
|
|
3898
|
+
useCallback12(
|
|
3887
3899
|
(model) => onColumnVisibilityModelChange?.(model),
|
|
3888
3900
|
[onColumnVisibilityModelChange]
|
|
3889
3901
|
)
|
|
@@ -3923,10 +3935,10 @@ function useDataTableRenderer({
|
|
|
3923
3935
|
[reorderedColumns]
|
|
3924
3936
|
);
|
|
3925
3937
|
const allColumnIds = useMemo11(() => {
|
|
3926
|
-
const taken = new Set(reorderedColumns.map((column) =>
|
|
3938
|
+
const taken = new Set(reorderedColumns.map((column) => sanitizeColumnId(column.field)));
|
|
3927
3939
|
const assigned = /* @__PURE__ */ new Set();
|
|
3928
3940
|
return reorderedColumns.map((column) => {
|
|
3929
|
-
const field =
|
|
3941
|
+
const field = sanitizeColumnId(column.field);
|
|
3930
3942
|
if (!assigned.has(field)) {
|
|
3931
3943
|
assigned.add(field);
|
|
3932
3944
|
return field;
|
|
@@ -3954,7 +3966,7 @@ function useDataTableRenderer({
|
|
|
3954
3966
|
),
|
|
3955
3967
|
[visibleColumns, columnIds]
|
|
3956
3968
|
);
|
|
3957
|
-
const sortComparator =
|
|
3969
|
+
const sortComparator = useCallback12(
|
|
3958
3970
|
(rowA, rowB) => {
|
|
3959
3971
|
for (const sort of sortModel) {
|
|
3960
3972
|
const { field, sort: direction } = sort;
|
|
@@ -3993,7 +4005,7 @@ function useDataTableRenderer({
|
|
|
3993
4005
|
);
|
|
3994
4006
|
const [page, setPage] = useState9(paginationModel?.page || 1);
|
|
3995
4007
|
const pageSize = paginationModel?.pageSize || 20;
|
|
3996
|
-
const getId =
|
|
4008
|
+
const getId = useCallback12(
|
|
3997
4009
|
(row, index) => _getId?.(row) ?? row.id ?? `${(index || 0) + (page - 1) * pageSize}`,
|
|
3998
4010
|
[_getId, page, pageSize]
|
|
3999
4011
|
);
|
|
@@ -4009,7 +4021,7 @@ function useDataTableRenderer({
|
|
|
4009
4021
|
}),
|
|
4010
4022
|
[dataInPage, isRowSelectable, getId]
|
|
4011
4023
|
);
|
|
4012
|
-
const handleRangeSelection =
|
|
4024
|
+
const handleRangeSelection = useCallback12(
|
|
4013
4025
|
(anchor, targetIndex) => {
|
|
4014
4026
|
const startIndex = Math.min(anchor.rowIndex, targetIndex);
|
|
4015
4027
|
const endIndex = Math.max(anchor.rowIndex, targetIndex);
|
|
@@ -4052,7 +4064,7 @@ function useDataTableRenderer({
|
|
|
4052
4064
|
),
|
|
4053
4065
|
[visibleColumnsById, columnWidths]
|
|
4054
4066
|
);
|
|
4055
|
-
const getWidth =
|
|
4067
|
+
const getWidth = useCallback12(
|
|
4056
4068
|
// 반환값은 pinned offset으로 더해지므로 반드시 숫자여야 한다. width/minWidth는 '500px' 같은 문자열.
|
|
4057
4069
|
(f) => measuredWidthByField[f] ?? parsePxValue(allColumnsByField[f]?.width) ?? // Column prop 으로 지정된 width
|
|
4058
4070
|
parsePxValue(allColumnsByField[f]?.minWidth) ?? 0,
|
|
@@ -4077,7 +4089,7 @@ function useDataTableRenderer({
|
|
|
4077
4089
|
field: key
|
|
4078
4090
|
}));
|
|
4079
4091
|
return baseColumns.map((column, index) => {
|
|
4080
|
-
const columnId = columnIds[index] ??
|
|
4092
|
+
const columnId = columnIds[index] ?? sanitizeColumnId(column.field);
|
|
4081
4093
|
const isLeftPinned = effectivePinnedLeft?.includes(column.field);
|
|
4082
4094
|
const isRightPinned = effectivePinnedRight?.includes(column.field);
|
|
4083
4095
|
const isPinned = isLeftPinned || isRightPinned;
|
|
@@ -4110,14 +4122,14 @@ function useDataTableRenderer({
|
|
|
4110
4122
|
sortOrder,
|
|
4111
4123
|
getWidth
|
|
4112
4124
|
]);
|
|
4113
|
-
const handlePageChange =
|
|
4125
|
+
const handlePageChange = useCallback12(
|
|
4114
4126
|
(newPage) => {
|
|
4115
4127
|
setPage(newPage);
|
|
4116
4128
|
onPaginationModelChange?.({ page: newPage, pageSize });
|
|
4117
4129
|
},
|
|
4118
4130
|
[onPaginationModelChange, pageSize]
|
|
4119
4131
|
);
|
|
4120
|
-
const handleSortChange =
|
|
4132
|
+
const handleSortChange = useCallback12(
|
|
4121
4133
|
(props) => {
|
|
4122
4134
|
const { field, currentSort, multiple } = props;
|
|
4123
4135
|
const column = allColumnsByField[field];
|
|
@@ -4155,14 +4167,14 @@ function useDataTableRenderer({
|
|
|
4155
4167
|
onSelectionModelChangeRef.current?.([]);
|
|
4156
4168
|
setSelectionAnchor(null);
|
|
4157
4169
|
}, [page]);
|
|
4158
|
-
const prevRowsRef =
|
|
4170
|
+
const prevRowsRef = useRef7(_rows);
|
|
4159
4171
|
useEffect6(() => {
|
|
4160
4172
|
if (prevRowsRef.current !== _rows) {
|
|
4161
4173
|
setSelectionAnchor(null);
|
|
4162
4174
|
prevRowsRef.current = _rows;
|
|
4163
4175
|
}
|
|
4164
4176
|
}, [_rows]);
|
|
4165
|
-
const handleAutoFit =
|
|
4177
|
+
const handleAutoFit = useCallback12(
|
|
4166
4178
|
(columnId) => {
|
|
4167
4179
|
const colDef = visibleColumnsById[columnId];
|
|
4168
4180
|
if (!colDef?.headerRef.current) return;
|
|
@@ -4194,8 +4206,8 @@ function useDataTableRenderer({
|
|
|
4194
4206
|
handleAutoFit,
|
|
4195
4207
|
isAllSelected,
|
|
4196
4208
|
isTotalSelected,
|
|
4197
|
-
isSelectedRow:
|
|
4198
|
-
isRowSelectable:
|
|
4209
|
+
isSelectedRow: useCallback12((model) => selectedModelSet.has(model), [selectedModelSet]),
|
|
4210
|
+
isRowSelectable: useCallback12(
|
|
4199
4211
|
(rowId, row) => {
|
|
4200
4212
|
if (!isRowSelectable) return true;
|
|
4201
4213
|
return isRowSelectable({ row, id: rowId });
|
|
@@ -4203,13 +4215,13 @@ function useDataTableRenderer({
|
|
|
4203
4215
|
[isRowSelectable]
|
|
4204
4216
|
),
|
|
4205
4217
|
focusedRowId,
|
|
4206
|
-
onRowFocus:
|
|
4218
|
+
onRowFocus: useCallback12((rowId) => {
|
|
4207
4219
|
setFocusedRowId(rowId);
|
|
4208
4220
|
}, []),
|
|
4209
|
-
onAllCheckboxChange:
|
|
4221
|
+
onAllCheckboxChange: useCallback12(() => {
|
|
4210
4222
|
onSelectionModelChange?.(isAllSelected ? [] : selectableDataInPage.map(getId));
|
|
4211
4223
|
}, [isAllSelected, selectableDataInPage, onSelectionModelChange, getId]),
|
|
4212
|
-
onCheckboxChange:
|
|
4224
|
+
onCheckboxChange: useCallback12(
|
|
4213
4225
|
(event, selectedModel) => {
|
|
4214
4226
|
const isShiftClick = "shiftKey" in event && event.shiftKey;
|
|
4215
4227
|
const rowIndex = dataInPage.findIndex((row, i) => getId(row, i) === selectedModel);
|
|
@@ -4243,7 +4255,7 @@ function useDataTableRenderer({
|
|
|
4243
4255
|
columns,
|
|
4244
4256
|
tableMinWidth,
|
|
4245
4257
|
processedColumnGroups,
|
|
4246
|
-
onTotalSelect:
|
|
4258
|
+
onTotalSelect: useCallback12(() => {
|
|
4247
4259
|
const selectableRows = rows.filter((row, i) => {
|
|
4248
4260
|
if (!isRowSelectable) return true;
|
|
4249
4261
|
return isRowSelectable({ row, id: getId(row, i) });
|
|
@@ -4328,7 +4340,7 @@ function TableBody(props) {
|
|
|
4328
4340
|
TableBody.displayName = "TableBody";
|
|
4329
4341
|
|
|
4330
4342
|
// src/components/Pagination/Pagination.tsx
|
|
4331
|
-
import React25, { useCallback as
|
|
4343
|
+
import React25, { useCallback as useCallback13, useEffect as useEffect7 } from "react";
|
|
4332
4344
|
import PreviousIcon from "@mui/icons-material/ChevronLeftRounded";
|
|
4333
4345
|
import NextIcon from "@mui/icons-material/ChevronRightRounded";
|
|
4334
4346
|
import FirstPageIcon from "@mui/icons-material/FirstPageRounded";
|
|
@@ -4398,7 +4410,7 @@ function Pagination(inProps) {
|
|
|
4398
4410
|
const [paginationModel, setPaginationModel] = useControlledState(
|
|
4399
4411
|
_paginationModel,
|
|
4400
4412
|
defaultPaginationModel,
|
|
4401
|
-
|
|
4413
|
+
useCallback13(
|
|
4402
4414
|
(newPage) => {
|
|
4403
4415
|
onPageChange(newPage.page);
|
|
4404
4416
|
},
|
|
@@ -4616,8 +4628,8 @@ function Component(props, apiRef) {
|
|
|
4616
4628
|
...innerProps
|
|
4617
4629
|
} = props;
|
|
4618
4630
|
const tableId = useId();
|
|
4619
|
-
const parentRef =
|
|
4620
|
-
const tableBodyRef =
|
|
4631
|
+
const parentRef = useRef8(null);
|
|
4632
|
+
const tableBodyRef = useRef8(null);
|
|
4621
4633
|
const {
|
|
4622
4634
|
columns,
|
|
4623
4635
|
processedColumnGroups,
|
|
@@ -4681,20 +4693,20 @@ function Component(props, apiRef) {
|
|
|
4681
4693
|
const showNoRowsOverlay = !loading && rowCount === 0;
|
|
4682
4694
|
const showFillerColumn = columns.length > 0 && columns.every((c) => !!c.width);
|
|
4683
4695
|
const totalColCount = Math.max(1, columns.length + (checkboxSelection ? 1 : 0) + (showFillerColumn ? 1 : 0));
|
|
4684
|
-
const getRowClickHandler =
|
|
4696
|
+
const getRowClickHandler = useCallback14(
|
|
4685
4697
|
(row, rowId) => (e) => {
|
|
4686
4698
|
onRowClick?.({ row, rowId }, e);
|
|
4687
4699
|
checkboxSelection && !disableSelectionOnClick && isRowSelectableCheck(rowId, row) && onCheckboxChange(e, rowId);
|
|
4688
4700
|
},
|
|
4689
4701
|
[onRowClick, checkboxSelection, disableSelectionOnClick, onCheckboxChange, isRowSelectableCheck]
|
|
4690
4702
|
);
|
|
4691
|
-
const getRowFocusHandler =
|
|
4703
|
+
const getRowFocusHandler = useCallback14(
|
|
4692
4704
|
(rowId) => () => {
|
|
4693
4705
|
onRowFocus(rowId);
|
|
4694
4706
|
},
|
|
4695
4707
|
[onRowFocus]
|
|
4696
4708
|
);
|
|
4697
|
-
const getCheckboxClickHandler =
|
|
4709
|
+
const getCheckboxClickHandler = useCallback14(
|
|
4698
4710
|
(rowId, row) => (e) => {
|
|
4699
4711
|
e.stopPropagation();
|
|
4700
4712
|
if (isRowSelectableCheck(rowId, row)) {
|
|
@@ -4704,7 +4716,7 @@ function Component(props, apiRef) {
|
|
|
4704
4716
|
},
|
|
4705
4717
|
[onCheckboxChange, isRowSelectableCheck, onRowFocus]
|
|
4706
4718
|
);
|
|
4707
|
-
const handleTableKeyDown =
|
|
4719
|
+
const handleTableKeyDown = useCallback14(
|
|
4708
4720
|
(e) => {
|
|
4709
4721
|
const supportedKeys = ["ArrowUp", "ArrowDown", " ", "Home", "End", "PageUp", "PageDown"];
|
|
4710
4722
|
if (!supportedKeys.includes(e.key)) return;
|
|
@@ -4915,13 +4927,13 @@ function Component(props, apiRef) {
|
|
|
4915
4927
|
}
|
|
4916
4928
|
},
|
|
4917
4929
|
headerCheckboxElement
|
|
4918
|
-
), columns.map((c
|
|
4930
|
+
), columns.map((c) => (
|
|
4919
4931
|
// @ts-ignore
|
|
4920
4932
|
/* @__PURE__ */ React26.createElement(
|
|
4921
4933
|
HeadCell2,
|
|
4922
4934
|
{
|
|
4923
4935
|
tableId,
|
|
4924
|
-
key:
|
|
4936
|
+
key: c.columnId,
|
|
4925
4937
|
stickyHeader: props.stickyHeader,
|
|
4926
4938
|
editMode: !!c.isCellEditable,
|
|
4927
4939
|
onSortChange: handleSortChange,
|
|
@@ -5051,7 +5063,7 @@ var DataTable = forwardRef7(Component);
|
|
|
5051
5063
|
DataTable.displayName = "DataTable";
|
|
5052
5064
|
|
|
5053
5065
|
// src/components/DateRangePicker/DateRangePicker.tsx
|
|
5054
|
-
import React27, { forwardRef as forwardRef8, useCallback as
|
|
5066
|
+
import React27, { forwardRef as forwardRef8, useCallback as useCallback15, useEffect as useEffect8, useImperativeHandle as useImperativeHandle3, useMemo as useMemo13, useRef as useRef9, useState as useState10 } from "react";
|
|
5055
5067
|
import { IMaskInput as IMaskInput2, IMask as IMask2 } from "react-imask";
|
|
5056
5068
|
import CalendarTodayIcon2 from "@mui/icons-material/CalendarToday";
|
|
5057
5069
|
import { styled as styled14, useThemeProps as useThemeProps7 } from "@mui/joy";
|
|
@@ -5256,12 +5268,12 @@ var DateRangePicker = forwardRef8((inProps, ref) => {
|
|
|
5256
5268
|
numberOfMonths,
|
|
5257
5269
|
...innerProps
|
|
5258
5270
|
} = props;
|
|
5259
|
-
const innerRef =
|
|
5260
|
-
const buttonRef =
|
|
5271
|
+
const innerRef = useRef9(null);
|
|
5272
|
+
const buttonRef = useRef9(null);
|
|
5261
5273
|
const [rawValue, setValue] = useControlledState(
|
|
5262
5274
|
props.value,
|
|
5263
5275
|
props.defaultValue ?? null,
|
|
5264
|
-
|
|
5276
|
+
useCallback15(
|
|
5265
5277
|
(value2) => onChange?.({ target: { name: props.name, value: value2 ?? "" } }),
|
|
5266
5278
|
[props.name, onChange]
|
|
5267
5279
|
)
|
|
@@ -5295,7 +5307,7 @@ var DateRangePicker = forwardRef8((inProps, ref) => {
|
|
|
5295
5307
|
}
|
|
5296
5308
|
}, [anchorEl, innerRef]);
|
|
5297
5309
|
useImperativeHandle3(ref, () => innerRef.current, [innerRef]);
|
|
5298
|
-
const handleChange =
|
|
5310
|
+
const handleChange = useCallback15(
|
|
5299
5311
|
(event) => {
|
|
5300
5312
|
const value2 = event.target.value;
|
|
5301
5313
|
setDisplayValue(value2 ? formatValueString2(parseDates(value2, format), displayFormat, locale) : value2);
|
|
@@ -5303,7 +5315,7 @@ var DateRangePicker = forwardRef8((inProps, ref) => {
|
|
|
5303
5315
|
},
|
|
5304
5316
|
[displayFormat, format, locale, setValue]
|
|
5305
5317
|
);
|
|
5306
|
-
const handleDisplayInputChange =
|
|
5318
|
+
const handleDisplayInputChange = useCallback15(
|
|
5307
5319
|
(event) => {
|
|
5308
5320
|
if (event.target.value === "") {
|
|
5309
5321
|
handleChange({
|
|
@@ -5328,14 +5340,14 @@ var DateRangePicker = forwardRef8((inProps, ref) => {
|
|
|
5328
5340
|
},
|
|
5329
5341
|
[displayFormat, format, handleChange, props.name]
|
|
5330
5342
|
);
|
|
5331
|
-
const handleCalendarToggle =
|
|
5343
|
+
const handleCalendarToggle = useCallback15(
|
|
5332
5344
|
(event) => {
|
|
5333
5345
|
setAnchorEl(anchorEl ? null : event.currentTarget);
|
|
5334
5346
|
innerRef.current?.focus();
|
|
5335
5347
|
},
|
|
5336
5348
|
[anchorEl, setAnchorEl, innerRef]
|
|
5337
5349
|
);
|
|
5338
|
-
const handleCalendarChange =
|
|
5350
|
+
const handleCalendarChange = useCallback15(
|
|
5339
5351
|
([date1, date2]) => {
|
|
5340
5352
|
if (!date1 || !date2) return;
|
|
5341
5353
|
const formattedValue = formatValueString2([date1, date2], format);
|
|
@@ -5349,7 +5361,7 @@ var DateRangePicker = forwardRef8((inProps, ref) => {
|
|
|
5349
5361
|
},
|
|
5350
5362
|
[props.value, props.name, onChange, setValue, setAnchorEl, format, displayFormat, locale]
|
|
5351
5363
|
);
|
|
5352
|
-
const handleInputMouseDown =
|
|
5364
|
+
const handleInputMouseDown = useCallback15(
|
|
5353
5365
|
(event) => {
|
|
5354
5366
|
if (inputReadOnly || isAlphabeticDisplay) {
|
|
5355
5367
|
event.preventDefault();
|
|
@@ -5358,7 +5370,7 @@ var DateRangePicker = forwardRef8((inProps, ref) => {
|
|
|
5358
5370
|
},
|
|
5359
5371
|
[inputReadOnly, isAlphabeticDisplay, buttonRef]
|
|
5360
5372
|
);
|
|
5361
|
-
const handleInputClick =
|
|
5373
|
+
const handleInputClick = useCallback15(
|
|
5362
5374
|
(event) => {
|
|
5363
5375
|
if (inputReadOnly && !readOnly) {
|
|
5364
5376
|
handleCalendarToggle(event);
|
|
@@ -5366,7 +5378,7 @@ var DateRangePicker = forwardRef8((inProps, ref) => {
|
|
|
5366
5378
|
},
|
|
5367
5379
|
[inputReadOnly, readOnly, handleCalendarToggle]
|
|
5368
5380
|
);
|
|
5369
|
-
const handlePresetClick =
|
|
5381
|
+
const handlePresetClick = useCallback15(
|
|
5370
5382
|
(presetValue) => {
|
|
5371
5383
|
if (props.value !== void 0) {
|
|
5372
5384
|
onChange?.({ target: { name: props.name, value: presetValue } });
|
|
@@ -5379,7 +5391,7 @@ var DateRangePicker = forwardRef8((inProps, ref) => {
|
|
|
5379
5391
|
},
|
|
5380
5392
|
[props.value, props.name, onChange, setValue, setAnchorEl, format, displayFormat, locale]
|
|
5381
5393
|
);
|
|
5382
|
-
const isPresetDisabled =
|
|
5394
|
+
const isPresetDisabled = useCallback15(
|
|
5383
5395
|
(presetValue) => {
|
|
5384
5396
|
try {
|
|
5385
5397
|
const dates = parseDates(presetValue, format);
|
|
@@ -5638,14 +5650,14 @@ var InsetDrawer = styled20(JoyDrawer2)(({ theme }) => ({
|
|
|
5638
5650
|
}));
|
|
5639
5651
|
|
|
5640
5652
|
// src/components/FilterableCheckboxGroup/FilterableCheckboxGroup.tsx
|
|
5641
|
-
import React32, { useCallback as
|
|
5653
|
+
import React32, { useCallback as useCallback16, useEffect as useEffect9, useMemo as useMemo14, useRef as useRef10, useState as useState11 } from "react";
|
|
5642
5654
|
import SearchIcon from "@mui/icons-material/Search";
|
|
5643
5655
|
import { useThemeProps as useThemeProps8 } from "@mui/joy";
|
|
5644
5656
|
import { useVirtualizer as useVirtualizer3 } from "@tanstack/react-virtual";
|
|
5645
5657
|
var EMPTY_VALUE = [];
|
|
5646
5658
|
function LabelWithTooltip(props) {
|
|
5647
5659
|
const { label, size } = props;
|
|
5648
|
-
const labelContentRef =
|
|
5660
|
+
const labelContentRef = useRef10(null);
|
|
5649
5661
|
const [isOverflowing, setIsOverflowing] = useState11(false);
|
|
5650
5662
|
const labelContent = /* @__PURE__ */ React32.createElement(
|
|
5651
5663
|
"span",
|
|
@@ -5693,12 +5705,12 @@ function FilterableCheckboxGroup(inProps) {
|
|
|
5693
5705
|
const [rawValue, setInternalValue] = useControlledState(
|
|
5694
5706
|
value,
|
|
5695
5707
|
value ?? EMPTY_VALUE,
|
|
5696
|
-
|
|
5708
|
+
useCallback16((newValue) => onChange?.(newValue ?? []), [onChange])
|
|
5697
5709
|
);
|
|
5698
5710
|
const internalValue = rawValue ?? EMPTY_VALUE;
|
|
5699
|
-
const parentRef =
|
|
5700
|
-
const isInitialSortRef =
|
|
5701
|
-
const prevOptionsRef =
|
|
5711
|
+
const parentRef = useRef10(null);
|
|
5712
|
+
const isInitialSortRef = useRef10(false);
|
|
5713
|
+
const prevOptionsRef = useRef10([...options]);
|
|
5702
5714
|
const filteredOptions = useMemo14(() => {
|
|
5703
5715
|
if (!searchTerm) return sortedOptions;
|
|
5704
5716
|
return sortedOptions.filter((option) => option.label.toLowerCase().includes(searchTerm.toLowerCase()));
|
|
@@ -5750,10 +5762,10 @@ function FilterableCheckboxGroup(inProps) {
|
|
|
5750
5762
|
useEffect9(() => {
|
|
5751
5763
|
virtualizer.measure();
|
|
5752
5764
|
}, [virtualizer, filteredOptions, size]);
|
|
5753
|
-
const handleSearchChange =
|
|
5765
|
+
const handleSearchChange = useCallback16((event) => {
|
|
5754
5766
|
setSearchTerm(event.target.value);
|
|
5755
5767
|
}, []);
|
|
5756
|
-
const handleCheckboxChange =
|
|
5768
|
+
const handleCheckboxChange = useCallback16(
|
|
5757
5769
|
(optionValue) => (event) => {
|
|
5758
5770
|
const checked = event.target.checked;
|
|
5759
5771
|
const newValue = checked ? [...internalValue, optionValue] : internalValue.filter((v) => v !== optionValue);
|
|
@@ -5761,7 +5773,7 @@ function FilterableCheckboxGroup(inProps) {
|
|
|
5761
5773
|
},
|
|
5762
5774
|
[internalValue, setInternalValue]
|
|
5763
5775
|
);
|
|
5764
|
-
const handleSelectAll =
|
|
5776
|
+
const handleSelectAll = useCallback16(
|
|
5765
5777
|
(event) => {
|
|
5766
5778
|
const checked = event.target.checked;
|
|
5767
5779
|
const enabledOptions = filteredOptions.filter((option) => !option.disabled);
|
|
@@ -6119,7 +6131,7 @@ function MenuButton2(props) {
|
|
|
6119
6131
|
MenuButton2.displayName = "MenuButton";
|
|
6120
6132
|
|
|
6121
6133
|
// src/components/MonthPicker/MonthPicker.tsx
|
|
6122
|
-
import React36, { forwardRef as forwardRef9, useCallback as
|
|
6134
|
+
import React36, { forwardRef as forwardRef9, useCallback as useCallback17, useEffect as useEffect11, useImperativeHandle as useImperativeHandle4, useRef as useRef11, useState as useState13 } from "react";
|
|
6123
6135
|
import CalendarTodayIcon3 from "@mui/icons-material/CalendarToday";
|
|
6124
6136
|
import { styled as styled21, useThemeProps as useThemeProps9 } from "@mui/joy";
|
|
6125
6137
|
import { FocusTrap as FocusTrap3, ClickAwayListener as ClickAwayListener3, Popper as Popper4 } from "@mui/base";
|
|
@@ -6202,18 +6214,18 @@ var MonthPicker = forwardRef9((inProps, ref) => {
|
|
|
6202
6214
|
locale,
|
|
6203
6215
|
...innerProps
|
|
6204
6216
|
} = props;
|
|
6205
|
-
const innerRef =
|
|
6206
|
-
const buttonRef =
|
|
6217
|
+
const innerRef = useRef11(null);
|
|
6218
|
+
const buttonRef = useRef11(null);
|
|
6207
6219
|
const [rawValue, setValue, isControlled] = useControlledState(
|
|
6208
6220
|
props.value,
|
|
6209
6221
|
props.defaultValue ?? null,
|
|
6210
|
-
|
|
6222
|
+
useCallback17(
|
|
6211
6223
|
(value2) => onChange?.({ target: { name: props.name, value: value2 ?? "" } }),
|
|
6212
6224
|
[props.name, onChange]
|
|
6213
6225
|
)
|
|
6214
6226
|
);
|
|
6215
6227
|
const value = rawValue ?? "";
|
|
6216
|
-
const getFormattedDisplayValue =
|
|
6228
|
+
const getFormattedDisplayValue = useCallback17(
|
|
6217
6229
|
(inputValue) => {
|
|
6218
6230
|
if (!inputValue) return "";
|
|
6219
6231
|
try {
|
|
@@ -6236,7 +6248,7 @@ var MonthPicker = forwardRef9((inProps, ref) => {
|
|
|
6236
6248
|
useEffect11(() => {
|
|
6237
6249
|
setDisplayValue(getFormattedDisplayValue(value));
|
|
6238
6250
|
}, [value, getFormattedDisplayValue]);
|
|
6239
|
-
const handleChange =
|
|
6251
|
+
const handleChange = useCallback17(
|
|
6240
6252
|
(event) => {
|
|
6241
6253
|
const newValue = event.target.value;
|
|
6242
6254
|
setValue(newValue);
|
|
@@ -6246,14 +6258,14 @@ var MonthPicker = forwardRef9((inProps, ref) => {
|
|
|
6246
6258
|
},
|
|
6247
6259
|
[setValue, getFormattedDisplayValue, isControlled]
|
|
6248
6260
|
);
|
|
6249
|
-
const handleCalendarToggle =
|
|
6261
|
+
const handleCalendarToggle = useCallback17(
|
|
6250
6262
|
(event) => {
|
|
6251
6263
|
setAnchorEl(anchorEl ? null : event.currentTarget);
|
|
6252
6264
|
innerRef.current?.focus();
|
|
6253
6265
|
},
|
|
6254
6266
|
[anchorEl, setAnchorEl, innerRef]
|
|
6255
6267
|
);
|
|
6256
|
-
const handleInputMouseDown =
|
|
6268
|
+
const handleInputMouseDown = useCallback17(
|
|
6257
6269
|
(event) => {
|
|
6258
6270
|
event.preventDefault();
|
|
6259
6271
|
buttonRef.current?.focus();
|
|
@@ -6377,7 +6389,7 @@ var MonthPicker = forwardRef9((inProps, ref) => {
|
|
|
6377
6389
|
});
|
|
6378
6390
|
|
|
6379
6391
|
// src/components/MonthRangePicker/MonthRangePicker.tsx
|
|
6380
|
-
import React37, { forwardRef as forwardRef10, useCallback as
|
|
6392
|
+
import React37, { forwardRef as forwardRef10, useCallback as useCallback18, useEffect as useEffect12, useImperativeHandle as useImperativeHandle5, useMemo as useMemo15, useRef as useRef12, useState as useState14 } from "react";
|
|
6381
6393
|
import { IMaskInput as IMaskInput3, IMask as IMask3 } from "react-imask";
|
|
6382
6394
|
import CalendarTodayIcon4 from "@mui/icons-material/CalendarToday";
|
|
6383
6395
|
import { styled as styled22, useThemeProps as useThemeProps10 } from "@mui/joy";
|
|
@@ -6492,12 +6504,12 @@ var MonthRangePicker = forwardRef10((inProps, ref) => {
|
|
|
6492
6504
|
} = props;
|
|
6493
6505
|
const displayFormat = displayFormatProp ?? format;
|
|
6494
6506
|
const isAlphabeticDisplay = hasAlphabeticMonth3(displayFormat);
|
|
6495
|
-
const innerRef =
|
|
6496
|
-
const buttonRef =
|
|
6507
|
+
const innerRef = useRef12(null);
|
|
6508
|
+
const buttonRef = useRef12(null);
|
|
6497
6509
|
const [rawValue, setValue] = useControlledState(
|
|
6498
6510
|
props.value,
|
|
6499
6511
|
props.defaultValue ?? null,
|
|
6500
|
-
|
|
6512
|
+
useCallback18(
|
|
6501
6513
|
(value2) => onChange?.({ target: { name: props.name, value: value2 ?? "" } }),
|
|
6502
6514
|
[props.name, onChange]
|
|
6503
6515
|
)
|
|
@@ -6527,7 +6539,7 @@ var MonthRangePicker = forwardRef10((inProps, ref) => {
|
|
|
6527
6539
|
}
|
|
6528
6540
|
}, [anchorEl, innerRef]);
|
|
6529
6541
|
useImperativeHandle5(ref, () => innerRef.current, [innerRef]);
|
|
6530
|
-
const handleChange =
|
|
6542
|
+
const handleChange = useCallback18(
|
|
6531
6543
|
(event) => {
|
|
6532
6544
|
setDisplayValue(
|
|
6533
6545
|
event.target.value ? formatValueString4(parseDates2(event.target.value), displayFormat, locale) : ""
|
|
@@ -6536,7 +6548,7 @@ var MonthRangePicker = forwardRef10((inProps, ref) => {
|
|
|
6536
6548
|
},
|
|
6537
6549
|
[displayFormat, locale, setValue]
|
|
6538
6550
|
);
|
|
6539
|
-
const handleInputMouseDown =
|
|
6551
|
+
const handleInputMouseDown = useCallback18(
|
|
6540
6552
|
(event) => {
|
|
6541
6553
|
if (isAlphabeticDisplay) {
|
|
6542
6554
|
event.preventDefault();
|
|
@@ -6545,14 +6557,14 @@ var MonthRangePicker = forwardRef10((inProps, ref) => {
|
|
|
6545
6557
|
},
|
|
6546
6558
|
[isAlphabeticDisplay, buttonRef]
|
|
6547
6559
|
);
|
|
6548
|
-
const handleCalendarToggle =
|
|
6560
|
+
const handleCalendarToggle = useCallback18(
|
|
6549
6561
|
(event) => {
|
|
6550
6562
|
setAnchorEl(anchorEl ? null : event.currentTarget);
|
|
6551
6563
|
innerRef.current?.focus();
|
|
6552
6564
|
},
|
|
6553
6565
|
[anchorEl, setAnchorEl, innerRef]
|
|
6554
6566
|
);
|
|
6555
|
-
const handleCalendarChange =
|
|
6567
|
+
const handleCalendarChange = useCallback18(
|
|
6556
6568
|
([date1, date2]) => {
|
|
6557
6569
|
if (!date1 || !date2) return;
|
|
6558
6570
|
const formattedValue = formatValueString4([date1, date2], format);
|
|
@@ -6791,7 +6803,7 @@ function Navigator(props) {
|
|
|
6791
6803
|
Navigator.displayName = "Navigator";
|
|
6792
6804
|
|
|
6793
6805
|
// src/components/PercentageInput/PercentageInput.tsx
|
|
6794
|
-
import React41, { useCallback as
|
|
6806
|
+
import React41, { useCallback as useCallback19, useMemo as useMemo16 } from "react";
|
|
6795
6807
|
import { NumericFormat as NumericFormat2 } from "react-number-format";
|
|
6796
6808
|
import { styled as styled25, useThemeProps as useThemeProps11 } from "@mui/joy";
|
|
6797
6809
|
var padDecimal = (value, decimalScale) => {
|
|
@@ -6848,7 +6860,7 @@ var PercentageInput = React41.forwardRef(
|
|
|
6848
6860
|
const [_value, setValue] = useControlledState(
|
|
6849
6861
|
props.value,
|
|
6850
6862
|
props.defaultValue ?? null,
|
|
6851
|
-
|
|
6863
|
+
useCallback19((value2) => onChange?.({ target: { name, value: value2 } }), [onChange, name])
|
|
6852
6864
|
);
|
|
6853
6865
|
const value = useMemo16(() => {
|
|
6854
6866
|
if (_value && useMinorUnit) {
|
|
@@ -6860,7 +6872,7 @@ var PercentageInput = React41.forwardRef(
|
|
|
6860
6872
|
() => value != null && (max != null && value > max || min != null && value < min),
|
|
6861
6873
|
[max, min, value]
|
|
6862
6874
|
);
|
|
6863
|
-
const handleChange =
|
|
6875
|
+
const handleChange = useCallback19(
|
|
6864
6876
|
(event) => {
|
|
6865
6877
|
if (event.target.value === "") {
|
|
6866
6878
|
setValue(null);
|
|
@@ -7622,7 +7634,7 @@ function ThemeProvider(props) {
|
|
|
7622
7634
|
ThemeProvider.displayName = "ThemeProvider";
|
|
7623
7635
|
|
|
7624
7636
|
// src/components/Uploader/Uploader.tsx
|
|
7625
|
-
import React49, { useCallback as
|
|
7637
|
+
import React49, { useCallback as useCallback20, useEffect as useEffect13, useMemo as useMemo17, useRef as useRef13, useState as useState16 } from "react";
|
|
7626
7638
|
import { styled as styled31, Input as Input2 } from "@mui/joy";
|
|
7627
7639
|
import MuiFileUploadIcon from "@mui/icons-material/CloudUploadRounded";
|
|
7628
7640
|
import MuiUploadFileIcon from "@mui/icons-material/UploadFileRounded";
|
|
@@ -7756,8 +7768,8 @@ var Uploader = React49.memo((props) => {
|
|
|
7756
7768
|
error: errorProp,
|
|
7757
7769
|
helperText: helperTextProp
|
|
7758
7770
|
} = props;
|
|
7759
|
-
const dropZoneRef =
|
|
7760
|
-
const inputRef =
|
|
7771
|
+
const dropZoneRef = useRef13(null);
|
|
7772
|
+
const inputRef = useRef13(null);
|
|
7761
7773
|
const [errorText, setErrorText] = useState16();
|
|
7762
7774
|
const [files, setFiles] = useState16([]);
|
|
7763
7775
|
const [uploaded, setUploaded] = useState16(props.uploaded || []);
|
|
@@ -7807,7 +7819,7 @@ var Uploader = React49.memo((props) => {
|
|
|
7807
7819
|
() => !maxCount || maxCount && [...uploaded, ...files].length !== maxCount,
|
|
7808
7820
|
[files, maxCount, uploaded]
|
|
7809
7821
|
);
|
|
7810
|
-
const addFiles =
|
|
7822
|
+
const addFiles = useCallback20(
|
|
7811
7823
|
(uploads) => {
|
|
7812
7824
|
try {
|
|
7813
7825
|
const types = parsedAccepts.map((type) => type.replace(".", "")) || [];
|
|
@@ -7889,14 +7901,14 @@ var Uploader = React49.memo((props) => {
|
|
|
7889
7901
|
}
|
|
7890
7902
|
}
|
|
7891
7903
|
}, [inputRef, files, minCount]);
|
|
7892
|
-
const handleFileChanged =
|
|
7904
|
+
const handleFileChanged = useCallback20(
|
|
7893
7905
|
(event) => {
|
|
7894
7906
|
const files2 = Array.from(event.target.files || []);
|
|
7895
7907
|
addFiles(files2);
|
|
7896
7908
|
},
|
|
7897
7909
|
[addFiles]
|
|
7898
7910
|
);
|
|
7899
|
-
const handleDeleteFile =
|
|
7911
|
+
const handleDeleteFile = useCallback20(
|
|
7900
7912
|
(deletedFile) => {
|
|
7901
7913
|
if (deletedFile instanceof File) {
|
|
7902
7914
|
setFiles((current) => {
|
|
@@ -7916,7 +7928,7 @@ var Uploader = React49.memo((props) => {
|
|
|
7916
7928
|
},
|
|
7917
7929
|
[name, onChange, onDelete]
|
|
7918
7930
|
);
|
|
7919
|
-
const handleUploaderButtonClick =
|
|
7931
|
+
const handleUploaderButtonClick = useCallback20(() => {
|
|
7920
7932
|
inputRef.current?.click();
|
|
7921
7933
|
}, []);
|
|
7922
7934
|
const uploader = /* @__PURE__ */ React49.createElement(
|