Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Globally align smart-select value with other input values #2356

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions bundles/org.openhab.ui/web/src/components/app.vue
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,23 @@
// --f7-list-item-media-margin 24px
// --f7-list-item-padding-horizontal 32px
// --f7-list-chevron-icon-color var(--f7-color-blue-tint) !important
</style>

<style lang="stylus">
// align smart select popup list item with input fields of f7-list-input elements
a.item-link.smart-select
.item-content
.item-inner
.item-title
// f7-input-item uses 35% for the item-title,
// but since their item-inner has less padding (16px vs 31px) on the left side, add those 15px difference
min-width calc(35% + 0.35*15px) !important
.item-after
width 100%
margin 0
padding 0
margin-left 8px
color var(--f7-input-text-color)
</style>

<script>
Expand Down
15 changes: 2 additions & 13 deletions bundles/org.openhab.ui/web/src/components/item/item-form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
</f7-list-group>
<f7-list-group v-if="itemType && !hideType">
<!-- Type -->
<f7-list-item v-if="itemType && !hideType" title="Type" class="align-popup-list-item" :disabled="!editable" :key="'type-' + itemType" smart-select :smart-select-params="{searchbar: true, openIn: 'popup', closeOnSelect: true}">
<f7-list-item v-if="itemType && !hideType" title="Type" :disabled="!editable" :key="'type-' + itemType" smart-select :smart-select-params="{searchbar: true, openIn: 'popup', closeOnSelect: true}">
<select name="select-type" @change="item.type = $event.target.value">
<option v-for="t in types.ItemTypes" :key="t" :value="t" :selected="t === itemType">
{{ t }}
</option>
</select>
</f7-list-item>
<!-- Dimensions -->
<f7-list-item v-if="dimensions.length && !hideType && itemType === 'Number'" title="Dimension" class="align-popup-list-item" :disabled="!editable" :key="'dimension-' + itemDimension" smart-select :smart-select-params="{searchbar: true, openIn: 'popup', closeOnSelect: true}">
<f7-list-item v-if="dimensions.length && !hideType && itemType === 'Number'" title="Dimension" :disabled="!editable" :key="'dimension-' + itemDimension" smart-select :smart-select-params="{searchbar: true, openIn: 'popup', closeOnSelect: true}">
<select name="select-dimension" @change="setDimension($event.target.value)">
<option key="" value="Number" :selected="itemDimension === ''" />
<option v-for="d in dimensions" :key="d.name" :value="d.name" :selected="d.name === itemDimension">
Expand Down Expand Up @@ -83,17 +83,6 @@
display inherit !important
.item-title
font-weight inherit !important
.align-popup-list-item
.item-title
// f7-input-item uses 35% for the item-title,
// but since their item-inner has less padding (16px vs 31px) on the left side, add those 15px difference
min-width calc(35% + 0.35*15px)
.item-after
width 100%
margin 0
padding 0
margin-left 8px
color var(--f7-input-text-color)
</style>

<script>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<f7-list inline-labels no-hairlines-md v-if="show">
<f7-list-item :disabled="!editable" title="Semantic Class" class="align-popup-list-item" :key="'class-' + semanticClass" smart-select :smart-select-params="{view: $f7.view.main, searchbar: true, openIn: 'popup', closeOnSelect: true, scrollToSelectedItem: true}">
<f7-list-item :disabled="!editable" title="Semantic Class" :key="'class-' + semanticClass" smart-select :smart-select-params="{view: $f7.view.main, searchbar: true, openIn: 'popup', closeOnSelect: true, scrollToSelectedItem: true}">
<select name="select-semantics-class" @change="update('class', $event.target.value)">
<option v-if="!hideNone" value="">
None
Expand All @@ -22,8 +22,8 @@
</optgroup>
</select>
</f7-list-item>
<f7-list-item v-if="currentSemanticType && !hideType" :disabled="!editable" title="Semantic Type" class="align-popup-list-item" :after="currentSemanticType" />
<f7-list-item v-if="currentSemanticType === 'Point'" :disabled="!editable" title="Semantic Property" class="align-popup-list-item" :key="'property-' + semanticProperty" smart-select :smart-select-params="{view: $f7.view.main, searchbar: true, openIn: 'popup', closeOnSelect: true, scrollToSelectedItem: true}">
<f7-list-item v-if="currentSemanticType && !hideType" :disabled="!editable" title="Semantic Type" :after="currentSemanticType" />
<f7-list-item v-if="currentSemanticType === 'Point'" :disabled="!editable" title="Semantic Property" :key="'property-' + semanticProperty" smart-select :smart-select-params="{view: $f7.view.main, searchbar: true, openIn: 'popup', closeOnSelect: true, scrollToSelectedItem: true}">
<select name="select-semantics-property" :value="semanticProperty" @change="update('property', $event.target.value)">
<option :value="''">
None
Expand Down
Loading