fix: record picker should support popupsize setting (#3299)
This commit is contained in:
parent
5de28cd4c4
commit
e8759588b5
@ -62,7 +62,7 @@ const useTableSelectorProps = () => {
|
||||
|
||||
export const InternalPicker = observer(
|
||||
(props: any) => {
|
||||
const { value, multiple, onChange, quickUpload, selectFile, shouldMountElement, ...others } = props;
|
||||
const { value, multiple, openSize, onChange, quickUpload, selectFile, shouldMountElement, ...others } = props;
|
||||
const field: any = useField();
|
||||
const fieldNames = useFieldNames(props);
|
||||
const [visibleSelector, setVisibleSelector] = useState(false);
|
||||
@ -183,6 +183,7 @@ export const InternalPicker = observer(
|
||||
</Input.Group>
|
||||
<ActionContextProvider
|
||||
value={{
|
||||
openSize,
|
||||
openMode: 'drawer',
|
||||
visible: visibleSelector,
|
||||
setVisible: setVisibleSelector,
|
||||
|
@ -349,7 +349,7 @@ export const formItemSettings = new SchemaSettings({
|
||||
},
|
||||
{
|
||||
name: 'popupSize',
|
||||
type: 'item',
|
||||
type: 'select',
|
||||
useComponentProps() {
|
||||
const { t } = useTranslation();
|
||||
const field = useField<Field>();
|
||||
@ -357,21 +357,15 @@ export const formItemSettings = new SchemaSettings({
|
||||
const { dn } = useDesignable();
|
||||
return {
|
||||
title: t('Popup size'),
|
||||
children: (
|
||||
<div style={{ alignItems: 'center', display: 'flex', justifyContent: 'space-between' }}>
|
||||
{t('Popup size')}
|
||||
<Select
|
||||
bordered={false}
|
||||
options={[
|
||||
options: [
|
||||
{ label: t('Small'), value: 'small' },
|
||||
{ label: t('Middle'), value: 'middle' },
|
||||
{ label: t('Large'), value: 'large' },
|
||||
]}
|
||||
value={
|
||||
],
|
||||
value:
|
||||
fieldSchema?.['x-component-props']?.['openSize'] ??
|
||||
(fieldSchema?.['x-component-props']?.['openMode'] == 'modal' ? 'large' : 'middle')
|
||||
}
|
||||
onChange={(value) => {
|
||||
(fieldSchema?.['x-component-props']?.['openMode'] == 'modal' ? 'large' : 'middle'),
|
||||
onChange: (value) => {
|
||||
field.componentProps.openSize = value;
|
||||
fieldSchema['x-component-props'] = field.componentProps;
|
||||
dn.emit('patch', {
|
||||
@ -381,11 +375,7 @@ export const formItemSettings = new SchemaSettings({
|
||||
},
|
||||
});
|
||||
dn.refresh();
|
||||
}}
|
||||
style={{ textAlign: 'right', minWidth: 100 }}
|
||||
/>
|
||||
</div>
|
||||
),
|
||||
},
|
||||
};
|
||||
},
|
||||
useVisible() {
|
||||
|
Loading…
Reference in New Issue
Block a user