mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-23 17:08:34 +00:00
fixes: table column resizes
This commit is contained in:
parent
1d07d960a6
commit
f47c63a9c3
2 changed files with 22 additions and 6 deletions
|
|
@ -51,6 +51,8 @@ import { ButtonSolid } from '@/_ui/AppButton/AppButton';
|
|||
import SolidIcon from '@/_ui/Icon/SolidIcons';
|
||||
import Skeleton, { SkeletonTheme } from 'react-loading-skeleton';
|
||||
import { OverlayTriggerComponent } from './OverlayTriggerComponent';
|
||||
// eslint-disable-next-line import/no-unresolved
|
||||
import { diff } from 'deep-object-diff';
|
||||
|
||||
// utilityForNestedNewRow function is used to construct nested object while adding or updating new row when '.' is present in column key for adding new row
|
||||
const utilityForNestedNewRow = (row) => {
|
||||
|
|
@ -788,11 +790,19 @@ export function Table({
|
|||
|
||||
useEffect(() => {
|
||||
const newColumnSizes = { ...columnSizes, ...state.columnResizing.columnWidths };
|
||||
if (!state.columnResizing.isResizingColumn && !_.isEmpty(newColumnSizes)) {
|
||||
|
||||
const isColumnSizeChanged = !_.isEmpty(diff(columnSizes, newColumnSizes));
|
||||
|
||||
if (isColumnSizeChanged && !state.columnResizing.isResizingColumn && !_.isEmpty(newColumnSizes)) {
|
||||
changeCanDrag(true);
|
||||
paramUpdated(id, 'columnSizes', {
|
||||
value: newColumnSizes,
|
||||
});
|
||||
paramUpdated(
|
||||
id,
|
||||
'columnSizes',
|
||||
{
|
||||
value: newColumnSizes,
|
||||
},
|
||||
{ componentDefinitionChanged: true }
|
||||
);
|
||||
} else {
|
||||
changeCanDrag(false);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,6 +93,7 @@ export const Container = ({
|
|||
const [isContainerFocused, setContainerFocus] = useState(false);
|
||||
const [canvasHeight, setCanvasHeight] = useState(null);
|
||||
|
||||
const paramUpdatesOptsRef = useRef({});
|
||||
const canvasRef = useRef(null);
|
||||
const focusedParentIdRef = useRef(undefined);
|
||||
useHotkeys('meta+z, control+z', () => handleUndo());
|
||||
|
|
@ -195,7 +196,9 @@ export const Container = ({
|
|||
|
||||
const componendAdded = Object.keys(newComponents).length > Object.keys(oldComponents).length;
|
||||
|
||||
const opts = { containerChanges: true };
|
||||
const opts = _.isEmpty(paramUpdatesOptsRef.current) ? { containerChanges: true } : paramUpdatesOptsRef.current;
|
||||
|
||||
paramUpdatesOptsRef.current = {};
|
||||
|
||||
if (componendAdded) {
|
||||
opts.componentAdded = true;
|
||||
|
|
@ -413,7 +416,7 @@ export const Container = ({
|
|||
);
|
||||
|
||||
const paramUpdated = useCallback(
|
||||
(id, param, value) => {
|
||||
(id, param, value, opts = {}) => {
|
||||
if (Object.keys(value)?.length > 0) {
|
||||
setBoxes((boxes) =>
|
||||
update(boxes, {
|
||||
|
|
@ -433,6 +436,9 @@ export const Container = ({
|
|||
},
|
||||
})
|
||||
);
|
||||
if (!_.isEmpty(opts)) {
|
||||
paramUpdatesOptsRef.current = opts;
|
||||
}
|
||||
}
|
||||
},
|
||||
[boxes, setBoxes]
|
||||
|
|
|
|||
Loading…
Reference in a new issue