amis-saas-6469 [Bug] 「Bug」amis-editor: 修改组件默认值影响最大最小值

Change-Id: Ifcaa481552bae989375c7e835e954477d5f2a6b8
This commit is contained in:
2betop 2022-09-02 17:57:21 +08:00
parent cb08739533
commit 846a0721e1
6 changed files with 9 additions and 19 deletions

View File

@ -323,7 +323,6 @@ export class DateControlPlugin extends BasePlugin {
name: 'minDate',
rendererSchema: {
...context?.schema,
value: context?.schema.minDate
},
needDeleteProps: ['minDate'], // 避免自我限制
label: tipedLabel('最小值', tipedLabelText)
@ -332,7 +331,6 @@ export class DateControlPlugin extends BasePlugin {
name: 'maxDate',
rendererSchema: {
...context?.schema,
value: context?.schema.maxDate
},
needDeleteProps: ['maxDate'], // 避免自我限制
label: tipedLabel('最大值', tipedLabelText)

View File

@ -269,7 +269,6 @@ export class DateRangeControlPlugin extends BasePlugin {
name: 'minDate',
rendererSchema: {
...context?.schema,
value: context?.schema.minDate,
type: 'input-date'
},
needDeleteProps: ['minDate'], // 避免自我限制
@ -279,7 +278,6 @@ export class DateRangeControlPlugin extends BasePlugin {
name: 'maxDate',
rendererSchema: {
...context?.schema,
value: context?.schema.maxDate,
type: 'input-date'
},
needDeleteProps: ['maxDate'], // 避免自我限制
@ -290,7 +288,6 @@ export class DateRangeControlPlugin extends BasePlugin {
name: 'minDuration',
rendererSchema: {
...context?.schema,
value: context?.schema.minDuration,
type: 'input-text'
},
needDeleteProps: ['minDuration'], // 避免自我限制
@ -301,7 +298,6 @@ export class DateRangeControlPlugin extends BasePlugin {
name: 'maxDuration',
rendererSchema: {
...context?.schema,
value: context?.schema.maxDuration,
type: 'input-text'
},
needDeleteProps: ['maxDuration'], // 避免自我限制

View File

@ -153,20 +153,20 @@ export class RangeControlPlugin extends BasePlugin {
name: 'value',
rendererSchema: {
...context?.schema,
value: context?.schema.min || 0,
type: 'input-number'
},
valueType: 'number', // 期望数值类型
visibleOn: '!data.multiple'
visibleOn: '!data.multiple',
pipeIn: defaultValue(0)
}),
getSchemaTpl('valueFormula', {
name: 'min',
rendererSchema: {
...context?.schema,
value: context?.schema.min || 0,
type: 'input-number'
},
pipeIn: defaultValue(0),
needDeleteProps: ['min'], // 避免自我限制
label: tipedLabel(
'最小值',
@ -179,9 +179,9 @@ export class RangeControlPlugin extends BasePlugin {
name: 'max',
rendererSchema: {
...context?.schema,
value: context?.schema.max || 100,
type: 'input-number'
},
pipeIn: defaultValue(100),
needDeleteProps: ['max'], // 避免自我限制
label: tipedLabel(
'最大值',

View File

@ -121,7 +121,6 @@ export class RateControlPlugin extends BasePlugin {
name: 'min',
rendererSchema: {
...context?.schema,
value: context?.schema.min,
type: 'input-number'
},
needDeleteProps: ['min'], // 避免自我限制
@ -136,7 +135,6 @@ export class RateControlPlugin extends BasePlugin {
name: 'max',
rendererSchema: {
...context?.schema,
value: context?.schema.max,
type: 'input-number'
},
needDeleteProps: ['max'], // 避免自我限制

View File

@ -61,7 +61,7 @@ export class StaticControlPlugin extends BasePlugin {
rendererSchema: {
...context?.schema,
type: 'textarea', // 改用多行文本编辑
value: context?.schema.tpl, // 避免默认值丢失
},
mode: 'vertical', // 改成上下展示模式
name: 'tpl'

View File

@ -13,7 +13,7 @@ import isString from 'lodash/isString';
import isEqual from 'lodash/isEqual';
import omit from 'lodash/omit';
import cx from 'classnames';
import {FormItem, Button, InputBox, Icon, ResultBox, render} from 'amis';
import {FormItem, Button, InputBox, Icon, ResultBox} from 'amis';
import {FormulaExec, isExpression} from 'amis';
import {PickerContainer} from 'amis';
import {FormulaEditor} from 'amis-ui/lib/components/formula/Editor';
@ -288,8 +288,6 @@ export default class FormulaControl extends React.Component<
if (rendererSchema) {
curRendererSchema = Object.assign({}, rendererSchema, data, {
type: rendererSchema.type ?? data.type,
// 说明: props.value 最后会同步到 rendererSchema.value 中
value: rendererSchema.value // this.props.value ?? rendererSchema.value ?? data.value
});
// 默认要剔除的字段
@ -323,7 +321,7 @@ export default class FormulaControl extends React.Component<
'unitOptions',
'keyboard',
'kilobitSeparator',
// 'value'
'value'
];
// 当前组件要剔除的字段
@ -395,7 +393,7 @@ export default class FormulaControl extends React.Component<
rendererWrapper,
manager,
useExternalFormData = false,
// render,
render,
...rest
} = this.props;
@ -451,7 +449,7 @@ export default class FormulaControl extends React.Component<
rendererWrapper ? 'border-wrapper' : ''
)}
>
{render(this.filterCustomRendererProps(rendererSchema), {
{render('inner', this.filterCustomRendererProps(rendererSchema), {
inputOnly: true,
value: value,
data: useExternalFormData