mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 12:08:13 +08:00
fix: 修复 panel 内容区 visibleOn 配置无效的问题 (#6650)
* fix: 修复 panel 内容区 visibleOn 配置无效的问题 * fix: 修复一些 ts 报错,更新snapshot
This commit is contained in:
parent
3fd350f3ff
commit
e507666277
@ -29,7 +29,7 @@ interface SchemaRendererProps extends Partial<RendererProps> {
|
|||||||
env: RendererEnv;
|
env: RendererEnv;
|
||||||
}
|
}
|
||||||
|
|
||||||
const defaultOmitList = [
|
export const RENDERER_TRANSMISSION_OMIT_PROPS = [
|
||||||
'type',
|
'type',
|
||||||
'name',
|
'name',
|
||||||
'$ref',
|
'$ref',
|
||||||
@ -54,7 +54,9 @@ const defaultOmitList = [
|
|||||||
'mode',
|
'mode',
|
||||||
'body',
|
'body',
|
||||||
'id',
|
'id',
|
||||||
'inputOnly'
|
'inputOnly',
|
||||||
|
'label',
|
||||||
|
'renderLabel'
|
||||||
];
|
];
|
||||||
|
|
||||||
const componentCache: SimpleMap = new SimpleMap();
|
const componentCache: SimpleMap = new SimpleMap();
|
||||||
@ -226,7 +228,7 @@ export class SchemaRenderer extends React.Component<SchemaRendererProps, any> {
|
|||||||
let {schema: _, $path: __, env, render, ...rest} = this.props;
|
let {schema: _, $path: __, env, render, ...rest} = this.props;
|
||||||
let {path: $path} = this.resolveRenderer(this.props);
|
let {path: $path} = this.resolveRenderer(this.props);
|
||||||
|
|
||||||
const omitList = defaultOmitList.concat();
|
const omitList = RENDERER_TRANSMISSION_OMIT_PROPS.concat();
|
||||||
if (this.renderer) {
|
if (this.renderer) {
|
||||||
const Component = this.renderer.component;
|
const Component = this.renderer.component;
|
||||||
Component.propsList &&
|
Component.propsList &&
|
||||||
|
@ -42,7 +42,7 @@ import {
|
|||||||
} from './locale';
|
} from './locale';
|
||||||
import type {LocaleProps, TranslateFn} from './locale';
|
import type {LocaleProps, TranslateFn} from './locale';
|
||||||
|
|
||||||
import Scoped, {ScopedContext} from './Scoped';
|
import Scoped, {ScopedComponentType, ScopedContext} from './Scoped';
|
||||||
import type {IScopedContext} from './Scoped';
|
import type {IScopedContext} from './Scoped';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@ -98,6 +98,7 @@ import {FormRenderer} from './renderers/Form';
|
|||||||
import type {FormHorizontal} from './renderers/Form';
|
import type {FormHorizontal} from './renderers/Form';
|
||||||
import {enableDebug, promisify, replaceText, wrapFetcher} from './utils/index';
|
import {enableDebug, promisify, replaceText, wrapFetcher} from './utils/index';
|
||||||
import {valueMap as styleMap} from './utils/style-helper';
|
import {valueMap as styleMap} from './utils/style-helper';
|
||||||
|
import {RENDERER_TRANSMISSION_OMIT_PROPS} from './SchemaRenderer';
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
export const version = '__buildVersion';
|
export const version = '__buildVersion';
|
||||||
@ -176,7 +177,9 @@ export {
|
|||||||
extendDefaultEnv,
|
extendDefaultEnv,
|
||||||
addRootWrapper,
|
addRootWrapper,
|
||||||
RendererConfig,
|
RendererConfig,
|
||||||
styleMap
|
styleMap,
|
||||||
|
RENDERER_TRANSMISSION_OMIT_PROPS,
|
||||||
|
ScopedComponentType
|
||||||
};
|
};
|
||||||
|
|
||||||
export function render(
|
export function render(
|
||||||
|
@ -50,6 +50,7 @@ export interface TabsTransferProps
|
|||||||
onTabChange: (key: number) => void;
|
onTabChange: (key: number) => void;
|
||||||
activeKey: number;
|
activeKey: number;
|
||||||
onlyChildren?: boolean;
|
onlyChildren?: boolean;
|
||||||
|
data?: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TabsTransferState {
|
export interface TabsTransferState {
|
||||||
|
@ -101,7 +101,7 @@ interface BooleanField extends BaseField {
|
|||||||
name: string;
|
name: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface CustomField extends BaseField {
|
export interface CustomField extends BaseField {
|
||||||
type: 'custom';
|
type: 'custom';
|
||||||
name: string;
|
name: string;
|
||||||
value: any;
|
value: any;
|
||||||
|
@ -9,3 +9,9 @@ import './themes/ang';
|
|||||||
import './themes/antd';
|
import './themes/antd';
|
||||||
import './themes/dark';
|
import './themes/dark';
|
||||||
import './themes/default';
|
import './themes/default';
|
||||||
|
import {
|
||||||
|
SchemaEditorItemPlaceholder,
|
||||||
|
schemaEditorItemPlaceholder
|
||||||
|
} from './components/schema-editor/Common';
|
||||||
|
|
||||||
|
export {schemaEditorItemPlaceholder, SchemaEditorItemPlaceholder};
|
||||||
|
@ -179,6 +179,7 @@ exports[`Renderer:panel 1`] = `
|
|||||||
<input
|
<input
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
class=""
|
class=""
|
||||||
|
name="text"
|
||||||
placeholder="Text 1"
|
placeholder="Text 1"
|
||||||
size="10"
|
size="10"
|
||||||
type="text"
|
type="text"
|
||||||
@ -200,6 +201,7 @@ exports[`Renderer:panel 1`] = `
|
|||||||
<input
|
<input
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
class=""
|
class=""
|
||||||
|
name="text2"
|
||||||
placeholder="Text 2"
|
placeholder="Text 2"
|
||||||
size="10"
|
size="10"
|
||||||
type="text"
|
type="text"
|
||||||
|
@ -376,7 +376,7 @@ export default class DropDownButton extends React.Component<
|
|||||||
>
|
>
|
||||||
<TooltipWrapper
|
<TooltipWrapper
|
||||||
placement={placement}
|
placement={placement}
|
||||||
tooltip={disabled ? disabledTip : tooltip}
|
tooltip={disabled ? disabledTip : (tooltip as any)}
|
||||||
container={tooltipContainer || env?.getModalContainer}
|
container={tooltipContainer || env?.getModalContainer}
|
||||||
trigger={tooltipTrigger}
|
trigger={tooltipTrigger}
|
||||||
rootClose={tooltipRootClose}
|
rootClose={tooltipRootClose}
|
||||||
|
@ -5,14 +5,15 @@ import {JSONSchemaEditor} from 'amis-ui';
|
|||||||
import {autobind, isObject} from 'amis-core';
|
import {autobind, isObject} from 'amis-core';
|
||||||
import {FormBaseControlSchema} from '../../Schema';
|
import {FormBaseControlSchema} from '../../Schema';
|
||||||
|
|
||||||
import {schemaEditorItemPlaceholder} from 'amis-ui/lib/components/schema-editor/Common';
|
import {schemaEditorItemPlaceholder} from 'amis-ui';
|
||||||
import type {SchemaEditorItemPlaceholder} from 'amis-ui/lib/components/schema-editor/Common';
|
import type {SchemaEditorItemPlaceholder} from 'amis-ui';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* JSON Schema Editor
|
* JSON Schema Editor
|
||||||
* 文档:https://baidu.gitee.io/amis/docs/components/form/json-schema-editor
|
* 文档:https://baidu.gitee.io/amis/docs/components/form/json-schema-editor
|
||||||
*/
|
*/
|
||||||
export interface JSONSchemaEditorControlSchema extends Omit<FormBaseControlSchema, 'placeholder'> {
|
export interface JSONSchemaEditorControlSchema
|
||||||
|
extends Omit<FormBaseControlSchema, 'placeholder'> {
|
||||||
/**
|
/**
|
||||||
* 指定为 JSON Schema Editor
|
* 指定为 JSON Schema Editor
|
||||||
*/
|
*/
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import {Renderer, RendererProps} from 'amis-core';
|
import {
|
||||||
|
RENDERER_TRANSMISSION_OMIT_PROPS,
|
||||||
|
Renderer,
|
||||||
|
RendererProps
|
||||||
|
} from 'amis-core';
|
||||||
import {SchemaNode, ActionObject} from 'amis-core';
|
import {SchemaNode, ActionObject} from 'amis-core';
|
||||||
import {getScrollParent, autobind} from 'amis-core';
|
import {getScrollParent, autobind} from 'amis-core';
|
||||||
import {findDOMNode} from 'react-dom';
|
import {findDOMNode} from 'react-dom';
|
||||||
@ -12,6 +16,7 @@ import {
|
|||||||
} from '../Schema';
|
} from '../Schema';
|
||||||
import {ActionSchema} from './Action';
|
import {ActionSchema} from './Action';
|
||||||
import {FormHorizontal} from 'amis-core';
|
import {FormHorizontal} from 'amis-core';
|
||||||
|
import omit from 'lodash/omit';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Panel渲染器。
|
* Panel渲染器。
|
||||||
@ -198,16 +203,12 @@ export default class Panel extends React.Component<PanelProps> {
|
|||||||
subFormMode,
|
subFormMode,
|
||||||
subFormHorizontal,
|
subFormHorizontal,
|
||||||
id,
|
id,
|
||||||
// 不应该将 label、renderLabel 传递下去,否则内部的表单项组件会受到影响
|
|
||||||
label,
|
|
||||||
renderLabel,
|
|
||||||
inputOnly,
|
|
||||||
...rest
|
...rest
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
const subProps = {
|
const subProps = {
|
||||||
data,
|
data,
|
||||||
...rest,
|
...omit(rest, RENDERER_TRANSMISSION_OMIT_PROPS),
|
||||||
formMode: subFormMode || formMode,
|
formMode: subFormMode || formMode,
|
||||||
formHorizontal: subFormHorizontal || formHorizontal
|
formHorizontal: subFormHorizontal || formHorizontal
|
||||||
};
|
};
|
||||||
|
@ -4,6 +4,7 @@ import {
|
|||||||
Renderer,
|
Renderer,
|
||||||
RendererProps,
|
RendererProps,
|
||||||
resolveEventData,
|
resolveEventData,
|
||||||
|
ScopedComponentType,
|
||||||
ScopedContext
|
ScopedContext
|
||||||
} from 'amis-core';
|
} from 'amis-core';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
@ -11,7 +12,6 @@ import {BaseSchema, SchemaClassName} from '../Schema';
|
|||||||
import {SearchBox} from 'amis-ui';
|
import {SearchBox} from 'amis-ui';
|
||||||
import {autobind, getPropValue, getVariable, setVariable} from 'amis-core';
|
import {autobind, getPropValue, getVariable, setVariable} from 'amis-core';
|
||||||
import type {ListenerAction} from 'amis-core';
|
import type {ListenerAction} from 'amis-core';
|
||||||
import type {ScopedComponentType} from 'amis-core/lib/Scoped';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 搜索框渲染器
|
* 搜索框渲染器
|
||||||
|
@ -34,7 +34,7 @@ import {
|
|||||||
import {IIRendererStore} from 'amis-core';
|
import {IIRendererStore} from 'amis-core';
|
||||||
|
|
||||||
import type {ListenerAction} from 'amis-core';
|
import type {ListenerAction} from 'amis-core';
|
||||||
import type {ScopedComponentType} from 'amis-core/lib/Scoped';
|
import type {ScopedComponentType} from 'amis-core';
|
||||||
|
|
||||||
export const eventTypes = [
|
export const eventTypes = [
|
||||||
/* 初始化时执行,默认 */
|
/* 初始化时执行,默认 */
|
||||||
|
@ -588,7 +588,7 @@ export default class ColumnToggler extends React.Component<
|
|||||||
) : (
|
) : (
|
||||||
<TooltipWrapper
|
<TooltipWrapper
|
||||||
placement={placement}
|
placement={placement}
|
||||||
tooltip={disabled ? disabledTip : tooltip}
|
tooltip={disabled ? disabledTip : (tooltip as any)}
|
||||||
container={tooltipContainer}
|
container={tooltipContainer}
|
||||||
trigger={tooltipTrigger}
|
trigger={tooltipTrigger}
|
||||||
rootClose={tooltipRootClose}
|
rootClose={tooltipRootClose}
|
||||||
|
Loading…
Reference in New Issue
Block a user