|
|
|
@ -47,32 +47,6 @@ const BasicTable = ({ |
|
|
|
|
[] |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
const EditableCell = ({ |
|
|
|
|
value: initialValue, |
|
|
|
|
row: { index }, |
|
|
|
|
column: { id }, |
|
|
|
|
updateMyData, // This is a custom function that we supplied to our table instance
|
|
|
|
|
}) => { |
|
|
|
|
// We need to keep and update the state of the cell normally
|
|
|
|
|
const [value, setValue] = React.useState(initialValue); |
|
|
|
|
|
|
|
|
|
const onChange = (e) => { |
|
|
|
|
setValue(e.target.value); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
// We'll only update the external data when the input is blurred
|
|
|
|
|
const onBlur = () => { |
|
|
|
|
updateMyData(index, id, value); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
// If the initialValue is changed external, sync it up with our state
|
|
|
|
|
React.useEffect(() => { |
|
|
|
|
setValue(initialValue); |
|
|
|
|
}, [initialValue]); |
|
|
|
|
|
|
|
|
|
return <input value={value} onChange={onChange} onBlur={onBlur} />; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
// یعنی فیلتر دیفالت هدر های ما سرچ خواهد بود مگه اینکه خودمون تغییرش بدیم
|
|
|
|
|
const defaultColumn = useMemo(() => { |
|
|
|
|
return { |
|
|
|
@ -191,7 +165,12 @@ const BasicTable = ({ |
|
|
|
|
/> |
|
|
|
|
</div> |
|
|
|
|
{/* settings icon */} |
|
|
|
|
{settingsIcon && <Settings />} |
|
|
|
|
{settingsIcon && ( |
|
|
|
|
<Settings |
|
|
|
|
allColumns={allColumns} |
|
|
|
|
getToggleHideAllColumnsProps={getToggleHideAllColumnsProps} |
|
|
|
|
/> |
|
|
|
|
)} |
|
|
|
|
</div> |
|
|
|
|
) : null} |
|
|
|
|
</div> |
|
|
|
|