Merge remote-tracking branch 'baidu/master'

This commit is contained in:
2betop 2024-09-19 15:45:16 +08:00
commit 50ff14de1b
3 changed files with 4 additions and 5 deletions

View File

@ -6,6 +6,8 @@ export function labelToString(label: any): string {
return label;
} else if (type === 'number') {
return `${label}`;
} else if (label === 'boolean') {
return String(label);
}
if (isPlainObject(label)) {

View File

@ -101,8 +101,6 @@ export function SchemaFrom({
return schema;
}, [body, controls, submitOnChange]);
const [init, setInit] = React.useState(true);
const themeConfig = React.useMemo(() => getThemeConfig(), []);
const submitSubscribers = React.useRef<Array<Function>>([]);
const subscribeSubmit = React.useCallback(
@ -149,8 +147,7 @@ export function SchemaFrom({
newValue = pipeOut ? await pipeOut(newValue, value) : newValue;
const diffValue = diff(value, newValue);
// 没有变化时不触发onChange
if (!diffValue || init) {
setInit(false);
if (!diffValue) {
return;
}
onChange(newValue, diffValue, (schema, value, id, diff) => {

View File

@ -229,7 +229,7 @@ export default class SelectControl extends React.Component<SelectProps, any> {
}
focus() {
this.input && this.input?.focus();
this.input && this.input?.focus?.();
}
getValue(