@handsontable/react-wrapper 17.0.1 → 17.1.0-rc1

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.
@@ -1,18 +1,18 @@
1
- import Handsontable from 'handsontable/base';
2
- import { HotTableProps } from './types';
3
- export declare class SettingsMapper {
4
- /**
5
- * Parse component settings into Handsontable-compatible settings.
6
- *
7
- * @param {Object} properties Object containing properties from the HotTable object.
8
- * @param {Object} additionalSettings Additional settings.
9
- * @param {boolean} additionalSettings.isInit Flag determining whether the settings are being set during initialization.
10
- * @param {string[]} additionalSettings.initOnlySettingKeys Array of keys that can be set only during initialization.
11
- * @returns {Object} Handsontable-compatible settings object.
12
- */
13
- static getSettings(properties: HotTableProps, { prevProps, isInit, initOnlySettingKeys }?: {
14
- prevProps?: HotTableProps;
15
- isInit?: boolean;
16
- initOnlySettingKeys?: Array<keyof Handsontable.GridSettings>;
17
- }): Handsontable.GridSettings;
18
- }
1
+ import Handsontable from 'handsontable/base';
2
+ import { HotTableProps } from './types';
3
+ export declare class SettingsMapper {
4
+ /**
5
+ * Parse component settings into Handsontable-compatible settings.
6
+ *
7
+ * @param {Object} properties Object containing properties from the HotTable object.
8
+ * @param {Object} additionalSettings Additional settings.
9
+ * @param {boolean} additionalSettings.isInit Flag determining whether the settings are being set during initialization.
10
+ * @param {string[]} additionalSettings.initOnlySettingKeys Array of keys that can be set only during initialization.
11
+ * @returns {Object} Handsontable-compatible settings object.
12
+ */
13
+ static getSettings(properties: HotTableProps, { prevProps, isInit, initOnlySettingKeys }?: {
14
+ prevProps?: HotTableProps;
15
+ isInit?: boolean;
16
+ initOnlySettingKeys?: Array<keyof Handsontable.GridSettings>;
17
+ }): Handsontable.GridSettings;
18
+ }
package/types.d.ts CHANGED
@@ -1,78 +1,78 @@
1
- import Handsontable from 'handsontable/base';
2
- import { ComponentType, CSSProperties, Dispatch, DispatchWithoutAction, ReactNode } from 'react';
3
- /**
4
- * Type of the identifier under which the cached components are stored.
5
- */
6
- export declare type ScopeIdentifier = 'global' | number;
7
- /**
8
- * Interface for the props of the component-based renderers.
9
- */
10
- export interface HotRendererProps {
11
- instance: Handsontable.Core;
12
- TD: HTMLTableCellElement;
13
- row: number;
14
- col: number;
15
- prop: string | number;
16
- value: any;
17
- cellProperties: Handsontable.CellProperties;
18
- }
19
- /**
20
- * Interface for component-based editor overridden hooks object.
21
- */
22
- export interface HotEditorHooks {
23
- onOpen?: () => void;
24
- onClose?: () => void;
25
- onPrepare?: (row: number, column: number, prop: string | number, TD: HTMLTableCellElement, originalValue: any, cellProperties: Handsontable.CellProperties) => void;
26
- onFocus?: () => void;
27
- }
28
- /**
29
- * Interface for custom component-based editor API exposed by useHotEditor
30
- */
31
- export interface UseHotEditorImpl<T> {
32
- value?: T;
33
- setValue: Dispatch<T>;
34
- isOpen: boolean;
35
- finishEditing: DispatchWithoutAction;
36
- row?: number;
37
- col?: number;
38
- }
39
- /**
40
- * Helper type to expose GridSettings/ColumnSettings props with native renderers/editors separately
41
- * from component-based render prop.
42
- */
43
- declare type ReplaceRenderersEditors<T extends Pick<Handsontable.GridSettings, 'renderer' | 'editor'>> = Omit<T, 'renderer' | 'editor'> & {
44
- hotRenderer?: T['renderer'];
45
- renderer?: ComponentType<HotRendererProps>;
46
- hotEditor?: T['editor'];
47
- editor?: ComponentType | boolean;
48
- };
49
- /**
50
- * Interface for the `prop` of the HotTable component - extending the default Handsontable settings with additional,
51
- * component-related properties.
52
- */
53
- export interface HotTableProps extends ReplaceRenderersEditors<Handsontable.GridSettings> {
54
- id?: string;
55
- className?: string;
56
- style?: CSSProperties;
57
- children?: ReactNode;
58
- }
59
- /**
60
- * Properties related to the HotColumn architecture.
61
- */
62
- export interface HotColumnProps extends ReplaceRenderersEditors<Handsontable.ColumnSettings> {
63
- children?: ReactNode;
64
- }
65
- /**
66
- * Type of interface exposed to parent components by HotTable instance via React ref
67
- */
68
- export interface HotTableRef {
69
- /**
70
- * Reference to the main Handsontable DOM element.
71
- */
72
- hotElementRef: HTMLElement;
73
- /**
74
- * Reference to the Handsontable instance.
75
- */
76
- hotInstance: Handsontable | null;
77
- }
78
- export {};
1
+ import Handsontable from 'handsontable/base';
2
+ import { ComponentType, CSSProperties, Dispatch, DispatchWithoutAction, ReactNode } from 'react';
3
+ /**
4
+ * Type of the identifier under which the cached components are stored.
5
+ */
6
+ export declare type ScopeIdentifier = 'global' | number;
7
+ /**
8
+ * Interface for the props of the component-based renderers.
9
+ */
10
+ export interface HotRendererProps {
11
+ instance: Handsontable.Core;
12
+ TD: HTMLTableCellElement;
13
+ row: number;
14
+ col: number;
15
+ prop: string | number;
16
+ value: any;
17
+ cellProperties: Handsontable.CellProperties;
18
+ }
19
+ /**
20
+ * Interface for component-based editor overridden hooks object.
21
+ */
22
+ export interface HotEditorHooks {
23
+ onOpen?: () => void;
24
+ onClose?: () => void;
25
+ onPrepare?: (row: number, column: number, prop: string | number, TD: HTMLTableCellElement, originalValue: any, cellProperties: Handsontable.CellProperties) => void;
26
+ onFocus?: () => void;
27
+ }
28
+ /**
29
+ * Interface for custom component-based editor API exposed by useHotEditor
30
+ */
31
+ export interface UseHotEditorImpl<T> {
32
+ value?: T;
33
+ setValue: Dispatch<T>;
34
+ isOpen: boolean;
35
+ finishEditing: DispatchWithoutAction;
36
+ row?: number;
37
+ col?: number;
38
+ }
39
+ /**
40
+ * Helper type to expose GridSettings/ColumnSettings props with native renderers/editors separately
41
+ * from component-based render prop.
42
+ */
43
+ declare type ReplaceRenderersEditors<T extends Pick<Handsontable.GridSettings, 'renderer' | 'editor'>> = Omit<T, 'renderer' | 'editor'> & {
44
+ hotRenderer?: T['renderer'];
45
+ renderer?: ComponentType<HotRendererProps>;
46
+ hotEditor?: T['editor'];
47
+ editor?: ComponentType | boolean;
48
+ };
49
+ /**
50
+ * Interface for the `prop` of the HotTable component - extending the default Handsontable settings with additional,
51
+ * component-related properties.
52
+ */
53
+ export interface HotTableProps extends ReplaceRenderersEditors<Handsontable.GridSettings> {
54
+ id?: string;
55
+ className?: string;
56
+ style?: CSSProperties;
57
+ children?: ReactNode;
58
+ }
59
+ /**
60
+ * Properties related to the HotColumn architecture.
61
+ */
62
+ export interface HotColumnProps extends ReplaceRenderersEditors<Handsontable.ColumnSettings> {
63
+ children?: ReactNode;
64
+ }
65
+ /**
66
+ * Type of interface exposed to parent components by HotTable instance via React ref
67
+ */
68
+ export interface HotTableRef {
69
+ /**
70
+ * Reference to the main Handsontable DOM element.
71
+ */
72
+ hotElementRef: HTMLElement;
73
+ /**
74
+ * Reference to the Handsontable instance.
75
+ */
76
+ hotInstance: Handsontable | null;
77
+ }
78
+ export {};