@handsontable/react-wrapper 17.0.1-rc2 → 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.
- package/commonjs/react-handsontable.js +482 -343
- package/dist/react-handsontable.js +492 -344
- package/dist/react-handsontable.js.map +1 -1
- package/dist/react-handsontable.min.js +2 -2
- package/dist/react-handsontable.min.js.map +1 -1
- package/es/react-handsontable.mjs +483 -344
- package/helpers.d.ts +113 -105
- package/hotColumn.d.ts +5 -5
- package/hotColumnContext.d.ts +16 -16
- package/hotEditor.d.ts +73 -73
- package/hotTable.d.ts +29 -29
- package/hotTableContext.d.ts +55 -55
- package/hotTableInner.d.ts +5 -5
- package/index.d.ts +5 -5
- package/package.json +3 -4
- package/renderersPortalManager.d.ts +6 -6
- package/settingsMapper.d.ts +18 -18
- package/types.d.ts +78 -78
package/helpers.d.ts
CHANGED
|
@@ -1,105 +1,113 @@
|
|
|
1
|
-
import React, { ComponentType, CSSProperties, DependencyList, EffectCallback, ReactNode, ReactPortal } from 'react';
|
|
2
|
-
import { HotTableProps } from './types';
|
|
3
|
-
/**
|
|
4
|
-
* Warning message for the `autoRowSize`/`autoColumnSize` compatibility check.
|
|
5
|
-
*/
|
|
6
|
-
export declare const AUTOSIZE_WARNING: string;
|
|
7
|
-
/**
|
|
8
|
-
* Warning message for the `hot-renderer` obsolete renderer passing method.
|
|
9
|
-
*/
|
|
10
|
-
export declare const OBSOLETE_HOTRENDERER_WARNING: string;
|
|
11
|
-
/**
|
|
12
|
-
* Warning message for the `hot-editor` obsolete editor passing method.
|
|
13
|
-
*/
|
|
14
|
-
export declare const OBSOLETE_HOTEDITOR_WARNING: string;
|
|
15
|
-
/**
|
|
16
|
-
* Warning message for the unexpected children of HotTable component.
|
|
17
|
-
*/
|
|
18
|
-
export declare const UNEXPECTED_HOTTABLE_CHILDREN_WARNING: string;
|
|
19
|
-
/**
|
|
20
|
-
* Warning message for the unexpected children of HotColumn component.
|
|
21
|
-
*/
|
|
22
|
-
export declare const UNEXPECTED_HOTCOLUMN_CHILDREN_WARNING: string;
|
|
23
|
-
/**
|
|
24
|
-
* Message for the warning thrown if the Handsontable instance has been destroyed.
|
|
25
|
-
*/
|
|
26
|
-
export declare const HOT_DESTROYED_WARNING: string;
|
|
27
|
-
/**
|
|
28
|
-
* Default classname given to the wrapper container.
|
|
29
|
-
*/
|
|
30
|
-
export declare const DEFAULT_CLASSNAME = "hot-wrapper-editor-container";
|
|
31
|
-
/**
|
|
32
|
-
* Logs warn to the console if the `console` object is exposed.
|
|
33
|
-
*
|
|
34
|
-
* @param {...*} args Values which will be logged.
|
|
35
|
-
*/
|
|
36
|
-
export declare function warn(...args: any[]): void;
|
|
37
|
-
/**
|
|
38
|
-
* Detect if `hot-renderer` or `hot-editor` is defined, and if so, throw an incompatibility warning.
|
|
39
|
-
*
|
|
40
|
-
* @returns {boolean} 'true' if the warning was issued
|
|
41
|
-
*/
|
|
42
|
-
export declare function displayObsoleteRenderersEditorsWarning(children: ReactNode): boolean;
|
|
43
|
-
/**
|
|
44
|
-
* Detect if children of specified type are defined, and if so, throw an incompatibility warning.
|
|
45
|
-
*
|
|
46
|
-
* @param {ReactNode} children Component children nodes
|
|
47
|
-
* @param {ComponentType} Component Component type to check
|
|
48
|
-
* @returns {boolean} 'true' if the warning was issued
|
|
49
|
-
*/
|
|
50
|
-
export declare function displayChildrenOfTypeWarning(children: ReactNode, Component: ComponentType): boolean;
|
|
51
|
-
/**
|
|
52
|
-
* Detect if children is defined, and if so, throw an incompatibility warning.
|
|
53
|
-
*
|
|
54
|
-
* @param {ReactNode} children Component children nodes
|
|
55
|
-
* @returns {boolean} 'true' if the warning was issued
|
|
56
|
-
*/
|
|
57
|
-
export declare function displayAnyChildrenWarning(children: ReactNode): boolean;
|
|
58
|
-
/**
|
|
59
|
-
* Create an editor portal.
|
|
60
|
-
*
|
|
61
|
-
* @param {Document} doc Document to be used.
|
|
62
|
-
* @param {ComponentType} Editor Editor component or render function.
|
|
63
|
-
* @returns {ReactPortal} The portal for the editor.
|
|
64
|
-
*/
|
|
65
|
-
export declare function createEditorPortal(doc: Document | null, Editor: HotTableProps['editor'] | undefined | boolean): ReactPortal | null;
|
|
66
|
-
/**
|
|
67
|
-
* Render a cell component to an external DOM node.
|
|
68
|
-
*
|
|
69
|
-
* @param {React.ReactElement} rElement React element to be used as a base for the component.
|
|
70
|
-
* @param {Document} [ownerDocument] The owner document to set the portal up into.
|
|
71
|
-
* @param {String} portalKey The key to be used for the portal.
|
|
72
|
-
* @param {HTMLElement} [cachedContainer] The cached container to be used for the portal.
|
|
73
|
-
* @returns {{portal: ReactPortal, portalContainer: HTMLElement}} An object containing the portal and its container.
|
|
74
|
-
*/
|
|
75
|
-
export declare function createPortal(rElement: React.ReactElement, ownerDocument: Document | null | undefined, portalKey: string, cachedContainer?: HTMLElement): {
|
|
76
|
-
portal: ReactPortal;
|
|
77
|
-
portalContainer: HTMLElement;
|
|
78
|
-
};
|
|
79
|
-
/**
|
|
80
|
-
* Get an object containing the `id`, `className` and `style` keys, representing the corresponding props passed to the
|
|
81
|
-
* component.
|
|
82
|
-
*
|
|
83
|
-
* @param {HotTableProps} props Object containing the React element props.
|
|
84
|
-
* @param {Boolean} randomizeId If set to `true`, the function will randomize the `id` property when no `id` was present in the `prop` object.
|
|
85
|
-
* @returns An object containing the `id`, `className` and `style` keys, representing the corresponding props passed to the
|
|
86
|
-
* component.
|
|
87
|
-
*/
|
|
88
|
-
export declare function getContainerAttributesProps(props: HotTableProps, randomizeId?: boolean): {
|
|
89
|
-
id?: string;
|
|
90
|
-
className: string;
|
|
91
|
-
style: CSSProperties;
|
|
92
|
-
};
|
|
93
|
-
/**
|
|
94
|
-
* Checks if the environment that the code runs in is a browser.
|
|
95
|
-
*
|
|
96
|
-
* @returns {boolean}
|
|
97
|
-
*/
|
|
98
|
-
export declare function isCSR(): boolean;
|
|
99
|
-
/**
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
* @param
|
|
103
|
-
* @param
|
|
104
|
-
|
|
105
|
-
|
|
1
|
+
import React, { ComponentType, CSSProperties, DependencyList, EffectCallback, ReactNode, ReactPortal } from 'react';
|
|
2
|
+
import { HotTableProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Warning message for the `autoRowSize`/`autoColumnSize` compatibility check.
|
|
5
|
+
*/
|
|
6
|
+
export declare const AUTOSIZE_WARNING: string;
|
|
7
|
+
/**
|
|
8
|
+
* Warning message for the `hot-renderer` obsolete renderer passing method.
|
|
9
|
+
*/
|
|
10
|
+
export declare const OBSOLETE_HOTRENDERER_WARNING: string;
|
|
11
|
+
/**
|
|
12
|
+
* Warning message for the `hot-editor` obsolete editor passing method.
|
|
13
|
+
*/
|
|
14
|
+
export declare const OBSOLETE_HOTEDITOR_WARNING: string;
|
|
15
|
+
/**
|
|
16
|
+
* Warning message for the unexpected children of HotTable component.
|
|
17
|
+
*/
|
|
18
|
+
export declare const UNEXPECTED_HOTTABLE_CHILDREN_WARNING: string;
|
|
19
|
+
/**
|
|
20
|
+
* Warning message for the unexpected children of HotColumn component.
|
|
21
|
+
*/
|
|
22
|
+
export declare const UNEXPECTED_HOTCOLUMN_CHILDREN_WARNING: string;
|
|
23
|
+
/**
|
|
24
|
+
* Message for the warning thrown if the Handsontable instance has been destroyed.
|
|
25
|
+
*/
|
|
26
|
+
export declare const HOT_DESTROYED_WARNING: string;
|
|
27
|
+
/**
|
|
28
|
+
* Default classname given to the wrapper container.
|
|
29
|
+
*/
|
|
30
|
+
export declare const DEFAULT_CLASSNAME = "hot-wrapper-editor-container";
|
|
31
|
+
/**
|
|
32
|
+
* Logs warn to the console if the `console` object is exposed.
|
|
33
|
+
*
|
|
34
|
+
* @param {...*} args Values which will be logged.
|
|
35
|
+
*/
|
|
36
|
+
export declare function warn(...args: any[]): void;
|
|
37
|
+
/**
|
|
38
|
+
* Detect if `hot-renderer` or `hot-editor` is defined, and if so, throw an incompatibility warning.
|
|
39
|
+
*
|
|
40
|
+
* @returns {boolean} 'true' if the warning was issued
|
|
41
|
+
*/
|
|
42
|
+
export declare function displayObsoleteRenderersEditorsWarning(children: ReactNode): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Detect if children of specified type are defined, and if so, throw an incompatibility warning.
|
|
45
|
+
*
|
|
46
|
+
* @param {ReactNode} children Component children nodes
|
|
47
|
+
* @param {ComponentType} Component Component type to check
|
|
48
|
+
* @returns {boolean} 'true' if the warning was issued
|
|
49
|
+
*/
|
|
50
|
+
export declare function displayChildrenOfTypeWarning(children: ReactNode, Component: ComponentType): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Detect if children is defined, and if so, throw an incompatibility warning.
|
|
53
|
+
*
|
|
54
|
+
* @param {ReactNode} children Component children nodes
|
|
55
|
+
* @returns {boolean} 'true' if the warning was issued
|
|
56
|
+
*/
|
|
57
|
+
export declare function displayAnyChildrenWarning(children: ReactNode): boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Create an editor portal.
|
|
60
|
+
*
|
|
61
|
+
* @param {Document} doc Document to be used.
|
|
62
|
+
* @param {ComponentType} Editor Editor component or render function.
|
|
63
|
+
* @returns {ReactPortal} The portal for the editor.
|
|
64
|
+
*/
|
|
65
|
+
export declare function createEditorPortal(doc: Document | null, Editor: HotTableProps['editor'] | undefined | boolean): ReactPortal | null;
|
|
66
|
+
/**
|
|
67
|
+
* Render a cell component to an external DOM node.
|
|
68
|
+
*
|
|
69
|
+
* @param {React.ReactElement} rElement React element to be used as a base for the component.
|
|
70
|
+
* @param {Document} [ownerDocument] The owner document to set the portal up into.
|
|
71
|
+
* @param {String} portalKey The key to be used for the portal.
|
|
72
|
+
* @param {HTMLElement} [cachedContainer] The cached container to be used for the portal.
|
|
73
|
+
* @returns {{portal: ReactPortal, portalContainer: HTMLElement}} An object containing the portal and its container.
|
|
74
|
+
*/
|
|
75
|
+
export declare function createPortal(rElement: React.ReactElement, ownerDocument: Document | null | undefined, portalKey: string, cachedContainer?: HTMLElement): {
|
|
76
|
+
portal: ReactPortal;
|
|
77
|
+
portalContainer: HTMLElement;
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Get an object containing the `id`, `className` and `style` keys, representing the corresponding props passed to the
|
|
81
|
+
* component.
|
|
82
|
+
*
|
|
83
|
+
* @param {HotTableProps} props Object containing the React element props.
|
|
84
|
+
* @param {Boolean} randomizeId If set to `true`, the function will randomize the `id` property when no `id` was present in the `prop` object.
|
|
85
|
+
* @returns An object containing the `id`, `className` and `style` keys, representing the corresponding props passed to the
|
|
86
|
+
* component.
|
|
87
|
+
*/
|
|
88
|
+
export declare function getContainerAttributesProps(props: HotTableProps, randomizeId?: boolean): {
|
|
89
|
+
id?: string;
|
|
90
|
+
className: string;
|
|
91
|
+
style: CSSProperties;
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* Checks if the environment that the code runs in is a browser.
|
|
95
|
+
*
|
|
96
|
+
* @returns {boolean}
|
|
97
|
+
*/
|
|
98
|
+
export declare function isCSR(): boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Deep-compare plain objects and arrays used by wrapper settings.
|
|
101
|
+
*
|
|
102
|
+
* @param {unknown} previousValue Previous value.
|
|
103
|
+
* @param {unknown} currentValue Current value.
|
|
104
|
+
* @returns {boolean} `true` if values are equivalent.
|
|
105
|
+
*/
|
|
106
|
+
export declare function areEquivalentSettingsValue(previousValue: unknown, currentValue: unknown): boolean;
|
|
107
|
+
/**
|
|
108
|
+
* A variant of useEffect hook that does not trigger on initial mount, only updates
|
|
109
|
+
*
|
|
110
|
+
* @param effect Effect function
|
|
111
|
+
* @param deps Effect dependencies
|
|
112
|
+
*/
|
|
113
|
+
export declare function useUpdateEffect(effect: EffectCallback, deps?: DependencyList): void;
|
package/hotColumn.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, { FC } from 'react';
|
|
2
|
-
import { HotColumnProps } from './types';
|
|
3
|
-
declare const isHotColumn: (childNode: any) => childNode is React.ReactElement<any, string | ((props: any, deprecatedLegacyContext?: any) => React.ReactElement<any, any> | null) | (new (props: any, deprecatedLegacyContext?: any) => React.Component<any, any, any>)>;
|
|
4
|
-
declare const HotColumn: FC<HotColumnProps>;
|
|
5
|
-
export { HotColumn, isHotColumn };
|
|
1
|
+
import React, { FC } from 'react';
|
|
2
|
+
import { HotColumnProps } from './types';
|
|
3
|
+
declare const isHotColumn: (childNode: any) => childNode is React.ReactElement<any, string | ((props: any, deprecatedLegacyContext?: any) => React.ReactElement<any, any> | null) | (new (props: any, deprecatedLegacyContext?: any) => React.Component<any, any, any>)>;
|
|
4
|
+
declare const HotColumn: FC<HotColumnProps>;
|
|
5
|
+
export { HotColumn, isHotColumn };
|
package/hotColumnContext.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { FC, PropsWithChildren } from 'react';
|
|
2
|
-
export interface HotColumnContextImpl {
|
|
3
|
-
/**
|
|
4
|
-
* Column index within a HotTable.
|
|
5
|
-
*/
|
|
6
|
-
readonly columnIndex: number;
|
|
7
|
-
/**
|
|
8
|
-
* Get the `Document` object corresponding to the main component element.
|
|
9
|
-
*
|
|
10
|
-
* @returns The `Document` object used by the component.
|
|
11
|
-
*/
|
|
12
|
-
readonly getOwnerDocument: () => Document | null;
|
|
13
|
-
}
|
|
14
|
-
declare const HotColumnContextProvider: FC<PropsWithChildren<HotColumnContextImpl>>;
|
|
15
|
-
declare const useHotColumnContext: () => HotColumnContextImpl;
|
|
16
|
-
export { useHotColumnContext, HotColumnContextProvider };
|
|
1
|
+
import { FC, PropsWithChildren } from 'react';
|
|
2
|
+
export interface HotColumnContextImpl {
|
|
3
|
+
/**
|
|
4
|
+
* Column index within a HotTable.
|
|
5
|
+
*/
|
|
6
|
+
readonly columnIndex: number;
|
|
7
|
+
/**
|
|
8
|
+
* Get the `Document` object corresponding to the main component element.
|
|
9
|
+
*
|
|
10
|
+
* @returns The `Document` object used by the component.
|
|
11
|
+
*/
|
|
12
|
+
readonly getOwnerDocument: () => Document | null;
|
|
13
|
+
}
|
|
14
|
+
declare const HotColumnContextProvider: FC<PropsWithChildren<HotColumnContextImpl>>;
|
|
15
|
+
declare const useHotColumnContext: () => HotColumnContextImpl;
|
|
16
|
+
export { useHotColumnContext, HotColumnContextProvider };
|
package/hotEditor.d.ts
CHANGED
|
@@ -1,73 +1,73 @@
|
|
|
1
|
-
import React, { DependencyList, FC, MutableRefObject, ReactNode, Ref, RefObject, Dispatch } from 'react';
|
|
2
|
-
import Handsontable from 'handsontable/base';
|
|
3
|
-
import { HotEditorHooks, UseHotEditorImpl } from './types';
|
|
4
|
-
/**
|
|
5
|
-
* Create a class to be passed to the Handsontable's settings.
|
|
6
|
-
*
|
|
7
|
-
* @param {RefObject<HotEditorHooks>} hooksRef Reference to component-based editor overridden hooks object.
|
|
8
|
-
* @param {RefObject} instanceRef Reference to Handsontable-native custom editor class instance.
|
|
9
|
-
* @returns {Function} A class to be passed to the Handsontable editor settings.
|
|
10
|
-
*/
|
|
11
|
-
export declare function makeEditorClass(hooksRef: MutableRefObject<HotEditorHooks | null>, instanceRef: MutableRefObject<Handsontable.editors.BaseEditor | null>): typeof Handsontable.editors.BaseEditor;
|
|
12
|
-
interface EditorContextType {
|
|
13
|
-
hooksRef: Ref<HotEditorHooks>;
|
|
14
|
-
hotCustomEditorInstanceRef: RefObject<Handsontable.editors.BaseEditor>;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Context to provide Handsontable-native custom editor class instance to overridden hooks object.
|
|
18
|
-
*/
|
|
19
|
-
export declare const EditorContext: React.Context<EditorContextType | undefined>;
|
|
20
|
-
interface EditorContextProviderProps {
|
|
21
|
-
hooksRef: Ref<HotEditorHooks>;
|
|
22
|
-
hotCustomEditorInstanceRef: RefObject<Handsontable.editors.BaseEditor>;
|
|
23
|
-
children: ReactNode;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Provider of the context that exposes Handsontable-native editor instance and passes hooks object
|
|
27
|
-
* for custom editor components.
|
|
28
|
-
*
|
|
29
|
-
* @param {Ref} hooksRef Reference for component-based editor overridden hooks object.
|
|
30
|
-
* @param {RefObject} hotCustomEditorInstanceRef Reference to Handsontable-native editor instance.
|
|
31
|
-
*/
|
|
32
|
-
export declare const EditorContextProvider: FC<EditorContextProviderProps>;
|
|
33
|
-
/**
|
|
34
|
-
* Hook that allows encapsulating custom behaviours of component-based editor by customizing passed ref with overridden hooks object.
|
|
35
|
-
*
|
|
36
|
-
* @param {HotEditorHooks} overriddenHooks Overrides specific for the custom editor.
|
|
37
|
-
* @param {DependencyList} deps Overridden hooks object React dependency list.
|
|
38
|
-
* @returns {UseHotEditorImpl} Editor API methods
|
|
39
|
-
*/
|
|
40
|
-
export declare function useHotEditor<T>(overriddenHooks?: HotEditorHooks, deps?: DependencyList): UseHotEditorImpl<T>;
|
|
41
|
-
declare type EditorChildrenProps<T> = {
|
|
42
|
-
value: T;
|
|
43
|
-
setValue: Dispatch<T>;
|
|
44
|
-
finishEditing: () => void;
|
|
45
|
-
isOpen: boolean;
|
|
46
|
-
row: number | undefined;
|
|
47
|
-
col: number | undefined;
|
|
48
|
-
mainElementRef: React.RefObject<HTMLDivElement>;
|
|
49
|
-
};
|
|
50
|
-
declare type EditorRenderProp<T> = (props: EditorChildrenProps<T>) => React.ReactNode;
|
|
51
|
-
declare type EditorComponentProps = {
|
|
52
|
-
onPrepare?: (row: number, column: number, prop: string | number, TD: HTMLTableCellElement, originalValue: any, cellProperties: Handsontable.CellProperties) => void;
|
|
53
|
-
onOpen?: () => void;
|
|
54
|
-
onClose?: () => void;
|
|
55
|
-
onFocus?: () => void;
|
|
56
|
-
shortcutsGroup?: string;
|
|
57
|
-
shortcuts?: {
|
|
58
|
-
keys: string[][];
|
|
59
|
-
callback: (props: any, event: KeyboardEvent) => boolean | void;
|
|
60
|
-
group?: string;
|
|
61
|
-
runOnlyIf?: () => boolean;
|
|
62
|
-
captureCtrl?: boolean;
|
|
63
|
-
preventDefault?: boolean;
|
|
64
|
-
stopPropagation?: boolean;
|
|
65
|
-
relativeToGroup?: string;
|
|
66
|
-
position?: "before" | "after";
|
|
67
|
-
forwardToContext?: any;
|
|
68
|
-
}[];
|
|
69
|
-
};
|
|
70
|
-
export declare function EditorComponent<T = any>({ onPrepare, onClose, onOpen, onFocus, children, shortcutsGroup, shortcuts, }: EditorComponentProps & {
|
|
71
|
-
children?: EditorRenderProp<T>;
|
|
72
|
-
}): React.ReactElement;
|
|
73
|
-
export {};
|
|
1
|
+
import React, { DependencyList, FC, MutableRefObject, ReactNode, Ref, RefObject, Dispatch } from 'react';
|
|
2
|
+
import Handsontable from 'handsontable/base';
|
|
3
|
+
import { HotEditorHooks, UseHotEditorImpl } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* Create a class to be passed to the Handsontable's settings.
|
|
6
|
+
*
|
|
7
|
+
* @param {RefObject<HotEditorHooks>} hooksRef Reference to component-based editor overridden hooks object.
|
|
8
|
+
* @param {RefObject} instanceRef Reference to Handsontable-native custom editor class instance.
|
|
9
|
+
* @returns {Function} A class to be passed to the Handsontable editor settings.
|
|
10
|
+
*/
|
|
11
|
+
export declare function makeEditorClass(hooksRef: MutableRefObject<HotEditorHooks | null>, instanceRef: MutableRefObject<Handsontable.editors.BaseEditor | null>): typeof Handsontable.editors.BaseEditor;
|
|
12
|
+
interface EditorContextType {
|
|
13
|
+
hooksRef: Ref<HotEditorHooks>;
|
|
14
|
+
hotCustomEditorInstanceRef: RefObject<Handsontable.editors.BaseEditor>;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Context to provide Handsontable-native custom editor class instance to overridden hooks object.
|
|
18
|
+
*/
|
|
19
|
+
export declare const EditorContext: React.Context<EditorContextType | undefined>;
|
|
20
|
+
interface EditorContextProviderProps {
|
|
21
|
+
hooksRef: Ref<HotEditorHooks>;
|
|
22
|
+
hotCustomEditorInstanceRef: RefObject<Handsontable.editors.BaseEditor>;
|
|
23
|
+
children: ReactNode;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Provider of the context that exposes Handsontable-native editor instance and passes hooks object
|
|
27
|
+
* for custom editor components.
|
|
28
|
+
*
|
|
29
|
+
* @param {Ref} hooksRef Reference for component-based editor overridden hooks object.
|
|
30
|
+
* @param {RefObject} hotCustomEditorInstanceRef Reference to Handsontable-native editor instance.
|
|
31
|
+
*/
|
|
32
|
+
export declare const EditorContextProvider: FC<EditorContextProviderProps>;
|
|
33
|
+
/**
|
|
34
|
+
* Hook that allows encapsulating custom behaviours of component-based editor by customizing passed ref with overridden hooks object.
|
|
35
|
+
*
|
|
36
|
+
* @param {HotEditorHooks} overriddenHooks Overrides specific for the custom editor.
|
|
37
|
+
* @param {DependencyList} deps Overridden hooks object React dependency list.
|
|
38
|
+
* @returns {UseHotEditorImpl} Editor API methods
|
|
39
|
+
*/
|
|
40
|
+
export declare function useHotEditor<T>(overriddenHooks?: HotEditorHooks, deps?: DependencyList): UseHotEditorImpl<T>;
|
|
41
|
+
declare type EditorChildrenProps<T> = {
|
|
42
|
+
value: T;
|
|
43
|
+
setValue: Dispatch<T>;
|
|
44
|
+
finishEditing: () => void;
|
|
45
|
+
isOpen: boolean;
|
|
46
|
+
row: number | undefined;
|
|
47
|
+
col: number | undefined;
|
|
48
|
+
mainElementRef: React.RefObject<HTMLDivElement>;
|
|
49
|
+
};
|
|
50
|
+
declare type EditorRenderProp<T> = (props: EditorChildrenProps<T>) => React.ReactNode;
|
|
51
|
+
declare type EditorComponentProps = {
|
|
52
|
+
onPrepare?: (row: number, column: number, prop: string | number, TD: HTMLTableCellElement, originalValue: any, cellProperties: Handsontable.CellProperties) => void;
|
|
53
|
+
onOpen?: () => void;
|
|
54
|
+
onClose?: () => void;
|
|
55
|
+
onFocus?: () => void;
|
|
56
|
+
shortcutsGroup?: string;
|
|
57
|
+
shortcuts?: {
|
|
58
|
+
keys: string[][];
|
|
59
|
+
callback: (props: any, event: KeyboardEvent) => boolean | void;
|
|
60
|
+
group?: string;
|
|
61
|
+
runOnlyIf?: () => boolean;
|
|
62
|
+
captureCtrl?: boolean;
|
|
63
|
+
preventDefault?: boolean;
|
|
64
|
+
stopPropagation?: boolean;
|
|
65
|
+
relativeToGroup?: string;
|
|
66
|
+
position?: "before" | "after";
|
|
67
|
+
forwardToContext?: any;
|
|
68
|
+
}[];
|
|
69
|
+
};
|
|
70
|
+
export declare function EditorComponent<T = any>({ onPrepare, onClose, onOpen, onFocus, children, shortcutsGroup, shortcuts, }: EditorComponentProps & {
|
|
71
|
+
children?: EditorRenderProp<T>;
|
|
72
|
+
}): React.ReactElement;
|
|
73
|
+
export {};
|
package/hotTable.d.ts
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
2
|
-
import { HotTableProps, HotTableRef } from './types';
|
|
3
|
-
interface Version {
|
|
4
|
-
version?: string;
|
|
5
|
-
}
|
|
6
|
-
declare type HotTable = ForwardRefExoticComponent<HotTableProps & RefAttributes<HotTableRef>> & Version;
|
|
7
|
-
/**
|
|
8
|
-
* A Handsontable-ReactJS wrapper.
|
|
9
|
-
*
|
|
10
|
-
* To implement, use the `HotTable` tag with properties corresponding to Handsontable options.
|
|
11
|
-
* For example:
|
|
12
|
-
*
|
|
13
|
-
* ```js
|
|
14
|
-
* <HotTable id="hot" data={dataObject} contextMenu={true} colHeaders={true} width={600} height={300} stretchH="all" />
|
|
15
|
-
*
|
|
16
|
-
* // is analogous to
|
|
17
|
-
* let hot = new Handsontable(document.getElementById('hot'), {
|
|
18
|
-
* data: dataObject,
|
|
19
|
-
* contextMenu: true,
|
|
20
|
-
* colHeaders: true,
|
|
21
|
-
* width: 600
|
|
22
|
-
* height: 300
|
|
23
|
-
* });
|
|
24
|
-
*
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
declare const HotTable: HotTable;
|
|
28
|
-
export default HotTable;
|
|
29
|
-
export { HotTable };
|
|
1
|
+
import { ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
2
|
+
import { HotTableProps, HotTableRef } from './types';
|
|
3
|
+
interface Version {
|
|
4
|
+
version?: string;
|
|
5
|
+
}
|
|
6
|
+
declare type HotTable = ForwardRefExoticComponent<HotTableProps & RefAttributes<HotTableRef>> & Version;
|
|
7
|
+
/**
|
|
8
|
+
* A Handsontable-ReactJS wrapper.
|
|
9
|
+
*
|
|
10
|
+
* To implement, use the `HotTable` tag with properties corresponding to Handsontable options.
|
|
11
|
+
* For example:
|
|
12
|
+
*
|
|
13
|
+
* ```js
|
|
14
|
+
* <HotTable id="hot" data={dataObject} contextMenu={true} colHeaders={true} width={600} height={300} stretchH="all" />
|
|
15
|
+
*
|
|
16
|
+
* // is analogous to
|
|
17
|
+
* let hot = new Handsontable(document.getElementById('hot'), {
|
|
18
|
+
* data: dataObject,
|
|
19
|
+
* contextMenu: true,
|
|
20
|
+
* colHeaders: true,
|
|
21
|
+
* width: 600
|
|
22
|
+
* height: 300
|
|
23
|
+
* });
|
|
24
|
+
*
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
declare const HotTable: HotTable;
|
|
28
|
+
export default HotTable;
|
|
29
|
+
export { HotTable };
|
package/hotTableContext.d.ts
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
import Handsontable from 'handsontable/base';
|
|
2
|
-
import { ComponentType, FC, PropsWithChildren } from 'react';
|
|
3
|
-
import { ScopeIdentifier, HotRendererProps } from './types';
|
|
4
|
-
import { RenderersPortalManagerRef } from './renderersPortalManager';
|
|
5
|
-
export interface HotTableContextImpl {
|
|
6
|
-
/**
|
|
7
|
-
* Map with column indexes (or a string = 'global') as keys, and booleans as values. Each key represents a component-based editor
|
|
8
|
-
* declared for the used column index, or a global one, if the key is the `global` string.
|
|
9
|
-
*/
|
|
10
|
-
readonly componentRendererColumns: Map<ScopeIdentifier, boolean>;
|
|
11
|
-
/**
|
|
12
|
-
* Array of object containing the column settings.
|
|
13
|
-
*/
|
|
14
|
-
readonly columnsSettings: Handsontable.ColumnSettings[];
|
|
15
|
-
/**
|
|
16
|
-
* Sets the column settings based on information received from HotColumn.
|
|
17
|
-
*
|
|
18
|
-
* @param {HotTableProps} columnSettings Column settings object.
|
|
19
|
-
* @param {Number} columnIndex Column index.
|
|
20
|
-
*/
|
|
21
|
-
readonly emitColumnSettings: (columnSettings: Handsontable.ColumnSettings, columnIndex: number) => void;
|
|
22
|
-
/**
|
|
23
|
-
* Return a renderer wrapper function for the provided renderer component.
|
|
24
|
-
*
|
|
25
|
-
* @param {ComponentType<HotRendererProps>} Renderer React renderer component.
|
|
26
|
-
* @returns {Handsontable.renderers.BaseRenderer} The Handsontable rendering function.
|
|
27
|
-
*/
|
|
28
|
-
readonly getRendererWrapper: (Renderer: ComponentType<HotRendererProps>) => typeof Handsontable.renderers.BaseRenderer;
|
|
29
|
-
/**
|
|
30
|
-
* Clears portals cache.
|
|
31
|
-
*/
|
|
32
|
-
readonly clearPortalCache: () => void;
|
|
33
|
-
/**
|
|
34
|
-
* Clears rendered cells cache.
|
|
35
|
-
*/
|
|
36
|
-
readonly clearRenderedCellCache: () => void;
|
|
37
|
-
/**
|
|
38
|
-
* Set the renderers portal manager dispatch function.
|
|
39
|
-
*
|
|
40
|
-
* @param {RenderersPortalManagerRef} pm The PortalManager dispatch function.
|
|
41
|
-
*/
|
|
42
|
-
readonly setRenderersPortalManagerRef: (pm: RenderersPortalManagerRef) => void;
|
|
43
|
-
/**
|
|
44
|
-
* Puts cell portals into portal manager and purges portals cache.
|
|
45
|
-
*/
|
|
46
|
-
readonly pushCellPortalsIntoPortalManager: () => void;
|
|
47
|
-
}
|
|
48
|
-
declare const HotTableContextProvider: FC<PropsWithChildren>;
|
|
49
|
-
/**
|
|
50
|
-
* Exposes the table context object to components
|
|
51
|
-
*
|
|
52
|
-
* @returns HotTableContext
|
|
53
|
-
*/
|
|
54
|
-
declare function useHotTableContext(): HotTableContextImpl;
|
|
55
|
-
export { HotTableContextProvider, useHotTableContext };
|
|
1
|
+
import Handsontable from 'handsontable/base';
|
|
2
|
+
import { ComponentType, FC, PropsWithChildren } from 'react';
|
|
3
|
+
import { ScopeIdentifier, HotRendererProps } from './types';
|
|
4
|
+
import { RenderersPortalManagerRef } from './renderersPortalManager';
|
|
5
|
+
export interface HotTableContextImpl {
|
|
6
|
+
/**
|
|
7
|
+
* Map with column indexes (or a string = 'global') as keys, and booleans as values. Each key represents a component-based editor
|
|
8
|
+
* declared for the used column index, or a global one, if the key is the `global` string.
|
|
9
|
+
*/
|
|
10
|
+
readonly componentRendererColumns: Map<ScopeIdentifier, boolean>;
|
|
11
|
+
/**
|
|
12
|
+
* Array of object containing the column settings.
|
|
13
|
+
*/
|
|
14
|
+
readonly columnsSettings: Handsontable.ColumnSettings[];
|
|
15
|
+
/**
|
|
16
|
+
* Sets the column settings based on information received from HotColumn.
|
|
17
|
+
*
|
|
18
|
+
* @param {HotTableProps} columnSettings Column settings object.
|
|
19
|
+
* @param {Number} columnIndex Column index.
|
|
20
|
+
*/
|
|
21
|
+
readonly emitColumnSettings: (columnSettings: Handsontable.ColumnSettings, columnIndex: number) => void;
|
|
22
|
+
/**
|
|
23
|
+
* Return a renderer wrapper function for the provided renderer component.
|
|
24
|
+
*
|
|
25
|
+
* @param {ComponentType<HotRendererProps>} Renderer React renderer component.
|
|
26
|
+
* @returns {Handsontable.renderers.BaseRenderer} The Handsontable rendering function.
|
|
27
|
+
*/
|
|
28
|
+
readonly getRendererWrapper: (Renderer: ComponentType<HotRendererProps>) => typeof Handsontable.renderers.BaseRenderer;
|
|
29
|
+
/**
|
|
30
|
+
* Clears portals cache.
|
|
31
|
+
*/
|
|
32
|
+
readonly clearPortalCache: () => void;
|
|
33
|
+
/**
|
|
34
|
+
* Clears rendered cells cache.
|
|
35
|
+
*/
|
|
36
|
+
readonly clearRenderedCellCache: () => void;
|
|
37
|
+
/**
|
|
38
|
+
* Set the renderers portal manager dispatch function.
|
|
39
|
+
*
|
|
40
|
+
* @param {RenderersPortalManagerRef} pm The PortalManager dispatch function.
|
|
41
|
+
*/
|
|
42
|
+
readonly setRenderersPortalManagerRef: (pm: RenderersPortalManagerRef) => void;
|
|
43
|
+
/**
|
|
44
|
+
* Puts cell portals into portal manager and purges portals cache.
|
|
45
|
+
*/
|
|
46
|
+
readonly pushCellPortalsIntoPortalManager: () => void;
|
|
47
|
+
}
|
|
48
|
+
declare const HotTableContextProvider: FC<PropsWithChildren>;
|
|
49
|
+
/**
|
|
50
|
+
* Exposes the table context object to components
|
|
51
|
+
*
|
|
52
|
+
* @returns HotTableContext
|
|
53
|
+
*/
|
|
54
|
+
declare function useHotTableContext(): HotTableContextImpl;
|
|
55
|
+
export { HotTableContextProvider, useHotTableContext };
|
package/hotTableInner.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { HotTableProps, HotTableRef } from './types';
|
|
3
|
-
declare const HotTableInner: React.ForwardRefExoticComponent<HotTableProps & React.RefAttributes<HotTableRef>>;
|
|
4
|
-
export default HotTableInner;
|
|
5
|
-
export { HotTableInner };
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { HotTableProps, HotTableRef } from './types';
|
|
3
|
+
declare const HotTableInner: React.ForwardRefExoticComponent<HotTableProps & React.RefAttributes<HotTableRef>>;
|
|
4
|
+
export default HotTableInner;
|
|
5
|
+
export { HotTableInner };
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from './hotColumn';
|
|
2
|
-
export * from './hotTable';
|
|
3
|
-
export { useHotEditor, EditorComponent, EditorContext } from './hotEditor';
|
|
4
|
-
export * from './types';
|
|
5
|
-
export { default } from './hotTable';
|
|
1
|
+
export * from './hotColumn';
|
|
2
|
+
export * from './hotTable';
|
|
3
|
+
export { useHotEditor, EditorComponent, EditorContext } from './hotEditor';
|
|
4
|
+
export * from './types';
|
|
5
|
+
export { default } from './hotTable';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@handsontable/react-wrapper",
|
|
3
|
-
"version": "17.0
|
|
3
|
+
"version": "17.1.0-rc1",
|
|
4
4
|
"description": "Best Data Grid for React with Spreadsheet Look and Feel.",
|
|
5
5
|
"author": "Handsoncode <hello@handsoncode.net> (https://handsoncode.net)",
|
|
6
6
|
"homepage": "https://handsontable.com",
|
|
@@ -80,7 +80,6 @@
|
|
|
80
80
|
"react-dom": "^18.2.0",
|
|
81
81
|
"react-redux": "^7.1.1",
|
|
82
82
|
"redux": "^4.0.4",
|
|
83
|
-
"rimraf": "^3.0.2",
|
|
84
83
|
"rollup": "^4.52.5",
|
|
85
84
|
"rollup-plugin-alias": "^1.5.2",
|
|
86
85
|
"rollup-plugin-typescript2": "^0.36.0",
|
|
@@ -96,8 +95,8 @@
|
|
|
96
95
|
"build:umd": "cross-env NODE_ENV=umd rollup -c --bundleConfigAsCjs",
|
|
97
96
|
"build:es": "cross-env NODE_ENV=es rollup -c --bundleConfigAsCjs",
|
|
98
97
|
"build:min": "cross-env NODE_ENV=min rollup -c --bundleConfigAsCjs",
|
|
99
|
-
"prepare:types": "
|
|
100
|
-
"clean": "
|
|
98
|
+
"prepare:types": "node scripts/prepare-types.mjs",
|
|
99
|
+
"clean": "node scripts/clean.mjs",
|
|
101
100
|
"publish-package": "npm publish",
|
|
102
101
|
"create-package": "npm pack",
|
|
103
102
|
"test": "jest",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React, { Dispatch, ReactPortal } from 'react';
|
|
2
|
-
export declare type RenderersPortalManagerRef = Dispatch<ReactPortal[]>;
|
|
3
|
-
/**
|
|
4
|
-
* Component used to manage the renderer component portals.
|
|
5
|
-
*/
|
|
6
|
-
export declare const RenderersPortalManager: React.ForwardRefExoticComponent<React.RefAttributes<React.Dispatch<React.ReactPortal[]>>>;
|
|
1
|
+
import React, { Dispatch, ReactPortal } from 'react';
|
|
2
|
+
export declare type RenderersPortalManagerRef = Dispatch<ReactPortal[]>;
|
|
3
|
+
/**
|
|
4
|
+
* Component used to manage the renderer component portals.
|
|
5
|
+
*/
|
|
6
|
+
export declare const RenderersPortalManager: React.ForwardRefExoticComponent<React.RefAttributes<React.Dispatch<React.ReactPortal[]>>>;
|