@ceed/ads 1.2.7 → 1.2.8-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/DataTable/index.d.ts +1 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/index.cjs +115 -77
- package/dist/index.js +118 -78
- package/framer/index.js +28 -28
- package/package.json +17 -13
|
@@ -12,6 +12,7 @@ export { Chip } from "./Chip";
|
|
|
12
12
|
export { Container } from "./Container";
|
|
13
13
|
export { CurrencyInput } from "./CurrencyInput";
|
|
14
14
|
export { DataTable } from "./DataTable";
|
|
15
|
+
export type * from "./DataTable/types";
|
|
15
16
|
export { DatePicker } from "./DatePicker";
|
|
16
17
|
export { DateRangePicker } from "./DateRangePicker";
|
|
17
18
|
export { DialogActions } from "./DialogActions";
|
package/dist/index.cjs
CHANGED
|
@@ -3029,51 +3029,73 @@ var HeadCell = (props) => {
|
|
|
3029
3029
|
() => `${tableId}_header_${headerName ?? field}`.trim(),
|
|
3030
3030
|
[tableId, headerName, field]
|
|
3031
3031
|
);
|
|
3032
|
-
const resizer =
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3032
|
+
const resizer = (0, import_react25.useMemo)(
|
|
3033
|
+
() => resizable ?? true ? Resizer(ref) : null,
|
|
3034
|
+
[resizable, ref]
|
|
3035
|
+
);
|
|
3036
|
+
const style = (0, import_react25.useMemo)(
|
|
3037
|
+
() => ({
|
|
3038
|
+
width,
|
|
3039
|
+
minWidth: minWidth ?? "50px",
|
|
3040
|
+
maxWidth,
|
|
3041
|
+
position: isPinned ? "sticky" : stickyHeader ? void 0 : "relative",
|
|
3042
|
+
// 조건식 더 복잡해지면 IIFE로 정리
|
|
3043
|
+
left: isPinned ? pinnedStartPosition : void 0,
|
|
3044
|
+
right: isPinned ? pinnedEndPosition : void 0,
|
|
3045
|
+
zIndex: isPinned ? `calc(${theme.getCssVar("zIndex-table")} + 2)` : void 0,
|
|
3046
|
+
cursor: sortable ? "pointer" : "default",
|
|
3047
|
+
// TODO: multi-sort때문에 일단 추가한 property, joy-ui에서는 multi-sort시 th에 user-select: none을 적용하고 툴팁을 띄워준다.
|
|
3048
|
+
userSelect: "none"
|
|
3049
|
+
}),
|
|
3050
|
+
[
|
|
3051
|
+
isPinned,
|
|
3052
|
+
maxWidth,
|
|
3053
|
+
minWidth,
|
|
3054
|
+
pinnedEndPosition,
|
|
3055
|
+
pinnedStartPosition,
|
|
3056
|
+
sortable,
|
|
3057
|
+
stickyHeader,
|
|
3058
|
+
theme,
|
|
3059
|
+
width
|
|
3060
|
+
]
|
|
3061
|
+
);
|
|
3046
3062
|
const textAlign = getTextAlign(props);
|
|
3047
3063
|
const initialSort = sortOrder[0];
|
|
3048
|
-
const sortIcon =
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3064
|
+
const sortIcon = (0, import_react25.useMemo)(
|
|
3065
|
+
() => sortable && /* @__PURE__ */ import_react25.default.createElement(
|
|
3066
|
+
MotionSortIcon,
|
|
3067
|
+
{
|
|
3068
|
+
style: {
|
|
3069
|
+
width: "16px",
|
|
3070
|
+
height: "16px"
|
|
3071
|
+
},
|
|
3072
|
+
role: "img",
|
|
3073
|
+
"aria-labelledby": headId,
|
|
3074
|
+
"aria-description": (sort ?? initialSort) === "desc" ? "descending" : "ascending",
|
|
3075
|
+
"data-testid": void 0,
|
|
3076
|
+
variants: {
|
|
3077
|
+
hover: { opacity: 1 },
|
|
3078
|
+
initial: { opacity: 0 }
|
|
3079
|
+
},
|
|
3080
|
+
animate: {
|
|
3081
|
+
color: !!sort ? "var(--ceed-palette-text-secondary)" : "var(--ceed-palette-primary-solidDisabledColor)",
|
|
3082
|
+
rotate: (sort ?? initialSort) === "desc" ? 180 : 0,
|
|
3083
|
+
opacity: !!sort ? 1 : 0
|
|
3084
|
+
},
|
|
3085
|
+
transition: {
|
|
3086
|
+
duration: 0,
|
|
3087
|
+
rotate: { duration: 0.2, ease: "easeOut" },
|
|
3088
|
+
color: { duration: 0.2, ease: "easeInOut" },
|
|
3089
|
+
opacity: { duration: 0.2, ease: "easeInOut" }
|
|
3090
|
+
}
|
|
3073
3091
|
}
|
|
3074
|
-
|
|
3092
|
+
),
|
|
3093
|
+
[headId, initialSort, sort, sortable]
|
|
3094
|
+
);
|
|
3095
|
+
const infoSign = (0, import_react25.useMemo)(
|
|
3096
|
+
() => description ? /* @__PURE__ */ import_react25.default.createElement(InfoSign_default, { message: description, placement: "bottom" }) : null,
|
|
3097
|
+
[description]
|
|
3075
3098
|
);
|
|
3076
|
-
const infoSign = description ? /* @__PURE__ */ import_react25.default.createElement(InfoSign_default, { message: description, placement: "bottom" }) : null;
|
|
3077
3099
|
return /* @__PURE__ */ import_react25.default.createElement(
|
|
3078
3100
|
StyledTh,
|
|
3079
3101
|
{
|
|
@@ -3083,7 +3105,10 @@ var HeadCell = (props) => {
|
|
|
3083
3105
|
ref,
|
|
3084
3106
|
key: field,
|
|
3085
3107
|
style,
|
|
3086
|
-
onClick: (
|
|
3108
|
+
onClick: (0, import_react25.useCallback)(
|
|
3109
|
+
(e) => sortable && onSortChange?.({ field, currentSort: sort, multiple: e.shiftKey }),
|
|
3110
|
+
[field, onSortChange, sort, sortable]
|
|
3111
|
+
),
|
|
3087
3112
|
whileHover: "hover",
|
|
3088
3113
|
initial: "initial"
|
|
3089
3114
|
},
|
|
@@ -3141,7 +3166,7 @@ var BodyCell = (props) => {
|
|
|
3141
3166
|
...typeof props.componentProps === "function" ? props.componentProps(params) : props.componentProps || {},
|
|
3142
3167
|
size: "sm"
|
|
3143
3168
|
}),
|
|
3144
|
-
[props, params]
|
|
3169
|
+
[props.componentProps, params]
|
|
3145
3170
|
);
|
|
3146
3171
|
const editModeComponentProps = (0, import_react25.useMemo)(
|
|
3147
3172
|
() => ({
|
|
@@ -3203,11 +3228,20 @@ var BodyCell = (props) => {
|
|
|
3203
3228
|
}
|
|
3204
3229
|
}
|
|
3205
3230
|
}),
|
|
3206
|
-
[
|
|
3231
|
+
[
|
|
3232
|
+
params,
|
|
3233
|
+
row,
|
|
3234
|
+
field,
|
|
3235
|
+
value,
|
|
3236
|
+
componentProps,
|
|
3237
|
+
type,
|
|
3238
|
+
props.onCellEditStop,
|
|
3239
|
+
props.onCellEditStart
|
|
3240
|
+
]
|
|
3207
3241
|
);
|
|
3208
3242
|
const EditModeComponent = (0, import_react25.useMemo)(() => {
|
|
3209
3243
|
if (renderEditCell) {
|
|
3210
|
-
return renderEditCell
|
|
3244
|
+
return (0, import_react25.createElement)((0, import_react25.memo)(renderEditCell), params);
|
|
3211
3245
|
}
|
|
3212
3246
|
return {
|
|
3213
3247
|
date: /* @__PURE__ */ import_react25.default.createElement(
|
|
@@ -3267,7 +3301,7 @@ var BodyCell = (props) => {
|
|
|
3267
3301
|
}, [value, editModeComponentProps, type]);
|
|
3268
3302
|
const ReadModeComponent = (0, import_react25.useMemo)(() => {
|
|
3269
3303
|
if (renderCell) {
|
|
3270
|
-
return renderCell
|
|
3304
|
+
return (0, import_react25.createElement)((0, import_react25.memo)(renderCell), params);
|
|
3271
3305
|
}
|
|
3272
3306
|
const innerText = value;
|
|
3273
3307
|
const typedComponent = {
|
|
@@ -3280,14 +3314,14 @@ var BodyCell = (props) => {
|
|
|
3280
3314
|
)
|
|
3281
3315
|
}[type || "text"];
|
|
3282
3316
|
return typedComponent || innerText;
|
|
3283
|
-
}, [value, renderCell, params, type, componentProps
|
|
3317
|
+
}, [value, renderCell, params, type, componentProps]);
|
|
3284
3318
|
const CellComponent = (0, import_react25.useMemo)(
|
|
3285
3319
|
() => editMode && EditModeComponent ? EditModeComponent : ReadModeComponent,
|
|
3286
3320
|
[editMode, EditModeComponent, ReadModeComponent]
|
|
3287
3321
|
);
|
|
3288
3322
|
const showTooltip = (0, import_react25.useMemo)(
|
|
3289
|
-
() => noWrap &&
|
|
3290
|
-
[noWrap,
|
|
3323
|
+
() => noWrap && type === "longText",
|
|
3324
|
+
[noWrap, type]
|
|
3291
3325
|
);
|
|
3292
3326
|
(0, import_react25.useEffect)(() => {
|
|
3293
3327
|
setValue(row[field]);
|
|
@@ -3298,38 +3332,40 @@ var BodyCell = (props) => {
|
|
|
3298
3332
|
ref: cellRef,
|
|
3299
3333
|
key: field,
|
|
3300
3334
|
headers: `${tableId}_header_${props.headerName ?? field}`,
|
|
3301
|
-
|
|
3335
|
+
sx: {
|
|
3302
3336
|
textAlign: getTextAlign({ type }),
|
|
3303
3337
|
verticalAlign: editMode ? "top" : "middle",
|
|
3304
3338
|
position: isPinned ? "sticky" : void 0,
|
|
3305
3339
|
left: isPinned ? pinnedStartPosition : void 0,
|
|
3306
3340
|
right: isPinned ? pinnedEndPosition : void 0,
|
|
3307
3341
|
zIndex: isPinned ? `calc(${theme.getCssVar("zIndex-table")} + 2)` : void 0,
|
|
3308
|
-
// @ts-expect-error: react CSSProperties에는 --var를 지원하지 않는다.
|
|
3309
3342
|
"--TableCell-dataBackground": isPinned ? `var(--TableCell-headBackground)` : void 0
|
|
3310
3343
|
},
|
|
3311
3344
|
className: isLastStartPinnedColumn && "is-last-left" || isLastEndPinnedColumn && "is-last-right" || ""
|
|
3312
3345
|
},
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
title: value,
|
|
3317
|
-
placement: "bottom",
|
|
3318
|
-
style: { maxWidth: "100%" },
|
|
3319
|
-
enterDelay: 1500,
|
|
3320
|
-
enterNextDelay: 1500
|
|
3321
|
-
},
|
|
3322
|
-
/* @__PURE__ */ import_react25.default.createElement(
|
|
3323
|
-
"div",
|
|
3346
|
+
(0, import_react25.useMemo)(
|
|
3347
|
+
() => showTooltip ? /* @__PURE__ */ import_react25.default.createElement(
|
|
3348
|
+
Tooltip_default,
|
|
3324
3349
|
{
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3350
|
+
title: value,
|
|
3351
|
+
placement: "bottom",
|
|
3352
|
+
style: { maxWidth: "100%" },
|
|
3353
|
+
enterDelay: 1500,
|
|
3354
|
+
enterNextDelay: 1500
|
|
3329
3355
|
},
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3356
|
+
/* @__PURE__ */ import_react25.default.createElement(
|
|
3357
|
+
"div",
|
|
3358
|
+
{
|
|
3359
|
+
style: {
|
|
3360
|
+
overflow: "hidden",
|
|
3361
|
+
textOverflow: "ellipsis"
|
|
3362
|
+
}
|
|
3363
|
+
},
|
|
3364
|
+
CellComponent
|
|
3365
|
+
)
|
|
3366
|
+
) : CellComponent,
|
|
3367
|
+
[CellComponent, showTooltip, value]
|
|
3368
|
+
)
|
|
3333
3369
|
);
|
|
3334
3370
|
};
|
|
3335
3371
|
var BodyRow = (props) => {
|
|
@@ -3358,8 +3394,8 @@ function useDataTableRenderer({
|
|
|
3358
3394
|
paginationModel,
|
|
3359
3395
|
onPaginationModelChange,
|
|
3360
3396
|
sortModel: controlledSortModel,
|
|
3361
|
-
sortOrder: _sortOrder
|
|
3362
|
-
selectionModel
|
|
3397
|
+
sortOrder: _sortOrder,
|
|
3398
|
+
selectionModel,
|
|
3363
3399
|
onSortModelChange,
|
|
3364
3400
|
onSelectionModelChange,
|
|
3365
3401
|
editMode,
|
|
@@ -3421,7 +3457,8 @@ function useDataTableRenderer({
|
|
|
3421
3457
|
[_rows, sortModel, sortComparator]
|
|
3422
3458
|
);
|
|
3423
3459
|
const sortOrder = (0, import_react25.useMemo)(
|
|
3424
|
-
|
|
3460
|
+
// NOTE: default value를 props destructuring에서 할당하면 렌더링 시점에 초기화가 되어버린다.
|
|
3461
|
+
() => Array.from(new Set(_sortOrder || ["asc", "desc", null])),
|
|
3425
3462
|
[_sortOrder]
|
|
3426
3463
|
);
|
|
3427
3464
|
const [page, setPage] = (0, import_react25.useState)(paginationModel?.page || 1);
|
|
@@ -3431,7 +3468,8 @@ function useDataTableRenderer({
|
|
|
3431
3468
|
[_getId, page, pageSize]
|
|
3432
3469
|
);
|
|
3433
3470
|
const selectedModelSet = (0, import_react25.useMemo)(
|
|
3434
|
-
|
|
3471
|
+
// NOTE: default value를 props destructuring에서 할당하면 렌더링 시점에 초기화가 되어버린다.
|
|
3472
|
+
() => new Set(selectionModel || []),
|
|
3435
3473
|
[selectionModel]
|
|
3436
3474
|
);
|
|
3437
3475
|
const dataInPage = (0, import_react25.useMemo)(
|
|
@@ -3444,7 +3482,7 @@ function useDataTableRenderer({
|
|
|
3444
3482
|
);
|
|
3445
3483
|
const rowCount = totalRowsProp || rows.length;
|
|
3446
3484
|
const isTotalSelected = (0, import_react25.useMemo)(
|
|
3447
|
-
() => _isTotalSelected ?? (rowCount > 0 && selectionModel
|
|
3485
|
+
() => _isTotalSelected ?? (rowCount > 0 && (selectionModel?.length || 0) === rowCount),
|
|
3448
3486
|
[_isTotalSelected, selectionModel, rowCount]
|
|
3449
3487
|
);
|
|
3450
3488
|
const columns = (0, import_react25.useMemo)(() => {
|
|
@@ -3568,12 +3606,12 @@ function useDataTableRenderer({
|
|
|
3568
3606
|
onCheckboxChange: (0, import_react25.useCallback)(
|
|
3569
3607
|
(event, selectedModel) => {
|
|
3570
3608
|
if (selectedModelSet.has(selectedModel)) {
|
|
3571
|
-
const newSelectionModel = selectionModel.filter(
|
|
3609
|
+
const newSelectionModel = (selectionModel || []).filter(
|
|
3572
3610
|
(model) => model !== selectedModel
|
|
3573
3611
|
);
|
|
3574
3612
|
onSelectionModelChange?.(newSelectionModel);
|
|
3575
3613
|
} else {
|
|
3576
|
-
const newSelectionModel = [...selectionModel, selectedModel];
|
|
3614
|
+
const newSelectionModel = [...selectionModel || [], selectedModel];
|
|
3577
3615
|
onSelectionModelChange?.(newSelectionModel);
|
|
3578
3616
|
}
|
|
3579
3617
|
},
|
|
@@ -3661,7 +3699,7 @@ function Component(props, apiRef) {
|
|
|
3661
3699
|
getScrollElement: () => parentRef.current,
|
|
3662
3700
|
estimateSize: () => 32,
|
|
3663
3701
|
measureElement: (element) => element.clientHeight,
|
|
3664
|
-
overscan:
|
|
3702
|
+
overscan: 5
|
|
3665
3703
|
});
|
|
3666
3704
|
const paginationModel = (0, import_react25.useMemo)(() => ({ page, pageSize }), [page, pageSize]);
|
|
3667
3705
|
const totalSize = virtualizer.getTotalSize();
|
package/dist/index.js
CHANGED
|
@@ -1988,7 +1988,9 @@ import React23, {
|
|
|
1988
1988
|
useState as useState6,
|
|
1989
1989
|
useId,
|
|
1990
1990
|
forwardRef as forwardRef7,
|
|
1991
|
-
useImperativeHandle as useImperativeHandle2
|
|
1991
|
+
useImperativeHandle as useImperativeHandle2,
|
|
1992
|
+
createElement,
|
|
1993
|
+
memo
|
|
1992
1994
|
} from "react";
|
|
1993
1995
|
import { useVirtualizer as useVirtualizer2 } from "@tanstack/react-virtual";
|
|
1994
1996
|
import { styled as styled12, LinearProgress, Link, useTheme } from "@mui/joy";
|
|
@@ -2977,51 +2979,73 @@ var HeadCell = (props) => {
|
|
|
2977
2979
|
() => `${tableId}_header_${headerName ?? field}`.trim(),
|
|
2978
2980
|
[tableId, headerName, field]
|
|
2979
2981
|
);
|
|
2980
|
-
const resizer =
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2982
|
+
const resizer = useMemo8(
|
|
2983
|
+
() => resizable ?? true ? Resizer(ref) : null,
|
|
2984
|
+
[resizable, ref]
|
|
2985
|
+
);
|
|
2986
|
+
const style = useMemo8(
|
|
2987
|
+
() => ({
|
|
2988
|
+
width,
|
|
2989
|
+
minWidth: minWidth ?? "50px",
|
|
2990
|
+
maxWidth,
|
|
2991
|
+
position: isPinned ? "sticky" : stickyHeader ? void 0 : "relative",
|
|
2992
|
+
// 조건식 더 복잡해지면 IIFE로 정리
|
|
2993
|
+
left: isPinned ? pinnedStartPosition : void 0,
|
|
2994
|
+
right: isPinned ? pinnedEndPosition : void 0,
|
|
2995
|
+
zIndex: isPinned ? `calc(${theme.getCssVar("zIndex-table")} + 2)` : void 0,
|
|
2996
|
+
cursor: sortable ? "pointer" : "default",
|
|
2997
|
+
// TODO: multi-sort때문에 일단 추가한 property, joy-ui에서는 multi-sort시 th에 user-select: none을 적용하고 툴팁을 띄워준다.
|
|
2998
|
+
userSelect: "none"
|
|
2999
|
+
}),
|
|
3000
|
+
[
|
|
3001
|
+
isPinned,
|
|
3002
|
+
maxWidth,
|
|
3003
|
+
minWidth,
|
|
3004
|
+
pinnedEndPosition,
|
|
3005
|
+
pinnedStartPosition,
|
|
3006
|
+
sortable,
|
|
3007
|
+
stickyHeader,
|
|
3008
|
+
theme,
|
|
3009
|
+
width
|
|
3010
|
+
]
|
|
3011
|
+
);
|
|
2994
3012
|
const textAlign = getTextAlign(props);
|
|
2995
3013
|
const initialSort = sortOrder[0];
|
|
2996
|
-
const sortIcon =
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3014
|
+
const sortIcon = useMemo8(
|
|
3015
|
+
() => sortable && /* @__PURE__ */ React23.createElement(
|
|
3016
|
+
MotionSortIcon,
|
|
3017
|
+
{
|
|
3018
|
+
style: {
|
|
3019
|
+
width: "16px",
|
|
3020
|
+
height: "16px"
|
|
3021
|
+
},
|
|
3022
|
+
role: "img",
|
|
3023
|
+
"aria-labelledby": headId,
|
|
3024
|
+
"aria-description": (sort ?? initialSort) === "desc" ? "descending" : "ascending",
|
|
3025
|
+
"data-testid": void 0,
|
|
3026
|
+
variants: {
|
|
3027
|
+
hover: { opacity: 1 },
|
|
3028
|
+
initial: { opacity: 0 }
|
|
3029
|
+
},
|
|
3030
|
+
animate: {
|
|
3031
|
+
color: !!sort ? "var(--ceed-palette-text-secondary)" : "var(--ceed-palette-primary-solidDisabledColor)",
|
|
3032
|
+
rotate: (sort ?? initialSort) === "desc" ? 180 : 0,
|
|
3033
|
+
opacity: !!sort ? 1 : 0
|
|
3034
|
+
},
|
|
3035
|
+
transition: {
|
|
3036
|
+
duration: 0,
|
|
3037
|
+
rotate: { duration: 0.2, ease: "easeOut" },
|
|
3038
|
+
color: { duration: 0.2, ease: "easeInOut" },
|
|
3039
|
+
opacity: { duration: 0.2, ease: "easeInOut" }
|
|
3040
|
+
}
|
|
3021
3041
|
}
|
|
3022
|
-
|
|
3042
|
+
),
|
|
3043
|
+
[headId, initialSort, sort, sortable]
|
|
3044
|
+
);
|
|
3045
|
+
const infoSign = useMemo8(
|
|
3046
|
+
() => description ? /* @__PURE__ */ React23.createElement(InfoSign_default, { message: description, placement: "bottom" }) : null,
|
|
3047
|
+
[description]
|
|
3023
3048
|
);
|
|
3024
|
-
const infoSign = description ? /* @__PURE__ */ React23.createElement(InfoSign_default, { message: description, placement: "bottom" }) : null;
|
|
3025
3049
|
return /* @__PURE__ */ React23.createElement(
|
|
3026
3050
|
StyledTh,
|
|
3027
3051
|
{
|
|
@@ -3031,7 +3055,10 @@ var HeadCell = (props) => {
|
|
|
3031
3055
|
ref,
|
|
3032
3056
|
key: field,
|
|
3033
3057
|
style,
|
|
3034
|
-
onClick: (
|
|
3058
|
+
onClick: useCallback9(
|
|
3059
|
+
(e) => sortable && onSortChange?.({ field, currentSort: sort, multiple: e.shiftKey }),
|
|
3060
|
+
[field, onSortChange, sort, sortable]
|
|
3061
|
+
),
|
|
3035
3062
|
whileHover: "hover",
|
|
3036
3063
|
initial: "initial"
|
|
3037
3064
|
},
|
|
@@ -3089,7 +3116,7 @@ var BodyCell = (props) => {
|
|
|
3089
3116
|
...typeof props.componentProps === "function" ? props.componentProps(params) : props.componentProps || {},
|
|
3090
3117
|
size: "sm"
|
|
3091
3118
|
}),
|
|
3092
|
-
[props, params]
|
|
3119
|
+
[props.componentProps, params]
|
|
3093
3120
|
);
|
|
3094
3121
|
const editModeComponentProps = useMemo8(
|
|
3095
3122
|
() => ({
|
|
@@ -3151,11 +3178,20 @@ var BodyCell = (props) => {
|
|
|
3151
3178
|
}
|
|
3152
3179
|
}
|
|
3153
3180
|
}),
|
|
3154
|
-
[
|
|
3181
|
+
[
|
|
3182
|
+
params,
|
|
3183
|
+
row,
|
|
3184
|
+
field,
|
|
3185
|
+
value,
|
|
3186
|
+
componentProps,
|
|
3187
|
+
type,
|
|
3188
|
+
props.onCellEditStop,
|
|
3189
|
+
props.onCellEditStart
|
|
3190
|
+
]
|
|
3155
3191
|
);
|
|
3156
3192
|
const EditModeComponent = useMemo8(() => {
|
|
3157
3193
|
if (renderEditCell) {
|
|
3158
|
-
return renderEditCell
|
|
3194
|
+
return createElement(memo(renderEditCell), params);
|
|
3159
3195
|
}
|
|
3160
3196
|
return {
|
|
3161
3197
|
date: /* @__PURE__ */ React23.createElement(
|
|
@@ -3215,7 +3251,7 @@ var BodyCell = (props) => {
|
|
|
3215
3251
|
}, [value, editModeComponentProps, type]);
|
|
3216
3252
|
const ReadModeComponent = useMemo8(() => {
|
|
3217
3253
|
if (renderCell) {
|
|
3218
|
-
return renderCell
|
|
3254
|
+
return createElement(memo(renderCell), params);
|
|
3219
3255
|
}
|
|
3220
3256
|
const innerText = value;
|
|
3221
3257
|
const typedComponent = {
|
|
@@ -3228,14 +3264,14 @@ var BodyCell = (props) => {
|
|
|
3228
3264
|
)
|
|
3229
3265
|
}[type || "text"];
|
|
3230
3266
|
return typedComponent || innerText;
|
|
3231
|
-
}, [value, renderCell, params, type, componentProps
|
|
3267
|
+
}, [value, renderCell, params, type, componentProps]);
|
|
3232
3268
|
const CellComponent = useMemo8(
|
|
3233
3269
|
() => editMode && EditModeComponent ? EditModeComponent : ReadModeComponent,
|
|
3234
3270
|
[editMode, EditModeComponent, ReadModeComponent]
|
|
3235
3271
|
);
|
|
3236
3272
|
const showTooltip = useMemo8(
|
|
3237
|
-
() => noWrap &&
|
|
3238
|
-
[noWrap,
|
|
3273
|
+
() => noWrap && type === "longText",
|
|
3274
|
+
[noWrap, type]
|
|
3239
3275
|
);
|
|
3240
3276
|
useEffect5(() => {
|
|
3241
3277
|
setValue(row[field]);
|
|
@@ -3246,38 +3282,40 @@ var BodyCell = (props) => {
|
|
|
3246
3282
|
ref: cellRef,
|
|
3247
3283
|
key: field,
|
|
3248
3284
|
headers: `${tableId}_header_${props.headerName ?? field}`,
|
|
3249
|
-
|
|
3285
|
+
sx: {
|
|
3250
3286
|
textAlign: getTextAlign({ type }),
|
|
3251
3287
|
verticalAlign: editMode ? "top" : "middle",
|
|
3252
3288
|
position: isPinned ? "sticky" : void 0,
|
|
3253
3289
|
left: isPinned ? pinnedStartPosition : void 0,
|
|
3254
3290
|
right: isPinned ? pinnedEndPosition : void 0,
|
|
3255
3291
|
zIndex: isPinned ? `calc(${theme.getCssVar("zIndex-table")} + 2)` : void 0,
|
|
3256
|
-
// @ts-expect-error: react CSSProperties에는 --var를 지원하지 않는다.
|
|
3257
3292
|
"--TableCell-dataBackground": isPinned ? `var(--TableCell-headBackground)` : void 0
|
|
3258
3293
|
},
|
|
3259
3294
|
className: isLastStartPinnedColumn && "is-last-left" || isLastEndPinnedColumn && "is-last-right" || ""
|
|
3260
3295
|
},
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
title: value,
|
|
3265
|
-
placement: "bottom",
|
|
3266
|
-
style: { maxWidth: "100%" },
|
|
3267
|
-
enterDelay: 1500,
|
|
3268
|
-
enterNextDelay: 1500
|
|
3269
|
-
},
|
|
3270
|
-
/* @__PURE__ */ React23.createElement(
|
|
3271
|
-
"div",
|
|
3296
|
+
useMemo8(
|
|
3297
|
+
() => showTooltip ? /* @__PURE__ */ React23.createElement(
|
|
3298
|
+
Tooltip_default,
|
|
3272
3299
|
{
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3300
|
+
title: value,
|
|
3301
|
+
placement: "bottom",
|
|
3302
|
+
style: { maxWidth: "100%" },
|
|
3303
|
+
enterDelay: 1500,
|
|
3304
|
+
enterNextDelay: 1500
|
|
3277
3305
|
},
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3306
|
+
/* @__PURE__ */ React23.createElement(
|
|
3307
|
+
"div",
|
|
3308
|
+
{
|
|
3309
|
+
style: {
|
|
3310
|
+
overflow: "hidden",
|
|
3311
|
+
textOverflow: "ellipsis"
|
|
3312
|
+
}
|
|
3313
|
+
},
|
|
3314
|
+
CellComponent
|
|
3315
|
+
)
|
|
3316
|
+
) : CellComponent,
|
|
3317
|
+
[CellComponent, showTooltip, value]
|
|
3318
|
+
)
|
|
3281
3319
|
);
|
|
3282
3320
|
};
|
|
3283
3321
|
var BodyRow = (props) => {
|
|
@@ -3306,8 +3344,8 @@ function useDataTableRenderer({
|
|
|
3306
3344
|
paginationModel,
|
|
3307
3345
|
onPaginationModelChange,
|
|
3308
3346
|
sortModel: controlledSortModel,
|
|
3309
|
-
sortOrder: _sortOrder
|
|
3310
|
-
selectionModel
|
|
3347
|
+
sortOrder: _sortOrder,
|
|
3348
|
+
selectionModel,
|
|
3311
3349
|
onSortModelChange,
|
|
3312
3350
|
onSelectionModelChange,
|
|
3313
3351
|
editMode,
|
|
@@ -3369,7 +3407,8 @@ function useDataTableRenderer({
|
|
|
3369
3407
|
[_rows, sortModel, sortComparator]
|
|
3370
3408
|
);
|
|
3371
3409
|
const sortOrder = useMemo8(
|
|
3372
|
-
|
|
3410
|
+
// NOTE: default value를 props destructuring에서 할당하면 렌더링 시점에 초기화가 되어버린다.
|
|
3411
|
+
() => Array.from(new Set(_sortOrder || ["asc", "desc", null])),
|
|
3373
3412
|
[_sortOrder]
|
|
3374
3413
|
);
|
|
3375
3414
|
const [page, setPage] = useState6(paginationModel?.page || 1);
|
|
@@ -3379,7 +3418,8 @@ function useDataTableRenderer({
|
|
|
3379
3418
|
[_getId, page, pageSize]
|
|
3380
3419
|
);
|
|
3381
3420
|
const selectedModelSet = useMemo8(
|
|
3382
|
-
|
|
3421
|
+
// NOTE: default value를 props destructuring에서 할당하면 렌더링 시점에 초기화가 되어버린다.
|
|
3422
|
+
() => new Set(selectionModel || []),
|
|
3383
3423
|
[selectionModel]
|
|
3384
3424
|
);
|
|
3385
3425
|
const dataInPage = useMemo8(
|
|
@@ -3392,7 +3432,7 @@ function useDataTableRenderer({
|
|
|
3392
3432
|
);
|
|
3393
3433
|
const rowCount = totalRowsProp || rows.length;
|
|
3394
3434
|
const isTotalSelected = useMemo8(
|
|
3395
|
-
() => _isTotalSelected ?? (rowCount > 0 && selectionModel
|
|
3435
|
+
() => _isTotalSelected ?? (rowCount > 0 && (selectionModel?.length || 0) === rowCount),
|
|
3396
3436
|
[_isTotalSelected, selectionModel, rowCount]
|
|
3397
3437
|
);
|
|
3398
3438
|
const columns = useMemo8(() => {
|
|
@@ -3516,12 +3556,12 @@ function useDataTableRenderer({
|
|
|
3516
3556
|
onCheckboxChange: useCallback9(
|
|
3517
3557
|
(event, selectedModel) => {
|
|
3518
3558
|
if (selectedModelSet.has(selectedModel)) {
|
|
3519
|
-
const newSelectionModel = selectionModel.filter(
|
|
3559
|
+
const newSelectionModel = (selectionModel || []).filter(
|
|
3520
3560
|
(model) => model !== selectedModel
|
|
3521
3561
|
);
|
|
3522
3562
|
onSelectionModelChange?.(newSelectionModel);
|
|
3523
3563
|
} else {
|
|
3524
|
-
const newSelectionModel = [...selectionModel, selectedModel];
|
|
3564
|
+
const newSelectionModel = [...selectionModel || [], selectedModel];
|
|
3525
3565
|
onSelectionModelChange?.(newSelectionModel);
|
|
3526
3566
|
}
|
|
3527
3567
|
},
|
|
@@ -3609,7 +3649,7 @@ function Component(props, apiRef) {
|
|
|
3609
3649
|
getScrollElement: () => parentRef.current,
|
|
3610
3650
|
estimateSize: () => 32,
|
|
3611
3651
|
measureElement: (element) => element.clientHeight,
|
|
3612
|
-
overscan:
|
|
3652
|
+
overscan: 5
|
|
3613
3653
|
});
|
|
3614
3654
|
const paginationModel = useMemo8(() => ({ page, pageSize }), [page, pageSize]);
|
|
3615
3655
|
const totalSize = virtualizer.getTotalSize();
|