@azrico/reactgrid 1.3.28 → 1.3.31
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/dist/src/views/DataGrid.js +13 -24
- package/package.json +5 -4
- package/src/views/DataGrid.tsx +23 -31
|
@@ -142,7 +142,10 @@ 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())
|
|
145
|
+
if (!rowProps || !rowProps.data || _func_child.func_selection.has_selection()) {
|
|
146
|
+
update_menuRow(null, null);
|
|
147
|
+
return true;
|
|
148
|
+
}
|
|
146
149
|
event.preventDefault();
|
|
147
150
|
const realRow = (0, _func_grid.find_realData)(rowProps.dataSourceArray, event.target, rowProps.data);
|
|
148
151
|
const anEl = _func_child.func_selection.getVirtualElement(event.clientX, event.clientY);
|
|
@@ -150,25 +153,9 @@ function DataGridEventsWrapper(props) {
|
|
|
150
153
|
return false;
|
|
151
154
|
}, []);
|
|
152
155
|
const update_menuRow = _react.default.useCallback((r = null, el = null) => {
|
|
153
|
-
// console.log('Set menuRow:', r);
|
|
154
156
|
set_menuRow(r || null);
|
|
155
157
|
set_menuAnchorEl(el || null);
|
|
156
158
|
}, []);
|
|
157
|
-
const renderRowContextMenu = _react.default.useCallback((menuProps, {
|
|
158
|
-
rowProps
|
|
159
|
-
}) => {
|
|
160
|
-
menuProps.autoDismiss = true;
|
|
161
|
-
function onclose() {
|
|
162
|
-
menuProps.onDismiss();
|
|
163
|
-
update_menuRow();
|
|
164
|
-
}
|
|
165
|
-
return _react.default.createElement(_controls.ContextMenu, {
|
|
166
|
-
menuAnchorEl: menuAnchorEl,
|
|
167
|
-
menuRow: menuRow,
|
|
168
|
-
close: onclose,
|
|
169
|
-
menu_items: props.contextMenuItems
|
|
170
|
-
});
|
|
171
|
-
}, [props.contextMenuItems, menuAnchorEl, menuRow, update_menuRow]);
|
|
172
159
|
/* -------------------------------------------------------------------------- */
|
|
173
160
|
const onRenderRow = (0, _react.useCallback)(rowProps => {
|
|
174
161
|
// save the original handlers to be called later
|
|
@@ -183,27 +170,29 @@ function DataGridEventsWrapper(props) {
|
|
|
183
170
|
onRowClick: onRowClick,
|
|
184
171
|
onRowContextMenu: onRowContextMenu
|
|
185
172
|
};
|
|
186
|
-
const contextmenuProps = {
|
|
187
|
-
renderRowContextMenu: renderRowContextMenu
|
|
188
|
-
};
|
|
189
173
|
const renderProps = {
|
|
190
174
|
onRenderRow: onRenderRow
|
|
191
175
|
};
|
|
192
176
|
return {
|
|
193
177
|
...props.static_gridOptions,
|
|
194
178
|
...events,
|
|
195
|
-
...contextmenuProps,
|
|
196
179
|
...renderProps
|
|
197
180
|
};
|
|
198
|
-
}, [props.static_gridOptions
|
|
181
|
+
}, [props.static_gridOptions]);
|
|
199
182
|
/* -------------------------------------------------------------------------- */
|
|
200
|
-
return
|
|
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, {
|
|
201
190
|
...props,
|
|
202
191
|
static_gridOptions: static_gridOptions
|
|
203
192
|
}) : _react.default.createElement(DataGridSizeWrapper, {
|
|
204
193
|
...props,
|
|
205
194
|
static_gridOptions: static_gridOptions
|
|
206
|
-
});
|
|
195
|
+
}));
|
|
207
196
|
}
|
|
208
197
|
function DataGridDetailsWrapper(props) {
|
|
209
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.
|
|
3
|
+
"version": "1.3.31",
|
|
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.
|
|
33
|
-
"@azrico/object": "^1.4.
|
|
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
|
}
|
package/src/views/DataGrid.tsx
CHANGED
|
@@ -303,8 +303,12 @@ 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())
|
|
306
|
+
if (!rowProps || !rowProps.data || func_selection.has_selection()) {
|
|
307
|
+
update_menuRow(null, null);
|
|
308
|
+
return true;
|
|
309
|
+
}
|
|
307
310
|
event.preventDefault();
|
|
311
|
+
|
|
308
312
|
const realRow = find_realData(rowProps.dataSourceArray, event.target, rowProps.data);
|
|
309
313
|
const anEl = func_selection.getVirtualElement(event.clientX, event.clientY);
|
|
310
314
|
update_menuRow(realRow, anEl);
|
|
@@ -312,30 +316,10 @@ function DataGridEventsWrapper(props: DataGridWrapperProps) {
|
|
|
312
316
|
}, []);
|
|
313
317
|
|
|
314
318
|
const update_menuRow = React.useCallback((r: any = null, el: any = null) => {
|
|
315
|
-
// console.log('Set menuRow:', r);
|
|
316
319
|
set_menuRow(r || null);
|
|
317
320
|
set_menuAnchorEl(el || null);
|
|
318
321
|
}, []);
|
|
319
322
|
|
|
320
|
-
const renderRowContextMenu = React.useCallback(
|
|
321
|
-
(menuProps, { rowProps }) => {
|
|
322
|
-
menuProps.autoDismiss = true;
|
|
323
|
-
function onclose() {
|
|
324
|
-
menuProps.onDismiss();
|
|
325
|
-
update_menuRow();
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
return (
|
|
329
|
-
<ContextMenu
|
|
330
|
-
menuAnchorEl={menuAnchorEl}
|
|
331
|
-
menuRow={menuRow}
|
|
332
|
-
close={onclose}
|
|
333
|
-
menu_items={props.contextMenuItems as any}
|
|
334
|
-
/>
|
|
335
|
-
);
|
|
336
|
-
},
|
|
337
|
-
[props.contextMenuItems, menuAnchorEl, menuRow, update_menuRow]
|
|
338
|
-
);
|
|
339
323
|
/* -------------------------------------------------------------------------- */
|
|
340
324
|
const onRenderRow = useCallback((rowProps) => {
|
|
341
325
|
// save the original handlers to be called later
|
|
@@ -350,26 +334,34 @@ function DataGridEventsWrapper(props: DataGridWrapperProps) {
|
|
|
350
334
|
onRowClick: onRowClick,
|
|
351
335
|
onRowContextMenu: onRowContextMenu,
|
|
352
336
|
};
|
|
353
|
-
|
|
354
|
-
renderRowContextMenu: renderRowContextMenu,
|
|
355
|
-
};
|
|
337
|
+
|
|
356
338
|
const renderProps: any = {
|
|
357
339
|
onRenderRow: onRenderRow,
|
|
358
340
|
};
|
|
359
341
|
return {
|
|
360
342
|
...props.static_gridOptions,
|
|
361
343
|
...events,
|
|
362
|
-
...contextmenuProps,
|
|
363
344
|
...renderProps,
|
|
364
345
|
};
|
|
365
|
-
}, [props.static_gridOptions
|
|
346
|
+
}, [props.static_gridOptions]);
|
|
366
347
|
|
|
367
348
|
/* -------------------------------------------------------------------------- */
|
|
368
349
|
|
|
369
|
-
return
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
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
|
+
</>
|
|
373
365
|
);
|
|
374
366
|
}
|
|
375
367
|
|
|
@@ -399,7 +391,7 @@ function DataGridDetailsWrapper(props: DataGridWrapperProps) {
|
|
|
399
391
|
defaultFilterValue={props.details_filter}
|
|
400
392
|
dataSource={details_dataSource}
|
|
401
393
|
columns={cached_details_columns}
|
|
402
|
-
|
|
394
|
+
/>
|
|
403
395
|
);
|
|
404
396
|
};
|
|
405
397
|
|