@azrico/reactgrid 1.2.39 → 1.2.41
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 +28 -0
- package/dist/src/views/DataGrid.js +36 -35
- package/package.json +1 -1
- package/src/views/DataGrid.tsx +31 -40
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.41](https://github.com/Azrideus/azrico-reactgrid/compare/v1.2.10...v1.2.41) (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.40](https://github.com/Azrideus/azrico-reactgrid/compare/v1.2.10...v1.2.40) (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.39](https://github.com/Azrideus/azrico-reactgrid/compare/v1.2.10...v1.2.39) (2023-07-09)
|
|
6
34
|
|
|
7
35
|
|
|
@@ -11,7 +11,9 @@ 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");
|
|
14
15
|
var _react = _interopRequireDefault(require("react"));
|
|
16
|
+
var _func_child = require("../func/func_child");
|
|
15
17
|
var _reactdatagridEnterprise = _interopRequireDefault(require("@inovua/reactdatagrid-enterprise"));
|
|
16
18
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
17
19
|
var _reactUseSize = require("react-use-size");
|
|
@@ -131,26 +133,30 @@ function DataGridEventsWrapper(props) {
|
|
|
131
133
|
click_data.current = {};
|
|
132
134
|
}, [props.dataSource]);
|
|
133
135
|
/* ------------------------------- ContextMenu ------------------------------ */
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
const renderRowContextMenu = _react.default.useCallback((menuProps,
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
//
|
|
147
|
-
//
|
|
148
|
-
//
|
|
149
|
-
//
|
|
150
|
-
//
|
|
151
|
-
//
|
|
152
|
-
|
|
153
|
-
|
|
136
|
+
const onRowContextMenu = _react.default.useCallback((rowProps, event) => {
|
|
137
|
+
if (!rowProps || !rowProps.data || _func_child.func_selection.has_selection()) return;
|
|
138
|
+
const anEl = _func_child.func_selection.getVirtualElement(event.clientX, event.clientY);
|
|
139
|
+
update_menuAnchorEl(anEl);
|
|
140
|
+
}, []);
|
|
141
|
+
const renderRowContextMenu = _react.default.useCallback((menuProps, {
|
|
142
|
+
rowProps
|
|
143
|
+
}) => {
|
|
144
|
+
console.log('cm:', menuProps, rowProps, menuAnchorEl);
|
|
145
|
+
// menuProps.autoDismiss = true;
|
|
146
|
+
// menuProps.items = [
|
|
147
|
+
// {
|
|
148
|
+
// label: 'Row ' + rowProps.rowIndex,
|
|
149
|
+
// },
|
|
150
|
+
// {
|
|
151
|
+
// label: 'Want to visit ',
|
|
152
|
+
// },
|
|
153
|
+
// ];
|
|
154
|
+
return _react.default.createElement(_controls.ContextMenu, {
|
|
155
|
+
menuAnchorEl: menuAnchorEl,
|
|
156
|
+
set_menuAnchorEl: update_menuAnchorEl,
|
|
157
|
+
menuRow: rowProps.data,
|
|
158
|
+
menu_items: props.contextMenuItems
|
|
159
|
+
});
|
|
154
160
|
}, [props.contextMenuItems]);
|
|
155
161
|
const update_menuAnchorEl = _react.default.useCallback(el => {
|
|
156
162
|
set_menuAnchorEl(el || null);
|
|
@@ -160,10 +166,9 @@ function DataGridEventsWrapper(props) {
|
|
|
160
166
|
*/
|
|
161
167
|
const static_gridOptions = _react.default.useMemo(() => {
|
|
162
168
|
const events = {
|
|
163
|
-
onRowClick: onRowClick
|
|
164
|
-
|
|
169
|
+
onRowClick: onRowClick,
|
|
170
|
+
onRowContextMenu: onRowContextMenu
|
|
165
171
|
};
|
|
166
|
-
|
|
167
172
|
const contextmenuProps = {
|
|
168
173
|
renderRowContextMenu: renderRowContextMenu
|
|
169
174
|
};
|
|
@@ -172,19 +177,15 @@ function DataGridEventsWrapper(props) {
|
|
|
172
177
|
...events,
|
|
173
178
|
...contextmenuProps
|
|
174
179
|
};
|
|
175
|
-
}, [props.static_gridOptions, onRowClick]);
|
|
180
|
+
}, [props.static_gridOptions, onRowClick, onRowContextMenu, renderRowContextMenu]);
|
|
176
181
|
/* -------------------------------------------------------------------------- */
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
...props,
|
|
185
|
-
static_gridOptions: static_gridOptions
|
|
186
|
-
});
|
|
187
|
-
}
|
|
182
|
+
return props.details_dataSource ? _react.default.createElement(DataGridDetailsWrapper, {
|
|
183
|
+
...props,
|
|
184
|
+
static_gridOptions: static_gridOptions
|
|
185
|
+
}) : _react.default.createElement(DataGridSizeWrapper, {
|
|
186
|
+
...props,
|
|
187
|
+
static_gridOptions: static_gridOptions
|
|
188
|
+
});
|
|
188
189
|
}
|
|
189
190
|
function DataGridDetailsWrapper(props) {
|
|
190
191
|
const cached_details_columns = _react.default.useMemo(() => {
|
package/package.json
CHANGED
package/src/views/DataGrid.tsx
CHANGED
|
@@ -288,30 +288,31 @@ function DataGridEventsWrapper(props: DataGridWrapperProps) {
|
|
|
288
288
|
}, [props.dataSource]);
|
|
289
289
|
|
|
290
290
|
/* ------------------------------- ContextMenu ------------------------------ */
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
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
296
|
const renderRowContextMenu = React.useCallback(
|
|
297
|
-
(menuProps, rowProps) => {
|
|
298
|
-
|
|
299
|
-
menuProps.
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
//
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
297
|
+
(menuProps, { rowProps }) => {
|
|
298
|
+
console.log('cm:', menuProps, rowProps, menuAnchorEl);
|
|
299
|
+
// menuProps.autoDismiss = true;
|
|
300
|
+
// menuProps.items = [
|
|
301
|
+
// {
|
|
302
|
+
// label: 'Row ' + rowProps.rowIndex,
|
|
303
|
+
// },
|
|
304
|
+
// {
|
|
305
|
+
// label: 'Want to visit ',
|
|
306
|
+
// },
|
|
307
|
+
// ];
|
|
308
|
+
return (
|
|
309
|
+
<ContextMenu
|
|
310
|
+
menuAnchorEl={menuAnchorEl}
|
|
311
|
+
set_menuAnchorEl={update_menuAnchorEl}
|
|
312
|
+
menuRow={rowProps.data}
|
|
313
|
+
menu_items={props.contextMenuItems as any}
|
|
314
|
+
/>
|
|
315
|
+
);
|
|
315
316
|
},
|
|
316
317
|
[props.contextMenuItems]
|
|
317
318
|
);
|
|
@@ -325,31 +326,21 @@ function DataGridEventsWrapper(props: DataGridWrapperProps) {
|
|
|
325
326
|
const static_gridOptions = React.useMemo<AzGridOptions>(() => {
|
|
326
327
|
const events: AzGridOptions = {
|
|
327
328
|
onRowClick: onRowClick,
|
|
328
|
-
|
|
329
|
+
onRowContextMenu: onRowContextMenu,
|
|
329
330
|
};
|
|
330
331
|
const contextmenuProps: AzGridOptions = {
|
|
331
332
|
renderRowContextMenu: renderRowContextMenu,
|
|
332
333
|
};
|
|
333
334
|
return { ...props.static_gridOptions, ...events, ...contextmenuProps };
|
|
334
|
-
}, [props.static_gridOptions, onRowClick]);
|
|
335
|
+
}, [props.static_gridOptions, onRowClick, onRowContextMenu, renderRowContextMenu]);
|
|
335
336
|
|
|
336
337
|
/* -------------------------------------------------------------------------- */
|
|
337
338
|
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
></DataGridDetailsWrapper>
|
|
344
|
-
);
|
|
345
|
-
} else {
|
|
346
|
-
return (
|
|
347
|
-
<DataGridSizeWrapper
|
|
348
|
-
{...props}
|
|
349
|
-
static_gridOptions={static_gridOptions}
|
|
350
|
-
></DataGridSizeWrapper>
|
|
351
|
-
);
|
|
352
|
-
}
|
|
339
|
+
return props.details_dataSource ? (
|
|
340
|
+
<DataGridDetailsWrapper {...props} static_gridOptions={static_gridOptions} />
|
|
341
|
+
) : (
|
|
342
|
+
<DataGridSizeWrapper {...props} static_gridOptions={static_gridOptions} />
|
|
343
|
+
);
|
|
353
344
|
}
|
|
354
345
|
|
|
355
346
|
function DataGridDetailsWrapper(props: DataGridWrapperProps) {
|