@azrico/reactgrid 1.2.35 → 1.2.37
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/index.d.ts +3 -3
- package/dist/index.js +21 -3
- package/dist/src/example.d.ts +4 -4
- package/dist/src/example.js +155 -112
- package/dist/src/func/func_child.d.ts +29 -29
- package/dist/src/func/func_child.js +73 -70
- package/dist/src/func/func_grid.d.ts +39 -39
- package/dist/src/func/func_grid.js +261 -275
- package/dist/src/index.d.ts +4 -4
- package/dist/src/index.js +60 -10
- package/dist/src/views/DataGrid.d.ts +79 -79
- package/dist/src/views/DataGrid.js +241 -195
- package/dist/src/views/index.d.ts +3 -3
- package/dist/src/views/index.js +23 -3
- package/package.json +1 -1
- package/src/views/DataGrid.tsx +32 -35
package/dist/src/views/index.js
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _exportNames = {};
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _DataGrid = _interopRequireWildcard(require("./DataGrid"));
|
|
9
|
+
Object.keys(_DataGrid).forEach(function (key) {
|
|
10
|
+
if (key === "default" || key === "__esModule") return;
|
|
11
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
12
|
+
if (key in exports && exports[key] === _DataGrid[key]) return;
|
|
13
|
+
Object.defineProperty(exports, key, {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () {
|
|
16
|
+
return _DataGrid[key];
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
21
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
22
|
+
var _default = _DataGrid.default;
|
|
23
|
+
exports.default = _default;
|
package/package.json
CHANGED
package/src/views/DataGrid.tsx
CHANGED
|
@@ -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,16 +288,26 @@ function DataGridEventsWrapper(props: DataGridWrapperProps) {
|
|
|
297
288
|
}, [props.dataSource]);
|
|
298
289
|
|
|
299
290
|
/* ------------------------------- ContextMenu ------------------------------ */
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
} else set_menuAnchorEl(null);
|
|
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);
|
|
305
295
|
}, []);
|
|
306
|
-
const
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
296
|
+
const renderRowContextMenu = React.useCallback(
|
|
297
|
+
(menuProps, rowProps) => {
|
|
298
|
+
return (
|
|
299
|
+
<ContextMenu
|
|
300
|
+
menuAnchorEl={menuAnchorEl}
|
|
301
|
+
set_menuAnchorEl={update_menuAnchorEl}
|
|
302
|
+
menuRow={rowProps.data}
|
|
303
|
+
menu_items={props.contextMenuItems as any}
|
|
304
|
+
/>
|
|
305
|
+
);
|
|
306
|
+
},
|
|
307
|
+
[props.contextMenuItems]
|
|
308
|
+
);
|
|
309
|
+
const update_menuAnchorEl = React.useCallback((el) => {
|
|
310
|
+
set_menuAnchorEl(el || null);
|
|
310
311
|
}, []);
|
|
311
312
|
|
|
312
313
|
/**
|
|
@@ -317,31 +318,27 @@ function DataGridEventsWrapper(props: DataGridWrapperProps) {
|
|
|
317
318
|
onRowClick: onRowClick,
|
|
318
319
|
onRowContextMenu: onRowContextMenu,
|
|
319
320
|
};
|
|
320
|
-
|
|
321
|
+
const contextmenuProps: AzGridOptions = {
|
|
322
|
+
renderRowContextMenu: renderRowContextMenu,
|
|
323
|
+
};
|
|
324
|
+
return { ...props.static_gridOptions, ...events, ...contextmenuProps };
|
|
321
325
|
}, [props.static_gridOptions, onRowClick]);
|
|
322
326
|
|
|
323
|
-
|
|
324
|
-
return (
|
|
325
|
-
<ContextMenu
|
|
326
|
-
menuAnchorEl={menuAnchorEl}
|
|
327
|
-
set_menuAnchorEl={update_menuAnchorEl}
|
|
328
|
-
menuRow={menuRow}
|
|
329
|
-
menu_items={props.contextMenuItems as any}
|
|
330
|
-
/>
|
|
331
|
-
);
|
|
332
|
-
}, [menuAnchorEl, menuRow, props.contextMenuItems]);
|
|
327
|
+
/* -------------------------------------------------------------------------- */
|
|
333
328
|
|
|
334
329
|
if (props.details_dataSource) {
|
|
335
330
|
return (
|
|
336
|
-
<DataGridDetailsWrapper
|
|
337
|
-
{
|
|
338
|
-
|
|
331
|
+
<DataGridDetailsWrapper
|
|
332
|
+
{...props}
|
|
333
|
+
static_gridOptions={static_gridOptions}
|
|
334
|
+
></DataGridDetailsWrapper>
|
|
339
335
|
);
|
|
340
336
|
} else {
|
|
341
337
|
return (
|
|
342
|
-
<DataGridSizeWrapper
|
|
343
|
-
{
|
|
344
|
-
|
|
338
|
+
<DataGridSizeWrapper
|
|
339
|
+
{...props}
|
|
340
|
+
static_gridOptions={static_gridOptions}
|
|
341
|
+
></DataGridSizeWrapper>
|
|
345
342
|
);
|
|
346
343
|
}
|
|
347
344
|
}
|