mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-07-01 18:52:20 +08:00
Merge branch 'main' into next
This commit is contained in:
commit
6a21af710b
@ -149,6 +149,7 @@ export const SourceKey = observer(
|
||||
defaultValue={sourceKey || options?.[0]?.value}
|
||||
onChange={props?.onChange}
|
||||
showSearch
|
||||
filterOption={(input, option) => option?.label.toLowerCase().includes(input.toLowerCase())}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
@ -216,6 +217,7 @@ export const TargetKey = observer(
|
||||
}}
|
||||
value={initialValue}
|
||||
disabled={disabled}
|
||||
filterOption={(input, option) => option?.label.toLowerCase().includes(input.toLowerCase())}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
@ -235,6 +237,7 @@ export const ForeignKey = observer(
|
||||
const compile = useCompile();
|
||||
const form = useForm();
|
||||
const [initialValue, setInitialValue] = useState(value || (template === 'view' ? null : field.initialValue));
|
||||
const [initialOptions, setInitialOptions] = useState([]);
|
||||
useEffect(() => {
|
||||
const effectField = ['belongsTo'].includes(type)
|
||||
? collectionName
|
||||
@ -254,6 +257,7 @@ export const ForeignKey = observer(
|
||||
};
|
||||
});
|
||||
setOptions(sourceOptions);
|
||||
setInitialOptions(sourceOptions);
|
||||
if (value) {
|
||||
const option = sourceOptions.find((v) => v.value === value);
|
||||
setInitialValue(option?.label || value);
|
||||
@ -295,6 +299,15 @@ export const ForeignKey = observer(
|
||||
props?.onChange?.(value);
|
||||
setInitialValue(option.label || value);
|
||||
}}
|
||||
onSearch={(value) => {
|
||||
if (value) {
|
||||
const targetValue = value.toLocaleLowerCase();
|
||||
const result = options.filter((v) => v.label.toLocaleLowerCase().includes(targetValue));
|
||||
setOptions(result);
|
||||
} else {
|
||||
setOptions(initialOptions);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
@ -60,7 +60,7 @@ export const TableColumnActionBar = observer(
|
||||
<SortableItem
|
||||
className={designerCss({
|
||||
margin: isInSubTable ? '-12px -8px' : '-18px -16px',
|
||||
padding: isInSubTable ? '12px 8px' : '18px 16px',
|
||||
padding: isInSubTable ? '12px 8px' : '12px 16px',
|
||||
})}
|
||||
>
|
||||
<Designer />
|
||||
|
@ -88,7 +88,7 @@ export const TableColumnDecorator = (props) => {
|
||||
<SortableItem
|
||||
className={designerCss({
|
||||
margin: isInSubTable ? '-12px -8px' : '-18px -16px',
|
||||
padding: isInSubTable ? '12px 8px' : '18px 16px',
|
||||
padding: isInSubTable ? '12px 8px' : '12px 16px',
|
||||
})}
|
||||
>
|
||||
<CollectionFieldContext.Provider value={collectionField}>
|
||||
|
Loading…
x
Reference in New Issue
Block a user