@handsontable/react 14.0.0 → 14.1.0-next-ba8c2b0-20240110
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 +97 -64
- package/dist/react-handsontable.js +98 -65
- 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 +97 -64
- package/helpers.d.ts +7 -1
- package/hotTable.d.ts +7 -234
- package/hotTableClass.d.ts +237 -0
- package/package.json +12 -10
- package/types.d.ts +1 -0
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Handsontable from 'handsontable/base';
|
|
3
|
+
import { RenderersPortalManager } from './renderersPortalManager';
|
|
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 HotTableCB
|
|
26
|
+
*/
|
|
27
|
+
declare class HotTableClass 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
|
+
renderersPortalManager: RenderersPortalManager;
|
|
71
|
+
/**
|
|
72
|
+
* Array containing the portals cashed to be rendered in bulk after Handsontable's render cycle.
|
|
73
|
+
*/
|
|
74
|
+
portalCacheArray: React.ReactPortal[];
|
|
75
|
+
/**
|
|
76
|
+
* The rendered cells cache.
|
|
77
|
+
*
|
|
78
|
+
* @private
|
|
79
|
+
* @type {Map}
|
|
80
|
+
*/
|
|
81
|
+
private renderedCellCache;
|
|
82
|
+
/**
|
|
83
|
+
* Editor cache.
|
|
84
|
+
*
|
|
85
|
+
* @private
|
|
86
|
+
* @type {Map}
|
|
87
|
+
*/
|
|
88
|
+
private editorCache;
|
|
89
|
+
/**
|
|
90
|
+
* Map with column indexes (or a string = 'global') as keys, and booleans as values. Each key represents a component-based editor
|
|
91
|
+
* declared for the used column index, or a global one, if the key is the `global` string.
|
|
92
|
+
*
|
|
93
|
+
* @private
|
|
94
|
+
* @type {Map}
|
|
95
|
+
*/
|
|
96
|
+
private componentRendererColumns;
|
|
97
|
+
/**
|
|
98
|
+
* Package version getter.
|
|
99
|
+
*
|
|
100
|
+
* @returns The version number of the package.
|
|
101
|
+
*/
|
|
102
|
+
static get version(): string;
|
|
103
|
+
/**
|
|
104
|
+
* Getter for the property storing the Handsontable instance.
|
|
105
|
+
*/
|
|
106
|
+
get hotInstance(): Handsontable | null;
|
|
107
|
+
/**
|
|
108
|
+
* Setter for the property storing the Handsontable instance.
|
|
109
|
+
* @param {Handsontable} hotInstance The Handsontable instance.
|
|
110
|
+
*/
|
|
111
|
+
set hotInstance(hotInstance: Handsontable | null);
|
|
112
|
+
/**
|
|
113
|
+
* Prop types to be checked at runtime.
|
|
114
|
+
*/
|
|
115
|
+
static propTypes: object;
|
|
116
|
+
/**
|
|
117
|
+
* Get the rendered table cell cache.
|
|
118
|
+
*
|
|
119
|
+
* @returns {Map}
|
|
120
|
+
*/
|
|
121
|
+
getRenderedCellCache(): Map<string, HTMLTableCellElement>;
|
|
122
|
+
/**
|
|
123
|
+
* Get the editor cache and return it.
|
|
124
|
+
*
|
|
125
|
+
* @returns {Map}
|
|
126
|
+
*/
|
|
127
|
+
getEditorCache(): HotEditorCache;
|
|
128
|
+
/**
|
|
129
|
+
* Clear both the editor and the renderer cache.
|
|
130
|
+
*/
|
|
131
|
+
clearCache(): void;
|
|
132
|
+
/**
|
|
133
|
+
* Get the `Document` object corresponding to the main component element.
|
|
134
|
+
*
|
|
135
|
+
* @returns The `Document` object used by the component.
|
|
136
|
+
*/
|
|
137
|
+
getOwnerDocument(): Document | null;
|
|
138
|
+
/**
|
|
139
|
+
* Set the reference to the main Handsontable DOM element.
|
|
140
|
+
*
|
|
141
|
+
* @param {HTMLElement} element The main Handsontable DOM element.
|
|
142
|
+
*/
|
|
143
|
+
private setHotElementRef;
|
|
144
|
+
/**
|
|
145
|
+
* Return a renderer wrapper function for the provided renderer component.
|
|
146
|
+
*
|
|
147
|
+
* @param {React.ReactElement} rendererElement React renderer component.
|
|
148
|
+
* @returns {Handsontable.renderers.Base} The Handsontable rendering function.
|
|
149
|
+
*/
|
|
150
|
+
getRendererWrapper(rendererElement: React.ReactElement): typeof Handsontable.renderers.BaseRenderer | any;
|
|
151
|
+
/**
|
|
152
|
+
* Create a fresh class to be used as an editor, based on the provided editor React element.
|
|
153
|
+
*
|
|
154
|
+
* @param {React.ReactElement} editorElement React editor component.
|
|
155
|
+
* @param {string|number} [editorColumnScope] The editor scope (column index or a 'global' string). Defaults to
|
|
156
|
+
* 'global'.
|
|
157
|
+
* @returns {Function} A class to be passed to the Handsontable editor settings.
|
|
158
|
+
*/
|
|
159
|
+
getEditorClass(editorElement: HotEditorElement, editorColumnScope?: EditorScopeIdentifier): typeof Handsontable.editors.BaseEditor;
|
|
160
|
+
/**
|
|
161
|
+
* Create a class to be passed to the Handsontable's settings.
|
|
162
|
+
*
|
|
163
|
+
* @param {React.ReactElement} editorComponent React editor component.
|
|
164
|
+
* @returns {Function} A class to be passed to the Handsontable editor settings.
|
|
165
|
+
*/
|
|
166
|
+
makeEditorClass(editorComponent: React.Component): typeof Handsontable.editors.BaseEditor;
|
|
167
|
+
/**
|
|
168
|
+
* Get the renderer element for the entire HotTable instance.
|
|
169
|
+
*
|
|
170
|
+
* @returns {React.ReactElement} React renderer component element.
|
|
171
|
+
*/
|
|
172
|
+
getGlobalRendererElement(): React.ReactElement;
|
|
173
|
+
/**
|
|
174
|
+
* Get the editor element for the entire HotTable instance.
|
|
175
|
+
*
|
|
176
|
+
* @param {React.ReactNode} [children] Children of the HotTable instance. Defaults to `this.props.children`.
|
|
177
|
+
* @returns {React.ReactElement} React editor component element.
|
|
178
|
+
*/
|
|
179
|
+
getGlobalEditorElement(): HotEditorElement | null;
|
|
180
|
+
/**
|
|
181
|
+
* Create a new settings object containing the column settings and global editors and renderers.
|
|
182
|
+
*
|
|
183
|
+
* @returns {Handsontable.GridSettings} New global set of settings for Handsontable.
|
|
184
|
+
*/
|
|
185
|
+
createNewGlobalSettings(): Handsontable.GridSettings;
|
|
186
|
+
/**
|
|
187
|
+
* Detect if `autoRowSize` or `autoColumnSize` is defined, and if so, throw an incompatibility warning.
|
|
188
|
+
*
|
|
189
|
+
* @param {Handsontable.GridSettings} newGlobalSettings New global settings passed as Handsontable config.
|
|
190
|
+
*/
|
|
191
|
+
displayAutoSizeWarning(newGlobalSettings: Handsontable.GridSettings): void;
|
|
192
|
+
/**
|
|
193
|
+
* Sets the column settings based on information received from HotColumn.
|
|
194
|
+
*
|
|
195
|
+
* @param {HotTableProps} columnSettings Column settings object.
|
|
196
|
+
* @param {Number} columnIndex Column index.
|
|
197
|
+
*/
|
|
198
|
+
setHotColumnSettings(columnSettings: Handsontable.ColumnSettings, columnIndex: number): void;
|
|
199
|
+
/**
|
|
200
|
+
* Handsontable's `beforeViewRender` hook callback.
|
|
201
|
+
*/
|
|
202
|
+
handsontableBeforeViewRender(): void;
|
|
203
|
+
/**
|
|
204
|
+
* Handsontable's `afterViewRender` hook callback.
|
|
205
|
+
*/
|
|
206
|
+
handsontableAfterViewRender(): void;
|
|
207
|
+
/**
|
|
208
|
+
* Call the `updateSettings` method for the Handsontable instance.
|
|
209
|
+
*
|
|
210
|
+
* @param {Object} newSettings The settings object.
|
|
211
|
+
*/
|
|
212
|
+
private updateHot;
|
|
213
|
+
/**
|
|
214
|
+
* Set the renderers portal manager ref.
|
|
215
|
+
*
|
|
216
|
+
* @param {React.ReactComponent} pmComponent The PortalManager component.
|
|
217
|
+
*/
|
|
218
|
+
private setRenderersPortalManagerRef;
|
|
219
|
+
/**
|
|
220
|
+
* Initialize Handsontable after the component has mounted.
|
|
221
|
+
*/
|
|
222
|
+
componentDidMount(): void;
|
|
223
|
+
/**
|
|
224
|
+
* Logic performed after the component update.
|
|
225
|
+
*/
|
|
226
|
+
componentDidUpdate(): void;
|
|
227
|
+
/**
|
|
228
|
+
* Destroy the Handsontable instance when the parent component unmounts.
|
|
229
|
+
*/
|
|
230
|
+
componentWillUnmount(): void;
|
|
231
|
+
/**
|
|
232
|
+
* Render the component.
|
|
233
|
+
*/
|
|
234
|
+
render(): React.ReactElement;
|
|
235
|
+
}
|
|
236
|
+
export default HotTableClass;
|
|
237
|
+
export { HotTableClass };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@handsontable/react",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.1.0-next-ba8c2b0-20240110",
|
|
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",
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
"unpkg": "./dist/react-handsontable.min.js",
|
|
12
12
|
"types": "./index.d.ts",
|
|
13
13
|
"exports": {
|
|
14
|
-
"./dist/react-handsontable.js"
|
|
15
|
-
"./dist/react-handsontable.min.js"
|
|
14
|
+
"./dist/react-handsontable.js": "./dist/react-handsontable.js",
|
|
15
|
+
"./dist/react-handsontable.min.js": "./dist/react-handsontable.min.js",
|
|
16
16
|
".": {
|
|
17
17
|
"types": "./index.d.ts",
|
|
18
18
|
"import": "./es/react-handsontable.mjs",
|
|
@@ -61,20 +61,22 @@
|
|
|
61
61
|
"@babel/preset-react": "^7.9.4",
|
|
62
62
|
"@babel/preset-typescript": "^7.9.0",
|
|
63
63
|
"@babel/runtime": "^7.9.2",
|
|
64
|
-
"@
|
|
64
|
+
"@testing-library/react": "^14.1.2",
|
|
65
|
+
"@types/react": "^18.2.0",
|
|
66
|
+
"@types/react-dom": "^18.2.0",
|
|
65
67
|
"@types/react-redux": "^7.1.7",
|
|
66
|
-
"@types/react": "^16.9.5",
|
|
67
68
|
"babel-core": "^7.0.0-bridge.0",
|
|
68
69
|
"cpy-cli": "^3.1.1",
|
|
69
70
|
"cross-env": "^7.0.3",
|
|
70
|
-
"handsontable": "
|
|
71
|
+
"handsontable": "14.1.0-next-ba8c2b0-20240110",
|
|
71
72
|
"jest": "^25.1.0",
|
|
72
73
|
"prop-types": "^15.7.2",
|
|
73
|
-
"react
|
|
74
|
+
"react": "^18.2.0",
|
|
75
|
+
"react-dom": "^18.2.0",
|
|
74
76
|
"react-redux": "^7.1.1",
|
|
75
|
-
"react": "^16.10.2",
|
|
76
77
|
"redux": "^4.0.4",
|
|
77
78
|
"rimraf": "^3.0.2",
|
|
79
|
+
"rollup": "^2.58.0",
|
|
78
80
|
"rollup-plugin-alias": "^1.5.2",
|
|
79
81
|
"rollup-plugin-babel": "^4.3.3",
|
|
80
82
|
"rollup-plugin-commonjs": "^10.0.1",
|
|
@@ -83,12 +85,11 @@
|
|
|
83
85
|
"rollup-plugin-replace": "^2.2.0",
|
|
84
86
|
"rollup-plugin-terser": "^7.0.2",
|
|
85
87
|
"rollup-plugin-typescript2": "^0.22.1",
|
|
86
|
-
"rollup": "^2.58.0",
|
|
87
88
|
"typescript": "3.8.2",
|
|
88
89
|
"uglify-js": "^3.4.9"
|
|
89
90
|
},
|
|
90
91
|
"peerDependencies": {
|
|
91
|
-
"handsontable": "
|
|
92
|
+
"handsontable": "14.1.0-next-ba8c2b0-20240110"
|
|
92
93
|
},
|
|
93
94
|
"scripts": {
|
|
94
95
|
"build": "npm run clean && npm run build:commonjs && npm run build:es && npm run build:umd && npm run build:min",
|
|
@@ -99,6 +100,7 @@
|
|
|
99
100
|
"clean": "rimraf ./es/ && rimraf ./commonjs/ && rimraf ./dist/ && rimraf ./*.d.ts",
|
|
100
101
|
"publish-package": "npm publish",
|
|
101
102
|
"test": "jest",
|
|
103
|
+
"test.watch": "jest --watch",
|
|
102
104
|
"watch:commonjs": "cross-env NODE_ENV=cjs rollup -c --watch",
|
|
103
105
|
"watch:es": "cross-env NODE_ENV=es rollup -c --watch"
|
|
104
106
|
},
|
package/types.d.ts
CHANGED
|
@@ -37,6 +37,7 @@ export interface HotEditorProps {
|
|
|
37
37
|
* Properties related to the HotColumn architecture.
|
|
38
38
|
*/
|
|
39
39
|
export interface HotColumnProps extends Handsontable.ColumnSettings {
|
|
40
|
+
settings?: Handsontable.ColumnSettings;
|
|
40
41
|
_componentRendererColumns?: Map<number | string, boolean>;
|
|
41
42
|
_emitColumnSettings?: (columnSettings: Handsontable.ColumnSettings, columnIndex: number) => void;
|
|
42
43
|
_columnIndex?: number;
|