Skip to content

Commit

Permalink
feat(Table): Applied user onChange callback for edit cells
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlos Pinedo committed Nov 29, 2023
1 parent 4f04b5a commit 0694d3d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/table/src/core/Cell/useRenderContent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const useRenderContent = (columnDef: ColDef, data: unknown) => {
const editionContent = columnDef.CellEditor
? columnDef.CellEditor({
value: data,
onChange: () => {},
onChange: columnDef.cellRendererConfig?.onChange,
})
: null;

Expand Down
11 changes: 9 additions & 2 deletions packages/table/src/declarations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,16 @@ export interface ColumnCellStyleProps {
toEdge?: boolean;
}

type EditCellOnChange = (newValue: unknown) => void;

interface CellEditorParams {
value: unknown;
onChange: () => void;
onChange: EditCellOnChange;
}

interface CellRendererConfig {
onChange?: EditCellOnChange;
[key: string]: any;
}

export interface ColDef {
Expand All @@ -62,7 +69,7 @@ export interface ColDef {
valueFormatter?: (value: unknown, context: DateContext) => void;

// revisar
cellRendererConfig?: any;
cellRendererConfig?: CellRendererConfig;
context?: {
[key: string]: unknown;
};
Expand Down

0 comments on commit 0694d3d

Please sign in to comment.