@monolith-forensics/monolith-ui 1.1.33 → 1.1.34
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/Table/Table.js +13 -3
- package/package.json +1 -1
package/dist/Table/Table.js
CHANGED
|
@@ -335,7 +335,7 @@ const InnerElement = forwardRef((_a, ref) => {
|
|
|
335
335
|
return (_jsxs(StyledTable, Object.assign({ ref: ref }, rest, { children: [_jsx(HeaderRowComponent, { columns: columns, resizeState: resizeState, _compact: _compact, headerHeight: headerHeight, onHeaderClick: onHeaderClick, dropColumn: dropColumn, dragColumn: dragColumn, showSelection: showSelection, selectAll: selectAll, selectionState: selectionState, handleSelectAll: handleSelectAll, handleColumnReorder: handleColumnReorder, onColumnResize: onColumnResize }), _jsx(StyledTbody, { className: "tbody" + (stripes ? " striped" : ""), stripes: stripes, children: children })] })));
|
|
336
336
|
});
|
|
337
337
|
const Row = ({ data, index, style }) => {
|
|
338
|
-
const { data: dataRows, columns, focusedRow, keyValue, _compact, queryKey, reloadFn, headerHeight, resizeState, onRowUpdated, } = data;
|
|
338
|
+
const { data: dataRows, columns, focusedRow, keyValue, _compact, queryKey, reloadFn, headerHeight, resizeState, onRowUpdated, onRowClick, onRowDoubleClick, } = data;
|
|
339
339
|
const item = (dataRows === null || dataRows === void 0 ? void 0 : dataRows[index]) || {};
|
|
340
340
|
const handleRowUpdated = (data) => {
|
|
341
341
|
onRowUpdated === null || onRowUpdated === void 0 ? void 0 : onRowUpdated({ rowData: item, updateData: data });
|
|
@@ -391,7 +391,15 @@ const Row = ({ data, index, style }) => {
|
|
|
391
391
|
: savedColSize || MIN_COLUMN_WIDTH,
|
|
392
392
|
}, children: [column.props.resizeEnabled !== false && _jsx(Resizer, { column: column }), value] }, shortUUID.generate()));
|
|
393
393
|
});
|
|
394
|
-
return (_jsx(StyledTr, { className: `tr${isRowFocused ? " focused" : ""}`, "data-key": item[keyValue], "data-type": "tr", "data-even": index % 2 === 0 ? "true" : "false", compact: _compact,
|
|
394
|
+
return (_jsx(StyledTr, { className: `tr${isRowFocused ? " focused" : ""}`, "data-key": item[keyValue], "data-type": "tr", "data-even": index % 2 === 0 ? "true" : "false", compact: _compact, onClick: (e) => {
|
|
395
|
+
// dblclick event
|
|
396
|
+
if (e.detail === 2) {
|
|
397
|
+
onRowDoubleClick === null || onRowDoubleClick === void 0 ? void 0 : onRowDoubleClick(item);
|
|
398
|
+
}
|
|
399
|
+
else {
|
|
400
|
+
onRowClick === null || onRowClick === void 0 ? void 0 : onRowClick(item);
|
|
401
|
+
}
|
|
402
|
+
}, style: Object.assign(Object.assign({}, style), { top: ((style === null || style === void 0 ? void 0 : style.top) || 0) + headerHeight }), children: row }, shortUUID.generate()));
|
|
395
403
|
};
|
|
396
404
|
export const useTable = () => {
|
|
397
405
|
const [tableInstance, setTableInstance] = useState(null);
|
|
@@ -409,7 +417,7 @@ export const useTable = () => {
|
|
|
409
417
|
onColumnResize: (e) => tableInstance === null || tableInstance === void 0 ? void 0 : tableInstance.onColumnResize(e),
|
|
410
418
|
};
|
|
411
419
|
};
|
|
412
|
-
const Table = styled(({ className, children, data, rowHeight, headerHeight, tableInstance, queryKey, totalRecords, compact, focusedRow, keyValue, onScroll, allowColumnResize, allowColumnReorder, showActionColumn, showSelection, selectAll, reloadFn, onColumnReorder, onSelectionChanged, onActionButtonClick, onHeaderClick, onColumnResize, onRowUpdated, }) => {
|
|
420
|
+
const Table = styled(({ className, children, data, rowHeight, headerHeight, tableInstance, queryKey, totalRecords, compact, focusedRow, keyValue, onScroll, allowColumnResize, allowColumnReorder, showActionColumn, showSelection, selectAll, reloadFn, onColumnReorder, onSelectionChanged, onActionButtonClick, onHeaderClick, onColumnResize, onRowUpdated, onRowClick, onRowDoubleClick, }) => {
|
|
413
421
|
const rootRef = useRef(null);
|
|
414
422
|
const [initialize, getInstance] = useOverlayScrollbars({
|
|
415
423
|
options: {
|
|
@@ -670,6 +678,8 @@ const Table = styled(({ className, children, data, rowHeight, headerHeight, tabl
|
|
|
670
678
|
: 38,
|
|
671
679
|
resizeState,
|
|
672
680
|
onRowUpdated,
|
|
681
|
+
onRowClick,
|
|
682
|
+
onRowDoubleClick,
|
|
673
683
|
tableWidth: width,
|
|
674
684
|
}, height: height, innerElementType: (props) => (_jsx(InnerElement, Object.assign({}, props, { columns: columns.filter((col) => !hiddenColumns.includes(col.props.dataField)), tableWidth: width, resizeState: resizeState, _compact: _compact, stripes: stripes, onHeaderClick: onHeaderClick, dropColumn: dropColumn, dragColumn: dragColumn, showSelection: showSelection, selectAll: selectAll, selectionState: selectionState, handleSelectAll: handleSelectAll, handleColumnReorder: handleColumnReorder, onColumnResize: onColumnResize }))), itemCount: data === null || data === void 0 ? void 0 : data.length, itemSize: rowHeight ? rowHeight : _compact ? 28 : 38, width: width, outerRef: setListElm, children: Row }) })) }) }));
|
|
675
685
|
}) `
|