-
-
Notifications
You must be signed in to change notification settings - Fork 350
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(cherry picked from commit 96f2411)
- Loading branch information
Showing
6 changed files
with
179 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
...ions/src/AttributePanel/components/blocks/AdvancedTable/Operation/tableCellBgSelector.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import { Input } from '@arco-design/web-react'; | ||
import React, { useEffect } from 'react'; | ||
import { render } from 'react-dom'; | ||
import { useState } from 'react'; | ||
|
||
interface CellBackgroundSelectorProps { | ||
bgColorHandler: (color: string) => void; | ||
rootDom: Element; | ||
} | ||
|
||
const CellBackgroundSelector: React.FC<CellBackgroundSelectorProps> = ({ | ||
bgColorHandler, | ||
rootDom, | ||
}) => { | ||
const [color, setColor] = useState('#ffffff'); | ||
|
||
useEffect(() => { | ||
if (!rootDom) { | ||
return; | ||
} | ||
const observer = new ResizeObserver(e => { | ||
setColor('#ffffff'); | ||
}); | ||
observer.observe(rootDom); | ||
return () => { | ||
observer.disconnect(); | ||
}; | ||
}, []); | ||
|
||
return ( | ||
<div | ||
onClick={e => e.stopPropagation()} | ||
className='easy-email-table-operation-menu-bg-item' | ||
> | ||
<div>Set Background Color</div> | ||
<div> | ||
<div className='easy-email-table-operation-menu-bg-item-color'> | ||
<div style={{ backgroundColor: color }}></div> | ||
<input | ||
type='color' | ||
value={color} | ||
onChange={e => setColor(e.target.value)} | ||
/> | ||
</div> | ||
<Input.Search | ||
height={28} | ||
searchButton='Set' | ||
onSearch={() => bgColorHandler(color)} | ||
value={color} | ||
onKeyDown={e => e.stopPropagation()} | ||
onChange={e => setColor(e)} | ||
/> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
const getCellBackgroundSelectorRoot = ( | ||
bgColorHandler: CellBackgroundSelectorProps['bgColorHandler'], | ||
rootDom: any, | ||
) => { | ||
const node = document.createElement('div'); | ||
|
||
render( | ||
<CellBackgroundSelector | ||
bgColorHandler={bgColorHandler} | ||
rootDom={rootDom} | ||
/>, | ||
node, | ||
); | ||
return node; | ||
}; | ||
|
||
export default getCellBackgroundSelectorRoot; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters