![38% of CISOs Fear They’re Not Moving Fast Enough on AI](https://cdn.sanity.io/images/cgdhsj6q/production/faa0bc28df98f791e11263f8239b34207f84b86f-1024x1024.webp?w=400&fit=max&auto=format)
Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
react-easy-edit
Advanced tools
A React library that allows inline editing on HTML5 input components.
input
(most types, even inputs with datalist
), textarea
,radio
, checkbox
and select
HTML typesnpm i react-easy-edit
or yarn add react-easy-edit
Give a :star: if this project helped you in any way!
Prop | Type | Required | Default | Description |
---|---|---|---|---|
type | string | Yes | The type of the input element to display. Supported types are text , number , color , textarea , date , datetime-local ,time , month , week , radio , email , checkbox , select , range and datalist | |
value | string or number or array | No | null | The value of the input element depended on its type |
options | array | No | A key value pair object that is used as available options for select, radio and checkbox.options = [{label:'Test One', value: '1'},{label:'Test Two', value: '2'}]; | |
saveButtonLabel | string or element | No | Save | The label to be used for the "Save" button |
saveButtonStyle | string | No | easy-edit-button | One or more CSS classes to be used to style the "Save" button |
cancelButtonLabel | string or element | No | Cancel | The label to be used for the "Cancel" button |
cancelButtonStyle | string | No | easy-edit-button | One or more CSS classes to be used to style the "Cancel" button |
placeholder | string | No | Click to edit | The text to be shown as a hint that describes the expected value of the input element |
onCancel | function | No | () => {} | A function that will be called when editing is cancelled. Also called when the Esc button is pressed |
onSave | function | Yes | A function that will be called when editing is saved. Also called when the Enter button is pressed (Textarea component is excluded) | |
onValidate | function | No | () => {} | A function that will be called before the onSave() event. It must return true or false and has one parameter which is the value of the component being edited |
validationMessage | string | No | The text to be displayed if validation fails | |
allowEdit | boolean | No | true | Determines whether the component itself should be editable or not |
attributes | object | No | {} | A key value pair of HTML attributes to be applied on the element |
instructions | string | No | Instructions to be shown below the component | |
editComponent | element | No | null | The custom component to be displayed when editing the value. This will override the standard input shown for the type provided |
displayComponent | element | No | null | The custom component to be displayed the value when not editing |
A simple example
import React, { Component } from 'react';
import EasyEdit from 'react-easy-edit';
function App() {
const save = (value) => {alert(value)}
const cancel = () => {alert("Cancelled")}
return (
<EasyEdit
type="text"
onSave={save}
onCancel={cancel}
saveButtonLabel="Save Me"
cancelButtonLabel="Cancel Me"
attributes={{ name: "awesome-input", id: 1}}
instructions="Star this repo!"
/>
);
}
When using custom input components, they must be passed in as props, like so:
<EasyEdit
type="text"
onSave={() => {}}
editComponent={<CustomInput />}
displayComponent={<CustomDisplay />}
/>
When defining a custom input component, the function setParentValue
is injected into your custom component, which must be called in order to pass the desired value up to the parent EasyEdit
component.
For example, if your component was a text field that needed to set the EasyEdit
value as a user id based on a username entered, you would need to pass the id to this.props.setParentValue
in order to get that value to the EasyEdit
component.
e.g.
// Inside your custom input
onChange(searchTerm) {
getUserIdByUsername(searchTerm).then((userId) => {
this.props.setParentValue(userId);
})
}
Contributions, issues and feature requests are welcome.
Feel free to check issues page if you want to contribute.
@giorgosart | @mnnalxndr | @liamwithers |
:construction::computer::bug: | :computer::bug: | :bug: |
For transparency and insight into our release cycle, releases will be numbered with the following format:
<major>.<minor>.<patch>
And constructed with the following guidelines:
Copyright © 2019 George Artemiou.
This project is MIT licensed.
FAQs
A react library for inline editing components
The npm package react-easy-edit receives a total of 0 weekly downloads. As such, react-easy-edit popularity was classified as not popular.
We found that react-easy-edit demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.