修复 schema.json 编译问题

This commit is contained in:
liaoxuezhi 2022-06-02 15:28:51 +08:00
parent d6bd8ab0e2
commit 7826903726
8 changed files with 33 additions and 66 deletions

View File

@ -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/

View File

@ -41,48 +41,48 @@
document.write(
`<link rel="stylesheet" title="ang" ${
theme !== 'ang' ? 'disabled' : ''
} href="${__uri('amis-ui/lib/themes/ang.css')}" />`
} href="${__uri('amis/lib/themes/ang.css')}" />`
);
document.write(
`<link rel="stylesheet" title="cxd" ${
theme !== 'cxd' ? 'disabled' : ''
} href="${__uri('amis-ui/lib/themes/cxd.css')}" />`
} href="${__uri('amis/lib/themes/cxd.css')}" />`
);
document.write(
`<link rel="stylesheet" title="dark" ${
theme !== 'dark' ? 'disabled' : ''
} href="${__uri('amis-ui/lib/themes/dark.css')}" />`
} href="${__uri('amis/lib/themes/dark.css')}" />`
);
document.write(
`<link rel="stylesheet" title="antd" ${
theme !== 'antd' ? 'disabled' : ''
} href="${__uri('amis-ui/lib/themes/antd.css')}" />`
} href="${__uri('amis/lib/themes/antd.css')}" />`
);
} else {
document.write(
`<link rel="stylesheet" title="ang" ${
theme !== 'ang' ? 'disabled' : ''
} href="${__uri('amis-ui/lib/themes/ang-ie11.css')}" />`
} href="${__uri('amis/lib/themes/ang-ie11.css')}" />`
);
document.write(
`<link rel="stylesheet" title="cxd" ${
theme !== 'cxd' ? 'disabled' : ''
} href="${__uri('amis-ui/lib/themes/cxd-ie11.css')}" />`
} href="${__uri('amis/lib/themes/cxd-ie11.css')}" />`
);
document.write(
`<link rel="stylesheet" title="dark" ${
theme !== 'dark' ? 'disabled' : ''
} href="${__uri('amis-ui/lib/themes/dark-ie11.css')}" />`
} href="${__uri('amis/lib/themes/dark-ie11.css')}" />`
);
document.write(
`<link rel="stylesheet" title="antd" ${
theme !== 'antd' ? 'disabled' : ''
} href="${__uri('amis-ui/lib/themes/antd-ie11.css')}" />`
} href="${__uri('amis/lib/themes/antd-ie11.css')}" />`
);
}
</script>
<!--ignore-->
<link rel="stylesheet" href="amis-ui/lib/helper.css" />
<link rel="stylesheet" href="amis/lib/helper.css" />
<!--ignore-->
</head>

View File

@ -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来判断是否完成xxxdata.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

View File

@ -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<RendererConfig> {

View File

@ -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<any>;
source?: Api;
source?: string | BaseApiObject;
searchable?: boolean;
/**
* API ${term}
*
*/
autoComplete?: Api;
autoComplete?: string | BaseApiObject;
}
interface BooleanField extends BaseField {

View File

@ -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<SchemaObject | SchemaTpl>;
/**
* `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};

View File

@ -13,7 +13,7 @@ import {getVariable, createObject} from 'amis-core';
export interface QuickFilterConfig {
options: Array<any>;
source: Api;
// source: Api;
multiple: boolean;
[propName: string]: any;
}

View File

@ -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;