This repository has been archived by the owner on Nov 25, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
298338a
commit 0a9c051
Showing
6 changed files
with
86 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import {bindable, customElement, bindingMode} from 'aurelia-framework'; | ||
import {resolvedView} from 'aurelia-view-manager'; | ||
|
||
@resolvedView('spoonx/form', 'form-select') | ||
@customElement('form-select') | ||
export class FormSelect { | ||
@bindable({defaultBindingMode: bindingMode.twoWay}) value; | ||
|
||
@bindable name = ''; | ||
@bindable classes = ''; | ||
@bindable readonly = false; | ||
@bindable disabled = false; | ||
@bindable multiple = false; | ||
@bindable selectOptions = []; | ||
@bindable options = {}; | ||
@bindable optionLabel = 'name'; | ||
getOptionLabel(option) { | ||
if (typeof option === 'object' && this.optionLabel) { | ||
return option[this.optionLabel] || option; | ||
} | ||
|
||
return option; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<template> | ||
<select | ||
value.bind="value" | ||
class="form-control ${classes}" | ||
name.bind="name" | ||
readonly.bind="readonly !== false" | ||
prefixed="options.bind: options; prefix: input-" | ||
disabled.bind="disabled !== false" | ||
multiple.bind="multiple !== false" | ||
> | ||
<option repeat.for="option of selectOptions" model.bind="option" t="${getOptionLabel(option)}">${getOptionLabel(option)}</option> | ||
</select> | ||
</template> |