@handsontable/react 11.0.1 → 12.0.1

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.
@@ -7,14 +7,9 @@ function ownKeys(object, enumerableOnly) {
7
7
 
8
8
  if (Object.getOwnPropertySymbols) {
9
9
  var symbols = Object.getOwnPropertySymbols(object);
10
-
11
- if (enumerableOnly) {
12
- symbols = symbols.filter(function (sym) {
13
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
14
- });
15
- }
16
-
17
- keys.push.apply(keys, symbols);
10
+ enumerableOnly && (symbols = symbols.filter(function (sym) {
11
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
12
+ })), keys.push.apply(keys, symbols);
18
13
  }
19
14
 
20
15
  return keys;
@@ -22,19 +17,12 @@ function ownKeys(object, enumerableOnly) {
22
17
 
23
18
  function _objectSpread2(target) {
24
19
  for (var i = 1; i < arguments.length; i++) {
25
- var source = arguments[i] != null ? arguments[i] : {};
26
-
27
- if (i % 2) {
28
- ownKeys(Object(source), true).forEach(function (key) {
29
- _defineProperty(target, key, source[key]);
30
- });
31
- } else if (Object.getOwnPropertyDescriptors) {
32
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
33
- } else {
34
- ownKeys(Object(source)).forEach(function (key) {
35
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
36
- });
37
- }
20
+ var source = null != arguments[i] ? arguments[i] : {};
21
+ i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
22
+ _defineProperty(target, key, source[key]);
23
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
24
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
25
+ });
38
26
  }
39
27
 
40
28
  return target;
@@ -43,17 +31,11 @@ function _objectSpread2(target) {
43
31
  function _typeof(obj) {
44
32
  "@babel/helpers - typeof";
45
33
 
46
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
47
- _typeof = function (obj) {
48
- return typeof obj;
49
- };
50
- } else {
51
- _typeof = function (obj) {
52
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
53
- };
54
- }
55
-
56
- return _typeof(obj);
34
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
35
+ return typeof obj;
36
+ } : function (obj) {
37
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
38
+ }, _typeof(obj);
57
39
  }
58
40
 
59
41
  function _classCallCheck(instance, Constructor) {
@@ -75,6 +57,9 @@ function _defineProperties(target, props) {
75
57
  function _createClass(Constructor, protoProps, staticProps) {
76
58
  if (protoProps) _defineProperties(Constructor.prototype, protoProps);
77
59
  if (staticProps) _defineProperties(Constructor, staticProps);
60
+ Object.defineProperty(Constructor, "prototype", {
61
+ writable: false
62
+ });
78
63
  return Constructor;
79
64
  }
80
65
 
@@ -105,6 +90,9 @@ function _inherits(subClass, superClass) {
105
90
  configurable: true
106
91
  }
107
92
  });
93
+ Object.defineProperty(subClass, "prototype", {
94
+ writable: false
95
+ });
108
96
  if (superClass) _setPrototypeOf(subClass, superClass);
109
97
  }
110
98
 
@@ -682,7 +670,7 @@ var PortalManager = /*#__PURE__*/function (_React$Component) {
682
670
  return PortalManager;
683
671
  }(React.Component);
684
672
 
685
- var version="11.0.1";
673
+ var version="12.0.1";
686
674
 
687
675
  function createCommonjsModule(fn, module) {
688
676
  return module = { exports: {} }, fn(module, module.exports), module.exports;
@@ -1180,12 +1168,14 @@ var objectAssign = shouldUseNative() ? Object.assign : function (target, source)
1180
1168
  var ReactPropTypesSecret$1 = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
1181
1169
  var ReactPropTypesSecret_1 = ReactPropTypesSecret$1;
1182
1170
 
1171
+ var has$1 = Function.call.bind(Object.prototype.hasOwnProperty);
1172
+
1183
1173
  var printWarning$1 = function printWarning() {};
1184
1174
 
1185
1175
  if (process.env.NODE_ENV !== 'production') {
1186
1176
  var ReactPropTypesSecret = ReactPropTypesSecret_1;
1187
1177
  var loggedTypeFailures = {};
1188
- var has$1 = Function.call.bind(Object.prototype.hasOwnProperty);
1178
+ var has = has$1;
1189
1179
 
1190
1180
  printWarning$1 = function printWarning(text) {
1191
1181
  var message = 'Warning: ' + text;
@@ -1199,7 +1189,9 @@ if (process.env.NODE_ENV !== 'production') {
1199
1189
  // This error was thrown as a convenience so that you can use this stack
1200
1190
  // to find the callsite that caused this warning to fire.
1201
1191
  throw new Error(message);
1202
- } catch (x) {}
1192
+ } catch (x) {
1193
+ /**/
1194
+ }
1203
1195
  };
1204
1196
  }
1205
1197
  /**
@@ -1218,7 +1210,7 @@ if (process.env.NODE_ENV !== 'production') {
1218
1210
  function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
1219
1211
  if (process.env.NODE_ENV !== 'production') {
1220
1212
  for (var typeSpecName in typeSpecs) {
1221
- if (has$1(typeSpecs, typeSpecName)) {
1213
+ if (has(typeSpecs, typeSpecName)) {
1222
1214
  var error; // Prop type validation may throw. In case they do, we don't want to
1223
1215
  // fail the render phase where it didn't fail before. So we log it.
1224
1216
  // After these have been cleaned up, we'll let them throw.
@@ -1227,7 +1219,7 @@ function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
1227
1219
  // This is intentionally an invariant that gets caught. It's the same
1228
1220
  // behavior as without this statement except with a better message.
1229
1221
  if (typeof typeSpecs[typeSpecName] !== 'function') {
1230
- var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + _typeof(typeSpecs[typeSpecName]) + '`.');
1222
+ var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + _typeof(typeSpecs[typeSpecName]) + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');
1231
1223
  err.name = 'Invariant Violation';
1232
1224
  throw err;
1233
1225
  }
@@ -1267,8 +1259,6 @@ checkPropTypes.resetWarningCache = function () {
1267
1259
 
1268
1260
  var checkPropTypes_1 = checkPropTypes;
1269
1261
 
1270
- var has = Function.call.bind(Object.prototype.hasOwnProperty);
1271
-
1272
1262
  var printWarning = function printWarning() {};
1273
1263
 
1274
1264
  if (process.env.NODE_ENV !== 'production') {
@@ -1372,6 +1362,7 @@ var factoryWithTypeCheckers = function factoryWithTypeCheckers(isValidElement, t
1372
1362
 
1373
1363
  var ReactPropTypes = {
1374
1364
  array: createPrimitiveTypeChecker('array'),
1365
+ bigint: createPrimitiveTypeChecker('bigint'),
1375
1366
  bool: createPrimitiveTypeChecker('boolean'),
1376
1367
  func: createPrimitiveTypeChecker('function'),
1377
1368
  number: createPrimitiveTypeChecker('number'),
@@ -1419,8 +1410,9 @@ var factoryWithTypeCheckers = function factoryWithTypeCheckers(isValidElement, t
1419
1410
  */
1420
1411
 
1421
1412
 
1422
- function PropTypeError(message) {
1413
+ function PropTypeError(message, data) {
1423
1414
  this.message = message;
1415
+ this.data = data && _typeof(data) === 'object' ? data : {};
1424
1416
  this.stack = '';
1425
1417
  } // Make `instanceof Error` still work for returned errors.
1426
1418
 
@@ -1486,7 +1478,9 @@ var factoryWithTypeCheckers = function factoryWithTypeCheckers(isValidElement, t
1486
1478
  // check, but we can offer a more precise error message here rather than
1487
1479
  // 'of type `object`'.
1488
1480
  var preciseType = getPreciseType(propValue);
1489
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
1481
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'), {
1482
+ expectedType: expectedType
1483
+ });
1490
1484
  }
1491
1485
 
1492
1486
  return null;
@@ -1621,7 +1615,7 @@ var factoryWithTypeCheckers = function factoryWithTypeCheckers(isValidElement, t
1621
1615
  }
1622
1616
 
1623
1617
  for (var key in propValue) {
1624
- if (has(propValue, key)) {
1618
+ if (has$1(propValue, key)) {
1625
1619
  var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
1626
1620
 
1627
1621
  if (error instanceof Error) {
@@ -1652,15 +1646,23 @@ var factoryWithTypeCheckers = function factoryWithTypeCheckers(isValidElement, t
1652
1646
  }
1653
1647
 
1654
1648
  function validate(props, propName, componentName, location, propFullName) {
1649
+ var expectedTypes = [];
1650
+
1655
1651
  for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
1656
1652
  var checker = arrayOfTypeCheckers[i];
1653
+ var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret_1);
1657
1654
 
1658
- if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret_1) == null) {
1655
+ if (checkerResult == null) {
1659
1656
  return null;
1660
1657
  }
1658
+
1659
+ if (checkerResult.data && has$1(checkerResult.data, 'expectedType')) {
1660
+ expectedTypes.push(checkerResult.data.expectedType);
1661
+ }
1661
1662
  }
1662
1663
 
1663
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
1664
+ var expectedTypesMessage = expectedTypes.length > 0 ? ', expected one of type [' + expectedTypes.join(', ') + ']' : '';
1665
+ return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.'));
1664
1666
  }
1665
1667
 
1666
1668
  return createChainableTypeChecker(validate);
@@ -1678,6 +1680,10 @@ var factoryWithTypeCheckers = function factoryWithTypeCheckers(isValidElement, t
1678
1680
  return createChainableTypeChecker(validate);
1679
1681
  }
1680
1682
 
1683
+ function invalidValidatorError(componentName, location, propFullName, key, type) {
1684
+ return new PropTypeError((componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + type + '`.');
1685
+ }
1686
+
1681
1687
  function createShapeTypeChecker(shapeTypes) {
1682
1688
  function validate(props, propName, componentName, location, propFullName) {
1683
1689
  var propValue = props[propName];
@@ -1690,8 +1696,8 @@ var factoryWithTypeCheckers = function factoryWithTypeCheckers(isValidElement, t
1690
1696
  for (var key in shapeTypes) {
1691
1697
  var checker = shapeTypes[key];
1692
1698
 
1693
- if (!checker) {
1694
- continue;
1699
+ if (typeof checker !== 'function') {
1700
+ return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
1695
1701
  }
1696
1702
 
1697
1703
  var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
@@ -1714,8 +1720,7 @@ var factoryWithTypeCheckers = function factoryWithTypeCheckers(isValidElement, t
1714
1720
 
1715
1721
  if (propType !== 'object') {
1716
1722
  return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
1717
- } // We need to check all keys in case some are required but missing from
1718
- // props.
1723
+ } // We need to check all keys in case some are required but missing from props.
1719
1724
 
1720
1725
 
1721
1726
  var allKeys = objectAssign({}, props[propName], shapeTypes);
@@ -1723,6 +1728,10 @@ var factoryWithTypeCheckers = function factoryWithTypeCheckers(isValidElement, t
1723
1728
  for (var key in allKeys) {
1724
1729
  var checker = shapeTypes[key];
1725
1730
 
1731
+ if (has$1(shapeTypes, key) && typeof checker !== 'function') {
1732
+ return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
1733
+ }
1734
+
1726
1735
  if (!checker) {
1727
1736
  return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' + '\nBad object: ' + JSON.stringify(props[propName], null, ' ') + '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' '));
1728
1737
  }
@@ -1921,6 +1930,7 @@ var factoryWithThrowingShims = function factoryWithThrowingShims() {
1921
1930
 
1922
1931
  var ReactPropTypes = {
1923
1932
  array: shim,
1933
+ bigint: shim,
1924
1934
  bool: shim,
1925
1935
  func: shim,
1926
1936
  number: shim,
@@ -1964,6 +1974,7 @@ var propTypes = createCommonjsModule(function (module) {
1964
1974
  module.exports = factoryWithThrowingShims();
1965
1975
  }
1966
1976
  });
1977
+ var PropTypes = propTypes;
1967
1978
 
1968
1979
  /**
1969
1980
  * A Handsontable-ReactJS wrapper.
@@ -2602,9 +2613,9 @@ var HotTable = /*#__PURE__*/function (_React$Component) {
2602
2613
 
2603
2614
 
2604
2615
  HotTable.propTypes = {
2605
- style: propTypes.object,
2606
- id: propTypes.string,
2607
- className: propTypes.string
2616
+ style: PropTypes.object,
2617
+ id: PropTypes.string,
2618
+ className: PropTypes.string
2608
2619
  };
2609
2620
 
2610
2621
  var BaseEditorComponent = /*#__PURE__*/function (_React$Component) {
@@ -2894,15 +2905,26 @@ var BaseEditorComponent = /*#__PURE__*/function (_React$Component) {
2894
2905
  return (_Handsontable$editors22 = Handsontable.editors.BaseEditor.prototype.getEditedCell).call.apply(_Handsontable$editors22, [this.hotCustomEditorInstance].concat(args));
2895
2906
  }
2896
2907
  }, {
2897
- key: "getEditedCellsZIndex",
2898
- value: function getEditedCellsZIndex() {
2908
+ key: "getEditedCellRect",
2909
+ value: function getEditedCellRect() {
2899
2910
  var _Handsontable$editors23;
2900
2911
 
2901
2912
  for (var _len23 = arguments.length, args = new Array(_len23), _key23 = 0; _key23 < _len23; _key23++) {
2902
2913
  args[_key23] = arguments[_key23];
2903
2914
  }
2904
2915
 
2905
- return (_Handsontable$editors23 = Handsontable.editors.BaseEditor.prototype.getEditedCellsZIndex).call.apply(_Handsontable$editors23, [this.hotCustomEditorInstance].concat(args));
2916
+ return (_Handsontable$editors23 = Handsontable.editors.BaseEditor.prototype.getEditedCellRect).call.apply(_Handsontable$editors23, [this.hotCustomEditorInstance].concat(args));
2917
+ }
2918
+ }, {
2919
+ key: "getEditedCellsZIndex",
2920
+ value: function getEditedCellsZIndex() {
2921
+ var _Handsontable$editors24;
2922
+
2923
+ for (var _len24 = arguments.length, args = new Array(_len24), _key24 = 0; _key24 < _len24; _key24++) {
2924
+ args[_key24] = arguments[_key24];
2925
+ }
2926
+
2927
+ return (_Handsontable$editors24 = Handsontable.editors.BaseEditor.prototype.getEditedCellsZIndex).call.apply(_Handsontable$editors24, [this.hotCustomEditorInstance].concat(args));
2906
2928
  }
2907
2929
  }]);
2908
2930
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@handsontable/react",
3
- "version": "11.0.1",
3
+ "version": "12.0.1",
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",
@@ -10,6 +10,12 @@
10
10
  "jsdelivr": "./dist/react-handsontable.min.js",
11
11
  "unpkg": "./dist/react-handsontable.min.js",
12
12
  "types": "./index.d.ts",
13
+ "exports": {
14
+ ".": {
15
+ "import": "./es/react-handsontable.js",
16
+ "require": "./commonjs/react-handsontable.js"
17
+ }
18
+ },
13
19
  "keywords": [
14
20
  "handsontable",
15
21
  "component",
@@ -52,8 +58,6 @@
52
58
  "@babel/preset-react": "^7.9.4",
53
59
  "@babel/preset-typescript": "^7.9.0",
54
60
  "@babel/runtime": "^7.9.2",
55
- "@types/enzyme": "^3.1.15",
56
- "@types/enzyme-adapter-react-16": "^1.0.3",
57
61
  "@types/react": "^16.9.5",
58
62
  "@types/react-dom": "^16.9.1",
59
63
  "@types/react-redux": "^7.1.7",
@@ -61,10 +65,7 @@
61
65
  "cpy-cli": "^3.1.1",
62
66
  "cross-env": "^5.2.0",
63
67
  "del-cli": "^3.0.1",
64
- "enzyme": "^3.10.0",
65
- "enzyme-adapter-react-16": "^1.14.0",
66
- "enzyme-to-json": "^3.4.0",
67
- "handsontable": "^11.0.0",
68
+ "handsontable": "^12.0.0",
68
69
  "jest": "^25.1.0",
69
70
  "prop-types": "^15.7.2",
70
71
  "react": "^16.10.2",
@@ -84,7 +85,7 @@
84
85
  "uglify-js": "^3.4.9"
85
86
  },
86
87
  "peerDependencies": {
87
- "handsontable": ">=11.0.0"
88
+ "handsontable": ">=12.0.0"
88
89
  },
89
90
  "scripts": {
90
91
  "build": "npm run clean && npm run build:commonjs && npm run build:es && npm run build:umd && npm run build:min",
@@ -100,12 +101,6 @@
100
101
  },
101
102
  "jest": {
102
103
  "testURL": "http://localhost/",
103
- "setupFiles": [
104
- "./test/jestsetup.ts"
105
- ],
106
- "snapshotSerializers": [
107
- "enzyme-to-json/serializer"
108
- ],
109
104
  "transform": {
110
105
  "^.+\\.tsx?$": "babel-jest",
111
106
  "^.+\\.js$": "babel-jest"
package/types.d.ts CHANGED
@@ -41,7 +41,7 @@ export interface HotColumnProps extends Handsontable.ColumnSettings {
41
41
  _emitColumnSettings?: (columnSettings: Handsontable.ColumnSettings, columnIndex: number) => void;
42
42
  _columnIndex?: number;
43
43
  _getChildElementByType?: (children: React.ReactNode, type: string) => React.ReactElement;
44
- _getRendererWrapper?: (rendererNode: React.ReactElement) => Handsontable.renderers.Base;
44
+ _getRendererWrapper?: (rendererNode: React.ReactElement) => typeof Handsontable.renderers.BaseRenderer;
45
45
  _getEditorClass?: (editorElement: React.ReactElement, editorColumnScope: EditorScopeIdentifier) => typeof Handsontable.editors.BaseEditor;
46
46
  _getEditorCache?: () => HotEditorCache;
47
47
  _getOwnerDocument?: () => Document;