AbsaOSS / AbsaOSS/cps-shared-ui

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

オープン
#387 コメント 0 件 リアクション 0 件 担当者 1 名 @lukasmatta が担当を希望しています GitHub で見る
enhancement
主要言語
TypeScript
スター
9
フォーク
6
平均マージ
23時間 46分
マージ済み PR(30日)
5

説明

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`

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。