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: './'
},
translate: {
appId: '20220810001301703',
key: 'WW7jKaJJBrtCawTOkCpk',
appId: '20220902001329332',
key: 'pVS96QbIzVROBSOarU4R',
host: 'http://api.fanyi.baidu.com'
}
};

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -20,8 +20,6 @@ extendLocale('zh-CN', {
'4d9c32c23df5d234e629c922c58d8e12': '右',
'5ef69f62dc668c1a3e68b51c50a2530a': '图标',
'4434b33a8731a73613ba5fa1eb984efb': 'CSS 类名',
'd46908ab96b7955bc7ba9cb172c4d2c8':
'有哪些辅助类 CSS 类名?请前往 <a href=https://baidu.gitee.io/amis/zh-CN/style/index target=_blank>样式说明</a>,除此之外你可以添加自定义类名,然后在系统配置中添加自定义样式。',
'159dbc2fafd57b9d3652f16659b1b519': '触发方式',
'45a51525391d4a3771b22f2cf1aa96b3': '浮层触发方式默认值为鼠标悬停',
'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);",
'b82231f254baf9a28bf752683d31b169': '自定义容器',
'e5b5798a8bab7dc8a578431991731040': '通过自定义代码来实现容器组件',
'717a7095d0330ee4bdb46ba8c8b44463':
'<div>\n<h2>hello, world!</h2>\n<div id=customBox>自定义容器区域</div>\n</div>',
'96ec95de2d7da5b16465eb980f74deae': '<p>自定义容器区域</p>',
'749f710d280419b1da031c9bc79b3b07': '自定义容器区',
'356b1959a9da95997b4de31415d9d74e': '日期展示',
@ -565,13 +561,6 @@ extendLocale('zh-CN', {
'dcba76890a534e1fe94421be2a17b484': '左下角展示报错消息',
'af5876b89583552eef4c781718886dec': '左下角展示loading动画',
'dd10fdec63a2224aa3d28b48d428cb98': '数据映射',
'ff57dff3fca4dee46a8e693d35b7e728':
'<div> 当开启数据映射时,弹框中的数据只会包含设置的部分,请绑定数据。如:{a: ${a}, b: 2}。</div>',
'290aa0d8fd40285d213a3786c98e28d3':
'<div>当值为 __undefined时表示删除对应的字段可以结合{&: $$}来达到黑名单效果。</div>',
'c7505acc5b5dd1ad17f35dd90e0884d6':
'${data[&] ? 已开启定制参数功能,可点击关闭该功能。 : 如果需要在默认数据的基础上定制参数请配置开启参数定制再定义key和value。}',
'9567f8bbb315b1217b7b32be37f97792': '${data[&] ? 立即关闭 : 立即开启}',
'261bba7ad82914e477f4b37f6a83874e': 'CSS类名',
'5e5d3f13111593b2710673006d4c8297': '外层',
'7e1eb2c588aa1301f4aa19395ef0a177': '分隔线',
@ -587,11 +576,7 @@ extendLocale('zh-CN', {
'bde8a41fc64bfe78d0c4951ac6f93718': '显示蒙层',
'4a757588f5aee8cd039b1d166b096d1a': '点击外部关闭',
'874cf31274d782914c7833cc39836c4e': '可拖拽抽屉大小',
'0eeffa0f121262f0c737975a7a6553e4':
'位置为 左 或 右 时生效。 默认宽度为尺寸字段配置的宽度,值单位默认为 px也支持百分比等单位 100%',
'd3e329f73ae4b58d95cc7769eeca8370': '位置为 为 左 或 右 时生效',
'9c203944698316da279b3c6f8d1933ac':
'位置为 上 或 下 时生效。 默认宽度为尺寸字段配置的高度,值单位默认为 px也支持百分比等单位 100%',
'45ce37c24c6e7252d98c6d450e3ca4ad': '标题区域',
'660553eee939d2bd8ea68172fa7216df': '页脚区域',
'cc70a816b7d61e7212d57335c0a15af5': '下拉按钮',
@ -638,8 +623,6 @@ extendLocale('zh-CN', {
'7ac1519928de413cfe36f5d2e0610430': '自动拉伸',
'8e15f51c9512fdbf4287794d6642a90b': '子节点管理',
'bc78248b34b7bf18691e6d385e0f544b': '子节点内容',
'2f10b0974520010e9db4ed5c87bc2a95':
'<span class=label label-default>子节点${index | plus}</span>',
'023c4bfc60545a2668c2d5111171b5d8': '外层CSS类名',
'a4611da51ffee9140976d01668e45d45': '子节点集合',
'729a4cca5ed3504793c1f3a87d2b48b9': '按钮点选',
@ -729,7 +712,6 @@ extendLocale('zh-CN', {
'66e867eb73a118649800c0a064d0b5aa': '类型名称',
'5aa528690fd771f89683a7f00868f39e': '分支管理',
'35b65a5a3f8d721e12cae310463d69d6': '命中条件',
'c4f1a371191ac24d16e00e105540c47a': '比如: this.type === text',
'85485d70be6b380294428018e54fc9b9': '根据成员数据判断是否使用此分支',
'50bfed6ada3e7d0ef4d20eb727b3d7df': '配置子表单项',
'd68162ea1904f627b033fe3953da295d': '配置子表单集合',
@ -942,8 +924,6 @@ extendLocale('zh-CN', {
'c80c42a0be1b39ed899b1f5560875cf8':
'支持 JS 表达式,如: <code>data.var_a + 2</code>,即当表单项 <code>var_a</code> 变化的时候,会自动给当前表单项设置为 <code>var_a + 2</code> 的值。若设置为字符串,则需要加引号',
'89a8549c2ed7fc23a683599731d92b22': '作用条件',
'e16e5eca749d250efd3ad95434ff7026':
'支持如:<code>\\${xxx}</code>或者<code>data.xxx == a</code> 表达式来配置作用条件,当满足该作用条件时,会将计算结果设置到目标变量上。',
'3df193f5d4f652a4bac331a69761041b': '是否初始应用',
'86cebf86c66c6a4e6731b840c3967ab0':
'是否初始化的时候运行公式结果,并设置到目标变量上。',
@ -1017,8 +997,6 @@ extendLocale('zh-CN', {
'0a72b3858efffaa1bab685fa840b701b': '时间值',
'f6db3514c72bdc34922f137a8a92b997': '输入框获取焦点(非内嵌模式)时触发',
'0f5fc3b84cf9c24ff3acae45ae22fb57': '输入框失去焦点(非内嵌模式)时触发',
'cfbace00045a3debdc8f02858cf753c6':
'提交数据前将根据设定格式化数据,请参考 <a href=https://momentjs.com/ target=_blank>moment</a> 中的格式用法。',
'ecd1a3cadcf1d55250afafbbde767250': '显示格式',
'182503224cfaf1f63c566f13da56a2a4':
'请参考 <a href=https://momentjs.com/ target=_blank>moment</a> 中的格式用法。',
@ -1095,8 +1073,6 @@ extendLocale('zh-CN', {
'd28879b6a8a4ddb62bf6f2ab59303df7': '随表单提交',
'3a76423b7ae40b0fa8b0bedb470cce7e': '独立上传',
'7c6722203327e8173be987f36fadf610': '数据格式',
'abe8f84fa8436e1033af359d8ef25634':
'${formType ? asBase64 ? 小文件时可以使用,默认给 Form 提交的是文件下载地址,设置后给 Form 提交文件内容的 base64 格式字符串。 : File 控件不接管文件上传,直接由表单的保存接口完成。和 Base64 选项二选一。 : }',
'6168fb08fe64663a502a132c5589b73d': '二进制',
'7245fe895fa1cfc42b5217a3de314565': '自动上传',
'cf9e4c80962e712eaa55551cccff317e': '开启分块',
@ -1240,8 +1216,6 @@ extendLocale('zh-CN', {
'f9fb6a063d1856da86a06def2dc6b921': '英文',
'81fafee54baebeb9591b5e7840d7e650': '大屏时展示的配置项',
'0b6eee152cb2553ed4298ca2fe82d3f8': '屏幕宽度 ≥ 1200px',
'ac3906888a34e51c5bdc1297636857ed':
'使用空格分开配置,使用<code>|</code>可将配置栏分组,<a target=_blank href=https://www.froala.com/wysiwyg-editor/docs/options>参考文档</a>',
'f126c4368fbf51cfd470684e7c3d31c9': '中屏时展示的配置项',
'3b8c320d14dba586c581ceb951917397': '屏幕宽度 ≥ 992px',
'89bc688b5b497e515ce3c026a1d92669': '小屏时展示的配置项',
@ -1249,8 +1223,6 @@ extendLocale('zh-CN', {
'b8c8f1c6a56e902bd837420da0f554b3': 'tinymce 设置项',
'e4d0e65de0018b63698ff22d683d6dd5': '是否显示菜单栏',
'63068211669d69b4028eebe0052425e7': '启用的插件',
'a917d194212a4f48b60d094c7a83fa17':
'使用空格分开配置,<a target=_blank href=https://www.tiny.cloud/docs/general-configuration-guide/basic-setup/>参考文档</a>',
'1a920d9999206a9fa5f588c7405fe081':
'SubForm, 配置一个子<code>form</code>作为当前的表单项',
'18c113b99afa964ee988f30e81baf12b': '名称字段名',
@ -1289,8 +1261,6 @@ extendLocale('zh-CN', {
'e54289c1f0e9311185adee89af24e618': '取消编辑按钮图标',
'1205e138ba64dddf61c1f8e6eb3a1aa7': '确认模式',
'1c1618f67cfea6fefb5f287932be2c27': '获取父级数据',
'c811e7212b773b5d698a708113007729':
'配置canAccessSuperData: true 同时配置 strictMode: false 开启此特性,初始会自动映射父级数据域的同名变量。需要注意的是,这里只会初始会映射,一旦修改过就是当前行数据为主了。也就是说,表单项类型的,只会起到初始值的作用',
'677fb705e57897710d28867b7628307e': 'Input CSS 类名',
'14d342362f66aa86e2aa1c1e11aa1204': '标签',
'1b4996b29c7b4d5fb45ca701e6438d14':
@ -1407,8 +1377,6 @@ extendLocale('zh-CN', {
'd1f923b8e23b66b3e48953ba1ce17839': '地理位置选择',
'989ea9acbab9b17d2c15e2946b5365bb': '位置选择',
'dffd9d86d2003615897b12ce7597d77b': '百度地图的 AK',
'3eaf4454ea75f435e78890d051775f68':
'请从<a href=http://lbsyun.baidu.com/ target=_blank>百度地图开放平台</a>获取',
'b472ba224a7d132c487ee6ec4798f835': '坐标格式',
'36443b53c845b197db8d39eeda433ab9': '百度坐标',
'f58cb611aec0998a44ef104b5c950b40': '国测局坐标',
@ -1451,8 +1419,6 @@ extendLocale('zh-CN', {
'dc0c50a5c9832b393df34835111c34a3': '开启内嵌模式',
'1ac065ed64b81380384a0b371d5b404f': '配置选框详情',
'd64b585847f015eaa1443a3a03562350': '已选定数据的展示样式',
'c2ceb5af7595ec6d1818b35d5b68890b':
'支持使用 <code>\\${xxx}</code> 来获取变量,或者用 lodash.template 语法来写模板逻辑。<a target=_blank href=/amis/zh-CN/docs/concepts/template>详情</a>',
'c2c23b4fc7f695c58e947ad413f2c5d8': '选框类型',
'33e6c41fed95c25e3b426d596d504579': '抽出式弹框',
'5a7af8d3e471d98339c84b07a844547b':
@ -1688,15 +1654,6 @@ extendLocale('zh-CN', {
'a2bc1edd7be9348e5a998feb0886c55d': '日志数据源',
'ddeeaa33ae62ead1a77a859fb79b78d7':
'对现有值做映射展示比如原始值是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': '映射表',
'a9de5901385d644363cd056482be7517':
'<p>当值命中左侧 Key 时,展示右侧内容,当没有命中时,默认实现 Key 为 <code>*</code>的内容</div>(请确保key值唯一)',
@ -1771,8 +1728,6 @@ extendLocale('zh-CN', {
'ff88d5db9d61f14bce6e3397fd4652a5': '当没有值时用这个来替代展示',
'348097cc50579e489f0bcb5433637d3a': '开启后可以根据当前列排序(后端排序)。',
'9db64f772c11c614ee00bb3cc066f46f': '列分组名称',
'161799764950b7251c94ae3e44d4c06f':
'当多列的分组名称设置一致时,表格会在显示表头的上层显示超级表头,<a href=https://baidu.github.io/amis/crud/header-group target=_blank>示例</a>',
'19c4f5e98ad302574202de30dddbaf66': '启用快速编辑',
'15c3796e07e33afc7252df751f610c5d': '是否立即保存',
'ba5a0a1ff2c438ae7719ca48b0ce3af7': '启用查看更多展示',
@ -1849,8 +1804,6 @@ extendLocale('zh-CN', {
'da71dcbb13405815476cef28a8b9c4f6': '按钮外层',
'6c5b1f0e8e361a801fa75da070d1cba5': '用来展示纯文字html 标签会被转义。',
'67e77a196826a8880e47ad949ce08ac0': '这是纯文本',
'8f945732891671ab4a3e095ebe58ea38':
'如果当前字段有值,请不要设置,否则覆盖。支持使用 <code>\\${xxx}</code> 来获取变量,或者用 lodash.template 语法来写模板逻辑。<a target=_blank href=/amis/zh-CN/docs/concepts/template>详情</a>',
'83077805e05ac6bedad69b47fca4462b': '进度展示',
'c77048def6e8a2d6c556a3fcc9c66730': '进度条、progress',
'b1aefb18d4bf96dc283a26d67abc41a8':
@ -2115,7 +2068,7 @@ extendLocale('zh-CN', {
'9769ee568100b0c530a06ec3f0c0044d': '内容1',
'4be268145385303e8ebeb480458a380e': '选项卡2',
'c50159e2acff0f4ffdce4c67ec3513a3': '内容2',
'c8794c58d0eb020ca40905d1904d88b2': '修改激活tab值',
'c8794c58d0eb020ca40905d1904d88b2': '激活指定选项卡',
'fcd3abb110aab48ebd0ac2a1d7040d6d': '修改当前激活tab项的key',
'9d000284174ff09642502803887f28ed': '激活第',
'29645b509093191cad34c673c1b3efb7': '项',
@ -2153,8 +2106,6 @@ extendLocale('zh-CN', {
'8a471486c6c7bbe43e14392c6b127aea': '异步任务',
'4f58f808d62c4e31c347e483898396d5': '用来做异步任务呈现或者操作。',
'9ee043b0a77a26d22eec0f4ea99afbd3': 'hive 任务',
'f0eda973dd9e60c659057dadde816725':
'查看详情<a target=_blank href=http://www.baidu.com>日志</a>。',
'3709f71c9552ed5db76cbe8f3cb5d4be': '小流量',
'c60ad696dee4e1eeff6f0f2c2e9b9fc0': '全量',
'5c0dc424442c913c6d16a2cf43137da4': '初始任务信息',
@ -2321,7 +2272,6 @@ extendLocale('zh-CN', {
'7c57a563ab87bc6eb5edd8f5b953f499': '接口设置',
'6aa351f5dacd13d3d862d9c93e4a0241': '发送方式',
'8dc91bca9bc83efea73150e3478657fc': '发送条件',
'd811d2650a17fb7cac710e9376645287': '如this.type == 123',
'91ee84292a5bf5e59d3b6309f948f2f1': '用表达式来设置该请求的发送条件',
'55409342e28d37db86fb23efbd84a025': '发送体格式为',
'e06a14abe7ef66a8ead143db4ae9786e':
@ -2342,8 +2292,6 @@ extendLocale('zh-CN', {
'9ae7a582479116d4cb41e828fbd59798': '发送数据映射',
'0fcbf036057c6dd88b7b809daa0c5eb7':
'当没开启数据映射时,发送 API 的时候会发送尽可能多的数据,如果你想自己控制发送的数据,或者需要额外的数据处理,请开启此选项',
'eba0c4982948edc9b865292dc8abea33':
'<p>当没开启数据映射时,发送数据自动切成白名单模式,配置啥发送啥,请绑定数据。如:<code>{a: \\${a}, b: 2}</code></p><p>如果希望在默认的基础上定制,请先添加一个 Key 为 `&` Value 为 `\\$$` 作为第一行。</p><div>当值为 <code>__undefined</code>时,表示删除对应的字段,可以结合<code>{&: \\$$}</code>来达到黑名单效果。</div>',
'7dd590a9d9e783e980d318bd52891905': '返回结果映射',
'7e295b6ff39ec7356e06c4534bfc4fb3':
'如果需要对返回结果做额外的数据处理,请开启此选项',
@ -2403,8 +2351,6 @@ extendLocale('zh-CN', {
'5d26b8a41e805204c9dcd5ea7e23b150': '请输入文本/值',
'22de6ef85ed60ec54dbdc1d8583e5104': '批量添加',
'421252e16c6cb544fe9ce0be94a190e0': '批量添加选项',
'55c4cbeae7ffae65d211bc5e9968dc28':
'每个选项单列一行,将所有值不重复的项加为新的选项;<br/>每行可通过空格来分别设置label和value,例:张三 zhangsan',
'1e2f96a69fbef8caa8823a3067ebbdc7': '请输入选项内容',
'a4f1ddbbfc96930d24e4b54cb815b62b': '无选项',
'5b4ffa2eadaf629b833b37a3e8742b2c': '不分块',
@ -2427,8 +2373,6 @@ extendLocale('zh-CN', {
'34df758502e02c7c1a58f804a6c96c28': '折叠前文案',
'1d20d90b7c7301b7739900242d38544e': '无配置情况,默认显示标题',
'8aea4138b4fac2627c9b72da37e0671f': '折叠后文案',
'82e9f5ad74c0ff5a041369bd6c7a0760':
'每个选项单列一行,将所有值不重复的项加为新的选项;<br/>每行可通过空格来分别设置time和title,例2022-06-23 期末补考',
'd584018521820dac9e92120737b733ba': '节点配置',
'c8158b3cad598b0b5939788ca4efb298': '接口获取',
'72a3c1690dead6e24f7ac1abc90d5063': '请输入显示时间',
@ -2675,8 +2619,6 @@ extendLocale('zh-CN', {
'1a1ff1e1149a0cd1b39c0b231a334d04':
'可以指定操作完成后刷新目标组件,请填写目标组件的 <code>name</code> 属性,多个组件请用<code>,</code>隔开,如果目标组件为表单项,请先填写表单的名字,再用<code>.</code>连接表单项的名字如:<code>xxForm.xxControl</code>。另外如果刷新目标对象设置为 <code>window</code>,则会刷新整个页面。',
'4fe2f10c6d5bedac03f40a4362e4f69b': '请输入组件name',
'018dcc21d4c932029eaff062c4767f3f':
'有哪些辅助类 CSS 类名?请前往 <a href=https://baidu.github.io/amis/docs/concepts/style target=_blank>样式说明</a>,除此之外你可以添加自定义类名,然后在系统配置中添加自定义样式。',
'3bce1a6217990c8dc087d254f1fe754a': '自动填充',
'f01553e415ca33cc89d0bca84023f4b5':
'将当前已选中的选项的某个字段的值,自动填充到表单中某个表单项中,支持数据映射',
@ -2824,8 +2766,6 @@ extendLocale('zh-CN', {
'ebd0dc3ebde6182caa3b66e0faf658b6': '自定义验证提示',
'd7772d568894afbb1c924bed7f7ddb32': '自带提示不满足时,可以自定义。',
'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': '修改即提交',
'6ccb7091c39a5229f7e77eff4dd44a0e': '设置后,表单中每次有修改都会触发提交',
'1a006028adf7167ae28cdf532bb75ef4': '校验触发',
@ -2839,5 +2779,171 @@ extendLocale('zh-CN', {
'a85ce2404b26140080c929ad9c3ec305': '请输入更多的内容,至少输入 $1 个字符',
'e93275245d529c486018e47136bfae2e': '请检查 Json 格式',
'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', [
{
className: 'p-none',
title: '常用',
title: '基本',
body: [
// 如果同时存在 src、text 和 icon会优先用 src、接着 text、最后 icon
{
@ -96,13 +96,11 @@ export class AvatarPlugin extends BasePlugin {
className: 'ae-ExtendMore mb-3',
body: [
// 图标
{
label: '图标',
getSchemaTpl('icon', {
name: 'icon',
type: 'icon-picker',
className: 'fix-icon-picker-overflow',
label: '图标',
visibleOn: 'data.showtype === "icon"'
},
}),
// 图片
getSchemaTpl('valueFormula', {
rendererSchema: {

View File

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

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

View File

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

View File

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

View File

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

View File

@ -56,12 +56,34 @@ export class DialogPlugin extends BasePlugin {
{
eventName: 'confirm',
eventLabel: '确认',
description: '点击弹窗确认按钮时触发'
description: '点击弹窗确认按钮时触发',
dataSchema: [
{
type: 'object',
properties: {
'event.data': {
type: 'object',
title: '弹窗数据'
}
}
}
]
},
{
eventName: 'cancel',
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',
eventLabel: '确认',
description: '点击抽屉确认按钮时触发'
description: '点击抽屉确认按钮时触发',
dataSchema: [
{
type: 'object',
properties: {
'event.data': {
type: 'object',
title: '抽屉数据'
}
}
}
]
},
{
eventName: 'cancel',
eventLabel: '取消',
description: '点击抽屉取消按钮时触发'
description: '点击抽屉取消按钮时触发',
dataSchema: [
{
type: 'object',
properties: {
'event.data': {
type: 'object',
title: '抽屉数据'
}
}
}
]
}
];
@ -123,7 +145,19 @@ export class DrawerPlugin extends BasePlugin {
}
],
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', {
name: 'overlay',

View File

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

View File

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

View File

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

View File

@ -42,6 +42,22 @@ export class CodeEditorControlPlugin extends BasePlugin {
};
events: RendererPluginEvent[] = [
{
eventName: 'change',
eventLabel: '代码变化',
description: '代码变化时触发',
dataSchema: [
{
type: 'object',
properties: {
'event.data.value': {
type: 'string',
title: '当前代码'
}
}
}
]
},
{
eventName: 'focus',
eventLabel: '获取焦点',
@ -143,7 +159,10 @@ export class CodeEditorControlPlugin extends BasePlugin {
getSchemaTpl('autoFillApi')
]
},
getSchemaTpl('status', {isFormItem: true}),
getSchemaTpl('status', {
isFormItem: true,
unsupportStatic: true
}),
getSchemaTpl('validation', {
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 {JSONPipeOut} from 'amis-editor-core';
import {mockValue} from 'amis-editor-core';
import {
RendererPluginEvent,
RendererPluginAction
} from 'amis-editor-core';
import {RendererPluginEvent, RendererPluginAction} from 'amis-editor-core';
import {setVariable} from 'amis-core';
export class ComboControlPlugin extends BasePlugin {
@ -109,6 +106,10 @@ export class ComboControlPlugin extends BasePlugin {
'event.data.value': {
type: 'string',
title: '现有组合项的值'
},
'event.data.item': {
type: 'object',
title: '被删除的项'
}
}
}
@ -125,6 +126,14 @@ export class ComboControlPlugin extends BasePlugin {
'event.data.key': {
type: 'string',
title: '选项卡索引'
},
'event.data.value': {
type: 'string',
title: '现有组合项的值'
},
'event.data.item': {
type: 'object',
title: '被激活的项'
}
}
}
@ -490,14 +499,26 @@ export class ComboControlPlugin extends BasePlugin {
name: 'lazyLoad',
label: '懒加载',
pipeIn: defaultValue(false),
description: '如果数据比较多,比较卡顿时,可开启此配置项'
labelRemark: {
className: 'm-l-xs',
trigger: 'click',
rootClose: true,
placement: 'left',
content: '如果数据比较多,比较卡顿时,可开启此配置项。'
}
}),
getSchemaTpl('switch', {
name: 'strictMode',
label: '严格模式',
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',
label: '允许为空',
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;
icon = 'fa fa-object-group';
pluginIcon = 'form-group-plugin';
description = `表单项容器`;
description = '表单项容器';
docLink = '/amis/zh-CN/components/form/group';
tags = ['容器'];
/**

View File

@ -48,6 +48,22 @@ export class DiffEditorControlPlugin extends BasePlugin {
};
events: RendererPluginEvent[] = [
{
eventName: 'change',
eventLabel: '代码变化',
description: '代码变化时触发',
dataSchema: [
{
type: 'object',
properties: {
'event.data.value': {
type: 'string',
title: '当前代码'
}
}
}
]
},
{
eventName: 'focus',
eventLabel: '获取焦点',
@ -155,7 +171,10 @@ export class DiffEditorControlPlugin extends BasePlugin {
getSchemaTpl('autoFillApi')
]
},
getSchemaTpl('status', {isFormItem: true}),
getSchemaTpl('status', {
isFormItem: true,
unsupportStatic: true
}),
getSchemaTpl('validation', {
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 = '字段集';
isBaseComponent = true;
icon = 'fa fa-toggle-down';
description = `多个表单项的组合,可配置是否折叠`;
description = '多个表单项的组合,可配置是否折叠';
docLink = '/amis/zh-CN/components/form/fieldset';
tags = ['表单项'];
scaffold = {

View File

@ -214,7 +214,7 @@ export class FormPlugin extends BasePlugin {
events: RendererPluginEvent[] = [
{
eventName: 'inited',
eventLabel: '初始化完成',
eventLabel: '初始化接口请求成功',
description: '远程初始化接口请求成功时触发',
// 表单数据为表单变量
dataSchema: [
@ -223,7 +223,7 @@ export class FormPlugin extends BasePlugin {
properties: {
'event.data': {
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',
eventLabel: '提交成功',
description: '表单提交请求成功后触发',
description:
'表单提交成功后触发,如果事件源是按钮,且按钮的类型为“提交”,那么即便当前表单没有配置“保存接口”也将触发提交成功事件',
dataSchema: [
{
type: 'object',
properties: {
'event.data.result': {
type: 'object',
title: '提交成功后返回的数据'
title: '保存接口请求成功后返回的数据'
}
}
}
@ -335,7 +352,7 @@ export class FormPlugin extends BasePlugin {
properties: {
'event.data.error': {
type: 'object',
title: '提交失败后返回的错误信息'
title: '保存接口请求失败后返回的错误信息'
}
}
}
@ -794,6 +811,11 @@ export class FormPlugin extends BasePlugin {
getSchemaTpl('className'),
getSchemaTpl('className', {
name: 'staticClassName',
label: '静态展示时 的 CSS 类名'
}),
getSchemaTpl('className', {
name: 'panelClassName',
visibleOn: 'this.wrapWithPanel !== false',
@ -828,7 +850,8 @@ export class FormPlugin extends BasePlugin {
}),
getSchemaTpl('disabled'),
getSchemaTpl('visible')
getSchemaTpl('visible'),
getSchemaTpl('static')
]
}
])

View File

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

View File

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

View File

@ -10,6 +10,8 @@ import {
import {formItemControl} from '../../component/BaseControl';
import {RendererPluginAction, RendererPluginEvent} from 'amis-editor-core';
import {ValidatorTag} from '../../validator';
import {getEventControlConfig} from '../../renderer/event-control/helper';
export class CityControlPlugin extends BasePlugin {
// 关联渲染器名字
@ -84,66 +86,67 @@ export class CityControlPlugin extends BasePlugin {
}
];
panelJustify = true;
panelBodyCreator = (context: BaseEventContext) => {
return formItemControl(
return getSchemaTpl('tabs', [
{
common: {
replace: true,
body: [
getSchemaTpl('formItemName', {
required: true
}),
getSchemaTpl('label'),
// getSchemaTpl('switchDefaultValue'),
title: '属性',
body: getSchemaTpl('collapseGroup', [
{
title: '基本',
body: [
getSchemaTpl('formItemName', {
required: true
}),
getSchemaTpl('label'),
getSchemaTpl('valueFormula', {
rendererSchema: context?.schema,
rendererWrapper: true,
mode: 'vertical' // 改成上下展示模式
}),
getSchemaTpl('switch', {
name: 'allowDistrict',
label: '允许选择区域',
pipeIn: defaultValue(true)
}),
/*
{
name: 'value',
type: 'input-city',
label: '默认值',
visibleOn: 'typeof data.value !== "undefined"',
validations: 'isNumeric',
labelRemark: {
trigger: 'click',
className: 'm-l-xs',
rootClose: true,
content: '城市编码',
placement: 'left'
}
},
*/
getSchemaTpl('switch', {
name: 'allowCity',
label: '允许选择城市',
pipeIn: defaultValue(true)
}),
getSchemaTpl('valueFormula', {
rendererSchema: context?.schema,
rendererWrapper: true,
mode: 'vertical' // 改成上下展示模式
}),
getSchemaTpl('switch', {
name: 'allowDistrict',
label: '允许选择区域',
pipeIn: defaultValue(true)
}),
getSchemaTpl('switch', {
name: 'allowCity',
label: '允许选择城市',
pipeIn: defaultValue(true)
}),
getSchemaTpl('switch', {
name: 'searchable',
label: '是否出搜索框',
pipeIn: defaultValue(false)
}),
getSchemaTpl('extractValue')
]
},
status: {}
getSchemaTpl('switch', {
name: 'searchable',
label: '是否出搜索框',
pipeIn: defaultValue(false)
})
]
},
getSchemaTpl('status', {isFormItem: true}),
getSchemaTpl('validation', {tag: ValidatorTag.MultiSelect})
])
},
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',
eventLabel: '获取焦点',
description: '输入框获取焦点(非内嵌模式)时触发'
description: '输入框获取焦点(非内嵌模式)时触发',
dataSchema: [
{
type: 'object',
properties: {
'event.data.value': {
type: 'string',
title: '时间值'
}
}
}
]
},
{
eventName: 'blur',
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;
icon = 'fa fa-upload';
pluginIcon = 'input-file-plugin';
description = `可上传多个文件,可配置是否自动上传以及大文件分片上传`;
description = '可上传多个文件,可配置是否自动上传以及大文件分片上传';
docLink = '/amis/zh-CN/components/form/input-file';
tags = ['表单项'];
scaffold = {
type: 'input-file',
label: '文件上传',
autoUpload: true,
proxy: true,
uploadType: 'fileReceptor',
name: 'file',
receiver: {
url: 'object-upload://default',
@ -51,7 +54,7 @@ export class FileControlPlugin extends BasePlugin {
{
type: 'object',
properties: {
'event.data.value': {
'event.data.file': {
type: 'object',
title: '上传的文件'
}
@ -67,7 +70,7 @@ export class FileControlPlugin extends BasePlugin {
{
type: 'object',
properties: {
'event.data.value': {
'event.data.item': {
type: 'object',
title: '被移除的文件'
}
@ -83,7 +86,7 @@ export class FileControlPlugin extends BasePlugin {
{
type: 'object',
properties: {
'event.data.value': {
'event.data.item': {
type: 'object',
title: '远程上传请求成功后返回的结果数据'
}
@ -99,7 +102,7 @@ export class FileControlPlugin extends BasePlugin {
{
type: 'object',
properties: {
'event.data.file': {
'event.data.item': {
type: 'object',
title: '上传的文件'
},
@ -240,7 +243,7 @@ export class FileControlPlugin extends BasePlugin {
}),
getSchemaTpl('proxy', {
value: false,
value: true,
visibleOn: 'data.uploadType !== "asForm" || !data.uploadType'
}),
@ -263,7 +266,7 @@ export class FileControlPlugin extends BasePlugin {
type: 'container',
className: 'ae-ExtendMore mb-3',
visibleOn:
'data.uploadType !== "asForm" && data.useChunk != false',
'data.uploadType !== "asForm" && data.useChunk === true',
body: [
{
type: 'input-group',
@ -287,6 +290,7 @@ export class FileControlPlugin extends BasePlugin {
'data.uploadType == "fileReceptor" && data.useChunk != false',
body: [
getSchemaTpl('apiControl', {
mode: 'row',
name: 'startChunkApi',
label: tipedLabel(
'分块准备接口',
@ -295,6 +299,7 @@ export class FileControlPlugin extends BasePlugin {
value: '/api/upload/startChunk'
}),
getSchemaTpl('apiControl', {
mode: 'row',
name: 'chunkApi',
label: tipedLabel(
'分块上传接口',
@ -303,6 +308,7 @@ export class FileControlPlugin extends BasePlugin {
value: '/api/upload/chunk'
}),
getSchemaTpl('apiControl', {
mode: 'row',
name: 'finishChunkApi',
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})
])
},
@ -371,6 +380,7 @@ export class FileControlPlugin extends BasePlugin {
body: getSchemaTpl('collapseGroup', [
getSchemaTpl('style:formItem', {renderer: context.info.renderer}),
getSchemaTpl('style:classNames', {
unsupportStatic: true,
schema: [
getSchemaTpl('className', {
name: 'descriptionClassName',

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -27,7 +27,8 @@ export class PickerControlPlugin extends BasePlugin {
isBaseComponent = true;
icon = 'fa fa-window-restore';
pluginIcon = 'picker-plugin';
description = `通过<code>pickerSchema</code>配置可供选取的数据源进行选择需要的数据,支持多选`;
description =
'通过 pickerSchema 配置可供选取的数据源进行选择需要的数据,支持多选';
docLink = '/amis/zh-CN/components/form/picker';
tags = ['表单项'];
scaffold = {
@ -72,13 +73,29 @@ export class PickerControlPlugin extends BasePlugin {
type: 'string',
title: '选中值'
},
'event.data.option': {
'event.data.selectedItems': {
type: 'string',
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 {getEventControlConfig} from '../../renderer/event-control/helper';
import {
RendererPluginAction,
RendererPluginEvent
} from 'amis-editor-core';
import {RendererPluginAction, RendererPluginEvent} from 'amis-editor-core';
export class RadiosControlPlugin extends BasePlugin {
// 关联渲染器名字
@ -21,7 +18,7 @@ export class RadiosControlPlugin extends BasePlugin {
isBaseComponent = true;
icon = 'fa fa-dot-circle-o';
pluginIcon = 'radios-plugin';
description = `通过<code>options</code>配置选项,可通过<code>source</code>拉取选项`;
description = '通过 options 配置选项,可通过 source 拉取选项';
docLink = '/amis/zh-CN/components/form/radios';
tags = ['表单项'];
scaffold = {
@ -70,6 +67,10 @@ export class RadiosControlPlugin extends BasePlugin {
'event.data.value': {
type: 'string',
title: '选中值'
},
'event.data.items': {
type: 'array',
title: '选项集合'
}
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -25,27 +25,28 @@ import {getEventControlConfig} from '../renderer/event-control/helper';
import {SchemaObject} from 'amis/lib/Schema';
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';
// 组件名称
name = '表格V2';
name = '表格2';
isBaseComponent = true;
panelJustify = true;
disabledRendererPlugin = true;
description =
'用来展示表格数据,可以配置列信息,然后关联数据便能完成展示。支持嵌套、超级表头、列固定、表头固顶、合并单元格等等。当前组件需要配置数据源,不自带数据拉取,请优先使用 「CRUD」 组件。';
docLink = '/amis/zh-CN/components/table-v2';
docLink = '/amis/zh-CN/components/table2';
icon = 'fa fa-table';
scaffold: SchemaObject = {
type: 'table-v2',
type: 'table2',
columns: [
{
title: '列信息',
key: 'a'
name: 'a'
}
],
@ -63,7 +64,7 @@ export class TableV2Plugin extends BasePlugin {
];
previewSchema: any = {
type: 'table-v2',
type: 'table2',
className: 'text-left m-b-none',
items: [
{a: 1, b: 2, c: 9},
@ -73,11 +74,11 @@ export class TableV2Plugin extends BasePlugin {
columns: [
{
title: 'A',
key: 'a'
name: 'a'
},
{
title: 'B',
key: 'b'
name: 'b'
}
]
};
@ -100,7 +101,7 @@ export class TableV2Plugin extends BasePlugin {
},
{
type: 'input-text',
name: 'key',
name: 'name',
placeholder: '绑定字段名'
},
{
@ -325,23 +326,24 @@ export class TableV2Plugin extends BasePlugin {
const columns: EditorNodeType = node.children.find(
item => item.isRegion && item.region === 'columns'
);
for (let current of columns.children) {
const schema = current.schema;
if (schema && schema.key) {
itemsSchema.properties[schema.key] = current.info?.plugin
?.buildDataSchemas
? await current.info.plugin.buildDataSchemas(current, region)
: {
type: 'string',
title: schema.label || schema.title,
description: schema.description
};
if (columns) {
for (let current of columns.children) {
const schema = current.schema;
if (schema && schema.key) {
itemsSchema.properties[schema.key] = current.info?.plugin
?.buildDataSchemas
? await current.info.plugin.buildDataSchemas(current, region)
: {
type: 'string',
title: schema.label || schema.title,
description: schema.description
};
}
}
}
const result: any = {
$id: 'table-v2',
$id: 'table2',
type: 'object',
properties: {
items: {
@ -821,8 +823,8 @@ export class TableV2Plugin extends BasePlugin {
if (Array.isArray(props.columns)) {
props.columns.forEach((column: any) => {
if (column.key) {
setVariable(mockedData, column.key, mockValue(column));
if (column.name) {
setVariable(mockedData, column.name, mockValue(column));
}
});
}
@ -869,7 +871,7 @@ export class TableV2Plugin extends BasePlugin {
if (
!schema.$$id &&
['crud', 'crud2'].includes(schema.$$editor?.renderer.name) &&
renderer.name === 'table-v2'
renderer.name === 'table2'
) {
return {
...({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 React from 'react';
import {FormItemProps, getVariable} from 'amis-core';
import {getVariable} from 'amis-core';
import {
BasePlugin,
@ -20,7 +20,7 @@ import {TabsSchema} from 'amis/lib/renderers/Tabs';
import {SchemaObject} from 'amis/lib/Schema';
import {remarkTpl} from '../component/BaseControl';
export class TableCellV2Plugin extends BasePlugin {
export class TableCell2Plugin extends BasePlugin {
panelTitle = '列配置';
panelIcon = 'fa fa-columns';
@ -28,7 +28,7 @@ export class TableCellV2Plugin extends BasePlugin {
const {context, data} = event.context;
if (
!context.node.parent?.parent?.type ||
context.node.parent.parent.type !== 'table-v2'
context.node.parent.parent.type !== 'table2'
) {
return;
}
@ -42,7 +42,7 @@ export class TableCellV2Plugin extends BasePlugin {
? false
: {
sameName: context.info.renderer.isFormItem ? 'name' : undefined,
name: 'key',
name: 'name',
type: 'ae-DataBindingControl',
label: '列字段',
onBindingChange(
@ -557,7 +557,6 @@ export class TableCellV2Plugin extends BasePlugin {
const parent = dom.parentElement?.parentElement;
const groupId = parent?.getAttribute('data-group-id');
const wrapper = dom.closest('table')!.parentElement?.parentElement;
return [].slice.call(
wrapper?.querySelectorAll(
`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: [
getSchemaTpl('collapseGroup', [
{
title: '常用',
title: '基本',
body: [
{
label: '标题',

View File

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

View File

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

View File

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

View File

@ -62,7 +62,13 @@ export class VideoPlugin extends BasePlugin {
getSchemaTpl('switch', {
name: 'isLive',
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 {
BaseEventContext,
BasePlugin,
@ -85,7 +89,7 @@ export class WizardPlugin extends BasePlugin {
events: RendererPluginEvent[] = [
{
eventName: 'inited',
eventLabel: '初始化完成',
eventLabel: '初始化接口请求成功',
description: '远程初始化接口请求成功时触发',
dataSchema: [
{
@ -93,7 +97,7 @@ export class WizardPlugin extends BasePlugin {
properties: {
'event.data': {
type: 'object',
title: 'initApi 远程请求返回的初始化数据'
title: '初始化接口请求成功返回的数据'
}
}
}

View File

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

View File

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

View File

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

View File

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

View File

@ -236,12 +236,17 @@ export default class FeatureControl extends React.Component<
className: `${klass}-action`,
btnClassName: `${klass}-action--btn`,
menuClassName: `${klass}-action--menus`,
buttons: this.state.unUseFeat.map(item => {
return {
label: item.label,
onClick: () => this.handleAdd(item)
};
})
buttons: this.state.unUseFeat.map(
item => {
return {
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) {
return true; // 数值为空不进行类型识别
}
const {rendererSchema} = this.props;
const expectType = this.props.valueType;
if (expectType === null || expectType === undefined) {
@ -246,6 +247,16 @@ export default class FormulaControl extends React.Component<
const curData = this.getContextData();
if (
rendererSchema.type === 'switch' &&
(rendererSchema.trueValue !== undefined ||
rendererSchema.falseValue !== undefined)
) {
// 开关类型组件单独处理
return (
rendererSchema.trueValue === value ||
rendererSchema.falseValue === value
);
} else if (
(expectType === 'number' && isNumber(value)) ||
(expectType === 'boolean' && isBoolean(value)) ||
(expectType === 'object' && isPlainObject(value)) ||

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -13,9 +13,12 @@ import {
SHOW_SELECT_PROP,
renderCmptActionSelect,
renderCmptSelect,
SUPPORT_DISABLED_CMPTS
SUPPORT_DISABLED_CMPTS,
SUPPORT_STATIC_FORMITEM_CMPTS
} from './helper';
import {BaseLabelMark} from '../../component/BaseControl';
import {i18n as _i18n} from 'i18n-runtime';
const MSG_TYPES: {[key: string]: string} = {
info: '提示',
warning: '警告',
@ -37,7 +40,8 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
descDetail: (info: any) => {
return (
<div>
<span className="variable-left">{info?.args?.url}</span>
<span className="variable-left">{info?.args?.url || '-'}</span>
</div>
);
},
@ -66,6 +70,7 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
label: '页面参数',
multiple: true,
mode: 'horizontal',
size: 'lg',
items: [
{
name: 'key',
@ -103,13 +108,13 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
actionLabel: '打开页面',
actionType: 'link',
description: '打开指定页面',
innerArgs: ['link', 'params'],
innerArgs: ['link', 'params', 'pageName', '__pageInputSchema'],
descDetail: (info: any) => {
return (
<div>
<span className="variable-left variable-right">
{info?.args?.pageName}
{info?.args?.pageName || '-'}
</span>
</div>
@ -181,7 +186,10 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
required: true,
pipeIn: defaultValue({
title: '弹框标题',
body: '<p>对,你刚刚点击了</p>'
body: '<p>对,你刚刚点击了</p>',
showCloseButton: true,
showErrorMsg: true,
showLoading: true
}),
asFormItem: true,
visibleOn: 'data.groupType === "dialog"',
@ -199,7 +207,8 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
}
block
>
{/* 翻译未生效,临时方案 */}
{_i18n('a532be3ad5f3fda70d228b8542e81835')}
</Button>
)
},
@ -227,7 +236,8 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
}
block
>
{/* 翻译未生效,临时方案 */}
{_i18n('a532be3ad5f3fda70d228b8542e81835')}
</Button>
)
}
@ -292,7 +302,7 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
return (
<div>
{MSG_TYPES[info?.args?.msgType] || ''}
<span className="variable-left">{info?.args?.msg}</span>
<span className="variable-left">{info?.args?.msg || '-'}</span>
</div>
);
},
@ -421,10 +431,10 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
<div>
<span className="variable-right variable-left">
{apiInfo?.method}
{apiInfo?.method || '-'}
</span>
<span className="variable-left">{apiInfo?.url}</span>
<span className="variable-left">{apiInfo?.url || '-'}</span>
</div>
);
},
@ -552,7 +562,7 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
<div>
<span className="variable-left variable-right">
{info?.rendererLabel}
{info?.rendererLabel || '-'}
</span>
</div>
@ -566,7 +576,7 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
<div>
<span className="variable-left variable-right">
{info?.rendererLabel}
{info?.rendererLabel || '-'}
</span>
</div>
@ -576,7 +586,7 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
],
supportComponents: '*',
schema: [
...renderCmptSelect('选择组件', true),
...renderCmptSelect('目标组件', true),
{
type: 'radios',
label: '显示/隐藏',
@ -611,7 +621,7 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
<div>
<span className="variable-left variable-right">
{info?.rendererLabel}
{info?.rendererLabel || '-'}
</span>
</div>
@ -625,7 +635,7 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
<div>
<span className="variable-left variable-right">
{info?.rendererLabel}
{info?.rendererLabel || '-'}
</span>
</div>
@ -639,7 +649,7 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
...SUPPORT_DISABLED_CMPTS
],
schema: [
...renderCmptSelect('选择组件', true),
...renderCmptSelect('目标组件', true),
{
type: 'radios',
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: '刷新组件',
actionType: 'reload',
@ -671,19 +738,177 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
<div>
<span className="variable-left variable-right">
{info?.rendererLabel}
{info?.rendererLabel || '-'}
</span>
</div>
);
},
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',
description: '设置数据容器或表单项的数据',
description: '更新目标组件的数据域或目标表单项的数据值',
innerArgs: [
'value',
'index',
@ -696,7 +921,7 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
<div>
<span className="variable-left variable-right">
{info?.rendererLabel}
{info?.rendererLabel || '-'}
</span>
{/*
@ -710,25 +935,32 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
},
supportComponents: 'byComponent',
schema: [
...renderCmptActionSelect('选择组件', true),
...renderCmptActionSelect(
'目标组件',
true,
(value: string, oldVal: any, data: any, form: any) => {
form.setValueByName('args.__containerType', 'all');
form.setValueByName('args.__comboType', 'all');
}
),
getArgsWrapper({
type: 'wrapper',
className: 'p-none',
body: [
{
type: 'radios',
required: true,
name: '__containerType',
mode: 'horizontal',
label: '赋值方式',
visibleOn: `data.__rendererName && ${IS_DATA_CONTAINER}`,
label: '数据设置',
pipeIn: defaultValue('all'),
visibleOn: `${IS_DATA_CONTAINER}`,
options: [
{
label: '数据域赋值',
label: '直接赋值',
value: 'all'
},
{
label: '数据域成员赋值',
label: '成员赋值',
value: 'appoint'
}
],
@ -744,12 +976,12 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
},
{
type: 'radios',
required: true,
name: '__comboType',
inputClassName: 'event-action-radio',
mode: 'horizontal',
label: '赋值方式',
visibleOn: `data.__rendererName && __rendererName === 'combo'`,
label: '数据设置',
pipeIn: defaultValue('all'),
visibleOn: `data.__rendererName === 'combo'`,
options: [
{
label: '全量',
@ -777,37 +1009,31 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
name: 'index',
mode: 'horizontal',
label: '输入序号',
size: 'lg',
placeholder: '请输入待更新序号',
visibleOn: `data.__comboType && __comboType === 'appoint' && data.__rendererName && data.__rendererName === 'combo'`
visibleOn: `data.__comboType === 'appoint' && data.__rendererName === 'combo'`
},
{
type: 'combo',
name: 'value',
label: '字段赋值',
label: '',
multiple: true,
removable: true,
required: true,
addable: true,
strictMode: false,
canAccessSuperData: true,
size: 'lg',
mode: 'horizontal',
items: [
{
name: 'key',
type: 'select',
type: 'input-text',
placeholder: '变量名',
source: '${__setValueDs}',
labelField: 'label',
valueField: 'value',
required: true,
visibleOn: `data.__rendererName && ${SHOW_SELECT_PROP}`
},
{
name: 'key',
type: 'input-text',
placeholder: '变量名',
required: true,
visibleOn: `data.__rendererName && !${SHOW_SELECT_PROP} && __comboType === 'appoint'`
required: true
},
{
name: 'val',
@ -819,12 +1045,12 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
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',
name: 'value',
label: '字段赋值',
label: '',
multiple: true,
removable: true,
required: true,
@ -832,6 +1058,7 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
strictMode: false,
canAccessSuperData: true,
mode: 'horizontal',
size: 'lg',
items: [
{
type: 'combo',
@ -845,6 +1072,7 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
strictMode: false,
canAccessSuperData: true,
className: 'm-l',
size: 'lg',
mode: 'horizontal',
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',
@ -876,10 +1104,23 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
evalMode: false,
variableMode: 'tabs',
inputMode: 'input-group',
label: '赋值',
label: '',
size: 'lg',
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
}
]
@ -895,14 +1136,14 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
<div>
<span className="variable-left variable-right">
{info?.rendererLabel}
{info?.rendererLabel || '-'}
</span>
</div>
);
},
supportComponents: 'form',
schema: renderCmptSelect('选择组件', true)
schema: renderCmptSelect('目标组件', true)
},
{
actionLabel: '清空表单',
@ -913,14 +1154,14 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
<div>
<span className="variable-left variable-right">
{info?.rendererLabel}
{info?.rendererLabel || '-'}
</span>
</div>
);
},
supportComponents: 'form',
schema: renderCmptSelect('选择组件', true)
schema: renderCmptSelect('目标组件', true)
},
{
actionLabel: '重置表单',
@ -931,14 +1172,14 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
<div>
<span className="variable-left variable-right">
{info?.rendererLabel}
{info?.rendererLabel || '-'}
</span>
</div>
);
},
supportComponents: 'form',
schema: renderCmptSelect('选择组件', true)
schema: renderCmptSelect('目标组件', true)
},
{
actionLabel: '校验表单',
@ -949,21 +1190,21 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
<div>
<span className="variable-left variable-right">
{info?.rendererLabel}
{info?.rendererLabel || '-'}
</span>
</div>
);
},
supportComponents: 'form',
schema: renderCmptSelect('选择组件', true)
schema: renderCmptSelect('目标组件', true)
},
{
actionLabel: '组件特性动作',
actionType: 'component',
description: '触发所选组件的特性动作',
supportComponents: '*',
schema: renderCmptActionSelect('选择组件', true)
schema: renderCmptActionSelect('目标组件', true)
}
]
},
@ -980,7 +1221,9 @@ const ACTION_TYPE_TREE = (manager: any): RendererPluginAction[] => {
return (
<div>
<span className="variable-left">{info?.args?.content}</span>
<span className="variable-left">
{info?.args?.content || '-'}
</span>
</div>
);
},

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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