mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-29 18:48:45 +08:00
feat: container wizard 组件 testid
This commit is contained in:
parent
4d56f38a6e
commit
6de217d016
@ -157,7 +157,8 @@ export default class Container<T> extends React.Component<
|
||||
classnames: cx,
|
||||
bodyClassName,
|
||||
disabled,
|
||||
wrapperBody
|
||||
wrapperBody,
|
||||
testIdBuilder
|
||||
} = this.props;
|
||||
|
||||
const isWrapperBody = wrapperBody ?? true;
|
||||
@ -172,7 +173,10 @@ export default class Container<T> extends React.Component<
|
||||
|
||||
if (isWrapperBody) {
|
||||
return (
|
||||
<div className={cx('Container-body', bodyClassName)}>
|
||||
<div
|
||||
className={cx('Container-body', bodyClassName)}
|
||||
{...testIdBuilder?.getTestId()}
|
||||
>
|
||||
{containerBody}
|
||||
</div>
|
||||
);
|
||||
|
@ -5,6 +5,7 @@ import {Icon} from 'amis-ui';
|
||||
import {Overlay} from 'amis-core';
|
||||
import {PopOver} from 'amis-core';
|
||||
import {setVariable, createObject} from 'amis-core';
|
||||
import type {TestIdBuilder} from 'amis-core';
|
||||
|
||||
export interface QuickSearchConfig {
|
||||
type?: string;
|
||||
@ -19,6 +20,7 @@ export interface HeadCellSearchProps extends RendererProps {
|
||||
searchable: boolean | QuickSearchConfig;
|
||||
classPrefix: string;
|
||||
onQuery: (values: object) => void;
|
||||
testIdBuilder?: TestIdBuilder;
|
||||
}
|
||||
|
||||
export function HeadCellSearchDropDown({
|
||||
@ -33,7 +35,8 @@ export function HeadCellSearchDropDown({
|
||||
translate: __,
|
||||
classPrefix: ns,
|
||||
popOverContainer,
|
||||
render
|
||||
render,
|
||||
testIdBuilder
|
||||
}: HeadCellSearchProps) {
|
||||
const ref = React.createRef<HTMLElement>();
|
||||
const [formSchema, formItems] = React.useMemo(() => {
|
||||
@ -183,6 +186,7 @@ export function HeadCellSearchDropDown({
|
||||
isActive ? 'is-active' : '',
|
||||
isOpened ? 'is-opened' : ''
|
||||
)}
|
||||
{...testIdBuilder?.getTestId()}
|
||||
>
|
||||
<span onClick={open}>
|
||||
<Icon icon="search" className="icon" />
|
||||
|
@ -1851,12 +1851,14 @@ export default class Table extends React.Component<TableProps, object> {
|
||||
classnames: cx,
|
||||
autoGenerateFilter,
|
||||
dispatchEvent,
|
||||
data
|
||||
data,
|
||||
testIdBuilder
|
||||
} = this.props;
|
||||
|
||||
// 注意,这里用关了哪些 store 里面的东西,TableContent 里面得也用一下
|
||||
// 因为 renderHeadCell 是 TableContent 回调的,tableContent 不重新渲染,这里面也不会重新渲染
|
||||
|
||||
const tIdCell = testIdBuilder?.getChild(`head-cell-${column.name}`);
|
||||
const style = {...props.style};
|
||||
const [stickyStyle, stickyClassName] = store.getStickyStyles(
|
||||
column,
|
||||
@ -1989,6 +1991,7 @@ export default class Table extends React.Component<TableProps, object> {
|
||||
searchable={column.searchable}
|
||||
type={column.type}
|
||||
data={query}
|
||||
testIdBuilder={tIdCell?.getChild('search')}
|
||||
popOverContainer={this.getPopOverContainer}
|
||||
/>
|
||||
);
|
||||
@ -2079,6 +2082,7 @@ export default class Table extends React.Component<TableProps, object> {
|
||||
superData={createObject(data, query)}
|
||||
filterable={column.filterable}
|
||||
popOverContainer={this.getPopOverContainer}
|
||||
testIdBuilder={tIdCell?.getChild('filter')}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@ -2093,6 +2097,7 @@ export default class Table extends React.Component<TableProps, object> {
|
||||
'TableCell--filterable': column.filterable,
|
||||
'Table-operationCell': column.type === 'operation'
|
||||
})}
|
||||
{...tIdCell?.getTestId()}
|
||||
>
|
||||
{prefix}
|
||||
<div
|
||||
|
@ -1100,7 +1100,8 @@ export default class Wizard extends React.Component<WizardProps, WizardState> {
|
||||
actionFinishLabel,
|
||||
render,
|
||||
translate: __,
|
||||
classnames: cx
|
||||
classnames: cx,
|
||||
testIdBuilder
|
||||
} = this.props;
|
||||
const steps = this.state.rawSteps;
|
||||
|
||||
@ -1155,7 +1156,8 @@ export default class Wizard extends React.Component<WizardProps, WizardState> {
|
||||
label: __(actionPrevLabel),
|
||||
actionType: 'prev',
|
||||
className: actionClassName,
|
||||
hiddenOn: '${currentStep === 1}'
|
||||
hiddenOn: '${currentStep === 1}',
|
||||
id: testIdBuilder?.getChild('button-prev').getTestIdValue()
|
||||
},
|
||||
{
|
||||
disabled: waiting || !prevCanJump || disabled,
|
||||
@ -1176,7 +1178,8 @@ export default class Wizard extends React.Component<WizardProps, WizardState> {
|
||||
actionType: 'next',
|
||||
primary: !nextStep || !!step.api,
|
||||
className: actionClassName,
|
||||
level: 'primary'
|
||||
level: 'primary',
|
||||
id: testIdBuilder?.getChild('button-next').getTestIdValue()
|
||||
},
|
||||
{
|
||||
disabled:
|
||||
|
Loading…
Reference in New Issue
Block a user