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 =
|
const detectData =
|
||||||
schema &&
|
schema &&
|
||||||
(schema.detectField === '&' ? rest : rest[schema.detectField || 'data']);
|
(schema.detectField === '&' ? rest : rest[schema.detectField || 'data']);
|
||||||
const exprProps = detectData
|
const exprProps: any = detectData
|
||||||
? getExprProperties(schema, detectData, undefined, rest)
|
? getExprProperties(schema, detectData, undefined, rest)
|
||||||
: null;
|
: {};
|
||||||
|
|
||||||
if (
|
if (
|
||||||
exprProps &&
|
exprProps &&
|
||||||
@ -268,7 +268,17 @@ export class SchemaRenderer extends React.Component<SchemaRendererProps, any> {
|
|||||||
const {data: defaultData, value: defaultValue, ...restSchema} = schema;
|
const {data: defaultData, value: defaultValue, ...restSchema} = schema;
|
||||||
const Component = renderer.component;
|
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;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,7 +159,7 @@ export class Carousel extends React.Component<CarouselProps, CarouselState> {
|
|||||||
componentDidUpdate(prevProps: CarouselProps) {
|
componentDidUpdate(prevProps: CarouselProps) {
|
||||||
const props = this.props;
|
const props = this.props;
|
||||||
|
|
||||||
const nextOptions = props.options || getPropValue(props);
|
const nextOptions = props.options || getPropValue(props) || [];
|
||||||
const prevOptions = prevProps.options || getPropValue(prevProps) || [];
|
const prevOptions = prevProps.options || getPropValue(prevProps) || [];
|
||||||
|
|
||||||
if (isArrayChildrenModified(prevOptions, nextOptions)) {
|
if (isArrayChildrenModified(prevOptions, nextOptions)) {
|
||||||
|
@ -399,7 +399,7 @@ export const HocQuickEdit = (config: Partial<QuickEditConfig> = {}) => (
|
|||||||
mode: 'normal',
|
mode: 'normal',
|
||||||
body: [
|
body: [
|
||||||
{
|
{
|
||||||
type: quickEdit.type || 'text',
|
type: quickEdit.type || 'input-text',
|
||||||
name: quickEdit.name || name,
|
name: quickEdit.name || name,
|
||||||
...quickEdit,
|
...quickEdit,
|
||||||
mode: undefined
|
mode: undefined
|
||||||
|
@ -40,7 +40,7 @@ export const FormStore = ServiceStore.named('FormStore')
|
|||||||
savedData: types.frozen(),
|
savedData: types.frozen(),
|
||||||
// items: types.optional(types.array(types.late(() => FormItemStore)), []),
|
// items: types.optional(types.array(types.late(() => FormItemStore)), []),
|
||||||
canAccessSuperData: true,
|
canAccessSuperData: true,
|
||||||
persistData: '',
|
persistData: types.optional(types.union(types.string, types.boolean), ''),
|
||||||
restError: types.optional(types.array(types.string), []) // 没有映射到表达项上的 errors
|
restError: types.optional(types.array(types.string), []) // 没有映射到表达项上的 errors
|
||||||
})
|
})
|
||||||
.views(self => {
|
.views(self => {
|
||||||
|
Loading…
Reference in New Issue
Block a user