@ceed/cds 1.40.2 → 1.40.3-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Autocomplete/Autocomplete.d.ts +4 -4
- package/dist/components/Autocomplete/index.d.ts +2 -1
- package/dist/components/DataTable/components.d.ts +1 -1
- package/dist/components/DataTable/hooks.d.ts +6 -7
- package/dist/components/DataTable/types.d.ts +7 -0
- package/dist/components/DataTable/utils.d.ts +5 -0
- package/dist/components/IconMenuButton/IconMenuButton.d.ts +6 -5
- package/dist/components/IconMenuButton/index.d.ts +2 -1
- package/dist/components/Modal/Modal.d.ts +1 -4
- package/dist/components/Select/Select.d.ts +3 -4
- package/dist/components/Textarea/Textarea.d.ts +1 -4
- package/dist/components/Textarea/index.d.ts +2 -1
- package/dist/components/data-display/DataTable.md +4 -0
- package/dist/components/inputs/DatePicker.md +1 -1
- package/dist/components/inputs/DateRangePicker.md +1 -1
- package/dist/index.browser.js +6 -6
- package/dist/index.browser.js.map +4 -4
- package/dist/index.cjs +736 -653
- package/dist/index.js +251 -168
- package/dist/libs/slot-props.d.ts +22 -0
- package/framer/index.js +1 -1
- package/package.json +7 -4
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, useRef as useRef2 } from "react";
|
|
190
|
+
import React5, { useCallback as useCallback2, useEffect as useEffect2, useMemo as useMemo2, useRef as useRef2 } from "react";
|
|
191
191
|
import {
|
|
192
192
|
Autocomplete as JoyAutocomplete,
|
|
193
193
|
AutocompleteOption as JoyAutocompleteOption,
|
|
@@ -294,6 +294,37 @@ 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
|
+
|
|
297
328
|
// src/components/Autocomplete/Autocomplete.tsx
|
|
298
329
|
var AutocompletePopper = styled3(Popper, {
|
|
299
330
|
name: "Autocomplete",
|
|
@@ -318,11 +349,11 @@ var AutocompleteListBox = React5.forwardRef((props, ref) => {
|
|
|
318
349
|
} = props;
|
|
319
350
|
const parentRef = useRef2(null);
|
|
320
351
|
const isGrouped = children[0].every((child) => child.hasOwnProperty("group"));
|
|
321
|
-
const itemHeight =
|
|
352
|
+
const itemHeight = useMemo2(() => {
|
|
322
353
|
const heights = itemHeightMap[fontSize ?? "md"];
|
|
323
354
|
return hasSecondaryText ? heights.secondary : heights.default;
|
|
324
355
|
}, [fontSize, hasSecondaryText]);
|
|
325
|
-
const renderTargets =
|
|
356
|
+
const renderTargets = useMemo2(() => {
|
|
326
357
|
if (loading) {
|
|
327
358
|
return [children[1]];
|
|
328
359
|
}
|
|
@@ -414,7 +445,7 @@ var autocompleteFilterOptions = createFilterOptions({
|
|
|
414
445
|
}
|
|
415
446
|
});
|
|
416
447
|
var getOptionLabel = (option) => `${option.label ?? ""}`;
|
|
417
|
-
function
|
|
448
|
+
function AutocompleteInner(props, ref) {
|
|
418
449
|
const {
|
|
419
450
|
label,
|
|
420
451
|
error,
|
|
@@ -444,7 +475,7 @@ function Autocomplete(props) {
|
|
|
444
475
|
)
|
|
445
476
|
);
|
|
446
477
|
const _value = rawValue ?? (props.multiple ? EMPTY_MULTIPLE_VALUE : "");
|
|
447
|
-
const options =
|
|
478
|
+
const options = useMemo2(
|
|
448
479
|
() => props.options.map((option) => {
|
|
449
480
|
if (typeof option !== "object") {
|
|
450
481
|
return {
|
|
@@ -456,14 +487,14 @@ function Autocomplete(props) {
|
|
|
456
487
|
}),
|
|
457
488
|
[props.options]
|
|
458
489
|
);
|
|
459
|
-
const optionMap =
|
|
490
|
+
const optionMap = useMemo2(() => {
|
|
460
491
|
const map = /* @__PURE__ */ new Map();
|
|
461
492
|
options.forEach((option) => {
|
|
462
493
|
map.set(option.value, option);
|
|
463
494
|
});
|
|
464
495
|
return map;
|
|
465
496
|
}, [options]);
|
|
466
|
-
const value =
|
|
497
|
+
const value = useMemo2(() => {
|
|
467
498
|
if (props.loading) {
|
|
468
499
|
return {
|
|
469
500
|
value: "",
|
|
@@ -482,23 +513,25 @@ function Autocomplete(props) {
|
|
|
482
513
|
},
|
|
483
514
|
[size, props.loading]
|
|
484
515
|
);
|
|
485
|
-
const startDecorator =
|
|
516
|
+
const startDecorator = useMemo2(
|
|
486
517
|
() => applySize(value?.startDecorator || props.startDecorator),
|
|
487
518
|
[value, applySize, props.startDecorator]
|
|
488
519
|
);
|
|
489
|
-
const endDecorator =
|
|
520
|
+
const endDecorator = useMemo2(
|
|
490
521
|
() => applySize(value?.endDecorator || props.endDecorator),
|
|
491
522
|
[value, applySize, props.endDecorator]
|
|
492
523
|
);
|
|
493
|
-
const
|
|
524
|
+
const inputSlotProps = useSlotRef(props.slotProps?.input, ref);
|
|
525
|
+
const slotProps = useMemo2(
|
|
494
526
|
() => ({
|
|
495
527
|
...props.slotProps,
|
|
496
528
|
listbox: {
|
|
497
529
|
...props.slotProps?.listbox,
|
|
498
530
|
hasSecondaryText: options.some((opt) => opt.secondaryText)
|
|
499
|
-
}
|
|
531
|
+
},
|
|
532
|
+
input: inputSlotProps
|
|
500
533
|
}),
|
|
501
|
-
[options, props.slotProps]
|
|
534
|
+
[options, props.slotProps, inputSlotProps]
|
|
502
535
|
);
|
|
503
536
|
const handleChange = useCallback2(
|
|
504
537
|
(event, value2) => {
|
|
@@ -532,9 +565,9 @@ function Autocomplete(props) {
|
|
|
532
565
|
endDecorator,
|
|
533
566
|
getOptionLabel,
|
|
534
567
|
renderTags: (tags, getTagProps) => tags.map((tag, index) => {
|
|
535
|
-
const { onClick, ...rest } = getTagProps({ index });
|
|
568
|
+
const { onClick, key, ...rest } = getTagProps({ index });
|
|
536
569
|
return applySize(
|
|
537
|
-
/* @__PURE__ */ React5.createElement(Chip_default, { color: "primary", ...rest }, /* @__PURE__ */ React5.createElement(Stack_default, { direction: "row", alignItems: "center", gap: 2, py: 0.5 }, tag.value, applySize(
|
|
570
|
+
/* @__PURE__ */ React5.createElement(Chip_default, { key, color: "primary", ...rest }, /* @__PURE__ */ React5.createElement(Stack_default, { direction: "row", alignItems: "center", gap: 2, py: 0.5 }, tag.value, applySize(
|
|
538
571
|
/* @__PURE__ */ React5.createElement(AutocompleteTagDelete, { color: "primary", variant: "soft", onClick }, /* @__PURE__ */ React5.createElement(CloseIcon, null))
|
|
539
572
|
)))
|
|
540
573
|
);
|
|
@@ -544,26 +577,29 @@ function Autocomplete(props) {
|
|
|
544
577
|
},
|
|
545
578
|
slotProps,
|
|
546
579
|
filterOptions: autocompleteFilterOptions,
|
|
547
|
-
renderOption: (props2, option) =>
|
|
548
|
-
|
|
549
|
-
{
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
applySize(option.label)
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
580
|
+
renderOption: (props2, option) => {
|
|
581
|
+
const { key, ...optionProps } = props2;
|
|
582
|
+
return /* @__PURE__ */ React5.createElement(JoyAutocompleteOption, { key, ...optionProps }, option.startDecorator && /* @__PURE__ */ React5.createElement(
|
|
583
|
+
ListItemDecorator,
|
|
584
|
+
{
|
|
585
|
+
sx: (theme) => ({
|
|
586
|
+
marginInlineEnd: `var(--Input-gap, ${theme.spacing(1)})`
|
|
587
|
+
})
|
|
588
|
+
},
|
|
589
|
+
applySize(option.startDecorator)
|
|
590
|
+
), 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)) : (
|
|
591
|
+
// TODO: haulla에서 사용할 때, label을 ReactNode로 넘기면 에러가 발생함....
|
|
592
|
+
applySize(option.label)
|
|
593
|
+
), option.endDecorator && /* @__PURE__ */ React5.createElement(
|
|
594
|
+
ListItemDecorator,
|
|
595
|
+
{
|
|
596
|
+
sx: (theme) => ({
|
|
597
|
+
marginInlineStart: `var(--Input-gap, ${theme.spacing(1)})`
|
|
598
|
+
})
|
|
599
|
+
},
|
|
600
|
+
applySize(option.endDecorator)
|
|
601
|
+
));
|
|
602
|
+
},
|
|
567
603
|
renderGroup: (params) => params
|
|
568
604
|
}
|
|
569
605
|
);
|
|
@@ -583,13 +619,14 @@ function Autocomplete(props) {
|
|
|
583
619
|
helperText && /* @__PURE__ */ React5.createElement(FormHelperText_default, null, helperText)
|
|
584
620
|
);
|
|
585
621
|
}
|
|
622
|
+
var Autocomplete = React5.forwardRef(AutocompleteInner);
|
|
586
623
|
Autocomplete.displayName = "Autocomplete";
|
|
587
624
|
|
|
588
625
|
// src/components/Autocomplete/index.ts
|
|
589
626
|
var Autocomplete_default = Autocomplete;
|
|
590
627
|
|
|
591
628
|
// src/components/Avatar/Avatar.tsx
|
|
592
|
-
import React6, { forwardRef as forwardRef2, useMemo as
|
|
629
|
+
import React6, { forwardRef as forwardRef2, useMemo as useMemo3 } from "react";
|
|
593
630
|
import { Avatar as JoyAvatar, AvatarGroup, styled as styled4, useThemeProps as useThemeProps2 } from "@mui/joy";
|
|
594
631
|
var StyledAvatar = styled4(JoyAvatar, {
|
|
595
632
|
name: "Avatar",
|
|
@@ -617,7 +654,7 @@ var Avatar = forwardRef2(function Avatar2(inProps, ref) {
|
|
|
617
654
|
name: "Avatar"
|
|
618
655
|
});
|
|
619
656
|
const { children, getInitial = defaultGetInitial, ...inheritProps } = props;
|
|
620
|
-
const calcChildren =
|
|
657
|
+
const calcChildren = useMemo3(() => {
|
|
621
658
|
if (typeof children === "string") {
|
|
622
659
|
return getInitial?.(children) ?? "";
|
|
623
660
|
}
|
|
@@ -659,7 +696,7 @@ var MenuItem = JoyMenuItem;
|
|
|
659
696
|
var Menu_default = Menu;
|
|
660
697
|
|
|
661
698
|
// src/components/Dropdown/Dropdown.tsx
|
|
662
|
-
import React8, { createContext, useCallback as useCallback3, useMemo as
|
|
699
|
+
import React8, { createContext, useCallback as useCallback3, useMemo as useMemo4, useState as useState2 } from "react";
|
|
663
700
|
import { Dropdown as JoyDropdown } from "@mui/joy";
|
|
664
701
|
import { MenuButton } from "@mui/joy";
|
|
665
702
|
import { useMenuButton } from "@mui/base/useMenuButton";
|
|
@@ -667,7 +704,7 @@ var DropdownNestedRegistryContext = createContext(null);
|
|
|
667
704
|
function Dropdown({ open: openProp, defaultOpen = false, onOpenChange, ...rest }) {
|
|
668
705
|
const [nestedCount, setNestedCount] = useState2(0);
|
|
669
706
|
const [open, setOpen] = useControlledState(openProp, defaultOpen);
|
|
670
|
-
const registry =
|
|
707
|
+
const registry = useMemo4(
|
|
671
708
|
() => ({
|
|
672
709
|
register: () => setNestedCount((c) => c + 1),
|
|
673
710
|
unregister: () => setNestedCount((c) => Math.max(0, c - 1))
|
|
@@ -737,7 +774,7 @@ Button.displayName = "Button";
|
|
|
737
774
|
var Button_default = Button;
|
|
738
775
|
|
|
739
776
|
// src/components/Calendar/Calendar.tsx
|
|
740
|
-
import React13, { Fragment, forwardRef as forwardRef4, useCallback as useCallback6, useEffect as useEffect3, useMemo as
|
|
777
|
+
import React13, { Fragment, forwardRef as forwardRef4, useCallback as useCallback6, useEffect as useEffect3, useMemo as useMemo6, useRef as useRef3, useState as useState5 } from "react";
|
|
741
778
|
import { styled as styled5 } from "@mui/joy";
|
|
742
779
|
import ChevronLeftIcon from "@mui/icons-material/ChevronLeft";
|
|
743
780
|
import ChevronRightIcon from "@mui/icons-material/ChevronRight";
|
|
@@ -831,7 +868,7 @@ var isSameMonth = (date1, date2) => {
|
|
|
831
868
|
};
|
|
832
869
|
|
|
833
870
|
// src/components/Calendar/hooks/use-calendar-props.ts
|
|
834
|
-
import { useCallback as useCallback4, useMemo as
|
|
871
|
+
import { useCallback as useCallback4, useMemo as useMemo5, useState as useState3 } from "react";
|
|
835
872
|
import { useThemeProps as useThemeProps3 } from "@mui/joy";
|
|
836
873
|
var resolveView = (view, views) => {
|
|
837
874
|
return views.includes(view) ? view : views[0];
|
|
@@ -851,12 +888,12 @@ var useCalendarProps = (inProps) => {
|
|
|
851
888
|
});
|
|
852
889
|
const [[page, direction], setPage] = useState3([0, 0]);
|
|
853
890
|
const resolvedView = inProps.view ?? uncontrolledView;
|
|
854
|
-
const resolvedMinDate =
|
|
891
|
+
const resolvedMinDate = useMemo5(() => {
|
|
855
892
|
const minDate = inProps.minDate || /* @__PURE__ */ new Date(0);
|
|
856
893
|
minDate.setHours(0, 0, 0, 0);
|
|
857
894
|
return minDate;
|
|
858
895
|
}, [inProps.minDate]);
|
|
859
|
-
const resolvedMaxDate =
|
|
896
|
+
const resolvedMaxDate = useMemo5(() => {
|
|
860
897
|
const maxDate = inProps.maxDate || /* @__PURE__ */ new Date(864e13);
|
|
861
898
|
maxDate.setHours(0, 0, 0, 0);
|
|
862
899
|
return maxDate;
|
|
@@ -915,7 +952,7 @@ var useCalendarProps = (inProps) => {
|
|
|
915
952
|
},
|
|
916
953
|
name: "Calendar"
|
|
917
954
|
});
|
|
918
|
-
const ownerState =
|
|
955
|
+
const ownerState = useMemo5(() => ({ ...props, viewMonth, direction }), [props, viewMonth, direction]);
|
|
919
956
|
return [props, ownerState];
|
|
920
957
|
};
|
|
921
958
|
|
|
@@ -1347,8 +1384,8 @@ var swipePower = (offset, velocity) => {
|
|
|
1347
1384
|
var PickerDays = (props) => {
|
|
1348
1385
|
const { ownerState } = props;
|
|
1349
1386
|
const { getPickerDayProps, getDayCellProps } = useCalendar(ownerState);
|
|
1350
|
-
const calendarDates =
|
|
1351
|
-
const weekdayNames =
|
|
1387
|
+
const calendarDates = useMemo6(() => getCalendarDates(ownerState.viewMonth), [ownerState.viewMonth]);
|
|
1388
|
+
const weekdayNames = useMemo6(() => getWeekdayNames(ownerState.locale || "default"), [ownerState.locale]);
|
|
1352
1389
|
return /* @__PURE__ */ React13.createElement(CalendarViewContainer, { calendarType: "datePicker" }, /* @__PURE__ */ React13.createElement(AnimatePresence, { initial: false, custom: ownerState.direction }, /* @__PURE__ */ React13.createElement(
|
|
1353
1390
|
CalendarViewTable,
|
|
1354
1391
|
{
|
|
@@ -1432,8 +1469,8 @@ var PickerMonths = (props) => {
|
|
|
1432
1469
|
};
|
|
1433
1470
|
var PlainPickerDays = ({ ownerState }) => {
|
|
1434
1471
|
const { getPickerDayProps, getDayCellProps } = useCalendar(ownerState);
|
|
1435
|
-
const calendarDates =
|
|
1436
|
-
const weekdayNames =
|
|
1472
|
+
const calendarDates = useMemo6(() => getCalendarDates(ownerState.viewMonth), [ownerState.viewMonth]);
|
|
1473
|
+
const weekdayNames = useMemo6(() => getWeekdayNames(ownerState.locale || "default"), [ownerState.locale]);
|
|
1437
1474
|
return /* @__PURE__ */ React13.createElement(StaticCalendarViewTable, null, /* @__PURE__ */ React13.createElement(CalendarWeekHeaderContainer, null, /* @__PURE__ */ React13.createElement("tr", null, weekdayNames.map((name, i) => /* @__PURE__ */ React13.createElement(Fragment, { key: `${ownerState.viewMonth}_${name}_${i}` }, /* @__PURE__ */ React13.createElement("th", null, /* @__PURE__ */ React13.createElement(Typography_default, { level: "body-xs", textAlign: "center" }, name)), i < 6 && /* @__PURE__ */ React13.createElement("th", { style: { width: 4 }, "aria-hidden": "true", "aria-description": "cell-gap" }))))), /* @__PURE__ */ React13.createElement(CalendarDayPickerContainer, null, calendarDates.map((weekDates, rowIndex) => /* @__PURE__ */ React13.createElement(Fragment, { key: `${ownerState.viewMonth}_${rowIndex}` }, /* @__PURE__ */ React13.createElement("tr", null, weekDates.map(
|
|
1438
1475
|
(date, i) => date ? /* @__PURE__ */ React13.createElement(Fragment, { key: `${ownerState.viewMonth}_${date}_${i}` }, /* @__PURE__ */ React13.createElement(CalendarDayCell, { ...getDayCellProps(date) }, /* @__PURE__ */ React13.createElement(CalendarDay, { size: "sm", variant: "plain", color: "neutral", ...getPickerDayProps(date) }, date)), i < 6 && /* @__PURE__ */ React13.createElement("td", { "aria-hidden": "true", "aria-description": "cell-gap" })) : /* @__PURE__ */ React13.createElement(Fragment, { key: `${ownerState.viewMonth}_${i}` }, /* @__PURE__ */ React13.createElement("td", null), i < 6 && /* @__PURE__ */ React13.createElement("td", { "aria-hidden": "true", "aria-description": "cell-gap" }))
|
|
1439
1476
|
)), rowIndex < calendarDates.length - 1 && /* @__PURE__ */ React13.createElement("tr", { "aria-hidden": "true", "aria-description": "row-gap" }, /* @__PURE__ */ React13.createElement("td", { colSpan: 13, style: { height: 4 } }))))));
|
|
@@ -1812,7 +1849,7 @@ var Container = forwardRef5(function Container2(props, ref) {
|
|
|
1812
1849
|
Container.displayName = "Container";
|
|
1813
1850
|
|
|
1814
1851
|
// src/components/CurrencyInput/CurrencyInput.tsx
|
|
1815
|
-
import React17, { useCallback as useCallback8, useMemo as
|
|
1852
|
+
import React17, { useCallback as useCallback8, useMemo as useMemo7 } from "react";
|
|
1816
1853
|
import { NumericFormat } from "react-number-format";
|
|
1817
1854
|
|
|
1818
1855
|
// src/components/Input/Input.tsx
|
|
@@ -2146,19 +2183,19 @@ var CurrencyInput = React17.forwardRef(function CurrencyInput2(inProps, ref) {
|
|
|
2146
2183
|
props.defaultValue ?? null,
|
|
2147
2184
|
useCallback8((value2) => onChange?.({ target: { name, value: value2 } }), [onChange, name])
|
|
2148
2185
|
);
|
|
2149
|
-
const value =
|
|
2186
|
+
const value = useMemo7(() => {
|
|
2150
2187
|
if (_value && useMinorUnit) {
|
|
2151
2188
|
return _value / Math.pow(10, decimalScale);
|
|
2152
2189
|
}
|
|
2153
2190
|
return _value;
|
|
2154
2191
|
}, [_value, useMinorUnit, decimalScale]);
|
|
2155
|
-
const max =
|
|
2192
|
+
const max = useMemo7(() => {
|
|
2156
2193
|
if (props.max && useMinorUnit) {
|
|
2157
2194
|
return props.max / Math.pow(10, decimalScale);
|
|
2158
2195
|
}
|
|
2159
2196
|
return props.max;
|
|
2160
2197
|
}, [props.max, useMinorUnit, decimalScale]);
|
|
2161
|
-
const isOverLimit =
|
|
2198
|
+
const isOverLimit = useMemo7(() => max != null && value != null && value > max, [max, value]);
|
|
2162
2199
|
const handleChange = useCallback8(
|
|
2163
2200
|
(event) => {
|
|
2164
2201
|
if (event.target.value === "") {
|
|
@@ -2209,7 +2246,7 @@ var CurrencyInput_default = CurrencyInput;
|
|
|
2209
2246
|
// src/components/DataTable/DataTable.tsx
|
|
2210
2247
|
import React26, {
|
|
2211
2248
|
useCallback as useCallback13,
|
|
2212
|
-
useMemo as
|
|
2249
|
+
useMemo as useMemo12,
|
|
2213
2250
|
useRef as useRef7,
|
|
2214
2251
|
useId,
|
|
2215
2252
|
forwardRef as forwardRef7,
|
|
@@ -2443,6 +2480,9 @@ function computeAutoFitWidth(params) {
|
|
|
2443
2480
|
if (!isNaN(maxPx) && maxPx > 0) finalWidth = Math.min(finalWidth, maxPx);
|
|
2444
2481
|
return finalWidth;
|
|
2445
2482
|
}
|
|
2483
|
+
function getHeaderCellId(tableId, columnId) {
|
|
2484
|
+
return `${tableId}_header_${columnId}`.trim();
|
|
2485
|
+
}
|
|
2446
2486
|
|
|
2447
2487
|
// src/components/DataTable/styled.tsx
|
|
2448
2488
|
import React18 from "react";
|
|
@@ -2634,7 +2674,7 @@ import React23, {
|
|
|
2634
2674
|
useRef as useRef5,
|
|
2635
2675
|
useState as useState8,
|
|
2636
2676
|
useLayoutEffect,
|
|
2637
|
-
useMemo as
|
|
2677
|
+
useMemo as useMemo10,
|
|
2638
2678
|
useCallback as useCallback10,
|
|
2639
2679
|
useEffect as useEffect5,
|
|
2640
2680
|
memo,
|
|
@@ -2982,7 +3022,7 @@ var DatePicker = forwardRef6((inProps, ref) => {
|
|
|
2982
3022
|
},
|
|
2983
3023
|
[format, minDate, maxDate, disableFuture, disablePast, shouldDisableDate]
|
|
2984
3024
|
);
|
|
2985
|
-
return /* @__PURE__ */ React19.createElement(DatePickerRoot,
|
|
3025
|
+
return /* @__PURE__ */ React19.createElement(DatePickerRoot, { sx, className }, /* @__PURE__ */ React19.createElement(FocusTrap, { open: true }, /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement(
|
|
2986
3026
|
Input_default,
|
|
2987
3027
|
{
|
|
2988
3028
|
...innerProps,
|
|
@@ -3008,8 +3048,7 @@ var DatePicker = forwardRef6((inProps, ref) => {
|
|
|
3008
3048
|
onClick: handleInputClick
|
|
3009
3049
|
}
|
|
3010
3050
|
},
|
|
3011
|
-
|
|
3012
|
-
sx,
|
|
3051
|
+
sx: { width: "100%" },
|
|
3013
3052
|
endDecorator: /* @__PURE__ */ React19.createElement(
|
|
3014
3053
|
CalendarButton,
|
|
3015
3054
|
{
|
|
@@ -3119,7 +3158,7 @@ import React20 from "react";
|
|
|
3119
3158
|
import { Textarea as JoyTextarea } from "@mui/joy";
|
|
3120
3159
|
import { motion as motion19 } from "framer-motion";
|
|
3121
3160
|
var MotionTextarea = motion19(JoyTextarea);
|
|
3122
|
-
var
|
|
3161
|
+
var TextareaBase = (props) => {
|
|
3123
3162
|
const {
|
|
3124
3163
|
label,
|
|
3125
3164
|
error,
|
|
@@ -3163,13 +3202,17 @@ var Textarea = (props) => {
|
|
|
3163
3202
|
helperText && /* @__PURE__ */ React20.createElement(FormHelperText_default, null, helperText)
|
|
3164
3203
|
);
|
|
3165
3204
|
};
|
|
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
|
+
});
|
|
3166
3209
|
Textarea.displayName = "Textarea";
|
|
3167
3210
|
|
|
3168
3211
|
// src/components/Textarea/index.ts
|
|
3169
3212
|
var Textarea_default = Textarea;
|
|
3170
3213
|
|
|
3171
3214
|
// src/components/Select/Select.tsx
|
|
3172
|
-
import React21, { useMemo as
|
|
3215
|
+
import React21, { useMemo as useMemo9 } from "react";
|
|
3173
3216
|
import {
|
|
3174
3217
|
Select as JoySelect,
|
|
3175
3218
|
Option as JoyOption,
|
|
@@ -3185,7 +3228,7 @@ var secondaryTextLevelMap2 = {
|
|
|
3185
3228
|
lg: "body-md"
|
|
3186
3229
|
};
|
|
3187
3230
|
Option.displayName = "Option";
|
|
3188
|
-
function
|
|
3231
|
+
function SelectInner(props, ref) {
|
|
3189
3232
|
const {
|
|
3190
3233
|
label,
|
|
3191
3234
|
helperText,
|
|
@@ -3211,7 +3254,7 @@ function Select(props) {
|
|
|
3211
3254
|
formHelperText: formHelperTextProps,
|
|
3212
3255
|
...joySlotProps
|
|
3213
3256
|
} = slotProps ?? {};
|
|
3214
|
-
const options =
|
|
3257
|
+
const options = useMemo9(
|
|
3215
3258
|
() => props.options.map((option) => {
|
|
3216
3259
|
if (option.hasOwnProperty("value") && option.hasOwnProperty("label")) {
|
|
3217
3260
|
return option;
|
|
@@ -3236,13 +3279,14 @@ function Select(props) {
|
|
|
3236
3279
|
};
|
|
3237
3280
|
onChange?.(newEvent, newValue);
|
|
3238
3281
|
};
|
|
3239
|
-
const optionMap =
|
|
3282
|
+
const optionMap = useMemo9(() => {
|
|
3240
3283
|
const map = /* @__PURE__ */ new Map();
|
|
3241
3284
|
options.forEach((option) => {
|
|
3242
3285
|
map.set(option.value, option);
|
|
3243
3286
|
});
|
|
3244
3287
|
return map;
|
|
3245
3288
|
}, [options]);
|
|
3289
|
+
const buttonSlotProps = useSlotRef(joySlotProps.button, ref);
|
|
3246
3290
|
const select = /* @__PURE__ */ React21.createElement(
|
|
3247
3291
|
JoySelect,
|
|
3248
3292
|
{
|
|
@@ -3251,7 +3295,7 @@ function Select(props) {
|
|
|
3251
3295
|
disabled,
|
|
3252
3296
|
size,
|
|
3253
3297
|
color: error ? "danger" : color,
|
|
3254
|
-
slotProps: joySlotProps,
|
|
3298
|
+
slotProps: { ...joySlotProps, button: buttonSlotProps },
|
|
3255
3299
|
onChange: handleChange,
|
|
3256
3300
|
renderValue: (selected) => {
|
|
3257
3301
|
if (!selected) return null;
|
|
@@ -3281,6 +3325,7 @@ function Select(props) {
|
|
|
3281
3325
|
helperText && /* @__PURE__ */ React21.createElement(FormHelperText_default, { ...formHelperTextProps }, helperText)
|
|
3282
3326
|
);
|
|
3283
3327
|
}
|
|
3328
|
+
var Select = React21.forwardRef(SelectInner);
|
|
3284
3329
|
Select.displayName = "Select";
|
|
3285
3330
|
|
|
3286
3331
|
// src/components/Select/index.ts
|
|
@@ -3395,7 +3440,8 @@ var HeadCell = (props) => {
|
|
|
3395
3440
|
tableColRef,
|
|
3396
3441
|
headerClassName,
|
|
3397
3442
|
headerLineClamp,
|
|
3398
|
-
onAutoFit
|
|
3443
|
+
onAutoFit,
|
|
3444
|
+
columnId
|
|
3399
3445
|
} = props;
|
|
3400
3446
|
const theme = useTheme();
|
|
3401
3447
|
const ref = headerRef;
|
|
@@ -3406,23 +3452,20 @@ var HeadCell = (props) => {
|
|
|
3406
3452
|
}, [ref]);
|
|
3407
3453
|
const [isHovered, setIsHovered] = useState8(false);
|
|
3408
3454
|
const sortable = type === "actions" ? false : _sortable;
|
|
3409
|
-
const headId =
|
|
3410
|
-
() => `${tableId}_header_${headerName ?? field}`.trim(),
|
|
3411
|
-
[tableId, headerName, field]
|
|
3412
|
-
);
|
|
3455
|
+
const headId = useMemo10(() => getHeaderCellId(tableId, columnId ?? field), [tableId, columnId, field]);
|
|
3413
3456
|
const isResizingRef = useRef5(false);
|
|
3414
|
-
const resizer =
|
|
3457
|
+
const resizer = useMemo10(
|
|
3415
3458
|
() => resizable ?? true ? Resizer(
|
|
3416
3459
|
ref,
|
|
3417
3460
|
colRef,
|
|
3418
3461
|
(isResizing) => {
|
|
3419
3462
|
isResizingRef.current = isResizing;
|
|
3420
3463
|
},
|
|
3421
|
-
onAutoFit ? () => onAutoFit(field) : void 0
|
|
3464
|
+
onAutoFit ? () => onAutoFit(columnId ?? String(field)) : void 0
|
|
3422
3465
|
) : null,
|
|
3423
|
-
[resizable, ref, colRef, onAutoFit, field]
|
|
3466
|
+
[resizable, ref, colRef, onAutoFit, columnId, field]
|
|
3424
3467
|
);
|
|
3425
|
-
const style =
|
|
3468
|
+
const style = useMemo10(
|
|
3426
3469
|
() => ({
|
|
3427
3470
|
width,
|
|
3428
3471
|
minWidth: minWidth ?? "50px",
|
|
@@ -3440,7 +3483,7 @@ var HeadCell = (props) => {
|
|
|
3440
3483
|
);
|
|
3441
3484
|
const textAlign = getTextAlign(props);
|
|
3442
3485
|
const initialSort = sortOrder[0];
|
|
3443
|
-
const sortIcon =
|
|
3486
|
+
const sortIcon = useMemo10(() => {
|
|
3444
3487
|
const isSorted = !!sort;
|
|
3445
3488
|
const isVisible = sortable && (isSorted || isHovered);
|
|
3446
3489
|
return /* @__PURE__ */ React23.createElement(AnimatePresence2, { mode: "wait" }, isVisible && /* @__PURE__ */ React23.createElement(
|
|
@@ -3471,17 +3514,17 @@ var HeadCell = (props) => {
|
|
|
3471
3514
|
}
|
|
3472
3515
|
));
|
|
3473
3516
|
}, [headId, initialSort, sort, sortable, isHovered]);
|
|
3474
|
-
const infoSign =
|
|
3517
|
+
const infoSign = useMemo10(
|
|
3475
3518
|
() => description ? /* @__PURE__ */ React23.createElement(InfoSign_default, { message: description, placement: "bottom" }) : null,
|
|
3476
3519
|
[description]
|
|
3477
3520
|
);
|
|
3478
|
-
const params =
|
|
3521
|
+
const params = useMemo10(
|
|
3479
3522
|
() => ({
|
|
3480
3523
|
field
|
|
3481
3524
|
}),
|
|
3482
3525
|
[field]
|
|
3483
3526
|
);
|
|
3484
|
-
const computedHeaderClassName =
|
|
3527
|
+
const computedHeaderClassName = useMemo10(
|
|
3485
3528
|
() => (typeof headerClassName === "function" ? headerClassName(params) : headerClassName) || void 0,
|
|
3486
3529
|
[headerClassName, params]
|
|
3487
3530
|
);
|
|
@@ -3535,7 +3578,7 @@ var BodyCell = (props) => {
|
|
|
3535
3578
|
const theme = useTheme();
|
|
3536
3579
|
const [value, setValue] = useState8(row[field]);
|
|
3537
3580
|
const cellRef = useRef5(null);
|
|
3538
|
-
const params =
|
|
3581
|
+
const params = useMemo10(
|
|
3539
3582
|
() => ({
|
|
3540
3583
|
row,
|
|
3541
3584
|
value,
|
|
@@ -3544,20 +3587,20 @@ var BodyCell = (props) => {
|
|
|
3544
3587
|
}),
|
|
3545
3588
|
[row, rowId, value, field]
|
|
3546
3589
|
);
|
|
3547
|
-
const editMode =
|
|
3590
|
+
const editMode = useMemo10(
|
|
3548
3591
|
() => !!(props.editMode && (typeof isCellEditable === "function" ? isCellEditable(params) : isCellEditable ?? true)),
|
|
3549
3592
|
[props.editMode, isCellEditable, params]
|
|
3550
3593
|
);
|
|
3551
3594
|
const propsComponentProps = "componentProps" in props ? props.componentProps : null;
|
|
3552
3595
|
const hasComponentProps = "componentProps" in props;
|
|
3553
|
-
const componentProps =
|
|
3596
|
+
const componentProps = useMemo10(
|
|
3554
3597
|
() => ({
|
|
3555
3598
|
...hasComponentProps && (typeof propsComponentProps === "function" ? propsComponentProps(params) : propsComponentProps || {}),
|
|
3556
3599
|
size: "sm"
|
|
3557
3600
|
}),
|
|
3558
3601
|
[hasComponentProps, propsComponentProps, params]
|
|
3559
3602
|
);
|
|
3560
|
-
const editModeComponentProps =
|
|
3603
|
+
const editModeComponentProps = useMemo10(
|
|
3561
3604
|
() => ({
|
|
3562
3605
|
...componentProps,
|
|
3563
3606
|
onChange: (e) => {
|
|
@@ -3619,9 +3662,9 @@ var BodyCell = (props) => {
|
|
|
3619
3662
|
}),
|
|
3620
3663
|
[params, row, field, value, componentProps, type, onCellEditStop, onCellEditStart]
|
|
3621
3664
|
);
|
|
3622
|
-
const MemoizedRenderEditCell =
|
|
3623
|
-
const MemoizedRenderCell =
|
|
3624
|
-
const EditModeComponent =
|
|
3665
|
+
const MemoizedRenderEditCell = useMemo10(() => renderEditCell ? memo(renderEditCell) : null, [renderEditCell]);
|
|
3666
|
+
const MemoizedRenderCell = useMemo10(() => renderCell ? memo(renderCell) : null, [renderCell]);
|
|
3667
|
+
const EditModeComponent = useMemo10(() => {
|
|
3625
3668
|
if (MemoizedRenderEditCell) {
|
|
3626
3669
|
return createElement(MemoizedRenderEditCell, params);
|
|
3627
3670
|
}
|
|
@@ -3656,7 +3699,7 @@ var BodyCell = (props) => {
|
|
|
3656
3699
|
}[type || "text"];
|
|
3657
3700
|
}, [value, editModeComponentProps, type, MemoizedRenderEditCell, params]);
|
|
3658
3701
|
const linkComponentFromProps = props.component;
|
|
3659
|
-
const ReadModeComponent =
|
|
3702
|
+
const ReadModeComponent = useMemo10(() => {
|
|
3660
3703
|
if (MemoizedRenderCell) {
|
|
3661
3704
|
return createElement(MemoizedRenderCell, params);
|
|
3662
3705
|
}
|
|
@@ -3670,15 +3713,15 @@ var BodyCell = (props) => {
|
|
|
3670
3713
|
return typedComponent || innerText;
|
|
3671
3714
|
}, [value, MemoizedRenderCell, params, type, componentProps, linkComponentFromProps]);
|
|
3672
3715
|
const getActions = props.getActions;
|
|
3673
|
-
const CellComponent =
|
|
3716
|
+
const CellComponent = useMemo10(() => {
|
|
3674
3717
|
if (type === "actions") {
|
|
3675
3718
|
return /* @__PURE__ */ React23.createElement(Stack_default, { direction: "row", gap: 1, justifyContent: "center", alignItems: "center" }, getActions?.(params));
|
|
3676
3719
|
}
|
|
3677
3720
|
return editMode && EditModeComponent ? EditModeComponent : ReadModeComponent;
|
|
3678
3721
|
}, [type, getActions, params, editMode, EditModeComponent, ReadModeComponent]);
|
|
3679
|
-
const showTooltip =
|
|
3722
|
+
const showTooltip = useMemo10(() => noWrap && type === "longText", [noWrap, type]);
|
|
3680
3723
|
const isBoundary = props.isLastStartPinnedColumn || props.isLastEndPinnedColumn;
|
|
3681
|
-
const computedCellClassName =
|
|
3724
|
+
const computedCellClassName = useMemo10(
|
|
3682
3725
|
() => (typeof cellClassName === "function" ? cellClassName(params) : cellClassName) || "",
|
|
3683
3726
|
[cellClassName, params]
|
|
3684
3727
|
);
|
|
@@ -3690,7 +3733,7 @@ var BodyCell = (props) => {
|
|
|
3690
3733
|
{
|
|
3691
3734
|
ref: cellRef,
|
|
3692
3735
|
key: field,
|
|
3693
|
-
headers:
|
|
3736
|
+
headers: getHeaderCellId(tableId, props.columnId ?? field),
|
|
3694
3737
|
sx: {
|
|
3695
3738
|
textAlign: getTextAlign({ type }),
|
|
3696
3739
|
verticalAlign: editMode ? "top" : "middle",
|
|
@@ -3702,7 +3745,7 @@ var BodyCell = (props) => {
|
|
|
3702
3745
|
},
|
|
3703
3746
|
className: [isLastStartPinnedColumn && "is-last-left", isLastEndPinnedColumn && "is-last-right", computedCellClassName].filter(Boolean).join(" ") || ""
|
|
3704
3747
|
},
|
|
3705
|
-
|
|
3748
|
+
useMemo10(
|
|
3706
3749
|
() => showTooltip ? /* @__PURE__ */ React23.createElement(CellTextEllipsis, null, CellComponent) : CellComponent,
|
|
3707
3750
|
[CellComponent, showTooltip]
|
|
3708
3751
|
)
|
|
@@ -3755,36 +3798,44 @@ var VirtualizedTableRow = memo(StyledTableRow2, (prevProps, nextProps) => {
|
|
|
3755
3798
|
});
|
|
3756
3799
|
|
|
3757
3800
|
// src/components/DataTable/hooks.ts
|
|
3758
|
-
import { useState as useState9, useLayoutEffect as useLayoutEffect2, useRef as useRef6, useMemo as
|
|
3759
|
-
function useColumnWidths(
|
|
3801
|
+
import { useState as useState9, useLayoutEffect as useLayoutEffect2, useRef as useRef6, useMemo as useMemo11, useCallback as useCallback11, useEffect as useEffect6, createRef } from "react";
|
|
3802
|
+
function useColumnWidths(columnsById) {
|
|
3760
3803
|
const [widths, setWidths] = useState9({});
|
|
3761
3804
|
const roRef = useRef6();
|
|
3762
3805
|
useLayoutEffect2(() => {
|
|
3763
3806
|
if (roRef.current) roRef.current.disconnect();
|
|
3764
3807
|
roRef.current = new ResizeObserver((entries) => {
|
|
3765
|
-
let changed = false;
|
|
3766
3808
|
setWidths((prev) => {
|
|
3809
|
+
let changed = false;
|
|
3767
3810
|
const next = { ...prev };
|
|
3768
3811
|
entries.forEach((entry) => {
|
|
3769
|
-
const
|
|
3812
|
+
const columnId = entry.target.dataset.hdsColumnId;
|
|
3770
3813
|
const w = Math.round(entry.target.getBoundingClientRect().width);
|
|
3771
|
-
if (next[
|
|
3772
|
-
next[
|
|
3814
|
+
if (next[columnId] !== w) {
|
|
3815
|
+
next[columnId] = w;
|
|
3773
3816
|
changed = true;
|
|
3774
3817
|
}
|
|
3775
3818
|
});
|
|
3776
3819
|
return changed ? next : prev;
|
|
3777
3820
|
});
|
|
3778
3821
|
});
|
|
3779
|
-
|
|
3822
|
+
const measured = {};
|
|
3823
|
+
Object.entries(columnsById).forEach(([columnId, def]) => {
|
|
3780
3824
|
const el = def.headerRef.current;
|
|
3781
3825
|
if (el) {
|
|
3782
|
-
el.dataset.
|
|
3826
|
+
el.dataset.hdsColumnId = columnId;
|
|
3827
|
+
el.dataset.field = String(def.field);
|
|
3828
|
+
measured[columnId] = Math.round(el.getBoundingClientRect().width);
|
|
3783
3829
|
roRef.current.observe(el);
|
|
3784
3830
|
}
|
|
3785
3831
|
});
|
|
3832
|
+
setWidths((prev) => {
|
|
3833
|
+
const keys = Object.keys(measured);
|
|
3834
|
+
const same = keys.length === Object.keys(prev).length && keys.every((key) => prev[key] === measured[key]);
|
|
3835
|
+
return same ? prev : measured;
|
|
3836
|
+
});
|
|
3786
3837
|
return () => roRef.current?.disconnect();
|
|
3787
|
-
}, [
|
|
3838
|
+
}, [columnsById]);
|
|
3788
3839
|
return widths;
|
|
3789
3840
|
}
|
|
3790
3841
|
function useDataTableRenderer({
|
|
@@ -3833,16 +3884,16 @@ function useDataTableRenderer({
|
|
|
3833
3884
|
[onColumnVisibilityModelChange]
|
|
3834
3885
|
)
|
|
3835
3886
|
);
|
|
3836
|
-
const reorderedColumns =
|
|
3887
|
+
const reorderedColumns = useMemo11(() => {
|
|
3837
3888
|
if (!columnGroupingModel) return columnsProp;
|
|
3838
3889
|
return reorderColumnsByGroupingModel(columnsProp, columnGroupingModel);
|
|
3839
3890
|
}, [columnsProp, columnGroupingModel]);
|
|
3840
|
-
const visibleColumns =
|
|
3891
|
+
const visibleColumns = useMemo11(
|
|
3841
3892
|
() => reorderedColumns.filter((col) => visibilityModel[col.field] !== false),
|
|
3842
3893
|
[reorderedColumns, visibilityModel]
|
|
3843
3894
|
);
|
|
3844
|
-
const visibleFieldSet =
|
|
3845
|
-
const tableMinWidth =
|
|
3895
|
+
const visibleFieldSet = useMemo11(() => new Set(visibleColumns.map((c) => c.field)), [visibleColumns]);
|
|
3896
|
+
const tableMinWidth = useMemo11(() => {
|
|
3846
3897
|
const DEFAULT_MIN = 50;
|
|
3847
3898
|
let total = checkboxSelection ? 40 : 0;
|
|
3848
3899
|
for (const col of visibleColumns) {
|
|
@@ -3850,7 +3901,7 @@ function useDataTableRenderer({
|
|
|
3850
3901
|
}
|
|
3851
3902
|
return total;
|
|
3852
3903
|
}, [visibleColumns, checkboxSelection]);
|
|
3853
|
-
const allColumnsByField =
|
|
3904
|
+
const allColumnsByField = useMemo11(
|
|
3854
3905
|
() => reorderedColumns.reduce(
|
|
3855
3906
|
(acc, curr) => ({
|
|
3856
3907
|
...acc,
|
|
@@ -3860,19 +3911,34 @@ function useDataTableRenderer({
|
|
|
3860
3911
|
),
|
|
3861
3912
|
[reorderedColumns]
|
|
3862
3913
|
);
|
|
3863
|
-
const
|
|
3864
|
-
() =>
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3914
|
+
const columnIds = useMemo11(() => {
|
|
3915
|
+
const taken = new Set(visibleColumns.map((column) => String(column.field)));
|
|
3916
|
+
const ids = [];
|
|
3917
|
+
visibleColumns.forEach((column) => {
|
|
3918
|
+
const field = String(column.field);
|
|
3919
|
+
if (!ids.includes(field)) {
|
|
3920
|
+
ids.push(field);
|
|
3921
|
+
return;
|
|
3922
|
+
}
|
|
3923
|
+
let n = 2;
|
|
3924
|
+
while (taken.has(`${field}__${n}`)) n += 1;
|
|
3925
|
+
taken.add(`${field}__${n}`);
|
|
3926
|
+
ids.push(`${field}__${n}`);
|
|
3927
|
+
});
|
|
3928
|
+
return ids;
|
|
3929
|
+
}, [visibleColumns]);
|
|
3930
|
+
const visibleColumnsById = useMemo11(
|
|
3931
|
+
() => Object.fromEntries(
|
|
3932
|
+
visibleColumns.map((column, index) => [
|
|
3933
|
+
columnIds[index],
|
|
3934
|
+
{
|
|
3935
|
+
...column,
|
|
3869
3936
|
headerRef: createRef(),
|
|
3870
3937
|
tableColRef: createRef()
|
|
3871
3938
|
}
|
|
3872
|
-
|
|
3873
|
-
{}
|
|
3939
|
+
])
|
|
3874
3940
|
),
|
|
3875
|
-
[visibleColumns]
|
|
3941
|
+
[visibleColumns, columnIds]
|
|
3876
3942
|
);
|
|
3877
3943
|
const sortComparator = useCallback11(
|
|
3878
3944
|
(rowA, rowB) => {
|
|
@@ -3903,11 +3969,11 @@ function useDataTableRenderer({
|
|
|
3903
3969
|
},
|
|
3904
3970
|
[sortModel, allColumnsByField]
|
|
3905
3971
|
);
|
|
3906
|
-
const rows =
|
|
3972
|
+
const rows = useMemo11(
|
|
3907
3973
|
() => sortModel.length ? [..._rows].sort(sortComparator) : _rows,
|
|
3908
3974
|
[_rows, sortModel, sortComparator]
|
|
3909
3975
|
);
|
|
3910
|
-
const sortOrder =
|
|
3976
|
+
const sortOrder = useMemo11(
|
|
3911
3977
|
() => Array.from(new Set(_sortOrder || ["asc", "desc", null])),
|
|
3912
3978
|
[_sortOrder]
|
|
3913
3979
|
);
|
|
@@ -3917,12 +3983,12 @@ function useDataTableRenderer({
|
|
|
3917
3983
|
(row, index) => _getId?.(row) ?? row.id ?? `${(index || 0) + (page - 1) * pageSize}`,
|
|
3918
3984
|
[_getId, page, pageSize]
|
|
3919
3985
|
);
|
|
3920
|
-
const selectedModelSet =
|
|
3921
|
-
const dataInPage =
|
|
3986
|
+
const selectedModelSet = useMemo11(() => new Set(selectionModel || []), [selectionModel]);
|
|
3987
|
+
const dataInPage = useMemo11(
|
|
3922
3988
|
() => !pagination || paginationMode === "server" ? rows : rows.slice((page - 1) * pageSize, (page - 1) * pageSize + pageSize),
|
|
3923
3989
|
[rows, page, pageSize, paginationMode, pagination]
|
|
3924
3990
|
);
|
|
3925
|
-
const selectableDataInPage =
|
|
3991
|
+
const selectableDataInPage = useMemo11(
|
|
3926
3992
|
() => dataInPage.filter((row, i) => {
|
|
3927
3993
|
if (!isRowSelectable) return true;
|
|
3928
3994
|
return isRowSelectable({ row, id: getId(row, i) });
|
|
@@ -3952,51 +4018,60 @@ function useDataTableRenderer({
|
|
|
3952
4018
|
},
|
|
3953
4019
|
[dataInPage, getId, isRowSelectable, selectionModel, onSelectionModelChange]
|
|
3954
4020
|
);
|
|
3955
|
-
const isAllSelected =
|
|
4021
|
+
const isAllSelected = useMemo11(
|
|
3956
4022
|
() => selectableDataInPage.length > 0 && selectableDataInPage.every((row, i) => selectedModelSet.has(getId(row, i))),
|
|
3957
4023
|
[selectableDataInPage, selectedModelSet, getId]
|
|
3958
4024
|
);
|
|
3959
4025
|
const rowCount = totalRowsProp || rows.length;
|
|
3960
|
-
const selectableRowCount =
|
|
4026
|
+
const selectableRowCount = useMemo11(() => {
|
|
3961
4027
|
if (!isRowSelectable) return rowCount;
|
|
3962
4028
|
return rows.filter((row, i) => isRowSelectable({ row, id: getId(row, i) })).length;
|
|
3963
4029
|
}, [rows, isRowSelectable, getId, rowCount]);
|
|
3964
|
-
const isTotalSelected =
|
|
4030
|
+
const isTotalSelected = useMemo11(
|
|
3965
4031
|
() => _isTotalSelected ?? (selectableRowCount > 0 && (selectionModel?.length || 0) === selectableRowCount),
|
|
3966
4032
|
[_isTotalSelected, selectionModel, selectableRowCount]
|
|
3967
4033
|
);
|
|
3968
|
-
const columnWidths = useColumnWidths(
|
|
4034
|
+
const columnWidths = useColumnWidths(visibleColumnsById);
|
|
4035
|
+
const measuredWidthByField = useMemo11(
|
|
4036
|
+
() => Object.fromEntries(
|
|
4037
|
+
Object.entries(visibleColumnsById).map(([columnId, column]) => [column.field, columnWidths[columnId]])
|
|
4038
|
+
),
|
|
4039
|
+
[visibleColumnsById, columnWidths]
|
|
4040
|
+
);
|
|
3969
4041
|
const getWidth = useCallback11(
|
|
3970
|
-
|
|
3971
|
-
allColumnsByField[f]?.
|
|
3972
|
-
[
|
|
4042
|
+
// 반환값은 pinned offset으로 더해지므로 반드시 숫자여야 한다. width/minWidth는 '500px' 같은 문자열.
|
|
4043
|
+
(f) => measuredWidthByField[f] ?? parsePxValue(allColumnsByField[f]?.width) ?? // Column prop 으로 지정된 width
|
|
4044
|
+
parsePxValue(allColumnsByField[f]?.minWidth) ?? 0,
|
|
4045
|
+
[measuredWidthByField, allColumnsByField]
|
|
3973
4046
|
);
|
|
3974
|
-
const processedColumnGroups =
|
|
4047
|
+
const processedColumnGroups = useMemo11(() => {
|
|
3975
4048
|
if (!columnGroupingModel) return null;
|
|
3976
4049
|
return calculateColumnGroups(columnGroupingModel, visibleColumns, visibleFieldSet);
|
|
3977
4050
|
}, [columnGroupingModel, visibleColumns, visibleFieldSet]);
|
|
3978
|
-
const effectivePinnedLeft =
|
|
4051
|
+
const effectivePinnedLeft = useMemo11(
|
|
3979
4052
|
() => pinnedColumns?.left?.filter((f) => visibleFieldSet.has(f)),
|
|
3980
4053
|
[pinnedColumns?.left, visibleFieldSet]
|
|
3981
4054
|
);
|
|
3982
|
-
const effectivePinnedRight =
|
|
4055
|
+
const effectivePinnedRight = useMemo11(
|
|
3983
4056
|
() => pinnedColumns?.right?.filter((f) => visibleFieldSet.has(f)),
|
|
3984
4057
|
[pinnedColumns?.right, visibleFieldSet]
|
|
3985
4058
|
);
|
|
3986
4059
|
const inferredFieldsKey = JSON.stringify(Object.keys(rows[0] || {}));
|
|
3987
|
-
const inferredFields =
|
|
3988
|
-
const columns =
|
|
4060
|
+
const inferredFields = useMemo11(() => JSON.parse(inferredFieldsKey), [inferredFieldsKey]);
|
|
4061
|
+
const columns = useMemo11(() => {
|
|
3989
4062
|
const baseColumns = visibleColumns.length > 0 ? visibleColumns : reorderedColumns.length > 0 ? [] : inferredFields.map((key) => ({
|
|
3990
4063
|
field: key
|
|
3991
4064
|
}));
|
|
3992
|
-
return baseColumns.map((column) => {
|
|
4065
|
+
return baseColumns.map((column, index) => {
|
|
4066
|
+
const columnId = columnIds[index] ?? String(column.field);
|
|
3993
4067
|
const isLeftPinned = effectivePinnedLeft?.includes(column.field);
|
|
3994
4068
|
const isRightPinned = effectivePinnedRight?.includes(column.field);
|
|
3995
4069
|
const isPinned = isLeftPinned || isRightPinned;
|
|
3996
4070
|
return {
|
|
3997
4071
|
...column,
|
|
3998
|
-
|
|
3999
|
-
|
|
4072
|
+
columnId,
|
|
4073
|
+
headerRef: visibleColumnsById[columnId]?.headerRef,
|
|
4074
|
+
tableColRef: visibleColumnsById[columnId]?.tableColRef,
|
|
4000
4075
|
isCellEditable: editMode && (typeof column.isCellEditable === "function" ? column.isCellEditable : column.isCellEditable ?? true),
|
|
4001
4076
|
sort: sortModel.find((sort) => sort.field === column.field)?.sort,
|
|
4002
4077
|
sortOrder: allColumnsByField[column.field]?.sortOrder || sortOrder,
|
|
@@ -4013,7 +4088,8 @@ function useDataTableRenderer({
|
|
|
4013
4088
|
inferredFields,
|
|
4014
4089
|
effectivePinnedLeft,
|
|
4015
4090
|
effectivePinnedRight,
|
|
4016
|
-
|
|
4091
|
+
columnIds,
|
|
4092
|
+
visibleColumnsById,
|
|
4017
4093
|
allColumnsByField,
|
|
4018
4094
|
editMode,
|
|
4019
4095
|
sortModel,
|
|
@@ -4073,15 +4149,14 @@ function useDataTableRenderer({
|
|
|
4073
4149
|
}
|
|
4074
4150
|
}, [_rows]);
|
|
4075
4151
|
const handleAutoFit = useCallback11(
|
|
4076
|
-
(
|
|
4077
|
-
const colDef =
|
|
4152
|
+
(columnId) => {
|
|
4153
|
+
const colDef = visibleColumnsById[columnId];
|
|
4078
4154
|
if (!colDef?.headerRef.current) return;
|
|
4079
|
-
const
|
|
4080
|
-
const columnType = column && "type" in column ? column.type : void 0;
|
|
4155
|
+
const columnType = "type" in colDef ? colDef.type : void 0;
|
|
4081
4156
|
if (columnType === "actions") return;
|
|
4082
4157
|
const optimalWidth = computeAutoFitWidth({
|
|
4083
4158
|
headerEl: colDef.headerRef.current,
|
|
4084
|
-
field,
|
|
4159
|
+
field: colDef.field,
|
|
4085
4160
|
dataInPage
|
|
4086
4161
|
});
|
|
4087
4162
|
if (optimalWidth == null) return;
|
|
@@ -4089,7 +4164,7 @@ function useDataTableRenderer({
|
|
|
4089
4164
|
colDef.headerRef.current.style.width = widthPx;
|
|
4090
4165
|
if (colDef.tableColRef.current) colDef.tableColRef.current.style.width = widthPx;
|
|
4091
4166
|
},
|
|
4092
|
-
[
|
|
4167
|
+
[visibleColumnsById, dataInPage]
|
|
4093
4168
|
);
|
|
4094
4169
|
return {
|
|
4095
4170
|
rowCount,
|
|
@@ -4564,9 +4639,9 @@ function Component(props, apiRef) {
|
|
|
4564
4639
|
measureElement: (element) => element.clientHeight,
|
|
4565
4640
|
overscan: 10
|
|
4566
4641
|
});
|
|
4567
|
-
const paginationModel =
|
|
4642
|
+
const paginationModel = useMemo12(() => ({ page, pageSize }), [page, pageSize]);
|
|
4568
4643
|
const columnsKey = getObjectVersion(columns);
|
|
4569
|
-
const headerCheckboxElement =
|
|
4644
|
+
const headerCheckboxElement = useMemo12(
|
|
4570
4645
|
() => /* @__PURE__ */ React26.createElement(
|
|
4571
4646
|
RenderCheckbox,
|
|
4572
4647
|
{
|
|
@@ -4776,7 +4851,7 @@ function Component(props, apiRef) {
|
|
|
4776
4851
|
"col",
|
|
4777
4852
|
{
|
|
4778
4853
|
ref: c.tableColRef,
|
|
4779
|
-
key:
|
|
4854
|
+
key: c.columnId,
|
|
4780
4855
|
style: {
|
|
4781
4856
|
width: c.width,
|
|
4782
4857
|
minWidth: c.minWidth ?? "50px"
|
|
@@ -4962,7 +5037,7 @@ var DataTable = forwardRef7(Component);
|
|
|
4962
5037
|
DataTable.displayName = "DataTable";
|
|
4963
5038
|
|
|
4964
5039
|
// src/components/DateRangePicker/DateRangePicker.tsx
|
|
4965
|
-
import React27, { forwardRef as forwardRef8, useCallback as useCallback14, useEffect as useEffect8, useImperativeHandle as useImperativeHandle3, useMemo as
|
|
5040
|
+
import React27, { forwardRef as forwardRef8, useCallback as useCallback14, useEffect as useEffect8, useImperativeHandle as useImperativeHandle3, useMemo as useMemo13, useRef as useRef8, useState as useState10 } from "react";
|
|
4966
5041
|
import { IMaskInput as IMaskInput2, IMask as IMask2 } from "react-imask";
|
|
4967
5042
|
import CalendarTodayIcon2 from "@mui/icons-material/CalendarToday";
|
|
4968
5043
|
import { styled as styled14, useThemeProps as useThemeProps7 } from "@mui/joy";
|
|
@@ -5184,7 +5259,7 @@ var DateRangePicker = forwardRef8((inProps, ref) => {
|
|
|
5184
5259
|
);
|
|
5185
5260
|
const [anchorEl, setAnchorEl] = useState10(null);
|
|
5186
5261
|
const open = Boolean(anchorEl);
|
|
5187
|
-
const calendarValue =
|
|
5262
|
+
const calendarValue = useMemo13(
|
|
5188
5263
|
() => value ? parseDates(value, format) : void 0,
|
|
5189
5264
|
[value, format]
|
|
5190
5265
|
);
|
|
@@ -5309,7 +5384,7 @@ var DateRangePicker = forwardRef8((inProps, ref) => {
|
|
|
5309
5384
|
},
|
|
5310
5385
|
[format, minDate, maxDate, disableFuture, disablePast]
|
|
5311
5386
|
);
|
|
5312
|
-
return /* @__PURE__ */ React27.createElement(DateRangePickerRoot,
|
|
5387
|
+
return /* @__PURE__ */ React27.createElement(DateRangePickerRoot, { sx, className }, /* @__PURE__ */ React27.createElement(FocusTrap2, { open: true }, /* @__PURE__ */ React27.createElement(React27.Fragment, null, /* @__PURE__ */ React27.createElement(
|
|
5313
5388
|
Input_default,
|
|
5314
5389
|
{
|
|
5315
5390
|
...innerProps,
|
|
@@ -5335,8 +5410,7 @@ var DateRangePicker = forwardRef8((inProps, ref) => {
|
|
|
5335
5410
|
}
|
|
5336
5411
|
},
|
|
5337
5412
|
error,
|
|
5338
|
-
|
|
5339
|
-
sx,
|
|
5413
|
+
sx: { width: "100%" },
|
|
5340
5414
|
endDecorator: /* @__PURE__ */ React27.createElement(
|
|
5341
5415
|
CalendarButton2,
|
|
5342
5416
|
{
|
|
@@ -5502,10 +5576,10 @@ var ModalClose = JoyModalClose;
|
|
|
5502
5576
|
var MotionModalOverflow = motion24(JoyModalOverflow);
|
|
5503
5577
|
var ModalOverflow = MotionModalOverflow;
|
|
5504
5578
|
ModalOverflow.displayName = "ModalOverflow";
|
|
5505
|
-
|
|
5579
|
+
var ModalFrame = React29.forwardRef((props, ref) => {
|
|
5506
5580
|
const { title, children, titleStartDecorator, onClose, ...innerProps } = props;
|
|
5507
|
-
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));
|
|
5508
|
-
}
|
|
5581
|
+
return /* @__PURE__ */ React29.createElement(StyledModalDialog, { ref, ...innerProps }, /* @__PURE__ */ React29.createElement(ModalClose, { onClick: onClose }), /* @__PURE__ */ React29.createElement(DialogTitle_default, null, titleStartDecorator, title), /* @__PURE__ */ React29.createElement(DialogContent_default, null, children));
|
|
5582
|
+
});
|
|
5509
5583
|
ModalFrame.displayName = "ModalFrame";
|
|
5510
5584
|
|
|
5511
5585
|
// src/components/DialogFrame/DialogFrame.tsx
|
|
@@ -5550,7 +5624,7 @@ var InsetDrawer = styled20(JoyDrawer2)(({ theme }) => ({
|
|
|
5550
5624
|
}));
|
|
5551
5625
|
|
|
5552
5626
|
// src/components/FilterableCheckboxGroup/FilterableCheckboxGroup.tsx
|
|
5553
|
-
import React32, { useCallback as useCallback15, useEffect as useEffect9, useMemo as
|
|
5627
|
+
import React32, { useCallback as useCallback15, useEffect as useEffect9, useMemo as useMemo14, useRef as useRef9, useState as useState11 } from "react";
|
|
5554
5628
|
import SearchIcon from "@mui/icons-material/Search";
|
|
5555
5629
|
import { useThemeProps as useThemeProps8 } from "@mui/joy";
|
|
5556
5630
|
import { useVirtualizer as useVirtualizer3 } from "@tanstack/react-virtual";
|
|
@@ -5611,11 +5685,11 @@ function FilterableCheckboxGroup(inProps) {
|
|
|
5611
5685
|
const parentRef = useRef9(null);
|
|
5612
5686
|
const isInitialSortRef = useRef9(false);
|
|
5613
5687
|
const prevOptionsRef = useRef9([...options]);
|
|
5614
|
-
const filteredOptions =
|
|
5688
|
+
const filteredOptions = useMemo14(() => {
|
|
5615
5689
|
if (!searchTerm) return sortedOptions;
|
|
5616
5690
|
return sortedOptions.filter((option) => option.label.toLowerCase().includes(searchTerm.toLowerCase()));
|
|
5617
5691
|
}, [sortedOptions, searchTerm]);
|
|
5618
|
-
const itemSize =
|
|
5692
|
+
const itemSize = useMemo14(() => {
|
|
5619
5693
|
switch (size) {
|
|
5620
5694
|
case "sm":
|
|
5621
5695
|
return 28;
|
|
@@ -5689,7 +5763,7 @@ function FilterableCheckboxGroup(inProps) {
|
|
|
5689
5763
|
},
|
|
5690
5764
|
[filteredOptions, internalValue, setInternalValue]
|
|
5691
5765
|
);
|
|
5692
|
-
const enabledFilteredOptions =
|
|
5766
|
+
const enabledFilteredOptions = useMemo14(() => filteredOptions.filter((option) => !option.disabled), [filteredOptions]);
|
|
5693
5767
|
const isAllSelected = enabledFilteredOptions.length > 0 && enabledFilteredOptions.every((option) => internalValue.includes(option.value));
|
|
5694
5768
|
const isIndeterminate = !isAllSelected && enabledFilteredOptions.some((option) => internalValue.includes(option.value));
|
|
5695
5769
|
return /* @__PURE__ */ React32.createElement("div", { style: { width: "100%" } }, /* @__PURE__ */ React32.createElement(
|
|
@@ -5785,7 +5859,10 @@ import {
|
|
|
5785
5859
|
MenuButton as JoyMenuButton2,
|
|
5786
5860
|
IconButton as JoyIconButton2
|
|
5787
5861
|
} from "@mui/joy";
|
|
5788
|
-
function
|
|
5862
|
+
var MenuButtonRootSlot = React33.forwardRef(function MenuButtonRootSlot2({ as, ...rest }, ref) {
|
|
5863
|
+
return /* @__PURE__ */ React33.createElement(JoyIconButton2, { ...rest, component: as ?? "button", ref });
|
|
5864
|
+
});
|
|
5865
|
+
function IconMenuButtonInner(props, ref) {
|
|
5789
5866
|
const {
|
|
5790
5867
|
size,
|
|
5791
5868
|
icon,
|
|
@@ -5796,6 +5873,8 @@ function IconMenuButton(props) {
|
|
|
5796
5873
|
variant = "plain",
|
|
5797
5874
|
placement = "bottom"
|
|
5798
5875
|
} = props;
|
|
5876
|
+
const { ref: buttonComponentRef, ...buttonComponentProps } = props.buttonComponentProps ?? {};
|
|
5877
|
+
const mergedButtonRef = useMergedRef(buttonComponentRef, ref);
|
|
5799
5878
|
if (!items.length) {
|
|
5800
5879
|
return /* @__PURE__ */ React33.createElement(
|
|
5801
5880
|
JoyIconButton2,
|
|
@@ -5806,7 +5885,8 @@ function IconMenuButton(props) {
|
|
|
5806
5885
|
color,
|
|
5807
5886
|
disabled,
|
|
5808
5887
|
loading,
|
|
5809
|
-
...
|
|
5888
|
+
...buttonComponentProps,
|
|
5889
|
+
ref: mergedButtonRef
|
|
5810
5890
|
},
|
|
5811
5891
|
icon
|
|
5812
5892
|
);
|
|
@@ -5814,7 +5894,7 @@ function IconMenuButton(props) {
|
|
|
5814
5894
|
return /* @__PURE__ */ React33.createElement(Dropdown_default, null, /* @__PURE__ */ React33.createElement(
|
|
5815
5895
|
JoyMenuButton2,
|
|
5816
5896
|
{
|
|
5817
|
-
slots: { root:
|
|
5897
|
+
slots: { root: MenuButtonRootSlot },
|
|
5818
5898
|
slotProps: {
|
|
5819
5899
|
root: {
|
|
5820
5900
|
component: props.buttonComponent ?? "button",
|
|
@@ -5823,13 +5903,16 @@ function IconMenuButton(props) {
|
|
|
5823
5903
|
color,
|
|
5824
5904
|
disabled,
|
|
5825
5905
|
loading,
|
|
5826
|
-
...
|
|
5906
|
+
...buttonComponentProps,
|
|
5907
|
+
// Joy의 useSlot이 내부 ref와 이 ref를 합쳐준다. 위 no-items 분기와 같은 경로로 ref를 넘긴다.
|
|
5908
|
+
ref: mergedButtonRef
|
|
5827
5909
|
}
|
|
5828
5910
|
}
|
|
5829
5911
|
},
|
|
5830
5912
|
icon
|
|
5831
5913
|
), /* @__PURE__ */ React33.createElement(Menu, { placement, size }, items.map((i) => /* @__PURE__ */ React33.createElement(MenuItem, { key: i.text, component: i.component, ...i.componentProps ?? {} }, i.text))));
|
|
5832
5914
|
}
|
|
5915
|
+
var IconMenuButton = React33.forwardRef(IconMenuButtonInner);
|
|
5833
5916
|
IconMenuButton.displayName = "IconMenuButton";
|
|
5834
5917
|
|
|
5835
5918
|
// src/components/Markdown/Markdown.tsx
|
|
@@ -6279,7 +6362,7 @@ var MonthPicker = forwardRef9((inProps, ref) => {
|
|
|
6279
6362
|
});
|
|
6280
6363
|
|
|
6281
6364
|
// src/components/MonthRangePicker/MonthRangePicker.tsx
|
|
6282
|
-
import React37, { forwardRef as forwardRef10, useCallback as useCallback17, useEffect as useEffect12, useImperativeHandle as useImperativeHandle5, useMemo as
|
|
6365
|
+
import React37, { forwardRef as forwardRef10, useCallback as useCallback17, useEffect as useEffect12, useImperativeHandle as useImperativeHandle5, useMemo as useMemo15, useRef as useRef11, useState as useState14 } from "react";
|
|
6283
6366
|
import { IMaskInput as IMaskInput3, IMask as IMask3 } from "react-imask";
|
|
6284
6367
|
import CalendarTodayIcon4 from "@mui/icons-material/CalendarToday";
|
|
6285
6368
|
import { styled as styled22, useThemeProps as useThemeProps10 } from "@mui/joy";
|
|
@@ -6410,7 +6493,7 @@ var MonthRangePicker = forwardRef10((inProps, ref) => {
|
|
|
6410
6493
|
);
|
|
6411
6494
|
const [anchorEl, setAnchorEl] = useState14(null);
|
|
6412
6495
|
const open = Boolean(anchorEl);
|
|
6413
|
-
const calendarValue =
|
|
6496
|
+
const calendarValue = useMemo15(() => value ? parseDates2(value) : void 0, [value]);
|
|
6414
6497
|
useEffect12(() => {
|
|
6415
6498
|
if (value) {
|
|
6416
6499
|
try {
|
|
@@ -6693,7 +6776,7 @@ function Navigator(props) {
|
|
|
6693
6776
|
Navigator.displayName = "Navigator";
|
|
6694
6777
|
|
|
6695
6778
|
// src/components/PercentageInput/PercentageInput.tsx
|
|
6696
|
-
import React41, { useCallback as useCallback18, useMemo as
|
|
6779
|
+
import React41, { useCallback as useCallback18, useMemo as useMemo16 } from "react";
|
|
6697
6780
|
import { NumericFormat as NumericFormat2 } from "react-number-format";
|
|
6698
6781
|
import { styled as styled25, useThemeProps as useThemeProps11 } from "@mui/joy";
|
|
6699
6782
|
var padDecimal = (value, decimalScale) => {
|
|
@@ -6752,13 +6835,13 @@ var PercentageInput = React41.forwardRef(
|
|
|
6752
6835
|
props.defaultValue ?? null,
|
|
6753
6836
|
useCallback18((value2) => onChange?.({ target: { name, value: value2 } }), [onChange, name])
|
|
6754
6837
|
);
|
|
6755
|
-
const value =
|
|
6838
|
+
const value = useMemo16(() => {
|
|
6756
6839
|
if (_value && useMinorUnit) {
|
|
6757
6840
|
return _value / Math.pow(10, maxDecimalScale);
|
|
6758
6841
|
}
|
|
6759
6842
|
return _value;
|
|
6760
6843
|
}, [_value, useMinorUnit, maxDecimalScale]);
|
|
6761
|
-
const internalError =
|
|
6844
|
+
const internalError = useMemo16(
|
|
6762
6845
|
() => value != null && (max != null && value > max || min != null && value < min),
|
|
6763
6846
|
[max, min, value]
|
|
6764
6847
|
);
|
|
@@ -7524,7 +7607,7 @@ function ThemeProvider(props) {
|
|
|
7524
7607
|
ThemeProvider.displayName = "ThemeProvider";
|
|
7525
7608
|
|
|
7526
7609
|
// src/components/Uploader/Uploader.tsx
|
|
7527
|
-
import React49, { useCallback as useCallback19, useEffect as useEffect13, useMemo as
|
|
7610
|
+
import React49, { useCallback as useCallback19, useEffect as useEffect13, useMemo as useMemo17, useRef as useRef12, useState as useState16 } from "react";
|
|
7528
7611
|
import { styled as styled31, Input as Input2 } from "@mui/joy";
|
|
7529
7612
|
import MuiFileUploadIcon from "@mui/icons-material/CloudUploadRounded";
|
|
7530
7613
|
import MuiUploadFileIcon from "@mui/icons-material/UploadFileRounded";
|
|
@@ -7664,8 +7747,8 @@ var Uploader = React49.memo((props) => {
|
|
|
7664
7747
|
const [files, setFiles] = useState16([]);
|
|
7665
7748
|
const [uploaded, setUploaded] = useState16(props.uploaded || []);
|
|
7666
7749
|
const [previewState, setPreviewState] = useState16("idle");
|
|
7667
|
-
const accepts =
|
|
7668
|
-
const parsedAccepts =
|
|
7750
|
+
const accepts = useMemo17(() => accept.split(",").map((accept2) => accept2.trim()), [accept]);
|
|
7751
|
+
const parsedAccepts = useMemo17(
|
|
7669
7752
|
() => accepts.flatMap((type) => {
|
|
7670
7753
|
if (["image/*", "video/*", "audio/*"].includes(type)) {
|
|
7671
7754
|
return ALL_EXTENSIONS_BY_TYPE[type];
|
|
@@ -7674,7 +7757,7 @@ var Uploader = React49.memo((props) => {
|
|
|
7674
7757
|
}),
|
|
7675
7758
|
[accepts]
|
|
7676
7759
|
);
|
|
7677
|
-
const helperText =
|
|
7760
|
+
const helperText = useMemo17(() => {
|
|
7678
7761
|
if (helperTextProp) {
|
|
7679
7762
|
return helperTextProp;
|
|
7680
7763
|
}
|
|
@@ -7704,8 +7787,8 @@ var Uploader = React49.memo((props) => {
|
|
|
7704
7787
|
}
|
|
7705
7788
|
return helperTexts.join(", ");
|
|
7706
7789
|
}, [accepts, maxFileTotalSize, maxCount, helperTextProp]);
|
|
7707
|
-
const error =
|
|
7708
|
-
const showDropZone =
|
|
7790
|
+
const error = useMemo17(() => !!errorText || errorProp, [errorProp, errorText]);
|
|
7791
|
+
const showDropZone = useMemo17(
|
|
7709
7792
|
() => !maxCount || maxCount && [...uploaded, ...files].length !== maxCount,
|
|
7710
7793
|
[files, maxCount, uploaded]
|
|
7711
7794
|
);
|