mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 20:09:08 +08:00
Compat3 (#2134)
* persistData 有可能是 boolean * 有可能无限 setState * QuickEdit 默认类型错误 * 恢复 formitem 逻辑
This commit is contained in:
parent
aa9784482c
commit
216c0a867c
@ -191,9 +191,9 @@ export class SchemaRenderer extends React.Component<SchemaRendererProps, any> {
|
||||
const detectData =
|
||||
schema &&
|
||||
(schema.detectField === '&' ? rest : rest[schema.detectField || 'data']);
|
||||
const exprProps = detectData
|
||||
const exprProps: any = detectData
|
||||
? getExprProperties(schema, detectData, undefined, rest)
|
||||
: null;
|
||||
: {};
|
||||
|
||||
if (
|
||||
exprProps &&
|
||||
@ -268,7 +268,17 @@ export class SchemaRenderer extends React.Component<SchemaRendererProps, any> {
|
||||
const {data: defaultData, value: defaultValue, ...restSchema} = schema;
|
||||
const Component = renderer.component;
|
||||
|
||||
if (rest.invisible && !renderer.isFormItem) {
|
||||
// 原来表单项的 visible: false 和 hidden: true 表单项的值和验证是有效的
|
||||
// 而 visibleOn 和 hiddenOn 是无效的,
|
||||
// 这个本来就是个bug,但是已经被广泛使用了
|
||||
// 我只能继续实现这个bug了
|
||||
if (
|
||||
rest.invisible &&
|
||||
(exprProps.hidden ||
|
||||
exprProps.visible === false ||
|
||||
!renderer.isFormItem ||
|
||||
(schema.visible !== false && !schema.hidden))
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -159,7 +159,7 @@ export class Carousel extends React.Component<CarouselProps, CarouselState> {
|
||||
componentDidUpdate(prevProps: CarouselProps) {
|
||||
const props = this.props;
|
||||
|
||||
const nextOptions = props.options || getPropValue(props);
|
||||
const nextOptions = props.options || getPropValue(props) || [];
|
||||
const prevOptions = prevProps.options || getPropValue(prevProps) || [];
|
||||
|
||||
if (isArrayChildrenModified(prevOptions, nextOptions)) {
|
||||
|
@ -399,7 +399,7 @@ export const HocQuickEdit = (config: Partial<QuickEditConfig> = {}) => (
|
||||
mode: 'normal',
|
||||
body: [
|
||||
{
|
||||
type: quickEdit.type || 'text',
|
||||
type: quickEdit.type || 'input-text',
|
||||
name: quickEdit.name || name,
|
||||
...quickEdit,
|
||||
mode: undefined
|
||||
|
@ -40,7 +40,7 @@ export const FormStore = ServiceStore.named('FormStore')
|
||||
savedData: types.frozen(),
|
||||
// items: types.optional(types.array(types.late(() => FormItemStore)), []),
|
||||
canAccessSuperData: true,
|
||||
persistData: '',
|
||||
persistData: types.optional(types.union(types.string, types.boolean), ''),
|
||||
restError: types.optional(types.array(types.string), []) // 没有映射到表达项上的 errors
|
||||
})
|
||||
.views(self => {
|
||||
|
Loading…
Reference in New Issue
Block a user