From 96ce11b34327858cf48d4be62f6263113d4a84d0 Mon Sep 17 00:00:00 2001 From: p-bemportato Date: Thu, 27 Jun 2024 15:33:01 +0000 Subject: [PATCH] bugifx(kup-input-panel): update custom button click handler event --- .../kup-input-panel/kup-input-panel-declarations.ts | 10 +++++----- .../src/components/kup-input-panel/kup-input-panel.tsx | 8 ++++---- .../ketchup/src/components/kup-input-panel/readme.md | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/ketchup/src/components/kup-input-panel/kup-input-panel-declarations.ts b/packages/ketchup/src/components/kup-input-panel/kup-input-panel-declarations.ts index a1d30d495d..3457ff4a55 100644 --- a/packages/ketchup/src/components/kup-input-panel/kup-input-panel-declarations.ts +++ b/packages/ketchup/src/components/kup-input-panel/kup-input-panel-declarations.ts @@ -102,11 +102,11 @@ export type InputPanelOptionsHandler = ( currentState: KupInputPanelData ) => Promise; -export type InputPanelButtonClickHandler = ( - fun: string, - cellId: string, - currentState: KupInputPanelData -) => void; +export type InputPanelButtonClickHandler = (event: { + fun: string; + cellId: string; + currentState: KupInputPanelData; +}) => void; export enum KupInputPanelProps { customStyle = 'Custom style of the component.', diff --git a/packages/ketchup/src/components/kup-input-panel/kup-input-panel.tsx b/packages/ketchup/src/components/kup-input-panel/kup-input-panel.tsx index 59d7b726f7..623deb6d7b 100644 --- a/packages/ketchup/src/components/kup-input-panel/kup-input-panel.tsx +++ b/packages/ketchup/src/components/kup-input-panel/kup-input-panel.tsx @@ -333,11 +333,11 @@ export class KupInputPanel { wrapperClass="form__submit" onClick={() => { cell.data.fun - ? this.customButtonClickHandler( - cell.data.fun, + ? this.customButtonClickHandler({ + fun: cell.data.fun, cellId, - this.#reverseMapCells() - ) + currentState: this.#reverseMapCells(), + }) : this.submitCb({ value: { before: { ...this.#originalData }, diff --git a/packages/ketchup/src/components/kup-input-panel/readme.md b/packages/ketchup/src/components/kup-input-panel/readme.md index 3b493226f9..731d409ed2 100644 --- a/packages/ketchup/src/components/kup-input-panel/readme.md +++ b/packages/ketchup/src/components/kup-input-panel/readme.md @@ -9,7 +9,7 @@ | Property | Attribute | Description | Type | Default | | -------------------------- | ---------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ------- | -| `customButtonClickHandler` | -- | Sets the handler to use when click on custom buttons | `(fun: string, cellId: string, currentState: KupInputPanelData) => void` | `null` | +| `customButtonClickHandler` | -- | Sets the handler to use when click on custom buttons | `(event: { fun: string; cellId: string; currentState: KupInputPanelData; }) => void` | `null` | | `customStyle` | `custom-style` | Custom style of the component. | `string` | `''` | | `data` | -- | Actual data of the form. | `KupInputPanelData` | `null` | | `hiddenSubmitButton` | `hidden-submit-button` | Creates a hidden submit button in order to submit the form with enter. | `boolean` | `false` |