fix: 修复 panel 内容区 visibleOn 配置无效的问题 (#6650)

* fix: 修复 panel 内容区 visibleOn 配置无效的问题

* fix: 修复一些 ts 报错,更新snapshot
This commit is contained in:
liaoxuezhi 2023-04-21 15:30:41 +08:00 committed by GitHub
parent 3fd350f3ff
commit e507666277
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 35 additions and 19 deletions

View File

@ -29,7 +29,7 @@ interface SchemaRendererProps extends Partial<RendererProps> {
env: RendererEnv;
}
const defaultOmitList = [
export const RENDERER_TRANSMISSION_OMIT_PROPS = [
'type',
'name',
'$ref',
@ -54,7 +54,9 @@ const defaultOmitList = [
'mode',
'body',
'id',
'inputOnly'
'inputOnly',
'label',
'renderLabel'
];
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 {path: $path} = this.resolveRenderer(this.props);
const omitList = defaultOmitList.concat();
const omitList = RENDERER_TRANSMISSION_OMIT_PROPS.concat();
if (this.renderer) {
const Component = this.renderer.component;
Component.propsList &&

View File

@ -42,7 +42,7 @@ import {
} 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 {
@ -98,6 +98,7 @@ import {FormRenderer} from './renderers/Form';
import type {FormHorizontal} from './renderers/Form';
import {enableDebug, promisify, replaceText, wrapFetcher} from './utils/index';
import {valueMap as styleMap} from './utils/style-helper';
import {RENDERER_TRANSMISSION_OMIT_PROPS} from './SchemaRenderer';
// @ts-ignore
export const version = '__buildVersion';
@ -176,7 +177,9 @@ export {
extendDefaultEnv,
addRootWrapper,
RendererConfig,
styleMap
styleMap,
RENDERER_TRANSMISSION_OMIT_PROPS,
ScopedComponentType
};
export function render(

View File

@ -50,6 +50,7 @@ export interface TabsTransferProps
onTabChange: (key: number) => void;
activeKey: number;
onlyChildren?: boolean;
data?: any;
}
export interface TabsTransferState {

View File

@ -101,7 +101,7 @@ interface BooleanField extends BaseField {
name: string;
}
interface CustomField extends BaseField {
export interface CustomField extends BaseField {
type: 'custom';
name: string;
value: any;

View File

@ -9,3 +9,9 @@ import './themes/ang';
import './themes/antd';
import './themes/dark';
import './themes/default';
import {
SchemaEditorItemPlaceholder,
schemaEditorItemPlaceholder
} from './components/schema-editor/Common';
export {schemaEditorItemPlaceholder, SchemaEditorItemPlaceholder};

View File

@ -179,6 +179,7 @@ exports[`Renderer:panel 1`] = `
<input
autocomplete="off"
class=""
name="text"
placeholder="Text 1"
size="10"
type="text"
@ -200,6 +201,7 @@ exports[`Renderer:panel 1`] = `
<input
autocomplete="off"
class=""
name="text2"
placeholder="Text 2"
size="10"
type="text"

View File

@ -376,7 +376,7 @@ export default class DropDownButton extends React.Component<
>
<TooltipWrapper
placement={placement}
tooltip={disabled ? disabledTip : tooltip}
tooltip={disabled ? disabledTip : (tooltip as any)}
container={tooltipContainer || env?.getModalContainer}
trigger={tooltipTrigger}
rootClose={tooltipRootClose}

View File

@ -5,14 +5,15 @@ import {JSONSchemaEditor} from 'amis-ui';
import {autobind, isObject} from 'amis-core';
import {FormBaseControlSchema} from '../../Schema';
import {schemaEditorItemPlaceholder} from 'amis-ui/lib/components/schema-editor/Common';
import type {SchemaEditorItemPlaceholder} from 'amis-ui/lib/components/schema-editor/Common';
import {schemaEditorItemPlaceholder} from 'amis-ui';
import type {SchemaEditorItemPlaceholder} from 'amis-ui';
/**
* 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
*/

View File

@ -1,5 +1,9 @@
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 {getScrollParent, autobind} from 'amis-core';
import {findDOMNode} from 'react-dom';
@ -12,6 +16,7 @@ import {
} from '../Schema';
import {ActionSchema} from './Action';
import {FormHorizontal} from 'amis-core';
import omit from 'lodash/omit';
/**
* Panel渲染器
@ -198,16 +203,12 @@ export default class Panel extends React.Component<PanelProps> {
subFormMode,
subFormHorizontal,
id,
// 不应该将 label、renderLabel 传递下去,否则内部的表单项组件会受到影响
label,
renderLabel,
inputOnly,
...rest
} = this.props;
const subProps = {
data,
...rest,
...omit(rest, RENDERER_TRANSMISSION_OMIT_PROPS),
formMode: subFormMode || formMode,
formHorizontal: subFormHorizontal || formHorizontal
};

View File

@ -4,6 +4,7 @@ import {
Renderer,
RendererProps,
resolveEventData,
ScopedComponentType,
ScopedContext
} from 'amis-core';
import React from 'react';
@ -11,7 +12,6 @@ import {BaseSchema, SchemaClassName} from '../Schema';
import {SearchBox} from 'amis-ui';
import {autobind, getPropValue, getVariable, setVariable} from 'amis-core';
import type {ListenerAction} from 'amis-core';
import type {ScopedComponentType} from 'amis-core/lib/Scoped';
/**
*

View File

@ -34,7 +34,7 @@ import {
import {IIRendererStore} 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 = [
/* 初始化时执行,默认 */

View File

@ -588,7 +588,7 @@ export default class ColumnToggler extends React.Component<
) : (
<TooltipWrapper
placement={placement}
tooltip={disabled ? disabledTip : tooltip}
tooltip={disabled ? disabledTip : (tooltip as any)}
container={tooltipContainer}
trigger={tooltipTrigger}
rootClose={tooltipRootClose}