@ceed/cds 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 +27 -27
- package/package.json +16 -13
|
@@ -10,6 +10,7 @@ export { Checkbox } from "./Checkbox";
|
|
|
10
10
|
export { Container } from "./Container";
|
|
11
11
|
export { CurrencyInput } from "./CurrencyInput";
|
|
12
12
|
export { DataTable } from "./DataTable";
|
|
13
|
+
export type * from "./DataTable/types";
|
|
13
14
|
export { DatePicker } from "./DatePicker";
|
|
14
15
|
export { DateRangePicker } from "./DateRangePicker";
|
|
15
16
|
export { Drawer } from "./Drawer";
|
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 renderEditCell
|
|
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 renderCell
|
|
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
|
@@ -1967,7 +1967,9 @@ import React22, {
|
|
|
1967
1967
|
useState as useState6,
|
|
1968
1968
|
useId,
|
|
1969
1969
|
forwardRef as forwardRef7,
|
|
1970
|
-
useImperativeHandle as useImperativeHandle2
|
|
1970
|
+
useImperativeHandle as useImperativeHandle2,
|
|
1971
|
+
createElement,
|
|
1972
|
+
memo
|
|
1971
1973
|
} from "react";
|
|
1972
1974
|
import { useVirtualizer as useVirtualizer2 } from "@tanstack/react-virtual";
|
|
1973
1975
|
import { styled as styled11, LinearProgress, Link, useTheme } from "@mui/joy";
|
|
@@ -2956,51 +2958,73 @@ var HeadCell = (props) => {
|
|
|
2956
2958
|
() => `${tableId}_header_${headerName ?? field}`.trim(),
|
|
2957
2959
|
[tableId, headerName, field]
|
|
2958
2960
|
);
|
|
2959
|
-
const resizer =
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
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
|
+
);
|
|
2973
2991
|
const textAlign = getTextAlign(props);
|
|
2974
2992
|
const initialSort = sortOrder[0];
|
|
2975
|
-
const sortIcon =
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
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
|
+
}
|
|
3000
3020
|
}
|
|
3001
|
-
|
|
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]
|
|
3002
3027
|
);
|
|
3003
|
-
const infoSign = description ? /* @__PURE__ */ React22.createElement(InfoSign_default, { message: description, placement: "bottom" }) : null;
|
|
3004
3028
|
return /* @__PURE__ */ React22.createElement(
|
|
3005
3029
|
StyledTh,
|
|
3006
3030
|
{
|
|
@@ -3010,7 +3034,10 @@ var HeadCell = (props) => {
|
|
|
3010
3034
|
ref,
|
|
3011
3035
|
key: field,
|
|
3012
3036
|
style,
|
|
3013
|
-
onClick: (
|
|
3037
|
+
onClick: useCallback9(
|
|
3038
|
+
(e) => sortable && onSortChange?.({ field, currentSort: sort, multiple: e.shiftKey }),
|
|
3039
|
+
[field, onSortChange, sort, sortable]
|
|
3040
|
+
),
|
|
3014
3041
|
whileHover: "hover",
|
|
3015
3042
|
initial: "initial"
|
|
3016
3043
|
},
|
|
@@ -3068,7 +3095,7 @@ var BodyCell = (props) => {
|
|
|
3068
3095
|
...typeof props.componentProps === "function" ? props.componentProps(params) : props.componentProps || {},
|
|
3069
3096
|
size: "sm"
|
|
3070
3097
|
}),
|
|
3071
|
-
[props, params]
|
|
3098
|
+
[props.componentProps, params]
|
|
3072
3099
|
);
|
|
3073
3100
|
const editModeComponentProps = useMemo8(
|
|
3074
3101
|
() => ({
|
|
@@ -3130,11 +3157,20 @@ var BodyCell = (props) => {
|
|
|
3130
3157
|
}
|
|
3131
3158
|
}
|
|
3132
3159
|
}),
|
|
3133
|
-
[
|
|
3160
|
+
[
|
|
3161
|
+
params,
|
|
3162
|
+
row,
|
|
3163
|
+
field,
|
|
3164
|
+
value,
|
|
3165
|
+
componentProps,
|
|
3166
|
+
type,
|
|
3167
|
+
props.onCellEditStop,
|
|
3168
|
+
props.onCellEditStart
|
|
3169
|
+
]
|
|
3134
3170
|
);
|
|
3135
3171
|
const EditModeComponent = useMemo8(() => {
|
|
3136
3172
|
if (renderEditCell) {
|
|
3137
|
-
return renderEditCell
|
|
3173
|
+
return createElement(memo(renderEditCell), params);
|
|
3138
3174
|
}
|
|
3139
3175
|
return {
|
|
3140
3176
|
date: /* @__PURE__ */ React22.createElement(
|
|
@@ -3194,7 +3230,7 @@ var BodyCell = (props) => {
|
|
|
3194
3230
|
}, [value, editModeComponentProps, type]);
|
|
3195
3231
|
const ReadModeComponent = useMemo8(() => {
|
|
3196
3232
|
if (renderCell) {
|
|
3197
|
-
return renderCell
|
|
3233
|
+
return createElement(memo(renderCell), params);
|
|
3198
3234
|
}
|
|
3199
3235
|
const innerText = value;
|
|
3200
3236
|
const typedComponent = {
|
|
@@ -3207,14 +3243,14 @@ var BodyCell = (props) => {
|
|
|
3207
3243
|
)
|
|
3208
3244
|
}[type || "text"];
|
|
3209
3245
|
return typedComponent || innerText;
|
|
3210
|
-
}, [value, renderCell, params, type, componentProps
|
|
3246
|
+
}, [value, renderCell, params, type, componentProps]);
|
|
3211
3247
|
const CellComponent = useMemo8(
|
|
3212
3248
|
() => editMode && EditModeComponent ? EditModeComponent : ReadModeComponent,
|
|
3213
3249
|
[editMode, EditModeComponent, ReadModeComponent]
|
|
3214
3250
|
);
|
|
3215
3251
|
const showTooltip = useMemo8(
|
|
3216
|
-
() => noWrap &&
|
|
3217
|
-
[noWrap,
|
|
3252
|
+
() => noWrap && type === "longText",
|
|
3253
|
+
[noWrap, type]
|
|
3218
3254
|
);
|
|
3219
3255
|
useEffect5(() => {
|
|
3220
3256
|
setValue(row[field]);
|
|
@@ -3225,38 +3261,40 @@ var BodyCell = (props) => {
|
|
|
3225
3261
|
ref: cellRef,
|
|
3226
3262
|
key: field,
|
|
3227
3263
|
headers: `${tableId}_header_${props.headerName ?? field}`,
|
|
3228
|
-
|
|
3264
|
+
sx: {
|
|
3229
3265
|
textAlign: getTextAlign({ type }),
|
|
3230
3266
|
verticalAlign: editMode ? "top" : "middle",
|
|
3231
3267
|
position: isPinned ? "sticky" : void 0,
|
|
3232
3268
|
left: isPinned ? pinnedStartPosition : void 0,
|
|
3233
3269
|
right: isPinned ? pinnedEndPosition : void 0,
|
|
3234
3270
|
zIndex: isPinned ? `calc(${theme.getCssVar("zIndex-table")} + 2)` : void 0,
|
|
3235
|
-
// @ts-expect-error: react CSSProperties에는 --var를 지원하지 않는다.
|
|
3236
3271
|
"--TableCell-dataBackground": isPinned ? `var(--TableCell-headBackground)` : void 0
|
|
3237
3272
|
},
|
|
3238
3273
|
className: isLastStartPinnedColumn && "is-last-left" || isLastEndPinnedColumn && "is-last-right" || ""
|
|
3239
3274
|
},
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
title: value,
|
|
3244
|
-
placement: "bottom",
|
|
3245
|
-
style: { maxWidth: "100%" },
|
|
3246
|
-
enterDelay: 1500,
|
|
3247
|
-
enterNextDelay: 1500
|
|
3248
|
-
},
|
|
3249
|
-
/* @__PURE__ */ React22.createElement(
|
|
3250
|
-
"div",
|
|
3275
|
+
useMemo8(
|
|
3276
|
+
() => showTooltip ? /* @__PURE__ */ React22.createElement(
|
|
3277
|
+
Tooltip_default,
|
|
3251
3278
|
{
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3279
|
+
title: value,
|
|
3280
|
+
placement: "bottom",
|
|
3281
|
+
style: { maxWidth: "100%" },
|
|
3282
|
+
enterDelay: 1500,
|
|
3283
|
+
enterNextDelay: 1500
|
|
3256
3284
|
},
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
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
|
+
)
|
|
3260
3298
|
);
|
|
3261
3299
|
};
|
|
3262
3300
|
var BodyRow = (props) => {
|
|
@@ -3285,8 +3323,8 @@ function useDataTableRenderer({
|
|
|
3285
3323
|
paginationModel,
|
|
3286
3324
|
onPaginationModelChange,
|
|
3287
3325
|
sortModel: controlledSortModel,
|
|
3288
|
-
sortOrder: _sortOrder
|
|
3289
|
-
selectionModel
|
|
3326
|
+
sortOrder: _sortOrder,
|
|
3327
|
+
selectionModel,
|
|
3290
3328
|
onSortModelChange,
|
|
3291
3329
|
onSelectionModelChange,
|
|
3292
3330
|
editMode,
|
|
@@ -3348,7 +3386,8 @@ function useDataTableRenderer({
|
|
|
3348
3386
|
[_rows, sortModel, sortComparator]
|
|
3349
3387
|
);
|
|
3350
3388
|
const sortOrder = useMemo8(
|
|
3351
|
-
|
|
3389
|
+
// NOTE: default value를 props destructuring에서 할당하면 렌더링 시점에 초기화가 되어버린다.
|
|
3390
|
+
() => Array.from(new Set(_sortOrder || ["asc", "desc", null])),
|
|
3352
3391
|
[_sortOrder]
|
|
3353
3392
|
);
|
|
3354
3393
|
const [page, setPage] = useState6(paginationModel?.page || 1);
|
|
@@ -3358,7 +3397,8 @@ function useDataTableRenderer({
|
|
|
3358
3397
|
[_getId, page, pageSize]
|
|
3359
3398
|
);
|
|
3360
3399
|
const selectedModelSet = useMemo8(
|
|
3361
|
-
|
|
3400
|
+
// NOTE: default value를 props destructuring에서 할당하면 렌더링 시점에 초기화가 되어버린다.
|
|
3401
|
+
() => new Set(selectionModel || []),
|
|
3362
3402
|
[selectionModel]
|
|
3363
3403
|
);
|
|
3364
3404
|
const dataInPage = useMemo8(
|
|
@@ -3371,7 +3411,7 @@ function useDataTableRenderer({
|
|
|
3371
3411
|
);
|
|
3372
3412
|
const rowCount = totalRowsProp || rows.length;
|
|
3373
3413
|
const isTotalSelected = useMemo8(
|
|
3374
|
-
() => _isTotalSelected ?? (rowCount > 0 && selectionModel
|
|
3414
|
+
() => _isTotalSelected ?? (rowCount > 0 && (selectionModel?.length || 0) === rowCount),
|
|
3375
3415
|
[_isTotalSelected, selectionModel, rowCount]
|
|
3376
3416
|
);
|
|
3377
3417
|
const columns = useMemo8(() => {
|
|
@@ -3495,12 +3535,12 @@ function useDataTableRenderer({
|
|
|
3495
3535
|
onCheckboxChange: useCallback9(
|
|
3496
3536
|
(event, selectedModel) => {
|
|
3497
3537
|
if (selectedModelSet.has(selectedModel)) {
|
|
3498
|
-
const newSelectionModel = selectionModel.filter(
|
|
3538
|
+
const newSelectionModel = (selectionModel || []).filter(
|
|
3499
3539
|
(model) => model !== selectedModel
|
|
3500
3540
|
);
|
|
3501
3541
|
onSelectionModelChange?.(newSelectionModel);
|
|
3502
3542
|
} else {
|
|
3503
|
-
const newSelectionModel = [...selectionModel, selectedModel];
|
|
3543
|
+
const newSelectionModel = [...selectionModel || [], selectedModel];
|
|
3504
3544
|
onSelectionModelChange?.(newSelectionModel);
|
|
3505
3545
|
}
|
|
3506
3546
|
},
|
|
@@ -3588,7 +3628,7 @@ function Component(props, apiRef) {
|
|
|
3588
3628
|
getScrollElement: () => parentRef.current,
|
|
3589
3629
|
estimateSize: () => 32,
|
|
3590
3630
|
measureElement: (element) => element.clientHeight,
|
|
3591
|
-
overscan:
|
|
3631
|
+
overscan: 5
|
|
3592
3632
|
});
|
|
3593
3633
|
const paginationModel = useMemo8(() => ({ page, pageSize }), [page, pageSize]);
|
|
3594
3634
|
const totalSize = virtualizer.getTotalSize();
|