jamis
Version:
一种支持通过JSON配置方式生成页面的组件库
151 lines (150 loc) • 4.72 kB
TypeScript
import type { Option, SchemaClassName, SchemaExpression } from 'jamis-core';
import type { FormOptionsSchema, OptionsControlProps } from '../form/types';
import type { BaseSelectionProps } from '../form-select/types';
import type { TreeCompProps } from '../r-tree/types';
import type { SchemaApi, SchemaObject } from '../types';
import type { AssociatedSelectionProps, ChainedSelectionProps, TableSelectionProps } from './components/Transfer.types';
export * from './components/Transfer.types';
export * from './components/ResultList.types';
export type TransferSelectMode = 'group' | 'table' | 'list' | 'tree' | 'chained' | 'associated';
/**
* Transfer
*/
export interface TransferControlSchema extends FormOptionsSchema {
type: 'transfer';
/**
* 是否显示剪头
*/
showArrow?: boolean;
/**
* 可排序?
*/
sortable?: boolean;
/**
* 勾选展示模式
*/
selectMode?: TransferSelectMode;
groupConfig?: Partial<BaseSelectionProps>;
listConfig?: Partial<BaseSelectionProps>;
treeConfig?: Partial<TreeCompProps>;
tableConfig?: Partial<TableSelectionProps>;
chainedConfig?: Partial<ChainedSelectionProps>;
associatedConfig?: Partial<AssociatedSelectionProps>;
/**
* 结果面板是否追踪显示
*/
resultListModeFollowSelect?: boolean;
/**
* 当 selectMode 为 associated 时用来定义左侧的选项
* @deprecated
*/
leftOptions?: Array<Option>;
/** 左侧容器样式类 */
leftWrapClassName?: SchemaClassName;
/**
* 当 selectMode 为 associated 时用来定义左侧的选择模式
* @deprecated
*/
leftMode?: 'tree' | 'list';
/**
* 当 selectMode 为 associated 时用来定义右侧的选择模式
* @deprecated
*/
rightMode?: 'table' | 'list' | 'tree' | 'chained';
/**
* 当 selectMode 为 table 时定义表格列信息。
* @deprecated
*/
columns?: Array<any>;
/**
* 搜索结果展示模式
*/
searchResultMode?: 'table' | 'list' | 'tree' | 'chained';
/**
* 当 searchResultMode 为 table 时定义表格列信息。
*/
searchResultColumns?: Array<any>;
/**
* 可搜索?
*/
searchable?: boolean;
/**
* 是否精确搜索, 也就是在搜索到父节点时不要带出子节点
*/
searchExact?: boolean;
/**
* 结果(右则)列表的检索功能,当设置为true时,可以通过输入检索模糊匹配检索内容
*/
resultSearchable?: boolean;
/**
* 搜索 API
*/
searchApi?: SchemaApi;
/**
* 自动补全 API
*/
autoComplete?: SchemaApi;
/**
* 左侧的标题文字
*/
selectTitle?: string;
/**
* 右侧结果的标题文字
*/
resultTitle?: string;
/**
* 用来丰富选项展示
*/
menuTpl?: string | SchemaObject;
/**
* 用来丰富值的展示
*/
valueTpl?: string | SchemaObject;
/**
* 左侧列表搜索框提示
*/
searchPlaceholder?: string;
/**
* 右侧列表搜索框提示
*/
resultSearchPlaceholder?: string;
/**
* 弹窗大小
*/
pickerSize?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
pickerSizeExpr?: SchemaExpression;
/**
* .cxd-TransferDropDown-popover元素的样式类
*/
popoverClassName?: SchemaClassName;
}
export interface BaseTransferProps extends OptionsControlProps, Omit<TransferControlSchema, 'type' | 'options' | 'className' | 'descriptionClassName' | 'inputClassName'> {
/**
* 搜索的字段名集合
*/
searchFields?: string[];
resultItemRender?: (option: Option) => JSX.Element;
}
/**
* TransferPicker 穿梭器的弹框形态
*/
export interface TransferPickerControlSchema extends Omit<TransferControlSchema, 'type'> {
type: 'transfer-picker';
/**
* 边框模式,全边框,还是半边框,或者没边框。
*/
borderMode?: 'full' | 'half' | 'none';
}
export interface TransferPickerProps extends OptionsControlProps, Omit<TransferPickerControlSchema, 'type' | 'options' | 'inputClassName' | 'className' | 'descriptionClassName'> {
}
/**
* TabsTransferPicker 穿梭器的弹框形态
*/
export interface TabsTransferPickerControlSchema extends Omit<TabsTransferControlSchema, 'type'> {
type: 'tabs-transfer-picker';
}
export interface TabsTransferControlSchema extends Omit<TransferControlSchema, 'type'> {
type: 'tabs-transfer';
}
export interface TabsTransferRendererProps extends OptionsControlProps, Omit<TabsTransferControlSchema, 'type' | 'options' | 'inputClassName' | 'className' | 'descriptionClassName'> {
}