@handsontable/react-wrapper 18.0.0 → 18.1.0-rc11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@handsontable/react-wrapper",
3
- "version": "18.0.0",
3
+ "version": "18.1.0-rc11",
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",
package/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import Handsontable from 'handsontable/base';
1
+ import Handsontable, { RemoveIndexSignature } from 'handsontable/base';
2
2
  import { ComponentType, CSSProperties, Dispatch, DispatchWithoutAction, ReactNode } from 'react';
3
3
  /**
4
4
  * Type of the identifier under which the cached components are stored.
@@ -37,11 +37,24 @@ export interface UseHotEditorImpl<T> {
37
37
  col?: number;
38
38
  }
39
39
  /**
40
- * Helper type to expose GridSettings/ColumnSettings props with native renderers/editors separately
41
- * from component-based render prop. Uses conditional types so it works with both GridSettings
42
- * and ColumnSettings (ColumnSettings' index signature can make it incompatible with strict Pick<>).
40
+ * Helper type to expose Handsontable settings as props with native renderers/editors separated from
41
+ * the component-based render prop.
42
+ *
43
+ * `RemoveIndexSignature` (imported from the core package) strips the `[key: string]: any` index
44
+ * signature that `GridSettings` carries. Without it, `Omit` widens `keyof T` to `string` and
45
+ * collapses to a bare index signature, dropping every named option — which is why `HotTableProps`/
46
+ * `HotColumnProps` had no option names to autocomplete. It is defined in core (and imported here
47
+ * rather than redefined) because this package's declaration compiler predates the `as` key-remapping
48
+ * the helper relies on.
49
+ *
50
+ * The trailing `& { [key: string]: any }` keeps the escape hatch that the raw settings types carry:
51
+ * cell-type and plugin options that are not declared on `GridSettings` (e.g. `correctFormat`,
52
+ * `datePickerConfig`) stay assignable. The named options above keep their real types regardless — the
53
+ * same pattern as `React.CSSProperties`, which autocompletes known properties yet still accepts
54
+ * arbitrary custom ones. Dropping this hatch would type-check-break existing configs that pass such
55
+ * options.
43
56
  */
44
- declare type ReplaceRenderersEditors<T> = Omit<T, 'renderer' | 'editor'> & {
57
+ declare type ReplaceRenderersEditors<T> = Omit<RemoveIndexSignature<T>, 'renderer' | 'editor'> & {
45
58
  hotRenderer?: T extends {
46
59
  renderer?: infer R;
47
60
  } ? R : never;
@@ -50,6 +63,17 @@ declare type ReplaceRenderersEditors<T> = Omit<T, 'renderer' | 'editor'> & {
50
63
  editor?: infer E;
51
64
  } ? E : never;
52
65
  editor?: ComponentType | boolean;
66
+ } & {
67
+ [key: string]: any;
68
+ };
69
+ /**
70
+ * Column props are the grid options (with the index signature stripped so the named options survive
71
+ * `Omit`) plus the column-specific `data` type. `data` is taken from `ColumnSettings` — an explicit
72
+ * member that resolves even though `ColumnSettings` itself carries the broad index signature — so the
73
+ * column form (`string | number | getter/setter`) overrides the grid's whole-table `data` type.
74
+ */
75
+ declare type ColumnGridSettings = Omit<RemoveIndexSignature<Handsontable.GridSettings>, 'data'> & {
76
+ data?: Handsontable.ColumnSettings['data'];
53
77
  };
54
78
  /**
55
79
  * Interface for the `prop` of the HotTable component - extending the default Handsontable settings with additional,
@@ -64,7 +88,7 @@ export interface HotTableProps extends ReplaceRenderersEditors<Handsontable.Grid
64
88
  /**
65
89
  * Properties related to the HotColumn architecture.
66
90
  */
67
- export interface HotColumnProps extends ReplaceRenderersEditors<Handsontable.ColumnSettings> {
91
+ export interface HotColumnProps extends ReplaceRenderersEditors<ColumnGridSettings> {
68
92
  children?: ReactNode;
69
93
  }
70
94
  /**