@ceed/cds 1.40.3-next.5 → 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 -749
- package/dist/index.js +163 -262
- 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 } }))))));
|
|
@@ -1610,8 +1573,6 @@ var Calendar = forwardRef4((inProps, ref) => {
|
|
|
1610
1573
|
maxDate,
|
|
1611
1574
|
disableFuture,
|
|
1612
1575
|
disablePast,
|
|
1613
|
-
shouldDisableDate,
|
|
1614
|
-
slots,
|
|
1615
1576
|
numberOfMonths,
|
|
1616
1577
|
...others
|
|
1617
1578
|
} = props;
|
|
@@ -1851,7 +1812,7 @@ var Container = forwardRef5(function Container2(props, ref) {
|
|
|
1851
1812
|
Container.displayName = "Container";
|
|
1852
1813
|
|
|
1853
1814
|
// src/components/CurrencyInput/CurrencyInput.tsx
|
|
1854
|
-
import React17, { useCallback as useCallback8, useMemo as
|
|
1815
|
+
import React17, { useCallback as useCallback8, useMemo as useMemo6 } from "react";
|
|
1855
1816
|
import { NumericFormat } from "react-number-format";
|
|
1856
1817
|
|
|
1857
1818
|
// src/components/Input/Input.tsx
|
|
@@ -2185,19 +2146,19 @@ var CurrencyInput = React17.forwardRef(function CurrencyInput2(inProps, ref) {
|
|
|
2185
2146
|
props.defaultValue ?? null,
|
|
2186
2147
|
useCallback8((value2) => onChange?.({ target: { name, value: value2 } }), [onChange, name])
|
|
2187
2148
|
);
|
|
2188
|
-
const value =
|
|
2149
|
+
const value = useMemo6(() => {
|
|
2189
2150
|
if (_value && useMinorUnit) {
|
|
2190
2151
|
return _value / Math.pow(10, decimalScale);
|
|
2191
2152
|
}
|
|
2192
2153
|
return _value;
|
|
2193
2154
|
}, [_value, useMinorUnit, decimalScale]);
|
|
2194
|
-
const max =
|
|
2155
|
+
const max = useMemo6(() => {
|
|
2195
2156
|
if (props.max && useMinorUnit) {
|
|
2196
2157
|
return props.max / Math.pow(10, decimalScale);
|
|
2197
2158
|
}
|
|
2198
2159
|
return props.max;
|
|
2199
2160
|
}, [props.max, useMinorUnit, decimalScale]);
|
|
2200
|
-
const isOverLimit =
|
|
2161
|
+
const isOverLimit = useMemo6(() => max != null && value != null && value > max, [max, value]);
|
|
2201
2162
|
const handleChange = useCallback8(
|
|
2202
2163
|
(event) => {
|
|
2203
2164
|
if (event.target.value === "") {
|
|
@@ -2248,7 +2209,7 @@ var CurrencyInput_default = CurrencyInput;
|
|
|
2248
2209
|
// src/components/DataTable/DataTable.tsx
|
|
2249
2210
|
import React26, {
|
|
2250
2211
|
useCallback as useCallback13,
|
|
2251
|
-
useMemo as
|
|
2212
|
+
useMemo as useMemo11,
|
|
2252
2213
|
useRef as useRef7,
|
|
2253
2214
|
useId,
|
|
2254
2215
|
forwardRef as forwardRef7,
|
|
@@ -2482,9 +2443,6 @@ function computeAutoFitWidth(params) {
|
|
|
2482
2443
|
if (!isNaN(maxPx) && maxPx > 0) finalWidth = Math.min(finalWidth, maxPx);
|
|
2483
2444
|
return finalWidth;
|
|
2484
2445
|
}
|
|
2485
|
-
function getHeaderCellId(tableId, columnId) {
|
|
2486
|
-
return `${tableId}_header_${columnId}`.trim();
|
|
2487
|
-
}
|
|
2488
2446
|
|
|
2489
2447
|
// src/components/DataTable/styled.tsx
|
|
2490
2448
|
import React18 from "react";
|
|
@@ -2676,7 +2634,7 @@ import React23, {
|
|
|
2676
2634
|
useRef as useRef5,
|
|
2677
2635
|
useState as useState8,
|
|
2678
2636
|
useLayoutEffect,
|
|
2679
|
-
useMemo as
|
|
2637
|
+
useMemo as useMemo9,
|
|
2680
2638
|
useCallback as useCallback10,
|
|
2681
2639
|
useEffect as useEffect5,
|
|
2682
2640
|
memo,
|
|
@@ -3160,7 +3118,7 @@ import React20 from "react";
|
|
|
3160
3118
|
import { Textarea as JoyTextarea } from "@mui/joy";
|
|
3161
3119
|
import { motion as motion19 } from "framer-motion";
|
|
3162
3120
|
var MotionTextarea = motion19(JoyTextarea);
|
|
3163
|
-
var
|
|
3121
|
+
var Textarea = (props) => {
|
|
3164
3122
|
const {
|
|
3165
3123
|
label,
|
|
3166
3124
|
error,
|
|
@@ -3204,17 +3162,13 @@ var TextareaBase = (props) => {
|
|
|
3204
3162
|
helperText && /* @__PURE__ */ React20.createElement(FormHelperText_default, null, helperText)
|
|
3205
3163
|
);
|
|
3206
3164
|
};
|
|
3207
|
-
var Textarea = React20.forwardRef((props, ref) => {
|
|
3208
|
-
const textareaSlotProps = useSlotRef(props.slotProps?.textarea, ref);
|
|
3209
|
-
return /* @__PURE__ */ React20.createElement(TextareaBase, { ...props, slotProps: { ...props.slotProps, textarea: textareaSlotProps } });
|
|
3210
|
-
});
|
|
3211
3165
|
Textarea.displayName = "Textarea";
|
|
3212
3166
|
|
|
3213
3167
|
// src/components/Textarea/index.ts
|
|
3214
3168
|
var Textarea_default = Textarea;
|
|
3215
3169
|
|
|
3216
3170
|
// src/components/Select/Select.tsx
|
|
3217
|
-
import React21, { useMemo as
|
|
3171
|
+
import React21, { useMemo as useMemo8 } from "react";
|
|
3218
3172
|
import {
|
|
3219
3173
|
Select as JoySelect,
|
|
3220
3174
|
Option as JoyOption,
|
|
@@ -3230,7 +3184,7 @@ var secondaryTextLevelMap2 = {
|
|
|
3230
3184
|
lg: "body-md"
|
|
3231
3185
|
};
|
|
3232
3186
|
Option.displayName = "Option";
|
|
3233
|
-
function
|
|
3187
|
+
function Select(props) {
|
|
3234
3188
|
const {
|
|
3235
3189
|
label,
|
|
3236
3190
|
helperText,
|
|
@@ -3256,7 +3210,7 @@ function SelectInner(props, ref) {
|
|
|
3256
3210
|
formHelperText: formHelperTextProps,
|
|
3257
3211
|
...joySlotProps
|
|
3258
3212
|
} = slotProps ?? {};
|
|
3259
|
-
const options =
|
|
3213
|
+
const options = useMemo8(
|
|
3260
3214
|
() => props.options.map((option) => {
|
|
3261
3215
|
if (option.hasOwnProperty("value") && option.hasOwnProperty("label")) {
|
|
3262
3216
|
return option;
|
|
@@ -3281,14 +3235,13 @@ function SelectInner(props, ref) {
|
|
|
3281
3235
|
};
|
|
3282
3236
|
onChange?.(newEvent, newValue);
|
|
3283
3237
|
};
|
|
3284
|
-
const optionMap =
|
|
3238
|
+
const optionMap = useMemo8(() => {
|
|
3285
3239
|
const map = /* @__PURE__ */ new Map();
|
|
3286
3240
|
options.forEach((option) => {
|
|
3287
3241
|
map.set(option.value, option);
|
|
3288
3242
|
});
|
|
3289
3243
|
return map;
|
|
3290
3244
|
}, [options]);
|
|
3291
|
-
const buttonSlotProps = useSlotRef(joySlotProps.button, ref);
|
|
3292
3245
|
const select = /* @__PURE__ */ React21.createElement(
|
|
3293
3246
|
JoySelect,
|
|
3294
3247
|
{
|
|
@@ -3297,7 +3250,7 @@ function SelectInner(props, ref) {
|
|
|
3297
3250
|
disabled,
|
|
3298
3251
|
size,
|
|
3299
3252
|
color: error ? "danger" : color,
|
|
3300
|
-
slotProps:
|
|
3253
|
+
slotProps: joySlotProps,
|
|
3301
3254
|
onChange: handleChange,
|
|
3302
3255
|
renderValue: (selected) => {
|
|
3303
3256
|
if (!selected) return null;
|
|
@@ -3327,7 +3280,6 @@ function SelectInner(props, ref) {
|
|
|
3327
3280
|
helperText && /* @__PURE__ */ React21.createElement(FormHelperText_default, { ...formHelperTextProps }, helperText)
|
|
3328
3281
|
);
|
|
3329
3282
|
}
|
|
3330
|
-
var Select = React21.forwardRef(SelectInner);
|
|
3331
3283
|
Select.displayName = "Select";
|
|
3332
3284
|
|
|
3333
3285
|
// src/components/Select/index.ts
|
|
@@ -3442,8 +3394,7 @@ var HeadCell = (props) => {
|
|
|
3442
3394
|
tableColRef,
|
|
3443
3395
|
headerClassName,
|
|
3444
3396
|
headerLineClamp,
|
|
3445
|
-
onAutoFit
|
|
3446
|
-
columnId
|
|
3397
|
+
onAutoFit
|
|
3447
3398
|
} = props;
|
|
3448
3399
|
const theme = useTheme();
|
|
3449
3400
|
const ref = headerRef;
|
|
@@ -3454,20 +3405,23 @@ var HeadCell = (props) => {
|
|
|
3454
3405
|
}, [ref]);
|
|
3455
3406
|
const [isHovered, setIsHovered] = useState8(false);
|
|
3456
3407
|
const sortable = type === "actions" ? false : _sortable;
|
|
3457
|
-
const headId =
|
|
3408
|
+
const headId = useMemo9(
|
|
3409
|
+
() => `${tableId}_header_${headerName ?? field}`.trim(),
|
|
3410
|
+
[tableId, headerName, field]
|
|
3411
|
+
);
|
|
3458
3412
|
const isResizingRef = useRef5(false);
|
|
3459
|
-
const resizer =
|
|
3413
|
+
const resizer = useMemo9(
|
|
3460
3414
|
() => resizable ?? true ? Resizer(
|
|
3461
3415
|
ref,
|
|
3462
3416
|
colRef,
|
|
3463
3417
|
(isResizing) => {
|
|
3464
3418
|
isResizingRef.current = isResizing;
|
|
3465
3419
|
},
|
|
3466
|
-
onAutoFit ? () => onAutoFit(
|
|
3420
|
+
onAutoFit ? () => onAutoFit(field) : void 0
|
|
3467
3421
|
) : null,
|
|
3468
|
-
[resizable, ref, colRef, onAutoFit,
|
|
3422
|
+
[resizable, ref, colRef, onAutoFit, field]
|
|
3469
3423
|
);
|
|
3470
|
-
const style =
|
|
3424
|
+
const style = useMemo9(
|
|
3471
3425
|
() => ({
|
|
3472
3426
|
width,
|
|
3473
3427
|
minWidth: minWidth ?? "50px",
|
|
@@ -3485,7 +3439,7 @@ var HeadCell = (props) => {
|
|
|
3485
3439
|
);
|
|
3486
3440
|
const textAlign = getTextAlign(props);
|
|
3487
3441
|
const initialSort = sortOrder[0];
|
|
3488
|
-
const sortIcon =
|
|
3442
|
+
const sortIcon = useMemo9(() => {
|
|
3489
3443
|
const isSorted = !!sort;
|
|
3490
3444
|
const isVisible = sortable && (isSorted || isHovered);
|
|
3491
3445
|
return /* @__PURE__ */ React23.createElement(AnimatePresence2, { mode: "wait" }, isVisible && /* @__PURE__ */ React23.createElement(
|
|
@@ -3516,17 +3470,17 @@ var HeadCell = (props) => {
|
|
|
3516
3470
|
}
|
|
3517
3471
|
));
|
|
3518
3472
|
}, [headId, initialSort, sort, sortable, isHovered]);
|
|
3519
|
-
const infoSign =
|
|
3473
|
+
const infoSign = useMemo9(
|
|
3520
3474
|
() => description ? /* @__PURE__ */ React23.createElement(InfoSign_default, { message: description, placement: "bottom" }) : null,
|
|
3521
3475
|
[description]
|
|
3522
3476
|
);
|
|
3523
|
-
const params =
|
|
3477
|
+
const params = useMemo9(
|
|
3524
3478
|
() => ({
|
|
3525
3479
|
field
|
|
3526
3480
|
}),
|
|
3527
3481
|
[field]
|
|
3528
3482
|
);
|
|
3529
|
-
const computedHeaderClassName =
|
|
3483
|
+
const computedHeaderClassName = useMemo9(
|
|
3530
3484
|
() => (typeof headerClassName === "function" ? headerClassName(params) : headerClassName) || void 0,
|
|
3531
3485
|
[headerClassName, params]
|
|
3532
3486
|
);
|
|
@@ -3580,7 +3534,7 @@ var BodyCell = (props) => {
|
|
|
3580
3534
|
const theme = useTheme();
|
|
3581
3535
|
const [value, setValue] = useState8(row[field]);
|
|
3582
3536
|
const cellRef = useRef5(null);
|
|
3583
|
-
const params =
|
|
3537
|
+
const params = useMemo9(
|
|
3584
3538
|
() => ({
|
|
3585
3539
|
row,
|
|
3586
3540
|
value,
|
|
@@ -3589,20 +3543,20 @@ var BodyCell = (props) => {
|
|
|
3589
3543
|
}),
|
|
3590
3544
|
[row, rowId, value, field]
|
|
3591
3545
|
);
|
|
3592
|
-
const editMode =
|
|
3546
|
+
const editMode = useMemo9(
|
|
3593
3547
|
() => !!(props.editMode && (typeof isCellEditable === "function" ? isCellEditable(params) : isCellEditable ?? true)),
|
|
3594
3548
|
[props.editMode, isCellEditable, params]
|
|
3595
3549
|
);
|
|
3596
3550
|
const propsComponentProps = "componentProps" in props ? props.componentProps : null;
|
|
3597
3551
|
const hasComponentProps = "componentProps" in props;
|
|
3598
|
-
const componentProps =
|
|
3552
|
+
const componentProps = useMemo9(
|
|
3599
3553
|
() => ({
|
|
3600
3554
|
...hasComponentProps && (typeof propsComponentProps === "function" ? propsComponentProps(params) : propsComponentProps || {}),
|
|
3601
3555
|
size: "sm"
|
|
3602
3556
|
}),
|
|
3603
3557
|
[hasComponentProps, propsComponentProps, params]
|
|
3604
3558
|
);
|
|
3605
|
-
const editModeComponentProps =
|
|
3559
|
+
const editModeComponentProps = useMemo9(
|
|
3606
3560
|
() => ({
|
|
3607
3561
|
...componentProps,
|
|
3608
3562
|
onChange: (e) => {
|
|
@@ -3664,9 +3618,9 @@ var BodyCell = (props) => {
|
|
|
3664
3618
|
}),
|
|
3665
3619
|
[params, row, field, value, componentProps, type, onCellEditStop, onCellEditStart]
|
|
3666
3620
|
);
|
|
3667
|
-
const MemoizedRenderEditCell =
|
|
3668
|
-
const MemoizedRenderCell =
|
|
3669
|
-
const EditModeComponent =
|
|
3621
|
+
const MemoizedRenderEditCell = useMemo9(() => renderEditCell ? memo(renderEditCell) : null, [renderEditCell]);
|
|
3622
|
+
const MemoizedRenderCell = useMemo9(() => renderCell ? memo(renderCell) : null, [renderCell]);
|
|
3623
|
+
const EditModeComponent = useMemo9(() => {
|
|
3670
3624
|
if (MemoizedRenderEditCell) {
|
|
3671
3625
|
return createElement(MemoizedRenderEditCell, params);
|
|
3672
3626
|
}
|
|
@@ -3701,7 +3655,7 @@ var BodyCell = (props) => {
|
|
|
3701
3655
|
}[type || "text"];
|
|
3702
3656
|
}, [value, editModeComponentProps, type, MemoizedRenderEditCell, params]);
|
|
3703
3657
|
const linkComponentFromProps = props.component;
|
|
3704
|
-
const ReadModeComponent =
|
|
3658
|
+
const ReadModeComponent = useMemo9(() => {
|
|
3705
3659
|
if (MemoizedRenderCell) {
|
|
3706
3660
|
return createElement(MemoizedRenderCell, params);
|
|
3707
3661
|
}
|
|
@@ -3715,15 +3669,15 @@ var BodyCell = (props) => {
|
|
|
3715
3669
|
return typedComponent || innerText;
|
|
3716
3670
|
}, [value, MemoizedRenderCell, params, type, componentProps, linkComponentFromProps]);
|
|
3717
3671
|
const getActions = props.getActions;
|
|
3718
|
-
const CellComponent =
|
|
3672
|
+
const CellComponent = useMemo9(() => {
|
|
3719
3673
|
if (type === "actions") {
|
|
3720
3674
|
return /* @__PURE__ */ React23.createElement(Stack_default, { direction: "row", gap: 1, justifyContent: "center", alignItems: "center" }, getActions?.(params));
|
|
3721
3675
|
}
|
|
3722
3676
|
return editMode && EditModeComponent ? EditModeComponent : ReadModeComponent;
|
|
3723
3677
|
}, [type, getActions, params, editMode, EditModeComponent, ReadModeComponent]);
|
|
3724
|
-
const showTooltip =
|
|
3678
|
+
const showTooltip = useMemo9(() => noWrap && type === "longText", [noWrap, type]);
|
|
3725
3679
|
const isBoundary = props.isLastStartPinnedColumn || props.isLastEndPinnedColumn;
|
|
3726
|
-
const computedCellClassName =
|
|
3680
|
+
const computedCellClassName = useMemo9(
|
|
3727
3681
|
() => (typeof cellClassName === "function" ? cellClassName(params) : cellClassName) || "",
|
|
3728
3682
|
[cellClassName, params]
|
|
3729
3683
|
);
|
|
@@ -3735,7 +3689,7 @@ var BodyCell = (props) => {
|
|
|
3735
3689
|
{
|
|
3736
3690
|
ref: cellRef,
|
|
3737
3691
|
key: field,
|
|
3738
|
-
headers:
|
|
3692
|
+
headers: `${tableId}_header_${props.headerName ?? field}`,
|
|
3739
3693
|
sx: {
|
|
3740
3694
|
textAlign: getTextAlign({ type }),
|
|
3741
3695
|
verticalAlign: editMode ? "top" : "middle",
|
|
@@ -3747,7 +3701,7 @@ var BodyCell = (props) => {
|
|
|
3747
3701
|
},
|
|
3748
3702
|
className: [isLastStartPinnedColumn && "is-last-left", isLastEndPinnedColumn && "is-last-right", computedCellClassName].filter(Boolean).join(" ") || ""
|
|
3749
3703
|
},
|
|
3750
|
-
|
|
3704
|
+
useMemo9(
|
|
3751
3705
|
() => showTooltip ? /* @__PURE__ */ React23.createElement(CellTextEllipsis, null, CellComponent) : CellComponent,
|
|
3752
3706
|
[CellComponent, showTooltip]
|
|
3753
3707
|
)
|
|
@@ -3800,46 +3754,36 @@ var VirtualizedTableRow = memo(StyledTableRow2, (prevProps, nextProps) => {
|
|
|
3800
3754
|
});
|
|
3801
3755
|
|
|
3802
3756
|
// src/components/DataTable/hooks.ts
|
|
3803
|
-
import { useState as useState9, useLayoutEffect as useLayoutEffect2, useRef as useRef6, useMemo as
|
|
3804
|
-
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) {
|
|
3805
3759
|
const [widths, setWidths] = useState9({});
|
|
3806
3760
|
const roRef = useRef6();
|
|
3807
3761
|
useLayoutEffect2(() => {
|
|
3808
3762
|
if (roRef.current) roRef.current.disconnect();
|
|
3809
3763
|
roRef.current = new ResizeObserver((entries) => {
|
|
3764
|
+
let changed = false;
|
|
3810
3765
|
setWidths((prev) => {
|
|
3811
|
-
let changed = false;
|
|
3812
3766
|
const next = { ...prev };
|
|
3813
3767
|
entries.forEach((entry) => {
|
|
3814
|
-
const
|
|
3768
|
+
const field = entry.target.dataset.field;
|
|
3815
3769
|
const w = Math.round(entry.target.getBoundingClientRect().width);
|
|
3816
|
-
if (
|
|
3817
|
-
|
|
3818
|
-
next[columnId] = w;
|
|
3770
|
+
if (next[field] !== w) {
|
|
3771
|
+
next[field] = w;
|
|
3819
3772
|
changed = true;
|
|
3820
3773
|
}
|
|
3821
3774
|
});
|
|
3822
3775
|
return changed ? next : prev;
|
|
3823
3776
|
});
|
|
3824
3777
|
});
|
|
3825
|
-
|
|
3826
|
-
Object.entries(columnsById).forEach(([columnId, def]) => {
|
|
3778
|
+
Object.entries(columnsByField).forEach(([field, def]) => {
|
|
3827
3779
|
const el = def.headerRef.current;
|
|
3828
3780
|
if (el) {
|
|
3829
|
-
el.dataset.
|
|
3830
|
-
el.dataset.field = String(def.field);
|
|
3831
|
-
const w = Math.round(el.getBoundingClientRect().width);
|
|
3832
|
-
if (w > 0) measured[columnId] = w;
|
|
3781
|
+
el.dataset.field = field;
|
|
3833
3782
|
roRef.current.observe(el);
|
|
3834
3783
|
}
|
|
3835
3784
|
});
|
|
3836
|
-
setWidths((prev) => {
|
|
3837
|
-
const keys = Object.keys(measured);
|
|
3838
|
-
const same = keys.length === Object.keys(prev).length && keys.every((key) => prev[key] === measured[key]);
|
|
3839
|
-
return same ? prev : measured;
|
|
3840
|
-
});
|
|
3841
3785
|
return () => roRef.current?.disconnect();
|
|
3842
|
-
}, [
|
|
3786
|
+
}, [columnsByField]);
|
|
3843
3787
|
return widths;
|
|
3844
3788
|
}
|
|
3845
3789
|
function useDataTableRenderer({
|
|
@@ -3888,23 +3832,16 @@ function useDataTableRenderer({
|
|
|
3888
3832
|
[onColumnVisibilityModelChange]
|
|
3889
3833
|
)
|
|
3890
3834
|
);
|
|
3891
|
-
const reorderedColumns =
|
|
3835
|
+
const reorderedColumns = useMemo10(() => {
|
|
3892
3836
|
if (!columnGroupingModel) return columnsProp;
|
|
3893
3837
|
return reorderColumnsByGroupingModel(columnsProp, columnGroupingModel);
|
|
3894
3838
|
}, [columnsProp, columnGroupingModel]);
|
|
3895
|
-
const
|
|
3896
|
-
() => reorderedColumns.
|
|
3897
|
-
if (visibilityModel[col.field] !== false) acc.push(index);
|
|
3898
|
-
return acc;
|
|
3899
|
-
}, []),
|
|
3839
|
+
const visibleColumns = useMemo10(
|
|
3840
|
+
() => reorderedColumns.filter((col) => visibilityModel[col.field] !== false),
|
|
3900
3841
|
[reorderedColumns, visibilityModel]
|
|
3901
3842
|
);
|
|
3902
|
-
const
|
|
3903
|
-
|
|
3904
|
-
[visibleColumnIndexes, reorderedColumns]
|
|
3905
|
-
);
|
|
3906
|
-
const visibleFieldSet = useMemo11(() => new Set(visibleColumns.map((c) => c.field)), [visibleColumns]);
|
|
3907
|
-
const tableMinWidth = useMemo11(() => {
|
|
3843
|
+
const visibleFieldSet = useMemo10(() => new Set(visibleColumns.map((c) => c.field)), [visibleColumns]);
|
|
3844
|
+
const tableMinWidth = useMemo10(() => {
|
|
3908
3845
|
const DEFAULT_MIN = 50;
|
|
3909
3846
|
let total = checkboxSelection ? 40 : 0;
|
|
3910
3847
|
for (const col of visibleColumns) {
|
|
@@ -3912,7 +3849,7 @@ function useDataTableRenderer({
|
|
|
3912
3849
|
}
|
|
3913
3850
|
return total;
|
|
3914
3851
|
}, [visibleColumns, checkboxSelection]);
|
|
3915
|
-
const allColumnsByField =
|
|
3852
|
+
const allColumnsByField = useMemo10(
|
|
3916
3853
|
() => reorderedColumns.reduce(
|
|
3917
3854
|
(acc, curr) => ({
|
|
3918
3855
|
...acc,
|
|
@@ -3922,37 +3859,19 @@ function useDataTableRenderer({
|
|
|
3922
3859
|
),
|
|
3923
3860
|
[reorderedColumns]
|
|
3924
3861
|
);
|
|
3925
|
-
const
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
assigned.add(field);
|
|
3932
|
-
return field;
|
|
3933
|
-
}
|
|
3934
|
-
let n = 2;
|
|
3935
|
-
while (taken.has(`${field}__${n}`)) n += 1;
|
|
3936
|
-
taken.add(`${field}__${n}`);
|
|
3937
|
-
return `${field}__${n}`;
|
|
3938
|
-
});
|
|
3939
|
-
}, [reorderedColumns]);
|
|
3940
|
-
const columnIds = useMemo11(
|
|
3941
|
-
() => visibleColumnIndexes.map((index) => allColumnIds[index]),
|
|
3942
|
-
[visibleColumnIndexes, allColumnIds]
|
|
3943
|
-
);
|
|
3944
|
-
const visibleColumnsById = useMemo11(
|
|
3945
|
-
() => Object.fromEntries(
|
|
3946
|
-
visibleColumns.map((column, index) => [
|
|
3947
|
-
columnIds[index],
|
|
3948
|
-
{
|
|
3949
|
-
...column,
|
|
3862
|
+
const visibleColumnsByField = useMemo10(
|
|
3863
|
+
() => visibleColumns.reduce(
|
|
3864
|
+
(acc, curr) => ({
|
|
3865
|
+
...acc,
|
|
3866
|
+
[curr.field]: {
|
|
3867
|
+
...curr,
|
|
3950
3868
|
headerRef: createRef(),
|
|
3951
3869
|
tableColRef: createRef()
|
|
3952
3870
|
}
|
|
3953
|
-
|
|
3871
|
+
}),
|
|
3872
|
+
{}
|
|
3954
3873
|
),
|
|
3955
|
-
[visibleColumns
|
|
3874
|
+
[visibleColumns]
|
|
3956
3875
|
);
|
|
3957
3876
|
const sortComparator = useCallback11(
|
|
3958
3877
|
(rowA, rowB) => {
|
|
@@ -3983,11 +3902,11 @@ function useDataTableRenderer({
|
|
|
3983
3902
|
},
|
|
3984
3903
|
[sortModel, allColumnsByField]
|
|
3985
3904
|
);
|
|
3986
|
-
const rows =
|
|
3905
|
+
const rows = useMemo10(
|
|
3987
3906
|
() => sortModel.length ? [..._rows].sort(sortComparator) : _rows,
|
|
3988
3907
|
[_rows, sortModel, sortComparator]
|
|
3989
3908
|
);
|
|
3990
|
-
const sortOrder =
|
|
3909
|
+
const sortOrder = useMemo10(
|
|
3991
3910
|
() => Array.from(new Set(_sortOrder || ["asc", "desc", null])),
|
|
3992
3911
|
[_sortOrder]
|
|
3993
3912
|
);
|
|
@@ -3997,12 +3916,12 @@ function useDataTableRenderer({
|
|
|
3997
3916
|
(row, index) => _getId?.(row) ?? row.id ?? `${(index || 0) + (page - 1) * pageSize}`,
|
|
3998
3917
|
[_getId, page, pageSize]
|
|
3999
3918
|
);
|
|
4000
|
-
const selectedModelSet =
|
|
4001
|
-
const dataInPage =
|
|
3919
|
+
const selectedModelSet = useMemo10(() => new Set(selectionModel || []), [selectionModel]);
|
|
3920
|
+
const dataInPage = useMemo10(
|
|
4002
3921
|
() => !pagination || paginationMode === "server" ? rows : rows.slice((page - 1) * pageSize, (page - 1) * pageSize + pageSize),
|
|
4003
3922
|
[rows, page, pageSize, paginationMode, pagination]
|
|
4004
3923
|
);
|
|
4005
|
-
const selectableDataInPage =
|
|
3924
|
+
const selectableDataInPage = useMemo10(
|
|
4006
3925
|
() => dataInPage.filter((row, i) => {
|
|
4007
3926
|
if (!isRowSelectable) return true;
|
|
4008
3927
|
return isRowSelectable({ row, id: getId(row, i) });
|
|
@@ -4032,60 +3951,51 @@ function useDataTableRenderer({
|
|
|
4032
3951
|
},
|
|
4033
3952
|
[dataInPage, getId, isRowSelectable, selectionModel, onSelectionModelChange]
|
|
4034
3953
|
);
|
|
4035
|
-
const isAllSelected =
|
|
3954
|
+
const isAllSelected = useMemo10(
|
|
4036
3955
|
() => selectableDataInPage.length > 0 && selectableDataInPage.every((row, i) => selectedModelSet.has(getId(row, i))),
|
|
4037
3956
|
[selectableDataInPage, selectedModelSet, getId]
|
|
4038
3957
|
);
|
|
4039
3958
|
const rowCount = totalRowsProp || rows.length;
|
|
4040
|
-
const selectableRowCount =
|
|
3959
|
+
const selectableRowCount = useMemo10(() => {
|
|
4041
3960
|
if (!isRowSelectable) return rowCount;
|
|
4042
3961
|
return rows.filter((row, i) => isRowSelectable({ row, id: getId(row, i) })).length;
|
|
4043
3962
|
}, [rows, isRowSelectable, getId, rowCount]);
|
|
4044
|
-
const isTotalSelected =
|
|
3963
|
+
const isTotalSelected = useMemo10(
|
|
4045
3964
|
() => _isTotalSelected ?? (selectableRowCount > 0 && (selectionModel?.length || 0) === selectableRowCount),
|
|
4046
3965
|
[_isTotalSelected, selectionModel, selectableRowCount]
|
|
4047
3966
|
);
|
|
4048
|
-
const columnWidths = useColumnWidths(
|
|
4049
|
-
const measuredWidthByField = useMemo11(
|
|
4050
|
-
() => Object.fromEntries(
|
|
4051
|
-
Object.entries(visibleColumnsById).map(([columnId, column]) => [column.field, columnWidths[columnId]])
|
|
4052
|
-
),
|
|
4053
|
-
[visibleColumnsById, columnWidths]
|
|
4054
|
-
);
|
|
3967
|
+
const columnWidths = useColumnWidths(visibleColumnsByField);
|
|
4055
3968
|
const getWidth = useCallback11(
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
[measuredWidthByField, allColumnsByField]
|
|
3969
|
+
(f) => columnWidths[f] ?? allColumnsByField[f]?.width ?? // Column prop 으로 지정된 width
|
|
3970
|
+
allColumnsByField[f]?.minWidth ?? 0,
|
|
3971
|
+
[columnWidths, allColumnsByField]
|
|
4060
3972
|
);
|
|
4061
|
-
const processedColumnGroups =
|
|
3973
|
+
const processedColumnGroups = useMemo10(() => {
|
|
4062
3974
|
if (!columnGroupingModel) return null;
|
|
4063
3975
|
return calculateColumnGroups(columnGroupingModel, visibleColumns, visibleFieldSet);
|
|
4064
3976
|
}, [columnGroupingModel, visibleColumns, visibleFieldSet]);
|
|
4065
|
-
const effectivePinnedLeft =
|
|
3977
|
+
const effectivePinnedLeft = useMemo10(
|
|
4066
3978
|
() => pinnedColumns?.left?.filter((f) => visibleFieldSet.has(f)),
|
|
4067
3979
|
[pinnedColumns?.left, visibleFieldSet]
|
|
4068
3980
|
);
|
|
4069
|
-
const effectivePinnedRight =
|
|
3981
|
+
const effectivePinnedRight = useMemo10(
|
|
4070
3982
|
() => pinnedColumns?.right?.filter((f) => visibleFieldSet.has(f)),
|
|
4071
3983
|
[pinnedColumns?.right, visibleFieldSet]
|
|
4072
3984
|
);
|
|
4073
3985
|
const inferredFieldsKey = JSON.stringify(Object.keys(rows[0] || {}));
|
|
4074
|
-
const inferredFields =
|
|
4075
|
-
const columns =
|
|
3986
|
+
const inferredFields = useMemo10(() => JSON.parse(inferredFieldsKey), [inferredFieldsKey]);
|
|
3987
|
+
const columns = useMemo10(() => {
|
|
4076
3988
|
const baseColumns = visibleColumns.length > 0 ? visibleColumns : reorderedColumns.length > 0 ? [] : inferredFields.map((key) => ({
|
|
4077
3989
|
field: key
|
|
4078
3990
|
}));
|
|
4079
|
-
return baseColumns.map((column
|
|
4080
|
-
const columnId = columnIds[index] ?? String(column.field);
|
|
3991
|
+
return baseColumns.map((column) => {
|
|
4081
3992
|
const isLeftPinned = effectivePinnedLeft?.includes(column.field);
|
|
4082
3993
|
const isRightPinned = effectivePinnedRight?.includes(column.field);
|
|
4083
3994
|
const isPinned = isLeftPinned || isRightPinned;
|
|
4084
3995
|
return {
|
|
4085
3996
|
...column,
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
tableColRef: visibleColumnsById[columnId]?.tableColRef,
|
|
3997
|
+
headerRef: visibleColumnsByField[column.field]?.headerRef,
|
|
3998
|
+
tableColRef: visibleColumnsByField[column.field]?.tableColRef,
|
|
4089
3999
|
isCellEditable: editMode && (typeof column.isCellEditable === "function" ? column.isCellEditable : column.isCellEditable ?? true),
|
|
4090
4000
|
sort: sortModel.find((sort) => sort.field === column.field)?.sort,
|
|
4091
4001
|
sortOrder: allColumnsByField[column.field]?.sortOrder || sortOrder,
|
|
@@ -4102,8 +4012,7 @@ function useDataTableRenderer({
|
|
|
4102
4012
|
inferredFields,
|
|
4103
4013
|
effectivePinnedLeft,
|
|
4104
4014
|
effectivePinnedRight,
|
|
4105
|
-
|
|
4106
|
-
visibleColumnsById,
|
|
4015
|
+
visibleColumnsByField,
|
|
4107
4016
|
allColumnsByField,
|
|
4108
4017
|
editMode,
|
|
4109
4018
|
sortModel,
|
|
@@ -4163,14 +4072,15 @@ function useDataTableRenderer({
|
|
|
4163
4072
|
}
|
|
4164
4073
|
}, [_rows]);
|
|
4165
4074
|
const handleAutoFit = useCallback11(
|
|
4166
|
-
(
|
|
4167
|
-
const colDef =
|
|
4075
|
+
(field) => {
|
|
4076
|
+
const colDef = visibleColumnsByField[field];
|
|
4168
4077
|
if (!colDef?.headerRef.current) return;
|
|
4169
|
-
const
|
|
4078
|
+
const column = allColumnsByField[field];
|
|
4079
|
+
const columnType = column && "type" in column ? column.type : void 0;
|
|
4170
4080
|
if (columnType === "actions") return;
|
|
4171
4081
|
const optimalWidth = computeAutoFitWidth({
|
|
4172
4082
|
headerEl: colDef.headerRef.current,
|
|
4173
|
-
field
|
|
4083
|
+
field,
|
|
4174
4084
|
dataInPage
|
|
4175
4085
|
});
|
|
4176
4086
|
if (optimalWidth == null) return;
|
|
@@ -4178,7 +4088,7 @@ function useDataTableRenderer({
|
|
|
4178
4088
|
colDef.headerRef.current.style.width = widthPx;
|
|
4179
4089
|
if (colDef.tableColRef.current) colDef.tableColRef.current.style.width = widthPx;
|
|
4180
4090
|
},
|
|
4181
|
-
[
|
|
4091
|
+
[visibleColumnsByField, allColumnsByField, dataInPage]
|
|
4182
4092
|
);
|
|
4183
4093
|
return {
|
|
4184
4094
|
rowCount,
|
|
@@ -4653,9 +4563,9 @@ function Component(props, apiRef) {
|
|
|
4653
4563
|
measureElement: (element) => element.clientHeight,
|
|
4654
4564
|
overscan: 10
|
|
4655
4565
|
});
|
|
4656
|
-
const paginationModel =
|
|
4566
|
+
const paginationModel = useMemo11(() => ({ page, pageSize }), [page, pageSize]);
|
|
4657
4567
|
const columnsKey = getObjectVersion(columns);
|
|
4658
|
-
const headerCheckboxElement =
|
|
4568
|
+
const headerCheckboxElement = useMemo11(
|
|
4659
4569
|
() => /* @__PURE__ */ React26.createElement(
|
|
4660
4570
|
RenderCheckbox,
|
|
4661
4571
|
{
|
|
@@ -4865,7 +4775,7 @@ function Component(props, apiRef) {
|
|
|
4865
4775
|
"col",
|
|
4866
4776
|
{
|
|
4867
4777
|
ref: c.tableColRef,
|
|
4868
|
-
key: c.
|
|
4778
|
+
key: `${c.field.toString()}_${c.width}`,
|
|
4869
4779
|
style: {
|
|
4870
4780
|
width: c.width,
|
|
4871
4781
|
minWidth: c.minWidth ?? "50px"
|
|
@@ -5051,7 +4961,7 @@ var DataTable = forwardRef7(Component);
|
|
|
5051
4961
|
DataTable.displayName = "DataTable";
|
|
5052
4962
|
|
|
5053
4963
|
// src/components/DateRangePicker/DateRangePicker.tsx
|
|
5054
|
-
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";
|
|
5055
4965
|
import { IMaskInput as IMaskInput2, IMask as IMask2 } from "react-imask";
|
|
5056
4966
|
import CalendarTodayIcon2 from "@mui/icons-material/CalendarToday";
|
|
5057
4967
|
import { styled as styled14, useThemeProps as useThemeProps7 } from "@mui/joy";
|
|
@@ -5273,7 +5183,7 @@ var DateRangePicker = forwardRef8((inProps, ref) => {
|
|
|
5273
5183
|
);
|
|
5274
5184
|
const [anchorEl, setAnchorEl] = useState10(null);
|
|
5275
5185
|
const open = Boolean(anchorEl);
|
|
5276
|
-
const calendarValue =
|
|
5186
|
+
const calendarValue = useMemo12(
|
|
5277
5187
|
() => value ? parseDates(value, format) : void 0,
|
|
5278
5188
|
[value, format]
|
|
5279
5189
|
);
|
|
@@ -5590,10 +5500,10 @@ var ModalClose = JoyModalClose;
|
|
|
5590
5500
|
var MotionModalOverflow = motion24(JoyModalOverflow);
|
|
5591
5501
|
var ModalOverflow = MotionModalOverflow;
|
|
5592
5502
|
ModalOverflow.displayName = "ModalOverflow";
|
|
5593
|
-
|
|
5503
|
+
function ModalFrame(props) {
|
|
5594
5504
|
const { title, children, titleStartDecorator, onClose, ...innerProps } = props;
|
|
5595
|
-
return /* @__PURE__ */ React29.createElement(StyledModalDialog, {
|
|
5596
|
-
}
|
|
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
|
+
}
|
|
5597
5507
|
ModalFrame.displayName = "ModalFrame";
|
|
5598
5508
|
|
|
5599
5509
|
// src/components/DialogFrame/DialogFrame.tsx
|
|
@@ -5638,7 +5548,7 @@ var InsetDrawer = styled20(JoyDrawer2)(({ theme }) => ({
|
|
|
5638
5548
|
}));
|
|
5639
5549
|
|
|
5640
5550
|
// src/components/FilterableCheckboxGroup/FilterableCheckboxGroup.tsx
|
|
5641
|
-
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";
|
|
5642
5552
|
import SearchIcon from "@mui/icons-material/Search";
|
|
5643
5553
|
import { useThemeProps as useThemeProps8 } from "@mui/joy";
|
|
5644
5554
|
import { useVirtualizer as useVirtualizer3 } from "@tanstack/react-virtual";
|
|
@@ -5699,11 +5609,11 @@ function FilterableCheckboxGroup(inProps) {
|
|
|
5699
5609
|
const parentRef = useRef9(null);
|
|
5700
5610
|
const isInitialSortRef = useRef9(false);
|
|
5701
5611
|
const prevOptionsRef = useRef9([...options]);
|
|
5702
|
-
const filteredOptions =
|
|
5612
|
+
const filteredOptions = useMemo13(() => {
|
|
5703
5613
|
if (!searchTerm) return sortedOptions;
|
|
5704
5614
|
return sortedOptions.filter((option) => option.label.toLowerCase().includes(searchTerm.toLowerCase()));
|
|
5705
5615
|
}, [sortedOptions, searchTerm]);
|
|
5706
|
-
const itemSize =
|
|
5616
|
+
const itemSize = useMemo13(() => {
|
|
5707
5617
|
switch (size) {
|
|
5708
5618
|
case "sm":
|
|
5709
5619
|
return 28;
|
|
@@ -5777,7 +5687,7 @@ function FilterableCheckboxGroup(inProps) {
|
|
|
5777
5687
|
},
|
|
5778
5688
|
[filteredOptions, internalValue, setInternalValue]
|
|
5779
5689
|
);
|
|
5780
|
-
const enabledFilteredOptions =
|
|
5690
|
+
const enabledFilteredOptions = useMemo13(() => filteredOptions.filter((option) => !option.disabled), [filteredOptions]);
|
|
5781
5691
|
const isAllSelected = enabledFilteredOptions.length > 0 && enabledFilteredOptions.every((option) => internalValue.includes(option.value));
|
|
5782
5692
|
const isIndeterminate = !isAllSelected && enabledFilteredOptions.some((option) => internalValue.includes(option.value));
|
|
5783
5693
|
return /* @__PURE__ */ React32.createElement("div", { style: { width: "100%" } }, /* @__PURE__ */ React32.createElement(
|
|
@@ -5873,10 +5783,7 @@ import {
|
|
|
5873
5783
|
MenuButton as JoyMenuButton2,
|
|
5874
5784
|
IconButton as JoyIconButton2
|
|
5875
5785
|
} from "@mui/joy";
|
|
5876
|
-
|
|
5877
|
-
return /* @__PURE__ */ React33.createElement(JoyIconButton2, { ...rest, component: as ?? "button", ref });
|
|
5878
|
-
});
|
|
5879
|
-
function IconMenuButtonInner(props, ref) {
|
|
5786
|
+
function IconMenuButton(props) {
|
|
5880
5787
|
const {
|
|
5881
5788
|
size,
|
|
5882
5789
|
icon,
|
|
@@ -5887,8 +5794,6 @@ function IconMenuButtonInner(props, ref) {
|
|
|
5887
5794
|
variant = "plain",
|
|
5888
5795
|
placement = "bottom"
|
|
5889
5796
|
} = props;
|
|
5890
|
-
const { ref: buttonComponentRef, ...buttonComponentProps } = props.buttonComponentProps ?? {};
|
|
5891
|
-
const mergedButtonRef = useMergedRef(buttonComponentRef, ref);
|
|
5892
5797
|
if (!items.length) {
|
|
5893
5798
|
return /* @__PURE__ */ React33.createElement(
|
|
5894
5799
|
JoyIconButton2,
|
|
@@ -5899,8 +5804,7 @@ function IconMenuButtonInner(props, ref) {
|
|
|
5899
5804
|
color,
|
|
5900
5805
|
disabled,
|
|
5901
5806
|
loading,
|
|
5902
|
-
...buttonComponentProps
|
|
5903
|
-
ref: mergedButtonRef
|
|
5807
|
+
...props.buttonComponentProps ?? {}
|
|
5904
5808
|
},
|
|
5905
5809
|
icon
|
|
5906
5810
|
);
|
|
@@ -5908,7 +5812,7 @@ function IconMenuButtonInner(props, ref) {
|
|
|
5908
5812
|
return /* @__PURE__ */ React33.createElement(Dropdown_default, null, /* @__PURE__ */ React33.createElement(
|
|
5909
5813
|
JoyMenuButton2,
|
|
5910
5814
|
{
|
|
5911
|
-
slots: { root:
|
|
5815
|
+
slots: { root: JoyIconButton2 },
|
|
5912
5816
|
slotProps: {
|
|
5913
5817
|
root: {
|
|
5914
5818
|
component: props.buttonComponent ?? "button",
|
|
@@ -5917,16 +5821,13 @@ function IconMenuButtonInner(props, ref) {
|
|
|
5917
5821
|
color,
|
|
5918
5822
|
disabled,
|
|
5919
5823
|
loading,
|
|
5920
|
-
...buttonComponentProps
|
|
5921
|
-
// Joy의 useSlot이 내부 ref와 이 ref를 합쳐준다. 위 no-items 분기와 같은 경로로 ref를 넘긴다.
|
|
5922
|
-
ref: mergedButtonRef
|
|
5824
|
+
...props.buttonComponentProps ?? {}
|
|
5923
5825
|
}
|
|
5924
5826
|
}
|
|
5925
5827
|
},
|
|
5926
5828
|
icon
|
|
5927
5829
|
), /* @__PURE__ */ React33.createElement(Menu, { placement, size }, items.map((i) => /* @__PURE__ */ React33.createElement(MenuItem, { key: i.text, component: i.component, ...i.componentProps ?? {} }, i.text))));
|
|
5928
5830
|
}
|
|
5929
|
-
var IconMenuButton = React33.forwardRef(IconMenuButtonInner);
|
|
5930
5831
|
IconMenuButton.displayName = "IconMenuButton";
|
|
5931
5832
|
|
|
5932
5833
|
// src/components/Markdown/Markdown.tsx
|
|
@@ -6376,7 +6277,7 @@ var MonthPicker = forwardRef9((inProps, ref) => {
|
|
|
6376
6277
|
});
|
|
6377
6278
|
|
|
6378
6279
|
// src/components/MonthRangePicker/MonthRangePicker.tsx
|
|
6379
|
-
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";
|
|
6380
6281
|
import { IMaskInput as IMaskInput3, IMask as IMask3 } from "react-imask";
|
|
6381
6282
|
import CalendarTodayIcon4 from "@mui/icons-material/CalendarToday";
|
|
6382
6283
|
import { styled as styled22, useThemeProps as useThemeProps10 } from "@mui/joy";
|
|
@@ -6507,7 +6408,7 @@ var MonthRangePicker = forwardRef10((inProps, ref) => {
|
|
|
6507
6408
|
);
|
|
6508
6409
|
const [anchorEl, setAnchorEl] = useState14(null);
|
|
6509
6410
|
const open = Boolean(anchorEl);
|
|
6510
|
-
const calendarValue =
|
|
6411
|
+
const calendarValue = useMemo14(() => value ? parseDates2(value) : void 0, [value]);
|
|
6511
6412
|
useEffect12(() => {
|
|
6512
6413
|
if (value) {
|
|
6513
6414
|
try {
|
|
@@ -6790,7 +6691,7 @@ function Navigator(props) {
|
|
|
6790
6691
|
Navigator.displayName = "Navigator";
|
|
6791
6692
|
|
|
6792
6693
|
// src/components/PercentageInput/PercentageInput.tsx
|
|
6793
|
-
import React41, { useCallback as useCallback18, useMemo as
|
|
6694
|
+
import React41, { useCallback as useCallback18, useMemo as useMemo15 } from "react";
|
|
6794
6695
|
import { NumericFormat as NumericFormat2 } from "react-number-format";
|
|
6795
6696
|
import { styled as styled25, useThemeProps as useThemeProps11 } from "@mui/joy";
|
|
6796
6697
|
var padDecimal = (value, decimalScale) => {
|
|
@@ -6849,13 +6750,13 @@ var PercentageInput = React41.forwardRef(
|
|
|
6849
6750
|
props.defaultValue ?? null,
|
|
6850
6751
|
useCallback18((value2) => onChange?.({ target: { name, value: value2 } }), [onChange, name])
|
|
6851
6752
|
);
|
|
6852
|
-
const value =
|
|
6753
|
+
const value = useMemo15(() => {
|
|
6853
6754
|
if (_value && useMinorUnit) {
|
|
6854
6755
|
return _value / Math.pow(10, maxDecimalScale);
|
|
6855
6756
|
}
|
|
6856
6757
|
return _value;
|
|
6857
6758
|
}, [_value, useMinorUnit, maxDecimalScale]);
|
|
6858
|
-
const internalError =
|
|
6759
|
+
const internalError = useMemo15(
|
|
6859
6760
|
() => value != null && (max != null && value > max || min != null && value < min),
|
|
6860
6761
|
[max, min, value]
|
|
6861
6762
|
);
|
|
@@ -7621,7 +7522,7 @@ function ThemeProvider(props) {
|
|
|
7621
7522
|
ThemeProvider.displayName = "ThemeProvider";
|
|
7622
7523
|
|
|
7623
7524
|
// src/components/Uploader/Uploader.tsx
|
|
7624
|
-
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";
|
|
7625
7526
|
import { styled as styled31, Input as Input2 } from "@mui/joy";
|
|
7626
7527
|
import MuiFileUploadIcon from "@mui/icons-material/CloudUploadRounded";
|
|
7627
7528
|
import MuiUploadFileIcon from "@mui/icons-material/UploadFileRounded";
|
|
@@ -7761,8 +7662,8 @@ var Uploader = React49.memo((props) => {
|
|
|
7761
7662
|
const [files, setFiles] = useState16([]);
|
|
7762
7663
|
const [uploaded, setUploaded] = useState16(props.uploaded || []);
|
|
7763
7664
|
const [previewState, setPreviewState] = useState16("idle");
|
|
7764
|
-
const accepts =
|
|
7765
|
-
const parsedAccepts =
|
|
7665
|
+
const accepts = useMemo16(() => accept.split(",").map((accept2) => accept2.trim()), [accept]);
|
|
7666
|
+
const parsedAccepts = useMemo16(
|
|
7766
7667
|
() => accepts.flatMap((type) => {
|
|
7767
7668
|
if (["image/*", "video/*", "audio/*"].includes(type)) {
|
|
7768
7669
|
return ALL_EXTENSIONS_BY_TYPE[type];
|
|
@@ -7771,7 +7672,7 @@ var Uploader = React49.memo((props) => {
|
|
|
7771
7672
|
}),
|
|
7772
7673
|
[accepts]
|
|
7773
7674
|
);
|
|
7774
|
-
const helperText =
|
|
7675
|
+
const helperText = useMemo16(() => {
|
|
7775
7676
|
if (helperTextProp) {
|
|
7776
7677
|
return helperTextProp;
|
|
7777
7678
|
}
|
|
@@ -7801,8 +7702,8 @@ var Uploader = React49.memo((props) => {
|
|
|
7801
7702
|
}
|
|
7802
7703
|
return helperTexts.join(", ");
|
|
7803
7704
|
}, [accepts, maxFileTotalSize, maxCount, helperTextProp]);
|
|
7804
|
-
const error =
|
|
7805
|
-
const showDropZone =
|
|
7705
|
+
const error = useMemo16(() => !!errorText || errorProp, [errorProp, errorText]);
|
|
7706
|
+
const showDropZone = useMemo16(
|
|
7806
7707
|
() => !maxCount || maxCount && [...uploaded, ...files].length !== maxCount,
|
|
7807
7708
|
[files, maxCount, uploaded]
|
|
7808
7709
|
);
|