@azrico/reactgrid 1.2.36 → 1.2.38

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/CHANGELOG.md CHANGED
@@ -2,6 +2,34 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [1.2.38](https://github.com/Azrideus/azrico-reactgrid/compare/v1.2.10...v1.2.38) (2023-07-09)
6
+
7
+
8
+ ### Features
9
+
10
+ * editable can be a function ([6ea857e](https://github.com/Azrideus/azrico-reactgrid/commit/6ea857e4f403d2a334dc5e74065f6b8033277ca4))
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * DataGridDelayedSizeWrapper actual delayed ([2ddfd2f](https://github.com/Azrideus/azrico-reactgrid/commit/2ddfd2fb58c90bd906e1330f22f0ef7468d34afb))
16
+ * onCellSelectionChange ([95c8f54](https://github.com/Azrideus/azrico-reactgrid/commit/95c8f540e94dde0c7e245fb29fb6afc7172957ec))
17
+ * styling ([9018f75](https://github.com/Azrideus/azrico-reactgrid/commit/9018f7593e253720f751f52855a2d956dfc578ed))
18
+
19
+ ### [1.2.37](https://github.com/Azrideus/azrico-reactgrid/compare/v1.2.10...v1.2.37) (2023-07-09)
20
+
21
+
22
+ ### Features
23
+
24
+ * editable can be a function ([6ea857e](https://github.com/Azrideus/azrico-reactgrid/commit/6ea857e4f403d2a334dc5e74065f6b8033277ca4))
25
+
26
+
27
+ ### Bug Fixes
28
+
29
+ * DataGridDelayedSizeWrapper actual delayed ([2ddfd2f](https://github.com/Azrideus/azrico-reactgrid/commit/2ddfd2fb58c90bd906e1330f22f0ef7468d34afb))
30
+ * onCellSelectionChange ([95c8f54](https://github.com/Azrideus/azrico-reactgrid/commit/95c8f540e94dde0c7e245fb29fb6afc7172957ec))
31
+ * styling ([9018f75](https://github.com/Azrideus/azrico-reactgrid/commit/9018f7593e253720f751f52855a2d956dfc578ed))
32
+
5
33
  ### [1.2.36](https://github.com/Azrideus/azrico-reactgrid/compare/v1.2.10...v1.2.36) (2023-07-09)
6
34
 
7
35
 
@@ -11,9 +11,7 @@ require("@inovua/reactdatagrid-enterprise/theme/amber-dark.css");
11
11
  require("../themes/base_styles.css");
12
12
  require("../themes/grid.css");
13
13
  var _func_grid = require("../func/func_grid");
14
- var _controls = require("@azrico/controls");
15
14
  var _react = _interopRequireDefault(require("react"));
16
- var _func_child = require("../func/func_child");
17
15
  var _reactdatagridEnterprise = _interopRequireDefault(require("@inovua/reactdatagrid-enterprise"));
18
16
  var _clsx = _interopRequireDefault(require("clsx"));
19
17
  var _reactUseSize = require("react-use-size");
@@ -115,15 +113,7 @@ function DataGridEventsWrapper(props) {
115
113
  /* -------------------------------------------------------------------------- */
116
114
  const click_data = _react.default.useRef(null);
117
115
  const [menuAnchorEl, set_menuAnchorEl] = _react.default.useState(null);
118
- const [menuRow, set_menuRow] = _react.default.useState(null);
119
116
  /* --------------------------------- events --------------------------------- */
120
- const onRowContextMenu = _react.default.useCallback((rowProps, event) => {
121
- if (!rowProps || !rowProps.data || _func_child.func_selection.has_selection()) return;
122
- const anEl = _func_child.func_selection.getVirtualElement(event.clientX, event.clientY);
123
- update_menuRow(rowProps.data);
124
- update_menuAnchorEl(anEl);
125
- event.preventDefault();
126
- }, []);
127
117
  const onRowClick = _react.default.useCallback((rowProps, event) => {
128
118
  const nowDate = Date.now();
129
119
  const lastclick = click_data.current[(0, _func_grid.get_row_id)(rowProps)];
@@ -141,44 +131,59 @@ function DataGridEventsWrapper(props) {
141
131
  click_data.current = {};
142
132
  }, [props.dataSource]);
143
133
  /* ------------------------------- ContextMenu ------------------------------ */
134
+ // const onRowContextMenu = React.useCallback((rowProps, event) => {
135
+ // if (!rowProps || !rowProps.data || func_selection.has_selection()) return;
136
+ // const anEl = func_selection.getVirtualElement(event.clientX, event.clientY);
137
+ // update_menuAnchorEl(anEl);
138
+ // }, []);
139
+ const renderRowContextMenu = _react.default.useCallback((menuProps, rowProps) => {
140
+ menuProps.autoDismiss = true;
141
+ menuProps.items = [{
142
+ label: 'Row ' + rowProps.rowIndex
143
+ }, {
144
+ label: 'Want to visit ' + rowProps.data.country + '?'
145
+ }];
146
+ // return (
147
+ // <ContextMenu
148
+ // menuAnchorEl={menuAnchorEl}
149
+ // set_menuAnchorEl={update_menuAnchorEl}
150
+ // menuRow={rowProps.data}
151
+ // menu_items={props.contextMenuItems as any}
152
+ // />
153
+ // );
154
+ }, [props.contextMenuItems]);
144
155
  const update_menuAnchorEl = _react.default.useCallback(el => {
145
156
  set_menuAnchorEl(el || null);
146
157
  }, []);
147
- const update_menuRow = _react.default.useCallback(r => {
148
- set_menuRow(r || null);
149
- }, []);
150
158
  /**
151
159
  * Merge click events into grid options
152
160
  */
153
161
  const static_gridOptions = _react.default.useMemo(() => {
154
162
  const events = {
155
- onRowClick: onRowClick,
156
- onRowContextMenu: onRowContextMenu
163
+ onRowClick: onRowClick
164
+ //onRowContextMenu: onRowContextMenu,
165
+ };
166
+
167
+ const contextmenuProps = {
168
+ renderRowContextMenu: renderRowContextMenu
157
169
  };
158
170
  return {
159
171
  ...props.static_gridOptions,
160
- ...events
172
+ ...events,
173
+ ...contextmenuProps
161
174
  };
162
175
  }, [props.static_gridOptions, onRowClick]);
163
176
  /* -------------------------------------------------------------------------- */
164
- const contextMenu = _react.default.useMemo(() => {
165
- return _react.default.createElement(_controls.ContextMenu, {
166
- menuAnchorEl: menuAnchorEl,
167
- set_menuAnchorEl: update_menuAnchorEl,
168
- menuRow: menuRow,
169
- menu_items: props.contextMenuItems
170
- });
171
- }, [menuRow, menuAnchorEl, props.contextMenuItems]);
172
177
  if (props.details_dataSource) {
173
178
  return _react.default.createElement(DataGridDetailsWrapper, {
174
179
  ...props,
175
180
  static_gridOptions: static_gridOptions
176
- }, contextMenu);
181
+ });
177
182
  } else {
178
183
  return _react.default.createElement(DataGridSizeWrapper, {
179
184
  ...props,
180
185
  static_gridOptions: static_gridOptions
181
- }, contextMenu);
186
+ });
182
187
  }
183
188
  }
184
189
  function DataGridDetailsWrapper(props) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azrico/reactgrid",
3
- "version": "1.2.36",
3
+ "version": "1.2.38",
4
4
  "main": "dist/index.js",
5
5
  "description": "React Datagrid",
6
6
  "author": "Azrideus <MehrdadTavangar@gmail.com>",
@@ -259,18 +259,9 @@ function DataGridEventsWrapper(props: DataGridWrapperProps) {
259
259
  const click_data = React.useRef<any>(null);
260
260
 
261
261
  const [menuAnchorEl, set_menuAnchorEl] = React.useState<any>(null);
262
- const [menuRow, set_menuRow] = React.useState<any>(null);
263
262
 
264
263
  /* --------------------------------- events --------------------------------- */
265
264
 
266
- const onRowContextMenu = React.useCallback((rowProps, event) => {
267
- if (!rowProps || !rowProps.data || func_selection.has_selection()) return;
268
-
269
- const anEl = func_selection.getVirtualElement(event.clientX, event.clientY);
270
- update_menuRow(rowProps.data);
271
- update_menuAnchorEl(anEl);
272
- event.preventDefault();
273
- }, []);
274
265
  const onRowClick = React.useCallback(
275
266
  (rowProps, event) => {
276
267
  const nowDate = Date.now();
@@ -297,13 +288,36 @@ function DataGridEventsWrapper(props: DataGridWrapperProps) {
297
288
  }, [props.dataSource]);
298
289
 
299
290
  /* ------------------------------- ContextMenu ------------------------------ */
300
-
291
+ // const onRowContextMenu = React.useCallback((rowProps, event) => {
292
+ // if (!rowProps || !rowProps.data || func_selection.has_selection()) return;
293
+ // const anEl = func_selection.getVirtualElement(event.clientX, event.clientY);
294
+ // update_menuAnchorEl(anEl);
295
+ // }, []);
296
+ const renderRowContextMenu = React.useCallback(
297
+ (menuProps, rowProps) => {
298
+ menuProps.autoDismiss = true;
299
+ menuProps.items = [
300
+ {
301
+ label: 'Row ' + rowProps.rowIndex,
302
+ },
303
+ {
304
+ label: 'Want to visit ' + rowProps.data.country + '?',
305
+ },
306
+ ];
307
+ // return (
308
+ // <ContextMenu
309
+ // menuAnchorEl={menuAnchorEl}
310
+ // set_menuAnchorEl={update_menuAnchorEl}
311
+ // menuRow={rowProps.data}
312
+ // menu_items={props.contextMenuItems as any}
313
+ // />
314
+ // );
315
+ },
316
+ [props.contextMenuItems]
317
+ );
301
318
  const update_menuAnchorEl = React.useCallback((el) => {
302
319
  set_menuAnchorEl(el || null);
303
320
  }, []);
304
- const update_menuRow = React.useCallback((r) => {
305
- set_menuRow(r || null);
306
- }, []);
307
321
 
308
322
  /**
309
323
  * Merge click events into grid options
@@ -311,34 +325,29 @@ function DataGridEventsWrapper(props: DataGridWrapperProps) {
311
325
  const static_gridOptions = React.useMemo<AzGridOptions>(() => {
312
326
  const events: AzGridOptions = {
313
327
  onRowClick: onRowClick,
314
- onRowContextMenu: onRowContextMenu,
328
+ //onRowContextMenu: onRowContextMenu,
329
+ };
330
+ const contextmenuProps: AzGridOptions = {
331
+ renderRowContextMenu: renderRowContextMenu,
315
332
  };
316
- return { ...props.static_gridOptions, ...events };
333
+ return { ...props.static_gridOptions, ...events, ...contextmenuProps };
317
334
  }, [props.static_gridOptions, onRowClick]);
318
335
 
319
336
  /* -------------------------------------------------------------------------- */
320
- const contextMenu = React.useMemo(() => {
321
- return (
322
- <ContextMenu
323
- menuAnchorEl={menuAnchorEl}
324
- set_menuAnchorEl={update_menuAnchorEl}
325
- menuRow={menuRow}
326
- menu_items={props.contextMenuItems as any}
327
- />
328
- );
329
- }, [menuRow, menuAnchorEl, props.contextMenuItems]);
330
337
 
331
338
  if (props.details_dataSource) {
332
339
  return (
333
- <DataGridDetailsWrapper {...props} static_gridOptions={static_gridOptions}>
334
- {contextMenu}
335
- </DataGridDetailsWrapper>
340
+ <DataGridDetailsWrapper
341
+ {...props}
342
+ static_gridOptions={static_gridOptions}
343
+ ></DataGridDetailsWrapper>
336
344
  );
337
345
  } else {
338
346
  return (
339
- <DataGridSizeWrapper {...props} static_gridOptions={static_gridOptions}>
340
- {contextMenu}
341
- </DataGridSizeWrapper>
347
+ <DataGridSizeWrapper
348
+ {...props}
349
+ static_gridOptions={static_gridOptions}
350
+ ></DataGridSizeWrapper>
342
351
  );
343
352
  }
344
353
  }