/** * @file 组件选项组件的可视化编辑控件 */ import React from 'react'; import { RendererProps } from 'amis'; import type { Option } from 'amis'; import type { SchemaApi } from 'amis'; import { valueType } from './ValueFormatControl'; export interface PopoverForm { optionLabel: string; optionValue: any; optionValueType: valueType; } export type OptionControlItem = Option & { checked: boolean; }; export interface OptionControlState { options: Array; api: SchemaApi; labelField: string; valueField: string; source: SourceType; } export interface OptionSourceControlProps extends OptionControlState, RendererProps { onChange: (value: Partial) => void; } export interface OptionSource { label: string; value: SourceType; test?: (value: Omit) => boolean; render?: (props: OptionSourceControlProps) => JSX.Element; component?: React.ComponentType; } export interface OptionControlProps extends RendererProps { className?: string; enabledOptionSourceType?: Array; extraOptionSources: Array; } export type SourceType = 'custom' | 'api' | 'apicenter' | 'variable' | string; export default class OptionControl extends React.Component { internalProps: string[]; optionSources: Array; lastOptions: OptionControlProps; constructor(props: OptionControlProps); /** * 数据更新 */ componentWillReceiveProps(nextProps: OptionControlProps): void; get enabledOptionSources(): OptionSource[]; transformOptions(props: OptionControlProps): { hiddenOn?: any; hidden?: any; badge?: any; label: any; value: any; checked: boolean; }[]; /** * 处理当前组件的默认值 */ normalizeValue(): any; /** * 更新options字段的统一出口 */ emitChange(): void; /** * 切换选项类型 */ handleSourceChange(source: SourceType): void; handleSourceControlChange(value: OptionControlState): void; renderHeader(): React.JSX.Element; render(): React.JSX.Element; } export declare class OptionControlRenderer extends OptionControl { }