Merge pull request #223 from catchonme/master

form配置异步api定时时间
This commit is contained in:
liaoxuezhi 2019-09-05 15:04:31 +08:00 committed by GitHub
commit 9613265966
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 8 deletions

View File

@ -17,7 +17,6 @@
- `showCompressOptions` 默认为 false, 开启后,允许用户输入压缩选项。
- `crop` 用来设置是否支持裁剪。
- `aspectRatio` 浮点型,默认 `1``1:1`,如果要设置 `16:9` 请设置 `1.7777777777777777``16 / 9`
- `allowInput` 默认都是通过用户选择图片后上传返回图片地址,如果开启此选项,则可以允许用户图片地址。
- `limit` 限制图片大小,超出不让上传。
- `width` 限制图片宽度。
- `height` 限制图片高度。

View File

@ -7,7 +7,7 @@
*/
import {render, Renderer, getRendererByName, resolveRenderer, filterSchema} from './factory';
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-lodash';
import * as utils from './utils/helper';
@ -226,6 +226,7 @@ export {
resizeSensor,
registerFilter,
reigsterTplEnginer,
evalExpression,
addRule,
str2rules,
normalizeOptions,

View File

@ -67,12 +67,14 @@ export interface FormProps extends RendererProps, FormSchema {
resetAfterSubmit?: boolean;
initApi?: Api; // 可以用来设置初始数据。
initAsyncApi?: Api; // 如果 api 处理时间过长,可以开启 initAsyncApi 来处理。轮询检测是否真的完成了。
initCheckInterval?: number;
initFinishedField?: string;
interval?: number;
silentPolling?: boolean;
stopAutoRefreshWhen?: string;
api?: Api; // 用来保存的 api
asyncApi?: Api; // 如果 api 处理时间过长,可以开启 asyncApi 来处理。轮询检测是否真的完成了。
checkInterval?: number;
finishedField?: string;
initFetch?: boolean; // 是否初始拉取?
initFetchOn?: string;
@ -212,6 +214,7 @@ export default class Form extends React.Component<FormProps, object> {
initFetchOn,
initAsyncApi,
initFinishedField,
initCheckInterval,
store,
messages: {
fetchSuccess,
@ -260,7 +263,8 @@ export default class Form extends React.Component<FormProps, object> {
return until(() => store.checkRemote(initAsyncApi, store.data)
, (ret:any) => ret && ret[initFinishedField || 'finished']
, (cancel) => this.asyncCancel = cancel);
, (cancel) => this.asyncCancel = cancel
, initCheckInterval);
}
})
.then(this.initInterval)
@ -481,6 +485,7 @@ export default class Form extends React.Component<FormProps, object> {
api,
asyncApi,
finishedField,
checkInterval,
messages: {
saveSuccess,
saveFailed
@ -550,7 +555,8 @@ export default class Form extends React.Component<FormProps, object> {
return until(() => store.checkRemote(finnalAsyncApi as Api, store.data)
, (ret:any) => ret && ret[finishedField || 'finished']
, (cancel) => this.asyncCancel = cancel);
, (cancel) => this.asyncCancel = cancel
, checkInterval);
}
})
.then(async (response) => {

View File

@ -311,8 +311,6 @@ export const HocQuickEdit = (config: Partial<QuickEditConfig> = {}) => (Componen
{
type: quickEdit.type || 'text',
name: quickEdit.name || name,
placeholder: label,
label: false,
...quickEdit,
},
],

View File

@ -548,7 +548,7 @@ export const TableStore = iRendererStore
rowSpans: {},
modified: false,
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: {},
modified: false,
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),
}
});