Skip to content

Commit

Permalink
glue-state-select component
Browse files Browse the repository at this point in the history
  • Loading branch information
kecnry committed Nov 20, 2024
1 parent 26168f2 commit 47efa6d
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 49 deletions.
1 change: 1 addition & 0 deletions jdaviz/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ def to_unit(self, data, cid, values, original_units, target_units):
'plugin-color-picker': 'components/plugin_color_picker.vue',
'plugin-input-header': 'components/plugin_input_header.vue',
'glue-state-sync-wrapper': 'components/glue_state_sync_wrapper.vue',
'glue-state-select': 'components/glue_state_select.vue',
'data-menu-add': 'components/data_menu_add.vue',
'data-menu-remove': 'components/data_menu_remove.vue',
'data-menu-subset-edit': 'components/data_menu_subset_edit.vue',
Expand Down
37 changes: 37 additions & 0 deletions jdaviz/components/glue_state_select.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<template>
<v-select
attach
:menu-props="{ left: true }"
:items="items"
v-model="selected"
@change="$emit('update:selected', $event)"
:label="api_hints_enabled && api_hint ? api_hint : label"
:class="api_hints_enabled && api_hint ? 'api-hint no-hint' : 'no-hint'"
dense
>
<template v-slot:selection="{ item, index }">
<span :class="api_hints_enabled ? 'api-hint' : null">
{{ api_hints_enabled ?
'\'' + item.text + '\''
:
item.text
}}
</span>
</template>
</v-select>
</template>

<script>
module.exports = {
props: ['items', 'selected', 'label', 'api_hint', 'api_hints_enabled'
]
};
</script>

<style scoped>
.v-select__selections {
flex-wrap: nowrap !important;
display: block !important;
margin-bottom: -32px;
}
</style>
91 changes: 42 additions & 49 deletions jdaviz/configs/default/plugins/plot_options/plot_options.vue
Original file line number Diff line number Diff line change
Expand Up @@ -361,14 +361,13 @@
</glue-state-sync-wrapper>

<glue-state-sync-wrapper v-if="marker_visible_value" :sync="marker_size_mode_sync" :multiselect="layer_multiselect" @unmix-state="unmix_state('marker_size_mode')">
<v-select
attach
:menu-props="{ left: true }"
<glue-state-select
:items="marker_size_mode_sync.choices"
v-model="marker_size_mode_value"
:label="api_hints_enabled ? 'plg.marker_size_mode =' : 'Size Mode'"
:class="api_hints_enabled ? 'api-hint no-hint' : 'no-hint'"
></v-select>
:selected.syn="marker_size_mode_value"
label="Size Mode"
api_hint="plg.marker_size_mode = "
:api_hints_enabled="api_hints_enabled"
/>
</glue-state-sync-wrapper>

<glue-state-sync-wrapper v-if="marker_visible_value && marker_size_mode_value==='Fixed'" :sync="marker_size_sync" :multiselect="layer_multiselect" @unmix-state="unmix_state('marker_size')">
Expand Down Expand Up @@ -396,14 +395,13 @@
</glue-state-sync-wrapper>

<glue-state-sync-wrapper v-if="marker_visible_value && marker_size_mode_value!=='Fixed'" :sync="marker_size_col_sync" :multiselect="layer_multiselect" @unmix-state="unmix_state('marker_size_col')">
<v-select
attach
:menu-props="{ left: true }"
<glue-state-select
:items="marker_size_col_sync.choices"
v-model="marker_size_col_value"
:label="api_hints_enabled ? 'plg.marker_size_col =' : 'Column'"
:class="api_hints_enabled ? 'api-hint no-hint' : 'no-hint'"
></v-select>
:selected.sync="marker_size_col_value"
label="Column"
api_hint="plg.marker_size_col = "
:api_hints_enabled="api_hints_enabled"
/>
</glue-state-sync-wrapper>

<glue-state-sync-wrapper v-if="marker_visible_value && marker_size_mode_value!=='Fixed'" :sync="marker_size_vmin_sync" :multiselect="layer_multiselect" @unmix-state="unmix_state('marker_size_vmin')">
Expand All @@ -430,14 +428,13 @@


<glue-state-sync-wrapper v-if="marker_visible_value" :sync="marker_color_mode_sync" :multiselect="layer_multiselect" @unmix-state="unmix_state('marker_color_mode')">
<v-select
attach
:menu-props="{ left: true }"
<glue-state-select
:items="marker_color_mode_sync.choices"
v-model="marker_color_mode_value"
:label="api_hints_enabled ? 'plg.marker_color_mode =' : 'Color Mode'"
:class="api_hints_enabled ? 'api-hint no-hint' : 'no-hint'"
></v-select>
:selected.sync="marker_color_mode_value"
label="Color Mode"
api_hint="plg.marker_color_mode = "
:api_hints_enabled="api_hints_enabled"
/>
</glue-state-sync-wrapper>

<glue-state-sync-wrapper v-if="marker_visible_value && marker_color_mode_value==='Fixed'" :sync="marker_color_sync" :multiselect="layer_multiselect" @unmix-state="unmix_state('marker_color')">
Expand All @@ -451,25 +448,23 @@
</glue-state-sync-wrapper>

<glue-state-sync-wrapper v-if="marker_visible_value && marker_color_mode_value!=='Fixed'" :sync="marker_color_col_sync" :multiselect="layer_multiselect" @unmix-state="unmix_state('marker_color_col')">
<v-select
attach
:menu-props="{ left: true }"
<glue-state-select
:items="marker_color_col_sync.choices"
v-model="marker_color_col_value"
:label="api_hints_enabled ? 'plg.marker_color_col =' : 'Column'"
:class="api_hints_enabled ? 'api-hint no-hint' : 'no-hint'"
></v-select>
:selected.sync="marker_color_col_value"
label="Column"
api_hint="plg.marker_color_col = "
:api_hints_enabled="api_hints_enabled"
/>
</glue-state-sync-wrapper>

<glue-state-sync-wrapper v-if="marker_visible_value && marker_color_mode_value!=='Fixed'" :sync="marker_colormap_sync" :multiselect="layer_multiselect" @unmix-state="unmix_state('marker_colormap')">
<v-select
attach
:menu-props="{ left: true }"
<glue-state-select
:items="marker_colormap_sync.choices"
v-model="marker_colormap_value"
:label="api_hints_enabled ? 'plg.marker_colormap =' : 'Colormap'"
:class="api_hints_enabled ? 'api-hint no-hint' : 'no-hint'"
></v-select>
:selected.sync="marker_colormap_value"
label="Colormap"
api_hint="plg.marker_colormap = "
:api_hints_enabled="api_hints_enabled"
/>
</glue-state-sync-wrapper>

<glue-state-sync-wrapper v-if="marker_visible_value && marker_color_mode_value!=='Fixed'" :sync="marker_colormap_vmin_sync" :multiselect="layer_multiselect" @unmix-state="unmix_state('marker_colormap_vmin')">
Expand Down Expand Up @@ -603,25 +598,23 @@
<!-- IMAGE:STRETCH -->
<j-plugin-section-header v-if="stretch_function_sync.in_subscribed_states">Stretch</j-plugin-section-header>
<glue-state-sync-wrapper :sync="stretch_function_sync" :multiselect="layer_multiselect" @unmix-state="unmix_state('stretch_function')">
<v-select
attach
:menu-props="{ left: true }"
<glue-state-select
:items="stretch_function_sync.choices"
v-model="stretch_function_value"
:label="api_hints_enabled ? 'plg.stretch_function =' : 'Stretch Function'"
:class="api_hints_enabled ? 'api-hint no-hint' : 'no-hint'"
></v-select>
:selected.sync="stretch_function_value"
label="Stretch Function"
api_hint="plg.stretch_function = "
:api_hints_enabled="api_hints_enabled"
/>
</glue-state-sync-wrapper>

<glue-state-sync-wrapper :sync="stretch_preset_sync" :multiselect="layer_multiselect" @unmix-state="unmix_state('stretch_preset')">
<v-select
attach
:menu-props="{ left: true }"
<glue-state-select
:items="stretch_preset_sync.choices"
v-model="stretch_preset_value"
:label="api_hints_enabled ? 'plg.stretch_preset =' : 'Stretch Percentile Preset'"
:class="api_hints_enabled ? 'api-hint no-hint' : 'no-hint'"
></v-select>
:selected.sync="stretch_preset_value"
label="Stretch Percentile Preset"
api_hint="plg.stretch_preset = "
:api_hints_enabled="api_hints_enabled"
/>
</glue-state-sync-wrapper>

<!-- for multiselect, show vmin/max here, otherwise they'll be in the "more stretch options" expandable section -->
Expand Down

0 comments on commit 47efa6d

Please sign in to comment.