@handsontable/react 0.0.0-next-9ec04ce-20221121
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/LICENSE.txt +25 -0
- package/README.md +123 -0
- package/baseEditorComponent.d.ts +45 -0
- package/commonjs/react-handsontable.js +2514 -0
- package/dist/react-handsontable.js +1768 -0
- package/dist/react-handsontable.js.map +1 -0
- package/dist/react-handsontable.min.js +31 -0
- package/dist/react-handsontable.min.js.map +1 -0
- package/es/react-handsontable.mjs +2501 -0
- package/handsontable-non-commercial-license.pdf +0 -0
- package/helpers.d.ts +99 -0
- package/hotColumn.d.ts +82 -0
- package/hotTable.d.ts +277 -0
- package/index.d.ts +5 -0
- package/package.json +130 -0
- package/portalManager.d.ts +10 -0
- package/settingsMapper.d.ts +11 -0
- package/types.d.ts +49 -0
|
Binary file
|
package/helpers.d.ts
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { HotEditorCache, HotEditorElement } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Warning message for the `autoRowSize`/`autoColumnSize` compatibility check.
|
|
5
|
+
*/
|
|
6
|
+
export declare const AUTOSIZE_WARNING: string;
|
|
7
|
+
/**
|
|
8
|
+
* Message for the warning thrown if the Handsontable instance has been destroyed.
|
|
9
|
+
*/
|
|
10
|
+
export declare const HOT_DESTROYED_WARNING: string;
|
|
11
|
+
/**
|
|
12
|
+
* String identifier for the global-scoped editor components.
|
|
13
|
+
*/
|
|
14
|
+
export declare const GLOBAL_EDITOR_SCOPE = "global";
|
|
15
|
+
/**
|
|
16
|
+
* Logs warn to the console if the `console` object is exposed.
|
|
17
|
+
*
|
|
18
|
+
* @param {...*} args Values which will be logged.
|
|
19
|
+
*/
|
|
20
|
+
export declare function warn(...args: any[]): void;
|
|
21
|
+
/**
|
|
22
|
+
* Filter out and return elements of the provided `type` from the `HotColumn` component's children.
|
|
23
|
+
*
|
|
24
|
+
* @param {React.ReactNode} children HotTable children array.
|
|
25
|
+
* @param {String} type Either `'hot-renderer'` or `'hot-editor'`.
|
|
26
|
+
* @returns {Object|null} A child (React node) or `null`, if no child of that type was found.
|
|
27
|
+
*/
|
|
28
|
+
export declare function getChildElementByType(children: React.ReactNode, type: string): React.ReactElement | null;
|
|
29
|
+
/**
|
|
30
|
+
* Get the reference to the original editor class.
|
|
31
|
+
*
|
|
32
|
+
* @param {React.ReactElement} editorElement React element of the editor class.
|
|
33
|
+
* @returns {Function} Original class of the editor component.
|
|
34
|
+
*/
|
|
35
|
+
export declare function getOriginalEditorClass(editorElement: HotEditorElement): any;
|
|
36
|
+
/**
|
|
37
|
+
* Remove editor containers from DOM.
|
|
38
|
+
*
|
|
39
|
+
* @param {Document} [doc] Document to be used.
|
|
40
|
+
* @param {Map} editorCache The editor cache reference.
|
|
41
|
+
*/
|
|
42
|
+
export declare function removeEditorContainers(doc?: Document): void;
|
|
43
|
+
/**
|
|
44
|
+
* Create an editor portal.
|
|
45
|
+
*
|
|
46
|
+
* @param {Document} [doc] Document to be used.
|
|
47
|
+
* @param {React.ReactElement} editorElement Editor's element.
|
|
48
|
+
* @param {Map} editorCache The editor cache reference.
|
|
49
|
+
* @returns {React.ReactPortal} The portal for the editor.
|
|
50
|
+
*/
|
|
51
|
+
export declare function createEditorPortal(doc: Document, editorElement: HotEditorElement, editorCache: HotEditorCache): React.ReactPortal;
|
|
52
|
+
/**
|
|
53
|
+
* Get an editor element extended with a instance-emitting method.
|
|
54
|
+
*
|
|
55
|
+
* @param {React.ReactNode} children Component children.
|
|
56
|
+
* @param {Map} editorCache Component's editor cache.
|
|
57
|
+
* @param {string|number} [editorColumnScope] The editor scope (column index or a 'global' string). Defaults to
|
|
58
|
+
* 'global'.
|
|
59
|
+
* @returns {React.ReactElement} An editor element containing the additional methods.
|
|
60
|
+
*/
|
|
61
|
+
export declare function getExtendedEditorElement(children: React.ReactNode, editorCache: HotEditorCache, editorColumnScope?: string | number): React.ReactElement | null;
|
|
62
|
+
/**
|
|
63
|
+
* Create a react component and render it to an external DOM done.
|
|
64
|
+
*
|
|
65
|
+
* @param {React.ReactElement} rElement React element to be used as a base for the component.
|
|
66
|
+
* @param {Object} props Props to be passed to the cloned element.
|
|
67
|
+
* @param {Function} callback Callback to be called after the component has been mounted.
|
|
68
|
+
* @param {Document} [ownerDocument] The owner document to set the portal up into.
|
|
69
|
+
* @returns {{portal: React.ReactPortal, portalContainer: HTMLElement}} An object containing the portal and its container.
|
|
70
|
+
*/
|
|
71
|
+
export declare function createPortal(rElement: React.ReactElement, props: any, callback: Function, ownerDocument?: Document): {
|
|
72
|
+
portal: React.ReactPortal;
|
|
73
|
+
portalContainer: HTMLElement;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Get an object containing the `id`, `className` and `style` keys, representing the corresponding props passed to the
|
|
77
|
+
* component.
|
|
78
|
+
*
|
|
79
|
+
* @param {Object} props Object containing the react element props.
|
|
80
|
+
* @param {Boolean} randomizeId If set to `true`, the function will randomize the `id` property when no `id` was present in the `prop` object.
|
|
81
|
+
* @returns An object containing the `id`, `className` and `style` keys, representing the corresponding props passed to the
|
|
82
|
+
* component.
|
|
83
|
+
*/
|
|
84
|
+
export declare function getContainerAttributesProps(props: any, randomizeId?: boolean): {
|
|
85
|
+
id: string;
|
|
86
|
+
className: string;
|
|
87
|
+
style: object;
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Add the `UNSAFE_` prefixes to the deprecated lifecycle methods for React >= 16.3.
|
|
91
|
+
*
|
|
92
|
+
* @param {Object} instance Instance to have the methods renamed.
|
|
93
|
+
*/
|
|
94
|
+
export declare function addUnsafePrefixes(instance: {
|
|
95
|
+
UNSAFE_componentWillUpdate?: Function;
|
|
96
|
+
componentWillUpdate: Function;
|
|
97
|
+
UNSAFE_componentWillMount?: Function;
|
|
98
|
+
componentWillMount: Function;
|
|
99
|
+
}): void;
|
package/hotColumn.d.ts
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import React, { ReactPortal } from 'react';
|
|
2
|
+
import { HotTableProps, HotColumnProps } from './types';
|
|
3
|
+
import Handsontable from 'handsontable/base';
|
|
4
|
+
declare class HotColumn extends React.Component<HotColumnProps, {}> {
|
|
5
|
+
internalProps: string[];
|
|
6
|
+
columnSettings: Handsontable.ColumnSettings;
|
|
7
|
+
/**
|
|
8
|
+
* Local editor portal cache.
|
|
9
|
+
*
|
|
10
|
+
* @private
|
|
11
|
+
* @type {ReactPortal}
|
|
12
|
+
*/
|
|
13
|
+
private localEditorPortal;
|
|
14
|
+
/**
|
|
15
|
+
* HotColumn class constructor.
|
|
16
|
+
*
|
|
17
|
+
* @param {HotColumnProps} props Component props.
|
|
18
|
+
* @param {*} [context] Component context.
|
|
19
|
+
*/
|
|
20
|
+
constructor(props: HotColumnProps, context?: any);
|
|
21
|
+
/**
|
|
22
|
+
* Get the local editor portal cache property.
|
|
23
|
+
*
|
|
24
|
+
* @return {ReactPortal} Local editor portal.
|
|
25
|
+
*/
|
|
26
|
+
getLocalEditorPortal(): ReactPortal;
|
|
27
|
+
/**
|
|
28
|
+
* Set the local editor portal cache property.
|
|
29
|
+
*
|
|
30
|
+
* @param {ReactPortal} portal Local editor portal.
|
|
31
|
+
*/
|
|
32
|
+
setLocalEditorPortal(portal: any): void;
|
|
33
|
+
/**
|
|
34
|
+
* Filter out all the internal properties and return an object with just the Handsontable-related props.
|
|
35
|
+
*
|
|
36
|
+
* @returns {Object}
|
|
37
|
+
*/
|
|
38
|
+
getSettingsProps(): HotTableProps;
|
|
39
|
+
/**
|
|
40
|
+
* Get the editor element for the current column.
|
|
41
|
+
*
|
|
42
|
+
* @returns {React.ReactElement} React editor component element.
|
|
43
|
+
*/
|
|
44
|
+
getLocalEditorElement(): React.ReactElement | null;
|
|
45
|
+
/**
|
|
46
|
+
* Create the column settings based on the data provided to the `HotColumn` component and it's child components.
|
|
47
|
+
*/
|
|
48
|
+
createColumnSettings(): void;
|
|
49
|
+
/**
|
|
50
|
+
* Create the local editor portal and its destination HTML element if needed.
|
|
51
|
+
*
|
|
52
|
+
* @param {React.ReactNode} [children] Children of the HotTable instance. Defaults to `this.props.children`.
|
|
53
|
+
*/
|
|
54
|
+
createLocalEditorPortal(children?: React.ReactNode): void;
|
|
55
|
+
/**
|
|
56
|
+
* Emit the column settings to the parent using a prop passed from the parent.
|
|
57
|
+
*/
|
|
58
|
+
emitColumnSettings(): void;
|
|
59
|
+
/**
|
|
60
|
+
* Logic performed before the mounting of the HotColumn component.
|
|
61
|
+
*/
|
|
62
|
+
componentWillMount(): void;
|
|
63
|
+
/**
|
|
64
|
+
* Logic performed after the mounting of the HotColumn component.
|
|
65
|
+
*/
|
|
66
|
+
componentDidMount(): void;
|
|
67
|
+
/**
|
|
68
|
+
* Logic performed before the updating of the HotColumn component.
|
|
69
|
+
*/
|
|
70
|
+
componentWillUpdate(nextProps: Readonly<HotColumnProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
71
|
+
/**
|
|
72
|
+
* Logic performed after the updating of the HotColumn component.
|
|
73
|
+
*/
|
|
74
|
+
componentDidUpdate(): void;
|
|
75
|
+
/**
|
|
76
|
+
* Render the portals of the editors, if there are any.
|
|
77
|
+
*
|
|
78
|
+
* @returns {React.ReactElement}
|
|
79
|
+
*/
|
|
80
|
+
render(): React.ReactElement;
|
|
81
|
+
}
|
|
82
|
+
export { HotColumn };
|
package/hotTable.d.ts
ADDED
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Handsontable from 'handsontable/base';
|
|
3
|
+
import { PortalManager } from './portalManager';
|
|
4
|
+
import { HotTableProps, HotEditorElement, HotEditorCache, EditorScopeIdentifier } from './types';
|
|
5
|
+
/**
|
|
6
|
+
* A Handsontable-ReactJS wrapper.
|
|
7
|
+
*
|
|
8
|
+
* To implement, use the `HotTable` tag with properties corresponding to Handsontable options.
|
|
9
|
+
* For example:
|
|
10
|
+
*
|
|
11
|
+
* ```js
|
|
12
|
+
* <HotTable id="hot" data={dataObject} contextMenu={true} colHeaders={true} width={600} height={300} stretchH="all" />
|
|
13
|
+
*
|
|
14
|
+
* // is analogous to
|
|
15
|
+
* let hot = new Handsontable(document.getElementById('hot'), {
|
|
16
|
+
* data: dataObject,
|
|
17
|
+
* contextMenu: true,
|
|
18
|
+
* colHeaders: true,
|
|
19
|
+
* width: 600
|
|
20
|
+
* height: 300
|
|
21
|
+
* });
|
|
22
|
+
*
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @class HotTable
|
|
26
|
+
*/
|
|
27
|
+
declare class HotTable extends React.Component<HotTableProps, {}> {
|
|
28
|
+
/**
|
|
29
|
+
* The `id` of the main Handsontable DOM element.
|
|
30
|
+
*
|
|
31
|
+
* @type {String}
|
|
32
|
+
*/
|
|
33
|
+
id: string;
|
|
34
|
+
/**
|
|
35
|
+
* Reference to the Handsontable instance.
|
|
36
|
+
*
|
|
37
|
+
* @private
|
|
38
|
+
* @type {Object}
|
|
39
|
+
*/
|
|
40
|
+
__hotInstance: Handsontable | null;
|
|
41
|
+
/**
|
|
42
|
+
* Reference to the main Handsontable DOM element.
|
|
43
|
+
*
|
|
44
|
+
* @type {HTMLElement}
|
|
45
|
+
*/
|
|
46
|
+
hotElementRef: HTMLElement;
|
|
47
|
+
/**
|
|
48
|
+
* Class name added to the component DOM element.
|
|
49
|
+
*
|
|
50
|
+
* @type {String}
|
|
51
|
+
*/
|
|
52
|
+
className: string;
|
|
53
|
+
/**
|
|
54
|
+
* Style object passed to the component.
|
|
55
|
+
*
|
|
56
|
+
* @type {React.CSSProperties}
|
|
57
|
+
*/
|
|
58
|
+
style: React.CSSProperties;
|
|
59
|
+
/**
|
|
60
|
+
* Array of object containing the column settings.
|
|
61
|
+
*
|
|
62
|
+
* @type {Array}
|
|
63
|
+
*/
|
|
64
|
+
columnSettings: Handsontable.ColumnSettings[];
|
|
65
|
+
/**
|
|
66
|
+
* Component used to manage the renderer portals.
|
|
67
|
+
*
|
|
68
|
+
* @type {React.Component}
|
|
69
|
+
*/
|
|
70
|
+
portalManager: PortalManager;
|
|
71
|
+
/**
|
|
72
|
+
* Array containing the portals cashed to be rendered in bulk after Handsontable's render cycle.
|
|
73
|
+
*/
|
|
74
|
+
portalCacheArray: React.ReactPortal[];
|
|
75
|
+
/**
|
|
76
|
+
* Global editor portal cache.
|
|
77
|
+
*
|
|
78
|
+
* @private
|
|
79
|
+
* @type {React.ReactPortal}
|
|
80
|
+
*/
|
|
81
|
+
private globalEditorPortal;
|
|
82
|
+
/**
|
|
83
|
+
* The rendered cells cache.
|
|
84
|
+
*
|
|
85
|
+
* @private
|
|
86
|
+
* @type {Map}
|
|
87
|
+
*/
|
|
88
|
+
private renderedCellCache;
|
|
89
|
+
/**
|
|
90
|
+
* Editor cache.
|
|
91
|
+
*
|
|
92
|
+
* @private
|
|
93
|
+
* @type {Map}
|
|
94
|
+
*/
|
|
95
|
+
private editorCache;
|
|
96
|
+
/**
|
|
97
|
+
* Map with column indexes (or a string = 'global') as keys, and booleans as values. Each key represents a component-based editor
|
|
98
|
+
* declared for the used column index, or a global one, if the key is the `global` string.
|
|
99
|
+
*
|
|
100
|
+
* @private
|
|
101
|
+
* @type {Map}
|
|
102
|
+
*/
|
|
103
|
+
private componentRendererColumns;
|
|
104
|
+
/**
|
|
105
|
+
* HotTable class constructor.
|
|
106
|
+
*
|
|
107
|
+
* @param {HotTableProps} props Component props.
|
|
108
|
+
* @param {*} [context] Component context.
|
|
109
|
+
*/
|
|
110
|
+
constructor(props: HotTableProps, context?: any);
|
|
111
|
+
/**
|
|
112
|
+
* Package version getter.
|
|
113
|
+
*
|
|
114
|
+
* @returns The version number of the package.
|
|
115
|
+
*/
|
|
116
|
+
static get version(): string;
|
|
117
|
+
/**
|
|
118
|
+
* Getter for the property storing the Handsontable instance.
|
|
119
|
+
*/
|
|
120
|
+
get hotInstance(): Handsontable | null;
|
|
121
|
+
/**
|
|
122
|
+
* Setter for the property storing the Handsontable instance.
|
|
123
|
+
* @param {Handsontable} hotInstance The Handsontable instance.
|
|
124
|
+
*/
|
|
125
|
+
set hotInstance(hotInstance: Handsontable | null);
|
|
126
|
+
/**
|
|
127
|
+
* Prop types to be checked at runtime.
|
|
128
|
+
*/
|
|
129
|
+
static propTypes: object;
|
|
130
|
+
/**
|
|
131
|
+
* Get the rendered table cell cache.
|
|
132
|
+
*
|
|
133
|
+
* @returns {Map}
|
|
134
|
+
*/
|
|
135
|
+
getRenderedCellCache(): Map<string, HTMLTableCellElement>;
|
|
136
|
+
/**
|
|
137
|
+
* Get the editor cache and return it.
|
|
138
|
+
*
|
|
139
|
+
* @returns {Map}
|
|
140
|
+
*/
|
|
141
|
+
getEditorCache(): HotEditorCache;
|
|
142
|
+
/**
|
|
143
|
+
* Get the global editor portal property.
|
|
144
|
+
*
|
|
145
|
+
* @return {React.ReactPortal} The global editor portal.
|
|
146
|
+
*/
|
|
147
|
+
getGlobalEditorPortal(): React.ReactPortal;
|
|
148
|
+
/**
|
|
149
|
+
* Set the private editor portal cache property.
|
|
150
|
+
*
|
|
151
|
+
* @param {React.ReactPortal} portal Global editor portal.
|
|
152
|
+
*/
|
|
153
|
+
setGlobalEditorPortal(portal: React.ReactPortal): void;
|
|
154
|
+
/**
|
|
155
|
+
* Clear both the editor and the renderer cache.
|
|
156
|
+
*/
|
|
157
|
+
clearCache(): void;
|
|
158
|
+
/**
|
|
159
|
+
* Get the `Document` object corresponding to the main component element.
|
|
160
|
+
*
|
|
161
|
+
* @returns The `Document` object used by the component.
|
|
162
|
+
*/
|
|
163
|
+
getOwnerDocument(): Document;
|
|
164
|
+
/**
|
|
165
|
+
* Set the reference to the main Handsontable DOM element.
|
|
166
|
+
*
|
|
167
|
+
* @param {HTMLElement} element The main Handsontable DOM element.
|
|
168
|
+
*/
|
|
169
|
+
private setHotElementRef;
|
|
170
|
+
/**
|
|
171
|
+
* Return a renderer wrapper function for the provided renderer component.
|
|
172
|
+
*
|
|
173
|
+
* @param {React.ReactElement} rendererElement React renderer component.
|
|
174
|
+
* @returns {Handsontable.renderers.Base} The Handsontable rendering function.
|
|
175
|
+
*/
|
|
176
|
+
getRendererWrapper(rendererElement: React.ReactElement): typeof Handsontable.renderers.BaseRenderer | any;
|
|
177
|
+
/**
|
|
178
|
+
* Create a fresh class to be used as an editor, based on the provided editor React element.
|
|
179
|
+
*
|
|
180
|
+
* @param {React.ReactElement} editorElement React editor component.
|
|
181
|
+
* @param {string|number} [editorColumnScope] The editor scope (column index or a 'global' string). Defaults to
|
|
182
|
+
* 'global'.
|
|
183
|
+
* @returns {Function} A class to be passed to the Handsontable editor settings.
|
|
184
|
+
*/
|
|
185
|
+
getEditorClass(editorElement: HotEditorElement, editorColumnScope?: EditorScopeIdentifier): typeof Handsontable.editors.BaseEditor;
|
|
186
|
+
/**
|
|
187
|
+
* Create a class to be passed to the Handsontable's settings.
|
|
188
|
+
*
|
|
189
|
+
* @param {React.ReactElement} editorComponent React editor component.
|
|
190
|
+
* @returns {Function} A class to be passed to the Handsontable editor settings.
|
|
191
|
+
*/
|
|
192
|
+
makeEditorClass(editorComponent: React.Component): typeof Handsontable.editors.BaseEditor;
|
|
193
|
+
/**
|
|
194
|
+
* Get the renderer element for the entire HotTable instance.
|
|
195
|
+
*
|
|
196
|
+
* @returns {React.ReactElement} React renderer component element.
|
|
197
|
+
*/
|
|
198
|
+
getGlobalRendererElement(): React.ReactElement;
|
|
199
|
+
/**
|
|
200
|
+
* Get the editor element for the entire HotTable instance.
|
|
201
|
+
*
|
|
202
|
+
* @param {React.ReactNode} [children] Children of the HotTable instance. Defaults to `this.props.children`.
|
|
203
|
+
* @returns {React.ReactElement} React editor component element.
|
|
204
|
+
*/
|
|
205
|
+
getGlobalEditorElement(children?: React.ReactNode): HotEditorElement | null;
|
|
206
|
+
/**
|
|
207
|
+
* Create the global editor portal and its destination HTML element if needed.
|
|
208
|
+
*
|
|
209
|
+
* @param {React.ReactNode} [children] Children of the HotTable instance. Defaults to `this.props.children`.
|
|
210
|
+
*/
|
|
211
|
+
createGlobalEditorPortal(children?: React.ReactNode): void;
|
|
212
|
+
/**
|
|
213
|
+
* Create a new settings object containing the column settings and global editors and renderers.
|
|
214
|
+
*
|
|
215
|
+
* @returns {Handsontable.GridSettings} New global set of settings for Handsontable.
|
|
216
|
+
*/
|
|
217
|
+
createNewGlobalSettings(): Handsontable.GridSettings;
|
|
218
|
+
/**
|
|
219
|
+
* Detect if `autoRowSize` or `autoColumnSize` is defined, and if so, throw an incompatibility warning.
|
|
220
|
+
*
|
|
221
|
+
* @param {Handsontable.GridSettings} newGlobalSettings New global settings passed as Handsontable config.
|
|
222
|
+
*/
|
|
223
|
+
displayAutoSizeWarning(newGlobalSettings: Handsontable.GridSettings): void;
|
|
224
|
+
/**
|
|
225
|
+
* Sets the column settings based on information received from HotColumn.
|
|
226
|
+
*
|
|
227
|
+
* @param {HotTableProps} columnSettings Column settings object.
|
|
228
|
+
* @param {Number} columnIndex Column index.
|
|
229
|
+
*/
|
|
230
|
+
setHotColumnSettings(columnSettings: Handsontable.ColumnSettings, columnIndex: number): void;
|
|
231
|
+
/**
|
|
232
|
+
* Handsontable's `beforeViewRender` hook callback.
|
|
233
|
+
*/
|
|
234
|
+
handsontableBeforeViewRender(): void;
|
|
235
|
+
/**
|
|
236
|
+
* Handsontable's `afterViewRender` hook callback.
|
|
237
|
+
*/
|
|
238
|
+
handsontableAfterViewRender(): void;
|
|
239
|
+
/**
|
|
240
|
+
* Call the `updateSettings` method for the Handsontable instance.
|
|
241
|
+
*
|
|
242
|
+
* @param {Object} newSettings The settings object.
|
|
243
|
+
*/
|
|
244
|
+
private updateHot;
|
|
245
|
+
/**
|
|
246
|
+
* Set the portal manager ref.
|
|
247
|
+
*
|
|
248
|
+
* @param {React.ReactComponent} pmComponent The PortalManager component.
|
|
249
|
+
*/
|
|
250
|
+
private setPortalManagerRef;
|
|
251
|
+
/**
|
|
252
|
+
* Logic performed before the mounting of the component.
|
|
253
|
+
*/
|
|
254
|
+
componentWillMount(): void;
|
|
255
|
+
/**
|
|
256
|
+
* Initialize Handsontable after the component has mounted.
|
|
257
|
+
*/
|
|
258
|
+
componentDidMount(): void;
|
|
259
|
+
/**
|
|
260
|
+
* Logic performed before the component update.
|
|
261
|
+
*/
|
|
262
|
+
componentWillUpdate(nextProps: Readonly<HotTableProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
263
|
+
/**
|
|
264
|
+
* Logic performed after the component update.
|
|
265
|
+
*/
|
|
266
|
+
componentDidUpdate(): void;
|
|
267
|
+
/**
|
|
268
|
+
* Destroy the Handsontable instance when the parent component unmounts.
|
|
269
|
+
*/
|
|
270
|
+
componentWillUnmount(): void;
|
|
271
|
+
/**
|
|
272
|
+
* Render the component.
|
|
273
|
+
*/
|
|
274
|
+
render(): React.ReactElement;
|
|
275
|
+
}
|
|
276
|
+
export default HotTable;
|
|
277
|
+
export { HotTable };
|
package/index.d.ts
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@handsontable/react",
|
|
3
|
+
"version": "0.0.0-next-9ec04ce-20221121",
|
|
4
|
+
"description": "Best Data Grid for React with Spreadsheet Look and Feel.",
|
|
5
|
+
"author": "Handsoncode <hello@handsoncode.net> (https://handsoncode.net)",
|
|
6
|
+
"homepage": "https://handsontable.com",
|
|
7
|
+
"license": "SEE LICENSE IN LICENSE.txt",
|
|
8
|
+
"main": "./commonjs/react-handsontable.js",
|
|
9
|
+
"module": "./es/react-handsontable.js",
|
|
10
|
+
"jsdelivr": "./dist/react-handsontable.min.js",
|
|
11
|
+
"unpkg": "./dist/react-handsontable.min.js",
|
|
12
|
+
"types": "./index.d.ts",
|
|
13
|
+
"exports": {
|
|
14
|
+
"./dist/react-handsontable.js" : "./dist/react-handsontable.js",
|
|
15
|
+
"./dist/react-handsontable.min.js" : "./dist/react-handsontable.min.js",
|
|
16
|
+
".": {
|
|
17
|
+
"import": "./es/react-handsontable.mjs",
|
|
18
|
+
"require": "./commonjs/react-handsontable.js"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"keywords": [
|
|
22
|
+
"handsontable",
|
|
23
|
+
"component",
|
|
24
|
+
"grid",
|
|
25
|
+
"data",
|
|
26
|
+
"table",
|
|
27
|
+
"data table",
|
|
28
|
+
"data grid",
|
|
29
|
+
"spreadsheet",
|
|
30
|
+
"sheet",
|
|
31
|
+
"excel",
|
|
32
|
+
"enterprise",
|
|
33
|
+
"sort",
|
|
34
|
+
"formulas",
|
|
35
|
+
"filter",
|
|
36
|
+
"search",
|
|
37
|
+
"conditional",
|
|
38
|
+
"formatting",
|
|
39
|
+
"csv",
|
|
40
|
+
"react",
|
|
41
|
+
"reactjs",
|
|
42
|
+
"react component",
|
|
43
|
+
"react grid",
|
|
44
|
+
"wrapper"
|
|
45
|
+
],
|
|
46
|
+
"repository": {
|
|
47
|
+
"type": "git",
|
|
48
|
+
"url": "https://github.com/handsontable/handsontable.git"
|
|
49
|
+
},
|
|
50
|
+
"bugs": {
|
|
51
|
+
"url": "https://github.com/handsontable/handsontable/issues"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@babel/cli": "^7.8.4",
|
|
55
|
+
"@babel/core": "^7.9.0",
|
|
56
|
+
"@babel/plugin-proposal-class-properties": "^7.8.3",
|
|
57
|
+
"@babel/plugin-transform-runtime": "^7.9.0",
|
|
58
|
+
"@babel/polyfill": "^7.8.7",
|
|
59
|
+
"@babel/preset-env": "^7.9.0",
|
|
60
|
+
"@babel/preset-react": "^7.9.4",
|
|
61
|
+
"@babel/preset-typescript": "^7.9.0",
|
|
62
|
+
"@babel/runtime": "^7.9.2",
|
|
63
|
+
"@types/react": "^16.9.5",
|
|
64
|
+
"@types/react-dom": "^16.9.1",
|
|
65
|
+
"@types/react-redux": "^7.1.7",
|
|
66
|
+
"babel-core": "^7.0.0-bridge.0",
|
|
67
|
+
"cpy-cli": "^3.1.1",
|
|
68
|
+
"cross-env": "^5.2.0",
|
|
69
|
+
"del-cli": "^3.0.1",
|
|
70
|
+
"handsontable": "0.0.0-next-9ec04ce-20221121",
|
|
71
|
+
"jest": "^25.1.0",
|
|
72
|
+
"prop-types": "^15.7.2",
|
|
73
|
+
"react": "^16.10.2",
|
|
74
|
+
"react-dom": "^16.10.2",
|
|
75
|
+
"react-redux": "^7.1.1",
|
|
76
|
+
"redux": "^4.0.4",
|
|
77
|
+
"resize-observer-polyfill": "^1.5.1",
|
|
78
|
+
"rollup": "^2.58.0",
|
|
79
|
+
"rollup-plugin-alias": "^1.5.2",
|
|
80
|
+
"rollup-plugin-babel": "^4.3.3",
|
|
81
|
+
"rollup-plugin-commonjs": "^10.0.1",
|
|
82
|
+
"rollup-plugin-json": "^4.0.0",
|
|
83
|
+
"rollup-plugin-node-resolve": "^5.2.0",
|
|
84
|
+
"rollup-plugin-replace": "^2.2.0",
|
|
85
|
+
"rollup-plugin-terser": "^7.0.2",
|
|
86
|
+
"rollup-plugin-typescript2": "^0.22.1",
|
|
87
|
+
"typescript": "3.8.2",
|
|
88
|
+
"uglify-js": "^3.4.9"
|
|
89
|
+
},
|
|
90
|
+
"peerDependencies": {
|
|
91
|
+
"handsontable": "0.0.0-next-9ec04ce-20221121"
|
|
92
|
+
},
|
|
93
|
+
"scripts": {
|
|
94
|
+
"build": "npm run clean && npm run build:commonjs && npm run build:es && npm run build:umd && npm run build:min",
|
|
95
|
+
"build:commonjs": "cross-env NODE_ENV=cjs rollup -c",
|
|
96
|
+
"build:umd": "cross-env NODE_ENV=umd rollup -c",
|
|
97
|
+
"build:es": "cross-env NODE_ENV=es rollup -c",
|
|
98
|
+
"build:min": "cross-env NODE_ENV=min rollup -c",
|
|
99
|
+
"clean": "del-cli ./es/ && del-cli ./commonjs/ && del-cli ./dist/ && del-cli ./*.d.ts",
|
|
100
|
+
"publish-package": "npm publish",
|
|
101
|
+
"test": "jest",
|
|
102
|
+
"watch:commonjs": "cross-env NODE_ENV=cjs rollup -c --watch",
|
|
103
|
+
"watch:es": "cross-env NODE_ENV=es rollup -c --watch"
|
|
104
|
+
},
|
|
105
|
+
"jest": {
|
|
106
|
+
"testURL": "http://localhost/",
|
|
107
|
+
"transform": {
|
|
108
|
+
"^.+\\.tsx?$": "babel-jest",
|
|
109
|
+
"^.+\\.js$": "babel-jest"
|
|
110
|
+
},
|
|
111
|
+
"testRegex": "(/test/(.*).(test|spec)).(jsx?|tsx?)$",
|
|
112
|
+
"moduleFileExtensions": [
|
|
113
|
+
"ts",
|
|
114
|
+
"tsx",
|
|
115
|
+
"js",
|
|
116
|
+
"jsx",
|
|
117
|
+
"json",
|
|
118
|
+
"node"
|
|
119
|
+
],
|
|
120
|
+
"setupFilesAfterEnv": [
|
|
121
|
+
"<rootDir>/test/bootstrap.js"
|
|
122
|
+
],
|
|
123
|
+
"globals": {
|
|
124
|
+
"ts-jest": {
|
|
125
|
+
"tsConfig": "test-tsconfig.json",
|
|
126
|
+
"babelConfig": true
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Component class used to manage the renderer component portals.
|
|
4
|
+
*/
|
|
5
|
+
export declare class PortalManager extends React.Component<{}, {
|
|
6
|
+
portals?: React.ReactPortal[];
|
|
7
|
+
}> {
|
|
8
|
+
constructor(props: any);
|
|
9
|
+
render(): React.ReactNode;
|
|
10
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import Handsontable from 'handsontable/base';
|
|
2
|
+
import { HotTableProps } from './types';
|
|
3
|
+
export declare class SettingsMapper {
|
|
4
|
+
/**
|
|
5
|
+
* Parse component settings into Handosntable-compatible settings.
|
|
6
|
+
*
|
|
7
|
+
* @param {Object} properties Object containing properties from the HotTable object.
|
|
8
|
+
* @returns {Object} Handsontable-compatible settings object.
|
|
9
|
+
*/
|
|
10
|
+
static getSettings(properties: HotTableProps): Handsontable.GridSettings;
|
|
11
|
+
}
|
package/types.d.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import Handsontable from 'handsontable/base';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { ConnectedComponent } from 'react-redux';
|
|
4
|
+
/**
|
|
5
|
+
* Type of the editor component's ReactElement.
|
|
6
|
+
*/
|
|
7
|
+
export declare type HotEditorElement = React.ReactElement<{}, ConnectedComponent<React.FunctionComponent, any> | any>;
|
|
8
|
+
/**
|
|
9
|
+
* Type of the identifier under which the cached editor components are stored.
|
|
10
|
+
*/
|
|
11
|
+
export declare type EditorScopeIdentifier = 'global' | number;
|
|
12
|
+
/**
|
|
13
|
+
* Type of the cache map for the Handsontable editor components.
|
|
14
|
+
*/
|
|
15
|
+
export declare type HotEditorCache = Map<Function, Map<EditorScopeIdentifier, React.Component>>;
|
|
16
|
+
/**
|
|
17
|
+
* Interface for the `prop` of the HotTable component - extending the default Handsontable settings with additional,
|
|
18
|
+
* component-related properties.
|
|
19
|
+
*/
|
|
20
|
+
export interface HotTableProps extends Handsontable.GridSettings {
|
|
21
|
+
id?: string;
|
|
22
|
+
className?: string;
|
|
23
|
+
style?: React.CSSProperties;
|
|
24
|
+
settings?: Handsontable.GridSettings;
|
|
25
|
+
children?: React.ReactNode;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Interface for the props of the component-based editors.
|
|
29
|
+
*/
|
|
30
|
+
export interface HotEditorProps {
|
|
31
|
+
"hot-editor": any;
|
|
32
|
+
id?: string;
|
|
33
|
+
className?: string;
|
|
34
|
+
style?: React.CSSProperties;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Properties related to the HotColumn architecture.
|
|
38
|
+
*/
|
|
39
|
+
export interface HotColumnProps extends Handsontable.ColumnSettings {
|
|
40
|
+
_componentRendererColumns?: Map<number | string, boolean>;
|
|
41
|
+
_emitColumnSettings?: (columnSettings: Handsontable.ColumnSettings, columnIndex: number) => void;
|
|
42
|
+
_columnIndex?: number;
|
|
43
|
+
_getChildElementByType?: (children: React.ReactNode, type: string) => React.ReactElement;
|
|
44
|
+
_getRendererWrapper?: (rendererNode: React.ReactElement) => typeof Handsontable.renderers.BaseRenderer;
|
|
45
|
+
_getEditorClass?: (editorElement: React.ReactElement, editorColumnScope: EditorScopeIdentifier) => typeof Handsontable.editors.BaseEditor;
|
|
46
|
+
_getEditorCache?: () => HotEditorCache;
|
|
47
|
+
_getOwnerDocument?: () => Document;
|
|
48
|
+
children?: React.ReactNode;
|
|
49
|
+
}
|