import Handsontable from 'handsontable/base'; import { HotTableProps } from './types'; /** * Copies of the values last passed to the grid, by setting name. The component keeps one per grid * instance and passes it to every update. */ export declare type ForwardedSettings = Map; export declare class SettingsMapper { /** * Parse component settings into Handsontable-compatible settings. * * A prop whose value is `undefined` counts as not passed and is left out, so the option keeps its * default. An own `undefined` key would shadow that default in the settings cascade. On an update * of a prop that had a value in the previous props, the option's default is forwarded instead, so * the grid matches a fresh mount with the same props (`copyPaste={on ? false : undefined}` turns * copy and paste back on). `height` and `width` are forwarded as `null`, because core leaves the * size in place for `undefined` (`height={full ? undefined : 400}` clears the height). * A hook has no default to fall back to, so a hook prop that had a callback and is now `undefined` * is forwarded as `null`, which removes the callback (`afterChange={on ? logChange : undefined}`). * So is a hook prop that had a callback and is no longer passed at all, and, on an update, a hook * prop that holds anything but a callback (`afterChange={on && logChange}` gives `false`). * For an option that is not a hook, `null` and `false` are real values and are forwarded. * * @param {object} properties Object containing properties from the HotTable object. * @param {object} additionalSettings Additional settings. * @param {boolean} additionalSettings.isInit Flag determining whether the settings are being set during initialization. * @param {string[]} additionalSettings.initOnlySettingKeys Array of keys that can be set only during initialization. * @param {HotTableProps} additionalSettings.prevProps The component's props before the current update. * @param {Handsontable.GridSettings} additionalSettings.currentSettings The grid's current live settings. * @param {ForwardedSettings} additionalSettings.forwardedSettings The values last passed to the grid. A * setting whose value equals the one recorded there is left out, and every setting passed is recorded. * @returns {object} Handsontable-compatible settings object. */ static getSettings(properties: HotTableProps, { prevProps, isInit, initOnlySettingKeys, currentSettings, forwardedSettings, }?: { prevProps?: HotTableProps; isInit?: boolean; initOnlySettingKeys?: Array; currentSettings?: Handsontable.GridSettings; forwardedSettings?: ForwardedSettings; }): Handsontable.GridSettings; }