mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-15 01:11:15 +08:00
fix(amis-saas-7103): 代码格式化一下
Change-Id: I5a8da179d640a4bdccc405b1a7ef56168f08d33b
This commit is contained in:
parent
0bb0422d8b
commit
afe2cd42c7
@ -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>
|
||||
);
|
||||
}
|
||||
|
@ -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"
|
||||
|
@ -229,9 +229,16 @@ export default class FormulaControl extends React.Component<
|
||||
// 当前数据域
|
||||
const curData = this.getContextData();
|
||||
|
||||
if (rendererSchema.type === 'switch' && (rendererSchema.trueValue !== undefined || rendererSchema.falseValue !== undefined)) {
|
||||
if (
|
||||
rendererSchema.type === 'switch' &&
|
||||
(rendererSchema.trueValue !== undefined ||
|
||||
rendererSchema.falseValue !== undefined)
|
||||
) {
|
||||
// 开关类型组件单独处理
|
||||
return rendererSchema.trueValue === value || rendererSchema.falseValue === value;
|
||||
return (
|
||||
rendererSchema.trueValue === value ||
|
||||
rendererSchema.falseValue === value
|
||||
);
|
||||
} else if (
|
||||
(expectType === 'number' && isNumber(value)) ||
|
||||
(expectType === 'boolean' && isBoolean(value)) ||
|
||||
@ -303,7 +310,7 @@ export default class FormulaControl extends React.Component<
|
||||
let curRendererSchema: any = null;
|
||||
if (rendererSchema) {
|
||||
curRendererSchema = Object.assign({}, rendererSchema, data, {
|
||||
type: rendererSchema.type ?? data.type,
|
||||
type: rendererSchema.type ?? data.type
|
||||
});
|
||||
|
||||
// 默认要剔除的字段
|
||||
|
@ -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'
|
||||
},
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -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>
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -65,4 +65,4 @@ export default class CmptActionSelect extends React.Component<RendererProps> {
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user