From 17f822b8b32b4a0094f937b12eb1b029800007a0 Mon Sep 17 00:00:00 2001 From: catchonme Date: Thu, 5 Sep 2019 14:47:28 +0800 Subject: [PATCH] =?UTF-8?q?form=E9=85=8D=E7=BD=AE=E5=BC=82=E6=AD=A5api?= =?UTF-8?q?=E5=AE=9A=E6=97=B6=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/renderers/Form/Image.md | 1 - src/index.tsx | 3 ++- src/renderers/Form/index.tsx | 10 ++++++++-- src/renderers/QuickEdit.tsx | 2 -- src/store/table.ts | 4 ++-- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/docs/renderers/Form/Image.md b/docs/renderers/Form/Image.md index 74964ce14..1d0ca19fd 100644 --- a/docs/renderers/Form/Image.md +++ b/docs/renderers/Form/Image.md @@ -17,7 +17,6 @@ - `showCompressOptions` 默认为 false, 开启后,允许用户输入压缩选项。 - `crop` 用来设置是否支持裁剪。 - `aspectRatio` 浮点型,默认 `1` 即 `1:1`,如果要设置 `16:9` 请设置 `1.7777777777777777` 即 `16 / 9`。 -- `allowInput` 默认都是通过用户选择图片后上传返回图片地址,如果开启此选项,则可以允许用户图片地址。 - `limit` 限制图片大小,超出不让上传。 - `width` 限制图片宽度。 - `height` 限制图片高度。 diff --git a/src/index.tsx b/src/index.tsx index ea155abe6..958e4e6f3 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -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, diff --git a/src/renderers/Form/index.tsx b/src/renderers/Form/index.tsx index d01ba402f..a0bcc4055 100644 --- a/src/renderers/Form/index.tsx +++ b/src/renderers/Form/index.tsx @@ -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 { initFetchOn, initAsyncApi, initFinishedField, + initCheckInterval, store, messages: { fetchSuccess, @@ -260,7 +263,8 @@ export default class Form extends React.Component { 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 { api, asyncApi, finishedField, + checkInterval, messages: { saveSuccess, saveFailed @@ -550,7 +555,8 @@ export default class Form extends React.Component { 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) => { diff --git a/src/renderers/QuickEdit.tsx b/src/renderers/QuickEdit.tsx index c012c55a9..ddccd861f 100644 --- a/src/renderers/QuickEdit.tsx +++ b/src/renderers/QuickEdit.tsx @@ -311,8 +311,6 @@ export const HocQuickEdit = (config: Partial = {}) => (Componen { type: quickEdit.type || 'text', name: quickEdit.name || name, - placeholder: label, - label: false, ...quickEdit, }, ], diff --git a/src/store/table.ts b/src/store/table.ts index 3497aca11..821136c17 100644 --- a/src/store/table.ts +++ b/src/store/table.ts @@ -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), } });