@ceed/cds 1.40.3-next.4 → 1.40.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 +1 -2
- package/dist/components/DataTable/components.d.ts +1 -1
- package/dist/components/DataTable/hooks.d.ts +7 -6
- package/dist/components/DataTable/types.d.ts +0 -7
- package/dist/components/DataTable/utils.d.ts +0 -5
- package/dist/components/IconMenuButton/IconMenuButton.d.ts +8 -9
- package/dist/components/IconMenuButton/index.d.ts +1 -2
- package/dist/components/Modal/Modal.d.ts +4 -1
- package/dist/components/Select/Select.d.ts +4 -3
- package/dist/components/Textarea/Textarea.d.ts +4 -1
- package/dist/components/Textarea/index.d.ts +1 -2
- package/dist/components/data-display/DataTable.md +0 -4
- package/dist/components/navigation/IconMenuButton.md +12 -12
- package/dist/index.browser.js +6 -6
- package/dist/index.browser.js.map +4 -4
- package/dist/index.cjs +650 -747
- package/dist/index.js +163 -260
- package/framer/index.js +1 -1
- package/package.json +1 -1
- package/dist/libs/slot-props.d.ts +0 -22
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 useCallback2, useEffect as useEffect2, useMemo
|
|
190
|
+
import React5, { useCallback as useCallback2, useEffect as useEffect2, useMemo, useRef as useRef2 } from "react";
|
|
191
191
|
import {
|
|
192
192
|
Autocomplete as JoyAutocomplete,
|
|
193
193
|
AutocompleteOption as JoyAutocompleteOption,
|
|
@@ -294,37 +294,6 @@ function useControlledState(controlledValue, defaultValue, onChange) {
|
|
|
294
294
|
return [displayValue, handleChange, isControlled];
|
|
295
295
|
}
|
|
296
296
|
|
|
297
|
-
// src/libs/slot-props.ts
|
|
298
|
-
import { useMemo } 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
|
-
return useMemo(() => {
|
|
317
|
-
if (isFunctionForm) {
|
|
318
|
-
return ((ownerState) => {
|
|
319
|
-
const resolved = slotProp(ownerState) ?? {};
|
|
320
|
-
const merged = mergeRefs(resolved.ref, ref);
|
|
321
|
-
return merged ? { ...resolved, ref: merged } : { ...resolved };
|
|
322
|
-
});
|
|
323
|
-
}
|
|
324
|
-
return mergedRef ? { ...slotProp, ref: mergedRef } : { ...slotProp };
|
|
325
|
-
}, [isFunctionForm, slotProp, mergedRef, ref]);
|
|
326
|
-
}
|
|
327
|
-
|
|
328
297
|
// src/components/Autocomplete/Autocomplete.tsx
|
|
329
298
|
var AutocompletePopper = styled3(Popper, {
|
|
330
299
|
name: "Autocomplete",
|
|
@@ -349,11 +318,11 @@ var AutocompleteListBox = React5.forwardRef((props, ref) => {
|
|
|
349
318
|
} = props;
|
|
350
319
|
const parentRef = useRef2(null);
|
|
351
320
|
const isGrouped = children[0].every((child) => child.hasOwnProperty("group"));
|
|
352
|
-
const itemHeight =
|
|
321
|
+
const itemHeight = useMemo(() => {
|
|
353
322
|
const heights = itemHeightMap[fontSize ?? "md"];
|
|
354
323
|
return hasSecondaryText ? heights.secondary : heights.default;
|
|
355
324
|
}, [fontSize, hasSecondaryText]);
|
|
356
|
-
const renderTargets =
|
|
325
|
+
const renderTargets = useMemo(() => {
|
|
357
326
|
if (loading) {
|
|
358
327
|
return [children[1]];
|
|
359
328
|
}
|
|
@@ -445,7 +414,7 @@ var autocompleteFilterOptions = createFilterOptions({
|
|
|
445
414
|
}
|
|
446
415
|
});
|
|
447
416
|
var getOptionLabel = (option) => `${option.label ?? ""}`;
|
|
448
|
-
function
|
|
417
|
+
function Autocomplete(props) {
|
|
449
418
|
const {
|
|
450
419
|
label,
|
|
451
420
|
error,
|
|
@@ -475,7 +444,7 @@ function AutocompleteInner(props, ref) {
|
|
|
475
444
|
)
|
|
476
445
|
);
|
|
477
446
|
const _value = rawValue ?? (props.multiple ? EMPTY_MULTIPLE_VALUE : "");
|
|
478
|
-
const options =
|
|
447
|
+
const options = useMemo(
|
|
479
448
|
() => props.options.map((option) => {
|
|
480
449
|
if (typeof option !== "object") {
|
|
481
450
|
return {
|
|
@@ -487,14 +456,14 @@ function AutocompleteInner(props, ref) {
|
|
|
487
456
|
}),
|
|
488
457
|
[props.options]
|
|
489
458
|
);
|
|
490
|
-
const optionMap =
|
|
459
|
+
const optionMap = useMemo(() => {
|
|
491
460
|
const map = /* @__PURE__ */ new Map();
|
|
492
461
|
options.forEach((option) => {
|
|
493
462
|
map.set(option.value, option);
|
|
494
463
|
});
|
|
495
464
|
return map;
|
|
496
465
|
}, [options]);
|
|
497
|
-
const value =
|
|
466
|
+
const value = useMemo(() => {
|
|
498
467
|
if (props.loading) {
|
|
499
468
|
return {
|
|
500
469
|
value: "",
|
|
@@ -513,25 +482,23 @@ function AutocompleteInner(props, ref) {
|
|
|
513
482
|
},
|
|
514
483
|
[size, props.loading]
|
|
515
484
|
);
|
|
516
|
-
const startDecorator =
|
|
485
|
+
const startDecorator = useMemo(
|
|
517
486
|
() => applySize(value?.startDecorator || props.startDecorator),
|
|
518
487
|
[value, applySize, props.startDecorator]
|
|
519
488
|
);
|
|
520
|
-
const endDecorator =
|
|
489
|
+
const endDecorator = useMemo(
|
|
521
490
|
() => applySize(value?.endDecorator || props.endDecorator),
|
|
522
491
|
[value, applySize, props.endDecorator]
|
|
523
492
|
);
|
|
524
|
-
const
|
|
525
|
-
const slotProps = useMemo2(
|
|
493
|
+
const slotProps = useMemo(
|
|
526
494
|
() => ({
|
|
527
495
|
...props.slotProps,
|
|
528
496
|
listbox: {
|
|
529
497
|
...props.slotProps?.listbox,
|
|
530
498
|
hasSecondaryText: options.some((opt) => opt.secondaryText)
|
|
531
|
-
}
|
|
532
|
-
input: inputSlotProps
|
|
499
|
+
}
|
|
533
500
|
}),
|
|
534
|
-
[options, props.slotProps
|
|
501
|
+
[options, props.slotProps]
|
|
535
502
|
);
|
|
536
503
|
const handleChange = useCallback2(
|
|
537
504
|
(event, value2) => {
|
|
@@ -565,9 +532,9 @@ function AutocompleteInner(props, ref) {
|
|
|
565
532
|
endDecorator,
|
|
566
533
|
getOptionLabel,
|
|
567
534
|
renderTags: (tags, getTagProps) => tags.map((tag, index) => {
|
|
568
|
-
const { onClick,
|
|
535
|
+
const { onClick, ...rest } = getTagProps({ index });
|
|
569
536
|
return applySize(
|
|
570
|
-
/* @__PURE__ */ React5.createElement(Chip_default, {
|
|
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(
|
|
571
538
|
/* @__PURE__ */ React5.createElement(AutocompleteTagDelete, { color: "primary", variant: "soft", onClick }, /* @__PURE__ */ React5.createElement(CloseIcon, null))
|
|
572
539
|
)))
|
|
573
540
|
);
|
|
@@ -577,29 +544,26 @@ function AutocompleteInner(props, ref) {
|
|
|
577
544
|
},
|
|
578
545
|
slotProps,
|
|
579
546
|
filterOptions: autocompleteFilterOptions,
|
|
580
|
-
renderOption: (props2, option) => {
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
applySize(option.endDecorator)
|
|
601
|
-
));
|
|
602
|
-
},
|
|
547
|
+
renderOption: (props2, option) => /* @__PURE__ */ React5.createElement(JoyAutocompleteOption, { ...props2 }, option.startDecorator && /* @__PURE__ */ React5.createElement(
|
|
548
|
+
ListItemDecorator,
|
|
549
|
+
{
|
|
550
|
+
sx: (theme) => ({
|
|
551
|
+
marginInlineEnd: `var(--Input-gap, ${theme.spacing(1)})`
|
|
552
|
+
})
|
|
553
|
+
},
|
|
554
|
+
applySize(option.startDecorator)
|
|
555
|
+
), 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)) : (
|
|
556
|
+
// TODO: haulla에서 사용할 때, label을 ReactNode로 넘기면 에러가 발생함....
|
|
557
|
+
applySize(option.label)
|
|
558
|
+
), option.endDecorator && /* @__PURE__ */ React5.createElement(
|
|
559
|
+
ListItemDecorator,
|
|
560
|
+
{
|
|
561
|
+
sx: (theme) => ({
|
|
562
|
+
marginInlineStart: `var(--Input-gap, ${theme.spacing(1)})`
|
|
563
|
+
})
|
|
564
|
+
},
|
|
565
|
+
applySize(option.endDecorator)
|
|
566
|
+
)),
|
|
603
567
|
renderGroup: (params) => params
|
|
604
568
|
}
|
|
605
569
|
);
|
|
@@ -619,14 +583,13 @@ function AutocompleteInner(props, ref) {
|
|
|
619
583
|
helperText && /* @__PURE__ */ React5.createElement(FormHelperText_default, null, helperText)
|
|
620
584
|
);
|
|
621
585
|
}
|
|
622
|
-
var Autocomplete = React5.forwardRef(AutocompleteInner);
|
|
623
586
|
Autocomplete.displayName = "Autocomplete";
|
|
624
587
|
|
|
625
588
|
// src/components/Autocomplete/index.ts
|
|
626
589
|
var Autocomplete_default = Autocomplete;
|
|
627
590
|
|
|
628
591
|
// src/components/Avatar/Avatar.tsx
|
|
629
|
-
import React6, { forwardRef as forwardRef2, useMemo as
|
|
592
|
+
import React6, { forwardRef as forwardRef2, useMemo as useMemo2 } from "react";
|
|
630
593
|
import { Avatar as JoyAvatar, AvatarGroup, styled as styled4, useThemeProps as useThemeProps2 } from "@mui/joy";
|
|
631
594
|
var StyledAvatar = styled4(JoyAvatar, {
|
|
632
595
|
name: "Avatar",
|
|
@@ -654,7 +617,7 @@ var Avatar = forwardRef2(function Avatar2(inProps, ref) {
|
|
|
654
617
|
name: "Avatar"
|
|
655
618
|
});
|
|
656
619
|
const { children, getInitial = defaultGetInitial, ...inheritProps } = props;
|
|
657
|
-
const calcChildren =
|
|
620
|
+
const calcChildren = useMemo2(() => {
|
|
658
621
|
if (typeof children === "string") {
|
|
659
622
|
return getInitial?.(children) ?? "";
|
|
660
623
|
}
|
|
@@ -696,7 +659,7 @@ var MenuItem = JoyMenuItem;
|
|
|
696
659
|
var Menu_default = Menu;
|
|
697
660
|
|
|
698
661
|
// src/components/Dropdown/Dropdown.tsx
|
|
699
|
-
import React8, { createContext, useCallback as useCallback3, useMemo as
|
|
662
|
+
import React8, { createContext, useCallback as useCallback3, useMemo as useMemo3, useState as useState2 } from "react";
|
|
700
663
|
import { Dropdown as JoyDropdown } from "@mui/joy";
|
|
701
664
|
import { MenuButton } from "@mui/joy";
|
|
702
665
|
import { useMenuButton } from "@mui/base/useMenuButton";
|
|
@@ -704,7 +667,7 @@ var DropdownNestedRegistryContext = createContext(null);
|
|
|
704
667
|
function Dropdown({ open: openProp, defaultOpen = false, onOpenChange, ...rest }) {
|
|
705
668
|
const [nestedCount, setNestedCount] = useState2(0);
|
|
706
669
|
const [open, setOpen] = useControlledState(openProp, defaultOpen);
|
|
707
|
-
const registry =
|
|
670
|
+
const registry = useMemo3(
|
|
708
671
|
() => ({
|
|
709
672
|
register: () => setNestedCount((c) => c + 1),
|
|
710
673
|
unregister: () => setNestedCount((c) => Math.max(0, c - 1))
|
|
@@ -774,7 +737,7 @@ Button.displayName = "Button";
|
|
|
774
737
|
var Button_default = Button;
|
|
775
738
|
|
|
776
739
|
// src/components/Calendar/Calendar.tsx
|
|
777
|
-
import React13, { Fragment, forwardRef as forwardRef4, useCallback as useCallback6, useEffect as useEffect3, useMemo as
|
|
740
|
+
import React13, { Fragment, forwardRef as forwardRef4, useCallback as useCallback6, useEffect as useEffect3, useMemo as useMemo5, useRef as useRef3, useState as useState5 } from "react";
|
|
778
741
|
import { styled as styled5 } from "@mui/joy";
|
|
779
742
|
import ChevronLeftIcon from "@mui/icons-material/ChevronLeft";
|
|
780
743
|
import ChevronRightIcon from "@mui/icons-material/ChevronRight";
|
|
@@ -868,7 +831,7 @@ var isSameMonth = (date1, date2) => {
|
|
|
868
831
|
};
|
|
869
832
|
|
|
870
833
|
// src/components/Calendar/hooks/use-calendar-props.ts
|
|
871
|
-
import { useCallback as useCallback4, useMemo as
|
|
834
|
+
import { useCallback as useCallback4, useMemo as useMemo4, useState as useState3 } from "react";
|
|
872
835
|
import { useThemeProps as useThemeProps3 } from "@mui/joy";
|
|
873
836
|
var resolveView = (view, views) => {
|
|
874
837
|
return views.includes(view) ? view : views[0];
|
|
@@ -888,12 +851,12 @@ var useCalendarProps = (inProps) => {
|
|
|
888
851
|
});
|
|
889
852
|
const [[page, direction], setPage] = useState3([0, 0]);
|
|
890
853
|
const resolvedView = inProps.view ?? uncontrolledView;
|
|
891
|
-
const resolvedMinDate =
|
|
854
|
+
const resolvedMinDate = useMemo4(() => {
|
|
892
855
|
const minDate = inProps.minDate || /* @__PURE__ */ new Date(0);
|
|
893
856
|
minDate.setHours(0, 0, 0, 0);
|
|
894
857
|
return minDate;
|
|
895
858
|
}, [inProps.minDate]);
|
|
896
|
-
const resolvedMaxDate =
|
|
859
|
+
const resolvedMaxDate = useMemo4(() => {
|
|
897
860
|
const maxDate = inProps.maxDate || /* @__PURE__ */ new Date(864e13);
|
|
898
861
|
maxDate.setHours(0, 0, 0, 0);
|
|
899
862
|
return maxDate;
|
|
@@ -952,7 +915,7 @@ var useCalendarProps = (inProps) => {
|
|
|
952
915
|
},
|
|
953
916
|
name: "Calendar"
|
|
954
917
|
});
|
|
955
|
-
const ownerState =
|
|
918
|
+
const ownerState = useMemo4(() => ({ ...props, viewMonth, direction }), [props, viewMonth, direction]);
|
|
956
919
|
return [props, ownerState];
|
|
957
920
|
};
|
|
958
921
|
|
|
@@ -1384,8 +1347,8 @@ var swipePower = (offset, velocity) => {
|
|
|
1384
1347
|
var PickerDays = (props) => {
|
|
1385
1348
|
const { ownerState } = props;
|
|
1386
1349
|
const { getPickerDayProps, getDayCellProps } = useCalendar(ownerState);
|
|
1387
|
-
const calendarDates =
|
|
1388
|
-
const weekdayNames =
|
|
1350
|
+
const calendarDates = useMemo5(() => getCalendarDates(ownerState.viewMonth), [ownerState.viewMonth]);
|
|
1351
|
+
const weekdayNames = useMemo5(() => getWeekdayNames(ownerState.locale || "default"), [ownerState.locale]);
|
|
1389
1352
|
return /* @__PURE__ */ React13.createElement(CalendarViewContainer, { calendarType: "datePicker" }, /* @__PURE__ */ React13.createElement(AnimatePresence, { initial: false, custom: ownerState.direction }, /* @__PURE__ */ React13.createElement(
|
|
1390
1353
|
CalendarViewTable,
|
|
1391
1354
|
{
|
|
@@ -1469,8 +1432,8 @@ var PickerMonths = (props) => {
|
|
|
1469
1432
|
};
|
|
1470
1433
|
var PlainPickerDays = ({ ownerState }) => {
|
|
1471
1434
|
const { getPickerDayProps, getDayCellProps } = useCalendar(ownerState);
|
|
1472
|
-
const calendarDates =
|
|
1473
|
-
const weekdayNames =
|
|
1435
|
+
const calendarDates = useMemo5(() => getCalendarDates(ownerState.viewMonth), [ownerState.viewMonth]);
|
|
1436
|
+
const weekdayNames = useMemo5(() => getWeekdayNames(ownerState.locale || "default"), [ownerState.locale]);
|
|
1474
1437
|
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(
|
|
1475
1438
|
(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" }))
|
|
1476
1439
|
)), rowIndex < calendarDates.length - 1 && /* @__PURE__ */ React13.createElement("tr", { "aria-hidden": "true", "aria-description": "row-gap" }, /* @__PURE__ */ React13.createElement("td", { colSpan: 13, style: { height: 4 } }))))));
|
|
@@ -1849,7 +1812,7 @@ var Container = forwardRef5(function Container2(props, ref) {
|
|
|
1849
1812
|
Container.displayName = "Container";
|
|
1850
1813
|
|
|
1851
1814
|
// src/components/CurrencyInput/CurrencyInput.tsx
|
|
1852
|
-
import React17, { useCallback as useCallback8, useMemo as
|
|
1815
|
+
import React17, { useCallback as useCallback8, useMemo as useMemo6 } from "react";
|
|
1853
1816
|
import { NumericFormat } from "react-number-format";
|
|
1854
1817
|
|
|
1855
1818
|
// src/components/Input/Input.tsx
|
|
@@ -2183,19 +2146,19 @@ var CurrencyInput = React17.forwardRef(function CurrencyInput2(inProps, ref) {
|
|
|
2183
2146
|
props.defaultValue ?? null,
|
|
2184
2147
|
useCallback8((value2) => onChange?.({ target: { name, value: value2 } }), [onChange, name])
|
|
2185
2148
|
);
|
|
2186
|
-
const value =
|
|
2149
|
+
const value = useMemo6(() => {
|
|
2187
2150
|
if (_value && useMinorUnit) {
|
|
2188
2151
|
return _value / Math.pow(10, decimalScale);
|
|
2189
2152
|
}
|
|
2190
2153
|
return _value;
|
|
2191
2154
|
}, [_value, useMinorUnit, decimalScale]);
|
|
2192
|
-
const max =
|
|
2155
|
+
const max = useMemo6(() => {
|
|
2193
2156
|
if (props.max && useMinorUnit) {
|
|
2194
2157
|
return props.max / Math.pow(10, decimalScale);
|
|
2195
2158
|
}
|
|
2196
2159
|
return props.max;
|
|
2197
2160
|
}, [props.max, useMinorUnit, decimalScale]);
|
|
2198
|
-
const isOverLimit =
|
|
2161
|
+
const isOverLimit = useMemo6(() => max != null && value != null && value > max, [max, value]);
|
|
2199
2162
|
const handleChange = useCallback8(
|
|
2200
2163
|
(event) => {
|
|
2201
2164
|
if (event.target.value === "") {
|
|
@@ -2246,7 +2209,7 @@ var CurrencyInput_default = CurrencyInput;
|
|
|
2246
2209
|
// src/components/DataTable/DataTable.tsx
|
|
2247
2210
|
import React26, {
|
|
2248
2211
|
useCallback as useCallback13,
|
|
2249
|
-
useMemo as
|
|
2212
|
+
useMemo as useMemo11,
|
|
2250
2213
|
useRef as useRef7,
|
|
2251
2214
|
useId,
|
|
2252
2215
|
forwardRef as forwardRef7,
|
|
@@ -2480,9 +2443,6 @@ function computeAutoFitWidth(params) {
|
|
|
2480
2443
|
if (!isNaN(maxPx) && maxPx > 0) finalWidth = Math.min(finalWidth, maxPx);
|
|
2481
2444
|
return finalWidth;
|
|
2482
2445
|
}
|
|
2483
|
-
function getHeaderCellId(tableId, columnId) {
|
|
2484
|
-
return `${tableId}_header_${columnId}`.trim();
|
|
2485
|
-
}
|
|
2486
2446
|
|
|
2487
2447
|
// src/components/DataTable/styled.tsx
|
|
2488
2448
|
import React18 from "react";
|
|
@@ -2674,7 +2634,7 @@ import React23, {
|
|
|
2674
2634
|
useRef as useRef5,
|
|
2675
2635
|
useState as useState8,
|
|
2676
2636
|
useLayoutEffect,
|
|
2677
|
-
useMemo as
|
|
2637
|
+
useMemo as useMemo9,
|
|
2678
2638
|
useCallback as useCallback10,
|
|
2679
2639
|
useEffect as useEffect5,
|
|
2680
2640
|
memo,
|
|
@@ -3158,7 +3118,7 @@ import React20 from "react";
|
|
|
3158
3118
|
import { Textarea as JoyTextarea } from "@mui/joy";
|
|
3159
3119
|
import { motion as motion19 } from "framer-motion";
|
|
3160
3120
|
var MotionTextarea = motion19(JoyTextarea);
|
|
3161
|
-
var
|
|
3121
|
+
var Textarea = (props) => {
|
|
3162
3122
|
const {
|
|
3163
3123
|
label,
|
|
3164
3124
|
error,
|
|
@@ -3202,17 +3162,13 @@ var TextareaBase = (props) => {
|
|
|
3202
3162
|
helperText && /* @__PURE__ */ React20.createElement(FormHelperText_default, null, helperText)
|
|
3203
3163
|
);
|
|
3204
3164
|
};
|
|
3205
|
-
var Textarea = React20.forwardRef((props, ref) => {
|
|
3206
|
-
const textareaSlotProps = useSlotRef(props.slotProps?.textarea, ref);
|
|
3207
|
-
return /* @__PURE__ */ React20.createElement(TextareaBase, { ...props, slotProps: { ...props.slotProps, textarea: textareaSlotProps } });
|
|
3208
|
-
});
|
|
3209
3165
|
Textarea.displayName = "Textarea";
|
|
3210
3166
|
|
|
3211
3167
|
// src/components/Textarea/index.ts
|
|
3212
3168
|
var Textarea_default = Textarea;
|
|
3213
3169
|
|
|
3214
3170
|
// src/components/Select/Select.tsx
|
|
3215
|
-
import React21, { useMemo as
|
|
3171
|
+
import React21, { useMemo as useMemo8 } from "react";
|
|
3216
3172
|
import {
|
|
3217
3173
|
Select as JoySelect,
|
|
3218
3174
|
Option as JoyOption,
|
|
@@ -3228,7 +3184,7 @@ var secondaryTextLevelMap2 = {
|
|
|
3228
3184
|
lg: "body-md"
|
|
3229
3185
|
};
|
|
3230
3186
|
Option.displayName = "Option";
|
|
3231
|
-
function
|
|
3187
|
+
function Select(props) {
|
|
3232
3188
|
const {
|
|
3233
3189
|
label,
|
|
3234
3190
|
helperText,
|
|
@@ -3254,7 +3210,7 @@ function SelectInner(props, ref) {
|
|
|
3254
3210
|
formHelperText: formHelperTextProps,
|
|
3255
3211
|
...joySlotProps
|
|
3256
3212
|
} = slotProps ?? {};
|
|
3257
|
-
const options =
|
|
3213
|
+
const options = useMemo8(
|
|
3258
3214
|
() => props.options.map((option) => {
|
|
3259
3215
|
if (option.hasOwnProperty("value") && option.hasOwnProperty("label")) {
|
|
3260
3216
|
return option;
|
|
@@ -3279,14 +3235,13 @@ function SelectInner(props, ref) {
|
|
|
3279
3235
|
};
|
|
3280
3236
|
onChange?.(newEvent, newValue);
|
|
3281
3237
|
};
|
|
3282
|
-
const optionMap =
|
|
3238
|
+
const optionMap = useMemo8(() => {
|
|
3283
3239
|
const map = /* @__PURE__ */ new Map();
|
|
3284
3240
|
options.forEach((option) => {
|
|
3285
3241
|
map.set(option.value, option);
|
|
3286
3242
|
});
|
|
3287
3243
|
return map;
|
|
3288
3244
|
}, [options]);
|
|
3289
|
-
const buttonSlotProps = useSlotRef(joySlotProps.button, ref);
|
|
3290
3245
|
const select = /* @__PURE__ */ React21.createElement(
|
|
3291
3246
|
JoySelect,
|
|
3292
3247
|
{
|
|
@@ -3295,7 +3250,7 @@ function SelectInner(props, ref) {
|
|
|
3295
3250
|
disabled,
|
|
3296
3251
|
size,
|
|
3297
3252
|
color: error ? "danger" : color,
|
|
3298
|
-
slotProps:
|
|
3253
|
+
slotProps: joySlotProps,
|
|
3299
3254
|
onChange: handleChange,
|
|
3300
3255
|
renderValue: (selected) => {
|
|
3301
3256
|
if (!selected) return null;
|
|
@@ -3325,7 +3280,6 @@ function SelectInner(props, ref) {
|
|
|
3325
3280
|
helperText && /* @__PURE__ */ React21.createElement(FormHelperText_default, { ...formHelperTextProps }, helperText)
|
|
3326
3281
|
);
|
|
3327
3282
|
}
|
|
3328
|
-
var Select = React21.forwardRef(SelectInner);
|
|
3329
3283
|
Select.displayName = "Select";
|
|
3330
3284
|
|
|
3331
3285
|
// src/components/Select/index.ts
|
|
@@ -3440,8 +3394,7 @@ var HeadCell = (props) => {
|
|
|
3440
3394
|
tableColRef,
|
|
3441
3395
|
headerClassName,
|
|
3442
3396
|
headerLineClamp,
|
|
3443
|
-
onAutoFit
|
|
3444
|
-
columnId
|
|
3397
|
+
onAutoFit
|
|
3445
3398
|
} = props;
|
|
3446
3399
|
const theme = useTheme();
|
|
3447
3400
|
const ref = headerRef;
|
|
@@ -3452,20 +3405,23 @@ var HeadCell = (props) => {
|
|
|
3452
3405
|
}, [ref]);
|
|
3453
3406
|
const [isHovered, setIsHovered] = useState8(false);
|
|
3454
3407
|
const sortable = type === "actions" ? false : _sortable;
|
|
3455
|
-
const headId =
|
|
3408
|
+
const headId = useMemo9(
|
|
3409
|
+
() => `${tableId}_header_${headerName ?? field}`.trim(),
|
|
3410
|
+
[tableId, headerName, field]
|
|
3411
|
+
);
|
|
3456
3412
|
const isResizingRef = useRef5(false);
|
|
3457
|
-
const resizer =
|
|
3413
|
+
const resizer = useMemo9(
|
|
3458
3414
|
() => resizable ?? true ? Resizer(
|
|
3459
3415
|
ref,
|
|
3460
3416
|
colRef,
|
|
3461
3417
|
(isResizing) => {
|
|
3462
3418
|
isResizingRef.current = isResizing;
|
|
3463
3419
|
},
|
|
3464
|
-
onAutoFit ? () => onAutoFit(
|
|
3420
|
+
onAutoFit ? () => onAutoFit(field) : void 0
|
|
3465
3421
|
) : null,
|
|
3466
|
-
[resizable, ref, colRef, onAutoFit,
|
|
3422
|
+
[resizable, ref, colRef, onAutoFit, field]
|
|
3467
3423
|
);
|
|
3468
|
-
const style =
|
|
3424
|
+
const style = useMemo9(
|
|
3469
3425
|
() => ({
|
|
3470
3426
|
width,
|
|
3471
3427
|
minWidth: minWidth ?? "50px",
|
|
@@ -3483,7 +3439,7 @@ var HeadCell = (props) => {
|
|
|
3483
3439
|
);
|
|
3484
3440
|
const textAlign = getTextAlign(props);
|
|
3485
3441
|
const initialSort = sortOrder[0];
|
|
3486
|
-
const sortIcon =
|
|
3442
|
+
const sortIcon = useMemo9(() => {
|
|
3487
3443
|
const isSorted = !!sort;
|
|
3488
3444
|
const isVisible = sortable && (isSorted || isHovered);
|
|
3489
3445
|
return /* @__PURE__ */ React23.createElement(AnimatePresence2, { mode: "wait" }, isVisible && /* @__PURE__ */ React23.createElement(
|
|
@@ -3514,17 +3470,17 @@ var HeadCell = (props) => {
|
|
|
3514
3470
|
}
|
|
3515
3471
|
));
|
|
3516
3472
|
}, [headId, initialSort, sort, sortable, isHovered]);
|
|
3517
|
-
const infoSign =
|
|
3473
|
+
const infoSign = useMemo9(
|
|
3518
3474
|
() => description ? /* @__PURE__ */ React23.createElement(InfoSign_default, { message: description, placement: "bottom" }) : null,
|
|
3519
3475
|
[description]
|
|
3520
3476
|
);
|
|
3521
|
-
const params =
|
|
3477
|
+
const params = useMemo9(
|
|
3522
3478
|
() => ({
|
|
3523
3479
|
field
|
|
3524
3480
|
}),
|
|
3525
3481
|
[field]
|
|
3526
3482
|
);
|
|
3527
|
-
const computedHeaderClassName =
|
|
3483
|
+
const computedHeaderClassName = useMemo9(
|
|
3528
3484
|
() => (typeof headerClassName === "function" ? headerClassName(params) : headerClassName) || void 0,
|
|
3529
3485
|
[headerClassName, params]
|
|
3530
3486
|
);
|
|
@@ -3578,7 +3534,7 @@ var BodyCell = (props) => {
|
|
|
3578
3534
|
const theme = useTheme();
|
|
3579
3535
|
const [value, setValue] = useState8(row[field]);
|
|
3580
3536
|
const cellRef = useRef5(null);
|
|
3581
|
-
const params =
|
|
3537
|
+
const params = useMemo9(
|
|
3582
3538
|
() => ({
|
|
3583
3539
|
row,
|
|
3584
3540
|
value,
|
|
@@ -3587,20 +3543,20 @@ var BodyCell = (props) => {
|
|
|
3587
3543
|
}),
|
|
3588
3544
|
[row, rowId, value, field]
|
|
3589
3545
|
);
|
|
3590
|
-
const editMode =
|
|
3546
|
+
const editMode = useMemo9(
|
|
3591
3547
|
() => !!(props.editMode && (typeof isCellEditable === "function" ? isCellEditable(params) : isCellEditable ?? true)),
|
|
3592
3548
|
[props.editMode, isCellEditable, params]
|
|
3593
3549
|
);
|
|
3594
3550
|
const propsComponentProps = "componentProps" in props ? props.componentProps : null;
|
|
3595
3551
|
const hasComponentProps = "componentProps" in props;
|
|
3596
|
-
const componentProps =
|
|
3552
|
+
const componentProps = useMemo9(
|
|
3597
3553
|
() => ({
|
|
3598
3554
|
...hasComponentProps && (typeof propsComponentProps === "function" ? propsComponentProps(params) : propsComponentProps || {}),
|
|
3599
3555
|
size: "sm"
|
|
3600
3556
|
}),
|
|
3601
3557
|
[hasComponentProps, propsComponentProps, params]
|
|
3602
3558
|
);
|
|
3603
|
-
const editModeComponentProps =
|
|
3559
|
+
const editModeComponentProps = useMemo9(
|
|
3604
3560
|
() => ({
|
|
3605
3561
|
...componentProps,
|
|
3606
3562
|
onChange: (e) => {
|
|
@@ -3662,9 +3618,9 @@ var BodyCell = (props) => {
|
|
|
3662
3618
|
}),
|
|
3663
3619
|
[params, row, field, value, componentProps, type, onCellEditStop, onCellEditStart]
|
|
3664
3620
|
);
|
|
3665
|
-
const MemoizedRenderEditCell =
|
|
3666
|
-
const MemoizedRenderCell =
|
|
3667
|
-
const EditModeComponent =
|
|
3621
|
+
const MemoizedRenderEditCell = useMemo9(() => renderEditCell ? memo(renderEditCell) : null, [renderEditCell]);
|
|
3622
|
+
const MemoizedRenderCell = useMemo9(() => renderCell ? memo(renderCell) : null, [renderCell]);
|
|
3623
|
+
const EditModeComponent = useMemo9(() => {
|
|
3668
3624
|
if (MemoizedRenderEditCell) {
|
|
3669
3625
|
return createElement(MemoizedRenderEditCell, params);
|
|
3670
3626
|
}
|
|
@@ -3699,7 +3655,7 @@ var BodyCell = (props) => {
|
|
|
3699
3655
|
}[type || "text"];
|
|
3700
3656
|
}, [value, editModeComponentProps, type, MemoizedRenderEditCell, params]);
|
|
3701
3657
|
const linkComponentFromProps = props.component;
|
|
3702
|
-
const ReadModeComponent =
|
|
3658
|
+
const ReadModeComponent = useMemo9(() => {
|
|
3703
3659
|
if (MemoizedRenderCell) {
|
|
3704
3660
|
return createElement(MemoizedRenderCell, params);
|
|
3705
3661
|
}
|
|
@@ -3713,15 +3669,15 @@ var BodyCell = (props) => {
|
|
|
3713
3669
|
return typedComponent || innerText;
|
|
3714
3670
|
}, [value, MemoizedRenderCell, params, type, componentProps, linkComponentFromProps]);
|
|
3715
3671
|
const getActions = props.getActions;
|
|
3716
|
-
const CellComponent =
|
|
3672
|
+
const CellComponent = useMemo9(() => {
|
|
3717
3673
|
if (type === "actions") {
|
|
3718
3674
|
return /* @__PURE__ */ React23.createElement(Stack_default, { direction: "row", gap: 1, justifyContent: "center", alignItems: "center" }, getActions?.(params));
|
|
3719
3675
|
}
|
|
3720
3676
|
return editMode && EditModeComponent ? EditModeComponent : ReadModeComponent;
|
|
3721
3677
|
}, [type, getActions, params, editMode, EditModeComponent, ReadModeComponent]);
|
|
3722
|
-
const showTooltip =
|
|
3678
|
+
const showTooltip = useMemo9(() => noWrap && type === "longText", [noWrap, type]);
|
|
3723
3679
|
const isBoundary = props.isLastStartPinnedColumn || props.isLastEndPinnedColumn;
|
|
3724
|
-
const computedCellClassName =
|
|
3680
|
+
const computedCellClassName = useMemo9(
|
|
3725
3681
|
() => (typeof cellClassName === "function" ? cellClassName(params) : cellClassName) || "",
|
|
3726
3682
|
[cellClassName, params]
|
|
3727
3683
|
);
|
|
@@ -3733,7 +3689,7 @@ var BodyCell = (props) => {
|
|
|
3733
3689
|
{
|
|
3734
3690
|
ref: cellRef,
|
|
3735
3691
|
key: field,
|
|
3736
|
-
headers:
|
|
3692
|
+
headers: `${tableId}_header_${props.headerName ?? field}`,
|
|
3737
3693
|
sx: {
|
|
3738
3694
|
textAlign: getTextAlign({ type }),
|
|
3739
3695
|
verticalAlign: editMode ? "top" : "middle",
|
|
@@ -3745,7 +3701,7 @@ var BodyCell = (props) => {
|
|
|
3745
3701
|
},
|
|
3746
3702
|
className: [isLastStartPinnedColumn && "is-last-left", isLastEndPinnedColumn && "is-last-right", computedCellClassName].filter(Boolean).join(" ") || ""
|
|
3747
3703
|
},
|
|
3748
|
-
|
|
3704
|
+
useMemo9(
|
|
3749
3705
|
() => showTooltip ? /* @__PURE__ */ React23.createElement(CellTextEllipsis, null, CellComponent) : CellComponent,
|
|
3750
3706
|
[CellComponent, showTooltip]
|
|
3751
3707
|
)
|
|
@@ -3798,46 +3754,36 @@ var VirtualizedTableRow = memo(StyledTableRow2, (prevProps, nextProps) => {
|
|
|
3798
3754
|
});
|
|
3799
3755
|
|
|
3800
3756
|
// src/components/DataTable/hooks.ts
|
|
3801
|
-
import { useState as useState9, useLayoutEffect as useLayoutEffect2, useRef as useRef6, useMemo as
|
|
3802
|
-
function useColumnWidths(
|
|
3757
|
+
import { useState as useState9, useLayoutEffect as useLayoutEffect2, useRef as useRef6, useMemo as useMemo10, useCallback as useCallback11, useEffect as useEffect6, createRef } from "react";
|
|
3758
|
+
function useColumnWidths(columnsByField) {
|
|
3803
3759
|
const [widths, setWidths] = useState9({});
|
|
3804
3760
|
const roRef = useRef6();
|
|
3805
3761
|
useLayoutEffect2(() => {
|
|
3806
3762
|
if (roRef.current) roRef.current.disconnect();
|
|
3807
3763
|
roRef.current = new ResizeObserver((entries) => {
|
|
3764
|
+
let changed = false;
|
|
3808
3765
|
setWidths((prev) => {
|
|
3809
|
-
let changed = false;
|
|
3810
3766
|
const next = { ...prev };
|
|
3811
3767
|
entries.forEach((entry) => {
|
|
3812
|
-
const
|
|
3768
|
+
const field = entry.target.dataset.field;
|
|
3813
3769
|
const w = Math.round(entry.target.getBoundingClientRect().width);
|
|
3814
|
-
if (
|
|
3815
|
-
|
|
3816
|
-
next[columnId] = w;
|
|
3770
|
+
if (next[field] !== w) {
|
|
3771
|
+
next[field] = w;
|
|
3817
3772
|
changed = true;
|
|
3818
3773
|
}
|
|
3819
3774
|
});
|
|
3820
3775
|
return changed ? next : prev;
|
|
3821
3776
|
});
|
|
3822
3777
|
});
|
|
3823
|
-
|
|
3824
|
-
Object.entries(columnsById).forEach(([columnId, def]) => {
|
|
3778
|
+
Object.entries(columnsByField).forEach(([field, def]) => {
|
|
3825
3779
|
const el = def.headerRef.current;
|
|
3826
3780
|
if (el) {
|
|
3827
|
-
el.dataset.
|
|
3828
|
-
el.dataset.field = String(def.field);
|
|
3829
|
-
const w = Math.round(el.getBoundingClientRect().width);
|
|
3830
|
-
if (w > 0) measured[columnId] = w;
|
|
3781
|
+
el.dataset.field = field;
|
|
3831
3782
|
roRef.current.observe(el);
|
|
3832
3783
|
}
|
|
3833
3784
|
});
|
|
3834
|
-
setWidths((prev) => {
|
|
3835
|
-
const keys = Object.keys(measured);
|
|
3836
|
-
const same = keys.length === Object.keys(prev).length && keys.every((key) => prev[key] === measured[key]);
|
|
3837
|
-
return same ? prev : measured;
|
|
3838
|
-
});
|
|
3839
3785
|
return () => roRef.current?.disconnect();
|
|
3840
|
-
}, [
|
|
3786
|
+
}, [columnsByField]);
|
|
3841
3787
|
return widths;
|
|
3842
3788
|
}
|
|
3843
3789
|
function useDataTableRenderer({
|
|
@@ -3886,23 +3832,16 @@ function useDataTableRenderer({
|
|
|
3886
3832
|
[onColumnVisibilityModelChange]
|
|
3887
3833
|
)
|
|
3888
3834
|
);
|
|
3889
|
-
const reorderedColumns =
|
|
3835
|
+
const reorderedColumns = useMemo10(() => {
|
|
3890
3836
|
if (!columnGroupingModel) return columnsProp;
|
|
3891
3837
|
return reorderColumnsByGroupingModel(columnsProp, columnGroupingModel);
|
|
3892
3838
|
}, [columnsProp, columnGroupingModel]);
|
|
3893
|
-
const
|
|
3894
|
-
() => reorderedColumns.
|
|
3895
|
-
if (visibilityModel[col.field] !== false) acc.push(index);
|
|
3896
|
-
return acc;
|
|
3897
|
-
}, []),
|
|
3839
|
+
const visibleColumns = useMemo10(
|
|
3840
|
+
() => reorderedColumns.filter((col) => visibilityModel[col.field] !== false),
|
|
3898
3841
|
[reorderedColumns, visibilityModel]
|
|
3899
3842
|
);
|
|
3900
|
-
const
|
|
3901
|
-
|
|
3902
|
-
[visibleColumnIndexes, reorderedColumns]
|
|
3903
|
-
);
|
|
3904
|
-
const visibleFieldSet = useMemo11(() => new Set(visibleColumns.map((c) => c.field)), [visibleColumns]);
|
|
3905
|
-
const tableMinWidth = useMemo11(() => {
|
|
3843
|
+
const visibleFieldSet = useMemo10(() => new Set(visibleColumns.map((c) => c.field)), [visibleColumns]);
|
|
3844
|
+
const tableMinWidth = useMemo10(() => {
|
|
3906
3845
|
const DEFAULT_MIN = 50;
|
|
3907
3846
|
let total = checkboxSelection ? 40 : 0;
|
|
3908
3847
|
for (const col of visibleColumns) {
|
|
@@ -3910,7 +3849,7 @@ function useDataTableRenderer({
|
|
|
3910
3849
|
}
|
|
3911
3850
|
return total;
|
|
3912
3851
|
}, [visibleColumns, checkboxSelection]);
|
|
3913
|
-
const allColumnsByField =
|
|
3852
|
+
const allColumnsByField = useMemo10(
|
|
3914
3853
|
() => reorderedColumns.reduce(
|
|
3915
3854
|
(acc, curr) => ({
|
|
3916
3855
|
...acc,
|
|
@@ -3920,37 +3859,19 @@ function useDataTableRenderer({
|
|
|
3920
3859
|
),
|
|
3921
3860
|
[reorderedColumns]
|
|
3922
3861
|
);
|
|
3923
|
-
const
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
assigned.add(field);
|
|
3930
|
-
return field;
|
|
3931
|
-
}
|
|
3932
|
-
let n = 2;
|
|
3933
|
-
while (taken.has(`${field}__${n}`)) n += 1;
|
|
3934
|
-
taken.add(`${field}__${n}`);
|
|
3935
|
-
return `${field}__${n}`;
|
|
3936
|
-
});
|
|
3937
|
-
}, [reorderedColumns]);
|
|
3938
|
-
const columnIds = useMemo11(
|
|
3939
|
-
() => visibleColumnIndexes.map((index) => allColumnIds[index]),
|
|
3940
|
-
[visibleColumnIndexes, allColumnIds]
|
|
3941
|
-
);
|
|
3942
|
-
const visibleColumnsById = useMemo11(
|
|
3943
|
-
() => Object.fromEntries(
|
|
3944
|
-
visibleColumns.map((column, index) => [
|
|
3945
|
-
columnIds[index],
|
|
3946
|
-
{
|
|
3947
|
-
...column,
|
|
3862
|
+
const visibleColumnsByField = useMemo10(
|
|
3863
|
+
() => visibleColumns.reduce(
|
|
3864
|
+
(acc, curr) => ({
|
|
3865
|
+
...acc,
|
|
3866
|
+
[curr.field]: {
|
|
3867
|
+
...curr,
|
|
3948
3868
|
headerRef: createRef(),
|
|
3949
3869
|
tableColRef: createRef()
|
|
3950
3870
|
}
|
|
3951
|
-
|
|
3871
|
+
}),
|
|
3872
|
+
{}
|
|
3952
3873
|
),
|
|
3953
|
-
[visibleColumns
|
|
3874
|
+
[visibleColumns]
|
|
3954
3875
|
);
|
|
3955
3876
|
const sortComparator = useCallback11(
|
|
3956
3877
|
(rowA, rowB) => {
|
|
@@ -3981,11 +3902,11 @@ function useDataTableRenderer({
|
|
|
3981
3902
|
},
|
|
3982
3903
|
[sortModel, allColumnsByField]
|
|
3983
3904
|
);
|
|
3984
|
-
const rows =
|
|
3905
|
+
const rows = useMemo10(
|
|
3985
3906
|
() => sortModel.length ? [..._rows].sort(sortComparator) : _rows,
|
|
3986
3907
|
[_rows, sortModel, sortComparator]
|
|
3987
3908
|
);
|
|
3988
|
-
const sortOrder =
|
|
3909
|
+
const sortOrder = useMemo10(
|
|
3989
3910
|
() => Array.from(new Set(_sortOrder || ["asc", "desc", null])),
|
|
3990
3911
|
[_sortOrder]
|
|
3991
3912
|
);
|
|
@@ -3995,12 +3916,12 @@ function useDataTableRenderer({
|
|
|
3995
3916
|
(row, index) => _getId?.(row) ?? row.id ?? `${(index || 0) + (page - 1) * pageSize}`,
|
|
3996
3917
|
[_getId, page, pageSize]
|
|
3997
3918
|
);
|
|
3998
|
-
const selectedModelSet =
|
|
3999
|
-
const dataInPage =
|
|
3919
|
+
const selectedModelSet = useMemo10(() => new Set(selectionModel || []), [selectionModel]);
|
|
3920
|
+
const dataInPage = useMemo10(
|
|
4000
3921
|
() => !pagination || paginationMode === "server" ? rows : rows.slice((page - 1) * pageSize, (page - 1) * pageSize + pageSize),
|
|
4001
3922
|
[rows, page, pageSize, paginationMode, pagination]
|
|
4002
3923
|
);
|
|
4003
|
-
const selectableDataInPage =
|
|
3924
|
+
const selectableDataInPage = useMemo10(
|
|
4004
3925
|
() => dataInPage.filter((row, i) => {
|
|
4005
3926
|
if (!isRowSelectable) return true;
|
|
4006
3927
|
return isRowSelectable({ row, id: getId(row, i) });
|
|
@@ -4030,60 +3951,51 @@ function useDataTableRenderer({
|
|
|
4030
3951
|
},
|
|
4031
3952
|
[dataInPage, getId, isRowSelectable, selectionModel, onSelectionModelChange]
|
|
4032
3953
|
);
|
|
4033
|
-
const isAllSelected =
|
|
3954
|
+
const isAllSelected = useMemo10(
|
|
4034
3955
|
() => selectableDataInPage.length > 0 && selectableDataInPage.every((row, i) => selectedModelSet.has(getId(row, i))),
|
|
4035
3956
|
[selectableDataInPage, selectedModelSet, getId]
|
|
4036
3957
|
);
|
|
4037
3958
|
const rowCount = totalRowsProp || rows.length;
|
|
4038
|
-
const selectableRowCount =
|
|
3959
|
+
const selectableRowCount = useMemo10(() => {
|
|
4039
3960
|
if (!isRowSelectable) return rowCount;
|
|
4040
3961
|
return rows.filter((row, i) => isRowSelectable({ row, id: getId(row, i) })).length;
|
|
4041
3962
|
}, [rows, isRowSelectable, getId, rowCount]);
|
|
4042
|
-
const isTotalSelected =
|
|
3963
|
+
const isTotalSelected = useMemo10(
|
|
4043
3964
|
() => _isTotalSelected ?? (selectableRowCount > 0 && (selectionModel?.length || 0) === selectableRowCount),
|
|
4044
3965
|
[_isTotalSelected, selectionModel, selectableRowCount]
|
|
4045
3966
|
);
|
|
4046
|
-
const columnWidths = useColumnWidths(
|
|
4047
|
-
const measuredWidthByField = useMemo11(
|
|
4048
|
-
() => Object.fromEntries(
|
|
4049
|
-
Object.entries(visibleColumnsById).map(([columnId, column]) => [column.field, columnWidths[columnId]])
|
|
4050
|
-
),
|
|
4051
|
-
[visibleColumnsById, columnWidths]
|
|
4052
|
-
);
|
|
3967
|
+
const columnWidths = useColumnWidths(visibleColumnsByField);
|
|
4053
3968
|
const getWidth = useCallback11(
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
[measuredWidthByField, allColumnsByField]
|
|
3969
|
+
(f) => columnWidths[f] ?? allColumnsByField[f]?.width ?? // Column prop 으로 지정된 width
|
|
3970
|
+
allColumnsByField[f]?.minWidth ?? 0,
|
|
3971
|
+
[columnWidths, allColumnsByField]
|
|
4058
3972
|
);
|
|
4059
|
-
const processedColumnGroups =
|
|
3973
|
+
const processedColumnGroups = useMemo10(() => {
|
|
4060
3974
|
if (!columnGroupingModel) return null;
|
|
4061
3975
|
return calculateColumnGroups(columnGroupingModel, visibleColumns, visibleFieldSet);
|
|
4062
3976
|
}, [columnGroupingModel, visibleColumns, visibleFieldSet]);
|
|
4063
|
-
const effectivePinnedLeft =
|
|
3977
|
+
const effectivePinnedLeft = useMemo10(
|
|
4064
3978
|
() => pinnedColumns?.left?.filter((f) => visibleFieldSet.has(f)),
|
|
4065
3979
|
[pinnedColumns?.left, visibleFieldSet]
|
|
4066
3980
|
);
|
|
4067
|
-
const effectivePinnedRight =
|
|
3981
|
+
const effectivePinnedRight = useMemo10(
|
|
4068
3982
|
() => pinnedColumns?.right?.filter((f) => visibleFieldSet.has(f)),
|
|
4069
3983
|
[pinnedColumns?.right, visibleFieldSet]
|
|
4070
3984
|
);
|
|
4071
3985
|
const inferredFieldsKey = JSON.stringify(Object.keys(rows[0] || {}));
|
|
4072
|
-
const inferredFields =
|
|
4073
|
-
const columns =
|
|
3986
|
+
const inferredFields = useMemo10(() => JSON.parse(inferredFieldsKey), [inferredFieldsKey]);
|
|
3987
|
+
const columns = useMemo10(() => {
|
|
4074
3988
|
const baseColumns = visibleColumns.length > 0 ? visibleColumns : reorderedColumns.length > 0 ? [] : inferredFields.map((key) => ({
|
|
4075
3989
|
field: key
|
|
4076
3990
|
}));
|
|
4077
|
-
return baseColumns.map((column
|
|
4078
|
-
const columnId = columnIds[index] ?? String(column.field);
|
|
3991
|
+
return baseColumns.map((column) => {
|
|
4079
3992
|
const isLeftPinned = effectivePinnedLeft?.includes(column.field);
|
|
4080
3993
|
const isRightPinned = effectivePinnedRight?.includes(column.field);
|
|
4081
3994
|
const isPinned = isLeftPinned || isRightPinned;
|
|
4082
3995
|
return {
|
|
4083
3996
|
...column,
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
tableColRef: visibleColumnsById[columnId]?.tableColRef,
|
|
3997
|
+
headerRef: visibleColumnsByField[column.field]?.headerRef,
|
|
3998
|
+
tableColRef: visibleColumnsByField[column.field]?.tableColRef,
|
|
4087
3999
|
isCellEditable: editMode && (typeof column.isCellEditable === "function" ? column.isCellEditable : column.isCellEditable ?? true),
|
|
4088
4000
|
sort: sortModel.find((sort) => sort.field === column.field)?.sort,
|
|
4089
4001
|
sortOrder: allColumnsByField[column.field]?.sortOrder || sortOrder,
|
|
@@ -4100,8 +4012,7 @@ function useDataTableRenderer({
|
|
|
4100
4012
|
inferredFields,
|
|
4101
4013
|
effectivePinnedLeft,
|
|
4102
4014
|
effectivePinnedRight,
|
|
4103
|
-
|
|
4104
|
-
visibleColumnsById,
|
|
4015
|
+
visibleColumnsByField,
|
|
4105
4016
|
allColumnsByField,
|
|
4106
4017
|
editMode,
|
|
4107
4018
|
sortModel,
|
|
@@ -4161,14 +4072,15 @@ function useDataTableRenderer({
|
|
|
4161
4072
|
}
|
|
4162
4073
|
}, [_rows]);
|
|
4163
4074
|
const handleAutoFit = useCallback11(
|
|
4164
|
-
(
|
|
4165
|
-
const colDef =
|
|
4075
|
+
(field) => {
|
|
4076
|
+
const colDef = visibleColumnsByField[field];
|
|
4166
4077
|
if (!colDef?.headerRef.current) return;
|
|
4167
|
-
const
|
|
4078
|
+
const column = allColumnsByField[field];
|
|
4079
|
+
const columnType = column && "type" in column ? column.type : void 0;
|
|
4168
4080
|
if (columnType === "actions") return;
|
|
4169
4081
|
const optimalWidth = computeAutoFitWidth({
|
|
4170
4082
|
headerEl: colDef.headerRef.current,
|
|
4171
|
-
field
|
|
4083
|
+
field,
|
|
4172
4084
|
dataInPage
|
|
4173
4085
|
});
|
|
4174
4086
|
if (optimalWidth == null) return;
|
|
@@ -4176,7 +4088,7 @@ function useDataTableRenderer({
|
|
|
4176
4088
|
colDef.headerRef.current.style.width = widthPx;
|
|
4177
4089
|
if (colDef.tableColRef.current) colDef.tableColRef.current.style.width = widthPx;
|
|
4178
4090
|
},
|
|
4179
|
-
[
|
|
4091
|
+
[visibleColumnsByField, allColumnsByField, dataInPage]
|
|
4180
4092
|
);
|
|
4181
4093
|
return {
|
|
4182
4094
|
rowCount,
|
|
@@ -4651,9 +4563,9 @@ function Component(props, apiRef) {
|
|
|
4651
4563
|
measureElement: (element) => element.clientHeight,
|
|
4652
4564
|
overscan: 10
|
|
4653
4565
|
});
|
|
4654
|
-
const paginationModel =
|
|
4566
|
+
const paginationModel = useMemo11(() => ({ page, pageSize }), [page, pageSize]);
|
|
4655
4567
|
const columnsKey = getObjectVersion(columns);
|
|
4656
|
-
const headerCheckboxElement =
|
|
4568
|
+
const headerCheckboxElement = useMemo11(
|
|
4657
4569
|
() => /* @__PURE__ */ React26.createElement(
|
|
4658
4570
|
RenderCheckbox,
|
|
4659
4571
|
{
|
|
@@ -4863,7 +4775,7 @@ function Component(props, apiRef) {
|
|
|
4863
4775
|
"col",
|
|
4864
4776
|
{
|
|
4865
4777
|
ref: c.tableColRef,
|
|
4866
|
-
key: c.
|
|
4778
|
+
key: `${c.field.toString()}_${c.width}`,
|
|
4867
4779
|
style: {
|
|
4868
4780
|
width: c.width,
|
|
4869
4781
|
minWidth: c.minWidth ?? "50px"
|
|
@@ -5049,7 +4961,7 @@ var DataTable = forwardRef7(Component);
|
|
|
5049
4961
|
DataTable.displayName = "DataTable";
|
|
5050
4962
|
|
|
5051
4963
|
// src/components/DateRangePicker/DateRangePicker.tsx
|
|
5052
|
-
import React27, { forwardRef as forwardRef8, useCallback as useCallback14, useEffect as useEffect8, useImperativeHandle as useImperativeHandle3, useMemo as
|
|
4964
|
+
import React27, { forwardRef as forwardRef8, useCallback as useCallback14, useEffect as useEffect8, useImperativeHandle as useImperativeHandle3, useMemo as useMemo12, useRef as useRef8, useState as useState10 } from "react";
|
|
5053
4965
|
import { IMaskInput as IMaskInput2, IMask as IMask2 } from "react-imask";
|
|
5054
4966
|
import CalendarTodayIcon2 from "@mui/icons-material/CalendarToday";
|
|
5055
4967
|
import { styled as styled14, useThemeProps as useThemeProps7 } from "@mui/joy";
|
|
@@ -5271,7 +5183,7 @@ var DateRangePicker = forwardRef8((inProps, ref) => {
|
|
|
5271
5183
|
);
|
|
5272
5184
|
const [anchorEl, setAnchorEl] = useState10(null);
|
|
5273
5185
|
const open = Boolean(anchorEl);
|
|
5274
|
-
const calendarValue =
|
|
5186
|
+
const calendarValue = useMemo12(
|
|
5275
5187
|
() => value ? parseDates(value, format) : void 0,
|
|
5276
5188
|
[value, format]
|
|
5277
5189
|
);
|
|
@@ -5588,10 +5500,10 @@ var ModalClose = JoyModalClose;
|
|
|
5588
5500
|
var MotionModalOverflow = motion24(JoyModalOverflow);
|
|
5589
5501
|
var ModalOverflow = MotionModalOverflow;
|
|
5590
5502
|
ModalOverflow.displayName = "ModalOverflow";
|
|
5591
|
-
|
|
5503
|
+
function ModalFrame(props) {
|
|
5592
5504
|
const { title, children, titleStartDecorator, onClose, ...innerProps } = props;
|
|
5593
|
-
return /* @__PURE__ */ React29.createElement(StyledModalDialog, {
|
|
5594
|
-
}
|
|
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
|
+
}
|
|
5595
5507
|
ModalFrame.displayName = "ModalFrame";
|
|
5596
5508
|
|
|
5597
5509
|
// src/components/DialogFrame/DialogFrame.tsx
|
|
@@ -5636,7 +5548,7 @@ var InsetDrawer = styled20(JoyDrawer2)(({ theme }) => ({
|
|
|
5636
5548
|
}));
|
|
5637
5549
|
|
|
5638
5550
|
// src/components/FilterableCheckboxGroup/FilterableCheckboxGroup.tsx
|
|
5639
|
-
import React32, { useCallback as useCallback15, useEffect as useEffect9, useMemo as
|
|
5551
|
+
import React32, { useCallback as useCallback15, useEffect as useEffect9, useMemo as useMemo13, useRef as useRef9, useState as useState11 } from "react";
|
|
5640
5552
|
import SearchIcon from "@mui/icons-material/Search";
|
|
5641
5553
|
import { useThemeProps as useThemeProps8 } from "@mui/joy";
|
|
5642
5554
|
import { useVirtualizer as useVirtualizer3 } from "@tanstack/react-virtual";
|
|
@@ -5697,11 +5609,11 @@ function FilterableCheckboxGroup(inProps) {
|
|
|
5697
5609
|
const parentRef = useRef9(null);
|
|
5698
5610
|
const isInitialSortRef = useRef9(false);
|
|
5699
5611
|
const prevOptionsRef = useRef9([...options]);
|
|
5700
|
-
const filteredOptions =
|
|
5612
|
+
const filteredOptions = useMemo13(() => {
|
|
5701
5613
|
if (!searchTerm) return sortedOptions;
|
|
5702
5614
|
return sortedOptions.filter((option) => option.label.toLowerCase().includes(searchTerm.toLowerCase()));
|
|
5703
5615
|
}, [sortedOptions, searchTerm]);
|
|
5704
|
-
const itemSize =
|
|
5616
|
+
const itemSize = useMemo13(() => {
|
|
5705
5617
|
switch (size) {
|
|
5706
5618
|
case "sm":
|
|
5707
5619
|
return 28;
|
|
@@ -5775,7 +5687,7 @@ function FilterableCheckboxGroup(inProps) {
|
|
|
5775
5687
|
},
|
|
5776
5688
|
[filteredOptions, internalValue, setInternalValue]
|
|
5777
5689
|
);
|
|
5778
|
-
const enabledFilteredOptions =
|
|
5690
|
+
const enabledFilteredOptions = useMemo13(() => filteredOptions.filter((option) => !option.disabled), [filteredOptions]);
|
|
5779
5691
|
const isAllSelected = enabledFilteredOptions.length > 0 && enabledFilteredOptions.every((option) => internalValue.includes(option.value));
|
|
5780
5692
|
const isIndeterminate = !isAllSelected && enabledFilteredOptions.some((option) => internalValue.includes(option.value));
|
|
5781
5693
|
return /* @__PURE__ */ React32.createElement("div", { style: { width: "100%" } }, /* @__PURE__ */ React32.createElement(
|
|
@@ -5871,10 +5783,7 @@ import {
|
|
|
5871
5783
|
MenuButton as JoyMenuButton2,
|
|
5872
5784
|
IconButton as JoyIconButton2
|
|
5873
5785
|
} from "@mui/joy";
|
|
5874
|
-
|
|
5875
|
-
return /* @__PURE__ */ React33.createElement(JoyIconButton2, { ...rest, component: as ?? "button", ref });
|
|
5876
|
-
});
|
|
5877
|
-
function IconMenuButtonInner(props, ref) {
|
|
5786
|
+
function IconMenuButton(props) {
|
|
5878
5787
|
const {
|
|
5879
5788
|
size,
|
|
5880
5789
|
icon,
|
|
@@ -5885,8 +5794,6 @@ function IconMenuButtonInner(props, ref) {
|
|
|
5885
5794
|
variant = "plain",
|
|
5886
5795
|
placement = "bottom"
|
|
5887
5796
|
} = props;
|
|
5888
|
-
const { ref: buttonComponentRef, ...buttonComponentProps } = props.buttonComponentProps ?? {};
|
|
5889
|
-
const mergedButtonRef = useMergedRef(buttonComponentRef, ref);
|
|
5890
5797
|
if (!items.length) {
|
|
5891
5798
|
return /* @__PURE__ */ React33.createElement(
|
|
5892
5799
|
JoyIconButton2,
|
|
@@ -5897,8 +5804,7 @@ function IconMenuButtonInner(props, ref) {
|
|
|
5897
5804
|
color,
|
|
5898
5805
|
disabled,
|
|
5899
5806
|
loading,
|
|
5900
|
-
...buttonComponentProps
|
|
5901
|
-
ref: mergedButtonRef
|
|
5807
|
+
...props.buttonComponentProps ?? {}
|
|
5902
5808
|
},
|
|
5903
5809
|
icon
|
|
5904
5810
|
);
|
|
@@ -5906,7 +5812,7 @@ function IconMenuButtonInner(props, ref) {
|
|
|
5906
5812
|
return /* @__PURE__ */ React33.createElement(Dropdown_default, null, /* @__PURE__ */ React33.createElement(
|
|
5907
5813
|
JoyMenuButton2,
|
|
5908
5814
|
{
|
|
5909
|
-
slots: { root:
|
|
5815
|
+
slots: { root: JoyIconButton2 },
|
|
5910
5816
|
slotProps: {
|
|
5911
5817
|
root: {
|
|
5912
5818
|
component: props.buttonComponent ?? "button",
|
|
@@ -5915,16 +5821,13 @@ function IconMenuButtonInner(props, ref) {
|
|
|
5915
5821
|
color,
|
|
5916
5822
|
disabled,
|
|
5917
5823
|
loading,
|
|
5918
|
-
...buttonComponentProps
|
|
5919
|
-
// Joy의 useSlot이 내부 ref와 이 ref를 합쳐준다. 위 no-items 분기와 같은 경로로 ref를 넘긴다.
|
|
5920
|
-
ref: mergedButtonRef
|
|
5824
|
+
...props.buttonComponentProps ?? {}
|
|
5921
5825
|
}
|
|
5922
5826
|
}
|
|
5923
5827
|
},
|
|
5924
5828
|
icon
|
|
5925
5829
|
), /* @__PURE__ */ React33.createElement(Menu, { placement, size }, items.map((i) => /* @__PURE__ */ React33.createElement(MenuItem, { key: i.text, component: i.component, ...i.componentProps ?? {} }, i.text))));
|
|
5926
5830
|
}
|
|
5927
|
-
var IconMenuButton = React33.forwardRef(IconMenuButtonInner);
|
|
5928
5831
|
IconMenuButton.displayName = "IconMenuButton";
|
|
5929
5832
|
|
|
5930
5833
|
// src/components/Markdown/Markdown.tsx
|
|
@@ -6374,7 +6277,7 @@ var MonthPicker = forwardRef9((inProps, ref) => {
|
|
|
6374
6277
|
});
|
|
6375
6278
|
|
|
6376
6279
|
// src/components/MonthRangePicker/MonthRangePicker.tsx
|
|
6377
|
-
import React37, { forwardRef as forwardRef10, useCallback as useCallback17, useEffect as useEffect12, useImperativeHandle as useImperativeHandle5, useMemo as
|
|
6280
|
+
import React37, { forwardRef as forwardRef10, useCallback as useCallback17, useEffect as useEffect12, useImperativeHandle as useImperativeHandle5, useMemo as useMemo14, useRef as useRef11, useState as useState14 } from "react";
|
|
6378
6281
|
import { IMaskInput as IMaskInput3, IMask as IMask3 } from "react-imask";
|
|
6379
6282
|
import CalendarTodayIcon4 from "@mui/icons-material/CalendarToday";
|
|
6380
6283
|
import { styled as styled22, useThemeProps as useThemeProps10 } from "@mui/joy";
|
|
@@ -6505,7 +6408,7 @@ var MonthRangePicker = forwardRef10((inProps, ref) => {
|
|
|
6505
6408
|
);
|
|
6506
6409
|
const [anchorEl, setAnchorEl] = useState14(null);
|
|
6507
6410
|
const open = Boolean(anchorEl);
|
|
6508
|
-
const calendarValue =
|
|
6411
|
+
const calendarValue = useMemo14(() => value ? parseDates2(value) : void 0, [value]);
|
|
6509
6412
|
useEffect12(() => {
|
|
6510
6413
|
if (value) {
|
|
6511
6414
|
try {
|
|
@@ -6788,7 +6691,7 @@ function Navigator(props) {
|
|
|
6788
6691
|
Navigator.displayName = "Navigator";
|
|
6789
6692
|
|
|
6790
6693
|
// src/components/PercentageInput/PercentageInput.tsx
|
|
6791
|
-
import React41, { useCallback as useCallback18, useMemo as
|
|
6694
|
+
import React41, { useCallback as useCallback18, useMemo as useMemo15 } from "react";
|
|
6792
6695
|
import { NumericFormat as NumericFormat2 } from "react-number-format";
|
|
6793
6696
|
import { styled as styled25, useThemeProps as useThemeProps11 } from "@mui/joy";
|
|
6794
6697
|
var padDecimal = (value, decimalScale) => {
|
|
@@ -6847,13 +6750,13 @@ var PercentageInput = React41.forwardRef(
|
|
|
6847
6750
|
props.defaultValue ?? null,
|
|
6848
6751
|
useCallback18((value2) => onChange?.({ target: { name, value: value2 } }), [onChange, name])
|
|
6849
6752
|
);
|
|
6850
|
-
const value =
|
|
6753
|
+
const value = useMemo15(() => {
|
|
6851
6754
|
if (_value && useMinorUnit) {
|
|
6852
6755
|
return _value / Math.pow(10, maxDecimalScale);
|
|
6853
6756
|
}
|
|
6854
6757
|
return _value;
|
|
6855
6758
|
}, [_value, useMinorUnit, maxDecimalScale]);
|
|
6856
|
-
const internalError =
|
|
6759
|
+
const internalError = useMemo15(
|
|
6857
6760
|
() => value != null && (max != null && value > max || min != null && value < min),
|
|
6858
6761
|
[max, min, value]
|
|
6859
6762
|
);
|
|
@@ -7619,7 +7522,7 @@ function ThemeProvider(props) {
|
|
|
7619
7522
|
ThemeProvider.displayName = "ThemeProvider";
|
|
7620
7523
|
|
|
7621
7524
|
// src/components/Uploader/Uploader.tsx
|
|
7622
|
-
import React49, { useCallback as useCallback19, useEffect as useEffect13, useMemo as
|
|
7525
|
+
import React49, { useCallback as useCallback19, useEffect as useEffect13, useMemo as useMemo16, useRef as useRef12, useState as useState16 } from "react";
|
|
7623
7526
|
import { styled as styled31, Input as Input2 } from "@mui/joy";
|
|
7624
7527
|
import MuiFileUploadIcon from "@mui/icons-material/CloudUploadRounded";
|
|
7625
7528
|
import MuiUploadFileIcon from "@mui/icons-material/UploadFileRounded";
|
|
@@ -7759,8 +7662,8 @@ var Uploader = React49.memo((props) => {
|
|
|
7759
7662
|
const [files, setFiles] = useState16([]);
|
|
7760
7663
|
const [uploaded, setUploaded] = useState16(props.uploaded || []);
|
|
7761
7664
|
const [previewState, setPreviewState] = useState16("idle");
|
|
7762
|
-
const accepts =
|
|
7763
|
-
const parsedAccepts =
|
|
7665
|
+
const accepts = useMemo16(() => accept.split(",").map((accept2) => accept2.trim()), [accept]);
|
|
7666
|
+
const parsedAccepts = useMemo16(
|
|
7764
7667
|
() => accepts.flatMap((type) => {
|
|
7765
7668
|
if (["image/*", "video/*", "audio/*"].includes(type)) {
|
|
7766
7669
|
return ALL_EXTENSIONS_BY_TYPE[type];
|
|
@@ -7769,7 +7672,7 @@ var Uploader = React49.memo((props) => {
|
|
|
7769
7672
|
}),
|
|
7770
7673
|
[accepts]
|
|
7771
7674
|
);
|
|
7772
|
-
const helperText =
|
|
7675
|
+
const helperText = useMemo16(() => {
|
|
7773
7676
|
if (helperTextProp) {
|
|
7774
7677
|
return helperTextProp;
|
|
7775
7678
|
}
|
|
@@ -7799,8 +7702,8 @@ var Uploader = React49.memo((props) => {
|
|
|
7799
7702
|
}
|
|
7800
7703
|
return helperTexts.join(", ");
|
|
7801
7704
|
}, [accepts, maxFileTotalSize, maxCount, helperTextProp]);
|
|
7802
|
-
const error =
|
|
7803
|
-
const showDropZone =
|
|
7705
|
+
const error = useMemo16(() => !!errorText || errorProp, [errorProp, errorText]);
|
|
7706
|
+
const showDropZone = useMemo16(
|
|
7804
7707
|
() => !maxCount || maxCount && [...uploaded, ...files].length !== maxCount,
|
|
7805
7708
|
[files, maxCount, uploaded]
|
|
7806
7709
|
);
|