@azrico/reactgrid 1.3.27 → 1.3.30

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.
@@ -1,4 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export * from './views/DataGrid';
2
- import React from 'react';
3
- export declare function ExampleGrid(): React.JSX.Element;
3
+ export declare function ExampleGrid(): JSX.Element;
4
4
  export default ExampleGrid;
@@ -76,5 +76,5 @@ export type AzGridProps = {
76
76
  looseCacheCheck?: boolean;
77
77
  className?: string;
78
78
  };
79
- export declare function AzGrid(props: AzGridProps): React.JSX.Element;
79
+ export declare function AzGrid(props: AzGridProps): JSX.Element;
80
80
  export default AzGrid;
@@ -142,31 +142,20 @@ function DataGridEventsWrapper(props) {
142
142
  }, [props.dataSource]);
143
143
  /* ------------------------------- ContextMenu ------------------------------ */
144
144
  const onRowContextMenu = _react.default.useCallback((rowProps, event) => {
145
- if (!rowProps || !rowProps.data || _func_child.func_selection.has_selection()) return;
145
+ if (!rowProps || !rowProps.data || _func_child.func_selection.has_selection()) {
146
+ update_menuRow(null, null);
147
+ return true;
148
+ }
149
+ event.preventDefault();
146
150
  const realRow = (0, _func_grid.find_realData)(rowProps.dataSourceArray, event.target, rowProps.data);
147
151
  const anEl = _func_child.func_selection.getVirtualElement(event.clientX, event.clientY);
148
152
  update_menuRow(realRow, anEl);
153
+ return false;
149
154
  }, []);
150
155
  const update_menuRow = _react.default.useCallback((r = null, el = null) => {
151
- // console.log('Set menuRow:', r);
152
156
  set_menuRow(r || null);
153
157
  set_menuAnchorEl(el || null);
154
158
  }, []);
155
- const renderRowContextMenu = _react.default.useCallback((menuProps, {
156
- rowProps
157
- }) => {
158
- menuProps.autoDismiss = true;
159
- function onclose() {
160
- menuProps.onDismiss();
161
- update_menuRow();
162
- }
163
- return _react.default.createElement(_controls.ContextMenu, {
164
- menuAnchorEl: menuAnchorEl,
165
- menuRow: menuRow,
166
- close: onclose,
167
- menu_items: props.contextMenuItems
168
- });
169
- }, [props.contextMenuItems, menuAnchorEl, menuRow, update_menuRow]);
170
159
  /* -------------------------------------------------------------------------- */
171
160
  const onRenderRow = (0, _react.useCallback)(rowProps => {
172
161
  // save the original handlers to be called later
@@ -181,27 +170,29 @@ function DataGridEventsWrapper(props) {
181
170
  onRowClick: onRowClick,
182
171
  onRowContextMenu: onRowContextMenu
183
172
  };
184
- const contextmenuProps = {
185
- renderRowContextMenu: renderRowContextMenu
186
- };
187
173
  const renderProps = {
188
174
  onRenderRow: onRenderRow
189
175
  };
190
176
  return {
191
177
  ...props.static_gridOptions,
192
178
  ...events,
193
- ...contextmenuProps,
194
179
  ...renderProps
195
180
  };
196
- }, [props.static_gridOptions, renderRowContextMenu]);
181
+ }, [props.static_gridOptions]);
197
182
  /* -------------------------------------------------------------------------- */
198
- return props.details_dataSource ? _react.default.createElement(DataGridDetailsWrapper, {
183
+ return _react.default.createElement(_react.default.Fragment, null, _react.default.createElement(_controls.ContextMenu, {
184
+ menuAnchorEl: menuAnchorEl,
185
+ menuRow: menuRow,
186
+ close: update_menuRow,
187
+ dontAutoClose: false,
188
+ menu_items: props.contextMenuItems
189
+ }), props.details_dataSource ? _react.default.createElement(DataGridDetailsWrapper, {
199
190
  ...props,
200
191
  static_gridOptions: static_gridOptions
201
192
  }) : _react.default.createElement(DataGridSizeWrapper, {
202
193
  ...props,
203
194
  static_gridOptions: static_gridOptions
204
- });
195
+ }));
205
196
  }
206
197
  function DataGridDetailsWrapper(props) {
207
198
  const cached_details_columns = _react.default.useMemo(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azrico/reactgrid",
3
- "version": "1.3.27",
3
+ "version": "1.3.30",
4
4
  "main": "dist/index.js",
5
5
  "description": "React Datagrid",
6
6
  "author": "Azrideus <MehrdadTavangar@gmail.com>",
@@ -29,8 +29,8 @@
29
29
  "typescript": "^4.8.4"
30
30
  },
31
31
  "dependencies": {
32
- "@azrico/controls": "^1.5.62",
33
- "@azrico/object": "^1.4.67",
32
+ "@azrico/controls": "^1.5.84",
33
+ "@azrico/object": "^1.4.84",
34
34
  "@emotion/react": "^11.9.3",
35
35
  "@emotion/styled": "^11.9.3",
36
36
  "@inovua/reactdatagrid-enterprise": "^5.10.2",
@@ -60,5 +60,6 @@
60
60
  "last 1 firefox version",
61
61
  "last 1 safari version"
62
62
  ]
63
- }
63
+ },
64
+ "packageManager": "yarn@3.5.0"
64
65
  }
@@ -1,9 +1,9 @@
1
- {
2
- "short_name": "AzGrid",
3
- "name": "React Grid Wrapper",
4
- "icons": [],
5
- "start_url": "./index.html",
6
- "display": "standalone",
7
- "theme_color": "#000000",
8
- "background_color": "#ffffff"
9
- }
1
+ {
2
+ "short_name": "AzGrid",
3
+ "name": "React Grid Wrapper",
4
+ "icons": [],
5
+ "start_url": "./index.html",
6
+ "display": "standalone",
7
+ "theme_color": "#000000",
8
+ "background_color": "#ffffff"
9
+ }
@@ -303,37 +303,23 @@ function DataGridEventsWrapper(props: DataGridWrapperProps) {
303
303
 
304
304
  /* ------------------------------- ContextMenu ------------------------------ */
305
305
  const onRowContextMenu = React.useCallback((rowProps, event) => {
306
- if (!rowProps || !rowProps.data || func_selection.has_selection()) return;
306
+ if (!rowProps || !rowProps.data || func_selection.has_selection()) {
307
+ update_menuRow(null, null);
308
+ return true;
309
+ }
310
+ event.preventDefault();
311
+
307
312
  const realRow = find_realData(rowProps.dataSourceArray, event.target, rowProps.data);
308
313
  const anEl = func_selection.getVirtualElement(event.clientX, event.clientY);
309
314
  update_menuRow(realRow, anEl);
315
+ return false;
310
316
  }, []);
311
317
 
312
318
  const update_menuRow = React.useCallback((r: any = null, el: any = null) => {
313
- // console.log('Set menuRow:', r);
314
319
  set_menuRow(r || null);
315
320
  set_menuAnchorEl(el || null);
316
321
  }, []);
317
322
 
318
- const renderRowContextMenu = React.useCallback(
319
- (menuProps, { rowProps }) => {
320
- menuProps.autoDismiss = true;
321
- function onclose() {
322
- menuProps.onDismiss();
323
- update_menuRow();
324
- }
325
-
326
- return (
327
- <ContextMenu
328
- menuAnchorEl={menuAnchorEl}
329
- menuRow={menuRow}
330
- close={onclose}
331
- menu_items={props.contextMenuItems as any}
332
- />
333
- );
334
- },
335
- [props.contextMenuItems, menuAnchorEl, menuRow, update_menuRow]
336
- );
337
323
  /* -------------------------------------------------------------------------- */
338
324
  const onRenderRow = useCallback((rowProps) => {
339
325
  // save the original handlers to be called later
@@ -348,26 +334,34 @@ function DataGridEventsWrapper(props: DataGridWrapperProps) {
348
334
  onRowClick: onRowClick,
349
335
  onRowContextMenu: onRowContextMenu,
350
336
  };
351
- const contextmenuProps: AzGridOptions = {
352
- renderRowContextMenu: renderRowContextMenu,
353
- };
337
+
354
338
  const renderProps: any = {
355
339
  onRenderRow: onRenderRow,
356
340
  };
357
341
  return {
358
342
  ...props.static_gridOptions,
359
343
  ...events,
360
- ...contextmenuProps,
361
344
  ...renderProps,
362
345
  };
363
- }, [props.static_gridOptions, renderRowContextMenu]);
346
+ }, [props.static_gridOptions]);
364
347
 
365
348
  /* -------------------------------------------------------------------------- */
366
349
 
367
- return props.details_dataSource ? (
368
- <DataGridDetailsWrapper {...props} static_gridOptions={static_gridOptions} />
369
- ) : (
370
- <DataGridSizeWrapper {...props} static_gridOptions={static_gridOptions} />
350
+ return (
351
+ <>
352
+ <ContextMenu
353
+ menuAnchorEl={menuAnchorEl}
354
+ menuRow={menuRow}
355
+ close={update_menuRow}
356
+ dontAutoClose={false}
357
+ menu_items={props.contextMenuItems as any}
358
+ />
359
+ {props.details_dataSource ? (
360
+ <DataGridDetailsWrapper {...props} static_gridOptions={static_gridOptions} />
361
+ ) : (
362
+ <DataGridSizeWrapper {...props} static_gridOptions={static_gridOptions} />
363
+ )}
364
+ </>
371
365
  );
372
366
  }
373
367
 
@@ -397,7 +391,7 @@ function DataGridDetailsWrapper(props: DataGridWrapperProps) {
397
391
  defaultFilterValue={props.details_filter}
398
392
  dataSource={details_dataSource}
399
393
  columns={cached_details_columns}
400
- ></ReactDataGrid>
394
+ />
401
395
  );
402
396
  };
403
397
 
@@ -1,4 +1,4 @@
1
- export * from './DataGrid';
2
-
3
- import AzGrid from './DataGrid';
4
- export default AzGrid;
1
+ export * from './DataGrid';
2
+
3
+ import AzGrid from './DataGrid';
4
+ export default AzGrid;