itsa-react-table 16.8.2 → 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 +32 -2
- 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,
|
|
@@ -1034,10 +1035,23 @@ class Table extends React.Component {
|
|
|
1034
1035
|
editableCols = props.editableCols,
|
|
1035
1036
|
cursorNav = props.cursorNav,
|
|
1036
1037
|
lowestColIndex = props.rowHeader ? 1 : 0,
|
|
1037
|
-
highestColIndex =
|
|
1038
|
+
highestColIndex =
|
|
1039
|
+
data.length > 0
|
|
1040
|
+
? data[0].itsa_keys().length - (props.rowHeader ? 0 : 1)
|
|
1041
|
+
: 0,
|
|
1038
1042
|
columns = props.columns,
|
|
1039
1043
|
hasColumns = columns && columns.length > 0;
|
|
1040
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
|
+
|
|
1041
1055
|
const implementChanges = (keepFocus) => {
|
|
1042
1056
|
if (props.editable === true || state.selectedRange) {
|
|
1043
1057
|
// NOT 'full' for that would take care of itself
|
|
@@ -1208,7 +1222,22 @@ class Table extends React.Component {
|
|
|
1208
1222
|
},
|
|
1209
1223
|
selectedRange: null,
|
|
1210
1224
|
});
|
|
1211
|
-
|
|
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
|
+
}
|
|
1212
1241
|
implementChanges();
|
|
1213
1242
|
}
|
|
1214
1243
|
}
|
|
@@ -1478,6 +1507,7 @@ Table.propTypes = {
|
|
|
1478
1507
|
data: PropTypes.array,
|
|
1479
1508
|
disabled: PropTypes.bool,
|
|
1480
1509
|
editable: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
|
|
1510
|
+
editableBlurCols: PropTypes.oneOfType([PropTypes.array, PropTypes.number]),
|
|
1481
1511
|
editableCols: PropTypes.oneOfType([PropTypes.array, PropTypes.number]),
|
|
1482
1512
|
editDirectionDown: PropTypes.bool,
|
|
1483
1513
|
extendableX: PropTypes.bool,
|