mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 03:58:07 +08:00
feat: 增加input-number inputExcel service tpl 的部分testid (#9526)
This commit is contained in:
parent
0d3563d994
commit
da01d47b0e
@ -30,6 +30,16 @@
|
||||
color: #bdbdbd;
|
||||
outline: none;
|
||||
transition: border 0.24s ease-in-out;
|
||||
position: relative;
|
||||
> input {
|
||||
display: block !important;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
&-dropzone:focus {
|
||||
|
@ -10,7 +10,14 @@ import getMiniDecimal, {
|
||||
} from '@rc-component/mini-decimal';
|
||||
|
||||
import {Icon} from './icons';
|
||||
import {ThemeProps, themeable, isNumeric, autobind, ucFirst} from 'amis-core';
|
||||
import {
|
||||
ThemeProps,
|
||||
themeable,
|
||||
isNumeric,
|
||||
autobind,
|
||||
ucFirst,
|
||||
TestIdBuilder
|
||||
} from 'amis-core';
|
||||
|
||||
export type ValueType = string | number;
|
||||
|
||||
@ -74,6 +81,8 @@ export interface NumberProps extends ThemeProps {
|
||||
* 数字输入框类名
|
||||
*/
|
||||
inputControlClassName?: string;
|
||||
|
||||
testIdBuilder?: TestIdBuilder;
|
||||
}
|
||||
|
||||
export interface NumberState {
|
||||
@ -317,7 +326,8 @@ export class NumberInput extends React.Component<NumberProps, NumberState> {
|
||||
inputRef,
|
||||
keyboard,
|
||||
inputControlClassName,
|
||||
mobileUI
|
||||
mobileUI,
|
||||
testIdBuilder
|
||||
} = this.props;
|
||||
const precisionProps: any = {
|
||||
precision: NumberInput.normalizePrecision(precision, step)
|
||||
@ -356,6 +366,7 @@ export class NumberInput extends React.Component<NumberProps, NumberState> {
|
||||
stringMode={this.isBig ? true : false}
|
||||
keyboard={keyboard}
|
||||
{...precisionProps}
|
||||
{...testIdBuilder?.getTestId()}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
@ -1139,6 +1139,7 @@ export class Select extends React.Component<SelectProps, SelectState> {
|
||||
<span
|
||||
className={cx('Select-option-content')}
|
||||
title={typeof label === 'string' ? label : ''}
|
||||
{...optTestIdBudr?.getChild('content').getTestId()}
|
||||
>
|
||||
{item.disabled
|
||||
? label
|
||||
|
@ -10,7 +10,8 @@ import {
|
||||
autobind,
|
||||
isObject,
|
||||
resolveEventData,
|
||||
dataMapping
|
||||
dataMapping,
|
||||
TestIdBuilder
|
||||
} from 'amis-core';
|
||||
import {FormBaseControlSchema, SchemaTokenizeableString} from '../../Schema';
|
||||
import type {CellValue, CellRichTextValue} from 'exceljs';
|
||||
@ -64,6 +65,8 @@ export interface InputExcelControlSchema extends FormBaseControlSchema {
|
||||
autoFill?: {
|
||||
[propName: string]: SchemaTokenizeableString;
|
||||
};
|
||||
|
||||
testIdBuilder?: TestIdBuilder;
|
||||
}
|
||||
|
||||
export interface ExcelProps
|
||||
@ -401,7 +404,8 @@ export default class ExcelControl extends React.PureComponent<
|
||||
classPrefix: ns,
|
||||
disabled,
|
||||
translate: __,
|
||||
placeholder
|
||||
placeholder,
|
||||
testIdBuilder
|
||||
} = this.props;
|
||||
|
||||
return (
|
||||
@ -415,8 +419,14 @@ export default class ExcelControl extends React.PureComponent<
|
||||
>
|
||||
{({getRootProps, getInputProps}) => (
|
||||
<section className={cx('ExcelControl-container', className)}>
|
||||
<div {...getRootProps({className: cx('ExcelControl-dropzone')})}>
|
||||
<input {...getInputProps()} />
|
||||
<div
|
||||
{...getRootProps({className: cx('ExcelControl-dropzone')})}
|
||||
{...testIdBuilder?.getTestId()}
|
||||
>
|
||||
<input
|
||||
{...getInputProps()}
|
||||
{...testIdBuilder?.getChild('input').getTestId()}
|
||||
/>
|
||||
{this.state.filename ? (
|
||||
__('Excel.parsed', {
|
||||
filename: this.state.filename
|
||||
|
@ -7,7 +7,8 @@ import {
|
||||
resolveEventData,
|
||||
CustomStyle,
|
||||
formatInputThemeCss,
|
||||
setThemeClassName
|
||||
setThemeClassName,
|
||||
TestIdBuilder
|
||||
} from 'amis-core';
|
||||
import cx from 'classnames';
|
||||
import {NumberInput, Select} from 'amis-ui';
|
||||
@ -158,6 +159,8 @@ export interface NumberProps extends FormControlProps {
|
||||
* 是否在清空内容时从数据域中删除该表单项对应的值
|
||||
*/
|
||||
clearValueOnEmpty?: boolean;
|
||||
|
||||
testIdBuilder?: TestIdBuilder;
|
||||
}
|
||||
|
||||
interface NumberState {
|
||||
@ -445,7 +448,8 @@ export default class NumberControl extends React.Component<
|
||||
themeCss,
|
||||
inputControlClassName,
|
||||
id,
|
||||
env
|
||||
env,
|
||||
testIdBuilder
|
||||
} = this.props;
|
||||
const {unit} = this.state;
|
||||
const finalPrecision = this.filterNum(precision);
|
||||
@ -523,6 +527,7 @@ export default class NumberControl extends React.Component<
|
||||
displayMode={displayMode}
|
||||
big={big}
|
||||
clearValueOnEmpty={clearValueOnEmpty}
|
||||
testIdBuilder={testIdBuilder}
|
||||
/>
|
||||
{Array.isArray(unitOptions) && unitOptions.length !== 0 ? (
|
||||
unitOptions.length > 1 ? (
|
||||
|
@ -14,7 +14,8 @@ import {
|
||||
isEffectiveApi,
|
||||
isApiOutdated,
|
||||
createObject,
|
||||
autobind
|
||||
autobind,
|
||||
TestIdBuilder
|
||||
} from 'amis-core';
|
||||
import {TransferDropDown, Spinner, Select, SpinnerExtraProps} from 'amis-ui';
|
||||
import {FormOptionsSchema, SchemaApi} from '../../Schema';
|
||||
@ -155,6 +156,8 @@ export interface SelectControlSchema
|
||||
*/
|
||||
filterOption?: 'string';
|
||||
};
|
||||
|
||||
testIdBuilder?: TestIdBuilder;
|
||||
}
|
||||
|
||||
export interface SelectProps extends OptionsControlProps, SpinnerExtraProps {
|
||||
@ -409,12 +412,13 @@ export default class SelectControl extends React.Component<SelectProps, any> {
|
||||
|
||||
@autobind
|
||||
renderMenu(option: Option, state: any) {
|
||||
const {menuTpl, render, data, optionClassName} = this.props;
|
||||
const {menuTpl, render, data, optionClassName, testIdBuilder} = this.props;
|
||||
|
||||
return render(`menu/${state.index}`, menuTpl, {
|
||||
showNativeTitle: true,
|
||||
className: cx('Select-option-content', optionClassName),
|
||||
data: createObject(createObject(data, state), option)
|
||||
data: createObject(createObject(data, state), option),
|
||||
testIdBuilder: testIdBuilder?.getChild('option-' + state.index)
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,8 @@ import {
|
||||
isVisible,
|
||||
qsstringify,
|
||||
createObject,
|
||||
extendObject
|
||||
extendObject,
|
||||
TestIdBuilder
|
||||
} from 'amis-core';
|
||||
import {
|
||||
BaseSchema,
|
||||
@ -151,6 +152,7 @@ export interface ServiceProps
|
||||
Omit<ServiceSchema, 'type' | 'className'> {
|
||||
store: IServiceStore;
|
||||
messages: SchemaMessage;
|
||||
testIdBuilder?: TestIdBuilder;
|
||||
}
|
||||
export default class Service extends React.Component<ServiceProps> {
|
||||
timer: ReturnType<typeof setTimeout>;
|
||||
@ -797,11 +799,16 @@ export default class Service extends React.Component<ServiceProps> {
|
||||
classPrefix: ns,
|
||||
classnames: cx,
|
||||
loadingConfig,
|
||||
showErrorMsg
|
||||
showErrorMsg,
|
||||
testIdBuilder
|
||||
} = this.props;
|
||||
|
||||
return (
|
||||
<div className={cx(`${ns}Service`, className)} style={style}>
|
||||
<div
|
||||
className={cx(`${ns}Service`, className)}
|
||||
style={style}
|
||||
{...testIdBuilder?.getTestId()}
|
||||
>
|
||||
{!env.forceSilenceInsideError &&
|
||||
store.error &&
|
||||
showErrorMsg !== false ? (
|
||||
|
@ -7,7 +7,7 @@ import {
|
||||
CustomStyle,
|
||||
setThemeClassName
|
||||
} from 'amis-core';
|
||||
import {filter, asyncFilter} from 'amis-core';
|
||||
import {filter, asyncFilter, TestIdBuilder} from 'amis-core';
|
||||
import isEmpty from 'lodash/isEmpty';
|
||||
import {anyChanged, getPropValue} from 'amis-core';
|
||||
import {escapeHtml} from 'amis-core';
|
||||
@ -52,6 +52,8 @@ export interface TplSchema extends BaseSchema {
|
||||
* 角标
|
||||
*/
|
||||
badge?: BadgeObject;
|
||||
|
||||
testidBuilder?: TestIdBuilder;
|
||||
}
|
||||
|
||||
export interface TplProps extends RendererProps, TplSchema {
|
||||
@ -200,7 +202,8 @@ export class Tpl extends React.Component<TplProps, TplState> {
|
||||
id,
|
||||
wrapperCustomStyle,
|
||||
env,
|
||||
themeCss
|
||||
themeCss,
|
||||
testIdBuilder
|
||||
} = this.props;
|
||||
const Component = wrapperComponent || (inline ? 'span' : 'div');
|
||||
const {content} = this.state;
|
||||
@ -236,6 +239,7 @@ export class Tpl extends React.Component<TplProps, TplState> {
|
||||
onClick={this.handleClick}
|
||||
onMouseEnter={this.handleMouseEnter}
|
||||
onMouseLeave={this.handleMouseLeave}
|
||||
{...testIdBuilder?.getChild('tpl')?.getTestId()}
|
||||
>
|
||||
<span
|
||||
className={cln ? cx(cln) : undefined}
|
||||
|
Loading…
Reference in New Issue
Block a user