Auto Resolve Conflict To Branch fix-fx-formula By iCode

Change-Id: I1cd2811b9e3b47bbd51ef712b7adde8cd5c4dac1
This commit is contained in:
jiatianqi 2022-10-31 15:52:03 +08:00
commit 8294d1d85b
101 changed files with 4284 additions and 3217 deletions

View File

@ -30,8 +30,8 @@ module.exports = {
path: './' path: './'
}, },
translate: { translate: {
appId: '20220810001301703', appId: '20220902001329332',
key: 'WW7jKaJJBrtCawTOkCpk', key: 'pVS96QbIzVROBSOarU4R',
host: 'http://api.fanyi.baidu.com' host: 'http://api.fanyi.baidu.com'
} }
}; };

View File

@ -1,6 +1,6 @@
{ {
"name": "amis-editor", "name": "amis-editor",
"version": "5.2.0-beta.70", "version": "5.2.1",
"description": "amis 可视化编辑器", "description": "amis 可视化编辑器",
"main": "lib/index.js", "main": "lib/index.js",
"module": "esm/index.js", "module": "esm/index.js",
@ -10,7 +10,8 @@
"build": "npm run clean-dist && NODE_ENV=production rollup -c ", "build": "npm run clean-dist && NODE_ENV=production rollup -c ",
"clean-dist": "rimraf lib/* esm/*", "clean-dist": "rimraf lib/* esm/*",
"i18n:update": "npx i18n update --config=./i18nConfig.js", "i18n:update": "npx i18n update --config=./i18nConfig.js",
"i18n:translate": "npx i18n translate --config=./i18nConfig.js --l=en-US" "i18n:translate": "npx i18n translate --config=./i18nConfig.js --l=en-US",
"i18n:merge": "npx i18n merge --config=./i18nConfig.js --l=en-US"
}, },
"keywords": [ "keywords": [
"amis", "amis",
@ -19,7 +20,8 @@
"author": "@fex", "author": "@fex",
"license": "ISC", "license": "ISC",
"files": [ "files": [
"lib" "lib",
"esm"
], ],
"lint-staged": { "lint-staged": {
"{src,scss,examples}/**/**/*.{js,jsx,ts,tsx,scss,json}": [ "{src,scss,examples}/**/**/*.{js,jsx,ts,tsx,scss,json}": [
@ -32,7 +34,7 @@
"dependencies": { "dependencies": {
"@webcomponents/webcomponentsjs": "^2.6.0", "@webcomponents/webcomponentsjs": "^2.6.0",
"amis-editor-core": "*", "amis-editor-core": "*",
"i18n-runtime": "0.0.6", "i18n-runtime": "*",
"lodash": "^4.17.15" "lodash": "^4.17.15"
}, },
"devDependencies": { "devDependencies": {
@ -59,10 +61,10 @@
"@types/sortablejs": "^1.10.7", "@types/sortablejs": "^1.10.7",
"@types/tinycolor2": "^1.4.3", "@types/tinycolor2": "^1.4.3",
"ajv": "^8.8.2", "ajv": "^8.8.2",
"amis": "^2.2.0", "amis": "2.3.2-beta.1",
"amis-core": "^2.2.0", "amis-core": "2.3.2-beta.1",
"amis-formula": "^2.2.0", "amis-formula": "2.3.2-beta.1",
"amis-ui": "^2.2.0", "amis-ui": "2.3.2-beta.1",
"axios": "0.21.1", "axios": "0.21.1",
"concurrently": "^6.2.0", "concurrently": "^6.2.0",
"css-loader": "^6.2.0", "css-loader": "^6.2.0",

View File

@ -3,7 +3,7 @@
*/ */
import flatten from 'lodash/flatten'; import flatten from 'lodash/flatten';
import {getEventControlConfig} from '../renderer/event-control/helper'; import {getEventControlConfig, SUPPORT_STATIC_FORMITEM_CMPTS} from '../renderer/event-control/helper';
import {getSchemaTpl, isObject, tipedLabel} from 'amis-editor-core'; import {getSchemaTpl, isObject, tipedLabel} from 'amis-editor-core';
import type {BaseEventContext} from 'amis-editor-core'; import type {BaseEventContext} from 'amis-editor-core';
import {SchemaObject} from 'amis/lib/Schema'; import {SchemaObject} from 'amis/lib/Schema';
@ -143,7 +143,7 @@ const normalizeBodySchema = (
* @param {Object=} panels * @param {Object=} panels
* @param {string=} key * @param {string=} key
* `property` * `property`
* `common` * `common`
* `status` * `status`
* `validation` * `validation`
* `style` * `style`
@ -196,6 +196,8 @@ export const formItemControl: (
>, >,
context?: BaseEventContext context?: BaseEventContext
) => Array<any> = (panels, context) => { ) => Array<any> = (panels, context) => {
const type = context?.schema?.type || '';
const supportStatic = SUPPORT_STATIC_FORMITEM_CMPTS.includes(type);
const collapseProps = { const collapseProps = {
type: 'collapse', type: 'collapse',
headingClassName: 'ae-formItemControl-header', headingClassName: 'ae-formItemControl-header',
@ -215,7 +217,7 @@ export const formItemControl: (
: [ : [
{ {
...collapseProps, ...collapseProps,
header: '常用', header: '基本',
key: 'common', key: 'common',
body: normalizeBodySchema( body: normalizeBodySchema(
[ [
@ -250,6 +252,7 @@ export const formItemControl: (
body: normalizeBodySchema( body: normalizeBodySchema(
[ [
getSchemaTpl('hidden'), getSchemaTpl('hidden'),
supportStatic ? getSchemaTpl('static') : null,
// TODO: 下面的部分表单项才有,是不是判断一下是否是表单项 // TODO: 下面的部分表单项才有,是不是判断一下是否是表单项
getSchemaTpl('disabled'), getSchemaTpl('disabled'),
getSchemaTpl('clearValueOnHidden') getSchemaTpl('clearValueOnHidden')
@ -283,7 +286,6 @@ export const formItemControl: (
// } // }
// ]) // ])
]; ];
return [ return [
{ {
type: 'tabs', type: 'tabs',
@ -337,7 +339,13 @@ export const formItemControl: (
label: '描述 CSS 类名', label: '描述 CSS 类名',
name: 'descriptionClassName', name: 'descriptionClassName',
visibleOn: 'this.description' visibleOn: 'this.description'
}) }),
...!supportStatic ? [] : [
getSchemaTpl('className', {
label: '静态 CSS 类名',
name: 'staticClassName'
})
]
], ],
panels?.style?.body, panels?.style?.body,
panels?.style?.replace, panels?.style?.replace,
@ -407,7 +415,7 @@ export function remarkTpl(config: {
}, },
form: { form: {
size: 'md', size: 'md',
className: 'mb-8 ae-remark-form', className: 'mb-8',
mode: 'horizontal', mode: 'horizontal',
horizontal: { horizontal: {
left: 4, left: 4,
@ -463,12 +471,10 @@ export function remarkTpl(config: {
} }
] ]
}, },
{ getSchemaTpl('icon', {
name: 'icon', name: 'icon',
label: '图标', label: '图标'
type: 'icon-picker', }),
className: 'fix-icon-picker-overflow'
},
{ {
name: 'className', name: 'className',
label: 'CSS 类名', label: 'CSS 类名',

View File

@ -73,7 +73,6 @@ import './plugin/Audio';
import './plugin/Avatar'; import './plugin/Avatar';
import './plugin/Button'; import './plugin/Button';
import './plugin/ButtonGroup'; import './plugin/ButtonGroup';
import './plugin/ButtonToolbar';
import './plugin/Breadcrumb'; import './plugin/Breadcrumb';
import './plugin/Card'; import './plugin/Card';
import './plugin/Card2'; import './plugin/Card2';
@ -122,8 +121,8 @@ import './plugin/Steps';
import './plugin/Sparkline'; import './plugin/Sparkline';
import './plugin/Submit'; import './plugin/Submit';
import './plugin/Table'; import './plugin/Table';
import './plugin/Table-v2'; import './plugin/Table2';
import './plugin/TableCell-v2'; import './plugin/TableCell2';
import './plugin/Tabs'; import './plugin/Tabs';
import './plugin/Tasks'; import './plugin/Tasks';
import './plugin/Time'; import './plugin/Time';

File diff suppressed because it is too large Load Diff

View File

@ -20,8 +20,6 @@ extendLocale('zh-CN', {
'4d9c32c23df5d234e629c922c58d8e12': '右', '4d9c32c23df5d234e629c922c58d8e12': '右',
'5ef69f62dc668c1a3e68b51c50a2530a': '图标', '5ef69f62dc668c1a3e68b51c50a2530a': '图标',
'4434b33a8731a73613ba5fa1eb984efb': 'CSS 类名', '4434b33a8731a73613ba5fa1eb984efb': 'CSS 类名',
'd46908ab96b7955bc7ba9cb172c4d2c8':
'有哪些辅助类 CSS 类名?请前往 <a href=https://baidu.gitee.io/amis/zh-CN/style/index target=_blank>样式说明</a>,除此之外你可以添加自定义类名,然后在系统配置中添加自定义样式。',
'159dbc2fafd57b9d3652f16659b1b519': '触发方式', '159dbc2fafd57b9d3652f16659b1b519': '触发方式',
'45a51525391d4a3771b22f2cf1aa96b3': '浮层触发方式默认值为鼠标悬停', '45a51525391d4a3771b22f2cf1aa96b3': '浮层触发方式默认值为鼠标悬停',
'728c7cdfa431821d291b5108394ec65a': '鼠标悬停', '728c7cdfa431821d291b5108394ec65a': '鼠标悬停',
@ -534,8 +532,6 @@ extendLocale('zh-CN', {
"\n const button = document.createElement('button');\n button.innerText = '点击修改姓名ddd';\n button.onclick = event => {\n onChange('new name');\n event.preventDefault();\n };\n dom.appendChild(button);", "\n const button = document.createElement('button');\n button.innerText = '点击修改姓名ddd';\n button.onclick = event => {\n onChange('new name');\n event.preventDefault();\n };\n dom.appendChild(button);",
'b82231f254baf9a28bf752683d31b169': '自定义容器', 'b82231f254baf9a28bf752683d31b169': '自定义容器',
'e5b5798a8bab7dc8a578431991731040': '通过自定义代码来实现容器组件', 'e5b5798a8bab7dc8a578431991731040': '通过自定义代码来实现容器组件',
'717a7095d0330ee4bdb46ba8c8b44463':
'<div>\n<h2>hello, world!</h2>\n<div id=customBox>自定义容器区域</div>\n</div>',
'96ec95de2d7da5b16465eb980f74deae': '<p>自定义容器区域</p>', '96ec95de2d7da5b16465eb980f74deae': '<p>自定义容器区域</p>',
'749f710d280419b1da031c9bc79b3b07': '自定义容器区', '749f710d280419b1da031c9bc79b3b07': '自定义容器区',
'356b1959a9da95997b4de31415d9d74e': '日期展示', '356b1959a9da95997b4de31415d9d74e': '日期展示',
@ -565,13 +561,6 @@ extendLocale('zh-CN', {
'dcba76890a534e1fe94421be2a17b484': '左下角展示报错消息', 'dcba76890a534e1fe94421be2a17b484': '左下角展示报错消息',
'af5876b89583552eef4c781718886dec': '左下角展示loading动画', 'af5876b89583552eef4c781718886dec': '左下角展示loading动画',
'dd10fdec63a2224aa3d28b48d428cb98': '数据映射', 'dd10fdec63a2224aa3d28b48d428cb98': '数据映射',
'ff57dff3fca4dee46a8e693d35b7e728':
'<div> 当开启数据映射时,弹框中的数据只会包含设置的部分,请绑定数据。如:{a: ${a}, b: 2}。</div>',
'290aa0d8fd40285d213a3786c98e28d3':
'<div>当值为 __undefined时表示删除对应的字段可以结合{&: $$}来达到黑名单效果。</div>',
'c7505acc5b5dd1ad17f35dd90e0884d6':
'${data[&] ? 已开启定制参数功能,可点击关闭该功能。 : 如果需要在默认数据的基础上定制参数请配置开启参数定制再定义key和value。}',
'9567f8bbb315b1217b7b32be37f97792': '${data[&] ? 立即关闭 : 立即开启}',
'261bba7ad82914e477f4b37f6a83874e': 'CSS类名', '261bba7ad82914e477f4b37f6a83874e': 'CSS类名',
'5e5d3f13111593b2710673006d4c8297': '外层', '5e5d3f13111593b2710673006d4c8297': '外层',
'7e1eb2c588aa1301f4aa19395ef0a177': '分隔线', '7e1eb2c588aa1301f4aa19395ef0a177': '分隔线',
@ -587,11 +576,7 @@ extendLocale('zh-CN', {
'bde8a41fc64bfe78d0c4951ac6f93718': '显示蒙层', 'bde8a41fc64bfe78d0c4951ac6f93718': '显示蒙层',
'4a757588f5aee8cd039b1d166b096d1a': '点击外部关闭', '4a757588f5aee8cd039b1d166b096d1a': '点击外部关闭',
'874cf31274d782914c7833cc39836c4e': '可拖拽抽屉大小', '874cf31274d782914c7833cc39836c4e': '可拖拽抽屉大小',
'0eeffa0f121262f0c737975a7a6553e4':
'位置为 左 或 右 时生效。 默认宽度为尺寸字段配置的宽度,值单位默认为 px也支持百分比等单位 100%',
'd3e329f73ae4b58d95cc7769eeca8370': '位置为 为 左 或 右 时生效', 'd3e329f73ae4b58d95cc7769eeca8370': '位置为 为 左 或 右 时生效',
'9c203944698316da279b3c6f8d1933ac':
'位置为 上 或 下 时生效。 默认宽度为尺寸字段配置的高度,值单位默认为 px也支持百分比等单位 100%',
'45ce37c24c6e7252d98c6d450e3ca4ad': '标题区域', '45ce37c24c6e7252d98c6d450e3ca4ad': '标题区域',
'660553eee939d2bd8ea68172fa7216df': '页脚区域', '660553eee939d2bd8ea68172fa7216df': '页脚区域',
'cc70a816b7d61e7212d57335c0a15af5': '下拉按钮', 'cc70a816b7d61e7212d57335c0a15af5': '下拉按钮',
@ -638,8 +623,6 @@ extendLocale('zh-CN', {
'7ac1519928de413cfe36f5d2e0610430': '自动拉伸', '7ac1519928de413cfe36f5d2e0610430': '自动拉伸',
'8e15f51c9512fdbf4287794d6642a90b': '子节点管理', '8e15f51c9512fdbf4287794d6642a90b': '子节点管理',
'bc78248b34b7bf18691e6d385e0f544b': '子节点内容', 'bc78248b34b7bf18691e6d385e0f544b': '子节点内容',
'2f10b0974520010e9db4ed5c87bc2a95':
'<span class=label label-default>子节点${index | plus}</span>',
'023c4bfc60545a2668c2d5111171b5d8': '外层CSS类名', '023c4bfc60545a2668c2d5111171b5d8': '外层CSS类名',
'a4611da51ffee9140976d01668e45d45': '子节点集合', 'a4611da51ffee9140976d01668e45d45': '子节点集合',
'729a4cca5ed3504793c1f3a87d2b48b9': '按钮点选', '729a4cca5ed3504793c1f3a87d2b48b9': '按钮点选',
@ -729,7 +712,6 @@ extendLocale('zh-CN', {
'66e867eb73a118649800c0a064d0b5aa': '类型名称', '66e867eb73a118649800c0a064d0b5aa': '类型名称',
'5aa528690fd771f89683a7f00868f39e': '分支管理', '5aa528690fd771f89683a7f00868f39e': '分支管理',
'35b65a5a3f8d721e12cae310463d69d6': '命中条件', '35b65a5a3f8d721e12cae310463d69d6': '命中条件',
'c4f1a371191ac24d16e00e105540c47a': '比如: this.type === text',
'85485d70be6b380294428018e54fc9b9': '根据成员数据判断是否使用此分支', '85485d70be6b380294428018e54fc9b9': '根据成员数据判断是否使用此分支',
'50bfed6ada3e7d0ef4d20eb727b3d7df': '配置子表单项', '50bfed6ada3e7d0ef4d20eb727b3d7df': '配置子表单项',
'd68162ea1904f627b033fe3953da295d': '配置子表单集合', 'd68162ea1904f627b033fe3953da295d': '配置子表单集合',
@ -942,8 +924,6 @@ extendLocale('zh-CN', {
'c80c42a0be1b39ed899b1f5560875cf8': 'c80c42a0be1b39ed899b1f5560875cf8':
'支持 JS 表达式,如: <code>data.var_a + 2</code>,即当表单项 <code>var_a</code> 变化的时候,会自动给当前表单项设置为 <code>var_a + 2</code> 的值。若设置为字符串,则需要加引号', '支持 JS 表达式,如: <code>data.var_a + 2</code>,即当表单项 <code>var_a</code> 变化的时候,会自动给当前表单项设置为 <code>var_a + 2</code> 的值。若设置为字符串,则需要加引号',
'89a8549c2ed7fc23a683599731d92b22': '作用条件', '89a8549c2ed7fc23a683599731d92b22': '作用条件',
'e16e5eca749d250efd3ad95434ff7026':
'支持如:<code>\\${xxx}</code>或者<code>data.xxx == a</code> 表达式来配置作用条件,当满足该作用条件时,会将计算结果设置到目标变量上。',
'3df193f5d4f652a4bac331a69761041b': '是否初始应用', '3df193f5d4f652a4bac331a69761041b': '是否初始应用',
'86cebf86c66c6a4e6731b840c3967ab0': '86cebf86c66c6a4e6731b840c3967ab0':
'是否初始化的时候运行公式结果,并设置到目标变量上。', '是否初始化的时候运行公式结果,并设置到目标变量上。',
@ -1017,8 +997,6 @@ extendLocale('zh-CN', {
'0a72b3858efffaa1bab685fa840b701b': '时间值', '0a72b3858efffaa1bab685fa840b701b': '时间值',
'f6db3514c72bdc34922f137a8a92b997': '输入框获取焦点(非内嵌模式)时触发', 'f6db3514c72bdc34922f137a8a92b997': '输入框获取焦点(非内嵌模式)时触发',
'0f5fc3b84cf9c24ff3acae45ae22fb57': '输入框失去焦点(非内嵌模式)时触发', '0f5fc3b84cf9c24ff3acae45ae22fb57': '输入框失去焦点(非内嵌模式)时触发',
'cfbace00045a3debdc8f02858cf753c6':
'提交数据前将根据设定格式化数据,请参考 <a href=https://momentjs.com/ target=_blank>moment</a> 中的格式用法。',
'ecd1a3cadcf1d55250afafbbde767250': '显示格式', 'ecd1a3cadcf1d55250afafbbde767250': '显示格式',
'182503224cfaf1f63c566f13da56a2a4': '182503224cfaf1f63c566f13da56a2a4':
'请参考 <a href=https://momentjs.com/ target=_blank>moment</a> 中的格式用法。', '请参考 <a href=https://momentjs.com/ target=_blank>moment</a> 中的格式用法。',
@ -1095,8 +1073,6 @@ extendLocale('zh-CN', {
'd28879b6a8a4ddb62bf6f2ab59303df7': '随表单提交', 'd28879b6a8a4ddb62bf6f2ab59303df7': '随表单提交',
'3a76423b7ae40b0fa8b0bedb470cce7e': '独立上传', '3a76423b7ae40b0fa8b0bedb470cce7e': '独立上传',
'7c6722203327e8173be987f36fadf610': '数据格式', '7c6722203327e8173be987f36fadf610': '数据格式',
'abe8f84fa8436e1033af359d8ef25634':
'${formType ? asBase64 ? 小文件时可以使用,默认给 Form 提交的是文件下载地址,设置后给 Form 提交文件内容的 base64 格式字符串。 : File 控件不接管文件上传,直接由表单的保存接口完成。和 Base64 选项二选一。 : }',
'6168fb08fe64663a502a132c5589b73d': '二进制', '6168fb08fe64663a502a132c5589b73d': '二进制',
'7245fe895fa1cfc42b5217a3de314565': '自动上传', '7245fe895fa1cfc42b5217a3de314565': '自动上传',
'cf9e4c80962e712eaa55551cccff317e': '开启分块', 'cf9e4c80962e712eaa55551cccff317e': '开启分块',
@ -1240,8 +1216,6 @@ extendLocale('zh-CN', {
'f9fb6a063d1856da86a06def2dc6b921': '英文', 'f9fb6a063d1856da86a06def2dc6b921': '英文',
'81fafee54baebeb9591b5e7840d7e650': '大屏时展示的配置项', '81fafee54baebeb9591b5e7840d7e650': '大屏时展示的配置项',
'0b6eee152cb2553ed4298ca2fe82d3f8': '屏幕宽度 ≥ 1200px', '0b6eee152cb2553ed4298ca2fe82d3f8': '屏幕宽度 ≥ 1200px',
'ac3906888a34e51c5bdc1297636857ed':
'使用空格分开配置,使用<code>|</code>可将配置栏分组,<a target=_blank href=https://www.froala.com/wysiwyg-editor/docs/options>参考文档</a>',
'f126c4368fbf51cfd470684e7c3d31c9': '中屏时展示的配置项', 'f126c4368fbf51cfd470684e7c3d31c9': '中屏时展示的配置项',
'3b8c320d14dba586c581ceb951917397': '屏幕宽度 ≥ 992px', '3b8c320d14dba586c581ceb951917397': '屏幕宽度 ≥ 992px',
'89bc688b5b497e515ce3c026a1d92669': '小屏时展示的配置项', '89bc688b5b497e515ce3c026a1d92669': '小屏时展示的配置项',
@ -1249,8 +1223,6 @@ extendLocale('zh-CN', {
'b8c8f1c6a56e902bd837420da0f554b3': 'tinymce 设置项', 'b8c8f1c6a56e902bd837420da0f554b3': 'tinymce 设置项',
'e4d0e65de0018b63698ff22d683d6dd5': '是否显示菜单栏', 'e4d0e65de0018b63698ff22d683d6dd5': '是否显示菜单栏',
'63068211669d69b4028eebe0052425e7': '启用的插件', '63068211669d69b4028eebe0052425e7': '启用的插件',
'a917d194212a4f48b60d094c7a83fa17':
'使用空格分开配置,<a target=_blank href=https://www.tiny.cloud/docs/general-configuration-guide/basic-setup/>参考文档</a>',
'1a920d9999206a9fa5f588c7405fe081': '1a920d9999206a9fa5f588c7405fe081':
'SubForm, 配置一个子<code>form</code>作为当前的表单项', 'SubForm, 配置一个子<code>form</code>作为当前的表单项',
'18c113b99afa964ee988f30e81baf12b': '名称字段名', '18c113b99afa964ee988f30e81baf12b': '名称字段名',
@ -1289,8 +1261,6 @@ extendLocale('zh-CN', {
'e54289c1f0e9311185adee89af24e618': '取消编辑按钮图标', 'e54289c1f0e9311185adee89af24e618': '取消编辑按钮图标',
'1205e138ba64dddf61c1f8e6eb3a1aa7': '确认模式', '1205e138ba64dddf61c1f8e6eb3a1aa7': '确认模式',
'1c1618f67cfea6fefb5f287932be2c27': '获取父级数据', '1c1618f67cfea6fefb5f287932be2c27': '获取父级数据',
'c811e7212b773b5d698a708113007729':
'配置canAccessSuperData: true 同时配置 strictMode: false 开启此特性,初始会自动映射父级数据域的同名变量。需要注意的是,这里只会初始会映射,一旦修改过就是当前行数据为主了。也就是说,表单项类型的,只会起到初始值的作用',
'677fb705e57897710d28867b7628307e': 'Input CSS 类名', '677fb705e57897710d28867b7628307e': 'Input CSS 类名',
'14d342362f66aa86e2aa1c1e11aa1204': '标签', '14d342362f66aa86e2aa1c1e11aa1204': '标签',
'1b4996b29c7b4d5fb45ca701e6438d14': '1b4996b29c7b4d5fb45ca701e6438d14':
@ -1407,8 +1377,6 @@ extendLocale('zh-CN', {
'd1f923b8e23b66b3e48953ba1ce17839': '地理位置选择', 'd1f923b8e23b66b3e48953ba1ce17839': '地理位置选择',
'989ea9acbab9b17d2c15e2946b5365bb': '位置选择', '989ea9acbab9b17d2c15e2946b5365bb': '位置选择',
'dffd9d86d2003615897b12ce7597d77b': '百度地图的 AK', 'dffd9d86d2003615897b12ce7597d77b': '百度地图的 AK',
'3eaf4454ea75f435e78890d051775f68':
'请从<a href=http://lbsyun.baidu.com/ target=_blank>百度地图开放平台</a>获取',
'b472ba224a7d132c487ee6ec4798f835': '坐标格式', 'b472ba224a7d132c487ee6ec4798f835': '坐标格式',
'36443b53c845b197db8d39eeda433ab9': '百度坐标', '36443b53c845b197db8d39eeda433ab9': '百度坐标',
'f58cb611aec0998a44ef104b5c950b40': '国测局坐标', 'f58cb611aec0998a44ef104b5c950b40': '国测局坐标',
@ -1451,8 +1419,6 @@ extendLocale('zh-CN', {
'dc0c50a5c9832b393df34835111c34a3': '开启内嵌模式', 'dc0c50a5c9832b393df34835111c34a3': '开启内嵌模式',
'1ac065ed64b81380384a0b371d5b404f': '配置选框详情', '1ac065ed64b81380384a0b371d5b404f': '配置选框详情',
'd64b585847f015eaa1443a3a03562350': '已选定数据的展示样式', 'd64b585847f015eaa1443a3a03562350': '已选定数据的展示样式',
'c2ceb5af7595ec6d1818b35d5b68890b':
'支持使用 <code>\\${xxx}</code> 来获取变量,或者用 lodash.template 语法来写模板逻辑。<a target=_blank href=/amis/zh-CN/docs/concepts/template>详情</a>',
'c2c23b4fc7f695c58e947ad413f2c5d8': '选框类型', 'c2c23b4fc7f695c58e947ad413f2c5d8': '选框类型',
'33e6c41fed95c25e3b426d596d504579': '抽出式弹框', '33e6c41fed95c25e3b426d596d504579': '抽出式弹框',
'5a7af8d3e471d98339c84b07a844547b': '5a7af8d3e471d98339c84b07a844547b':
@ -1688,15 +1654,6 @@ extendLocale('zh-CN', {
'a2bc1edd7be9348e5a998feb0886c55d': '日志数据源', 'a2bc1edd7be9348e5a998feb0886c55d': '日志数据源',
'ddeeaa33ae62ead1a77a859fb79b78d7': 'ddeeaa33ae62ead1a77a859fb79b78d7':
'对现有值做映射展示比如原始值是1、2、3...,需要展示成:下线、上线、过期等等。', '对现有值做映射展示比如原始值是1、2、3...,需要展示成:下线、上线、过期等等。',
'de5c484c2ef38a6908f501bd93339ea7': '<span class=label label-info>一</span>',
'637729ecbb0395a5ce9fc43f94cb92bd':
'<span class=label label-success>二</span>',
'3a82dd75c3c3747c77329f682b243405':
'<span class=label label-danger>三</span>',
'6aa6f4aed3337b006be1052661f2b86b':
'<span class=label label-warning>四</span>',
'8fb95b984334a27006b5d45613a79c51':
'<span class=label label-primary>五</span>',
'8b139ce9fa196b602bb1ee3bd25b25df': '映射表', '8b139ce9fa196b602bb1ee3bd25b25df': '映射表',
'a9de5901385d644363cd056482be7517': 'a9de5901385d644363cd056482be7517':
'<p>当值命中左侧 Key 时,展示右侧内容,当没有命中时,默认实现 Key 为 <code>*</code>的内容</div>(请确保key值唯一)', '<p>当值命中左侧 Key 时,展示右侧内容,当没有命中时,默认实现 Key 为 <code>*</code>的内容</div>(请确保key值唯一)',
@ -1771,8 +1728,6 @@ extendLocale('zh-CN', {
'ff88d5db9d61f14bce6e3397fd4652a5': '当没有值时用这个来替代展示', 'ff88d5db9d61f14bce6e3397fd4652a5': '当没有值时用这个来替代展示',
'348097cc50579e489f0bcb5433637d3a': '开启后可以根据当前列排序(后端排序)。', '348097cc50579e489f0bcb5433637d3a': '开启后可以根据当前列排序(后端排序)。',
'9db64f772c11c614ee00bb3cc066f46f': '列分组名称', '9db64f772c11c614ee00bb3cc066f46f': '列分组名称',
'161799764950b7251c94ae3e44d4c06f':
'当多列的分组名称设置一致时,表格会在显示表头的上层显示超级表头,<a href=https://baidu.github.io/amis/crud/header-group target=_blank>示例</a>',
'19c4f5e98ad302574202de30dddbaf66': '启用快速编辑', '19c4f5e98ad302574202de30dddbaf66': '启用快速编辑',
'15c3796e07e33afc7252df751f610c5d': '是否立即保存', '15c3796e07e33afc7252df751f610c5d': '是否立即保存',
'ba5a0a1ff2c438ae7719ca48b0ce3af7': '启用查看更多展示', 'ba5a0a1ff2c438ae7719ca48b0ce3af7': '启用查看更多展示',
@ -1849,8 +1804,6 @@ extendLocale('zh-CN', {
'da71dcbb13405815476cef28a8b9c4f6': '按钮外层', 'da71dcbb13405815476cef28a8b9c4f6': '按钮外层',
'6c5b1f0e8e361a801fa75da070d1cba5': '用来展示纯文字html 标签会被转义。', '6c5b1f0e8e361a801fa75da070d1cba5': '用来展示纯文字html 标签会被转义。',
'67e77a196826a8880e47ad949ce08ac0': '这是纯文本', '67e77a196826a8880e47ad949ce08ac0': '这是纯文本',
'8f945732891671ab4a3e095ebe58ea38':
'如果当前字段有值,请不要设置,否则覆盖。支持使用 <code>\\${xxx}</code> 来获取变量,或者用 lodash.template 语法来写模板逻辑。<a target=_blank href=/amis/zh-CN/docs/concepts/template>详情</a>',
'83077805e05ac6bedad69b47fca4462b': '进度展示', '83077805e05ac6bedad69b47fca4462b': '进度展示',
'c77048def6e8a2d6c556a3fcc9c66730': '进度条、progress', 'c77048def6e8a2d6c556a3fcc9c66730': '进度条、progress',
'b1aefb18d4bf96dc283a26d67abc41a8': 'b1aefb18d4bf96dc283a26d67abc41a8':
@ -2115,7 +2068,7 @@ extendLocale('zh-CN', {
'9769ee568100b0c530a06ec3f0c0044d': '内容1', '9769ee568100b0c530a06ec3f0c0044d': '内容1',
'4be268145385303e8ebeb480458a380e': '选项卡2', '4be268145385303e8ebeb480458a380e': '选项卡2',
'c50159e2acff0f4ffdce4c67ec3513a3': '内容2', 'c50159e2acff0f4ffdce4c67ec3513a3': '内容2',
'c8794c58d0eb020ca40905d1904d88b2': '修改激活tab值', 'c8794c58d0eb020ca40905d1904d88b2': '激活指定选项卡',
'fcd3abb110aab48ebd0ac2a1d7040d6d': '修改当前激活tab项的key', 'fcd3abb110aab48ebd0ac2a1d7040d6d': '修改当前激活tab项的key',
'9d000284174ff09642502803887f28ed': '激活第', '9d000284174ff09642502803887f28ed': '激活第',
'29645b509093191cad34c673c1b3efb7': '项', '29645b509093191cad34c673c1b3efb7': '项',
@ -2153,8 +2106,6 @@ extendLocale('zh-CN', {
'8a471486c6c7bbe43e14392c6b127aea': '异步任务', '8a471486c6c7bbe43e14392c6b127aea': '异步任务',
'4f58f808d62c4e31c347e483898396d5': '用来做异步任务呈现或者操作。', '4f58f808d62c4e31c347e483898396d5': '用来做异步任务呈现或者操作。',
'9ee043b0a77a26d22eec0f4ea99afbd3': 'hive 任务', '9ee043b0a77a26d22eec0f4ea99afbd3': 'hive 任务',
'f0eda973dd9e60c659057dadde816725':
'查看详情<a target=_blank href=http://www.baidu.com>日志</a>。',
'3709f71c9552ed5db76cbe8f3cb5d4be': '小流量', '3709f71c9552ed5db76cbe8f3cb5d4be': '小流量',
'c60ad696dee4e1eeff6f0f2c2e9b9fc0': '全量', 'c60ad696dee4e1eeff6f0f2c2e9b9fc0': '全量',
'5c0dc424442c913c6d16a2cf43137da4': '初始任务信息', '5c0dc424442c913c6d16a2cf43137da4': '初始任务信息',
@ -2321,7 +2272,6 @@ extendLocale('zh-CN', {
'7c57a563ab87bc6eb5edd8f5b953f499': '接口设置', '7c57a563ab87bc6eb5edd8f5b953f499': '接口设置',
'6aa351f5dacd13d3d862d9c93e4a0241': '发送方式', '6aa351f5dacd13d3d862d9c93e4a0241': '发送方式',
'8dc91bca9bc83efea73150e3478657fc': '发送条件', '8dc91bca9bc83efea73150e3478657fc': '发送条件',
'd811d2650a17fb7cac710e9376645287': '如this.type == 123',
'91ee84292a5bf5e59d3b6309f948f2f1': '用表达式来设置该请求的发送条件', '91ee84292a5bf5e59d3b6309f948f2f1': '用表达式来设置该请求的发送条件',
'55409342e28d37db86fb23efbd84a025': '发送体格式为', '55409342e28d37db86fb23efbd84a025': '发送体格式为',
'e06a14abe7ef66a8ead143db4ae9786e': 'e06a14abe7ef66a8ead143db4ae9786e':
@ -2342,8 +2292,6 @@ extendLocale('zh-CN', {
'9ae7a582479116d4cb41e828fbd59798': '发送数据映射', '9ae7a582479116d4cb41e828fbd59798': '发送数据映射',
'0fcbf036057c6dd88b7b809daa0c5eb7': '0fcbf036057c6dd88b7b809daa0c5eb7':
'当没开启数据映射时,发送 API 的时候会发送尽可能多的数据,如果你想自己控制发送的数据,或者需要额外的数据处理,请开启此选项', '当没开启数据映射时,发送 API 的时候会发送尽可能多的数据,如果你想自己控制发送的数据,或者需要额外的数据处理,请开启此选项',
'eba0c4982948edc9b865292dc8abea33':
'<p>当没开启数据映射时,发送数据自动切成白名单模式,配置啥发送啥,请绑定数据。如:<code>{a: \\${a}, b: 2}</code></p><p>如果希望在默认的基础上定制,请先添加一个 Key 为 `&` Value 为 `\\$$` 作为第一行。</p><div>当值为 <code>__undefined</code>时,表示删除对应的字段,可以结合<code>{&: \\$$}</code>来达到黑名单效果。</div>',
'7dd590a9d9e783e980d318bd52891905': '返回结果映射', '7dd590a9d9e783e980d318bd52891905': '返回结果映射',
'7e295b6ff39ec7356e06c4534bfc4fb3': '7e295b6ff39ec7356e06c4534bfc4fb3':
'如果需要对返回结果做额外的数据处理,请开启此选项', '如果需要对返回结果做额外的数据处理,请开启此选项',
@ -2403,8 +2351,6 @@ extendLocale('zh-CN', {
'5d26b8a41e805204c9dcd5ea7e23b150': '请输入文本/值', '5d26b8a41e805204c9dcd5ea7e23b150': '请输入文本/值',
'22de6ef85ed60ec54dbdc1d8583e5104': '批量添加', '22de6ef85ed60ec54dbdc1d8583e5104': '批量添加',
'421252e16c6cb544fe9ce0be94a190e0': '批量添加选项', '421252e16c6cb544fe9ce0be94a190e0': '批量添加选项',
'55c4cbeae7ffae65d211bc5e9968dc28':
'每个选项单列一行,将所有值不重复的项加为新的选项;<br/>每行可通过空格来分别设置label和value,例:张三 zhangsan',
'1e2f96a69fbef8caa8823a3067ebbdc7': '请输入选项内容', '1e2f96a69fbef8caa8823a3067ebbdc7': '请输入选项内容',
'a4f1ddbbfc96930d24e4b54cb815b62b': '无选项', 'a4f1ddbbfc96930d24e4b54cb815b62b': '无选项',
'5b4ffa2eadaf629b833b37a3e8742b2c': '不分块', '5b4ffa2eadaf629b833b37a3e8742b2c': '不分块',
@ -2427,8 +2373,6 @@ extendLocale('zh-CN', {
'34df758502e02c7c1a58f804a6c96c28': '折叠前文案', '34df758502e02c7c1a58f804a6c96c28': '折叠前文案',
'1d20d90b7c7301b7739900242d38544e': '无配置情况,默认显示标题', '1d20d90b7c7301b7739900242d38544e': '无配置情况,默认显示标题',
'8aea4138b4fac2627c9b72da37e0671f': '折叠后文案', '8aea4138b4fac2627c9b72da37e0671f': '折叠后文案',
'82e9f5ad74c0ff5a041369bd6c7a0760':
'每个选项单列一行,将所有值不重复的项加为新的选项;<br/>每行可通过空格来分别设置time和title,例2022-06-23 期末补考',
'd584018521820dac9e92120737b733ba': '节点配置', 'd584018521820dac9e92120737b733ba': '节点配置',
'c8158b3cad598b0b5939788ca4efb298': '接口获取', 'c8158b3cad598b0b5939788ca4efb298': '接口获取',
'72a3c1690dead6e24f7ac1abc90d5063': '请输入显示时间', '72a3c1690dead6e24f7ac1abc90d5063': '请输入显示时间',
@ -2675,8 +2619,6 @@ extendLocale('zh-CN', {
'1a1ff1e1149a0cd1b39c0b231a334d04': '1a1ff1e1149a0cd1b39c0b231a334d04':
'可以指定操作完成后刷新目标组件,请填写目标组件的 <code>name</code> 属性,多个组件请用<code>,</code>隔开,如果目标组件为表单项,请先填写表单的名字,再用<code>.</code>连接表单项的名字如:<code>xxForm.xxControl</code>。另外如果刷新目标对象设置为 <code>window</code>,则会刷新整个页面。', '可以指定操作完成后刷新目标组件,请填写目标组件的 <code>name</code> 属性,多个组件请用<code>,</code>隔开,如果目标组件为表单项,请先填写表单的名字,再用<code>.</code>连接表单项的名字如:<code>xxForm.xxControl</code>。另外如果刷新目标对象设置为 <code>window</code>,则会刷新整个页面。',
'4fe2f10c6d5bedac03f40a4362e4f69b': '请输入组件name', '4fe2f10c6d5bedac03f40a4362e4f69b': '请输入组件name',
'018dcc21d4c932029eaff062c4767f3f':
'有哪些辅助类 CSS 类名?请前往 <a href=https://baidu.github.io/amis/docs/concepts/style target=_blank>样式说明</a>,除此之外你可以添加自定义类名,然后在系统配置中添加自定义样式。',
'3bce1a6217990c8dc087d254f1fe754a': '自动填充', '3bce1a6217990c8dc087d254f1fe754a': '自动填充',
'f01553e415ca33cc89d0bca84023f4b5': 'f01553e415ca33cc89d0bca84023f4b5':
'将当前已选中的选项的某个字段的值,自动填充到表单中某个表单项中,支持数据映射', '将当前已选中的选项的某个字段的值,自动填充到表单中某个表单项中,支持数据映射',
@ -2824,8 +2766,6 @@ extendLocale('zh-CN', {
'ebd0dc3ebde6182caa3b66e0faf658b6': '自定义验证提示', 'ebd0dc3ebde6182caa3b66e0faf658b6': '自定义验证提示',
'd7772d568894afbb1c924bed7f7ddb32': '自带提示不满足时,可以自定义。', 'd7772d568894afbb1c924bed7f7ddb32': '自带提示不满足时,可以自定义。',
'58c9592f818d706420236c6f9f595517': '新增提示', '58c9592f818d706420236c6f9f595517': '新增提示',
'e367011e16762afd7db7cf4ff06dcb68':
"({\n isEmail: 'Email 格式不正确',\n isRequired: '这是必填项',\n isUrl: 'Url 格式不正确',\n isInt: '请输入整形数字',\n isAlpha: '请输入字母',\n isNumeric: '请输入数字',\n isAlphanumeric: '请输入字母或者数字',\n isFloat: '请输入浮点型数值',\n isWords: '请输入字母',\n isUrlPath: '只能输入字母、数字、\\-\\ 和 \\_\\.',\n matchRegexp: '格式不正确, 请输入符合规则为 \\$1\\ 的内容。',\n minLength: '请输入更多的内容,至少输入 $1 个字符。',\n maxLength: '请控制内容长度, 请不要输入 $1 个字符以上',\n maximum: '当前输入值超出最大值 $1请检查',\n minimum: '当前输入值低于最小值 $1请检查',\n isJson: '请检查 Json 格式。',\n isLength: '请输入长度为 $1 的内容',\n notEmptyString: '请不要全输入空白字符',\n equalsField: '输入的数据与 $1 值不一致',\n equals: '输入的数据与 $1 不一致',\n isPhoneNumber: '请输入合法的手机号码',\n isTelNumber: '请输入合法的电话号码',\n isZipcode: '请输入合法的邮编地址',\n isId: '请输入合法的身份证号',\n })[data.type] || ''",
'171f7b825707ddd79175fed3f8def6cd': '修改即提交', '171f7b825707ddd79175fed3f8def6cd': '修改即提交',
'6ccb7091c39a5229f7e77eff4dd44a0e': '设置后,表单中每次有修改都会触发提交', '6ccb7091c39a5229f7e77eff4dd44a0e': '设置后,表单中每次有修改都会触发提交',
'1a006028adf7167ae28cdf532bb75ef4': '校验触发', '1a006028adf7167ae28cdf532bb75ef4': '校验触发',
@ -2839,5 +2779,171 @@ extendLocale('zh-CN', {
'a85ce2404b26140080c929ad9c3ec305': '请输入更多的内容,至少输入 $1 个字符', 'a85ce2404b26140080c929ad9c3ec305': '请输入更多的内容,至少输入 $1 个字符',
'e93275245d529c486018e47136bfae2e': '请检查 Json 格式', 'e93275245d529c486018e47136bfae2e': '请检查 Json 格式',
'2c8c25bb51dfd9ddfc74fd75a8a380a1': '值内容', '2c8c25bb51dfd9ddfc74fd75a8a380a1': '值内容',
'859102d8ced9928cc71bb225961171bf': '请输入Js正则' '859102d8ced9928cc71bb225961171bf': '请输入Js正则',
'544fac400db790f57ea8ee4207cbeb6b': '标准',
'7a377ac3904628fd73e7d33ce6130ae1': '表单校验最少选中的节点数',
'674ddb63a7cd9e14a49813d52cf7e25e': '表单校验最多选中的节点数',
'54d621d5bd588bea4e896de52147a229': '选中的行数据',
'ae76ff4dcb615d3b0232dcd10115e149': '初始化静态数据',
'152b66069787294e53cfc176a189c81f': '图标对应的字段',
'10cfe8897db8c032986138ba7b2f48da': '数据域赋值',
'a6e2cf5b7fa625f571a3e6d0df3a7327': '数据域成员赋值',
'3371427f1b82095309092ef82418ec1a': '您已添加该事件',
'a718dcd3a16bee2a4086244ef1eb0ab4': '请输入长度为 \\$1 的内容',
'c323e3527a805cfdd264700fdf013daf':
'请控制内容长度, 请不要输入 \\$1 个字符以上',
'c762cefa0ff423010af0a943c04d603b': '请输入更多的内容,至少输入 \\$1 个字符',
'b95aed5c6f2c8e49e23b382ac3d593ba': '当前输入值超出最大值 \\$1请检查',
'fd11733fbabaf2ae3cf1fcd3fe385cc5': '当前输入值低于最小值 \\$1请检查',
'acf719549561f28f38bf750a64cda508': '输入的数据与 \\$1 不一致',
'e027500d91d46a962036f63c09492c6c': '输入的数据与 \\$1 值不一致',
'd01886eeef1de19f2e99617017f4def8':
'格式不正确, 请输入符合规则为 \\$1 的内容。',
'f10b676db977ae808af8d96b327be7f3':
'有哪些辅助类 CSS 类名?请前往 <a href="https://baidu.gitee.io/amis/zh-CN/style/index" target="_blank">样式说明</a>,除此之外你可以添加自定义类名,然后在系统配置中添加自定义样式。',
'73ac822ddf4685dbfec661dec41a96b7':
'<div>\n<h2>hello, world!</h2>\n<div id="customBox">自定义容器区域</div>\n</div>',
'e9b91e9101059dc2e234d9847dd7b003': '弹窗数据',
'94397b87ac63fe238c779120fadab024':
'位置为 "左" 或 "右" 时生效。 默认宽度为"尺寸"字段配置的宽度,值单位默认为 px也支持百分比等单位 100%',
'a6d91e801974dfa735a4ae0e098c522a':
'位置为 "上" 或 "下" 时生效。 默认宽度为"尺寸"字段配置的高度,值单位默认为 px也支持百分比等单位 100%',
'197af5d5971778e3b80deb25182d63e3':
'<span class="label label-default">子节点${index | plus}</span>',
'7341e991c8e8cfec68d31ffe0e06e429': '比如: this.type === "text"',
'8add6799ceff24eb041c5a6a92bb1694':
'支持如:<code>\\${xxx}</code>或者<code>data.xxx == "a"</code> 表达式来配置作用条件,当满足该作用条件时,会将计算结果设置到目标变量上。',
'e02d111d524de97e8622121f7ce845cf':
'提交数据前将根据设定格式化数据,请参考 <a href="https://momentjs.com/" target="_blank">moment</a> 中的格式用法。',
'fcb9b16d5d056bfbf6b6cba9dcf61efa':
'请参考 <a href="https://momentjs.com/" target="_blank">moment</a> 中的格式用法。',
'fde1ab2f504097f3f717acbb653b4f09':
'${formType ? asBase64 ? "小文件时可以使用,默认给 Form 提交的是文件下载地址,设置后给 Form 提交文件内容的 base64 格式字符串。" : "File 控件不接管文件上传,直接由表单的保存接口完成。和 Base64 选项二选一。" : ""}',
'17a689143f0c7003123bb3c947d35273': '校验优先级比最大宽度和最大宽度高',
'2aa41edf8cfa79e7e5fcf38c9742b495': '校验优先级比最大高度和最大高度高',
'37ad5d98b12853d786b08cb52b91a43a': '开启后需通过CSS类设置其高度、宽度',
'324d0ccd6fa9d976d2f17de3bf0b70bd': '开启固定尺寸时,根据此值控制展示尺寸',
'd85a80d177db696b29b7338af1501055':
'使用空格分开配置,使用<code>|</code>可将配置栏分组,<a target="_blank" href="https://www.froala.com/wysiwyg-editor/docs/options">参考文档</a>',
'8cfcd52cebdc2555b202f4b03de93662':
'使用空格分开配置,<a target="_blank" href="https://www.tiny.cloud/docs/general-configuration-guide/basic-setup/">参考文档</a>',
'5831c1f77c5acefa6dfe9c64d06ca78a':
'配置"canAccessSuperData": true 同时配置 "strictMode": false 开启此特性,初始会自动映射父级数据域的同名变量。需要注意的是,这里只会初始会映射,一旦修改过就是当前行数据为主了。也就是说,表单项类型的,只会起到初始值的作用',
'24c5febd312d27b5e80354cf03e241f0': '外层容器',
'a269e7de6c7735290733eb3e574c2129':
'请从<a href="http://lbsyun.baidu.com/" target="_blank">百度地图开放平台</a>获取',
'0861915dbac25ccb573b3bb72ffeebd7':
'支持使用 <code>\\${xxx}</code> 来获取变量,或者用 lodash.template 语法来写模板逻辑。<a target="_blank" href="/amis/zh-CN/docs/concepts/template">详情</a>',
'844318bd1d58ba0bf7dabbb771174b12':
'<span class="label label-info">一</span>',
'2fccd71275cdf5d6c0c677ef79dd84a0':
'<span class="label label-success">二</span>',
'198a96c4cfc64d5feba81b3f931f8289':
'<span class="label label-danger">三</span>',
'626a0f2fdf13bcadf11581006ab9eba3':
'<span class="label label-warning">四</span>',
'ce3fd44456123f571e9d083b98da9fcb':
'<span class="label label-primary">五</span>',
'fea0f3f456153564218a9eefb78d8cec':
'当多列的分组名称设置一致时,表格会在显示表头的上层显示超级表头,<a href="https://baidu.github.io/amis/crud/header-group" target="_blank">示例</a>',
'f8fc21a9fd40881e8fd3d7f15919465c':
'如果当前字段有值,请不要设置,否则覆盖。支持使用 <code>\\${xxx}</code> 来获取变量,或者用 lodash.template 语法来写模板逻辑。<a target="_blank" href="/amis/zh-CN/docs/concepts/template">详情</a>',
'2c8a99d35cb5704994cabcc61a4c3a4a':
'查看详情<a target="_blank" href="http://www.baidu.com">日志</a>。',
'bf9e242338d2c26b182aa6b9c015d84c': '如this.type == "123"',
'5414824fb8efdb7d59beae4bf95fdefd':
'<p>当没开启数据映射时,发送数据自动切成白名单模式,配置啥发送啥,请绑定数据。如:<code>{"a": "\\${a}", "b": 2}</code></p><p>如果希望在默认的基础上定制,请先添加一个 Key 为 `&` Value 为 `\\$$` 作为第一行。</p><div>当值为 <code>__undefined</code>时,表示删除对应的字段,可以结合<code>{"&": "\\$$"}</code>来达到黑名单效果。</div>',
'c130bd5b55edefdaf8923269e9a52439':
'每个选项单列一行,将所有值不重复的项加为新的选项;<br/>每行可通过空格来分别设置label和value,例:"张三 zhangsan"',
'1bf14fd24efe68f62bbff0538dee238a':
'每个选项单列一行,将所有值不重复的项加为新的选项;<br/>每行可通过空格来分别设置time和title,例:"2022-06-23 期末补考"',
'0e9525b2bb1493c567c114dd61b69095': '温馨提示:',
'7080fa6e0ca1d7e24f6f8cac05077a3a':
'有哪些辅助类 CSS 类名?请前往 <a href="https://baidu.github.io/amis/docs/concepts/style" target="_blank">样式说明</a>,除此之外你可以添加自定义类名,然后在系统配置中添加自定义样式。',
'f19464cd1d7c55610b84b4972eaf506f':
'<div> 当开启数据映射时,弹框中的数据只会包含设置的部分,请绑定数据。如:{"a": "${a}", "b": 2}。</div>',
'784cf5219012b5f16f2985b7f1fd52f5':
'<div>当值为 __undefined时表示删除对应的字段可以结合{"&": "$$"}来达到黑名单效果。</div>',
'af9f27383daeec508815a33753247f42':
'${data["&"] ? "已开启定制参数功能,可点击关闭该功能。" : "如果需要在默认数据的基础上定制参数请配置开启参数定制再定义key和value。"}',
'ff0d36eac9b9c029d91c365cd2c7e6cf': '${data["&"] ? "立即关闭" : "立即开启"}',
'7237d0dfa065bf451120d06330291b7d':
"({\n isEmail: 'Email 格式不正确',\n isRequired: '这是必填项',\n isUrl: 'Url 格式不正确',\n isInt: '请输入整形数字',\n isAlpha: '请输入字母',\n isNumeric: '请输入数字',\n isAlphanumeric: '请输入字母或者数字',\n isFloat: '请输入浮点型数值',\n isWords: '请输入字母',\n isUrlPath: '只能输入字母、数字、\\`-\\` 和 \\`_\\`.',\n matchRegexp: '格式不正确, 请输入符合规则为 \\`$1\\` 的内容。',\n minLength: '请输入更多的内容,至少输入 $1 个字符。',\n maxLength: '请控制内容长度, 请不要输入 $1 个字符以上',\n maximum: '当前输入值超出最大值 $1请检查',\n minimum: '当前输入值低于最小值 $1请检查',\n isJson: '请检查 Json 格式。',\n isLength: '请输入长度为 $1 的内容',\n notEmptyString: '请不要全输入空白字符',\n equalsField: '输入的数据与 $1 值不一致',\n equals: '输入的数据与 $1 不一致',\n isPhoneNumber: '请输入合法的手机号码',\n isTelNumber: '请输入合法的电话号码',\n isZipcode: '请输入合法的邮编地址',\n isId: '请输入合法的身份证号',\n })[data.type] || ''",
'5e568c42a5ecb74db2dc3d8531079dd6':
'<a target="_blank" href="https://www.tiny.cloud/docs/general-configuration-guide/basic-setup/">参考文档</a>',
'cadf0e302ddbc6fdbf005aed670b5e3e': '代码变化',
'6006074bdabc639b86f42aa18876e33a': '代码变化时触发',
'28e5fd494ea37a09fd2ad36d0f98bacc': '被删除的项',
'046de1a6cb21ff83af74958342c0db64': '被激活的项',
'f6e5fc909971d2e5f6ffe23edae93584':
'如果数据比较多,比较卡顿时,可开启此配置项。',
'31dae237cbd03ae0d2dcf7ad2fd4fb76': '初始化接口请求成功后返回的数据',
'850c62f7b1ebfb4b89182ecd51202a7d':
'表单提交成功后触发,如果事件源是按钮,且按钮的类型为“提交”,那么即便当前表单没有配置“保存接口”也将触发提交成功事件',
'88b2930823f9fd6706473805e9b11797': '保存接口请求成功后返回的数据',
'3e07258baf3c4389c1ffd4a98c20b8fe': '保存接口请求失败后返回的错误信息',
'0d6581b6dd51f6c03a4edf26475d75c6': '被移除的项',
'4ea280a2e54969de1d1b9bbd5b708e63': '点击选项',
'f05520432bb87ced419a1da818c6cc9d': '选项被点击时触发',
'91f7b7fdf9b91073ca3519260f7a62d7': '所点击的选项',
'6afde638796d237377b0755506d08ded': '目标组件',
'fee99f2bcced486e4753a8f58f511d3f': '追加数据',
'3f3f4c71c1b736e7f01cf910a553ff43':
'选择“是”时,会将源组件所在数据域变量同步到目标组件的数据域。<br/>如果目标组件是增删改查组件且增删改查组件的数据拉取接口是get请求则源组件所在数据域变量将追加到目标组件的初始化请求query中。',
'2aecb19ca1655d66fc80fc27a783cc9e': '追加方式',
'b67b01a3b9170f1daf78082cfd0df793':
'选择“合并”时,会将数据合并到目标组件的数据域。<br/>选择“覆盖”时,数据会直接覆盖目标组件的数据域。',
'bd81577a6fd4956e676cec499bb70d00': '合并',
'e09fea40f7e4abd4b2a495b315940688': '覆盖',
'9a5500b6013ec1ebf61bdf0e18452348':
'数据默认为源组件所在数据域,可以选择“自定义”来定制所需数据',
'f30bcdccf71b19e858c37d8881d2b206': '源组件所在数据域',
'fa644cb20c66f7530d8a376d4fa6a36e': '组件数据',
'7d9260bd45b2e85a09398f218c25f220':
'更新目标组件的数据域或目标表单项的数据值',
'e7af71fb102cc86ab3be6a2fb32b5e3f': '数据设置',
'77b1081c177fa3334cc93c99f0ecee75': '直接赋值',
'f5c5e3d69daee06ea1606378ef466765': '成员赋值',
'697af73997072e0ce9ee65b15a7b3715': '重置页码',
'd7bf42dd6e66f2818f9a232603c4a53b': '选择“是”时,将重新请求第一页数据。',
'3e573fd37473d789211ee44335d82fad': '静态 CSS 类名',
'905407c57ccd033cb6bd64bfad20a8c7': '静态展示时 的 CSS 类名',
'0d1f68afa19f3f3dd88e28d17c98ddf9': '表格2',
'e052287273ad39a1d3fa9fa3decb5fd9': '组件展示态',
'506f28f48dbebd5d19e19dfc721e13be': '控制所选的组件的输入态/静态',
'0e35b091e18032508758899735664df7': '组件切换为静态',
'34d361256526b04909e064c29d9a9b76': '组件切换为输入态',
'd2e930293da37452638759e17d771adf': '组件状态',
'b535bea11c97ec5588b1494799de4d60': '表单输入',
'f7784642f42d33f506ba05f3daefc3c4': '表单静态',
'a8797a840f3c0bbb5297aada95f9b13a': '表单项静态',
'7bb3e24cc54f4b8ee0a65d14fa4c067c': '激活指定选项卡',
'fd951a59a7c635d5330bc1aeec22c813': '自定义数据',
'b62ce3df3c0d5772006c525b60d5eeab':
'数据默认为源组件所在数据域,开启“自定义”可以定制所需数据',
'0f9803bd27434940d4017007c105a861':
'当选择“是”且目标组件是增删改查组件时数据接口请求时将带上这些数据其他类型的目标组件只有在数据接口是post请求时才会带上这些数据。',
'81e1ff0bb8917a9df99d737982ee24b7':
'SubForm, 配置一个子 form 作为当前的表单项',
'a5c2dba5ccf62851b24cfa12d4958ce2':
'可以用来展现数据的,可以用来展示数组类型的数据,比如 multiple 的子 form',
'74104c62ed33836f0bc74297539dd7c9': '配置 options 可以实现选择选项',
'b5ade3d97d5b11bc784786111e011571':
'树型结构来选择,可通过 options 来配置选项,也可通过 source 拉取选项',
'2c05e451a6f2b2fe1cf55f7afb8c8423':
'单选或者多选,支持 source 拉取选项,选项可配置图片,也可以自定义 HTML 配置',
'c65c9862813c7a66c0df52e301e0e1d1':
'适用于选项中含有子项,可通过 source 拉取选项,支持多选',
'8f650b58c8421edecfb380d6f60ef40e':
'通过 pickerSchema 配置可供选取的数据源进行选择需要的数据,支持多选',
'b7a4abc1e4e975c9df5bb9d9cf4823ba':
'通过 options 配置选项,可通过 source 拉取选项',
'f2fc416c7d95a93a8da621f760be8417':
'支持多选,输入提示,可使用 source 获取选项',
'b4482a3d9523f48e83a816fa85911185':
'纯用来展示数据,可用来展示 json、date、image、progress 等数据',
'ecfd82eb65102274188011a502913d3a': '抽屉数据',
'951f802ebd0c0d795fbae6767a5ee9b3': '初始化接口请求成功',
'da0126992b4937a5fd847ef5366b02e6': '初始化接口请求成功返回的数据',
'70b8342d743374233bfee0f56c7f0fc7': '节点示例数据'
}); });

View File

@ -54,7 +54,7 @@ export class AvatarPlugin extends BasePlugin {
getSchemaTpl('collapseGroup', [ getSchemaTpl('collapseGroup', [
{ {
className: 'p-none', className: 'p-none',
title: '常用', title: '基本',
body: [ body: [
// 如果同时存在 src、text 和 icon会优先用 src、接着 text、最后 icon // 如果同时存在 src、text 和 icon会优先用 src、接着 text、最后 icon
{ {
@ -96,13 +96,11 @@ export class AvatarPlugin extends BasePlugin {
className: 'ae-ExtendMore mb-3', className: 'ae-ExtendMore mb-3',
body: [ body: [
// 图标 // 图标
{ getSchemaTpl('icon', {
label: '图标',
name: 'icon', name: 'icon',
type: 'icon-picker', label: '图标',
className: 'fix-icon-picker-overflow',
visibleOn: 'data.showtype === "icon"' visibleOn: 'data.showtype === "icon"'
}, }),
// 图片 // 图片
getSchemaTpl('valueFormula', { getSchemaTpl('valueFormula', {
rendererSchema: { rendererSchema: {

View File

@ -73,12 +73,10 @@ export class BreadcrumbPlugin extends BasePlugin {
name: 'href', name: 'href',
placeholder: '链接' placeholder: '链接'
}, },
{ getSchemaTpl('icon', {
name: 'icon', name: 'icon',
label: '图标', label: '图标'
type: 'icon-picker', })
className: 'fix-icon-picker-overflow'
}
] ]
} }
] ]

View File

@ -1,81 +0,0 @@
import {BasePlugin} from 'amis-editor-core';
import {getSchemaTpl} from 'amis-editor-core';
export class ButtonToolbarPlugin extends BasePlugin {
// 关联渲染器名字
rendererName = 'button-toolbar';
$schema = '/schemas/ButtonToolbarSchema.json';
// 组件名称
name = '按钮工具栏';
isBaseComponent = true;
description = '可以用来放置多个按钮或者按钮组,按钮之间会存在一定的间隔';
tags = ['按钮'];
icon = 'fa fa-ellipsis-h';
pluginIcon = 'btn-toolbar-plugin';
/**
* ButtonGroup合并
*/
disabledRendererPlugin = true;
scaffold = {
type: 'button-toolbar',
buttons: [
{
type: 'button',
label: '按钮1'
},
{
type: 'button',
label: '按钮2'
}
]
};
previewSchema = {
...this.scaffold
};
panelTitle = '按钮工具栏';
panelBody = [
getSchemaTpl('tabs', [
{
title: '常规',
body: [
{
name: 'buttons',
type: 'combo',
label: '按钮管理',
multiple: true,
addable: true,
draggable: true,
draggableTip: '可排序、可移除、如要编辑请在预览区选中编辑',
editable: false,
visibleOn: 'this.buttons && this.buttons.length',
items: [
{
type: 'tpl',
inline: false,
className: 'p-t-xs',
tpl: `<span class="label label-default"><% if (data.type === "button-group") { %> ${'按钮组'} <% } else { %><%= data.label %><% if (data.icon) { %><i class="<%= data.icon %>"/><% }%><% } %></span>`
}
],
addButtonText: '新增按钮',
scaffold: {
type: 'button',
label: '按钮'
}
}
]
},
{
title: '外观',
body: [getSchemaTpl('className')]
},
{
title: '显隐',
body: [getSchemaTpl('ref'), getSchemaTpl('visible')]
}
])
];
}
// 和plugin/Form/ButtonToolbar.tsx的重复了
// registerEditorPlugin(ButtonToolbarPlugin);

View File

@ -242,7 +242,7 @@ export class CRUDPlugin extends BasePlugin {
}); });
} else { } else {
toast.warning( toast.warning(
`API返回格式不正确请点击接口地址右侧示例的问号查看示例` 'API返回格式不正确请点击接口地址右侧示例的问号查看示例'
); );
} }
} }
@ -527,6 +527,7 @@ export class CRUDPlugin extends BasePlugin {
getSchemaTpl('switch', { getSchemaTpl('switch', {
name: 'filter', name: 'filter',
label: '启用查询条件', label: '启用查询条件',
visibleOn: 'data.api && data.api.url',
pipeIn: (value: any) => !!value, pipeIn: (value: any) => !!value,
pipeOut: (value: any, originValue: any) => { pipeOut: (value: any, originValue: any) => {
if (value) { if (value) {
@ -552,10 +553,11 @@ export class CRUDPlugin extends BasePlugin {
}), }),
{ {
type: 'divider' type: 'divider',
visibleOn: 'data.api && data.api.url'
}, },
{ getSchemaTpl('combo-container', {
label: '批量操作', label: '批量操作',
name: 'bulkActions', name: 'bulkActions',
type: 'combo', type: 'combo',
@ -597,7 +599,7 @@ export class CRUDPlugin extends BasePlugin {
) )
} }
] ]
}, }),
// getSchemaTpl('switch', { // getSchemaTpl('switch', {
// name: 'defaultChecked', // name: 'defaultChecked',
@ -610,7 +612,7 @@ export class CRUDPlugin extends BasePlugin {
type: 'divider' type: 'divider'
}, },
{ getSchemaTpl('combo-container', {
label: '单条操作', label: '单条操作',
name: 'itemActions', name: 'itemActions',
type: 'combo', type: 'combo',
@ -658,7 +660,7 @@ export class CRUDPlugin extends BasePlugin {
) )
} }
] ]
}, }),
{ {
type: 'divider', type: 'divider',
@ -679,7 +681,7 @@ export class CRUDPlugin extends BasePlugin {
} }
}), }),
{ getSchemaTpl('combo-container', {
label: '默认参数', label: '默认参数',
type: 'input-kv', type: 'input-kv',
name: 'defaultParams', name: 'defaultParams',
@ -690,7 +692,7 @@ export class CRUDPlugin extends BasePlugin {
content: '可以用来设置默认参数,比如 <code>perPage:20</code>', content: '可以用来设置默认参数,比如 <code>perPage:20</code>',
placement: 'left' placement: 'left'
} }
}, }),
{ {
type: 'divider' type: 'divider'
@ -1090,7 +1092,7 @@ export class CRUDPlugin extends BasePlugin {
] ]
}, },
{ getSchemaTpl('combo-container', {
name: 'headerToolbar', name: 'headerToolbar',
type: 'combo', type: 'combo',
draggable: true, draggable: true,
@ -1264,9 +1266,9 @@ export class CRUDPlugin extends BasePlugin {
// className: 'm-l-none' // className: 'm-l-none'
// } // }
] ]
}, }),
{ getSchemaTpl('combo-container', {
name: 'footerToolbar', name: 'footerToolbar',
type: 'combo', type: 'combo',
draggable: true, draggable: true,
@ -1442,7 +1444,7 @@ export class CRUDPlugin extends BasePlugin {
className: 'm-l-none' className: 'm-l-none'
} }
] ]
}, }),
getSchemaTpl('switch', { getSchemaTpl('switch', {
name: 'filterTogglable', name: 'filterTogglable',

View File

@ -527,7 +527,7 @@ export class CRUDPlugin extends BasePlugin {
return; return;
} }
// 可能会出错但是cards table-v2 list 配置面板结构统一,因此 // 可能会出错但是cards table2 list 配置面板结构统一,因此
(context.data as any).tabs.forEach((tab: any) => { (context.data as any).tabs.forEach((tab: any) => {
if (tab.title === '属性') { if (tab.title === '属性') {
tab.body[0].body.forEach((collapse: any) => { tab.body[0].body.forEach((collapse: any) => {
@ -610,7 +610,7 @@ export class CRUDPlugin extends BasePlugin {
}); });
// 只有表格才能找到操作列放这个内容,卡片和列表不知道位置 // 只有表格才能找到操作列放这个内容,卡片和列表不知道位置
if (context.schema.mode === 'table-v2') { if (context.schema.mode === 'table2') {
DataOperators.forEach(op => { DataOperators.forEach(op => {
if (!builder.features.includes(op.value)) { if (!builder.features.includes(op.value)) {
return; return;
@ -681,7 +681,7 @@ export class CRUDPlugin extends BasePlugin {
} }
const existCols = const existCols =
node!.children.find(child => child.type === 'table-v2')?.children[0] node!.children.find(child => child.type === 'table2')?.children[0]
?.children || []; ?.children || [];
const hasOperatorCol = node!.schema.columns?.some( const hasOperatorCol = node!.schema.columns?.some(
(col: any) => col.type === 'operation' (col: any) => col.type === 'operation'
@ -707,7 +707,7 @@ export class CRUDPlugin extends BasePlugin {
); );
if (appendCols?.length) { if (appendCols?.length) {
appendCols.forEach((col: any) => { appendCols.forEach((col: any) => {
if (existColsName.includes(col.key)) { if (existColsName.includes(col.name)) {
return; return;
} }
@ -741,7 +741,7 @@ export class CRUDPlugin extends BasePlugin {
// context.node. // context.node.
// // 只有表格才能找到操作列放这个内容,卡片和列表不知道位置 // // 只有表格才能找到操作列放这个内容,卡片和列表不知道位置
// if (context.schema.mode === 'table-v2') { // if (context.schema.mode === 'table2') {
// DataOperators.forEach(op => { // DataOperators.forEach(op => {
// if (!builder.features.includes(op.value)) { // if (!builder.features.includes(op.value)) {
// return; // return;
@ -760,7 +760,6 @@ export class CRUDPlugin extends BasePlugin {
// }); // });
// }); // });
// } // }
return columns; return columns;
} }
@ -1342,7 +1341,7 @@ export class CRUDPlugin extends BasePlugin {
// actionType: 'resetQuery', // actionType: 'resetQuery',
// actionLabel: '重置查询', // actionLabel: '重置查询',
// description: '重新恢复查询条件为初始值', // description: '重新恢复查询条件为初始值',
// desc: (info: any) => { // descDetail: (info: any) => {
// return ( // return (
// <div> // <div>
// <span className="variable-right">{info?.__rendererLabel}</span> // <span className="variable-right">{info?.__rendererLabel}</span>
@ -1383,14 +1382,14 @@ export class CRUDPlugin extends BasePlugin {
columns: [ columns: [
{ {
title: 'A', title: 'A',
key: 'a' name: 'a'
}, },
{ {
title: 'B', title: 'B',
key: 'b' name: 'b'
}, },
{ {
key: 'operation', name: 'operation',
title: '操作', title: '操作',
buttons: [ buttons: [
{ {
@ -1422,7 +1421,7 @@ export class CRUDPlugin extends BasePlugin {
async buildDataSchemas(node: EditorNodeType, region?: EditorNodeType) { async buildDataSchemas(node: EditorNodeType, region?: EditorNodeType) {
const child: EditorNodeType = node.children.find( const child: EditorNodeType = node.children.find(
item => !!~['table-v2', 'cards', 'list'].indexOf(item.type) item => !!~['table2', 'cards', 'list'].indexOf(item.type)
); );
let items; let items;
@ -1531,10 +1530,10 @@ export class TableCRUDPlugin extends CRUDPlugin {
scaffold: any = { scaffold: any = {
type: 'crud2', type: 'crud2',
mode: 'table-v2', mode: 'table2',
columns: [ columns: [
{ {
key: 'id', name: 'id',
title: 'ID', title: 'ID',
type: 'container', type: 'container',
body: [ body: [
@ -1544,7 +1543,7 @@ export class TableCRUDPlugin extends CRUDPlugin {
] ]
}, },
{ {
key: 'engine', name: 'engine',
title: '示例', title: '示例',
type: 'container', type: 'container',
body: [ body: [

View File

@ -16,6 +16,7 @@ export class Card2Plugin extends BasePlugin {
// 组件名称 // 组件名称
name = '卡片'; name = '卡片';
isBaseComponent = true; isBaseComponent = true;
disabledRendererPlugin = true;
description = '展示单个卡片。'; description = '展示单个卡片。';
tags = ['展示']; tags = ['展示'];
icon = ''; icon = '';

View File

@ -96,18 +96,16 @@ export class CollapseGroupPlugin extends BasePlugin {
autoFocus: false, autoFocus: false,
form: { form: {
body: [ body: [
{ getSchemaTpl('icon', {
label: '图标',
name: 'expandIcon', name: 'expandIcon',
type: 'icon-picker', label: '图标',
className: 'fix-icon-picker-overflow',
pipeIn: (value: any) => value?.icon, pipeIn: (value: any) => value?.icon,
pipeOut: (value: any) => ({ pipeOut: (value: any) => ({
type: 'icon', type: 'icon',
vendor: '', vendor: '',
icon: value icon: value
}) })
} })
] ]
}, },
pipeIn: (value: string) => { pipeIn: (value: string) => {

View File

@ -56,12 +56,34 @@ export class DialogPlugin extends BasePlugin {
{ {
eventName: 'confirm', eventName: 'confirm',
eventLabel: '确认', eventLabel: '确认',
description: '点击弹窗确认按钮时触发' description: '点击弹窗确认按钮时触发',
dataSchema: [
{
type: 'object',
properties: {
'event.data': {
type: 'object',
title: '弹窗数据'
}
}
}
]
}, },
{ {
eventName: 'cancel', eventName: 'cancel',
eventLabel: '取消', eventLabel: '取消',
description: '点击弹窗取消按钮时触发' description: '点击弹窗取消按钮时触发',
dataSchema: [
{
type: 'object',
properties: {
'event.data': {
type: 'object',
title: '弹窗数据'
}
}
}
]
} }
]; ];

View File

@ -57,12 +57,34 @@ export class DrawerPlugin extends BasePlugin {
{ {
eventName: 'confirm', eventName: 'confirm',
eventLabel: '确认', eventLabel: '确认',
description: '点击抽屉确认按钮时触发' description: '点击抽屉确认按钮时触发',
dataSchema: [
{
type: 'object',
properties: {
'event.data': {
type: 'object',
title: '抽屉数据'
}
}
}
]
}, },
{ {
eventName: 'cancel', eventName: 'cancel',
eventLabel: '取消', eventLabel: '取消',
description: '点击抽屉取消按钮时触发' description: '点击抽屉取消按钮时触发',
dataSchema: [
{
type: 'object',
properties: {
'event.data': {
type: 'object',
title: '抽屉数据'
}
}
}
]
} }
]; ];
@ -123,7 +145,19 @@ export class DrawerPlugin extends BasePlugin {
} }
], ],
pipeIn: defaultValue('right'), pipeIn: defaultValue('right'),
pipeOut: (value: any) => (value ? value : 'right') pipeOut: (value: any) => (value ? value : 'right'),
onChange: (
value: string,
oldValue: string,
model: any,
form: any
) => {
if (value === 'left' || value === 'right') {
form.deleteValueByName('height');
} else if (value === 'top' || value === 'bottom') {
form.deleteValueByName('width');
}
}
}, },
getSchemaTpl('switch', { getSchemaTpl('switch', {
name: 'overlay', name: 'overlay',

View File

@ -25,7 +25,8 @@ export class ButtonGroupControlPlugin extends BasePlugin {
tags = ['按钮']; tags = ['按钮'];
scaffold = { scaffold = {
type: 'button-group-select', type: 'button-group-select',
name: 'a', name: 'buttonGroupSelect',
label: '按钮点选',
inline: false, inline: false,
options: [ options: [
{ {

View File

@ -89,7 +89,7 @@ export class ButtonToolbarControlPlugin extends BasePlugin {
type: 'tpl', type: 'tpl',
inline: false, inline: false,
className: 'p-t-xs', className: 'p-t-xs',
tpl: '<span class="label label-default"><% if (data.type === "button-group") { %> 按钮组 <% } else { %><%= data.label %><% if (data.icon) { %><i class="<%= data.icon %>"/><% }%><% } %></span>' tpl: `<span class="label label-default"><% if (data.type === "button-group") { %> ${'按钮组'} <% } else { %><%= data.label %><% if (data.icon) { %><i class="<%= data.icon %>"/><% }%><% } %></span>`
} }
], ],
addButtonText: '新增按钮', addButtonText: '新增按钮',
@ -121,6 +121,7 @@ export class ButtonToolbarControlPlugin extends BasePlugin {
}, },
getSchemaTpl('style:classNames', { getSchemaTpl('style:classNames', {
isFormItem: true, isFormItem: true,
unsupportStatic: true,
schema: [ schema: [
getSchemaTpl('className', { getSchemaTpl('className', {
label: '描述', label: '描述',

View File

@ -143,6 +143,7 @@ export class ChainedSelectControlPlugin extends BasePlugin {
body: [ body: [
getSchemaTpl('apiControl', { getSchemaTpl('apiControl', {
name: 'source', name: 'source',
mode: 'normal',
label: tipedLabel( label: tipedLabel(
'获取选项接口', '获取选项接口',
`<div>可用变量说明</div><ul> `<div>可用变量说明</div><ul>

View File

@ -42,6 +42,22 @@ export class CodeEditorControlPlugin extends BasePlugin {
}; };
events: RendererPluginEvent[] = [ events: RendererPluginEvent[] = [
{
eventName: 'change',
eventLabel: '代码变化',
description: '代码变化时触发',
dataSchema: [
{
type: 'object',
properties: {
'event.data.value': {
type: 'string',
title: '当前代码'
}
}
}
]
},
{ {
eventName: 'focus', eventName: 'focus',
eventLabel: '获取焦点', eventLabel: '获取焦点',
@ -143,7 +159,10 @@ export class CodeEditorControlPlugin extends BasePlugin {
getSchemaTpl('autoFillApi') getSchemaTpl('autoFillApi')
] ]
}, },
getSchemaTpl('status', {isFormItem: true}), getSchemaTpl('status', {
isFormItem: true,
unsupportStatic: true
}),
getSchemaTpl('validation', { getSchemaTpl('validation', {
tag: ValidatorTag.Code tag: ValidatorTag.Code
}) })
@ -190,7 +209,9 @@ export class CodeEditorControlPlugin extends BasePlugin {
} }
] ]
}), }),
getSchemaTpl('style:classNames') getSchemaTpl('style:classNames', {
unsupportStatic: true
})
]) ])
}, },
{ {

View File

@ -15,10 +15,7 @@ import React from 'react';
import {diff, JSONPipeIn} from 'amis-editor-core'; import {diff, JSONPipeIn} from 'amis-editor-core';
import {JSONPipeOut} from 'amis-editor-core'; import {JSONPipeOut} from 'amis-editor-core';
import {mockValue} from 'amis-editor-core'; import {mockValue} from 'amis-editor-core';
import { import {RendererPluginEvent, RendererPluginAction} from 'amis-editor-core';
RendererPluginEvent,
RendererPluginAction
} from 'amis-editor-core';
import {setVariable} from 'amis-core'; import {setVariable} from 'amis-core';
export class ComboControlPlugin extends BasePlugin { export class ComboControlPlugin extends BasePlugin {
@ -109,6 +106,10 @@ export class ComboControlPlugin extends BasePlugin {
'event.data.value': { 'event.data.value': {
type: 'string', type: 'string',
title: '现有组合项的值' title: '现有组合项的值'
},
'event.data.item': {
type: 'object',
title: '被删除的项'
} }
} }
} }
@ -125,6 +126,14 @@ export class ComboControlPlugin extends BasePlugin {
'event.data.key': { 'event.data.key': {
type: 'string', type: 'string',
title: '选项卡索引' title: '选项卡索引'
},
'event.data.value': {
type: 'string',
title: '现有组合项的值'
},
'event.data.item': {
type: 'object',
title: '被激活的项'
} }
} }
} }
@ -490,14 +499,26 @@ export class ComboControlPlugin extends BasePlugin {
name: 'lazyLoad', name: 'lazyLoad',
label: '懒加载', label: '懒加载',
pipeIn: defaultValue(false), pipeIn: defaultValue(false),
description: '如果数据比较多,比较卡顿时,可开启此配置项' labelRemark: {
className: 'm-l-xs',
trigger: 'click',
rootClose: true,
placement: 'left',
content: '如果数据比较多,比较卡顿时,可开启此配置项。'
}
}), }),
getSchemaTpl('switch', { getSchemaTpl('switch', {
name: 'strictMode', name: 'strictMode',
label: '严格模式', label: '严格模式',
pipeIn: defaultValue(true), pipeIn: defaultValue(true),
description: '如果你希望环境变量的值实时透传到 Combo 中,请关闭此选项。' labelRemark: {
className: 'm-l-xs',
trigger: 'click',
rootClose: true,
placement: 'left',
content: '如果你希望环境变量的值实时透传到 Combo 中,请关闭此选项。'
}
}), }),
{ {
@ -515,8 +536,14 @@ export class ComboControlPlugin extends BasePlugin {
name: 'nullable', name: 'nullable',
label: '允许为空', label: '允许为空',
pipeIn: defaultValue(false), pipeIn: defaultValue(false),
description: labelRemark: {
'如果子表单项里面配置验证器,且又是单条模式。可以允许用户选择清空(不填)。' className: 'm-l-xs',
trigger: 'click',
rootClose: true,
placement: 'left',
content:
'如果子表单项里面配置验证器,且又是单条模式。可以允许用户选择清空(不填)。'
}
}), }),
{ {

View File

@ -15,7 +15,7 @@ export class ControlPlugin extends BasePlugin {
isBaseComponent = true; isBaseComponent = true;
icon = 'fa fa-object-group'; icon = 'fa fa-object-group';
pluginIcon = 'form-group-plugin'; pluginIcon = 'form-group-plugin';
description = `表单项容器`; description = '表单项容器';
docLink = '/amis/zh-CN/components/form/group'; docLink = '/amis/zh-CN/components/form/group';
tags = ['容器']; tags = ['容器'];
/** /**

View File

@ -48,6 +48,22 @@ export class DiffEditorControlPlugin extends BasePlugin {
}; };
events: RendererPluginEvent[] = [ events: RendererPluginEvent[] = [
{
eventName: 'change',
eventLabel: '代码变化',
description: '代码变化时触发',
dataSchema: [
{
type: 'object',
properties: {
'event.data.value': {
type: 'string',
title: '当前代码'
}
}
}
]
},
{ {
eventName: 'focus', eventName: 'focus',
eventLabel: '获取焦点', eventLabel: '获取焦点',
@ -155,7 +171,10 @@ export class DiffEditorControlPlugin extends BasePlugin {
getSchemaTpl('autoFillApi') getSchemaTpl('autoFillApi')
] ]
}, },
getSchemaTpl('status', {isFormItem: true}), getSchemaTpl('status', {
isFormItem: true,
unsupportStatic: true
}),
getSchemaTpl('validation', { getSchemaTpl('validation', {
tag: ValidatorTag.All tag: ValidatorTag.All
}) })
@ -202,7 +221,9 @@ export class DiffEditorControlPlugin extends BasePlugin {
} }
] ]
}), }),
getSchemaTpl('style:classNames') getSchemaTpl('style:classNames', {
unsupportStatic: true
})
]) ])
}, },
{ {

View File

@ -13,7 +13,7 @@ export class FieldSetControlPlugin extends BasePlugin {
name = '字段集'; name = '字段集';
isBaseComponent = true; isBaseComponent = true;
icon = 'fa fa-toggle-down'; icon = 'fa fa-toggle-down';
description = `多个表单项的组合,可配置是否折叠`; description = '多个表单项的组合,可配置是否折叠';
docLink = '/amis/zh-CN/components/form/fieldset'; docLink = '/amis/zh-CN/components/form/fieldset';
tags = ['表单项']; tags = ['表单项'];
scaffold = { scaffold = {

View File

@ -214,7 +214,7 @@ export class FormPlugin extends BasePlugin {
events: RendererPluginEvent[] = [ events: RendererPluginEvent[] = [
{ {
eventName: 'inited', eventName: 'inited',
eventLabel: '初始化完成', eventLabel: '初始化接口请求成功',
description: '远程初始化接口请求成功时触发', description: '远程初始化接口请求成功时触发',
// 表单数据为表单变量 // 表单数据为表单变量
dataSchema: [ dataSchema: [
@ -223,7 +223,7 @@ export class FormPlugin extends BasePlugin {
properties: { properties: {
'event.data': { 'event.data': {
type: 'object', type: 'object',
title: 'initApi 远程请求返回的初始化数据' title: '初始化接口请求成功返回的数据'
} }
} }
} }
@ -309,17 +309,34 @@ export class FormPlugin extends BasePlugin {
} }
] ]
}, },
// {
// eventName: 'submit',
// eventLabel: '表单提交',
// strongDesc: '配置该事件后将不会触发表单提交时默认的校验、提交到api或者target等行为所有行为需要自己配置',
// dataSchema: [
// {
// type: 'object',
// properties: {
// 'event.data': {
// type: 'object',
// title: '当前表单数据'
// }
// }
// }
// ]
// },
{ {
eventName: 'submitSucc', eventName: 'submitSucc',
eventLabel: '提交成功', eventLabel: '提交成功',
description: '表单提交请求成功后触发', description:
'表单提交成功后触发,如果事件源是按钮,且按钮的类型为“提交”,那么即便当前表单没有配置“保存接口”也将触发提交成功事件',
dataSchema: [ dataSchema: [
{ {
type: 'object', type: 'object',
properties: { properties: {
'event.data.result': { 'event.data.result': {
type: 'object', type: 'object',
title: '提交成功后返回的数据' title: '保存接口请求成功后返回的数据'
} }
} }
} }
@ -335,7 +352,7 @@ export class FormPlugin extends BasePlugin {
properties: { properties: {
'event.data.error': { 'event.data.error': {
type: 'object', type: 'object',
title: '提交失败后返回的错误信息' title: '保存接口请求失败后返回的错误信息'
} }
} }
} }
@ -794,6 +811,11 @@ export class FormPlugin extends BasePlugin {
getSchemaTpl('className'), getSchemaTpl('className'),
getSchemaTpl('className', {
name: 'staticClassName',
label: '静态展示时 的 CSS 类名'
}),
getSchemaTpl('className', { getSchemaTpl('className', {
name: 'panelClassName', name: 'panelClassName',
visibleOn: 'this.wrapWithPanel !== false', visibleOn: 'this.wrapWithPanel !== false',
@ -828,7 +850,8 @@ export class FormPlugin extends BasePlugin {
}), }),
getSchemaTpl('disabled'), getSchemaTpl('disabled'),
getSchemaTpl('visible') getSchemaTpl('visible'),
getSchemaTpl('static')
] ]
} }
]) ])

View File

@ -12,7 +12,7 @@ export class FormulaControlPlugin extends BasePlugin {
isBaseComponent = true; isBaseComponent = true;
icon = 'fa fa-calculator'; icon = 'fa fa-calculator';
pluginIcon = 'formula-plugin'; pluginIcon = 'formula-plugin';
description = `通过公式计算指定的变量值,并将其结果作用到指定的变量中`; description = '通过公式计算指定的变量值,并将其结果作用到指定的变量中';
docLink = '/amis/zh-CN/components/form/formula'; docLink = '/amis/zh-CN/components/form/formula';
tags = ['表单项']; tags = ['表单项'];
scaffold = { scaffold = {

View File

@ -12,7 +12,7 @@ export class HiddenControlPlugin extends BasePlugin {
isBaseComponent = true; isBaseComponent = true;
icon = 'fa fa-eye-slash'; icon = 'fa fa-eye-slash';
pluginIcon = 'hidden-plugin'; pluginIcon = 'hidden-plugin';
description = `隐藏表单项`; description = '隐藏表单项';
docLink = '/amis/zh-CN/components/form/hidden'; docLink = '/amis/zh-CN/components/form/hidden';
tags = ['表单项']; tags = ['表单项'];
scaffold = { scaffold = {

View File

@ -10,6 +10,8 @@ import {
import {formItemControl} from '../../component/BaseControl'; import {formItemControl} from '../../component/BaseControl';
import {RendererPluginAction, RendererPluginEvent} from 'amis-editor-core'; import {RendererPluginAction, RendererPluginEvent} from 'amis-editor-core';
import {ValidatorTag} from '../../validator';
import {getEventControlConfig} from '../../renderer/event-control/helper';
export class CityControlPlugin extends BasePlugin { export class CityControlPlugin extends BasePlugin {
// 关联渲染器名字 // 关联渲染器名字
@ -84,66 +86,67 @@ export class CityControlPlugin extends BasePlugin {
} }
]; ];
panelJustify = true;
panelBodyCreator = (context: BaseEventContext) => { panelBodyCreator = (context: BaseEventContext) => {
return formItemControl( return getSchemaTpl('tabs', [
{ {
common: { title: '属性',
replace: true, body: getSchemaTpl('collapseGroup', [
body: [ {
getSchemaTpl('formItemName', { title: '基本',
required: true body: [
}), getSchemaTpl('formItemName', {
getSchemaTpl('label'), required: true
// getSchemaTpl('switchDefaultValue'), }),
getSchemaTpl('label'),
getSchemaTpl('valueFormula', {
rendererSchema: context?.schema,
rendererWrapper: true,
mode: 'vertical' // 改成上下展示模式
}),
getSchemaTpl('switch', {
name: 'allowDistrict',
label: '允许选择区域',
pipeIn: defaultValue(true)
}),
/* getSchemaTpl('switch', {
{ name: 'allowCity',
name: 'value', label: '允许选择城市',
type: 'input-city', pipeIn: defaultValue(true)
label: '默认值', }),
visibleOn: 'typeof data.value !== "undefined"',
validations: 'isNumeric',
labelRemark: {
trigger: 'click',
className: 'm-l-xs',
rootClose: true,
content: '城市编码',
placement: 'left'
}
},
*/
getSchemaTpl('valueFormula', { getSchemaTpl('switch', {
rendererSchema: context?.schema, name: 'searchable',
rendererWrapper: true, label: '是否出搜索框',
mode: 'vertical' // 改成上下展示模式 pipeIn: defaultValue(false)
}), })
]
getSchemaTpl('switch', { },
name: 'allowDistrict', getSchemaTpl('status', {isFormItem: true}),
label: '允许选择区域', getSchemaTpl('validation', {tag: ValidatorTag.MultiSelect})
pipeIn: defaultValue(true) ])
}),
getSchemaTpl('switch', {
name: 'allowCity',
label: '允许选择城市',
pipeIn: defaultValue(true)
}),
getSchemaTpl('switch', {
name: 'searchable',
label: '是否出搜索框',
pipeIn: defaultValue(false)
}),
getSchemaTpl('extractValue')
]
},
status: {}
}, },
context {
); title: '外观',
body: [
getSchemaTpl('collapseGroup', [
getSchemaTpl('style:formItem', {renderer: context.info.renderer}),
getSchemaTpl('style:classNames')
])
]
},
{
title: '事件',
className: 'p-none',
body: [
getSchemaTpl('eventControl', {
name: 'onEvent',
...getEventControlConfig(this.manager, context)
})
]
}
]);
}; };
} }

View File

@ -198,12 +198,34 @@ export class DateControlPlugin extends BasePlugin {
{ {
eventName: 'focus', eventName: 'focus',
eventLabel: '获取焦点', eventLabel: '获取焦点',
description: '输入框获取焦点(非内嵌模式)时触发' description: '输入框获取焦点(非内嵌模式)时触发',
dataSchema: [
{
type: 'object',
properties: {
'event.data.value': {
type: 'string',
title: '时间值'
}
}
}
]
}, },
{ {
eventName: 'blur', eventName: 'blur',
eventLabel: '失去焦点', eventLabel: '失去焦点',
description: '输入框失去焦点(非内嵌模式)时触发' description: '输入框失去焦点(非内嵌模式)时触发',
dataSchema: [
{
type: 'object',
properties: {
'event.data.value': {
type: 'string',
title: '时间值'
}
}
}
]
} }
]; ];

View File

@ -15,12 +15,15 @@ export class FileControlPlugin extends BasePlugin {
isBaseComponent = true; isBaseComponent = true;
icon = 'fa fa-upload'; icon = 'fa fa-upload';
pluginIcon = 'input-file-plugin'; pluginIcon = 'input-file-plugin';
description = `可上传多个文件,可配置是否自动上传以及大文件分片上传`; description = '可上传多个文件,可配置是否自动上传以及大文件分片上传';
docLink = '/amis/zh-CN/components/form/input-file'; docLink = '/amis/zh-CN/components/form/input-file';
tags = ['表单项']; tags = ['表单项'];
scaffold = { scaffold = {
type: 'input-file', type: 'input-file',
label: '文件上传', label: '文件上传',
autoUpload: true,
proxy: true,
uploadType: 'fileReceptor',
name: 'file', name: 'file',
receiver: { receiver: {
url: 'object-upload://default', url: 'object-upload://default',
@ -51,7 +54,7 @@ export class FileControlPlugin extends BasePlugin {
{ {
type: 'object', type: 'object',
properties: { properties: {
'event.data.value': { 'event.data.file': {
type: 'object', type: 'object',
title: '上传的文件' title: '上传的文件'
} }
@ -67,7 +70,7 @@ export class FileControlPlugin extends BasePlugin {
{ {
type: 'object', type: 'object',
properties: { properties: {
'event.data.value': { 'event.data.item': {
type: 'object', type: 'object',
title: '被移除的文件' title: '被移除的文件'
} }
@ -83,7 +86,7 @@ export class FileControlPlugin extends BasePlugin {
{ {
type: 'object', type: 'object',
properties: { properties: {
'event.data.value': { 'event.data.item': {
type: 'object', type: 'object',
title: '远程上传请求成功后返回的结果数据' title: '远程上传请求成功后返回的结果数据'
} }
@ -99,7 +102,7 @@ export class FileControlPlugin extends BasePlugin {
{ {
type: 'object', type: 'object',
properties: { properties: {
'event.data.file': { 'event.data.item': {
type: 'object', type: 'object',
title: '上传的文件' title: '上传的文件'
}, },
@ -240,7 +243,7 @@ export class FileControlPlugin extends BasePlugin {
}), }),
getSchemaTpl('proxy', { getSchemaTpl('proxy', {
value: false, value: true,
visibleOn: 'data.uploadType !== "asForm" || !data.uploadType' visibleOn: 'data.uploadType !== "asForm" || !data.uploadType'
}), }),
@ -263,7 +266,7 @@ export class FileControlPlugin extends BasePlugin {
type: 'container', type: 'container',
className: 'ae-ExtendMore mb-3', className: 'ae-ExtendMore mb-3',
visibleOn: visibleOn:
'data.uploadType !== "asForm" && data.useChunk != false', 'data.uploadType !== "asForm" && data.useChunk === true',
body: [ body: [
{ {
type: 'input-group', type: 'input-group',
@ -287,6 +290,7 @@ export class FileControlPlugin extends BasePlugin {
'data.uploadType == "fileReceptor" && data.useChunk != false', 'data.uploadType == "fileReceptor" && data.useChunk != false',
body: [ body: [
getSchemaTpl('apiControl', { getSchemaTpl('apiControl', {
mode: 'row',
name: 'startChunkApi', name: 'startChunkApi',
label: tipedLabel( label: tipedLabel(
'分块准备接口', '分块准备接口',
@ -295,6 +299,7 @@ export class FileControlPlugin extends BasePlugin {
value: '/api/upload/startChunk' value: '/api/upload/startChunk'
}), }),
getSchemaTpl('apiControl', { getSchemaTpl('apiControl', {
mode: 'row',
name: 'chunkApi', name: 'chunkApi',
label: tipedLabel( label: tipedLabel(
'分块上传接口', '分块上传接口',
@ -303,6 +308,7 @@ export class FileControlPlugin extends BasePlugin {
value: '/api/upload/chunk' value: '/api/upload/chunk'
}), }),
getSchemaTpl('apiControl', { getSchemaTpl('apiControl', {
mode: 'row',
name: 'finishChunkApi', name: 'finishChunkApi',
label: tipedLabel( label: tipedLabel(
'上传完成接口', '上传完成接口',
@ -362,7 +368,10 @@ export class FileControlPlugin extends BasePlugin {
}) })
] ]
}, },
getSchemaTpl('status', {isFormItem: true}), getSchemaTpl('status', {
isFormItem: true,
unsupportStatic: true
}),
getSchemaTpl('validation', {tag: ValidatorTag.File}) getSchemaTpl('validation', {tag: ValidatorTag.File})
]) ])
}, },
@ -371,6 +380,7 @@ export class FileControlPlugin extends BasePlugin {
body: getSchemaTpl('collapseGroup', [ body: getSchemaTpl('collapseGroup', [
getSchemaTpl('style:formItem', {renderer: context.info.renderer}), getSchemaTpl('style:formItem', {renderer: context.info.renderer}),
getSchemaTpl('style:classNames', { getSchemaTpl('style:classNames', {
unsupportStatic: true,
schema: [ schema: [
getSchemaTpl('className', { getSchemaTpl('className', {
name: 'descriptionClassName', name: 'descriptionClassName',

View File

@ -14,7 +14,7 @@ export class InputGroupControlPlugin extends BasePlugin {
isBaseComponent = true; isBaseComponent = true;
icon = 'fa fa-object-group'; icon = 'fa fa-object-group';
pluginIcon = 'input-group-plugin'; pluginIcon = 'input-group-plugin';
description = `输入组合,支持多种类型的控件组合`; description = '输入组合,支持多种类型的控件组合';
docLink = '/amis/zh-CN/components/form/input-group'; docLink = '/amis/zh-CN/components/form/input-group';
tags = ['表单项']; tags = ['表单项'];
scaffold = { scaffold = {
@ -64,8 +64,7 @@ export class InputGroupControlPlugin extends BasePlugin {
type: 'tpl', type: 'tpl',
inline: false, inline: false,
className: 'p-t-xs', className: 'p-t-xs',
tpl: tpl: '<%= data.label %><% if (data.icon) { %><i class="<%= data.icon %>"/><% }%>'
'<%= data.label %><% if (data.icon) { %><i class="<%= data.icon %>"/><% }%>'
} }
] ]
}, },

View File

@ -19,7 +19,8 @@ export class ImageControlPlugin extends BasePlugin {
// 组件名称 // 组件名称
name = '图片上传'; name = '图片上传';
isBaseComponent = true; isBaseComponent = true;
description = `可以对图片实现裁剪,限制图片的宽高以及大小,支持自动上传及上传多张图片`; description =
'可以对图片实现裁剪,限制图片的宽高以及大小,支持自动上传及上传多张图片';
docLink = '/amis/zh-CN/components/form/input-image'; docLink = '/amis/zh-CN/components/form/input-image';
tags = ['表单项']; tags = ['表单项'];
icon = 'fa fa-crop'; icon = 'fa fa-crop';
@ -28,6 +29,9 @@ export class ImageControlPlugin extends BasePlugin {
type: 'input-image', type: 'input-image',
label: '图片上传', label: '图片上传',
name: 'image', name: 'image',
autoUpload: true,
proxy: true,
uploadType: 'fileReceptor',
imageClassName: 'r w-full', imageClassName: 'r w-full',
receiver: { receiver: {
url: 'object-upload://default', url: 'object-upload://default',
@ -57,7 +61,7 @@ export class ImageControlPlugin extends BasePlugin {
{ {
type: 'object', type: 'object',
properties: { properties: {
'event.data.value': { 'event.data.file': {
type: 'object', type: 'object',
title: '上传的文件' title: '上传的文件'
} }
@ -73,7 +77,7 @@ export class ImageControlPlugin extends BasePlugin {
{ {
type: 'object', type: 'object',
properties: { properties: {
'event.data.value': { 'event.data.item': {
type: 'object', type: 'object',
title: '被移除的文件' title: '被移除的文件'
} }
@ -89,7 +93,7 @@ export class ImageControlPlugin extends BasePlugin {
{ {
type: 'object', type: 'object',
properties: { properties: {
'event.data.value': { 'event.data.item': {
type: 'object', type: 'object',
title: '远程上传请求成功后返回的结果数据' title: '远程上传请求成功后返回的结果数据'
} }
@ -105,7 +109,7 @@ export class ImageControlPlugin extends BasePlugin {
{ {
type: 'object', type: 'object',
properties: { properties: {
'event.data.file': { 'event.data.item': {
type: 'object', type: 'object',
title: '上传的文件' title: '上传的文件'
}, },
@ -173,6 +177,7 @@ export class ImageControlPlugin extends BasePlugin {
}), }),
getSchemaTpl('apiControl', { getSchemaTpl('apiControl', {
mode: 'row',
name: 'receiver', name: 'receiver',
label: tipedLabel( label: tipedLabel(
'文件接收器', '文件接收器',
@ -188,7 +193,7 @@ export class ImageControlPlugin extends BasePlugin {
}), }),
getSchemaTpl('proxy', { getSchemaTpl('proxy', {
value: false value: true
}), }),
// getSchemaTpl('autoFill'), // getSchemaTpl('autoFill'),
@ -207,12 +212,6 @@ export class ImageControlPlugin extends BasePlugin {
] ]
}), }),
getSchemaTpl('switch', {
name: 'fixedSize',
label: '固定尺寸',
value: false
}),
getSchemaTpl('switch', { getSchemaTpl('switch', {
name: 'hideUploadButton', name: 'hideUploadButton',
label: '隐藏上传按钮', label: '隐藏上传按钮',
@ -225,38 +224,38 @@ export class ImageControlPlugin extends BasePlugin {
value: false value: false
}), }),
getSchemaTpl('switch', { // getSchemaTpl('switch', {
name: 'compress', // name: 'compress',
value: true, // value: true,
label: tipedLabel( // label: tipedLabel(
'开启压缩', // '开启压缩',
'由 hiphoto 实现,自定义接口将无效' // '由 hiphoto 实现,自定义接口将无效'
) // )
}), // }),
{ // {
type: 'container', // type: 'container',
className: 'ae-ExtendMore mb-3', // className: 'ae-ExtendMore mb-3',
visibleOn: 'data.compress', // visibleOn: 'data.compress',
name: 'compressOptions', // name: 'compressOptions',
body: [ // body: [
{ // {
type: 'input-number', // type: 'input-number',
label: '最大宽度', // label: '最大宽度',
name: 'maxWidth' // name: 'compressOptions.maxWidth'
}, // },
{ // {
type: 'input-number', // type: 'input-number',
label: '最大高度', // label: '最大高度',
name: 'maxHeight' // name: 'compressOptions.maxHeight'
} // }
] // ]
}, // },
getSchemaTpl('switch', { // getSchemaTpl('switch', {
name: 'showCompressOptions', // name: 'showCompressOptions',
label: '是否显示压缩选项' // label: '显示压缩选项'
}), // }),
getSchemaTpl('switch', { getSchemaTpl('switch', {
name: 'crop', name: 'crop',
@ -317,6 +316,7 @@ export class ImageControlPlugin extends BasePlugin {
{ {
name: 'maxSize', name: 'maxSize',
type: 'input-number', type: 'input-number',
suffix: 'B',
label: tipedLabel( label: tipedLabel(
'最大体积', '最大体积',
'超出大小不允许上传,单位字节' '超出大小不允许上传,单位字节'
@ -325,13 +325,19 @@ export class ImageControlPlugin extends BasePlugin {
{ {
type: 'input-number', type: 'input-number',
name: 'limit.width', name: 'limit.width',
label: '宽度' label: tipedLabel(
'宽度',
'校验优先级比最大宽度和最大宽度高'
)
}, },
{ {
type: 'input-number', type: 'input-number',
name: 'limit.height', name: 'limit.height',
label: '高度' label: tipedLabel(
'高度',
'校验优先级比最大高度和最大高度高'
)
}, },
{ {
@ -366,7 +372,7 @@ export class ImageControlPlugin extends BasePlugin {
{ {
type: 'input-text', type: 'input-text',
name: 'limit.限制最小高度', name: 'limit.aspectRatioLabel',
label: tipedLabel( label: tipedLabel(
'宽高比描述', '宽高比描述',
'当宽高比没有满足条件时,此描述将作为提示信息显示' '当宽高比没有满足条件时,此描述将作为提示信息显示'
@ -376,7 +382,10 @@ export class ImageControlPlugin extends BasePlugin {
} }
] ]
}, },
getSchemaTpl('status', {isFormItem: true}), getSchemaTpl('status', {
isFormItem: true,
unsupportStatic: true
}),
getSchemaTpl('validation', {tag: ValidatorTag.File}) getSchemaTpl('validation', {tag: ValidatorTag.File})
]) ])
}, },
@ -384,7 +393,38 @@ export class ImageControlPlugin extends BasePlugin {
title: '外观', title: '外观',
body: getSchemaTpl('collapseGroup', [ body: getSchemaTpl('collapseGroup', [
getSchemaTpl('style:formItem', {renderer: context.info.renderer}), getSchemaTpl('style:formItem', {renderer: context.info.renderer}),
{
title: '尺寸',
body: [
getSchemaTpl('switch', {
name: 'fixedSize',
label: tipedLabel(
'固定尺寸',
'开启后需通过CSS类设置其高度、宽度'
),
value: false
}),
{
type: 'container',
className: 'ae-ExtendMore mb-3',
visibleOn: 'data.fixedSize',
body: [
{
type: 'input-text',
required: true,
name: 'fixedSizeClassName',
label: tipedLabel(
'CSS类名',
'开启固定尺寸时,根据此值控制展示尺寸'
)
}
]
}
]
},
getSchemaTpl('style:classNames', { getSchemaTpl('style:classNames', {
unsupportStatic: true,
schema: [] schema: []
}) })
]) ])

View File

@ -1,10 +1,7 @@
/** /**
* @file input-kv * @file input-kv
*/ */
import { import {RendererPluginAction, RendererPluginEvent} from 'amis-editor-core';
RendererPluginAction,
RendererPluginEvent
} from 'amis-editor-core';
import {defaultValue, getSchemaTpl, valuePipeOut} from 'amis-editor-core'; import {defaultValue, getSchemaTpl, valuePipeOut} from 'amis-editor-core';
import {registerEditorPlugin} from 'amis-editor-core'; import {registerEditorPlugin} from 'amis-editor-core';
import { import {
@ -77,6 +74,10 @@ export class KVControlPlugin extends BasePlugin {
'event.data.value': { 'event.data.value': {
type: 'string', type: 'string',
title: '当前组合项的值' title: '当前组合项的值'
},
'event.data.item': {
type: 'object',
title: '被移除的项'
} }
} }
} }

View File

@ -12,7 +12,7 @@ export class MonthControlPlugin extends DateControlPlugin {
isBaseComponent = true; isBaseComponent = true;
pluginIcon = 'inputMonth-plugin'; pluginIcon = 'inputMonth-plugin';
icon = 'fa fa-calendar'; icon = 'fa fa-calendar';
description = `月份选择`; description = '月份选择';
docLink = '/amis/zh-CN/components/form/input-month'; docLink = '/amis/zh-CN/components/form/input-month';
tags = ['表单项']; tags = ['表单项'];
// @ts-ignore // @ts-ignore

View File

@ -12,7 +12,7 @@ export class InputQuarterPlugin extends DateControlPlugin {
isBaseComponent = true; isBaseComponent = true;
icon = 'fa fa-calendar'; icon = 'fa fa-calendar';
pluginIcon = 'input-quarter-plugin'; pluginIcon = 'input-quarter-plugin';
description = `季度选择`; description = '季度选择';
docLink = '/amis/zh-CN/components/form/input-quarter'; docLink = '/amis/zh-CN/components/form/input-quarter';
tags = ['表单项']; tags = ['表单项'];
// @ts-ignore // @ts-ignore

View File

@ -15,7 +15,7 @@ export class RangeControlPlugin extends BasePlugin {
isBaseComponent = true; isBaseComponent = true;
icon = 'fa fa-sliders'; icon = 'fa fa-sliders';
pluginIcon = 'input-range-plugin'; pluginIcon = 'input-range-plugin';
description = `选择某个值或者某个范围`; description = '选择某个值或者某个范围';
docLink = '/amis/zh-CN/components/form/input-range'; docLink = '/amis/zh-CN/components/form/input-range';
tags = ['表单项']; tags = ['表单项'];
scaffold = { scaffold = {

View File

@ -8,10 +8,7 @@ import {registerEditorPlugin} from 'amis-editor-core';
import {BasePlugin, BaseEventContext, tipedLabel} from 'amis-editor-core'; import {BasePlugin, BaseEventContext, tipedLabel} from 'amis-editor-core';
import {ValidatorTag} from '../../validator'; import {ValidatorTag} from '../../validator';
import {getEventControlConfig} from '../../renderer/event-control/helper'; import {getEventControlConfig} from '../../renderer/event-control/helper';
import { import {RendererPluginAction, RendererPluginEvent} from 'amis-editor-core';
RendererPluginAction,
RendererPluginEvent
} from 'amis-editor-core';
export class RateControlPlugin extends BasePlugin { export class RateControlPlugin extends BasePlugin {
// 关联渲染器名字 // 关联渲染器名字
@ -23,7 +20,7 @@ export class RateControlPlugin extends BasePlugin {
isBaseComponent = true; isBaseComponent = true;
icon = 'fa fa-star-o'; icon = 'fa fa-star-o';
pluginIcon = 'input-rating-plugin'; pluginIcon = 'input-rating-plugin';
description = `支持只读、半星选择`; description = '支持只读、半星选择';
docLink = '/amis/zh-CN/components/form/input-rating'; docLink = '/amis/zh-CN/components/form/input-rating';
tags = ['表单项']; tags = ['表单项'];
scaffold = { scaffold = {

View File

@ -12,7 +12,7 @@ export class RepeatControlPlugin extends BasePlugin {
isBaseComponent = true; isBaseComponent = true;
icon = 'fa fa-repeat'; icon = 'fa fa-repeat';
pluginIcon = 'input-repeat-plugin'; pluginIcon = 'input-repeat-plugin';
description = `选择重复的频率,如每时、每天、每周等`; description = '选择重复的频率,如每时、每天、每周等';
docLink = '/amis/zh-CN/components/form/input-repeat'; docLink = '/amis/zh-CN/components/form/input-repeat';
tags = ['表单项']; tags = ['表单项'];
scaffold = { scaffold = {
@ -46,9 +46,10 @@ export class RepeatControlPlugin extends BasePlugin {
name: 'options', name: 'options',
type: 'select', type: 'select',
label: '启用单位', label: '启用单位',
options: 'secondly,minutely,hourly,daily,weekdays,weekly,monthly,yearly'.split( options:
',' 'secondly,minutely,hourly,daily,weekdays,weekly,monthly,yearly'.split(
), ','
),
value: 'hourly,daily,weekly,monthly', value: 'hourly,daily,weekly,monthly',
multiple: true multiple: true
} }

View File

@ -1,4 +1,4 @@
import {getSchemaTpl} from 'amis-editor-core'; import {BaseEventContext, getSchemaTpl} from 'amis-editor-core';
import {registerEditorPlugin} from 'amis-editor-core'; import {registerEditorPlugin} from 'amis-editor-core';
import {BasePlugin} from 'amis-editor-core'; import {BasePlugin} from 'amis-editor-core';
@ -12,13 +12,15 @@ export class RichTextControlPlugin extends BasePlugin {
isBaseComponent = true; isBaseComponent = true;
icon = 'fa fa-newspaper-o'; icon = 'fa fa-newspaper-o';
pluginIcon = 'input-rich-text-plugin'; pluginIcon = 'input-rich-text-plugin';
description = `可自定义富文本的配置栏`; description = '可自定义富文本的配置栏';
docLink = '/amis/zh-CN/components/form/input-rich-text'; docLink = '/amis/zh-CN/components/form/input-rich-text';
tags = ['表单项']; tags = ['表单项'];
scaffold = { scaffold = {
type: 'input-rich-text', type: 'input-rich-text',
label: '富文本', label: '富文本',
name: 'rich-text' name: 'rich-text',
receiver: '/api/upload/image',
vendor: 'tinymce'
}; };
previewSchema: any = { previewSchema: any = {
type: 'form', type: 'form',
@ -33,154 +35,188 @@ export class RichTextControlPlugin extends BasePlugin {
}; };
panelTitle = '富文本'; panelTitle = '富文本';
panelBody = [
getSchemaTpl('switchDefaultValue'), panelBodyCreator = (context: BaseEventContext) => {
{ // 有设置这个就默认使用 froala
type: 'textarea', const hasRichTextToken = this.manager.env?.richTextToken ? true : false;
name: 'value', return [
label: '默认值', getSchemaTpl('switchDefaultValue'),
visibleOn: 'typeof this.value !== "undefined"' {
}, type: 'textarea',
getSchemaTpl('api', { name: 'value',
name: 'receiver', label: '默认值',
label: '文件接收接口', visibleOn: 'typeof this.value !== "undefined"'
value: '/api/upload/image', },
__isUpload: true getSchemaTpl('api', {
}), name: 'receiver',
{ label: '文件接收接口',
type: 'select', value: '/api/upload/image',
name: 'vendor', __isUpload: true
label: '编辑器类型', }),
value: 'tinymce', {
options: ['tinymce', 'froala'] type: 'select',
}, name: 'vendor',
getSchemaTpl('fieldSet', { label: '编辑器类型',
title: 'froala 设置项', value: hasRichTextToken ? 'froala' : 'tinymce',
visibleOn: 'data.vendor === "froala"', options: ['tinymce', 'froala']
body: [ },
{ getSchemaTpl('fieldSet', {
type: 'combo', title: 'froala 设置项',
name: 'options', visibleOn: 'data.vendor === "froala"',
noBorder: true, body: [
multiLine: true, {
items: [ type: 'combo',
{ name: 'options',
type: 'select', noBorder: true,
name: 'language', multiLine: true,
label: '语言', items: [
labelRemark: '鼠标覆盖配置栏中配置时显示的提示语言', {
defaultValue: 'zh_cn', type: 'select',
options: [ name: 'language',
{label: '中文', value: 'zh_cn'}, label: '语言',
{label: '英文', value: 'en_us'} labelRemark: '鼠标覆盖配置栏中配置时显示的提示语言',
] defaultValue: 'zh_cn',
}, options: [
{ {label: '中文', value: 'zh_cn'},
type: 'textarea', {label: '英文', value: 'en_us'}
name: 'toolbarButtons', ]
label: '大屏时展示的配置项', },
labelRemark: '屏幕宽度 ≥ 1200px', {
description: type: 'textarea',
'使用空格分开配置,使用<code>|</code>可将配置栏分组,<a target="_blank" href="https://www.froala.com/wysiwyg-editor/docs/options">参考文档</a>', name: 'toolbarButtons',
minRows: 5, label: '大屏时展示的配置项',
value: [ labelRemark: '屏幕宽度 ≥ 1200px',
'paragraphFormat', description:
'quote', '使用空格分开配置,使用<code>|</code>可将配置栏分组,<a target="_blank" href="https://www.froala.com/wysiwyg-editor/docs/options">参考文档</a>',
'color', minRows: 5,
'|', value: [
'bold', 'paragraphFormat',
'italic', 'quote',
'underline', 'color',
'strikeThrough', '|',
'|', 'bold',
'formatOL', 'italic',
'formatUL', 'underline',
'align', 'strikeThrough',
'|', '|',
'insertLink', 'formatOL',
'insertImage', 'formatUL',
'insertEmotion', 'align',
'insertTable', '|',
'|', 'insertLink',
'undo', 'insertImage',
'redo', 'insertEmotion',
'html' 'insertTable',
], '|',
pipeIn: (value: any) => 'undo',
Array.isArray(value) ? value.join(' ') : '', 'redo',
pipeOut: (value: any) => value.replace(/\s+/g, ' ').split(' ') 'html'
}, ],
{ pipeIn: (value: any) =>
type: 'textarea', Array.isArray(value) ? value.join(' ') : '',
name: 'toolbarButtonsMD', pipeOut: (value: any) => value.replace(/\s+/g, ' ').split(' ')
label: '中屏时展示的配置项', },
labelRemark: '屏幕宽度 ≥ 992px', {
description: type: 'textarea',
'使用空格分开配置,使用<code>|</code>可将配置栏分组,<a target="_blank" href="https://www.froala.com/wysiwyg-editor/docs/options">参考文档</a>', name: 'toolbarButtonsMD',
minRows: 5, label: '中屏时展示的配置项',
pipeIn: (value: any) => labelRemark: '屏幕宽度 ≥ 992px',
Array.isArray(value) ? value.join(' ') : '', description:
pipeOut: (value: any) => value.replace(/\s+/g, ' ').split(' ') '使用空格分开配置,使用<code>|</code>可将配置栏分组,<a target="_blank" href="https://www.froala.com/wysiwyg-editor/docs/options">参考文档</a>',
}, minRows: 5,
{ pipeIn: (value: any) =>
type: 'textarea', Array.isArray(value) ? value.join(' ') : '',
name: 'toolbarButtonsSM', pipeOut: (value: any) => value.replace(/\s+/g, ' ').split(' ')
label: '小屏时展示的配置项', },
labelRemark: '屏幕宽度 ≥ 768px', {
description: type: 'textarea',
'使用空格分开配置,使用<code>|</code>可将配置栏分组,<a target="_blank" href="https://www.froala.com/wysiwyg-editor/docs/options">参考文档</a>', name: 'toolbarButtonsSM',
minRows: 5, label: '小屏时展示的配置项',
pipeIn: (value: any) => labelRemark: '屏幕宽度 ≥ 768px',
Array.isArray(value) ? value.join(' ') : '', description:
pipeOut: (value: any) => value.replace(/\s+/g, ' ').split(' ') '使用空格分开配置,使用<code>|</code>可将配置栏分组,<a target="_blank" href="https://www.froala.com/wysiwyg-editor/docs/options">参考文档</a>',
} minRows: 5,
] pipeIn: (value: any) =>
} Array.isArray(value) ? value.join(' ') : '',
] pipeOut: (value: any) => value.replace(/\s+/g, ' ').split(' ')
}), }
getSchemaTpl('fieldSet', { ]
title: 'tinymce 设置项', }
visibleOn: 'data.vendor === "tinymce"', ]
body: [ }),
{ getSchemaTpl('fieldSet', {
type: 'combo', title: 'tinymce 设置项',
name: 'options', visibleOn: 'data.vendor === "tinymce"',
noBorder: true, body: [
multiLine: true, {
items: [ type: 'combo',
getSchemaTpl('switch', { name: 'options',
label: '是否显示菜单栏', noBorder: true,
value: 'true', multiLine: true,
name: 'menubar' items: [
}), getSchemaTpl('switch', {
{ label: '是否显示菜单栏',
type: 'input-number', value: 'true',
label: '高度', name: 'menubar'
min: 0, }),
value: 400, {
name: 'height' type: 'input-number',
}, label: '高度',
{ min: 0,
type: 'textarea', value: 400,
name: 'plugins', name: 'height'
label: '启用的插件', },
description: {
'使用空格分开配置,<a target="_blank" href="https://www.tiny.cloud/docs/general-configuration-guide/basic-setup/">参考文档</a>', name: 'plugins',
value: label: '启用的插件',
'advlist autolink link image lists charmap print preview hr anchor pagebreak spellchecker searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking table emoticons template paste help' description:
}, '<a target="_blank" href="https://www.tiny.cloud/docs/general-configuration-guide/basic-setup/">参考文档</a>',
{
type: 'textarea', type: 'input-array',
name: 'toolbar',
label: '工具栏', inline: true,
value: items: {
'undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | print preview media fullpage | forecolor backcolor emoticons | help' type: 'input-text',
} clearable: true
] },
} value: [
] 'advlist',
}) 'autolink',
]; 'link',
'image',
'lists',
'charmap',
'preview',
'anchor',
'pagebreak',
'searchreplace',
'wordcount',
'visualblocks',
'visualchars',
'code',
'fullscreen',
'insertdatetime',
'media',
'nonbreaking',
'table',
'emoticons',
'template',
'help'
]
},
{
type: 'textarea',
name: 'toolbar',
label: '工具栏',
value:
'undo redo | formatselect | bold italic backcolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | removeformat | help'
}
]
}
]
})
];
};
} }
registerEditorPlugin(RichTextControlPlugin); registerEditorPlugin(RichTextControlPlugin);

View File

@ -21,7 +21,7 @@ export class SubFormControlPlugin extends BasePlugin {
isBaseComponent = true; isBaseComponent = true;
icon = 'fa fa-window-restore'; icon = 'fa fa-window-restore';
pluginIcon = 'sub-form-plugin'; pluginIcon = 'sub-form-plugin';
description = `SubForm, 配置一个子<code>form</code>作为当前的表单项`; description = 'SubForm, 配置一个子 form 作为当前的表单项';
docLink = '/amis/zh-CN/components/form/input-sub-form'; docLink = '/amis/zh-CN/components/form/input-sub-form';
tags = ['表单项']; tags = ['表单项'];
scaffold = { scaffold = {

View File

@ -28,7 +28,8 @@ export class TableControlPlugin extends BasePlugin {
isBaseComponent = true; isBaseComponent = true;
icon = 'fa fa-table'; icon = 'fa fa-table';
pluginIcon = 'table-plugin'; pluginIcon = 'table-plugin';
description = `可以用来展现数据的,可以用来展示数组类型的数据,比如 <code>multiple</code> 的子 <code>form</code>`; description =
'可以用来展现数据的,可以用来展示数组类型的数据,比如 multiple 的子 form';
docLink = '/amis/zh-CN/components/form/input-table'; docLink = '/amis/zh-CN/components/form/input-table';
tags = ['表单项']; tags = ['表单项'];
scaffold = { scaffold = {

View File

@ -23,7 +23,7 @@ export class TagControlPlugin extends BasePlugin {
isBaseComponent = true; isBaseComponent = true;
icon = 'fa fa-tag'; icon = 'fa fa-tag';
pluginIcon = 'input-tag-plugin'; pluginIcon = 'input-tag-plugin';
description = `配置<code>options</code>可以实现选择选项`; description = '配置 options 可以实现选择选项';
docLink = '/amis/zh-CN/components/form/input-tag'; docLink = '/amis/zh-CN/components/form/input-tag';
tags = ['表单项']; tags = ['表单项'];
scaffold = { scaffold = {
@ -76,6 +76,10 @@ export class TagControlPlugin extends BasePlugin {
'event.data.value': { 'event.data.value': {
type: 'string', type: 'string',
title: '选中值' title: '选中值'
},
'event.data.items': {
type: 'array',
title: '选项集合'
} }
} }
} }
@ -92,6 +96,10 @@ export class TagControlPlugin extends BasePlugin {
'event.data.value': { 'event.data.value': {
type: 'string', type: 'string',
title: '选中值' title: '选中值'
},
'event.data.items': {
type: 'array',
title: '选项集合'
} }
} }
} }

View File

@ -11,7 +11,7 @@ export class TimeControlPlugin extends DateControlPlugin {
isBaseComponent = true; isBaseComponent = true;
icon = 'fa fa-clock-o'; icon = 'fa fa-clock-o';
pluginIcon = 'input-time-plugin'; pluginIcon = 'input-time-plugin';
description = `时分秒输入`; description = '时分秒输入';
docLink = '/amis/zh-CN/components/form/input-time'; docLink = '/amis/zh-CN/components/form/input-time';
tags = ['表单项']; tags = ['表单项'];
scaffold = { scaffold = {

View File

@ -20,7 +20,8 @@ export class TreeControlPlugin extends BasePlugin {
isBaseComponent = true; isBaseComponent = true;
icon = 'fa fa-list-alt'; icon = 'fa fa-list-alt';
pluginIcon = 'input-tree-plugin'; pluginIcon = 'input-tree-plugin';
description = `树型结构来选择,可通过<code>options</code>来配置选项,也可通过<code>source</code>拉取选项`; description =
'树型结构来选择,可通过 options 来配置选项,也可通过 source 拉取选项';
docLink = '/amis/zh-CN/components/form/input-tree'; docLink = '/amis/zh-CN/components/form/input-tree';
tags = ['表单项']; tags = ['表单项'];
scaffold = { scaffold = {
@ -93,7 +94,7 @@ export class TreeControlPlugin extends BasePlugin {
type: 'object', type: 'object',
title: '新增的节点信息' title: '新增的节点信息'
}, },
'event.data.options': { 'event.data.items': {
type: 'array', type: 'array',
title: '选项集合' title: '选项集合'
} }
@ -113,7 +114,7 @@ export class TreeControlPlugin extends BasePlugin {
type: 'object', type: 'object',
title: '编辑的节点信息' title: '编辑的节点信息'
}, },
'event.data.options': { 'event.data.items': {
type: 'array', type: 'array',
title: '选项集合' title: '选项集合'
} }
@ -133,7 +134,7 @@ export class TreeControlPlugin extends BasePlugin {
type: 'object', type: 'object',
title: '删除的节点信息' title: '删除的节点信息'
}, },
'event.data.options': { 'event.data.items': {
type: 'array', type: 'array',
title: '选项集合' title: '选项集合'
} }
@ -488,27 +489,17 @@ export class TreeControlPlugin extends BasePlugin {
}, },
{ {
title: '外观', title: '外观',
body: [ body: getSchemaTpl('collapseGroup', [
{ getSchemaTpl('style:formItem', {renderer}),
label: '顶级文字', getSchemaTpl('style:classNames', {
name: 'rootLabel', schema: [
type: 'input-text', getSchemaTpl('className', {
pipeIn: defaultValue('顶级'), label: '外层容器',
visibleOn: 'data.hideRoot !== true' name: 'treeContainerClassName'
}, })
]
getSchemaTpl('switch', {
name: 'showIcon',
label: '是否显示图标',
pipeIn: defaultValue(true)
}),
getSchemaTpl('switch', {
label: '是否显示单选按钮',
name: 'showRadio',
visibleOn: '!data.multiple'
}) })
] ])
}, },
{ {
title: '事件', title: '事件',

View File

@ -12,7 +12,7 @@ export class YearControlPlugin extends DateControlPlugin {
isBaseComponent = true; isBaseComponent = true;
icon = 'fa fa-calendar'; icon = 'fa fa-calendar';
pluginIcon = 'input-year-plugin'; pluginIcon = 'input-year-plugin';
description = `年选择`; description = '年选择';
docLink = '/amis/zh-CN/components/form/input-year'; docLink = '/amis/zh-CN/components/form/input-year';
tags = ['表单项']; tags = ['表单项'];
// @ts-ignore // @ts-ignore

View File

@ -15,6 +15,7 @@ import {
import {defaultValue, getSchemaTpl} from 'amis-editor-core'; import {defaultValue, getSchemaTpl} from 'amis-editor-core';
import find from 'lodash/find'; import find from 'lodash/find';
import {JSONDelete, JSONPipeIn, JSONUpdate} from 'amis-editor-core'; import {JSONDelete, JSONPipeIn, JSONUpdate} from 'amis-editor-core';
import {SUPPORT_STATIC_FORMITEM_CMPTS} from '../../renderer/event-control/helper';
export class ItemPlugin extends BasePlugin { export class ItemPlugin extends BasePlugin {
// panelTitle = '表单项通配'; // panelTitle = '表单项通配';
@ -55,9 +56,9 @@ export class ItemPlugin extends BasePlugin {
} }
} }
panelBodyCreator = (context: BaseEventContext) => { panelBodyCreator = (context: BaseEventContext) => {
const ignoreName = ~['button', 'submit', 'reset'].indexOf( const type = context.schema.type || '';
context.schema.type const supportStatic = SUPPORT_STATIC_FORMITEM_CMPTS.includes(type);
); const ignoreName = ~['button', 'submit', 'reset'].indexOf(type);
const notRequiredName = ~[ const notRequiredName = ~[
'button-toobar', 'button-toobar',
'container', 'container',
@ -72,7 +73,7 @@ export class ItemPlugin extends BasePlugin {
'table', 'table',
'elevator', 'elevator',
'static' 'static'
].indexOf(context.schema.type); ].indexOf(type);
const hasReadOnly = ~[ const hasReadOnly = ~[
'switch', 'switch',
'wizard', 'wizard',
@ -81,9 +82,9 @@ export class ItemPlugin extends BasePlugin {
'input-rating', 'input-rating',
'input-text', 'input-text',
'textarea' 'textarea'
].indexOf(context.schema.type); ].indexOf(type);
/** 不支持配置校验属性的组件 */ /** 不支持配置校验属性的组件 */
const ignoreValidator = !!~['input-group'].indexOf(context.schema.type); const ignoreValidator = !!~['input-group'].indexOf(type);
const renderer: any = context.info.renderer; const renderer: any = context.info.renderer;
return [ return [
getSchemaTpl('tabs', [ getSchemaTpl('tabs', [
@ -155,7 +156,15 @@ export class ItemPlugin extends BasePlugin {
label: '描述 CSS 类名', label: '描述 CSS 类名',
name: 'descriptionClassName', name: 'descriptionClassName',
visibleOn: 'this.description' visibleOn: 'this.description'
}) }),
...(!supportStatic
? []
: [
getSchemaTpl('className', {
label: '静态 CSS 类名',
name: 'staticClassName'
})
])
] ]
}, },
@ -165,11 +174,10 @@ export class ItemPlugin extends BasePlugin {
// TODO: 有些表单项没有 disabled // TODO: 有些表单项没有 disabled
getSchemaTpl('disabled'), getSchemaTpl('disabled'),
getSchemaTpl('visible'), getSchemaTpl('visible'),
supportStatic ? getSchemaTpl('static') : null,
getSchemaTpl('switch', { getSchemaTpl('switch', {
name: 'clearValueOnHidden', name: 'clearValueOnHidden',
label: '隐藏时删除表单项值', label: '隐藏时删除表单项值'
disabledOn: 'typeof this.visible === "boolean"'
}) })
] ]
}, },

View File

@ -3,10 +3,7 @@ import {registerEditorPlugin} from 'amis-editor-core';
import {BasePlugin, BaseEventContext} from 'amis-editor-core'; import {BasePlugin, BaseEventContext} from 'amis-editor-core';
import {formItemControl} from '../../component/BaseControl'; import {formItemControl} from '../../component/BaseControl';
import { import {RendererPluginAction, RendererPluginEvent} from 'amis-editor-core';
RendererPluginAction,
RendererPluginEvent
} from 'amis-editor-core';
export class ListControlPlugin extends BasePlugin { export class ListControlPlugin extends BasePlugin {
// 关联渲染器名字 // 关联渲染器名字
@ -20,7 +17,8 @@ export class ListControlPlugin extends BasePlugin {
isBaseComponent = true; isBaseComponent = true;
icon = 'fa fa-ellipsis-h'; icon = 'fa fa-ellipsis-h';
pluginIcon = 'list-select-plugin'; pluginIcon = 'list-select-plugin';
description = `单选或者多选,支持<code>source</code>拉取选项,选项可配置图片,也可以自定义<code>HTML</code>配置`; description =
'单选或者多选,支持 source 拉取选项,选项可配置图片,也可以自定义 HTML 配置';
docLink = '/amis/zh-CN/components/form/list-select'; docLink = '/amis/zh-CN/components/form/list-select';
tags = ['表单项']; tags = ['表单项'];
scaffold = { scaffold = {
@ -112,7 +110,6 @@ export class ListControlPlugin extends BasePlugin {
getSchemaTpl('label'), getSchemaTpl('label'),
getSchemaTpl('multiple'), getSchemaTpl('multiple'),
getSchemaTpl('extractValue'), getSchemaTpl('extractValue'),
getSchemaTpl('valueFormula', { getSchemaTpl('valueFormula', {
rendererSchema: context?.schema, rendererSchema: context?.schema,
useSelectMode: true, // 改用 Select 设置模式 useSelectMode: true, // 改用 Select 设置模式

View File

@ -12,7 +12,7 @@ export class LocationControlPlugin extends BasePlugin {
isBaseComponent = true; isBaseComponent = true;
icon = 'fa fa-location-arrow'; icon = 'fa fa-location-arrow';
pluginIcon = 'location-picker-plugin'; pluginIcon = 'location-picker-plugin';
description = `地理位置选择`; description = '地理位置选择';
docLink = '/amis/zh-CN/components/form/location-picker'; docLink = '/amis/zh-CN/components/form/location-picker';
tags = ['表单项']; tags = ['表单项'];
scaffold = { scaffold = {

View File

@ -10,10 +10,7 @@ import {
} from 'amis-editor-core'; } from 'amis-editor-core';
import {ValidatorTag} from '../../validator'; import {ValidatorTag} from '../../validator';
import {getEventControlConfig} from '../../renderer/event-control/helper'; import {getEventControlConfig} from '../../renderer/event-control/helper';
import { import {RendererPluginAction, RendererPluginEvent} from 'amis-editor-core';
RendererPluginAction,
RendererPluginEvent
} from 'amis-editor-core';
export class MatrixControlPlugin extends BasePlugin { export class MatrixControlPlugin extends BasePlugin {
// 关联渲染器名字 // 关联渲染器名字
@ -25,7 +22,7 @@ export class MatrixControlPlugin extends BasePlugin {
isBaseComponent = true; isBaseComponent = true;
icon = 'fa fa-th-large'; icon = 'fa fa-th-large';
pluginIcon = 'matrix-checkboxes-plugin'; pluginIcon = 'matrix-checkboxes-plugin';
description = `可配置行单选,列单选,以及全部选项只能单选或者全部选项多选`; description = '可配置行单选,列单选,以及全部选项只能单选或者全部选项多选';
docLink = '/amis/zh-CN/components/form/matrix-checkboxes'; docLink = '/amis/zh-CN/components/form/matrix-checkboxes';
tags = ['表单项']; tags = ['表单项'];
scaffold = { scaffold = {
@ -159,8 +156,9 @@ export class MatrixControlPlugin extends BasePlugin {
title: '选项', title: '选项',
body: [ body: [
[ [
{ getSchemaTpl('combo-container', {
label: '列配置', label: '列配置',
mode: 'normal',
name: 'columns', name: 'columns',
type: 'combo', type: 'combo',
multiple: true, multiple: true,
@ -175,16 +173,17 @@ export class MatrixControlPlugin extends BasePlugin {
placeholder: '列说明' placeholder: '列说明'
} }
] ]
}, }),
{ {
name: 'rowLabel', name: 'rowLabel',
label: '行标题文字', label: '行标题文字',
type: 'input-text' type: 'input-text'
}, },
{ getSchemaTpl('combo-container', {
label: '行配置', label: '行配置',
name: 'rows', name: 'rows',
type: 'combo', type: 'combo',
mode: 'normal',
multiple: true, multiple: true,
scaffold: { scaffold: {
label: '行说明' label: '行说明'
@ -197,16 +196,12 @@ export class MatrixControlPlugin extends BasePlugin {
placeholder: '行说明' placeholder: '行说明'
} }
] ]
} })
], ],
getSchemaTpl('apiControl', { getSchemaTpl('apiControl', {
label: tipedLabel('接口', '获取矩阵数据接口'), label: tipedLabel('接口', '获取矩阵数据接口'),
name: 'source', name: 'source',
mode: 'horizontal', mode: 'normal'
horizontal: {
left: 4,
justify: true
}
}) })
// getSchemaTpl('value') // getSchemaTpl('value')
] ]

View File

@ -24,7 +24,7 @@ export class NestedSelectControlPlugin extends BasePlugin {
isBaseComponent = true; isBaseComponent = true;
icon = 'fa fa-indent'; icon = 'fa fa-indent';
pluginIcon = 'nested-select-plugin'; pluginIcon = 'nested-select-plugin';
description = `适用于选项中含有子项,可通过<code>source</code>拉取选项,支持多选`; description = '适用于选项中含有子项,可通过 source 拉取选项,支持多选';
docLink = '/amis/zh-CN/components/form/nestedselect'; docLink = '/amis/zh-CN/components/form/nestedselect';
tags = ['表单项']; tags = ['表单项'];
scaffold = { scaffold = {
@ -305,9 +305,7 @@ export class NestedSelectControlPlugin extends BasePlugin {
}, },
{ {
title: '选项', title: '选项',
body: [ body: [getSchemaTpl('treeOptionControl')]
getSchemaTpl('treeOptionControl')
]
}, },
getSchemaTpl('status', {isFormItem: true}), getSchemaTpl('status', {isFormItem: true}),
getSchemaTpl('validation', { getSchemaTpl('validation', {

View File

@ -27,7 +27,8 @@ export class PickerControlPlugin extends BasePlugin {
isBaseComponent = true; isBaseComponent = true;
icon = 'fa fa-window-restore'; icon = 'fa fa-window-restore';
pluginIcon = 'picker-plugin'; pluginIcon = 'picker-plugin';
description = `通过<code>pickerSchema</code>配置可供选取的数据源进行选择需要的数据,支持多选`; description =
'通过 pickerSchema 配置可供选取的数据源进行选择需要的数据,支持多选';
docLink = '/amis/zh-CN/components/form/picker'; docLink = '/amis/zh-CN/components/form/picker';
tags = ['表单项']; tags = ['表单项'];
scaffold = { scaffold = {
@ -72,13 +73,29 @@ export class PickerControlPlugin extends BasePlugin {
type: 'string', type: 'string',
title: '选中值' title: '选中值'
}, },
'event.data.option': { 'event.data.selectedItems': {
type: 'string', type: 'string',
title: '选中的行数据' title: '选中的行数据'
} }
} }
} }
] ]
},
{
eventName: 'itemclick',
eventLabel: '点击选项',
description: '选项被点击时触发',
dataSchema: [
{
type: 'object',
properties: {
'event.data.item': {
type: 'object',
title: '所点击的选项'
}
}
}
]
} }
]; ];

View File

@ -4,10 +4,7 @@ import {BasePlugin, BaseEventContext} from 'amis-editor-core';
import {ValidatorTag} from '../../validator'; import {ValidatorTag} from '../../validator';
import {getEventControlConfig} from '../../renderer/event-control/helper'; import {getEventControlConfig} from '../../renderer/event-control/helper';
import { import {RendererPluginAction, RendererPluginEvent} from 'amis-editor-core';
RendererPluginAction,
RendererPluginEvent
} from 'amis-editor-core';
export class RadiosControlPlugin extends BasePlugin { export class RadiosControlPlugin extends BasePlugin {
// 关联渲染器名字 // 关联渲染器名字
@ -21,7 +18,7 @@ export class RadiosControlPlugin extends BasePlugin {
isBaseComponent = true; isBaseComponent = true;
icon = 'fa fa-dot-circle-o'; icon = 'fa fa-dot-circle-o';
pluginIcon = 'radios-plugin'; pluginIcon = 'radios-plugin';
description = `通过<code>options</code>配置选项,可通过<code>source</code>拉取选项`; description = '通过 options 配置选项,可通过 source 拉取选项';
docLink = '/amis/zh-CN/components/form/radios'; docLink = '/amis/zh-CN/components/form/radios';
tags = ['表单项']; tags = ['表单项'];
scaffold = { scaffold = {
@ -70,6 +67,10 @@ export class RadiosControlPlugin extends BasePlugin {
'event.data.value': { 'event.data.value': {
type: 'string', type: 'string',
title: '选中值' title: '选中值'
},
'event.data.items': {
type: 'array',
title: '选项集合'
} }
} }
} }

View File

@ -19,7 +19,7 @@ export class SelectControlPlugin extends BasePlugin {
isBaseComponent = true; isBaseComponent = true;
icon = 'fa fa-th-list'; icon = 'fa fa-th-list';
pluginIcon = 'select-plugin'; pluginIcon = 'select-plugin';
description = `支持多选,输入提示,可使用<code>source</code>获取选项`; description = '支持多选,输入提示,可使用 source 获取选项';
docLink = '/amis/zh-CN/components/form/select'; docLink = '/amis/zh-CN/components/form/select';
tags = ['表单项']; tags = ['表单项'];
scaffold = { scaffold = {
@ -67,6 +67,10 @@ export class SelectControlPlugin extends BasePlugin {
'event.data.value': { 'event.data.value': {
type: 'string', type: 'string',
title: '选中值' title: '选中值'
},
'event.data.items': {
type: 'array',
title: '选项集合'
} }
} }
} }
@ -83,6 +87,10 @@ export class SelectControlPlugin extends BasePlugin {
'event.data.value': { 'event.data.value': {
type: 'string', type: 'string',
title: '选中值' title: '选中值'
},
'event.data.items': {
type: 'array',
title: '选项集合'
} }
} }
} }
@ -99,6 +107,10 @@ export class SelectControlPlugin extends BasePlugin {
'event.data.value': { 'event.data.value': {
type: 'string', type: 'string',
title: '选中值' title: '选中值'
},
'event.data.items': {
type: 'array',
title: '选项集合'
} }
} }
} }
@ -116,7 +128,7 @@ export class SelectControlPlugin extends BasePlugin {
type: 'object', type: 'object',
title: '新增的选项' title: '新增的选项'
}, },
'event.data.options': { 'event.data.items': {
type: 'array', type: 'array',
title: '选项集合' title: '选项集合'
} }
@ -136,7 +148,7 @@ export class SelectControlPlugin extends BasePlugin {
type: 'object', type: 'object',
title: '编辑的选项' title: '编辑的选项'
}, },
'event.data.options': { 'event.data.items': {
type: 'array', type: 'array',
title: '选项集合' title: '选项集合'
} }
@ -156,7 +168,7 @@ export class SelectControlPlugin extends BasePlugin {
type: 'object', type: 'object',
title: '删除的选项' title: '删除的选项'
}, },
'event.data.options': { 'event.data.items': {
type: 'array', type: 'array',
title: '选项集合' title: '选项集合'
} }

View File

@ -18,7 +18,7 @@ export class StaticControlPlugin extends BasePlugin {
isBaseComponent = true; isBaseComponent = true;
icon = 'fa fa-info'; icon = 'fa fa-info';
pluginIcon = 'static-plugin'; pluginIcon = 'static-plugin';
description = `纯用来展示数据,可用来展示<code>json、date、image、progress</code>等数据`; description = '纯用来展示数据,可用来展示 json、date、image、progress 等数据';
docLink = '/amis/zh-CN/components/form/static'; docLink = '/amis/zh-CN/components/form/static';
tags = ['表单项']; tags = ['表单项'];
scaffold = { scaffold = {
@ -58,13 +58,14 @@ export class StaticControlPlugin extends BasePlugin {
getSchemaTpl('label'), getSchemaTpl('label'),
// getSchemaTpl('value'), // getSchemaTpl('value'),
getSchemaTpl('valueFormula', { getSchemaTpl('valueFormula', {
rendererSchema: { // TODO: 因为 formulaControl 未适配 static 这类特殊组件,暂不传递 rendererSchema属性让其内部先使用 InputBox
...context?.schema, // 待后续 formulaControl 优化之后再重新调整适配
type: 'textarea', // 改用多行文本编辑 // rendererSchema: {
value: context?.schema.tpl // 避免默认值丢失 // ...context?.schema,
}, // type: 'textarea', // 改用多行文本编辑
mode: 'vertical', // 改成上下展示模式 // value: context?.schema.tpl // 避免默认值丢失
name: 'tpl' // },
mode: 'vertical' // 改成上下展示模式
}), }),
getSchemaTpl('switch', { getSchemaTpl('switch', {
name: 'quickEdit', name: 'quickEdit',
@ -95,8 +96,13 @@ export class StaticControlPlugin extends BasePlugin {
name: 'quickEdit.saveImmediately', name: 'quickEdit.saveImmediately',
label: '立即保存', label: '立即保存',
visibleOn: 'data.quickEdit', visibleOn: 'data.quickEdit',
description: '开启后修改即提交,而不是标记修改批量提交。', labelRemark: {
descriptionClassName: 'help-block m-b-none', className: 'm-l-xs',
trigger: 'click',
rootClose: true,
placement: 'left',
content: '开启后修改即提交,而不是标记修改批量提交。'
},
pipeIn: (value: any) => !!value pipeIn: (value: any) => !!value
}), }),
getSchemaTpl('apiControl', { getSchemaTpl('apiControl', {

View File

@ -3,10 +3,7 @@ import {registerEditorPlugin, tipedLabel} from 'amis-editor-core';
import {BasePlugin, BaseEventContext} from 'amis-editor-core'; import {BasePlugin, BaseEventContext} from 'amis-editor-core';
import {ValidatorTag} from '../../validator'; import {ValidatorTag} from '../../validator';
import {getEventControlConfig} from '../../renderer/event-control/helper'; import {getEventControlConfig} from '../../renderer/event-control/helper';
import type { import type {RendererPluginAction, RendererPluginEvent} from 'amis-editor-core';
RendererPluginAction,
RendererPluginEvent
} from 'amis-editor-core';
export class SwitchControlPlugin extends BasePlugin { export class SwitchControlPlugin extends BasePlugin {
// 关联渲染器名字 // 关联渲染器名字
@ -20,12 +17,13 @@ export class SwitchControlPlugin extends BasePlugin {
isBaseComponent = true; isBaseComponent = true;
icon = 'fa fa-toggle-on'; icon = 'fa fa-toggle-on';
pluginIcon = 'switch-plugin'; pluginIcon = 'switch-plugin';
description = `开关控件`; description = '开关控件';
docLink = '/amis/zh-CN/components/form/switch'; docLink = '/amis/zh-CN/components/form/switch';
tags = ['表单项']; tags = ['表单项'];
scaffold = { scaffold = {
type: 'switch', type: 'switch',
option: '开关', label: '开关',
option: '说明',
name: 'switch', name: 'switch',
falseValue: false, falseValue: false,
trueValue: true trueValue: true

View File

@ -16,7 +16,7 @@ export class TabsTransferPlugin extends BasePlugin {
isBaseComponent = true; isBaseComponent = true;
icon = 'fa fa-th-list'; icon = 'fa fa-th-list';
pluginIcon = 'tabs-transfer-plugin'; pluginIcon = 'tabs-transfer-plugin';
description = `组合穿梭器组件`; description = '组合穿梭器组件';
docLink = '/amis/zh-CN/components/form/transfer'; docLink = '/amis/zh-CN/components/form/transfer';
tags = ['表单项']; tags = ['表单项'];
scaffold = { scaffold = {
@ -144,22 +144,10 @@ export class TabsTransferPlugin extends BasePlugin {
'event.data.value': { 'event.data.value': {
type: 'string', type: 'string',
title: '选中值' title: '选中值'
} },
} 'event.data.items': {
} type: 'array',
] title: '选项集合'
},
{
eventName: 'selectAll',
eventLabel: '全选',
description: '选中所有选项',
dataSchema: [
{
type: 'object',
properties: {
'event.data.value': {
type: 'string',
title: '选中值'
} }
} }
} }
@ -279,12 +267,12 @@ export class TabsTransferPlugin extends BasePlugin {
getSchemaTpl('label'), getSchemaTpl('label'),
getSchemaTpl('searchable'), getSchemaTpl('searchable'),
getSchemaTpl('api', { getSchemaTpl('api', {
label: '检索接口', label: '检索接口',
name: 'searchApi' name: 'searchApi'
}), }),
{ {
label: '查询时勾选展示模式', label: '查询时勾选展示模式',
name: 'searchResultMode', name: 'searchResultMode',
@ -309,16 +297,16 @@ export class TabsTransferPlugin extends BasePlugin {
} }
] ]
}, },
getSchemaTpl('sortable'), getSchemaTpl('sortable'),
getSchemaTpl('formulaControl', { getSchemaTpl('formulaControl', {
label: '左侧选项标题', label: '左侧选项标题',
name: 'selectTitle', name: 'selectTitle',
type: 'input-text', type: 'input-text',
inputClassName: 'is-inline ' inputClassName: 'is-inline '
}), }),
getSchemaTpl('formulaControl', { getSchemaTpl('formulaControl', {
label: '右侧结果标题', label: '右侧结果标题',
name: 'resultTitle', name: 'resultTitle',

View File

@ -5,10 +5,7 @@ import {BasePlugin, tipedLabel} from 'amis-editor-core';
import type {BaseEventContext} from 'amis-editor-core'; import type {BaseEventContext} from 'amis-editor-core';
import {ValidatorTag} from '../../validator'; import {ValidatorTag} from '../../validator';
import {getEventControlConfig} from '../../renderer/event-control/helper'; import {getEventControlConfig} from '../../renderer/event-control/helper';
import { import {RendererPluginAction, RendererPluginEvent} from 'amis-editor-core';
RendererPluginAction,
RendererPluginEvent
} from 'amis-editor-core';
export class TextareaControlPlugin extends BasePlugin { export class TextareaControlPlugin extends BasePlugin {
// 关联渲染器名字 // 关联渲染器名字
@ -21,7 +18,7 @@ export class TextareaControlPlugin extends BasePlugin {
isBaseComponent = true; isBaseComponent = true;
icon = 'fa fa-paragraph'; icon = 'fa fa-paragraph';
pluginIcon = 'textarea-plugin'; pluginIcon = 'textarea-plugin';
description = `支持换行输入`; description = '支持换行输入';
docLink = '/amis/zh-CN/components/form/textarea'; docLink = '/amis/zh-CN/components/form/textarea';
tags = ['表单项']; tags = ['表单项'];
scaffold = { scaffold = {

View File

@ -17,7 +17,7 @@ export class TransferPlugin extends BasePlugin {
isBaseComponent = true; isBaseComponent = true;
icon = 'fa fa-th-list'; icon = 'fa fa-th-list';
pluginIcon = 'transfer-plugin'; pluginIcon = 'transfer-plugin';
description = `穿梭器组件`; description = '穿梭器组件';
docLink = '/amis/zh-CN/components/form/transfer'; docLink = '/amis/zh-CN/components/form/transfer';
tags = ['表单项']; tags = ['表单项'];
scaffold = { scaffold = {
@ -63,6 +63,10 @@ export class TransferPlugin extends BasePlugin {
'event.data.value': { 'event.data.value': {
type: 'string', type: 'string',
title: '选中值' title: '选中值'
},
'event.data.items': {
type: 'array',
title: '选项集合'
} }
} }
} }
@ -76,9 +80,9 @@ export class TransferPlugin extends BasePlugin {
{ {
type: 'object', type: 'object',
properties: { properties: {
'event.data': { 'event.data.items': {
type: 'array', type: 'array',
title: '选中值' title: '选项集合'
} }
} }
} }
@ -180,7 +184,6 @@ export class TransferPlugin extends BasePlugin {
}), }),
getSchemaTpl('labelRemark'), getSchemaTpl('labelRemark'),
getSchemaTpl('remark'), getSchemaTpl('remark'),
getSchemaTpl('placeholder'),
getSchemaTpl('description'), getSchemaTpl('description'),
getSchemaTpl('switch', { getSchemaTpl('switch', {
label: '统计数据', label: '统计数据',
@ -290,7 +293,10 @@ export class TransferPlugin extends BasePlugin {
options: [ options: [
{label: '列表形式', value: false}, {label: '列表形式', value: false},
{label: '跟随左侧', value: true} {label: '跟随左侧', value: true}
] ],
onChange: (value: any, origin: any, item: any, form: any) => {
form.setValueByName('sortable', !value ? true : undefined);
}
}, },
getSchemaTpl('switch', { getSchemaTpl('switch', {
label: tipedLabel( label: tipedLabel(

View File

@ -16,13 +16,14 @@ export class TreeSelectControlPlugin extends BasePlugin {
isBaseComponent = true; isBaseComponent = true;
icon = 'fa fa-chevron-down'; icon = 'fa fa-chevron-down';
pluginIcon = 'tree-select-plugin'; pluginIcon = 'tree-select-plugin';
description = `点击输入框,弹出树型选择框进行选择`; description = '点击输入框,弹出树型选择框进行选择';
docLink = '/amis/zh-CN/components/form/treeselect'; docLink = '/amis/zh-CN/components/form/treeselect';
tags = ['表单项']; tags = ['表单项'];
scaffold = { scaffold = {
type: 'tree-select', type: 'tree-select',
label: '树下拉框', label: '树下拉框',
name: 'tree-select', name: 'tree-select',
clearable: false,
options: [ options: [
{ {
label: '选项A', label: '选项A',
@ -89,7 +90,7 @@ export class TreeSelectControlPlugin extends BasePlugin {
type: 'object', type: 'object',
title: '新增的选项信息' title: '新增的选项信息'
}, },
'event.data.options': { 'event.data.items': {
type: 'array', type: 'array',
title: '选项集合' title: '选项集合'
} }
@ -109,7 +110,7 @@ export class TreeSelectControlPlugin extends BasePlugin {
type: 'object', type: 'object',
title: '编辑的选项信息' title: '编辑的选项信息'
}, },
'event.data.options': { 'event.data.items': {
type: 'array', type: 'array',
title: '选项集合' title: '选项集合'
} }
@ -129,7 +130,7 @@ export class TreeSelectControlPlugin extends BasePlugin {
type: 'object', type: 'object',
title: '删除的选项信息' title: '删除的选项信息'
}, },
'event.data.options': { 'event.data.items': {
type: 'array', type: 'array',
title: '选项集合' title: '选项集合'
} }
@ -252,6 +253,7 @@ export class TreeSelectControlPlugin extends BasePlugin {
panelBodyCreator = (context: BaseEventContext) => { panelBodyCreator = (context: BaseEventContext) => {
const renderer: any = context.info.renderer; const renderer: any = context.info.renderer;
return getSchemaTpl('tabs', [ return getSchemaTpl('tabs', [
{ {
title: '属性', title: '属性',
@ -270,8 +272,7 @@ export class TreeSelectControlPlugin extends BasePlugin {
justify: true, justify: true,
left: 8 left: 8
}, },
inputClassName: 'is-inline ', inputClassName: 'is-inline '
value: true
}), }),
getSchemaTpl('searchable'), getSchemaTpl('searchable'),
getSchemaTpl('multiple', { getSchemaTpl('multiple', {
@ -389,11 +390,6 @@ export class TreeSelectControlPlugin extends BasePlugin {
{ {
title: '高级', title: '高级',
body: [ body: [
getSchemaTpl('valueFormula', {
name: 'highlightTxt',
label: '高亮节点字符',
type: 'input-text'
}),
{ {
type: 'ae-Switch-More', type: 'ae-Switch-More',
mode: 'normal', mode: 'normal',
@ -422,26 +418,27 @@ export class TreeSelectControlPlugin extends BasePlugin {
), ),
name: 'hideNodePathLabel' name: 'hideNodePathLabel'
}), }),
{ // tree-select 该组件目前无此配置
type: 'ae-Switch-More', // {
mode: 'normal', // type: 'ae-Switch-More',
name: 'hideRoot', // mode: 'normal',
label: '显示顶级节点', // name: 'hideRoot',
value: true, // label: '显示顶级节点',
trueValue: false, // value: true,
falseValue: true, // trueValue: false,
formType: 'extend', // falseValue: true,
form: { // formType: 'extend',
body: [ // form: {
{ // body: [
type: 'input-text', // {
label: '节点文案', // type: 'input-text',
value: '顶级', // label: '节点文案',
name: 'rootLabel' // value: '顶级',
} // name: 'rootLabel'
] // }
} // ]
}, // }
// },
getSchemaTpl('switch', { getSchemaTpl('switch', {
label: '显示节点图标', label: '显示节点图标',
name: 'showIcon', name: 'showIcon',

View File

@ -17,7 +17,7 @@ export class UUIDControlPlugin extends BasePlugin {
isBaseComponent = true; isBaseComponent = true;
icon = 'fa fa-eye-slash'; icon = 'fa fa-eye-slash';
pluginIcon = 'uuid-plugin'; pluginIcon = 'uuid-plugin';
description = `自动生成的 UUID`; description = '自动生成的 UUID';
docLink = '/amis/zh-CN/components/form/uuid'; docLink = '/amis/zh-CN/components/form/uuid';
tags = ['表单项']; tags = ['表单项'];
scaffold = { scaffold = {

View File

@ -165,7 +165,7 @@ export class HBoxPlugin extends BasePlugin {
] ]
}, },
{ getSchemaTpl('combo-container', {
name: 'columns', name: 'columns',
label: '列集合', label: '列集合',
type: 'combo', type: 'combo',
@ -188,7 +188,7 @@ export class HBoxPlugin extends BasePlugin {
label: '' label: ''
}) })
] ]
}, }),
getSchemaTpl('fieldSet', { getSchemaTpl('fieldSet', {
title: '水平对齐', title: '水平对齐',
collapsable: false, collapsable: false,

View File

@ -66,12 +66,10 @@ export class NavPlugin extends BasePlugin {
required: true required: true
}, },
{ getSchemaTpl('icon', {
type: 'icon-picker',
name: 'icon', name: 'icon',
label: '图标', label: '图标'
className: 'fix-icon-picker-overflow' }),
},
{ {
type: 'group', type: 'group',

View File

@ -147,7 +147,10 @@ export class ActionPlugin extends BasePlugin {
name: 'dialog', name: 'dialog',
pipeIn: defaultValue({ pipeIn: defaultValue({
title: '弹框标题', title: '弹框标题',
body: '<p>对,你刚刚点击了</p>' body: '<p>对,你刚刚点击了</p>',
showCloseButton: true,
showErrorMsg: true,
showLoading: true
}), }),
asFormItem: true, asFormItem: true,
children: ({value, onChange, data}: any) => children: ({value, onChange, data}: any) =>
@ -406,7 +409,7 @@ export class ActionPlugin extends BasePlugin {
) { ) {
toolbars.push({ toolbars.push({
iconSvg: 'dialog', iconSvg: 'dialog',
tooltip: `配置弹框内容`, tooltip: '配置弹框内容',
placement: 'bottom', placement: 'bottom',
onClick: () => this.editDetail(id) onClick: () => this.editDetail(id)
}); });

View File

@ -50,7 +50,7 @@ export class PagePlugin extends BasePlugin {
events: RendererPluginEvent[] = [ events: RendererPluginEvent[] = [
{ {
eventName: 'inited', eventName: 'inited',
eventLabel: '初始化完成', eventLabel: '初始化接口请求成功',
description: '远程初始化接口请求成功时触发', description: '远程初始化接口请求成功时触发',
dataSchema: [ dataSchema: [
{ {
@ -58,7 +58,7 @@ export class PagePlugin extends BasePlugin {
properties: { properties: {
'event.data': { 'event.data': {
type: 'object', type: 'object',
title: '远程请求返回的初始化数据' title: '初始化接口请求成功返回的数据'
} }
} }
} }
@ -265,7 +265,7 @@ export class PagePlugin extends BasePlugin {
className: 'p-none', className: 'p-none',
body: [ body: [
getSchemaTpl('collapseGroup', [ getSchemaTpl('collapseGroup', [
...getSchemaTpl('style:common'), ...getSchemaTpl('style:common', ['layout']),
getSchemaTpl('style:classNames', { getSchemaTpl('style:classNames', {
isFormItem: false, isFormItem: false,
schema: [ schema: [

View File

@ -19,6 +19,7 @@ export class PaginationPlugin extends BasePlugin {
// 组件名称 // 组件名称
name = '分页组件'; name = '分页组件';
isBaseComponent = true; isBaseComponent = true;
disabledRendererPlugin = true;
description = '分页组件,可以对列表进行分页展示,提高页面性能'; description = '分页组件,可以对列表进行分页展示,提高页面性能';
tags = ['容器']; tags = ['容器'];
icon = 'fa fa-window-minimize'; icon = 'fa fa-window-minimize';

View File

@ -214,7 +214,7 @@ export class ProgressPlugin extends BasePlugin {
form.setValueByName('stripe', value === 'stripe'); form.setValueByName('stripe', value === 'stripe');
} }
}, },
{ getSchemaTpl('combo-container', {
name: 'map', name: 'map',
type: 'combo', type: 'combo',
mode: 'normal', mode: 'normal',
@ -250,7 +250,7 @@ export class ProgressPlugin extends BasePlugin {
pipeIn: (value: any) => { pipeIn: (value: any) => {
return Array.isArray(value) ? value : []; return Array.isArray(value) ? value : [];
} }
} })
] ]
}, },
getSchemaTpl('style:classNames', { getSchemaTpl('style:classNames', {

View File

@ -45,7 +45,7 @@ export class StepsPlugin extends BasePlugin {
{ {
title: '常规', title: '常规',
body: [ body: [
{ getSchemaTpl('combo-container', {
name: 'steps', name: 'steps',
label: '步骤列表', label: '步骤列表',
type: 'combo', type: 'combo',
@ -76,7 +76,7 @@ export class StepsPlugin extends BasePlugin {
placeholder: '描述' placeholder: '描述'
} }
] ]
}, }),
{ {
name: 'value', name: 'value',
type: 'input-text', type: 'input-text',

View File

@ -25,27 +25,28 @@ import {getEventControlConfig} from '../renderer/event-control/helper';
import {SchemaObject} from 'amis/lib/Schema'; import {SchemaObject} from 'amis/lib/Schema';
import {getArgsWrapper} from '../renderer/event-control/helper'; import {getArgsWrapper} from '../renderer/event-control/helper';
export class TableV2Plugin extends BasePlugin { export class Table2Plugin extends BasePlugin {
// 关联渲染器名字 // 关联渲染器名字
rendererName = 'table-v2'; rendererName = 'table2';
$schema = '/schemas/TableSchema.json'; $schema = '/schemas/TableSchema.json';
// 组件名称 // 组件名称
name = '表格V2'; name = '表格2';
isBaseComponent = true; isBaseComponent = true;
panelJustify = true; panelJustify = true;
disabledRendererPlugin = true;
description = description =
'用来展示表格数据,可以配置列信息,然后关联数据便能完成展示。支持嵌套、超级表头、列固定、表头固顶、合并单元格等等。当前组件需要配置数据源,不自带数据拉取,请优先使用 「CRUD」 组件。'; '用来展示表格数据,可以配置列信息,然后关联数据便能完成展示。支持嵌套、超级表头、列固定、表头固顶、合并单元格等等。当前组件需要配置数据源,不自带数据拉取,请优先使用 「CRUD」 组件。';
docLink = '/amis/zh-CN/components/table-v2'; docLink = '/amis/zh-CN/components/table2';
icon = 'fa fa-table'; icon = 'fa fa-table';
scaffold: SchemaObject = { scaffold: SchemaObject = {
type: 'table-v2', type: 'table2',
columns: [ columns: [
{ {
title: '列信息', title: '列信息',
key: 'a' name: 'a'
} }
], ],
@ -63,7 +64,7 @@ export class TableV2Plugin extends BasePlugin {
]; ];
previewSchema: any = { previewSchema: any = {
type: 'table-v2', type: 'table2',
className: 'text-left m-b-none', className: 'text-left m-b-none',
items: [ items: [
{a: 1, b: 2, c: 9}, {a: 1, b: 2, c: 9},
@ -73,11 +74,11 @@ export class TableV2Plugin extends BasePlugin {
columns: [ columns: [
{ {
title: 'A', title: 'A',
key: 'a' name: 'a'
}, },
{ {
title: 'B', title: 'B',
key: 'b' name: 'b'
} }
] ]
}; };
@ -100,7 +101,7 @@ export class TableV2Plugin extends BasePlugin {
}, },
{ {
type: 'input-text', type: 'input-text',
name: 'key', name: 'name',
placeholder: '绑定字段名' placeholder: '绑定字段名'
}, },
{ {
@ -325,23 +326,24 @@ export class TableV2Plugin extends BasePlugin {
const columns: EditorNodeType = node.children.find( const columns: EditorNodeType = node.children.find(
item => item.isRegion && item.region === 'columns' item => item.isRegion && item.region === 'columns'
); );
if (columns) {
for (let current of columns.children) { for (let current of columns.children) {
const schema = current.schema; const schema = current.schema;
if (schema && schema.key) { if (schema && schema.key) {
itemsSchema.properties[schema.key] = current.info?.plugin itemsSchema.properties[schema.key] = current.info?.plugin
?.buildDataSchemas ?.buildDataSchemas
? await current.info.plugin.buildDataSchemas(current, region) ? await current.info.plugin.buildDataSchemas(current, region)
: { : {
type: 'string', type: 'string',
title: schema.label || schema.title, title: schema.label || schema.title,
description: schema.description description: schema.description
}; };
}
} }
} }
const result: any = { const result: any = {
$id: 'table-v2', $id: 'table2',
type: 'object', type: 'object',
properties: { properties: {
items: { items: {
@ -821,8 +823,8 @@ export class TableV2Plugin extends BasePlugin {
if (Array.isArray(props.columns)) { if (Array.isArray(props.columns)) {
props.columns.forEach((column: any) => { props.columns.forEach((column: any) => {
if (column.key) { if (column.name) {
setVariable(mockedData, column.key, mockValue(column)); setVariable(mockedData, column.name, mockValue(column));
} }
}); });
} }
@ -869,7 +871,7 @@ export class TableV2Plugin extends BasePlugin {
if ( if (
!schema.$$id && !schema.$$id &&
['crud', 'crud2'].includes(schema.$$editor?.renderer.name) && ['crud', 'crud2'].includes(schema.$$editor?.renderer.name) &&
renderer.name === 'table-v2' renderer.name === 'table2'
) { ) {
return { return {
...({id: schema.$$editor.id} as any), ...({id: schema.$$editor.id} as any),
@ -904,4 +906,4 @@ export class TableV2Plugin extends BasePlugin {
} }
} }
registerEditorPlugin(TableV2Plugin); registerEditorPlugin(Table2Plugin);

View File

@ -1,6 +1,6 @@
import {Button, Icon} from 'amis'; import {Button, Icon} from 'amis';
import React from 'react'; import React from 'react';
import {FormItemProps, getVariable} from 'amis-core'; import {getVariable} from 'amis-core';
import { import {
BasePlugin, BasePlugin,
@ -20,7 +20,7 @@ import {TabsSchema} from 'amis/lib/renderers/Tabs';
import {SchemaObject} from 'amis/lib/Schema'; import {SchemaObject} from 'amis/lib/Schema';
import {remarkTpl} from '../component/BaseControl'; import {remarkTpl} from '../component/BaseControl';
export class TableCellV2Plugin extends BasePlugin { export class TableCell2Plugin extends BasePlugin {
panelTitle = '列配置'; panelTitle = '列配置';
panelIcon = 'fa fa-columns'; panelIcon = 'fa fa-columns';
@ -28,7 +28,7 @@ export class TableCellV2Plugin extends BasePlugin {
const {context, data} = event.context; const {context, data} = event.context;
if ( if (
!context.node.parent?.parent?.type || !context.node.parent?.parent?.type ||
context.node.parent.parent.type !== 'table-v2' context.node.parent.parent.type !== 'table2'
) { ) {
return; return;
} }
@ -42,7 +42,7 @@ export class TableCellV2Plugin extends BasePlugin {
? false ? false
: { : {
sameName: context.info.renderer.isFormItem ? 'name' : undefined, sameName: context.info.renderer.isFormItem ? 'name' : undefined,
name: 'key', name: 'name',
type: 'ae-DataBindingControl', type: 'ae-DataBindingControl',
label: '列字段', label: '列字段',
onBindingChange( onBindingChange(
@ -557,7 +557,6 @@ export class TableCellV2Plugin extends BasePlugin {
const parent = dom.parentElement?.parentElement; const parent = dom.parentElement?.parentElement;
const groupId = parent?.getAttribute('data-group-id'); const groupId = parent?.getAttribute('data-group-id');
const wrapper = dom.closest('table')!.parentElement?.parentElement; const wrapper = dom.closest('table')!.parentElement?.parentElement;
return [].slice.call( return [].slice.call(
wrapper?.querySelectorAll( wrapper?.querySelectorAll(
`th[data-group-id="${groupId}"], `th[data-group-id="${groupId}"],
@ -585,4 +584,4 @@ export class TableCellV2Plugin extends BasePlugin {
} }
} }
registerEditorPlugin(TableCellV2Plugin); registerEditorPlugin(TableCell2Plugin);

View File

@ -185,7 +185,7 @@ export class TableViewPlugin extends BasePlugin {
body: [ body: [
getSchemaTpl('collapseGroup', [ getSchemaTpl('collapseGroup', [
{ {
title: '常用', title: '基本',
body: [ body: [
{ {
label: '标题', label: '标题',

View File

@ -74,7 +74,7 @@ export class TabsPlugin extends BasePlugin {
{ {
type: 'object', type: 'object',
properties: { properties: {
value: { 'event.data.value': {
type: 'string', type: 'string',
title: '选项卡索引' title: '选项卡索引'
} }
@ -87,13 +87,12 @@ export class TabsPlugin extends BasePlugin {
actions = [ actions = [
{ {
actionType: 'changeActiveKey', actionType: 'changeActiveKey',
actionLabel: '修改激活tab值', actionLabel: '激活指定选项卡',
description: '修改当前激活tab项的key', description: '修改当前激活tab项的key',
config: ['activeKey'], config: ['activeKey'],
desc: (info: any) => { descDetail: (info: any) => {
return ( return (
<div> <div>
<span className="variable-right">{info?.__rendererLabel}</span>
<span className="variable-left variable-right"> <span className="variable-left variable-right">
{info?.args?.activeKey} {info?.args?.activeKey}
@ -164,8 +163,9 @@ export class TabsPlugin extends BasePlugin {
), ),
type: 'input-text', type: 'input-text',
name: 'activeKey', name: 'activeKey',
pipeOut: (data: string) => data === '' || isNaN(Number(data)) ? data : Number(data) pipeOut: (data: string) =>
}, data === '' || isNaN(Number(data)) ? data : Number(data)
}
] ]
}, },
getSchemaTpl('status'), getSchemaTpl('status'),

View File

@ -20,8 +20,9 @@ export class TimelinePlugin extends BasePlugin {
label: '时间轴', label: '时间轴',
name: 'timeline', name: 'timeline',
items: [ items: [
{time: '2012-12-21', title: '节点数据'}, {time: '2012-12-21', title: '节点示例数据'},
{time: '2012-12-24', title: '节点数据'} {time: '2012-12-24', title: '节点示例数据'},
{time: '2012-12-27', title: '节点示例数据'}
] ]
}; };
previewSchema = { previewSchema = {

View File

@ -59,7 +59,7 @@ export class TooltipWrapperPlugin extends BasePlugin {
body: [ body: [
getSchemaTpl('collapseGroup', [ getSchemaTpl('collapseGroup', [
{ {
title: '常用', title: '基本',
body: [ body: [
{ {
type: 'input-text', type: 'input-text',
@ -205,7 +205,7 @@ export class TooltipWrapperPlugin extends BasePlugin {
Array.isArray(value) ? value[0] || 0 : 0, Array.isArray(value) ? value[0] || 0 : 0,
pipeOut: (value: any, oldValue: any, data: any) => [ pipeOut: (value: any, oldValue: any, data: any) => [
value, value,
data.offset[1] data.offset?.[1] || 0
] ]
}, },
{ {
@ -215,7 +215,7 @@ export class TooltipWrapperPlugin extends BasePlugin {
pipeIn: (value: any) => pipeIn: (value: any) =>
Array.isArray(value) ? value[1] || 0 : 0, Array.isArray(value) ? value[1] || 0 : 0,
pipeOut: (value: any, oldValue: any, data: any) => [ pipeOut: (value: any, oldValue: any, data: any) => [
data.offset[0], data.offset?.[0] || 0,
value value
] ]
} }

View File

@ -62,7 +62,13 @@ export class VideoPlugin extends BasePlugin {
getSchemaTpl('switch', { getSchemaTpl('switch', {
name: 'isLive', name: 'isLive',
label: '直播流', label: '直播流',
description: '如果是直播流,请勾选,否则有可能不能正常播放。' labelRemark: {
className: 'm-l-xs',
trigger: 'click',
rootClose: true,
placement: 'left',
content: '如果是直播流,请勾选,否则有可能不能正常播放。'
}
}) })
] ]
}, },

View File

@ -1,4 +1,8 @@
import {EditorNodeType, jsonToJsonSchema, registerEditorPlugin} from 'amis-editor-core'; import {
EditorNodeType,
jsonToJsonSchema,
registerEditorPlugin
} from 'amis-editor-core';
import { import {
BaseEventContext, BaseEventContext,
BasePlugin, BasePlugin,
@ -85,7 +89,7 @@ export class WizardPlugin extends BasePlugin {
events: RendererPluginEvent[] = [ events: RendererPluginEvent[] = [
{ {
eventName: 'inited', eventName: 'inited',
eventLabel: '初始化完成', eventLabel: '初始化接口请求成功',
description: '远程初始化接口请求成功时触发', description: '远程初始化接口请求成功时触发',
dataSchema: [ dataSchema: [
{ {
@ -93,7 +97,7 @@ export class WizardPlugin extends BasePlugin {
properties: { properties: {
'event.data': { 'event.data': {
type: 'object', type: 'object',
title: 'initApi 远程请求返回的初始化数据' title: '初始化接口请求成功返回的数据'
} }
} }
} }

View File

@ -39,7 +39,7 @@ export class WrapperPlugin extends BasePlugin {
body: [ body: [
getSchemaTpl('collapseGroup', [ getSchemaTpl('collapseGroup', [
{ {
title: '常用', title: '基本',
body: [ body: [
{ {
label: '内间距', label: '内间距',
@ -95,8 +95,7 @@ export class WrapperPlugin extends BasePlugin {
items: [ items: [
{ {
type: 'tpl', type: 'tpl',
tpl: tpl: '<span class="label label-default">子节点${index | plus}</span>'
'<span class="label label-default">子节点${index | plus}</span>'
} }
] ]
} }

View File

@ -5,12 +5,7 @@
import React from 'react'; import React from 'react';
import cx from 'classnames'; import cx from 'classnames';
import findIndex from 'lodash/findIndex'; import findIndex from 'lodash/findIndex';
import { import {FormControlProps, FormItem, TreeSelection} from 'amis';
FormControlProps,
FormItem,
TreeSelection
} from 'amis';
export interface ColumnControlProps extends FormControlProps { export interface ColumnControlProps extends FormControlProps {
className?: string; className?: string;
@ -24,7 +19,6 @@ export default class ColumnControl extends React.Component<
ColumnControlProps, ColumnControlProps,
ColumnsControlState ColumnsControlState
> { > {
constructor(props: any) { constructor(props: any) {
super(props); super(props);
@ -51,16 +45,22 @@ export default class ColumnControl extends React.Component<
render() { render() {
const {columns} = this.state; const {columns} = this.state;
const options = columns ? columns.map(c => ({value: c.key, label: c.title})) : []; const options = columns
const value = columns ? columns.filter(c => c.toggled !== false).map(c => ({value: c.key, label: c.title})) : [] ? columns.map(c => ({value: c.key, label: c.title}))
: [];
const value = columns
? columns
.filter(c => c.toggled !== false)
.map(c => ({value: c.key, label: c.title}))
: [];
return ( return (
<div className={cx('ae-ColumnControl')}> <div className={cx('ae-ColumnControl')}>
<TreeSelection <TreeSelection
options={options} options={options}
value={value} value={value}
onChange={(v: Array<any>) => this.onChange(v)}> onChange={(v: Array<any>) => this.onChange(v)}
</TreeSelection> ></TreeSelection>
</div> </div>
); );
} }

View File

@ -47,9 +47,7 @@ class DataPickerControl extends React.Component<FormControlProps> {
onChange={() => {}} onChange={() => {}}
header={''} header={''}
> >
{({onClick}: { {({onClick}: {onClick: (e: React.MouseEvent) => void}) => {
onClick: (e: React.MouseEvent) => void;
}) => {
return ( return (
<InputBox <InputBox
className="ae-InputVariable" className="ae-InputVariable"

View File

@ -312,13 +312,19 @@ export class DateShortCutControl extends React.PureComponent<
</header> </header>
{this.renderContent()} {this.renderContent()}
<div className={klass + '-footer'}> <div className={klass + '-footer'}>
{render('inner', { {render(
type: 'dropdown-button', 'inner',
label: '添加选项', {
closeOnClick: true, type: 'dropdown-button',
closeOnOutside: true, label: '添加选项',
buttons: optionList closeOnClick: true,
})} closeOnOutside: true,
buttons: optionList
},
{
popOverContainer: null // amis 渲染挂载节点会使用 this.target
}
)}
</div> </div>
</div> </div>
); );

View File

@ -236,12 +236,17 @@ export default class FeatureControl extends React.Component<
className: `${klass}-action`, className: `${klass}-action`,
btnClassName: `${klass}-action--btn`, btnClassName: `${klass}-action--btn`,
menuClassName: `${klass}-action--menus`, menuClassName: `${klass}-action--menus`,
buttons: this.state.unUseFeat.map(item => { buttons: this.state.unUseFeat.map(
return { item => {
label: item.label, return {
onClick: () => this.handleAdd(item) label: item.label,
}; onClick: () => this.handleAdd(item)
}) };
},
{
popOverContainer: null // amis 渲染挂载节点会使用 this.target
}
)
}); });
} }

View File

@ -236,6 +236,7 @@ export default class FormulaControl extends React.Component<
if (value === null || value === undefined) { if (value === null || value === undefined) {
return true; // 数值为空不进行类型识别 return true; // 数值为空不进行类型识别
} }
const {rendererSchema} = this.props;
const expectType = this.props.valueType; const expectType = this.props.valueType;
if (expectType === null || expectType === undefined) { if (expectType === null || expectType === undefined) {
@ -246,6 +247,16 @@ export default class FormulaControl extends React.Component<
const curData = this.getContextData(); const curData = this.getContextData();
if ( if (
rendererSchema.type === 'switch' &&
(rendererSchema.trueValue !== undefined ||
rendererSchema.falseValue !== undefined)
) {
// 开关类型组件单独处理
return (
rendererSchema.trueValue === value ||
rendererSchema.falseValue === value
);
} else if (
(expectType === 'number' && isNumber(value)) || (expectType === 'number' && isNumber(value)) ||
(expectType === 'boolean' && isBoolean(value)) || (expectType === 'boolean' && isBoolean(value)) ||
(expectType === 'object' && isPlainObject(value)) || (expectType === 'object' && isPlainObject(value)) ||

View File

@ -57,12 +57,26 @@ export default class OptionControl extends React.Component<
constructor(props: OptionControlProps) { constructor(props: OptionControlProps) {
super(props); super(props);
let source: 'custom' | 'api' | 'apicenter' = 'custom';
if (props.data.source) {
const api = props.data.source;
const url =
typeof api === 'string'
? api
: typeof api === 'object'
? api.url || ''
: '';
source = !url.indexOf('api://') ? 'apicenter' : 'api';
}
this.state = { this.state = {
options: this.transformOptions(props), options: this.transformOptions(props),
api: props.data.source, api: props.data.source,
labelField: props.data.labelField, labelField: props.data.labelField,
valueField: props.data.valueField, valueField: props.data.valueField,
source: props.data.source ? 'api' : 'custom' source
}; };
} }
@ -494,7 +508,6 @@ export default class OptionControl extends React.Component<
}, },
{ {
type: 'input-text', type: 'input-text',
name: 'label',
placeholder: '请输入显示文本', placeholder: '请输入显示文本',
label: '文本', label: '文本',
mode: 'horizontal', mode: 'horizontal',
@ -611,17 +624,23 @@ export default class OptionControl extends React.Component<
clearable={false} clearable={false}
onChange={(value: string) => this.handleEditLabel(index, value)} onChange={(value: string) => this.handleEditLabel(index, value)}
/> />
{render('dropdown', { {render(
type: 'dropdown-button', 'dropdown',
className: 'ae-OptionControlItem-dropdown', {
btnClassName: 'px-2', type: 'dropdown-button',
icon: 'fa fa-ellipsis-h', className: 'ae-OptionControlItem-dropdown',
hideCaret: true, btnClassName: 'px-2',
closeOnClick: true, icon: 'fa fa-ellipsis-h',
align: 'right', hideCaret: true,
menuClassName: 'ae-OptionControlItem-ulmenu', closeOnClick: true,
buttons: operationBtn align: 'right',
})} menuClassName: 'ae-OptionControlItem-ulmenu',
buttons: operationBtn
},
{
popOverContainer: null // amis 渲染挂载节点会使用 this.target
}
)}
</div> </div>
{editDom} {editDom}
</li> </li>

View File

@ -23,7 +23,6 @@ export interface StatusControlProps extends FormControlProps {
messages?: Pick<FormSchema, 'messages'>; messages?: Pick<FormSchema, 'messages'>;
} }
type StatusFormData = { type StatusFormData = {
statusType: number; statusType: number;
expression: string; expression: string;
@ -52,11 +51,11 @@ export class StatusControl extends React.Component<
const {data: ctx = {}, expressionName, name, trueValue} = this.props; const {data: ctx = {}, expressionName, name, trueValue} = this.props;
const formData: StatusFormData = { const formData: StatusFormData = {
statusType: 1, statusType: 1,
expression: '', expression: ''
}; };
if (ctx[expressionName] || ctx[expressionName]=== "") { if (ctx[expressionName] || ctx[expressionName] === '') {
formData.statusType = 2; formData.statusType = 2;
formData.expression = ctx[expressionName]; formData.expression = ctx[expressionName];
} }
return { return {
checked: checked:
@ -76,21 +75,17 @@ export class StatusControl extends React.Component<
handleSwitch(value: boolean) { handleSwitch(value: boolean) {
const {trueValue, falseValue} = this.props; const {trueValue, falseValue} = this.props;
this.setState({checked: value == trueValue ? true : false}, () => { this.setState({checked: value == trueValue ? true : false}, () => {
const {onBulkChange, expressionName, name} = this.props; const {onBulkChange, expressionName, name} = this.props;
onBulkChange && onBulkChange &&
onBulkChange({ onBulkChange({
[name]: value == trueValue ? trueValue : falseValue, [name]: value == trueValue ? trueValue : falseValue,
[expressionName]: undefined, [expressionName]: undefined
}); });
}); });
} }
@autobind @autobind
handleFormSubmit( handleFormSubmit(values: StatusFormData) {
values: StatusFormData
) {
const {onBulkChange, name, expressionName} = this.props; const {onBulkChange, name, expressionName} = this.props;
const data: Record<string, any> = { const data: Record<string, any> = {
[name]: undefined, [name]: undefined,
@ -110,7 +105,6 @@ export class StatusControl extends React.Component<
onBulkChange && onBulkChange(data); onBulkChange && onBulkChange(data);
} }
render() { render() {
const {className, data: ctx = {}, trueValue, falseValue, env} = this.props; const {className, data: ctx = {}, trueValue, falseValue, env} = this.props;
const {checked} = this.state; const {checked} = this.state;
@ -191,7 +185,7 @@ export class StatusControl extends React.Component<
label: '表达式', label: '表达式',
placeholder: `请输入${label}条件`, placeholder: `请输入${label}条件`,
visibleOn: 'this.statusType === 2' visibleOn: 'this.statusType === 2'
}, }
] ]
}, },
{ {

View File

@ -77,6 +77,9 @@ export default class TimelineItemControl extends React.Component<
data.items = items.map(item => ({...item})); data.items = items.map(item => ({...item}));
} }
if (source === 'api') { if (source === 'api') {
const {items, api} = this.state;
data.items = items.map(item => ({...item}));
data.source = api;
} }
onBulkChange && onBulkChange(data); onBulkChange && onBulkChange(data);
} }
@ -396,6 +399,7 @@ export default class TimelineItemControl extends React.Component<
renderOption(props: TimelineItem & {index: number}) { renderOption(props: TimelineItem & {index: number}) {
const {time, title, index} = props; const {time, title, index} = props;
const delDisabled = !(this.state.items.length > 2);
return ( return (
<li className="ae-TimelineItemControlItem" key={index}> <li className="ae-TimelineItemControlItem" key={index}>
<div className="ae-TimelineItemControlItem-Main"> <div className="ae-TimelineItemControlItem-Main">
@ -421,60 +425,66 @@ export default class TimelineItemControl extends React.Component<
} }
)} */} )} */}
{amisRender({ {amisRender(
type: 'dropdown-button', {
className: 'ae-TimelineItemControlItem-dropdown', type: 'dropdown-button',
btnClassName: 'px-2', className: 'ae-TimelineItemControlItem-dropdown',
icon: 'fa fa-ellipsis-h', btnClassName: 'px-2',
hideCaret: true, icon: 'fa fa-ellipsis-h',
closeOnClick: true, hideCaret: true,
align: 'right', closeOnClick: true,
menuClassName: 'ae-TimelineItemControlItem-ulmenu', align: 'right',
buttons: [ menuClassName: 'ae-TimelineItemControlItem-ulmenu',
{ buttons: [
type: 'action', {
className: 'ae-TimelineItemControlItem-action', type: 'action',
label: '编辑', className: 'ae-TimelineItemControlItem-action',
actionType: 'dialog', label: '编辑',
dialog: { actionType: 'dialog',
title: '节点配置', dialog: {
headerClassName: 'font-bold', title: '节点配置',
closeOnEsc: true, headerClassName: 'font-bold',
closeOnOutside: false, closeOnEsc: true,
showCloseButton: true, closeOnOutside: false,
body: [ showCloseButton: true,
{ body: [
type: 'form', {
wrapWithPanel: false, type: 'form',
wrapperComponent: 'div', wrapWithPanel: false,
resetAfterSubmit: true, wrapperComponent: 'div',
autoFocus: true, resetAfterSubmit: true,
preventEnterSubmit: true, autoFocus: true,
horizontal: { preventEnterSubmit: true,
justify: true, horizontal: {
left: 3, justify: true,
right: 9 left: 3,
}, right: 9
body: this.buildAddOrEditSchema(props), },
onSubmit: (e: any) => this.toggleEdit(e, index) body: this.buildAddOrEditSchema(props),
} onSubmit: (e: any) => this.toggleEdit(e, index)
] }
]
}
},
{
type: 'button',
className: 'ae-TimelineItemControlItem-action',
label: '复制',
onClick: () => this.toggleCopy(index)
},
{
type: 'button',
className: 'ae-TimelineItemControlItem-action',
label: '删除',
disabled: delDisabled,
onClick: () => this.toggleDelete(index)
} }
}, ]
{ },
type: 'button', {
className: 'ae-TimelineItemControlItem-action', popOverContainer: null // amis 渲染挂载节点会使用 this.target
label: '复制', }
onClick: () => this.toggleCopy(index) )}
},
{
type: 'button',
className: 'ae-TimelineItemControlItem-action',
label: '删除',
onClick: () => this.toggleDelete(index)
}
]
})}
</div> </div>
<div className="ae-TimelineItemControlItem-Main"> <div className="ae-TimelineItemControlItem-Main">
<InputBox <InputBox

View File

@ -285,13 +285,15 @@ function BaseOptionControl(Cmpt: React.JSXElementConstructor<any>) {
const renderInput = ( const renderInput = (
name: string, name: string,
placeholder: string, placeholder: string,
required: boolean = true required: boolean = true,
unique: boolean = false
) => { ) => {
return { return {
type: 'input-text', type: 'input-text',
name, name,
placeholder: placeholder, placeholder: placeholder,
required required,
unique
}; };
}; };
@ -412,17 +414,24 @@ export default class TransferTableOption extends React.Component<
this.handleChange(args[2].options, 'options'), this.handleChange(args[2].options, 'options'),
body: [ body: [
{ {
name: 'options', type: 'form',
type: 'combo', wrapWithPanel: false,
multiple: true, mode: 'normal',
draggable: true, body: [
addButtonText: '新增', {
value: options, name: 'options',
items: [ type: 'combo',
...columns.map((item: Option) => multiple: true,
renderInput(item.name, item.label ?? '') draggable: true,
), addButtonText: '新增',
renderInput('value', '值', true) value: options,
items: [
...columns.map((item: Option) =>
renderInput(item.name, item.label ?? '', false)
),
renderInput('value', '值', true, true)
]
}
] ]
} }
] ]
@ -437,6 +446,20 @@ export default class TransferTableOption extends React.Component<
const {data} = this.props; const {data} = this.props;
const {onBulkChange, onValueChange} = this.props; const {onBulkChange, onValueChange} = this.props;
data[type] = value; data[type] = value;
if (type === 'columns') {
const keys = value.map(item => item.name);
data.options = (data.options ?? []).map((item: Option) => {
return {
...keys.reduce(
(pv, cv) => {
pv[cv] = item[cv];
return pv;
},
{value: item.value}
)
};
});
}
onValueChange && onValueChange(type, data, onBulkChange); onValueChange && onValueChange(type, data, onBulkChange);
} }

View File

@ -347,35 +347,41 @@ export default class TreeOptionControl extends React.Component<
}} }}
/> />
<div className="ae-TreeOptionControlItem-btns"> <div className="ae-TreeOptionControlItem-btns">
{render('dropdown', { {render(
type: 'dropdown-button', 'dropdown',
className: 'ae-TreeOptionControlItem-dropdown fa-sm', {
btnClassName: 'px-2', type: 'dropdown-button',
icon: 'add', className: 'ae-TreeOptionControlItem-dropdown fa-sm',
hideCaret: true, btnClassName: 'px-2',
closeOnClick: true, icon: 'add',
trigger: 'hover', hideCaret: true,
align: 'right', closeOnClick: true,
menuClassName: 'ae-TreeOptionControlItem-ulmenu', trigger: 'hover',
buttons: [ align: 'right',
{ menuClassName: 'ae-TreeOptionControlItem-ulmenu',
type: 'button', buttons: [
className: 'ae-OptionControlItem-action', {
label: '添加选项', type: 'button',
onClick: () => { className: 'ae-OptionControlItem-action',
this.addOption(path); label: '添加选项',
onClick: () => {
this.addOption(path);
}
},
{
type: 'button',
className: 'ae-OptionControlItem-action',
label: '添加子选项',
onClick: () => {
this.addChildOption(path);
}
} }
}, ]
{ },
type: 'button', {
className: 'ae-OptionControlItem-action', popOverContainer: null // amis 渲染挂载节点会使用 this.target
label: '添加子选项', }
onClick: () => { )}
this.addChildOption(path);
}
}
]
})}
<Button <Button
size="sm" size="sm"
onClick={() => { onClick={() => {

View File

@ -230,7 +230,7 @@ export default class ValidationControl extends React.Component<
icon: 'fa fa-plus', icon: 'fa fa-plus',
label: '', label: '',
tooltip: '添加校验规则', tooltip: '添加校验规则',
placement: 'top', placement: 'left',
align: 'right', align: 'right',
tooltipTrigger: 'hover', tooltipTrigger: 'hover',
closeOnClick: true, closeOnClick: true,

View File

@ -7,14 +7,13 @@ import {defaultValue, RendererPluginAction} from 'amis-editor-core';
import React from 'react'; import React from 'react';
import cx from 'classnames'; import cx from 'classnames';
import {COMMON_ACTION_SCHEMA_MAP, renderCmptActionSelect} from './helper'; import {COMMON_ACTION_SCHEMA_MAP, renderCmptActionSelect} from './helper';
import { Button } from 'amis'; import {Button} from 'amis';
export default class ActionConfigPanel extends React.Component<RendererProps> { export default class ActionConfigPanel extends React.Component<RendererProps> {
render() { render() {
const {data, onBulkChange, render, pluginActions, actionConfigItemsMap} = this.props; const {data, onBulkChange, render, pluginActions, actionConfigItemsMap} =
const actionType = data.__subActions this.props;
? data.groupType const actionType = data.__subActions ? data.groupType : data.actionType;
: data.actionType;
const commonActionConfig = { const commonActionConfig = {
...COMMON_ACTION_SCHEMA_MAP, ...COMMON_ACTION_SCHEMA_MAP,
...actionConfigItemsMap ...actionConfigItemsMap
@ -25,8 +24,7 @@ export default class ActionConfigPanel extends React.Component<RendererProps> {
// 获取组件动作配置 // 获取组件动作配置
const subActionSchema = const subActionSchema =
pluginActions?.[data.__rendererName]?.find( pluginActions?.[data.__rendererName]?.find(
(item: RendererPluginAction) => (item: RendererPluginAction) => item.actionType === data.groupType
item.actionType === data.groupType
)?.schema ?? commonActionConfig[data.groupType]?.schema; )?.schema ?? commonActionConfig[data.groupType]?.schema;
const baseSchema = renderCmptActionSelect('选择组件', true); const baseSchema = renderCmptActionSelect('选择组件', true);
// 追加到基础配置 // 追加到基础配置
@ -36,8 +34,7 @@ export default class ActionConfigPanel extends React.Component<RendererProps> {
? subActionSchema ? subActionSchema
: [subActionSchema]) : [subActionSchema])
]; ];
} } else {
else {
schema = data.__actionSchema; schema = data.__actionSchema;
} }
@ -63,4 +60,4 @@ export default class ActionConfigPanel extends React.Component<RendererProps> {
</div> </div>
); );
} }
} }

View File

@ -13,9 +13,12 @@ import {
SHOW_SELECT_PROP, SHOW_SELECT_PROP,
renderCmptActionSelect, renderCmptActionSelect,
renderCmptSelect, renderCmptSelect,
SUPPORT_DISABLED_CMPTS SUPPORT_DISABLED_CMPTS,
SUPPORT_STATIC_FORMITEM_CMPTS
} from './helper'; } from './helper';
import {BaseLabelMark} from '../../component/BaseControl'; import {BaseLabelMark} from '../../component/BaseControl';
import {i18n as _i18n} from 'i18n-runtime';
const MSG_TYPES: {[key: string]: string} = { const MSG_TYPES: {[key: string]: string} = {
info: '提示', info: '提示',
warning: '警告', warning: '警告',
@ -37,7 +40,8 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
descDetail: (info: any) => { descDetail: (info: any) => {
return ( return (
<div> <div>
<span className="variable-left">{info?.args?.url}</span>
<span className="variable-left">{info?.args?.url || '-'}</span>
</div> </div>
); );
}, },
@ -66,6 +70,7 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
label: '页面参数', label: '页面参数',
multiple: true, multiple: true,
mode: 'horizontal', mode: 'horizontal',
size: 'lg',
items: [ items: [
{ {
name: 'key', name: 'key',
@ -103,13 +108,13 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
actionLabel: '打开页面', actionLabel: '打开页面',
actionType: 'link', actionType: 'link',
description: '打开指定页面', description: '打开指定页面',
innerArgs: ['link', 'params'], innerArgs: ['link', 'params', 'pageName', '__pageInputSchema'],
descDetail: (info: any) => { descDetail: (info: any) => {
return ( return (
<div> <div>
<span className="variable-left variable-right"> <span className="variable-left variable-right">
{info?.args?.pageName} {info?.args?.pageName || '-'}
</span> </span>
</div> </div>
@ -181,7 +186,10 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
required: true, required: true,
pipeIn: defaultValue({ pipeIn: defaultValue({
title: '弹框标题', title: '弹框标题',
body: '<p>对,你刚刚点击了</p>' body: '<p>对,你刚刚点击了</p>',
showCloseButton: true,
showErrorMsg: true,
showLoading: true
}), }),
asFormItem: true, asFormItem: true,
visibleOn: 'data.groupType === "dialog"', visibleOn: 'data.groupType === "dialog"',
@ -199,7 +207,8 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
} }
block block
> >
{/* 翻译未生效,临时方案 */}
{_i18n('a532be3ad5f3fda70d228b8542e81835')}
</Button> </Button>
) )
}, },
@ -227,7 +236,8 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
} }
block block
> >
{/* 翻译未生效,临时方案 */}
{_i18n('a532be3ad5f3fda70d228b8542e81835')}
</Button> </Button>
) )
} }
@ -292,7 +302,7 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
return ( return (
<div> <div>
{MSG_TYPES[info?.args?.msgType] || ''} {MSG_TYPES[info?.args?.msgType] || ''}
<span className="variable-left">{info?.args?.msg}</span> <span className="variable-left">{info?.args?.msg || '-'}</span>
</div> </div>
); );
}, },
@ -421,10 +431,10 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
<div> <div>
<span className="variable-right variable-left"> <span className="variable-right variable-left">
{apiInfo?.method} {apiInfo?.method || '-'}
</span> </span>
<span className="variable-left">{apiInfo?.url}</span> <span className="variable-left">{apiInfo?.url || '-'}</span>
</div> </div>
); );
}, },
@ -552,7 +562,7 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
<div> <div>
<span className="variable-left variable-right"> <span className="variable-left variable-right">
{info?.rendererLabel} {info?.rendererLabel || '-'}
</span> </span>
</div> </div>
@ -566,7 +576,7 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
<div> <div>
<span className="variable-left variable-right"> <span className="variable-left variable-right">
{info?.rendererLabel} {info?.rendererLabel || '-'}
</span> </span>
</div> </div>
@ -576,7 +586,7 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
], ],
supportComponents: '*', supportComponents: '*',
schema: [ schema: [
...renderCmptSelect('选择组件', true), ...renderCmptSelect('目标组件', true),
{ {
type: 'radios', type: 'radios',
label: '显示/隐藏', label: '显示/隐藏',
@ -611,7 +621,7 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
<div> <div>
<span className="variable-left variable-right"> <span className="variable-left variable-right">
{info?.rendererLabel} {info?.rendererLabel || '-'}
</span> </span>
</div> </div>
@ -625,7 +635,7 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
<div> <div>
<span className="variable-left variable-right"> <span className="variable-left variable-right">
{info?.rendererLabel} {info?.rendererLabel || '-'}
</span> </span>
</div> </div>
@ -639,7 +649,7 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
...SUPPORT_DISABLED_CMPTS ...SUPPORT_DISABLED_CMPTS
], ],
schema: [ schema: [
...renderCmptSelect('选择组件', true), ...renderCmptSelect('目标组件', true),
{ {
type: 'radios', type: 'radios',
label: '启用/禁用', label: '启用/禁用',
@ -662,6 +672,63 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
} }
] ]
}, },
{
actionLabel: '组件展示态',
actionType: 'staticStatus',
description: '控制所选的组件的输入态/静态',
actions: [
{
actionType: 'static',
descDetail: (info: any) => {
return (
<div>
<span className="variable-left variable-right">
{info?.rendererLabel}
</span>
</div>
);
}
},
{
actionType: 'nonstatic',
descDetail: (info: any) => {
return (
<div>
<span className="variable-left variable-right">
{info?.rendererLabel}
</span>
</div>
);
}
}
],
supportComponents: ['form', ...SUPPORT_STATIC_FORMITEM_CMPTS],
schema: [
...renderCmptSelect('选择组件', true),
{
type: 'radios',
label: '组件状态',
name: 'groupType',
mode: 'horizontal',
inputClassName: 'event-action-radio',
value: 'nonstatic',
required: true,
pipeIn: defaultValue('nonstatic'),
options: [
{
label: '表单输入',
value: 'nonstatic'
},
{
label: '表单静态',
value: 'static'
}
]
}
]
},
{ {
actionLabel: '刷新组件', actionLabel: '刷新组件',
actionType: 'reload', actionType: 'reload',
@ -671,19 +738,177 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
<div> <div>
<span className="variable-left variable-right"> <span className="variable-left variable-right">
{info?.rendererLabel} {info?.rendererLabel || '-'}
</span> </span>
</div> </div>
); );
}, },
supportComponents: 'byComponent', supportComponents: 'byComponent',
schema: renderCmptSelect('选择组件', true) schema: [
...renderCmptSelect(
'目标组件',
true,
(value: string, oldVal: any, data: any, form: any) => {
form.setValueByName('args.resetPage', true);
form.setValueByName('__addParam', true);
form.setValueByName('__customData', false);
form.setValueByName('__containerType', 'all');
form.setValueByName('__reloadParam', []);
}
),
{
type: 'switch',
name: '__resetPage',
label: '重置页码',
labelRemark: {
className: 'm-l-xs',
icon: 'fa fa-question-circle',
rootClose: true,
content: '选择“是”时,将重新请求第一页数据。',
placement: 'top'
},
onText: '是',
offText: '否',
mode: 'horizontal',
pipeIn: defaultValue(true),
visibleOn: `data.actionType === "reload" && data.__rendererName === "crud"`
},
{
type: 'switch',
name: '__addParam',
label: '追加数据',
labelRemark: {
className: 'm-l-xs',
icon: 'fa fa-question-circle',
rootClose: true,
content: `当选择“是”且目标组件是增删改查组件时数据接口请求时将带上这些数据其他类型的目标组件只有在数据接口是post请求时才会带上这些数据。`,
placement: 'top'
},
onText: '是',
offText: '否',
mode: 'horizontal',
pipeIn: defaultValue(true),
visibleOn: `data.actionType === "reload" && ${IS_DATA_CONTAINER}`
},
{
type: 'switch',
name: '__customData',
label: '自定义数据',
labelRemark: {
className: 'm-l-xs',
icon: 'fa fa-question-circle',
rootClose: true,
content: `数据默认为源组件所在数据域,开启“自定义”可以定制所需数据`,
placement: 'top'
},
onText: '是',
offText: '否',
mode: 'horizontal',
pipeIn: defaultValue(true),
visibleOn: `data.__addParam && data.actionType === "reload" && ${IS_DATA_CONTAINER}`,
onChange: (value: string, oldVal: any, data: any, form: any) => {
form.setValueByName('__containerType', 'all');
}
},
{
type: 'radios',
name: '__containerType',
mode: 'horizontal',
label: '',
pipeIn: defaultValue('all'),
visibleOn: `data.__addParam && data.__customData && data.actionType === "reload" && ${IS_DATA_CONTAINER}`,
options: [
{
label: '直接赋值',
value: 'all'
},
{
label: '成员赋值',
value: 'appoint'
}
],
onChange: (value: string, oldVal: any, data: any, form: any) => {
form.setValueByName('__reloadParams', []);
form.setValueByName('__valueInput', undefined);
}
},
{
name: '__valueInput',
type: 'input-formula',
variables: '${variables}',
evalMode: false,
required: true,
variableMode: 'tabs',
inputMode: 'input-group',
label: '',
size: 'lg',
mode: 'horizontal',
visibleOn: `data.__addParam && data.__customData && data.__containerType === "all" && data.actionType === "reload" && ${IS_DATA_CONTAINER}`
},
{
type: 'combo',
name: '__reloadParams',
label: '',
multiple: true,
removable: true,
addable: true,
strictMode: false,
canAccessSuperData: true,
size: 'lg',
mode: 'horizontal',
items: [
{
name: 'key',
type: 'input-text',
placeholder: '参数名',
labelField: 'label',
valueField: 'value',
required: true
},
{
name: 'val',
type: 'input-formula',
placeholder: '参数值',
variables: '${variables}',
evalMode: false,
variableMode: 'tabs',
inputMode: 'input-group'
}
],
visibleOn: `data.__addParam && data.__customData && data.__containerType === "appoint" && data.actionType === "reload" && ${IS_DATA_CONTAINER}`
},
{
type: 'radios',
name: 'dataMergeMode',
mode: 'horizontal',
label: '追加方式',
labelRemark: {
className: 'm-l-xs',
icon: 'fa fa-question-circle',
rootClose: true,
content: `选择“合并”时,会将数据合并到目标组件的数据域。<br/>选择“覆盖”时,数据会直接覆盖目标组件的数据域。`,
placement: 'top'
},
pipeIn: defaultValue('merge'),
visibleOn: `data.__addParam && data.actionType === "reload" && ${IS_DATA_CONTAINER}`,
options: [
{
label: '合并',
value: 'merge'
},
{
label: '覆盖',
value: 'override'
}
]
}
]
}, },
{ {
actionLabel: '设置组件数据', actionLabel: '组件数据',
actionType: 'setValue', actionType: 'setValue',
description: '设置数据容器或表单项的数据', description: '更新目标组件的数据域或目标表单项的数据值',
innerArgs: [ innerArgs: [
'value', 'value',
'index', 'index',
@ -696,7 +921,7 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
<div> <div>
<span className="variable-left variable-right"> <span className="variable-left variable-right">
{info?.rendererLabel} {info?.rendererLabel || '-'}
</span> </span>
{/* {/*
@ -710,25 +935,32 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
}, },
supportComponents: 'byComponent', supportComponents: 'byComponent',
schema: [ schema: [
...renderCmptActionSelect('选择组件', true), ...renderCmptActionSelect(
'目标组件',
true,
(value: string, oldVal: any, data: any, form: any) => {
form.setValueByName('args.__containerType', 'all');
form.setValueByName('args.__comboType', 'all');
}
),
getArgsWrapper({ getArgsWrapper({
type: 'wrapper', type: 'wrapper',
className: 'p-none', className: 'p-none',
body: [ body: [
{ {
type: 'radios', type: 'radios',
required: true,
name: '__containerType', name: '__containerType',
mode: 'horizontal', mode: 'horizontal',
label: '赋值方式', label: '数据设置',
visibleOn: `data.__rendererName && ${IS_DATA_CONTAINER}`, pipeIn: defaultValue('all'),
visibleOn: `${IS_DATA_CONTAINER}`,
options: [ options: [
{ {
label: '数据域赋值', label: '直接赋值',
value: 'all' value: 'all'
}, },
{ {
label: '数据域成员赋值', label: '成员赋值',
value: 'appoint' value: 'appoint'
} }
], ],
@ -744,12 +976,12 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
}, },
{ {
type: 'radios', type: 'radios',
required: true,
name: '__comboType', name: '__comboType',
inputClassName: 'event-action-radio', inputClassName: 'event-action-radio',
mode: 'horizontal', mode: 'horizontal',
label: '赋值方式', label: '数据设置',
visibleOn: `data.__rendererName && __rendererName === 'combo'`, pipeIn: defaultValue('all'),
visibleOn: `data.__rendererName === 'combo'`,
options: [ options: [
{ {
label: '全量', label: '全量',
@ -777,37 +1009,31 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
name: 'index', name: 'index',
mode: 'horizontal', mode: 'horizontal',
label: '输入序号', label: '输入序号',
size: 'lg',
placeholder: '请输入待更新序号', placeholder: '请输入待更新序号',
visibleOn: `data.__comboType && __comboType === 'appoint' && data.__rendererName && data.__rendererName === 'combo'` visibleOn: `data.__comboType === 'appoint' && data.__rendererName === 'combo'`
}, },
{ {
type: 'combo', type: 'combo',
name: 'value', name: 'value',
label: '字段赋值', label: '',
multiple: true, multiple: true,
removable: true, removable: true,
required: true, required: true,
addable: true, addable: true,
strictMode: false, strictMode: false,
canAccessSuperData: true, canAccessSuperData: true,
size: 'lg',
mode: 'horizontal', mode: 'horizontal',
items: [ items: [
{ {
name: 'key', name: 'key',
type: 'select', type: 'input-text',
placeholder: '变量名', placeholder: '变量名',
source: '${__setValueDs}', source: '${__setValueDs}',
labelField: 'label', labelField: 'label',
valueField: 'value', valueField: 'value',
required: true, required: true
visibleOn: `data.__rendererName && ${SHOW_SELECT_PROP}`
},
{
name: 'key',
type: 'input-text',
placeholder: '变量名',
required: true,
visibleOn: `data.__rendererName && !${SHOW_SELECT_PROP} && __comboType === 'appoint'`
}, },
{ {
name: 'val', name: 'val',
@ -819,12 +1045,12 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
inputMode: 'input-group' inputMode: 'input-group'
} }
], ],
visibleOn: `data.__rendererName && ${IS_DATA_CONTAINER} && data.__containerType && data.__containerType === 'appoint' || (data.__comboType && __comboType === 'appoint')` visibleOn: `${IS_DATA_CONTAINER} && data.__containerType === 'appoint' || data.__comboType === 'appoint'`
}, },
{ {
type: 'combo', type: 'combo',
name: 'value', name: 'value',
label: '字段赋值', label: '',
multiple: true, multiple: true,
removable: true, removable: true,
required: true, required: true,
@ -832,6 +1058,7 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
strictMode: false, strictMode: false,
canAccessSuperData: true, canAccessSuperData: true,
mode: 'horizontal', mode: 'horizontal',
size: 'lg',
items: [ items: [
{ {
type: 'combo', type: 'combo',
@ -845,6 +1072,7 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
strictMode: false, strictMode: false,
canAccessSuperData: true, canAccessSuperData: true,
className: 'm-l', className: 'm-l',
size: 'lg',
mode: 'horizontal', mode: 'horizontal',
items: [ items: [
{ {
@ -867,7 +1095,7 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
] ]
} }
], ],
visibleOn: `data.__rendererName && __rendererName === 'combo' && data.__comboType && __comboType === 'all'` visibleOn: `data.__rendererName === 'combo' && data.__comboType === 'all'`
}, },
{ {
name: '__valueInput', name: '__valueInput',
@ -876,10 +1104,23 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
evalMode: false, evalMode: false,
variableMode: 'tabs', variableMode: 'tabs',
inputMode: 'input-group', inputMode: 'input-group',
label: '赋值', label: '',
size: 'lg', size: 'lg',
mode: 'horizontal', mode: 'horizontal',
visibleOn: `data.__rendererName && !${IS_DATA_CONTAINER} && !${SHOW_SELECT_PROP} && __rendererName !== 'combo' || (${IS_DATA_CONTAINER} && data.__containerType && data.__containerType === 'all')`, visibleOn: `(${IS_DATA_CONTAINER} || ${SHOW_SELECT_PROP}) && data.__containerType === 'all'`,
required: true
},
{
name: '__valueInput',
type: 'input-formula',
variables: '${variables}',
evalMode: false,
variableMode: 'tabs',
inputMode: 'input-group',
label: '数据设置',
size: 'lg',
mode: 'horizontal',
visibleOn: `data.__rendererName && !${IS_DATA_CONTAINER} && data.__rendererName !== 'combo'`,
required: true required: true
} }
] ]
@ -895,14 +1136,14 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
<div> <div>
<span className="variable-left variable-right"> <span className="variable-left variable-right">
{info?.rendererLabel} {info?.rendererLabel || '-'}
</span> </span>
</div> </div>
); );
}, },
supportComponents: 'form', supportComponents: 'form',
schema: renderCmptSelect('选择组件', true) schema: renderCmptSelect('目标组件', true)
}, },
{ {
actionLabel: '清空表单', actionLabel: '清空表单',
@ -913,14 +1154,14 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
<div> <div>
<span className="variable-left variable-right"> <span className="variable-left variable-right">
{info?.rendererLabel} {info?.rendererLabel || '-'}
</span> </span>
</div> </div>
); );
}, },
supportComponents: 'form', supportComponents: 'form',
schema: renderCmptSelect('选择组件', true) schema: renderCmptSelect('目标组件', true)
}, },
{ {
actionLabel: '重置表单', actionLabel: '重置表单',
@ -931,14 +1172,14 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
<div> <div>
<span className="variable-left variable-right"> <span className="variable-left variable-right">
{info?.rendererLabel} {info?.rendererLabel || '-'}
</span> </span>
</div> </div>
); );
}, },
supportComponents: 'form', supportComponents: 'form',
schema: renderCmptSelect('选择组件', true) schema: renderCmptSelect('目标组件', true)
}, },
{ {
actionLabel: '校验表单', actionLabel: '校验表单',
@ -949,21 +1190,21 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
<div> <div>
<span className="variable-left variable-right"> <span className="variable-left variable-right">
{info?.rendererLabel} {info?.rendererLabel || '-'}
</span> </span>
</div> </div>
); );
}, },
supportComponents: 'form', supportComponents: 'form',
schema: renderCmptSelect('选择组件', true) schema: renderCmptSelect('目标组件', true)
}, },
{ {
actionLabel: '组件特性动作', actionLabel: '组件特性动作',
actionType: 'component', actionType: 'component',
description: '触发所选组件的特性动作', description: '触发所选组件的特性动作',
supportComponents: '*', supportComponents: '*',
schema: renderCmptActionSelect('选择组件', true) schema: renderCmptActionSelect('目标组件', true)
} }
] ]
}, },
@ -980,7 +1221,9 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
return ( return (
<div> <div>
<span className="variable-left">{info?.args?.content}</span> <span className="variable-left">
{info?.args?.content || '-'}
</span>
</div> </div>
); );
}, },

View File

@ -65,4 +65,4 @@ export default class CmptActionSelect extends React.Component<RendererProps> {
/> />
); );
} }
} }

View File

@ -12,18 +12,19 @@ import {
RendererPluginEvent, RendererPluginEvent,
SubRendererPluginAction SubRendererPluginAction
} from 'amis-editor-core'; } from 'amis-editor-core';
import {ActionConfig, ContextVariables} from './types'; import {ActionConfig, ComponentInfo, ContextVariables} from './types';
import { import {
DataSchema, DataSchema,
filterTree, filterTree,
findTree, findTree,
mapTree, mapTree,
normalizeApi normalizeApi,
PlainObject
} from 'amis-core'; } from 'amis-core';
import CmptActionSelect from './comp-action-select'; import CmptActionSelect from './comp-action-select';
import {Button} from 'amis'; import {Button} from 'amis';
import ACTION_TYPE_TREE from './actions'; import ACTION_TYPE_TREE from './actions';
import {stores} from 'amis-core/lib/factory'; import without from 'lodash/without';
// 数据容器范围 // 数据容器范围
export const DATA_CONTAINER = [ export const DATA_CONTAINER = [
@ -32,6 +33,7 @@ export const DATA_CONTAINER = [
'drawer', 'drawer',
'wizard', 'wizard',
'service', 'service',
'crud',
'page', 'page',
'app', 'app',
'chart' 'chart'
@ -43,12 +45,12 @@ export const SELECT_PROPS_CONTAINER = ['form'];
// 是否数据容器 // 是否数据容器
export const IS_DATA_CONTAINER = `${JSON.stringify( export const IS_DATA_CONTAINER = `${JSON.stringify(
DATA_CONTAINER DATA_CONTAINER
)}.includes(__rendererName)`; )}.includes(data.__rendererName)`;
// 是否下拉展示可赋值属性 // 是否下拉展示可赋值属性
export const SHOW_SELECT_PROP = `${JSON.stringify( export const SHOW_SELECT_PROP = `${JSON.stringify(
SELECT_PROPS_CONTAINER SELECT_PROPS_CONTAINER
)}.includes(__rendererName)`; )}.includes(data.__rendererName)`;
// 表单项组件 // 表单项组件
export const FORMITEM_CMPTS = [ export const FORMITEM_CMPTS = [
@ -116,6 +118,29 @@ export const FORMITEM_CMPTS = [
'uuid' 'uuid'
]; ];
export const SUPPORT_STATIC_FORMITEM_CMPTS = without(
FORMITEM_CMPTS,
...[
'button-toolbar',
'condition-builder',
'diff-editor',
'editor',
'formula',
'hidden',
'icon-picker',
'input-excel',
'input-file',
'input-formula',
'input-image',
'input-repeat',
'input-rich-text',
'input-sub-form',
'input-table',
'picker',
'uuid'
]
);
export const SUPPORT_DISABLED_CMPTS = [ export const SUPPORT_DISABLED_CMPTS = [
'button-group', 'button-group',
'action', 'action',
@ -211,7 +236,7 @@ export const COMMON_ACTION_SCHEMA_MAP: {
inputMode: 'input-group' inputMode: 'input-group'
} }
], ],
visibleOn: `data.__rendererName && ${IS_DATA_CONTAINER}` visibleOn: `${IS_DATA_CONTAINER}`
}, },
{ {
type: 'combo', type: 'combo',
@ -255,7 +280,7 @@ export const COMMON_ACTION_SCHEMA_MAP: {
] ]
} }
], ],
visibleOn: `data.__rendererName && __rendererName === 'combo'` visibleOn: `data.__rendererName === 'combo'`
}, },
{ {
name: '__valueInput', name: '__valueInput',
@ -267,7 +292,7 @@ export const COMMON_ACTION_SCHEMA_MAP: {
label: '变量赋值', label: '变量赋值',
size: 'lg', size: 'lg',
mode: 'horizontal', mode: 'horizontal',
visibleOn: `data.__rendererName && !${IS_DATA_CONTAINER} && __rendererName !== 'combo'`, visibleOn: `!${IS_DATA_CONTAINER} && data.__rendererName !== 'combo'`,
required: true required: true
} }
] ]
@ -437,6 +462,11 @@ export const getEventLabel = (events: RendererPluginEvent[], name: string) =>
export const getEventDesc = (events: RendererPluginEvent[], name: string) => export const getEventDesc = (events: RendererPluginEvent[], name: string) =>
events.find(item => item.eventName === name)?.description; events.find(item => item.eventName === name)?.description;
export const getEventStrongDesc = (
events: RendererPluginEvent[],
name: string
) => events.find(item => item.eventName === name)?.strongDesc;
// 判断插件动作中是否存在指定动作 // 判断插件动作中是否存在指定动作
export const hasActionType = ( export const hasActionType = (
actionType: string, actionType: string,
@ -456,14 +486,21 @@ export const getPropOfAcion = (
propName: string, propName: string,
actionTree: RendererPluginAction[], actionTree: RendererPluginAction[],
pluginActions: PluginActions, pluginActions: PluginActions,
commonActions?: {[propName: string]: RendererPluginAction} commonActions?: {[propName: string]: RendererPluginAction},
allComponents?: ComponentInfo[]
): any => { ): any => {
let prop: any = null; let prop: any = null;
if (action.componentId) { if (action.componentId) {
// 优先从组件特性动作中找 // 优先从组件特性动作中找
pluginActions[action.__rendererName]?.find( const node = findTree(
(item: RendererPluginAction) => item.actionType === action.actionType allComponents ?? [],
)?.[propName as keyof RendererPluginAction]; item => item.value === action.componentId
);
prop =
node &&
pluginActions[node.type]?.find(
(item: RendererPluginAction) => item.actionType === action.actionType
)?.[propName as keyof RendererPluginAction];
} }
if (!prop) { if (!prop) {
@ -506,7 +543,7 @@ export const renderCmptSelect = (
{ {
type: 'tree-select', type: 'tree-select',
name: 'componentId', name: 'componentId',
label: componentLabel, label: componentLabel || '选择组件',
showIcon: false, showIcon: false,
searchable: true, searchable: true,
required, required,
@ -535,7 +572,7 @@ export const renderCmptActionSelect = (
) => { ) => {
return [ return [
...renderCmptSelect( ...renderCmptSelect(
'选择组件', componentLabel || '选择组件',
true, true,
async (value: string, oldVal: any, data: any, form: any) => { async (value: string, oldVal: any, data: any, form: any) => {
// 获取组件上下文. // 获取组件上下文.
@ -566,6 +603,7 @@ export const renderCmptActionSelect = (
form.setValueByName('args.__comboType', undefined); form.setValueByName('args.__comboType', undefined);
form.setValueByName('args.__valueInput', undefined); form.setValueByName('args.__valueInput', undefined);
form.setValueByName('args.__containerType', undefined); form.setValueByName('args.__containerType', undefined);
if (SELECT_PROPS_CONTAINER.includes(rendererType)) { if (SELECT_PROPS_CONTAINER.includes(rendererType)) {
form.setValueByName( form.setValueByName(
'__setValueDs', '__setValueDs',
@ -739,7 +777,10 @@ export const getOldActionSchema = (
name: 'dialog', name: 'dialog',
pipeIn: defaultValue({ pipeIn: defaultValue({
title: '弹框标题', title: '弹框标题',
body: '<p>对,你刚刚点击了</p>' body: '<p>对,你刚刚点击了</p>',
showCloseButton: true,
showErrorMsg: true,
showLoading: true
}), }),
asFormItem: true, asFormItem: true,
children: ({value, onChange, data}: any) => children: ({value, onChange, data}: any) =>
@ -949,6 +990,31 @@ export const getOldActionSchema = (
}; };
}; };
/**
* Combo组件对象数组
* @param obj
* @returns
*/
const objectToComboArray = (obj: PlainObject) =>
Object.entries(obj).map(([key, val]) => ({
key,
val
}));
/**
* Combo组件对象数组转对象
* @param arr
* @returns
*/
const comboArrayToObject = (arr: any[]) => {
let obj: PlainObject = {};
arr?.forEach(item => {
obj[item.key] = item.val;
});
return obj;
};
/** /**
* *
*/ */
@ -1068,30 +1134,30 @@ export const getEventControlConfig = (
) => { ) => {
let config = {...action}; let config = {...action};
if (['setValue', 'url'].includes(action.actionType) && action.args) { if (['link', 'url'].includes(action.actionType) && action.args?.params) {
const prop = action.actionType === 'setValue' ? 'value' : 'params'; config.args = {
...config.args,
params: objectToComboArray(action.args?.params)
};
}
if (['setValue'].includes(action.actionType) && action.args?.value) {
!config.args && (config.args = {}); !config.args && (config.args = {});
if (Array.isArray(action.args[prop])) { if (Array.isArray(action.args?.value)) {
config.args[prop] = action.args[prop].reduce( config.args.value = action.args?.value.reduce(
(arr: any, valueItem: any, index: number) => { (arr: any, valueItem: any, index: number) => {
if (!arr[index]) { if (!arr[index]) {
arr[index] = {}; arr[index] = {};
} }
arr[index].item = Object.entries(valueItem).map(([key, val]) => ({ arr[index].item = objectToComboArray(valueItem);
key,
val
}));
return arr; return arr;
}, },
[] []
); );
// 目前只有给combo赋值会是数组所以认为是全量的赋值方式 // 目前只有给combo赋值会是数组所以认为是全量的赋值方式
config.args['__comboType'] = 'all'; config.args['__comboType'] = 'all';
} else if (typeof action.args[prop] === 'object') { } else if (typeof action.args?.value === 'object') {
config.args[prop] = Object.keys(action.args[prop]).map(key => ({ config.args.value = objectToComboArray(action.args?.value);
key,
val: action.args?.[prop][key]
}));
config.args['__containerType'] = 'appoint'; config.args['__containerType'] = 'appoint';
// 如果有index认为是给指定序号的combo赋值所以认为是指定序号的赋值方式 // 如果有index认为是给指定序号的combo赋值所以认为是指定序号的赋值方式
if (action.args.index !== undefined) { if (action.args.index !== undefined) {
@ -1099,19 +1165,21 @@ export const getEventControlConfig = (
} }
} else if ( } else if (
action.actionType === 'setValue' && action.actionType === 'setValue' &&
typeof action.args[prop] === 'string' typeof action.args?.value === 'string'
) { ) {
config.args['__containerType'] = 'all'; config.args['__containerType'] = 'all';
config.args['__valueInput'] = config.args['value']; config.args['__valueInput'] = config.args['value'];
delete config.args?.value; delete config.args?.value;
} }
} }
if ( if (
action.actionType === 'ajax' && action.actionType === 'ajax' &&
typeof action?.args?.api === 'string' typeof action?.args?.api === 'string'
) { ) {
action.args.api = normalizeApi(action?.args?.api); action.args.api = normalizeApi(action?.args?.api);
} }
// 获取动作专有配置参数 // 获取动作专有配置参数
const innerArgs: any = getPropOfAcion( const innerArgs: any = getPropOfAcion(
action, action,
@ -1120,6 +1188,43 @@ export const getEventControlConfig = (
manager.pluginActions, manager.pluginActions,
commonActions commonActions
); );
// 处理刷新组件动作的追加参数
if (config.actionType === 'reload') {
config.__resetPage = config.args?.resetPage;
config.__addParam = config.data === undefined || !!config.data;
config.__customData = !!config.data;
if (
(config.data && typeof config.data === 'object') ||
(config.args &&
!Object.keys(config.args).length &&
config.data === undefined)
) {
config.__customData = true;
config.__containerType = 'appoint';
config.dataMergeMode = 'override';
}
if (config.__addParam && config.__customData && config.data) {
if (typeof config.data === 'string') {
config.__containerType = 'all';
config.__valueInput = config.data;
} else {
config.__containerType = 'appoint';
config.__reloadParams = objectToComboArray(config.data);
}
} else if (
config.args &&
!Object.keys(config.args).length &&
config.data === undefined
) {
config.__reloadParams = objectToComboArray(config.args);
}
}
delete config.data;
// 还原args为可视化配置结构(args + addOnArgs) // 还原args为可视化配置结构(args + addOnArgs)
if (config.args) { if (config.args) {
if (innerArgs) { if (innerArgs) {
@ -1172,7 +1277,7 @@ export const getEventControlConfig = (
? [ ? [
...variables.eventVariables, ...variables.eventVariables,
{ {
label: `数据来源变量`, label: '数据来源变量',
children: datasource children: datasource
}, },
...variables.rawVariables ...variables.rawVariables
@ -1211,17 +1316,50 @@ export const getEventControlConfig = (
}); });
delete action.addOnArgs; delete action.addOnArgs;
} }
// 刷新组件时,处理是否追加事件变量
if (config.actionType === 'reload') {
action.data = null;
action.dataMergeMode = undefined;
action.args =
action.__rendererName === 'crud'
? {
...action.args,
resetPage: config.__resetPage ?? true
}
: undefined;
if (config.__addParam) {
action.dataMergeMode = config.dataMergeMode || 'merge';
action.data = undefined;
if (config.__customData) {
action.data =
config.__containerType === 'all'
? config.__valueInput
: comboArrayToObject(config.__reloadParams || []);
}
}
}
// 转换下格式 // 转换下格式
if (['setValue', 'url'].includes(action.actionType)) { if (['link', 'url'].includes(action.actionType)) {
const propName = action.actionType === 'setValue' ? 'value' : 'params'; const params = config.args?.params;
if ( if (params && params.length) {
action.actionType === 'setValue' && action.args = {
config.args?.__valueInput !== undefined ...action.args,
) { params: comboArrayToObject(params)
};
}
}
// 转换下格式
if (action.actionType === 'setValue') {
if (config.args?.__valueInput !== undefined) {
action.args = { action.args = {
value: config.args?.__valueInput value: config.args?.__valueInput
}; };
} else if (Array.isArray(config.args?.[propName])) { } else if (Array.isArray(config.args?.value)) {
action.args = action.args ?? {}; action.args = action.args ?? {};
if ( if (
action.__rendererName === 'combo' && action.__rendererName === 'combo' &&
@ -1229,7 +1367,7 @@ export const getEventControlConfig = (
) { ) {
// combo特殊处理 // combo特殊处理
let tempArr: any = []; let tempArr: any = [];
config.args?.[propName].forEach((valueItem: any, index: number) => { config.args?.value.forEach((valueItem: any, index: number) => {
valueItem.item.forEach((item: any) => { valueItem.item.forEach((item: any) => {
if (!tempArr[index]) { if (!tempArr[index]) {
tempArr[index] = {}; tempArr[index] = {};
@ -1239,16 +1377,12 @@ export const getEventControlConfig = (
}); });
action.args = { action.args = {
...action.args, ...action.args,
[propName]: tempArr value: tempArr
}; };
} else { } else {
let tmpObj: any = {};
config.args?.[propName].forEach((item: any) => {
tmpObj[item.key] = item.val;
});
action.args = { action.args = {
...action.args, ...action.args,
[propName]: tmpObj value: comboArrayToObject(config.args?.value!)
}; };
} }
} }
@ -1256,11 +1390,6 @@ export const getEventControlConfig = (
delete action.config; delete action.config;
// 去掉空参
if (action.args && !Object.keys(action.args).length) {
delete action.args;
}
return action; return action;
} }
}; };

View File

@ -11,6 +11,7 @@ import {
findSubActionNode, findSubActionNode,
getActionType, getActionType,
getEventDesc, getEventDesc,
getEventStrongDesc,
getEventLabel, getEventLabel,
getPropOfAcion, getPropOfAcion,
SELECT_PROPS_CONTAINER SELECT_PROPS_CONTAINER
@ -29,6 +30,7 @@ import {
SubRendererPluginAction SubRendererPluginAction
} from 'amis-editor-core'; } from 'amis-editor-core';
export * from './helper'; export * from './helper';
import {i18n as _i18n} from 'i18n-runtime';
interface EventControlProps extends FormControlProps { interface EventControlProps extends FormControlProps {
actions: PluginActions; // 组件的动作列表 actions: PluginActions; // 组件的动作列表
@ -414,7 +416,8 @@ export class EventControl extends React.Component<
> >
) { ) {
const {events, onEvent} = this.state; const {events, onEvent} = this.state;
const {actionTree, pluginActions, commonActions} = this.props; const {actionTree, pluginActions, commonActions, allComponents} =
this.props;
// 收集当前事件已有ajax动作的请求返回结果作为事件变量 // 收集当前事件已有ajax动作的请求返回结果作为事件变量
let oldActions = onEvent[activeData.actionData!.eventKey].actions; let oldActions = onEvent[activeData.actionData!.eventKey].actions;
if (activeData.type === 'update') { if (activeData.type === 'update') {
@ -430,14 +433,16 @@ export class EventControl extends React.Component<
'actionLabel', 'actionLabel',
actionTree, actionTree,
pluginActions, pluginActions,
commonActions commonActions,
allComponents
); );
const dataSchemaJson = getPropOfAcion( const dataSchemaJson = getPropOfAcion(
item, item,
'outputVarDataSchema', 'outputVarDataSchema',
actionTree, actionTree,
pluginActions, pluginActions,
commonActions commonActions,
allComponents
); );
const dataSchema = new DataSchema(dataSchemaJson || []); const dataSchema = new DataSchema(dataSchemaJson || []);
return { return {
@ -511,20 +516,23 @@ export class EventControl extends React.Component<
item => item.value === action.componentId item => item.value === action.componentId
); );
// 获取组件数据动作所需上下文
let setValueDs: any = null; let setValueDs: any = null;
if (actionConfig?.actionType === 'setValue') { if (
const rendererType = node?.type; actionConfig?.actionType === 'setValue' &&
const rendererName = node?.label; node?.id &&
// todo:这里会闪一下需要从amis查下问题 SELECT_PROPS_CONTAINER.includes(node?.type || '')
if (SELECT_PROPS_CONTAINER.includes(rendererType || '')) { ) {
const curVariable = rawVariables.find( const targetDataSchema: any = await getContextSchemas?.(node.id, true);
item => item.label === `${rendererName}变量` const targetDataSchemaIns = new DataSchema(targetDataSchema || []);
); const targetVariables =
setValueDs = curVariable?.children?.filter( targetDataSchemaIns?.getDataPropsAsOptions() || [];
(item: ContextVariables) => item.value !== '$$id'
); setValueDs = targetVariables?.filter(
} (item: ContextVariables) => item.value !== '$$id'
);
} }
data.actionData = { data.actionData = {
eventKey: data.actionData!.eventKey, eventKey: data.actionData!.eventKey,
actionIndex: data.actionData!.actionIndex, actionIndex: data.actionData!.actionIndex,
@ -570,14 +578,16 @@ export class EventControl extends React.Component<
actions: pluginActions, actions: pluginActions,
actionTree, actionTree,
commonActions, commonActions,
getComponents getComponents,
allComponents
} = this.props; } = this.props;
const desc = getPropOfAcion( const desc = getPropOfAcion(
action, action,
'descDetail', 'descDetail',
actionTree, actionTree,
pluginActions, pluginActions,
commonActions commonActions,
allComponents
); );
let info = {...action}; let info = {...action};
// 根据子动作类型获取动作树节点的配置 // 根据子动作类型获取动作树节点的配置
@ -613,8 +623,9 @@ export class EventControl extends React.Component<
} else if (type === 'update') { } else if (type === 'update') {
this.updateAction?.(config.eventKey, config.actionIndex, action); this.updateAction?.(config.eventKey, config.actionIndex, action);
} }
this.setState({actionData: undefined});
this.setState({showAcionDialog: false}); this.setState({showAcionDialog: false});
this.setState({actionData: undefined});
} }
@autobind @autobind
@ -628,6 +639,7 @@ export class EventControl extends React.Component<
actions: pluginActions, actions: pluginActions,
commonActions, commonActions,
getComponents, getComponents,
allComponents,
render render
} = this.props; } = this.props;
const { const {
@ -650,27 +662,33 @@ export class EventControl extends React.Component<
'no-bd-btm': !eventKeys.length 'no-bd-btm': !eventKeys.length
})} })}
> >
{render('dropdown', { {render(
type: 'dropdown-button', 'dropdown',
level: 'enhance', {
label: '添加事件', type: 'dropdown-button',
disabled: false, level: 'enhance',
className: 'block w-full add-event-dropdown', label: '添加事件',
closeOnClick: true, disabled: false,
buttons: events.map(item => ({ className: 'block w-full add-event-dropdown',
type: 'button', closeOnClick: true,
disabledTip: '您已添加该事件', buttons: events.map(item => ({
tooltipPlacement: 'left', type: 'button',
disabled: Object.keys(onEvent).includes(item.eventName), disabledTip: '您已添加该事件',
actionType: '', tooltipPlacement: 'left',
label: item.eventLabel, disabled: Object.keys(onEvent).includes(item.eventName),
onClick: this.addEvent.bind( actionType: '',
this, label: item.eventLabel,
item, onClick: this.addEvent.bind(
Object.keys(onEvent).includes(item.eventName) this,
) item,
})) Object.keys(onEvent).includes(item.eventName)
})} )
}))
},
{
popOverContainer: null // amis 渲染挂载节点会使用 this.target
}
)}
</header> </header>
<ul <ul
className={cx({ className={cx({
@ -686,10 +704,11 @@ export class EventControl extends React.Component<
<div <div
className={cx({ className={cx({
'event-item-header': true, 'event-item-header': true,
'no-bd-btm': !( 'no-bd-btm':
enventSnapshot[eventKey].actions?.length && !(
eventPanelActive[eventKey] enventSnapshot[eventKey].actions?.length &&
) eventPanelActive[eventKey]
) && !getEventStrongDesc(events, eventKey)
})} })}
> >
<TooltipWrapper <TooltipWrapper
@ -699,7 +718,9 @@ export class EventControl extends React.Component<
tooltip={{ tooltip={{
children: () => ( children: () => (
<div> <div>
{getEventDesc(events, eventKey) || eventKey} {getEventDesc(events, eventKey) ||
getEventStrongDesc(events, eventKey) ||
eventKey}
</div> </div>
) )
}} }}
@ -732,6 +753,17 @@ export class EventControl extends React.Component<
</div> </div>
</div> </div>
</div> </div>
{getEventStrongDesc(events, eventKey)
? render('alert', {
type: 'alert',
body:
'温馨提示:' + getEventStrongDesc(events, eventKey),
level: 'info',
showCloseButton: true,
showIcon: true,
className: 'event-item-desc'
})
: null}
{enventSnapshot[eventKey].actions.length && {enventSnapshot[eventKey].actions.length &&
eventPanelActive[eventKey] ? ( eventPanelActive[eventKey] ? (
<ul className="item-content"> <ul className="item-content">
@ -756,7 +788,8 @@ export class EventControl extends React.Component<
'actionLabel', 'actionLabel',
actionTree, actionTree,
pluginActions, pluginActions,
commonActions commonActions,
allComponents
) || action.actionType} ) || action.actionType}
</div> </div>
</div> </div>
@ -807,7 +840,8 @@ export class EventControl extends React.Component<
}) })
) : ( ) : (
<div className="ae-event-control-placeholder"> <div className="ae-event-control-placeholder">
{/* 翻译未生效,临时方案 */}
{_i18n('4db5110d41293fef57f5a1f364187896')}
</div> </div>
)} )}
</ul> </ul>

View File

@ -21,6 +21,7 @@ export interface ComponentInfo {
disabled?: boolean; disabled?: boolean;
actions?: RendererPluginAction[]; // 动作集 actions?: RendererPluginAction[]; // 动作集
children?: ComponentInfo[]; children?: ComponentInfo[];
id: string;
} }
export interface ContextVariables { export interface ContextVariables {

View File

@ -237,7 +237,8 @@ function BoxBorder({
placeholder: '边框颜色', placeholder: '边框颜色',
clearable: true, clearable: true,
value: value[getKey('border', 'color')], value: value[getKey('border', 'color')],
inputClassName: 'ae-border-colorpicker' inputClassName: 'ae-border-colorpicker',
label: false,
}, },
{ {
onChange: changeItem('border', 'color') onChange: changeItem('border', 'color')

View File

@ -34,7 +34,7 @@ setSchemaTpl('api', (patch: any = {}) => {
placement: 'left' placement: 'left'
} }
: undefined, : undefined,
option: `高级配置`, option: '高级配置',
name: name || 'api', name: name || 'api',
mode: 'inline', mode: 'inline',
className: 'w-full m-b-sm', className: 'w-full m-b-sm',
@ -428,7 +428,7 @@ setSchemaTpl('apiControl', (patch: any = {}) => {
return { return {
type: 'ae-apiControl', type: 'ae-apiControl',
label, label,
name, name: name || 'api',
description, description,
labelRemark: sampleBuilder labelRemark: sampleBuilder
? { ? {

View File

@ -82,13 +82,7 @@ setSchemaTpl(
}) => ({ }) => ({
label: '布局', label: '布局',
name: 'mode', name: 'mode',
type: 'button-group-select', type: 'select',
option: '继承',
horizontal: {
left: 2,
justify: true
},
// className: 'w-full',
pipeIn: defaultValue(''), pipeIn: defaultValue(''),
options: [ options: [
{ {
@ -216,7 +210,7 @@ setSchemaTpl(
type: 'tabs', type: 'tabs',
tabsMode: 'line', // tiled tabsMode: 'line', // tiled
className: 'editor-prop-config-tabs', className: 'editor-prop-config-tabs',
linksClassName: 'editor-prop-config-tabs-links', linksClassName: 'editor-prop-config-tabs-links aa',
contentClassName: contentClassName:
'no-border editor-prop-config-tabs-cont hoverShowScrollBar', 'no-border editor-prop-config-tabs-cont hoverShowScrollBar',
tabs: config tabs: config
@ -519,9 +513,8 @@ setSchemaTpl('expression', {
setSchemaTpl('icon', { setSchemaTpl('icon', {
label: '图标', label: '图标',
type: 'icon-picker', type: 'icon-select',
name: 'icon', name: 'icon',
className: 'fix-icon-picker-overflow',
placeholder: '点击选择图标', placeholder: '点击选择图标',
clearable: true, clearable: true,
description: '' description: ''
@ -596,12 +589,17 @@ setSchemaTpl('className', (schema: any) => {
*/ */
setSchemaTpl('combo-container', (config: SchemaObject) => { setSchemaTpl('combo-container', (config: SchemaObject) => {
if (isObject(config)) { if (isObject(config)) {
const itemsWrapperClassName = let itemsWrapperClassName;
['input-kv', 'combo'].includes((config as any).type) && let itemClassName;
'ae-Combo-items ' + ((config as any).itemsWrapperClassName ?? ''); if (['input-kv', 'combo'].includes((config as any).type)) {
itemsWrapperClassName =
'ae-Combo-items ' + ((config as any).itemsWrapperClassName ?? '');
itemClassName = 'ae-Combo-item ' + ((config as any).itemClassName ?? '');
}
return { return {
...(config as any), ...(config as any),
...(itemsWrapperClassName ? {itemsWrapperClassName} : {}) ...(itemsWrapperClassName ? {itemsWrapperClassName} : {}),
...(itemClassName ? {itemClassName} : {})
}; };
} }
return config; return config;
@ -612,12 +610,20 @@ setSchemaTpl('combo-container', (config: SchemaObject) => {
*/ */
setSchemaTpl( setSchemaTpl(
'status', 'status',
(config: {isFormItem?: boolean; readonly?: boolean; disabled?: boolean}) => { (config: {
isFormItem?: boolean;
readonly?: boolean;
disabled?: boolean;
unsupportStatic?: boolean;
}) => {
return { return {
title: '状态', title: '状态',
body: [ body: [
getSchemaTpl('newVisible'), getSchemaTpl('newVisible'),
getSchemaTpl('hidden'), getSchemaTpl('hidden'),
!config?.unsupportStatic && config?.isFormItem
? getSchemaTpl('static')
: null,
config?.readonly ? getSchemaTpl('readonly') : null, config?.readonly ? getSchemaTpl('readonly') : null,
config?.disabled || config?.isFormItem config?.disabled || config?.isFormItem
? getSchemaTpl('disabled') ? getSchemaTpl('disabled')
@ -690,6 +696,15 @@ setSchemaTpl('visible', {
expressionName: 'visibleOn' expressionName: 'visibleOn'
}); });
setSchemaTpl('static', {
type: 'ae-StatusControl',
label: '静态展示',
mode: 'normal',
name: 'static',
expressionName: 'staticOn'
});
// 新版配置面板兼容 [可见] 状态 // 新版配置面板兼容 [可见] 状态
setSchemaTpl('newVisible', { setSchemaTpl('newVisible', {
type: 'ae-StatusControl', type: 'ae-StatusControl',
@ -1041,42 +1056,49 @@ setSchemaTpl('app-page', {
}); });
setSchemaTpl('app-page-args', { setSchemaTpl('app-page-args', {
type: 'ae-DataMappingControl', type: 'combo',
name: 'params', name: 'params',
label: '页面参数', label: '页面参数',
schema: {type: 'object', properties: {}}, multiple: true,
mode: 'horizontal' removable: true,
addable: true,
strictMode: false,
canAccessSuperData: true,
size: 'lg',
mode: 'horizontal',
items: [
{
name: 'key',
type: 'input-text',
placeholder: '参数名',
source: '${__pageInputSchema}',
labelField: 'label',
valueField: 'value',
required: true
},
{
name: 'val',
type: 'input-formula',
placeholder: '参数值',
variables: '${variables}',
evalMode: false,
variableMode: 'tabs',
inputMode: 'input-group'
}
]
}); });
setSchemaTpl( setSchemaTpl(
'iconLink', 'iconLink',
(schema: {name: 'icon' | 'rightIcon'; visibleOn: boolean}) => { (schema: {name: 'icon' | 'rightIcon'; visibleOn: boolean}) => {
const {name, visibleOn} = schema; const {name, visibleOn} = schema;
return { return getSchemaTpl('icon', {
name: name, name: name,
visibleOn, visibleOn,
label: '图标', label: '图标',
type: 'icon-picker',
className: 'fix-icon-picker-overflow',
placeholder: '点击选择图标', placeholder: '点击选择图标',
clearable: true, clearable: true,
description: '' description: ''
}; });
} }
); );
setSchemaTpl(
'iconLink',
(schema: {name: 'icon' | 'rightIcon'; visibleOn: boolean}) => {
const {name, visibleOn} = schema;
return {
name: name,
visibleOn,
label: '图标',
type: 'icon-picker',
placeholder: '点击选择图标',
clearable: true,
description: ''
};
}
);

View File

@ -63,7 +63,7 @@ setSchemaTpl(
(config: {visibleOn: string; [propName: string]: any}) => { (config: {visibleOn: string; [propName: string]: any}) => {
return [ return [
{ {
type: 'button-group-select', type: 'select',
label: '标题宽度', label: '标题宽度',
name: 'horizontal', name: 'horizontal',
options: [ options: [

View File

@ -213,6 +213,7 @@ setSchemaTpl('addApi', () => {
return getSchemaTpl('apiControl', { return getSchemaTpl('apiControl', {
label: '新增接口', label: '新增接口',
name: 'addApi', name: 'addApi',
mode: 'row',
visibleOn: 'data.creatable' visibleOn: 'data.creatable'
}); });
}); });
@ -238,6 +239,7 @@ setSchemaTpl('editApi', () =>
getSchemaTpl('apiControl', { getSchemaTpl('apiControl', {
label: '编辑接口', label: '编辑接口',
name: 'editApi', name: 'editApi',
mode: 'row',
visibleOn: 'data.editable' visibleOn: 'data.editable'
}) })
); );
@ -256,6 +258,7 @@ setSchemaTpl('deleteApi', () =>
getSchemaTpl('apiControl', { getSchemaTpl('apiControl', {
label: '删除接口', label: '删除接口',
name: 'deleteApi', name: 'deleteApi',
mode: 'row',
visibleOn: 'data.removable' visibleOn: 'data.removable'
}) })
); );

View File

@ -18,8 +18,16 @@ setSchemaTpl('style:formItem', ({renderer, schema}: any) => {
setSchemaTpl( setSchemaTpl(
'style:classNames', 'style:classNames',
(config: {schema: SchemaCollection; isFormItem: boolean}) => { (config: {
const {isFormItem = true, schema = []} = config || {}; schema: SchemaCollection;
isFormItem: boolean;
unsupportStatic?: boolean;
}) => {
const {
isFormItem = true,
unsupportStatic = false,
schema = []
} = config || {};
return { return {
title: 'CSS 类名', title: 'CSS 类名',
@ -35,7 +43,13 @@ setSchemaTpl(
getSchemaTpl('className', { getSchemaTpl('className', {
label: '控件', label: '控件',
name: 'inputClassName' name: 'inputClassName'
}) }),
...unsupportStatic ? [] : [
getSchemaTpl('className', {
label: '表单项静态',
name: 'staticClassName'
})
]
] ]
: [ : [
getSchemaTpl('className', { getSchemaTpl('className', {

View File

@ -521,6 +521,7 @@ setSchemaTpl('submitOnChange', {
setSchemaTpl('validateOnChange', { setSchemaTpl('validateOnChange', {
type: 'select', type: 'select',
name: 'validateOnChange', name: 'validateOnChange',
overlayPlacement: 'top',
label: '校验触发', label: '校验触发',
options: [ options: [
{ {

Some files were not shown because too many files have changed in this diff Show More