-
Notifications
You must be signed in to change notification settings - Fork 19
Conversation
Cherrypicking this commit to |
src/components/OcSelect.vue
Outdated
@@ -32,6 +35,11 @@ export default { | |||
required: false, | |||
default: null, | |||
}, | |||
labelText: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to bind $attrs
without the label
prop to the vue-select? So that we can have a dedicated label
prop on the OcSelect? I kind of dislike using labelText
as prop name here, while we use label
on all other form related elements.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Full ack! Streamline all the things 🥳
eb13580
to
69140e6
Compare
@kulmann ready for re-review. Feels a bit hacky and prevents us from using the vue-select label prop but gets the job done |
69140e6
to
f889be9
Compare
src/components/OcSelect.vue
Outdated
@@ -33,6 +42,11 @@ export default { | |||
default: null, | |||
}, | |||
}, | |||
computed: { | |||
setLabel() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i find this somehow misleading, sounds like a method. Maybe selectLabel?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about inputLabel
? @kulmann any suggestions/opinions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, inputLabel
is fine
src/components/OcSelect.vue
Outdated
@@ -42,6 +56,11 @@ export default { | |||
const comboBoxElement = this.$refs.select.$el.querySelector("div:first-child") | |||
comboBoxElement.setAttribute("aria-label", this.$gettext("Search for option")) | |||
}, | |||
setCustomizedAttrs() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not setting anything. It should be a computed prop (and have a different name, like customizedAttrs
or something like that)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, you should copy the this.$attrs
first before modifying.
@@ -0,0 +1,5 @@ | |||
Enhancement: Label for OcSelect | |||
|
|||
We've added a configurable `<label>` for the OcSelect label. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tbh this sounds a bit strange.
You've just added a label for OcSelect
, no?
|
||
We've added a configurable `<label>` for the OcSelect label. | ||
|
||
https://github.com/owncloud/web/issues/1570 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be #1503 I think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, nope - #1570 hehe
Number was right, just the wrong repo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO this is a breaking change (I'm using the label
property already) and should be marked as such in the changelog.
After all you had to change the documentation/example because it was broken ;-)
I would prefer having an option-label
prop instead of having to use the option
slot but that's obviously debatable.
src/components/OcSelect.vue
Outdated
Sometimes we need to display more complex options. This can include e.g. an option with a title and a description. | ||
To still display all those values exactly as we want to, we need to use scoped slot called `option`. | ||
We can then retrieve all the values that we want to display from the slots parametres. | ||
It is important to use a `label` key inside the passed object since `oc-select` will look for it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sounds rather complicated. Why don't we introduce an option-label
property that will be passed as label
to vue-select?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds like a great idea actually, let me take a look 🕵🏽
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or get it from $attrs
fwiw
In general: yay! |
src/components/OcSelect.vue
Outdated
return this.$attrs["label"] | ||
/** | ||
* Label of the select component | ||
* ATTENTION: this shadows the vue-select option `label`. If you need access to that use `optionLabel`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It shadows the vue select "prop"
src/components/OcSelect.vue
Outdated
<div slot="no-options" v-translate>No options available.</div> | ||
</vue-select> | ||
<div> | ||
<label :for="this.$attrs['input-id']" v-text="label" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is this supposed to come from? How is this wired up with vue-select?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I assume vue-select has this prop? In other places we seem to use an id prop, maybe we should stick to that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/** |
CI fails because of unit tests, looks completely unrelated to me. |
e881e5d
to
c4cbb27
Compare
bd6b7da
to
ee9c5b6
Compare
ee9c5b6
to
628e848
Compare
Description
See changelog item