fix(editor): 值格式设置文本1后自动转为了数字1

This commit is contained in:
yangwei9012 2024-01-16 12:43:50 +08:00
parent 79a29f93bd
commit b2520daef9
2 changed files with 25 additions and 5 deletions

View File

@ -40,6 +40,7 @@ export function valuePipeOut(value: any) {
return undefined;
}
// 文本1会被转为数字1值格式慎用
return JSON.parse(value);
} catch (e) {
return value;

View File

@ -7,7 +7,8 @@ import {
getSchemaTpl,
BasePlugin,
tipedLabel,
JSONPipeOut
JSONPipeOut,
undefinedPipeOut
} from 'amis-editor-core';
import {ValidatorTag} from '../../validator';
@ -221,9 +222,6 @@ export class SelectControlPlugin extends BasePlugin {
]
}),
getSchemaTpl('checkAll'),
getSchemaTpl('valueFormula', {
rendererSchema: (schema: Schema) => schema
}),
getSchemaTpl('labelRemark'),
getSchemaTpl('remark'),
getSchemaTpl('placeholder'),
@ -234,7 +232,28 @@ export class SelectControlPlugin extends BasePlugin {
title: '选项',
body: [
getSchemaTpl('optionControlV2'),
getSchemaTpl('selectFirst'),
getSchemaTpl('selectFirst', {
onChange: (
value: any,
oldValue: any,
model: any,
form: any
) => {
if (value) {
form.deleteValueByName('value');
}
}
}),
getSchemaTpl('valueFormula', {
rendererSchema: (schema: Schema) => ({
...schema,
type: 'input-text'
}),
pipeOut: undefinedPipeOut,
// 默认值组件设计有些问题自动发起了请求接口数据作为了默认值选项接口形式应该是设置静态值或者FX
needDeleteProps: ['source'],
hiddenOn: 'this.selectFirst === true'
}),
getSchemaTpl(
'loadingConfig',
{