@ceed/cds 1.8.6 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Accordions/Accordions.d.ts +1 -1
- package/dist/components/Accordions/index.d.ts +2 -2
- package/dist/components/Alert/Alert.d.ts +3 -3
- package/dist/components/Autocomplete/Autocomplete.d.ts +3 -3
- package/dist/components/Autocomplete/index.d.ts +2 -2
- package/dist/components/Avatar/Avatar.d.ts +2 -2
- package/dist/components/Box/Box.d.ts +1 -1
- package/dist/components/Box/index.d.ts +2 -2
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +5 -5
- package/dist/components/Breadcrumbs/index.d.ts +2 -2
- package/dist/components/Button/Button.d.ts +4 -4
- package/dist/components/Button/index.d.ts +2 -2
- package/dist/components/Calendar/Calendar.d.ts +2 -2
- package/dist/components/Calendar/hooks/use-calendar-props.d.ts +2 -2
- package/dist/components/Calendar/hooks/use-calendar.d.ts +11 -11
- package/dist/components/Calendar/index.d.ts +2 -2
- package/dist/components/Calendar/types.d.ts +2 -2
- package/dist/components/Card/Card.d.ts +1 -1
- package/dist/components/Card/index.d.ts +2 -2
- package/dist/components/Checkbox/Checkbox.d.ts +3 -3
- package/dist/components/Checkbox/index.d.ts +2 -2
- package/dist/components/Container/Container.d.ts +1 -1
- package/dist/components/Container/index.d.ts +2 -2
- package/dist/components/CurrencyInput/CurrencyInput.d.ts +4 -4
- package/dist/components/DataTable/DataTable.d.ts +3 -3
- package/dist/components/DataTable/index.d.ts +3 -3
- package/dist/components/DataTable/types.d.ts +45 -20
- package/dist/components/DatePicker/DatePicker.d.ts +3 -3
- package/dist/components/DatePicker/index.d.ts +2 -2
- package/dist/components/DateRangePicker/DateRangePicker.d.ts +3 -3
- package/dist/components/DateRangePicker/index.d.ts +2 -2
- package/dist/components/DialogActions/DialogActions.d.ts +1 -1
- package/dist/components/DialogActions/index.d.ts +2 -2
- package/dist/components/DialogContent/DialogContent.d.ts +1 -1
- package/dist/components/DialogContent/index.d.ts +2 -2
- package/dist/components/DialogFrame/DialogFrame.d.ts +1 -1
- package/dist/components/DialogFrame/index.d.ts +2 -2
- package/dist/components/DialogTitle/DialogTitle.d.ts +1 -1
- package/dist/components/DialogTitle/index.d.ts +2 -2
- package/dist/components/Divider/Divider.d.ts +3 -3
- package/dist/components/Divider/index.d.ts +2 -2
- package/dist/components/Drawer/Drawer.d.ts +3 -3
- package/dist/components/Drawer/index.d.ts +2 -2
- package/dist/components/Dropdown/Dropdown.d.ts +1 -1
- package/dist/components/Dropdown/index.d.ts +2 -2
- package/dist/components/FormControl/FormControl.d.ts +1 -1
- package/dist/components/FormControl/index.d.ts +2 -2
- package/dist/components/FormHelperText/FormHelperText.d.ts +1 -1
- package/dist/components/FormHelperText/index.d.ts +2 -2
- package/dist/components/FormLabel/FormLabel.d.ts +1 -1
- package/dist/components/FormLabel/index.d.ts +2 -2
- package/dist/components/Grid/Grid.d.ts +1 -1
- package/dist/components/Grid/index.d.ts +2 -2
- package/dist/components/IconButton/IconButton.d.ts +4 -4
- package/dist/components/IconButton/index.d.ts +2 -2
- package/dist/components/IconMenuButton/IconMenuButton.d.ts +6 -6
- package/dist/components/IconMenuButton/index.d.ts +2 -2
- package/dist/components/InfoSign/InfoSign.d.ts +4 -4
- package/dist/components/InfoSign/index.d.ts +2 -2
- package/dist/components/Input/Input.d.ts +2 -2
- package/dist/components/Input/index.d.ts +2 -2
- package/dist/components/InsetDrawer/index.d.ts +2 -2
- package/dist/components/Markdown/Markdown.d.ts +6 -6
- package/dist/components/Markdown/index.d.ts +2 -2
- package/dist/components/Menu/Menu.d.ts +3 -3
- package/dist/components/Menu/index.d.ts +2 -2
- package/dist/components/MenuButton/MenuButton.d.ts +8 -8
- package/dist/components/MenuButton/index.d.ts +2 -2
- package/dist/components/Modal/Modal.d.ts +1 -1
- package/dist/components/Modal/index.d.ts +2 -2
- package/dist/components/MonthPicker/MonthPicker.d.ts +3 -3
- package/dist/components/MonthPicker/index.d.ts +2 -2
- package/dist/components/MonthRangePicker/MonthRangePicker.d.ts +3 -3
- package/dist/components/MonthRangePicker/index.d.ts +2 -2
- package/dist/components/NavigationGroup/NavigationGroup.d.ts +3 -3
- package/dist/components/NavigationGroup/index.d.ts +2 -2
- package/dist/components/NavigationItem/NavigationItem.d.ts +3 -3
- package/dist/components/NavigationItem/index.d.ts +2 -2
- package/dist/components/Navigator/Navigator.d.ts +3 -3
- package/dist/components/Pagination/Pagination.d.ts +2 -2
- package/dist/components/Pagination/index.d.ts +2 -2
- package/dist/components/PercentageInput/PercentageInput.d.ts +4 -4
- package/dist/components/Radio/Radio.d.ts +1 -1
- package/dist/components/Radio/index.d.ts +2 -2
- package/dist/components/RadioList/RadioList.d.ts +2 -2
- package/dist/components/RadioList/index.d.ts +2 -2
- package/dist/components/Select/Select.d.ts +5 -5
- package/dist/components/Select/index.d.ts +2 -2
- package/dist/components/Sheet/Sheet.d.ts +1 -1
- package/dist/components/Sheet/index.d.ts +2 -2
- package/dist/components/Stack/Stack.d.ts +1 -1
- package/dist/components/Stack/index.d.ts +2 -2
- package/dist/components/Stepper/Stepper.d.ts +2 -2
- package/dist/components/Switch/Switch.d.ts +3 -3
- package/dist/components/Switch/index.d.ts +2 -2
- package/dist/components/Table/Table.d.ts +2 -2
- package/dist/components/Table/index.d.ts +2 -2
- package/dist/components/Tabs/Tabs.d.ts +1 -1
- package/dist/components/Tabs/index.d.ts +2 -2
- package/dist/components/Textarea/Textarea.d.ts +3 -3
- package/dist/components/Textarea/index.d.ts +2 -2
- package/dist/components/ThemeProvider/ThemeProvider.d.ts +20 -20
- package/dist/components/ThemeProvider/index.d.ts +2 -2
- package/dist/components/Tooltip/Tooltip.d.ts +3 -3
- package/dist/components/Tooltip/index.d.ts +2 -2
- package/dist/components/Typography/Typography.d.ts +3 -3
- package/dist/components/Typography/index.d.ts +2 -2
- package/dist/components/Uploader/Uploader.d.ts +1 -1
- package/dist/components/index.d.ts +57 -57
- package/dist/index.cjs +1396 -1783
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1366 -1829
- package/dist/libs/rehype-accent/index.d.ts +2 -2
- package/framer/index.js +38 -38
- package/package.json +6 -1
package/dist/index.cjs
CHANGED
|
@@ -323,16 +323,7 @@ var MotionAlert = (0, import_joy4.styled)((0, import_framer_motion3.motion)(impo
|
|
|
323
323
|
function Alert(props) {
|
|
324
324
|
const { title, content, actions, color = "primary", ...innerProps } = props;
|
|
325
325
|
const invertedColors = props.invertedColors || props.variant === "solid";
|
|
326
|
-
return /* @__PURE__ */ import_react3.default.createElement(
|
|
327
|
-
MotionAlert,
|
|
328
|
-
{
|
|
329
|
-
...innerProps,
|
|
330
|
-
color,
|
|
331
|
-
endDecorator: actions,
|
|
332
|
-
invertedColors
|
|
333
|
-
},
|
|
334
|
-
/* @__PURE__ */ import_react3.default.createElement(Stack_default, null, title && /* @__PURE__ */ import_react3.default.createElement(Typography_default, { level: "title-md", fontWeight: "bold", color }, title), /* @__PURE__ */ import_react3.default.createElement(Typography_default, { level: "body-sm", fontWeight: 500, color }, content))
|
|
335
|
-
);
|
|
326
|
+
return /* @__PURE__ */ import_react3.default.createElement(MotionAlert, { ...innerProps, color, endDecorator: actions, invertedColors }, /* @__PURE__ */ import_react3.default.createElement(Stack_default, null, title && /* @__PURE__ */ import_react3.default.createElement(Typography_default, { level: "title-md", fontWeight: "bold", color }, title), /* @__PURE__ */ import_react3.default.createElement(Typography_default, { level: "body-sm", fontWeight: 500, color }, content)));
|
|
336
327
|
}
|
|
337
328
|
Alert.displayName = "Alert";
|
|
338
329
|
|
|
@@ -409,9 +400,7 @@ var IconButton_default = IconButton;
|
|
|
409
400
|
var import_react5 = require("react");
|
|
410
401
|
function useControlledState(controlledValue, defaultValue, onChange) {
|
|
411
402
|
const { current: isControlled } = (0, import_react5.useRef)(controlledValue !== void 0);
|
|
412
|
-
const [internalValue, setInternalValue] = (0, import_react5.useState)(
|
|
413
|
-
controlledValue ?? defaultValue
|
|
414
|
-
);
|
|
403
|
+
const [internalValue, setInternalValue] = (0, import_react5.useState)(controlledValue ?? defaultValue);
|
|
415
404
|
const displayValue = isControlled ? controlledValue : internalValue;
|
|
416
405
|
(0, import_react5.useEffect)(() => {
|
|
417
406
|
if (isControlled) {
|
|
@@ -785,33 +774,13 @@ function Breadcrumbs(props) {
|
|
|
785
774
|
}
|
|
786
775
|
};
|
|
787
776
|
if (!collapsed) {
|
|
788
|
-
return /* @__PURE__ */ import_react9.default.createElement(
|
|
789
|
-
import_joy15.Breadcrumbs,
|
|
790
|
-
{
|
|
791
|
-
size,
|
|
792
|
-
slots: restSlots,
|
|
793
|
-
slotProps: restSlotProps,
|
|
794
|
-
...innerProps
|
|
795
|
-
},
|
|
796
|
-
crumbs.map((crumb, index) => /* @__PURE__ */ import_react9.default.createElement(Crumb, { key: `breadcrumb-${index}`, ...crumb }))
|
|
797
|
-
);
|
|
777
|
+
return /* @__PURE__ */ import_react9.default.createElement(import_joy15.Breadcrumbs, { size, slots: restSlots, slotProps: restSlotProps, ...innerProps }, crumbs.map((crumb, index) => /* @__PURE__ */ import_react9.default.createElement(Crumb, { key: `breadcrumb-${index}`, ...crumb })));
|
|
798
778
|
}
|
|
799
779
|
const _endCrumbCount = Math.max(1, endCrumbCount);
|
|
800
780
|
const frontCrumbs = crumbs.slice(0, startCrumbCount).map((crumb) => /* @__PURE__ */ import_react9.default.createElement(Crumb, { key: `breadcrumb-${crumb.label}`, ...crumb }));
|
|
801
781
|
const backCrumbs = (startCrumbCount + _endCrumbCount > crumbs.length ? crumbs.slice(startCrumbCount) : crumbs.slice(-_endCrumbCount)).map((crumb) => /* @__PURE__ */ import_react9.default.createElement(Crumb, { key: `breadcrumb-${crumb.label}`, ...crumb }));
|
|
802
782
|
const collapsedCrumbs = crumbs.slice(startCrumbCount, -_endCrumbCount).map((crumb) => /* @__PURE__ */ import_react9.default.createElement(MenuItem, { key: `breadcrumb-${crumb.label}` }, /* @__PURE__ */ import_react9.default.createElement(Crumb, { ...crumb })));
|
|
803
|
-
return /* @__PURE__ */ import_react9.default.createElement(
|
|
804
|
-
import_joy15.Breadcrumbs,
|
|
805
|
-
{
|
|
806
|
-
size,
|
|
807
|
-
slots: restSlots,
|
|
808
|
-
slotProps: restSlotProps,
|
|
809
|
-
...innerProps
|
|
810
|
-
},
|
|
811
|
-
frontCrumbs,
|
|
812
|
-
collapsedCrumbs.length && /* @__PURE__ */ import_react9.default.createElement(Dropdown_default, null, /* @__PURE__ */ import_react9.default.createElement(import_joy15.MenuButton, { size, variant: "plain" }, "..."), /* @__PURE__ */ import_react9.default.createElement(Menu_default, { size }, collapsedCrumbs)),
|
|
813
|
-
backCrumbs
|
|
814
|
-
);
|
|
783
|
+
return /* @__PURE__ */ import_react9.default.createElement(import_joy15.Breadcrumbs, { size, slots: restSlots, slotProps: restSlotProps, ...innerProps }, frontCrumbs, collapsedCrumbs.length && /* @__PURE__ */ import_react9.default.createElement(Dropdown_default, null, /* @__PURE__ */ import_react9.default.createElement(import_joy15.MenuButton, { size, variant: "plain" }, "..."), /* @__PURE__ */ import_react9.default.createElement(Menu_default, { size }, collapsedCrumbs)), backCrumbs);
|
|
815
784
|
}
|
|
816
785
|
Breadcrumbs.displayName = "Breadcrumbs";
|
|
817
786
|
|
|
@@ -820,11 +789,9 @@ var import_react10 = __toESM(require("react"));
|
|
|
820
789
|
var import_joy16 = require("@mui/joy");
|
|
821
790
|
var import_framer_motion11 = require("framer-motion");
|
|
822
791
|
var MotionButton = (0, import_framer_motion11.motion)(import_joy16.Button);
|
|
823
|
-
var Button = (0, import_react10.forwardRef)(
|
|
824
|
-
({ ...props }
|
|
825
|
-
|
|
826
|
-
}
|
|
827
|
-
);
|
|
792
|
+
var Button = (0, import_react10.forwardRef)(({ ...props }, ref) => {
|
|
793
|
+
return /* @__PURE__ */ import_react10.default.createElement(MotionButton, { ref, ...props });
|
|
794
|
+
});
|
|
828
795
|
Button.displayName = "Button";
|
|
829
796
|
|
|
830
797
|
// src/components/Button/index.ts
|
|
@@ -843,9 +810,7 @@ var getCalendarDates = (date) => {
|
|
|
843
810
|
const firstDay = new Date(date.getFullYear(), date.getMonth(), 1);
|
|
844
811
|
const lastDay = new Date(date.getFullYear(), date.getMonth() + 1, 0);
|
|
845
812
|
const firstWeekInThisMonth = Math.ceil((firstDay.getDay() + 1) / 7);
|
|
846
|
-
const lastWeekInThisMonth = Math.ceil(
|
|
847
|
-
(lastDay.getDate() + firstDay.getDay()) / 7
|
|
848
|
-
);
|
|
813
|
+
const lastWeekInThisMonth = Math.ceil((lastDay.getDate() + firstDay.getDay()) / 7);
|
|
849
814
|
let day = 1;
|
|
850
815
|
for (let i = 1; i <= lastWeekInThisMonth; i++) {
|
|
851
816
|
const week = [];
|
|
@@ -920,7 +885,9 @@ var useCalendarProps = (inProps) => {
|
|
|
920
885
|
const [uncontrolledView, setUncontrolledView] = (0, import_react11.useState)(
|
|
921
886
|
() => resolveView(inProps.view || "day", inProps.views || ["day", "month"])
|
|
922
887
|
);
|
|
923
|
-
const [uncontrolledValue, setUncontrolledValue] = (0, import_react11.useState)(
|
|
888
|
+
const [uncontrolledValue, setUncontrolledValue] = (0, import_react11.useState)(
|
|
889
|
+
inProps.defaultValue
|
|
890
|
+
);
|
|
924
891
|
const [viewMonth, setViewMonth] = (0, import_react11.useState)(() => {
|
|
925
892
|
const today = /* @__PURE__ */ new Date();
|
|
926
893
|
today.setDate(1);
|
|
@@ -993,10 +960,7 @@ var useCalendarProps = (inProps) => {
|
|
|
993
960
|
},
|
|
994
961
|
name: "Calendar"
|
|
995
962
|
});
|
|
996
|
-
const ownerState = (0, import_react11.useMemo)(
|
|
997
|
-
() => ({ ...props, viewMonth, direction }),
|
|
998
|
-
[props, viewMonth, direction]
|
|
999
|
-
);
|
|
963
|
+
const ownerState = (0, import_react11.useMemo)(() => ({ ...props, viewMonth, direction }), [props, viewMonth, direction]);
|
|
1000
964
|
return [props, ownerState];
|
|
1001
965
|
};
|
|
1002
966
|
|
|
@@ -1014,11 +978,7 @@ var useCalendar = (ownerState) => {
|
|
|
1014
978
|
const currentMonth = currentDate.getMonth();
|
|
1015
979
|
const currentDay = currentDate.getDate();
|
|
1016
980
|
const prevMonth = new Date(currentYear, currentMonth - 1, 1);
|
|
1017
|
-
const lastDayOfPrevMonth = new Date(
|
|
1018
|
-
currentYear,
|
|
1019
|
-
currentMonth,
|
|
1020
|
-
0
|
|
1021
|
-
).getDate();
|
|
981
|
+
const lastDayOfPrevMonth = new Date(currentYear, currentMonth, 0).getDate();
|
|
1022
982
|
const prevMonthDay = Math.min(currentDay, lastDayOfPrevMonth);
|
|
1023
983
|
prevMonth.setDate(prevMonthDay);
|
|
1024
984
|
ownerState.onMonthChange?.(prevMonth);
|
|
@@ -1035,11 +995,7 @@ var useCalendar = (ownerState) => {
|
|
|
1035
995
|
const currentMonth = currentDate.getMonth();
|
|
1036
996
|
const currentDay = currentDate.getDate();
|
|
1037
997
|
const nextMonth = new Date(currentYear, currentMonth + 1, 1);
|
|
1038
|
-
const lastDayOfNextMonth = new Date(
|
|
1039
|
-
currentYear,
|
|
1040
|
-
currentMonth + 2,
|
|
1041
|
-
0
|
|
1042
|
-
).getDate();
|
|
998
|
+
const lastDayOfNextMonth = new Date(currentYear, currentMonth + 2, 0).getDate();
|
|
1043
999
|
const nextMonthDay = Math.min(currentDay, lastDayOfNextMonth);
|
|
1044
1000
|
nextMonth.setDate(nextMonthDay);
|
|
1045
1001
|
ownerState.onMonthChange?.(nextMonth);
|
|
@@ -1056,22 +1012,13 @@ var useCalendar = (ownerState) => {
|
|
|
1056
1012
|
thisDay.setDate(day);
|
|
1057
1013
|
const inRange = ownerState.rangeSelection && ownerState.value && ownerState.value[0] && // NOTE: hover day is not included in the range
|
|
1058
1014
|
(hoverDay && isWithinRange(ownerState.value[0], hoverDay, thisDay) || // NOTE: Selected range is included in the range
|
|
1059
|
-
ownerState.value[1] && isWithinRange(
|
|
1060
|
-
ownerState.value[0],
|
|
1061
|
-
ownerState.value[1],
|
|
1062
|
-
thisDay
|
|
1063
|
-
));
|
|
1015
|
+
ownerState.value[1] && isWithinRange(ownerState.value[0], ownerState.value[1], thisDay));
|
|
1064
1016
|
return {
|
|
1065
1017
|
"aria-label": thisDay.toLocaleDateString(),
|
|
1066
1018
|
"aria-current": inRange ? "date" : void 0
|
|
1067
1019
|
};
|
|
1068
1020
|
},
|
|
1069
|
-
[
|
|
1070
|
-
ownerState.rangeSelection,
|
|
1071
|
-
ownerState.value,
|
|
1072
|
-
ownerState.viewMonth,
|
|
1073
|
-
hoverDay
|
|
1074
|
-
]
|
|
1021
|
+
[ownerState.rangeSelection, ownerState.value, ownerState.viewMonth, hoverDay]
|
|
1075
1022
|
),
|
|
1076
1023
|
getMonthCellProps: (0, import_react12.useCallback)(
|
|
1077
1024
|
(monthIndex) => {
|
|
@@ -1082,22 +1029,13 @@ var useCalendar = (ownerState) => {
|
|
|
1082
1029
|
const isMonthRangeSelection = !ownerState.views?.find((view) => view === "day") && ownerState.rangeSelection;
|
|
1083
1030
|
const inRange = isMonthRangeSelection && ownerState.value && ownerState.value[0] && // NOTE: hover day is not included in the range
|
|
1084
1031
|
(hoverMonth && isWithinRange(ownerState.value[0], hoverMonth, thisMonth) || // NOTE: Selected range is included in the range
|
|
1085
|
-
ownerState.value[1] && isWithinRange(
|
|
1086
|
-
ownerState.value[0],
|
|
1087
|
-
ownerState.value[1],
|
|
1088
|
-
thisMonth
|
|
1089
|
-
));
|
|
1032
|
+
ownerState.value[1] && isWithinRange(ownerState.value[0], ownerState.value[1], thisMonth));
|
|
1090
1033
|
return {
|
|
1091
1034
|
"aria-label": thisMonth.toLocaleDateString(),
|
|
1092
1035
|
"aria-current": inRange ? "date" : void 0
|
|
1093
1036
|
};
|
|
1094
1037
|
},
|
|
1095
|
-
[
|
|
1096
|
-
ownerState.rangeSelection,
|
|
1097
|
-
ownerState.value,
|
|
1098
|
-
ownerState.viewMonth,
|
|
1099
|
-
hoverMonth
|
|
1100
|
-
]
|
|
1038
|
+
[ownerState.rangeSelection, ownerState.value, ownerState.viewMonth, hoverMonth]
|
|
1101
1039
|
),
|
|
1102
1040
|
getPickerDayProps: (0, import_react12.useCallback)(
|
|
1103
1041
|
(day) => {
|
|
@@ -1107,23 +1045,15 @@ var useCalendar = (ownerState) => {
|
|
|
1107
1045
|
const isSelected = !!ownerState.value && (isSameDay(thisDay, ownerState.value[0]) || ownerState.value[1] && isSameDay(thisDay, ownerState.value[1]));
|
|
1108
1046
|
const inRange = ownerState.rangeSelection && ownerState.value && ownerState.value[0] && // NOTE: hover day is not included in the range
|
|
1109
1047
|
(hoverDay && isWithinRange(ownerState.value[0], hoverDay, thisDay) || // NOTE: Selected range is included in the range
|
|
1110
|
-
ownerState.value[1] && isWithinRange(
|
|
1111
|
-
ownerState.value[0],
|
|
1112
|
-
ownerState.value[1],
|
|
1113
|
-
thisDay
|
|
1114
|
-
));
|
|
1048
|
+
ownerState.value[1] && isWithinRange(ownerState.value[0], ownerState.value[1], thisDay));
|
|
1115
1049
|
const handleDayClick = () => {
|
|
1116
1050
|
if (ownerState.rangeSelection) {
|
|
1117
1051
|
if (!ownerState.value) {
|
|
1118
1052
|
ownerState.onChange?.([thisDay, void 0]);
|
|
1119
1053
|
} else if (ownerState.value[0] && !ownerState.value[1]) {
|
|
1120
1054
|
ownerState.onChange?.([
|
|
1121
|
-
new Date(
|
|
1122
|
-
|
|
1123
|
-
),
|
|
1124
|
-
new Date(
|
|
1125
|
-
Math.max(ownerState.value[0].getTime(), thisDay.getTime())
|
|
1126
|
-
)
|
|
1055
|
+
new Date(Math.min(ownerState.value[0].getTime(), thisDay.getTime())),
|
|
1056
|
+
new Date(Math.max(ownerState.value[0].getTime(), thisDay.getTime()))
|
|
1127
1057
|
]);
|
|
1128
1058
|
} else {
|
|
1129
1059
|
ownerState.onChange?.([thisDay, void 0]);
|
|
@@ -1172,23 +1102,15 @@ var useCalendar = (ownerState) => {
|
|
|
1172
1102
|
const isSelected = !!ownerState.value && (isSameMonth(thisMonth, ownerState.value[0]) || ownerState.value[1] && isSameMonth(thisMonth, ownerState.value[1]));
|
|
1173
1103
|
const inRange = isMonthRangeSelection && ownerState.value && ownerState.value[0] && // NOTE: hover day is not included in the range
|
|
1174
1104
|
(hoverMonth && isWithinRange(ownerState.value[0], hoverMonth, thisMonth) || // NOTE: Selected range is included in the range
|
|
1175
|
-
ownerState.value[1] && isWithinRange(
|
|
1176
|
-
ownerState.value[0],
|
|
1177
|
-
ownerState.value[1],
|
|
1178
|
-
thisMonth
|
|
1179
|
-
));
|
|
1105
|
+
ownerState.value[1] && isWithinRange(ownerState.value[0], ownerState.value[1], thisMonth));
|
|
1180
1106
|
const handleMonthClick = () => {
|
|
1181
1107
|
if (isMonthRangeSelection) {
|
|
1182
1108
|
if (!ownerState.value) {
|
|
1183
1109
|
ownerState.onChange?.([thisMonth, void 0]);
|
|
1184
1110
|
} else if (ownerState.value[0] && !ownerState.value[1]) {
|
|
1185
1111
|
ownerState.onChange?.([
|
|
1186
|
-
new Date(
|
|
1187
|
-
|
|
1188
|
-
),
|
|
1189
|
-
new Date(
|
|
1190
|
-
Math.max(ownerState.value[0].getTime(), thisMonth.getTime())
|
|
1191
|
-
)
|
|
1112
|
+
new Date(Math.min(ownerState.value[0].getTime(), thisMonth.getTime())),
|
|
1113
|
+
new Date(Math.max(ownerState.value[0].getTime(), thisMonth.getTime()))
|
|
1192
1114
|
]);
|
|
1193
1115
|
} else {
|
|
1194
1116
|
ownerState.onChange?.([thisMonth, void 0]);
|
|
@@ -1258,15 +1180,13 @@ var CalendarViewContainer = (0, import_joy18.styled)("div", {
|
|
|
1258
1180
|
name: "Calendar",
|
|
1259
1181
|
slot: "viewContainer",
|
|
1260
1182
|
shouldForwardProp: (prop) => prop !== "calendarType"
|
|
1261
|
-
})(
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
})
|
|
1269
|
-
);
|
|
1183
|
+
})(({ theme, calendarType }) => ({
|
|
1184
|
+
paddingLeft: theme.spacing(2),
|
|
1185
|
+
paddingRight: theme.spacing(2),
|
|
1186
|
+
position: "relative",
|
|
1187
|
+
overflow: "hidden",
|
|
1188
|
+
minHeight: calendarType === "datePicker" ? "250px" : "unset"
|
|
1189
|
+
}));
|
|
1270
1190
|
var CalendarViewTable = (0, import_joy18.styled)(import_framer_motion12.motion.table, {
|
|
1271
1191
|
name: "Calendar",
|
|
1272
1192
|
slot: "viewTable"
|
|
@@ -1445,14 +1365,8 @@ var swipePower = (offset, velocity) => {
|
|
|
1445
1365
|
var PickerDays = (props) => {
|
|
1446
1366
|
const { ownerState } = props;
|
|
1447
1367
|
const { getPickerDayProps, getDayCellProps } = useCalendar(ownerState);
|
|
1448
|
-
const calendarDates = (0, import_react13.useMemo)(
|
|
1449
|
-
|
|
1450
|
-
[ownerState.viewMonth]
|
|
1451
|
-
);
|
|
1452
|
-
const weekdayNames = (0, import_react13.useMemo)(
|
|
1453
|
-
() => getWeekdayNames(ownerState.locale || "default"),
|
|
1454
|
-
[ownerState.locale]
|
|
1455
|
-
);
|
|
1368
|
+
const calendarDates = (0, import_react13.useMemo)(() => getCalendarDates(ownerState.viewMonth), [ownerState.viewMonth]);
|
|
1369
|
+
const weekdayNames = (0, import_react13.useMemo)(() => getWeekdayNames(ownerState.locale || "default"), [ownerState.locale]);
|
|
1456
1370
|
return /* @__PURE__ */ import_react13.default.createElement(CalendarViewContainer, { calendarType: "datePicker" }, /* @__PURE__ */ import_react13.default.createElement(import_framer_motion12.AnimatePresence, { initial: false, custom: ownerState.direction }, /* @__PURE__ */ import_react13.default.createElement(
|
|
1457
1371
|
CalendarViewTable,
|
|
1458
1372
|
{
|
|
@@ -1482,25 +1396,9 @@ var PickerDays = (props) => {
|
|
|
1482
1396
|
}
|
|
1483
1397
|
}
|
|
1484
1398
|
},
|
|
1485
|
-
/* @__PURE__ */ import_react13.default.createElement(CalendarWeekHeaderContainer, null, /* @__PURE__ */ import_react13.default.createElement("tr", null, weekdayNames.map((name, i) => /* @__PURE__ */ import_react13.default.createElement(import_react13.Fragment, { key: `${ownerState.viewMonth}_${name}_${i}` }, /* @__PURE__ */ import_react13.default.createElement("th", null, /* @__PURE__ */ import_react13.default.createElement(Typography_default, { level: "body-xs", textAlign: "center" }, name)), i < 6 && /* @__PURE__ */ import_react13.default.createElement(
|
|
1486
|
-
"th",
|
|
1487
|
-
{
|
|
1488
|
-
style: { width: 4 },
|
|
1489
|
-
"aria-hidden": "true",
|
|
1490
|
-
"aria-description": "cell-gap"
|
|
1491
|
-
}
|
|
1492
|
-
))))),
|
|
1399
|
+
/* @__PURE__ */ import_react13.default.createElement(CalendarWeekHeaderContainer, null, /* @__PURE__ */ import_react13.default.createElement("tr", null, weekdayNames.map((name, i) => /* @__PURE__ */ import_react13.default.createElement(import_react13.Fragment, { key: `${ownerState.viewMonth}_${name}_${i}` }, /* @__PURE__ */ import_react13.default.createElement("th", null, /* @__PURE__ */ import_react13.default.createElement(Typography_default, { level: "body-xs", textAlign: "center" }, name)), i < 6 && /* @__PURE__ */ import_react13.default.createElement("th", { style: { width: 4 }, "aria-hidden": "true", "aria-description": "cell-gap" }))))),
|
|
1493
1400
|
/* @__PURE__ */ import_react13.default.createElement(CalendarDayPickerContainer, null, calendarDates.map((weekDates, rowIndex) => /* @__PURE__ */ import_react13.default.createElement(import_react13.Fragment, { key: `${ownerState.viewMonth}_${rowIndex}` }, /* @__PURE__ */ import_react13.default.createElement("tr", null, weekDates.map(
|
|
1494
|
-
(date, i) => date ? /* @__PURE__ */ import_react13.default.createElement(import_react13.Fragment, { key: `${ownerState.viewMonth}_${date}_${i}` }, /* @__PURE__ */ import_react13.default.createElement(CalendarDayCell, { ...getDayCellProps(date) }, /* @__PURE__ */ import_react13.default.createElement(
|
|
1495
|
-
CalendarDay,
|
|
1496
|
-
{
|
|
1497
|
-
size: "sm",
|
|
1498
|
-
variant: "plain",
|
|
1499
|
-
color: "neutral",
|
|
1500
|
-
...getPickerDayProps(date)
|
|
1501
|
-
},
|
|
1502
|
-
date
|
|
1503
|
-
)), i < 6 && /* @__PURE__ */ import_react13.default.createElement("td", { "aria-hidden": "true", "aria-description": "cell-gap" })) : /* @__PURE__ */ import_react13.default.createElement(import_react13.Fragment, { key: `${ownerState.viewMonth}_${i}` }, /* @__PURE__ */ import_react13.default.createElement("td", null), i < 6 && /* @__PURE__ */ import_react13.default.createElement("td", { "aria-hidden": "true", "aria-description": "cell-gap" }))
|
|
1401
|
+
(date, i) => date ? /* @__PURE__ */ import_react13.default.createElement(import_react13.Fragment, { key: `${ownerState.viewMonth}_${date}_${i}` }, /* @__PURE__ */ import_react13.default.createElement(CalendarDayCell, { ...getDayCellProps(date) }, /* @__PURE__ */ import_react13.default.createElement(CalendarDay, { size: "sm", variant: "plain", color: "neutral", ...getPickerDayProps(date) }, date)), i < 6 && /* @__PURE__ */ import_react13.default.createElement("td", { "aria-hidden": "true", "aria-description": "cell-gap" })) : /* @__PURE__ */ import_react13.default.createElement(import_react13.Fragment, { key: `${ownerState.viewMonth}_${i}` }, /* @__PURE__ */ import_react13.default.createElement("td", null), i < 6 && /* @__PURE__ */ import_react13.default.createElement("td", { "aria-hidden": "true", "aria-description": "cell-gap" }))
|
|
1504
1402
|
)), rowIndex < calendarDates.length - 1 && /* @__PURE__ */ import_react13.default.createElement("tr", { "aria-hidden": "true", "aria-description": "row-gap" }, /* @__PURE__ */ import_react13.default.createElement("td", { colSpan: 13, style: { height: 4 } })))))
|
|
1505
1403
|
)));
|
|
1506
1404
|
};
|
|
@@ -1518,62 +1416,37 @@ var PickerMonths = (props) => {
|
|
|
1518
1416
|
[[]]
|
|
1519
1417
|
);
|
|
1520
1418
|
const isMonthPicker = !ownerState.views?.find((view) => view === "day");
|
|
1521
|
-
return /* @__PURE__ */ import_react13.default.createElement(
|
|
1522
|
-
|
|
1419
|
+
return /* @__PURE__ */ import_react13.default.createElement(CalendarViewContainer, { calendarType: isMonthPicker ? "monthPicker" : "datePicker" }, /* @__PURE__ */ import_react13.default.createElement(import_framer_motion12.AnimatePresence, { initial: false, custom: ownerState.direction }, /* @__PURE__ */ import_react13.default.createElement(
|
|
1420
|
+
CalendarViewTable,
|
|
1523
1421
|
{
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
animate: "center",
|
|
1534
|
-
exit: "exit",
|
|
1535
|
-
transition: {
|
|
1536
|
-
x: { type: "spring", stiffness: 300, damping: 30 },
|
|
1537
|
-
opacity: { duration: 0.2 }
|
|
1538
|
-
},
|
|
1539
|
-
drag: "x",
|
|
1540
|
-
dragConstraints: { left: 0, right: 0 },
|
|
1541
|
-
dragElastic: 1,
|
|
1542
|
-
onDragEnd: (e, { offset, velocity }) => {
|
|
1543
|
-
const swipe = swipePower(offset.x, velocity.x);
|
|
1544
|
-
if (swipe < -swipeConfidenceThreshold) {
|
|
1545
|
-
const date = new Date(ownerState.viewMonth || /* @__PURE__ */ new Date());
|
|
1546
|
-
date.setMonth(date.getMonth() + 1);
|
|
1547
|
-
ownerState.onMonthChange?.(date);
|
|
1548
|
-
} else if (swipe > swipeConfidenceThreshold) {
|
|
1549
|
-
const date = new Date(ownerState.viewMonth || /* @__PURE__ */ new Date());
|
|
1550
|
-
date.setMonth(date.getMonth() - 1);
|
|
1551
|
-
ownerState.onMonthChange?.(date);
|
|
1552
|
-
}
|
|
1553
|
-
}
|
|
1422
|
+
key: `${ownerState.viewMonth.getFullYear()}_${ownerState.direction}`,
|
|
1423
|
+
custom: ownerState.direction,
|
|
1424
|
+
variants,
|
|
1425
|
+
initial: "enter",
|
|
1426
|
+
animate: "center",
|
|
1427
|
+
exit: "exit",
|
|
1428
|
+
transition: {
|
|
1429
|
+
x: { type: "spring", stiffness: 300, damping: 30 },
|
|
1430
|
+
opacity: { duration: 0.2 }
|
|
1554
1431
|
},
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
ownerState.
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
"td",
|
|
1569
|
-
{
|
|
1570
|
-
style: { width: 4 },
|
|
1571
|
-
"aria-hidden": "true",
|
|
1572
|
-
"aria-description": "cell-gap"
|
|
1432
|
+
drag: "x",
|
|
1433
|
+
dragConstraints: { left: 0, right: 0 },
|
|
1434
|
+
dragElastic: 1,
|
|
1435
|
+
onDragEnd: (e, { offset, velocity }) => {
|
|
1436
|
+
const swipe = swipePower(offset.x, velocity.x);
|
|
1437
|
+
if (swipe < -swipeConfidenceThreshold) {
|
|
1438
|
+
const date = new Date(ownerState.viewMonth || /* @__PURE__ */ new Date());
|
|
1439
|
+
date.setMonth(date.getMonth() + 1);
|
|
1440
|
+
ownerState.onMonthChange?.(date);
|
|
1441
|
+
} else if (swipe > swipeConfidenceThreshold) {
|
|
1442
|
+
const date = new Date(ownerState.viewMonth || /* @__PURE__ */ new Date());
|
|
1443
|
+
date.setMonth(date.getMonth() - 1);
|
|
1444
|
+
ownerState.onMonthChange?.(date);
|
|
1573
1445
|
}
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1446
|
+
}
|
|
1447
|
+
},
|
|
1448
|
+
/* @__PURE__ */ import_react13.default.createElement("tbody", null, chunkedMonths.map((months, i) => /* @__PURE__ */ import_react13.default.createElement(import_react13.Fragment, { key: months.join("_") }, /* @__PURE__ */ import_react13.default.createElement("tr", null, months.map((monthIndex, j) => /* @__PURE__ */ import_react13.default.createElement(import_react13.Fragment, { key: monthIndex }, /* @__PURE__ */ import_react13.default.createElement(CalendarMonthCell, { ...getMonthCellProps(monthIndex) }, /* @__PURE__ */ import_react13.default.createElement(CalendarMonth, { size: "sm", variant: "plain", color: "neutral", ...getPickerMonthProps(monthIndex) }, getMonthNameFromIndex(monthIndex, ownerState.locale))), j < 3 && /* @__PURE__ */ import_react13.default.createElement("td", { style: { width: 4 }, "aria-hidden": "true", "aria-description": "cell-gap" })))), i < chunkedMonths.length - 1 && /* @__PURE__ */ import_react13.default.createElement("tr", { "aria-hidden": "true", "aria-description": "row-gap" }, /* @__PURE__ */ import_react13.default.createElement("td", { colSpan: 7, style: { height: 4 } })))))
|
|
1449
|
+
)));
|
|
1577
1450
|
};
|
|
1578
1451
|
var Calendar = (0, import_react13.forwardRef)((inProps, ref) => {
|
|
1579
1452
|
const [props, ownerState] = useCalendarProps(inProps);
|
|
@@ -1594,15 +1467,7 @@ var Calendar = (0, import_react13.forwardRef)((inProps, ref) => {
|
|
|
1594
1467
|
...others
|
|
1595
1468
|
} = props;
|
|
1596
1469
|
const { calendarTitle, onPrev, onNext } = useCalendar(ownerState);
|
|
1597
|
-
return /* @__PURE__ */ import_react13.default.createElement(CalendarRoot, { ref, ...others }, /* @__PURE__ */ import_react13.default.createElement(CalendarHeader, null, /* @__PURE__ */ import_react13.default.createElement(
|
|
1598
|
-
IconButton_default,
|
|
1599
|
-
{
|
|
1600
|
-
size: "sm",
|
|
1601
|
-
onClick: onPrev,
|
|
1602
|
-
"aria-label": `Previous ${view === "day" ? "Month" : "Year"}`
|
|
1603
|
-
},
|
|
1604
|
-
/* @__PURE__ */ import_react13.default.createElement(import_ChevronLeft.default, null)
|
|
1605
|
-
), /* @__PURE__ */ import_react13.default.createElement(
|
|
1470
|
+
return /* @__PURE__ */ import_react13.default.createElement(CalendarRoot, { ref, ...others }, /* @__PURE__ */ import_react13.default.createElement(CalendarHeader, null, /* @__PURE__ */ import_react13.default.createElement(IconButton_default, { size: "sm", onClick: onPrev, "aria-label": `Previous ${view === "day" ? "Month" : "Year"}` }, /* @__PURE__ */ import_react13.default.createElement(import_ChevronLeft.default, null)), /* @__PURE__ */ import_react13.default.createElement(
|
|
1606
1471
|
CalendarSwitchViewButton,
|
|
1607
1472
|
{
|
|
1608
1473
|
ownerState,
|
|
@@ -1612,15 +1477,7 @@ var Calendar = (0, import_react13.forwardRef)((inProps, ref) => {
|
|
|
1612
1477
|
"aria-label": "Switch Calendar View"
|
|
1613
1478
|
},
|
|
1614
1479
|
calendarTitle
|
|
1615
|
-
), /* @__PURE__ */ import_react13.default.createElement(
|
|
1616
|
-
IconButton_default,
|
|
1617
|
-
{
|
|
1618
|
-
size: "sm",
|
|
1619
|
-
onClick: onNext,
|
|
1620
|
-
"aria-label": `Next ${view === "day" ? "Month" : "Year"}`
|
|
1621
|
-
},
|
|
1622
|
-
/* @__PURE__ */ import_react13.default.createElement(import_ChevronRight.default, null)
|
|
1623
|
-
)), view === "day" && /* @__PURE__ */ import_react13.default.createElement(PickerDays, { ownerState }), view === "month" && /* @__PURE__ */ import_react13.default.createElement(PickerMonths, { ownerState }));
|
|
1480
|
+
), /* @__PURE__ */ import_react13.default.createElement(IconButton_default, { size: "sm", onClick: onNext, "aria-label": `Next ${view === "day" ? "Month" : "Year"}` }, /* @__PURE__ */ import_react13.default.createElement(import_ChevronRight.default, null))), view === "day" && /* @__PURE__ */ import_react13.default.createElement(PickerDays, { ownerState }), view === "month" && /* @__PURE__ */ import_react13.default.createElement(PickerMonths, { ownerState }));
|
|
1624
1481
|
});
|
|
1625
1482
|
Calendar.displayName = "Calendar";
|
|
1626
1483
|
|
|
@@ -1758,23 +1615,15 @@ var Input = import_react16.default.forwardRef((props, ref) => {
|
|
|
1758
1615
|
...innerProps.slotProps
|
|
1759
1616
|
},
|
|
1760
1617
|
...innerProps,
|
|
1761
|
-
endDecorator: enableClearable ? /* @__PURE__ */ import_react16.default.createElement(
|
|
1762
|
-
|
|
1618
|
+
endDecorator: enableClearable ? /* @__PURE__ */ import_react16.default.createElement(Stack_default, { gap: 1, direction: "row" }, innerProps.endDecorator, value && /* @__PURE__ */ import_react16.default.createElement(
|
|
1619
|
+
IconButton_default,
|
|
1763
1620
|
{
|
|
1764
|
-
|
|
1765
|
-
|
|
1621
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
1622
|
+
onClick: handleClear,
|
|
1623
|
+
"aria-label": "Clear"
|
|
1766
1624
|
},
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
IconButton_default,
|
|
1770
|
-
{
|
|
1771
|
-
onMouseDown: (e) => e.preventDefault(),
|
|
1772
|
-
onClick: handleClear,
|
|
1773
|
-
"aria-label": "Clear"
|
|
1774
|
-
},
|
|
1775
|
-
/* @__PURE__ */ import_react16.default.createElement(import_Close2.default, null)
|
|
1776
|
-
)
|
|
1777
|
-
) : innerProps.endDecorator
|
|
1625
|
+
/* @__PURE__ */ import_react16.default.createElement(import_Close2.default, null)
|
|
1626
|
+
)) : innerProps.endDecorator
|
|
1778
1627
|
}
|
|
1779
1628
|
);
|
|
1780
1629
|
return /* @__PURE__ */ import_react16.default.createElement(
|
|
@@ -1962,25 +1811,23 @@ var useCurrencySetting = (props) => {
|
|
|
1962
1811
|
};
|
|
1963
1812
|
|
|
1964
1813
|
// src/components/CurrencyInput/CurrencyInput.tsx
|
|
1965
|
-
var TextMaskAdapter = import_react17.default.forwardRef(
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
}
|
|
1983
|
-
);
|
|
1814
|
+
var TextMaskAdapter = import_react17.default.forwardRef(function TextMaskAdapter2(props, ref) {
|
|
1815
|
+
const { onChange, ...innerProps } = props;
|
|
1816
|
+
return /* @__PURE__ */ import_react17.default.createElement(
|
|
1817
|
+
import_react_number_format.NumericFormat,
|
|
1818
|
+
{
|
|
1819
|
+
...innerProps,
|
|
1820
|
+
onValueChange: ({ value }) => {
|
|
1821
|
+
onChange?.({
|
|
1822
|
+
target: { name: props.name, value }
|
|
1823
|
+
});
|
|
1824
|
+
},
|
|
1825
|
+
valueIsNumericString: true,
|
|
1826
|
+
getInputRef: ref,
|
|
1827
|
+
allowNegative: true
|
|
1828
|
+
}
|
|
1829
|
+
);
|
|
1830
|
+
});
|
|
1984
1831
|
var CurrencyInputRoot = (0, import_joy23.styled)(Input_default, {
|
|
1985
1832
|
name: "CurrencyInput",
|
|
1986
1833
|
slot: "root",
|
|
@@ -2003,21 +1850,11 @@ var CurrencyInput = import_react17.default.forwardRef(function CurrencyInput2(in
|
|
|
2003
1850
|
className,
|
|
2004
1851
|
...innerProps
|
|
2005
1852
|
} = props;
|
|
2006
|
-
const {
|
|
2007
|
-
symbol,
|
|
2008
|
-
thousandSeparator,
|
|
2009
|
-
decimalSeparator,
|
|
2010
|
-
placeholder,
|
|
2011
|
-
fixedDecimalScale,
|
|
2012
|
-
decimalScale
|
|
2013
|
-
} = useCurrencySetting(props);
|
|
1853
|
+
const { symbol, thousandSeparator, decimalSeparator, placeholder, fixedDecimalScale, decimalScale } = useCurrencySetting(props);
|
|
2014
1854
|
const [_value, setValue] = useControlledState(
|
|
2015
1855
|
props.value,
|
|
2016
1856
|
props.defaultValue,
|
|
2017
|
-
(0, import_react17.useCallback)(
|
|
2018
|
-
(value2) => onChange?.({ target: { name, value: value2 } }),
|
|
2019
|
-
[onChange, name]
|
|
2020
|
-
)
|
|
1857
|
+
(0, import_react17.useCallback)((value2) => onChange?.({ target: { name, value: value2 } }), [onChange, name])
|
|
2021
1858
|
);
|
|
2022
1859
|
const value = (0, import_react17.useMemo)(() => {
|
|
2023
1860
|
if (_value && useMinorUnit) {
|
|
@@ -2031,9 +1868,7 @@ var CurrencyInput = import_react17.default.forwardRef(function CurrencyInput2(in
|
|
|
2031
1868
|
}
|
|
2032
1869
|
return props.max;
|
|
2033
1870
|
}, [props.max, useMinorUnit, decimalScale]);
|
|
2034
|
-
const [isOverLimit, setIsOverLimit] = (0, import_react17.useState)(
|
|
2035
|
-
!!max && !!value && value > max
|
|
2036
|
-
);
|
|
1871
|
+
const [isOverLimit, setIsOverLimit] = (0, import_react17.useState)(!!max && !!value && value > max);
|
|
2037
1872
|
const handleChange = (0, import_react17.useCallback)(
|
|
2038
1873
|
(event) => {
|
|
2039
1874
|
if (event.target.value === "") {
|
|
@@ -2063,9 +1898,9 @@ var CurrencyInput = import_react17.default.forwardRef(function CurrencyInput2(in
|
|
|
2063
1898
|
required,
|
|
2064
1899
|
color: error || isOverLimit ? "danger" : props.color,
|
|
2065
1900
|
label,
|
|
2066
|
-
helperText: isOverLimit ? new import_intl_messageformat2.IntlMessageFormat(
|
|
2067
|
-
|
|
2068
|
-
|
|
1901
|
+
helperText: isOverLimit ? new import_intl_messageformat2.IntlMessageFormat(`limit: {amount, number, ::currency/${currency} unit-width-narrow}`).format({
|
|
1902
|
+
amount: max
|
|
1903
|
+
}) : helperText,
|
|
2069
1904
|
slotProps: {
|
|
2070
1905
|
input: {
|
|
2071
1906
|
component: TextMaskAdapter,
|
|
@@ -2161,13 +1996,7 @@ function TableBody(props) {
|
|
|
2161
1996
|
textAlign: "center"
|
|
2162
1997
|
}
|
|
2163
1998
|
},
|
|
2164
|
-
/* @__PURE__ */ import_react18.default.createElement(
|
|
2165
|
-
RenderCheckbox,
|
|
2166
|
-
{
|
|
2167
|
-
onChange: (event) => onCheckboxChange?.(event, rowIndex),
|
|
2168
|
-
...checkboxProps
|
|
2169
|
-
}
|
|
2170
|
-
)
|
|
1999
|
+
/* @__PURE__ */ import_react18.default.createElement(RenderCheckbox, { onChange: (event) => onCheckboxChange?.(event, rowIndex), ...checkboxProps })
|
|
2171
2000
|
), cellOrder.map((cellKey) => /* @__PURE__ */ import_react18.default.createElement(
|
|
2172
2001
|
"td",
|
|
2173
2002
|
{
|
|
@@ -2212,9 +2041,7 @@ var CalendarButton = (0, import_joy27.styled)(IconButton_default, {
|
|
|
2212
2041
|
"&:focus": {
|
|
2213
2042
|
"--Icon-color": "currentColor",
|
|
2214
2043
|
outlineOffset: `${theme.getCssVar("focus-thickness")}`,
|
|
2215
|
-
outline: `${theme.getCssVar("focus-thickness")} solid ${theme.getCssVar(
|
|
2216
|
-
"palette-focusVisible"
|
|
2217
|
-
)}`
|
|
2044
|
+
outline: `${theme.getCssVar("focus-thickness")} solid ${theme.getCssVar("palette-focusVisible")}`
|
|
2218
2045
|
}
|
|
2219
2046
|
}));
|
|
2220
2047
|
var StyledPopper = (0, import_joy27.styled)(import_base2.Popper, {
|
|
@@ -2248,9 +2075,7 @@ var validValueFormat = (value, format) => {
|
|
|
2248
2075
|
if (value !== formatValueString(parsedValue, format)) {
|
|
2249
2076
|
return false;
|
|
2250
2077
|
}
|
|
2251
|
-
const regex = new RegExp(
|
|
2252
|
-
`^${format.replace(/Y/g, "\\d").replace(/M/g, "\\d").replace(/D/g, "\\d")}$`
|
|
2253
|
-
);
|
|
2078
|
+
const regex = new RegExp(`^${format.replace(/Y/g, "\\d").replace(/M/g, "\\d").replace(/D/g, "\\d")}$`);
|
|
2254
2079
|
return regex.test(value);
|
|
2255
2080
|
} catch (e) {
|
|
2256
2081
|
return false;
|
|
@@ -2291,310 +2116,293 @@ function parseDate(dateString, format) {
|
|
|
2291
2116
|
var formatToPattern = (format) => {
|
|
2292
2117
|
return format.replace(/YYYY/g, "Y").replace(/MM/g, "M").replace(/DD/g, "D").replace(/[^YMD\s]/g, (match) => `${match}\``);
|
|
2293
2118
|
};
|
|
2294
|
-
var TextMaskAdapter3 = import_react19.default.forwardRef(
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
maxLength: 2
|
|
2311
|
-
},
|
|
2312
|
-
M: {
|
|
2313
|
-
mask: import_react_imask.IMask.MaskedRange,
|
|
2314
|
-
from: 1,
|
|
2315
|
-
to: 12,
|
|
2316
|
-
maxLength: 2
|
|
2317
|
-
},
|
|
2318
|
-
Y: {
|
|
2319
|
-
mask: import_react_imask.IMask.MaskedRange,
|
|
2320
|
-
from: 1900,
|
|
2321
|
-
to: 9999,
|
|
2322
|
-
maxLength: 4
|
|
2323
|
-
}
|
|
2119
|
+
var TextMaskAdapter3 = import_react19.default.forwardRef(function TextMaskAdapter4(props, ref) {
|
|
2120
|
+
const { onChange, format, ...other } = props;
|
|
2121
|
+
return /* @__PURE__ */ import_react19.default.createElement(
|
|
2122
|
+
import_react_imask.IMaskInput,
|
|
2123
|
+
{
|
|
2124
|
+
...other,
|
|
2125
|
+
inputRef: ref,
|
|
2126
|
+
onAccept: (value) => onChange({ target: { name: props.name, value } }),
|
|
2127
|
+
mask: Date,
|
|
2128
|
+
pattern: formatToPattern(format),
|
|
2129
|
+
blocks: {
|
|
2130
|
+
D: {
|
|
2131
|
+
mask: import_react_imask.IMask.MaskedRange,
|
|
2132
|
+
from: 1,
|
|
2133
|
+
to: 31,
|
|
2134
|
+
maxLength: 2
|
|
2324
2135
|
},
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
);
|
|
2331
|
-
}
|
|
2332
|
-
);
|
|
2333
|
-
var DatePicker = (0, import_react19.forwardRef)(
|
|
2334
|
-
(inProps, ref) => {
|
|
2335
|
-
const props = (0, import_joy27.useThemeProps)({ props: inProps, name: "DatePicker" });
|
|
2336
|
-
const {
|
|
2337
|
-
onChange,
|
|
2338
|
-
disabled,
|
|
2339
|
-
label,
|
|
2340
|
-
error,
|
|
2341
|
-
helperText,
|
|
2342
|
-
minDate,
|
|
2343
|
-
maxDate,
|
|
2344
|
-
disableFuture,
|
|
2345
|
-
disablePast,
|
|
2346
|
-
required,
|
|
2347
|
-
// NOTE: 스타일 관련된 props는 최상위 엘리먼트에 적용한다.
|
|
2348
|
-
sx,
|
|
2349
|
-
className,
|
|
2350
|
-
format = "YYYY/MM/DD",
|
|
2351
|
-
displayFormat = "YYYY/MM/DD",
|
|
2352
|
-
size,
|
|
2353
|
-
inputReadOnly,
|
|
2354
|
-
hideClearButton,
|
|
2355
|
-
readOnly,
|
|
2356
|
-
shouldDisableDate,
|
|
2357
|
-
...innerProps
|
|
2358
|
-
} = props;
|
|
2359
|
-
const innerRef = (0, import_react19.useRef)(null);
|
|
2360
|
-
const buttonRef = (0, import_react19.useRef)(null);
|
|
2361
|
-
const [value, setValue] = useControlledState(
|
|
2362
|
-
props.value,
|
|
2363
|
-
props.defaultValue || "",
|
|
2364
|
-
(0, import_react19.useCallback)(
|
|
2365
|
-
(value2) => onChange?.({ target: { name: props.name, value: value2 } }),
|
|
2366
|
-
[props.name, onChange]
|
|
2367
|
-
)
|
|
2368
|
-
);
|
|
2369
|
-
const [displayValue, setDisplayValue] = (0, import_react19.useState)(
|
|
2370
|
-
() => value ? formatValueString(parseDate(value, format), displayFormat) : ""
|
|
2371
|
-
);
|
|
2372
|
-
const [anchorEl, setAnchorEl] = (0, import_react19.useState)(null);
|
|
2373
|
-
const open = Boolean(anchorEl);
|
|
2374
|
-
(0, import_react19.useEffect)(() => {
|
|
2375
|
-
if (!anchorEl) {
|
|
2376
|
-
innerRef.current?.blur();
|
|
2377
|
-
}
|
|
2378
|
-
}, [anchorEl, innerRef]);
|
|
2379
|
-
(0, import_react19.useEffect)(() => {
|
|
2380
|
-
if (value === "") {
|
|
2381
|
-
setDisplayValue("");
|
|
2382
|
-
return;
|
|
2383
|
-
}
|
|
2384
|
-
const formattedValue = formatValueString(
|
|
2385
|
-
parseDate(value, format),
|
|
2386
|
-
displayFormat
|
|
2387
|
-
);
|
|
2388
|
-
if (validValueFormat(formattedValue, displayFormat) && formattedValue !== displayValue) {
|
|
2389
|
-
setDisplayValue(formattedValue);
|
|
2390
|
-
}
|
|
2391
|
-
}, [displayFormat, displayValue, format, value]);
|
|
2392
|
-
(0, import_react19.useImperativeHandle)(ref, () => innerRef.current, [
|
|
2393
|
-
innerRef
|
|
2394
|
-
]);
|
|
2395
|
-
const handleChange = (0, import_react19.useCallback)(
|
|
2396
|
-
(event) => {
|
|
2397
|
-
const value2 = event.target.value;
|
|
2398
|
-
setDisplayValue(
|
|
2399
|
-
value2 ? formatValueString(parseDate(value2, format), displayFormat) : value2
|
|
2400
|
-
);
|
|
2401
|
-
setValue(value2);
|
|
2402
|
-
},
|
|
2403
|
-
[displayFormat, format, setValue]
|
|
2404
|
-
);
|
|
2405
|
-
const handleDisplayInputChange = (0, import_react19.useCallback)(
|
|
2406
|
-
(event) => {
|
|
2407
|
-
if (event.target.value === "") {
|
|
2408
|
-
handleChange({
|
|
2409
|
-
target: {
|
|
2410
|
-
name: props.name,
|
|
2411
|
-
value: ""
|
|
2412
|
-
}
|
|
2413
|
-
});
|
|
2414
|
-
return;
|
|
2415
|
-
}
|
|
2416
|
-
const isValidDisplayValue = validValueFormat(
|
|
2417
|
-
event.target.value,
|
|
2418
|
-
displayFormat
|
|
2419
|
-
);
|
|
2420
|
-
if (isValidDisplayValue) {
|
|
2421
|
-
const parsedDate = parseDate(event.target.value, displayFormat);
|
|
2422
|
-
const formattedValue = formatValueString(parsedDate, format);
|
|
2423
|
-
handleChange({
|
|
2424
|
-
target: {
|
|
2425
|
-
name: props.name,
|
|
2426
|
-
value: formattedValue
|
|
2427
|
-
}
|
|
2428
|
-
});
|
|
2429
|
-
}
|
|
2430
|
-
},
|
|
2431
|
-
[displayFormat, format, handleChange, props.name]
|
|
2432
|
-
);
|
|
2433
|
-
const handleCalendarToggle = (0, import_react19.useCallback)(
|
|
2434
|
-
(event) => {
|
|
2435
|
-
setAnchorEl(anchorEl ? null : event.currentTarget);
|
|
2436
|
-
setTimeout(() => {
|
|
2437
|
-
innerRef.current?.focus();
|
|
2438
|
-
}, 0);
|
|
2439
|
-
},
|
|
2440
|
-
[anchorEl, setAnchorEl, innerRef]
|
|
2441
|
-
);
|
|
2442
|
-
const handleInputMouseDown = (0, import_react19.useCallback)(
|
|
2443
|
-
(event) => {
|
|
2444
|
-
if (inputReadOnly) {
|
|
2445
|
-
event.preventDefault();
|
|
2446
|
-
buttonRef.current?.focus();
|
|
2447
|
-
}
|
|
2448
|
-
},
|
|
2449
|
-
[inputReadOnly, buttonRef]
|
|
2450
|
-
);
|
|
2451
|
-
return /* @__PURE__ */ import_react19.default.createElement(DatePickerRoot, null, /* @__PURE__ */ import_react19.default.createElement(import_base2.FocusTrap, { open: true }, /* @__PURE__ */ import_react19.default.createElement(import_react19.default.Fragment, null, /* @__PURE__ */ import_react19.default.createElement(
|
|
2452
|
-
Input_default,
|
|
2453
|
-
{
|
|
2454
|
-
...innerProps,
|
|
2455
|
-
color: error ? "danger" : innerProps.color,
|
|
2456
|
-
ref: innerRef,
|
|
2457
|
-
size,
|
|
2458
|
-
value: displayValue,
|
|
2459
|
-
onChange: handleDisplayInputChange,
|
|
2460
|
-
placeholder: displayFormat,
|
|
2461
|
-
disabled,
|
|
2462
|
-
required,
|
|
2463
|
-
error,
|
|
2464
|
-
slotProps: {
|
|
2465
|
-
input: {
|
|
2466
|
-
component: TextMaskAdapter3,
|
|
2467
|
-
ref: innerRef,
|
|
2468
|
-
format: displayFormat,
|
|
2469
|
-
sx: {
|
|
2470
|
-
"&:hover": {
|
|
2471
|
-
cursor: inputReadOnly || readOnly ? "default" : "text"
|
|
2472
|
-
}
|
|
2473
|
-
},
|
|
2474
|
-
onMouseDown: handleInputMouseDown
|
|
2475
|
-
}
|
|
2136
|
+
M: {
|
|
2137
|
+
mask: import_react_imask.IMask.MaskedRange,
|
|
2138
|
+
from: 1,
|
|
2139
|
+
to: 12,
|
|
2140
|
+
maxLength: 2
|
|
2476
2141
|
},
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
ref: buttonRef,
|
|
2483
|
-
variant: "plain",
|
|
2484
|
-
onClick: readOnly ? void 0 : handleCalendarToggle,
|
|
2485
|
-
"aria-label": "Toggle Calendar",
|
|
2486
|
-
"aria-controls": "date-picker-popper",
|
|
2487
|
-
"aria-haspopup": "dialog",
|
|
2488
|
-
"aria-expanded": open,
|
|
2489
|
-
disabled
|
|
2490
|
-
},
|
|
2491
|
-
/* @__PURE__ */ import_react19.default.createElement(import_CalendarToday.default, null)
|
|
2492
|
-
),
|
|
2493
|
-
label,
|
|
2494
|
-
helperText,
|
|
2495
|
-
readOnly: readOnly || inputReadOnly
|
|
2496
|
-
}
|
|
2497
|
-
), open && /* @__PURE__ */ import_react19.default.createElement(import_base2.ClickAwayListener, { onClickAway: () => setAnchorEl(null) }, /* @__PURE__ */ import_react19.default.createElement(
|
|
2498
|
-
StyledPopper,
|
|
2499
|
-
{
|
|
2500
|
-
id: "date-picker-popper",
|
|
2501
|
-
open: true,
|
|
2502
|
-
anchorEl,
|
|
2503
|
-
placement: "bottom-end",
|
|
2504
|
-
onMouseDown: (e) => e.preventDefault(),
|
|
2505
|
-
modifiers: [
|
|
2506
|
-
{
|
|
2507
|
-
name: "offset",
|
|
2508
|
-
options: {
|
|
2509
|
-
offset: [4, 4]
|
|
2510
|
-
}
|
|
2511
|
-
}
|
|
2512
|
-
],
|
|
2513
|
-
"aria-label": "Calendar Tooltip",
|
|
2514
|
-
"aria-expanded": open
|
|
2515
|
-
},
|
|
2516
|
-
/* @__PURE__ */ import_react19.default.createElement(CalendarSheet, { tabIndex: -1, role: "presentation" }, /* @__PURE__ */ import_react19.default.createElement(
|
|
2517
|
-
Calendar_default,
|
|
2518
|
-
{
|
|
2519
|
-
value: value && !Number.isNaN(parseDate(value, format).getTime()) ? [parseDate(value, format), void 0] : void 0,
|
|
2520
|
-
onChange: ([date]) => {
|
|
2521
|
-
handleChange({
|
|
2522
|
-
target: {
|
|
2523
|
-
name: props.name,
|
|
2524
|
-
value: formatValueString(date, format)
|
|
2525
|
-
}
|
|
2526
|
-
});
|
|
2527
|
-
setAnchorEl(null);
|
|
2528
|
-
},
|
|
2529
|
-
minDate: minDate ? new Date(minDate) : void 0,
|
|
2530
|
-
maxDate: maxDate ? new Date(maxDate) : void 0,
|
|
2531
|
-
disableFuture,
|
|
2532
|
-
disablePast,
|
|
2533
|
-
shouldDisableDate: shouldDisableDate ? (date) => shouldDisableDate(formatValueString(date, format)) : void 0
|
|
2142
|
+
Y: {
|
|
2143
|
+
mask: import_react_imask.IMask.MaskedRange,
|
|
2144
|
+
from: 1900,
|
|
2145
|
+
to: 9999,
|
|
2146
|
+
maxLength: 4
|
|
2534
2147
|
}
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
size,
|
|
2546
|
-
variant: "plain",
|
|
2547
|
-
color: "neutral",
|
|
2548
|
-
onClick: () => {
|
|
2549
|
-
handleChange({
|
|
2550
|
-
target: {
|
|
2551
|
-
name: props.name,
|
|
2552
|
-
value: ""
|
|
2553
|
-
}
|
|
2554
|
-
});
|
|
2555
|
-
setAnchorEl(null);
|
|
2556
|
-
}
|
|
2557
|
-
},
|
|
2558
|
-
"Clear"
|
|
2559
|
-
)
|
|
2560
|
-
))
|
|
2561
|
-
)))));
|
|
2562
|
-
}
|
|
2563
|
-
);
|
|
2564
|
-
|
|
2565
|
-
// src/components/DatePicker/index.ts
|
|
2566
|
-
var DatePicker_default = DatePicker;
|
|
2567
|
-
|
|
2568
|
-
// src/components/Textarea/Textarea.tsx
|
|
2569
|
-
var import_react20 = __toESM(require("react"));
|
|
2570
|
-
var import_joy28 = require("@mui/joy");
|
|
2571
|
-
var import_framer_motion18 = require("framer-motion");
|
|
2572
|
-
var MotionTextarea = (0, import_framer_motion18.motion)(import_joy28.Textarea);
|
|
2573
|
-
var Textarea = (props) => {
|
|
2148
|
+
},
|
|
2149
|
+
format: (date) => formatValueString(date, format),
|
|
2150
|
+
parse: (str) => parseDate(str, format),
|
|
2151
|
+
autofix: "pad",
|
|
2152
|
+
overwrite: true
|
|
2153
|
+
}
|
|
2154
|
+
);
|
|
2155
|
+
});
|
|
2156
|
+
var DatePicker = (0, import_react19.forwardRef)((inProps, ref) => {
|
|
2157
|
+
const props = (0, import_joy27.useThemeProps)({ props: inProps, name: "DatePicker" });
|
|
2574
2158
|
const {
|
|
2159
|
+
onChange,
|
|
2160
|
+
disabled,
|
|
2575
2161
|
label,
|
|
2576
2162
|
error,
|
|
2577
2163
|
helperText,
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2164
|
+
minDate,
|
|
2165
|
+
maxDate,
|
|
2166
|
+
disableFuture,
|
|
2167
|
+
disablePast,
|
|
2581
2168
|
required,
|
|
2582
|
-
minRows = 2,
|
|
2583
|
-
maxRows = 4,
|
|
2584
2169
|
// NOTE: 스타일 관련된 props는 최상위 엘리먼트에 적용한다.
|
|
2585
2170
|
sx,
|
|
2586
2171
|
className,
|
|
2172
|
+
format = "YYYY/MM/DD",
|
|
2173
|
+
displayFormat = "YYYY/MM/DD",
|
|
2174
|
+
size,
|
|
2175
|
+
inputReadOnly,
|
|
2176
|
+
hideClearButton,
|
|
2177
|
+
readOnly,
|
|
2178
|
+
shouldDisableDate,
|
|
2587
2179
|
...innerProps
|
|
2588
2180
|
} = props;
|
|
2589
|
-
const
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2181
|
+
const innerRef = (0, import_react19.useRef)(null);
|
|
2182
|
+
const buttonRef = (0, import_react19.useRef)(null);
|
|
2183
|
+
const [value, setValue] = useControlledState(
|
|
2184
|
+
props.value,
|
|
2185
|
+
props.defaultValue || "",
|
|
2186
|
+
(0, import_react19.useCallback)((value2) => onChange?.({ target: { name: props.name, value: value2 } }), [props.name, onChange])
|
|
2187
|
+
);
|
|
2188
|
+
const [displayValue, setDisplayValue] = (0, import_react19.useState)(
|
|
2189
|
+
() => value ? formatValueString(parseDate(value, format), displayFormat) : ""
|
|
2190
|
+
);
|
|
2191
|
+
const [anchorEl, setAnchorEl] = (0, import_react19.useState)(null);
|
|
2192
|
+
const open = Boolean(anchorEl);
|
|
2193
|
+
(0, import_react19.useEffect)(() => {
|
|
2194
|
+
if (!anchorEl) {
|
|
2195
|
+
innerRef.current?.blur();
|
|
2196
|
+
}
|
|
2197
|
+
}, [anchorEl, innerRef]);
|
|
2198
|
+
(0, import_react19.useEffect)(() => {
|
|
2199
|
+
if (value === "") {
|
|
2200
|
+
setDisplayValue("");
|
|
2201
|
+
return;
|
|
2202
|
+
}
|
|
2203
|
+
const formattedValue = formatValueString(parseDate(value, format), displayFormat);
|
|
2204
|
+
if (validValueFormat(formattedValue, displayFormat) && formattedValue !== displayValue) {
|
|
2205
|
+
setDisplayValue(formattedValue);
|
|
2206
|
+
}
|
|
2207
|
+
}, [displayFormat, displayValue, format, value]);
|
|
2208
|
+
(0, import_react19.useImperativeHandle)(ref, () => innerRef.current, [innerRef]);
|
|
2209
|
+
const handleChange = (0, import_react19.useCallback)(
|
|
2210
|
+
(event) => {
|
|
2211
|
+
const value2 = event.target.value;
|
|
2212
|
+
setDisplayValue(value2 ? formatValueString(parseDate(value2, format), displayFormat) : value2);
|
|
2213
|
+
setValue(value2);
|
|
2214
|
+
},
|
|
2215
|
+
[displayFormat, format, setValue]
|
|
2216
|
+
);
|
|
2217
|
+
const handleDisplayInputChange = (0, import_react19.useCallback)(
|
|
2218
|
+
(event) => {
|
|
2219
|
+
if (event.target.value === "") {
|
|
2220
|
+
handleChange({
|
|
2221
|
+
target: {
|
|
2222
|
+
name: props.name,
|
|
2223
|
+
value: ""
|
|
2224
|
+
}
|
|
2225
|
+
});
|
|
2226
|
+
return;
|
|
2227
|
+
}
|
|
2228
|
+
const isValidDisplayValue = validValueFormat(event.target.value, displayFormat);
|
|
2229
|
+
if (isValidDisplayValue) {
|
|
2230
|
+
const parsedDate = parseDate(event.target.value, displayFormat);
|
|
2231
|
+
const formattedValue = formatValueString(parsedDate, format);
|
|
2232
|
+
handleChange({
|
|
2233
|
+
target: {
|
|
2234
|
+
name: props.name,
|
|
2235
|
+
value: formattedValue
|
|
2236
|
+
}
|
|
2237
|
+
});
|
|
2238
|
+
}
|
|
2239
|
+
},
|
|
2240
|
+
[displayFormat, format, handleChange, props.name]
|
|
2241
|
+
);
|
|
2242
|
+
const handleCalendarToggle = (0, import_react19.useCallback)(
|
|
2243
|
+
(event) => {
|
|
2244
|
+
setAnchorEl(anchorEl ? null : event.currentTarget);
|
|
2245
|
+
setTimeout(() => {
|
|
2246
|
+
innerRef.current?.focus();
|
|
2247
|
+
}, 0);
|
|
2248
|
+
},
|
|
2249
|
+
[anchorEl, setAnchorEl, innerRef]
|
|
2250
|
+
);
|
|
2251
|
+
const handleInputMouseDown = (0, import_react19.useCallback)(
|
|
2252
|
+
(event) => {
|
|
2253
|
+
if (inputReadOnly) {
|
|
2254
|
+
event.preventDefault();
|
|
2255
|
+
buttonRef.current?.focus();
|
|
2256
|
+
}
|
|
2257
|
+
},
|
|
2258
|
+
[inputReadOnly, buttonRef]
|
|
2259
|
+
);
|
|
2260
|
+
return /* @__PURE__ */ import_react19.default.createElement(DatePickerRoot, null, /* @__PURE__ */ import_react19.default.createElement(import_base2.FocusTrap, { open: true }, /* @__PURE__ */ import_react19.default.createElement(import_react19.default.Fragment, null, /* @__PURE__ */ import_react19.default.createElement(
|
|
2261
|
+
Input_default,
|
|
2262
|
+
{
|
|
2263
|
+
...innerProps,
|
|
2264
|
+
color: error ? "danger" : innerProps.color,
|
|
2265
|
+
ref: innerRef,
|
|
2266
|
+
size,
|
|
2267
|
+
value: displayValue,
|
|
2268
|
+
onChange: handleDisplayInputChange,
|
|
2269
|
+
placeholder: displayFormat,
|
|
2270
|
+
disabled,
|
|
2271
|
+
required,
|
|
2272
|
+
error,
|
|
2273
|
+
slotProps: {
|
|
2274
|
+
input: {
|
|
2275
|
+
component: TextMaskAdapter3,
|
|
2276
|
+
ref: innerRef,
|
|
2277
|
+
format: displayFormat,
|
|
2278
|
+
sx: {
|
|
2279
|
+
"&:hover": {
|
|
2280
|
+
cursor: inputReadOnly || readOnly ? "default" : "text"
|
|
2281
|
+
}
|
|
2282
|
+
},
|
|
2283
|
+
onMouseDown: handleInputMouseDown
|
|
2284
|
+
}
|
|
2285
|
+
},
|
|
2286
|
+
className,
|
|
2287
|
+
sx,
|
|
2288
|
+
endDecorator: /* @__PURE__ */ import_react19.default.createElement(
|
|
2289
|
+
CalendarButton,
|
|
2290
|
+
{
|
|
2291
|
+
ref: buttonRef,
|
|
2292
|
+
variant: "plain",
|
|
2293
|
+
onClick: readOnly ? void 0 : handleCalendarToggle,
|
|
2294
|
+
"aria-label": "Toggle Calendar",
|
|
2295
|
+
"aria-controls": "date-picker-popper",
|
|
2296
|
+
"aria-haspopup": "dialog",
|
|
2297
|
+
"aria-expanded": open,
|
|
2298
|
+
disabled
|
|
2299
|
+
},
|
|
2300
|
+
/* @__PURE__ */ import_react19.default.createElement(import_CalendarToday.default, null)
|
|
2301
|
+
),
|
|
2302
|
+
label,
|
|
2303
|
+
helperText,
|
|
2304
|
+
readOnly: readOnly || inputReadOnly
|
|
2305
|
+
}
|
|
2306
|
+
), open && /* @__PURE__ */ import_react19.default.createElement(import_base2.ClickAwayListener, { onClickAway: () => setAnchorEl(null) }, /* @__PURE__ */ import_react19.default.createElement(
|
|
2307
|
+
StyledPopper,
|
|
2308
|
+
{
|
|
2309
|
+
id: "date-picker-popper",
|
|
2310
|
+
open: true,
|
|
2311
|
+
anchorEl,
|
|
2312
|
+
placement: "bottom-end",
|
|
2313
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
2314
|
+
modifiers: [
|
|
2315
|
+
{
|
|
2316
|
+
name: "offset",
|
|
2317
|
+
options: {
|
|
2318
|
+
offset: [4, 4]
|
|
2319
|
+
}
|
|
2320
|
+
}
|
|
2321
|
+
],
|
|
2322
|
+
"aria-label": "Calendar Tooltip",
|
|
2323
|
+
"aria-expanded": open
|
|
2324
|
+
},
|
|
2325
|
+
/* @__PURE__ */ import_react19.default.createElement(CalendarSheet, { tabIndex: -1, role: "presentation" }, /* @__PURE__ */ import_react19.default.createElement(
|
|
2326
|
+
Calendar_default,
|
|
2327
|
+
{
|
|
2328
|
+
value: value && !Number.isNaN(parseDate(value, format).getTime()) ? [parseDate(value, format), void 0] : void 0,
|
|
2329
|
+
onChange: ([date]) => {
|
|
2330
|
+
handleChange({
|
|
2331
|
+
target: {
|
|
2332
|
+
name: props.name,
|
|
2333
|
+
value: formatValueString(date, format)
|
|
2334
|
+
}
|
|
2335
|
+
});
|
|
2336
|
+
setAnchorEl(null);
|
|
2337
|
+
},
|
|
2338
|
+
minDate: minDate ? new Date(minDate) : void 0,
|
|
2339
|
+
maxDate: maxDate ? new Date(maxDate) : void 0,
|
|
2340
|
+
disableFuture,
|
|
2341
|
+
disablePast,
|
|
2342
|
+
shouldDisableDate: shouldDisableDate ? (date) => shouldDisableDate(formatValueString(date, format)) : void 0
|
|
2343
|
+
}
|
|
2344
|
+
), !hideClearButton && /* @__PURE__ */ import_react19.default.createElement(
|
|
2345
|
+
DialogActions_default,
|
|
2346
|
+
{
|
|
2347
|
+
sx: {
|
|
2348
|
+
p: 1
|
|
2349
|
+
}
|
|
2350
|
+
},
|
|
2351
|
+
/* @__PURE__ */ import_react19.default.createElement(
|
|
2352
|
+
Button_default,
|
|
2353
|
+
{
|
|
2354
|
+
size,
|
|
2355
|
+
variant: "plain",
|
|
2356
|
+
color: "neutral",
|
|
2357
|
+
onClick: () => {
|
|
2358
|
+
handleChange({
|
|
2359
|
+
target: {
|
|
2360
|
+
name: props.name,
|
|
2361
|
+
value: ""
|
|
2362
|
+
}
|
|
2363
|
+
});
|
|
2364
|
+
setAnchorEl(null);
|
|
2365
|
+
}
|
|
2366
|
+
},
|
|
2367
|
+
"Clear"
|
|
2368
|
+
)
|
|
2369
|
+
))
|
|
2370
|
+
)))));
|
|
2371
|
+
});
|
|
2372
|
+
|
|
2373
|
+
// src/components/DatePicker/index.ts
|
|
2374
|
+
var DatePicker_default = DatePicker;
|
|
2375
|
+
|
|
2376
|
+
// src/components/Textarea/Textarea.tsx
|
|
2377
|
+
var import_react20 = __toESM(require("react"));
|
|
2378
|
+
var import_joy28 = require("@mui/joy");
|
|
2379
|
+
var import_framer_motion18 = require("framer-motion");
|
|
2380
|
+
var MotionTextarea = (0, import_framer_motion18.motion)(import_joy28.Textarea);
|
|
2381
|
+
var Textarea = (props) => {
|
|
2382
|
+
const {
|
|
2383
|
+
label,
|
|
2384
|
+
error,
|
|
2385
|
+
helperText,
|
|
2386
|
+
color,
|
|
2387
|
+
size,
|
|
2388
|
+
disabled,
|
|
2389
|
+
required,
|
|
2390
|
+
minRows = 2,
|
|
2391
|
+
maxRows = 4,
|
|
2392
|
+
// NOTE: 스타일 관련된 props는 최상위 엘리먼트에 적용한다.
|
|
2393
|
+
sx,
|
|
2394
|
+
className,
|
|
2395
|
+
...innerProps
|
|
2396
|
+
} = props;
|
|
2397
|
+
const textarea = /* @__PURE__ */ import_react20.default.createElement(
|
|
2398
|
+
MotionTextarea,
|
|
2399
|
+
{
|
|
2400
|
+
required,
|
|
2401
|
+
disabled,
|
|
2402
|
+
color: error ? "danger" : color,
|
|
2403
|
+
size,
|
|
2404
|
+
minRows,
|
|
2405
|
+
maxRows,
|
|
2598
2406
|
...innerProps
|
|
2599
2407
|
}
|
|
2600
2408
|
);
|
|
@@ -2793,18 +2601,9 @@ function Pagination(props) {
|
|
|
2793
2601
|
setPaginationModel({ ...paginationModel, page: newPage });
|
|
2794
2602
|
};
|
|
2795
2603
|
const firstPage = 1;
|
|
2796
|
-
const lastPage = Math.max(
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
);
|
|
2800
|
-
const beforePages = [
|
|
2801
|
-
paginationModel.page - 2,
|
|
2802
|
-
paginationModel.page - 1
|
|
2803
|
-
].filter((p) => p > 1);
|
|
2804
|
-
const afterPages = [
|
|
2805
|
-
paginationModel.page + 1,
|
|
2806
|
-
paginationModel.page + 2
|
|
2807
|
-
].filter((p) => p <= lastPage - 1);
|
|
2604
|
+
const lastPage = Math.max(firstPage, Math.ceil(rowCount / paginationModel.pageSize));
|
|
2605
|
+
const beforePages = [paginationModel.page - 2, paginationModel.page - 1].filter((p) => p > 1);
|
|
2606
|
+
const afterPages = [paginationModel.page + 1, paginationModel.page + 2].filter((p) => p <= lastPage - 1);
|
|
2808
2607
|
const isMoreAfterPages = lastPage > 1 && paginationModel.page < lastPage - 3;
|
|
2809
2608
|
const isMoreBeforePages = lastPage > 1 && paginationModel.page > 4;
|
|
2810
2609
|
(0, import_react23.useEffect)(() => {
|
|
@@ -2823,16 +2622,7 @@ function Pagination(props) {
|
|
|
2823
2622
|
"aria-label": "Previous page"
|
|
2824
2623
|
},
|
|
2825
2624
|
/* @__PURE__ */ import_react23.default.createElement(import_ChevronLeft2.default, null)
|
|
2826
|
-
), paginationModel.page !== firstPage && /* @__PURE__ */ import_react23.default.createElement(
|
|
2827
|
-
PaginationButton,
|
|
2828
|
-
{
|
|
2829
|
-
size,
|
|
2830
|
-
variant: "plain",
|
|
2831
|
-
color: "neutral",
|
|
2832
|
-
onClick: () => handlePageChange(firstPage)
|
|
2833
|
-
},
|
|
2834
|
-
firstPage
|
|
2835
|
-
), isMoreBeforePages && /* @__PURE__ */ import_react23.default.createElement(
|
|
2625
|
+
), paginationModel.page !== firstPage && /* @__PURE__ */ import_react23.default.createElement(PaginationButton, { size, variant: "plain", color: "neutral", onClick: () => handlePageChange(firstPage) }, firstPage), isMoreBeforePages && /* @__PURE__ */ import_react23.default.createElement(
|
|
2836
2626
|
PaginationButton,
|
|
2837
2627
|
{
|
|
2838
2628
|
size,
|
|
@@ -2842,27 +2632,7 @@ function Pagination(props) {
|
|
|
2842
2632
|
"aria-label": "More previous pages"
|
|
2843
2633
|
},
|
|
2844
2634
|
"..."
|
|
2845
|
-
), beforePages.map((p) => /* @__PURE__ */ import_react23.default.createElement(
|
|
2846
|
-
PaginationButton,
|
|
2847
|
-
{
|
|
2848
|
-
key: p,
|
|
2849
|
-
size,
|
|
2850
|
-
variant: "plain",
|
|
2851
|
-
color: "neutral",
|
|
2852
|
-
onClick: () => handlePageChange(p)
|
|
2853
|
-
},
|
|
2854
|
-
p
|
|
2855
|
-
)), /* @__PURE__ */ import_react23.default.createElement(PaginationButton, { active: "active", size, "aria-current": "page" }, paginationModel.page), afterPages.map((p) => /* @__PURE__ */ import_react23.default.createElement(
|
|
2856
|
-
PaginationButton,
|
|
2857
|
-
{
|
|
2858
|
-
key: p,
|
|
2859
|
-
size,
|
|
2860
|
-
variant: "plain",
|
|
2861
|
-
color: "neutral",
|
|
2862
|
-
onClick: () => handlePageChange(p)
|
|
2863
|
-
},
|
|
2864
|
-
p
|
|
2865
|
-
)), isMoreAfterPages && /* @__PURE__ */ import_react23.default.createElement(
|
|
2635
|
+
), beforePages.map((p) => /* @__PURE__ */ import_react23.default.createElement(PaginationButton, { key: p, size, variant: "plain", color: "neutral", onClick: () => handlePageChange(p) }, p)), /* @__PURE__ */ import_react23.default.createElement(PaginationButton, { active: "active", size, "aria-current": "page" }, paginationModel.page), afterPages.map((p) => /* @__PURE__ */ import_react23.default.createElement(PaginationButton, { key: p, size, variant: "plain", color: "neutral", onClick: () => handlePageChange(p) }, p)), isMoreAfterPages && /* @__PURE__ */ import_react23.default.createElement(
|
|
2866
2636
|
PaginationButton,
|
|
2867
2637
|
{
|
|
2868
2638
|
size,
|
|
@@ -2872,16 +2642,7 @@ function Pagination(props) {
|
|
|
2872
2642
|
onClick: () => handlePageChange(paginationModel.page + 3)
|
|
2873
2643
|
},
|
|
2874
2644
|
"..."
|
|
2875
|
-
), paginationModel.page !== lastPage && /* @__PURE__ */ import_react23.default.createElement(
|
|
2876
|
-
PaginationButton,
|
|
2877
|
-
{
|
|
2878
|
-
size,
|
|
2879
|
-
variant: "plain",
|
|
2880
|
-
color: "neutral",
|
|
2881
|
-
onClick: () => handlePageChange(lastPage)
|
|
2882
|
-
},
|
|
2883
|
-
lastPage
|
|
2884
|
-
), /* @__PURE__ */ import_react23.default.createElement(
|
|
2645
|
+
), paginationModel.page !== lastPage && /* @__PURE__ */ import_react23.default.createElement(PaginationButton, { size, variant: "plain", color: "neutral", onClick: () => handlePageChange(lastPage) }, lastPage), /* @__PURE__ */ import_react23.default.createElement(
|
|
2885
2646
|
PaginationIconButton,
|
|
2886
2647
|
{
|
|
2887
2648
|
size,
|
|
@@ -2933,6 +2694,118 @@ function InfoSign(props) {
|
|
|
2933
2694
|
var InfoSign_default = InfoSign;
|
|
2934
2695
|
|
|
2935
2696
|
// src/components/DataTable/DataTable.tsx
|
|
2697
|
+
function extractFieldsFromGroupingModel(items) {
|
|
2698
|
+
const fields = /* @__PURE__ */ new Set();
|
|
2699
|
+
for (const item of items) {
|
|
2700
|
+
if ("groupId" in item) {
|
|
2701
|
+
const children = Array.isArray(item.children) ? item.children : [item.children];
|
|
2702
|
+
const childFields = extractFieldsFromGroupingModel(children);
|
|
2703
|
+
childFields.forEach((field) => fields.add(field));
|
|
2704
|
+
} else {
|
|
2705
|
+
fields.add(item.field);
|
|
2706
|
+
}
|
|
2707
|
+
}
|
|
2708
|
+
return fields;
|
|
2709
|
+
}
|
|
2710
|
+
function reorderColumnsByGroupingModel(columns, columnGroupingModel) {
|
|
2711
|
+
const fieldsInGroupingModel = extractFieldsFromGroupingModel(columnGroupingModel);
|
|
2712
|
+
const orderedFields = [];
|
|
2713
|
+
function collectFieldsInOrder(items) {
|
|
2714
|
+
for (const item of items) {
|
|
2715
|
+
if ("groupId" in item) {
|
|
2716
|
+
const children = Array.isArray(item.children) ? item.children : [item.children];
|
|
2717
|
+
collectFieldsInOrder(children);
|
|
2718
|
+
} else {
|
|
2719
|
+
if (!orderedFields.includes(item.field)) {
|
|
2720
|
+
orderedFields.push(item.field);
|
|
2721
|
+
}
|
|
2722
|
+
}
|
|
2723
|
+
}
|
|
2724
|
+
}
|
|
2725
|
+
collectFieldsInOrder(columnGroupingModel);
|
|
2726
|
+
const columnMap = new Map(columns.map((col) => [col.field, col]));
|
|
2727
|
+
const reorderedColumns = [];
|
|
2728
|
+
for (const field of orderedFields) {
|
|
2729
|
+
const column = columnMap.get(field);
|
|
2730
|
+
if (column) {
|
|
2731
|
+
reorderedColumns.push(column);
|
|
2732
|
+
}
|
|
2733
|
+
}
|
|
2734
|
+
for (const column of columns) {
|
|
2735
|
+
if (!fieldsInGroupingModel.has(column.field)) {
|
|
2736
|
+
reorderedColumns.push(column);
|
|
2737
|
+
}
|
|
2738
|
+
}
|
|
2739
|
+
return reorderedColumns;
|
|
2740
|
+
}
|
|
2741
|
+
function flattenColumnGroups(items, groupPath = [], columnIndex = { current: 0 }) {
|
|
2742
|
+
const result = [];
|
|
2743
|
+
for (const item of items) {
|
|
2744
|
+
if ("groupId" in item) {
|
|
2745
|
+
const newPath = [...groupPath, item.groupId];
|
|
2746
|
+
const children = Array.isArray(item.children) ? item.children : [item.children];
|
|
2747
|
+
result.push(...flattenColumnGroups(children, newPath, columnIndex));
|
|
2748
|
+
} else {
|
|
2749
|
+
result.push({
|
|
2750
|
+
...item,
|
|
2751
|
+
groupPath,
|
|
2752
|
+
columnIndex: columnIndex.current++
|
|
2753
|
+
});
|
|
2754
|
+
}
|
|
2755
|
+
}
|
|
2756
|
+
return result;
|
|
2757
|
+
}
|
|
2758
|
+
function calculateColumnGroups(columnGroupingModel, columns) {
|
|
2759
|
+
const fieldsInGroupingModel = extractFieldsFromGroupingModel(columnGroupingModel);
|
|
2760
|
+
const flattenedColumns = flattenColumnGroups(columnGroupingModel);
|
|
2761
|
+
const columnIndexMap = new Map(flattenedColumns.map((col) => [col.field, col.columnIndex]));
|
|
2762
|
+
const processedGroups = /* @__PURE__ */ new Map();
|
|
2763
|
+
const groupsByLevel = [];
|
|
2764
|
+
let maxLevel = 0;
|
|
2765
|
+
function processGroup(items, level, parentGroupId) {
|
|
2766
|
+
let minIndex = Infinity;
|
|
2767
|
+
let maxIndex = -Infinity;
|
|
2768
|
+
for (const item of items) {
|
|
2769
|
+
if ("groupId" in item) {
|
|
2770
|
+
const groupKey = parentGroupId ? `${parentGroupId}.${item.groupId}` : item.groupId;
|
|
2771
|
+
if (!processedGroups.has(groupKey)) {
|
|
2772
|
+
const children = Array.isArray(item.children) ? item.children : [item.children];
|
|
2773
|
+
const { startIndex, colspan } = processGroup(children, level + 1, groupKey);
|
|
2774
|
+
const group = {
|
|
2775
|
+
groupId: item.groupId,
|
|
2776
|
+
headerName: item.headerName,
|
|
2777
|
+
colspan,
|
|
2778
|
+
level,
|
|
2779
|
+
startIndex
|
|
2780
|
+
};
|
|
2781
|
+
processedGroups.set(groupKey, group);
|
|
2782
|
+
if (!groupsByLevel[level]) {
|
|
2783
|
+
groupsByLevel[level] = [];
|
|
2784
|
+
}
|
|
2785
|
+
groupsByLevel[level].push(group);
|
|
2786
|
+
maxLevel = Math.max(maxLevel, level);
|
|
2787
|
+
minIndex = Math.min(minIndex, startIndex);
|
|
2788
|
+
maxIndex = Math.max(maxIndex, startIndex + colspan - 1);
|
|
2789
|
+
}
|
|
2790
|
+
} else {
|
|
2791
|
+
const columnIndex = columnIndexMap.get(item.field);
|
|
2792
|
+
if (columnIndex !== void 0) {
|
|
2793
|
+
minIndex = Math.min(minIndex, columnIndex);
|
|
2794
|
+
maxIndex = Math.max(maxIndex, columnIndex);
|
|
2795
|
+
}
|
|
2796
|
+
}
|
|
2797
|
+
}
|
|
2798
|
+
return {
|
|
2799
|
+
startIndex: minIndex === Infinity ? 0 : minIndex,
|
|
2800
|
+
colspan: maxIndex === -Infinity ? 0 : maxIndex - minIndex + 1
|
|
2801
|
+
};
|
|
2802
|
+
}
|
|
2803
|
+
processGroup(columnGroupingModel, 0);
|
|
2804
|
+
groupsByLevel.forEach((level) => {
|
|
2805
|
+
level.sort((a, b) => a.startIndex - b.startIndex);
|
|
2806
|
+
});
|
|
2807
|
+
return { groups: groupsByLevel, maxLevel, fieldsInGroupingModel };
|
|
2808
|
+
}
|
|
2936
2809
|
function getTextAlign(props) {
|
|
2937
2810
|
return !props.editMode && ["number", "date", "currency"].includes(props.type || "") ? "end" : "start";
|
|
2938
2811
|
}
|
|
@@ -2957,15 +2830,7 @@ var TextEllipsis = ({ children }) => {
|
|
|
2957
2830
|
}, [children]);
|
|
2958
2831
|
const content = /* @__PURE__ */ import_react25.default.createElement(EllipsisDiv, { ref: textRef }, children);
|
|
2959
2832
|
if (showTooltip) {
|
|
2960
|
-
return /* @__PURE__ */ import_react25.default.createElement(
|
|
2961
|
-
Tooltip_default,
|
|
2962
|
-
{
|
|
2963
|
-
title: children,
|
|
2964
|
-
placement: "top",
|
|
2965
|
-
onClick: (e) => e.stopPropagation()
|
|
2966
|
-
},
|
|
2967
|
-
content
|
|
2968
|
-
);
|
|
2833
|
+
return /* @__PURE__ */ import_react25.default.createElement(Tooltip_default, { title: children, placement: "top", onClick: (e) => e.stopPropagation() }, content);
|
|
2969
2834
|
}
|
|
2970
2835
|
return content;
|
|
2971
2836
|
};
|
|
@@ -3011,7 +2876,7 @@ var OverlayWrapper = (0, import_joy33.styled)("tr", {
|
|
|
3011
2876
|
}
|
|
3012
2877
|
});
|
|
3013
2878
|
var numberFormatter = (value) => "Intl" in window ? new Intl.NumberFormat().format(value) : value;
|
|
3014
|
-
var Resizer = (ref) => /* @__PURE__ */ import_react25.default.createElement(
|
|
2879
|
+
var Resizer = (ref, targetRef = ref) => /* @__PURE__ */ import_react25.default.createElement(
|
|
3015
2880
|
Box_default,
|
|
3016
2881
|
{
|
|
3017
2882
|
sx: {
|
|
@@ -3029,6 +2894,7 @@ var Resizer = (ref) => /* @__PURE__ */ import_react25.default.createElement(
|
|
|
3029
2894
|
const onMouseMove = (e2) => {
|
|
3030
2895
|
if (initialWidth && initialX) {
|
|
3031
2896
|
ref.current.style.width = `${initialWidth + (e2.clientX - initialX)}px`;
|
|
2897
|
+
targetRef.current.style.width = `${initialWidth + (e2.clientX - initialX)}px`;
|
|
3032
2898
|
}
|
|
3033
2899
|
};
|
|
3034
2900
|
const onMouseUp = () => {
|
|
@@ -3139,20 +3005,19 @@ var HeadCell = (props) => {
|
|
|
3139
3005
|
isPinned,
|
|
3140
3006
|
pinnedStartPosition,
|
|
3141
3007
|
pinnedEndPosition,
|
|
3142
|
-
headerRef
|
|
3008
|
+
headerRef,
|
|
3009
|
+
tableColRef
|
|
3143
3010
|
} = props;
|
|
3144
3011
|
const theme = (0, import_joy33.useTheme)();
|
|
3145
3012
|
const ref = headerRef;
|
|
3013
|
+
const colRef = tableColRef;
|
|
3146
3014
|
const [isHovered, setIsHovered] = (0, import_react25.useState)(false);
|
|
3147
3015
|
const sortable = type === "actions" ? false : _sortable;
|
|
3148
3016
|
const headId = (0, import_react25.useMemo)(
|
|
3149
3017
|
() => `${tableId}_header_${headerName ?? field}`.trim(),
|
|
3150
3018
|
[tableId, headerName, field]
|
|
3151
3019
|
);
|
|
3152
|
-
const resizer = (0, import_react25.useMemo)(
|
|
3153
|
-
() => resizable ?? true ? Resizer(ref) : null,
|
|
3154
|
-
[resizable, ref]
|
|
3155
|
-
);
|
|
3020
|
+
const resizer = (0, import_react25.useMemo)(() => resizable ?? true ? Resizer(ref, colRef) : null, [resizable, ref, colRef]);
|
|
3156
3021
|
const style = (0, import_react25.useMemo)(
|
|
3157
3022
|
() => ({
|
|
3158
3023
|
width,
|
|
@@ -3167,17 +3032,7 @@ var HeadCell = (props) => {
|
|
|
3167
3032
|
// TODO: multi-sort때문에 일단 추가한 property, joy-ui에서는 multi-sort시 th에 user-select: none을 적용하고 툴팁을 띄워준다.
|
|
3168
3033
|
userSelect: "none"
|
|
3169
3034
|
}),
|
|
3170
|
-
[
|
|
3171
|
-
isPinned,
|
|
3172
|
-
maxWidth,
|
|
3173
|
-
minWidth,
|
|
3174
|
-
pinnedEndPosition,
|
|
3175
|
-
pinnedStartPosition,
|
|
3176
|
-
sortable,
|
|
3177
|
-
stickyHeader,
|
|
3178
|
-
theme,
|
|
3179
|
-
width
|
|
3180
|
-
]
|
|
3035
|
+
[isPinned, maxWidth, minWidth, pinnedEndPosition, pinnedStartPosition, sortable, stickyHeader, theme, width]
|
|
3181
3036
|
);
|
|
3182
3037
|
const textAlign = getTextAlign(props);
|
|
3183
3038
|
const initialSort = sortOrder[0];
|
|
@@ -3234,20 +3089,7 @@ var HeadCell = (props) => {
|
|
|
3234
3089
|
whileHover: "hover",
|
|
3235
3090
|
initial: "initial"
|
|
3236
3091
|
},
|
|
3237
|
-
/* @__PURE__ */ import_react25.default.createElement(
|
|
3238
|
-
Stack_default,
|
|
3239
|
-
{
|
|
3240
|
-
gap: 1,
|
|
3241
|
-
direction: "row",
|
|
3242
|
-
justifyContent: textAlign,
|
|
3243
|
-
alignItems: "center"
|
|
3244
|
-
},
|
|
3245
|
-
textAlign === "end" && sortIcon,
|
|
3246
|
-
textAlign === "end" && infoSign,
|
|
3247
|
-
/* @__PURE__ */ import_react25.default.createElement(TextEllipsis, null, headerName ?? field, editMode && required && /* @__PURE__ */ import_react25.default.createElement(Asterisk, null, "*")),
|
|
3248
|
-
textAlign === "start" && infoSign,
|
|
3249
|
-
textAlign === "start" && sortIcon
|
|
3250
|
-
),
|
|
3092
|
+
/* @__PURE__ */ import_react25.default.createElement(Stack_default, { gap: 1, direction: "row", justifyContent: textAlign, alignItems: "center" }, textAlign === "end" && sortIcon, textAlign === "end" && infoSign, /* @__PURE__ */ import_react25.default.createElement(TextEllipsis, null, headerName ?? field, editMode && required && /* @__PURE__ */ import_react25.default.createElement(Asterisk, null, "*")), textAlign === "start" && infoSign, textAlign === "start" && sortIcon),
|
|
3251
3093
|
resizer
|
|
3252
3094
|
);
|
|
3253
3095
|
};
|
|
@@ -3266,7 +3108,10 @@ var BodyCell = (props) => {
|
|
|
3266
3108
|
pinnedStartPosition,
|
|
3267
3109
|
pinnedEndPosition,
|
|
3268
3110
|
row,
|
|
3269
|
-
rowId
|
|
3111
|
+
rowId,
|
|
3112
|
+
cellClassName,
|
|
3113
|
+
onCellEditStart,
|
|
3114
|
+
onCellEditStop
|
|
3270
3115
|
} = props;
|
|
3271
3116
|
const theme = (0, import_joy33.useTheme)();
|
|
3272
3117
|
const [value, setValue] = (0, import_react25.useState)(row[field]);
|
|
@@ -3275,20 +3120,22 @@ var BodyCell = (props) => {
|
|
|
3275
3120
|
() => ({
|
|
3276
3121
|
row,
|
|
3277
3122
|
value,
|
|
3278
|
-
id: rowId
|
|
3123
|
+
id: rowId,
|
|
3124
|
+
field
|
|
3279
3125
|
}),
|
|
3280
|
-
[row, rowId, value]
|
|
3126
|
+
[row, rowId, value, field]
|
|
3281
3127
|
);
|
|
3282
3128
|
const editMode = (0, import_react25.useMemo)(
|
|
3283
3129
|
() => !!(props.editMode && (typeof isCellEditable === "function" ? isCellEditable(params) : isCellEditable ?? true)),
|
|
3284
3130
|
[props.editMode, isCellEditable, params]
|
|
3285
3131
|
);
|
|
3132
|
+
const propsComponentProps = "componentProps" in props ? props.componentProps : null;
|
|
3286
3133
|
const componentProps = (0, import_react25.useMemo)(
|
|
3287
3134
|
() => ({
|
|
3288
|
-
..."componentProps" in props && (typeof
|
|
3135
|
+
..."componentProps" in props && (typeof propsComponentProps === "function" ? propsComponentProps(params) : propsComponentProps || {}),
|
|
3289
3136
|
size: "sm"
|
|
3290
3137
|
}),
|
|
3291
|
-
[
|
|
3138
|
+
[props, propsComponentProps, params]
|
|
3292
3139
|
);
|
|
3293
3140
|
const editModeComponentProps = (0, import_react25.useMemo)(
|
|
3294
3141
|
() => ({
|
|
@@ -3297,7 +3144,7 @@ var BodyCell = (props) => {
|
|
|
3297
3144
|
componentProps.onChange?.(e);
|
|
3298
3145
|
setValue(e.target.value);
|
|
3299
3146
|
if (type === "select") {
|
|
3300
|
-
|
|
3147
|
+
onCellEditStop?.({
|
|
3301
3148
|
...params,
|
|
3302
3149
|
originalRow: row,
|
|
3303
3150
|
row: {
|
|
@@ -3310,7 +3157,7 @@ var BodyCell = (props) => {
|
|
|
3310
3157
|
},
|
|
3311
3158
|
onFocus: (e) => {
|
|
3312
3159
|
componentProps.onFocus?.(e);
|
|
3313
|
-
|
|
3160
|
+
onCellEditStart?.({
|
|
3314
3161
|
...params,
|
|
3315
3162
|
originalRow: row,
|
|
3316
3163
|
row: {
|
|
@@ -3323,7 +3170,7 @@ var BodyCell = (props) => {
|
|
|
3323
3170
|
onBlur: (e) => {
|
|
3324
3171
|
componentProps.onBlur?.(e);
|
|
3325
3172
|
if (type && ["number", "text", "longText", "currency", "date"].includes(type)) {
|
|
3326
|
-
|
|
3173
|
+
onCellEditStop?.({
|
|
3327
3174
|
...params,
|
|
3328
3175
|
originalRow: row,
|
|
3329
3176
|
row: {
|
|
@@ -3338,7 +3185,7 @@ var BodyCell = (props) => {
|
|
|
3338
3185
|
onChangeComplete: (e) => {
|
|
3339
3186
|
componentProps.onChangeComplete?.(e);
|
|
3340
3187
|
setValue(e.target.value);
|
|
3341
|
-
|
|
3188
|
+
onCellEditStop?.({
|
|
3342
3189
|
...params,
|
|
3343
3190
|
originalRow: row,
|
|
3344
3191
|
row: {
|
|
@@ -3350,29 +3197,14 @@ var BodyCell = (props) => {
|
|
|
3350
3197
|
}
|
|
3351
3198
|
}
|
|
3352
3199
|
}),
|
|
3353
|
-
[
|
|
3354
|
-
params,
|
|
3355
|
-
row,
|
|
3356
|
-
field,
|
|
3357
|
-
value,
|
|
3358
|
-
componentProps,
|
|
3359
|
-
type,
|
|
3360
|
-
props.onCellEditStop,
|
|
3361
|
-
props.onCellEditStart
|
|
3362
|
-
]
|
|
3200
|
+
[params, row, field, value, componentProps, type, onCellEditStop, onCellEditStart]
|
|
3363
3201
|
);
|
|
3364
3202
|
const EditModeComponent = (0, import_react25.useMemo)(() => {
|
|
3365
3203
|
if (renderEditCell) {
|
|
3366
3204
|
return (0, import_react25.createElement)((0, import_react25.memo)(renderEditCell), params);
|
|
3367
3205
|
}
|
|
3368
3206
|
return {
|
|
3369
|
-
date: /* @__PURE__ */ import_react25.default.createElement(
|
|
3370
|
-
DatePicker_default,
|
|
3371
|
-
{
|
|
3372
|
-
value,
|
|
3373
|
-
...editModeComponentProps
|
|
3374
|
-
}
|
|
3375
|
-
),
|
|
3207
|
+
date: /* @__PURE__ */ import_react25.default.createElement(DatePicker_default, { value, ...editModeComponentProps }),
|
|
3376
3208
|
currency: /* @__PURE__ */ import_react25.default.createElement(
|
|
3377
3209
|
CurrencyInput_default,
|
|
3378
3210
|
{
|
|
@@ -3380,29 +3212,9 @@ var BodyCell = (props) => {
|
|
|
3380
3212
|
...editModeComponentProps
|
|
3381
3213
|
}
|
|
3382
3214
|
),
|
|
3383
|
-
number: /* @__PURE__ */ import_react25.default.createElement(
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
value,
|
|
3387
|
-
type: "number",
|
|
3388
|
-
...editModeComponentProps
|
|
3389
|
-
}
|
|
3390
|
-
),
|
|
3391
|
-
text: /* @__PURE__ */ import_react25.default.createElement(
|
|
3392
|
-
Input_default,
|
|
3393
|
-
{
|
|
3394
|
-
value,
|
|
3395
|
-
type: "text",
|
|
3396
|
-
...editModeComponentProps
|
|
3397
|
-
}
|
|
3398
|
-
),
|
|
3399
|
-
longText: /* @__PURE__ */ import_react25.default.createElement(
|
|
3400
|
-
Textarea_default,
|
|
3401
|
-
{
|
|
3402
|
-
value,
|
|
3403
|
-
...editModeComponentProps
|
|
3404
|
-
}
|
|
3405
|
-
),
|
|
3215
|
+
number: /* @__PURE__ */ import_react25.default.createElement(Input_default, { value, type: "number", ...editModeComponentProps }),
|
|
3216
|
+
text: /* @__PURE__ */ import_react25.default.createElement(Input_default, { value, type: "text", ...editModeComponentProps }),
|
|
3217
|
+
longText: /* @__PURE__ */ import_react25.default.createElement(Textarea_default, { value, ...editModeComponentProps }),
|
|
3406
3218
|
autocomplete: /* @__PURE__ */ import_react25.default.createElement(
|
|
3407
3219
|
Autocomplete_default,
|
|
3408
3220
|
{
|
|
@@ -3420,50 +3232,34 @@ var BodyCell = (props) => {
|
|
|
3420
3232
|
}
|
|
3421
3233
|
)
|
|
3422
3234
|
}[type || "text"];
|
|
3423
|
-
}, [value, editModeComponentProps, type]);
|
|
3235
|
+
}, [value, editModeComponentProps, type, renderEditCell, params]);
|
|
3236
|
+
const linkComponentFromProps = props.component;
|
|
3424
3237
|
const ReadModeComponent = (0, import_react25.useMemo)(() => {
|
|
3425
3238
|
if (renderCell) {
|
|
3426
3239
|
return (0, import_react25.createElement)((0, import_react25.memo)(renderCell), params);
|
|
3427
3240
|
}
|
|
3428
3241
|
const innerText = value;
|
|
3429
3242
|
const typedComponent = {
|
|
3430
|
-
link: import_react25.default.createElement(
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
...componentProps
|
|
3435
|
-
}
|
|
3436
|
-
)
|
|
3243
|
+
link: import_react25.default.createElement(linkComponentFromProps || import_joy33.Link, {
|
|
3244
|
+
children: innerText,
|
|
3245
|
+
...componentProps
|
|
3246
|
+
})
|
|
3437
3247
|
}[type || "text"];
|
|
3438
3248
|
return typedComponent || innerText;
|
|
3439
|
-
}, [value, renderCell, params, type, componentProps]);
|
|
3249
|
+
}, [value, renderCell, params, type, componentProps, linkComponentFromProps]);
|
|
3250
|
+
const getActions = props.getActions;
|
|
3440
3251
|
const CellComponent = (0, import_react25.useMemo)(() => {
|
|
3441
3252
|
if (type === "actions") {
|
|
3442
|
-
return /* @__PURE__ */ import_react25.default.createElement(
|
|
3443
|
-
Stack_default,
|
|
3444
|
-
{
|
|
3445
|
-
direction: "row",
|
|
3446
|
-
gap: 1,
|
|
3447
|
-
justifyContent: "center",
|
|
3448
|
-
alignItems: "center"
|
|
3449
|
-
},
|
|
3450
|
-
props.getActions?.(params)
|
|
3451
|
-
);
|
|
3253
|
+
return /* @__PURE__ */ import_react25.default.createElement(Stack_default, { direction: "row", gap: 1, justifyContent: "center", alignItems: "center" }, getActions?.(params));
|
|
3452
3254
|
}
|
|
3453
3255
|
return editMode && EditModeComponent ? EditModeComponent : ReadModeComponent;
|
|
3454
|
-
}, [
|
|
3455
|
-
|
|
3456
|
-
props.getActions,
|
|
3457
|
-
params,
|
|
3458
|
-
editMode,
|
|
3459
|
-
EditModeComponent,
|
|
3460
|
-
ReadModeComponent
|
|
3461
|
-
]);
|
|
3462
|
-
const showTooltip = (0, import_react25.useMemo)(
|
|
3463
|
-
() => noWrap && type === "longText",
|
|
3464
|
-
[noWrap, type]
|
|
3465
|
-
);
|
|
3256
|
+
}, [type, getActions, params, editMode, EditModeComponent, ReadModeComponent]);
|
|
3257
|
+
const showTooltip = (0, import_react25.useMemo)(() => noWrap && type === "longText", [noWrap, type]);
|
|
3466
3258
|
const isBoundary = props.isLastStartPinnedColumn || props.isLastEndPinnedColumn;
|
|
3259
|
+
const computedCellClassName = (0, import_react25.useMemo)(
|
|
3260
|
+
() => (typeof cellClassName === "function" ? cellClassName(params) : cellClassName) || "",
|
|
3261
|
+
[cellClassName, params]
|
|
3262
|
+
);
|
|
3467
3263
|
(0, import_react25.useEffect)(() => {
|
|
3468
3264
|
setValue(row[field]);
|
|
3469
3265
|
}, [row, field]);
|
|
@@ -3482,11 +3278,11 @@ var BodyCell = (props) => {
|
|
|
3482
3278
|
zIndex: isPinned ? `calc(${theme.getCssVar("zIndex-table")} + ${isBoundary ? 2 : 3})` : void 0,
|
|
3483
3279
|
"--TableCell-dataBackground": isPinned ? `var(--TableCell-headBackground)` : void 0
|
|
3484
3280
|
},
|
|
3485
|
-
className: isLastStartPinnedColumn && "is-last-left"
|
|
3281
|
+
className: [isLastStartPinnedColumn && "is-last-left", isLastEndPinnedColumn && "is-last-right", computedCellClassName].filter(Boolean).join(" ") || ""
|
|
3486
3282
|
},
|
|
3487
3283
|
(0, import_react25.useMemo)(
|
|
3488
3284
|
() => showTooltip ? /* @__PURE__ */ import_react25.default.createElement(CellTextEllipsis, null, CellComponent) : CellComponent,
|
|
3489
|
-
[CellComponent, showTooltip
|
|
3285
|
+
[CellComponent, showTooltip]
|
|
3490
3286
|
)
|
|
3491
3287
|
);
|
|
3492
3288
|
};
|
|
@@ -3556,31 +3352,40 @@ function useDataTableRenderer({
|
|
|
3556
3352
|
editMode,
|
|
3557
3353
|
getId: _getId,
|
|
3558
3354
|
isTotalSelected: _isTotalSelected,
|
|
3559
|
-
isRowSelectable
|
|
3355
|
+
isRowSelectable,
|
|
3356
|
+
columnGroupingModel
|
|
3357
|
+
// Add this prop
|
|
3560
3358
|
}) {
|
|
3359
|
+
if (pinnedColumns && columnGroupingModel) {
|
|
3360
|
+
throw new Error(
|
|
3361
|
+
"You cannot use both `pinnedColumns` and `columnGroupingModel` at the same time. Please choose one of them."
|
|
3362
|
+
);
|
|
3363
|
+
}
|
|
3561
3364
|
const onSelectionModelChangeRef = (0, import_react25.useRef)(onSelectionModelChange);
|
|
3562
3365
|
onSelectionModelChangeRef.current = onSelectionModelChange;
|
|
3563
3366
|
const [focusedRowId, setFocusedRowId] = (0, import_react25.useState)(null);
|
|
3564
3367
|
const [sortModel, setSortModel] = useControlledState(
|
|
3565
3368
|
controlledSortModel,
|
|
3566
3369
|
initialState?.sorting?.sortModel ?? [],
|
|
3567
|
-
(0, import_react25.useCallback)(
|
|
3568
|
-
(sortModel2) => onSortModelChange?.(sortModel2),
|
|
3569
|
-
[onSortModelChange]
|
|
3570
|
-
)
|
|
3370
|
+
(0, import_react25.useCallback)((sortModel2) => onSortModelChange?.(sortModel2), [onSortModelChange])
|
|
3571
3371
|
);
|
|
3372
|
+
const reorderedColumns = (0, import_react25.useMemo)(() => {
|
|
3373
|
+
if (!columnGroupingModel) return columnsProp;
|
|
3374
|
+
return reorderColumnsByGroupingModel(columnsProp, columnGroupingModel);
|
|
3375
|
+
}, [columnsProp, columnGroupingModel]);
|
|
3572
3376
|
const columnsByField = (0, import_react25.useMemo)(
|
|
3573
|
-
() =>
|
|
3377
|
+
() => reorderedColumns.reduce(
|
|
3574
3378
|
(acc, curr) => ({
|
|
3575
3379
|
...acc,
|
|
3576
3380
|
[curr.field]: {
|
|
3577
3381
|
...curr,
|
|
3578
|
-
headerRef: import_react25.default.createRef()
|
|
3382
|
+
headerRef: import_react25.default.createRef(),
|
|
3383
|
+
tableColRef: import_react25.default.createRef()
|
|
3579
3384
|
}
|
|
3580
3385
|
}),
|
|
3581
3386
|
{}
|
|
3582
3387
|
),
|
|
3583
|
-
[
|
|
3388
|
+
[reorderedColumns]
|
|
3584
3389
|
);
|
|
3585
3390
|
const sortComparator = (0, import_react25.useCallback)(
|
|
3586
3391
|
(rowA, rowB) => {
|
|
@@ -3642,9 +3447,7 @@ function useDataTableRenderer({
|
|
|
3642
3447
|
[dataInPage, isRowSelectable, getId]
|
|
3643
3448
|
);
|
|
3644
3449
|
const isAllSelected = (0, import_react25.useMemo)(
|
|
3645
|
-
() => selectableDataInPage.length > 0 && selectableDataInPage.every(
|
|
3646
|
-
(row, i) => selectedModelSet.has(getId(row, i))
|
|
3647
|
-
),
|
|
3450
|
+
() => selectableDataInPage.length > 0 && selectableDataInPage.every((row, i) => selectedModelSet.has(getId(row, i))),
|
|
3648
3451
|
[selectableDataInPage, selectedModelSet, getId]
|
|
3649
3452
|
);
|
|
3650
3453
|
const rowCount = totalRowsProp || rows.length;
|
|
@@ -3662,22 +3465,25 @@ function useDataTableRenderer({
|
|
|
3662
3465
|
columnsByField[f].minWidth ?? 0,
|
|
3663
3466
|
[columnWidths, columnsByField]
|
|
3664
3467
|
);
|
|
3468
|
+
const processedColumnGroups = (0, import_react25.useMemo)(() => {
|
|
3469
|
+
if (!columnGroupingModel) return null;
|
|
3470
|
+
return calculateColumnGroups(columnGroupingModel, reorderedColumns);
|
|
3471
|
+
}, [columnGroupingModel, reorderedColumns]);
|
|
3665
3472
|
const columns = (0, import_react25.useMemo)(() => {
|
|
3666
|
-
const baseColumns =
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
3473
|
+
const baseColumns = reorderedColumns.length > 0 ? reorderedColumns : (
|
|
3474
|
+
// fallback
|
|
3475
|
+
Object.keys(rows[0] || {}).map((key) => ({
|
|
3476
|
+
field: key
|
|
3477
|
+
}))
|
|
3478
|
+
);
|
|
3670
3479
|
return baseColumns.map((column) => {
|
|
3671
|
-
const isLeftPinned = pinnedColumns?.left?.includes(
|
|
3672
|
-
|
|
3673
|
-
);
|
|
3674
|
-
const isRightPinned = pinnedColumns?.right?.includes(
|
|
3675
|
-
column.field
|
|
3676
|
-
);
|
|
3480
|
+
const isLeftPinned = pinnedColumns?.left?.includes(column.field);
|
|
3481
|
+
const isRightPinned = pinnedColumns?.right?.includes(column.field);
|
|
3677
3482
|
const isPinned = isLeftPinned || isRightPinned;
|
|
3678
3483
|
return {
|
|
3679
3484
|
...column,
|
|
3680
3485
|
headerRef: columnsByField[column.field].headerRef,
|
|
3486
|
+
tableColRef: columnsByField[column.field].tableColRef,
|
|
3681
3487
|
isCellEditable: editMode && (typeof column.isCellEditable === "function" ? column.isCellEditable : column.isCellEditable ?? true),
|
|
3682
3488
|
sort: sortModel.find((sort) => sort.field === column.field)?.sort,
|
|
3683
3489
|
sortOrder: columnsByField[column.field]?.sortOrder || sortOrder,
|
|
@@ -3685,17 +3491,12 @@ function useDataTableRenderer({
|
|
|
3685
3491
|
isLastStartPinnedColumn: isLeftPinned && [...pinnedColumns?.left || []].pop() === column.field,
|
|
3686
3492
|
isLastEndPinnedColumn: isRightPinned && (pinnedColumns?.right?.[0] ?? null) === column.field,
|
|
3687
3493
|
// pinned 관련 계산부
|
|
3688
|
-
pinnedStartPosition: pinnedColumns?.left?.slice(
|
|
3689
|
-
|
|
3690
|
-
isLeftPinned ? pinnedColumns.left.indexOf(column.field) : pinnedColumns.left.length
|
|
3691
|
-
).reduce((acc, curr) => acc + getWidth(curr), 0),
|
|
3692
|
-
pinnedEndPosition: pinnedColumns?.right?.slice(
|
|
3693
|
-
isRightPinned ? pinnedColumns.right.indexOf(column.field) + 1 : 0
|
|
3694
|
-
).reduce((acc, curr) => acc + getWidth(curr), 0)
|
|
3494
|
+
pinnedStartPosition: pinnedColumns?.left?.slice(0, isLeftPinned ? pinnedColumns.left.indexOf(column.field) : pinnedColumns.left.length).reduce((acc, curr) => acc + getWidth(curr), 0),
|
|
3495
|
+
pinnedEndPosition: pinnedColumns?.right?.slice(isRightPinned ? pinnedColumns.right.indexOf(column.field) + 1 : 0).reduce((acc, curr) => acc + getWidth(curr), 0)
|
|
3695
3496
|
};
|
|
3696
3497
|
});
|
|
3697
3498
|
}, [
|
|
3698
|
-
|
|
3499
|
+
reorderedColumns,
|
|
3699
3500
|
rows,
|
|
3700
3501
|
pinnedColumns?.left,
|
|
3701
3502
|
pinnedColumns?.right,
|
|
@@ -3726,9 +3527,7 @@ function useDataTableRenderer({
|
|
|
3726
3527
|
setSortModel(newSortModel2);
|
|
3727
3528
|
return;
|
|
3728
3529
|
}
|
|
3729
|
-
const newSortModel = multiple ? sortModel.map(
|
|
3730
|
-
(model) => model.field === field ? { field, sort: nextSortOrder } : model
|
|
3731
|
-
) : [{ field, sort: nextSortOrder }];
|
|
3530
|
+
const newSortModel = multiple ? sortModel.map((model) => model.field === field ? { field, sort: nextSortOrder } : model) : [{ field, sort: nextSortOrder }];
|
|
3732
3531
|
setSortModel(newSortModel);
|
|
3733
3532
|
} else {
|
|
3734
3533
|
const newSortModel = multiple ? [...sortModel, { field, sort: columnSortOrder[0] }] : [{ field, sort: columnSortOrder[0] }];
|
|
@@ -3765,10 +3564,7 @@ function useDataTableRenderer({
|
|
|
3765
3564
|
isAllSelected,
|
|
3766
3565
|
// all rows are selected on this page
|
|
3767
3566
|
isTotalSelected,
|
|
3768
|
-
isSelectedRow: (0, import_react25.useCallback)(
|
|
3769
|
-
(model) => selectedModelSet.has(model),
|
|
3770
|
-
[selectedModelSet]
|
|
3771
|
-
),
|
|
3567
|
+
isSelectedRow: (0, import_react25.useCallback)((model) => selectedModelSet.has(model), [selectedModelSet]),
|
|
3772
3568
|
isRowSelectable: (0, import_react25.useCallback)(
|
|
3773
3569
|
(rowId, row) => {
|
|
3774
3570
|
if (!isRowSelectable) return true;
|
|
@@ -3781,16 +3577,12 @@ function useDataTableRenderer({
|
|
|
3781
3577
|
setFocusedRowId(rowId);
|
|
3782
3578
|
}, []),
|
|
3783
3579
|
onAllCheckboxChange: (0, import_react25.useCallback)(() => {
|
|
3784
|
-
onSelectionModelChange?.(
|
|
3785
|
-
isAllSelected ? [] : selectableDataInPage.map(getId)
|
|
3786
|
-
);
|
|
3580
|
+
onSelectionModelChange?.(isAllSelected ? [] : selectableDataInPage.map(getId));
|
|
3787
3581
|
}, [isAllSelected, selectableDataInPage, onSelectionModelChange, getId]),
|
|
3788
3582
|
onCheckboxChange: (0, import_react25.useCallback)(
|
|
3789
3583
|
(event, selectedModel) => {
|
|
3790
3584
|
if (selectedModelSet.has(selectedModel)) {
|
|
3791
|
-
const newSelectionModel = (selectionModel || []).filter(
|
|
3792
|
-
(model) => model !== selectedModel
|
|
3793
|
-
);
|
|
3585
|
+
const newSelectionModel = (selectionModel || []).filter((model) => model !== selectedModel);
|
|
3794
3586
|
onSelectionModelChange?.(newSelectionModel);
|
|
3795
3587
|
} else {
|
|
3796
3588
|
const newSelectionModel = [...selectionModel || [], selectedModel];
|
|
@@ -3800,15 +3592,13 @@ function useDataTableRenderer({
|
|
|
3800
3592
|
[selectionModel, onSelectionModelChange, selectedModelSet]
|
|
3801
3593
|
),
|
|
3802
3594
|
columns,
|
|
3595
|
+
processedColumnGroups,
|
|
3803
3596
|
onTotalSelect: (0, import_react25.useCallback)(() => {
|
|
3804
3597
|
const selectableRows = rows.filter((row, i) => {
|
|
3805
3598
|
if (!isRowSelectable) return true;
|
|
3806
3599
|
return isRowSelectable({ row, id: getId(row, i) });
|
|
3807
3600
|
});
|
|
3808
|
-
onSelectionModelChange?.(
|
|
3809
|
-
isTotalSelected ? [] : selectableRows.map(getId),
|
|
3810
|
-
!isTotalSelected
|
|
3811
|
-
);
|
|
3601
|
+
onSelectionModelChange?.(isTotalSelected ? [] : selectableRows.map(getId), !isTotalSelected);
|
|
3812
3602
|
}, [isTotalSelected, rows, onSelectionModelChange, getId, isRowSelectable])
|
|
3813
3603
|
};
|
|
3814
3604
|
}
|
|
@@ -3845,17 +3635,15 @@ function Component(props, apiRef) {
|
|
|
3845
3635
|
getId: ____________,
|
|
3846
3636
|
// getId is used in useDataTableRenderer
|
|
3847
3637
|
loading,
|
|
3638
|
+
columnGroupingModel: _________________,
|
|
3639
|
+
// columnGroupingModel is used in useDataTableRenderer
|
|
3848
3640
|
slots: {
|
|
3849
3641
|
checkbox: RenderCheckbox = Checkbox_default,
|
|
3850
3642
|
toolbar: Toolbar,
|
|
3851
3643
|
footer: Footer,
|
|
3852
3644
|
loadingOverlay: LoadingOverlay = DefaultLoadingOverlay
|
|
3853
3645
|
} = {},
|
|
3854
|
-
slotProps: {
|
|
3855
|
-
checkbox: checkboxProps = {},
|
|
3856
|
-
toolbar: toolbarProps,
|
|
3857
|
-
background: backgroundProps = {}
|
|
3858
|
-
} = {},
|
|
3646
|
+
slotProps: { checkbox: checkboxProps = {}, toolbar: toolbarProps, background: backgroundProps = {} } = {},
|
|
3859
3647
|
stripe,
|
|
3860
3648
|
isTotalSelected: ___________,
|
|
3861
3649
|
...innerProps
|
|
@@ -3865,6 +3653,7 @@ function Component(props, apiRef) {
|
|
|
3865
3653
|
const tableBodyRef = (0, import_react25.useRef)(null);
|
|
3866
3654
|
const {
|
|
3867
3655
|
columns,
|
|
3656
|
+
processedColumnGroups,
|
|
3868
3657
|
isAllSelected,
|
|
3869
3658
|
isSelectedRow,
|
|
3870
3659
|
isRowSelectable: isRowSelectableCheck,
|
|
@@ -3900,13 +3689,7 @@ function Component(props, apiRef) {
|
|
|
3900
3689
|
onRowClick?.({ row, rowId }, e);
|
|
3901
3690
|
checkboxSelection && !disableSelectionOnClick && isRowSelectableCheck(rowId, row) && onCheckboxChange(e, rowId);
|
|
3902
3691
|
},
|
|
3903
|
-
[
|
|
3904
|
-
onRowClick,
|
|
3905
|
-
checkboxSelection,
|
|
3906
|
-
disableSelectionOnClick,
|
|
3907
|
-
onCheckboxChange,
|
|
3908
|
-
isRowSelectableCheck
|
|
3909
|
-
]
|
|
3692
|
+
[onRowClick, checkboxSelection, disableSelectionOnClick, onCheckboxChange, isRowSelectableCheck]
|
|
3910
3693
|
);
|
|
3911
3694
|
const getRowFocusHandler = (0, import_react25.useCallback)(
|
|
3912
3695
|
(rowId) => () => {
|
|
@@ -3964,16 +3747,7 @@ function Component(props, apiRef) {
|
|
|
3964
3747
|
justifyContent: "space-between",
|
|
3965
3748
|
alignItems: "center"
|
|
3966
3749
|
},
|
|
3967
|
-
!!checkboxSelection && /* @__PURE__ */ import_react25.default.createElement(Stack_default, { direction: "row", spacing: 1 }, !isAllSelected && /* @__PURE__ */ import_react25.default.createElement(Typography_default, { level: "body-xs" }, numberFormatter(selectionModel?.length || 0), " items selected"), isAllSelected && !isTotalSelected && /* @__PURE__ */ import_react25.default.createElement(Stack_default, { direction: "row", spacing: 1, alignItems: "center" }, /* @__PURE__ */ import_react25.default.createElement(Typography_default, { level: "body-xs" }, "All ", numberFormatter(selectionModel?.length || 0), " items on this page are selected."), /* @__PURE__ */ import_react25.default.createElement(Button_default, { size: "sm", variant: "plain", onClick: onTotalSelect }, "Select all ", numberFormatter(selectableRowCount), " items")), isTotalSelected && /* @__PURE__ */ import_react25.default.createElement(Stack_default, { direction: "row", spacing: 1, alignItems: "center" }, /* @__PURE__ */ import_react25.default.createElement(Typography_default, { level: "body-xs" }, "All ", numberFormatter(selectableRowCount), " items are selected."), /* @__PURE__ */ import_react25.default.createElement(
|
|
3968
|
-
Button_default,
|
|
3969
|
-
{
|
|
3970
|
-
size: "sm",
|
|
3971
|
-
variant: "plain",
|
|
3972
|
-
color: "danger",
|
|
3973
|
-
onClick: onTotalSelect
|
|
3974
|
-
},
|
|
3975
|
-
"Cancel"
|
|
3976
|
-
))),
|
|
3750
|
+
!!checkboxSelection && /* @__PURE__ */ import_react25.default.createElement(Stack_default, { direction: "row", spacing: 1 }, !isAllSelected && /* @__PURE__ */ import_react25.default.createElement(Typography_default, { level: "body-xs" }, numberFormatter(selectionModel?.length || 0), " items selected"), isAllSelected && !isTotalSelected && /* @__PURE__ */ import_react25.default.createElement(Stack_default, { direction: "row", spacing: 1, alignItems: "center" }, /* @__PURE__ */ import_react25.default.createElement(Typography_default, { level: "body-xs" }, "All ", numberFormatter(selectionModel?.length || 0), " items on this page are selected."), /* @__PURE__ */ import_react25.default.createElement(Button_default, { size: "sm", variant: "plain", onClick: onTotalSelect }, "Select all ", numberFormatter(selectableRowCount), " items")), isTotalSelected && /* @__PURE__ */ import_react25.default.createElement(Stack_default, { direction: "row", spacing: 1, alignItems: "center" }, /* @__PURE__ */ import_react25.default.createElement(Typography_default, { level: "body-xs" }, "All ", numberFormatter(selectableRowCount), " items are selected."), /* @__PURE__ */ import_react25.default.createElement(Button_default, { size: "sm", variant: "plain", color: "danger", onClick: onTotalSelect }, "Cancel"))),
|
|
3977
3751
|
Toolbar && /* @__PURE__ */ import_react25.default.createElement(Toolbar, { ...toolbarProps || {} })
|
|
3978
3752
|
),
|
|
3979
3753
|
/* @__PURE__ */ import_react25.default.createElement(
|
|
@@ -3987,7 +3761,8 @@ function Component(props, apiRef) {
|
|
|
3987
3761
|
boxShadow: "sm",
|
|
3988
3762
|
borderRadius: "sm",
|
|
3989
3763
|
"--DataTableSheet-width": parentRef.current?.clientWidth + "px",
|
|
3990
|
-
backgroundColor: "white"
|
|
3764
|
+
backgroundColor: "white",
|
|
3765
|
+
"--TableCell-cornerRadius": "0px"
|
|
3991
3766
|
},
|
|
3992
3767
|
className: [
|
|
3993
3768
|
...(parentRef.current?.scrollLeft || 0) > 0 ? ["ScrollableRight"] : [],
|
|
@@ -3996,16 +3771,34 @@ function Component(props, apiRef) {
|
|
|
3996
3771
|
ref: parentRef,
|
|
3997
3772
|
...backgroundProps
|
|
3998
3773
|
},
|
|
3999
|
-
/* @__PURE__ */ import_react25.default.createElement(Table, { ...innerProps }, /* @__PURE__ */ import_react25.default.createElement("
|
|
4000
|
-
"
|
|
3774
|
+
/* @__PURE__ */ import_react25.default.createElement(Table, { ...innerProps }, /* @__PURE__ */ import_react25.default.createElement("colgroup", null, checkboxSelection && /* @__PURE__ */ import_react25.default.createElement(
|
|
3775
|
+
"col",
|
|
4001
3776
|
{
|
|
4002
3777
|
style: {
|
|
4003
|
-
width: "40px"
|
|
4004
|
-
textAlign: "center"
|
|
3778
|
+
width: "40px"
|
|
4005
3779
|
}
|
|
4006
|
-
}
|
|
4007
|
-
|
|
4008
|
-
|
|
3780
|
+
}
|
|
3781
|
+
), columns.map((c) => /* @__PURE__ */ import_react25.default.createElement(
|
|
3782
|
+
"col",
|
|
3783
|
+
{
|
|
3784
|
+
ref: c.tableColRef,
|
|
3785
|
+
key: `${c.field.toString()}_${c.width}`,
|
|
3786
|
+
style: {
|
|
3787
|
+
width: c.width
|
|
3788
|
+
}
|
|
3789
|
+
}
|
|
3790
|
+
))), /* @__PURE__ */ import_react25.default.createElement("thead", null, processedColumnGroups && processedColumnGroups.groups.map((levelGroups, level) => /* @__PURE__ */ import_react25.default.createElement("tr", { key: `group-level-${level}` }, checkboxSelection && level === 0 && /* @__PURE__ */ import_react25.default.createElement(
|
|
3791
|
+
"th",
|
|
3792
|
+
{
|
|
3793
|
+
rowSpan: processedColumnGroups.maxLevel + 2,
|
|
3794
|
+
style: {
|
|
3795
|
+
width: "40px",
|
|
3796
|
+
textAlign: "center",
|
|
3797
|
+
verticalAlign: "middle"
|
|
3798
|
+
}
|
|
3799
|
+
},
|
|
3800
|
+
/* @__PURE__ */ import_react25.default.createElement(
|
|
3801
|
+
RenderCheckbox,
|
|
4009
3802
|
{
|
|
4010
3803
|
onChange: onAllCheckboxChange,
|
|
4011
3804
|
checked: isAllSelected,
|
|
@@ -4014,16 +3807,52 @@ function Component(props, apiRef) {
|
|
|
4014
3807
|
...checkboxProps
|
|
4015
3808
|
}
|
|
4016
3809
|
)
|
|
4017
|
-
),
|
|
4018
|
-
|
|
3810
|
+
), level > 0 && Array.from({ length: levelGroups[0]?.startIndex || 0 }).map((_2, i) => /* @__PURE__ */ import_react25.default.createElement("th", { key: `empty-${level}-${i}` })), levelGroups.map((group, groupIndex) => {
|
|
3811
|
+
const nextGroup = levelGroups[groupIndex + 1];
|
|
3812
|
+
const emptyCells = nextGroup ? nextGroup.startIndex - (group.startIndex + group.colspan) : columns.length - (group.startIndex + group.colspan);
|
|
3813
|
+
return /* @__PURE__ */ import_react25.default.createElement(import_react25.Fragment, { key: group.groupId }, /* @__PURE__ */ import_react25.default.createElement(
|
|
3814
|
+
"th",
|
|
3815
|
+
{
|
|
3816
|
+
colSpan: group.colspan,
|
|
3817
|
+
style: {
|
|
3818
|
+
textAlign: "center",
|
|
3819
|
+
fontWeight: "bold",
|
|
3820
|
+
verticalAlign: "middle"
|
|
3821
|
+
}
|
|
3822
|
+
},
|
|
3823
|
+
group.headerName ?? group.groupId
|
|
3824
|
+
), emptyCells > 0 && Array.from({ length: emptyCells }).map((_2, i) => /* @__PURE__ */ import_react25.default.createElement("th", { key: `empty-between-${level}-${groupIndex}-${i}`, colSpan: 1 })));
|
|
3825
|
+
}))), /* @__PURE__ */ import_react25.default.createElement("tr", null, !processedColumnGroups && checkboxSelection && /* @__PURE__ */ import_react25.default.createElement(
|
|
3826
|
+
"th",
|
|
4019
3827
|
{
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
3828
|
+
style: {
|
|
3829
|
+
width: "40px",
|
|
3830
|
+
textAlign: "center"
|
|
3831
|
+
}
|
|
3832
|
+
},
|
|
3833
|
+
/* @__PURE__ */ import_react25.default.createElement(
|
|
3834
|
+
RenderCheckbox,
|
|
3835
|
+
{
|
|
3836
|
+
onChange: onAllCheckboxChange,
|
|
3837
|
+
checked: isAllSelected,
|
|
3838
|
+
indeterminate: (selectionModel || []).length > 0 && !isAllSelected,
|
|
3839
|
+
disabled: dataInPage.length > 0 && !selectableRowCount,
|
|
3840
|
+
...checkboxProps
|
|
3841
|
+
}
|
|
3842
|
+
)
|
|
3843
|
+
), columns.map((c, i) => (
|
|
3844
|
+
// @ts-ignore
|
|
3845
|
+
/* @__PURE__ */ import_react25.default.createElement(
|
|
3846
|
+
HeadCell2,
|
|
3847
|
+
{
|
|
3848
|
+
tableId,
|
|
3849
|
+
key: `${c.field.toString()}_${i}`,
|
|
3850
|
+
stickyHeader: props.stickyHeader,
|
|
3851
|
+
editMode: !!c.isCellEditable,
|
|
3852
|
+
onSortChange: handleSortChange,
|
|
3853
|
+
...c
|
|
3854
|
+
}
|
|
3855
|
+
)
|
|
4027
3856
|
)))), /* @__PURE__ */ import_react25.default.createElement(
|
|
4028
3857
|
VirtualizedTableBody,
|
|
4029
3858
|
{
|
|
@@ -4142,9 +3971,7 @@ var CalendarButton2 = (0, import_joy34.styled)(IconButton_default, {
|
|
|
4142
3971
|
"&:focus": {
|
|
4143
3972
|
"--Icon-color": "currentColor",
|
|
4144
3973
|
outlineOffset: `${theme.getCssVar("focus-thickness")}`,
|
|
4145
|
-
outline: `${theme.getCssVar("focus-thickness")} solid ${theme.getCssVar(
|
|
4146
|
-
"palette-focusVisible"
|
|
4147
|
-
)}`
|
|
3974
|
+
outline: `${theme.getCssVar("focus-thickness")} solid ${theme.getCssVar("palette-focusVisible")}`
|
|
4148
3975
|
}
|
|
4149
3976
|
}));
|
|
4150
3977
|
var StyledPopper2 = (0, import_joy34.styled)(import_base3.Popper, {
|
|
@@ -4181,10 +4008,7 @@ var validValueFormat2 = (value, format) => {
|
|
|
4181
4008
|
if (parsedDate1.toString() === "Invalid Date" || parsedDate2.toString() === "Invalid Date") {
|
|
4182
4009
|
return false;
|
|
4183
4010
|
}
|
|
4184
|
-
const formattedValue = formatValueString2(
|
|
4185
|
-
[parsedDate1, parsedDate2],
|
|
4186
|
-
format
|
|
4187
|
-
);
|
|
4011
|
+
const formattedValue = formatValueString2([parsedDate1, parsedDate2], format);
|
|
4188
4012
|
if (value !== formattedValue) {
|
|
4189
4013
|
return false;
|
|
4190
4014
|
}
|
|
@@ -4236,287 +4060,263 @@ var parseDates = (str, format) => {
|
|
|
4236
4060
|
var formatToPattern2 = (format) => {
|
|
4237
4061
|
return `${format} - ${format}`.replace(/YYYY/g, "Y").replace(/MM/g, "M").replace(/DD/g, "D").replace(/[^YMD\s]/g, (match) => `${match}\``);
|
|
4238
4062
|
};
|
|
4239
|
-
var TextMaskAdapter5 = import_react26.default.forwardRef(
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
|
|
4247
|
-
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
maxLength: 2
|
|
4256
|
-
},
|
|
4257
|
-
M: {
|
|
4258
|
-
mask: import_react_imask2.IMask.MaskedRange,
|
|
4259
|
-
from: 1,
|
|
4260
|
-
to: 12,
|
|
4261
|
-
maxLength: 2
|
|
4262
|
-
},
|
|
4263
|
-
Y: {
|
|
4264
|
-
mask: import_react_imask2.IMask.MaskedRange,
|
|
4265
|
-
from: 1900,
|
|
4266
|
-
to: 9999
|
|
4267
|
-
}
|
|
4063
|
+
var TextMaskAdapter5 = import_react26.default.forwardRef(function TextMaskAdapter6(props, ref) {
|
|
4064
|
+
const { onChange, format, ...other } = props;
|
|
4065
|
+
return /* @__PURE__ */ import_react26.default.createElement(
|
|
4066
|
+
import_react_imask2.IMaskInput,
|
|
4067
|
+
{
|
|
4068
|
+
...other,
|
|
4069
|
+
inputRef: ref,
|
|
4070
|
+
onAccept: (value) => onChange({ target: { name: props.name, value } }),
|
|
4071
|
+
mask: Date,
|
|
4072
|
+
pattern: formatToPattern2(format),
|
|
4073
|
+
blocks: {
|
|
4074
|
+
D: {
|
|
4075
|
+
mask: import_react_imask2.IMask.MaskedRange,
|
|
4076
|
+
from: 1,
|
|
4077
|
+
to: 31,
|
|
4078
|
+
maxLength: 2
|
|
4268
4079
|
},
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
const props = (0, import_joy34.useThemeProps)({ props: inProps, name: "DateRangePicker" });
|
|
4280
|
-
const {
|
|
4281
|
-
onChange,
|
|
4282
|
-
disabled,
|
|
4283
|
-
label,
|
|
4284
|
-
error,
|
|
4285
|
-
helperText,
|
|
4286
|
-
minDate,
|
|
4287
|
-
maxDate,
|
|
4288
|
-
disableFuture,
|
|
4289
|
-
disablePast,
|
|
4290
|
-
required,
|
|
4291
|
-
// NOTE: 스타일 관련된 props는 최상위 엘리먼트에 적용한다.
|
|
4292
|
-
sx,
|
|
4293
|
-
className,
|
|
4294
|
-
format = "YYYY/MM/DD",
|
|
4295
|
-
displayFormat = "YYYY/MM/DD",
|
|
4296
|
-
size,
|
|
4297
|
-
inputReadOnly,
|
|
4298
|
-
hideClearButton,
|
|
4299
|
-
readOnly,
|
|
4300
|
-
...innerProps
|
|
4301
|
-
} = props;
|
|
4302
|
-
const innerRef = (0, import_react26.useRef)(null);
|
|
4303
|
-
const buttonRef = (0, import_react26.useRef)(null);
|
|
4304
|
-
const [value, setValue] = useControlledState(
|
|
4305
|
-
props.value,
|
|
4306
|
-
props.defaultValue || "",
|
|
4307
|
-
(0, import_react26.useCallback)(
|
|
4308
|
-
(value2) => onChange?.({ target: { name: props.name, value: value2 } }),
|
|
4309
|
-
[props.name, onChange]
|
|
4310
|
-
)
|
|
4311
|
-
);
|
|
4312
|
-
const [displayValue, setDisplayValue] = (0, import_react26.useState)(
|
|
4313
|
-
() => value ? formatValueString2(parseDates(value, format), displayFormat) : ""
|
|
4314
|
-
);
|
|
4315
|
-
const [anchorEl, setAnchorEl] = (0, import_react26.useState)(null);
|
|
4316
|
-
const open = Boolean(anchorEl);
|
|
4317
|
-
const calendarValue = (0, import_react26.useMemo)(
|
|
4318
|
-
() => value ? parseDates(value, format) : void 0,
|
|
4319
|
-
[value, format]
|
|
4320
|
-
);
|
|
4321
|
-
(0, import_react26.useEffect)(() => {
|
|
4322
|
-
if (value) {
|
|
4323
|
-
try {
|
|
4324
|
-
const dates = parseDates(value, format);
|
|
4325
|
-
const newDisplayValue = formatValueString2(dates, displayFormat);
|
|
4326
|
-
setDisplayValue(newDisplayValue);
|
|
4327
|
-
} catch (error2) {
|
|
4080
|
+
M: {
|
|
4081
|
+
mask: import_react_imask2.IMask.MaskedRange,
|
|
4082
|
+
from: 1,
|
|
4083
|
+
to: 12,
|
|
4084
|
+
maxLength: 2
|
|
4085
|
+
},
|
|
4086
|
+
Y: {
|
|
4087
|
+
mask: import_react_imask2.IMask.MaskedRange,
|
|
4088
|
+
from: 1900,
|
|
4089
|
+
to: 9999
|
|
4328
4090
|
}
|
|
4091
|
+
},
|
|
4092
|
+
format: (dates) => formatValueString2(dates, format),
|
|
4093
|
+
parse: (str) => parseDates(str, format),
|
|
4094
|
+
autofix: "pad",
|
|
4095
|
+
overwrite: true
|
|
4096
|
+
}
|
|
4097
|
+
);
|
|
4098
|
+
});
|
|
4099
|
+
var DateRangePicker = (0, import_react26.forwardRef)((inProps, ref) => {
|
|
4100
|
+
const props = (0, import_joy34.useThemeProps)({ props: inProps, name: "DateRangePicker" });
|
|
4101
|
+
const {
|
|
4102
|
+
onChange,
|
|
4103
|
+
disabled,
|
|
4104
|
+
label,
|
|
4105
|
+
error,
|
|
4106
|
+
helperText,
|
|
4107
|
+
minDate,
|
|
4108
|
+
maxDate,
|
|
4109
|
+
disableFuture,
|
|
4110
|
+
disablePast,
|
|
4111
|
+
required,
|
|
4112
|
+
// NOTE: 스타일 관련된 props는 최상위 엘리먼트에 적용한다.
|
|
4113
|
+
sx,
|
|
4114
|
+
className,
|
|
4115
|
+
format = "YYYY/MM/DD",
|
|
4116
|
+
displayFormat = "YYYY/MM/DD",
|
|
4117
|
+
size,
|
|
4118
|
+
inputReadOnly,
|
|
4119
|
+
hideClearButton,
|
|
4120
|
+
readOnly,
|
|
4121
|
+
...innerProps
|
|
4122
|
+
} = props;
|
|
4123
|
+
const innerRef = (0, import_react26.useRef)(null);
|
|
4124
|
+
const buttonRef = (0, import_react26.useRef)(null);
|
|
4125
|
+
const [value, setValue] = useControlledState(
|
|
4126
|
+
props.value,
|
|
4127
|
+
props.defaultValue || "",
|
|
4128
|
+
(0, import_react26.useCallback)((value2) => onChange?.({ target: { name: props.name, value: value2 } }), [props.name, onChange])
|
|
4129
|
+
);
|
|
4130
|
+
const [displayValue, setDisplayValue] = (0, import_react26.useState)(
|
|
4131
|
+
() => value ? formatValueString2(parseDates(value, format), displayFormat) : ""
|
|
4132
|
+
);
|
|
4133
|
+
const [anchorEl, setAnchorEl] = (0, import_react26.useState)(null);
|
|
4134
|
+
const open = Boolean(anchorEl);
|
|
4135
|
+
const calendarValue = (0, import_react26.useMemo)(
|
|
4136
|
+
() => value ? parseDates(value, format) : void 0,
|
|
4137
|
+
[value, format]
|
|
4138
|
+
);
|
|
4139
|
+
(0, import_react26.useEffect)(() => {
|
|
4140
|
+
if (value) {
|
|
4141
|
+
try {
|
|
4142
|
+
const dates = parseDates(value, format);
|
|
4143
|
+
const newDisplayValue = formatValueString2(dates, displayFormat);
|
|
4144
|
+
setDisplayValue(newDisplayValue);
|
|
4145
|
+
} catch (error2) {
|
|
4146
|
+
}
|
|
4147
|
+
} else {
|
|
4148
|
+
setDisplayValue("");
|
|
4149
|
+
}
|
|
4150
|
+
}, [displayFormat, value, format]);
|
|
4151
|
+
(0, import_react26.useEffect)(() => {
|
|
4152
|
+
if (!anchorEl) {
|
|
4153
|
+
innerRef.current?.blur();
|
|
4154
|
+
}
|
|
4155
|
+
}, [anchorEl, innerRef]);
|
|
4156
|
+
(0, import_react26.useImperativeHandle)(ref, () => innerRef.current, [innerRef]);
|
|
4157
|
+
const handleChange = (0, import_react26.useCallback)(
|
|
4158
|
+
(event) => {
|
|
4159
|
+
const value2 = event.target.value;
|
|
4160
|
+
setDisplayValue(value2 ? formatValueString2(parseDates(value2, format), displayFormat) : value2);
|
|
4161
|
+
setValue(value2);
|
|
4162
|
+
},
|
|
4163
|
+
[displayFormat, format, setValue]
|
|
4164
|
+
);
|
|
4165
|
+
const handleDisplayInputChange = (0, import_react26.useCallback)(
|
|
4166
|
+
(event) => {
|
|
4167
|
+
if (event.target.value === "") {
|
|
4168
|
+
handleChange({
|
|
4169
|
+
target: {
|
|
4170
|
+
name: props.name,
|
|
4171
|
+
value: ""
|
|
4172
|
+
}
|
|
4173
|
+
});
|
|
4174
|
+
return;
|
|
4175
|
+
}
|
|
4176
|
+
const isValidDisplayValue = validValueFormat2(event.target.value, displayFormat);
|
|
4177
|
+
if (isValidDisplayValue) {
|
|
4178
|
+
const dates = parseDates(event.target.value, displayFormat);
|
|
4179
|
+
const formattedValue = formatValueString2(dates, format);
|
|
4180
|
+
handleChange({
|
|
4181
|
+
target: {
|
|
4182
|
+
name: props.name,
|
|
4183
|
+
value: formattedValue
|
|
4184
|
+
}
|
|
4185
|
+
});
|
|
4186
|
+
}
|
|
4187
|
+
},
|
|
4188
|
+
[displayFormat, format, handleChange, props.name]
|
|
4189
|
+
);
|
|
4190
|
+
const handleCalendarToggle = (0, import_react26.useCallback)(
|
|
4191
|
+
(event) => {
|
|
4192
|
+
setAnchorEl(anchorEl ? null : event.currentTarget);
|
|
4193
|
+
innerRef.current?.focus();
|
|
4194
|
+
},
|
|
4195
|
+
[anchorEl, setAnchorEl, innerRef]
|
|
4196
|
+
);
|
|
4197
|
+
const handleCalendarChange = (0, import_react26.useCallback)(
|
|
4198
|
+
([date1, date2]) => {
|
|
4199
|
+
if (!date1 || !date2) return;
|
|
4200
|
+
const formattedValue = formatValueString2([date1, date2], format);
|
|
4201
|
+
if (props.value !== void 0) {
|
|
4202
|
+
onChange?.({ target: { name: props.name, value: formattedValue } });
|
|
4329
4203
|
} else {
|
|
4330
|
-
setDisplayValue(
|
|
4204
|
+
setDisplayValue(formatValueString2([date1, date2], displayFormat));
|
|
4205
|
+
setValue(formattedValue);
|
|
4331
4206
|
}
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4207
|
+
setAnchorEl(null);
|
|
4208
|
+
},
|
|
4209
|
+
[props.value, props.name, onChange, setValue, setAnchorEl, format, displayFormat]
|
|
4210
|
+
);
|
|
4211
|
+
const handleInputMouseDown = (0, import_react26.useCallback)(
|
|
4212
|
+
(event) => {
|
|
4213
|
+
if (inputReadOnly) {
|
|
4214
|
+
event.preventDefault();
|
|
4215
|
+
buttonRef.current?.focus();
|
|
4336
4216
|
}
|
|
4337
|
-
},
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4354
|
-
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
return;
|
|
4361
|
-
}
|
|
4362
|
-
const isValidDisplayValue = validValueFormat2(
|
|
4363
|
-
event.target.value,
|
|
4364
|
-
displayFormat
|
|
4365
|
-
);
|
|
4366
|
-
if (isValidDisplayValue) {
|
|
4367
|
-
const dates = parseDates(event.target.value, displayFormat);
|
|
4368
|
-
const formattedValue = formatValueString2(dates, format);
|
|
4369
|
-
handleChange({
|
|
4370
|
-
target: {
|
|
4371
|
-
name: props.name,
|
|
4372
|
-
value: formattedValue
|
|
4217
|
+
},
|
|
4218
|
+
[inputReadOnly, buttonRef]
|
|
4219
|
+
);
|
|
4220
|
+
return /* @__PURE__ */ import_react26.default.createElement(DateRangePickerRoot, null, /* @__PURE__ */ import_react26.default.createElement(import_base3.FocusTrap, { open: true }, /* @__PURE__ */ import_react26.default.createElement(import_react26.default.Fragment, null, /* @__PURE__ */ import_react26.default.createElement(
|
|
4221
|
+
Input_default,
|
|
4222
|
+
{
|
|
4223
|
+
...innerProps,
|
|
4224
|
+
color: error ? "danger" : innerProps.color,
|
|
4225
|
+
ref,
|
|
4226
|
+
size,
|
|
4227
|
+
value: displayValue,
|
|
4228
|
+
onChange: handleDisplayInputChange,
|
|
4229
|
+
disabled,
|
|
4230
|
+
required,
|
|
4231
|
+
placeholder: `${displayFormat} - ${displayFormat}`,
|
|
4232
|
+
slotProps: {
|
|
4233
|
+
input: {
|
|
4234
|
+
component: TextMaskAdapter5,
|
|
4235
|
+
ref: innerRef,
|
|
4236
|
+
format: displayFormat,
|
|
4237
|
+
sx: {
|
|
4238
|
+
"&:hover": {
|
|
4239
|
+
cursor: inputReadOnly || readOnly ? "default" : "text"
|
|
4373
4240
|
}
|
|
4374
|
-
}
|
|
4375
|
-
|
|
4376
|
-
},
|
|
4377
|
-
[displayFormat, format, handleChange, props.name]
|
|
4378
|
-
);
|
|
4379
|
-
const handleCalendarToggle = (0, import_react26.useCallback)(
|
|
4380
|
-
(event) => {
|
|
4381
|
-
setAnchorEl(anchorEl ? null : event.currentTarget);
|
|
4382
|
-
innerRef.current?.focus();
|
|
4383
|
-
},
|
|
4384
|
-
[anchorEl, setAnchorEl, innerRef]
|
|
4385
|
-
);
|
|
4386
|
-
const handleCalendarChange = (0, import_react26.useCallback)(
|
|
4387
|
-
([date1, date2]) => {
|
|
4388
|
-
if (!date1 || !date2) return;
|
|
4389
|
-
const formattedValue = formatValueString2([date1, date2], format);
|
|
4390
|
-
if (props.value !== void 0) {
|
|
4391
|
-
onChange?.({ target: { name: props.name, value: formattedValue } });
|
|
4392
|
-
} else {
|
|
4393
|
-
setDisplayValue(
|
|
4394
|
-
formatValueString2([date1, date2], displayFormat)
|
|
4395
|
-
);
|
|
4396
|
-
setValue(formattedValue);
|
|
4241
|
+
},
|
|
4242
|
+
onMouseDown: handleInputMouseDown
|
|
4397
4243
|
}
|
|
4398
|
-
setAnchorEl(null);
|
|
4399
4244
|
},
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
|
|
4414
|
-
|
|
4245
|
+
error,
|
|
4246
|
+
className,
|
|
4247
|
+
sx,
|
|
4248
|
+
endDecorator: /* @__PURE__ */ import_react26.default.createElement(
|
|
4249
|
+
CalendarButton2,
|
|
4250
|
+
{
|
|
4251
|
+
ref: buttonRef,
|
|
4252
|
+
variant: "plain",
|
|
4253
|
+
onClick: readOnly ? void 0 : handleCalendarToggle,
|
|
4254
|
+
"aria-label": "Toggle Calendar",
|
|
4255
|
+
"aria-controls": "date-range-picker-popper",
|
|
4256
|
+
"aria-haspopup": "dialog",
|
|
4257
|
+
"aria-expanded": open,
|
|
4258
|
+
disabled
|
|
4259
|
+
},
|
|
4260
|
+
/* @__PURE__ */ import_react26.default.createElement(import_CalendarToday2.default, null)
|
|
4261
|
+
),
|
|
4262
|
+
label,
|
|
4263
|
+
helperText,
|
|
4264
|
+
readOnly: readOnly || inputReadOnly
|
|
4265
|
+
}
|
|
4266
|
+
), open && /* @__PURE__ */ import_react26.default.createElement(import_base3.ClickAwayListener, { onClickAway: () => setAnchorEl(null) }, /* @__PURE__ */ import_react26.default.createElement(
|
|
4267
|
+
StyledPopper2,
|
|
4268
|
+
{
|
|
4269
|
+
id: "date-range-picker-popper",
|
|
4270
|
+
open: true,
|
|
4271
|
+
anchorEl,
|
|
4272
|
+
placement: "bottom-end",
|
|
4273
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
4274
|
+
modifiers: [
|
|
4275
|
+
{
|
|
4276
|
+
name: "offset",
|
|
4277
|
+
options: {
|
|
4278
|
+
offset: [4, 4]
|
|
4279
|
+
}
|
|
4415
4280
|
}
|
|
4416
|
-
|
|
4417
|
-
|
|
4418
|
-
|
|
4419
|
-
|
|
4420
|
-
|
|
4281
|
+
],
|
|
4282
|
+
"aria-label": "Calendar Tooltip",
|
|
4283
|
+
"aria-expanded": open
|
|
4284
|
+
},
|
|
4285
|
+
/* @__PURE__ */ import_react26.default.createElement(CalendarSheet2, { tabIndex: -1, role: "presentation" }, /* @__PURE__ */ import_react26.default.createElement(
|
|
4286
|
+
Calendar_default,
|
|
4421
4287
|
{
|
|
4422
|
-
|
|
4423
|
-
|
|
4424
|
-
|
|
4425
|
-
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
|
|
4429
|
-
required,
|
|
4430
|
-
placeholder: `${displayFormat} - ${displayFormat}`,
|
|
4431
|
-
slotProps: {
|
|
4432
|
-
input: {
|
|
4433
|
-
component: TextMaskAdapter5,
|
|
4434
|
-
ref: innerRef,
|
|
4435
|
-
format: displayFormat,
|
|
4436
|
-
sx: {
|
|
4437
|
-
"&:hover": {
|
|
4438
|
-
cursor: inputReadOnly || readOnly ? "default" : "text"
|
|
4439
|
-
}
|
|
4440
|
-
},
|
|
4441
|
-
onMouseDown: handleInputMouseDown
|
|
4442
|
-
}
|
|
4443
|
-
},
|
|
4444
|
-
error,
|
|
4445
|
-
className,
|
|
4446
|
-
sx,
|
|
4447
|
-
endDecorator: /* @__PURE__ */ import_react26.default.createElement(
|
|
4448
|
-
CalendarButton2,
|
|
4449
|
-
{
|
|
4450
|
-
ref: buttonRef,
|
|
4451
|
-
variant: "plain",
|
|
4452
|
-
onClick: readOnly ? void 0 : handleCalendarToggle,
|
|
4453
|
-
"aria-label": "Toggle Calendar",
|
|
4454
|
-
"aria-controls": "date-range-picker-popper",
|
|
4455
|
-
"aria-haspopup": "dialog",
|
|
4456
|
-
"aria-expanded": open,
|
|
4457
|
-
disabled
|
|
4458
|
-
},
|
|
4459
|
-
/* @__PURE__ */ import_react26.default.createElement(import_CalendarToday2.default, null)
|
|
4460
|
-
),
|
|
4461
|
-
label,
|
|
4462
|
-
helperText,
|
|
4463
|
-
readOnly: readOnly || inputReadOnly
|
|
4288
|
+
rangeSelection: true,
|
|
4289
|
+
defaultValue: calendarValue,
|
|
4290
|
+
onChange: handleCalendarChange,
|
|
4291
|
+
minDate: minDate ? new Date(minDate) : void 0,
|
|
4292
|
+
maxDate: maxDate ? new Date(maxDate) : void 0,
|
|
4293
|
+
disableFuture,
|
|
4294
|
+
disablePast
|
|
4464
4295
|
}
|
|
4465
|
-
),
|
|
4466
|
-
|
|
4296
|
+
), !hideClearButton && /* @__PURE__ */ import_react26.default.createElement(
|
|
4297
|
+
DialogActions_default,
|
|
4467
4298
|
{
|
|
4468
|
-
|
|
4469
|
-
|
|
4470
|
-
anchorEl,
|
|
4471
|
-
placement: "bottom-end",
|
|
4472
|
-
onMouseDown: (e) => e.preventDefault(),
|
|
4473
|
-
modifiers: [
|
|
4474
|
-
{
|
|
4475
|
-
name: "offset",
|
|
4476
|
-
options: {
|
|
4477
|
-
offset: [4, 4]
|
|
4478
|
-
}
|
|
4479
|
-
}
|
|
4480
|
-
],
|
|
4481
|
-
"aria-label": "Calendar Tooltip",
|
|
4482
|
-
"aria-expanded": open
|
|
4483
|
-
},
|
|
4484
|
-
/* @__PURE__ */ import_react26.default.createElement(CalendarSheet2, { tabIndex: -1, role: "presentation" }, /* @__PURE__ */ import_react26.default.createElement(
|
|
4485
|
-
Calendar_default,
|
|
4486
|
-
{
|
|
4487
|
-
rangeSelection: true,
|
|
4488
|
-
defaultValue: calendarValue,
|
|
4489
|
-
onChange: handleCalendarChange,
|
|
4490
|
-
minDate: minDate ? new Date(minDate) : void 0,
|
|
4491
|
-
maxDate: maxDate ? new Date(maxDate) : void 0,
|
|
4492
|
-
disableFuture,
|
|
4493
|
-
disablePast
|
|
4299
|
+
sx: {
|
|
4300
|
+
p: 1
|
|
4494
4301
|
}
|
|
4495
|
-
|
|
4496
|
-
|
|
4302
|
+
},
|
|
4303
|
+
/* @__PURE__ */ import_react26.default.createElement(
|
|
4304
|
+
Button_default,
|
|
4497
4305
|
{
|
|
4498
|
-
|
|
4499
|
-
|
|
4306
|
+
size,
|
|
4307
|
+
variant: "plain",
|
|
4308
|
+
color: "neutral",
|
|
4309
|
+
onClick: () => {
|
|
4310
|
+
setValue("");
|
|
4311
|
+
setDisplayValue("");
|
|
4312
|
+
setAnchorEl(null);
|
|
4500
4313
|
}
|
|
4501
4314
|
},
|
|
4502
|
-
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
color: "neutral",
|
|
4508
|
-
onClick: () => {
|
|
4509
|
-
setValue("");
|
|
4510
|
-
setDisplayValue("");
|
|
4511
|
-
setAnchorEl(null);
|
|
4512
|
-
}
|
|
4513
|
-
},
|
|
4514
|
-
"Clear"
|
|
4515
|
-
)
|
|
4516
|
-
))
|
|
4517
|
-
)))));
|
|
4518
|
-
}
|
|
4519
|
-
);
|
|
4315
|
+
"Clear"
|
|
4316
|
+
)
|
|
4317
|
+
))
|
|
4318
|
+
)))));
|
|
4319
|
+
});
|
|
4520
4320
|
DateRangePicker.displayName = "DateRangePicker";
|
|
4521
4321
|
|
|
4522
4322
|
// src/components/Drawer/Drawer.tsx
|
|
@@ -4603,17 +4403,7 @@ var StyledDialogFrame = (0, import_joy39.styled)(ModalDialog, {
|
|
|
4603
4403
|
});
|
|
4604
4404
|
var DialogFrame = import_react29.default.forwardRef((props, ref) => {
|
|
4605
4405
|
const { title, children, actions, fullscreen, ...innerProps } = props;
|
|
4606
|
-
return /* @__PURE__ */ import_react29.default.createElement(
|
|
4607
|
-
StyledDialogFrame,
|
|
4608
|
-
{
|
|
4609
|
-
layout: fullscreen ? "fullscreen" : "center",
|
|
4610
|
-
ref,
|
|
4611
|
-
...innerProps
|
|
4612
|
-
},
|
|
4613
|
-
/* @__PURE__ */ import_react29.default.createElement(DialogTitle_default, null, title),
|
|
4614
|
-
/* @__PURE__ */ import_react29.default.createElement(DialogContent_default, null, children),
|
|
4615
|
-
/* @__PURE__ */ import_react29.default.createElement(DialogActions_default, null, actions)
|
|
4616
|
-
);
|
|
4406
|
+
return /* @__PURE__ */ import_react29.default.createElement(StyledDialogFrame, { layout: fullscreen ? "fullscreen" : "center", ref, ...innerProps }, /* @__PURE__ */ import_react29.default.createElement(DialogTitle_default, null, title), /* @__PURE__ */ import_react29.default.createElement(DialogContent_default, null, children), /* @__PURE__ */ import_react29.default.createElement(DialogActions_default, null, actions));
|
|
4617
4407
|
});
|
|
4618
4408
|
DialogFrame.displayName = "DialogFrame";
|
|
4619
4409
|
|
|
@@ -4692,15 +4482,7 @@ function IconMenuButton(props) {
|
|
|
4692
4482
|
}
|
|
4693
4483
|
},
|
|
4694
4484
|
icon
|
|
4695
|
-
), /* @__PURE__ */ import_react31.default.createElement(Menu, { placement, size }, items.map((i) => /* @__PURE__ */ import_react31.default.createElement(
|
|
4696
|
-
MenuItem,
|
|
4697
|
-
{
|
|
4698
|
-
key: i.text,
|
|
4699
|
-
component: i.component,
|
|
4700
|
-
...i.componentProps ?? {}
|
|
4701
|
-
},
|
|
4702
|
-
i.text
|
|
4703
|
-
))));
|
|
4485
|
+
), /* @__PURE__ */ import_react31.default.createElement(Menu, { placement, size }, items.map((i) => /* @__PURE__ */ import_react31.default.createElement(MenuItem, { key: i.text, component: i.component, ...i.componentProps ?? {} }, i.text))));
|
|
4704
4486
|
}
|
|
4705
4487
|
IconMenuButton.displayName = "IconMenuButton";
|
|
4706
4488
|
|
|
@@ -4734,52 +4516,33 @@ var Markdown = (props) => {
|
|
|
4734
4516
|
if (!rehypeAccent2) {
|
|
4735
4517
|
return null;
|
|
4736
4518
|
}
|
|
4737
|
-
return /* @__PURE__ */ import_react32.default.createElement(
|
|
4738
|
-
|
|
4519
|
+
return /* @__PURE__ */ import_react32.default.createElement(Typography, { component: "div", color, textColor, level: defaultLevel, ...innerProps }, /* @__PURE__ */ import_react32.default.createElement(
|
|
4520
|
+
import_react32.Suspense,
|
|
4739
4521
|
{
|
|
4740
|
-
|
|
4741
|
-
color,
|
|
4742
|
-
textColor,
|
|
4743
|
-
level: defaultLevel,
|
|
4744
|
-
...innerProps
|
|
4522
|
+
fallback: fallback || /* @__PURE__ */ import_react32.default.createElement(Typography, null, /* @__PURE__ */ import_react32.default.createElement(import_joy44.Skeleton, null, content || ""))
|
|
4745
4523
|
},
|
|
4746
4524
|
/* @__PURE__ */ import_react32.default.createElement(
|
|
4747
|
-
|
|
4525
|
+
LazyReactMarkdown,
|
|
4748
4526
|
{
|
|
4749
|
-
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
{
|
|
4754
|
-
|
|
4755
|
-
children:
|
|
4756
|
-
|
|
4757
|
-
|
|
4758
|
-
|
|
4759
|
-
|
|
4760
|
-
|
|
4761
|
-
|
|
4762
|
-
|
|
4763
|
-
|
|
4764
|
-
Typography,
|
|
4765
|
-
{
|
|
4766
|
-
color,
|
|
4767
|
-
textColor,
|
|
4768
|
-
level: defaultLevel,
|
|
4769
|
-
...node?.properties
|
|
4770
|
-
},
|
|
4771
|
-
children
|
|
4772
|
-
),
|
|
4773
|
-
a: ({ children, href }) => /* @__PURE__ */ import_react32.default.createElement(import_joy45.Link, { href, target: defaultLinkAction }, children),
|
|
4774
|
-
hr: () => /* @__PURE__ */ import_react32.default.createElement(Divider, null),
|
|
4775
|
-
b: ({ children }) => /* @__PURE__ */ import_react32.default.createElement(Typography, { fontWeight: boldFontWeight }, children),
|
|
4776
|
-
strong: ({ children }) => /* @__PURE__ */ import_react32.default.createElement(Typography, { fontWeight: boldFontWeight }, children),
|
|
4777
|
-
...markdownOptions?.components
|
|
4778
|
-
}
|
|
4527
|
+
...markdownOptions,
|
|
4528
|
+
children: content,
|
|
4529
|
+
rehypePlugins: [[rehypeAccent2, { accentColor }]],
|
|
4530
|
+
remarkPlugins: [import_remark_gfm.default],
|
|
4531
|
+
components: {
|
|
4532
|
+
h1: ({ children }) => /* @__PURE__ */ import_react32.default.createElement(Typography, { color, textColor, level: "h1" }, children),
|
|
4533
|
+
h2: ({ children }) => /* @__PURE__ */ import_react32.default.createElement(Typography, { color, textColor, level: "h2" }, children),
|
|
4534
|
+
h3: ({ children }) => /* @__PURE__ */ import_react32.default.createElement(Typography, { color, textColor, level: "h3" }, children),
|
|
4535
|
+
h4: ({ children }) => /* @__PURE__ */ import_react32.default.createElement(Typography, { color, textColor, level: "h4" }, children),
|
|
4536
|
+
p: ({ children, node }) => /* @__PURE__ */ import_react32.default.createElement(Typography, { color, textColor, level: defaultLevel, ...node?.properties }, children),
|
|
4537
|
+
a: ({ children, href }) => /* @__PURE__ */ import_react32.default.createElement(import_joy45.Link, { href, target: defaultLinkAction }, children),
|
|
4538
|
+
hr: () => /* @__PURE__ */ import_react32.default.createElement(Divider, null),
|
|
4539
|
+
b: ({ children }) => /* @__PURE__ */ import_react32.default.createElement(Typography, { fontWeight: boldFontWeight }, children),
|
|
4540
|
+
strong: ({ children }) => /* @__PURE__ */ import_react32.default.createElement(Typography, { fontWeight: boldFontWeight }, children),
|
|
4541
|
+
...markdownOptions?.components
|
|
4779
4542
|
}
|
|
4780
|
-
|
|
4543
|
+
}
|
|
4781
4544
|
)
|
|
4782
|
-
);
|
|
4545
|
+
));
|
|
4783
4546
|
};
|
|
4784
4547
|
Markdown.displayName = "Markdown";
|
|
4785
4548
|
|
|
@@ -4832,15 +4595,7 @@ function MenuButton(props) {
|
|
|
4832
4595
|
endDecorator: showIcon ? /* @__PURE__ */ import_react33.default.createElement(import_react33.default.Fragment, null, endDecorator, /* @__PURE__ */ import_react33.default.createElement(import_ExpandMore.default, null)) : /* @__PURE__ */ import_react33.default.createElement(import_react33.default.Fragment, null, endDecorator)
|
|
4833
4596
|
},
|
|
4834
4597
|
buttonText
|
|
4835
|
-
), /* @__PURE__ */ import_react33.default.createElement(Menu, { placement, size }, items.map((i) => /* @__PURE__ */ import_react33.default.createElement(
|
|
4836
|
-
MenuItem,
|
|
4837
|
-
{
|
|
4838
|
-
key: i.text,
|
|
4839
|
-
component: i.component,
|
|
4840
|
-
...i.componentProps ?? {}
|
|
4841
|
-
},
|
|
4842
|
-
i.text
|
|
4843
|
-
))));
|
|
4598
|
+
), /* @__PURE__ */ import_react33.default.createElement(Menu, { placement, size }, items.map((i) => /* @__PURE__ */ import_react33.default.createElement(MenuItem, { key: i.text, component: i.component, ...i.componentProps ?? {} }, i.text))));
|
|
4844
4599
|
}
|
|
4845
4600
|
MenuButton.displayName = "MenuButton";
|
|
4846
4601
|
|
|
@@ -4900,215 +4655,202 @@ function parseDate3(dateString, format) {
|
|
|
4900
4655
|
const result = new Date(year, month, day);
|
|
4901
4656
|
return result;
|
|
4902
4657
|
}
|
|
4903
|
-
var MonthPicker = (0, import_react34.forwardRef)(
|
|
4904
|
-
(
|
|
4905
|
-
|
|
4906
|
-
|
|
4907
|
-
|
|
4658
|
+
var MonthPicker = (0, import_react34.forwardRef)((inProps, ref) => {
|
|
4659
|
+
const props = (0, import_joy47.useThemeProps)({ props: inProps, name: "MonthPicker" });
|
|
4660
|
+
const {
|
|
4661
|
+
onChange,
|
|
4662
|
+
disabled,
|
|
4663
|
+
label,
|
|
4664
|
+
error,
|
|
4665
|
+
helperText,
|
|
4666
|
+
minDate,
|
|
4667
|
+
maxDate,
|
|
4668
|
+
disableFuture,
|
|
4669
|
+
disablePast,
|
|
4670
|
+
required,
|
|
4671
|
+
// NOTE: 스타일 관련된 props는 최상위 엘리먼트에 적용한다.
|
|
4672
|
+
sx,
|
|
4673
|
+
className,
|
|
4674
|
+
/**
|
|
4675
|
+
* NOTE: 현재 CalendarDate는 YYYY-MM-DD로 개발하고 있어 date를 포함하여 value를 관리한다.
|
|
4676
|
+
* @see https://ecubelabs.atlassian.net/wiki/spaces/SW/pages/1938784349/Date#CalendarDate
|
|
4677
|
+
* @see https://github.com/Ecube-Labs/hds/pull/145
|
|
4678
|
+
*/
|
|
4679
|
+
format = "YYYY/MM/DD",
|
|
4680
|
+
displayFormat = "YYYY/MM",
|
|
4681
|
+
size,
|
|
4682
|
+
locale,
|
|
4683
|
+
...innerProps
|
|
4684
|
+
} = props;
|
|
4685
|
+
const innerRef = (0, import_react34.useRef)(null);
|
|
4686
|
+
const buttonRef = (0, import_react34.useRef)(null);
|
|
4687
|
+
const [value, setValue, isControlled] = useControlledState(
|
|
4688
|
+
props.value,
|
|
4689
|
+
props.defaultValue || "",
|
|
4690
|
+
(0, import_react34.useCallback)((value2) => onChange?.({ target: { name: props.name, value: value2 } }), [props.name, onChange])
|
|
4691
|
+
);
|
|
4692
|
+
const getFormattedDisplayValue = (0, import_react34.useCallback)(
|
|
4693
|
+
(inputValue) => {
|
|
4694
|
+
if (!inputValue) return "";
|
|
4695
|
+
try {
|
|
4696
|
+
return formatValueString3(parseDate3(inputValue, format), displayFormat, locale);
|
|
4697
|
+
} catch (e) {
|
|
4698
|
+
return inputValue;
|
|
4699
|
+
}
|
|
4700
|
+
},
|
|
4701
|
+
[format, displayFormat, locale]
|
|
4702
|
+
);
|
|
4703
|
+
const [displayValue, setDisplayValue] = (0, import_react34.useState)(() => getFormattedDisplayValue(value));
|
|
4704
|
+
const [anchorEl, setAnchorEl] = (0, import_react34.useState)(null);
|
|
4705
|
+
const open = Boolean(anchorEl);
|
|
4706
|
+
(0, import_react34.useEffect)(() => {
|
|
4707
|
+
if (!anchorEl) {
|
|
4708
|
+
innerRef.current?.blur();
|
|
4709
|
+
}
|
|
4710
|
+
}, [anchorEl, innerRef]);
|
|
4711
|
+
(0, import_react34.useImperativeHandle)(ref, () => innerRef.current, [innerRef]);
|
|
4712
|
+
(0, import_react34.useEffect)(() => {
|
|
4713
|
+
setDisplayValue(getFormattedDisplayValue(value));
|
|
4714
|
+
}, [value, getFormattedDisplayValue]);
|
|
4715
|
+
const handleChange = (0, import_react34.useCallback)(
|
|
4716
|
+
(event) => {
|
|
4717
|
+
const newValue = event.target.value;
|
|
4718
|
+
setValue(newValue);
|
|
4719
|
+
if (!isControlled) {
|
|
4720
|
+
setDisplayValue(getFormattedDisplayValue(newValue));
|
|
4721
|
+
}
|
|
4722
|
+
},
|
|
4723
|
+
[setValue, getFormattedDisplayValue, isControlled]
|
|
4724
|
+
);
|
|
4725
|
+
const handleCalendarToggle = (0, import_react34.useCallback)(
|
|
4726
|
+
(event) => {
|
|
4727
|
+
setAnchorEl(anchorEl ? null : event.currentTarget);
|
|
4728
|
+
innerRef.current?.focus();
|
|
4729
|
+
},
|
|
4730
|
+
[anchorEl, setAnchorEl, innerRef]
|
|
4731
|
+
);
|
|
4732
|
+
const handleInputMouseDown = (0, import_react34.useCallback)(
|
|
4733
|
+
(event) => {
|
|
4734
|
+
event.preventDefault();
|
|
4735
|
+
buttonRef.current?.focus();
|
|
4736
|
+
},
|
|
4737
|
+
[buttonRef]
|
|
4738
|
+
);
|
|
4739
|
+
return /* @__PURE__ */ import_react34.default.createElement(MonthPickerRoot, null, /* @__PURE__ */ import_react34.default.createElement(import_base4.FocusTrap, { open: true }, /* @__PURE__ */ import_react34.default.createElement(import_react34.default.Fragment, null, /* @__PURE__ */ import_react34.default.createElement(
|
|
4740
|
+
Input_default,
|
|
4741
|
+
{
|
|
4742
|
+
...innerProps,
|
|
4743
|
+
color: error ? "danger" : innerProps.color,
|
|
4744
|
+
ref: innerRef,
|
|
4745
|
+
size,
|
|
4746
|
+
value: displayValue,
|
|
4747
|
+
placeholder: displayFormat,
|
|
4908
4748
|
disabled,
|
|
4909
|
-
label,
|
|
4910
|
-
error,
|
|
4911
|
-
helperText,
|
|
4912
|
-
minDate,
|
|
4913
|
-
maxDate,
|
|
4914
|
-
disableFuture,
|
|
4915
|
-
disablePast,
|
|
4916
4749
|
required,
|
|
4917
|
-
|
|
4918
|
-
|
|
4919
|
-
|
|
4920
|
-
|
|
4921
|
-
|
|
4922
|
-
|
|
4923
|
-
|
|
4924
|
-
|
|
4925
|
-
|
|
4926
|
-
|
|
4927
|
-
size,
|
|
4928
|
-
locale,
|
|
4929
|
-
...innerProps
|
|
4930
|
-
} = props;
|
|
4931
|
-
const innerRef = (0, import_react34.useRef)(null);
|
|
4932
|
-
const buttonRef = (0, import_react34.useRef)(null);
|
|
4933
|
-
const [value, setValue, isControlled] = useControlledState(
|
|
4934
|
-
props.value,
|
|
4935
|
-
props.defaultValue || "",
|
|
4936
|
-
(0, import_react34.useCallback)(
|
|
4937
|
-
(value2) => onChange?.({ target: { name: props.name, value: value2 } }),
|
|
4938
|
-
[props.name, onChange]
|
|
4939
|
-
)
|
|
4940
|
-
);
|
|
4941
|
-
const getFormattedDisplayValue = (0, import_react34.useCallback)(
|
|
4942
|
-
(inputValue) => {
|
|
4943
|
-
if (!inputValue) return "";
|
|
4944
|
-
try {
|
|
4945
|
-
return formatValueString3(
|
|
4946
|
-
parseDate3(inputValue, format),
|
|
4947
|
-
displayFormat,
|
|
4948
|
-
locale
|
|
4949
|
-
);
|
|
4950
|
-
} catch (e) {
|
|
4951
|
-
return inputValue;
|
|
4952
|
-
}
|
|
4953
|
-
},
|
|
4954
|
-
[format, displayFormat, locale]
|
|
4955
|
-
);
|
|
4956
|
-
const [displayValue, setDisplayValue] = (0, import_react34.useState)(
|
|
4957
|
-
() => getFormattedDisplayValue(value)
|
|
4958
|
-
);
|
|
4959
|
-
const [anchorEl, setAnchorEl] = (0, import_react34.useState)(null);
|
|
4960
|
-
const open = Boolean(anchorEl);
|
|
4961
|
-
(0, import_react34.useEffect)(() => {
|
|
4962
|
-
if (!anchorEl) {
|
|
4963
|
-
innerRef.current?.blur();
|
|
4964
|
-
}
|
|
4965
|
-
}, [anchorEl, innerRef]);
|
|
4966
|
-
(0, import_react34.useImperativeHandle)(ref, () => innerRef.current, [
|
|
4967
|
-
innerRef
|
|
4968
|
-
]);
|
|
4969
|
-
(0, import_react34.useEffect)(() => {
|
|
4970
|
-
setDisplayValue(getFormattedDisplayValue(value));
|
|
4971
|
-
}, [value, getFormattedDisplayValue]);
|
|
4972
|
-
const handleChange = (0, import_react34.useCallback)(
|
|
4973
|
-
(event) => {
|
|
4974
|
-
const newValue = event.target.value;
|
|
4975
|
-
setValue(newValue);
|
|
4976
|
-
if (!isControlled) {
|
|
4977
|
-
setDisplayValue(getFormattedDisplayValue(newValue));
|
|
4750
|
+
slotProps: {
|
|
4751
|
+
input: {
|
|
4752
|
+
ref: innerRef,
|
|
4753
|
+
format: displayFormat,
|
|
4754
|
+
sx: {
|
|
4755
|
+
"&:hover": {
|
|
4756
|
+
cursor: "default"
|
|
4757
|
+
}
|
|
4758
|
+
},
|
|
4759
|
+
onMouseDown: handleInputMouseDown
|
|
4978
4760
|
}
|
|
4979
4761
|
},
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
},
|
|
4987
|
-
[anchorEl, setAnchorEl, innerRef]
|
|
4988
|
-
);
|
|
4989
|
-
const handleInputMouseDown = (0, import_react34.useCallback)(
|
|
4990
|
-
(event) => {
|
|
4991
|
-
event.preventDefault();
|
|
4992
|
-
buttonRef.current?.focus();
|
|
4762
|
+
error,
|
|
4763
|
+
className,
|
|
4764
|
+
sx: {
|
|
4765
|
+
...sx,
|
|
4766
|
+
// NOTE: placeholder char 를 텍스트로 표시하므로 동일한 너비를 가지는 mono font 를 사용해야 이질감이 없다.
|
|
4767
|
+
fontFamily: "monospace"
|
|
4993
4768
|
},
|
|
4994
|
-
|
|
4995
|
-
|
|
4996
|
-
|
|
4997
|
-
|
|
4998
|
-
|
|
4999
|
-
|
|
5000
|
-
|
|
5001
|
-
|
|
5002
|
-
|
|
5003
|
-
|
|
5004
|
-
|
|
5005
|
-
disabled,
|
|
5006
|
-
required,
|
|
5007
|
-
slotProps: {
|
|
5008
|
-
input: {
|
|
5009
|
-
ref: innerRef,
|
|
5010
|
-
format: displayFormat,
|
|
5011
|
-
sx: {
|
|
5012
|
-
"&:hover": {
|
|
5013
|
-
cursor: "default"
|
|
5014
|
-
}
|
|
5015
|
-
},
|
|
5016
|
-
onMouseDown: handleInputMouseDown
|
|
5017
|
-
}
|
|
4769
|
+
endDecorator: /* @__PURE__ */ import_react34.default.createElement(
|
|
4770
|
+
IconButton_default,
|
|
4771
|
+
{
|
|
4772
|
+
ref: buttonRef,
|
|
4773
|
+
variant: "plain",
|
|
4774
|
+
onClick: handleCalendarToggle,
|
|
4775
|
+
"aria-label": "Toggle Calendar",
|
|
4776
|
+
"aria-controls": "month-picker-popper",
|
|
4777
|
+
"aria-haspopup": "dialog",
|
|
4778
|
+
"aria-expanded": open,
|
|
4779
|
+
disabled
|
|
5018
4780
|
},
|
|
5019
|
-
|
|
5020
|
-
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
|
|
5024
|
-
|
|
4781
|
+
/* @__PURE__ */ import_react34.default.createElement(import_CalendarToday3.default, null)
|
|
4782
|
+
),
|
|
4783
|
+
label,
|
|
4784
|
+
helperText
|
|
4785
|
+
}
|
|
4786
|
+
), open && /* @__PURE__ */ import_react34.default.createElement(import_base4.ClickAwayListener, { onClickAway: () => setAnchorEl(null) }, /* @__PURE__ */ import_react34.default.createElement(
|
|
4787
|
+
StyledPopper3,
|
|
4788
|
+
{
|
|
4789
|
+
id: "month-picker-popper",
|
|
4790
|
+
open: true,
|
|
4791
|
+
anchorEl,
|
|
4792
|
+
placement: "bottom-end",
|
|
4793
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
4794
|
+
modifiers: [
|
|
4795
|
+
{
|
|
4796
|
+
name: "offset",
|
|
4797
|
+
options: {
|
|
4798
|
+
offset: [4, 4]
|
|
4799
|
+
}
|
|
4800
|
+
}
|
|
4801
|
+
],
|
|
4802
|
+
"aria-label": "Calendar Tooltip",
|
|
4803
|
+
"aria-expanded": open
|
|
4804
|
+
},
|
|
4805
|
+
/* @__PURE__ */ import_react34.default.createElement(CalendarSheet3, { tabIndex: -1, role: "presentation" }, /* @__PURE__ */ import_react34.default.createElement(
|
|
4806
|
+
Calendar_default,
|
|
4807
|
+
{
|
|
4808
|
+
view: "month",
|
|
4809
|
+
views: ["month"],
|
|
4810
|
+
value: !Number.isNaN(new Date(value).getTime()) ? [new Date(value), void 0] : void 0,
|
|
4811
|
+
onChange: ([date]) => {
|
|
4812
|
+
handleChange({
|
|
4813
|
+
target: {
|
|
4814
|
+
name: props.name,
|
|
4815
|
+
value: formatValueString3(date, format, locale)
|
|
4816
|
+
}
|
|
4817
|
+
});
|
|
4818
|
+
setAnchorEl(null);
|
|
5025
4819
|
},
|
|
5026
|
-
|
|
5027
|
-
|
|
5028
|
-
|
|
5029
|
-
|
|
5030
|
-
|
|
5031
|
-
onClick: handleCalendarToggle,
|
|
5032
|
-
"aria-label": "Toggle Calendar",
|
|
5033
|
-
"aria-controls": "month-picker-popper",
|
|
5034
|
-
"aria-haspopup": "dialog",
|
|
5035
|
-
"aria-expanded": open,
|
|
5036
|
-
disabled
|
|
5037
|
-
},
|
|
5038
|
-
/* @__PURE__ */ import_react34.default.createElement(import_CalendarToday3.default, null)
|
|
5039
|
-
),
|
|
5040
|
-
label,
|
|
5041
|
-
helperText
|
|
4820
|
+
minDate: minDate ? new Date(minDate) : void 0,
|
|
4821
|
+
maxDate: maxDate ? new Date(maxDate) : void 0,
|
|
4822
|
+
disableFuture,
|
|
4823
|
+
disablePast,
|
|
4824
|
+
locale
|
|
5042
4825
|
}
|
|
5043
|
-
),
|
|
5044
|
-
|
|
4826
|
+
), /* @__PURE__ */ import_react34.default.createElement(
|
|
4827
|
+
DialogActions_default,
|
|
5045
4828
|
{
|
|
5046
|
-
|
|
5047
|
-
|
|
5048
|
-
|
|
5049
|
-
placement: "bottom-end",
|
|
5050
|
-
onMouseDown: (e) => e.preventDefault(),
|
|
5051
|
-
modifiers: [
|
|
5052
|
-
{
|
|
5053
|
-
name: "offset",
|
|
5054
|
-
options: {
|
|
5055
|
-
offset: [4, 4]
|
|
5056
|
-
}
|
|
5057
|
-
}
|
|
5058
|
-
],
|
|
5059
|
-
"aria-label": "Calendar Tooltip",
|
|
5060
|
-
"aria-expanded": open
|
|
4829
|
+
sx: {
|
|
4830
|
+
p: 1
|
|
4831
|
+
}
|
|
5061
4832
|
},
|
|
5062
|
-
/* @__PURE__ */ import_react34.default.createElement(
|
|
5063
|
-
|
|
4833
|
+
/* @__PURE__ */ import_react34.default.createElement(
|
|
4834
|
+
Button_default,
|
|
5064
4835
|
{
|
|
5065
|
-
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
|
|
4836
|
+
size,
|
|
4837
|
+
variant: "plain",
|
|
4838
|
+
color: "neutral",
|
|
4839
|
+
onClick: () => {
|
|
5069
4840
|
handleChange({
|
|
5070
4841
|
target: {
|
|
5071
4842
|
name: props.name,
|
|
5072
|
-
value:
|
|
4843
|
+
value: ""
|
|
5073
4844
|
}
|
|
5074
4845
|
});
|
|
5075
4846
|
setAnchorEl(null);
|
|
5076
|
-
},
|
|
5077
|
-
minDate: minDate ? new Date(minDate) : void 0,
|
|
5078
|
-
maxDate: maxDate ? new Date(maxDate) : void 0,
|
|
5079
|
-
disableFuture,
|
|
5080
|
-
disablePast,
|
|
5081
|
-
locale
|
|
5082
|
-
}
|
|
5083
|
-
), /* @__PURE__ */ import_react34.default.createElement(
|
|
5084
|
-
DialogActions_default,
|
|
5085
|
-
{
|
|
5086
|
-
sx: {
|
|
5087
|
-
p: 1
|
|
5088
4847
|
}
|
|
5089
4848
|
},
|
|
5090
|
-
|
|
5091
|
-
|
|
5092
|
-
|
|
5093
|
-
|
|
5094
|
-
|
|
5095
|
-
color: "neutral",
|
|
5096
|
-
onClick: () => {
|
|
5097
|
-
handleChange({
|
|
5098
|
-
target: {
|
|
5099
|
-
name: props.name,
|
|
5100
|
-
value: ""
|
|
5101
|
-
}
|
|
5102
|
-
});
|
|
5103
|
-
setAnchorEl(null);
|
|
5104
|
-
}
|
|
5105
|
-
},
|
|
5106
|
-
"Clear"
|
|
5107
|
-
)
|
|
5108
|
-
))
|
|
5109
|
-
)))));
|
|
5110
|
-
}
|
|
5111
|
-
);
|
|
4849
|
+
"Clear"
|
|
4850
|
+
)
|
|
4851
|
+
))
|
|
4852
|
+
)))));
|
|
4853
|
+
});
|
|
5112
4854
|
|
|
5113
4855
|
// src/components/MonthRangePicker/MonthRangePicker.tsx
|
|
5114
4856
|
var import_react35 = __toESM(require("react"));
|
|
@@ -5169,196 +4911,184 @@ var parseDates2 = (str) => {
|
|
|
5169
4911
|
var formatToPattern3 = (format) => {
|
|
5170
4912
|
return `${format} - ${format}`.replace(/YYYY/g, "Y").replace(/MM/g, "m").replace(/[^YMm\s]/g, (match) => `${match}\``);
|
|
5171
4913
|
};
|
|
5172
|
-
var TextMaskAdapter7 = import_react35.default.forwardRef(
|
|
5173
|
-
|
|
5174
|
-
|
|
5175
|
-
|
|
5176
|
-
|
|
5177
|
-
|
|
5178
|
-
|
|
5179
|
-
|
|
5180
|
-
|
|
5181
|
-
|
|
5182
|
-
|
|
5183
|
-
|
|
5184
|
-
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
maxLength: 2
|
|
5189
|
-
},
|
|
5190
|
-
Y: {
|
|
5191
|
-
mask: import_react_imask3.IMask.MaskedRange,
|
|
5192
|
-
from: 1900,
|
|
5193
|
-
to: 9999
|
|
5194
|
-
}
|
|
4914
|
+
var TextMaskAdapter7 = import_react35.default.forwardRef(function TextMaskAdapter8(props, ref) {
|
|
4915
|
+
const { onChange, format, ...other } = props;
|
|
4916
|
+
return /* @__PURE__ */ import_react35.default.createElement(
|
|
4917
|
+
import_react_imask3.IMaskInput,
|
|
4918
|
+
{
|
|
4919
|
+
...other,
|
|
4920
|
+
inputRef: ref,
|
|
4921
|
+
onAccept: (value) => onChange({ target: { name: props.name, value } }),
|
|
4922
|
+
mask: Date,
|
|
4923
|
+
pattern: formatToPattern3(format),
|
|
4924
|
+
blocks: {
|
|
4925
|
+
m: {
|
|
4926
|
+
mask: import_react_imask3.IMask.MaskedRange,
|
|
4927
|
+
from: 1,
|
|
4928
|
+
to: 12,
|
|
4929
|
+
maxLength: 2
|
|
5195
4930
|
},
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
|
|
5201
|
-
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
|
|
4931
|
+
Y: {
|
|
4932
|
+
mask: import_react_imask3.IMask.MaskedRange,
|
|
4933
|
+
from: 1900,
|
|
4934
|
+
to: 9999
|
|
4935
|
+
}
|
|
4936
|
+
},
|
|
4937
|
+
format: (dates) => formatValueString4(dates, format),
|
|
4938
|
+
parse: parseDates2,
|
|
4939
|
+
autofix: "pad",
|
|
4940
|
+
overwrite: true
|
|
4941
|
+
}
|
|
4942
|
+
);
|
|
4943
|
+
});
|
|
4944
|
+
var MonthRangePicker = (0, import_react35.forwardRef)((inProps, ref) => {
|
|
4945
|
+
const props = (0, import_joy48.useThemeProps)({ props: inProps, name: "MonthRangePicker" });
|
|
4946
|
+
const {
|
|
4947
|
+
onChange,
|
|
4948
|
+
disabled,
|
|
4949
|
+
label,
|
|
4950
|
+
error,
|
|
4951
|
+
helperText,
|
|
4952
|
+
minDate,
|
|
4953
|
+
maxDate,
|
|
4954
|
+
disableFuture,
|
|
4955
|
+
disablePast,
|
|
4956
|
+
required,
|
|
4957
|
+
// NOTE: 스타일 관련된 props는 최상위 엘리먼트에 적용한다.
|
|
4958
|
+
sx,
|
|
4959
|
+
className,
|
|
4960
|
+
format = "YYYY/MM",
|
|
4961
|
+
size,
|
|
4962
|
+
...innerProps
|
|
4963
|
+
} = props;
|
|
4964
|
+
const innerRef = (0, import_react35.useRef)(null);
|
|
4965
|
+
const [value, setValue] = useControlledState(
|
|
4966
|
+
props.value,
|
|
4967
|
+
props.defaultValue || "",
|
|
4968
|
+
(0, import_react35.useCallback)((value2) => onChange?.({ target: { name: props.name, value: value2 } }), [props.name, onChange])
|
|
4969
|
+
);
|
|
4970
|
+
const [anchorEl, setAnchorEl] = (0, import_react35.useState)(null);
|
|
4971
|
+
const open = Boolean(anchorEl);
|
|
4972
|
+
const calendarValue = (0, import_react35.useMemo)(() => value ? parseDates2(value) : void 0, [value]);
|
|
4973
|
+
(0, import_react35.useEffect)(() => {
|
|
4974
|
+
if (!anchorEl) {
|
|
4975
|
+
innerRef.current?.blur();
|
|
4976
|
+
}
|
|
4977
|
+
}, [anchorEl, innerRef]);
|
|
4978
|
+
(0, import_react35.useImperativeHandle)(ref, () => innerRef.current, [innerRef]);
|
|
4979
|
+
const handleChange = (0, import_react35.useCallback)(
|
|
4980
|
+
(event) => {
|
|
4981
|
+
setValue(event.target.value);
|
|
4982
|
+
},
|
|
4983
|
+
[setValue]
|
|
4984
|
+
);
|
|
4985
|
+
const handleCalendarToggle = (0, import_react35.useCallback)(
|
|
4986
|
+
(event) => {
|
|
4987
|
+
setAnchorEl(anchorEl ? null : event.currentTarget);
|
|
4988
|
+
innerRef.current?.focus();
|
|
4989
|
+
},
|
|
4990
|
+
[anchorEl, setAnchorEl, innerRef]
|
|
4991
|
+
);
|
|
4992
|
+
const handleCalendarChange = (0, import_react35.useCallback)(
|
|
4993
|
+
([date1, date2]) => {
|
|
4994
|
+
if (!date1 || !date2) return;
|
|
4995
|
+
setValue(formatValueString4([date1, date2], format));
|
|
4996
|
+
setAnchorEl(null);
|
|
4997
|
+
},
|
|
4998
|
+
[setValue, setAnchorEl, format]
|
|
4999
|
+
);
|
|
5000
|
+
return /* @__PURE__ */ import_react35.default.createElement(MonthRangePickerRoot, null, /* @__PURE__ */ import_react35.default.createElement(import_base5.FocusTrap, { open: true }, /* @__PURE__ */ import_react35.default.createElement(import_react35.default.Fragment, null, /* @__PURE__ */ import_react35.default.createElement(
|
|
5001
|
+
Input_default,
|
|
5002
|
+
{
|
|
5003
|
+
...innerProps,
|
|
5004
|
+
color: error ? "danger" : innerProps.color,
|
|
5005
|
+
ref,
|
|
5006
|
+
size,
|
|
5007
|
+
value,
|
|
5008
|
+
onChange: handleChange,
|
|
5209
5009
|
disabled,
|
|
5210
|
-
label,
|
|
5211
|
-
error,
|
|
5212
|
-
helperText,
|
|
5213
|
-
minDate,
|
|
5214
|
-
maxDate,
|
|
5215
|
-
disableFuture,
|
|
5216
|
-
disablePast,
|
|
5217
5010
|
required,
|
|
5218
|
-
|
|
5219
|
-
|
|
5220
|
-
|
|
5221
|
-
format = "YYYY/MM",
|
|
5222
|
-
size,
|
|
5223
|
-
...innerProps
|
|
5224
|
-
} = props;
|
|
5225
|
-
const innerRef = (0, import_react35.useRef)(null);
|
|
5226
|
-
const [value, setValue] = useControlledState(
|
|
5227
|
-
props.value,
|
|
5228
|
-
props.defaultValue || "",
|
|
5229
|
-
(0, import_react35.useCallback)(
|
|
5230
|
-
(value2) => onChange?.({ target: { name: props.name, value: value2 } }),
|
|
5231
|
-
[props.name, onChange]
|
|
5232
|
-
)
|
|
5233
|
-
);
|
|
5234
|
-
const [anchorEl, setAnchorEl] = (0, import_react35.useState)(null);
|
|
5235
|
-
const open = Boolean(anchorEl);
|
|
5236
|
-
const calendarValue = (0, import_react35.useMemo)(
|
|
5237
|
-
() => value ? parseDates2(value) : void 0,
|
|
5238
|
-
[value]
|
|
5239
|
-
);
|
|
5240
|
-
(0, import_react35.useEffect)(() => {
|
|
5241
|
-
if (!anchorEl) {
|
|
5242
|
-
innerRef.current?.blur();
|
|
5243
|
-
}
|
|
5244
|
-
}, [anchorEl, innerRef]);
|
|
5245
|
-
(0, import_react35.useImperativeHandle)(ref, () => innerRef.current, [
|
|
5246
|
-
innerRef
|
|
5247
|
-
]);
|
|
5248
|
-
const handleChange = (0, import_react35.useCallback)(
|
|
5249
|
-
(event) => {
|
|
5250
|
-
setValue(event.target.value);
|
|
5251
|
-
},
|
|
5252
|
-
[setValue]
|
|
5253
|
-
);
|
|
5254
|
-
const handleCalendarToggle = (0, import_react35.useCallback)(
|
|
5255
|
-
(event) => {
|
|
5256
|
-
setAnchorEl(anchorEl ? null : event.currentTarget);
|
|
5257
|
-
innerRef.current?.focus();
|
|
5011
|
+
placeholder: `${format} - ${format}`,
|
|
5012
|
+
slotProps: {
|
|
5013
|
+
input: { component: TextMaskAdapter7, ref: innerRef, format }
|
|
5258
5014
|
},
|
|
5259
|
-
|
|
5260
|
-
|
|
5261
|
-
|
|
5262
|
-
|
|
5263
|
-
|
|
5264
|
-
|
|
5265
|
-
setAnchorEl(null);
|
|
5015
|
+
error,
|
|
5016
|
+
className,
|
|
5017
|
+
sx: {
|
|
5018
|
+
...sx,
|
|
5019
|
+
// NOTE: placeholder char 를 텍스트로 표시하므로 동일한 너비를 가지는 mono font 를 사용해야 이질감이 없다.
|
|
5020
|
+
fontFamily: "monospace"
|
|
5266
5021
|
},
|
|
5267
|
-
|
|
5268
|
-
|
|
5269
|
-
|
|
5270
|
-
|
|
5271
|
-
|
|
5272
|
-
|
|
5273
|
-
|
|
5274
|
-
|
|
5275
|
-
|
|
5276
|
-
value,
|
|
5277
|
-
onChange: handleChange,
|
|
5278
|
-
disabled,
|
|
5279
|
-
required,
|
|
5280
|
-
placeholder: `${format} - ${format}`,
|
|
5281
|
-
slotProps: {
|
|
5282
|
-
input: { component: TextMaskAdapter7, ref: innerRef, format }
|
|
5283
|
-
},
|
|
5284
|
-
error,
|
|
5285
|
-
className,
|
|
5286
|
-
sx: {
|
|
5287
|
-
...sx,
|
|
5288
|
-
// NOTE: placeholder char 를 텍스트로 표시하므로 동일한 너비를 가지는 mono font 를 사용해야 이질감이 없다.
|
|
5289
|
-
fontFamily: "monospace"
|
|
5022
|
+
endDecorator: /* @__PURE__ */ import_react35.default.createElement(
|
|
5023
|
+
IconButton_default,
|
|
5024
|
+
{
|
|
5025
|
+
variant: "plain",
|
|
5026
|
+
onClick: handleCalendarToggle,
|
|
5027
|
+
"aria-label": "Toggle Calendar",
|
|
5028
|
+
"aria-controls": "month-range-picker-popper",
|
|
5029
|
+
"aria-haspopup": "dialog",
|
|
5030
|
+
"aria-expanded": open
|
|
5290
5031
|
},
|
|
5291
|
-
|
|
5292
|
-
|
|
5293
|
-
|
|
5294
|
-
|
|
5295
|
-
|
|
5296
|
-
|
|
5297
|
-
|
|
5298
|
-
|
|
5299
|
-
|
|
5300
|
-
|
|
5301
|
-
|
|
5302
|
-
|
|
5303
|
-
|
|
5304
|
-
|
|
5032
|
+
/* @__PURE__ */ import_react35.default.createElement(import_CalendarToday4.default, null)
|
|
5033
|
+
),
|
|
5034
|
+
label,
|
|
5035
|
+
helperText
|
|
5036
|
+
}
|
|
5037
|
+
), open && /* @__PURE__ */ import_react35.default.createElement(import_base5.ClickAwayListener, { onClickAway: () => setAnchorEl(null) }, /* @__PURE__ */ import_react35.default.createElement(
|
|
5038
|
+
StyledPopper4,
|
|
5039
|
+
{
|
|
5040
|
+
id: "month-range-picker-popper",
|
|
5041
|
+
open: true,
|
|
5042
|
+
anchorEl,
|
|
5043
|
+
placement: "bottom-end",
|
|
5044
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
5045
|
+
modifiers: [
|
|
5046
|
+
{
|
|
5047
|
+
name: "offset",
|
|
5048
|
+
options: {
|
|
5049
|
+
offset: [4, 4]
|
|
5050
|
+
}
|
|
5051
|
+
}
|
|
5052
|
+
],
|
|
5053
|
+
"aria-label": "Calendar Tooltip",
|
|
5054
|
+
"aria-expanded": open
|
|
5055
|
+
},
|
|
5056
|
+
/* @__PURE__ */ import_react35.default.createElement(CalendarSheet4, { tabIndex: -1, role: "presentation" }, /* @__PURE__ */ import_react35.default.createElement(
|
|
5057
|
+
Calendar_default,
|
|
5058
|
+
{
|
|
5059
|
+
view: "month",
|
|
5060
|
+
views: ["month"],
|
|
5061
|
+
rangeSelection: true,
|
|
5062
|
+
defaultValue: calendarValue,
|
|
5063
|
+
onChange: handleCalendarChange,
|
|
5064
|
+
minDate: minDate ? new Date(minDate) : void 0,
|
|
5065
|
+
maxDate: maxDate ? new Date(maxDate) : void 0,
|
|
5066
|
+
disableFuture,
|
|
5067
|
+
disablePast
|
|
5305
5068
|
}
|
|
5306
|
-
),
|
|
5307
|
-
|
|
5069
|
+
), /* @__PURE__ */ import_react35.default.createElement(
|
|
5070
|
+
DialogActions_default,
|
|
5308
5071
|
{
|
|
5309
|
-
|
|
5310
|
-
|
|
5311
|
-
anchorEl,
|
|
5312
|
-
placement: "bottom-end",
|
|
5313
|
-
onMouseDown: (e) => e.preventDefault(),
|
|
5314
|
-
modifiers: [
|
|
5315
|
-
{
|
|
5316
|
-
name: "offset",
|
|
5317
|
-
options: {
|
|
5318
|
-
offset: [4, 4]
|
|
5319
|
-
}
|
|
5320
|
-
}
|
|
5321
|
-
],
|
|
5322
|
-
"aria-label": "Calendar Tooltip",
|
|
5323
|
-
"aria-expanded": open
|
|
5324
|
-
},
|
|
5325
|
-
/* @__PURE__ */ import_react35.default.createElement(CalendarSheet4, { tabIndex: -1, role: "presentation" }, /* @__PURE__ */ import_react35.default.createElement(
|
|
5326
|
-
Calendar_default,
|
|
5327
|
-
{
|
|
5328
|
-
view: "month",
|
|
5329
|
-
views: ["month"],
|
|
5330
|
-
rangeSelection: true,
|
|
5331
|
-
defaultValue: calendarValue,
|
|
5332
|
-
onChange: handleCalendarChange,
|
|
5333
|
-
minDate: minDate ? new Date(minDate) : void 0,
|
|
5334
|
-
maxDate: maxDate ? new Date(maxDate) : void 0,
|
|
5335
|
-
disableFuture,
|
|
5336
|
-
disablePast
|
|
5072
|
+
sx: {
|
|
5073
|
+
p: 1
|
|
5337
5074
|
}
|
|
5338
|
-
|
|
5339
|
-
|
|
5075
|
+
},
|
|
5076
|
+
/* @__PURE__ */ import_react35.default.createElement(
|
|
5077
|
+
Button_default,
|
|
5340
5078
|
{
|
|
5341
|
-
|
|
5342
|
-
|
|
5079
|
+
size,
|
|
5080
|
+
variant: "plain",
|
|
5081
|
+
color: "neutral",
|
|
5082
|
+
onClick: () => {
|
|
5083
|
+
setValue("");
|
|
5084
|
+
setAnchorEl(null);
|
|
5343
5085
|
}
|
|
5344
5086
|
},
|
|
5345
|
-
|
|
5346
|
-
|
|
5347
|
-
|
|
5348
|
-
|
|
5349
|
-
|
|
5350
|
-
color: "neutral",
|
|
5351
|
-
onClick: () => {
|
|
5352
|
-
setValue("");
|
|
5353
|
-
setAnchorEl(null);
|
|
5354
|
-
}
|
|
5355
|
-
},
|
|
5356
|
-
"Clear"
|
|
5357
|
-
)
|
|
5358
|
-
))
|
|
5359
|
-
)))));
|
|
5360
|
-
}
|
|
5361
|
-
);
|
|
5087
|
+
"Clear"
|
|
5088
|
+
)
|
|
5089
|
+
))
|
|
5090
|
+
)))));
|
|
5091
|
+
});
|
|
5362
5092
|
MonthRangePicker.displayName = "MonthRangePicker";
|
|
5363
5093
|
|
|
5364
5094
|
// src/components/NavigationGroup/NavigationGroup.tsx
|
|
@@ -5480,115 +5210,112 @@ var padDecimal = (value, decimalScale) => {
|
|
|
5480
5210
|
const [integer, decimal = ""] = `${value}`.split(".");
|
|
5481
5211
|
return Number(`${integer}${decimal.padEnd(decimalScale, "0")}`);
|
|
5482
5212
|
};
|
|
5483
|
-
var TextMaskAdapter9 = import_react39.default.forwardRef(
|
|
5484
|
-
|
|
5485
|
-
|
|
5486
|
-
|
|
5487
|
-
|
|
5488
|
-
|
|
5489
|
-
|
|
5490
|
-
|
|
5491
|
-
|
|
5492
|
-
|
|
5493
|
-
|
|
5494
|
-
|
|
5495
|
-
|
|
5496
|
-
|
|
5497
|
-
|
|
5498
|
-
|
|
5499
|
-
|
|
5500
|
-
|
|
5501
|
-
|
|
5502
|
-
|
|
5503
|
-
|
|
5504
|
-
|
|
5505
|
-
}
|
|
5506
|
-
);
|
|
5213
|
+
var TextMaskAdapter9 = import_react39.default.forwardRef(function TextMaskAdapter10(props, ref) {
|
|
5214
|
+
const { onChange, min, max, ...innerProps } = props;
|
|
5215
|
+
return /* @__PURE__ */ import_react39.default.createElement(
|
|
5216
|
+
import_react_number_format2.NumericFormat,
|
|
5217
|
+
{
|
|
5218
|
+
...innerProps,
|
|
5219
|
+
onValueChange: ({ value }) => {
|
|
5220
|
+
onChange?.({
|
|
5221
|
+
target: {
|
|
5222
|
+
name: props.name,
|
|
5223
|
+
value
|
|
5224
|
+
}
|
|
5225
|
+
});
|
|
5226
|
+
},
|
|
5227
|
+
valueIsNumericString: true,
|
|
5228
|
+
thousandSeparator: true,
|
|
5229
|
+
suffix: "%",
|
|
5230
|
+
getInputRef: ref,
|
|
5231
|
+
allowNegative: true
|
|
5232
|
+
}
|
|
5233
|
+
);
|
|
5234
|
+
});
|
|
5507
5235
|
var PercentageInputRoot = (0, import_joy51.styled)(Input_default, {
|
|
5508
5236
|
name: "PercentageInput",
|
|
5509
5237
|
slot: "Root",
|
|
5510
5238
|
overridesResolver: (props, styles) => styles.root
|
|
5511
5239
|
})({});
|
|
5512
|
-
var PercentageInput = import_react39.default.forwardRef(
|
|
5513
|
-
|
|
5514
|
-
|
|
5515
|
-
|
|
5516
|
-
|
|
5517
|
-
|
|
5518
|
-
error,
|
|
5519
|
-
helperText,
|
|
5520
|
-
required,
|
|
5521
|
-
disabled,
|
|
5522
|
-
useMinorUnit,
|
|
5523
|
-
maxDecimalScale = 0,
|
|
5524
|
-
min,
|
|
5525
|
-
max,
|
|
5526
|
-
// NOTE: 스타일 관련된 props는 최상위 엘리먼트에 적용한다.
|
|
5527
|
-
sx,
|
|
5528
|
-
className,
|
|
5529
|
-
...innerProps
|
|
5530
|
-
} = props;
|
|
5531
|
-
const [_value, setValue] = useControlledState(
|
|
5532
|
-
props.value,
|
|
5533
|
-
props.defaultValue,
|
|
5534
|
-
(0, import_react39.useCallback)(
|
|
5535
|
-
(value2) => onChange?.({ target: { name, value: value2 } }),
|
|
5536
|
-
[onChange, name]
|
|
5537
|
-
)
|
|
5538
|
-
);
|
|
5539
|
-
const [internalError, setInternalError] = (0, import_react39.useState)(
|
|
5540
|
-
max && _value && _value > max || min && _value && _value < min
|
|
5541
|
-
);
|
|
5542
|
-
const value = (0, import_react39.useMemo)(() => {
|
|
5543
|
-
if (_value && useMinorUnit) {
|
|
5544
|
-
return _value / Math.pow(10, maxDecimalScale);
|
|
5545
|
-
}
|
|
5546
|
-
return _value;
|
|
5547
|
-
}, [_value, useMinorUnit, maxDecimalScale]);
|
|
5548
|
-
const handleChange = (0, import_react39.useCallback)(
|
|
5549
|
-
(event) => {
|
|
5550
|
-
if (event.target.value === "") {
|
|
5551
|
-
setValue(void 0);
|
|
5552
|
-
return;
|
|
5553
|
-
}
|
|
5554
|
-
const originalAmount = Number(event.target.value);
|
|
5555
|
-
if (min && originalAmount < min || max && originalAmount > max) {
|
|
5556
|
-
setInternalError(true);
|
|
5557
|
-
} else {
|
|
5558
|
-
setInternalError(false);
|
|
5559
|
-
}
|
|
5560
|
-
const amount = useMinorUnit ? padDecimal(originalAmount, maxDecimalScale) : originalAmount;
|
|
5561
|
-
setValue(amount);
|
|
5562
|
-
},
|
|
5563
|
-
[setValue, useMinorUnit, maxDecimalScale, min, max]
|
|
5564
|
-
);
|
|
5565
|
-
return /* @__PURE__ */ import_react39.default.createElement(
|
|
5566
|
-
PercentageInputRoot,
|
|
5567
|
-
{
|
|
5568
|
-
...innerProps,
|
|
5569
|
-
ref,
|
|
5570
|
-
value,
|
|
5571
|
-
onChange: handleChange,
|
|
5572
|
-
error: internalError || error,
|
|
5573
|
-
disabled,
|
|
5574
|
-
required,
|
|
5575
|
-
color: internalError || error ? "danger" : props.color,
|
|
5240
|
+
var PercentageInput = import_react39.default.forwardRef(
|
|
5241
|
+
function PercentageInput2(inProps, ref) {
|
|
5242
|
+
const props = (0, import_joy51.useThemeProps)({ props: inProps, name: "PercentageInput" });
|
|
5243
|
+
const {
|
|
5244
|
+
name,
|
|
5245
|
+
onChange,
|
|
5576
5246
|
label,
|
|
5247
|
+
error,
|
|
5577
5248
|
helperText,
|
|
5578
|
-
|
|
5579
|
-
|
|
5580
|
-
|
|
5581
|
-
|
|
5582
|
-
|
|
5249
|
+
required,
|
|
5250
|
+
disabled,
|
|
5251
|
+
useMinorUnit,
|
|
5252
|
+
maxDecimalScale = 0,
|
|
5253
|
+
min,
|
|
5254
|
+
max,
|
|
5255
|
+
// NOTE: 스타일 관련된 props는 최상위 엘리먼트에 적용한다.
|
|
5256
|
+
sx,
|
|
5257
|
+
className,
|
|
5258
|
+
...innerProps
|
|
5259
|
+
} = props;
|
|
5260
|
+
const [_value, setValue] = useControlledState(
|
|
5261
|
+
props.value,
|
|
5262
|
+
props.defaultValue,
|
|
5263
|
+
(0, import_react39.useCallback)((value2) => onChange?.({ target: { name, value: value2 } }), [onChange, name])
|
|
5264
|
+
);
|
|
5265
|
+
const [internalError, setInternalError] = (0, import_react39.useState)(
|
|
5266
|
+
max && _value && _value > max || min && _value && _value < min
|
|
5267
|
+
);
|
|
5268
|
+
const value = (0, import_react39.useMemo)(() => {
|
|
5269
|
+
if (_value && useMinorUnit) {
|
|
5270
|
+
return _value / Math.pow(10, maxDecimalScale);
|
|
5271
|
+
}
|
|
5272
|
+
return _value;
|
|
5273
|
+
}, [_value, useMinorUnit, maxDecimalScale]);
|
|
5274
|
+
const handleChange = (0, import_react39.useCallback)(
|
|
5275
|
+
(event) => {
|
|
5276
|
+
if (event.target.value === "") {
|
|
5277
|
+
setValue(void 0);
|
|
5278
|
+
return;
|
|
5583
5279
|
}
|
|
5280
|
+
const originalAmount = Number(event.target.value);
|
|
5281
|
+
if (min && originalAmount < min || max && originalAmount > max) {
|
|
5282
|
+
setInternalError(true);
|
|
5283
|
+
} else {
|
|
5284
|
+
setInternalError(false);
|
|
5285
|
+
}
|
|
5286
|
+
const amount = useMinorUnit ? padDecimal(originalAmount, maxDecimalScale) : originalAmount;
|
|
5287
|
+
setValue(amount);
|
|
5584
5288
|
},
|
|
5585
|
-
|
|
5586
|
-
|
|
5587
|
-
|
|
5588
|
-
|
|
5589
|
-
|
|
5590
|
-
|
|
5591
|
-
|
|
5289
|
+
[setValue, useMinorUnit, maxDecimalScale, min, max]
|
|
5290
|
+
);
|
|
5291
|
+
return /* @__PURE__ */ import_react39.default.createElement(
|
|
5292
|
+
PercentageInputRoot,
|
|
5293
|
+
{
|
|
5294
|
+
...innerProps,
|
|
5295
|
+
ref,
|
|
5296
|
+
value,
|
|
5297
|
+
onChange: handleChange,
|
|
5298
|
+
error: internalError || error,
|
|
5299
|
+
disabled,
|
|
5300
|
+
required,
|
|
5301
|
+
color: internalError || error ? "danger" : props.color,
|
|
5302
|
+
label,
|
|
5303
|
+
helperText,
|
|
5304
|
+
slotProps: {
|
|
5305
|
+
input: {
|
|
5306
|
+
component: TextMaskAdapter9,
|
|
5307
|
+
"aria-label": innerProps["aria-label"],
|
|
5308
|
+
decimalScale: maxDecimalScale
|
|
5309
|
+
}
|
|
5310
|
+
},
|
|
5311
|
+
sx: {
|
|
5312
|
+
...sx
|
|
5313
|
+
},
|
|
5314
|
+
className
|
|
5315
|
+
}
|
|
5316
|
+
);
|
|
5317
|
+
}
|
|
5318
|
+
);
|
|
5592
5319
|
PercentageInput.displayName = "PercentageInput";
|
|
5593
5320
|
|
|
5594
5321
|
// src/components/Radio/Radio.tsx
|
|
@@ -6068,52 +5795,11 @@ var ClearIcon2 = (0, import_joy57.styled)(import_ClearRounded.default, {
|
|
|
6068
5795
|
width: "18px",
|
|
6069
5796
|
height: "18px"
|
|
6070
5797
|
}));
|
|
6071
|
-
var UNITS = [
|
|
6072
|
-
"byte",
|
|
6073
|
-
"kilobyte",
|
|
6074
|
-
"megabyte",
|
|
6075
|
-
"gigabyte",
|
|
6076
|
-
"terabyte",
|
|
6077
|
-
"petabyte"
|
|
6078
|
-
];
|
|
5798
|
+
var UNITS = ["byte", "kilobyte", "megabyte", "gigabyte", "terabyte", "petabyte"];
|
|
6079
5799
|
var ALL_EXTENSIONS_BY_TYPE = {
|
|
6080
|
-
"image/*": [
|
|
6081
|
-
|
|
6082
|
-
|
|
6083
|
-
".png",
|
|
6084
|
-
".gif",
|
|
6085
|
-
".bmp",
|
|
6086
|
-
".tiff",
|
|
6087
|
-
".svg",
|
|
6088
|
-
".webp",
|
|
6089
|
-
".heic",
|
|
6090
|
-
".ico"
|
|
6091
|
-
],
|
|
6092
|
-
"audio/*": [
|
|
6093
|
-
".mp3",
|
|
6094
|
-
".wav",
|
|
6095
|
-
".flac",
|
|
6096
|
-
".aac",
|
|
6097
|
-
".ogg",
|
|
6098
|
-
".m4a",
|
|
6099
|
-
".wma",
|
|
6100
|
-
".aiff",
|
|
6101
|
-
".alac",
|
|
6102
|
-
".midi",
|
|
6103
|
-
".mp4"
|
|
6104
|
-
],
|
|
6105
|
-
"video/*": [
|
|
6106
|
-
".mp4",
|
|
6107
|
-
".avi",
|
|
6108
|
-
".mkv",
|
|
6109
|
-
".mov",
|
|
6110
|
-
".wmv",
|
|
6111
|
-
".flv",
|
|
6112
|
-
".webm",
|
|
6113
|
-
".mpeg",
|
|
6114
|
-
".3gp",
|
|
6115
|
-
".m4v"
|
|
6116
|
-
]
|
|
5800
|
+
"image/*": [".jpeg", ".jpg", ".png", ".gif", ".bmp", ".tiff", ".svg", ".webp", ".heic", ".ico"],
|
|
5801
|
+
"audio/*": [".mp3", ".wav", ".flac", ".aac", ".ogg", ".m4a", ".wma", ".aiff", ".alac", ".midi", ".mp4"],
|
|
5802
|
+
"video/*": [".mp4", ".avi", ".mkv", ".mov", ".wmv", ".flv", ".webm", ".mpeg", ".3gp", ".m4v"]
|
|
6117
5803
|
};
|
|
6118
5804
|
var getFileSize = (n) => {
|
|
6119
5805
|
const i = n == 0 ? 0 : Math.floor(Math.log(n) / Math.log(1024));
|
|
@@ -6127,16 +5813,7 @@ var getFileSize = (n) => {
|
|
|
6127
5813
|
};
|
|
6128
5814
|
var Preview = (props) => {
|
|
6129
5815
|
const { files, uploaded, onDelete } = props;
|
|
6130
|
-
return /* @__PURE__ */ import_react45.default.createElement(PreviewRoot, { gap: 1 }, [...uploaded, ...files].map((file) => /* @__PURE__ */ import_react45.default.createElement(UploadCard, { key: file.name, size: "sm", color: "neutral" }, /* @__PURE__ */ import_react45.default.createElement(Stack_default, { direction: "row", alignItems: "center", gap: 2 }, /* @__PURE__ */ import_react45.default.createElement(UploadFileIcon, null), /* @__PURE__ */ import_react45.default.createElement(Stack_default, { flex: "1" }, /* @__PURE__ */ import_react45.default.createElement(Typography_default, { level: "body-sm", textColor: "common.black" }, file.name), !!file.size && /* @__PURE__ */ import_react45.default.createElement(
|
|
6131
|
-
Typography_default,
|
|
6132
|
-
{
|
|
6133
|
-
level: "body-xs",
|
|
6134
|
-
fontWeight: "300",
|
|
6135
|
-
lineHeight: "1.33",
|
|
6136
|
-
textColor: "text.tertiary"
|
|
6137
|
-
},
|
|
6138
|
-
getFileSize(file.size)
|
|
6139
|
-
)), /* @__PURE__ */ import_react45.default.createElement(IconButton_default, { onClick: () => onDelete?.(file) }, /* @__PURE__ */ import_react45.default.createElement(ClearIcon2, null))))));
|
|
5816
|
+
return /* @__PURE__ */ import_react45.default.createElement(PreviewRoot, { gap: 1 }, [...uploaded, ...files].map((file) => /* @__PURE__ */ import_react45.default.createElement(UploadCard, { key: file.name, size: "sm", color: "neutral" }, /* @__PURE__ */ import_react45.default.createElement(Stack_default, { direction: "row", alignItems: "center", gap: 2 }, /* @__PURE__ */ import_react45.default.createElement(UploadFileIcon, null), /* @__PURE__ */ import_react45.default.createElement(Stack_default, { flex: "1" }, /* @__PURE__ */ import_react45.default.createElement(Typography_default, { level: "body-sm", textColor: "common.black" }, file.name), !!file.size && /* @__PURE__ */ import_react45.default.createElement(Typography_default, { level: "body-xs", fontWeight: "300", lineHeight: "1.33", textColor: "text.tertiary" }, getFileSize(file.size))), /* @__PURE__ */ import_react45.default.createElement(IconButton_default, { onClick: () => onDelete?.(file) }, /* @__PURE__ */ import_react45.default.createElement(ClearIcon2, null))))));
|
|
6140
5817
|
};
|
|
6141
5818
|
var UploaderRoot = (0, import_joy57.styled)(Stack_default, {
|
|
6142
5819
|
name: "Uploader",
|
|
@@ -6148,31 +5825,27 @@ var FileDropZone = (0, import_joy57.styled)(Sheet_default, {
|
|
|
6148
5825
|
name: "Uploader",
|
|
6149
5826
|
slot: "dropZone",
|
|
6150
5827
|
shouldForwardProp: (prop) => prop !== "error"
|
|
6151
|
-
})(
|
|
6152
|
-
|
|
6153
|
-
|
|
6154
|
-
|
|
6155
|
-
|
|
6156
|
-
|
|
6157
|
-
|
|
6158
|
-
|
|
6159
|
-
|
|
6160
|
-
|
|
6161
|
-
|
|
6162
|
-
|
|
6163
|
-
})
|
|
6164
|
-
);
|
|
5828
|
+
})(({ theme, state, error }) => ({
|
|
5829
|
+
width: "100%",
|
|
5830
|
+
display: "flex",
|
|
5831
|
+
flexDirection: "column",
|
|
5832
|
+
justifyContent: "center",
|
|
5833
|
+
alignItems: "center",
|
|
5834
|
+
padding: theme.spacing(5),
|
|
5835
|
+
gap: theme.spacing(4),
|
|
5836
|
+
cursor: "pointer",
|
|
5837
|
+
backgroundColor: theme.palette.background.surface,
|
|
5838
|
+
border: error ? `1px solid ${theme.palette.danger.outlinedBorder}` : state === "idle" ? `1px solid ${theme.palette.neutral.outlinedBorder}` : `1px solid ${theme.palette.primary.outlinedBorder}`
|
|
5839
|
+
}));
|
|
6165
5840
|
var UploaderIcon = (0, import_joy57.styled)(import_CloudUploadRounded.default, {
|
|
6166
5841
|
name: "Uploader",
|
|
6167
5842
|
slot: "iconContainer",
|
|
6168
5843
|
shouldForwardProp: (prop) => prop !== "error"
|
|
6169
|
-
})(
|
|
6170
|
-
({
|
|
6171
|
-
|
|
6172
|
-
|
|
6173
|
-
|
|
6174
|
-
})
|
|
6175
|
-
);
|
|
5844
|
+
})(({ theme, state, error }) => ({
|
|
5845
|
+
color: error ? `rgba(${theme.vars.palette.danger.mainChannel} / 0.6)` : state === "over" ? `rgba(${theme.palette.primary.mainChannel} / 0.6)` : theme.palette.neutral.softActiveBg,
|
|
5846
|
+
width: "32px",
|
|
5847
|
+
height: "32px"
|
|
5848
|
+
}));
|
|
6176
5849
|
var Uploader = import_react45.default.memo(
|
|
6177
5850
|
(props) => {
|
|
6178
5851
|
const {
|
|
@@ -6192,14 +5865,9 @@ var Uploader = import_react45.default.memo(
|
|
|
6192
5865
|
const inputRef = (0, import_react45.useRef)(null);
|
|
6193
5866
|
const [errorText, setErrorText] = (0, import_react45.useState)();
|
|
6194
5867
|
const [files, setFiles] = (0, import_react45.useState)([]);
|
|
6195
|
-
const [uploaded, setUploaded] = (0, import_react45.useState)(
|
|
6196
|
-
props.uploaded || []
|
|
6197
|
-
);
|
|
5868
|
+
const [uploaded, setUploaded] = (0, import_react45.useState)(props.uploaded || []);
|
|
6198
5869
|
const [previewState, setPreviewState] = (0, import_react45.useState)("idle");
|
|
6199
|
-
const accepts = (0, import_react45.useMemo)(
|
|
6200
|
-
() => accept.split(",").map((accept2) => accept2.trim()),
|
|
6201
|
-
[accept]
|
|
6202
|
-
);
|
|
5870
|
+
const accepts = (0, import_react45.useMemo)(() => accept.split(",").map((accept2) => accept2.trim()), [accept]);
|
|
6203
5871
|
const parsedAccepts = (0, import_react45.useMemo)(
|
|
6204
5872
|
() => accepts.flatMap((type) => {
|
|
6205
5873
|
if (["image/*", "video/*", "audio/*"].includes(type)) {
|
|
@@ -6211,15 +5879,11 @@ var Uploader = import_react45.default.memo(
|
|
|
6211
5879
|
);
|
|
6212
5880
|
const helperText = (0, import_react45.useMemo)(() => {
|
|
6213
5881
|
const [allAcceptedTypes, acceptedTypes] = [
|
|
6214
|
-
accepts.filter(
|
|
6215
|
-
(accept2) => ["image/*", "video/*", "audio/*"].includes(accept2)
|
|
6216
|
-
).map((accept2) => {
|
|
5882
|
+
accepts.filter((accept2) => ["image/*", "video/*", "audio/*"].includes(accept2)).map((accept2) => {
|
|
6217
5883
|
const [type] = accept2.split("/");
|
|
6218
5884
|
return type.toLowerCase();
|
|
6219
5885
|
}),
|
|
6220
|
-
accepts.filter(
|
|
6221
|
-
(accept2) => !["image/*", "video/*", "audio/*"].includes(accept2)
|
|
6222
|
-
).map((accept2) => {
|
|
5886
|
+
accepts.filter((accept2) => !["image/*", "video/*", "audio/*"].includes(accept2)).map((accept2) => {
|
|
6223
5887
|
const [extensionOrType, subType] = accept2.split("/");
|
|
6224
5888
|
if (!subType) {
|
|
6225
5889
|
return extensionOrType.toUpperCase().replace(".", "");
|
|
@@ -6236,16 +5900,11 @@ var Uploader = import_react45.default.memo(
|
|
|
6236
5900
|
}
|
|
6237
5901
|
helperTexts.push(`Maximum ${getFileSize(maxFileTotalSize)}`);
|
|
6238
5902
|
if (maxCount) {
|
|
6239
|
-
helperTexts.push(
|
|
6240
|
-
`Up to ${maxCount} ${maxCount === 1 ? "file" : "files"}`
|
|
6241
|
-
);
|
|
5903
|
+
helperTexts.push(`Up to ${maxCount} ${maxCount === 1 ? "file" : "files"}`);
|
|
6242
5904
|
}
|
|
6243
5905
|
return helperTexts.join(", ");
|
|
6244
5906
|
}, [accepts, maxFileTotalSize, maxCount]);
|
|
6245
|
-
const error = (0, import_react45.useMemo)(
|
|
6246
|
-
() => !!errorText || props.error,
|
|
6247
|
-
[props.error, errorText]
|
|
6248
|
-
);
|
|
5907
|
+
const error = (0, import_react45.useMemo)(() => !!errorText || props.error, [props.error, errorText]);
|
|
6249
5908
|
const showDropZone = (0, import_react45.useMemo)(
|
|
6250
5909
|
() => !maxCount || maxCount && [...uploaded, ...files].length !== maxCount,
|
|
6251
5910
|
[files, maxCount, uploaded]
|
|
@@ -6272,10 +5931,7 @@ var Uploader = import_react45.default.memo(
|
|
|
6272
5931
|
}
|
|
6273
5932
|
});
|
|
6274
5933
|
}
|
|
6275
|
-
const totalFileSize = [...files, ...uploads].reduce(
|
|
6276
|
-
(acc, file) => acc + file.size,
|
|
6277
|
-
0
|
|
6278
|
-
);
|
|
5934
|
+
const totalFileSize = [...files, ...uploads].reduce((acc, file) => acc + file.size, 0);
|
|
6279
5935
|
if (totalFileSize > maxFileTotalSize) {
|
|
6280
5936
|
throw new Error(`Total File size exceeded the maximum limit.`);
|
|
6281
5937
|
}
|
|
@@ -6296,34 +5952,15 @@ var Uploader = import_react45.default.memo(
|
|
|
6296
5952
|
setErrorText(err.message);
|
|
6297
5953
|
}
|
|
6298
5954
|
},
|
|
6299
|
-
[
|
|
6300
|
-
files,
|
|
6301
|
-
uploaded,
|
|
6302
|
-
maxCount,
|
|
6303
|
-
parsedAccepts,
|
|
6304
|
-
maxFileSize,
|
|
6305
|
-
maxFileTotalSize,
|
|
6306
|
-
name,
|
|
6307
|
-
onChange
|
|
6308
|
-
]
|
|
5955
|
+
[files, uploaded, maxCount, parsedAccepts, maxFileSize, maxFileTotalSize, name, onChange]
|
|
6309
5956
|
);
|
|
6310
5957
|
(0, import_react45.useEffect)(() => {
|
|
6311
5958
|
if (!dropZoneRef.current || disabled) {
|
|
6312
5959
|
return;
|
|
6313
5960
|
}
|
|
6314
5961
|
let cleanup;
|
|
6315
|
-
Promise.all([
|
|
6316
|
-
|
|
6317
|
-
esmFiles.adapter,
|
|
6318
|
-
esmFiles.file,
|
|
6319
|
-
esmFiles.preventUnhandled
|
|
6320
|
-
]).then(
|
|
6321
|
-
([
|
|
6322
|
-
combineModule,
|
|
6323
|
-
adapterModule,
|
|
6324
|
-
fileModule,
|
|
6325
|
-
preventUnhandledModule
|
|
6326
|
-
]) => {
|
|
5962
|
+
Promise.all([esmFiles.combine, esmFiles.adapter, esmFiles.file, esmFiles.preventUnhandled]).then(
|
|
5963
|
+
([combineModule, adapterModule, fileModule, preventUnhandledModule]) => {
|
|
6327
5964
|
const { combine } = combineModule;
|
|
6328
5965
|
const { dropTargetForExternal, monitorForExternal } = adapterModule;
|
|
6329
5966
|
const { containsFiles, getFiles } = fileModule;
|
|
@@ -6358,9 +5995,7 @@ var Uploader = import_react45.default.memo(
|
|
|
6358
5995
|
(0, import_react45.useEffect)(() => {
|
|
6359
5996
|
if (inputRef.current && minCount) {
|
|
6360
5997
|
if (files.length < minCount) {
|
|
6361
|
-
inputRef.current.setCustomValidity(
|
|
6362
|
-
`At least ${minCount} files are required.`
|
|
6363
|
-
);
|
|
5998
|
+
inputRef.current.setCustomValidity(`At least ${minCount} files are required.`);
|
|
6364
5999
|
} else {
|
|
6365
6000
|
inputRef.current.setCustomValidity("");
|
|
6366
6001
|
}
|
|
@@ -6386,9 +6021,7 @@ var Uploader = import_react45.default.memo(
|
|
|
6386
6021
|
return current.filter((file) => file !== deletedFile);
|
|
6387
6022
|
});
|
|
6388
6023
|
} else {
|
|
6389
|
-
setUploaded(
|
|
6390
|
-
(uploaded2) => uploaded2.filter((file) => file.id !== deletedFile.id)
|
|
6391
|
-
);
|
|
6024
|
+
setUploaded((uploaded2) => uploaded2.filter((file) => file.id !== deletedFile.id));
|
|
6392
6025
|
onDelete?.(deletedFile);
|
|
6393
6026
|
}
|
|
6394
6027
|
setErrorText(void 0);
|
|
@@ -6414,9 +6047,7 @@ var Uploader = import_react45.default.memo(
|
|
|
6414
6047
|
required: !!minCount,
|
|
6415
6048
|
onInvalid: (e) => {
|
|
6416
6049
|
if (minCount && files.length < minCount) {
|
|
6417
|
-
setErrorText(
|
|
6418
|
-
`Please choose ${minCount} ${minCount === 1 ? "file" : "files"} to upload.`
|
|
6419
|
-
);
|
|
6050
|
+
setErrorText(`Please choose ${minCount} ${minCount === 1 ? "file" : "files"} to upload.`);
|
|
6420
6051
|
}
|
|
6421
6052
|
},
|
|
6422
6053
|
slotProps: {
|
|
@@ -6432,25 +6063,7 @@ var Uploader = import_react45.default.memo(
|
|
|
6432
6063
|
}
|
|
6433
6064
|
)
|
|
6434
6065
|
);
|
|
6435
|
-
return /* @__PURE__ */ import_react45.default.createElement(UploaderRoot, null, showDropZone && /* @__PURE__ */ import_react45.default.createElement(
|
|
6436
|
-
FormControl_default,
|
|
6437
|
-
{
|
|
6438
|
-
size,
|
|
6439
|
-
error: !!(error || errorText),
|
|
6440
|
-
disabled,
|
|
6441
|
-
required: !!minCount
|
|
6442
|
-
},
|
|
6443
|
-
label && /* @__PURE__ */ import_react45.default.createElement(FormLabel_default, null, label),
|
|
6444
|
-
uploader,
|
|
6445
|
-
/* @__PURE__ */ import_react45.default.createElement(FormHelperText_default, null, /* @__PURE__ */ import_react45.default.createElement(Stack_default, null, errorText && /* @__PURE__ */ import_react45.default.createElement("div", null, errorText), /* @__PURE__ */ import_react45.default.createElement("div", null, helperText)))
|
|
6446
|
-
), [...uploaded, ...files].length > 0 && /* @__PURE__ */ import_react45.default.createElement(
|
|
6447
|
-
Preview,
|
|
6448
|
-
{
|
|
6449
|
-
files,
|
|
6450
|
-
uploaded,
|
|
6451
|
-
onDelete: handleDeleteFile
|
|
6452
|
-
}
|
|
6453
|
-
));
|
|
6066
|
+
return /* @__PURE__ */ import_react45.default.createElement(UploaderRoot, null, showDropZone && /* @__PURE__ */ import_react45.default.createElement(FormControl_default, { size, error: !!(error || errorText), disabled, required: !!minCount }, label && /* @__PURE__ */ import_react45.default.createElement(FormLabel_default, null, label), uploader, /* @__PURE__ */ import_react45.default.createElement(FormHelperText_default, null, /* @__PURE__ */ import_react45.default.createElement(Stack_default, null, errorText && /* @__PURE__ */ import_react45.default.createElement("div", null, errorText), /* @__PURE__ */ import_react45.default.createElement("div", null, helperText)))), [...uploaded, ...files].length > 0 && /* @__PURE__ */ import_react45.default.createElement(Preview, { files, uploaded, onDelete: handleDeleteFile }));
|
|
6454
6067
|
}
|
|
6455
6068
|
);
|
|
6456
6069
|
Uploader.displayName = "Uploader";
|