@adaptabletools/adaptable-react-aggrid 18.0.9 → 18.0.10-canary.0

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,13 +1,14 @@
1
1
  {
2
2
  "name": "@adaptabletools/adaptable-react-aggrid",
3
- "version": "18.0.9",
3
+ "version": "18.0.10-canary.0",
4
4
  "description": "React version of AdapTable - the powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements",
5
5
  "keywords": [],
6
6
  "license": "contact sales@adaptabletools.com for details",
7
+ "main": "src/index.js",
7
8
  "typings": "src/index.d.ts",
8
9
  "dependencies": {
9
10
  "tslib": "^2.3.0",
10
- "@adaptabletools/adaptable": "18.0.9"
11
+ "@adaptabletools/adaptable": "18.0.10-canary.0"
11
12
  },
12
13
  "peerDependencies": {
13
14
  "@ag-grid-community/core": ">=31.3.1",
@@ -83,20 +83,22 @@ const AdaptableUI = (props) => {
83
83
  if (transition === AdaptableAgGridStateTransitions.AG_GRID_EMIT_PROPS) {
84
84
  return null;
85
85
  }
86
- return (React.createElement(AdaptableReactComponent, Object.assign({ style: props.style, className: props.className, gridOptions: gridOptions, modules: modules }, adaptableProps)));
86
+ return (React.createElement(AdaptableReactComponent
87
+ // This needs to be first, so gridOptions is the one passed and not from props
88
+ , Object.assign({}, adaptableProps, { style: props.style, className: props.className, gridOptions: gridOptions, modules: modules })));
87
89
  };
88
90
  const AdaptableAgGridReact = (props) => {
89
91
  const agGridRef = React.useRef(null);
90
92
  const { modules, gridOptions, setAgGridApi, transition, setAgGridProps } = useAdaptableAgGridContext();
93
+ const LIST_OF_PROPS_NOT_ON_GRID_OPTIONS = [
94
+ 'containerStyle',
95
+ 'className',
96
+ 'setGridApi',
97
+ 'componentWrappingElement',
98
+ 'maxComponentCreationTimeMs',
99
+ 'children',
100
+ ];
91
101
  React.useEffect(() => {
92
- const LIST_OF_PROPS_NOT_ON_GRID_OPTIONS = [
93
- 'containerStyle',
94
- 'className',
95
- 'setGridApi',
96
- 'componentWrappingElement',
97
- 'maxComponentCreationTimeMs',
98
- 'children',
99
- ];
100
102
  const agGridProps = Object.keys(props).reduce((acc, key) => {
101
103
  if (LIST_OF_PROPS_NOT_ON_GRID_OPTIONS.includes(key)) {
102
104
  return acc;
@@ -105,10 +107,19 @@ const AdaptableAgGridReact = (props) => {
105
107
  }, {});
106
108
  setAgGridProps(agGridProps);
107
109
  }, []);
110
+ const agGridPassThroughProps = React.useMemo(() => {
111
+ return LIST_OF_PROPS_NOT_ON_GRID_OPTIONS.reduce((acc, key) => {
112
+ if (key in props) {
113
+ // @ts-ignore
114
+ acc[key] = props[key];
115
+ }
116
+ return acc;
117
+ }, {});
118
+ }, [props]);
108
119
  if (transition !== AdaptableAgGridStateTransitions.INITIALIZE_AG_GRID) {
109
120
  return null;
110
121
  }
111
- return (React.createElement(AgGridReact, Object.assign({ ref: agGridRef }, props, { modules: modules, onGridReady: (event) => {
122
+ return (React.createElement(AgGridReact, Object.assign({ ref: agGridRef }, agGridPassThroughProps, { modules: modules, onGridReady: (event) => {
112
123
  setAgGridApi(event.api);
113
124
  if (props.onGridReady) {
114
125
  props.onGridReady(event);