@ceed/cds 1.7.0 → 1.7.1-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.
@@ -104,7 +104,15 @@ export type LinkColumnDef<T extends Record<PropertyKey, string>, ID, C extends R
104
104
  component?: C;
105
105
  componentProps?: ComponentProperties<C, T, ID, string>;
106
106
  };
107
- export type ColumnDef<T extends Record<PropertyKey, any>, ID = unknown> = AutocompleteColumnDef<T, ID> | CurrencyColumnDef<T, ID> | DateColumnDef<T, ID> | NumberColumnDef<T, ID> | TextColumnDef<T, ID> | LongTextColumnDef<T, ID> | LinkColumnDef<T, ID> | SelectColumnDef<T, ID>;
107
+ export type ActionsColumnDef<T extends Record<PropertyKey, string>, ID> = BaseColumnDef<T, string, ID> & {
108
+ type: "actions";
109
+ getActions: (params: {
110
+ row: T;
111
+ value?: any;
112
+ id: ID;
113
+ }) => ReactNode[];
114
+ };
115
+ export type ColumnDef<T extends Record<PropertyKey, any>, ID = unknown> = AutocompleteColumnDef<T, ID> | CurrencyColumnDef<T, ID> | DateColumnDef<T, ID> | NumberColumnDef<T, ID> | TextColumnDef<T, ID> | LongTextColumnDef<T, ID> | LinkColumnDef<T, ID> | SelectColumnDef<T, ID> | ActionsColumnDef<T, ID>;
108
116
  export type Sort = "asc" | "desc" | null;
109
117
  export type SortModel<T extends Record<PropertyKey, any>> = {
110
118
  [K in keyof T]: {
@@ -9,14 +9,11 @@ declare function IconMenuButton<T extends ElementType, P extends ElementType>(pr
9
9
  loading?: boolean;
10
10
  color?: MenuButtonProps<T, P>["color"];
11
11
  variant?: MenuButtonProps<T, P>["variant"];
12
- endDecorator?: MenuButtonProps<T, P>["endDecorator"];
13
- startDecorator?: MenuButtonProps<T, P>["startDecorator"];
14
12
  items?: {
15
13
  text: string;
16
14
  component?: P;
17
15
  componentProps?: ComponentProps<P>;
18
16
  }[];
19
- showIcon?: boolean;
20
17
  placement?: "bottom-start" | "bottom" | "bottom-end";
21
18
  }): React.JSX.Element;
22
19
  declare namespace IconMenuButton {
package/dist/index.cjs CHANGED
@@ -2989,13 +2989,17 @@ var VirtualizedTableBody = (0, import_joy33.styled)("tbody", {
2989
2989
  },
2990
2990
  // NOTE: 테이블 안에 버튼을 넣을 때 버튼의 높이가 테이블의 높이를 넘어가지 않도록 설정
2991
2991
  [`& .${import_joy33.buttonClasses.root}`]: {
2992
- "--Button-minHeight": "20px",
2992
+ "--Button-minHeight": "26px",
2993
2993
  "--Button-paddingBlock": "0.25rem",
2994
- lineHeight: 1
2994
+ lineHeight: 1,
2995
+ marginTop: "-2px",
2996
+ marginBottom: "-2px"
2995
2997
  },
2996
2998
  [`& .${import_joy33.iconButtonClasses.root}`]: {
2997
- "--IconButton-size": "21px",
2998
- verticalAlign: "middle"
2999
+ "--IconButton-size": "26px",
3000
+ verticalAlign: "middle",
3001
+ marginTop: "-2px",
3002
+ marginBottom: "-2px"
2999
3003
  }
3000
3004
  });
3001
3005
  var StyledTableRow = (0, import_joy33.styled)("tr", {
@@ -3059,13 +3063,14 @@ var HeadCell = (props) => {
3059
3063
  stickyHeader,
3060
3064
  resizable,
3061
3065
  field,
3066
+ type,
3062
3067
  tableId,
3063
3068
  headerName,
3064
3069
  required,
3065
3070
  editMode,
3066
3071
  sort,
3067
3072
  onSortChange,
3068
- sortable = true,
3073
+ sortable: _sortable = true,
3069
3074
  sortOrder,
3070
3075
  description,
3071
3076
  isPinned,
@@ -3075,6 +3080,7 @@ var HeadCell = (props) => {
3075
3080
  } = props;
3076
3081
  const theme = (0, import_joy33.useTheme)();
3077
3082
  const ref = headerRef;
3083
+ const sortable = type === "actions" ? false : _sortable;
3078
3084
  const headId = (0, import_react25.useMemo)(
3079
3085
  () => `${tableId}_header_${headerName ?? field}`.trim(),
3080
3086
  [tableId, headerName, field]
@@ -3213,10 +3219,10 @@ var BodyCell = (props) => {
3213
3219
  );
3214
3220
  const componentProps = (0, import_react25.useMemo)(
3215
3221
  () => ({
3216
- ...typeof props.componentProps === "function" ? props.componentProps(params) : props.componentProps || {},
3222
+ ..."componentProps" in props && (typeof props.componentProps === "function" ? props.componentProps(params) : props.componentProps || {}),
3217
3223
  size: "sm"
3218
3224
  }),
3219
- [props.componentProps, params]
3225
+ ["componentProps" in props ? props.componentProps : null, params]
3220
3226
  );
3221
3227
  const editModeComponentProps = (0, import_react25.useMemo)(
3222
3228
  () => ({
@@ -3365,10 +3371,27 @@ var BodyCell = (props) => {
3365
3371
  }[type || "text"];
3366
3372
  return typedComponent || innerText;
3367
3373
  }, [value, renderCell, params, type, componentProps]);
3368
- const CellComponent = (0, import_react25.useMemo)(
3369
- () => editMode && EditModeComponent ? EditModeComponent : ReadModeComponent,
3370
- [editMode, EditModeComponent, ReadModeComponent]
3371
- );
3374
+ const CellComponent = (0, import_react25.useMemo)(() => {
3375
+ if (type === "actions") {
3376
+ return /* @__PURE__ */ import_react25.default.createElement(
3377
+ Stack_default,
3378
+ {
3379
+ direction: "row",
3380
+ gap: 1,
3381
+ justifyContent: "center",
3382
+ alignItems: "center"
3383
+ },
3384
+ props.getActions?.(params)
3385
+ );
3386
+ }
3387
+ return editMode && EditModeComponent ? EditModeComponent : ReadModeComponent;
3388
+ }, [
3389
+ type,
3390
+ props.getActions,
3391
+ editMode,
3392
+ EditModeComponent,
3393
+ ReadModeComponent
3394
+ ]);
3372
3395
  const showTooltip = (0, import_react25.useMemo)(
3373
3396
  () => noWrap && type === "longText",
3374
3397
  [noWrap, type]
package/dist/index.js CHANGED
@@ -2957,13 +2957,17 @@ var VirtualizedTableBody = styled12("tbody", {
2957
2957
  },
2958
2958
  // NOTE: 테이블 안에 버튼을 넣을 때 버튼의 높이가 테이블의 높이를 넘어가지 않도록 설정
2959
2959
  [`& .${buttonClasses.root}`]: {
2960
- "--Button-minHeight": "20px",
2960
+ "--Button-minHeight": "26px",
2961
2961
  "--Button-paddingBlock": "0.25rem",
2962
- lineHeight: 1
2962
+ lineHeight: 1,
2963
+ marginTop: "-2px",
2964
+ marginBottom: "-2px"
2963
2965
  },
2964
2966
  [`& .${iconButtonClasses.root}`]: {
2965
- "--IconButton-size": "21px",
2966
- verticalAlign: "middle"
2967
+ "--IconButton-size": "26px",
2968
+ verticalAlign: "middle",
2969
+ marginTop: "-2px",
2970
+ marginBottom: "-2px"
2967
2971
  }
2968
2972
  });
2969
2973
  var StyledTableRow = styled12("tr", {
@@ -3027,13 +3031,14 @@ var HeadCell = (props) => {
3027
3031
  stickyHeader,
3028
3032
  resizable,
3029
3033
  field,
3034
+ type,
3030
3035
  tableId,
3031
3036
  headerName,
3032
3037
  required,
3033
3038
  editMode,
3034
3039
  sort,
3035
3040
  onSortChange,
3036
- sortable = true,
3041
+ sortable: _sortable = true,
3037
3042
  sortOrder,
3038
3043
  description,
3039
3044
  isPinned,
@@ -3043,6 +3048,7 @@ var HeadCell = (props) => {
3043
3048
  } = props;
3044
3049
  const theme = useTheme();
3045
3050
  const ref = headerRef;
3051
+ const sortable = type === "actions" ? false : _sortable;
3046
3052
  const headId = useMemo8(
3047
3053
  () => `${tableId}_header_${headerName ?? field}`.trim(),
3048
3054
  [tableId, headerName, field]
@@ -3181,10 +3187,10 @@ var BodyCell = (props) => {
3181
3187
  );
3182
3188
  const componentProps = useMemo8(
3183
3189
  () => ({
3184
- ...typeof props.componentProps === "function" ? props.componentProps(params) : props.componentProps || {},
3190
+ ..."componentProps" in props && (typeof props.componentProps === "function" ? props.componentProps(params) : props.componentProps || {}),
3185
3191
  size: "sm"
3186
3192
  }),
3187
- [props.componentProps, params]
3193
+ ["componentProps" in props ? props.componentProps : null, params]
3188
3194
  );
3189
3195
  const editModeComponentProps = useMemo8(
3190
3196
  () => ({
@@ -3333,10 +3339,27 @@ var BodyCell = (props) => {
3333
3339
  }[type || "text"];
3334
3340
  return typedComponent || innerText;
3335
3341
  }, [value, renderCell, params, type, componentProps]);
3336
- const CellComponent = useMemo8(
3337
- () => editMode && EditModeComponent ? EditModeComponent : ReadModeComponent,
3338
- [editMode, EditModeComponent, ReadModeComponent]
3339
- );
3342
+ const CellComponent = useMemo8(() => {
3343
+ if (type === "actions") {
3344
+ return /* @__PURE__ */ React23.createElement(
3345
+ Stack_default,
3346
+ {
3347
+ direction: "row",
3348
+ gap: 1,
3349
+ justifyContent: "center",
3350
+ alignItems: "center"
3351
+ },
3352
+ props.getActions?.(params)
3353
+ );
3354
+ }
3355
+ return editMode && EditModeComponent ? EditModeComponent : ReadModeComponent;
3356
+ }, [
3357
+ type,
3358
+ props.getActions,
3359
+ editMode,
3360
+ EditModeComponent,
3361
+ ReadModeComponent
3362
+ ]);
3340
3363
  const showTooltip = useMemo8(
3341
3364
  () => noWrap && type === "longText",
3342
3365
  [noWrap, type]