itsa-react-table 16.8.3 → 16.9.0
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/lib/component.jsx +28 -1
- package/package.json +1 -1
package/lib/component.jsx
CHANGED
|
@@ -1026,6 +1026,7 @@ class Table extends React.Component {
|
|
|
1026
1026
|
const instance = this,
|
|
1027
1027
|
props = instance.props,
|
|
1028
1028
|
state = instance.state,
|
|
1029
|
+
editableBlurCols = props.editableBlurCols,
|
|
1029
1030
|
keyCode = e.keyCode,
|
|
1030
1031
|
shiftKey = e.shiftKey,
|
|
1031
1032
|
ctrlKey = e.metaKey || e.ctrlKey,
|
|
@@ -1041,6 +1042,16 @@ class Table extends React.Component {
|
|
|
1041
1042
|
columns = props.columns,
|
|
1042
1043
|
hasColumns = columns && columns.length > 0;
|
|
1043
1044
|
|
|
1045
|
+
let preventDomFocus = false;
|
|
1046
|
+
if (typeof editableBlurCols !== "undefined") {
|
|
1047
|
+
if (typeof editableBlurCols === "number") {
|
|
1048
|
+
preventDomFocus = editableBlurCols === state.editableCol;
|
|
1049
|
+
}
|
|
1050
|
+
if (Array.isArray(editableBlurCols)) {
|
|
1051
|
+
preventDomFocus = editableBlurCols.includes(state.editableCol);
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1044
1055
|
const implementChanges = (keepFocus) => {
|
|
1045
1056
|
if (props.editable === true || state.selectedRange) {
|
|
1046
1057
|
// NOT 'full' for that would take care of itself
|
|
@@ -1211,7 +1222,22 @@ class Table extends React.Component {
|
|
|
1211
1222
|
},
|
|
1212
1223
|
selectedRange: null,
|
|
1213
1224
|
});
|
|
1214
|
-
|
|
1225
|
+
if (preventDomFocus) {
|
|
1226
|
+
instance.setState(
|
|
1227
|
+
(prevState) => {
|
|
1228
|
+
return {
|
|
1229
|
+
// editValue: instance._editValueBeforeEdit,
|
|
1230
|
+
editableRow: null,
|
|
1231
|
+
editableCol: null,
|
|
1232
|
+
};
|
|
1233
|
+
},
|
|
1234
|
+
() => {
|
|
1235
|
+
instance._blurActiveCell();
|
|
1236
|
+
}
|
|
1237
|
+
);
|
|
1238
|
+
} else {
|
|
1239
|
+
instance._focusActiveCell();
|
|
1240
|
+
}
|
|
1215
1241
|
implementChanges();
|
|
1216
1242
|
}
|
|
1217
1243
|
}
|
|
@@ -1481,6 +1507,7 @@ Table.propTypes = {
|
|
|
1481
1507
|
data: PropTypes.array,
|
|
1482
1508
|
disabled: PropTypes.bool,
|
|
1483
1509
|
editable: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
|
|
1510
|
+
editableBlurCols: PropTypes.oneOfType([PropTypes.array, PropTypes.number]),
|
|
1484
1511
|
editableCols: PropTypes.oneOfType([PropTypes.array, PropTypes.number]),
|
|
1485
1512
|
editDirectionDown: PropTypes.bool,
|
|
1486
1513
|
extendableX: PropTypes.bool,
|