react-table-edit 0.7.7 → 0.7.8
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/index.js +8 -0
- package/dist/index.mjs +8 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2891,6 +2891,14 @@ var TableEdit = (0, import_react16.forwardRef)((props, ref) => {
|
|
|
2891
2891
|
} else {
|
|
2892
2892
|
element.focus();
|
|
2893
2893
|
}
|
|
2894
|
+
if (!onLoad) {
|
|
2895
|
+
if (tableElement.current) {
|
|
2896
|
+
const parentRect = tableElement.current.getBoundingClientRect();
|
|
2897
|
+
const childRect = element.getBoundingClientRect();
|
|
2898
|
+
const offset = childRect.left - parentRect.left + tableElement.current.scrollLeft - parentRect.width / 2 + childRect.width / 2;
|
|
2899
|
+
tableElement.current.scrollTo({ left: offset, behavior: "smooth" });
|
|
2900
|
+
}
|
|
2901
|
+
}
|
|
2894
2902
|
if ((tableElement.current?.scrollHeight ?? 0) > 0) {
|
|
2895
2903
|
if ((tableElement.current?.scrollTop ?? 0) > (row - 1) * 34) {
|
|
2896
2904
|
tableElement.current?.scrollTo({ behavior: "smooth", top: (row - 1) * 34 });
|
package/dist/index.mjs
CHANGED
|
@@ -2857,6 +2857,14 @@ var TableEdit = forwardRef3((props, ref) => {
|
|
|
2857
2857
|
} else {
|
|
2858
2858
|
element.focus();
|
|
2859
2859
|
}
|
|
2860
|
+
if (!onLoad) {
|
|
2861
|
+
if (tableElement.current) {
|
|
2862
|
+
const parentRect = tableElement.current.getBoundingClientRect();
|
|
2863
|
+
const childRect = element.getBoundingClientRect();
|
|
2864
|
+
const offset = childRect.left - parentRect.left + tableElement.current.scrollLeft - parentRect.width / 2 + childRect.width / 2;
|
|
2865
|
+
tableElement.current.scrollTo({ left: offset, behavior: "smooth" });
|
|
2866
|
+
}
|
|
2867
|
+
}
|
|
2860
2868
|
if ((tableElement.current?.scrollHeight ?? 0) > 0) {
|
|
2861
2869
|
if ((tableElement.current?.scrollTop ?? 0) > (row - 1) * 34) {
|
|
2862
2870
|
tableElement.current?.scrollTo({ behavior: "smooth", top: (row - 1) * 34 });
|