drip-table
Version:
A tiny and powerful enterprise-class solution for building tables.
111 lines (110 loc) • 2.95 kB
TypeScript
import React from 'react';
import { DripTableColumnSchema, DripTableRecordTypeBase, SchemaObject } from "../../../types";
import { DripTableComponentProps } from '../component';
declare type LabeledOptions = {
label: string;
value: string | number;
disabled?: boolean | string;
};
export declare type DTCSelectColumnSchema = DripTableColumnSchema<'select', {
/**
* 允许清空值
*/
allowClear?: boolean;
/**
* 展示边框,默认为 true
*/
bordered?: boolean;
style?: React.CSSProperties;
/**
* 多选和标签模式
*/
mode?: 'multiple' | 'tags';
/**
* 暗纹提示
*/
placeholder?: string;
/**
* 弹出框位置
*/
placement?: 'bottomLeft' | 'bottomRight' | 'topLeft' | 'topRight';
/**
* 尺寸大小
*/
size?: 'large' | 'middle' | 'small';
/**
* 值回显强制与数据绑定,默认为true
*/
bindValue?: boolean;
/**
* 展示箭头,默认为 true
*/
showArrow?: boolean;
/**
* 允许搜索,默认为 false
*/
showSearch?: boolean;
/**
* 事件名,给用户区分事件用
*/
event?: string;
/**
* 是否禁用,给用户区分事件用
*/
disabled?: string | boolean;
/**
* 默认值
*/
defaultValue?: string | number | (string | number)[];
/**
* 自定义options
*/
options?: LabeledOptions[];
/**
* 从接口请求拿取 options
*/
url?: string;
/**
* 接口请求配置,目前仅支持 JSON 格式
*/
request?: {
method: 'GET' | 'POST';
headers?: HeadersInit;
credentials?: 'include' | 'same-origin' | 'omit';
body?: string | Record<string, unknown>;
};
/**
* 接口返回数据格式配置, dataIndex 和 mapper 二者选其一
*/
response?: {
dataIndex?: string | number | (string | number)[];
mapper?: string;
};
}>;
export interface DTCSelectEvent {
type: 'drip-select-change';
payload: {
name: string;
value: string | number | (string | number)[];
};
}
interface DTCSelectProps<RecordType extends DripTableRecordTypeBase> extends DripTableComponentProps<RecordType, DTCSelectColumnSchema> {
}
interface DTCSelectState {
loading?: boolean;
options?: LabeledOptions[];
}
export default class DTCSelect<RecordType extends DripTableRecordTypeBase> extends React.PureComponent<DTCSelectProps<RecordType>, DTCSelectState> {
static componentName: DTCSelectColumnSchema['component'];
static schema: SchemaObject;
constructor(props: DTCSelectProps<RecordType>);
private get disabled();
private get options();
private get value();
private finalizeOptionDisabled;
private finalizeRequestBody;
private finalizeOptionsResponse;
componentDidMount(): void;
render(): React.JSX.Element;
}
export {};