Merge pull request #9948 from wibetter/master

fix(amis-editor): input-number步长配置功能优化,实时同步当前小数位数配置
This commit is contained in:
刘丹 2024-04-03 15:34:33 +08:00 committed by GitHub
commit 0a266a042a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 32 additions and 28 deletions

View File

@ -23,6 +23,7 @@ import {isAlive} from 'mobx-state-tree';
import {reaction} from 'mobx';
import {resolveVariableAndFilter} from './utils/tpl-builtin';
import {buildStyle} from './utils/style';
import {isExpression} from './utils/formula';
import {StatusScopedProps} from './StatusScoped';
import {evalExpression, filter} from './utils/tpl';
@ -491,7 +492,7 @@ export class SchemaRenderer extends React.Component<SchemaRendererProps, any> {
// 自动解析变量模式,主要是方便直接引入第三方组件库,无需为了支持变量封装一层
if (renderer.autoVar) {
for (const key of Object.keys(schema)) {
if (typeof props[key] === 'string') {
if (typeof props[key] === 'string' && isExpression(props[key])) {
props[key] = resolveVariableAndFilter(
props[key],
props.data,

View File

@ -208,15 +208,15 @@ export class NumberControlPlugin extends BasePlugin {
label: '最大值',
valueType: 'number'
}),
{
type: 'input-number',
name: 'step',
label: '步长',
min: 0,
value: 1
value: 1,
precision: '${precision}',
strictMode: false
},
{
type: 'input-number',
name: 'precision',

View File

@ -121,30 +121,33 @@ export class BreadcrumbField extends React.Component<BreadcrumbProps, object> {
data,
'| raw'
) as Array<BreadcrumbItemSchema>);
crumbItems = crumbItems.map(item => {
if (item.label) {
item.label = filter(item.label, data);
}
if (item.href) {
item.href = resolveVariableAndFilter(item.href, data, '| raw');
}
if (item.dropdown) {
item.dropdown = item.dropdown.map(dropdownItem => {
if (dropdownItem.label) {
dropdownItem.label = filter(dropdownItem.label, data);
}
if (dropdownItem.href) {
dropdownItem.href = resolveVariableAndFilter(
dropdownItem.href,
data,
'| raw'
);
}
return dropdownItem;
});
}
return item;
});
if (crumbItems) {
crumbItems = crumbItems.map(item => {
if (item.label) {
item.label = filter(item.label, data);
}
if (item.href) {
item.href = resolveVariableAndFilter(item.href, data, '| raw');
}
if (item.dropdown) {
item.dropdown = item.dropdown.map(dropdownItem => {
if (dropdownItem.label) {
dropdownItem.label = filter(dropdownItem.label, data);
}
if (dropdownItem.href) {
dropdownItem.href = resolveVariableAndFilter(
dropdownItem.href,
data,
'| raw'
);
}
return dropdownItem;
});
}
return item;
});
}
return (
<Breadcrumb