AbsaOSS / AbsaOSS/cps-shared-ui

Not possible to use a nested property for optionLabel/optionValue/optionInfo in CpsSelect

Đang mở
#387 0 bình luận 0 reaction 1 người được giao Được @lukasmatta nhận Xem trên GitHub
enhancement
Ngôn ngữ chính
TypeScript
Star
9
Fork
6
Merge trung bình
23 giờ 46 phút
Pull request đã merge (30 ngày)
5

Mô tả

Currently, if one wants to use nested property for `optionLabel`/`optionValue`/`optionInfo` it's not possible. Let me illustrate on an example:

We have an array of options of the following type:

```ts
interface Option {
name: string;
address: {
city: string;
};
}
```

And we want to use it in a `CpsSelect`:

```html

>

```

I'd suggest supporting not only `string` type but also a `Function` type for those inputs, so that a user can define custom function that will take option object and would return value to be used for `optionLabel/Value/Info`, e.g.:

```js
const getCity = (option: Option): string => option.address.city;
```

```html

```

Components that might also support this:
`CpsSelect`/`CpsTreeSelect`
`CpsAutocomplete`/`CpsTreeAutocomplete`

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.