@adaptabletools/adaptable-react-aggrid-cjs 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,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptabletools/adaptable-react-aggrid-cjs",
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",
@@ -8,7 +8,7 @@
8
8
  "typings": "src/index.d.ts",
9
9
  "dependencies": {
10
10
  "tslib": "^2.3.0",
11
- "@adaptabletools/adaptable-cjs": "18.0.9"
11
+ "@adaptabletools/adaptable-cjs": "18.0.10-canary.0"
12
12
  },
13
13
  "peerDependencies": {
14
14
  "react": "^18.0.0",
@@ -87,20 +87,22 @@ const AdaptableUI = (props) => {
87
87
  if (transition === AdaptableAgGridStateTransitions.AG_GRID_EMIT_PROPS) {
88
88
  return null;
89
89
  }
90
- return (React.createElement(AdaptableReact_1.default, Object.assign({ style: props.style, className: props.className, gridOptions: gridOptions, modules: modules }, adaptableProps)));
90
+ return (React.createElement(AdaptableReact_1.default
91
+ // This needs to be first, so gridOptions is the one passed and not from props
92
+ , Object.assign({}, adaptableProps, { style: props.style, className: props.className, gridOptions: gridOptions, modules: modules })));
91
93
  };
92
94
  const AdaptableAgGridReact = (props) => {
93
95
  const agGridRef = React.useRef(null);
94
96
  const { modules, gridOptions, setAgGridApi, transition, setAgGridProps } = useAdaptableAgGridContext();
97
+ const LIST_OF_PROPS_NOT_ON_GRID_OPTIONS = [
98
+ 'containerStyle',
99
+ 'className',
100
+ 'setGridApi',
101
+ 'componentWrappingElement',
102
+ 'maxComponentCreationTimeMs',
103
+ 'children',
104
+ ];
95
105
  React.useEffect(() => {
96
- const LIST_OF_PROPS_NOT_ON_GRID_OPTIONS = [
97
- 'containerStyle',
98
- 'className',
99
- 'setGridApi',
100
- 'componentWrappingElement',
101
- 'maxComponentCreationTimeMs',
102
- 'children',
103
- ];
104
106
  const agGridProps = Object.keys(props).reduce((acc, key) => {
105
107
  if (LIST_OF_PROPS_NOT_ON_GRID_OPTIONS.includes(key)) {
106
108
  return acc;
@@ -109,10 +111,19 @@ const AdaptableAgGridReact = (props) => {
109
111
  }, {});
110
112
  setAgGridProps(agGridProps);
111
113
  }, []);
114
+ const agGridPassThroughProps = React.useMemo(() => {
115
+ return LIST_OF_PROPS_NOT_ON_GRID_OPTIONS.reduce((acc, key) => {
116
+ if (key in props) {
117
+ // @ts-ignore
118
+ acc[key] = props[key];
119
+ }
120
+ return acc;
121
+ }, {});
122
+ }, [props]);
112
123
  if (transition !== AdaptableAgGridStateTransitions.INITIALIZE_AG_GRID) {
113
124
  return null;
114
125
  }
115
- return (React.createElement(react_1.AgGridReact, Object.assign({ ref: agGridRef }, props, { modules: modules, onGridReady: (event) => {
126
+ return (React.createElement(react_1.AgGridReact, Object.assign({ ref: agGridRef }, agGridPassThroughProps, { modules: modules, onGridReady: (event) => {
116
127
  setAgGridApi(event.api);
117
128
  if (props.onGridReady) {
118
129
  props.onGridReady(event);