upload 边界情况:用动作保存

This commit is contained in:
qsc 2023-10-23 18:49:29 +08:00
parent 7bce1dc06d
commit 1acbdfa7d3
15 changed files with 23 additions and 10 deletions

View File

@ -1,6 +1,7 @@
/// <reference types="react" />
import { EntityDict } from '../../../oak-app-domain';
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<EntityDict, keyof EntityDict, boolean, {
action: string | undefined;
efPaths: string[];
size: string;
block: boolean;

View File

@ -19,6 +19,7 @@ export default OakComponent({
};
},
properties: {
action: '',
efPaths: [],
size: 'middle',
block: false,

View File

@ -8,6 +8,7 @@ export default function render(props: WebComponentProps<EntityDict, any, true, {
block?: ButtonProps['block'];
type?: ButtonProps['type'];
executeText?: string;
action?: string;
buttonProps?: ButtonProps;
beforeCommit?: () => Promise<boolean | undefined> | boolean | undefined;
afterCommit?: () => void;

View File

@ -1,7 +1,7 @@
import { jsx as _jsx } from "react/jsx-runtime";
import { Button } from 'antd-mobile';
export default function render(props) {
const { state, oakExecutable, oakExecuting, oakDirty, size, block, type, executeText, buttonProps, beforeCommit, afterCommit, } = props.data;
const { state, oakExecutable, oakExecuting, oakDirty, size, block, type, executeText, buttonProps, action, beforeCommit, afterCommit, } = props.data;
const { t, upload, execute } = props.methods;
const disabled = oakExecuting ||
['uploading'].includes(state) ||
@ -26,7 +26,7 @@ export default function render(props) {
return;
}
}
await execute();
await execute(action || undefined);
await upload();
if (afterCommit) {
afterCommit();

View File

@ -8,6 +8,7 @@ export default function render(props: WebComponentProps<EntityDict, any, true, {
block?: ButtonProps['block'];
type?: ButtonProps['type'];
executeText?: string;
action?: string;
buttonProps?: ButtonProps;
afterCommit?: () => void;
beforeCommit?: () => Promise<boolean> | boolean;

View File

@ -1,7 +1,7 @@
import { jsx as _jsx } from "react/jsx-runtime";
import { Button } from 'antd';
export default function render(props) {
const { state, oakExecutable, oakExecuting, size, block, type, executeText, buttonProps = {}, afterCommit, beforeCommit, } = props.data;
const { state, oakExecutable, oakExecuting, size, block, type, executeText, buttonProps = {}, action, afterCommit, beforeCommit, } = props.data;
const { t, upload, execute } = props.methods;
const disabled = oakExecuting ||
['uploading'].includes(state) ||
@ -26,7 +26,7 @@ export default function render(props) {
return;
}
}
await execute();
await execute(action || undefined);
await upload();
if (afterCommit) {
afterCommit();

View File

@ -1,6 +1,7 @@
/// <reference types="react" />
import { EntityDict } from '../../../oak-app-domain';
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<EntityDict, keyof EntityDict, boolean, {
action: string | undefined;
efPaths: string[];
size: string;
block: boolean;

View File

@ -22,6 +22,7 @@ exports.default = OakComponent({
};
},
properties: {
action: '',
efPaths: [],
size: 'middle',
block: false,

View File

@ -8,6 +8,7 @@ export default function render(props: WebComponentProps<EntityDict, any, true, {
block?: ButtonProps['block'];
type?: ButtonProps['type'];
executeText?: string;
action?: string;
buttonProps?: ButtonProps;
beforeCommit?: () => Promise<boolean | undefined> | boolean | undefined;
afterCommit?: () => void;

View File

@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
const jsx_runtime_1 = require("react/jsx-runtime");
const antd_mobile_1 = require("antd-mobile");
function render(props) {
const { state, oakExecutable, oakExecuting, oakDirty, size, block, type, executeText, buttonProps, beforeCommit, afterCommit, } = props.data;
const { state, oakExecutable, oakExecuting, oakDirty, size, block, type, executeText, buttonProps, action, beforeCommit, afterCommit, } = props.data;
const { t, upload, execute } = props.methods;
const disabled = oakExecuting ||
['uploading'].includes(state) ||
@ -28,7 +28,7 @@ function render(props) {
return;
}
}
await execute();
await execute(action || undefined);
await upload();
if (afterCommit) {
afterCommit();

View File

@ -8,6 +8,7 @@ export default function render(props: WebComponentProps<EntityDict, any, true, {
block?: ButtonProps['block'];
type?: ButtonProps['type'];
executeText?: string;
action?: string;
buttonProps?: ButtonProps;
afterCommit?: () => void;
beforeCommit?: () => Promise<boolean> | boolean;

View File

@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
const jsx_runtime_1 = require("react/jsx-runtime");
const antd_1 = require("antd");
function render(props) {
const { state, oakExecutable, oakExecuting, size, block, type, executeText, buttonProps = {}, afterCommit, beforeCommit, } = props.data;
const { state, oakExecutable, oakExecuting, size, block, type, executeText, buttonProps = {}, action, afterCommit, beforeCommit, } = props.data;
const { t, upload, execute } = props.methods;
const disabled = oakExecuting ||
['uploading'].includes(state) ||
@ -28,7 +28,7 @@ function render(props) {
return;
}
}
await execute();
await execute(action || undefined);
await upload();
if (afterCommit) {
afterCommit();

View File

@ -22,6 +22,7 @@ export default OakComponent({
};
},
properties: {
action: '' as (string | undefined),
efPaths: [] as string[],
size: 'middle',
block: false,

View File

@ -15,6 +15,7 @@ export default function render(
block?: ButtonProps['block'];
type?: ButtonProps['type'];
executeText?: string;
action?: string;
buttonProps?: ButtonProps;
afterCommit?: () => void;
beforeCommit?: () => Promise<boolean> | boolean;
@ -33,6 +34,7 @@ export default function render(
type,
executeText,
buttonProps = {},
action,
afterCommit,
beforeCommit,
} = props.data;
@ -67,7 +69,7 @@ export default function render(
return;
}
}
await execute();
await execute(action || undefined);
await upload();
if (afterCommit) {
afterCommit();

View File

@ -15,6 +15,7 @@ export default function render(
block?: ButtonProps['block'];
type?: ButtonProps['type'];
executeText?: string;
action?: string;
buttonProps?: ButtonProps;
beforeCommit?: () =>
| Promise<boolean | undefined>
@ -37,6 +38,7 @@ export default function render(
type,
executeText,
buttonProps,
action,
beforeCommit,
afterCommit,
} = props.data;
@ -71,7 +73,7 @@ export default function render(
return;
}
}
await execute();
await execute(action || undefined);
await upload();
if (afterCommit) {
afterCommit();