@ceed/cds 1.40.3 → 1.40.4
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/Autocomplete/Autocomplete.d.ts +4 -4
- package/dist/components/Autocomplete/index.d.ts +2 -1
- package/dist/components/DataTable/hooks.d.ts +3 -5
- package/dist/components/DataTable/types.d.ts +1 -0
- package/dist/components/DataTable/utils.d.ts +11 -0
- package/dist/components/IconMenuButton/IconMenuButton.d.ts +9 -8
- package/dist/components/IconMenuButton/IconMenuButton.type-test.d.ts +5 -0
- package/dist/components/IconMenuButton/index.d.ts +2 -1
- package/dist/components/Modal/Modal.d.ts +1 -4
- package/dist/components/Select/Select.d.ts +7 -4
- package/dist/components/Select/index.d.ts +2 -1
- package/dist/components/Textarea/Textarea.d.ts +1 -4
- package/dist/components/Textarea/index.d.ts +2 -1
- package/dist/components/data-display/DataTable.md +25 -23
- package/dist/components/inputs/Calendar.md +17 -17
- package/dist/components/navigation/IconMenuButton.md +17 -12
- package/dist/index.browser.js +6 -6
- package/dist/index.browser.js.map +4 -4
- package/dist/index.cjs +715 -633
- package/dist/index.js +344 -262
- package/dist/libs/slot-props.d.ts +22 -0
- package/framer/index.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -187,7 +187,7 @@ function Alert(inProps) {
|
|
|
187
187
|
Alert.displayName = "Alert";
|
|
188
188
|
|
|
189
189
|
// src/components/Autocomplete/Autocomplete.tsx
|
|
190
|
-
import React5, { useCallback as
|
|
190
|
+
import React5, { useCallback as useCallback3, useEffect as useEffect2, useMemo as useMemo2, useRef as useRef3 } from "react";
|
|
191
191
|
import {
|
|
192
192
|
Autocomplete as JoyAutocomplete,
|
|
193
193
|
AutocompleteOption as JoyAutocompleteOption,
|
|
@@ -294,6 +294,46 @@ function useControlledState(controlledValue, defaultValue, onChange) {
|
|
|
294
294
|
return [displayValue, handleChange, isControlled];
|
|
295
295
|
}
|
|
296
296
|
|
|
297
|
+
// src/libs/slot-props.ts
|
|
298
|
+
import { useCallback as useCallback2, useMemo, useRef as useRef2 } from "react";
|
|
299
|
+
function assignRef(ref, value) {
|
|
300
|
+
if (typeof ref === "function") ref(value);
|
|
301
|
+
else if (ref) ref.current = value;
|
|
302
|
+
}
|
|
303
|
+
function mergeRefs(...refs) {
|
|
304
|
+
const live = refs.filter((r) => r != null);
|
|
305
|
+
if (live.length === 0) return void 0;
|
|
306
|
+
if (live.length === 1) return live[0];
|
|
307
|
+
return (value) => live.forEach((r) => assignRef(r, value));
|
|
308
|
+
}
|
|
309
|
+
function useMergedRef(a, b) {
|
|
310
|
+
return useMemo(() => mergeRefs(a, b), [a, b]);
|
|
311
|
+
}
|
|
312
|
+
function useSlotRef(slotProp, ref) {
|
|
313
|
+
const isFunctionForm = typeof slotProp === "function";
|
|
314
|
+
const slotRef = isFunctionForm ? void 0 : slotProp?.ref;
|
|
315
|
+
const mergedRef = useMergedRef(slotRef, ref);
|
|
316
|
+
const latestSlotRef = useRef2(null);
|
|
317
|
+
const stableMergedRef = useCallback2(
|
|
318
|
+
(value) => {
|
|
319
|
+
assignRef(latestSlotRef.current, value);
|
|
320
|
+
assignRef(ref, value);
|
|
321
|
+
},
|
|
322
|
+
[ref]
|
|
323
|
+
);
|
|
324
|
+
return useMemo(() => {
|
|
325
|
+
if (isFunctionForm) {
|
|
326
|
+
return ((ownerState) => {
|
|
327
|
+
const resolved = slotProp(ownerState) ?? {};
|
|
328
|
+
const resolvedRef = resolved.ref;
|
|
329
|
+
latestSlotRef.current = resolvedRef ?? null;
|
|
330
|
+
return resolvedRef || ref ? { ...resolved, ref: stableMergedRef } : { ...resolved };
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
return mergedRef ? { ...slotProp, ref: mergedRef } : { ...slotProp };
|
|
334
|
+
}, [isFunctionForm, slotProp, mergedRef, ref, stableMergedRef]);
|
|
335
|
+
}
|
|
336
|
+
|
|
297
337
|
// src/components/Autocomplete/Autocomplete.tsx
|
|
298
338
|
var AutocompletePopper = styled3(Popper, {
|
|
299
339
|
name: "Autocomplete",
|
|
@@ -316,13 +356,13 @@ var AutocompleteListBox = React5.forwardRef((props, ref) => {
|
|
|
316
356
|
ownerState: { loading, size: fontSize = "md" },
|
|
317
357
|
...innerProps
|
|
318
358
|
} = props;
|
|
319
|
-
const parentRef =
|
|
359
|
+
const parentRef = useRef3(null);
|
|
320
360
|
const isGrouped = children[0].every((child) => child.hasOwnProperty("group"));
|
|
321
|
-
const itemHeight =
|
|
361
|
+
const itemHeight = useMemo2(() => {
|
|
322
362
|
const heights = itemHeightMap[fontSize ?? "md"];
|
|
323
363
|
return hasSecondaryText ? heights.secondary : heights.default;
|
|
324
364
|
}, [fontSize, hasSecondaryText]);
|
|
325
|
-
const renderTargets =
|
|
365
|
+
const renderTargets = useMemo2(() => {
|
|
326
366
|
if (loading) {
|
|
327
367
|
return [children[1]];
|
|
328
368
|
}
|
|
@@ -414,7 +454,7 @@ var autocompleteFilterOptions = createFilterOptions({
|
|
|
414
454
|
}
|
|
415
455
|
});
|
|
416
456
|
var getOptionLabel = (option) => `${option.label ?? ""}`;
|
|
417
|
-
function
|
|
457
|
+
function AutocompleteInner(props, ref) {
|
|
418
458
|
const {
|
|
419
459
|
label,
|
|
420
460
|
error,
|
|
@@ -433,7 +473,7 @@ function Autocomplete(props) {
|
|
|
433
473
|
const [rawValue, setValue] = useControlledState(
|
|
434
474
|
props.value,
|
|
435
475
|
props.defaultValue ?? null,
|
|
436
|
-
|
|
476
|
+
useCallback3(
|
|
437
477
|
(value2) => onChange?.({
|
|
438
478
|
target: {
|
|
439
479
|
value: value2,
|
|
@@ -444,7 +484,7 @@ function Autocomplete(props) {
|
|
|
444
484
|
)
|
|
445
485
|
);
|
|
446
486
|
const _value = rawValue ?? (props.multiple ? EMPTY_MULTIPLE_VALUE : "");
|
|
447
|
-
const options =
|
|
487
|
+
const options = useMemo2(
|
|
448
488
|
() => props.options.map((option) => {
|
|
449
489
|
if (typeof option !== "object") {
|
|
450
490
|
return {
|
|
@@ -456,14 +496,14 @@ function Autocomplete(props) {
|
|
|
456
496
|
}),
|
|
457
497
|
[props.options]
|
|
458
498
|
);
|
|
459
|
-
const optionMap =
|
|
499
|
+
const optionMap = useMemo2(() => {
|
|
460
500
|
const map = /* @__PURE__ */ new Map();
|
|
461
501
|
options.forEach((option) => {
|
|
462
502
|
map.set(option.value, option);
|
|
463
503
|
});
|
|
464
504
|
return map;
|
|
465
505
|
}, [options]);
|
|
466
|
-
const value =
|
|
506
|
+
const value = useMemo2(() => {
|
|
467
507
|
if (props.loading) {
|
|
468
508
|
return {
|
|
469
509
|
value: "",
|
|
@@ -476,31 +516,33 @@ function Autocomplete(props) {
|
|
|
476
516
|
}
|
|
477
517
|
return optionMap.get(_value);
|
|
478
518
|
}, [_value, optionMap, props.loading]);
|
|
479
|
-
const applySize =
|
|
519
|
+
const applySize = useCallback3(
|
|
480
520
|
(node) => {
|
|
481
521
|
return React5.isValidElement(node) && !props.loading ? React5.cloneElement(node, { ...{ size } }) : node;
|
|
482
522
|
},
|
|
483
523
|
[size, props.loading]
|
|
484
524
|
);
|
|
485
|
-
const startDecorator =
|
|
525
|
+
const startDecorator = useMemo2(
|
|
486
526
|
() => applySize(value?.startDecorator || props.startDecorator),
|
|
487
527
|
[value, applySize, props.startDecorator]
|
|
488
528
|
);
|
|
489
|
-
const endDecorator =
|
|
529
|
+
const endDecorator = useMemo2(
|
|
490
530
|
() => applySize(value?.endDecorator || props.endDecorator),
|
|
491
531
|
[value, applySize, props.endDecorator]
|
|
492
532
|
);
|
|
493
|
-
const
|
|
533
|
+
const inputSlotProps = useSlotRef(props.slotProps?.input, ref);
|
|
534
|
+
const slotProps = useMemo2(
|
|
494
535
|
() => ({
|
|
495
536
|
...props.slotProps,
|
|
496
537
|
listbox: {
|
|
497
538
|
...props.slotProps?.listbox,
|
|
498
539
|
hasSecondaryText: options.some((opt) => opt.secondaryText)
|
|
499
|
-
}
|
|
540
|
+
},
|
|
541
|
+
input: inputSlotProps
|
|
500
542
|
}),
|
|
501
|
-
[options, props.slotProps]
|
|
543
|
+
[options, props.slotProps, inputSlotProps]
|
|
502
544
|
);
|
|
503
|
-
const handleChange =
|
|
545
|
+
const handleChange = useCallback3(
|
|
504
546
|
(event, value2) => {
|
|
505
547
|
const newValue = value2;
|
|
506
548
|
const _value2 = Array.isArray(newValue) ? newValue.map((value3) => value3.value) : newValue?.value;
|
|
@@ -532,9 +574,9 @@ function Autocomplete(props) {
|
|
|
532
574
|
endDecorator,
|
|
533
575
|
getOptionLabel,
|
|
534
576
|
renderTags: (tags, getTagProps) => tags.map((tag, index) => {
|
|
535
|
-
const { onClick, ...rest } = getTagProps({ index });
|
|
577
|
+
const { onClick, key, ...rest } = getTagProps({ index });
|
|
536
578
|
return applySize(
|
|
537
|
-
/* @__PURE__ */ React5.createElement(Chip_default, { color: "primary", ...rest }, /* @__PURE__ */ React5.createElement(Stack_default, { direction: "row", alignItems: "center", gap: 2, py: 0.5 }, tag.value, applySize(
|
|
579
|
+
/* @__PURE__ */ React5.createElement(Chip_default, { key, color: "primary", ...rest }, /* @__PURE__ */ React5.createElement(Stack_default, { direction: "row", alignItems: "center", gap: 2, py: 0.5 }, tag.value, applySize(
|
|
538
580
|
/* @__PURE__ */ React5.createElement(AutocompleteTagDelete, { color: "primary", variant: "soft", onClick }, /* @__PURE__ */ React5.createElement(CloseIcon, null))
|
|
539
581
|
)))
|
|
540
582
|
);
|
|
@@ -544,26 +586,29 @@ function Autocomplete(props) {
|
|
|
544
586
|
},
|
|
545
587
|
slotProps,
|
|
546
588
|
filterOptions: autocompleteFilterOptions,
|
|
547
|
-
renderOption: (props2, option) =>
|
|
548
|
-
|
|
549
|
-
{
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
applySize(option.label)
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
589
|
+
renderOption: (props2, option) => {
|
|
590
|
+
const { key, ...optionProps } = props2;
|
|
591
|
+
return /* @__PURE__ */ React5.createElement(JoyAutocompleteOption, { key, ...optionProps }, option.startDecorator && /* @__PURE__ */ React5.createElement(
|
|
592
|
+
ListItemDecorator,
|
|
593
|
+
{
|
|
594
|
+
sx: (theme) => ({
|
|
595
|
+
marginInlineEnd: `var(--Input-gap, ${theme.spacing(1)})`
|
|
596
|
+
})
|
|
597
|
+
},
|
|
598
|
+
applySize(option.startDecorator)
|
|
599
|
+
), option.secondaryText ? /* @__PURE__ */ React5.createElement(ListItemContent, { sx: { gap: 0.5 } }, /* @__PURE__ */ React5.createElement(Typography2, { level: "inherit" }, applySize(option.label)), /* @__PURE__ */ React5.createElement(Typography2, { level: secondaryTextLevelMap[size ?? "md"], textColor: "text.tertiary" }, option.secondaryText)) : (
|
|
600
|
+
// TODO: haulla에서 사용할 때, label을 ReactNode로 넘기면 에러가 발생함....
|
|
601
|
+
applySize(option.label)
|
|
602
|
+
), option.endDecorator && /* @__PURE__ */ React5.createElement(
|
|
603
|
+
ListItemDecorator,
|
|
604
|
+
{
|
|
605
|
+
sx: (theme) => ({
|
|
606
|
+
marginInlineStart: `var(--Input-gap, ${theme.spacing(1)})`
|
|
607
|
+
})
|
|
608
|
+
},
|
|
609
|
+
applySize(option.endDecorator)
|
|
610
|
+
));
|
|
611
|
+
},
|
|
567
612
|
renderGroup: (params) => params
|
|
568
613
|
}
|
|
569
614
|
);
|
|
@@ -583,13 +628,14 @@ function Autocomplete(props) {
|
|
|
583
628
|
helperText && /* @__PURE__ */ React5.createElement(FormHelperText_default, null, helperText)
|
|
584
629
|
);
|
|
585
630
|
}
|
|
631
|
+
var Autocomplete = React5.forwardRef(AutocompleteInner);
|
|
586
632
|
Autocomplete.displayName = "Autocomplete";
|
|
587
633
|
|
|
588
634
|
// src/components/Autocomplete/index.ts
|
|
589
635
|
var Autocomplete_default = Autocomplete;
|
|
590
636
|
|
|
591
637
|
// src/components/Avatar/Avatar.tsx
|
|
592
|
-
import React6, { forwardRef as forwardRef2, useMemo as
|
|
638
|
+
import React6, { forwardRef as forwardRef2, useMemo as useMemo3 } from "react";
|
|
593
639
|
import { Avatar as JoyAvatar, AvatarGroup, styled as styled4, useThemeProps as useThemeProps2 } from "@mui/joy";
|
|
594
640
|
var StyledAvatar = styled4(JoyAvatar, {
|
|
595
641
|
name: "Avatar",
|
|
@@ -617,7 +663,7 @@ var Avatar = forwardRef2(function Avatar2(inProps, ref) {
|
|
|
617
663
|
name: "Avatar"
|
|
618
664
|
});
|
|
619
665
|
const { children, getInitial = defaultGetInitial, ...inheritProps } = props;
|
|
620
|
-
const calcChildren =
|
|
666
|
+
const calcChildren = useMemo3(() => {
|
|
621
667
|
if (typeof children === "string") {
|
|
622
668
|
return getInitial?.(children) ?? "";
|
|
623
669
|
}
|
|
@@ -659,7 +705,7 @@ var MenuItem = JoyMenuItem;
|
|
|
659
705
|
var Menu_default = Menu;
|
|
660
706
|
|
|
661
707
|
// src/components/Dropdown/Dropdown.tsx
|
|
662
|
-
import React8, { createContext, useCallback as
|
|
708
|
+
import React8, { createContext, useCallback as useCallback4, useMemo as useMemo4, useState as useState2 } from "react";
|
|
663
709
|
import { Dropdown as JoyDropdown } from "@mui/joy";
|
|
664
710
|
import { MenuButton } from "@mui/joy";
|
|
665
711
|
import { useMenuButton } from "@mui/base/useMenuButton";
|
|
@@ -667,14 +713,14 @@ var DropdownNestedRegistryContext = createContext(null);
|
|
|
667
713
|
function Dropdown({ open: openProp, defaultOpen = false, onOpenChange, ...rest }) {
|
|
668
714
|
const [nestedCount, setNestedCount] = useState2(0);
|
|
669
715
|
const [open, setOpen] = useControlledState(openProp, defaultOpen);
|
|
670
|
-
const registry =
|
|
716
|
+
const registry = useMemo4(
|
|
671
717
|
() => ({
|
|
672
718
|
register: () => setNestedCount((c) => c + 1),
|
|
673
719
|
unregister: () => setNestedCount((c) => Math.max(0, c - 1))
|
|
674
720
|
}),
|
|
675
721
|
[]
|
|
676
722
|
);
|
|
677
|
-
const handleOpenChange =
|
|
723
|
+
const handleOpenChange = useCallback4(
|
|
678
724
|
(event, isOpen) => {
|
|
679
725
|
if (nestedCount > 0 && !isOpen && event?.type === "blur") {
|
|
680
726
|
return;
|
|
@@ -737,7 +783,7 @@ Button.displayName = "Button";
|
|
|
737
783
|
var Button_default = Button;
|
|
738
784
|
|
|
739
785
|
// src/components/Calendar/Calendar.tsx
|
|
740
|
-
import React13, { Fragment, forwardRef as forwardRef4, useCallback as
|
|
786
|
+
import React13, { Fragment, forwardRef as forwardRef4, useCallback as useCallback7, useEffect as useEffect3, useMemo as useMemo6, useRef as useRef4, useState as useState5 } from "react";
|
|
741
787
|
import { styled as styled5 } from "@mui/joy";
|
|
742
788
|
import ChevronLeftIcon from "@mui/icons-material/ChevronLeft";
|
|
743
789
|
import ChevronRightIcon from "@mui/icons-material/ChevronRight";
|
|
@@ -831,7 +877,7 @@ var isSameMonth = (date1, date2) => {
|
|
|
831
877
|
};
|
|
832
878
|
|
|
833
879
|
// src/components/Calendar/hooks/use-calendar-props.ts
|
|
834
|
-
import { useCallback as
|
|
880
|
+
import { useCallback as useCallback5, useMemo as useMemo5, useState as useState3 } from "react";
|
|
835
881
|
import { useThemeProps as useThemeProps3 } from "@mui/joy";
|
|
836
882
|
var resolveView = (view, views) => {
|
|
837
883
|
return views.includes(view) ? view : views[0];
|
|
@@ -851,23 +897,23 @@ var useCalendarProps = (inProps) => {
|
|
|
851
897
|
});
|
|
852
898
|
const [[page, direction], setPage] = useState3([0, 0]);
|
|
853
899
|
const resolvedView = inProps.view ?? uncontrolledView;
|
|
854
|
-
const resolvedMinDate =
|
|
900
|
+
const resolvedMinDate = useMemo5(() => {
|
|
855
901
|
const minDate = inProps.minDate || /* @__PURE__ */ new Date(0);
|
|
856
902
|
minDate.setHours(0, 0, 0, 0);
|
|
857
903
|
return minDate;
|
|
858
904
|
}, [inProps.minDate]);
|
|
859
|
-
const resolvedMaxDate =
|
|
905
|
+
const resolvedMaxDate = useMemo5(() => {
|
|
860
906
|
const maxDate = inProps.maxDate || /* @__PURE__ */ new Date(864e13);
|
|
861
907
|
maxDate.setHours(0, 0, 0, 0);
|
|
862
908
|
return maxDate;
|
|
863
909
|
}, [inProps.maxDate]);
|
|
864
|
-
const paginate =
|
|
910
|
+
const paginate = useCallback5(
|
|
865
911
|
(newDirection) => {
|
|
866
912
|
setPage([page + newDirection, newDirection]);
|
|
867
913
|
},
|
|
868
914
|
[page]
|
|
869
915
|
);
|
|
870
|
-
const handleViewMonthChange =
|
|
916
|
+
const handleViewMonthChange = useCallback5(
|
|
871
917
|
(newMonth) => {
|
|
872
918
|
setViewMonth(newMonth);
|
|
873
919
|
if (resolvedView === "month") {
|
|
@@ -915,12 +961,12 @@ var useCalendarProps = (inProps) => {
|
|
|
915
961
|
},
|
|
916
962
|
name: "Calendar"
|
|
917
963
|
});
|
|
918
|
-
const ownerState =
|
|
964
|
+
const ownerState = useMemo5(() => ({ ...props, viewMonth, direction }), [props, viewMonth, direction]);
|
|
919
965
|
return [props, ownerState];
|
|
920
966
|
};
|
|
921
967
|
|
|
922
968
|
// src/components/Calendar/hooks/use-calendar.ts
|
|
923
|
-
import { useCallback as
|
|
969
|
+
import { useCallback as useCallback6, useState as useState4 } from "react";
|
|
924
970
|
var useCalendar = (ownerState) => {
|
|
925
971
|
const [localHoverDay, setLocalHoverDay] = useState4(null);
|
|
926
972
|
const [localHoverMonth, setLocalHoverMonth] = useState4(null);
|
|
@@ -930,7 +976,7 @@ var useCalendar = (ownerState) => {
|
|
|
930
976
|
const setHoverMonth = ownerState.onHoverMonthChange ?? setLocalHoverMonth;
|
|
931
977
|
return {
|
|
932
978
|
calendarTitle: ownerState.view === "month" ? getYearName(ownerState.viewMonth, ownerState.locale || "default") : getMonthName(ownerState.viewMonth, ownerState.locale || "default"),
|
|
933
|
-
onPrev:
|
|
979
|
+
onPrev: useCallback6(() => {
|
|
934
980
|
if (ownerState.view === "day") {
|
|
935
981
|
const currentDate = new Date(ownerState.viewMonth || /* @__PURE__ */ new Date());
|
|
936
982
|
const currentYear = currentDate.getFullYear();
|
|
@@ -947,7 +993,7 @@ var useCalendar = (ownerState) => {
|
|
|
947
993
|
ownerState.onMonthChange?.(prevYear);
|
|
948
994
|
}
|
|
949
995
|
}, [ownerState.onMonthChange, ownerState.viewMonth, ownerState.view]),
|
|
950
|
-
onNext:
|
|
996
|
+
onNext: useCallback6(() => {
|
|
951
997
|
if (ownerState.view === "day") {
|
|
952
998
|
const currentDate = new Date(ownerState.viewMonth || /* @__PURE__ */ new Date());
|
|
953
999
|
const currentYear = currentDate.getFullYear();
|
|
@@ -964,7 +1010,7 @@ var useCalendar = (ownerState) => {
|
|
|
964
1010
|
ownerState.onMonthChange?.(nextYear);
|
|
965
1011
|
}
|
|
966
1012
|
}, [ownerState.onMonthChange, ownerState.viewMonth, ownerState.view]),
|
|
967
|
-
getDayCellProps:
|
|
1013
|
+
getDayCellProps: useCallback6(
|
|
968
1014
|
(day) => {
|
|
969
1015
|
const thisDay = new Date(ownerState.viewMonth || /* @__PURE__ */ new Date());
|
|
970
1016
|
thisDay.setHours(0, 0, 0, 0);
|
|
@@ -979,7 +1025,7 @@ var useCalendar = (ownerState) => {
|
|
|
979
1025
|
},
|
|
980
1026
|
[ownerState.rangeSelection, ownerState.value, ownerState.viewMonth, hoverDay]
|
|
981
1027
|
),
|
|
982
|
-
getMonthCellProps:
|
|
1028
|
+
getMonthCellProps: useCallback6(
|
|
983
1029
|
(monthIndex) => {
|
|
984
1030
|
const thisMonth = new Date(ownerState.viewMonth || /* @__PURE__ */ new Date());
|
|
985
1031
|
thisMonth.setDate(1);
|
|
@@ -996,7 +1042,7 @@ var useCalendar = (ownerState) => {
|
|
|
996
1042
|
},
|
|
997
1043
|
[ownerState.rangeSelection, ownerState.value, ownerState.viewMonth, hoverMonth]
|
|
998
1044
|
),
|
|
999
|
-
getPickerDayProps:
|
|
1045
|
+
getPickerDayProps: useCallback6(
|
|
1000
1046
|
(day) => {
|
|
1001
1047
|
const thisDay = new Date(ownerState.viewMonth || /* @__PURE__ */ new Date());
|
|
1002
1048
|
thisDay.setHours(0, 0, 0, 0);
|
|
@@ -1050,7 +1096,7 @@ var useCalendar = (ownerState) => {
|
|
|
1050
1096
|
hoverDay
|
|
1051
1097
|
]
|
|
1052
1098
|
),
|
|
1053
|
-
getPickerMonthProps:
|
|
1099
|
+
getPickerMonthProps: useCallback6(
|
|
1054
1100
|
(monthIndex) => {
|
|
1055
1101
|
const thisMonth = new Date(ownerState.viewMonth || /* @__PURE__ */ new Date());
|
|
1056
1102
|
thisMonth.setDate(1);
|
|
@@ -1347,8 +1393,8 @@ var swipePower = (offset, velocity) => {
|
|
|
1347
1393
|
var PickerDays = (props) => {
|
|
1348
1394
|
const { ownerState } = props;
|
|
1349
1395
|
const { getPickerDayProps, getDayCellProps } = useCalendar(ownerState);
|
|
1350
|
-
const calendarDates =
|
|
1351
|
-
const weekdayNames =
|
|
1396
|
+
const calendarDates = useMemo6(() => getCalendarDates(ownerState.viewMonth), [ownerState.viewMonth]);
|
|
1397
|
+
const weekdayNames = useMemo6(() => getWeekdayNames(ownerState.locale || "default"), [ownerState.locale]);
|
|
1352
1398
|
return /* @__PURE__ */ React13.createElement(CalendarViewContainer, { calendarType: "datePicker" }, /* @__PURE__ */ React13.createElement(AnimatePresence, { initial: false, custom: ownerState.direction }, /* @__PURE__ */ React13.createElement(
|
|
1353
1399
|
CalendarViewTable,
|
|
1354
1400
|
{
|
|
@@ -1432,8 +1478,8 @@ var PickerMonths = (props) => {
|
|
|
1432
1478
|
};
|
|
1433
1479
|
var PlainPickerDays = ({ ownerState }) => {
|
|
1434
1480
|
const { getPickerDayProps, getDayCellProps } = useCalendar(ownerState);
|
|
1435
|
-
const calendarDates =
|
|
1436
|
-
const weekdayNames =
|
|
1481
|
+
const calendarDates = useMemo6(() => getCalendarDates(ownerState.viewMonth), [ownerState.viewMonth]);
|
|
1482
|
+
const weekdayNames = useMemo6(() => getWeekdayNames(ownerState.locale || "default"), [ownerState.locale]);
|
|
1437
1483
|
return /* @__PURE__ */ React13.createElement(StaticCalendarViewTable, null, /* @__PURE__ */ React13.createElement(CalendarWeekHeaderContainer, null, /* @__PURE__ */ React13.createElement("tr", null, weekdayNames.map((name, i) => /* @__PURE__ */ React13.createElement(Fragment, { key: `${ownerState.viewMonth}_${name}_${i}` }, /* @__PURE__ */ React13.createElement("th", null, /* @__PURE__ */ React13.createElement(Typography_default, { level: "body-xs", textAlign: "center" }, name)), i < 6 && /* @__PURE__ */ React13.createElement("th", { style: { width: 4 }, "aria-hidden": "true", "aria-description": "cell-gap" }))))), /* @__PURE__ */ React13.createElement(CalendarDayPickerContainer, null, calendarDates.map((weekDates, rowIndex) => /* @__PURE__ */ React13.createElement(Fragment, { key: `${ownerState.viewMonth}_${rowIndex}` }, /* @__PURE__ */ React13.createElement("tr", null, weekDates.map(
|
|
1438
1484
|
(date, i) => date ? /* @__PURE__ */ React13.createElement(Fragment, { key: `${ownerState.viewMonth}_${date}_${i}` }, /* @__PURE__ */ React13.createElement(CalendarDayCell, { ...getDayCellProps(date) }, /* @__PURE__ */ React13.createElement(CalendarDay, { size: "sm", variant: "plain", color: "neutral", ...getPickerDayProps(date) }, date)), i < 6 && /* @__PURE__ */ React13.createElement("td", { "aria-hidden": "true", "aria-description": "cell-gap" })) : /* @__PURE__ */ React13.createElement(Fragment, { key: `${ownerState.viewMonth}_${i}` }, /* @__PURE__ */ React13.createElement("td", null), i < 6 && /* @__PURE__ */ React13.createElement("td", { "aria-hidden": "true", "aria-description": "cell-gap" }))
|
|
1439
1485
|
)), rowIndex < calendarDates.length - 1 && /* @__PURE__ */ React13.createElement("tr", { "aria-hidden": "true", "aria-description": "row-gap" }, /* @__PURE__ */ React13.createElement("td", { colSpan: 13, style: { height: 4 } }))))));
|
|
@@ -1573,14 +1619,16 @@ var Calendar = forwardRef4((inProps, ref) => {
|
|
|
1573
1619
|
maxDate,
|
|
1574
1620
|
disableFuture,
|
|
1575
1621
|
disablePast,
|
|
1622
|
+
shouldDisableDate,
|
|
1623
|
+
slots,
|
|
1576
1624
|
numberOfMonths,
|
|
1577
1625
|
...others
|
|
1578
1626
|
} = props;
|
|
1579
1627
|
const { calendarTitle, onPrev, onNext } = useCalendar(ownerState);
|
|
1580
1628
|
const [isMonthViewAssistHintOpen, setIsMonthViewAssistHintOpen] = useState5(false);
|
|
1581
|
-
const monthNavClickTimestampsRef =
|
|
1582
|
-
const monthViewAssistHintShownInSessionRef =
|
|
1583
|
-
const monthViewAssistHintTimeoutRef =
|
|
1629
|
+
const monthNavClickTimestampsRef = useRef4([]);
|
|
1630
|
+
const monthViewAssistHintShownInSessionRef = useRef4(false);
|
|
1631
|
+
const monthViewAssistHintTimeoutRef = useRef4(null);
|
|
1584
1632
|
const [hoverDay, setHoverDay] = useState5(null);
|
|
1585
1633
|
const [hoverMonth, setHoverMonth] = useState5(null);
|
|
1586
1634
|
const resolvedNumberOfMonths = numberOfMonths ?? 1;
|
|
@@ -1601,14 +1649,14 @@ var Calendar = forwardRef4((inProps, ref) => {
|
|
|
1601
1649
|
}
|
|
1602
1650
|
};
|
|
1603
1651
|
}, []);
|
|
1604
|
-
const closeMonthViewAssistHint =
|
|
1652
|
+
const closeMonthViewAssistHint = useCallback7(() => {
|
|
1605
1653
|
if (monthViewAssistHintTimeoutRef.current) {
|
|
1606
1654
|
clearTimeout(monthViewAssistHintTimeoutRef.current);
|
|
1607
1655
|
monthViewAssistHintTimeoutRef.current = null;
|
|
1608
1656
|
}
|
|
1609
1657
|
setIsMonthViewAssistHintOpen(false);
|
|
1610
1658
|
}, []);
|
|
1611
|
-
const showMonthViewAssistHint =
|
|
1659
|
+
const showMonthViewAssistHint = useCallback7(() => {
|
|
1612
1660
|
const now = Date.now();
|
|
1613
1661
|
if (monthViewAssistHintShownInSessionRef.current) return;
|
|
1614
1662
|
if (now - lastMonthViewAssistHintShownAt < MONTH_VIEW_HINT_COOLDOWN_MS) return;
|
|
@@ -1623,7 +1671,7 @@ var Calendar = forwardRef4((inProps, ref) => {
|
|
|
1623
1671
|
monthViewAssistHintTimeoutRef.current = null;
|
|
1624
1672
|
}, MONTH_VIEW_HINT_DURATION_MS);
|
|
1625
1673
|
}, []);
|
|
1626
|
-
const trackFastMonthNavigation =
|
|
1674
|
+
const trackFastMonthNavigation = useCallback7(() => {
|
|
1627
1675
|
if (!isHintEligible) return;
|
|
1628
1676
|
const now = Date.now();
|
|
1629
1677
|
monthNavClickTimestampsRef.current = [
|
|
@@ -1634,15 +1682,15 @@ var Calendar = forwardRef4((inProps, ref) => {
|
|
|
1634
1682
|
showMonthViewAssistHint();
|
|
1635
1683
|
}
|
|
1636
1684
|
}, [isHintEligible, showMonthViewAssistHint]);
|
|
1637
|
-
const handlePrevClick =
|
|
1685
|
+
const handlePrevClick = useCallback7(() => {
|
|
1638
1686
|
onPrev();
|
|
1639
1687
|
trackFastMonthNavigation();
|
|
1640
1688
|
}, [onPrev, trackFastMonthNavigation]);
|
|
1641
|
-
const handleNextClick =
|
|
1689
|
+
const handleNextClick = useCallback7(() => {
|
|
1642
1690
|
onNext();
|
|
1643
1691
|
trackFastMonthNavigation();
|
|
1644
1692
|
}, [onNext, trackFastMonthNavigation]);
|
|
1645
|
-
const handleSwitchViewClick =
|
|
1693
|
+
const handleSwitchViewClick = useCallback7(() => {
|
|
1646
1694
|
closeMonthViewAssistHint();
|
|
1647
1695
|
onViewChange?.();
|
|
1648
1696
|
}, [closeMonthViewAssistHint, onViewChange]);
|
|
@@ -1812,11 +1860,11 @@ var Container = forwardRef5(function Container2(props, ref) {
|
|
|
1812
1860
|
Container.displayName = "Container";
|
|
1813
1861
|
|
|
1814
1862
|
// src/components/CurrencyInput/CurrencyInput.tsx
|
|
1815
|
-
import React17, { useCallback as
|
|
1863
|
+
import React17, { useCallback as useCallback9, useMemo as useMemo7 } from "react";
|
|
1816
1864
|
import { NumericFormat } from "react-number-format";
|
|
1817
1865
|
|
|
1818
1866
|
// src/components/Input/Input.tsx
|
|
1819
|
-
import React16, { useCallback as
|
|
1867
|
+
import React16, { useCallback as useCallback8, useState as useState6 } from "react";
|
|
1820
1868
|
import { Input as JoyInput } from "@mui/joy";
|
|
1821
1869
|
import { motion as motion16 } from "framer-motion";
|
|
1822
1870
|
import ClearIcon from "@mui/icons-material/Close";
|
|
@@ -1854,7 +1902,7 @@ var Input = React16.forwardRef((props, ref) => {
|
|
|
1854
1902
|
const [value, setValue] = useControlledState(
|
|
1855
1903
|
valueProp,
|
|
1856
1904
|
defaultValueProp ?? null,
|
|
1857
|
-
|
|
1905
|
+
useCallback8(
|
|
1858
1906
|
(value2) => {
|
|
1859
1907
|
onChange?.({
|
|
1860
1908
|
/**
|
|
@@ -2144,22 +2192,22 @@ var CurrencyInput = React17.forwardRef(function CurrencyInput2(inProps, ref) {
|
|
|
2144
2192
|
const [_value, setValue] = useControlledState(
|
|
2145
2193
|
props.value,
|
|
2146
2194
|
props.defaultValue ?? null,
|
|
2147
|
-
|
|
2195
|
+
useCallback9((value2) => onChange?.({ target: { name, value: value2 } }), [onChange, name])
|
|
2148
2196
|
);
|
|
2149
|
-
const value =
|
|
2197
|
+
const value = useMemo7(() => {
|
|
2150
2198
|
if (_value && useMinorUnit) {
|
|
2151
2199
|
return _value / Math.pow(10, decimalScale);
|
|
2152
2200
|
}
|
|
2153
2201
|
return _value;
|
|
2154
2202
|
}, [_value, useMinorUnit, decimalScale]);
|
|
2155
|
-
const max =
|
|
2203
|
+
const max = useMemo7(() => {
|
|
2156
2204
|
if (props.max && useMinorUnit) {
|
|
2157
2205
|
return props.max / Math.pow(10, decimalScale);
|
|
2158
2206
|
}
|
|
2159
2207
|
return props.max;
|
|
2160
2208
|
}, [props.max, useMinorUnit, decimalScale]);
|
|
2161
|
-
const isOverLimit =
|
|
2162
|
-
const handleChange =
|
|
2209
|
+
const isOverLimit = useMemo7(() => max != null && value != null && value > max, [max, value]);
|
|
2210
|
+
const handleChange = useCallback9(
|
|
2163
2211
|
(event) => {
|
|
2164
2212
|
if (event.target.value === "") {
|
|
2165
2213
|
setValue(null);
|
|
@@ -2208,9 +2256,9 @@ var CurrencyInput_default = CurrencyInput;
|
|
|
2208
2256
|
|
|
2209
2257
|
// src/components/DataTable/DataTable.tsx
|
|
2210
2258
|
import React26, {
|
|
2211
|
-
useCallback as
|
|
2212
|
-
useMemo as
|
|
2213
|
-
useRef as
|
|
2259
|
+
useCallback as useCallback14,
|
|
2260
|
+
useMemo as useMemo12,
|
|
2261
|
+
useRef as useRef8,
|
|
2214
2262
|
useId,
|
|
2215
2263
|
forwardRef as forwardRef7,
|
|
2216
2264
|
useImperativeHandle as useImperativeHandle2,
|
|
@@ -2443,6 +2491,12 @@ function computeAutoFitWidth(params) {
|
|
|
2443
2491
|
if (!isNaN(maxPx) && maxPx > 0) finalWidth = Math.min(finalWidth, maxPx);
|
|
2444
2492
|
return finalWidth;
|
|
2445
2493
|
}
|
|
2494
|
+
function getHeaderCellId(tableId, field) {
|
|
2495
|
+
return `${tableId}_header_${sanitizeColumnId(field)}`;
|
|
2496
|
+
}
|
|
2497
|
+
function sanitizeColumnId(field) {
|
|
2498
|
+
return String(field).trim().replace(/\s+/g, "_");
|
|
2499
|
+
}
|
|
2446
2500
|
|
|
2447
2501
|
// src/components/DataTable/styled.tsx
|
|
2448
2502
|
import React18 from "react";
|
|
@@ -2631,11 +2685,11 @@ var Resizer = (ref, targetRef = ref, onResizeStateChange, onAutoFit) => /* @__PU
|
|
|
2631
2685
|
|
|
2632
2686
|
// src/components/DataTable/components.tsx
|
|
2633
2687
|
import React23, {
|
|
2634
|
-
useRef as
|
|
2688
|
+
useRef as useRef6,
|
|
2635
2689
|
useState as useState8,
|
|
2636
2690
|
useLayoutEffect,
|
|
2637
|
-
useMemo as
|
|
2638
|
-
useCallback as
|
|
2691
|
+
useMemo as useMemo10,
|
|
2692
|
+
useCallback as useCallback11,
|
|
2639
2693
|
useEffect as useEffect5,
|
|
2640
2694
|
memo,
|
|
2641
2695
|
createElement
|
|
@@ -2644,7 +2698,7 @@ import { styled as styled12, useTheme } from "@mui/joy";
|
|
|
2644
2698
|
import { AnimatePresence as AnimatePresence2 } from "framer-motion";
|
|
2645
2699
|
|
|
2646
2700
|
// src/components/DatePicker/DatePicker.tsx
|
|
2647
|
-
import React19, { forwardRef as forwardRef6, useCallback as
|
|
2701
|
+
import React19, { forwardRef as forwardRef6, useCallback as useCallback10, useEffect as useEffect4, useImperativeHandle, useRef as useRef5, useState as useState7 } from "react";
|
|
2648
2702
|
import { IMaskInput, IMask } from "react-imask";
|
|
2649
2703
|
import CalendarTodayIcon from "@mui/icons-material/CalendarToday";
|
|
2650
2704
|
import { styled as styled10, useThemeProps as useThemeProps5 } from "@mui/joy";
|
|
@@ -2861,12 +2915,12 @@ var DatePicker = forwardRef6((inProps, ref) => {
|
|
|
2861
2915
|
presets,
|
|
2862
2916
|
...innerProps
|
|
2863
2917
|
} = props;
|
|
2864
|
-
const innerRef =
|
|
2865
|
-
const buttonRef =
|
|
2918
|
+
const innerRef = useRef5(null);
|
|
2919
|
+
const buttonRef = useRef5(null);
|
|
2866
2920
|
const [rawValue, setValue] = useControlledState(
|
|
2867
2921
|
props.value,
|
|
2868
2922
|
props.defaultValue ?? null,
|
|
2869
|
-
|
|
2923
|
+
useCallback10(
|
|
2870
2924
|
(value2) => onChange?.({ target: { name: props.name, value: value2 ?? "" } }),
|
|
2871
2925
|
[props.name, onChange]
|
|
2872
2926
|
)
|
|
@@ -2894,7 +2948,7 @@ var DatePicker = forwardRef6((inProps, ref) => {
|
|
|
2894
2948
|
}
|
|
2895
2949
|
}, [displayFormat, displayValue, format, locale, value]);
|
|
2896
2950
|
useImperativeHandle(ref, () => innerRef.current, [innerRef]);
|
|
2897
|
-
const handleChange =
|
|
2951
|
+
const handleChange = useCallback10(
|
|
2898
2952
|
(event) => {
|
|
2899
2953
|
const value2 = event.target.value;
|
|
2900
2954
|
setDisplayValue(value2 ? formatValueString(parseDate(value2, format), displayFormat, locale) : value2);
|
|
@@ -2902,7 +2956,7 @@ var DatePicker = forwardRef6((inProps, ref) => {
|
|
|
2902
2956
|
},
|
|
2903
2957
|
[displayFormat, format, locale, setValue]
|
|
2904
2958
|
);
|
|
2905
|
-
const handleDisplayInputChange =
|
|
2959
|
+
const handleDisplayInputChange = useCallback10(
|
|
2906
2960
|
(event) => {
|
|
2907
2961
|
if (event.target.value === "") {
|
|
2908
2962
|
handleChange({
|
|
@@ -2927,7 +2981,7 @@ var DatePicker = forwardRef6((inProps, ref) => {
|
|
|
2927
2981
|
},
|
|
2928
2982
|
[displayFormat, format, handleChange, props.name]
|
|
2929
2983
|
);
|
|
2930
|
-
const handleCalendarToggle =
|
|
2984
|
+
const handleCalendarToggle = useCallback10(
|
|
2931
2985
|
(event) => {
|
|
2932
2986
|
setAnchorEl(anchorEl ? null : event.currentTarget);
|
|
2933
2987
|
setTimeout(() => {
|
|
@@ -2936,7 +2990,7 @@ var DatePicker = forwardRef6((inProps, ref) => {
|
|
|
2936
2990
|
},
|
|
2937
2991
|
[anchorEl, setAnchorEl, innerRef]
|
|
2938
2992
|
);
|
|
2939
|
-
const handleInputMouseDown =
|
|
2993
|
+
const handleInputMouseDown = useCallback10(
|
|
2940
2994
|
(event) => {
|
|
2941
2995
|
if (inputReadOnly || isAlphabeticDisplay) {
|
|
2942
2996
|
event.preventDefault();
|
|
@@ -2945,7 +2999,7 @@ var DatePicker = forwardRef6((inProps, ref) => {
|
|
|
2945
2999
|
},
|
|
2946
3000
|
[inputReadOnly, isAlphabeticDisplay, buttonRef]
|
|
2947
3001
|
);
|
|
2948
|
-
const handleInputClick =
|
|
3002
|
+
const handleInputClick = useCallback10(
|
|
2949
3003
|
(event) => {
|
|
2950
3004
|
if (inputReadOnly && !readOnly) {
|
|
2951
3005
|
handleCalendarToggle(event);
|
|
@@ -2953,7 +3007,7 @@ var DatePicker = forwardRef6((inProps, ref) => {
|
|
|
2953
3007
|
},
|
|
2954
3008
|
[inputReadOnly, readOnly, handleCalendarToggle]
|
|
2955
3009
|
);
|
|
2956
|
-
const handlePresetClick =
|
|
3010
|
+
const handlePresetClick = useCallback10(
|
|
2957
3011
|
(presetValue) => {
|
|
2958
3012
|
handleChange({
|
|
2959
3013
|
target: {
|
|
@@ -2965,7 +3019,7 @@ var DatePicker = forwardRef6((inProps, ref) => {
|
|
|
2965
3019
|
},
|
|
2966
3020
|
[handleChange, props.name]
|
|
2967
3021
|
);
|
|
2968
|
-
const isPresetDisabled =
|
|
3022
|
+
const isPresetDisabled = useCallback10(
|
|
2969
3023
|
(presetValue) => {
|
|
2970
3024
|
try {
|
|
2971
3025
|
const date = parseDate(presetValue, format);
|
|
@@ -3118,7 +3172,7 @@ import React20 from "react";
|
|
|
3118
3172
|
import { Textarea as JoyTextarea } from "@mui/joy";
|
|
3119
3173
|
import { motion as motion19 } from "framer-motion";
|
|
3120
3174
|
var MotionTextarea = motion19(JoyTextarea);
|
|
3121
|
-
var
|
|
3175
|
+
var TextareaBase = (props) => {
|
|
3122
3176
|
const {
|
|
3123
3177
|
label,
|
|
3124
3178
|
error,
|
|
@@ -3162,13 +3216,17 @@ var Textarea = (props) => {
|
|
|
3162
3216
|
helperText && /* @__PURE__ */ React20.createElement(FormHelperText_default, null, helperText)
|
|
3163
3217
|
);
|
|
3164
3218
|
};
|
|
3219
|
+
var Textarea = React20.forwardRef((props, ref) => {
|
|
3220
|
+
const textareaSlotProps = useSlotRef(props.slotProps?.textarea, ref);
|
|
3221
|
+
return /* @__PURE__ */ React20.createElement(TextareaBase, { ...props, slotProps: { ...props.slotProps, textarea: textareaSlotProps } });
|
|
3222
|
+
});
|
|
3165
3223
|
Textarea.displayName = "Textarea";
|
|
3166
3224
|
|
|
3167
3225
|
// src/components/Textarea/index.ts
|
|
3168
3226
|
var Textarea_default = Textarea;
|
|
3169
3227
|
|
|
3170
3228
|
// src/components/Select/Select.tsx
|
|
3171
|
-
import React21, { useMemo as
|
|
3229
|
+
import React21, { useMemo as useMemo9 } from "react";
|
|
3172
3230
|
import {
|
|
3173
3231
|
Select as JoySelect,
|
|
3174
3232
|
Option as JoyOption,
|
|
@@ -3184,7 +3242,7 @@ var secondaryTextLevelMap2 = {
|
|
|
3184
3242
|
lg: "body-md"
|
|
3185
3243
|
};
|
|
3186
3244
|
Option.displayName = "Option";
|
|
3187
|
-
function
|
|
3245
|
+
function SelectInner(props, ref) {
|
|
3188
3246
|
const {
|
|
3189
3247
|
label,
|
|
3190
3248
|
helperText,
|
|
@@ -3210,7 +3268,7 @@ function Select(props) {
|
|
|
3210
3268
|
formHelperText: formHelperTextProps,
|
|
3211
3269
|
...joySlotProps
|
|
3212
3270
|
} = slotProps ?? {};
|
|
3213
|
-
const options =
|
|
3271
|
+
const options = useMemo9(
|
|
3214
3272
|
() => props.options.map((option) => {
|
|
3215
3273
|
if (option.hasOwnProperty("value") && option.hasOwnProperty("label")) {
|
|
3216
3274
|
return option;
|
|
@@ -3235,13 +3293,14 @@ function Select(props) {
|
|
|
3235
3293
|
};
|
|
3236
3294
|
onChange?.(newEvent, newValue);
|
|
3237
3295
|
};
|
|
3238
|
-
const optionMap =
|
|
3296
|
+
const optionMap = useMemo9(() => {
|
|
3239
3297
|
const map = /* @__PURE__ */ new Map();
|
|
3240
3298
|
options.forEach((option) => {
|
|
3241
3299
|
map.set(option.value, option);
|
|
3242
3300
|
});
|
|
3243
3301
|
return map;
|
|
3244
3302
|
}, [options]);
|
|
3303
|
+
const buttonSlotProps = useSlotRef(joySlotProps.button, ref);
|
|
3245
3304
|
const select = /* @__PURE__ */ React21.createElement(
|
|
3246
3305
|
JoySelect,
|
|
3247
3306
|
{
|
|
@@ -3250,7 +3309,7 @@ function Select(props) {
|
|
|
3250
3309
|
disabled,
|
|
3251
3310
|
size,
|
|
3252
3311
|
color: error ? "danger" : color,
|
|
3253
|
-
slotProps: joySlotProps,
|
|
3312
|
+
slotProps: { ...joySlotProps, button: buttonSlotProps },
|
|
3254
3313
|
onChange: handleChange,
|
|
3255
3314
|
renderValue: (selected) => {
|
|
3256
3315
|
if (!selected) return null;
|
|
@@ -3280,6 +3339,7 @@ function Select(props) {
|
|
|
3280
3339
|
helperText && /* @__PURE__ */ React21.createElement(FormHelperText_default, { ...formHelperTextProps }, helperText)
|
|
3281
3340
|
);
|
|
3282
3341
|
}
|
|
3342
|
+
var Select = React21.forwardRef(SelectInner);
|
|
3283
3343
|
Select.displayName = "Select";
|
|
3284
3344
|
|
|
3285
3345
|
// src/components/Select/index.ts
|
|
@@ -3327,7 +3387,7 @@ var TextEllipsis = ({
|
|
|
3327
3387
|
lineClamp,
|
|
3328
3388
|
...rest
|
|
3329
3389
|
}) => {
|
|
3330
|
-
const textRef =
|
|
3390
|
+
const textRef = useRef6(null);
|
|
3331
3391
|
const [showTooltip, setShowTooltip] = useState8(false);
|
|
3332
3392
|
useLayoutEffect(() => {
|
|
3333
3393
|
const element = textRef.current;
|
|
@@ -3344,7 +3404,7 @@ var TextEllipsis = ({
|
|
|
3344
3404
|
return /* @__PURE__ */ React23.createElement(Tooltip_default, { title: showTooltip ? children : "", placement: "top" }, /* @__PURE__ */ React23.createElement(EllipsisDiv, { ref: textRef, lineClamp, ...rest }, children));
|
|
3345
3405
|
};
|
|
3346
3406
|
var CellTextEllipsis = ({ children }) => {
|
|
3347
|
-
const textRef =
|
|
3407
|
+
const textRef = useRef6(null);
|
|
3348
3408
|
const [showTooltip, setShowTooltip] = useState8(false);
|
|
3349
3409
|
useLayoutEffect(() => {
|
|
3350
3410
|
const element = textRef.current;
|
|
@@ -3399,18 +3459,15 @@ var HeadCell = (props) => {
|
|
|
3399
3459
|
const theme = useTheme();
|
|
3400
3460
|
const ref = headerRef;
|
|
3401
3461
|
const colRef = tableColRef;
|
|
3402
|
-
const localRef =
|
|
3462
|
+
const localRef = useRef6(null);
|
|
3403
3463
|
useLayoutEffect(() => {
|
|
3404
3464
|
ref.current = localRef.current;
|
|
3405
3465
|
}, [ref]);
|
|
3406
3466
|
const [isHovered, setIsHovered] = useState8(false);
|
|
3407
3467
|
const sortable = type === "actions" ? false : _sortable;
|
|
3408
|
-
const headId =
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
);
|
|
3412
|
-
const isResizingRef = useRef5(false);
|
|
3413
|
-
const resizer = useMemo9(
|
|
3468
|
+
const headId = useMemo10(() => getHeaderCellId(tableId, field), [tableId, field]);
|
|
3469
|
+
const isResizingRef = useRef6(false);
|
|
3470
|
+
const resizer = useMemo10(
|
|
3414
3471
|
() => resizable ?? true ? Resizer(
|
|
3415
3472
|
ref,
|
|
3416
3473
|
colRef,
|
|
@@ -3421,7 +3478,7 @@ var HeadCell = (props) => {
|
|
|
3421
3478
|
) : null,
|
|
3422
3479
|
[resizable, ref, colRef, onAutoFit, field]
|
|
3423
3480
|
);
|
|
3424
|
-
const style =
|
|
3481
|
+
const style = useMemo10(
|
|
3425
3482
|
() => ({
|
|
3426
3483
|
width,
|
|
3427
3484
|
minWidth: minWidth ?? "50px",
|
|
@@ -3439,7 +3496,7 @@ var HeadCell = (props) => {
|
|
|
3439
3496
|
);
|
|
3440
3497
|
const textAlign = getTextAlign(props);
|
|
3441
3498
|
const initialSort = sortOrder[0];
|
|
3442
|
-
const sortIcon =
|
|
3499
|
+
const sortIcon = useMemo10(() => {
|
|
3443
3500
|
const isSorted = !!sort;
|
|
3444
3501
|
const isVisible = sortable && (isSorted || isHovered);
|
|
3445
3502
|
return /* @__PURE__ */ React23.createElement(AnimatePresence2, { mode: "wait" }, isVisible && /* @__PURE__ */ React23.createElement(
|
|
@@ -3470,17 +3527,17 @@ var HeadCell = (props) => {
|
|
|
3470
3527
|
}
|
|
3471
3528
|
));
|
|
3472
3529
|
}, [headId, initialSort, sort, sortable, isHovered]);
|
|
3473
|
-
const infoSign =
|
|
3530
|
+
const infoSign = useMemo10(
|
|
3474
3531
|
() => description ? /* @__PURE__ */ React23.createElement(InfoSign_default, { message: description, placement: "bottom" }) : null,
|
|
3475
3532
|
[description]
|
|
3476
3533
|
);
|
|
3477
|
-
const params =
|
|
3534
|
+
const params = useMemo10(
|
|
3478
3535
|
() => ({
|
|
3479
3536
|
field
|
|
3480
3537
|
}),
|
|
3481
3538
|
[field]
|
|
3482
3539
|
);
|
|
3483
|
-
const computedHeaderClassName =
|
|
3540
|
+
const computedHeaderClassName = useMemo10(
|
|
3484
3541
|
() => (typeof headerClassName === "function" ? headerClassName(params) : headerClassName) || void 0,
|
|
3485
3542
|
[headerClassName, params]
|
|
3486
3543
|
);
|
|
@@ -3493,7 +3550,7 @@ var HeadCell = (props) => {
|
|
|
3493
3550
|
ref: localRef,
|
|
3494
3551
|
key: field,
|
|
3495
3552
|
style,
|
|
3496
|
-
onClick:
|
|
3553
|
+
onClick: useCallback11(
|
|
3497
3554
|
(e) => {
|
|
3498
3555
|
if (isResizingRef.current) return;
|
|
3499
3556
|
if (!(e.target instanceof Element) || !e.currentTarget.contains(e.target)) return;
|
|
@@ -3533,8 +3590,8 @@ var BodyCell = (props) => {
|
|
|
3533
3590
|
} = props;
|
|
3534
3591
|
const theme = useTheme();
|
|
3535
3592
|
const [value, setValue] = useState8(row[field]);
|
|
3536
|
-
const cellRef =
|
|
3537
|
-
const params =
|
|
3593
|
+
const cellRef = useRef6(null);
|
|
3594
|
+
const params = useMemo10(
|
|
3538
3595
|
() => ({
|
|
3539
3596
|
row,
|
|
3540
3597
|
value,
|
|
@@ -3543,20 +3600,20 @@ var BodyCell = (props) => {
|
|
|
3543
3600
|
}),
|
|
3544
3601
|
[row, rowId, value, field]
|
|
3545
3602
|
);
|
|
3546
|
-
const editMode =
|
|
3603
|
+
const editMode = useMemo10(
|
|
3547
3604
|
() => !!(props.editMode && (typeof isCellEditable === "function" ? isCellEditable(params) : isCellEditable ?? true)),
|
|
3548
3605
|
[props.editMode, isCellEditable, params]
|
|
3549
3606
|
);
|
|
3550
3607
|
const propsComponentProps = "componentProps" in props ? props.componentProps : null;
|
|
3551
3608
|
const hasComponentProps = "componentProps" in props;
|
|
3552
|
-
const componentProps =
|
|
3609
|
+
const componentProps = useMemo10(
|
|
3553
3610
|
() => ({
|
|
3554
3611
|
...hasComponentProps && (typeof propsComponentProps === "function" ? propsComponentProps(params) : propsComponentProps || {}),
|
|
3555
3612
|
size: "sm"
|
|
3556
3613
|
}),
|
|
3557
3614
|
[hasComponentProps, propsComponentProps, params]
|
|
3558
3615
|
);
|
|
3559
|
-
const editModeComponentProps =
|
|
3616
|
+
const editModeComponentProps = useMemo10(
|
|
3560
3617
|
() => ({
|
|
3561
3618
|
...componentProps,
|
|
3562
3619
|
onChange: (e) => {
|
|
@@ -3618,9 +3675,9 @@ var BodyCell = (props) => {
|
|
|
3618
3675
|
}),
|
|
3619
3676
|
[params, row, field, value, componentProps, type, onCellEditStop, onCellEditStart]
|
|
3620
3677
|
);
|
|
3621
|
-
const MemoizedRenderEditCell =
|
|
3622
|
-
const MemoizedRenderCell =
|
|
3623
|
-
const EditModeComponent =
|
|
3678
|
+
const MemoizedRenderEditCell = useMemo10(() => renderEditCell ? memo(renderEditCell) : null, [renderEditCell]);
|
|
3679
|
+
const MemoizedRenderCell = useMemo10(() => renderCell ? memo(renderCell) : null, [renderCell]);
|
|
3680
|
+
const EditModeComponent = useMemo10(() => {
|
|
3624
3681
|
if (MemoizedRenderEditCell) {
|
|
3625
3682
|
return createElement(MemoizedRenderEditCell, params);
|
|
3626
3683
|
}
|
|
@@ -3655,7 +3712,7 @@ var BodyCell = (props) => {
|
|
|
3655
3712
|
}[type || "text"];
|
|
3656
3713
|
}, [value, editModeComponentProps, type, MemoizedRenderEditCell, params]);
|
|
3657
3714
|
const linkComponentFromProps = props.component;
|
|
3658
|
-
const ReadModeComponent =
|
|
3715
|
+
const ReadModeComponent = useMemo10(() => {
|
|
3659
3716
|
if (MemoizedRenderCell) {
|
|
3660
3717
|
return createElement(MemoizedRenderCell, params);
|
|
3661
3718
|
}
|
|
@@ -3669,15 +3726,15 @@ var BodyCell = (props) => {
|
|
|
3669
3726
|
return typedComponent || innerText;
|
|
3670
3727
|
}, [value, MemoizedRenderCell, params, type, componentProps, linkComponentFromProps]);
|
|
3671
3728
|
const getActions = props.getActions;
|
|
3672
|
-
const CellComponent =
|
|
3729
|
+
const CellComponent = useMemo10(() => {
|
|
3673
3730
|
if (type === "actions") {
|
|
3674
3731
|
return /* @__PURE__ */ React23.createElement(Stack_default, { direction: "row", gap: 1, justifyContent: "center", alignItems: "center" }, getActions?.(params));
|
|
3675
3732
|
}
|
|
3676
3733
|
return editMode && EditModeComponent ? EditModeComponent : ReadModeComponent;
|
|
3677
3734
|
}, [type, getActions, params, editMode, EditModeComponent, ReadModeComponent]);
|
|
3678
|
-
const showTooltip =
|
|
3735
|
+
const showTooltip = useMemo10(() => noWrap && type === "longText", [noWrap, type]);
|
|
3679
3736
|
const isBoundary = props.isLastStartPinnedColumn || props.isLastEndPinnedColumn;
|
|
3680
|
-
const computedCellClassName =
|
|
3737
|
+
const computedCellClassName = useMemo10(
|
|
3681
3738
|
() => (typeof cellClassName === "function" ? cellClassName(params) : cellClassName) || "",
|
|
3682
3739
|
[cellClassName, params]
|
|
3683
3740
|
);
|
|
@@ -3689,7 +3746,7 @@ var BodyCell = (props) => {
|
|
|
3689
3746
|
{
|
|
3690
3747
|
ref: cellRef,
|
|
3691
3748
|
key: field,
|
|
3692
|
-
headers:
|
|
3749
|
+
headers: getHeaderCellId(tableId, field),
|
|
3693
3750
|
sx: {
|
|
3694
3751
|
textAlign: getTextAlign({ type }),
|
|
3695
3752
|
verticalAlign: editMode ? "top" : "middle",
|
|
@@ -3701,7 +3758,7 @@ var BodyCell = (props) => {
|
|
|
3701
3758
|
},
|
|
3702
3759
|
className: [isLastStartPinnedColumn && "is-last-left", isLastEndPinnedColumn && "is-last-right", computedCellClassName].filter(Boolean).join(" ") || ""
|
|
3703
3760
|
},
|
|
3704
|
-
|
|
3761
|
+
useMemo10(
|
|
3705
3762
|
() => showTooltip ? /* @__PURE__ */ React23.createElement(CellTextEllipsis, null, CellComponent) : CellComponent,
|
|
3706
3763
|
[CellComponent, showTooltip]
|
|
3707
3764
|
)
|
|
@@ -3754,19 +3811,20 @@ var VirtualizedTableRow = memo(StyledTableRow2, (prevProps, nextProps) => {
|
|
|
3754
3811
|
});
|
|
3755
3812
|
|
|
3756
3813
|
// src/components/DataTable/hooks.ts
|
|
3757
|
-
import { useState as useState9, useLayoutEffect as useLayoutEffect2, useRef as
|
|
3814
|
+
import { useState as useState9, useLayoutEffect as useLayoutEffect2, useRef as useRef7, useMemo as useMemo11, useCallback as useCallback12, useEffect as useEffect6, createRef } from "react";
|
|
3758
3815
|
function useColumnWidths(columnsByField) {
|
|
3759
3816
|
const [widths, setWidths] = useState9({});
|
|
3760
|
-
const roRef =
|
|
3817
|
+
const roRef = useRef7();
|
|
3761
3818
|
useLayoutEffect2(() => {
|
|
3762
3819
|
if (roRef.current) roRef.current.disconnect();
|
|
3763
3820
|
roRef.current = new ResizeObserver((entries) => {
|
|
3764
|
-
let changed = false;
|
|
3765
3821
|
setWidths((prev) => {
|
|
3822
|
+
let changed = false;
|
|
3766
3823
|
const next = { ...prev };
|
|
3767
3824
|
entries.forEach((entry) => {
|
|
3768
3825
|
const field = entry.target.dataset.field;
|
|
3769
3826
|
const w = Math.round(entry.target.getBoundingClientRect().width);
|
|
3827
|
+
if (w === 0) return;
|
|
3770
3828
|
if (next[field] !== w) {
|
|
3771
3829
|
next[field] = w;
|
|
3772
3830
|
changed = true;
|
|
@@ -3775,13 +3833,21 @@ function useColumnWidths(columnsByField) {
|
|
|
3775
3833
|
return changed ? next : prev;
|
|
3776
3834
|
});
|
|
3777
3835
|
});
|
|
3836
|
+
const measured = {};
|
|
3778
3837
|
Object.entries(columnsByField).forEach(([field, def]) => {
|
|
3779
3838
|
const el = def.headerRef.current;
|
|
3780
3839
|
if (el) {
|
|
3781
3840
|
el.dataset.field = field;
|
|
3841
|
+
const w = Math.round(el.getBoundingClientRect().width);
|
|
3842
|
+
if (w > 0) measured[field] = w;
|
|
3782
3843
|
roRef.current.observe(el);
|
|
3783
3844
|
}
|
|
3784
3845
|
});
|
|
3846
|
+
setWidths((prev) => {
|
|
3847
|
+
const keys = Object.keys(measured);
|
|
3848
|
+
const same = keys.every((key) => prev[key] === measured[key]);
|
|
3849
|
+
return same ? prev : { ...prev, ...measured };
|
|
3850
|
+
});
|
|
3785
3851
|
return () => roRef.current?.disconnect();
|
|
3786
3852
|
}, [columnsByField]);
|
|
3787
3853
|
return widths;
|
|
@@ -3815,33 +3881,40 @@ function useDataTableRenderer({
|
|
|
3815
3881
|
"You cannot use both `pinnedColumns` and `columnGroupingModel` at the same time. Please choose one of them."
|
|
3816
3882
|
);
|
|
3817
3883
|
}
|
|
3818
|
-
const
|
|
3884
|
+
const duplicatedField = useMemo11(() => {
|
|
3885
|
+
const ids = columnsProp.map((column) => sanitizeColumnId(column.field));
|
|
3886
|
+
const index = ids.findIndex((id, i) => ids.indexOf(id) !== i);
|
|
3887
|
+
return index === -1 ? void 0 : columnsProp[index].field;
|
|
3888
|
+
}, [columnsProp]);
|
|
3889
|
+
if (duplicatedField !== void 0)
|
|
3890
|
+
throw new Error(`DataTable: column \`field\` must be unique. Duplicated: "${String(duplicatedField)}"`);
|
|
3891
|
+
const onSelectionModelChangeRef = useRef7(onSelectionModelChange);
|
|
3819
3892
|
onSelectionModelChangeRef.current = onSelectionModelChange;
|
|
3820
3893
|
const [focusedRowId, setFocusedRowId] = useState9(null);
|
|
3821
3894
|
const [selectionAnchor, setSelectionAnchor] = useState9(null);
|
|
3822
3895
|
const [sortModel, setSortModel] = useControlledState(
|
|
3823
3896
|
controlledSortModel,
|
|
3824
3897
|
initialState?.sorting?.sortModel ?? [],
|
|
3825
|
-
|
|
3898
|
+
useCallback12((sortModel2) => onSortModelChange?.(sortModel2), [onSortModelChange])
|
|
3826
3899
|
);
|
|
3827
3900
|
const [visibilityModel] = useControlledState(
|
|
3828
3901
|
columnVisibilityModel,
|
|
3829
3902
|
initialState?.columns?.columnVisibilityModel ?? {},
|
|
3830
|
-
|
|
3903
|
+
useCallback12(
|
|
3831
3904
|
(model) => onColumnVisibilityModelChange?.(model),
|
|
3832
3905
|
[onColumnVisibilityModelChange]
|
|
3833
3906
|
)
|
|
3834
3907
|
);
|
|
3835
|
-
const reorderedColumns =
|
|
3908
|
+
const reorderedColumns = useMemo11(() => {
|
|
3836
3909
|
if (!columnGroupingModel) return columnsProp;
|
|
3837
3910
|
return reorderColumnsByGroupingModel(columnsProp, columnGroupingModel);
|
|
3838
3911
|
}, [columnsProp, columnGroupingModel]);
|
|
3839
|
-
const visibleColumns =
|
|
3912
|
+
const visibleColumns = useMemo11(
|
|
3840
3913
|
() => reorderedColumns.filter((col) => visibilityModel[col.field] !== false),
|
|
3841
3914
|
[reorderedColumns, visibilityModel]
|
|
3842
3915
|
);
|
|
3843
|
-
const visibleFieldSet =
|
|
3844
|
-
const tableMinWidth =
|
|
3916
|
+
const visibleFieldSet = useMemo11(() => new Set(visibleColumns.map((c) => c.field)), [visibleColumns]);
|
|
3917
|
+
const tableMinWidth = useMemo11(() => {
|
|
3845
3918
|
const DEFAULT_MIN = 50;
|
|
3846
3919
|
let total = checkboxSelection ? 40 : 0;
|
|
3847
3920
|
for (const col of visibleColumns) {
|
|
@@ -3849,7 +3922,7 @@ function useDataTableRenderer({
|
|
|
3849
3922
|
}
|
|
3850
3923
|
return total;
|
|
3851
3924
|
}, [visibleColumns, checkboxSelection]);
|
|
3852
|
-
const allColumnsByField =
|
|
3925
|
+
const allColumnsByField = useMemo11(
|
|
3853
3926
|
() => reorderedColumns.reduce(
|
|
3854
3927
|
(acc, curr) => ({
|
|
3855
3928
|
...acc,
|
|
@@ -3859,21 +3932,20 @@ function useDataTableRenderer({
|
|
|
3859
3932
|
),
|
|
3860
3933
|
[reorderedColumns]
|
|
3861
3934
|
);
|
|
3862
|
-
const visibleColumnsByField =
|
|
3863
|
-
() =>
|
|
3864
|
-
(
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
...
|
|
3935
|
+
const visibleColumnsByField = useMemo11(
|
|
3936
|
+
() => Object.fromEntries(
|
|
3937
|
+
visibleColumns.map((column) => [
|
|
3938
|
+
column.field,
|
|
3939
|
+
{
|
|
3940
|
+
...column,
|
|
3868
3941
|
headerRef: createRef(),
|
|
3869
3942
|
tableColRef: createRef()
|
|
3870
3943
|
}
|
|
3871
|
-
|
|
3872
|
-
{}
|
|
3944
|
+
])
|
|
3873
3945
|
),
|
|
3874
3946
|
[visibleColumns]
|
|
3875
3947
|
);
|
|
3876
|
-
const sortComparator =
|
|
3948
|
+
const sortComparator = useCallback12(
|
|
3877
3949
|
(rowA, rowB) => {
|
|
3878
3950
|
for (const sort of sortModel) {
|
|
3879
3951
|
const { field, sort: direction } = sort;
|
|
@@ -3902,33 +3974,33 @@ function useDataTableRenderer({
|
|
|
3902
3974
|
},
|
|
3903
3975
|
[sortModel, allColumnsByField]
|
|
3904
3976
|
);
|
|
3905
|
-
const rows =
|
|
3977
|
+
const rows = useMemo11(
|
|
3906
3978
|
() => sortModel.length ? [..._rows].sort(sortComparator) : _rows,
|
|
3907
3979
|
[_rows, sortModel, sortComparator]
|
|
3908
3980
|
);
|
|
3909
|
-
const sortOrder =
|
|
3981
|
+
const sortOrder = useMemo11(
|
|
3910
3982
|
() => Array.from(new Set(_sortOrder || ["asc", "desc", null])),
|
|
3911
3983
|
[_sortOrder]
|
|
3912
3984
|
);
|
|
3913
3985
|
const [page, setPage] = useState9(paginationModel?.page || 1);
|
|
3914
3986
|
const pageSize = paginationModel?.pageSize || 20;
|
|
3915
|
-
const getId =
|
|
3987
|
+
const getId = useCallback12(
|
|
3916
3988
|
(row, index) => _getId?.(row) ?? row.id ?? `${(index || 0) + (page - 1) * pageSize}`,
|
|
3917
3989
|
[_getId, page, pageSize]
|
|
3918
3990
|
);
|
|
3919
|
-
const selectedModelSet =
|
|
3920
|
-
const dataInPage =
|
|
3991
|
+
const selectedModelSet = useMemo11(() => new Set(selectionModel || []), [selectionModel]);
|
|
3992
|
+
const dataInPage = useMemo11(
|
|
3921
3993
|
() => !pagination || paginationMode === "server" ? rows : rows.slice((page - 1) * pageSize, (page - 1) * pageSize + pageSize),
|
|
3922
3994
|
[rows, page, pageSize, paginationMode, pagination]
|
|
3923
3995
|
);
|
|
3924
|
-
const selectableDataInPage =
|
|
3996
|
+
const selectableDataInPage = useMemo11(
|
|
3925
3997
|
() => dataInPage.filter((row, i) => {
|
|
3926
3998
|
if (!isRowSelectable) return true;
|
|
3927
3999
|
return isRowSelectable({ row, id: getId(row, i) });
|
|
3928
4000
|
}),
|
|
3929
4001
|
[dataInPage, isRowSelectable, getId]
|
|
3930
4002
|
);
|
|
3931
|
-
const handleRangeSelection =
|
|
4003
|
+
const handleRangeSelection = useCallback12(
|
|
3932
4004
|
(anchor, targetIndex) => {
|
|
3933
4005
|
const startIndex = Math.min(anchor.rowIndex, targetIndex);
|
|
3934
4006
|
const endIndex = Math.max(anchor.rowIndex, targetIndex);
|
|
@@ -3951,40 +4023,41 @@ function useDataTableRenderer({
|
|
|
3951
4023
|
},
|
|
3952
4024
|
[dataInPage, getId, isRowSelectable, selectionModel, onSelectionModelChange]
|
|
3953
4025
|
);
|
|
3954
|
-
const isAllSelected =
|
|
4026
|
+
const isAllSelected = useMemo11(
|
|
3955
4027
|
() => selectableDataInPage.length > 0 && selectableDataInPage.every((row, i) => selectedModelSet.has(getId(row, i))),
|
|
3956
4028
|
[selectableDataInPage, selectedModelSet, getId]
|
|
3957
4029
|
);
|
|
3958
4030
|
const rowCount = totalRowsProp || rows.length;
|
|
3959
|
-
const selectableRowCount =
|
|
4031
|
+
const selectableRowCount = useMemo11(() => {
|
|
3960
4032
|
if (!isRowSelectable) return rowCount;
|
|
3961
4033
|
return rows.filter((row, i) => isRowSelectable({ row, id: getId(row, i) })).length;
|
|
3962
4034
|
}, [rows, isRowSelectable, getId, rowCount]);
|
|
3963
|
-
const isTotalSelected =
|
|
4035
|
+
const isTotalSelected = useMemo11(
|
|
3964
4036
|
() => _isTotalSelected ?? (selectableRowCount > 0 && (selectionModel?.length || 0) === selectableRowCount),
|
|
3965
4037
|
[_isTotalSelected, selectionModel, selectableRowCount]
|
|
3966
4038
|
);
|
|
3967
4039
|
const columnWidths = useColumnWidths(visibleColumnsByField);
|
|
3968
|
-
const getWidth =
|
|
3969
|
-
|
|
3970
|
-
allColumnsByField[f]?.
|
|
4040
|
+
const getWidth = useCallback12(
|
|
4041
|
+
// 반환값은 pinned offset으로 더해지므로 반드시 숫자여야 한다. width/minWidth는 '500px' 같은 문자열.
|
|
4042
|
+
(f) => columnWidths[f] ?? parsePxValue(allColumnsByField[f]?.width) ?? // Column prop 으로 지정된 width
|
|
4043
|
+
parsePxValue(allColumnsByField[f]?.minWidth) ?? 0,
|
|
3971
4044
|
[columnWidths, allColumnsByField]
|
|
3972
4045
|
);
|
|
3973
|
-
const processedColumnGroups =
|
|
4046
|
+
const processedColumnGroups = useMemo11(() => {
|
|
3974
4047
|
if (!columnGroupingModel) return null;
|
|
3975
4048
|
return calculateColumnGroups(columnGroupingModel, visibleColumns, visibleFieldSet);
|
|
3976
4049
|
}, [columnGroupingModel, visibleColumns, visibleFieldSet]);
|
|
3977
|
-
const effectivePinnedLeft =
|
|
4050
|
+
const effectivePinnedLeft = useMemo11(
|
|
3978
4051
|
() => pinnedColumns?.left?.filter((f) => visibleFieldSet.has(f)),
|
|
3979
4052
|
[pinnedColumns?.left, visibleFieldSet]
|
|
3980
4053
|
);
|
|
3981
|
-
const effectivePinnedRight =
|
|
4054
|
+
const effectivePinnedRight = useMemo11(
|
|
3982
4055
|
() => pinnedColumns?.right?.filter((f) => visibleFieldSet.has(f)),
|
|
3983
4056
|
[pinnedColumns?.right, visibleFieldSet]
|
|
3984
4057
|
);
|
|
3985
4058
|
const inferredFieldsKey = JSON.stringify(Object.keys(rows[0] || {}));
|
|
3986
|
-
const inferredFields =
|
|
3987
|
-
const columns =
|
|
4059
|
+
const inferredFields = useMemo11(() => JSON.parse(inferredFieldsKey), [inferredFieldsKey]);
|
|
4060
|
+
const columns = useMemo11(() => {
|
|
3988
4061
|
const baseColumns = visibleColumns.length > 0 ? visibleColumns : reorderedColumns.length > 0 ? [] : inferredFields.map((key) => ({
|
|
3989
4062
|
field: key
|
|
3990
4063
|
}));
|
|
@@ -4019,14 +4092,14 @@ function useDataTableRenderer({
|
|
|
4019
4092
|
sortOrder,
|
|
4020
4093
|
getWidth
|
|
4021
4094
|
]);
|
|
4022
|
-
const handlePageChange =
|
|
4095
|
+
const handlePageChange = useCallback12(
|
|
4023
4096
|
(newPage) => {
|
|
4024
4097
|
setPage(newPage);
|
|
4025
4098
|
onPaginationModelChange?.({ page: newPage, pageSize });
|
|
4026
4099
|
},
|
|
4027
4100
|
[onPaginationModelChange, pageSize]
|
|
4028
4101
|
);
|
|
4029
|
-
const handleSortChange =
|
|
4102
|
+
const handleSortChange = useCallback12(
|
|
4030
4103
|
(props) => {
|
|
4031
4104
|
const { field, currentSort, multiple } = props;
|
|
4032
4105
|
const column = allColumnsByField[field];
|
|
@@ -4064,23 +4137,22 @@ function useDataTableRenderer({
|
|
|
4064
4137
|
onSelectionModelChangeRef.current?.([]);
|
|
4065
4138
|
setSelectionAnchor(null);
|
|
4066
4139
|
}, [page]);
|
|
4067
|
-
const prevRowsRef =
|
|
4140
|
+
const prevRowsRef = useRef7(_rows);
|
|
4068
4141
|
useEffect6(() => {
|
|
4069
4142
|
if (prevRowsRef.current !== _rows) {
|
|
4070
4143
|
setSelectionAnchor(null);
|
|
4071
4144
|
prevRowsRef.current = _rows;
|
|
4072
4145
|
}
|
|
4073
4146
|
}, [_rows]);
|
|
4074
|
-
const handleAutoFit =
|
|
4147
|
+
const handleAutoFit = useCallback12(
|
|
4075
4148
|
(field) => {
|
|
4076
4149
|
const colDef = visibleColumnsByField[field];
|
|
4077
4150
|
if (!colDef?.headerRef.current) return;
|
|
4078
|
-
const
|
|
4079
|
-
const columnType = column && "type" in column ? column.type : void 0;
|
|
4151
|
+
const columnType = "type" in colDef ? colDef.type : void 0;
|
|
4080
4152
|
if (columnType === "actions") return;
|
|
4081
4153
|
const optimalWidth = computeAutoFitWidth({
|
|
4082
4154
|
headerEl: colDef.headerRef.current,
|
|
4083
|
-
field,
|
|
4155
|
+
field: colDef.field,
|
|
4084
4156
|
dataInPage
|
|
4085
4157
|
});
|
|
4086
4158
|
if (optimalWidth == null) return;
|
|
@@ -4088,7 +4160,7 @@ function useDataTableRenderer({
|
|
|
4088
4160
|
colDef.headerRef.current.style.width = widthPx;
|
|
4089
4161
|
if (colDef.tableColRef.current) colDef.tableColRef.current.style.width = widthPx;
|
|
4090
4162
|
},
|
|
4091
|
-
[visibleColumnsByField,
|
|
4163
|
+
[visibleColumnsByField, dataInPage]
|
|
4092
4164
|
);
|
|
4093
4165
|
return {
|
|
4094
4166
|
rowCount,
|
|
@@ -4104,8 +4176,8 @@ function useDataTableRenderer({
|
|
|
4104
4176
|
handleAutoFit,
|
|
4105
4177
|
isAllSelected,
|
|
4106
4178
|
isTotalSelected,
|
|
4107
|
-
isSelectedRow:
|
|
4108
|
-
isRowSelectable:
|
|
4179
|
+
isSelectedRow: useCallback12((model) => selectedModelSet.has(model), [selectedModelSet]),
|
|
4180
|
+
isRowSelectable: useCallback12(
|
|
4109
4181
|
(rowId, row) => {
|
|
4110
4182
|
if (!isRowSelectable) return true;
|
|
4111
4183
|
return isRowSelectable({ row, id: rowId });
|
|
@@ -4113,13 +4185,13 @@ function useDataTableRenderer({
|
|
|
4113
4185
|
[isRowSelectable]
|
|
4114
4186
|
),
|
|
4115
4187
|
focusedRowId,
|
|
4116
|
-
onRowFocus:
|
|
4188
|
+
onRowFocus: useCallback12((rowId) => {
|
|
4117
4189
|
setFocusedRowId(rowId);
|
|
4118
4190
|
}, []),
|
|
4119
|
-
onAllCheckboxChange:
|
|
4191
|
+
onAllCheckboxChange: useCallback12(() => {
|
|
4120
4192
|
onSelectionModelChange?.(isAllSelected ? [] : selectableDataInPage.map(getId));
|
|
4121
4193
|
}, [isAllSelected, selectableDataInPage, onSelectionModelChange, getId]),
|
|
4122
|
-
onCheckboxChange:
|
|
4194
|
+
onCheckboxChange: useCallback12(
|
|
4123
4195
|
(event, selectedModel) => {
|
|
4124
4196
|
const isShiftClick = "shiftKey" in event && event.shiftKey;
|
|
4125
4197
|
const rowIndex = dataInPage.findIndex((row, i) => getId(row, i) === selectedModel);
|
|
@@ -4153,7 +4225,7 @@ function useDataTableRenderer({
|
|
|
4153
4225
|
columns,
|
|
4154
4226
|
tableMinWidth,
|
|
4155
4227
|
processedColumnGroups,
|
|
4156
|
-
onTotalSelect:
|
|
4228
|
+
onTotalSelect: useCallback12(() => {
|
|
4157
4229
|
const selectableRows = rows.filter((row, i) => {
|
|
4158
4230
|
if (!isRowSelectable) return true;
|
|
4159
4231
|
return isRowSelectable({ row, id: getId(row, i) });
|
|
@@ -4238,7 +4310,7 @@ function TableBody(props) {
|
|
|
4238
4310
|
TableBody.displayName = "TableBody";
|
|
4239
4311
|
|
|
4240
4312
|
// src/components/Pagination/Pagination.tsx
|
|
4241
|
-
import React25, { useCallback as
|
|
4313
|
+
import React25, { useCallback as useCallback13, useEffect as useEffect7 } from "react";
|
|
4242
4314
|
import PreviousIcon from "@mui/icons-material/ChevronLeftRounded";
|
|
4243
4315
|
import NextIcon from "@mui/icons-material/ChevronRightRounded";
|
|
4244
4316
|
import FirstPageIcon from "@mui/icons-material/FirstPageRounded";
|
|
@@ -4308,7 +4380,7 @@ function Pagination(inProps) {
|
|
|
4308
4380
|
const [paginationModel, setPaginationModel] = useControlledState(
|
|
4309
4381
|
_paginationModel,
|
|
4310
4382
|
defaultPaginationModel,
|
|
4311
|
-
|
|
4383
|
+
useCallback13(
|
|
4312
4384
|
(newPage) => {
|
|
4313
4385
|
onPageChange(newPage.page);
|
|
4314
4386
|
},
|
|
@@ -4526,8 +4598,8 @@ function Component(props, apiRef) {
|
|
|
4526
4598
|
...innerProps
|
|
4527
4599
|
} = props;
|
|
4528
4600
|
const tableId = useId();
|
|
4529
|
-
const parentRef =
|
|
4530
|
-
const tableBodyRef =
|
|
4601
|
+
const parentRef = useRef8(null);
|
|
4602
|
+
const tableBodyRef = useRef8(null);
|
|
4531
4603
|
const {
|
|
4532
4604
|
columns,
|
|
4533
4605
|
processedColumnGroups,
|
|
@@ -4563,9 +4635,9 @@ function Component(props, apiRef) {
|
|
|
4563
4635
|
measureElement: (element) => element.clientHeight,
|
|
4564
4636
|
overscan: 10
|
|
4565
4637
|
});
|
|
4566
|
-
const paginationModel =
|
|
4638
|
+
const paginationModel = useMemo12(() => ({ page, pageSize }), [page, pageSize]);
|
|
4567
4639
|
const columnsKey = getObjectVersion(columns);
|
|
4568
|
-
const headerCheckboxElement =
|
|
4640
|
+
const headerCheckboxElement = useMemo12(
|
|
4569
4641
|
() => /* @__PURE__ */ React26.createElement(
|
|
4570
4642
|
RenderCheckbox,
|
|
4571
4643
|
{
|
|
@@ -4591,20 +4663,20 @@ function Component(props, apiRef) {
|
|
|
4591
4663
|
const showNoRowsOverlay = !loading && rowCount === 0;
|
|
4592
4664
|
const showFillerColumn = columns.length > 0 && columns.every((c) => !!c.width);
|
|
4593
4665
|
const totalColCount = Math.max(1, columns.length + (checkboxSelection ? 1 : 0) + (showFillerColumn ? 1 : 0));
|
|
4594
|
-
const getRowClickHandler =
|
|
4666
|
+
const getRowClickHandler = useCallback14(
|
|
4595
4667
|
(row, rowId) => (e) => {
|
|
4596
4668
|
onRowClick?.({ row, rowId }, e);
|
|
4597
4669
|
checkboxSelection && !disableSelectionOnClick && isRowSelectableCheck(rowId, row) && onCheckboxChange(e, rowId);
|
|
4598
4670
|
},
|
|
4599
4671
|
[onRowClick, checkboxSelection, disableSelectionOnClick, onCheckboxChange, isRowSelectableCheck]
|
|
4600
4672
|
);
|
|
4601
|
-
const getRowFocusHandler =
|
|
4673
|
+
const getRowFocusHandler = useCallback14(
|
|
4602
4674
|
(rowId) => () => {
|
|
4603
4675
|
onRowFocus(rowId);
|
|
4604
4676
|
},
|
|
4605
4677
|
[onRowFocus]
|
|
4606
4678
|
);
|
|
4607
|
-
const getCheckboxClickHandler =
|
|
4679
|
+
const getCheckboxClickHandler = useCallback14(
|
|
4608
4680
|
(rowId, row) => (e) => {
|
|
4609
4681
|
e.stopPropagation();
|
|
4610
4682
|
if (isRowSelectableCheck(rowId, row)) {
|
|
@@ -4614,7 +4686,7 @@ function Component(props, apiRef) {
|
|
|
4614
4686
|
},
|
|
4615
4687
|
[onCheckboxChange, isRowSelectableCheck, onRowFocus]
|
|
4616
4688
|
);
|
|
4617
|
-
const handleTableKeyDown =
|
|
4689
|
+
const handleTableKeyDown = useCallback14(
|
|
4618
4690
|
(e) => {
|
|
4619
4691
|
const supportedKeys = ["ArrowUp", "ArrowDown", " ", "Home", "End", "PageUp", "PageDown"];
|
|
4620
4692
|
if (!supportedKeys.includes(e.key)) return;
|
|
@@ -4775,7 +4847,7 @@ function Component(props, apiRef) {
|
|
|
4775
4847
|
"col",
|
|
4776
4848
|
{
|
|
4777
4849
|
ref: c.tableColRef,
|
|
4778
|
-
key:
|
|
4850
|
+
key: c.field.toString(),
|
|
4779
4851
|
style: {
|
|
4780
4852
|
width: c.width,
|
|
4781
4853
|
minWidth: c.minWidth ?? "50px"
|
|
@@ -4825,13 +4897,13 @@ function Component(props, apiRef) {
|
|
|
4825
4897
|
}
|
|
4826
4898
|
},
|
|
4827
4899
|
headerCheckboxElement
|
|
4828
|
-
), columns.map((c
|
|
4900
|
+
), columns.map((c) => (
|
|
4829
4901
|
// @ts-ignore
|
|
4830
4902
|
/* @__PURE__ */ React26.createElement(
|
|
4831
4903
|
HeadCell2,
|
|
4832
4904
|
{
|
|
4833
4905
|
tableId,
|
|
4834
|
-
key:
|
|
4906
|
+
key: c.field.toString(),
|
|
4835
4907
|
stickyHeader: props.stickyHeader,
|
|
4836
4908
|
editMode: !!c.isCellEditable,
|
|
4837
4909
|
onSortChange: handleSortChange,
|
|
@@ -4961,7 +5033,7 @@ var DataTable = forwardRef7(Component);
|
|
|
4961
5033
|
DataTable.displayName = "DataTable";
|
|
4962
5034
|
|
|
4963
5035
|
// src/components/DateRangePicker/DateRangePicker.tsx
|
|
4964
|
-
import React27, { forwardRef as forwardRef8, useCallback as
|
|
5036
|
+
import React27, { forwardRef as forwardRef8, useCallback as useCallback15, useEffect as useEffect8, useImperativeHandle as useImperativeHandle3, useMemo as useMemo13, useRef as useRef9, useState as useState10 } from "react";
|
|
4965
5037
|
import { IMaskInput as IMaskInput2, IMask as IMask2 } from "react-imask";
|
|
4966
5038
|
import CalendarTodayIcon2 from "@mui/icons-material/CalendarToday";
|
|
4967
5039
|
import { styled as styled14, useThemeProps as useThemeProps7 } from "@mui/joy";
|
|
@@ -5166,12 +5238,12 @@ var DateRangePicker = forwardRef8((inProps, ref) => {
|
|
|
5166
5238
|
numberOfMonths,
|
|
5167
5239
|
...innerProps
|
|
5168
5240
|
} = props;
|
|
5169
|
-
const innerRef =
|
|
5170
|
-
const buttonRef =
|
|
5241
|
+
const innerRef = useRef9(null);
|
|
5242
|
+
const buttonRef = useRef9(null);
|
|
5171
5243
|
const [rawValue, setValue] = useControlledState(
|
|
5172
5244
|
props.value,
|
|
5173
5245
|
props.defaultValue ?? null,
|
|
5174
|
-
|
|
5246
|
+
useCallback15(
|
|
5175
5247
|
(value2) => onChange?.({ target: { name: props.name, value: value2 ?? "" } }),
|
|
5176
5248
|
[props.name, onChange]
|
|
5177
5249
|
)
|
|
@@ -5183,7 +5255,7 @@ var DateRangePicker = forwardRef8((inProps, ref) => {
|
|
|
5183
5255
|
);
|
|
5184
5256
|
const [anchorEl, setAnchorEl] = useState10(null);
|
|
5185
5257
|
const open = Boolean(anchorEl);
|
|
5186
|
-
const calendarValue =
|
|
5258
|
+
const calendarValue = useMemo13(
|
|
5187
5259
|
() => value ? parseDates(value, format) : void 0,
|
|
5188
5260
|
[value, format]
|
|
5189
5261
|
);
|
|
@@ -5205,7 +5277,7 @@ var DateRangePicker = forwardRef8((inProps, ref) => {
|
|
|
5205
5277
|
}
|
|
5206
5278
|
}, [anchorEl, innerRef]);
|
|
5207
5279
|
useImperativeHandle3(ref, () => innerRef.current, [innerRef]);
|
|
5208
|
-
const handleChange =
|
|
5280
|
+
const handleChange = useCallback15(
|
|
5209
5281
|
(event) => {
|
|
5210
5282
|
const value2 = event.target.value;
|
|
5211
5283
|
setDisplayValue(value2 ? formatValueString2(parseDates(value2, format), displayFormat, locale) : value2);
|
|
@@ -5213,7 +5285,7 @@ var DateRangePicker = forwardRef8((inProps, ref) => {
|
|
|
5213
5285
|
},
|
|
5214
5286
|
[displayFormat, format, locale, setValue]
|
|
5215
5287
|
);
|
|
5216
|
-
const handleDisplayInputChange =
|
|
5288
|
+
const handleDisplayInputChange = useCallback15(
|
|
5217
5289
|
(event) => {
|
|
5218
5290
|
if (event.target.value === "") {
|
|
5219
5291
|
handleChange({
|
|
@@ -5238,14 +5310,14 @@ var DateRangePicker = forwardRef8((inProps, ref) => {
|
|
|
5238
5310
|
},
|
|
5239
5311
|
[displayFormat, format, handleChange, props.name]
|
|
5240
5312
|
);
|
|
5241
|
-
const handleCalendarToggle =
|
|
5313
|
+
const handleCalendarToggle = useCallback15(
|
|
5242
5314
|
(event) => {
|
|
5243
5315
|
setAnchorEl(anchorEl ? null : event.currentTarget);
|
|
5244
5316
|
innerRef.current?.focus();
|
|
5245
5317
|
},
|
|
5246
5318
|
[anchorEl, setAnchorEl, innerRef]
|
|
5247
5319
|
);
|
|
5248
|
-
const handleCalendarChange =
|
|
5320
|
+
const handleCalendarChange = useCallback15(
|
|
5249
5321
|
([date1, date2]) => {
|
|
5250
5322
|
if (!date1 || !date2) return;
|
|
5251
5323
|
const formattedValue = formatValueString2([date1, date2], format);
|
|
@@ -5259,7 +5331,7 @@ var DateRangePicker = forwardRef8((inProps, ref) => {
|
|
|
5259
5331
|
},
|
|
5260
5332
|
[props.value, props.name, onChange, setValue, setAnchorEl, format, displayFormat, locale]
|
|
5261
5333
|
);
|
|
5262
|
-
const handleInputMouseDown =
|
|
5334
|
+
const handleInputMouseDown = useCallback15(
|
|
5263
5335
|
(event) => {
|
|
5264
5336
|
if (inputReadOnly || isAlphabeticDisplay) {
|
|
5265
5337
|
event.preventDefault();
|
|
@@ -5268,7 +5340,7 @@ var DateRangePicker = forwardRef8((inProps, ref) => {
|
|
|
5268
5340
|
},
|
|
5269
5341
|
[inputReadOnly, isAlphabeticDisplay, buttonRef]
|
|
5270
5342
|
);
|
|
5271
|
-
const handleInputClick =
|
|
5343
|
+
const handleInputClick = useCallback15(
|
|
5272
5344
|
(event) => {
|
|
5273
5345
|
if (inputReadOnly && !readOnly) {
|
|
5274
5346
|
handleCalendarToggle(event);
|
|
@@ -5276,7 +5348,7 @@ var DateRangePicker = forwardRef8((inProps, ref) => {
|
|
|
5276
5348
|
},
|
|
5277
5349
|
[inputReadOnly, readOnly, handleCalendarToggle]
|
|
5278
5350
|
);
|
|
5279
|
-
const handlePresetClick =
|
|
5351
|
+
const handlePresetClick = useCallback15(
|
|
5280
5352
|
(presetValue) => {
|
|
5281
5353
|
if (props.value !== void 0) {
|
|
5282
5354
|
onChange?.({ target: { name: props.name, value: presetValue } });
|
|
@@ -5289,7 +5361,7 @@ var DateRangePicker = forwardRef8((inProps, ref) => {
|
|
|
5289
5361
|
},
|
|
5290
5362
|
[props.value, props.name, onChange, setValue, setAnchorEl, format, displayFormat, locale]
|
|
5291
5363
|
);
|
|
5292
|
-
const isPresetDisabled =
|
|
5364
|
+
const isPresetDisabled = useCallback15(
|
|
5293
5365
|
(presetValue) => {
|
|
5294
5366
|
try {
|
|
5295
5367
|
const dates = parseDates(presetValue, format);
|
|
@@ -5500,10 +5572,10 @@ var ModalClose = JoyModalClose;
|
|
|
5500
5572
|
var MotionModalOverflow = motion24(JoyModalOverflow);
|
|
5501
5573
|
var ModalOverflow = MotionModalOverflow;
|
|
5502
5574
|
ModalOverflow.displayName = "ModalOverflow";
|
|
5503
|
-
|
|
5575
|
+
var ModalFrame = React29.forwardRef((props, ref) => {
|
|
5504
5576
|
const { title, children, titleStartDecorator, onClose, ...innerProps } = props;
|
|
5505
|
-
return /* @__PURE__ */ React29.createElement(StyledModalDialog, { ...innerProps }, /* @__PURE__ */ React29.createElement(ModalClose, { onClick: onClose }), /* @__PURE__ */ React29.createElement(DialogTitle_default, null, titleStartDecorator, title), /* @__PURE__ */ React29.createElement(DialogContent_default, null, children));
|
|
5506
|
-
}
|
|
5577
|
+
return /* @__PURE__ */ React29.createElement(StyledModalDialog, { ...innerProps, ref }, /* @__PURE__ */ React29.createElement(ModalClose, { onClick: onClose }), /* @__PURE__ */ React29.createElement(DialogTitle_default, null, titleStartDecorator, title), /* @__PURE__ */ React29.createElement(DialogContent_default, null, children));
|
|
5578
|
+
});
|
|
5507
5579
|
ModalFrame.displayName = "ModalFrame";
|
|
5508
5580
|
|
|
5509
5581
|
// src/components/DialogFrame/DialogFrame.tsx
|
|
@@ -5548,14 +5620,14 @@ var InsetDrawer = styled20(JoyDrawer2)(({ theme }) => ({
|
|
|
5548
5620
|
}));
|
|
5549
5621
|
|
|
5550
5622
|
// src/components/FilterableCheckboxGroup/FilterableCheckboxGroup.tsx
|
|
5551
|
-
import React32, { useCallback as
|
|
5623
|
+
import React32, { useCallback as useCallback16, useEffect as useEffect9, useMemo as useMemo14, useRef as useRef10, useState as useState11 } from "react";
|
|
5552
5624
|
import SearchIcon from "@mui/icons-material/Search";
|
|
5553
5625
|
import { useThemeProps as useThemeProps8 } from "@mui/joy";
|
|
5554
5626
|
import { useVirtualizer as useVirtualizer3 } from "@tanstack/react-virtual";
|
|
5555
5627
|
var EMPTY_VALUE = [];
|
|
5556
5628
|
function LabelWithTooltip(props) {
|
|
5557
5629
|
const { label, size } = props;
|
|
5558
|
-
const labelContentRef =
|
|
5630
|
+
const labelContentRef = useRef10(null);
|
|
5559
5631
|
const [isOverflowing, setIsOverflowing] = useState11(false);
|
|
5560
5632
|
const labelContent = /* @__PURE__ */ React32.createElement(
|
|
5561
5633
|
"span",
|
|
@@ -5603,17 +5675,17 @@ function FilterableCheckboxGroup(inProps) {
|
|
|
5603
5675
|
const [rawValue, setInternalValue] = useControlledState(
|
|
5604
5676
|
value,
|
|
5605
5677
|
value ?? EMPTY_VALUE,
|
|
5606
|
-
|
|
5678
|
+
useCallback16((newValue) => onChange?.(newValue ?? []), [onChange])
|
|
5607
5679
|
);
|
|
5608
5680
|
const internalValue = rawValue ?? EMPTY_VALUE;
|
|
5609
|
-
const parentRef =
|
|
5610
|
-
const isInitialSortRef =
|
|
5611
|
-
const prevOptionsRef =
|
|
5612
|
-
const filteredOptions =
|
|
5681
|
+
const parentRef = useRef10(null);
|
|
5682
|
+
const isInitialSortRef = useRef10(false);
|
|
5683
|
+
const prevOptionsRef = useRef10([...options]);
|
|
5684
|
+
const filteredOptions = useMemo14(() => {
|
|
5613
5685
|
if (!searchTerm) return sortedOptions;
|
|
5614
5686
|
return sortedOptions.filter((option) => option.label.toLowerCase().includes(searchTerm.toLowerCase()));
|
|
5615
5687
|
}, [sortedOptions, searchTerm]);
|
|
5616
|
-
const itemSize =
|
|
5688
|
+
const itemSize = useMemo14(() => {
|
|
5617
5689
|
switch (size) {
|
|
5618
5690
|
case "sm":
|
|
5619
5691
|
return 28;
|
|
@@ -5660,10 +5732,10 @@ function FilterableCheckboxGroup(inProps) {
|
|
|
5660
5732
|
useEffect9(() => {
|
|
5661
5733
|
virtualizer.measure();
|
|
5662
5734
|
}, [virtualizer, filteredOptions, size]);
|
|
5663
|
-
const handleSearchChange =
|
|
5735
|
+
const handleSearchChange = useCallback16((event) => {
|
|
5664
5736
|
setSearchTerm(event.target.value);
|
|
5665
5737
|
}, []);
|
|
5666
|
-
const handleCheckboxChange =
|
|
5738
|
+
const handleCheckboxChange = useCallback16(
|
|
5667
5739
|
(optionValue) => (event) => {
|
|
5668
5740
|
const checked = event.target.checked;
|
|
5669
5741
|
const newValue = checked ? [...internalValue, optionValue] : internalValue.filter((v) => v !== optionValue);
|
|
@@ -5671,7 +5743,7 @@ function FilterableCheckboxGroup(inProps) {
|
|
|
5671
5743
|
},
|
|
5672
5744
|
[internalValue, setInternalValue]
|
|
5673
5745
|
);
|
|
5674
|
-
const handleSelectAll =
|
|
5746
|
+
const handleSelectAll = useCallback16(
|
|
5675
5747
|
(event) => {
|
|
5676
5748
|
const checked = event.target.checked;
|
|
5677
5749
|
const enabledOptions = filteredOptions.filter((option) => !option.disabled);
|
|
@@ -5687,7 +5759,7 @@ function FilterableCheckboxGroup(inProps) {
|
|
|
5687
5759
|
},
|
|
5688
5760
|
[filteredOptions, internalValue, setInternalValue]
|
|
5689
5761
|
);
|
|
5690
|
-
const enabledFilteredOptions =
|
|
5762
|
+
const enabledFilteredOptions = useMemo14(() => filteredOptions.filter((option) => !option.disabled), [filteredOptions]);
|
|
5691
5763
|
const isAllSelected = enabledFilteredOptions.length > 0 && enabledFilteredOptions.every((option) => internalValue.includes(option.value));
|
|
5692
5764
|
const isIndeterminate = !isAllSelected && enabledFilteredOptions.some((option) => internalValue.includes(option.value));
|
|
5693
5765
|
return /* @__PURE__ */ React32.createElement("div", { style: { width: "100%" } }, /* @__PURE__ */ React32.createElement(
|
|
@@ -5783,7 +5855,10 @@ import {
|
|
|
5783
5855
|
MenuButton as JoyMenuButton2,
|
|
5784
5856
|
IconButton as JoyIconButton2
|
|
5785
5857
|
} from "@mui/joy";
|
|
5786
|
-
function
|
|
5858
|
+
var MenuButtonRootSlot = React33.forwardRef(function MenuButtonRootSlot2({ as, ownerState: _ownerState, ...rest }, ref) {
|
|
5859
|
+
return /* @__PURE__ */ React33.createElement(JoyIconButton2, { ...rest, component: as ?? "button", ref });
|
|
5860
|
+
});
|
|
5861
|
+
function IconMenuButtonInner(props, ref) {
|
|
5787
5862
|
const {
|
|
5788
5863
|
size,
|
|
5789
5864
|
icon,
|
|
@@ -5794,6 +5869,8 @@ function IconMenuButton(props) {
|
|
|
5794
5869
|
variant = "plain",
|
|
5795
5870
|
placement = "bottom"
|
|
5796
5871
|
} = props;
|
|
5872
|
+
const { ref: buttonComponentRef, ...buttonComponentProps } = props.buttonComponentProps ?? {};
|
|
5873
|
+
const mergedButtonRef = useMergedRef(buttonComponentRef, ref);
|
|
5797
5874
|
if (!items.length) {
|
|
5798
5875
|
return /* @__PURE__ */ React33.createElement(
|
|
5799
5876
|
JoyIconButton2,
|
|
@@ -5804,7 +5881,8 @@ function IconMenuButton(props) {
|
|
|
5804
5881
|
color,
|
|
5805
5882
|
disabled,
|
|
5806
5883
|
loading,
|
|
5807
|
-
...
|
|
5884
|
+
...buttonComponentProps,
|
|
5885
|
+
ref: mergedButtonRef
|
|
5808
5886
|
},
|
|
5809
5887
|
icon
|
|
5810
5888
|
);
|
|
@@ -5812,22 +5890,26 @@ function IconMenuButton(props) {
|
|
|
5812
5890
|
return /* @__PURE__ */ React33.createElement(Dropdown_default, null, /* @__PURE__ */ React33.createElement(
|
|
5813
5891
|
JoyMenuButton2,
|
|
5814
5892
|
{
|
|
5815
|
-
slots: { root:
|
|
5893
|
+
slots: { root: MenuButtonRootSlot },
|
|
5816
5894
|
slotProps: {
|
|
5817
5895
|
root: {
|
|
5818
|
-
|
|
5896
|
+
// 기본값 'button'은 MenuButtonRootSlot 한 곳에만 둔다.
|
|
5897
|
+
component: props.buttonComponent,
|
|
5819
5898
|
size,
|
|
5820
5899
|
variant,
|
|
5821
5900
|
color,
|
|
5822
5901
|
disabled,
|
|
5823
5902
|
loading,
|
|
5824
|
-
...
|
|
5903
|
+
...buttonComponentProps,
|
|
5904
|
+
// Joy의 useSlot이 내부 ref와 이 ref를 합쳐준다. 위 no-items 분기와 같은 경로로 ref를 넘긴다.
|
|
5905
|
+
ref: mergedButtonRef
|
|
5825
5906
|
}
|
|
5826
5907
|
}
|
|
5827
5908
|
},
|
|
5828
5909
|
icon
|
|
5829
5910
|
), /* @__PURE__ */ React33.createElement(Menu, { placement, size }, items.map((i) => /* @__PURE__ */ React33.createElement(MenuItem, { key: i.text, component: i.component, ...i.componentProps ?? {} }, i.text))));
|
|
5830
5911
|
}
|
|
5912
|
+
var IconMenuButton = React33.forwardRef(IconMenuButtonInner);
|
|
5831
5913
|
IconMenuButton.displayName = "IconMenuButton";
|
|
5832
5914
|
|
|
5833
5915
|
// src/components/Markdown/Markdown.tsx
|
|
@@ -6019,7 +6101,7 @@ function MenuButton2(props) {
|
|
|
6019
6101
|
MenuButton2.displayName = "MenuButton";
|
|
6020
6102
|
|
|
6021
6103
|
// src/components/MonthPicker/MonthPicker.tsx
|
|
6022
|
-
import React36, { forwardRef as forwardRef9, useCallback as
|
|
6104
|
+
import React36, { forwardRef as forwardRef9, useCallback as useCallback17, useEffect as useEffect11, useImperativeHandle as useImperativeHandle4, useRef as useRef11, useState as useState13 } from "react";
|
|
6023
6105
|
import CalendarTodayIcon3 from "@mui/icons-material/CalendarToday";
|
|
6024
6106
|
import { styled as styled21, useThemeProps as useThemeProps9 } from "@mui/joy";
|
|
6025
6107
|
import { FocusTrap as FocusTrap3, ClickAwayListener as ClickAwayListener3, Popper as Popper4 } from "@mui/base";
|
|
@@ -6102,18 +6184,18 @@ var MonthPicker = forwardRef9((inProps, ref) => {
|
|
|
6102
6184
|
locale,
|
|
6103
6185
|
...innerProps
|
|
6104
6186
|
} = props;
|
|
6105
|
-
const innerRef =
|
|
6106
|
-
const buttonRef =
|
|
6187
|
+
const innerRef = useRef11(null);
|
|
6188
|
+
const buttonRef = useRef11(null);
|
|
6107
6189
|
const [rawValue, setValue, isControlled] = useControlledState(
|
|
6108
6190
|
props.value,
|
|
6109
6191
|
props.defaultValue ?? null,
|
|
6110
|
-
|
|
6192
|
+
useCallback17(
|
|
6111
6193
|
(value2) => onChange?.({ target: { name: props.name, value: value2 ?? "" } }),
|
|
6112
6194
|
[props.name, onChange]
|
|
6113
6195
|
)
|
|
6114
6196
|
);
|
|
6115
6197
|
const value = rawValue ?? "";
|
|
6116
|
-
const getFormattedDisplayValue =
|
|
6198
|
+
const getFormattedDisplayValue = useCallback17(
|
|
6117
6199
|
(inputValue) => {
|
|
6118
6200
|
if (!inputValue) return "";
|
|
6119
6201
|
try {
|
|
@@ -6136,7 +6218,7 @@ var MonthPicker = forwardRef9((inProps, ref) => {
|
|
|
6136
6218
|
useEffect11(() => {
|
|
6137
6219
|
setDisplayValue(getFormattedDisplayValue(value));
|
|
6138
6220
|
}, [value, getFormattedDisplayValue]);
|
|
6139
|
-
const handleChange =
|
|
6221
|
+
const handleChange = useCallback17(
|
|
6140
6222
|
(event) => {
|
|
6141
6223
|
const newValue = event.target.value;
|
|
6142
6224
|
setValue(newValue);
|
|
@@ -6146,14 +6228,14 @@ var MonthPicker = forwardRef9((inProps, ref) => {
|
|
|
6146
6228
|
},
|
|
6147
6229
|
[setValue, getFormattedDisplayValue, isControlled]
|
|
6148
6230
|
);
|
|
6149
|
-
const handleCalendarToggle =
|
|
6231
|
+
const handleCalendarToggle = useCallback17(
|
|
6150
6232
|
(event) => {
|
|
6151
6233
|
setAnchorEl(anchorEl ? null : event.currentTarget);
|
|
6152
6234
|
innerRef.current?.focus();
|
|
6153
6235
|
},
|
|
6154
6236
|
[anchorEl, setAnchorEl, innerRef]
|
|
6155
6237
|
);
|
|
6156
|
-
const handleInputMouseDown =
|
|
6238
|
+
const handleInputMouseDown = useCallback17(
|
|
6157
6239
|
(event) => {
|
|
6158
6240
|
event.preventDefault();
|
|
6159
6241
|
buttonRef.current?.focus();
|
|
@@ -6277,7 +6359,7 @@ var MonthPicker = forwardRef9((inProps, ref) => {
|
|
|
6277
6359
|
});
|
|
6278
6360
|
|
|
6279
6361
|
// src/components/MonthRangePicker/MonthRangePicker.tsx
|
|
6280
|
-
import React37, { forwardRef as forwardRef10, useCallback as
|
|
6362
|
+
import React37, { forwardRef as forwardRef10, useCallback as useCallback18, useEffect as useEffect12, useImperativeHandle as useImperativeHandle5, useMemo as useMemo15, useRef as useRef12, useState as useState14 } from "react";
|
|
6281
6363
|
import { IMaskInput as IMaskInput3, IMask as IMask3 } from "react-imask";
|
|
6282
6364
|
import CalendarTodayIcon4 from "@mui/icons-material/CalendarToday";
|
|
6283
6365
|
import { styled as styled22, useThemeProps as useThemeProps10 } from "@mui/joy";
|
|
@@ -6392,12 +6474,12 @@ var MonthRangePicker = forwardRef10((inProps, ref) => {
|
|
|
6392
6474
|
} = props;
|
|
6393
6475
|
const displayFormat = displayFormatProp ?? format;
|
|
6394
6476
|
const isAlphabeticDisplay = hasAlphabeticMonth3(displayFormat);
|
|
6395
|
-
const innerRef =
|
|
6396
|
-
const buttonRef =
|
|
6477
|
+
const innerRef = useRef12(null);
|
|
6478
|
+
const buttonRef = useRef12(null);
|
|
6397
6479
|
const [rawValue, setValue] = useControlledState(
|
|
6398
6480
|
props.value,
|
|
6399
6481
|
props.defaultValue ?? null,
|
|
6400
|
-
|
|
6482
|
+
useCallback18(
|
|
6401
6483
|
(value2) => onChange?.({ target: { name: props.name, value: value2 ?? "" } }),
|
|
6402
6484
|
[props.name, onChange]
|
|
6403
6485
|
)
|
|
@@ -6408,7 +6490,7 @@ var MonthRangePicker = forwardRef10((inProps, ref) => {
|
|
|
6408
6490
|
);
|
|
6409
6491
|
const [anchorEl, setAnchorEl] = useState14(null);
|
|
6410
6492
|
const open = Boolean(anchorEl);
|
|
6411
|
-
const calendarValue =
|
|
6493
|
+
const calendarValue = useMemo15(() => value ? parseDates2(value) : void 0, [value]);
|
|
6412
6494
|
useEffect12(() => {
|
|
6413
6495
|
if (value) {
|
|
6414
6496
|
try {
|
|
@@ -6427,7 +6509,7 @@ var MonthRangePicker = forwardRef10((inProps, ref) => {
|
|
|
6427
6509
|
}
|
|
6428
6510
|
}, [anchorEl, innerRef]);
|
|
6429
6511
|
useImperativeHandle5(ref, () => innerRef.current, [innerRef]);
|
|
6430
|
-
const handleChange =
|
|
6512
|
+
const handleChange = useCallback18(
|
|
6431
6513
|
(event) => {
|
|
6432
6514
|
setDisplayValue(
|
|
6433
6515
|
event.target.value ? formatValueString4(parseDates2(event.target.value), displayFormat, locale) : ""
|
|
@@ -6436,7 +6518,7 @@ var MonthRangePicker = forwardRef10((inProps, ref) => {
|
|
|
6436
6518
|
},
|
|
6437
6519
|
[displayFormat, locale, setValue]
|
|
6438
6520
|
);
|
|
6439
|
-
const handleInputMouseDown =
|
|
6521
|
+
const handleInputMouseDown = useCallback18(
|
|
6440
6522
|
(event) => {
|
|
6441
6523
|
if (isAlphabeticDisplay) {
|
|
6442
6524
|
event.preventDefault();
|
|
@@ -6445,14 +6527,14 @@ var MonthRangePicker = forwardRef10((inProps, ref) => {
|
|
|
6445
6527
|
},
|
|
6446
6528
|
[isAlphabeticDisplay, buttonRef]
|
|
6447
6529
|
);
|
|
6448
|
-
const handleCalendarToggle =
|
|
6530
|
+
const handleCalendarToggle = useCallback18(
|
|
6449
6531
|
(event) => {
|
|
6450
6532
|
setAnchorEl(anchorEl ? null : event.currentTarget);
|
|
6451
6533
|
innerRef.current?.focus();
|
|
6452
6534
|
},
|
|
6453
6535
|
[anchorEl, setAnchorEl, innerRef]
|
|
6454
6536
|
);
|
|
6455
|
-
const handleCalendarChange =
|
|
6537
|
+
const handleCalendarChange = useCallback18(
|
|
6456
6538
|
([date1, date2]) => {
|
|
6457
6539
|
if (!date1 || !date2) return;
|
|
6458
6540
|
const formattedValue = formatValueString4([date1, date2], format);
|
|
@@ -6691,7 +6773,7 @@ function Navigator(props) {
|
|
|
6691
6773
|
Navigator.displayName = "Navigator";
|
|
6692
6774
|
|
|
6693
6775
|
// src/components/PercentageInput/PercentageInput.tsx
|
|
6694
|
-
import React41, { useCallback as
|
|
6776
|
+
import React41, { useCallback as useCallback19, useMemo as useMemo16 } from "react";
|
|
6695
6777
|
import { NumericFormat as NumericFormat2 } from "react-number-format";
|
|
6696
6778
|
import { styled as styled25, useThemeProps as useThemeProps11 } from "@mui/joy";
|
|
6697
6779
|
var padDecimal = (value, decimalScale) => {
|
|
@@ -6748,19 +6830,19 @@ var PercentageInput = React41.forwardRef(
|
|
|
6748
6830
|
const [_value, setValue] = useControlledState(
|
|
6749
6831
|
props.value,
|
|
6750
6832
|
props.defaultValue ?? null,
|
|
6751
|
-
|
|
6833
|
+
useCallback19((value2) => onChange?.({ target: { name, value: value2 } }), [onChange, name])
|
|
6752
6834
|
);
|
|
6753
|
-
const value =
|
|
6835
|
+
const value = useMemo16(() => {
|
|
6754
6836
|
if (_value && useMinorUnit) {
|
|
6755
6837
|
return _value / Math.pow(10, maxDecimalScale);
|
|
6756
6838
|
}
|
|
6757
6839
|
return _value;
|
|
6758
6840
|
}, [_value, useMinorUnit, maxDecimalScale]);
|
|
6759
|
-
const internalError =
|
|
6841
|
+
const internalError = useMemo16(
|
|
6760
6842
|
() => value != null && (max != null && value > max || min != null && value < min),
|
|
6761
6843
|
[max, min, value]
|
|
6762
6844
|
);
|
|
6763
|
-
const handleChange =
|
|
6845
|
+
const handleChange = useCallback19(
|
|
6764
6846
|
(event) => {
|
|
6765
6847
|
if (event.target.value === "") {
|
|
6766
6848
|
setValue(null);
|
|
@@ -7522,7 +7604,7 @@ function ThemeProvider(props) {
|
|
|
7522
7604
|
ThemeProvider.displayName = "ThemeProvider";
|
|
7523
7605
|
|
|
7524
7606
|
// src/components/Uploader/Uploader.tsx
|
|
7525
|
-
import React49, { useCallback as
|
|
7607
|
+
import React49, { useCallback as useCallback20, useEffect as useEffect13, useMemo as useMemo17, useRef as useRef13, useState as useState16 } from "react";
|
|
7526
7608
|
import { styled as styled31, Input as Input2 } from "@mui/joy";
|
|
7527
7609
|
import MuiFileUploadIcon from "@mui/icons-material/CloudUploadRounded";
|
|
7528
7610
|
import MuiUploadFileIcon from "@mui/icons-material/UploadFileRounded";
|
|
@@ -7656,14 +7738,14 @@ var Uploader = React49.memo((props) => {
|
|
|
7656
7738
|
error: errorProp,
|
|
7657
7739
|
helperText: helperTextProp
|
|
7658
7740
|
} = props;
|
|
7659
|
-
const dropZoneRef =
|
|
7660
|
-
const inputRef =
|
|
7741
|
+
const dropZoneRef = useRef13(null);
|
|
7742
|
+
const inputRef = useRef13(null);
|
|
7661
7743
|
const [errorText, setErrorText] = useState16();
|
|
7662
7744
|
const [files, setFiles] = useState16([]);
|
|
7663
7745
|
const [uploaded, setUploaded] = useState16(props.uploaded || []);
|
|
7664
7746
|
const [previewState, setPreviewState] = useState16("idle");
|
|
7665
|
-
const accepts =
|
|
7666
|
-
const parsedAccepts =
|
|
7747
|
+
const accepts = useMemo17(() => accept.split(",").map((accept2) => accept2.trim()), [accept]);
|
|
7748
|
+
const parsedAccepts = useMemo17(
|
|
7667
7749
|
() => accepts.flatMap((type) => {
|
|
7668
7750
|
if (["image/*", "video/*", "audio/*"].includes(type)) {
|
|
7669
7751
|
return ALL_EXTENSIONS_BY_TYPE[type];
|
|
@@ -7672,7 +7754,7 @@ var Uploader = React49.memo((props) => {
|
|
|
7672
7754
|
}),
|
|
7673
7755
|
[accepts]
|
|
7674
7756
|
);
|
|
7675
|
-
const helperText =
|
|
7757
|
+
const helperText = useMemo17(() => {
|
|
7676
7758
|
if (helperTextProp) {
|
|
7677
7759
|
return helperTextProp;
|
|
7678
7760
|
}
|
|
@@ -7702,12 +7784,12 @@ var Uploader = React49.memo((props) => {
|
|
|
7702
7784
|
}
|
|
7703
7785
|
return helperTexts.join(", ");
|
|
7704
7786
|
}, [accepts, maxFileTotalSize, maxCount, helperTextProp]);
|
|
7705
|
-
const error =
|
|
7706
|
-
const showDropZone =
|
|
7787
|
+
const error = useMemo17(() => !!errorText || errorProp, [errorProp, errorText]);
|
|
7788
|
+
const showDropZone = useMemo17(
|
|
7707
7789
|
() => !maxCount || maxCount && [...uploaded, ...files].length !== maxCount,
|
|
7708
7790
|
[files, maxCount, uploaded]
|
|
7709
7791
|
);
|
|
7710
|
-
const addFiles =
|
|
7792
|
+
const addFiles = useCallback20(
|
|
7711
7793
|
(uploads) => {
|
|
7712
7794
|
try {
|
|
7713
7795
|
const types = parsedAccepts.map((type) => type.replace(".", "")) || [];
|
|
@@ -7789,14 +7871,14 @@ var Uploader = React49.memo((props) => {
|
|
|
7789
7871
|
}
|
|
7790
7872
|
}
|
|
7791
7873
|
}, [inputRef, files, minCount]);
|
|
7792
|
-
const handleFileChanged =
|
|
7874
|
+
const handleFileChanged = useCallback20(
|
|
7793
7875
|
(event) => {
|
|
7794
7876
|
const files2 = Array.from(event.target.files || []);
|
|
7795
7877
|
addFiles(files2);
|
|
7796
7878
|
},
|
|
7797
7879
|
[addFiles]
|
|
7798
7880
|
);
|
|
7799
|
-
const handleDeleteFile =
|
|
7881
|
+
const handleDeleteFile = useCallback20(
|
|
7800
7882
|
(deletedFile) => {
|
|
7801
7883
|
if (deletedFile instanceof File) {
|
|
7802
7884
|
setFiles((current) => {
|
|
@@ -7816,7 +7898,7 @@ var Uploader = React49.memo((props) => {
|
|
|
7816
7898
|
},
|
|
7817
7899
|
[name, onChange, onDelete]
|
|
7818
7900
|
);
|
|
7819
|
-
const handleUploaderButtonClick =
|
|
7901
|
+
const handleUploaderButtonClick = useCallback20(() => {
|
|
7820
7902
|
inputRef.current?.click();
|
|
7821
7903
|
}, []);
|
|
7822
7904
|
const uploader = /* @__PURE__ */ React49.createElement(
|