diff --git a/deploy-gh-pages.sh b/deploy-gh-pages.sh index f18b9c755..3edd85f40 100755 --- a/deploy-gh-pages.sh +++ b/deploy-gh-pages.sh @@ -5,20 +5,16 @@ set -e echo "building" node ./scripts/generate-search-data.js -npm run build-schemas - ./node_modules/.bin/fis3 release gh-pages -c # 拷贝一份兼容之前的访问路径 cp -r gh-pages/zh-CN/docs/* gh-pages/docs/ -cp ./schema.json ./gh-pages +cp ./packages/amis/schema.json ./gh-pages cp -r mock gh-pages/ -sh build.sh - -tar -zcvf sdk.tar.gz sdk +tar -zcvf sdk.tar.gz packages/amis/sdk mv sdk.tar.gz gh-pages/ diff --git a/examples/index.html b/examples/index.html index 491551bf6..445524437 100644 --- a/examples/index.html +++ b/examples/index.html @@ -41,48 +41,48 @@ document.write( `` + } href="${__uri('amis/lib/themes/ang.css')}" />` ); document.write( `` + } href="${__uri('amis/lib/themes/cxd.css')}" />` ); document.write( `` + } href="${__uri('amis/lib/themes/dark.css')}" />` ); document.write( `` + } href="${__uri('amis/lib/themes/antd.css')}" />` ); } else { document.write( `` + } href="${__uri('amis/lib/themes/ang-ie11.css')}" />` ); document.write( `` + } href="${__uri('amis/lib/themes/cxd-ie11.css')}" />` ); document.write( `` + } href="${__uri('amis/lib/themes/dark-ie11.css')}" />` ); document.write( `` + } href="${__uri('amis/lib/themes/antd-ie11.css')}" />` ); } - + diff --git a/packages/amis-core/src/renderers/Form.tsx b/packages/amis-core/src/renderers/Form.tsx index f19c90239..e19f89382 100644 --- a/packages/amis-core/src/renderers/Form.tsx +++ b/packages/amis-core/src/renderers/Form.tsx @@ -7,7 +7,8 @@ import { Schema, ActionObject, Payload, - ClassName + ClassName, + BaseApiObject } from '../types'; import {filter, evalExpression} from '../utils/tpl'; import getExprProperties from '../utils/filter-schema'; @@ -85,12 +86,12 @@ export interface FormSchemaBase { /** * 用来初始化表单数据 */ - initApi?: Api; + initApi?: string | BaseApiObject; /** * Form 用来获取初始数据的 api,与initApi不同的是,会一直轮询请求该接口,直到返回 finished 属性为 true 才 结束。 */ - initAsyncApi?: Api; + initAsyncApi?: string | BaseApiObject; /** * 设置了initAsyncApi后,默认会从返回数据的data.finished来判断是否完成,也可以设置成其他的xxx,就会从data.xxx中获取 @@ -142,7 +143,7 @@ export interface FormSchemaBase { * * 详情:https://baidu.gitee.io/amis/docs/components/form/index#%E8%A1%A8%E5%8D%95%E6%8F%90%E4%BA%A4 */ - api?: Api; + api?: string | BaseApiObject; /** * Form 也可以配置 feedback。 @@ -152,7 +153,7 @@ export interface FormSchemaBase { /** * 设置此属性后,表单提交发送保存接口后,还会继续轮询请求该接口,直到返回 finished 属性为 true 才 结束。 */ - asyncApi?: Api; + asyncApi?: string | BaseApiObject; /** * 轮询请求的时间间隔,默认为 3秒。设置 asyncApi 才有效 diff --git a/packages/amis-core/src/renderers/Item.tsx b/packages/amis-core/src/renderers/Item.tsx index 57a1b813b..15cf40b89 100644 --- a/packages/amis-core/src/renderers/Item.tsx +++ b/packages/amis-core/src/renderers/Item.tsx @@ -23,6 +23,7 @@ import {FormHorizontal, FormSchemaBase} from './Form'; import { Api, ApiObject, + BaseApiObject, BaseSchemaWithoutType, ClassName, Schema @@ -283,7 +284,7 @@ export interface FormBaseControl extends BaseSchemaWithoutType { /** * 远端校验表单项接口 */ - validateApi?: Api; + validateApi?: string | BaseApiObject; } export interface FormItemBasicConfig extends Partial { diff --git a/packages/amis-ui/src/components/condition-builder/types.ts b/packages/amis-ui/src/components/condition-builder/types.ts index 34843574f..b09ad29b7 100644 --- a/packages/amis-ui/src/components/condition-builder/types.ts +++ b/packages/amis-ui/src/components/condition-builder/types.ts @@ -1,4 +1,4 @@ -import {Api} from 'amis-core'; +import {Api, BaseApiObject} from 'amis-core'; export type FieldTypes = | 'text' @@ -153,14 +153,14 @@ interface SelectField extends BaseField { name: string; multiple?: boolean; options?: Array; - source?: Api; + source?: string | BaseApiObject; searchable?: boolean; /** * 自动完成 API,当输入部分文字的时候,会将这些文字通过 ${term} 可以取到,发送给接口。 * 接口可以返回匹配到的选项,帮助用户输入。 */ - autoComplete?: Api; + autoComplete?: string | BaseApiObject; } interface BooleanField extends BaseField { diff --git a/packages/amis/src/Schema.ts b/packages/amis/src/Schema.ts index 47b98ca58..f85abd9b3 100644 --- a/packages/amis/src/Schema.ts +++ b/packages/amis/src/Schema.ts @@ -119,7 +119,11 @@ import {TabsTransferPickerControlSchema} from './renderers/Form/TabsTransferPick import {UserSelectControlSchema} from './renderers/Form/UserSelect'; import {JSONSchemaEditorControlSchema} from './renderers/Form/JSONSchemaEditor'; import {TableSchemaV2} from './renderers/Table-v2'; -import {BaseSchemaWithoutType} from 'amis-core'; +import { + BaseSchemaWithoutType, + SchemaClassName, + SchemaExpression +} from 'amis-core'; import type {FormSchemaBase} from 'amis-core/lib/renderers/Form'; // 每加个类型,这补充一下。 @@ -477,43 +481,6 @@ export type SchemaCollection = | SchemaTpl | Array; -/** - * 表达式,语法 `data.xxx > 5`。 - */ -export type SchemaExpression = string; - -/** - * css类名,配置字符串,或者对象。 - * - * className: "red" - * - * 用对象配置时意味着你能跟表达式一起搭配使用,如: - * - * className: { - * "red": "data.progress > 80", - * "blue": "data.progress > 60" - * } - */ -export type SchemaClassName = - | string - | { - [propName: string]: boolean | undefined | null | SchemaExpression; - }; - -// /** -// * css类名,配置字符串,或者对象。 -// * -// * className: "red" -// * -// * 用对象配置时意味着你能跟表达式一起搭配使用,如: -// * -// * className: { -// * "red": "data.progress > 80", -// * "blue": "data.progress > 60" -// * } -// */ -// export type SchemaClassName = string; - export interface SchemaApiObject { /** * API 发送类型 @@ -893,3 +860,5 @@ export interface FormSchema extends FormSchemaBase, BaseSchema { */ body?: SchemaCollection; } + +export {SchemaClassName, SchemaExpression}; diff --git a/packages/amis/src/renderers/Table/HeadCellFilterDropdown.tsx b/packages/amis/src/renderers/Table/HeadCellFilterDropdown.tsx index e116ff60e..220cfa8a8 100644 --- a/packages/amis/src/renderers/Table/HeadCellFilterDropdown.tsx +++ b/packages/amis/src/renderers/Table/HeadCellFilterDropdown.tsx @@ -13,7 +13,7 @@ import {getVariable, createObject} from 'amis-core'; export interface QuickFilterConfig { options: Array; - source: Api; + // source: Api; multiple: boolean; [propName: string]: any; } diff --git a/packages/amis/src/types.ts b/packages/amis/src/types.ts index 156f2cb31..cdaf58b54 100644 --- a/packages/amis/src/types.ts +++ b/packages/amis/src/types.ts @@ -1,5 +1,5 @@ import type {ActionSchema} from './renderers/Action'; -import {SchemaApiObject} from './Schema'; +import {SchemaApi, SchemaApiObject} from './Schema'; export interface ApiObject extends SchemaApiObject { config?: { @@ -115,8 +115,8 @@ export interface Action extends Button { | 'selectAll' | 'changeTabKey' | 'click'; - api?: Api; - asyncApi?: Api; + api?: SchemaApi; + asyncApi?: SchemaApi; payload?: any; dialog?: SchemaNode; to?: string;