mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 05:36:05 +00:00
chore: add testid
This commit is contained in:
parent
4e882c582c
commit
1f2a7f56f8
@ -16,7 +16,7 @@ const schema2: ISchema = {
|
||||
|
||||
export const ACLPane = () => {
|
||||
return (
|
||||
<Card bordered={false}>
|
||||
<Card data-testid="acl-pane-card" bordered={false}>
|
||||
<SchemaComponent components={components} schema={schema2} />
|
||||
</Card>
|
||||
);
|
||||
|
@ -84,6 +84,7 @@ export const StrategyActions = connect((props) => {
|
||||
render: (scope, action) =>
|
||||
!action.onNewRecord && (
|
||||
<Select
|
||||
data-testid="antd-select"
|
||||
popupMatchSelectWidth={false}
|
||||
size={'small'}
|
||||
value={scope}
|
||||
|
@ -286,7 +286,7 @@ export const BlockProvider = (props) => {
|
||||
<BlockRequestProvider {...props} updateAssociationValues={updateAssociationValues} params={params}>
|
||||
<SharedFilterProvider {...props} params={params}>
|
||||
<FilterBlockRecord {...props} params={params}>
|
||||
{props.children}
|
||||
<div data-testid={props['data-testid']}>{props.children}</div>
|
||||
</FilterBlockRecord>
|
||||
</SharedFilterProvider>
|
||||
</BlockRequestProvider>
|
||||
|
@ -33,7 +33,7 @@ const InternalCalendarBlockProvider = (props) => {
|
||||
|
||||
export const CalendarBlockProvider = (props) => {
|
||||
return (
|
||||
<BlockProvider {...props} params={{ ...props.params, paginate: false }}>
|
||||
<BlockProvider data-testid="calendar-block" {...props} params={{ ...props.params, paginate: false }}>
|
||||
<InternalCalendarBlockProvider {...props} />
|
||||
</BlockProvider>
|
||||
);
|
||||
|
@ -39,7 +39,7 @@ const InternalDetailsBlockProvider = (props) => {
|
||||
|
||||
export const DetailsBlockProvider = (props) => {
|
||||
return (
|
||||
<BlockProvider {...props}>
|
||||
<BlockProvider data-testid="details-block" {...props}>
|
||||
<InternalDetailsBlockProvider {...props} />
|
||||
</BlockProvider>
|
||||
);
|
||||
|
@ -5,7 +5,7 @@ import { FormBlockProvider } from './FormBlockProvider';
|
||||
export const FilterFormBlockProvider = (props) => {
|
||||
return (
|
||||
<DatePickerProvider value={{ utc: false }}>
|
||||
<FormBlockProvider {...props}></FormBlockProvider>
|
||||
<FormBlockProvider data-testid="filter-form-block" {...props}></FormBlockProvider>
|
||||
</DatePickerProvider>
|
||||
);
|
||||
};
|
||||
|
@ -82,7 +82,7 @@ export const FormBlockProvider = (props) => {
|
||||
(currentCollection.name === (collection?.name || collection) && !isEmptyRecord) || !currentCollection.name;
|
||||
return (
|
||||
(detailFlag || createFlag || isCusomeizeCreate) && (
|
||||
<BlockProvider {...props} block={'form'}>
|
||||
<BlockProvider data-testid={props['data-testid'] || 'form-block'} {...props} block={'form'}>
|
||||
<InternalFormBlockProvider {...props} />
|
||||
</BlockProvider>
|
||||
)
|
||||
|
@ -77,7 +77,7 @@ export const WithoutFormFieldResource = createContext(null);
|
||||
export const FormFieldProvider = (props) => {
|
||||
return (
|
||||
<WithoutFormFieldResource.Provider value={false}>
|
||||
<BlockProvider block={'FormField'} {...props}>
|
||||
<BlockProvider data-testid="form-field-block" block={'FormField'} {...props}>
|
||||
<InternalFormFieldProvider {...props} />
|
||||
</BlockProvider>
|
||||
</WithoutFormFieldResource.Provider>
|
||||
|
@ -73,7 +73,7 @@ const InternalGanttBlockProvider = (props) => {
|
||||
export const GanttBlockProvider = (props) => {
|
||||
const params = { filter: props.params.filter, tree: true, paginate: false, sort: props.fieldNames.start };
|
||||
return (
|
||||
<BlockProvider {...props} params={params}>
|
||||
<BlockProvider data-testid="gantt-block" {...props} params={params}>
|
||||
<TableBlockProvider {...props} params={params}>
|
||||
<InternalGanttBlockProvider {...props} />
|
||||
</TableBlockProvider>
|
||||
|
@ -108,7 +108,7 @@ export const KanbanBlockProvider = (props) => {
|
||||
params['appends'] = appends;
|
||||
}
|
||||
return (
|
||||
<BlockProvider {...props} params={params}>
|
||||
<BlockProvider data-testid="kanban-block" {...props} params={params}>
|
||||
<InternalKanbanBlockProvider {...props} params={params} />
|
||||
</BlockProvider>
|
||||
);
|
||||
|
@ -97,7 +97,7 @@ export const TableBlockProvider = (props) => {
|
||||
return (
|
||||
<SchemaComponentOptions scope={{ treeTable }}>
|
||||
<FormContext.Provider value={form}>
|
||||
<BlockProvider {...props} params={params} runWhenParamsChanged>
|
||||
<BlockProvider data-testid="table-block" {...props} params={params} runWhenParamsChanged>
|
||||
<InternalTableBlockProvider {...props} childrenColumnName={childrenColumnName} params={params} />
|
||||
</BlockProvider>
|
||||
</FormContext.Provider>
|
||||
|
@ -126,7 +126,7 @@ export const WithoutTableFieldResource = createContext(null);
|
||||
export const TableFieldProvider = (props) => {
|
||||
return (
|
||||
<WithoutTableFieldResource.Provider value={false}>
|
||||
<BlockProvider block={'TableField'} {...props}>
|
||||
<BlockProvider data-testid="table-field-block" block={'TableField'} {...props}>
|
||||
<InternalTableFieldProvider {...props} />
|
||||
</BlockProvider>
|
||||
</WithoutTableFieldResource.Provider>
|
||||
|
@ -238,7 +238,7 @@ export const TableSelectorProvider = (props: TableSelectorProviderProps) => {
|
||||
|
||||
return (
|
||||
<SchemaComponentOptions scope={{ treeTable }}>
|
||||
<BlockProvider {...props} params={params}>
|
||||
<BlockProvider data-testid="table-selector-block" {...props} params={params}>
|
||||
<InternalTableSelectorProvider {...props} params={params} extraFilter={extraFilter} />
|
||||
</BlockProvider>
|
||||
</SchemaComponentOptions>
|
||||
|
@ -17,6 +17,7 @@ export const SourceForeignKey = observer(
|
||||
return (
|
||||
<div>
|
||||
<Select
|
||||
data-testid="antd-select"
|
||||
allowClear
|
||||
placeholder={'留空时,自动生成 FK 字段'}
|
||||
disabled={field.disabled}
|
||||
@ -44,6 +45,7 @@ export const ThroughForeignKey = observer(
|
||||
return (
|
||||
<div>
|
||||
<Select
|
||||
data-testid="antd-select"
|
||||
allowClear
|
||||
popupMatchSelectWidth={false}
|
||||
placeholder={'留空时,自动生成 FK 字段'}
|
||||
@ -72,6 +74,7 @@ export const TargetForeignKey = observer(
|
||||
return (
|
||||
<div>
|
||||
<Select
|
||||
data-testid="antd-select"
|
||||
allowClear
|
||||
popupMatchSelectWidth={false}
|
||||
placeholder={'留空时,自动生成 FK 字段'}
|
||||
@ -101,6 +104,7 @@ export const SourceCollection = observer(
|
||||
return (
|
||||
<div>
|
||||
<Select
|
||||
data-testid="antd-select"
|
||||
disabled
|
||||
popupMatchSelectWidth={false}
|
||||
value={collection.name}
|
||||
@ -116,7 +120,7 @@ export const SourceKey = observer(
|
||||
() => {
|
||||
return (
|
||||
<div>
|
||||
<Select disabled value={'id'} options={[{ value: 'id', label: 'ID' }]} />
|
||||
<Select data-testid="antd-select" disabled value={'id'} options={[{ value: 'id', label: 'ID' }]} />
|
||||
</div>
|
||||
);
|
||||
},
|
||||
@ -127,7 +131,7 @@ export const TargetKey = observer(
|
||||
() => {
|
||||
return (
|
||||
<div>
|
||||
<Select disabled value={'id'} options={[{ value: 'id', label: 'ID' }]} />
|
||||
<Select data-testid="antd-select" disabled value={'id'} options={[{ value: 'id', label: 'ID' }]} />
|
||||
</div>
|
||||
);
|
||||
},
|
||||
|
@ -148,6 +148,7 @@ const PreviewCom = (props) => {
|
||||
<Tag>{text}</Tag>
|
||||
) : (
|
||||
<Select
|
||||
data-testid="antd-select"
|
||||
defaultValue={text}
|
||||
popupMatchSelectWidth={false}
|
||||
style={{ width: '100%' }}
|
||||
@ -173,6 +174,7 @@ const PreviewCom = (props) => {
|
||||
text
|
||||
) : (
|
||||
<Select
|
||||
data-testid="antd-select"
|
||||
defaultValue={text}
|
||||
style={{ width: '100%' }}
|
||||
popupMatchSelectWidth={false}
|
||||
|
@ -67,6 +67,7 @@ export const SettingsCenterDropdown = () => {
|
||||
<ActionContextProvider value={{ visible, setVisible }}>
|
||||
<Dropdown placement="bottom" menu={menu}>
|
||||
<Button
|
||||
data-testid="settings-center-button"
|
||||
icon={<SettingOutlined />}
|
||||
// title={t('All plugin settings')}
|
||||
/>
|
||||
|
@ -28,6 +28,7 @@ export const ActionDrawer: ComposedActionDrawer = observer(
|
||||
|
||||
return (
|
||||
<Drawer
|
||||
data-testid="action-drawer"
|
||||
width={openSizeWidthMap.get(openSize)}
|
||||
title={field.title}
|
||||
{...others}
|
||||
|
@ -26,6 +26,7 @@ export const ActionModal: ComposedActionDrawer<ModalProps> = observer(
|
||||
});
|
||||
return (
|
||||
<Modal
|
||||
data-testid="action-modal"
|
||||
width={actualWidth}
|
||||
title={field.title}
|
||||
{...(others as ModalProps)}
|
||||
|
@ -28,7 +28,7 @@ export const ActionPage: ComposedActionDrawer = observer(
|
||||
{containerRef?.current &&
|
||||
visible &&
|
||||
createPortal(
|
||||
<div className="nb-action-page">
|
||||
<div data-testid="action-page" className="nb-action-page">
|
||||
<RecursionField
|
||||
basePath={field.address}
|
||||
schema={schema}
|
||||
|
@ -61,7 +61,7 @@ function TypeSelect(props) {
|
||||
});
|
||||
|
||||
return (
|
||||
<Select {...props}>
|
||||
<Select data-testid="antd-select" {...props}>
|
||||
{Object.keys(types).map((key) => (
|
||||
<Select.Option key={key} value={key}>
|
||||
{types[key].title}
|
||||
|
@ -202,7 +202,7 @@ export const AppendsTreeSelect: React.FC<AppendsTreeSelectProps> = (props) => {
|
||||
}
|
||||
const { fullTitle } = optionsMap[value] ?? {};
|
||||
return (
|
||||
<Tag closable={closable && !disabled} onClose={onClose}>
|
||||
<Tag data-testid="antd-tag" closable={closable && !disabled} onClose={onClose}>
|
||||
{fullTitle?.join(' / ')}
|
||||
</Tag>
|
||||
);
|
||||
@ -219,6 +219,7 @@ export const AppendsTreeSelect: React.FC<AppendsTreeSelectProps> = (props) => {
|
||||
|
||||
return (
|
||||
<TreeSelect
|
||||
data-testid="antd-tree-select"
|
||||
value={filteredValue}
|
||||
placeholder={t('Select field')}
|
||||
showCheckedStrategy={TreeSelect.SHOW_ALL}
|
||||
|
@ -23,9 +23,13 @@ import { flatData, getLabelFormatValue, useLabelUiSchema } from './util';
|
||||
|
||||
const useTableSelectorProps = () => {
|
||||
const field: any = useField();
|
||||
const { multiple, options = [], setSelectedRows, selectedRows: rcSelectRows = [], onChange } = useContext(
|
||||
RecordPickerContext,
|
||||
);
|
||||
const {
|
||||
multiple,
|
||||
options = [],
|
||||
setSelectedRows,
|
||||
selectedRows: rcSelectRows = [],
|
||||
onChange,
|
||||
} = useContext(RecordPickerContext);
|
||||
const { onRowSelectionChange, rowKey = 'id', ...others } = useTsp();
|
||||
const { setVisible } = useActionContext();
|
||||
return {
|
||||
@ -128,6 +132,7 @@ export const InternalPicker = observer(
|
||||
<Input.Group compact style={{ display: 'flex', lineHeight: '32px' }}>
|
||||
<div style={{ width: '100%' }}>
|
||||
<Select
|
||||
data-testid="antd-select"
|
||||
style={{ width: '100%' }}
|
||||
popupMatchSelectWidth={false}
|
||||
{...others}
|
||||
|
@ -1,12 +1,12 @@
|
||||
import { css } from '@emotion/css';
|
||||
import { FormLayout } from '@formily/antd-v5';
|
||||
import { RecursionField, observer, useField, useFieldSchema, SchemaOptionsContext } from '@formily/react';
|
||||
import { RecursionField, SchemaOptionsContext, observer, useField, useFieldSchema } from '@formily/react';
|
||||
import React, { useEffect } from 'react';
|
||||
import { ACLCollectionProvider, useACLActionParamsContext } from '../../../acl';
|
||||
import { CollectionProvider } from '../../../collection-manager';
|
||||
import { useSchemaOptionsContext } from '../../../schema-component';
|
||||
import Select from '../select/Select';
|
||||
import { useAssociationFieldContext, useInsertSchema } from './hooks';
|
||||
import { ACLCollectionProvider, useACLActionParamsContext } from '../../../acl';
|
||||
import schema from './schema';
|
||||
|
||||
export const InternalSubTable = observer(
|
||||
@ -24,8 +24,8 @@ export const InternalSubTable = observer(
|
||||
const option = useSchemaOptionsContext();
|
||||
const components = {
|
||||
...option.components,
|
||||
'Radio.Group': Select,
|
||||
'Checkbox.Group': (props) => <Select multiple={true} mode="multiple" {...props} />,
|
||||
'Radio.Group': (props) => <Select data-testid="antd-select" {...props} />,
|
||||
'Checkbox.Group': (props) => <Select data-testid="antd-select" multiple={true} mode="multiple" {...props} />,
|
||||
};
|
||||
return (
|
||||
<CollectionProvider name={options.target}>
|
||||
|
@ -79,6 +79,7 @@ export const AssociationFilterFilterBlockInitializer = () => {
|
||||
|
||||
return (
|
||||
<SchemaInitializer.Button
|
||||
data-testid="configure-fields-button-of-association-filter-filter-block"
|
||||
className={css`
|
||||
margin-top: 16px;
|
||||
`}
|
||||
|
@ -49,6 +49,7 @@ export const AssociationFilterInitializer = () => {
|
||||
|
||||
return (
|
||||
<SchemaInitializer.Button
|
||||
data-testid="configure-fields-button-of-association-filter"
|
||||
className={css`
|
||||
margin-top: 16px;
|
||||
`}
|
||||
|
@ -15,7 +15,7 @@ export const ViewSelect = observer(
|
||||
} = useContext(CalendarToolbarContext);
|
||||
return (
|
||||
<div className="ant-btn-group">
|
||||
<Select popupMatchSelectWidth={false} value={view} onChange={onView}>
|
||||
<Select data-testid="antd-select" popupMatchSelectWidth={false} value={view} onChange={onView}>
|
||||
{views.map((name) => (
|
||||
<Select.Option key={name} value={name}>
|
||||
{messages[name]}
|
||||
|
@ -45,6 +45,7 @@ export const CollectionSelect = connect(
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<Select
|
||||
data-testid="antd-select"
|
||||
placeholder={t('Select collection')}
|
||||
popupMatchSelectWidth={false}
|
||||
{...others}
|
||||
|
@ -23,7 +23,7 @@ export const ColorSelect = connect(
|
||||
(props) => {
|
||||
const compile = useCompile();
|
||||
return (
|
||||
<Select {...props}>
|
||||
<Select data-testid="antd-select" {...props}>
|
||||
{Object.keys(colors).map((color) => (
|
||||
<Select.Option value={color}>
|
||||
<Tag color={color}>{compile(colors[color] || colors.default)}</Tag>
|
||||
|
@ -64,6 +64,7 @@ const CronSetInternal = (props: CronSetProps) => {
|
||||
return (
|
||||
<fieldset>
|
||||
<Select
|
||||
data-testid="antd-select"
|
||||
popupMatchSelectWidth={false}
|
||||
allowClear
|
||||
{...props}
|
||||
|
@ -50,13 +50,15 @@ export const DynamicComponent = (props) => {
|
||||
};
|
||||
return (
|
||||
<FormContext.Provider value={form}>
|
||||
{component
|
||||
? React.createElement(component, {
|
||||
value: props.value,
|
||||
onChange: props?.onChange,
|
||||
renderSchemaComponent,
|
||||
})
|
||||
: renderSchemaComponent()}
|
||||
<div data-testid="dynamic-component-filter-item">
|
||||
{component
|
||||
? React.createElement(component, {
|
||||
value: props.value,
|
||||
onChange: props?.onChange,
|
||||
renderSchemaComponent,
|
||||
})
|
||||
: renderSchemaComponent()}
|
||||
</div>
|
||||
</FormContext.Provider>
|
||||
);
|
||||
};
|
||||
|
@ -42,7 +42,7 @@ export const FilterGroup = connect((props) => {
|
||||
}
|
||||
>
|
||||
{remove && !mergedDisabled && (
|
||||
<a>
|
||||
<a data-testid="close-icon-button">
|
||||
<CloseCircleOutlined
|
||||
style={{
|
||||
position: 'absolute',
|
||||
@ -58,6 +58,7 @@ export const FilterGroup = connect((props) => {
|
||||
<Trans>
|
||||
{'Meet '}
|
||||
<Select
|
||||
data-testid="antd-select"
|
||||
style={{ width: 'auto' }}
|
||||
value={logic}
|
||||
onChange={(value) => {
|
||||
|
@ -5,8 +5,8 @@ import { Cascader, Select, Space } from 'antd';
|
||||
import React, { useContext } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useCompile } from '../..';
|
||||
import { RemoveConditionContext } from './context';
|
||||
import { DynamicComponent } from './DynamicComponent';
|
||||
import { RemoveConditionContext } from './context';
|
||||
import { useValues } from './useValues';
|
||||
|
||||
export const FilterItem = observer(
|
||||
@ -20,6 +20,7 @@ export const FilterItem = observer(
|
||||
<div style={{ marginBottom: 8 }} className="nc-filter-item">
|
||||
<Space>
|
||||
<Cascader
|
||||
data-testid="antd-cascader"
|
||||
className={css`
|
||||
width: 160px;
|
||||
`}
|
||||
@ -37,6 +38,7 @@ export const FilterItem = observer(
|
||||
placeholder={t('Select field')}
|
||||
/>
|
||||
<Select
|
||||
data-testid="antd-select"
|
||||
className={css`
|
||||
min-width: 110px;
|
||||
`}
|
||||
@ -50,7 +52,7 @@ export const FilterItem = observer(
|
||||
/>
|
||||
{!operator?.noValue ? <DynamicComponent value={value} schema={schema} onChange={setValue} /> : null}
|
||||
{!props.disabled && (
|
||||
<a>
|
||||
<a data-testid="close-icon-button">
|
||||
<CloseCircleOutlined onClick={() => remove()} style={{ color: '#bfbfbf' }} />
|
||||
</a>
|
||||
)}
|
||||
|
@ -460,6 +460,7 @@ FormItem.Designer = function Designer() {
|
||||
<div style={{ alignItems: 'center', display: 'flex', justifyContent: 'space-between' }}>
|
||||
{t('Popup size')}
|
||||
<Select
|
||||
data-testid="antd-select"
|
||||
bordered={false}
|
||||
options={[
|
||||
{ label: t('Small'), value: 'small' },
|
||||
|
@ -157,6 +157,7 @@ export const Templates = ({ style = {}, form }) => {
|
||||
<Space wrap>
|
||||
<label style={labelStyle}>{t('Data template')}: </label>
|
||||
<Select
|
||||
data-testid="antd-select"
|
||||
popupMatchSelectWidth={false}
|
||||
options={templateOptions}
|
||||
fieldNames={{ label: 'title', value: 'key' }}
|
||||
|
@ -42,7 +42,7 @@ const InternalGridCardBlockProvider = (props) => {
|
||||
|
||||
export const GridCardBlockProvider = (props) => {
|
||||
return (
|
||||
<BlockProvider {...props}>
|
||||
<BlockProvider data-testid="grid-card-block" {...props}>
|
||||
<InternalGridCardBlockProvider {...props} />
|
||||
</BlockProvider>
|
||||
);
|
||||
|
@ -33,16 +33,14 @@ const InternalListBlockProvider = (props) => {
|
||||
<FormContext.Provider value={form}>
|
||||
<FormLayout layout={'vertical'}>
|
||||
<div
|
||||
className={cx(
|
||||
css`
|
||||
.ant-description-input {
|
||||
line-height: 34px;
|
||||
}
|
||||
.ant-formily-item-feedback-layout-loose {
|
||||
display: inline;
|
||||
}
|
||||
`,
|
||||
)}
|
||||
className={cx(css`
|
||||
.ant-description-input {
|
||||
line-height: 34px;
|
||||
}
|
||||
.ant-formily-item-feedback-layout-loose {
|
||||
display: inline;
|
||||
}
|
||||
`)}
|
||||
>
|
||||
{props.children}
|
||||
</div>
|
||||
@ -54,7 +52,7 @@ const InternalListBlockProvider = (props) => {
|
||||
|
||||
export const ListBlockProvider = (props) => {
|
||||
return (
|
||||
<BlockProvider {...props}>
|
||||
<BlockProvider data-testid="list-block" {...props}>
|
||||
<InternalListBlockProvider {...props} />
|
||||
</BlockProvider>
|
||||
);
|
||||
|
@ -20,7 +20,10 @@ export const PageDesigner = ({ title }) => {
|
||||
<div className={'general-schema-designer'}>
|
||||
<div className={'general-schema-designer-icons'}>
|
||||
<Space size={2} align={'center'}>
|
||||
<SchemaSettings title={<MenuOutlined style={{ cursor: 'pointer', fontSize: 12 }} />}>
|
||||
<SchemaSettings
|
||||
data-testid="page-designer-button"
|
||||
title={<MenuOutlined style={{ cursor: 'pointer', fontSize: 12 }} />}
|
||||
>
|
||||
<SchemaSettings.SwitchItem
|
||||
title={t('Enable page header')}
|
||||
checked={!fieldSchema['x-component-props']?.disablePageHeader}
|
||||
|
@ -175,6 +175,7 @@ export const InputRecordPicker: React.FC<any> = (props: IRecordPickerProps) => {
|
||||
/>
|
||||
) : (
|
||||
<Select
|
||||
data-testid="antd-select"
|
||||
{...others}
|
||||
mode={multiple ? 'multiple' : props.mode}
|
||||
fieldNames={fieldNames}
|
||||
|
@ -43,6 +43,7 @@ const ObjectSelect = (props: Props) => {
|
||||
|
||||
return (
|
||||
<AntdSelect
|
||||
data-testid="antd-select"
|
||||
value={toValue(value)}
|
||||
defaultValue={toValue(defaultValue)}
|
||||
allowClear
|
||||
@ -108,6 +109,7 @@ const InternalSelect = connect(
|
||||
};
|
||||
return (
|
||||
<AntdSelect
|
||||
data-testid="antd-select"
|
||||
showSearch
|
||||
filterOption={filterOption}
|
||||
allowClear
|
||||
|
@ -77,6 +77,7 @@ const ConstantTypes = {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<Select
|
||||
data-testid="antd-select"
|
||||
value={value}
|
||||
onChange={onChange}
|
||||
placeholder={t('Select')}
|
||||
|
@ -93,12 +93,7 @@ export const SortableItem: React.FC<SortableItemProps> = observer(
|
||||
|
||||
export const DragHandler = (props) => {
|
||||
const { draggable } = useContext(SortableContext);
|
||||
const { isDragging, attributes, listeners, setNodeRef, transform } = draggable;
|
||||
const style = transform
|
||||
? {
|
||||
transform: `translate3d(${transform.x}px, ${transform.y}px, 0)`,
|
||||
}
|
||||
: undefined;
|
||||
const { attributes, listeners, setNodeRef } = draggable;
|
||||
|
||||
return (
|
||||
<div
|
||||
@ -118,8 +113,6 @@ export const DragHandler = (props) => {
|
||||
zIndex: 1,
|
||||
// backgroundColor: '#333',
|
||||
lineHeight: 0,
|
||||
height: 2,
|
||||
width: 2,
|
||||
fontSize: 0,
|
||||
display: 'inline-block',
|
||||
}}
|
||||
|
@ -2,6 +2,7 @@ import { gridRowColWrap } from '../utils';
|
||||
|
||||
// 页面里添加区块
|
||||
export const BlockInitializers = {
|
||||
'data-testid': 'add-block-button-in-page',
|
||||
title: '{{t("Add block")}}',
|
||||
icon: 'PlusOutlined',
|
||||
wrap: gridRowColWrap,
|
||||
|
@ -14,6 +14,7 @@ export const BulkEditFormItemInitializers = (props: any) => {
|
||||
const associationFields = useAssociatedFormItemInitializerFields({ readPretty: true, block: 'Form' });
|
||||
return (
|
||||
<SchemaInitializer.Button
|
||||
data-testid="configure-fields-button-of-bulk-edit-form-item"
|
||||
wrap={gridRowColWrap}
|
||||
icon={'SettingOutlined'}
|
||||
items={union<any>(
|
||||
|
@ -2,6 +2,7 @@ import { useCollection } from '../../';
|
||||
|
||||
// 日历的操作配置
|
||||
export const CalendarActionInitializers = {
|
||||
'data-testid': 'configure-actions-button-of-calendar',
|
||||
title: '{{t("Configure actions")}}',
|
||||
icon: 'SettingOutlined',
|
||||
style: { marginLeft: 8 },
|
||||
|
@ -2,6 +2,7 @@ import { useCollection } from '../..';
|
||||
|
||||
// 表单的操作配置
|
||||
export const CalendarFormActionInitializers = {
|
||||
'data-testid': 'configure-actions-button-of-calendar-form',
|
||||
title: '{{t("Configure actions")}}',
|
||||
icon: 'SettingOutlined',
|
||||
style: {
|
||||
|
@ -34,6 +34,7 @@ export const CustomFormItemInitializers = (props: any) => {
|
||||
}
|
||||
return (
|
||||
<SchemaInitializer.Button
|
||||
data-testid="configure-fields-button-of-custom-form-item"
|
||||
wrap={gridRowColWrap}
|
||||
icon={'SettingOutlined'}
|
||||
items={fieldItems}
|
||||
|
@ -1,5 +1,6 @@
|
||||
// 表单的操作配置
|
||||
export const DetailsActionInitializers = {
|
||||
'data-testid': 'configure-actions-button-of-details',
|
||||
title: '{{t("Configure actions")}}',
|
||||
icon: 'SettingOutlined',
|
||||
style: {
|
||||
|
@ -1,5 +1,6 @@
|
||||
// 表单的操作配置
|
||||
export const FilterFormActionInitializers = {
|
||||
'data-testid': 'configure-actions-button-of-filter-form',
|
||||
title: '{{t("Configure actions")}}',
|
||||
icon: 'SettingOutlined',
|
||||
items: [
|
||||
|
@ -26,6 +26,7 @@ const FormTriggerWorkflowActionInitializer = {
|
||||
|
||||
// 表单的操作配置
|
||||
export const FormActionInitializers = {
|
||||
'data-testid': 'configure-actions-button-of-form',
|
||||
title: '{{t("Configure actions")}}',
|
||||
icon: 'SettingOutlined',
|
||||
items: [
|
||||
@ -159,6 +160,7 @@ export const FormActionInitializers = {
|
||||
};
|
||||
|
||||
export const CreateFormActionInitializers = {
|
||||
'data-testid': 'configure-actions-button-of-create-form',
|
||||
title: '{{t("Configure actions")}}',
|
||||
icon: 'SettingOutlined',
|
||||
items: [
|
||||
@ -292,6 +294,7 @@ export const CreateFormActionInitializers = {
|
||||
};
|
||||
|
||||
export const UpdateFormActionInitializers = {
|
||||
'data-testid': 'configure-actions-button-of-update-form',
|
||||
title: '{{t("Configure actions")}}',
|
||||
icon: 'SettingOutlined',
|
||||
items: [
|
||||
@ -424,6 +427,7 @@ export const UpdateFormActionInitializers = {
|
||||
};
|
||||
|
||||
export const BulkEditFormActionInitializers = {
|
||||
'data-testid': 'configure-actions-button-of-bulk-edit-form',
|
||||
title: '{{t("Configure actions")}}',
|
||||
icon: 'SettingOutlined',
|
||||
items: [
|
||||
|
@ -78,6 +78,7 @@ export const FormItemInitializers = (props: any) => {
|
||||
);
|
||||
return (
|
||||
<SchemaInitializer.Button
|
||||
data-testid="configure-fields-button-of-form-item"
|
||||
wrap={gridRowColWrap}
|
||||
icon={'SettingOutlined'}
|
||||
items={fieldItems}
|
||||
@ -151,6 +152,7 @@ export const FilterFormItemInitializers = (props: any) => {
|
||||
);
|
||||
return (
|
||||
<SchemaInitializer.Button
|
||||
data-testid="configure-fields-button-of-filter-form-item"
|
||||
wrap={gridRowColWrap}
|
||||
icon={'SettingOutlined'}
|
||||
items={fieldItems}
|
||||
|
@ -2,6 +2,7 @@ import { useCollection } from '../../collection-manager';
|
||||
|
||||
// 表单的操作配置
|
||||
export const GridCardActionInitializers = {
|
||||
'data-testid': 'configure-actions-button-of-grid-card',
|
||||
title: "{{t('Configure actions')}}",
|
||||
icon: 'SettingOutlined',
|
||||
style: {
|
||||
@ -135,6 +136,7 @@ export const GridCardActionInitializers = {
|
||||
};
|
||||
|
||||
export const GridCardItemActionInitializers = {
|
||||
'data-testid': 'configure-actions-button-of-grid-card-item',
|
||||
title: '{{t("Configure actions")}}',
|
||||
icon: 'SettingOutlined',
|
||||
items: [
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { useCollection } from '../../';
|
||||
|
||||
export const KanbanActionInitializers = {
|
||||
'data-testid': 'configure-actions-button-of-kanban',
|
||||
title: "{{t('Configure actions')}}",
|
||||
icon: 'SettingOutlined',
|
||||
style: {
|
||||
|
@ -2,6 +2,7 @@ import { useCollection } from '../../collection-manager';
|
||||
|
||||
// 表单的操作配置
|
||||
export const ListActionInitializers = {
|
||||
'data-testid': 'configure-actions-button-of-list',
|
||||
title: "{{t('Configure actions')}}",
|
||||
icon: 'SettingOutlined',
|
||||
style: {
|
||||
@ -135,6 +136,7 @@ export const ListActionInitializers = {
|
||||
};
|
||||
|
||||
export const ListItemActionInitializers = {
|
||||
'data-testid': 'configure-actions-button-of-list-item',
|
||||
title: '{{t("Configure actions")}}',
|
||||
icon: 'SettingOutlined',
|
||||
items: [
|
||||
|
@ -6,6 +6,7 @@ const useVisibleCollection = () => {
|
||||
};
|
||||
// 表单的操作配置
|
||||
export const ReadPrettyFormActionInitializers = {
|
||||
'data-testid': 'configure-actions-button-of-read-pretty-form',
|
||||
title: '{{t("Configure actions")}}',
|
||||
icon: 'SettingOutlined',
|
||||
style: {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { union } from 'lodash';
|
||||
import React from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useCompile } from '../../schema-component';
|
||||
import { SchemaInitializer } from '../SchemaInitializer';
|
||||
import {
|
||||
gridRowColWrap,
|
||||
@ -8,7 +8,6 @@ import {
|
||||
useFormItemInitializerFields,
|
||||
useInheritsFormItemInitializerFields,
|
||||
} from '../utils';
|
||||
import { useCompile } from '../../schema-component';
|
||||
|
||||
export const ReadPrettyFormItemInitializers = (props: any) => {
|
||||
const { t } = useTranslation();
|
||||
@ -72,6 +71,7 @@ export const ReadPrettyFormItemInitializers = (props: any) => {
|
||||
);
|
||||
return (
|
||||
<SchemaInitializer.Button
|
||||
data-testid="configure-fields-button-of-read-pretty-form-item"
|
||||
wrap={gridRowColWrap}
|
||||
icon={'SettingOutlined'}
|
||||
items={fieldItems}
|
||||
|
@ -7,6 +7,7 @@ export const RecordFormBlockInitializers = (props: any) => {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<SchemaInitializer.Button
|
||||
data-testid="add-block-button-in-record-form-block"
|
||||
wrap={gridRowColWrap}
|
||||
title={t('Add block')}
|
||||
icon={'PlusOutlined'}
|
||||
|
@ -1,5 +1,6 @@
|
||||
// 表格操作配置
|
||||
export const SubTableActionInitializers = {
|
||||
'data-testid': 'configure-actions-button-of-sub-table',
|
||||
title: "{{t('Configure actions')}}",
|
||||
icon: 'SettingOutlined',
|
||||
style: {
|
||||
|
@ -3,6 +3,7 @@ import { useCollection } from '../../';
|
||||
|
||||
// 表格操作配置
|
||||
export const TableActionInitializers = {
|
||||
'data-testid': 'configure-actions-button-of-table',
|
||||
title: "{{t('Configure actions')}}",
|
||||
icon: 'SettingOutlined',
|
||||
style: {
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { useField, useFieldSchema } from '@formily/react';
|
||||
import React from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useCollection } from '../../collection-manager';
|
||||
import { useCompile } from '../../schema-component';
|
||||
import { SchemaInitializer } from '../SchemaInitializer';
|
||||
import {
|
||||
@ -12,7 +13,8 @@ import {
|
||||
|
||||
// 表格列配置
|
||||
export const TableColumnInitializers = (props: any) => {
|
||||
const { items = [], action = true } = props;
|
||||
const { action = true } = props;
|
||||
const { name } = useCollection();
|
||||
const { t } = useTranslation();
|
||||
const field = useField();
|
||||
const fieldSchema = useFieldSchema();
|
||||
@ -69,6 +71,7 @@ export const TableColumnInitializers = (props: any) => {
|
||||
|
||||
return (
|
||||
<SchemaInitializer.Button
|
||||
data-testid={`configure-columns-button-of-${name}`}
|
||||
insertPosition={'beforeEnd'}
|
||||
icon={'SettingOutlined'}
|
||||
wrap={(s) => {
|
||||
|
@ -9,6 +9,7 @@ export const TableSelectorInitializers = (props: any) => {
|
||||
|
||||
return (
|
||||
<SchemaInitializer.Button
|
||||
data-testid="add-block-button-in-table-selector"
|
||||
wrap={gridRowColWrap}
|
||||
title={component ? null : t('Add block')}
|
||||
icon={'PlusOutlined'}
|
||||
|
@ -127,7 +127,7 @@ export const BulkEditField = (props: any) => {
|
||||
}
|
||||
`}
|
||||
>
|
||||
<Select defaultValue={type} value={type} onChange={typeChangeHandler}>
|
||||
<Select data-testid="antd-select" defaultValue={type} value={type} onChange={typeChangeHandler}>
|
||||
<Select.Option value={BulkEditFormItemValueType.RemainsTheSame}>{t('Remains the same')}</Select.Option>
|
||||
<Select.Option value={BulkEditFormItemValueType.ChangedTo}>{t('Changed to')}</Select.Option>
|
||||
<Select.Option value={BulkEditFormItemValueType.Clear}>{t('Clear')}</Select.Option>
|
||||
|
@ -1,9 +1,9 @@
|
||||
import React from 'react';
|
||||
import { useField, useFieldSchema } from '@formily/react';
|
||||
import { SchemaSettings } from '../schema-settings';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Select } from 'antd';
|
||||
import React from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useDesignable } from '../schema-component';
|
||||
import { SchemaSettings } from '../schema-settings';
|
||||
|
||||
interface Options {
|
||||
openMode?: boolean;
|
||||
@ -49,6 +49,7 @@ export const OpenModeSchemaItems: React.FC<Options> = (options) => {
|
||||
<div style={{ alignItems: 'center', display: 'flex', justifyContent: 'space-between' }}>
|
||||
{t('Popup size')}
|
||||
<Select
|
||||
data-testid="antd-select"
|
||||
bordered={false}
|
||||
options={[
|
||||
{ label: t('Small'), value: 'small' },
|
||||
|
@ -171,6 +171,7 @@ function SelectItem(props) {
|
||||
<div style={{ alignItems: 'center', display: 'flex', justifyContent: 'space-between' }}>
|
||||
{title}
|
||||
<Select
|
||||
data-testid="antd-select"
|
||||
popupMatchSelectWidth={false}
|
||||
bordered={false}
|
||||
value={value}
|
||||
|
@ -58,9 +58,7 @@ export const GeneralSchemaDesigner = (props: any) => {
|
||||
return {
|
||||
insertPosition: 'afterEnd',
|
||||
wrap: rowCtx?.cols?.length > 1 ? undefined : gridRowColWrap,
|
||||
component: (
|
||||
<PlusOutlined data-testid="GeneralSchemaDesigner-Initializer" style={{ cursor: 'pointer', fontSize: 14 }} />
|
||||
),
|
||||
component: <PlusOutlined data-testid="designer-add-block" style={{ cursor: 'pointer', fontSize: 14 }} />,
|
||||
};
|
||||
}, [rowCtx?.cols?.length]);
|
||||
|
||||
@ -86,7 +84,7 @@ export const GeneralSchemaDesigner = (props: any) => {
|
||||
<Space size={2} align={'center'}>
|
||||
{draggable && (
|
||||
<DragHandler>
|
||||
<DragOutlined data-testid="GeneralSchemaDesigner-DragHandler" />
|
||||
<DragOutlined data-testid="designer-drag" />
|
||||
</DragHandler>
|
||||
)}
|
||||
{!disableInitializer &&
|
||||
@ -96,12 +94,7 @@ export const GeneralSchemaDesigner = (props: any) => {
|
||||
ctx?.renderSchemaInitializer?.(initializerProps)
|
||||
))}
|
||||
<SchemaSettings
|
||||
title={
|
||||
<MenuOutlined
|
||||
data-testid="GeneralSchemaDesigner-SchemaSettings"
|
||||
style={{ cursor: 'pointer', fontSize: 12 }}
|
||||
/>
|
||||
}
|
||||
title={<MenuOutlined data-testid="designer-schema-settings" style={{ cursor: 'pointer', fontSize: 12 }} />}
|
||||
{...schemaSettingsProps}
|
||||
>
|
||||
{props.children}
|
||||
|
@ -72,6 +72,7 @@ export const FormFieldLinkageRuleAction = observer(
|
||||
placeholder={t('Select field')}
|
||||
/>
|
||||
<Select
|
||||
data-testid="antd-select"
|
||||
popupMatchSelectWidth={false}
|
||||
value={operator}
|
||||
className={css`
|
||||
@ -92,7 +93,7 @@ export const FormFieldLinkageRuleAction = observer(
|
||||
/>
|
||||
)}
|
||||
{!props.disabled && (
|
||||
<a>
|
||||
<a data-testid="close-icon-button">
|
||||
<CloseCircleOutlined onClick={() => remove()} style={{ color: '#bfbfbf' }} />
|
||||
</a>
|
||||
)}
|
||||
@ -141,7 +142,7 @@ export const FormButtonLinkageRuleAction = observer(
|
||||
},
|
||||
})}
|
||||
{!props.disabled && (
|
||||
<a>
|
||||
<a data-testid="close-icon-button">
|
||||
<CloseCircleOutlined onClick={() => remove()} style={{ color: '#bfbfbf' }} />
|
||||
</a>
|
||||
)}
|
||||
|
@ -1,9 +1,8 @@
|
||||
import React, { useState } from 'react';
|
||||
import { Input, Select } from 'antd';
|
||||
import { css } from '@emotion/css';
|
||||
import React, { useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { DynamicComponent } from './DynamicComponent';
|
||||
import { Variable } from '.././../schema-component';
|
||||
import { DynamicComponent } from './DynamicComponent';
|
||||
import { useVariableOptions } from './Variables';
|
||||
|
||||
const { Option } = Select;
|
||||
@ -16,6 +15,7 @@ export const ValueDynamicComponent = (props) => {
|
||||
return (
|
||||
<Input.Group compact>
|
||||
<Select
|
||||
data-testid="antd-select"
|
||||
value={mode}
|
||||
style={{ width: 150 }}
|
||||
onChange={(value) => {
|
||||
|
@ -175,7 +175,7 @@ export const SchemaSettings: React.FC<SchemaSettingsProps> & SchemaSettingsNeste
|
||||
`}
|
||||
menu={{ items }}
|
||||
>
|
||||
{typeof title === 'string' ? <span>{title}</span> : title}
|
||||
<div data-testid={props['data-testid']}>{typeof title === 'string' ? <span>{title}</span> : title}</div>
|
||||
</Dropdown>
|
||||
</>
|
||||
);
|
||||
@ -708,6 +708,7 @@ SchemaSettings.SelectItem = function SelectItem(props) {
|
||||
<div style={{ alignItems: 'center', display: 'flex', justifyContent: 'space-between' }}>
|
||||
{title}
|
||||
<Select
|
||||
data-testid="antd-select"
|
||||
popupMatchSelectWidth={false}
|
||||
bordered={false}
|
||||
defaultValue={value}
|
||||
|
@ -172,6 +172,7 @@ export const CurrentUser = () => {
|
||||
}}
|
||||
>
|
||||
<span
|
||||
data-testid="user-center-button"
|
||||
className={css`
|
||||
max-width: 160px;
|
||||
overflow: hidden;
|
||||
|
@ -27,6 +27,7 @@ export const useLanguageSettings = () => {
|
||||
>
|
||||
{t('Language')}{' '}
|
||||
<Select
|
||||
data-testid="antd-select"
|
||||
popupMatchSelectWidth={false}
|
||||
style={{ minWidth: 100 }}
|
||||
bordered={false}
|
||||
|
@ -22,6 +22,7 @@ export const useSwitchRole = () => {
|
||||
>
|
||||
{t('Switch role')}{' '}
|
||||
<Select
|
||||
data-testid="antd-select"
|
||||
style={{ minWidth: 100 }}
|
||||
bordered={false}
|
||||
popupMatchSelectWidth={false}
|
||||
|
@ -81,6 +81,7 @@ const Documentation = () => {
|
||||
{t('Select a definition')}
|
||||
</Typography.Text>
|
||||
<Select
|
||||
data-testid="antd-select"
|
||||
showSearch
|
||||
value={destination}
|
||||
options={urls?.data}
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { connect, mapProps, mapReadPretty } from '@formily/react';
|
||||
import { css, useRecord } from '@nocobase/client';
|
||||
import dayjs from 'dayjs';
|
||||
import { useBoolean } from 'ahooks';
|
||||
import { DatePicker, Select, Space, Typography } from 'antd';
|
||||
import dayjs from 'dayjs';
|
||||
import React, { useMemo } from 'react';
|
||||
import { useTranslation } from '../locale';
|
||||
|
||||
@ -38,7 +38,12 @@ const InternalExpiresSelect = (props) => {
|
||||
|
||||
return (
|
||||
<Space className={spaceCSS}>
|
||||
<Select {...props} value={isCustom ? 'custom' : props.value} onChange={onSelectChange}></Select>
|
||||
<Select
|
||||
data-testid="antd-select"
|
||||
{...props}
|
||||
value={isCustom ? 'custom' : props.value}
|
||||
onChange={onSelectChange}
|
||||
></Select>
|
||||
{isCustom ? (
|
||||
<DatePicker
|
||||
disabledDate={(date) => {
|
||||
|
@ -1,5 +1,6 @@
|
||||
// 操作记录表格操作配置
|
||||
export const AuditLogsTableActionInitializers = {
|
||||
'data-testid': 'configure-actions-button-of-audit-logs-table',
|
||||
title: "{{t('Configure actions')}}",
|
||||
icon: 'SettingOutlined',
|
||||
style: {
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { LoadingOutlined } from '@ant-design/icons';
|
||||
import { connect, mapProps, mapReadPretty } from '@formily/react';
|
||||
import { isValid } from '@formily/shared';
|
||||
import { Icon, PopoverWithStopPropagation, css } from '@nocobase/client';
|
||||
import type { SelectProps } from 'antd';
|
||||
import { Select as AntdSelect } from 'antd';
|
||||
@ -10,8 +9,6 @@ import { ReadPretty } from './ReadPretty';
|
||||
|
||||
type Props = SelectProps<any, any> & { objectValue?: boolean; onChange?: (v: any) => void; multiple: boolean };
|
||||
|
||||
const isEmptyObject = (val: any) => !isValid(val) || (typeof val === 'object' && Object.keys(val).length === 0);
|
||||
|
||||
const { Option, OptGroup } = AntdSelect;
|
||||
const filterOption = (input, option) => (option?.label ?? '').toLowerCase().includes((input || '').toLowerCase());
|
||||
|
||||
@ -24,6 +21,7 @@ const InternalSelect = connect(
|
||||
const group2 = options.filter((option) => option.group === 1);
|
||||
return (
|
||||
<AntdSelect
|
||||
data-testid="antd-select"
|
||||
showSearch
|
||||
filterOption={filterOption}
|
||||
allowClear
|
||||
|
@ -8,9 +8,8 @@ import {
|
||||
useCompile,
|
||||
useRequest,
|
||||
} from '@nocobase/client';
|
||||
import { error } from '@nocobase/utils/client';
|
||||
import { error, lodash } from '@nocobase/utils/client';
|
||||
import { Select, message } from 'antd';
|
||||
import { lodash } from '@nocobase/utils/client';
|
||||
import React, { useContext, useEffect } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { GraphCollectionContext } from './components/CollectionNodeProvder';
|
||||
@ -36,6 +35,7 @@ export const SourceCollection = observer(
|
||||
return (
|
||||
<div>
|
||||
<Select
|
||||
data-testid="antd-select"
|
||||
popupMatchSelectWidth={false}
|
||||
disabled
|
||||
value={record.name}
|
||||
|
@ -1,5 +1,6 @@
|
||||
// 表格操作配置
|
||||
export const MapActionInitializers = {
|
||||
'data-testid': 'configure-actions-button-of-map',
|
||||
title: "{{t('Configure actions')}}",
|
||||
icon: 'SettingOutlined',
|
||||
style: {
|
||||
|
@ -40,7 +40,7 @@ export const MapBlockProvider = (props) => {
|
||||
appends.push(field[0]);
|
||||
}
|
||||
return (
|
||||
<BlockProvider {...props} params={{ ...params, appends, paginate: false }}>
|
||||
<BlockProvider data-testid="map-block" {...props} params={{ ...params, appends, paginate: false }}>
|
||||
<InternalMapBlockProvider {...props} />
|
||||
</BlockProvider>
|
||||
);
|
||||
|
@ -75,6 +75,7 @@ export const Search = (props: SearchProps) => {
|
||||
`}
|
||||
>
|
||||
<Select
|
||||
data-testid="antd-select"
|
||||
showSearch
|
||||
allowClear
|
||||
style={{
|
||||
|
@ -88,6 +88,7 @@ export const Search = (props: SearchProps) => {
|
||||
`}
|
||||
>
|
||||
<Select
|
||||
data-testid="antd-select"
|
||||
id="google-map-search"
|
||||
showSearch
|
||||
allowClear
|
||||
|
@ -3,6 +3,7 @@ import { generateNTemplate } from '../../../locale';
|
||||
|
||||
// 页面里添加区块
|
||||
export const MBlockInitializers = {
|
||||
'data-testid': 'add-block-button-in-mobile-page',
|
||||
title: '{{t("Add block")}}',
|
||||
icon: 'PlusOutlined',
|
||||
wrap: gridRowColWrap,
|
||||
|
@ -233,6 +233,7 @@ export const TableTransfer = connect((props) => {
|
||||
<strong style={{ fontSize: token.fontSizeLG, color: token.colorText }}>{t('Unshared collections')}</strong>
|
||||
<Input.Group compact style={{ width: 360 }}>
|
||||
<Select
|
||||
data-testid="antd-select"
|
||||
popupMatchSelectWidth={false}
|
||||
onChange={(value) => {
|
||||
removedDataSource.setCategoryFilter(value);
|
||||
@ -318,6 +319,7 @@ export const TableTransfer = connect((props) => {
|
||||
<strong style={{ fontSize: token.fontSizeLG, color: token.colorText }}>{t('Shared collections')}</strong>
|
||||
<Input.Group compact style={{ width: 360 }}>
|
||||
<Select
|
||||
data-testid="antd-select"
|
||||
popupMatchSelectWidth={false}
|
||||
onChange={(value) => {
|
||||
addedDataSource.setCategoryFilter(value);
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { i18n, Plugin, PluginManagerContext, SettingsCenterProvider } from '@nocobase/client';
|
||||
import { Select } from 'antd';
|
||||
import React, { ReactNode, useContext } from 'react';
|
||||
import React, { useContext } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
const ns = '@nocobase/plugin-sample-shop-i18n';
|
||||
@ -26,7 +26,7 @@ function OrderStatusSelect() {
|
||||
const { t } = useTranslation(ns);
|
||||
|
||||
return (
|
||||
<Select style={{ minWidth: '8em' }}>
|
||||
<Select data-testid="antd-select" style={{ minWidth: '8em' }}>
|
||||
{ORDER_STATUS_LIST.map((item) => (
|
||||
<Select.Option key={item.value} value={item.value}>
|
||||
{t(item.label)}
|
||||
|
@ -29,7 +29,7 @@ function RuleTypeSelect(props) {
|
||||
});
|
||||
|
||||
return (
|
||||
<Select popupMatchSelectWidth={false} {...props}>
|
||||
<Select data-testid="antd-select" popupMatchSelectWidth={false} {...props}>
|
||||
{Object.keys(RuleTypes).map((key) => (
|
||||
<Select.Option key={key} value={key}>
|
||||
{compile(RuleTypes[key].title)}
|
||||
@ -181,7 +181,7 @@ const RuleTypes = {
|
||||
}) || shortValues[5];
|
||||
return (
|
||||
<fieldset>
|
||||
<Select value={option.value} onChange={(v) => onChange(shortValues[v].cron)}>
|
||||
<Select data-testid="antd-select" value={option.value} onChange={(v) => onChange(shortValues[v].cron)}>
|
||||
{shortValues.map((item) => (
|
||||
<Select.Option key={item.value} value={item.value}>
|
||||
{lang(item.label)}
|
||||
|
@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { SchemaInitializer, gridRowColWrap } from '@nocobase/client';
|
||||
import React from 'react';
|
||||
import { useSnapshotTranslation } from '../../locale';
|
||||
|
||||
export const SnapshotBlockInitializers = (props: any) => {
|
||||
@ -7,6 +7,7 @@ export const SnapshotBlockInitializers = (props: any) => {
|
||||
const { insertPosition, component } = props;
|
||||
return (
|
||||
<SchemaInitializer.Button
|
||||
data-testid="add-block-button-in-snapshot-block"
|
||||
wrap={gridRowColWrap}
|
||||
insertPosition={insertPosition}
|
||||
component={component}
|
||||
|
@ -18,5 +18,5 @@ export const useSnapshotOwnerCollectionFields = () => {
|
||||
|
||||
export const SnapshotOwnerCollectionFieldsSelect: React.FC<SnapshotOwnerCollectionFieldsSelectProps> = (props) => {
|
||||
const options = useSnapshotOwnerCollectionFields();
|
||||
return <Select popupMatchSelectWidth={false} options={options} {...props} />;
|
||||
return <Select data-testid="antd-select" popupMatchSelectWidth={false} options={options} {...props} />;
|
||||
};
|
||||
|
@ -283,6 +283,7 @@ const ColorPanel: FC<ColorPanelProps> = ({ color, onChange, alpha, style }) => {
|
||||
<div style={{ backgroundColor: color, width: '100%', height: '100%' }} />
|
||||
</div>
|
||||
<Select
|
||||
data-testid="antd-select"
|
||||
value={colorMode}
|
||||
onChange={handleColorModeChange}
|
||||
options={colorModes
|
||||
|
@ -124,6 +124,7 @@ const CollectionFieldSet = observer(
|
||||
</Variable.Input>
|
||||
{!mergedDisabled ? (
|
||||
<Button
|
||||
data-testid="close-icon-button"
|
||||
type="link"
|
||||
icon={<CloseCircleOutlined />}
|
||||
onClick={() => {
|
||||
|
@ -35,6 +35,7 @@ export default function ({ value = 60000, onChange }) {
|
||||
className="auto-width"
|
||||
/>
|
||||
<Select
|
||||
data-testid="antd-select"
|
||||
popupMatchSelectWidth={false}
|
||||
value={option.value}
|
||||
onChange={(unit) => onChange(Math.round(quantity * unit))}
|
||||
|
@ -1,5 +1,5 @@
|
||||
import React, { useCallback } from 'react';
|
||||
import { Select, Tag } from 'antd';
|
||||
import React, { useCallback } from 'react';
|
||||
|
||||
import { useCompile } from '@nocobase/client';
|
||||
import { EXECUTION_STATUS, ExecutionStatusOptions, ExecutionStatusOptionsMap } from '../constants';
|
||||
@ -31,7 +31,13 @@ function ExecutionStatusOption(props) {
|
||||
|
||||
export function ExecutionStatusSelect({ ...props }) {
|
||||
return (
|
||||
<Select {...props} mode={props.multiple ? 'multiple' : null} optionLabelProp="label" tagRender={LabelTag}>
|
||||
<Select
|
||||
data-testid="antd-select"
|
||||
{...props}
|
||||
mode={props.multiple ? 'multiple' : null}
|
||||
optionLabelProp="label"
|
||||
tagRender={LabelTag}
|
||||
>
|
||||
{ExecutionStatusOptions.filter((item) => Boolean(item.value) && item.value !== EXECUTION_STATUS.ABORTED).map(
|
||||
(option) => (
|
||||
<Select.Option key={option.value} {...option}>
|
||||
|
@ -18,6 +18,7 @@ export const FieldsSelect = observer(
|
||||
|
||||
return (
|
||||
<Select
|
||||
data-testid="antd-select"
|
||||
popupMatchSelectWidth={false}
|
||||
{...others}
|
||||
options={fields.filter(filter).map((field) => ({
|
||||
|
@ -157,6 +157,7 @@ function Calculation({ calculator, operands = [], onChange }) {
|
||||
useTypedConstant
|
||||
/>
|
||||
<Select
|
||||
data-testid="antd-select"
|
||||
value={calculator}
|
||||
onChange={(v) => onChange({ operands, calculator: v })}
|
||||
placeholder={lang('Calculator')}
|
||||
@ -205,7 +206,7 @@ function CalculationItem({ value, onChange, onRemove }) {
|
||||
) : (
|
||||
<Calculation operands={operands} calculator={calculator} onChange={onChange} />
|
||||
)}
|
||||
<Button onClick={onRemove} type="link" icon={<CloseCircleOutlined />} />
|
||||
<Button data-testid="close-icon-button" onClick={onRemove} type="link" icon={<CloseCircleOutlined />} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
import React, { useContext, useEffect, useMemo, useState } from 'react';
|
||||
import { FormLayout } from '@formily/antd-v5';
|
||||
import { createForm } from '@formily/core';
|
||||
import { FormProvider, ISchema, Schema, useFieldSchema, useForm } from '@formily/react';
|
||||
import { FormLayout } from '@formily/antd-v5';
|
||||
import { Alert, Button, Modal, Space } from 'antd';
|
||||
import React, { useContext, useEffect, useMemo, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
import {
|
||||
@ -24,16 +24,16 @@ import {
|
||||
} from '@nocobase/client';
|
||||
import { Registry, lodash } from '@nocobase/utils/client';
|
||||
import { instructions, useAvailableUpstreams, useNodeContext } from '..';
|
||||
import { JOB_STATUS } from '../../constants';
|
||||
import { useFlowContext } from '../../FlowContext';
|
||||
import { JOB_STATUS } from '../../constants';
|
||||
import { NAMESPACE, lang } from '../../locale';
|
||||
import { useTrigger } from '../../triggers';
|
||||
import { useWorkflowVariableOptions } from '../../variable';
|
||||
import { DetailsBlockProvider } from './DetailsBlockProvider';
|
||||
import { FormBlockProvider } from './FormBlockProvider';
|
||||
import createRecordForm from './forms/create';
|
||||
import customRecordForm from './forms/custom';
|
||||
import updateRecordForm from './forms/update';
|
||||
import { useWorkflowVariableOptions } from '../../variable';
|
||||
|
||||
type ValueOf<T> = T[keyof T];
|
||||
|
||||
@ -162,7 +162,15 @@ function AddBlockButton(props: any) {
|
||||
},
|
||||
] as SchemaInitializerItemOptions[];
|
||||
|
||||
return <SchemaInitializer.Button {...props} wrap={gridRowColWrap} items={items} title="{{t('Add block')}}" />;
|
||||
return (
|
||||
<SchemaInitializer.Button
|
||||
data-testid="add-block-button-in-workflow"
|
||||
{...props}
|
||||
wrap={gridRowColWrap}
|
||||
items={items}
|
||||
title="{{t('Add block')}}"
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
function AssignedFieldValues() {
|
||||
@ -171,31 +179,32 @@ function AssignedFieldValues() {
|
||||
const fieldSchema = useFieldSchema();
|
||||
const scope = useWorkflowVariableOptions({ fieldNames: { label: 'title', value: 'name' } });
|
||||
const [open, setOpen] = useState(false);
|
||||
const [initialSchema, setInitialSchema] = useState(fieldSchema?.['x-action-settings']?.assignedValues?.schema ?? {
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'CustomFormItemInitializers',
|
||||
properties: {},
|
||||
});
|
||||
const [initialSchema, setInitialSchema] = useState(
|
||||
fieldSchema?.['x-action-settings']?.assignedValues?.schema ?? {
|
||||
type: 'void',
|
||||
'x-component': 'Grid',
|
||||
'x-initializer': 'CustomFormItemInitializers',
|
||||
properties: {},
|
||||
},
|
||||
);
|
||||
const [schema, setSchema] = useState<Schema>(null);
|
||||
const { components } = useSchemaOptionsContext();
|
||||
useEffect(() => {
|
||||
setSchema(new Schema({
|
||||
properties: {
|
||||
grid: initialSchema
|
||||
},
|
||||
}));
|
||||
setSchema(
|
||||
new Schema({
|
||||
properties: {
|
||||
grid: initialSchema,
|
||||
},
|
||||
}),
|
||||
);
|
||||
}, [initialSchema]);
|
||||
const form = useMemo(
|
||||
() => {
|
||||
const initialValues = fieldSchema?.['x-action-settings']?.assignedValues?.values;
|
||||
return createForm({
|
||||
initialValues: lodash.cloneDeep(initialValues),
|
||||
values: lodash.cloneDeep(initialValues),
|
||||
});
|
||||
},
|
||||
[],
|
||||
);
|
||||
const form = useMemo(() => {
|
||||
const initialValues = fieldSchema?.['x-action-settings']?.assignedValues?.values;
|
||||
return createForm({
|
||||
initialValues: lodash.cloneDeep(initialValues),
|
||||
values: lodash.cloneDeep(initialValues),
|
||||
});
|
||||
}, []);
|
||||
|
||||
const title = t('Assign field values');
|
||||
|
||||
@ -220,9 +229,7 @@ function AssignedFieldValues() {
|
||||
|
||||
return (
|
||||
<>
|
||||
<SchemaSettings.Item onClick={() => setOpen(true)}>
|
||||
{title}
|
||||
</SchemaSettings.Item>
|
||||
<SchemaSettings.Item onClick={() => setOpen(true)}>{title}</SchemaSettings.Item>
|
||||
<Modal
|
||||
width={'50%'}
|
||||
title={title}
|
||||
@ -231,14 +238,18 @@ function AssignedFieldValues() {
|
||||
footer={
|
||||
<Space>
|
||||
<Button onClick={onCancel}>{t('Cancel')}</Button>
|
||||
<Button type="primary" onClick={onSubmit}>{t('Submit')}</Button>
|
||||
<Button type="primary" onClick={onSubmit}>
|
||||
{t('Submit')}
|
||||
</Button>
|
||||
</Space>
|
||||
}
|
||||
>
|
||||
<VariableScopeProvider scope={scope}>
|
||||
<FormProvider form={form}>
|
||||
<FormLayout layout={'vertical'}>
|
||||
<Alert message={lang('Values preset in this form will override user submitted ones when continue or reject.')} />
|
||||
<Alert
|
||||
message={lang('Values preset in this form will override user submitted ones when continue or reject.')}
|
||||
/>
|
||||
<br />
|
||||
{open && schema && (
|
||||
<SchemaComponentContext.Provider
|
||||
@ -246,7 +257,7 @@ function AssignedFieldValues() {
|
||||
...ctx,
|
||||
refresh() {
|
||||
setInitialSchema(lodash.get(schema.toJSON(), 'properties.grid'));
|
||||
}
|
||||
},
|
||||
}}
|
||||
>
|
||||
<SchemaComponent schema={schema} components={components} />
|
||||
@ -328,6 +339,7 @@ function ActionInitializer({ action, actionProps, ...props }) {
|
||||
function AddActionButton(props) {
|
||||
return (
|
||||
<SchemaInitializer.Button
|
||||
data-testid="configure-actions-add-action-button"
|
||||
{...props}
|
||||
items={[
|
||||
{
|
||||
|
@ -221,6 +221,7 @@ function AddCustomFormField(props) {
|
||||
}}
|
||||
>
|
||||
<SchemaInitializer.Button
|
||||
data-testid="configure-fields-button-of-add-custom-form-field"
|
||||
wrap={gridRowColWrap}
|
||||
insertPosition={insertPosition}
|
||||
items={items}
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { css } from '@nocobase/client';
|
||||
import dayjs from 'dayjs';
|
||||
import { DatePicker, Select } from 'antd';
|
||||
import dayjs from 'dayjs';
|
||||
import React from 'react';
|
||||
import { useWorkflowTranslation } from '../../locale';
|
||||
import { OnField } from './OnField';
|
||||
@ -16,6 +16,7 @@ export function EndsByField({ value, onChange }) {
|
||||
`}
|
||||
>
|
||||
<Select
|
||||
data-testid="antd-select"
|
||||
value={type}
|
||||
onChange={(t) => {
|
||||
onChange(t ? (t === 'field' ? {} : new Date()) : null);
|
||||
|
@ -29,6 +29,7 @@ export function OnField({ value, onChange }) {
|
||||
/>
|
||||
{value.field ? (
|
||||
<Select
|
||||
data-testid="antd-select"
|
||||
value={dir}
|
||||
onChange={(v) => {
|
||||
setDir(v);
|
||||
@ -48,6 +49,7 @@ export function OnField({ value, onChange }) {
|
||||
onChange={(v) => onChange({ ...value, offset: (v ?? 0) * dir })}
|
||||
/>
|
||||
<Select
|
||||
data-testid="antd-select"
|
||||
value={value.unit || 86400000}
|
||||
onChange={(unit) => onChange({ ...value, unit })}
|
||||
options={[
|
||||
|
@ -104,7 +104,7 @@ export function RepeatField({ value = null, onChange }) {
|
||||
}
|
||||
`}
|
||||
>
|
||||
<Select value={typeValue} onChange={onTypeChange} className="auto-width">
|
||||
<Select data-testid="antd-select" value={typeValue} onChange={onTypeChange} className="auto-width">
|
||||
{RepeatOptions.map((item) => (
|
||||
<Select.Option key={item.value} value={item.value}>
|
||||
{t(item.text)}
|
||||
|
Loading…
Reference in New Issue
Block a user