Merge branch 'fix/col-actions' into 'release'

Minor fixes for column actions

See merge request theappsmith/internal-tools-client!258
This commit is contained in:
Satbir Singh 2020-01-23 13:32:05 +00:00
commit 5489cd8fc9
4 changed files with 21 additions and 4 deletions

View File

@ -12,6 +12,8 @@ import {
CommandColumn,
CommandModel,
CommandClickEventArgs,
ColumnMenuOpenEventArgs,
ColumnMenuItemModel,
PageSettingsModel,
} from "@syncfusion/ej2-react-grids";
import React, { useRef, MutableRefObject, useEffect, memo } from "react";
@ -148,6 +150,19 @@ const TableComponent = memo(
}
}
function columnMenuOpen(args: ColumnMenuOpenEventArgs) {
for (const item of args.items) {
if (item.text) {
if (item.text === "Autofit all columns") {
(item as ColumnMenuItemModel).hide = true;
}
if (item.text === "Autofit this column") {
(item as ColumnMenuItemModel).text = "Autofit column";
}
}
}
}
return (
<StyledGridComponent
selectionSettings={settings}
@ -163,6 +178,7 @@ const TableComponent = memo(
columnDragStart={columnDragStart}
columnDrop={columnDrop}
commandClick={onCommandClick}
columnMenuOpen={columnMenuOpen}
>
<Inject services={[Resize, Page, Reorder, ColumnMenu, CommandColumn]} />
<ColumnsDirective>
@ -172,7 +188,7 @@ const TableComponent = memo(
);
})}
{commands.length > 0 && (
<ColumnDirective headerText="Commands" commands={commands} />
<ColumnDirective headerText="Actions" commands={commands} />
)}
</ColumnsDirective>
</StyledGridComponent>

View File

@ -273,11 +273,12 @@ export default function ActionSelector(props: ActionSelectorProps) {
</div>
<div hidden={!props.labelEditable}>
<InputText
label={"Name"}
label={"Action Name"}
value={props.label}
onChange={onTextChange}
isValid={true}
></InputText>
<label>{"On Action Click"}</label>
</div>
<ActionSelectorDropDownContainer>

View File

@ -175,7 +175,7 @@ export function FinalActionSelector(props: FinalActionSelectorProps) {
actionTypeOptions={actionTypeOptions}
selectedActionType={selectedErrorActionType}
selectedActionLabel={selectedErrorActionLabel}
identifier={"On SucceErrorss"}
identifier={"On Error"}
label={"On Error"}
actionResolutionType={ACTION_RESOLUTION_TYPE.ERROR}
updateActions={props.updateActions}

View File

@ -123,7 +123,7 @@ class ColumnActionSelectorControl extends BaseControl<
const columnActions = this.props.propertyValue || [];
const columnActionsClone = columnActions.slice();
columnActionsClone.push({
label: "newColumnAction",
label: "Action",
id: generateReactKey(),
actionPayloads: [],
});