Skip to content

Commit f85195c

Browse files
committed
feat: add toSelectPlugin
1 parent 8ccf2a4 commit f85195c

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/types.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -257,9 +257,14 @@ export interface IEnumItems<
257257
* **CN:** 生成一个对象数组,包含所有的枚举项,可自定义值和标签字段名
258258
*
259259
* @example
260+
* Week.toList({
261+
* valueField: 'id',
262+
* labelField: 'name',
263+
* });
264+
*
260265
* [
261-
* { value: 0, label: 'Sunday' },
262-
* { value: 1, label: 'Monday' },
266+
* { id: 0, name: 'Sunday' },
267+
* { id: 1, name: 'Monday' },
263268
* ];
264269
*
265270
* @param config Custom options, supports customizing value and label field names |
@@ -442,8 +447,11 @@ export type CompactEnumItemInit = Record<string, never>; // 等价于{}
442447
* @template FOL Field name of the label, default is `label` | 标签字段名,默认为 `label`
443448
* @template FOV Field name of the value, default is `value` | 值字段名,默认为 `value`
444449
*/
445-
export type ListItem<V = EnumValue, FOV extends string = 'value', FOL extends string = 'label'> = Record<FOV, V> &
446-
Record<FOL, string>;
450+
export type ListItem<
451+
V extends EnumValue = EnumValue,
452+
FOV extends string = 'value',
453+
FOL extends string = 'label',
454+
> = Record<FOV, V> & Record<FOL, string>;
447455

448456
/** Data structure of column filter items of ant-design Table */
449457
export interface ColumnFilterItem<V> {

0 commit comments

Comments
 (0)