@adaptabletools/adaptable-react-aggrid 23.0.4-canary.0 → 23.0.5-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",
3
- "version": "23.0.4-canary.0",
3
+ "version": "23.0.5-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
  "dependencies": {
9
9
  "tslib": "^2.8.1",
10
10
  "react-redux": "9.2.0",
11
- "@adaptabletools/adaptable": "23.0.4-canary.0"
11
+ "@adaptabletools/adaptable": "23.0.5-canary.0"
12
12
  },
13
13
  "peerDependencies": {
14
14
  "ag-grid-enterprise": ">=35.3.0",
@@ -10,7 +10,6 @@ const PLACEHOLDER_REDUX_STORE = {
10
10
  getState: () => ({}),
11
11
  subscribe: () => {
12
12
  return () => {
13
- /* noop unsubscribe */
14
13
  };
15
14
  },
16
15
  dispatch: (a) => a,
@@ -22,7 +21,6 @@ var AdaptableAgGridStateTransitions;
22
21
  AdaptableAgGridStateTransitions["INITIALIZE_AG_GRID"] = "INITIALIZE_AG_GRID";
23
22
  })(AdaptableAgGridStateTransitions || (AdaptableAgGridStateTransitions = {}));
24
23
  const agGridPropertySet = new Set(_GET_ALL_GRID_OPTIONS());
25
- // -- ADAPTABLE PROVIDER -
26
24
  const AdaptableAgGridContext = React.createContext(null);
27
25
  export const useAdaptableAgGridContext = () => {
28
26
  const context = React.useContext(AdaptableAgGridContext);
@@ -50,8 +48,6 @@ function usePromise() {
50
48
  const AdaptableProvider = (props) => {
51
49
  const [currentTransition, setCurrentTransition] = React.useState(AdaptableAgGridStateTransitions.AG_GRID_EMIT_PROPS);
52
50
  const useIdResult = useId();
53
- // Stable for the lifetime of this Provider — must not change when adaptableOptions
54
- // is recreated on parent re-render (e.g. inline object literals in JSX).
55
51
  const idRef = React.useRef(null);
56
52
  if (idRef.current === null) {
57
53
  idRef.current = `${props.adaptableOptions.adaptableId || 'adaptable'}-${useIdResult}`;
@@ -76,15 +72,8 @@ const AdaptableProvider = (props) => {
76
72
  setCurrentTransition(AdaptableAgGridStateTransitions.INITIALIZE_AG_GRID);
77
73
  return gridApiPromise;
78
74
  }, [gridApiPromise]);
79
- // this is a check to make sure the user is rendering Adaptable.AgGridReact inside Adaptable.Provider
80
- // and not AgGridReact directly
81
- // we're waiting 1s for this to happen
82
75
  React.useEffect(() => {
83
76
  const timeoutId = setTimeout(() => {
84
- // this ref is updated in setAgridProps function in the context
85
- // which is called by the Adaptable.AgGridReact component on mount
86
- // so if this has not been updated, it means the user is not rendering Adaptable.AgGridReact
87
- // so we show an error in the console and link to the docs
88
77
  if (!adaptableAgGridReactRenderedRef.current) {
89
78
  console.error('You are not rendering <Adaptable.AgGridReact /> inside <Adaptable.Provider />.');
90
79
  console.error('You are probably rendering <AgGridReact /> directly. Please use <Adaptable.AgGridReact /> instead.');
@@ -111,17 +100,14 @@ const AdaptableProvider = (props) => {
111
100
  setAgGridProps: (agGridProps) => {
112
101
  adaptableAgGridReactRenderedRef.current = true;
113
102
  setAgGridProps(agGridProps);
114
- // get props and add the to gridOptions
115
103
  const newGridOptions = {
116
104
  ...gridOptions,
117
105
  ...agGridProps,
118
106
  };
119
- // Check null or undefined
120
107
  if (newGridOptions.reactiveCustomComponents == null) {
121
108
  newGridOptions.reactiveCustomComponents = true;
122
109
  }
123
110
  setGridOptions(newGridOptions);
124
- // Adaptable has everything it needs to initialize
125
111
  setCurrentTransition(AdaptableAgGridStateTransitions.INITIALIZE_ADAPTABLE);
126
112
  },
127
113
  adaptableProps: {
@@ -131,15 +117,12 @@ const AdaptableProvider = (props) => {
131
117
  }, children: _jsx(ReduxProvider, { store: adaptableApi?.internalApi.getAdaptableInstance()?.adaptableStore?.TheStore ??
132
118
  PLACEHOLDER_REDUX_STORE, children: props.children }) }));
133
119
  };
134
- // -- ADAPTABLE UI WRAPPER -
135
120
  const AdaptableUI = (props) => {
136
121
  const { adaptableProps, modules, gridOptions, transition, onAdaptableReady } = useAdaptableAgGridContext();
137
122
  if (transition === AdaptableAgGridStateTransitions.AG_GRID_EMIT_PROPS) {
138
123
  return null;
139
124
  }
140
- return (_jsx(AdaptableReactComponent
141
- // This needs to be first, so gridOptions is the one passed and not from props
142
- , { ...adaptableProps, onAdaptableReady: onAdaptableReady, style: props.style, className: props.className, gridOptions: gridOptions, modules: modules }));
125
+ return (_jsx(AdaptableReactComponent, { ...adaptableProps, onAdaptableReady: onAdaptableReady, style: props.style, className: props.className, gridOptions: gridOptions, modules: modules }));
143
126
  };
144
127
  const readyAGGridAdaptableInstances = new Map();
145
128
  const destroyCalledInstances = new Map();
@@ -181,7 +164,6 @@ const AdaptableAgGridReact = (props) => {
181
164
  const agGridPassThroughProps = React.useMemo(() => {
182
165
  return LIST_OF_PROPS_NOT_ON_GRID_OPTIONS.reduce((acc, key) => {
183
166
  if (key in props) {
184
- // @ts-ignore
185
167
  acc[key] = props[key];
186
168
  }
187
169
  return acc;
@@ -191,7 +173,6 @@ const AdaptableAgGridReact = (props) => {
191
173
  return null;
192
174
  }
193
175
  return (_jsx(AgGridReact, { ref: agGridRef, ...agGridPassThroughProps, modules: modules, onGridReady: (event) => {
194
- // this is not called extra in strict mode
195
176
  setAgGridApi(event.api);
196
177
  if (props.onGridReady) {
197
178
  props.onGridReady(event);
@@ -202,30 +183,17 @@ const AdaptableAgGridReact = (props) => {
202
183
  setAgGridIsReady(true);
203
184
  readyAGGridAdaptableInstances.set(id, true);
204
185
  }, onGridPreDestroyed: () => {
205
- // this is extra called in strict mode
206
- // when doing the double render
207
- // when we are in strict mode,
208
- // if gridPreDestroyed is called the second time
209
- // then we know it's a real destroy
210
186
  if (destroyCalledInstances.get(id) === true) {
211
- // so go ahead and reject the promise
212
187
  gridApiPromiseReject('ag grid destroy');
213
188
  destroyCalledInstances.delete(id);
214
189
  return;
215
190
  }
216
191
  destroyCalledInstances.set(id, true);
217
192
  if (readyAGGridAdaptableInstances.get(id) === true) {
218
- // in strict mode, gridPreDestroyed is called extra on mount, before the onGridReady
219
- // so if the instance is ready, we know it's a real destroy, not due to strict mode
220
- // so we can reject the promise
221
193
  readyAGGridAdaptableInstances.delete(id);
222
194
  gridApiPromiseReject('ag grid destroy');
223
195
  }
224
196
  else {
225
- // STILL, we might have an exception
226
- // when strict mode is not enabled,
227
- // then we really need to destroy the instance
228
- // but we'll only do this if the instance is not in readyAGGridAdaptableInstances
229
197
  setTimeout(() => {
230
198
  if (!readyAGGridAdaptableInstances.get(id)) {
231
199
  gridApiPromiseReject('ag grid destroy');
@@ -25,18 +25,6 @@ const AdaptableReact = ({ adaptableOptions, gridOptions, onAdaptableReady, ...pr
25
25
  destroyAgGrid: false,
26
26
  });
27
27
  adaptableApiRef.current = null;
28
- // We fully tore down a *ready* instance — i.e. a real unmount such as
29
- // navigation or an HMR / Fast Refresh update (where the container is
30
- // remounted but `id`, derived from `useId()`, stays the same). Clear the
31
- // module-level guards so the instance is recreated when the container
32
- // mounts again. Without this, `isInstanceStarted(id)` stays `true` and
33
- // the destroyed instance is never replaced, leaving components holding a
34
- // null api.
35
- //
36
- // In React StrictMode the transient unmount happens *before* the instance
37
- // becomes ready, so `successInstances.get(id)` is not yet `true` and this
38
- // branch is skipped — preserving the single in-flight init (no double
39
- // initialization).
40
28
  startedInstances.delete(id);
41
29
  successInstances.delete(id);
42
30
  }
@@ -69,7 +57,6 @@ const AdaptableReact = ({ adaptableOptions, gridOptions, onAdaptableReady, ...pr
69
57
  })
70
58
  .then((api) => {
71
59
  adaptableApiRef.current = api;
72
- //see #no_additional_react_root
73
60
  setAdaptableJSXElement(api.internalApi.getAdaptableJSXElement());
74
61
  if (onAdaptableReady) {
75
62
  api.eventApi.on('AdaptableReady', onAdaptableReady);
package/src/index.js CHANGED
@@ -1,9 +1,5 @@
1
- // export { default } from './components/AdaptableReact';
2
1
  import { AdaptableReactDateEditor, AdaptableReactNumberEditor, AdaptableReactPercentageEditor } from '@adaptabletools/adaptable';
3
2
  export * from '@adaptabletools/adaptable';
4
- // we want to shadow the `AdaptableNumberEditor`,
5
- // `AdaptablePercentageEditor`, and `AdaptableDateEditor` from `@adaptabletools/adaptable`
6
- // and pass the react variants for those editors
7
3
  export const AdaptableNumberEditor = AdaptableReactNumberEditor;
8
4
  export const AdaptablePercentageEditor = AdaptableReactPercentageEditor;
9
5
  export const AdaptableDateEditor = AdaptableReactDateEditor;