mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 11:36:42 +00:00
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,35 +357,25 @@ 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={[
|
||||
{ label: t('Small'), value: 'small' },
|
||||
{ label: t('Middle'), value: 'middle' },
|
||||
{ label: t('Large'), value: 'large' },
|
||||
]}
|
||||
value={
|
||||
fieldSchema?.['x-component-props']?.['openSize'] ??
|
||||
(fieldSchema?.['x-component-props']?.['openMode'] == 'modal' ? 'large' : 'middle')
|
||||
}
|
||||
onChange={(value) => {
|
||||
field.componentProps.openSize = value;
|
||||
fieldSchema['x-component-props'] = field.componentProps;
|
||||
dn.emit('patch', {
|
||||
schema: {
|
||||
'x-uid': fieldSchema['x-uid'],
|
||||
'x-component-props': fieldSchema['x-component-props'],
|
||||
},
|
||||
});
|
||||
dn.refresh();
|
||||
}}
|
||||
style={{ textAlign: 'right', minWidth: 100 }}
|
||||
/>
|
||||
</div>
|
||||
),
|
||||
options: [
|
||||
{ label: t('Small'), value: 'small' },
|
||||
{ label: t('Middle'), value: 'middle' },
|
||||
{ label: t('Large'), value: 'large' },
|
||||
],
|
||||
value:
|
||||
fieldSchema?.['x-component-props']?.['openSize'] ??
|
||||
(fieldSchema?.['x-component-props']?.['openMode'] == 'modal' ? 'large' : 'middle'),
|
||||
onChange: (value) => {
|
||||
field.componentProps.openSize = value;
|
||||
fieldSchema['x-component-props'] = field.componentProps;
|
||||
dn.emit('patch', {
|
||||
schema: {
|
||||
'x-uid': fieldSchema['x-uid'],
|
||||
'x-component-props': fieldSchema['x-component-props'],
|
||||
},
|
||||
});
|
||||
dn.refresh();
|
||||
},
|
||||
};
|
||||
},
|
||||
useVisible() {
|
||||
|
Loading…
Reference in New Issue
Block a user