修复 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" echo "building"
node ./scripts/generate-search-data.js node ./scripts/generate-search-data.js
npm run build-schemas
./node_modules/.bin/fis3 release gh-pages -c ./node_modules/.bin/fis3 release gh-pages -c
# 拷贝一份兼容之前的访问路径 # 拷贝一份兼容之前的访问路径
cp -r gh-pages/zh-CN/docs/* gh-pages/docs/ 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/ cp -r mock gh-pages/
sh build.sh tar -zcvf sdk.tar.gz packages/amis/sdk
tar -zcvf sdk.tar.gz sdk
mv sdk.tar.gz gh-pages/ mv sdk.tar.gz gh-pages/

View File

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

View File

@ -7,7 +7,8 @@ import {
Schema, Schema,
ActionObject, ActionObject,
Payload, Payload,
ClassName ClassName,
BaseApiObject
} from '../types'; } from '../types';
import {filter, evalExpression} from '../utils/tpl'; import {filter, evalExpression} from '../utils/tpl';
import getExprProperties from '../utils/filter-schema'; import getExprProperties from '../utils/filter-schema';
@ -85,12 +86,12 @@ export interface FormSchemaBase {
/** /**
* *
*/ */
initApi?: Api; initApi?: string | BaseApiObject;
/** /**
* Form api,initApi不同的是 finished true * Form api,initApi不同的是 finished true
*/ */
initAsyncApi?: Api; initAsyncApi?: string | BaseApiObject;
/** /**
* initAsyncApi后data.finished来判断是否完成xxxdata.xxx中获取 * 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 * 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 * Form feedback
@ -152,7 +153,7 @@ export interface FormSchemaBase {
/** /**
* finished true * finished true
*/ */
asyncApi?: Api; asyncApi?: string | BaseApiObject;
/** /**
* 3 asyncApi * 3 asyncApi

View File

@ -23,6 +23,7 @@ import {FormHorizontal, FormSchemaBase} from './Form';
import { import {
Api, Api,
ApiObject, ApiObject,
BaseApiObject,
BaseSchemaWithoutType, BaseSchemaWithoutType,
ClassName, ClassName,
Schema Schema
@ -283,7 +284,7 @@ export interface FormBaseControl extends BaseSchemaWithoutType {
/** /**
* *
*/ */
validateApi?: Api; validateApi?: string | BaseApiObject;
} }
export interface FormItemBasicConfig extends Partial<RendererConfig> { 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 = export type FieldTypes =
| 'text' | 'text'
@ -153,14 +153,14 @@ interface SelectField extends BaseField {
name: string; name: string;
multiple?: boolean; multiple?: boolean;
options?: Array<any>; options?: Array<any>;
source?: Api; source?: string | BaseApiObject;
searchable?: boolean; searchable?: boolean;
/** /**
* API ${term} * API ${term}
* *
*/ */
autoComplete?: Api; autoComplete?: string | BaseApiObject;
} }
interface BooleanField extends BaseField { interface BooleanField extends BaseField {

View File

@ -119,7 +119,11 @@ import {TabsTransferPickerControlSchema} from './renderers/Form/TabsTransferPick
import {UserSelectControlSchema} from './renderers/Form/UserSelect'; import {UserSelectControlSchema} from './renderers/Form/UserSelect';
import {JSONSchemaEditorControlSchema} from './renderers/Form/JSONSchemaEditor'; import {JSONSchemaEditorControlSchema} from './renderers/Form/JSONSchemaEditor';
import {TableSchemaV2} from './renderers/Table-v2'; 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'; import type {FormSchemaBase} from 'amis-core/lib/renderers/Form';
// 每加个类型,这补充一下。 // 每加个类型,这补充一下。
@ -477,43 +481,6 @@ export type SchemaCollection =
| SchemaTpl | SchemaTpl
| Array<SchemaObject | 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 { export interface SchemaApiObject {
/** /**
* API * API
@ -893,3 +860,5 @@ export interface FormSchema extends FormSchemaBase, BaseSchema {
*/ */
body?: SchemaCollection; body?: SchemaCollection;
} }
export {SchemaClassName, SchemaExpression};

View File

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

View File

@ -1,5 +1,5 @@
import type {ActionSchema} from './renderers/Action'; import type {ActionSchema} from './renderers/Action';
import {SchemaApiObject} from './Schema'; import {SchemaApi, SchemaApiObject} from './Schema';
export interface ApiObject extends SchemaApiObject { export interface ApiObject extends SchemaApiObject {
config?: { config?: {
@ -115,8 +115,8 @@ export interface Action extends Button {
| 'selectAll' | 'selectAll'
| 'changeTabKey' | 'changeTabKey'
| 'click'; | 'click';
api?: Api; api?: SchemaApi;
asyncApi?: Api; asyncApi?: SchemaApi;
payload?: any; payload?: any;
dialog?: SchemaNode; dialog?: SchemaNode;
to?: string; to?: string;