@ceed/ads 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 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 = resizable ?? true ? Resizer(ref) : null;
3033
- const style = {
3034
- width,
3035
- minWidth: minWidth ?? "50px",
3036
- maxWidth,
3037
- position: isPinned ? "sticky" : stickyHeader ? void 0 : "relative",
3038
- // 조건식 더 복잡해지면 IIFE로 정리
3039
- left: isPinned ? pinnedStartPosition : void 0,
3040
- right: isPinned ? pinnedEndPosition : void 0,
3041
- zIndex: isPinned ? `calc(${theme.getCssVar("zIndex-table")} + 2)` : void 0,
3042
- cursor: sortable ? "pointer" : "default",
3043
- // TODO: multi-sort때문에 일단 추가한 property, joy-ui에서는 multi-sort시 th에 user-select: none을 적용하고 툴팁을 띄워준다.
3044
- userSelect: "none"
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 = sortable && /* @__PURE__ */ import_react25.default.createElement(
3049
- MotionSortIcon,
3050
- {
3051
- style: {
3052
- width: "16px",
3053
- height: "16px"
3054
- },
3055
- role: "img",
3056
- "aria-labelledby": headId,
3057
- "aria-description": (sort ?? initialSort) === "desc" ? "descending" : "ascending",
3058
- "data-testid": void 0,
3059
- variants: {
3060
- hover: { opacity: 1 },
3061
- initial: { opacity: 0 }
3062
- },
3063
- animate: {
3064
- color: !!sort ? "var(--ceed-palette-text-secondary)" : "var(--ceed-palette-primary-solidDisabledColor)",
3065
- rotate: (sort ?? initialSort) === "desc" ? 180 : 0,
3066
- opacity: !!sort ? 1 : 0
3067
- },
3068
- transition: {
3069
- duration: 0,
3070
- rotate: { duration: 0.2, ease: "easeOut" },
3071
- color: { duration: 0.2, ease: "easeInOut" },
3072
- opacity: { duration: 0.2, ease: "easeInOut" }
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: (e) => sortable && onSortChange?.({ field, currentSort: sort, multiple: e.shiftKey }),
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
- [params, row, field, value, componentProps, type, props]
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 (0, import_react25.createElement)(renderEditCell, params);
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 (0, import_react25.createElement)(renderCell, params);
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, props]);
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 && props.type === "longText",
3290
- [noWrap, props.type]
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
- style: {
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
- showTooltip ? /* @__PURE__ */ import_react25.default.createElement(
3314
- Tooltip_default,
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
- style: {
3326
- overflow: "hidden",
3327
- textOverflow: "ellipsis"
3328
- }
3350
+ title: value,
3351
+ placement: "bottom",
3352
+ style: { maxWidth: "100%" },
3353
+ enterDelay: 1500,
3354
+ enterNextDelay: 1500
3329
3355
  },
3330
- CellComponent
3331
- )
3332
- ) : CellComponent
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 = ["asc", "desc", null],
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
- () => Array.from(new Set(_sortOrder)),
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
- () => new Set(selectionModel),
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.length === rowCount),
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: 20
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
@@ -1989,7 +1989,8 @@ import React23, {
1989
1989
  useId,
1990
1990
  forwardRef as forwardRef7,
1991
1991
  useImperativeHandle as useImperativeHandle2,
1992
- createElement
1992
+ createElement,
1993
+ memo
1993
1994
  } from "react";
1994
1995
  import { useVirtualizer as useVirtualizer2 } from "@tanstack/react-virtual";
1995
1996
  import { styled as styled12, LinearProgress, Link, useTheme } from "@mui/joy";
@@ -2978,51 +2979,73 @@ var HeadCell = (props) => {
2978
2979
  () => `${tableId}_header_${headerName ?? field}`.trim(),
2979
2980
  [tableId, headerName, field]
2980
2981
  );
2981
- const resizer = resizable ?? true ? Resizer(ref) : null;
2982
- const style = {
2983
- width,
2984
- minWidth: minWidth ?? "50px",
2985
- maxWidth,
2986
- position: isPinned ? "sticky" : stickyHeader ? void 0 : "relative",
2987
- // 조건식 더 복잡해지면 IIFE로 정리
2988
- left: isPinned ? pinnedStartPosition : void 0,
2989
- right: isPinned ? pinnedEndPosition : void 0,
2990
- zIndex: isPinned ? `calc(${theme.getCssVar("zIndex-table")} + 2)` : void 0,
2991
- cursor: sortable ? "pointer" : "default",
2992
- // TODO: multi-sort때문에 일단 추가한 property, joy-ui에서는 multi-sort시 th에 user-select: none을 적용하고 툴팁을 띄워준다.
2993
- userSelect: "none"
2994
- };
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
+ );
2995
3012
  const textAlign = getTextAlign(props);
2996
3013
  const initialSort = sortOrder[0];
2997
- const sortIcon = sortable && /* @__PURE__ */ React23.createElement(
2998
- MotionSortIcon,
2999
- {
3000
- style: {
3001
- width: "16px",
3002
- height: "16px"
3003
- },
3004
- role: "img",
3005
- "aria-labelledby": headId,
3006
- "aria-description": (sort ?? initialSort) === "desc" ? "descending" : "ascending",
3007
- "data-testid": void 0,
3008
- variants: {
3009
- hover: { opacity: 1 },
3010
- initial: { opacity: 0 }
3011
- },
3012
- animate: {
3013
- color: !!sort ? "var(--ceed-palette-text-secondary)" : "var(--ceed-palette-primary-solidDisabledColor)",
3014
- rotate: (sort ?? initialSort) === "desc" ? 180 : 0,
3015
- opacity: !!sort ? 1 : 0
3016
- },
3017
- transition: {
3018
- duration: 0,
3019
- rotate: { duration: 0.2, ease: "easeOut" },
3020
- color: { duration: 0.2, ease: "easeInOut" },
3021
- opacity: { duration: 0.2, ease: "easeInOut" }
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
+ }
3022
3041
  }
3023
- }
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]
3024
3048
  );
3025
- const infoSign = description ? /* @__PURE__ */ React23.createElement(InfoSign_default, { message: description, placement: "bottom" }) : null;
3026
3049
  return /* @__PURE__ */ React23.createElement(
3027
3050
  StyledTh,
3028
3051
  {
@@ -3032,7 +3055,10 @@ var HeadCell = (props) => {
3032
3055
  ref,
3033
3056
  key: field,
3034
3057
  style,
3035
- onClick: (e) => sortable && onSortChange?.({ field, currentSort: sort, multiple: e.shiftKey }),
3058
+ onClick: useCallback9(
3059
+ (e) => sortable && onSortChange?.({ field, currentSort: sort, multiple: e.shiftKey }),
3060
+ [field, onSortChange, sort, sortable]
3061
+ ),
3036
3062
  whileHover: "hover",
3037
3063
  initial: "initial"
3038
3064
  },
@@ -3090,7 +3116,7 @@ var BodyCell = (props) => {
3090
3116
  ...typeof props.componentProps === "function" ? props.componentProps(params) : props.componentProps || {},
3091
3117
  size: "sm"
3092
3118
  }),
3093
- [props, params]
3119
+ [props.componentProps, params]
3094
3120
  );
3095
3121
  const editModeComponentProps = useMemo8(
3096
3122
  () => ({
@@ -3152,11 +3178,20 @@ var BodyCell = (props) => {
3152
3178
  }
3153
3179
  }
3154
3180
  }),
3155
- [params, row, field, value, componentProps, type, props]
3181
+ [
3182
+ params,
3183
+ row,
3184
+ field,
3185
+ value,
3186
+ componentProps,
3187
+ type,
3188
+ props.onCellEditStop,
3189
+ props.onCellEditStart
3190
+ ]
3156
3191
  );
3157
3192
  const EditModeComponent = useMemo8(() => {
3158
3193
  if (renderEditCell) {
3159
- return createElement(renderEditCell, params);
3194
+ return createElement(memo(renderEditCell), params);
3160
3195
  }
3161
3196
  return {
3162
3197
  date: /* @__PURE__ */ React23.createElement(
@@ -3216,7 +3251,7 @@ var BodyCell = (props) => {
3216
3251
  }, [value, editModeComponentProps, type]);
3217
3252
  const ReadModeComponent = useMemo8(() => {
3218
3253
  if (renderCell) {
3219
- return createElement(renderCell, params);
3254
+ return createElement(memo(renderCell), params);
3220
3255
  }
3221
3256
  const innerText = value;
3222
3257
  const typedComponent = {
@@ -3229,14 +3264,14 @@ var BodyCell = (props) => {
3229
3264
  )
3230
3265
  }[type || "text"];
3231
3266
  return typedComponent || innerText;
3232
- }, [value, renderCell, params, type, componentProps, props]);
3267
+ }, [value, renderCell, params, type, componentProps]);
3233
3268
  const CellComponent = useMemo8(
3234
3269
  () => editMode && EditModeComponent ? EditModeComponent : ReadModeComponent,
3235
3270
  [editMode, EditModeComponent, ReadModeComponent]
3236
3271
  );
3237
3272
  const showTooltip = useMemo8(
3238
- () => noWrap && props.type === "longText",
3239
- [noWrap, props.type]
3273
+ () => noWrap && type === "longText",
3274
+ [noWrap, type]
3240
3275
  );
3241
3276
  useEffect5(() => {
3242
3277
  setValue(row[field]);
@@ -3247,38 +3282,40 @@ var BodyCell = (props) => {
3247
3282
  ref: cellRef,
3248
3283
  key: field,
3249
3284
  headers: `${tableId}_header_${props.headerName ?? field}`,
3250
- style: {
3285
+ sx: {
3251
3286
  textAlign: getTextAlign({ type }),
3252
3287
  verticalAlign: editMode ? "top" : "middle",
3253
3288
  position: isPinned ? "sticky" : void 0,
3254
3289
  left: isPinned ? pinnedStartPosition : void 0,
3255
3290
  right: isPinned ? pinnedEndPosition : void 0,
3256
3291
  zIndex: isPinned ? `calc(${theme.getCssVar("zIndex-table")} + 2)` : void 0,
3257
- // @ts-expect-error: react CSSProperties에는 --var를 지원하지 않는다.
3258
3292
  "--TableCell-dataBackground": isPinned ? `var(--TableCell-headBackground)` : void 0
3259
3293
  },
3260
3294
  className: isLastStartPinnedColumn && "is-last-left" || isLastEndPinnedColumn && "is-last-right" || ""
3261
3295
  },
3262
- showTooltip ? /* @__PURE__ */ React23.createElement(
3263
- Tooltip_default,
3264
- {
3265
- title: value,
3266
- placement: "bottom",
3267
- style: { maxWidth: "100%" },
3268
- enterDelay: 1500,
3269
- enterNextDelay: 1500
3270
- },
3271
- /* @__PURE__ */ React23.createElement(
3272
- "div",
3296
+ useMemo8(
3297
+ () => showTooltip ? /* @__PURE__ */ React23.createElement(
3298
+ Tooltip_default,
3273
3299
  {
3274
- style: {
3275
- overflow: "hidden",
3276
- textOverflow: "ellipsis"
3277
- }
3300
+ title: value,
3301
+ placement: "bottom",
3302
+ style: { maxWidth: "100%" },
3303
+ enterDelay: 1500,
3304
+ enterNextDelay: 1500
3278
3305
  },
3279
- CellComponent
3280
- )
3281
- ) : CellComponent
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
+ )
3282
3319
  );
3283
3320
  };
3284
3321
  var BodyRow = (props) => {
@@ -3307,8 +3344,8 @@ function useDataTableRenderer({
3307
3344
  paginationModel,
3308
3345
  onPaginationModelChange,
3309
3346
  sortModel: controlledSortModel,
3310
- sortOrder: _sortOrder = ["asc", "desc", null],
3311
- selectionModel = [],
3347
+ sortOrder: _sortOrder,
3348
+ selectionModel,
3312
3349
  onSortModelChange,
3313
3350
  onSelectionModelChange,
3314
3351
  editMode,
@@ -3370,7 +3407,8 @@ function useDataTableRenderer({
3370
3407
  [_rows, sortModel, sortComparator]
3371
3408
  );
3372
3409
  const sortOrder = useMemo8(
3373
- () => Array.from(new Set(_sortOrder)),
3410
+ // NOTE: default value를 props destructuring에서 할당하면 렌더링 시점에 초기화가 되어버린다.
3411
+ () => Array.from(new Set(_sortOrder || ["asc", "desc", null])),
3374
3412
  [_sortOrder]
3375
3413
  );
3376
3414
  const [page, setPage] = useState6(paginationModel?.page || 1);
@@ -3380,7 +3418,8 @@ function useDataTableRenderer({
3380
3418
  [_getId, page, pageSize]
3381
3419
  );
3382
3420
  const selectedModelSet = useMemo8(
3383
- () => new Set(selectionModel),
3421
+ // NOTE: default value를 props destructuring에서 할당하면 렌더링 시점에 초기화가 되어버린다.
3422
+ () => new Set(selectionModel || []),
3384
3423
  [selectionModel]
3385
3424
  );
3386
3425
  const dataInPage = useMemo8(
@@ -3393,7 +3432,7 @@ function useDataTableRenderer({
3393
3432
  );
3394
3433
  const rowCount = totalRowsProp || rows.length;
3395
3434
  const isTotalSelected = useMemo8(
3396
- () => _isTotalSelected ?? (rowCount > 0 && selectionModel.length === rowCount),
3435
+ () => _isTotalSelected ?? (rowCount > 0 && (selectionModel?.length || 0) === rowCount),
3397
3436
  [_isTotalSelected, selectionModel, rowCount]
3398
3437
  );
3399
3438
  const columns = useMemo8(() => {
@@ -3517,12 +3556,12 @@ function useDataTableRenderer({
3517
3556
  onCheckboxChange: useCallback9(
3518
3557
  (event, selectedModel) => {
3519
3558
  if (selectedModelSet.has(selectedModel)) {
3520
- const newSelectionModel = selectionModel.filter(
3559
+ const newSelectionModel = (selectionModel || []).filter(
3521
3560
  (model) => model !== selectedModel
3522
3561
  );
3523
3562
  onSelectionModelChange?.(newSelectionModel);
3524
3563
  } else {
3525
- const newSelectionModel = [...selectionModel, selectedModel];
3564
+ const newSelectionModel = [...selectionModel || [], selectedModel];
3526
3565
  onSelectionModelChange?.(newSelectionModel);
3527
3566
  }
3528
3567
  },
@@ -3610,7 +3649,7 @@ function Component(props, apiRef) {
3610
3649
  getScrollElement: () => parentRef.current,
3611
3650
  estimateSize: () => 32,
3612
3651
  measureElement: (element) => element.clientHeight,
3613
- overscan: 20
3652
+ overscan: 5
3614
3653
  });
3615
3654
  const paginationModel = useMemo8(() => ({ page, pageSize }), [page, pageSize]);
3616
3655
  const totalSize = virtualizer.getTotalSize();