@handsontable/react-wrapper 16.2.0 → 17.0.0-rc3
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/README.md +1 -13
- package/commonjs/react-handsontable.js +110 -1
- package/dist/react-handsontable.js +111 -2
- 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 +109 -2
- package/hotEditor.d.ts +41 -1
- package/index.d.ts +1 -1
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -67,15 +67,6 @@ Below is the installation guide for the React functional component.
|
|
|
67
67
|
npm install handsontable @handsontable/react-wrapper
|
|
68
68
|
```
|
|
69
69
|
|
|
70
|
-
### Import CSS files
|
|
71
|
-
|
|
72
|
-
```jsx
|
|
73
|
-
// Base CSS rules
|
|
74
|
-
import 'handsontable/styles/handsontable.min.css';
|
|
75
|
-
// Main theme variables
|
|
76
|
-
import 'handsontable/styles/ht-theme-main.min.css';
|
|
77
|
-
```
|
|
78
|
-
|
|
79
70
|
### Register Handsontable's modules
|
|
80
71
|
|
|
81
72
|
```jsx
|
|
@@ -97,15 +88,12 @@ To set Handsontable's [configuration options](https://handsontable.com/docs/reac
|
|
|
97
88
|
```jsx
|
|
98
89
|
import { HotTable, HotColumn } from '@handsontable/react-wrapper';
|
|
99
90
|
import { registerAllModules } from 'handsontable/registry';
|
|
100
|
-
import 'handsontable/styles/handsontable.min.css';
|
|
101
|
-
import 'handsontable/styles/ht-theme-main.min.css';
|
|
102
91
|
|
|
103
92
|
registerAllModules();
|
|
104
93
|
|
|
105
94
|
const ExampleComponent = () => {
|
|
106
95
|
return (
|
|
107
96
|
<HotTable
|
|
108
|
-
theme="ht-theme-main-dark-auto"
|
|
109
97
|
data={[
|
|
110
98
|
{ company: 'Tagcat', country: 'United Kingdom', rating: 4.4 },
|
|
111
99
|
{ company: 'Zoomzone', country: 'Japan', rating: 4.5 },
|
|
@@ -138,7 +126,7 @@ const ExampleComponent = () => {
|
|
|
138
126
|
- [Website](https://handsontable.com)
|
|
139
127
|
- [Demo](https://handsontable.com/demo)
|
|
140
128
|
- [Documentation](https://handsontable.com/docs/react-data-grid)
|
|
141
|
-
- [npm](https://www.npmjs.com/package/@handsontable/react)
|
|
129
|
+
- [npm](https://www.npmjs.com/package/@handsontable/react-wrapper)
|
|
142
130
|
- [CDN](https://www.jsdelivr.com/package/npm/@handsontable/react-wrapper)
|
|
143
131
|
- [Forum](https://forum.handsontable.com/)
|
|
144
132
|
- [Blog](https://handsontable.com/blog)
|
|
@@ -689,6 +689,113 @@ function useHotEditor(overriddenHooks, deps) {
|
|
|
689
689
|
};
|
|
690
690
|
}, [rerenderTrigger, hotCustomEditorInstanceRef, deferredValue]);
|
|
691
691
|
}
|
|
692
|
+
function EditorComponent(_ref2) {
|
|
693
|
+
var _onPrepare = _ref2.onPrepare,
|
|
694
|
+
_onClose = _ref2.onClose,
|
|
695
|
+
_onOpen = _ref2.onOpen,
|
|
696
|
+
_onFocus = _ref2.onFocus,
|
|
697
|
+
children = _ref2.children,
|
|
698
|
+
_ref2$shortcutsGroup = _ref2.shortcutsGroup,
|
|
699
|
+
shortcutsGroup = _ref2$shortcutsGroup === void 0 ? "custom-editor" : _ref2$shortcutsGroup,
|
|
700
|
+
shortcuts = _ref2.shortcuts;
|
|
701
|
+
var mainElementRef = React.useRef(null);
|
|
702
|
+
var currentValue = React.useRef(undefined);
|
|
703
|
+
var _useContext2 = React.useContext(EditorContext),
|
|
704
|
+
hotCustomEditorInstanceRef = _useContext2.hotCustomEditorInstanceRef;
|
|
705
|
+
var registerShortcuts = React.useCallback(function () {
|
|
706
|
+
var _hotCustomEditorInsta8, _hotCustomEditorInsta9, _hotCustomEditorInsta0;
|
|
707
|
+
if (!((_hotCustomEditorInsta8 = hotCustomEditorInstanceRef.current) !== null && _hotCustomEditorInsta8 !== void 0 && _hotCustomEditorInsta8.hot)) return;
|
|
708
|
+
(_hotCustomEditorInsta9 = hotCustomEditorInstanceRef.current) === null || _hotCustomEditorInsta9 === void 0 || (_hotCustomEditorInsta9 = _hotCustomEditorInsta9.hot) === null || _hotCustomEditorInsta9 === void 0 || _hotCustomEditorInsta9.getShortcutManager().setActiveContextName("editor");
|
|
709
|
+
var shortcutManager = (_hotCustomEditorInsta0 = hotCustomEditorInstanceRef.current) === null || _hotCustomEditorInsta0 === void 0 || (_hotCustomEditorInsta0 = _hotCustomEditorInsta0.hot) === null || _hotCustomEditorInsta0 === void 0 ? void 0 : _hotCustomEditorInsta0.getShortcutManager();
|
|
710
|
+
var editorContext = shortcutManager.getContext('editor');
|
|
711
|
+
var contextConfig = {
|
|
712
|
+
group: shortcutsGroup
|
|
713
|
+
};
|
|
714
|
+
if (shortcuts) {
|
|
715
|
+
editorContext === null || editorContext === void 0 || editorContext.addShortcuts(shortcuts.map(function (shortcut) {
|
|
716
|
+
return _objectSpread2(_objectSpread2({}, shortcut), {}, {
|
|
717
|
+
group: shortcut.group || shortcutsGroup,
|
|
718
|
+
relativeToGroup: shortcut.relativeToGroup || 'editorManager.handlingEditor',
|
|
719
|
+
position: shortcut.position || 'before',
|
|
720
|
+
callback: function callback(event) {
|
|
721
|
+
return shortcut.callback({
|
|
722
|
+
value: currentValue.current,
|
|
723
|
+
setValue: setValue,
|
|
724
|
+
finishEditing: finishEditing
|
|
725
|
+
}, event);
|
|
726
|
+
}
|
|
727
|
+
});
|
|
728
|
+
}),
|
|
729
|
+
//@ts-ignore
|
|
730
|
+
contextConfig);
|
|
731
|
+
}
|
|
732
|
+
}, [shortcuts]);
|
|
733
|
+
var unRegisterShortcuts = React.useCallback(function () {
|
|
734
|
+
var _hotCustomEditorInsta1, _hotCustomEditorInsta10;
|
|
735
|
+
if (!((_hotCustomEditorInsta1 = hotCustomEditorInstanceRef.current) !== null && _hotCustomEditorInsta1 !== void 0 && _hotCustomEditorInsta1.hot)) return;
|
|
736
|
+
var shortcutManager = (_hotCustomEditorInsta10 = hotCustomEditorInstanceRef.current) === null || _hotCustomEditorInsta10 === void 0 || (_hotCustomEditorInsta10 = _hotCustomEditorInsta10.hot) === null || _hotCustomEditorInsta10 === void 0 ? void 0 : _hotCustomEditorInsta10.getShortcutManager();
|
|
737
|
+
var editorContext = shortcutManager.getContext("editor");
|
|
738
|
+
editorContext.removeShortcutsByGroup(shortcutsGroup);
|
|
739
|
+
}, [shortcuts]);
|
|
740
|
+
var _useHotEditor = useHotEditor({
|
|
741
|
+
onOpen: function onOpen() {
|
|
742
|
+
if (!mainElementRef.current) return;
|
|
743
|
+
mainElementRef.current.style.display = 'block';
|
|
744
|
+
_onOpen === null || _onOpen === void 0 || _onOpen();
|
|
745
|
+
registerShortcuts();
|
|
746
|
+
},
|
|
747
|
+
onClose: function onClose() {
|
|
748
|
+
if (!mainElementRef.current) return;
|
|
749
|
+
mainElementRef.current.style.display = 'none';
|
|
750
|
+
_onClose === null || _onClose === void 0 || _onClose();
|
|
751
|
+
unRegisterShortcuts();
|
|
752
|
+
},
|
|
753
|
+
onPrepare: function onPrepare(_row, _column, _prop, TD, _originalValue, _cellProperties) {
|
|
754
|
+
if (!mainElementRef.current) return;
|
|
755
|
+
var tdPosition = TD.getBoundingClientRect();
|
|
756
|
+
mainElementRef.current.style.left = "".concat(tdPosition.left + window.pageXOffset - 1, "px");
|
|
757
|
+
mainElementRef.current.style.top = "".concat(tdPosition.top + window.pageYOffset - 1, "px");
|
|
758
|
+
mainElementRef.current.style.width = "".concat(tdPosition.width + 1, "px");
|
|
759
|
+
mainElementRef.current.style.height = "".concat(tdPosition.height + 1, "px");
|
|
760
|
+
_onPrepare === null || _onPrepare === void 0 || _onPrepare(_row, _column, _prop, TD, _originalValue, _cellProperties);
|
|
761
|
+
},
|
|
762
|
+
onFocus: function onFocus() {
|
|
763
|
+
_onFocus === null || _onFocus === void 0 || _onFocus();
|
|
764
|
+
}
|
|
765
|
+
}),
|
|
766
|
+
value = _useHotEditor.value,
|
|
767
|
+
setValue = _useHotEditor.setValue,
|
|
768
|
+
finishEditing = _useHotEditor.finishEditing,
|
|
769
|
+
isOpen = _useHotEditor.isOpen,
|
|
770
|
+
col = _useHotEditor.col,
|
|
771
|
+
row = _useHotEditor.row;
|
|
772
|
+
React.useEffect(function () {
|
|
773
|
+
currentValue.current = value;
|
|
774
|
+
}, [value]);
|
|
775
|
+
var stopMousedownPropagation = function stopMousedownPropagation(e) {
|
|
776
|
+
e.stopPropagation();
|
|
777
|
+
};
|
|
778
|
+
return React__default["default"].createElement("div", {
|
|
779
|
+
ref: mainElementRef,
|
|
780
|
+
style: {
|
|
781
|
+
display: 'none',
|
|
782
|
+
position: 'absolute',
|
|
783
|
+
background: '#fff',
|
|
784
|
+
border: '0px',
|
|
785
|
+
padding: '0px',
|
|
786
|
+
zIndex: 999
|
|
787
|
+
},
|
|
788
|
+
onMouseDown: stopMousedownPropagation
|
|
789
|
+
}, children({
|
|
790
|
+
value: value,
|
|
791
|
+
setValue: setValue,
|
|
792
|
+
finishEditing: finishEditing,
|
|
793
|
+
mainElementRef: mainElementRef,
|
|
794
|
+
isOpen: isOpen,
|
|
795
|
+
col: col,
|
|
796
|
+
row: row
|
|
797
|
+
}));
|
|
798
|
+
}
|
|
692
799
|
|
|
693
800
|
var isHotColumn = function isHotColumn(childNode) {
|
|
694
801
|
return childNode.type === HotColumn;
|
|
@@ -763,7 +870,7 @@ var HotColumn = function HotColumn(props) {
|
|
|
763
870
|
}, editorPortal);
|
|
764
871
|
};
|
|
765
872
|
|
|
766
|
-
var version="
|
|
873
|
+
var version="17.0.0-rc3";
|
|
767
874
|
|
|
768
875
|
/**
|
|
769
876
|
* Component used to manage the renderer component portals.
|
|
@@ -2134,6 +2241,8 @@ var HotTable = React.forwardRef(function (_ref, ref) {
|
|
|
2134
2241
|
*/
|
|
2135
2242
|
HotTable.version = version;
|
|
2136
2243
|
|
|
2244
|
+
exports.EditorComponent = EditorComponent;
|
|
2245
|
+
exports.EditorContext = EditorContext;
|
|
2137
2246
|
exports.HotColumn = HotColumn;
|
|
2138
2247
|
exports.HotTable = HotTable;
|
|
2139
2248
|
exports["default"] = HotTable;
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
* INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER ARISING FROM
|
|
26
26
|
* USE OR INABILITY TO USE THIS SOFTWARE.
|
|
27
27
|
*
|
|
28
|
-
* Version:
|
|
28
|
+
* Version: 17.0.0-rc3 (built at Tue Feb 24 2026 09:27:36 GMT+0000 (Coordinated Universal Time))
|
|
29
29
|
*/
|
|
30
30
|
(function (global, factory) {
|
|
31
31
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('react-dom'), require('handsontable/base'), require('handsontable/renderers/registry'), require('handsontable/editors/registry')) :
|
|
@@ -705,6 +705,113 @@ function useHotEditor(overriddenHooks, deps) {
|
|
|
705
705
|
};
|
|
706
706
|
}, [rerenderTrigger, hotCustomEditorInstanceRef, deferredValue]);
|
|
707
707
|
}
|
|
708
|
+
function EditorComponent(_ref2) {
|
|
709
|
+
var _onPrepare = _ref2.onPrepare,
|
|
710
|
+
_onClose = _ref2.onClose,
|
|
711
|
+
_onOpen = _ref2.onOpen,
|
|
712
|
+
_onFocus = _ref2.onFocus,
|
|
713
|
+
children = _ref2.children,
|
|
714
|
+
_ref2$shortcutsGroup = _ref2.shortcutsGroup,
|
|
715
|
+
shortcutsGroup = _ref2$shortcutsGroup === void 0 ? "custom-editor" : _ref2$shortcutsGroup,
|
|
716
|
+
shortcuts = _ref2.shortcuts;
|
|
717
|
+
var mainElementRef = React.useRef(null);
|
|
718
|
+
var currentValue = React.useRef(undefined);
|
|
719
|
+
var _useContext2 = React.useContext(EditorContext),
|
|
720
|
+
hotCustomEditorInstanceRef = _useContext2.hotCustomEditorInstanceRef;
|
|
721
|
+
var registerShortcuts = React.useCallback(function () {
|
|
722
|
+
var _hotCustomEditorInsta8, _hotCustomEditorInsta9, _hotCustomEditorInsta0;
|
|
723
|
+
if (!((_hotCustomEditorInsta8 = hotCustomEditorInstanceRef.current) !== null && _hotCustomEditorInsta8 !== void 0 && _hotCustomEditorInsta8.hot)) return;
|
|
724
|
+
(_hotCustomEditorInsta9 = hotCustomEditorInstanceRef.current) === null || _hotCustomEditorInsta9 === void 0 || (_hotCustomEditorInsta9 = _hotCustomEditorInsta9.hot) === null || _hotCustomEditorInsta9 === void 0 || _hotCustomEditorInsta9.getShortcutManager().setActiveContextName("editor");
|
|
725
|
+
var shortcutManager = (_hotCustomEditorInsta0 = hotCustomEditorInstanceRef.current) === null || _hotCustomEditorInsta0 === void 0 || (_hotCustomEditorInsta0 = _hotCustomEditorInsta0.hot) === null || _hotCustomEditorInsta0 === void 0 ? void 0 : _hotCustomEditorInsta0.getShortcutManager();
|
|
726
|
+
var editorContext = shortcutManager.getContext('editor');
|
|
727
|
+
var contextConfig = {
|
|
728
|
+
group: shortcutsGroup
|
|
729
|
+
};
|
|
730
|
+
if (shortcuts) {
|
|
731
|
+
editorContext === null || editorContext === void 0 || editorContext.addShortcuts(shortcuts.map(function (shortcut) {
|
|
732
|
+
return _objectSpread2(_objectSpread2({}, shortcut), {}, {
|
|
733
|
+
group: shortcut.group || shortcutsGroup,
|
|
734
|
+
relativeToGroup: shortcut.relativeToGroup || 'editorManager.handlingEditor',
|
|
735
|
+
position: shortcut.position || 'before',
|
|
736
|
+
callback: function callback(event) {
|
|
737
|
+
return shortcut.callback({
|
|
738
|
+
value: currentValue.current,
|
|
739
|
+
setValue: setValue,
|
|
740
|
+
finishEditing: finishEditing
|
|
741
|
+
}, event);
|
|
742
|
+
}
|
|
743
|
+
});
|
|
744
|
+
}),
|
|
745
|
+
//@ts-ignore
|
|
746
|
+
contextConfig);
|
|
747
|
+
}
|
|
748
|
+
}, [shortcuts]);
|
|
749
|
+
var unRegisterShortcuts = React.useCallback(function () {
|
|
750
|
+
var _hotCustomEditorInsta1, _hotCustomEditorInsta10;
|
|
751
|
+
if (!((_hotCustomEditorInsta1 = hotCustomEditorInstanceRef.current) !== null && _hotCustomEditorInsta1 !== void 0 && _hotCustomEditorInsta1.hot)) return;
|
|
752
|
+
var shortcutManager = (_hotCustomEditorInsta10 = hotCustomEditorInstanceRef.current) === null || _hotCustomEditorInsta10 === void 0 || (_hotCustomEditorInsta10 = _hotCustomEditorInsta10.hot) === null || _hotCustomEditorInsta10 === void 0 ? void 0 : _hotCustomEditorInsta10.getShortcutManager();
|
|
753
|
+
var editorContext = shortcutManager.getContext("editor");
|
|
754
|
+
editorContext.removeShortcutsByGroup(shortcutsGroup);
|
|
755
|
+
}, [shortcuts]);
|
|
756
|
+
var _useHotEditor = useHotEditor({
|
|
757
|
+
onOpen: function onOpen() {
|
|
758
|
+
if (!mainElementRef.current) return;
|
|
759
|
+
mainElementRef.current.style.display = 'block';
|
|
760
|
+
_onOpen === null || _onOpen === void 0 || _onOpen();
|
|
761
|
+
registerShortcuts();
|
|
762
|
+
},
|
|
763
|
+
onClose: function onClose() {
|
|
764
|
+
if (!mainElementRef.current) return;
|
|
765
|
+
mainElementRef.current.style.display = 'none';
|
|
766
|
+
_onClose === null || _onClose === void 0 || _onClose();
|
|
767
|
+
unRegisterShortcuts();
|
|
768
|
+
},
|
|
769
|
+
onPrepare: function onPrepare(_row, _column, _prop, TD, _originalValue, _cellProperties) {
|
|
770
|
+
if (!mainElementRef.current) return;
|
|
771
|
+
var tdPosition = TD.getBoundingClientRect();
|
|
772
|
+
mainElementRef.current.style.left = "".concat(tdPosition.left + window.pageXOffset - 1, "px");
|
|
773
|
+
mainElementRef.current.style.top = "".concat(tdPosition.top + window.pageYOffset - 1, "px");
|
|
774
|
+
mainElementRef.current.style.width = "".concat(tdPosition.width + 1, "px");
|
|
775
|
+
mainElementRef.current.style.height = "".concat(tdPosition.height + 1, "px");
|
|
776
|
+
_onPrepare === null || _onPrepare === void 0 || _onPrepare(_row, _column, _prop, TD, _originalValue, _cellProperties);
|
|
777
|
+
},
|
|
778
|
+
onFocus: function onFocus() {
|
|
779
|
+
_onFocus === null || _onFocus === void 0 || _onFocus();
|
|
780
|
+
}
|
|
781
|
+
}),
|
|
782
|
+
value = _useHotEditor.value,
|
|
783
|
+
setValue = _useHotEditor.setValue,
|
|
784
|
+
finishEditing = _useHotEditor.finishEditing,
|
|
785
|
+
isOpen = _useHotEditor.isOpen,
|
|
786
|
+
col = _useHotEditor.col,
|
|
787
|
+
row = _useHotEditor.row;
|
|
788
|
+
React.useEffect(function () {
|
|
789
|
+
currentValue.current = value;
|
|
790
|
+
}, [value]);
|
|
791
|
+
var stopMousedownPropagation = function stopMousedownPropagation(e) {
|
|
792
|
+
e.stopPropagation();
|
|
793
|
+
};
|
|
794
|
+
return React__default["default"].createElement("div", {
|
|
795
|
+
ref: mainElementRef,
|
|
796
|
+
style: {
|
|
797
|
+
display: 'none',
|
|
798
|
+
position: 'absolute',
|
|
799
|
+
background: '#fff',
|
|
800
|
+
border: '0px',
|
|
801
|
+
padding: '0px',
|
|
802
|
+
zIndex: 999
|
|
803
|
+
},
|
|
804
|
+
onMouseDown: stopMousedownPropagation
|
|
805
|
+
}, children({
|
|
806
|
+
value: value,
|
|
807
|
+
setValue: setValue,
|
|
808
|
+
finishEditing: finishEditing,
|
|
809
|
+
mainElementRef: mainElementRef,
|
|
810
|
+
isOpen: isOpen,
|
|
811
|
+
col: col,
|
|
812
|
+
row: row
|
|
813
|
+
}));
|
|
814
|
+
}
|
|
708
815
|
|
|
709
816
|
var isHotColumn = function isHotColumn(childNode) {
|
|
710
817
|
return childNode.type === HotColumn;
|
|
@@ -779,7 +886,7 @@ var HotColumn = function HotColumn(props) {
|
|
|
779
886
|
}, editorPortal);
|
|
780
887
|
};
|
|
781
888
|
|
|
782
|
-
var version="
|
|
889
|
+
var version="17.0.0-rc3";
|
|
783
890
|
|
|
784
891
|
/**
|
|
785
892
|
* Component used to manage the renderer component portals.
|
|
@@ -1123,6 +1230,8 @@ var HotTable = React.forwardRef(function (_ref, ref) {
|
|
|
1123
1230
|
*/
|
|
1124
1231
|
HotTable.version = version;
|
|
1125
1232
|
|
|
1233
|
+
exports.EditorComponent = EditorComponent;
|
|
1234
|
+
exports.EditorContext = EditorContext;
|
|
1126
1235
|
exports.HotColumn = HotColumn;
|
|
1127
1236
|
exports.HotTable = HotTable;
|
|
1128
1237
|
exports["default"] = HotTable;
|