mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 20:09:08 +08:00
form配置异步api定时时间
This commit is contained in:
parent
60163fdcb2
commit
17f822b8b3
@ -17,7 +17,6 @@
|
|||||||
- `showCompressOptions` 默认为 false, 开启后,允许用户输入压缩选项。
|
- `showCompressOptions` 默认为 false, 开启后,允许用户输入压缩选项。
|
||||||
- `crop` 用来设置是否支持裁剪。
|
- `crop` 用来设置是否支持裁剪。
|
||||||
- `aspectRatio` 浮点型,默认 `1` 即 `1:1`,如果要设置 `16:9` 请设置 `1.7777777777777777` 即 `16 / 9`。
|
- `aspectRatio` 浮点型,默认 `1` 即 `1:1`,如果要设置 `16:9` 请设置 `1.7777777777777777` 即 `16 / 9`。
|
||||||
- `allowInput` 默认都是通过用户选择图片后上传返回图片地址,如果开启此选项,则可以允许用户图片地址。
|
|
||||||
- `limit` 限制图片大小,超出不让上传。
|
- `limit` 限制图片大小,超出不让上传。
|
||||||
- `width` 限制图片宽度。
|
- `width` 限制图片宽度。
|
||||||
- `height` 限制图片高度。
|
- `height` 限制图片高度。
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*/
|
*/
|
||||||
import {render, Renderer, getRendererByName, resolveRenderer, filterSchema} from './factory';
|
import {render, Renderer, getRendererByName, resolveRenderer, filterSchema} from './factory';
|
||||||
import {wrapFetcher, buildApi} from './utils/api';
|
import {wrapFetcher, buildApi} from './utils/api';
|
||||||
import {filter, reigsterTplEnginer} from './utils/tpl'
|
import {filter, reigsterTplEnginer, evalExpression} from './utils/tpl'
|
||||||
import './utils/tpl-builtin';
|
import './utils/tpl-builtin';
|
||||||
import './utils/tpl-lodash';
|
import './utils/tpl-lodash';
|
||||||
import * as utils from './utils/helper';
|
import * as utils from './utils/helper';
|
||||||
@ -226,6 +226,7 @@ export {
|
|||||||
resizeSensor,
|
resizeSensor,
|
||||||
registerFilter,
|
registerFilter,
|
||||||
reigsterTplEnginer,
|
reigsterTplEnginer,
|
||||||
|
evalExpression,
|
||||||
addRule,
|
addRule,
|
||||||
str2rules,
|
str2rules,
|
||||||
normalizeOptions,
|
normalizeOptions,
|
||||||
|
@ -67,12 +67,14 @@ export interface FormProps extends RendererProps, FormSchema {
|
|||||||
resetAfterSubmit?: boolean;
|
resetAfterSubmit?: boolean;
|
||||||
initApi?: Api; // 可以用来设置初始数据。
|
initApi?: Api; // 可以用来设置初始数据。
|
||||||
initAsyncApi?: Api; // 如果 api 处理时间过长,可以开启 initAsyncApi 来处理。轮询检测是否真的完成了。
|
initAsyncApi?: Api; // 如果 api 处理时间过长,可以开启 initAsyncApi 来处理。轮询检测是否真的完成了。
|
||||||
|
initCheckInterval?: number;
|
||||||
initFinishedField?: string;
|
initFinishedField?: string;
|
||||||
interval?: number;
|
interval?: number;
|
||||||
silentPolling?: boolean;
|
silentPolling?: boolean;
|
||||||
stopAutoRefreshWhen?: string;
|
stopAutoRefreshWhen?: string;
|
||||||
api?: Api; // 用来保存的 api
|
api?: Api; // 用来保存的 api
|
||||||
asyncApi?: Api; // 如果 api 处理时间过长,可以开启 asyncApi 来处理。轮询检测是否真的完成了。
|
asyncApi?: Api; // 如果 api 处理时间过长,可以开启 asyncApi 来处理。轮询检测是否真的完成了。
|
||||||
|
checkInterval?: number;
|
||||||
finishedField?: string;
|
finishedField?: string;
|
||||||
initFetch?: boolean; // 是否初始拉取?
|
initFetch?: boolean; // 是否初始拉取?
|
||||||
initFetchOn?: string;
|
initFetchOn?: string;
|
||||||
@ -212,6 +214,7 @@ export default class Form extends React.Component<FormProps, object> {
|
|||||||
initFetchOn,
|
initFetchOn,
|
||||||
initAsyncApi,
|
initAsyncApi,
|
||||||
initFinishedField,
|
initFinishedField,
|
||||||
|
initCheckInterval,
|
||||||
store,
|
store,
|
||||||
messages: {
|
messages: {
|
||||||
fetchSuccess,
|
fetchSuccess,
|
||||||
@ -260,7 +263,8 @@ export default class Form extends React.Component<FormProps, object> {
|
|||||||
|
|
||||||
return until(() => store.checkRemote(initAsyncApi, store.data)
|
return until(() => store.checkRemote(initAsyncApi, store.data)
|
||||||
, (ret:any) => ret && ret[initFinishedField || 'finished']
|
, (ret:any) => ret && ret[initFinishedField || 'finished']
|
||||||
, (cancel) => this.asyncCancel = cancel);
|
, (cancel) => this.asyncCancel = cancel
|
||||||
|
, initCheckInterval);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(this.initInterval)
|
.then(this.initInterval)
|
||||||
@ -481,6 +485,7 @@ export default class Form extends React.Component<FormProps, object> {
|
|||||||
api,
|
api,
|
||||||
asyncApi,
|
asyncApi,
|
||||||
finishedField,
|
finishedField,
|
||||||
|
checkInterval,
|
||||||
messages: {
|
messages: {
|
||||||
saveSuccess,
|
saveSuccess,
|
||||||
saveFailed
|
saveFailed
|
||||||
@ -550,7 +555,8 @@ export default class Form extends React.Component<FormProps, object> {
|
|||||||
|
|
||||||
return until(() => store.checkRemote(finnalAsyncApi as Api, store.data)
|
return until(() => store.checkRemote(finnalAsyncApi as Api, store.data)
|
||||||
, (ret:any) => ret && ret[finishedField || 'finished']
|
, (ret:any) => ret && ret[finishedField || 'finished']
|
||||||
, (cancel) => this.asyncCancel = cancel);
|
, (cancel) => this.asyncCancel = cancel
|
||||||
|
, checkInterval);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(async (response) => {
|
.then(async (response) => {
|
||||||
|
@ -311,8 +311,6 @@ export const HocQuickEdit = (config: Partial<QuickEditConfig> = {}) => (Componen
|
|||||||
{
|
{
|
||||||
type: quickEdit.type || 'text',
|
type: quickEdit.type || 'text',
|
||||||
name: quickEdit.name || name,
|
name: quickEdit.name || name,
|
||||||
placeholder: label,
|
|
||||||
label: false,
|
|
||||||
...quickEdit,
|
...quickEdit,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -548,7 +548,7 @@ export const TableStore = iRendererStore
|
|||||||
rowSpans: {},
|
rowSpans: {},
|
||||||
modified: false,
|
modified: false,
|
||||||
children: (item && Array.isArray(item.children)) ? initChildren(item.children, depth, key, id) : [],
|
children: (item && Array.isArray(item.children)) ? initChildren(item.children, depth, key, id) : [],
|
||||||
expandable: !!(item && Array.isArray(item.children) || self.footable && self.footableColumns.length),
|
expandable: !!(item && Array.isArray(item.children) && item.children.length || self.footable && self.footableColumns.length),
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -571,7 +571,7 @@ export const TableStore = iRendererStore
|
|||||||
rowSpans: {},
|
rowSpans: {},
|
||||||
modified: false,
|
modified: false,
|
||||||
children: (item && Array.isArray(item.children)) ? initChildren(item.children, 1, key, id) : [],
|
children: (item && Array.isArray(item.children)) ? initChildren(item.children, 1, key, id) : [],
|
||||||
expandable: !!(item && Array.isArray(item.children) || self.footable && self.footableColumns.length),
|
expandable: !!(item && Array.isArray(item.children) && item.children.length || self.footable && self.footableColumns.length),
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user