Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(props) {
super(props);
// text input
const textInputFormatter = inlineEditFormatterFactory({
renderEdit: (value, { columnIndex, rowIndex, column }, { activeEditId }) => {
const id = this.makeId({ rowIndex, columnIndex, column });
return (
this.onChange(newValue, {
rowIndex,
columnIndex
})
}
autoFocus={activeEditId === id}
/>
);
}id={id}
defaultValue={value}
onBlur={newValue =>
this.onChange(newValue, {
rowIndex,
columnIndex
})
}
autoFocus={activeEditId === id}
/>
);
}
});
// dropdown
const workspacesFormatter = inlineEditFormatterFactory({
resolveValue: (value, { rowData }) => rowData.data.workspace,
renderEdit: (workspace, { column, rowData, columnIndex, rowIndex }, { activeEditId }) => {
const dropdownItems = column.data.dropdownItems.map(item => {item});
const toggleId = this.makeId({ rowIndex, columnIndex, column, name: 'toggle' });
return (
this.onWorkspaceChange({ selected: event.target.text, isDropdownOpen: false }, { rowIndex })
}
toggle={
this.onWorkspaceChange({ isDropdownOpen: !workspace.isDropdownOpen }, { rowIndex })}
>autoFocus={activeEditId === toggleId}
onToggle={() => this.onWorkspaceChange({ isDropdownOpen: !workspace.isDropdownOpen }, { rowIndex })}
>
{workspace.selected}
}
isOpen={workspace.isDropdownOpen}
dropdownItems={dropdownItems}
/>
);
},
renderValue: workspace => workspace.selected
});
// checkbox
const privateRepoFormatter = inlineEditFormatterFactory({
resolveValue: (value, { rowData }) => rowData.data.privateRepo,
renderEdit: (privateRepo, { column, columnIndex, rowIndex }) => (
this.onPrivateRepoChange(value, {
rowIndex,
columnIndex
})
}
aria-label="checkbox"
/>
),
renderValue: (privateRepo, { columnIndex, rowIndex, column }) => (render() {
const { columns, rows, activeEditId } = this.state;
const editConfig = {
activeEditId,
onEditCellClicked: this.onEditCellClicked,
editConfirmationType: TableEditConfirmation.ROW,
onEditConfirmed: this.onEditConfirmed,
onEditCanceled: this.onEditCanceled
};
const ComposedBody = editableTableBody(TableBody);
const ComposedRowWrapper = editableRowWrapper(RowWrapper);
return (
<table rows="{rows}">
</table>render() {
const { columns, rows, activeEditId } = this.state;
const editConfig = {
activeEditId,
onEditCellClicked: this.onEditCellClicked,
editConfirmationType: TableEditConfirmation.ROW,
onEditConfirmed: this.onEditConfirmed,
onEditCanceled: this.onEditCanceled
};
const ComposedBody = editableTableBody(TableBody);
const ComposedRowWrapper = editableRowWrapper(RowWrapper);
return (
<table rows="{rows}">
</table>
);
}
}render() {
const { columns, rows, activeEditId } = this.state;
const editConfig = {
activeEditId,
onEditCellClicked: this.onEditCellClicked,
editConfirmationType: TableEditConfirmation.ROW,
onEditConfirmed: this.onEditConfirmed,
onEditCanceled: this.onEditCanceled
};
const ComposedBody = editableTableBody(TableBody);
const ComposedRowWrapper = editableRowWrapper(RowWrapper);
return (
<table rows="{rows}">
</table>
);
}
}