Skip to content

Commit

Permalink
feat(select): add nullLabel prop
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasRichel committed May 31, 2022
1 parent 60d1f3c commit 9098123
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/BIMDataComponents/BIMDataSelect/BIMDataSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ export default {
type: Boolean,
default: false,
},
nullLabel: {
type: String,
},
disabled: {
type: Boolean,
default: false,
Expand Down
6 changes: 6 additions & 0 deletions src/BIMDataComponents/BIMDataSelect/BIMDataSelectMulti.vue
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ export default {
modelValue: {
type: Array,
},
nullLabel: {
type: String,
},
disabled: {
type: Boolean,
default: false,
Expand Down Expand Up @@ -116,6 +119,9 @@ export default {
return option;
},
optionLabel(option) {
if (this.nullLabel && option == null) {
return this.nullLabel;
}
if (this.optionLabelKey && option) {
return option[this.optionLabelKey];
}
Expand Down
8 changes: 7 additions & 1 deletion src/BIMDataComponents/BIMDataSelect/BIMDataSelectSingle.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
class="bimdata-select__option-list__entry"
@click="onNullValueClick()"
>
None
{{ nullLabel || "None" }}
</li>
<li
class="bimdata-select__option-list__entry"
Expand Down Expand Up @@ -88,6 +88,9 @@ export default {
type: Boolean,
default: false,
},
nullLabel: {
type: String,
},
disabled: {
type: Boolean,
default: false,
Expand Down Expand Up @@ -117,6 +120,9 @@ export default {
return option;
},
optionLabel(option) {
if (this.nullLabel && option == null) {
return this.nullLabel;
}
if (this.optionLabelKey && option) {
return option[this.optionLabelKey];
}
Expand Down

0 comments on commit 9098123

Please sign in to comment.