@ceed/ads 1.2.8 → 1.2.9
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 +132 -92
- package/dist/index.js +134 -93
- package/framer/index.js +30 -30
- package/package.json +1 -1
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 =
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
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 =
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
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: (
|
|
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
|
-
[
|
|
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
|
|
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 &&
|
|
3239
|
-
[noWrap,
|
|
3273
|
+
() => noWrap && type === "longText",
|
|
3274
|
+
[noWrap, type]
|
|
3240
3275
|
);
|
|
3241
3276
|
useEffect5(() => {
|
|
3242
3277
|
setValue(row[field]);
|
|
@@ -3247,55 +3282,59 @@ var BodyCell = (props) => {
|
|
|
3247
3282
|
ref: cellRef,
|
|
3248
3283
|
key: field,
|
|
3249
3284
|
headers: `${tableId}_header_${props.headerName ?? field}`,
|
|
3250
|
-
|
|
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
|
-
|
|
3263
|
-
|
|
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
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3300
|
+
title: value,
|
|
3301
|
+
placement: "bottom",
|
|
3302
|
+
style: { maxWidth: "100%" },
|
|
3303
|
+
enterDelay: 1500,
|
|
3304
|
+
enterNextDelay: 1500
|
|
3278
3305
|
},
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
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
|
-
var BodyRow = (
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3321
|
+
var BodyRow = memo(
|
|
3322
|
+
(props) => {
|
|
3323
|
+
const { tableId, columns, rowId, editMode, noWrap, row } = props;
|
|
3324
|
+
return /* @__PURE__ */ React23.createElement(React23.Fragment, null, columns.map((column, i) => /* @__PURE__ */ React23.createElement(
|
|
3325
|
+
BodyCell,
|
|
3326
|
+
{
|
|
3327
|
+
...column,
|
|
3328
|
+
tableId,
|
|
3329
|
+
key: `${rowId}_${column.field.toString()}_${i}`,
|
|
3330
|
+
row,
|
|
3331
|
+
rowId,
|
|
3332
|
+
editMode,
|
|
3333
|
+
noWrap
|
|
3334
|
+
}
|
|
3335
|
+
)));
|
|
3336
|
+
}
|
|
3337
|
+
);
|
|
3299
3338
|
function useDataTableRenderer({
|
|
3300
3339
|
rows: _rows,
|
|
3301
3340
|
columns: columnsProp,
|
|
@@ -3307,8 +3346,8 @@ function useDataTableRenderer({
|
|
|
3307
3346
|
paginationModel,
|
|
3308
3347
|
onPaginationModelChange,
|
|
3309
3348
|
sortModel: controlledSortModel,
|
|
3310
|
-
sortOrder: _sortOrder
|
|
3311
|
-
selectionModel
|
|
3349
|
+
sortOrder: _sortOrder,
|
|
3350
|
+
selectionModel,
|
|
3312
3351
|
onSortModelChange,
|
|
3313
3352
|
onSelectionModelChange,
|
|
3314
3353
|
editMode,
|
|
@@ -3370,7 +3409,8 @@ function useDataTableRenderer({
|
|
|
3370
3409
|
[_rows, sortModel, sortComparator]
|
|
3371
3410
|
);
|
|
3372
3411
|
const sortOrder = useMemo8(
|
|
3373
|
-
|
|
3412
|
+
// NOTE: default value를 props destructuring에서 할당하면 렌더링 시점에 초기화가 되어버린다.
|
|
3413
|
+
() => Array.from(new Set(_sortOrder || ["asc", "desc", null])),
|
|
3374
3414
|
[_sortOrder]
|
|
3375
3415
|
);
|
|
3376
3416
|
const [page, setPage] = useState6(paginationModel?.page || 1);
|
|
@@ -3380,7 +3420,8 @@ function useDataTableRenderer({
|
|
|
3380
3420
|
[_getId, page, pageSize]
|
|
3381
3421
|
);
|
|
3382
3422
|
const selectedModelSet = useMemo8(
|
|
3383
|
-
|
|
3423
|
+
// NOTE: default value를 props destructuring에서 할당하면 렌더링 시점에 초기화가 되어버린다.
|
|
3424
|
+
() => new Set(selectionModel || []),
|
|
3384
3425
|
[selectionModel]
|
|
3385
3426
|
);
|
|
3386
3427
|
const dataInPage = useMemo8(
|
|
@@ -3393,7 +3434,7 @@ function useDataTableRenderer({
|
|
|
3393
3434
|
);
|
|
3394
3435
|
const rowCount = totalRowsProp || rows.length;
|
|
3395
3436
|
const isTotalSelected = useMemo8(
|
|
3396
|
-
() => _isTotalSelected ?? (rowCount > 0 && selectionModel
|
|
3437
|
+
() => _isTotalSelected ?? (rowCount > 0 && (selectionModel?.length || 0) === rowCount),
|
|
3397
3438
|
[_isTotalSelected, selectionModel, rowCount]
|
|
3398
3439
|
);
|
|
3399
3440
|
const columns = useMemo8(() => {
|
|
@@ -3517,12 +3558,12 @@ function useDataTableRenderer({
|
|
|
3517
3558
|
onCheckboxChange: useCallback9(
|
|
3518
3559
|
(event, selectedModel) => {
|
|
3519
3560
|
if (selectedModelSet.has(selectedModel)) {
|
|
3520
|
-
const newSelectionModel = selectionModel.filter(
|
|
3561
|
+
const newSelectionModel = (selectionModel || []).filter(
|
|
3521
3562
|
(model) => model !== selectedModel
|
|
3522
3563
|
);
|
|
3523
3564
|
onSelectionModelChange?.(newSelectionModel);
|
|
3524
3565
|
} else {
|
|
3525
|
-
const newSelectionModel = [...selectionModel, selectedModel];
|
|
3566
|
+
const newSelectionModel = [...selectionModel || [], selectedModel];
|
|
3526
3567
|
onSelectionModelChange?.(newSelectionModel);
|
|
3527
3568
|
}
|
|
3528
3569
|
},
|
|
@@ -3610,7 +3651,7 @@ function Component(props, apiRef) {
|
|
|
3610
3651
|
getScrollElement: () => parentRef.current,
|
|
3611
3652
|
estimateSize: () => 32,
|
|
3612
3653
|
measureElement: (element) => element.clientHeight,
|
|
3613
|
-
overscan:
|
|
3654
|
+
overscan: 10
|
|
3614
3655
|
});
|
|
3615
3656
|
const paginationModel = useMemo8(() => ({ page, pageSize }), [page, pageSize]);
|
|
3616
3657
|
const totalSize = virtualizer.getTotalSize();
|