AbsaOSS / AbsaOSS/cps-shared-ui

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

Aperta
#387 0 commenti 0 reazioni 1 assegnatario Rivendicata da @lukasmatta Vedi su GitHub
enhancement
Lingua principale
TypeScript
Stelle
9
Fork
6
Merge medio
23h 46m
PR unite (30g)
5

Descrizione

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`

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.