-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add formily-meet documents (#797)
- Loading branch information
1 parent
ef10275
commit 03bbd0b
Showing
8 changed files
with
416 additions
and
1,818 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { connect } from '@formily/react-schema-renderer' | ||
import MeetRadioDrawer from '@alife/meet-radio-drawer'; | ||
import { mapStyledProps, mapTextComponent } from '../shared' | ||
import React, { useState, useMemo } from 'react'; | ||
import View from 'rax-view'; | ||
|
||
export const RadioDrawer = | ||
connect({ | ||
getProps: mapStyledProps, | ||
getComponent: mapTextComponent | ||
})(({ value, onChange, data, ...props }) => { | ||
const [visible, setVisible] = useState(false); | ||
const onConfirm = (data) => { | ||
setVisible(false); | ||
onChange(data && data[0] && data[0].value); | ||
} | ||
const text = useMemo(() => { | ||
const selected = data.find((item) => item.value === value) || {}; | ||
return selected.label || '请选择'; | ||
}, [visible, data]); | ||
|
||
return visible ? ( | ||
<MeetRadioDrawer | ||
visible={visible} | ||
data={data} | ||
onConfirm={onConfirm} | ||
onCancel={() => setVisible(false)} | ||
{...props} /> | ||
) : ( | ||
<View {...props} onClick={() => setVisible(true)}>{text}</View> | ||
) | ||
}) | ||
|
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
Oops, something went wrong.