mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 14:56:00 +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(
|
export const InternalPicker = observer(
|
||||||
(props: any) => {
|
(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 field: any = useField();
|
||||||
const fieldNames = useFieldNames(props);
|
const fieldNames = useFieldNames(props);
|
||||||
const [visibleSelector, setVisibleSelector] = useState(false);
|
const [visibleSelector, setVisibleSelector] = useState(false);
|
||||||
@ -183,6 +183,7 @@ export const InternalPicker = observer(
|
|||||||
</Input.Group>
|
</Input.Group>
|
||||||
<ActionContextProvider
|
<ActionContextProvider
|
||||||
value={{
|
value={{
|
||||||
|
openSize,
|
||||||
openMode: 'drawer',
|
openMode: 'drawer',
|
||||||
visible: visibleSelector,
|
visible: visibleSelector,
|
||||||
setVisible: setVisibleSelector,
|
setVisible: setVisibleSelector,
|
||||||
|
@ -349,7 +349,7 @@ export const formItemSettings = new SchemaSettings({
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'popupSize',
|
name: 'popupSize',
|
||||||
type: 'item',
|
type: 'select',
|
||||||
useComponentProps() {
|
useComponentProps() {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const field = useField<Field>();
|
const field = useField<Field>();
|
||||||
@ -357,35 +357,25 @@ export const formItemSettings = new SchemaSettings({
|
|||||||
const { dn } = useDesignable();
|
const { dn } = useDesignable();
|
||||||
return {
|
return {
|
||||||
title: t('Popup size'),
|
title: t('Popup size'),
|
||||||
children: (
|
options: [
|
||||||
<div style={{ alignItems: 'center', display: 'flex', justifyContent: 'space-between' }}>
|
{ label: t('Small'), value: 'small' },
|
||||||
{t('Popup size')}
|
{ label: t('Middle'), value: 'middle' },
|
||||||
<Select
|
{ label: t('Large'), value: 'large' },
|
||||||
bordered={false}
|
],
|
||||||
options={[
|
value:
|
||||||
{ label: t('Small'), value: 'small' },
|
fieldSchema?.['x-component-props']?.['openSize'] ??
|
||||||
{ label: t('Middle'), value: 'middle' },
|
(fieldSchema?.['x-component-props']?.['openMode'] == 'modal' ? 'large' : 'middle'),
|
||||||
{ label: t('Large'), value: 'large' },
|
onChange: (value) => {
|
||||||
]}
|
field.componentProps.openSize = value;
|
||||||
value={
|
fieldSchema['x-component-props'] = field.componentProps;
|
||||||
fieldSchema?.['x-component-props']?.['openSize'] ??
|
dn.emit('patch', {
|
||||||
(fieldSchema?.['x-component-props']?.['openMode'] == 'modal' ? 'large' : 'middle')
|
schema: {
|
||||||
}
|
'x-uid': fieldSchema['x-uid'],
|
||||||
onChange={(value) => {
|
'x-component-props': fieldSchema['x-component-props'],
|
||||||
field.componentProps.openSize = value;
|
},
|
||||||
fieldSchema['x-component-props'] = field.componentProps;
|
});
|
||||||
dn.emit('patch', {
|
dn.refresh();
|
||||||
schema: {
|
},
|
||||||
'x-uid': fieldSchema['x-uid'],
|
|
||||||
'x-component-props': fieldSchema['x-component-props'],
|
|
||||||
},
|
|
||||||
});
|
|
||||||
dn.refresh();
|
|
||||||
}}
|
|
||||||
style={{ textAlign: 'right', minWidth: 100 }}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
),
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
useVisible() {
|
useVisible() {
|
||||||
|
Loading…
Reference in New Issue
Block a user