@ceed/cds 1.2.8 → 1.2.9-next.1
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 +134 -92
- package/dist/index.js +136 -93
- package/framer/index.js +54 -39
- package/package.json +4 -2
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,55 +3299,59 @@ 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
|
-
var BodyRow = (
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3338
|
+
var BodyRow = (0, import_react24.memo)(
|
|
3339
|
+
(props) => {
|
|
3340
|
+
const { tableId, columns, rowId, editMode, noWrap, row } = props;
|
|
3341
|
+
return /* @__PURE__ */ import_react24.default.createElement(import_react24.default.Fragment, null, columns.map((column, i) => /* @__PURE__ */ import_react24.default.createElement(
|
|
3342
|
+
BodyCell,
|
|
3343
|
+
{
|
|
3344
|
+
...column,
|
|
3345
|
+
tableId,
|
|
3346
|
+
key: `${rowId}_${column.field.toString()}_${i}`,
|
|
3347
|
+
row,
|
|
3348
|
+
rowId,
|
|
3349
|
+
editMode,
|
|
3350
|
+
noWrap
|
|
3351
|
+
}
|
|
3352
|
+
)));
|
|
3353
|
+
}
|
|
3354
|
+
);
|
|
3317
3355
|
function useDataTableRenderer({
|
|
3318
3356
|
rows: _rows,
|
|
3319
3357
|
columns: columnsProp,
|
|
@@ -3325,8 +3363,8 @@ function useDataTableRenderer({
|
|
|
3325
3363
|
paginationModel,
|
|
3326
3364
|
onPaginationModelChange,
|
|
3327
3365
|
sortModel: controlledSortModel,
|
|
3328
|
-
sortOrder: _sortOrder
|
|
3329
|
-
selectionModel
|
|
3366
|
+
sortOrder: _sortOrder,
|
|
3367
|
+
selectionModel,
|
|
3330
3368
|
onSortModelChange,
|
|
3331
3369
|
onSelectionModelChange,
|
|
3332
3370
|
editMode,
|
|
@@ -3388,7 +3426,8 @@ function useDataTableRenderer({
|
|
|
3388
3426
|
[_rows, sortModel, sortComparator]
|
|
3389
3427
|
);
|
|
3390
3428
|
const sortOrder = (0, import_react24.useMemo)(
|
|
3391
|
-
|
|
3429
|
+
// NOTE: default value를 props destructuring에서 할당하면 렌더링 시점에 초기화가 되어버린다.
|
|
3430
|
+
() => Array.from(new Set(_sortOrder || ["asc", "desc", null])),
|
|
3392
3431
|
[_sortOrder]
|
|
3393
3432
|
);
|
|
3394
3433
|
const [page, setPage] = (0, import_react24.useState)(paginationModel?.page || 1);
|
|
@@ -3398,7 +3437,8 @@ function useDataTableRenderer({
|
|
|
3398
3437
|
[_getId, page, pageSize]
|
|
3399
3438
|
);
|
|
3400
3439
|
const selectedModelSet = (0, import_react24.useMemo)(
|
|
3401
|
-
|
|
3440
|
+
// NOTE: default value를 props destructuring에서 할당하면 렌더링 시점에 초기화가 되어버린다.
|
|
3441
|
+
() => new Set(selectionModel || []),
|
|
3402
3442
|
[selectionModel]
|
|
3403
3443
|
);
|
|
3404
3444
|
const dataInPage = (0, import_react24.useMemo)(
|
|
@@ -3411,7 +3451,7 @@ function useDataTableRenderer({
|
|
|
3411
3451
|
);
|
|
3412
3452
|
const rowCount = totalRowsProp || rows.length;
|
|
3413
3453
|
const isTotalSelected = (0, import_react24.useMemo)(
|
|
3414
|
-
() => _isTotalSelected ?? (rowCount > 0 && selectionModel
|
|
3454
|
+
() => _isTotalSelected ?? (rowCount > 0 && (selectionModel?.length || 0) === rowCount),
|
|
3415
3455
|
[_isTotalSelected, selectionModel, rowCount]
|
|
3416
3456
|
);
|
|
3417
3457
|
const columns = (0, import_react24.useMemo)(() => {
|
|
@@ -3535,12 +3575,12 @@ function useDataTableRenderer({
|
|
|
3535
3575
|
onCheckboxChange: (0, import_react24.useCallback)(
|
|
3536
3576
|
(event, selectedModel) => {
|
|
3537
3577
|
if (selectedModelSet.has(selectedModel)) {
|
|
3538
|
-
const newSelectionModel = selectionModel.filter(
|
|
3578
|
+
const newSelectionModel = (selectionModel || []).filter(
|
|
3539
3579
|
(model) => model !== selectedModel
|
|
3540
3580
|
);
|
|
3541
3581
|
onSelectionModelChange?.(newSelectionModel);
|
|
3542
3582
|
} else {
|
|
3543
|
-
const newSelectionModel = [...selectionModel, selectedModel];
|
|
3583
|
+
const newSelectionModel = [...selectionModel || [], selectedModel];
|
|
3544
3584
|
onSelectionModelChange?.(newSelectionModel);
|
|
3545
3585
|
}
|
|
3546
3586
|
},
|
|
@@ -3628,7 +3668,7 @@ function Component(props, apiRef) {
|
|
|
3628
3668
|
getScrollElement: () => parentRef.current,
|
|
3629
3669
|
estimateSize: () => 32,
|
|
3630
3670
|
measureElement: (element) => element.clientHeight,
|
|
3631
|
-
overscan:
|
|
3671
|
+
overscan: 10
|
|
3632
3672
|
});
|
|
3633
3673
|
const paginationModel = (0, import_react24.useMemo)(() => ({ page, pageSize }), [page, pageSize]);
|
|
3634
3674
|
const totalSize = virtualizer.getTotalSize();
|
|
@@ -4262,6 +4302,7 @@ var import_joy41 = require("@mui/joy");
|
|
|
4262
4302
|
var import_react30 = __toESM(require("react"));
|
|
4263
4303
|
var import_joy42 = require("@mui/joy");
|
|
4264
4304
|
var import_joy43 = require("@mui/joy");
|
|
4305
|
+
var import_remark_gfm = __toESM(require("remark-gfm"));
|
|
4265
4306
|
var LazyReactMarkdown = (0, import_react30.lazy)(() => import("react-markdown"));
|
|
4266
4307
|
var Markdown = (props) => {
|
|
4267
4308
|
const [rehypeAccent2, setRehypeAccent] = (0, import_react30.useState)(null);
|
|
@@ -4307,6 +4348,7 @@ var Markdown = (props) => {
|
|
|
4307
4348
|
...markdownOptions,
|
|
4308
4349
|
children: content,
|
|
4309
4350
|
rehypePlugins: [[rehypeAccent2, { accentColor }]],
|
|
4351
|
+
remarkPlugins: [import_remark_gfm.default],
|
|
4310
4352
|
components: {
|
|
4311
4353
|
h1: ({ children }) => /* @__PURE__ */ import_react30.default.createElement(Typography, { color, textColor, level: "h1" }, children),
|
|
4312
4354
|
h2: ({ children }) => /* @__PURE__ */ import_react30.default.createElement(Typography, { color, textColor, level: "h2" }, children),
|