@ceed/ads 1.41.3-next.1 → 1.41.3-next.3
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/components.d.ts +1 -1
- package/dist/components/DataTable/hooks.d.ts +6 -7
- package/dist/components/DataTable/types.d.ts +7 -0
- package/dist/components/DataTable/utils.d.ts +5 -0
- package/dist/components/IconMenuButton/IconMenuButton.d.ts +6 -5
- 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 +3 -4
- 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 +4 -0
- package/dist/index.browser.js +6 -6
- package/dist/index.browser.js.map +4 -4
- package/dist/index.cjs +801 -708
- package/dist/index.js +263 -170
- 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
|
@@ -182,7 +182,7 @@ function Alert(inProps) {
|
|
|
182
182
|
Alert.displayName = "Alert";
|
|
183
183
|
|
|
184
184
|
// src/components/Autocomplete/Autocomplete.tsx
|
|
185
|
-
import React5, { useCallback as useCallback2, useEffect as useEffect2, useMemo, useRef as useRef2 } from "react";
|
|
185
|
+
import React5, { useCallback as useCallback2, useEffect as useEffect2, useMemo as useMemo2, useRef as useRef2 } from "react";
|
|
186
186
|
import {
|
|
187
187
|
Autocomplete as JoyAutocomplete,
|
|
188
188
|
AutocompleteOption as JoyAutocompleteOption,
|
|
@@ -284,6 +284,37 @@ function useControlledState(controlledValue, defaultValue, onChange) {
|
|
|
284
284
|
return [displayValue, handleChange, isControlled];
|
|
285
285
|
}
|
|
286
286
|
|
|
287
|
+
// src/libs/slot-props.ts
|
|
288
|
+
import { useMemo } from "react";
|
|
289
|
+
function assignRef(ref, value) {
|
|
290
|
+
if (typeof ref === "function") ref(value);
|
|
291
|
+
else if (ref) ref.current = value;
|
|
292
|
+
}
|
|
293
|
+
function mergeRefs(...refs) {
|
|
294
|
+
const live = refs.filter((r) => r != null);
|
|
295
|
+
if (live.length === 0) return void 0;
|
|
296
|
+
if (live.length === 1) return live[0];
|
|
297
|
+
return (value) => live.forEach((r) => assignRef(r, value));
|
|
298
|
+
}
|
|
299
|
+
function useMergedRef(a, b) {
|
|
300
|
+
return useMemo(() => mergeRefs(a, b), [a, b]);
|
|
301
|
+
}
|
|
302
|
+
function useSlotRef(slotProp, ref) {
|
|
303
|
+
const isFunctionForm = typeof slotProp === "function";
|
|
304
|
+
const slotRef = isFunctionForm ? void 0 : slotProp?.ref;
|
|
305
|
+
const mergedRef = useMergedRef(slotRef, ref);
|
|
306
|
+
return useMemo(() => {
|
|
307
|
+
if (isFunctionForm) {
|
|
308
|
+
return ((ownerState) => {
|
|
309
|
+
const resolved = slotProp(ownerState);
|
|
310
|
+
const merged = mergeRefs(resolved.ref, ref);
|
|
311
|
+
return merged ? { ...resolved, ref: merged } : { ...resolved };
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
return mergedRef ? { ...slotProp, ref: mergedRef } : { ...slotProp };
|
|
315
|
+
}, [isFunctionForm, slotProp, mergedRef, ref]);
|
|
316
|
+
}
|
|
317
|
+
|
|
287
318
|
// src/components/Autocomplete/Autocomplete.tsx
|
|
288
319
|
var AutocompletePopper = styled3(Popper, {
|
|
289
320
|
name: "Autocomplete",
|
|
@@ -308,11 +339,11 @@ var AutocompleteListBox = React5.forwardRef((props, ref) => {
|
|
|
308
339
|
} = props;
|
|
309
340
|
const parentRef = useRef2(null);
|
|
310
341
|
const isGrouped = children[0].every((child) => child.hasOwnProperty("group"));
|
|
311
|
-
const itemHeight =
|
|
342
|
+
const itemHeight = useMemo2(() => {
|
|
312
343
|
const heights = itemHeightMap[fontSize ?? "md"];
|
|
313
344
|
return hasSecondaryText ? heights.secondary : heights.default;
|
|
314
345
|
}, [fontSize, hasSecondaryText]);
|
|
315
|
-
const renderTargets =
|
|
346
|
+
const renderTargets = useMemo2(() => {
|
|
316
347
|
if (loading) {
|
|
317
348
|
return [children[1]];
|
|
318
349
|
}
|
|
@@ -404,7 +435,7 @@ var autocompleteFilterOptions = createFilterOptions({
|
|
|
404
435
|
}
|
|
405
436
|
});
|
|
406
437
|
var getOptionLabel = (option) => `${option.label ?? ""}`;
|
|
407
|
-
function
|
|
438
|
+
function AutocompleteInner(props, ref) {
|
|
408
439
|
const {
|
|
409
440
|
label,
|
|
410
441
|
error,
|
|
@@ -434,7 +465,7 @@ function Autocomplete(props) {
|
|
|
434
465
|
)
|
|
435
466
|
);
|
|
436
467
|
const _value = rawValue ?? (props.multiple ? EMPTY_MULTIPLE_VALUE : "");
|
|
437
|
-
const options =
|
|
468
|
+
const options = useMemo2(
|
|
438
469
|
() => props.options.map((option) => {
|
|
439
470
|
if (typeof option !== "object") {
|
|
440
471
|
return {
|
|
@@ -446,14 +477,14 @@ function Autocomplete(props) {
|
|
|
446
477
|
}),
|
|
447
478
|
[props.options]
|
|
448
479
|
);
|
|
449
|
-
const optionMap =
|
|
480
|
+
const optionMap = useMemo2(() => {
|
|
450
481
|
const map = /* @__PURE__ */ new Map();
|
|
451
482
|
options.forEach((option) => {
|
|
452
483
|
map.set(option.value, option);
|
|
453
484
|
});
|
|
454
485
|
return map;
|
|
455
486
|
}, [options]);
|
|
456
|
-
const value =
|
|
487
|
+
const value = useMemo2(() => {
|
|
457
488
|
if (props.loading) {
|
|
458
489
|
return {
|
|
459
490
|
value: "",
|
|
@@ -472,23 +503,25 @@ function Autocomplete(props) {
|
|
|
472
503
|
},
|
|
473
504
|
[size, props.loading]
|
|
474
505
|
);
|
|
475
|
-
const startDecorator =
|
|
506
|
+
const startDecorator = useMemo2(
|
|
476
507
|
() => applySize(value?.startDecorator || props.startDecorator),
|
|
477
508
|
[value, applySize, props.startDecorator]
|
|
478
509
|
);
|
|
479
|
-
const endDecorator =
|
|
510
|
+
const endDecorator = useMemo2(
|
|
480
511
|
() => applySize(value?.endDecorator || props.endDecorator),
|
|
481
512
|
[value, applySize, props.endDecorator]
|
|
482
513
|
);
|
|
483
|
-
const
|
|
514
|
+
const inputSlotProps = useSlotRef(props.slotProps?.input, ref);
|
|
515
|
+
const slotProps = useMemo2(
|
|
484
516
|
() => ({
|
|
485
517
|
...props.slotProps,
|
|
486
518
|
listbox: {
|
|
487
519
|
...props.slotProps?.listbox,
|
|
488
520
|
hasSecondaryText: options.some((opt) => opt.secondaryText)
|
|
489
|
-
}
|
|
521
|
+
},
|
|
522
|
+
input: inputSlotProps
|
|
490
523
|
}),
|
|
491
|
-
[options, props.slotProps]
|
|
524
|
+
[options, props.slotProps, inputSlotProps]
|
|
492
525
|
);
|
|
493
526
|
const handleChange = useCallback2(
|
|
494
527
|
(event, value2) => {
|
|
@@ -522,9 +555,9 @@ function Autocomplete(props) {
|
|
|
522
555
|
endDecorator,
|
|
523
556
|
getOptionLabel,
|
|
524
557
|
renderTags: (tags, getTagProps) => tags.map((tag, index) => {
|
|
525
|
-
const { onClick, ...rest } = getTagProps({ index });
|
|
558
|
+
const { onClick, key, ...rest } = getTagProps({ index });
|
|
526
559
|
return applySize(
|
|
527
|
-
/* @__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(
|
|
560
|
+
/* @__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(
|
|
528
561
|
/* @__PURE__ */ React5.createElement(AutocompleteTagDelete, { color: "primary", variant: "soft", onClick, size }, /* @__PURE__ */ React5.createElement(CloseIcon, null))
|
|
529
562
|
)))
|
|
530
563
|
);
|
|
@@ -534,26 +567,29 @@ function Autocomplete(props) {
|
|
|
534
567
|
},
|
|
535
568
|
slotProps,
|
|
536
569
|
filterOptions: autocompleteFilterOptions,
|
|
537
|
-
renderOption: (props2, option) =>
|
|
538
|
-
|
|
539
|
-
{
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
applySize(option.label)
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
570
|
+
renderOption: (props2, option) => {
|
|
571
|
+
const { key, ...optionProps } = props2;
|
|
572
|
+
return /* @__PURE__ */ React5.createElement(JoyAutocompleteOption, { key, ...optionProps }, option.startDecorator && /* @__PURE__ */ React5.createElement(
|
|
573
|
+
ListItemDecorator,
|
|
574
|
+
{
|
|
575
|
+
sx: (theme) => ({
|
|
576
|
+
marginInlineEnd: `var(--Input-gap, ${theme.spacing(1)})`
|
|
577
|
+
})
|
|
578
|
+
},
|
|
579
|
+
applySize(option.startDecorator)
|
|
580
|
+
), 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)) : (
|
|
581
|
+
// TODO: haulla에서 사용할 때, label을 ReactNode로 넘기면 에러가 발생함....
|
|
582
|
+
applySize(option.label)
|
|
583
|
+
), option.endDecorator && /* @__PURE__ */ React5.createElement(
|
|
584
|
+
ListItemDecorator,
|
|
585
|
+
{
|
|
586
|
+
sx: (theme) => ({
|
|
587
|
+
marginInlineStart: `var(--Input-gap, ${theme.spacing(1)})`
|
|
588
|
+
})
|
|
589
|
+
},
|
|
590
|
+
applySize(option.endDecorator)
|
|
591
|
+
));
|
|
592
|
+
},
|
|
557
593
|
renderGroup: (params) => params
|
|
558
594
|
}
|
|
559
595
|
);
|
|
@@ -573,13 +609,14 @@ function Autocomplete(props) {
|
|
|
573
609
|
helperText && /* @__PURE__ */ React5.createElement(FormHelperText_default, null, helperText)
|
|
574
610
|
);
|
|
575
611
|
}
|
|
612
|
+
var Autocomplete = React5.forwardRef(AutocompleteInner);
|
|
576
613
|
Autocomplete.displayName = "Autocomplete";
|
|
577
614
|
|
|
578
615
|
// src/components/Autocomplete/index.ts
|
|
579
616
|
var Autocomplete_default = Autocomplete;
|
|
580
617
|
|
|
581
618
|
// src/components/Avatar/Avatar.tsx
|
|
582
|
-
import React6, { forwardRef as forwardRef2, useMemo as
|
|
619
|
+
import React6, { forwardRef as forwardRef2, useMemo as useMemo3 } from "react";
|
|
583
620
|
import { Avatar as JoyAvatar, AvatarGroup, styled as styled4, useThemeProps as useThemeProps2 } from "@mui/joy";
|
|
584
621
|
var StyledAvatar = styled4(JoyAvatar, {
|
|
585
622
|
name: "Avatar",
|
|
@@ -607,7 +644,7 @@ var Avatar = forwardRef2(function Avatar2(inProps, ref) {
|
|
|
607
644
|
name: "Avatar"
|
|
608
645
|
});
|
|
609
646
|
const { children, getInitial = defaultGetInitial, ...inheritProps } = props;
|
|
610
|
-
const calcChildren =
|
|
647
|
+
const calcChildren = useMemo3(() => {
|
|
611
648
|
if (typeof children === "string") {
|
|
612
649
|
return getInitial?.(children) ?? "";
|
|
613
650
|
}
|
|
@@ -649,7 +686,7 @@ var MenuItem = JoyMenuItem;
|
|
|
649
686
|
var Menu_default = Menu;
|
|
650
687
|
|
|
651
688
|
// src/components/Dropdown/Dropdown.tsx
|
|
652
|
-
import React8, { createContext, useCallback as useCallback3, useMemo as
|
|
689
|
+
import React8, { createContext, useCallback as useCallback3, useMemo as useMemo4, useState as useState2 } from "react";
|
|
653
690
|
import { Dropdown as JoyDropdown } from "@mui/joy";
|
|
654
691
|
import { MenuButton } from "@mui/joy";
|
|
655
692
|
import { useMenuButton } from "@mui/base/useMenuButton";
|
|
@@ -657,7 +694,7 @@ var DropdownNestedRegistryContext = createContext(null);
|
|
|
657
694
|
function Dropdown({ open: openProp, defaultOpen = false, onOpenChange, ...rest }) {
|
|
658
695
|
const [nestedCount, setNestedCount] = useState2(0);
|
|
659
696
|
const [open, setOpen] = useControlledState(openProp, defaultOpen);
|
|
660
|
-
const registry =
|
|
697
|
+
const registry = useMemo4(
|
|
661
698
|
() => ({
|
|
662
699
|
register: () => setNestedCount((c) => c + 1),
|
|
663
700
|
unregister: () => setNestedCount((c) => Math.max(0, c - 1))
|
|
@@ -727,7 +764,7 @@ Button.displayName = "Button";
|
|
|
727
764
|
var Button_default = Button;
|
|
728
765
|
|
|
729
766
|
// src/components/Calendar/Calendar.tsx
|
|
730
|
-
import React13, { Fragment, forwardRef as forwardRef4, useCallback as useCallback6, useEffect as useEffect3, useMemo as
|
|
767
|
+
import React13, { Fragment, forwardRef as forwardRef4, useCallback as useCallback6, useEffect as useEffect3, useMemo as useMemo6, useRef as useRef3, useState as useState5 } from "react";
|
|
731
768
|
import { styled as styled5 } from "@mui/joy";
|
|
732
769
|
import ChevronLeftIcon from "@mui/icons-material/ChevronLeft";
|
|
733
770
|
import ChevronRightIcon from "@mui/icons-material/ChevronRight";
|
|
@@ -821,7 +858,7 @@ var isSameMonth = (date1, date2) => {
|
|
|
821
858
|
};
|
|
822
859
|
|
|
823
860
|
// src/components/Calendar/hooks/use-calendar-props.ts
|
|
824
|
-
import { useCallback as useCallback4, useMemo as
|
|
861
|
+
import { useCallback as useCallback4, useMemo as useMemo5, useState as useState3 } from "react";
|
|
825
862
|
import { useThemeProps as useThemeProps3 } from "@mui/joy";
|
|
826
863
|
var resolveView = (view, views) => {
|
|
827
864
|
return views.includes(view) ? view : views[0];
|
|
@@ -841,12 +878,12 @@ var useCalendarProps = (inProps) => {
|
|
|
841
878
|
});
|
|
842
879
|
const [[page, direction], setPage] = useState3([0, 0]);
|
|
843
880
|
const resolvedView = inProps.view ?? uncontrolledView;
|
|
844
|
-
const resolvedMinDate =
|
|
881
|
+
const resolvedMinDate = useMemo5(() => {
|
|
845
882
|
const minDate = inProps.minDate || /* @__PURE__ */ new Date(0);
|
|
846
883
|
minDate.setHours(0, 0, 0, 0);
|
|
847
884
|
return minDate;
|
|
848
885
|
}, [inProps.minDate]);
|
|
849
|
-
const resolvedMaxDate =
|
|
886
|
+
const resolvedMaxDate = useMemo5(() => {
|
|
850
887
|
const maxDate = inProps.maxDate || /* @__PURE__ */ new Date(864e13);
|
|
851
888
|
maxDate.setHours(0, 0, 0, 0);
|
|
852
889
|
return maxDate;
|
|
@@ -905,7 +942,7 @@ var useCalendarProps = (inProps) => {
|
|
|
905
942
|
},
|
|
906
943
|
name: "Calendar"
|
|
907
944
|
});
|
|
908
|
-
const ownerState =
|
|
945
|
+
const ownerState = useMemo5(() => ({ ...props, viewMonth, direction }), [props, viewMonth, direction]);
|
|
909
946
|
return [props, ownerState];
|
|
910
947
|
};
|
|
911
948
|
|
|
@@ -1337,8 +1374,8 @@ var swipePower = (offset, velocity) => {
|
|
|
1337
1374
|
var PickerDays = (props) => {
|
|
1338
1375
|
const { ownerState } = props;
|
|
1339
1376
|
const { getPickerDayProps, getDayCellProps } = useCalendar(ownerState);
|
|
1340
|
-
const calendarDates =
|
|
1341
|
-
const weekdayNames =
|
|
1377
|
+
const calendarDates = useMemo6(() => getCalendarDates(ownerState.viewMonth), [ownerState.viewMonth]);
|
|
1378
|
+
const weekdayNames = useMemo6(() => getWeekdayNames(ownerState.locale || "default"), [ownerState.locale]);
|
|
1342
1379
|
return /* @__PURE__ */ React13.createElement(CalendarViewContainer, { calendarType: "datePicker" }, /* @__PURE__ */ React13.createElement(AnimatePresence, { initial: false, custom: ownerState.direction }, /* @__PURE__ */ React13.createElement(
|
|
1343
1380
|
CalendarViewTable,
|
|
1344
1381
|
{
|
|
@@ -1422,8 +1459,8 @@ var PickerMonths = (props) => {
|
|
|
1422
1459
|
};
|
|
1423
1460
|
var PlainPickerDays = ({ ownerState }) => {
|
|
1424
1461
|
const { getPickerDayProps, getDayCellProps } = useCalendar(ownerState);
|
|
1425
|
-
const calendarDates =
|
|
1426
|
-
const weekdayNames =
|
|
1462
|
+
const calendarDates = useMemo6(() => getCalendarDates(ownerState.viewMonth), [ownerState.viewMonth]);
|
|
1463
|
+
const weekdayNames = useMemo6(() => getWeekdayNames(ownerState.locale || "default"), [ownerState.locale]);
|
|
1427
1464
|
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(
|
|
1428
1465
|
(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" }))
|
|
1429
1466
|
)), rowIndex < calendarDates.length - 1 && /* @__PURE__ */ React13.createElement("tr", { "aria-hidden": "true", "aria-description": "row-gap" }, /* @__PURE__ */ React13.createElement("td", { colSpan: 13, style: { height: 4 } }))))));
|
|
@@ -1802,7 +1839,7 @@ var Container = forwardRef5(function Container2(props, ref) {
|
|
|
1802
1839
|
Container.displayName = "Container";
|
|
1803
1840
|
|
|
1804
1841
|
// src/components/CurrencyInput/CurrencyInput.tsx
|
|
1805
|
-
import React17, { useCallback as useCallback8, useMemo as
|
|
1842
|
+
import React17, { useCallback as useCallback8, useMemo as useMemo7 } from "react";
|
|
1806
1843
|
import { NumericFormat } from "react-number-format";
|
|
1807
1844
|
|
|
1808
1845
|
// src/components/Input/Input.tsx
|
|
@@ -2136,19 +2173,19 @@ var CurrencyInput = React17.forwardRef(function CurrencyInput2(inProps, ref) {
|
|
|
2136
2173
|
props.defaultValue ?? null,
|
|
2137
2174
|
useCallback8((value2) => onChange?.({ target: { name, value: value2 } }), [onChange, name])
|
|
2138
2175
|
);
|
|
2139
|
-
const value =
|
|
2176
|
+
const value = useMemo7(() => {
|
|
2140
2177
|
if (_value && useMinorUnit) {
|
|
2141
2178
|
return _value / Math.pow(10, decimalScale);
|
|
2142
2179
|
}
|
|
2143
2180
|
return _value;
|
|
2144
2181
|
}, [_value, useMinorUnit, decimalScale]);
|
|
2145
|
-
const max =
|
|
2182
|
+
const max = useMemo7(() => {
|
|
2146
2183
|
if (props.max && useMinorUnit) {
|
|
2147
2184
|
return props.max / Math.pow(10, decimalScale);
|
|
2148
2185
|
}
|
|
2149
2186
|
return props.max;
|
|
2150
2187
|
}, [props.max, useMinorUnit, decimalScale]);
|
|
2151
|
-
const isOverLimit =
|
|
2188
|
+
const isOverLimit = useMemo7(() => max != null && value != null && value > max, [max, value]);
|
|
2152
2189
|
const handleChange = useCallback8(
|
|
2153
2190
|
(event) => {
|
|
2154
2191
|
if (event.target.value === "") {
|
|
@@ -2199,7 +2236,7 @@ var CurrencyInput_default = CurrencyInput;
|
|
|
2199
2236
|
// src/components/DataTable/DataTable.tsx
|
|
2200
2237
|
import React26, {
|
|
2201
2238
|
useCallback as useCallback13,
|
|
2202
|
-
useMemo as
|
|
2239
|
+
useMemo as useMemo12,
|
|
2203
2240
|
useRef as useRef7,
|
|
2204
2241
|
useId,
|
|
2205
2242
|
forwardRef as forwardRef7,
|
|
@@ -2433,6 +2470,9 @@ function computeAutoFitWidth(params) {
|
|
|
2433
2470
|
if (!isNaN(maxPx) && maxPx > 0) finalWidth = Math.min(finalWidth, maxPx);
|
|
2434
2471
|
return finalWidth;
|
|
2435
2472
|
}
|
|
2473
|
+
function getHeaderCellId(tableId, columnId) {
|
|
2474
|
+
return `${tableId}_header_${columnId}`.trim();
|
|
2475
|
+
}
|
|
2436
2476
|
|
|
2437
2477
|
// src/components/DataTable/styled.tsx
|
|
2438
2478
|
import React18 from "react";
|
|
@@ -2624,7 +2664,7 @@ import React23, {
|
|
|
2624
2664
|
useRef as useRef5,
|
|
2625
2665
|
useState as useState8,
|
|
2626
2666
|
useLayoutEffect,
|
|
2627
|
-
useMemo as
|
|
2667
|
+
useMemo as useMemo10,
|
|
2628
2668
|
useCallback as useCallback10,
|
|
2629
2669
|
useEffect as useEffect5,
|
|
2630
2670
|
memo,
|
|
@@ -3108,7 +3148,7 @@ import React20 from "react";
|
|
|
3108
3148
|
import { Textarea as JoyTextarea } from "@mui/joy";
|
|
3109
3149
|
import { motion as motion19 } from "framer-motion";
|
|
3110
3150
|
var MotionTextarea = motion19(JoyTextarea);
|
|
3111
|
-
var
|
|
3151
|
+
var TextareaBase = (props) => {
|
|
3112
3152
|
const {
|
|
3113
3153
|
label,
|
|
3114
3154
|
error,
|
|
@@ -3152,13 +3192,17 @@ var Textarea = (props) => {
|
|
|
3152
3192
|
helperText && /* @__PURE__ */ React20.createElement(FormHelperText_default, null, helperText)
|
|
3153
3193
|
);
|
|
3154
3194
|
};
|
|
3195
|
+
var Textarea = React20.forwardRef((props, ref) => {
|
|
3196
|
+
const textareaSlotProps = useSlotRef(props.slotProps?.textarea, ref);
|
|
3197
|
+
return /* @__PURE__ */ React20.createElement(TextareaBase, { ...props, slotProps: { ...props.slotProps, textarea: textareaSlotProps } });
|
|
3198
|
+
});
|
|
3155
3199
|
Textarea.displayName = "Textarea";
|
|
3156
3200
|
|
|
3157
3201
|
// src/components/Textarea/index.ts
|
|
3158
3202
|
var Textarea_default = Textarea;
|
|
3159
3203
|
|
|
3160
3204
|
// src/components/Select/Select.tsx
|
|
3161
|
-
import React21, { useMemo as
|
|
3205
|
+
import React21, { useMemo as useMemo9 } from "react";
|
|
3162
3206
|
import {
|
|
3163
3207
|
Select as JoySelect,
|
|
3164
3208
|
Option as JoyOption,
|
|
@@ -3174,7 +3218,7 @@ var secondaryTextLevelMap2 = {
|
|
|
3174
3218
|
lg: "body-md"
|
|
3175
3219
|
};
|
|
3176
3220
|
Option.displayName = "Option";
|
|
3177
|
-
function
|
|
3221
|
+
function SelectInner(props, ref) {
|
|
3178
3222
|
const {
|
|
3179
3223
|
label,
|
|
3180
3224
|
helperText,
|
|
@@ -3200,7 +3244,7 @@ function Select(props) {
|
|
|
3200
3244
|
formHelperText: formHelperTextProps,
|
|
3201
3245
|
...joySlotProps
|
|
3202
3246
|
} = slotProps ?? {};
|
|
3203
|
-
const options =
|
|
3247
|
+
const options = useMemo9(
|
|
3204
3248
|
() => props.options.map((option) => {
|
|
3205
3249
|
if (option.hasOwnProperty("value") && option.hasOwnProperty("label")) {
|
|
3206
3250
|
return option;
|
|
@@ -3225,13 +3269,14 @@ function Select(props) {
|
|
|
3225
3269
|
};
|
|
3226
3270
|
onChange?.(newEvent, newValue);
|
|
3227
3271
|
};
|
|
3228
|
-
const optionMap =
|
|
3272
|
+
const optionMap = useMemo9(() => {
|
|
3229
3273
|
const map = /* @__PURE__ */ new Map();
|
|
3230
3274
|
options.forEach((option) => {
|
|
3231
3275
|
map.set(option.value, option);
|
|
3232
3276
|
});
|
|
3233
3277
|
return map;
|
|
3234
3278
|
}, [options]);
|
|
3279
|
+
const buttonSlotProps = useSlotRef(joySlotProps.button, ref);
|
|
3235
3280
|
const select = /* @__PURE__ */ React21.createElement(
|
|
3236
3281
|
JoySelect,
|
|
3237
3282
|
{
|
|
@@ -3240,7 +3285,7 @@ function Select(props) {
|
|
|
3240
3285
|
disabled,
|
|
3241
3286
|
size,
|
|
3242
3287
|
color: error ? "danger" : color,
|
|
3243
|
-
slotProps: joySlotProps,
|
|
3288
|
+
slotProps: { ...joySlotProps, button: buttonSlotProps },
|
|
3244
3289
|
onChange: handleChange,
|
|
3245
3290
|
renderValue: (selected) => {
|
|
3246
3291
|
if (!selected) return null;
|
|
@@ -3270,6 +3315,7 @@ function Select(props) {
|
|
|
3270
3315
|
helperText && /* @__PURE__ */ React21.createElement(FormHelperText_default, { ...formHelperTextProps }, helperText)
|
|
3271
3316
|
);
|
|
3272
3317
|
}
|
|
3318
|
+
var Select = React21.forwardRef(SelectInner);
|
|
3273
3319
|
Select.displayName = "Select";
|
|
3274
3320
|
|
|
3275
3321
|
// src/components/Select/index.ts
|
|
@@ -3384,7 +3430,8 @@ var HeadCell = (props) => {
|
|
|
3384
3430
|
tableColRef,
|
|
3385
3431
|
headerClassName,
|
|
3386
3432
|
headerLineClamp,
|
|
3387
|
-
onAutoFit
|
|
3433
|
+
onAutoFit,
|
|
3434
|
+
columnId
|
|
3388
3435
|
} = props;
|
|
3389
3436
|
const theme = useTheme();
|
|
3390
3437
|
const ref = headerRef;
|
|
@@ -3395,23 +3442,20 @@ var HeadCell = (props) => {
|
|
|
3395
3442
|
}, [ref]);
|
|
3396
3443
|
const [isHovered, setIsHovered] = useState8(false);
|
|
3397
3444
|
const sortable = type === "actions" ? false : _sortable;
|
|
3398
|
-
const headId =
|
|
3399
|
-
() => `${tableId}_header_${headerName ?? field}`.trim(),
|
|
3400
|
-
[tableId, headerName, field]
|
|
3401
|
-
);
|
|
3445
|
+
const headId = useMemo10(() => getHeaderCellId(tableId, columnId ?? field), [tableId, columnId, field]);
|
|
3402
3446
|
const isResizingRef = useRef5(false);
|
|
3403
|
-
const resizer =
|
|
3447
|
+
const resizer = useMemo10(
|
|
3404
3448
|
() => resizable ?? true ? Resizer(
|
|
3405
3449
|
ref,
|
|
3406
3450
|
colRef,
|
|
3407
3451
|
(isResizing) => {
|
|
3408
3452
|
isResizingRef.current = isResizing;
|
|
3409
3453
|
},
|
|
3410
|
-
onAutoFit ? () => onAutoFit(field) : void 0
|
|
3454
|
+
onAutoFit ? () => onAutoFit(columnId ?? String(field)) : void 0
|
|
3411
3455
|
) : null,
|
|
3412
|
-
[resizable, ref, colRef, onAutoFit, field]
|
|
3456
|
+
[resizable, ref, colRef, onAutoFit, columnId, field]
|
|
3413
3457
|
);
|
|
3414
|
-
const style =
|
|
3458
|
+
const style = useMemo10(
|
|
3415
3459
|
() => ({
|
|
3416
3460
|
width,
|
|
3417
3461
|
minWidth: minWidth ?? "50px",
|
|
@@ -3429,7 +3473,7 @@ var HeadCell = (props) => {
|
|
|
3429
3473
|
);
|
|
3430
3474
|
const textAlign = getTextAlign(props);
|
|
3431
3475
|
const initialSort = sortOrder[0];
|
|
3432
|
-
const sortIcon =
|
|
3476
|
+
const sortIcon = useMemo10(() => {
|
|
3433
3477
|
const isSorted = !!sort;
|
|
3434
3478
|
const isVisible = sortable && (isSorted || isHovered);
|
|
3435
3479
|
return /* @__PURE__ */ React23.createElement(AnimatePresence2, { mode: "wait" }, isVisible && /* @__PURE__ */ React23.createElement(
|
|
@@ -3460,17 +3504,17 @@ var HeadCell = (props) => {
|
|
|
3460
3504
|
}
|
|
3461
3505
|
));
|
|
3462
3506
|
}, [headId, initialSort, sort, sortable, isHovered]);
|
|
3463
|
-
const infoSign =
|
|
3507
|
+
const infoSign = useMemo10(
|
|
3464
3508
|
() => description ? /* @__PURE__ */ React23.createElement(InfoSign_default, { message: description, placement: "bottom" }) : null,
|
|
3465
3509
|
[description]
|
|
3466
3510
|
);
|
|
3467
|
-
const params =
|
|
3511
|
+
const params = useMemo10(
|
|
3468
3512
|
() => ({
|
|
3469
3513
|
field
|
|
3470
3514
|
}),
|
|
3471
3515
|
[field]
|
|
3472
3516
|
);
|
|
3473
|
-
const computedHeaderClassName =
|
|
3517
|
+
const computedHeaderClassName = useMemo10(
|
|
3474
3518
|
() => (typeof headerClassName === "function" ? headerClassName(params) : headerClassName) || void 0,
|
|
3475
3519
|
[headerClassName, params]
|
|
3476
3520
|
);
|
|
@@ -3524,7 +3568,7 @@ var BodyCell = (props) => {
|
|
|
3524
3568
|
const theme = useTheme();
|
|
3525
3569
|
const [value, setValue] = useState8(row[field]);
|
|
3526
3570
|
const cellRef = useRef5(null);
|
|
3527
|
-
const params =
|
|
3571
|
+
const params = useMemo10(
|
|
3528
3572
|
() => ({
|
|
3529
3573
|
row,
|
|
3530
3574
|
value,
|
|
@@ -3533,20 +3577,20 @@ var BodyCell = (props) => {
|
|
|
3533
3577
|
}),
|
|
3534
3578
|
[row, rowId, value, field]
|
|
3535
3579
|
);
|
|
3536
|
-
const editMode =
|
|
3580
|
+
const editMode = useMemo10(
|
|
3537
3581
|
() => !!(props.editMode && (typeof isCellEditable === "function" ? isCellEditable(params) : isCellEditable ?? true)),
|
|
3538
3582
|
[props.editMode, isCellEditable, params]
|
|
3539
3583
|
);
|
|
3540
3584
|
const propsComponentProps = "componentProps" in props ? props.componentProps : null;
|
|
3541
3585
|
const hasComponentProps = "componentProps" in props;
|
|
3542
|
-
const componentProps =
|
|
3586
|
+
const componentProps = useMemo10(
|
|
3543
3587
|
() => ({
|
|
3544
3588
|
...hasComponentProps && (typeof propsComponentProps === "function" ? propsComponentProps(params) : propsComponentProps || {}),
|
|
3545
3589
|
size: "sm"
|
|
3546
3590
|
}),
|
|
3547
3591
|
[hasComponentProps, propsComponentProps, params]
|
|
3548
3592
|
);
|
|
3549
|
-
const editModeComponentProps =
|
|
3593
|
+
const editModeComponentProps = useMemo10(
|
|
3550
3594
|
() => ({
|
|
3551
3595
|
...componentProps,
|
|
3552
3596
|
onChange: (e) => {
|
|
@@ -3608,9 +3652,9 @@ var BodyCell = (props) => {
|
|
|
3608
3652
|
}),
|
|
3609
3653
|
[params, row, field, value, componentProps, type, onCellEditStop, onCellEditStart]
|
|
3610
3654
|
);
|
|
3611
|
-
const MemoizedRenderEditCell =
|
|
3612
|
-
const MemoizedRenderCell =
|
|
3613
|
-
const EditModeComponent =
|
|
3655
|
+
const MemoizedRenderEditCell = useMemo10(() => renderEditCell ? memo(renderEditCell) : null, [renderEditCell]);
|
|
3656
|
+
const MemoizedRenderCell = useMemo10(() => renderCell ? memo(renderCell) : null, [renderCell]);
|
|
3657
|
+
const EditModeComponent = useMemo10(() => {
|
|
3614
3658
|
if (MemoizedRenderEditCell) {
|
|
3615
3659
|
return createElement(MemoizedRenderEditCell, params);
|
|
3616
3660
|
}
|
|
@@ -3645,7 +3689,7 @@ var BodyCell = (props) => {
|
|
|
3645
3689
|
}[type || "text"];
|
|
3646
3690
|
}, [value, editModeComponentProps, type, MemoizedRenderEditCell, params]);
|
|
3647
3691
|
const linkComponentFromProps = props.component;
|
|
3648
|
-
const ReadModeComponent =
|
|
3692
|
+
const ReadModeComponent = useMemo10(() => {
|
|
3649
3693
|
if (MemoizedRenderCell) {
|
|
3650
3694
|
return createElement(MemoizedRenderCell, params);
|
|
3651
3695
|
}
|
|
@@ -3659,15 +3703,15 @@ var BodyCell = (props) => {
|
|
|
3659
3703
|
return typedComponent || innerText;
|
|
3660
3704
|
}, [value, MemoizedRenderCell, params, type, componentProps, linkComponentFromProps]);
|
|
3661
3705
|
const getActions = props.getActions;
|
|
3662
|
-
const CellComponent =
|
|
3706
|
+
const CellComponent = useMemo10(() => {
|
|
3663
3707
|
if (type === "actions") {
|
|
3664
3708
|
return /* @__PURE__ */ React23.createElement(Stack_default, { direction: "row", gap: 1, justifyContent: "center", alignItems: "center" }, getActions?.(params));
|
|
3665
3709
|
}
|
|
3666
3710
|
return editMode && EditModeComponent ? EditModeComponent : ReadModeComponent;
|
|
3667
3711
|
}, [type, getActions, params, editMode, EditModeComponent, ReadModeComponent]);
|
|
3668
|
-
const showTooltip =
|
|
3712
|
+
const showTooltip = useMemo10(() => noWrap && type === "longText", [noWrap, type]);
|
|
3669
3713
|
const isBoundary = props.isLastStartPinnedColumn || props.isLastEndPinnedColumn;
|
|
3670
|
-
const computedCellClassName =
|
|
3714
|
+
const computedCellClassName = useMemo10(
|
|
3671
3715
|
() => (typeof cellClassName === "function" ? cellClassName(params) : cellClassName) || "",
|
|
3672
3716
|
[cellClassName, params]
|
|
3673
3717
|
);
|
|
@@ -3679,7 +3723,7 @@ var BodyCell = (props) => {
|
|
|
3679
3723
|
{
|
|
3680
3724
|
ref: cellRef,
|
|
3681
3725
|
key: field,
|
|
3682
|
-
headers:
|
|
3726
|
+
headers: getHeaderCellId(tableId, props.columnId ?? field),
|
|
3683
3727
|
sx: {
|
|
3684
3728
|
textAlign: getTextAlign({ type }),
|
|
3685
3729
|
verticalAlign: editMode ? "top" : "middle",
|
|
@@ -3691,7 +3735,7 @@ var BodyCell = (props) => {
|
|
|
3691
3735
|
},
|
|
3692
3736
|
className: [isLastStartPinnedColumn && "is-last-left", isLastEndPinnedColumn && "is-last-right", computedCellClassName].filter(Boolean).join(" ") || ""
|
|
3693
3737
|
},
|
|
3694
|
-
|
|
3738
|
+
useMemo10(
|
|
3695
3739
|
() => showTooltip ? /* @__PURE__ */ React23.createElement(CellTextEllipsis, null, CellComponent) : CellComponent,
|
|
3696
3740
|
[CellComponent, showTooltip]
|
|
3697
3741
|
)
|
|
@@ -3744,36 +3788,46 @@ var VirtualizedTableRow = memo(StyledTableRow2, (prevProps, nextProps) => {
|
|
|
3744
3788
|
});
|
|
3745
3789
|
|
|
3746
3790
|
// src/components/DataTable/hooks.ts
|
|
3747
|
-
import { useState as useState9, useLayoutEffect as useLayoutEffect2, useRef as useRef6, useMemo as
|
|
3748
|
-
function useColumnWidths(
|
|
3791
|
+
import { useState as useState9, useLayoutEffect as useLayoutEffect2, useRef as useRef6, useMemo as useMemo11, useCallback as useCallback11, useEffect as useEffect6, createRef } from "react";
|
|
3792
|
+
function useColumnWidths(columnsById) {
|
|
3749
3793
|
const [widths, setWidths] = useState9({});
|
|
3750
3794
|
const roRef = useRef6();
|
|
3751
3795
|
useLayoutEffect2(() => {
|
|
3752
3796
|
if (roRef.current) roRef.current.disconnect();
|
|
3753
3797
|
roRef.current = new ResizeObserver((entries) => {
|
|
3754
|
-
let changed = false;
|
|
3755
3798
|
setWidths((prev) => {
|
|
3799
|
+
let changed = false;
|
|
3756
3800
|
const next = { ...prev };
|
|
3757
3801
|
entries.forEach((entry) => {
|
|
3758
|
-
const
|
|
3802
|
+
const columnId = entry.target.dataset.hdsColumnId;
|
|
3759
3803
|
const w = Math.round(entry.target.getBoundingClientRect().width);
|
|
3760
|
-
if (
|
|
3761
|
-
|
|
3804
|
+
if (w === 0) return;
|
|
3805
|
+
if (next[columnId] !== w) {
|
|
3806
|
+
next[columnId] = w;
|
|
3762
3807
|
changed = true;
|
|
3763
3808
|
}
|
|
3764
3809
|
});
|
|
3765
3810
|
return changed ? next : prev;
|
|
3766
3811
|
});
|
|
3767
3812
|
});
|
|
3768
|
-
|
|
3813
|
+
const measured = {};
|
|
3814
|
+
Object.entries(columnsById).forEach(([columnId, def]) => {
|
|
3769
3815
|
const el = def.headerRef.current;
|
|
3770
3816
|
if (el) {
|
|
3771
|
-
el.dataset.
|
|
3817
|
+
el.dataset.hdsColumnId = columnId;
|
|
3818
|
+
el.dataset.field = String(def.field);
|
|
3819
|
+
const w = Math.round(el.getBoundingClientRect().width);
|
|
3820
|
+
if (w > 0) measured[columnId] = w;
|
|
3772
3821
|
roRef.current.observe(el);
|
|
3773
3822
|
}
|
|
3774
3823
|
});
|
|
3824
|
+
setWidths((prev) => {
|
|
3825
|
+
const keys = Object.keys(measured);
|
|
3826
|
+
const same = keys.length === Object.keys(prev).length && keys.every((key) => prev[key] === measured[key]);
|
|
3827
|
+
return same ? prev : measured;
|
|
3828
|
+
});
|
|
3775
3829
|
return () => roRef.current?.disconnect();
|
|
3776
|
-
}, [
|
|
3830
|
+
}, [columnsById]);
|
|
3777
3831
|
return widths;
|
|
3778
3832
|
}
|
|
3779
3833
|
function useDataTableRenderer({
|
|
@@ -3822,16 +3876,16 @@ function useDataTableRenderer({
|
|
|
3822
3876
|
[onColumnVisibilityModelChange]
|
|
3823
3877
|
)
|
|
3824
3878
|
);
|
|
3825
|
-
const reorderedColumns =
|
|
3879
|
+
const reorderedColumns = useMemo11(() => {
|
|
3826
3880
|
if (!columnGroupingModel) return columnsProp;
|
|
3827
3881
|
return reorderColumnsByGroupingModel(columnsProp, columnGroupingModel);
|
|
3828
3882
|
}, [columnsProp, columnGroupingModel]);
|
|
3829
|
-
const visibleColumns =
|
|
3883
|
+
const visibleColumns = useMemo11(
|
|
3830
3884
|
() => reorderedColumns.filter((col) => visibilityModel[col.field] !== false),
|
|
3831
3885
|
[reorderedColumns, visibilityModel]
|
|
3832
3886
|
);
|
|
3833
|
-
const visibleFieldSet =
|
|
3834
|
-
const tableMinWidth =
|
|
3887
|
+
const visibleFieldSet = useMemo11(() => new Set(visibleColumns.map((c) => c.field)), [visibleColumns]);
|
|
3888
|
+
const tableMinWidth = useMemo11(() => {
|
|
3835
3889
|
const DEFAULT_MIN = 50;
|
|
3836
3890
|
let total = checkboxSelection ? 40 : 0;
|
|
3837
3891
|
for (const col of visibleColumns) {
|
|
@@ -3839,7 +3893,7 @@ function useDataTableRenderer({
|
|
|
3839
3893
|
}
|
|
3840
3894
|
return total;
|
|
3841
3895
|
}, [visibleColumns, checkboxSelection]);
|
|
3842
|
-
const allColumnsByField =
|
|
3896
|
+
const allColumnsByField = useMemo11(
|
|
3843
3897
|
() => reorderedColumns.reduce(
|
|
3844
3898
|
(acc, curr) => ({
|
|
3845
3899
|
...acc,
|
|
@@ -3849,19 +3903,40 @@ function useDataTableRenderer({
|
|
|
3849
3903
|
),
|
|
3850
3904
|
[reorderedColumns]
|
|
3851
3905
|
);
|
|
3852
|
-
const
|
|
3853
|
-
() =>
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3906
|
+
const columnIdByColumn = useMemo11(() => {
|
|
3907
|
+
const taken = new Set(reorderedColumns.map((column) => String(column.field)));
|
|
3908
|
+
const assigned = /* @__PURE__ */ new Set();
|
|
3909
|
+
const ids = /* @__PURE__ */ new Map();
|
|
3910
|
+
reorderedColumns.forEach((column) => {
|
|
3911
|
+
const field = String(column.field);
|
|
3912
|
+
if (!assigned.has(field)) {
|
|
3913
|
+
assigned.add(field);
|
|
3914
|
+
ids.set(column, field);
|
|
3915
|
+
return;
|
|
3916
|
+
}
|
|
3917
|
+
let n = 2;
|
|
3918
|
+
while (taken.has(`${field}__${n}`)) n += 1;
|
|
3919
|
+
taken.add(`${field}__${n}`);
|
|
3920
|
+
ids.set(column, `${field}__${n}`);
|
|
3921
|
+
});
|
|
3922
|
+
return ids;
|
|
3923
|
+
}, [reorderedColumns]);
|
|
3924
|
+
const columnIds = useMemo11(
|
|
3925
|
+
() => visibleColumns.map((column) => columnIdByColumn.get(column) ?? String(column.field)),
|
|
3926
|
+
[visibleColumns, columnIdByColumn]
|
|
3927
|
+
);
|
|
3928
|
+
const visibleColumnsById = useMemo11(
|
|
3929
|
+
() => Object.fromEntries(
|
|
3930
|
+
visibleColumns.map((column, index) => [
|
|
3931
|
+
columnIds[index],
|
|
3932
|
+
{
|
|
3933
|
+
...column,
|
|
3858
3934
|
headerRef: createRef(),
|
|
3859
3935
|
tableColRef: createRef()
|
|
3860
3936
|
}
|
|
3861
|
-
|
|
3862
|
-
{}
|
|
3937
|
+
])
|
|
3863
3938
|
),
|
|
3864
|
-
[visibleColumns]
|
|
3939
|
+
[visibleColumns, columnIds]
|
|
3865
3940
|
);
|
|
3866
3941
|
const sortComparator = useCallback11(
|
|
3867
3942
|
(rowA, rowB) => {
|
|
@@ -3892,11 +3967,11 @@ function useDataTableRenderer({
|
|
|
3892
3967
|
},
|
|
3893
3968
|
[sortModel, allColumnsByField]
|
|
3894
3969
|
);
|
|
3895
|
-
const rows =
|
|
3970
|
+
const rows = useMemo11(
|
|
3896
3971
|
() => sortModel.length ? [..._rows].sort(sortComparator) : _rows,
|
|
3897
3972
|
[_rows, sortModel, sortComparator]
|
|
3898
3973
|
);
|
|
3899
|
-
const sortOrder =
|
|
3974
|
+
const sortOrder = useMemo11(
|
|
3900
3975
|
() => Array.from(new Set(_sortOrder || ["asc", "desc", null])),
|
|
3901
3976
|
[_sortOrder]
|
|
3902
3977
|
);
|
|
@@ -3906,12 +3981,12 @@ function useDataTableRenderer({
|
|
|
3906
3981
|
(row, index) => _getId?.(row) ?? row.id ?? `${(index || 0) + (page - 1) * pageSize}`,
|
|
3907
3982
|
[_getId, page, pageSize]
|
|
3908
3983
|
);
|
|
3909
|
-
const selectedModelSet =
|
|
3910
|
-
const dataInPage =
|
|
3984
|
+
const selectedModelSet = useMemo11(() => new Set(selectionModel || []), [selectionModel]);
|
|
3985
|
+
const dataInPage = useMemo11(
|
|
3911
3986
|
() => !pagination || paginationMode === "server" ? rows : rows.slice((page - 1) * pageSize, (page - 1) * pageSize + pageSize),
|
|
3912
3987
|
[rows, page, pageSize, paginationMode, pagination]
|
|
3913
3988
|
);
|
|
3914
|
-
const selectableDataInPage =
|
|
3989
|
+
const selectableDataInPage = useMemo11(
|
|
3915
3990
|
() => dataInPage.filter((row, i) => {
|
|
3916
3991
|
if (!isRowSelectable) return true;
|
|
3917
3992
|
return isRowSelectable({ row, id: getId(row, i) });
|
|
@@ -3941,51 +4016,60 @@ function useDataTableRenderer({
|
|
|
3941
4016
|
},
|
|
3942
4017
|
[dataInPage, getId, isRowSelectable, selectionModel, onSelectionModelChange]
|
|
3943
4018
|
);
|
|
3944
|
-
const isAllSelected =
|
|
4019
|
+
const isAllSelected = useMemo11(
|
|
3945
4020
|
() => selectableDataInPage.length > 0 && selectableDataInPage.every((row, i) => selectedModelSet.has(getId(row, i))),
|
|
3946
4021
|
[selectableDataInPage, selectedModelSet, getId]
|
|
3947
4022
|
);
|
|
3948
4023
|
const rowCount = totalRowsProp || rows.length;
|
|
3949
|
-
const selectableRowCount =
|
|
4024
|
+
const selectableRowCount = useMemo11(() => {
|
|
3950
4025
|
if (!isRowSelectable) return rowCount;
|
|
3951
4026
|
return rows.filter((row, i) => isRowSelectable({ row, id: getId(row, i) })).length;
|
|
3952
4027
|
}, [rows, isRowSelectable, getId, rowCount]);
|
|
3953
|
-
const isTotalSelected =
|
|
4028
|
+
const isTotalSelected = useMemo11(
|
|
3954
4029
|
() => _isTotalSelected ?? (selectableRowCount > 0 && (selectionModel?.length || 0) === selectableRowCount),
|
|
3955
4030
|
[_isTotalSelected, selectionModel, selectableRowCount]
|
|
3956
4031
|
);
|
|
3957
|
-
const columnWidths = useColumnWidths(
|
|
4032
|
+
const columnWidths = useColumnWidths(visibleColumnsById);
|
|
4033
|
+
const measuredWidthByField = useMemo11(
|
|
4034
|
+
() => Object.fromEntries(
|
|
4035
|
+
Object.entries(visibleColumnsById).map(([columnId, column]) => [column.field, columnWidths[columnId]])
|
|
4036
|
+
),
|
|
4037
|
+
[visibleColumnsById, columnWidths]
|
|
4038
|
+
);
|
|
3958
4039
|
const getWidth = useCallback11(
|
|
3959
|
-
|
|
3960
|
-
allColumnsByField[f]?.
|
|
3961
|
-
[
|
|
4040
|
+
// 반환값은 pinned offset으로 더해지므로 반드시 숫자여야 한다. width/minWidth는 '500px' 같은 문자열.
|
|
4041
|
+
(f) => measuredWidthByField[f] ?? parsePxValue(allColumnsByField[f]?.width) ?? // Column prop 으로 지정된 width
|
|
4042
|
+
parsePxValue(allColumnsByField[f]?.minWidth) ?? 0,
|
|
4043
|
+
[measuredWidthByField, allColumnsByField]
|
|
3962
4044
|
);
|
|
3963
|
-
const processedColumnGroups =
|
|
4045
|
+
const processedColumnGroups = useMemo11(() => {
|
|
3964
4046
|
if (!columnGroupingModel) return null;
|
|
3965
4047
|
return calculateColumnGroups(columnGroupingModel, visibleColumns, visibleFieldSet);
|
|
3966
4048
|
}, [columnGroupingModel, visibleColumns, visibleFieldSet]);
|
|
3967
|
-
const effectivePinnedLeft =
|
|
4049
|
+
const effectivePinnedLeft = useMemo11(
|
|
3968
4050
|
() => pinnedColumns?.left?.filter((f) => visibleFieldSet.has(f)),
|
|
3969
4051
|
[pinnedColumns?.left, visibleFieldSet]
|
|
3970
4052
|
);
|
|
3971
|
-
const effectivePinnedRight =
|
|
4053
|
+
const effectivePinnedRight = useMemo11(
|
|
3972
4054
|
() => pinnedColumns?.right?.filter((f) => visibleFieldSet.has(f)),
|
|
3973
4055
|
[pinnedColumns?.right, visibleFieldSet]
|
|
3974
4056
|
);
|
|
3975
4057
|
const inferredFieldsKey = JSON.stringify(Object.keys(rows[0] || {}));
|
|
3976
|
-
const inferredFields =
|
|
3977
|
-
const columns =
|
|
4058
|
+
const inferredFields = useMemo11(() => JSON.parse(inferredFieldsKey), [inferredFieldsKey]);
|
|
4059
|
+
const columns = useMemo11(() => {
|
|
3978
4060
|
const baseColumns = visibleColumns.length > 0 ? visibleColumns : reorderedColumns.length > 0 ? [] : inferredFields.map((key) => ({
|
|
3979
4061
|
field: key
|
|
3980
4062
|
}));
|
|
3981
|
-
return baseColumns.map((column) => {
|
|
4063
|
+
return baseColumns.map((column, index) => {
|
|
4064
|
+
const columnId = columnIds[index] ?? String(column.field);
|
|
3982
4065
|
const isLeftPinned = effectivePinnedLeft?.includes(column.field);
|
|
3983
4066
|
const isRightPinned = effectivePinnedRight?.includes(column.field);
|
|
3984
4067
|
const isPinned = isLeftPinned || isRightPinned;
|
|
3985
4068
|
return {
|
|
3986
4069
|
...column,
|
|
3987
|
-
|
|
3988
|
-
|
|
4070
|
+
columnId,
|
|
4071
|
+
headerRef: visibleColumnsById[columnId]?.headerRef,
|
|
4072
|
+
tableColRef: visibleColumnsById[columnId]?.tableColRef,
|
|
3989
4073
|
isCellEditable: editMode && (typeof column.isCellEditable === "function" ? column.isCellEditable : column.isCellEditable ?? true),
|
|
3990
4074
|
sort: sortModel.find((sort) => sort.field === column.field)?.sort,
|
|
3991
4075
|
sortOrder: allColumnsByField[column.field]?.sortOrder || sortOrder,
|
|
@@ -4002,7 +4086,8 @@ function useDataTableRenderer({
|
|
|
4002
4086
|
inferredFields,
|
|
4003
4087
|
effectivePinnedLeft,
|
|
4004
4088
|
effectivePinnedRight,
|
|
4005
|
-
|
|
4089
|
+
columnIds,
|
|
4090
|
+
visibleColumnsById,
|
|
4006
4091
|
allColumnsByField,
|
|
4007
4092
|
editMode,
|
|
4008
4093
|
sortModel,
|
|
@@ -4062,15 +4147,14 @@ function useDataTableRenderer({
|
|
|
4062
4147
|
}
|
|
4063
4148
|
}, [_rows]);
|
|
4064
4149
|
const handleAutoFit = useCallback11(
|
|
4065
|
-
(
|
|
4066
|
-
const colDef =
|
|
4150
|
+
(columnId) => {
|
|
4151
|
+
const colDef = visibleColumnsById[columnId];
|
|
4067
4152
|
if (!colDef?.headerRef.current) return;
|
|
4068
|
-
const
|
|
4069
|
-
const columnType = column && "type" in column ? column.type : void 0;
|
|
4153
|
+
const columnType = "type" in colDef ? colDef.type : void 0;
|
|
4070
4154
|
if (columnType === "actions") return;
|
|
4071
4155
|
const optimalWidth = computeAutoFitWidth({
|
|
4072
4156
|
headerEl: colDef.headerRef.current,
|
|
4073
|
-
field,
|
|
4157
|
+
field: colDef.field,
|
|
4074
4158
|
dataInPage
|
|
4075
4159
|
});
|
|
4076
4160
|
if (optimalWidth == null) return;
|
|
@@ -4078,7 +4162,7 @@ function useDataTableRenderer({
|
|
|
4078
4162
|
colDef.headerRef.current.style.width = widthPx;
|
|
4079
4163
|
if (colDef.tableColRef.current) colDef.tableColRef.current.style.width = widthPx;
|
|
4080
4164
|
},
|
|
4081
|
-
[
|
|
4165
|
+
[visibleColumnsById, dataInPage]
|
|
4082
4166
|
);
|
|
4083
4167
|
return {
|
|
4084
4168
|
rowCount,
|
|
@@ -4553,9 +4637,9 @@ function Component(props, apiRef) {
|
|
|
4553
4637
|
measureElement: (element) => element.clientHeight,
|
|
4554
4638
|
overscan: 10
|
|
4555
4639
|
});
|
|
4556
|
-
const paginationModel =
|
|
4640
|
+
const paginationModel = useMemo12(() => ({ page, pageSize }), [page, pageSize]);
|
|
4557
4641
|
const columnsKey = getObjectVersion(columns);
|
|
4558
|
-
const headerCheckboxElement =
|
|
4642
|
+
const headerCheckboxElement = useMemo12(
|
|
4559
4643
|
() => /* @__PURE__ */ React26.createElement(
|
|
4560
4644
|
RenderCheckbox,
|
|
4561
4645
|
{
|
|
@@ -4765,7 +4849,7 @@ function Component(props, apiRef) {
|
|
|
4765
4849
|
"col",
|
|
4766
4850
|
{
|
|
4767
4851
|
ref: c.tableColRef,
|
|
4768
|
-
key:
|
|
4852
|
+
key: c.columnId,
|
|
4769
4853
|
style: {
|
|
4770
4854
|
width: c.width,
|
|
4771
4855
|
minWidth: c.minWidth ?? "50px"
|
|
@@ -4951,7 +5035,7 @@ var DataTable = forwardRef7(Component);
|
|
|
4951
5035
|
DataTable.displayName = "DataTable";
|
|
4952
5036
|
|
|
4953
5037
|
// src/components/DateRangePicker/DateRangePicker.tsx
|
|
4954
|
-
import React27, { forwardRef as forwardRef8, useCallback as useCallback14, useEffect as useEffect8, useImperativeHandle as useImperativeHandle3, useMemo as
|
|
5038
|
+
import React27, { forwardRef as forwardRef8, useCallback as useCallback14, useEffect as useEffect8, useImperativeHandle as useImperativeHandle3, useMemo as useMemo13, useRef as useRef8, useState as useState10 } from "react";
|
|
4955
5039
|
import { IMaskInput as IMaskInput2, IMask as IMask2 } from "react-imask";
|
|
4956
5040
|
import CalendarTodayIcon2 from "@mui/icons-material/CalendarToday";
|
|
4957
5041
|
import { styled as styled14, useThemeProps as useThemeProps7 } from "@mui/joy";
|
|
@@ -5173,7 +5257,7 @@ var DateRangePicker = forwardRef8((inProps, ref) => {
|
|
|
5173
5257
|
);
|
|
5174
5258
|
const [anchorEl, setAnchorEl] = useState10(null);
|
|
5175
5259
|
const open = Boolean(anchorEl);
|
|
5176
|
-
const calendarValue =
|
|
5260
|
+
const calendarValue = useMemo13(
|
|
5177
5261
|
() => value ? parseDates(value, format) : void 0,
|
|
5178
5262
|
[value, format]
|
|
5179
5263
|
);
|
|
@@ -5467,10 +5551,10 @@ var ModalClose = JoyModalClose;
|
|
|
5467
5551
|
var MotionModalOverflow = motion23(JoyModalOverflow);
|
|
5468
5552
|
var ModalOverflow = MotionModalOverflow;
|
|
5469
5553
|
ModalOverflow.displayName = "ModalOverflow";
|
|
5470
|
-
|
|
5554
|
+
var ModalFrame = React28.forwardRef((props, ref) => {
|
|
5471
5555
|
const { title, children, titleStartDecorator, onClose, ...innerProps } = props;
|
|
5472
|
-
return /* @__PURE__ */ React28.createElement(StyledModalDialog, { ...innerProps }, /* @__PURE__ */ React28.createElement(ModalClose, { onClick: onClose }), /* @__PURE__ */ React28.createElement(DialogTitle_default, null, titleStartDecorator, title), /* @__PURE__ */ React28.createElement(DialogContent_default, null, children));
|
|
5473
|
-
}
|
|
5556
|
+
return /* @__PURE__ */ React28.createElement(StyledModalDialog, { ref, ...innerProps }, /* @__PURE__ */ React28.createElement(ModalClose, { onClick: onClose }), /* @__PURE__ */ React28.createElement(DialogTitle_default, null, titleStartDecorator, title), /* @__PURE__ */ React28.createElement(DialogContent_default, null, children));
|
|
5557
|
+
});
|
|
5474
5558
|
ModalFrame.displayName = "ModalFrame";
|
|
5475
5559
|
|
|
5476
5560
|
// src/components/DialogFrame/DialogFrame.tsx
|
|
@@ -5515,7 +5599,7 @@ var InsetDrawer = styled19(JoyDrawer)(({ theme }) => ({
|
|
|
5515
5599
|
}));
|
|
5516
5600
|
|
|
5517
5601
|
// src/components/FilterableCheckboxGroup/FilterableCheckboxGroup.tsx
|
|
5518
|
-
import React31, { useCallback as useCallback15, useEffect as useEffect9, useMemo as
|
|
5602
|
+
import React31, { useCallback as useCallback15, useEffect as useEffect9, useMemo as useMemo14, useRef as useRef9, useState as useState11 } from "react";
|
|
5519
5603
|
import SearchIcon from "@mui/icons-material/Search";
|
|
5520
5604
|
import { useThemeProps as useThemeProps8 } from "@mui/joy";
|
|
5521
5605
|
import { useVirtualizer as useVirtualizer3 } from "@tanstack/react-virtual";
|
|
@@ -5576,11 +5660,11 @@ function FilterableCheckboxGroup(inProps) {
|
|
|
5576
5660
|
const parentRef = useRef9(null);
|
|
5577
5661
|
const isInitialSortRef = useRef9(false);
|
|
5578
5662
|
const prevOptionsRef = useRef9([...options]);
|
|
5579
|
-
const filteredOptions =
|
|
5663
|
+
const filteredOptions = useMemo14(() => {
|
|
5580
5664
|
if (!searchTerm) return sortedOptions;
|
|
5581
5665
|
return sortedOptions.filter((option) => option.label.toLowerCase().includes(searchTerm.toLowerCase()));
|
|
5582
5666
|
}, [sortedOptions, searchTerm]);
|
|
5583
|
-
const itemSize =
|
|
5667
|
+
const itemSize = useMemo14(() => {
|
|
5584
5668
|
switch (size) {
|
|
5585
5669
|
case "sm":
|
|
5586
5670
|
return 28;
|
|
@@ -5654,7 +5738,7 @@ function FilterableCheckboxGroup(inProps) {
|
|
|
5654
5738
|
},
|
|
5655
5739
|
[filteredOptions, internalValue, setInternalValue]
|
|
5656
5740
|
);
|
|
5657
|
-
const enabledFilteredOptions =
|
|
5741
|
+
const enabledFilteredOptions = useMemo14(() => filteredOptions.filter((option) => !option.disabled), [filteredOptions]);
|
|
5658
5742
|
const isAllSelected = enabledFilteredOptions.length > 0 && enabledFilteredOptions.every((option) => internalValue.includes(option.value));
|
|
5659
5743
|
const isIndeterminate = !isAllSelected && enabledFilteredOptions.some((option) => internalValue.includes(option.value));
|
|
5660
5744
|
return /* @__PURE__ */ React31.createElement("div", { style: { width: "100%" } }, /* @__PURE__ */ React31.createElement(
|
|
@@ -5843,7 +5927,7 @@ function RadioGroup2(props) {
|
|
|
5843
5927
|
RadioGroup2.displayName = "RadioGroup";
|
|
5844
5928
|
|
|
5845
5929
|
// src/components/FilterMenu/components/DateRange.tsx
|
|
5846
|
-
import React35, { useCallback as useCallback19, useMemo as
|
|
5930
|
+
import React35, { useCallback as useCallback19, useMemo as useMemo15, useState as useState12, useEffect as useEffect10 } from "react";
|
|
5847
5931
|
import { Stack as Stack5 } from "@mui/joy";
|
|
5848
5932
|
function DateRange(props) {
|
|
5849
5933
|
const {
|
|
@@ -5862,7 +5946,7 @@ function DateRange(props) {
|
|
|
5862
5946
|
} = props;
|
|
5863
5947
|
const [internalValue, setInternalValue] = useControlledState(value, null, onChange);
|
|
5864
5948
|
const [selectedOption, setSelectedOption] = useState12("all-time");
|
|
5865
|
-
const dateRangeOptions =
|
|
5949
|
+
const dateRangeOptions = useMemo15(
|
|
5866
5950
|
() => [
|
|
5867
5951
|
{ label: "All Time", value: "all-time" },
|
|
5868
5952
|
{ label: "This Month", value: "this-month" },
|
|
@@ -5927,7 +6011,7 @@ function DateRange(props) {
|
|
|
5927
6011
|
},
|
|
5928
6012
|
[getDateRangeForOption]
|
|
5929
6013
|
);
|
|
5930
|
-
const customDateRangeValue =
|
|
6014
|
+
const customDateRangeValue = useMemo15(() => {
|
|
5931
6015
|
if (selectedOption === "custom" && internalValue) {
|
|
5932
6016
|
return `${internalValue[0]} - ${internalValue[1]}`;
|
|
5933
6017
|
}
|
|
@@ -5986,11 +6070,11 @@ function DateRange(props) {
|
|
|
5986
6070
|
DateRange.displayName = "DateRange";
|
|
5987
6071
|
|
|
5988
6072
|
// src/components/FilterMenu/components/MonthRange.tsx
|
|
5989
|
-
import React37, { useCallback as useCallback21, useMemo as
|
|
6073
|
+
import React37, { useCallback as useCallback21, useMemo as useMemo17 } from "react";
|
|
5990
6074
|
import { Stack as Stack6 } from "@mui/joy";
|
|
5991
6075
|
|
|
5992
6076
|
// src/components/MonthRangePicker/MonthRangePicker.tsx
|
|
5993
|
-
import React36, { forwardRef as forwardRef9, useCallback as useCallback20, useEffect as useEffect11, useImperativeHandle as useImperativeHandle4, useMemo as
|
|
6077
|
+
import React36, { forwardRef as forwardRef9, useCallback as useCallback20, useEffect as useEffect11, useImperativeHandle as useImperativeHandle4, useMemo as useMemo16, useRef as useRef10, useState as useState13 } from "react";
|
|
5994
6078
|
import { IMaskInput as IMaskInput3, IMask as IMask3 } from "react-imask";
|
|
5995
6079
|
import CalendarTodayIcon3 from "@mui/icons-material/CalendarToday";
|
|
5996
6080
|
import { styled as styled20, useThemeProps as useThemeProps9 } from "@mui/joy";
|
|
@@ -6121,7 +6205,7 @@ var MonthRangePicker = forwardRef9((inProps, ref) => {
|
|
|
6121
6205
|
);
|
|
6122
6206
|
const [anchorEl, setAnchorEl] = useState13(null);
|
|
6123
6207
|
const open = Boolean(anchorEl);
|
|
6124
|
-
const calendarValue =
|
|
6208
|
+
const calendarValue = useMemo16(() => value ? parseDates2(value) : void 0, [value]);
|
|
6125
6209
|
useEffect11(() => {
|
|
6126
6210
|
if (value) {
|
|
6127
6211
|
try {
|
|
@@ -6296,7 +6380,7 @@ function MonthRange(props) {
|
|
|
6296
6380
|
locale
|
|
6297
6381
|
} = props;
|
|
6298
6382
|
const [internalValue, setInternalValue] = useControlledState(value, null, onChange);
|
|
6299
|
-
const pickerValue =
|
|
6383
|
+
const pickerValue = useMemo17(
|
|
6300
6384
|
() => internalValue ? `${internalValue[0]} - ${internalValue[1]}` : "",
|
|
6301
6385
|
[internalValue]
|
|
6302
6386
|
);
|
|
@@ -6439,7 +6523,7 @@ import React41 from "react";
|
|
|
6439
6523
|
import { Stack as Stack9, Typography as Typography5 } from "@mui/joy";
|
|
6440
6524
|
|
|
6441
6525
|
// src/components/PercentageInput/PercentageInput.tsx
|
|
6442
|
-
import React40, { useCallback as useCallback24, useMemo as
|
|
6526
|
+
import React40, { useCallback as useCallback24, useMemo as useMemo18 } from "react";
|
|
6443
6527
|
import { NumericFormat as NumericFormat2 } from "react-number-format";
|
|
6444
6528
|
import { styled as styled21, useThemeProps as useThemeProps10 } from "@mui/joy";
|
|
6445
6529
|
var padDecimal = (value, decimalScale) => {
|
|
@@ -6498,13 +6582,13 @@ var PercentageInput = React40.forwardRef(
|
|
|
6498
6582
|
props.defaultValue ?? null,
|
|
6499
6583
|
useCallback24((value2) => onChange?.({ target: { name, value: value2 } }), [onChange, name])
|
|
6500
6584
|
);
|
|
6501
|
-
const value =
|
|
6585
|
+
const value = useMemo18(() => {
|
|
6502
6586
|
if (_value && useMinorUnit) {
|
|
6503
6587
|
return _value / Math.pow(10, maxDecimalScale);
|
|
6504
6588
|
}
|
|
6505
6589
|
return _value;
|
|
6506
6590
|
}, [_value, useMinorUnit, maxDecimalScale]);
|
|
6507
|
-
const internalError =
|
|
6591
|
+
const internalError = useMemo18(
|
|
6508
6592
|
() => value != null && (max != null && value > max || min != null && value < min),
|
|
6509
6593
|
[max, min, value]
|
|
6510
6594
|
);
|
|
@@ -6764,7 +6848,7 @@ function FilterMenu(props) {
|
|
|
6764
6848
|
FilterMenu.displayName = "FilterMenu";
|
|
6765
6849
|
|
|
6766
6850
|
// src/components/Uploader/Uploader.tsx
|
|
6767
|
-
import React45, { useCallback as useCallback28, useEffect as useEffect13, useMemo as
|
|
6851
|
+
import React45, { useCallback as useCallback28, useEffect as useEffect13, useMemo as useMemo19, useRef as useRef11, useState as useState14 } from "react";
|
|
6768
6852
|
import { styled as styled22, Input as Input2 } from "@mui/joy";
|
|
6769
6853
|
import MuiFileUploadIcon from "@mui/icons-material/CloudUploadRounded";
|
|
6770
6854
|
import MuiUploadFileIcon from "@mui/icons-material/UploadFileRounded";
|
|
@@ -6904,8 +6988,8 @@ var Uploader = React45.memo((props) => {
|
|
|
6904
6988
|
const [files, setFiles] = useState14([]);
|
|
6905
6989
|
const [uploaded, setUploaded] = useState14(props.uploaded || []);
|
|
6906
6990
|
const [previewState, setPreviewState] = useState14("idle");
|
|
6907
|
-
const accepts =
|
|
6908
|
-
const parsedAccepts =
|
|
6991
|
+
const accepts = useMemo19(() => accept.split(",").map((accept2) => accept2.trim()), [accept]);
|
|
6992
|
+
const parsedAccepts = useMemo19(
|
|
6909
6993
|
() => accepts.flatMap((type) => {
|
|
6910
6994
|
if (["image/*", "video/*", "audio/*"].includes(type)) {
|
|
6911
6995
|
return ALL_EXTENSIONS_BY_TYPE[type];
|
|
@@ -6914,7 +6998,7 @@ var Uploader = React45.memo((props) => {
|
|
|
6914
6998
|
}),
|
|
6915
6999
|
[accepts]
|
|
6916
7000
|
);
|
|
6917
|
-
const helperText =
|
|
7001
|
+
const helperText = useMemo19(() => {
|
|
6918
7002
|
if (helperTextProp) {
|
|
6919
7003
|
return helperTextProp;
|
|
6920
7004
|
}
|
|
@@ -6944,8 +7028,8 @@ var Uploader = React45.memo((props) => {
|
|
|
6944
7028
|
}
|
|
6945
7029
|
return helperTexts.join(", ");
|
|
6946
7030
|
}, [accepts, maxFileTotalSize, maxCount, helperTextProp]);
|
|
6947
|
-
const error =
|
|
6948
|
-
const showDropZone =
|
|
7031
|
+
const error = useMemo19(() => !!errorText || errorProp, [errorProp, errorText]);
|
|
7032
|
+
const showDropZone = useMemo19(
|
|
6949
7033
|
() => !maxCount || maxCount && [...uploaded, ...files].length !== maxCount,
|
|
6950
7034
|
[files, maxCount, uploaded]
|
|
6951
7035
|
);
|
|
@@ -7107,7 +7191,10 @@ import {
|
|
|
7107
7191
|
MenuButton as JoyMenuButton2,
|
|
7108
7192
|
IconButton as JoyIconButton2
|
|
7109
7193
|
} from "@mui/joy";
|
|
7110
|
-
function
|
|
7194
|
+
var MenuButtonRootSlot = React46.forwardRef(function MenuButtonRootSlot2({ as, ...rest }, ref) {
|
|
7195
|
+
return /* @__PURE__ */ React46.createElement(JoyIconButton2, { ...rest, component: as ?? "button", ref });
|
|
7196
|
+
});
|
|
7197
|
+
function IconMenuButtonInner(props, ref) {
|
|
7111
7198
|
const {
|
|
7112
7199
|
size,
|
|
7113
7200
|
icon,
|
|
@@ -7118,6 +7205,8 @@ function IconMenuButton(props) {
|
|
|
7118
7205
|
variant = "plain",
|
|
7119
7206
|
placement = "bottom"
|
|
7120
7207
|
} = props;
|
|
7208
|
+
const { ref: buttonComponentRef, ...buttonComponentProps } = props.buttonComponentProps ?? {};
|
|
7209
|
+
const mergedButtonRef = useMergedRef(buttonComponentRef, ref);
|
|
7121
7210
|
if (!items.length) {
|
|
7122
7211
|
return /* @__PURE__ */ React46.createElement(
|
|
7123
7212
|
JoyIconButton2,
|
|
@@ -7128,7 +7217,8 @@ function IconMenuButton(props) {
|
|
|
7128
7217
|
color,
|
|
7129
7218
|
disabled,
|
|
7130
7219
|
loading,
|
|
7131
|
-
...
|
|
7220
|
+
...buttonComponentProps,
|
|
7221
|
+
ref: mergedButtonRef
|
|
7132
7222
|
},
|
|
7133
7223
|
icon
|
|
7134
7224
|
);
|
|
@@ -7136,7 +7226,7 @@ function IconMenuButton(props) {
|
|
|
7136
7226
|
return /* @__PURE__ */ React46.createElement(Dropdown_default, null, /* @__PURE__ */ React46.createElement(
|
|
7137
7227
|
JoyMenuButton2,
|
|
7138
7228
|
{
|
|
7139
|
-
slots: { root:
|
|
7229
|
+
slots: { root: MenuButtonRootSlot },
|
|
7140
7230
|
slotProps: {
|
|
7141
7231
|
root: {
|
|
7142
7232
|
component: props.buttonComponent ?? "button",
|
|
@@ -7145,13 +7235,16 @@ function IconMenuButton(props) {
|
|
|
7145
7235
|
color,
|
|
7146
7236
|
disabled,
|
|
7147
7237
|
loading,
|
|
7148
|
-
...
|
|
7238
|
+
...buttonComponentProps,
|
|
7239
|
+
// Joy의 useSlot이 내부 ref와 이 ref를 합쳐준다. 위 no-items 분기와 같은 경로로 ref를 넘긴다.
|
|
7240
|
+
ref: mergedButtonRef
|
|
7149
7241
|
}
|
|
7150
7242
|
}
|
|
7151
7243
|
},
|
|
7152
7244
|
icon
|
|
7153
7245
|
), /* @__PURE__ */ React46.createElement(Menu, { placement, size }, items.map((i) => /* @__PURE__ */ React46.createElement(MenuItem, { key: i.text, component: i.component, ...i.componentProps ?? {} }, i.text))));
|
|
7154
7246
|
}
|
|
7247
|
+
var IconMenuButton = React46.forwardRef(IconMenuButtonInner);
|
|
7155
7248
|
IconMenuButton.displayName = "IconMenuButton";
|
|
7156
7249
|
|
|
7157
7250
|
// src/components/Markdown/Markdown.tsx
|
|
@@ -7725,7 +7818,7 @@ function Navigator(props) {
|
|
|
7725
7818
|
Navigator.displayName = "Navigator";
|
|
7726
7819
|
|
|
7727
7820
|
// src/components/ProfileMenu/ProfileMenu.tsx
|
|
7728
|
-
import React53, { useCallback as useCallback30, useMemo as
|
|
7821
|
+
import React53, { useCallback as useCallback30, useMemo as useMemo20 } from "react";
|
|
7729
7822
|
import { Dropdown as Dropdown2, ListDivider, menuItemClasses, styled as styled26, MenuButton as MenuButton3, useThemeProps as useThemeProps12 } from "@mui/joy";
|
|
7730
7823
|
import { ClickAwayListener as ClickAwayListener5 } from "@mui/base";
|
|
7731
7824
|
import DropdownIcon from "@mui/icons-material/ArrowDropDown";
|
|
@@ -7735,8 +7828,8 @@ var StyledProfileCard = styled26(Stack, {
|
|
|
7735
7828
|
})({});
|
|
7736
7829
|
function ProfileCard(props) {
|
|
7737
7830
|
const { children, chip, caption, size } = props;
|
|
7738
|
-
const captionLevel =
|
|
7739
|
-
const nameLevel =
|
|
7831
|
+
const captionLevel = useMemo20(() => size === "sm" ? "body-xs" : "body-sm", [size]);
|
|
7832
|
+
const nameLevel = useMemo20(() => size === "sm" ? "body-sm" : "body-md", [size]);
|
|
7740
7833
|
return /* @__PURE__ */ React53.createElement(StyledProfileCard, { px: 4, py: 2 }, /* @__PURE__ */ React53.createElement(Stack, { direction: "row", gap: 2 }, /* @__PURE__ */ React53.createElement(Typography, { level: nameLevel, fontWeight: "bold", textColor: "text.primary" }, children), chip && /* @__PURE__ */ React53.createElement(Chip, { size, color: "neutral", variant: "outlined" }, chip)), caption && /* @__PURE__ */ React53.createElement(Typography, { level: captionLevel, textColor: "text.tertiary" }, caption));
|
|
7741
7834
|
}
|
|
7742
7835
|
ProfileCard.displayName = "ProfileCard";
|