@ceed/cds 1.2.8-next.1 → 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/index.cjs +115 -77
- package/dist/index.js +117 -78
- package/framer/index.js +27 -27
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2996,51 +2996,73 @@ var HeadCell = (props) => {
|
|
|
2996
2996
|
() => `${tableId}_header_${headerName ?? field}`.trim(),
|
|
2997
2997
|
[tableId, headerName, field]
|
|
2998
2998
|
);
|
|
2999
|
-
const resizer =
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
2999
|
+
const resizer = (0, import_react24.useMemo)(
|
|
3000
|
+
() => resizable ?? true ? Resizer(ref) : null,
|
|
3001
|
+
[resizable, ref]
|
|
3002
|
+
);
|
|
3003
|
+
const style = (0, import_react24.useMemo)(
|
|
3004
|
+
() => ({
|
|
3005
|
+
width,
|
|
3006
|
+
minWidth: minWidth ?? "50px",
|
|
3007
|
+
maxWidth,
|
|
3008
|
+
position: isPinned ? "sticky" : stickyHeader ? void 0 : "relative",
|
|
3009
|
+
// 조건식 더 복잡해지면 IIFE로 정리
|
|
3010
|
+
left: isPinned ? pinnedStartPosition : void 0,
|
|
3011
|
+
right: isPinned ? pinnedEndPosition : void 0,
|
|
3012
|
+
zIndex: isPinned ? `calc(${theme.getCssVar("zIndex-table")} + 2)` : void 0,
|
|
3013
|
+
cursor: sortable ? "pointer" : "default",
|
|
3014
|
+
// TODO: multi-sort때문에 일단 추가한 property, joy-ui에서는 multi-sort시 th에 user-select: none을 적용하고 툴팁을 띄워준다.
|
|
3015
|
+
userSelect: "none"
|
|
3016
|
+
}),
|
|
3017
|
+
[
|
|
3018
|
+
isPinned,
|
|
3019
|
+
maxWidth,
|
|
3020
|
+
minWidth,
|
|
3021
|
+
pinnedEndPosition,
|
|
3022
|
+
pinnedStartPosition,
|
|
3023
|
+
sortable,
|
|
3024
|
+
stickyHeader,
|
|
3025
|
+
theme,
|
|
3026
|
+
width
|
|
3027
|
+
]
|
|
3028
|
+
);
|
|
3013
3029
|
const textAlign = getTextAlign(props);
|
|
3014
3030
|
const initialSort = sortOrder[0];
|
|
3015
|
-
const sortIcon =
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3031
|
+
const sortIcon = (0, import_react24.useMemo)(
|
|
3032
|
+
() => sortable && /* @__PURE__ */ import_react24.default.createElement(
|
|
3033
|
+
MotionSortIcon,
|
|
3034
|
+
{
|
|
3035
|
+
style: {
|
|
3036
|
+
width: "16px",
|
|
3037
|
+
height: "16px"
|
|
3038
|
+
},
|
|
3039
|
+
role: "img",
|
|
3040
|
+
"aria-labelledby": headId,
|
|
3041
|
+
"aria-description": (sort ?? initialSort) === "desc" ? "descending" : "ascending",
|
|
3042
|
+
"data-testid": void 0,
|
|
3043
|
+
variants: {
|
|
3044
|
+
hover: { opacity: 1 },
|
|
3045
|
+
initial: { opacity: 0 }
|
|
3046
|
+
},
|
|
3047
|
+
animate: {
|
|
3048
|
+
color: !!sort ? "var(--ceed-palette-text-secondary)" : "var(--ceed-palette-primary-solidDisabledColor)",
|
|
3049
|
+
rotate: (sort ?? initialSort) === "desc" ? 180 : 0,
|
|
3050
|
+
opacity: !!sort ? 1 : 0
|
|
3051
|
+
},
|
|
3052
|
+
transition: {
|
|
3053
|
+
duration: 0,
|
|
3054
|
+
rotate: { duration: 0.2, ease: "easeOut" },
|
|
3055
|
+
color: { duration: 0.2, ease: "easeInOut" },
|
|
3056
|
+
opacity: { duration: 0.2, ease: "easeInOut" }
|
|
3057
|
+
}
|
|
3040
3058
|
}
|
|
3041
|
-
|
|
3059
|
+
),
|
|
3060
|
+
[headId, initialSort, sort, sortable]
|
|
3061
|
+
);
|
|
3062
|
+
const infoSign = (0, import_react24.useMemo)(
|
|
3063
|
+
() => description ? /* @__PURE__ */ import_react24.default.createElement(InfoSign_default, { message: description, placement: "bottom" }) : null,
|
|
3064
|
+
[description]
|
|
3042
3065
|
);
|
|
3043
|
-
const infoSign = description ? /* @__PURE__ */ import_react24.default.createElement(InfoSign_default, { message: description, placement: "bottom" }) : null;
|
|
3044
3066
|
return /* @__PURE__ */ import_react24.default.createElement(
|
|
3045
3067
|
StyledTh,
|
|
3046
3068
|
{
|
|
@@ -3050,7 +3072,10 @@ var HeadCell = (props) => {
|
|
|
3050
3072
|
ref,
|
|
3051
3073
|
key: field,
|
|
3052
3074
|
style,
|
|
3053
|
-
onClick: (
|
|
3075
|
+
onClick: (0, import_react24.useCallback)(
|
|
3076
|
+
(e) => sortable && onSortChange?.({ field, currentSort: sort, multiple: e.shiftKey }),
|
|
3077
|
+
[field, onSortChange, sort, sortable]
|
|
3078
|
+
),
|
|
3054
3079
|
whileHover: "hover",
|
|
3055
3080
|
initial: "initial"
|
|
3056
3081
|
},
|
|
@@ -3108,7 +3133,7 @@ var BodyCell = (props) => {
|
|
|
3108
3133
|
...typeof props.componentProps === "function" ? props.componentProps(params) : props.componentProps || {},
|
|
3109
3134
|
size: "sm"
|
|
3110
3135
|
}),
|
|
3111
|
-
[props, params]
|
|
3136
|
+
[props.componentProps, params]
|
|
3112
3137
|
);
|
|
3113
3138
|
const editModeComponentProps = (0, import_react24.useMemo)(
|
|
3114
3139
|
() => ({
|
|
@@ -3170,11 +3195,20 @@ var BodyCell = (props) => {
|
|
|
3170
3195
|
}
|
|
3171
3196
|
}
|
|
3172
3197
|
}),
|
|
3173
|
-
[
|
|
3198
|
+
[
|
|
3199
|
+
params,
|
|
3200
|
+
row,
|
|
3201
|
+
field,
|
|
3202
|
+
value,
|
|
3203
|
+
componentProps,
|
|
3204
|
+
type,
|
|
3205
|
+
props.onCellEditStop,
|
|
3206
|
+
props.onCellEditStart
|
|
3207
|
+
]
|
|
3174
3208
|
);
|
|
3175
3209
|
const EditModeComponent = (0, import_react24.useMemo)(() => {
|
|
3176
3210
|
if (renderEditCell) {
|
|
3177
|
-
return (0, import_react24.createElement)(renderEditCell, params);
|
|
3211
|
+
return (0, import_react24.createElement)((0, import_react24.memo)(renderEditCell), params);
|
|
3178
3212
|
}
|
|
3179
3213
|
return {
|
|
3180
3214
|
date: /* @__PURE__ */ import_react24.default.createElement(
|
|
@@ -3234,7 +3268,7 @@ var BodyCell = (props) => {
|
|
|
3234
3268
|
}, [value, editModeComponentProps, type]);
|
|
3235
3269
|
const ReadModeComponent = (0, import_react24.useMemo)(() => {
|
|
3236
3270
|
if (renderCell) {
|
|
3237
|
-
return (0, import_react24.createElement)(renderCell, params);
|
|
3271
|
+
return (0, import_react24.createElement)((0, import_react24.memo)(renderCell), params);
|
|
3238
3272
|
}
|
|
3239
3273
|
const innerText = value;
|
|
3240
3274
|
const typedComponent = {
|
|
@@ -3247,14 +3281,14 @@ var BodyCell = (props) => {
|
|
|
3247
3281
|
)
|
|
3248
3282
|
}[type || "text"];
|
|
3249
3283
|
return typedComponent || innerText;
|
|
3250
|
-
}, [value, renderCell, params, type, componentProps
|
|
3284
|
+
}, [value, renderCell, params, type, componentProps]);
|
|
3251
3285
|
const CellComponent = (0, import_react24.useMemo)(
|
|
3252
3286
|
() => editMode && EditModeComponent ? EditModeComponent : ReadModeComponent,
|
|
3253
3287
|
[editMode, EditModeComponent, ReadModeComponent]
|
|
3254
3288
|
);
|
|
3255
3289
|
const showTooltip = (0, import_react24.useMemo)(
|
|
3256
|
-
() => noWrap &&
|
|
3257
|
-
[noWrap,
|
|
3290
|
+
() => noWrap && type === "longText",
|
|
3291
|
+
[noWrap, type]
|
|
3258
3292
|
);
|
|
3259
3293
|
(0, import_react24.useEffect)(() => {
|
|
3260
3294
|
setValue(row[field]);
|
|
@@ -3265,38 +3299,40 @@ var BodyCell = (props) => {
|
|
|
3265
3299
|
ref: cellRef,
|
|
3266
3300
|
key: field,
|
|
3267
3301
|
headers: `${tableId}_header_${props.headerName ?? field}`,
|
|
3268
|
-
|
|
3302
|
+
sx: {
|
|
3269
3303
|
textAlign: getTextAlign({ type }),
|
|
3270
3304
|
verticalAlign: editMode ? "top" : "middle",
|
|
3271
3305
|
position: isPinned ? "sticky" : void 0,
|
|
3272
3306
|
left: isPinned ? pinnedStartPosition : void 0,
|
|
3273
3307
|
right: isPinned ? pinnedEndPosition : void 0,
|
|
3274
3308
|
zIndex: isPinned ? `calc(${theme.getCssVar("zIndex-table")} + 2)` : void 0,
|
|
3275
|
-
// @ts-expect-error: react CSSProperties에는 --var를 지원하지 않는다.
|
|
3276
3309
|
"--TableCell-dataBackground": isPinned ? `var(--TableCell-headBackground)` : void 0
|
|
3277
3310
|
},
|
|
3278
3311
|
className: isLastStartPinnedColumn && "is-last-left" || isLastEndPinnedColumn && "is-last-right" || ""
|
|
3279
3312
|
},
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
title: value,
|
|
3284
|
-
placement: "bottom",
|
|
3285
|
-
style: { maxWidth: "100%" },
|
|
3286
|
-
enterDelay: 1500,
|
|
3287
|
-
enterNextDelay: 1500
|
|
3288
|
-
},
|
|
3289
|
-
/* @__PURE__ */ import_react24.default.createElement(
|
|
3290
|
-
"div",
|
|
3313
|
+
(0, import_react24.useMemo)(
|
|
3314
|
+
() => showTooltip ? /* @__PURE__ */ import_react24.default.createElement(
|
|
3315
|
+
Tooltip_default,
|
|
3291
3316
|
{
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3317
|
+
title: value,
|
|
3318
|
+
placement: "bottom",
|
|
3319
|
+
style: { maxWidth: "100%" },
|
|
3320
|
+
enterDelay: 1500,
|
|
3321
|
+
enterNextDelay: 1500
|
|
3296
3322
|
},
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3323
|
+
/* @__PURE__ */ import_react24.default.createElement(
|
|
3324
|
+
"div",
|
|
3325
|
+
{
|
|
3326
|
+
style: {
|
|
3327
|
+
overflow: "hidden",
|
|
3328
|
+
textOverflow: "ellipsis"
|
|
3329
|
+
}
|
|
3330
|
+
},
|
|
3331
|
+
CellComponent
|
|
3332
|
+
)
|
|
3333
|
+
) : CellComponent,
|
|
3334
|
+
[CellComponent, showTooltip, value]
|
|
3335
|
+
)
|
|
3300
3336
|
);
|
|
3301
3337
|
};
|
|
3302
3338
|
var BodyRow = (props) => {
|
|
@@ -3325,8 +3361,8 @@ function useDataTableRenderer({
|
|
|
3325
3361
|
paginationModel,
|
|
3326
3362
|
onPaginationModelChange,
|
|
3327
3363
|
sortModel: controlledSortModel,
|
|
3328
|
-
sortOrder: _sortOrder
|
|
3329
|
-
selectionModel
|
|
3364
|
+
sortOrder: _sortOrder,
|
|
3365
|
+
selectionModel,
|
|
3330
3366
|
onSortModelChange,
|
|
3331
3367
|
onSelectionModelChange,
|
|
3332
3368
|
editMode,
|
|
@@ -3388,7 +3424,8 @@ function useDataTableRenderer({
|
|
|
3388
3424
|
[_rows, sortModel, sortComparator]
|
|
3389
3425
|
);
|
|
3390
3426
|
const sortOrder = (0, import_react24.useMemo)(
|
|
3391
|
-
|
|
3427
|
+
// NOTE: default value를 props destructuring에서 할당하면 렌더링 시점에 초기화가 되어버린다.
|
|
3428
|
+
() => Array.from(new Set(_sortOrder || ["asc", "desc", null])),
|
|
3392
3429
|
[_sortOrder]
|
|
3393
3430
|
);
|
|
3394
3431
|
const [page, setPage] = (0, import_react24.useState)(paginationModel?.page || 1);
|
|
@@ -3398,7 +3435,8 @@ function useDataTableRenderer({
|
|
|
3398
3435
|
[_getId, page, pageSize]
|
|
3399
3436
|
);
|
|
3400
3437
|
const selectedModelSet = (0, import_react24.useMemo)(
|
|
3401
|
-
|
|
3438
|
+
// NOTE: default value를 props destructuring에서 할당하면 렌더링 시점에 초기화가 되어버린다.
|
|
3439
|
+
() => new Set(selectionModel || []),
|
|
3402
3440
|
[selectionModel]
|
|
3403
3441
|
);
|
|
3404
3442
|
const dataInPage = (0, import_react24.useMemo)(
|
|
@@ -3411,7 +3449,7 @@ function useDataTableRenderer({
|
|
|
3411
3449
|
);
|
|
3412
3450
|
const rowCount = totalRowsProp || rows.length;
|
|
3413
3451
|
const isTotalSelected = (0, import_react24.useMemo)(
|
|
3414
|
-
() => _isTotalSelected ?? (rowCount > 0 && selectionModel
|
|
3452
|
+
() => _isTotalSelected ?? (rowCount > 0 && (selectionModel?.length || 0) === rowCount),
|
|
3415
3453
|
[_isTotalSelected, selectionModel, rowCount]
|
|
3416
3454
|
);
|
|
3417
3455
|
const columns = (0, import_react24.useMemo)(() => {
|
|
@@ -3535,12 +3573,12 @@ function useDataTableRenderer({
|
|
|
3535
3573
|
onCheckboxChange: (0, import_react24.useCallback)(
|
|
3536
3574
|
(event, selectedModel) => {
|
|
3537
3575
|
if (selectedModelSet.has(selectedModel)) {
|
|
3538
|
-
const newSelectionModel = selectionModel.filter(
|
|
3576
|
+
const newSelectionModel = (selectionModel || []).filter(
|
|
3539
3577
|
(model) => model !== selectedModel
|
|
3540
3578
|
);
|
|
3541
3579
|
onSelectionModelChange?.(newSelectionModel);
|
|
3542
3580
|
} else {
|
|
3543
|
-
const newSelectionModel = [...selectionModel, selectedModel];
|
|
3581
|
+
const newSelectionModel = [...selectionModel || [], selectedModel];
|
|
3544
3582
|
onSelectionModelChange?.(newSelectionModel);
|
|
3545
3583
|
}
|
|
3546
3584
|
},
|
|
@@ -3628,7 +3666,7 @@ function Component(props, apiRef) {
|
|
|
3628
3666
|
getScrollElement: () => parentRef.current,
|
|
3629
3667
|
estimateSize: () => 32,
|
|
3630
3668
|
measureElement: (element) => element.clientHeight,
|
|
3631
|
-
overscan:
|
|
3669
|
+
overscan: 5
|
|
3632
3670
|
});
|
|
3633
3671
|
const paginationModel = (0, import_react24.useMemo)(() => ({ page, pageSize }), [page, pageSize]);
|
|
3634
3672
|
const totalSize = virtualizer.getTotalSize();
|
package/dist/index.js
CHANGED
|
@@ -1968,7 +1968,8 @@ import React22, {
|
|
|
1968
1968
|
useId,
|
|
1969
1969
|
forwardRef as forwardRef7,
|
|
1970
1970
|
useImperativeHandle as useImperativeHandle2,
|
|
1971
|
-
createElement
|
|
1971
|
+
createElement,
|
|
1972
|
+
memo
|
|
1972
1973
|
} from "react";
|
|
1973
1974
|
import { useVirtualizer as useVirtualizer2 } from "@tanstack/react-virtual";
|
|
1974
1975
|
import { styled as styled11, LinearProgress, Link, useTheme } from "@mui/joy";
|
|
@@ -2957,51 +2958,73 @@ var HeadCell = (props) => {
|
|
|
2957
2958
|
() => `${tableId}_header_${headerName ?? field}`.trim(),
|
|
2958
2959
|
[tableId, headerName, field]
|
|
2959
2960
|
);
|
|
2960
|
-
const resizer =
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2961
|
+
const resizer = useMemo8(
|
|
2962
|
+
() => resizable ?? true ? Resizer(ref) : null,
|
|
2963
|
+
[resizable, ref]
|
|
2964
|
+
);
|
|
2965
|
+
const style = useMemo8(
|
|
2966
|
+
() => ({
|
|
2967
|
+
width,
|
|
2968
|
+
minWidth: minWidth ?? "50px",
|
|
2969
|
+
maxWidth,
|
|
2970
|
+
position: isPinned ? "sticky" : stickyHeader ? void 0 : "relative",
|
|
2971
|
+
// 조건식 더 복잡해지면 IIFE로 정리
|
|
2972
|
+
left: isPinned ? pinnedStartPosition : void 0,
|
|
2973
|
+
right: isPinned ? pinnedEndPosition : void 0,
|
|
2974
|
+
zIndex: isPinned ? `calc(${theme.getCssVar("zIndex-table")} + 2)` : void 0,
|
|
2975
|
+
cursor: sortable ? "pointer" : "default",
|
|
2976
|
+
// TODO: multi-sort때문에 일단 추가한 property, joy-ui에서는 multi-sort시 th에 user-select: none을 적용하고 툴팁을 띄워준다.
|
|
2977
|
+
userSelect: "none"
|
|
2978
|
+
}),
|
|
2979
|
+
[
|
|
2980
|
+
isPinned,
|
|
2981
|
+
maxWidth,
|
|
2982
|
+
minWidth,
|
|
2983
|
+
pinnedEndPosition,
|
|
2984
|
+
pinnedStartPosition,
|
|
2985
|
+
sortable,
|
|
2986
|
+
stickyHeader,
|
|
2987
|
+
theme,
|
|
2988
|
+
width
|
|
2989
|
+
]
|
|
2990
|
+
);
|
|
2974
2991
|
const textAlign = getTextAlign(props);
|
|
2975
2992
|
const initialSort = sortOrder[0];
|
|
2976
|
-
const sortIcon =
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
2993
|
+
const sortIcon = useMemo8(
|
|
2994
|
+
() => sortable && /* @__PURE__ */ React22.createElement(
|
|
2995
|
+
MotionSortIcon,
|
|
2996
|
+
{
|
|
2997
|
+
style: {
|
|
2998
|
+
width: "16px",
|
|
2999
|
+
height: "16px"
|
|
3000
|
+
},
|
|
3001
|
+
role: "img",
|
|
3002
|
+
"aria-labelledby": headId,
|
|
3003
|
+
"aria-description": (sort ?? initialSort) === "desc" ? "descending" : "ascending",
|
|
3004
|
+
"data-testid": void 0,
|
|
3005
|
+
variants: {
|
|
3006
|
+
hover: { opacity: 1 },
|
|
3007
|
+
initial: { opacity: 0 }
|
|
3008
|
+
},
|
|
3009
|
+
animate: {
|
|
3010
|
+
color: !!sort ? "var(--ceed-palette-text-secondary)" : "var(--ceed-palette-primary-solidDisabledColor)",
|
|
3011
|
+
rotate: (sort ?? initialSort) === "desc" ? 180 : 0,
|
|
3012
|
+
opacity: !!sort ? 1 : 0
|
|
3013
|
+
},
|
|
3014
|
+
transition: {
|
|
3015
|
+
duration: 0,
|
|
3016
|
+
rotate: { duration: 0.2, ease: "easeOut" },
|
|
3017
|
+
color: { duration: 0.2, ease: "easeInOut" },
|
|
3018
|
+
opacity: { duration: 0.2, ease: "easeInOut" }
|
|
3019
|
+
}
|
|
3001
3020
|
}
|
|
3002
|
-
|
|
3021
|
+
),
|
|
3022
|
+
[headId, initialSort, sort, sortable]
|
|
3023
|
+
);
|
|
3024
|
+
const infoSign = useMemo8(
|
|
3025
|
+
() => description ? /* @__PURE__ */ React22.createElement(InfoSign_default, { message: description, placement: "bottom" }) : null,
|
|
3026
|
+
[description]
|
|
3003
3027
|
);
|
|
3004
|
-
const infoSign = description ? /* @__PURE__ */ React22.createElement(InfoSign_default, { message: description, placement: "bottom" }) : null;
|
|
3005
3028
|
return /* @__PURE__ */ React22.createElement(
|
|
3006
3029
|
StyledTh,
|
|
3007
3030
|
{
|
|
@@ -3011,7 +3034,10 @@ var HeadCell = (props) => {
|
|
|
3011
3034
|
ref,
|
|
3012
3035
|
key: field,
|
|
3013
3036
|
style,
|
|
3014
|
-
onClick: (
|
|
3037
|
+
onClick: useCallback9(
|
|
3038
|
+
(e) => sortable && onSortChange?.({ field, currentSort: sort, multiple: e.shiftKey }),
|
|
3039
|
+
[field, onSortChange, sort, sortable]
|
|
3040
|
+
),
|
|
3015
3041
|
whileHover: "hover",
|
|
3016
3042
|
initial: "initial"
|
|
3017
3043
|
},
|
|
@@ -3069,7 +3095,7 @@ var BodyCell = (props) => {
|
|
|
3069
3095
|
...typeof props.componentProps === "function" ? props.componentProps(params) : props.componentProps || {},
|
|
3070
3096
|
size: "sm"
|
|
3071
3097
|
}),
|
|
3072
|
-
[props, params]
|
|
3098
|
+
[props.componentProps, params]
|
|
3073
3099
|
);
|
|
3074
3100
|
const editModeComponentProps = useMemo8(
|
|
3075
3101
|
() => ({
|
|
@@ -3131,11 +3157,20 @@ var BodyCell = (props) => {
|
|
|
3131
3157
|
}
|
|
3132
3158
|
}
|
|
3133
3159
|
}),
|
|
3134
|
-
[
|
|
3160
|
+
[
|
|
3161
|
+
params,
|
|
3162
|
+
row,
|
|
3163
|
+
field,
|
|
3164
|
+
value,
|
|
3165
|
+
componentProps,
|
|
3166
|
+
type,
|
|
3167
|
+
props.onCellEditStop,
|
|
3168
|
+
props.onCellEditStart
|
|
3169
|
+
]
|
|
3135
3170
|
);
|
|
3136
3171
|
const EditModeComponent = useMemo8(() => {
|
|
3137
3172
|
if (renderEditCell) {
|
|
3138
|
-
return createElement(renderEditCell, params);
|
|
3173
|
+
return createElement(memo(renderEditCell), params);
|
|
3139
3174
|
}
|
|
3140
3175
|
return {
|
|
3141
3176
|
date: /* @__PURE__ */ React22.createElement(
|
|
@@ -3195,7 +3230,7 @@ var BodyCell = (props) => {
|
|
|
3195
3230
|
}, [value, editModeComponentProps, type]);
|
|
3196
3231
|
const ReadModeComponent = useMemo8(() => {
|
|
3197
3232
|
if (renderCell) {
|
|
3198
|
-
return createElement(renderCell, params);
|
|
3233
|
+
return createElement(memo(renderCell), params);
|
|
3199
3234
|
}
|
|
3200
3235
|
const innerText = value;
|
|
3201
3236
|
const typedComponent = {
|
|
@@ -3208,14 +3243,14 @@ var BodyCell = (props) => {
|
|
|
3208
3243
|
)
|
|
3209
3244
|
}[type || "text"];
|
|
3210
3245
|
return typedComponent || innerText;
|
|
3211
|
-
}, [value, renderCell, params, type, componentProps
|
|
3246
|
+
}, [value, renderCell, params, type, componentProps]);
|
|
3212
3247
|
const CellComponent = useMemo8(
|
|
3213
3248
|
() => editMode && EditModeComponent ? EditModeComponent : ReadModeComponent,
|
|
3214
3249
|
[editMode, EditModeComponent, ReadModeComponent]
|
|
3215
3250
|
);
|
|
3216
3251
|
const showTooltip = useMemo8(
|
|
3217
|
-
() => noWrap &&
|
|
3218
|
-
[noWrap,
|
|
3252
|
+
() => noWrap && type === "longText",
|
|
3253
|
+
[noWrap, type]
|
|
3219
3254
|
);
|
|
3220
3255
|
useEffect5(() => {
|
|
3221
3256
|
setValue(row[field]);
|
|
@@ -3226,38 +3261,40 @@ var BodyCell = (props) => {
|
|
|
3226
3261
|
ref: cellRef,
|
|
3227
3262
|
key: field,
|
|
3228
3263
|
headers: `${tableId}_header_${props.headerName ?? field}`,
|
|
3229
|
-
|
|
3264
|
+
sx: {
|
|
3230
3265
|
textAlign: getTextAlign({ type }),
|
|
3231
3266
|
verticalAlign: editMode ? "top" : "middle",
|
|
3232
3267
|
position: isPinned ? "sticky" : void 0,
|
|
3233
3268
|
left: isPinned ? pinnedStartPosition : void 0,
|
|
3234
3269
|
right: isPinned ? pinnedEndPosition : void 0,
|
|
3235
3270
|
zIndex: isPinned ? `calc(${theme.getCssVar("zIndex-table")} + 2)` : void 0,
|
|
3236
|
-
// @ts-expect-error: react CSSProperties에는 --var를 지원하지 않는다.
|
|
3237
3271
|
"--TableCell-dataBackground": isPinned ? `var(--TableCell-headBackground)` : void 0
|
|
3238
3272
|
},
|
|
3239
3273
|
className: isLastStartPinnedColumn && "is-last-left" || isLastEndPinnedColumn && "is-last-right" || ""
|
|
3240
3274
|
},
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
title: value,
|
|
3245
|
-
placement: "bottom",
|
|
3246
|
-
style: { maxWidth: "100%" },
|
|
3247
|
-
enterDelay: 1500,
|
|
3248
|
-
enterNextDelay: 1500
|
|
3249
|
-
},
|
|
3250
|
-
/* @__PURE__ */ React22.createElement(
|
|
3251
|
-
"div",
|
|
3275
|
+
useMemo8(
|
|
3276
|
+
() => showTooltip ? /* @__PURE__ */ React22.createElement(
|
|
3277
|
+
Tooltip_default,
|
|
3252
3278
|
{
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3279
|
+
title: value,
|
|
3280
|
+
placement: "bottom",
|
|
3281
|
+
style: { maxWidth: "100%" },
|
|
3282
|
+
enterDelay: 1500,
|
|
3283
|
+
enterNextDelay: 1500
|
|
3257
3284
|
},
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3285
|
+
/* @__PURE__ */ React22.createElement(
|
|
3286
|
+
"div",
|
|
3287
|
+
{
|
|
3288
|
+
style: {
|
|
3289
|
+
overflow: "hidden",
|
|
3290
|
+
textOverflow: "ellipsis"
|
|
3291
|
+
}
|
|
3292
|
+
},
|
|
3293
|
+
CellComponent
|
|
3294
|
+
)
|
|
3295
|
+
) : CellComponent,
|
|
3296
|
+
[CellComponent, showTooltip, value]
|
|
3297
|
+
)
|
|
3261
3298
|
);
|
|
3262
3299
|
};
|
|
3263
3300
|
var BodyRow = (props) => {
|
|
@@ -3286,8 +3323,8 @@ function useDataTableRenderer({
|
|
|
3286
3323
|
paginationModel,
|
|
3287
3324
|
onPaginationModelChange,
|
|
3288
3325
|
sortModel: controlledSortModel,
|
|
3289
|
-
sortOrder: _sortOrder
|
|
3290
|
-
selectionModel
|
|
3326
|
+
sortOrder: _sortOrder,
|
|
3327
|
+
selectionModel,
|
|
3291
3328
|
onSortModelChange,
|
|
3292
3329
|
onSelectionModelChange,
|
|
3293
3330
|
editMode,
|
|
@@ -3349,7 +3386,8 @@ function useDataTableRenderer({
|
|
|
3349
3386
|
[_rows, sortModel, sortComparator]
|
|
3350
3387
|
);
|
|
3351
3388
|
const sortOrder = useMemo8(
|
|
3352
|
-
|
|
3389
|
+
// NOTE: default value를 props destructuring에서 할당하면 렌더링 시점에 초기화가 되어버린다.
|
|
3390
|
+
() => Array.from(new Set(_sortOrder || ["asc", "desc", null])),
|
|
3353
3391
|
[_sortOrder]
|
|
3354
3392
|
);
|
|
3355
3393
|
const [page, setPage] = useState6(paginationModel?.page || 1);
|
|
@@ -3359,7 +3397,8 @@ function useDataTableRenderer({
|
|
|
3359
3397
|
[_getId, page, pageSize]
|
|
3360
3398
|
);
|
|
3361
3399
|
const selectedModelSet = useMemo8(
|
|
3362
|
-
|
|
3400
|
+
// NOTE: default value를 props destructuring에서 할당하면 렌더링 시점에 초기화가 되어버린다.
|
|
3401
|
+
() => new Set(selectionModel || []),
|
|
3363
3402
|
[selectionModel]
|
|
3364
3403
|
);
|
|
3365
3404
|
const dataInPage = useMemo8(
|
|
@@ -3372,7 +3411,7 @@ function useDataTableRenderer({
|
|
|
3372
3411
|
);
|
|
3373
3412
|
const rowCount = totalRowsProp || rows.length;
|
|
3374
3413
|
const isTotalSelected = useMemo8(
|
|
3375
|
-
() => _isTotalSelected ?? (rowCount > 0 && selectionModel
|
|
3414
|
+
() => _isTotalSelected ?? (rowCount > 0 && (selectionModel?.length || 0) === rowCount),
|
|
3376
3415
|
[_isTotalSelected, selectionModel, rowCount]
|
|
3377
3416
|
);
|
|
3378
3417
|
const columns = useMemo8(() => {
|
|
@@ -3496,12 +3535,12 @@ function useDataTableRenderer({
|
|
|
3496
3535
|
onCheckboxChange: useCallback9(
|
|
3497
3536
|
(event, selectedModel) => {
|
|
3498
3537
|
if (selectedModelSet.has(selectedModel)) {
|
|
3499
|
-
const newSelectionModel = selectionModel.filter(
|
|
3538
|
+
const newSelectionModel = (selectionModel || []).filter(
|
|
3500
3539
|
(model) => model !== selectedModel
|
|
3501
3540
|
);
|
|
3502
3541
|
onSelectionModelChange?.(newSelectionModel);
|
|
3503
3542
|
} else {
|
|
3504
|
-
const newSelectionModel = [...selectionModel, selectedModel];
|
|
3543
|
+
const newSelectionModel = [...selectionModel || [], selectedModel];
|
|
3505
3544
|
onSelectionModelChange?.(newSelectionModel);
|
|
3506
3545
|
}
|
|
3507
3546
|
},
|
|
@@ -3589,7 +3628,7 @@ function Component(props, apiRef) {
|
|
|
3589
3628
|
getScrollElement: () => parentRef.current,
|
|
3590
3629
|
estimateSize: () => 32,
|
|
3591
3630
|
measureElement: (element) => element.clientHeight,
|
|
3592
|
-
overscan:
|
|
3631
|
+
overscan: 5
|
|
3593
3632
|
});
|
|
3594
3633
|
const paginationModel = useMemo8(() => ({ page, pageSize }), [page, pageSize]);
|
|
3595
3634
|
const totalSize = virtualizer.getTotalSize();
|