Skip to content

Commit 91ae133

Browse files
author
balajisoundar
committed
Qa callouts fixes #4
1 parent 76c1254 commit 91ae133

8 files changed

Lines changed: 36 additions & 36 deletions

File tree

app/client/src/widgets/TableWidgetV2/component/TableStyledWrappers.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,8 @@ export const TableStyles = css<{
309309
isTextType?: boolean;
310310
}>``;
311311

312+
export const CELL_WRAPPER_LINE_HEIGHT = 28;
313+
312314
export const CellWrapper = styled.div<{
313315
isHidden?: boolean;
314316
isHyperLink?: boolean;
@@ -351,7 +353,7 @@ export const CellWrapper = styled.div<{
351353
padding: ${(props) =>
352354
props.compactMode ? TABLE_SIZES[props.compactMode].VERTICAL_PADDING : 0}px
353355
10px;
354-
line-height: 28px;
356+
line-height: ${CELL_WRAPPER_LINE_HEIGHT}px;
355357
.${Classes.POPOVER_WRAPPER}, > span > span > span,
356358
> div > span > span > span {
357359
width: 100%;

app/client/src/widgets/TableWidgetV2/component/cellComponents/InlineCellEditor.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export function InlineCellEditor({
9494
}: InlineEditorPropsType) {
9595
const inputRef = useRef<HTMLTextAreaElement | HTMLInputElement>(null);
9696
const [cursorPos, setCursorPos] = useState(value.length);
97-
const onFocusChange = useCallback((focus: boolean) => !focus && onSave(), [
97+
const onFocusChange = useCallback((focus: boolean) => !focus && onSave, [
9898
onSave,
9999
]);
100100

app/client/src/widgets/TableWidgetV2/component/cellComponents/TextCell.tsx

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { InlineCellEditor } from "./InlineCellEditor";
77
import { ColumnTypes } from "widgets/TableWidgetV2/constants";
88
import { ALIGN_ITEMS, TABLE_SIZES, VerticalAlignment } from "../Constants";
99
import { InputTypes } from "widgets/BaseInputWidget/constants";
10+
import { CELL_WRAPPER_LINE_HEIGHT } from "../TableStyledWrappers";
1011

1112
const Container = styled.div<{
1213
isCellEditMode?: boolean;
@@ -78,6 +79,10 @@ const UnsavedChangesMarker = styled.div<{ accentColor: string }>`
7879
transform: rotateZ(45deg);
7980
`;
8081

82+
const Content = styled.div`
83+
display: inline;
84+
`;
85+
8186
interface PropType extends RenderDefaultPropsType {
8287
onChange: (text: string) => void;
8388
onDiscard: () => void;
@@ -121,18 +126,13 @@ export function TextCell({
121126
[toggleCellEditMode, value],
122127
);
123128

124-
const isMultiline = useCallback(() => {
125-
const rowHeight = TABLE_SIZES[compactMode].ROW_HEIGHT;
126-
127-
return (
128-
!!contentRef.current?.offsetHeight &&
129-
contentRef.current?.offsetHeight - rowHeight > 10
130-
);
131-
}, [contentRef.current, compactMode]);
132-
133129
let editor;
134130

135131
if (isCellEditMode) {
132+
const isMultiline =
133+
!!contentRef.current?.offsetHeight &&
134+
contentRef.current?.offsetHeight / CELL_WRAPPER_LINE_HEIGHT > 1;
135+
136136
editor = (
137137
<InlineCellEditor
138138
accentColor={accentColor}
@@ -143,7 +143,7 @@ export function TextCell({
143143
? InputTypes.NUMBER
144144
: InputTypes.TEXT
145145
}
146-
multiline={isMultiline()}
146+
multiline={isMultiline}
147147
onChange={onChange}
148148
onDiscard={onDiscard}
149149
onSave={onSave}
@@ -164,7 +164,6 @@ export function TextCell({
164164
compactMode={compactMode}
165165
isCellEditMode={isCellEditMode}
166166
onDoubleClick={onEditHandler}
167-
ref={contentRef}
168167
>
169168
{hasUnsavedChanged && (
170169
<UnsavedChangesMarker accentColor={accentColor} />
@@ -185,7 +184,7 @@ export function TextCell({
185184
title={!!value ? value.toString() : ""}
186185
verticalAlignment={verticalAlignment}
187186
>
188-
{value}
187+
<Content ref={contentRef}>{value}</Content>
189188
</StyledAutoToolTipComponent>
190189
{isCellEditable && (
191190
<StyledEditIcon

app/client/src/widgets/TableWidgetV2/widget/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -814,7 +814,7 @@ class TableWidgetV2 extends BaseWidget<TableWidgetProps, WidgetState> {
814814

815815
handleColumnSorting = (columnAccessor: string, isAsc: boolean) => {
816816
const columnId = this.getColumnIdByAlias(columnAccessor);
817-
this.resetSelectedRowIndex();
817+
this.resetSelectedRowIndex(true);
818818

819819
let sortOrderProps;
820820

@@ -1027,7 +1027,7 @@ class TableWidgetV2 extends BaseWidget<TableWidgetProps, WidgetState> {
10271027
}
10281028
};
10291029

1030-
resetSelectedRowIndex = () => {
1030+
resetSelectedRowIndex = (skipDefault?: boolean) => {
10311031
const {
10321032
defaultSelectedRowIndex,
10331033
defaultSelectedRowIndices,
@@ -1037,12 +1037,12 @@ class TableWidgetV2 extends BaseWidget<TableWidgetProps, WidgetState> {
10371037
if (multiRowSelection) {
10381038
this.props.updateWidgetMetaProperty(
10391039
"selectedRowIndices",
1040-
defaultSelectedRowIndices,
1040+
skipDefault ? [] : defaultSelectedRowIndices,
10411041
);
10421042
} else {
10431043
this.props.updateWidgetMetaProperty(
10441044
"selectedRowIndex",
1045-
defaultSelectedRowIndex,
1045+
skipDefault ? -1 : defaultSelectedRowIndex,
10461046
);
10471047
}
10481048
};

app/client/src/widgets/TableWidgetV2/widget/propertyConfig/PanelConfig/ColumnControl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ export default {
174174
dependencies: ["primaryColumns", "columnType"],
175175
label: "Cell Wrapping",
176176
helpText: "Allows content of the cell to be wrapped",
177-
defaultValue: false,
177+
defaultValue: true,
178178
controlType: "SWITCH",
179179
customJSControl: "COMPUTE_VALUE_V2",
180180
isJSConvertible: true,

app/client/src/widgets/TableWidgetV2/widget/propertyConfig/PanelConfig/Events.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ export default {
1313
ColumnTypes.BUTTON,
1414
ColumnTypes.ICON_BUTTON,
1515
ColumnTypes.IMAGE,
16-
ColumnTypes.MENU_BUTTON,
1716
ColumnTypes.EDIT_ACTIONS,
1817
],
1918
true,
@@ -71,22 +70,6 @@ export default {
7170
isBindProperty: true,
7271
isTriggerProperty: true,
7372
},
74-
//MenuButton onClick
75-
{
76-
helpText: "Triggers an action when the menu item is clicked",
77-
propertyName: "onClick",
78-
label: "onItemClick",
79-
controlType: "ACTION_SELECTOR",
80-
isJSConvertible: true,
81-
isBindProperty: true,
82-
isTriggerProperty: true,
83-
dependencies: ["primaryColumns", "columnOrder"],
84-
hidden: (props: TableWidgetProps, propertyPath: string) => {
85-
const baseProperty = getBasePropertyPath(propertyPath);
86-
const columnType = get(props, `${baseProperty}.columnType`, "");
87-
return columnType !== ColumnTypes.MENU_BUTTON;
88-
},
89-
},
9073
{
9174
propertyName: "onSubmit",
9275
label: "onSubmit",

app/client/src/widgets/TableWidgetV2/widget/propertyConfig/PanelConfig/MenuItems.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,21 @@ export default {
129129
},
130130
],
131131
},
132+
{
133+
sectionName: "Events",
134+
children: [
135+
{
136+
helpText: "Triggers an action when the menu item is clicked",
137+
propertyName: "onClick",
138+
label: "onItemClick",
139+
controlType: "ACTION_SELECTOR",
140+
isJSConvertible: true,
141+
isBindProperty: true,
142+
isTriggerProperty: true,
143+
dependencies: ["primaryColumns", "columnOrder"],
144+
},
145+
],
146+
},
132147
],
133148
},
134149
},

app/client/src/widgets/TextWidget/widget/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ class TextWidget extends BaseWidget<TextWidgetProps, WidgetState> {
8383
propertyName: "disableLink",
8484
helpText: "Controls parsing text as Link",
8585
label: "Disable Link",
86+
defaultValue: false,
8687
controlType: "SWITCH",
8788
isJSConvertible: true,
8889
isBindProperty: true,

0 commit comments

Comments
 (0)