fix
This commit is contained in:
parent
ad557ca5c0
commit
3bc6330379
|
|
@ -125,7 +125,9 @@ export const Form: FC<FMProps> = (props) => {
|
|||
)}
|
||||
>
|
||||
{fm.status !== "init" && fm.size.width > 0 && (
|
||||
<PassProp fm={fm}>{body}</PassProp>
|
||||
<PassProp fm={fm} submit={fm.submit}>
|
||||
{body}
|
||||
</PassProp>
|
||||
)}
|
||||
<button type="submit" className="c-hidden"></button>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -14,30 +14,16 @@ export const TypeCustom: FC<{ field: FieldLocal; fm: FMLocal }> = ({
|
|||
});
|
||||
|
||||
if (!local.custom && field.custom) {
|
||||
console.log("field", field.custom);
|
||||
local.custom = field.custom;
|
||||
}
|
||||
|
||||
if (!local.exec) {
|
||||
local.exec = true;
|
||||
const callback = (value: any, should_render: boolean) => {
|
||||
local.result = value;
|
||||
if (should_render) {
|
||||
local.render();
|
||||
setTimeout(() => {
|
||||
local.exec = false;
|
||||
}, 100);
|
||||
}
|
||||
};
|
||||
if (field.custom) {
|
||||
const res = local.custom();
|
||||
if (res instanceof Promise) {
|
||||
res.then((value) => {
|
||||
callback(value, true);
|
||||
});
|
||||
console.error("Custom Function cannot be async");
|
||||
return null;
|
||||
} else {
|
||||
callback(res, false);
|
||||
}
|
||||
local.result = res;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ export type FieldProp = {
|
|||
_meta: any;
|
||||
_item: any;
|
||||
_sync: any;
|
||||
custom?: () => Promise<CustomField>;
|
||||
custom?: () => CustomField;
|
||||
};
|
||||
|
||||
export type FMInternal = {
|
||||
|
|
|
|||
|
|
@ -23,8 +23,6 @@ export const genFieldMitem = (arg: {
|
|||
?.get("content")
|
||||
?.get("childs");
|
||||
|
||||
const col = fm.field_def[field.name];
|
||||
if (col) {
|
||||
const component = fieldMapping[field.type as "text"];
|
||||
if (component) {
|
||||
const item = createItem({
|
||||
|
|
@ -35,7 +33,6 @@ export const genFieldMitem = (arg: {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const updateFieldMItem = (_meta: any, _item: any, _sync: any) => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue