amis-model-design
Version:
amis模型设计器
113 lines (112 loc) • 3.46 kB
TypeScript
import { Option } from 'amis';
import React from 'react';
import Sortable from 'sortablejs';
export type valueType = 'VARCHAR' | 'INTEGER';
export type OptionControlItem = Option & {
checked: boolean;
};
interface OptionsCustomProps {
[key: string]: any;
handleChange: (options: {
options: Array<OptionControlItem>;
}, triggerChange?: boolean, valueType?: valueType) => void;
}
interface OptionsCustomState {
}
export declare class OptionsCustom extends React.Component<OptionsCustomProps, OptionsCustomState> {
sortable?: Sortable;
drag?: HTMLElement | null;
target: HTMLElement | null;
/**
* 处理填入输入框的值
*/
transformOptionValue(value: any): string;
/**
* 获取当前选项值的类型
*/
getOptionValueType(value: any): valueType;
handleChange(options: {
options: Array<OptionControlItem>;
}, cb: () => void): void;
/**
* 编辑选项
*/
toggleEdit(index: number): void;
handleEditLabel(index: number, value: string): void;
/**
* 删除选项
*/
handleDelete(index: number): void;
/**
* 设置默认选项
*/
handleToggleDefaultValue(index: number, checked: any, shift?: boolean): void;
handleAdd(): void;
/**
* 将当前选项值转换为选择的类型
*/
handleValueTypeChange(type: valueType): void;
handleValueChange(index: number, value: string): void;
handleBatchAdd(values: {
batchOption: string;
}, action: any): void;
renderOption(props: any): React.JSX.Element;
scroll2Bottom(): void;
targetRef(ref: any): void;
dragRef(ref: any): void;
initDragging(): void;
destroyDragging(): void;
buildBatchAddSchema(): {
type: string;
actionType: string;
label: string;
dialog: {
title: string;
headerClassName: string;
closeOnEsc: boolean;
closeOnOutside: boolean;
showCloseButton: boolean;
body: ({
type: string;
level: string;
body: string;
showIcon: boolean;
className: string;
wrapWithPanel?: undefined;
mode?: undefined;
wrapperComponent?: undefined;
resetAfterSubmit?: undefined;
autoFocus?: undefined;
preventEnterSubmit?: undefined;
horizontal?: undefined;
} | {
type: string;
wrapWithPanel: boolean;
mode: string;
wrapperComponent: string;
resetAfterSubmit: boolean;
autoFocus: boolean;
preventEnterSubmit: boolean;
horizontal: {
left: number;
right: number;
};
body: {
name: string;
type: string;
label: string;
placeholder: string;
trimContents: boolean;
minRows: number;
maxRows: number;
required: boolean;
}[];
level?: undefined;
showIcon?: undefined;
className?: undefined;
})[];
};
};
render(): React.JSX.Element;
}
export default OptionsCustom;