Ghost/ghost/admin/app/components/gh-input-with-select/index.hbs
Kevin Ansfield 33c872c859 Added <GhInputWithSelect> component
refs https://github.com/TryGhost/Team/issues/987

- `<GhInputWithSelect>` acts as a typical text input element but will also show options that are filtered whilst typing. Useful for inputs where there should be suggestions or the ability to choose an existing option
- updated `<GhSearchInput>` to use the renamed and slightly modified trigger
2021-08-20 14:33:30 +01:00

72 lines
2.9 KiB
Handlebars

{{#let (component (or @powerSelectComponentName "power-select")) as |Select|}}
<Select
@afterOptionsComponent={{@afterOptionsComponent}}
@allowClear={{@allowClear}}
@ariaDescribedBy={{@ariaDescribedBy}}
@ariaInvalid={{@ariaInvalid}}
@ariaLabel={{@ariaLabel}}
@ariaLabelledBy={{@ariaLabelledBy}}
@beforeOptionsComponent={{this.beforeOptionsComponent}}
@buildSelection={{@buildSelection}}
@calculatePosition={{@calculatePosition}}
@class={{@class}}
@closeOnSelect={{@closeOnSelect}}
@defaultHighlighted={{@defaultHighlighted}}
@destination={{@destination}}
@dir={{@dir}}
@disabled={{@disabled}}
@dropdownClass={{@dropdownClass}}
@extra={{assign @extra (hash
value=@value
autofocus=@autofocus
openOnFocus=@openOnFocus
closeWhenEmpty=@closeWhenEmpty
)}}
@groupComponent={{@groupComponent}}
@highlightOnHover={{@highlightOnHover}}
@horizontalPosition={{@horizontalPosition}}
@initiallyOpened={{@initiallyOpened}}
@loadingMessage={{@loadingMessage}}
@matchTriggerWidth={{@matchTriggerWidth}}
@matcher={{this.matcher}}
@noMatchesMessage={{or @noMatchesMessage ""}}
@onBlur={{@onBlur}}
@onChange={{this.selectOrCreate}}
@onClose={{@onClose}}
@onFocus={{@onFocus}}
@onInput={{@onInput}}
@onKeydown={{@onKeydown}}
@onOpen={{@onOpen}}
@options={{@options}}
@optionsComponent={{@optionsComponent}}
@placeholder={{@placeholder}}
@placeholderComponent={{@placeholderComponent}}
@preventScroll={{@preventScroll}}
@registerAPI={{@registerAPI}}
@renderInPlace={{@renderInPlace}}
@scrollTo={{@scrollTo}}
@search={{this.searchAndSuggest}}
@searchEnabled={{false}}
@searchField={{or @searchField "name"}}
@searchMessage={{@searchMessage}}
@searchMessageComponent={{@searchMessageComponent}}
@searchPlaceholder={{@searchPlaceholder}}
@selected={{@selected}}
@selectedItemComponent={{@selectedItemComponent}}
@tabindex={{@tabindex}}
@triggerClass="ember-power-select-multiple-trigger {{@triggerClass}}"
@triggerComponent={{component (or @triggerComponent "gh-input-with-select/trigger") tabindex=@tabindex}}
@triggerId={{@triggerId}}
@triggerRole={{@triggerRole}}
@typeAheadMatcher={{@typeAheadMatcher}}
@verticalPosition={{@verticalPosition}}
...attributes
as |option term|
>
{{#if option.__isSuggestion__}}
{{component (or @suggestedOptionComponent "gh-input-with-select/suggested-option") option=option term=term}}
{{else}}
{{yield option term}}
{{/if}}
</Select>
{{/let}}