mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-05 05:18:34 +08:00
chore: 尝试修复一些 ts 报错 (#6457)
This commit is contained in:
parent
a8eeb98011
commit
284dd97d2a
@ -31,7 +31,7 @@ export interface RootProps {
|
||||
|
||||
export interface RootWrapperProps {
|
||||
env: RendererEnv;
|
||||
children: React.ReactNode;
|
||||
children: React.ReactNode | Array<React.ReactNode>;
|
||||
schema: SchemaNode;
|
||||
rootStore: IRendererStore;
|
||||
theme: string;
|
||||
|
@ -181,7 +181,7 @@ interface OverlayProps {
|
||||
shouldUpdatePosition?: boolean;
|
||||
rootClose?: boolean;
|
||||
onHide?(props: any, ...args: any[]): any;
|
||||
container?: React.ReactNode | Function;
|
||||
container?: HTMLElement | (() => HTMLElement | null | undefined);
|
||||
containerSelector?: string;
|
||||
target?: React.ReactNode | Function;
|
||||
watchTargetSizeChange?: boolean;
|
||||
|
@ -51,7 +51,7 @@ interface InputOption {
|
||||
|
||||
const ShortCutItemWrap = (props: {
|
||||
index: number;
|
||||
children: React.ReactNode;
|
||||
children: React.ReactNode | Array<React.ReactNode>;
|
||||
handleDelete: (index: number, e: React.SyntheticEvent<any>) => void;
|
||||
}) => {
|
||||
return (
|
||||
|
@ -33,7 +33,7 @@ export interface SwitchMoreProps extends FormControlProps {
|
||||
// offset?: ((clip: object, offset: object) => Offset) | Offset;
|
||||
// style?: object;
|
||||
overlay?: boolean;
|
||||
container?: React.ReactNode | Function;
|
||||
container?: HTMLElement | (() => HTMLElement) | Function;
|
||||
target?: React.ReactNode | Function;
|
||||
trueValue?: any; // 开关开启时匹配的 value, 默认 true
|
||||
falseValue?: any; // 开关关闭时匹配的 value, 默认 flase
|
||||
|
@ -19,7 +19,7 @@ export interface AlertProps extends ThemeProps, LocaleProps {
|
||||
confirmBtnLevel?: string;
|
||||
alertBtnLevel?: string;
|
||||
isolate?: boolean;
|
||||
children?: JSX.Element;
|
||||
children?: React.ReactElement;
|
||||
}
|
||||
|
||||
export interface AlertState {
|
||||
|
@ -21,7 +21,7 @@ export interface AlertProps {
|
||||
onClose?: () => void;
|
||||
classnames: ClassNamesFn;
|
||||
classPrefix: string;
|
||||
children?: JSX.Element;
|
||||
children?: React.ReactNode | Array<React.ReactNode>;
|
||||
}
|
||||
|
||||
export interface AlertState {
|
||||
|
@ -18,6 +18,7 @@ export interface AnchorNavSectionProps extends ThemeProps {
|
||||
body?: Schema; // Schema
|
||||
className?: string; // 样式名
|
||||
style?: any;
|
||||
children?: React.ReactNode | Array<React.ReactNode>;
|
||||
}
|
||||
|
||||
class AnchorNavSectionComponent extends React.PureComponent<AnchorNavSectionProps> {
|
||||
@ -48,6 +49,7 @@ export interface AnchorNavProps extends ThemeProps {
|
||||
) => JSX.Element; // 锚点区域渲染器
|
||||
onSelect?: (key: string | number) => void; // 选中回调方法
|
||||
direction?: 'vertical' | 'horizontal'; // 导航方向
|
||||
children?: React.ReactNode | Array<React.ReactNode>;
|
||||
}
|
||||
|
||||
interface SectionOffset {
|
||||
@ -111,9 +113,9 @@ export class AnchorNav extends React.Component<AnchorNavProps, AnchorNavState> {
|
||||
children &&
|
||||
React.Children.forEach(
|
||||
children,
|
||||
(section: AnchorNavSectionComponent, index: number) => {
|
||||
(section: React.ReactNode, index: number) => {
|
||||
offsetArr.push({
|
||||
key: section.props.name,
|
||||
key: (section as JSX.Element).props.name,
|
||||
offsetTop: (parentNode.children[index] as HTMLElement).offsetTop
|
||||
});
|
||||
}
|
||||
|
@ -75,7 +75,10 @@ interface AvatarCmptProps extends ThemeProps {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
children?: JSX.Element | ((props?: any) => JSX.Element);
|
||||
children?:
|
||||
| React.ReactNode
|
||||
| Array<React.ReactNode>
|
||||
| ((props?: any) => React.ReactNode | Array<React.ReactNode>);
|
||||
}
|
||||
|
||||
const prefix = 'Avatar--';
|
||||
@ -179,7 +182,7 @@ export class Avatar extends React.Component<AvatarCmptProps, AvatarState> {
|
||||
const isImgRender = React.isValidElement(src);
|
||||
const isIconRender = React.isValidElement(icon);
|
||||
|
||||
let childrenRender;
|
||||
let childrenRender: React.ReactNode | Array<React.ReactNode>;
|
||||
|
||||
let sizeStyle = {};
|
||||
let sizeClass = '';
|
||||
@ -233,7 +236,7 @@ export class Avatar extends React.Component<AvatarCmptProps, AvatarState> {
|
||||
} else if (['string', 'object'].includes(typeof icon)) {
|
||||
childrenRender = generateIcon(cx, icon as any);
|
||||
} else if (isIconRender) {
|
||||
childrenRender = icon;
|
||||
childrenRender = icon as any;
|
||||
} else {
|
||||
childrenRender = (
|
||||
<span
|
||||
@ -241,7 +244,7 @@ export class Avatar extends React.Component<AvatarCmptProps, AvatarState> {
|
||||
ref={this.avatarChildrenRef}
|
||||
style={scaleStyle}
|
||||
>
|
||||
{children}
|
||||
{typeof children === 'function' ? children() : children}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
@ -73,6 +73,7 @@ export interface BadgeProps {
|
||||
badge?: BadgeObject;
|
||||
classnames: ClassNamesFn;
|
||||
data?: any;
|
||||
children?: React.ReactNode | Array<React.ReactNode>;
|
||||
}
|
||||
|
||||
export class Badge extends React.Component<BadgeProps, object> {
|
||||
|
@ -29,6 +29,7 @@ interface CheckboxProps {
|
||||
classnames: ClassNamesFn;
|
||||
partial?: boolean;
|
||||
optionType?: 'default' | 'button';
|
||||
children?: React.ReactNode | Array<React.ReactNode>;
|
||||
}
|
||||
|
||||
export class Checkbox extends React.Component<CheckboxProps, any> {
|
||||
@ -74,12 +75,13 @@ export class Checkbox extends React.Component<CheckboxProps, any> {
|
||||
labelClassName,
|
||||
optionType
|
||||
} = this.props;
|
||||
const _checked = typeof checked !== 'undefined'
|
||||
? checked
|
||||
: typeof value === 'undefined'
|
||||
? value
|
||||
: value == trueValue;
|
||||
|
||||
const _checked =
|
||||
typeof checked !== 'undefined'
|
||||
? checked
|
||||
: typeof value === 'undefined'
|
||||
? value
|
||||
: value == trueValue;
|
||||
|
||||
return (
|
||||
<label
|
||||
className={cx(`Checkbox Checkbox--${type}`, className, {
|
||||
|
@ -52,6 +52,8 @@ export interface CollapseProps {
|
||||
headingComponent?: any;
|
||||
translate?: TranslateFn;
|
||||
propsUpdate?: boolean;
|
||||
partial?: boolean;
|
||||
children?: React.ReactNode | Array<React.ReactNode>;
|
||||
}
|
||||
|
||||
export interface CollapseState {
|
||||
|
@ -25,6 +25,7 @@ export interface CollapseGroupProps {
|
||||
style?: any;
|
||||
classnames: ClassNamesFn;
|
||||
classPrefix: string;
|
||||
children?: React.ReactNode | Array<React.ReactNode>;
|
||||
}
|
||||
|
||||
export interface CollapseGroupState {
|
||||
@ -59,7 +60,7 @@ class CollapseGroup extends React.Component<
|
||||
updateActiveKey(propsActiveKey: any, isInit?: boolean) {
|
||||
const props = this.props;
|
||||
let curActiveKey = propsActiveKey;
|
||||
|
||||
|
||||
if (!Array.isArray(curActiveKey)) {
|
||||
curActiveKey = curActiveKey ? [curActiveKey] : [];
|
||||
}
|
||||
|
@ -38,6 +38,7 @@ export interface DrawerProps {
|
||||
classPrefix: string;
|
||||
resizable?: boolean;
|
||||
classnames: ClassNamesFn;
|
||||
children?: React.ReactNode | Array<React.ReactNode>;
|
||||
onExited?: () => void;
|
||||
onEntered?: () => void;
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ export interface FormFieldProps extends LocaleProps, ThemeProps {
|
||||
isRequired?: boolean;
|
||||
hasError?: boolean;
|
||||
errors?: string | Array<string>;
|
||||
children?: JSX.Element;
|
||||
children?: React.ReactNode | Array<React.ReactNode>;
|
||||
}
|
||||
|
||||
function FormField(props: FormFieldProps) {
|
||||
|
@ -30,6 +30,7 @@ export interface GridNavProps {
|
||||
itemClassName?: string;
|
||||
classnames: ClassNamesFn;
|
||||
style?: React.CSSProperties;
|
||||
children?: React.ReactNode | Array<React.ReactNode>;
|
||||
}
|
||||
|
||||
export interface GridNavItemProps {
|
||||
@ -208,7 +209,6 @@ const GridNav: React.FC<GridNavProps> = ({
|
||||
className={cx(`GridNav ${className || ''}`, {
|
||||
'GridNav-top u-hairline': props.border && !props.gutter
|
||||
})}
|
||||
|
||||
>
|
||||
{React.Children.toArray(children)
|
||||
.filter(Boolean)
|
||||
|
@ -29,7 +29,7 @@ export interface ImageAction {
|
||||
}
|
||||
|
||||
export interface ImageGalleryProps extends ThemeProps, LocaleProps {
|
||||
children: React.ReactNode;
|
||||
children: React.ReactNode | Array<React.ReactNode>;
|
||||
modalContainer?: () => HTMLElement;
|
||||
/** 操作栏 */
|
||||
actions?: ImageAction[];
|
||||
|
@ -16,7 +16,7 @@ export interface InputBoxProps
|
||||
hasError?: boolean;
|
||||
placeholder?: string;
|
||||
prefix?: JSX.Element;
|
||||
children?: JSX.Element;
|
||||
children?: React.ReactNode | Array<React.ReactNode>;
|
||||
borderMode?: 'full' | 'half' | 'none';
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ export interface LinkProps
|
||||
href?: string;
|
||||
htmlTarget?: string;
|
||||
title?: string;
|
||||
children?: JSX.Element;
|
||||
children?: React.ReactNode | Array<React.ReactNode>;
|
||||
}
|
||||
|
||||
export class Link extends React.Component<LinkProps, object> {
|
||||
|
@ -13,6 +13,7 @@ export interface ListMenuProps extends ThemeProps, LocaleProps {
|
||||
itemRender: (option: Option) => JSX.Element;
|
||||
getItemProps: (props: {item: Option; index: number}) => any;
|
||||
prefix?: JSX.Element;
|
||||
children?: React.ReactNode | Array<React.ReactNode>;
|
||||
}
|
||||
|
||||
interface RenderResult {
|
||||
|
@ -33,7 +33,7 @@ export interface ModalProps extends ThemeProps, LocaleProps {
|
||||
disabled?: boolean;
|
||||
onExited?: () => void;
|
||||
onEntered?: () => void;
|
||||
children?: JSX.Element;
|
||||
children?: React.ReactNode | Array<React.ReactNode>;
|
||||
}
|
||||
export interface ModalState {}
|
||||
const fadeStyles: {
|
||||
|
@ -313,7 +313,7 @@ const PickerColumn = forwardRef<{}, PickerColumnProps>((props, ref) => {
|
||||
|
||||
const childData = {
|
||||
className: 'text-ellipsis',
|
||||
children: text
|
||||
children: text as React.ReactNode
|
||||
};
|
||||
|
||||
return (
|
||||
|
@ -32,7 +32,7 @@ export interface PopUpPorps extends ThemeProps, LocaleProps {
|
||||
showClose?: boolean;
|
||||
placement?: 'left' | 'center' | 'right';
|
||||
header?: JSX.Element;
|
||||
children?: JSX.Element;
|
||||
children?: React.ReactNode | Array<React.ReactNode>;
|
||||
}
|
||||
|
||||
const fadeStyles: {
|
||||
|
@ -24,7 +24,7 @@ export interface PullRefreshProps {
|
||||
loading?: boolean;
|
||||
successDuration?: number;
|
||||
loadingDuration?: number;
|
||||
children?: JSX.Element;
|
||||
children?: React.ReactNode | Array<React.ReactNode>;
|
||||
}
|
||||
|
||||
type statusText = 'normal' | 'pulling' | 'loosing' | 'success' | 'loading';
|
||||
|
@ -209,7 +209,7 @@ class HandleItem extends React.Component<HandleItemProps, HandleItemState> {
|
||||
<Overlay
|
||||
placement={tooltipPlacement}
|
||||
target={() => findDOMNode(this)}
|
||||
container={() => findDOMNode(this)}
|
||||
container={() => findDOMNode(this) as HTMLElement}
|
||||
rootClose={false}
|
||||
show={true}
|
||||
>
|
||||
|
@ -226,7 +226,7 @@ export class Rating extends React.Component<RatingProps, any> {
|
||||
}
|
||||
|
||||
saveRef(index: number) {
|
||||
return (node: React.ReactNode) => {
|
||||
return (node?: HTMLLIElement | null) => {
|
||||
this.starsNode[String(index)] = node;
|
||||
};
|
||||
}
|
||||
|
@ -52,6 +52,7 @@ export interface TabProps extends ThemeProps {
|
||||
mountOnEnter?: boolean;
|
||||
unmountOnExit?: boolean;
|
||||
toolbar?: React.ReactNode;
|
||||
children?: React.ReactNode | Array<React.ReactNode>;
|
||||
}
|
||||
|
||||
class TabComponent extends React.PureComponent<TabProps> {
|
||||
@ -130,6 +131,7 @@ export interface TabsProps extends ThemeProps, LocaleProps {
|
||||
collapseOnExceed?: number;
|
||||
collapseBtnLabel?: string;
|
||||
popOverContainer?: any;
|
||||
children?: React.ReactNode | Array<React.ReactNode>;
|
||||
}
|
||||
|
||||
export interface IDragInfo {
|
||||
@ -244,10 +246,12 @@ export class Tabs extends React.Component<TabsProps, any> {
|
||||
activeKey: this.props.activeKey,
|
||||
children: Array.isArray(this.props.children)
|
||||
? this.props.children!.map(item => ({
|
||||
eventKey: item?.props?.eventKey,
|
||||
eventKey: (item as JSX.Element)?.props?.eventKey,
|
||||
// 这里 title 可能是 React.ReactNode,只对比 string
|
||||
title:
|
||||
typeof item?.props?.title === 'string' ? item.props.title : ''
|
||||
typeof (item as JSX.Element)?.props?.title === 'string'
|
||||
? (item as JSX.Element).props.title
|
||||
: ''
|
||||
}))
|
||||
: []
|
||||
},
|
||||
|
@ -21,6 +21,7 @@ export interface TagProps extends ThemeProps {
|
||||
onClick?: (e: React.MouseEvent) => void;
|
||||
onMouseEnter?: (e: React.MouseEvent) => void;
|
||||
onMouseLeave?: (e: React.MouseEvent) => void;
|
||||
children?: React.ReactNode | Array<React.ReactNode>;
|
||||
}
|
||||
|
||||
export interface CheckableTagProps extends TagProps {
|
||||
|
@ -67,7 +67,7 @@ export interface TooltipObject {
|
||||
/**
|
||||
* 挂载容器元素
|
||||
*/
|
||||
container?: React.ReactNode;
|
||||
container?: HTMLElement | (() => HTMLElement | null | undefined);
|
||||
/**
|
||||
* 浮层触发方式
|
||||
*/
|
||||
@ -87,7 +87,7 @@ export interface TooltipWrapperProps {
|
||||
classPrefix: string;
|
||||
classnames: ClassNamesFn;
|
||||
placement: 'top' | 'right' | 'bottom' | 'left';
|
||||
container?: React.ReactNode;
|
||||
container?: HTMLElement | (() => HTMLElement | null | undefined);
|
||||
trigger: Trigger | Array<Trigger>;
|
||||
rootClose: boolean;
|
||||
overlay?: any;
|
||||
@ -99,7 +99,7 @@ export interface TooltipWrapperProps {
|
||||
* 显示&隐藏时触发
|
||||
*/
|
||||
onVisibleChange?: (visible: boolean) => void;
|
||||
children?: JSX.Element;
|
||||
children?: React.ReactNode | Array<React.ReactNode>;
|
||||
}
|
||||
|
||||
interface TooltipWrapperState {
|
||||
|
@ -224,7 +224,8 @@ export function withRemoteConfig<P = any>(
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
const env: RendererEnv = this.props.env || this.context;
|
||||
const env: RendererEnv =
|
||||
this.props.env || (this.context as RendererEnv);
|
||||
const {store, data} = this.props;
|
||||
const source = (this.props as any)[config.sourceField || 'source'];
|
||||
|
||||
@ -276,7 +277,8 @@ export function withRemoteConfig<P = any>(
|
||||
}
|
||||
|
||||
async loadConfig(ctx = this.props.data) {
|
||||
const env: RendererEnv = this.props.env || this.context;
|
||||
const env: RendererEnv =
|
||||
this.props.env || (this.context as RendererEnv);
|
||||
const {store} = this.props;
|
||||
const source = (this.props as any)[config.sourceField || 'source'];
|
||||
|
||||
@ -286,7 +288,8 @@ export function withRemoteConfig<P = any>(
|
||||
}
|
||||
|
||||
loadAutoComplete(input: string) {
|
||||
const env: RendererEnv = this.props.env || this.context;
|
||||
const env: RendererEnv =
|
||||
this.props.env || (this.context as RendererEnv);
|
||||
const {autoComplete, data, store} = this.props;
|
||||
|
||||
if (!env || !env.fetcher) {
|
||||
@ -330,7 +333,8 @@ export function withRemoteConfig<P = any>(
|
||||
async deferLoadConfig(item: any) {
|
||||
const {store, data, deferApi} = this.props;
|
||||
const source = (this.props as any)[config.sourceField || 'source'];
|
||||
const env: RendererEnv = this.props.env || this.context;
|
||||
const env: RendererEnv =
|
||||
this.props.env || (this.context as RendererEnv);
|
||||
const indexes = findTreeIndex(store.config, a => a === item)!;
|
||||
|
||||
const ret = config.beforeDeferLoad?.(
|
||||
@ -371,7 +375,8 @@ export function withRemoteConfig<P = any>(
|
||||
|
||||
render() {
|
||||
const store = this.props.store;
|
||||
const env: RendererEnv = this.props.env || this.context;
|
||||
const env: RendererEnv =
|
||||
this.props.env || (this.context as RendererEnv);
|
||||
const injectedProps: RemoteOptionsProps<P> = {
|
||||
config: store.config,
|
||||
loading: store.fetching,
|
||||
|
@ -42,7 +42,12 @@ export interface CustomMonthsViewProps extends LocaleProps {
|
||||
setDate?: (date: string) => void;
|
||||
updateSelectedMonth?: () => void;
|
||||
updateSelectedDate: (event: React.MouseEvent<any>, close?: boolean) => void;
|
||||
renderMonth?: (props: any, month: number, year: number, date: any) => void;
|
||||
renderMonth?: (
|
||||
props: any,
|
||||
month: number,
|
||||
year: number,
|
||||
date: any
|
||||
) => React.ReactNode;
|
||||
onConfirm?: (value: number[], types?: string[]) => void;
|
||||
getColumns: (types: DateType[], dateBoundary: void) => any;
|
||||
isValidDate?(value: any): boolean;
|
||||
@ -78,7 +83,7 @@ export class CustomMonthsView extends React.Component<CustomMonthsViewProps> {
|
||||
year = this.props.viewDate.year(),
|
||||
rows = [],
|
||||
i = 0,
|
||||
months = [],
|
||||
months: Array<React.ReactNode> = [],
|
||||
renderer = this.props.renderMonth || this.renderMonth,
|
||||
isValid = this.props.isValidDate || this.alwaysValidDate,
|
||||
classes,
|
||||
|
@ -21,7 +21,7 @@ export function InputJSONSchemaArray(props: InputJSONSchemaItemProps) {
|
||||
collapsable,
|
||||
renderValue
|
||||
} = props;
|
||||
const buildMembers = React.useCallback((schema: any, value) => {
|
||||
const buildMembers = React.useCallback((schema: any, value: any) => {
|
||||
const members: Array<JSONSchemaArrayMember> = [];
|
||||
|
||||
let len = Array.isArray(value) ? value.length : 1;
|
||||
|
@ -26,7 +26,7 @@ export interface MenuItemProps
|
||||
classPrefix: string;
|
||||
classnames: ClassNamesFn;
|
||||
tooltipClassName?: string;
|
||||
tooltipContainer?: React.ReactNode;
|
||||
tooltipContainer?: HTMLElement | (() => HTMLElement);
|
||||
tooltipTrigger?: Trigger | Array<Trigger>;
|
||||
renderLink: Function;
|
||||
extra?: React.ReactNode;
|
||||
|
@ -32,7 +32,7 @@ export interface Props extends ThemeProps, LocaleProps {
|
||||
className: string; // 图标样式
|
||||
layerClassName: string; // 展开层样式
|
||||
active: boolean; // 图标是否高亮
|
||||
popOverContainer?: () => Element | Text | null;
|
||||
popOverContainer?: () => HTMLElement;
|
||||
filterDropdown: (payload: FilterDropdownProps) => JSX.Element | null; // 菜单内容
|
||||
selectedKeys?: Array<string | number> | string;
|
||||
setSelectedKeys?: (keys: Array<string | number> | string) => void;
|
||||
@ -78,7 +78,9 @@ export class HeadCellDropDown extends React.Component<Props, State> {
|
||||
</span>
|
||||
{isOpened ? (
|
||||
<Overlay
|
||||
container={popOverContainer || (() => findDOMNode(this))}
|
||||
container={
|
||||
popOverContainer || (() => findDOMNode(this) as HTMLElement)
|
||||
}
|
||||
placement="left-bottom-left-top right-bottom-right-top"
|
||||
target={
|
||||
popOverContainer ? () => findDOMNode(this)!.parentNode : null
|
||||
|
@ -27,7 +27,7 @@ export interface Props extends ThemeProps, LocaleProps {
|
||||
onFilter?: Function;
|
||||
filteredValue?: Array<string>;
|
||||
filterMultiple?: boolean;
|
||||
popOverContainer?: () => Element | Text | null;
|
||||
popOverContainer?: () => HTMLElement;
|
||||
classnames: ClassNamesFn;
|
||||
classPrefix: string;
|
||||
}
|
||||
@ -170,7 +170,9 @@ export class HeadCellFilter extends React.Component<Props, State> {
|
||||
(options && options.some((item: any) => item.selected))
|
||||
}
|
||||
popOverContainer={
|
||||
popOverContainer ? popOverContainer : () => findDOMNode(this)
|
||||
popOverContainer
|
||||
? popOverContainer
|
||||
: () => findDOMNode(this) as HTMLElement
|
||||
}
|
||||
selectedKeys={this.state.filteredValue}
|
||||
{...filterProps}
|
||||
|
@ -23,7 +23,7 @@ import {Icon} from '../icons';
|
||||
export interface Props extends ThemeProps, LocaleProps {
|
||||
selections: Array<RowSelectionOptionProps>;
|
||||
keys: Array<string | number> | string;
|
||||
popOverContainer?: () => Element | Text | null;
|
||||
popOverContainer?: () => HTMLElement;
|
||||
classnames: ClassNamesFn;
|
||||
classPrefix: string;
|
||||
}
|
||||
@ -61,7 +61,9 @@ export class HeadCellSelect extends React.Component<Props, State> {
|
||||
filterIcon={<Icon icon="left-arrow" className="icon" />}
|
||||
active={false}
|
||||
popOverContainer={
|
||||
popOverContainer ? popOverContainer : () => findDOMNode(this)
|
||||
popOverContainer
|
||||
? popOverContainer
|
||||
: () => findDOMNode(this) as HTMLElement
|
||||
}
|
||||
filterDropdown={({
|
||||
setSelectedKeys,
|
||||
|
@ -4,7 +4,7 @@ import {ClassNamesFn} from 'amis-core';
|
||||
|
||||
export interface ItemActionsProps {
|
||||
classnames: ClassNamesFn;
|
||||
children?: JSX.Element;
|
||||
children?: React.ReactNode | Array<React.ReactNode>;
|
||||
dom: HTMLTableRowElement;
|
||||
}
|
||||
|
||||
|
@ -365,7 +365,7 @@ export class Table extends React.PureComponent<TableProps, TableState> {
|
||||
|
||||
@autobind
|
||||
getPopOverContainer() {
|
||||
return findDOMNode(this);
|
||||
return findDOMNode(this) as HTMLElement;
|
||||
}
|
||||
|
||||
// 表头配置
|
||||
@ -1099,14 +1099,16 @@ export class Table extends React.PureComponent<TableProps, TableState> {
|
||||
}
|
||||
const children = !item.children?.length ? (
|
||||
<span>
|
||||
{sort}
|
||||
{filter}
|
||||
{resizable ? (
|
||||
<i
|
||||
className={cx('Table-thead-resizable')}
|
||||
onMouseDown={e => this.onResizeMouseDown(e, cIndex)}
|
||||
></i>
|
||||
) : null}
|
||||
<>
|
||||
{sort}
|
||||
{filter}
|
||||
{resizable ? (
|
||||
<i
|
||||
className={cx('Table-thead-resizable')}
|
||||
onMouseDown={e => this.onResizeMouseDown(e, cIndex)}
|
||||
></i>
|
||||
) : null}
|
||||
</>
|
||||
</span>
|
||||
) : null;
|
||||
|
||||
|
@ -6,7 +6,7 @@ const useSetState = <T extends object>(
|
||||
): [T, (patch: Partial<T> | ((prevState: T) => Partial<T>)) => void] => {
|
||||
const [state, setState] = useState<T>(initialState);
|
||||
|
||||
const setMergeState = useCallback(patch => {
|
||||
const setMergeState = useCallback((patch: any) => {
|
||||
setState(prevState => ({
|
||||
...prevState,
|
||||
...(isFunction(patch) ? patch(prevState) : patch)
|
||||
|
@ -45,7 +45,9 @@ import {scrollPosition, isMobile} from 'amis-core';
|
||||
* css 定义
|
||||
*/
|
||||
interface CSSRule {
|
||||
[selector: string]: Record<string, string> | Record<string, Record<string, string>>; // 定义
|
||||
[selector: string]:
|
||||
| Record<string, string>
|
||||
| Record<string, Record<string, string>>; // 定义
|
||||
}
|
||||
|
||||
/**
|
||||
@ -326,16 +328,16 @@ export default class Page extends React.Component<PageProps> {
|
||||
const declaration = cssRules[selector];
|
||||
let declarationStr = '';
|
||||
for (const property in declaration) {
|
||||
let innerstr = ''
|
||||
const innerValue=declaration[property]
|
||||
if (typeof innerValue==='string') {
|
||||
let innerstr = '';
|
||||
const innerValue = declaration[property];
|
||||
if (typeof innerValue === 'string') {
|
||||
declarationStr += ` ${property}: ${innerValue};\n`;
|
||||
} else {
|
||||
for (const propsName in innerValue) {
|
||||
innerstr+= ` ${propsName}:${innerValue[propsName]};`;
|
||||
innerstr += ` ${propsName}:${innerValue[propsName]};`;
|
||||
}
|
||||
declarationStr += ` ${property} {${innerstr}}\n`;
|
||||
}
|
||||
declarationStr += ` ${property} {${innerstr}}\n`;
|
||||
}
|
||||
}
|
||||
|
||||
css += `
|
||||
@ -1020,7 +1022,7 @@ export class PageRenderer extends Page {
|
||||
const store = this.props.store;
|
||||
const dialogAction = store.action as ActionObject;
|
||||
const reload = action.reload ?? dialogAction.reload;
|
||||
const scoped = store.getDialogScoped() || this.context;
|
||||
const scoped = store.getDialogScoped() || (this.context as IScopedContext);
|
||||
|
||||
super.handleDialogConfirm(values, action, ...rest);
|
||||
|
||||
|
@ -5,7 +5,7 @@ import {ClassNamesFn} from 'amis-core';
|
||||
|
||||
export interface ItemActionsProps {
|
||||
classnames: ClassNamesFn;
|
||||
children: JSX.Element;
|
||||
children: React.ReactNode | Array<React.ReactNode>;
|
||||
store: ITableStore;
|
||||
}
|
||||
|
||||
|
@ -143,7 +143,7 @@ export interface TooltipWrapperProps extends RendererProps {
|
||||
disabled?: boolean;
|
||||
mouseEnterDelay?: number;
|
||||
mouseLeaveDelay?: number;
|
||||
container?: React.ReactNode;
|
||||
container?: HTMLElement | (() => HTMLElement);
|
||||
style?: React.CSSProperties;
|
||||
tooltipStyle?: React.CSSProperties;
|
||||
wrapperComponent?: string;
|
||||
@ -240,7 +240,12 @@ export default class TooltipWrapper extends React.Component<
|
||||
placement,
|
||||
trigger,
|
||||
rootClose,
|
||||
container: container !== undefined ? container : (env && env.getModalContainer ? env.getModalContainer : undefined),
|
||||
container:
|
||||
container !== undefined
|
||||
? container
|
||||
: env && env.getModalContainer
|
||||
? env.getModalContainer
|
||||
: undefined,
|
||||
tooltipTheme,
|
||||
tooltipClassName,
|
||||
mouseEnterDelay,
|
||||
|
Loading…
Reference in New Issue
Block a user