1
0
Fork 0
mirror of synced 2024-07-15 11:15:59 +12:00

Merge pull request #6640 from mslourens/pass_untruncated_title_to_radiogroup

Pass a title property with untruncated text to the RadioGroup
This commit is contained in:
Martin McKeaveney 2022-08-31 13:32:33 +01:00 committed by GitHub
commit e6eb1687d2
4 changed files with 6 additions and 1 deletions

View file

@ -10,6 +10,7 @@
export let disabled = false export let disabled = false
export let getOptionLabel = option => option export let getOptionLabel = option => option
export let getOptionValue = option => option export let getOptionValue = option => option
export let getOptionTitle = option => option
const dispatch = createEventDispatcher() const dispatch = createEventDispatcher()
const onChange = e => dispatch("change", e.target.value) const onChange = e => dispatch("change", e.target.value)
@ -19,7 +20,7 @@
{#if options && Array.isArray(options)} {#if options && Array.isArray(options)}
{#each options as option} {#each options as option}
<div <div
title={getOptionLabel(option)} title={getOptionTitle(option)}
class="spectrum-Radio spectrum-FieldGroup-item spectrum-Radio--emphasized" class="spectrum-Radio spectrum-FieldGroup-item spectrum-Radio--emphasized"
class:is-invalid={!!error} class:is-invalid={!!error}
> >

View file

@ -12,6 +12,7 @@
export let direction = "vertical" export let direction = "vertical"
export let getOptionLabel = option => extractProperty(option, "label") export let getOptionLabel = option => extractProperty(option, "label")
export let getOptionValue = option => extractProperty(option, "value") export let getOptionValue = option => extractProperty(option, "value")
export let getOptionTitle = option => extractProperty(option, "label")
const dispatch = createEventDispatcher() const dispatch = createEventDispatcher()
const onChange = e => { const onChange = e => {
@ -35,6 +36,7 @@
{direction} {direction}
{getOptionLabel} {getOptionLabel}
{getOptionValue} {getOptionValue}
{getOptionTitle}
on:change={onChange} on:change={onChange}
/> />
</Field> </Field>

View file

@ -467,6 +467,7 @@
options={relationshipOptions} options={relationshipOptions}
getOptionLabel={option => option.name} getOptionLabel={option => option.name}
getOptionValue={option => option.value} getOptionValue={option => option.value}
getOptionTitle={option => option.alt}
/> />
{/if} {/if}
<Input <Input

View file

@ -77,6 +77,7 @@
{direction} {direction}
on:change={handleChange} on:change={handleChange}
getOptionLabel={flatOptions ? x => x : x => x.label} getOptionLabel={flatOptions ? x => x : x => x.label}
getOptionTitle={flatOptions ? x => x : x => x.label}
getOptionValue={flatOptions ? x => x : x => x.value} getOptionValue={flatOptions ? x => x : x => x.value}
/> />
{/if} {/if}