mirror of
				https://github.com/simon987/sist2.git
				synced 2025-11-04 09:36:53 +00:00 
			
		
		
		
	Add filter bar in tag picker
This commit is contained in:
		
							parent
							
								
									c575fca91d
								
							
						
					
					
						commit
						dbdc75dcb8
					
				
							
								
								
									
										2
									
								
								sist2-vue/dist/css/index.css
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								sist2-vue/dist/css/index.css
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										2
									
								
								sist2-vue/dist/js/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								sist2-vue/dist/js/index.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							@ -1,5 +1,13 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <div id="tagTree"></div>
 | 
			
		||||
  <div>
 | 
			
		||||
    <b-input-group v-if="showSearchBar" id="tag-picker-filter-bar">
 | 
			
		||||
      <b-form-input :value="filter"
 | 
			
		||||
                    :placeholder="'Filter tags'"
 | 
			
		||||
                    @input="onFilter($event)"></b-form-input>
 | 
			
		||||
    </b-input-group>
 | 
			
		||||
 | 
			
		||||
    <div id="tagTree"></div>
 | 
			
		||||
  </div>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
@ -112,10 +120,12 @@ function addTag(map, tag, id, count) {
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
  name: "TagPicker",
 | 
			
		||||
  props: ["showSearchBar"],
 | 
			
		||||
  data() {
 | 
			
		||||
    return {
 | 
			
		||||
      tagTree: null,
 | 
			
		||||
      loadedFromArgs: false,
 | 
			
		||||
      filter: ""
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  mounted() {
 | 
			
		||||
@ -129,6 +139,10 @@ export default {
 | 
			
		||||
    });
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
    onFilter(value) {
 | 
			
		||||
      this.filter = value;
 | 
			
		||||
      this.tagTree.search(value);
 | 
			
		||||
    },
 | 
			
		||||
    initializeTree() {
 | 
			
		||||
      const tagMap = [];
 | 
			
		||||
      this.tagTree = new InspireTree({
 | 
			
		||||
@ -163,7 +177,8 @@ export default {
 | 
			
		||||
      });
 | 
			
		||||
    },
 | 
			
		||||
    handleTreeClick(node, e) {
 | 
			
		||||
      if (e === "indeterminate" || e === "collapsed" || e === 'rendered' || e === "focused") {
 | 
			
		||||
      if (e === "indeterminate" || e === "collapsed" || e === 'rendered' || e === "focused"
 | 
			
		||||
          || e === "matched" || e === "hidden") {
 | 
			
		||||
        return;
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
@ -180,7 +195,15 @@ export default {
 | 
			
		||||
}
 | 
			
		||||
</style>
 | 
			
		||||
<style>
 | 
			
		||||
.inspire-tree .focused>.wholerow {
 | 
			
		||||
.inspire-tree .focused > .wholerow {
 | 
			
		||||
  border: none;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#tag-picker-filter-bar {
 | 
			
		||||
  padding: 10px 4px 4px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.theme-black .inspire-tree .matched > .wholerow {
 | 
			
		||||
  background: rgba(251, 191, 41, 0.25);
 | 
			
		||||
}
 | 
			
		||||
</style>
 | 
			
		||||
@ -4,6 +4,8 @@ import VueRouter, {Route} from "vue-router";
 | 
			
		||||
import {EsHit, EsResult, EsTag, Index, Tag} from "@/Sist2Api";
 | 
			
		||||
import {deserializeMimes, serializeMimes} from "@/util";
 | 
			
		||||
 | 
			
		||||
const CONF_VERSION = 2;
 | 
			
		||||
 | 
			
		||||
Vue.use(Vuex)
 | 
			
		||||
 | 
			
		||||
export default new Vuex.Store({
 | 
			
		||||
@ -52,6 +54,7 @@ export default new Vuex.Store({
 | 
			
		||||
        optUseDatePicker: false,
 | 
			
		||||
        optVidPreviewInterval: 700,
 | 
			
		||||
        optSimpleLightbox: true,
 | 
			
		||||
        optShowTagPickerFilter: true,
 | 
			
		||||
 | 
			
		||||
        _onLoadSelectedIndices: [] as string[],
 | 
			
		||||
        _onLoadSelectedMimeTypes: [] as string[],
 | 
			
		||||
@ -163,6 +166,7 @@ export default new Vuex.Store({
 | 
			
		||||
        setOptUseDatePicker: (state, val) => state.optUseDatePicker = val,
 | 
			
		||||
        setOptVidPreviewInterval: (state, val) => state.optVidPreviewInterval = val,
 | 
			
		||||
        setOptSimpleLightbox: (state, val) => state.optSimpleLightbox = val,
 | 
			
		||||
        setOptShowTagPickerFilter: (state, val) => state.optShowTagPickerFilter = val,
 | 
			
		||||
 | 
			
		||||
        setOptLightboxLoadOnlyCurrent: (state, val) => state.optLightboxLoadOnlyCurrent = val,
 | 
			
		||||
        setOptLightboxSlideDuration: (state, val) => state.optLightboxSlideDuration = val,
 | 
			
		||||
@ -274,6 +278,8 @@ export default new Vuex.Store({
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            conf["version"] = CONF_VERSION;
 | 
			
		||||
 | 
			
		||||
            localStorage.setItem("sist2_configuration", JSON.stringify(conf));
 | 
			
		||||
        },
 | 
			
		||||
        loadConfiguration({state}) {
 | 
			
		||||
@ -281,6 +287,11 @@ export default new Vuex.Store({
 | 
			
		||||
            if (confString) {
 | 
			
		||||
                const conf = JSON.parse(confString);
 | 
			
		||||
 | 
			
		||||
                if (!("version" in conf) || conf["version"] != CONF_VERSION) {
 | 
			
		||||
                    localStorage.removeItem("sist2_configuration");
 | 
			
		||||
                    window.location.reload();
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                Object.keys(state).forEach((key) => {
 | 
			
		||||
                    if (key.startsWith("opt")) {
 | 
			
		||||
                        (state as any)[key] = conf[key];
 | 
			
		||||
@ -386,5 +397,6 @@ export default new Vuex.Store({
 | 
			
		||||
        optUseDatePicker: state => state.optUseDatePicker,
 | 
			
		||||
        optVidPreviewInterval: state => state.optVidPreviewInterval,
 | 
			
		||||
        optSimpleLightbox: state => state.optSimpleLightbox,
 | 
			
		||||
        optShowTagPickerFilter: state => state.optShowTagPickerFilter,
 | 
			
		||||
    }
 | 
			
		||||
})
 | 
			
		||||
@ -50,6 +50,11 @@
 | 
			
		||||
              $t("opt.simpleLightbox")
 | 
			
		||||
            }}
 | 
			
		||||
          </b-form-checkbox>
 | 
			
		||||
 | 
			
		||||
          <b-form-checkbox :checked="optShowTagPickerFilter" @input="setOptShowTagPickerFilter">{{
 | 
			
		||||
              $t("opt.showTagPickerFilter")
 | 
			
		||||
            }}
 | 
			
		||||
          </b-form-checkbox>
 | 
			
		||||
        </b-card>
 | 
			
		||||
 | 
			
		||||
        <br/>
 | 
			
		||||
@ -245,6 +250,7 @@ export default {
 | 
			
		||||
      "optUseDatePicker",
 | 
			
		||||
      "optVidPreviewInterval",
 | 
			
		||||
      "optSimpleLightbox",
 | 
			
		||||
      "optShowTagPickerFilter",
 | 
			
		||||
    ]),
 | 
			
		||||
    clientWidth() {
 | 
			
		||||
      return window.innerWidth;
 | 
			
		||||
@ -292,6 +298,7 @@ export default {
 | 
			
		||||
      "setOptUseDatePicker",
 | 
			
		||||
      "setOptVidPreviewInterval",
 | 
			
		||||
      "setOptSimpleLightbox",
 | 
			
		||||
      "setOptShowTagPickerFilter",
 | 
			
		||||
    ]),
 | 
			
		||||
    onResetClick() {
 | 
			
		||||
      localStorage.removeItem("sist2_configuration");
 | 
			
		||||
 | 
			
		||||
@ -32,7 +32,7 @@
 | 
			
		||||
              <MimePicker></MimePicker>
 | 
			
		||||
            </b-tab>
 | 
			
		||||
            <b-tab :title="$t('tags')">
 | 
			
		||||
              <TagPicker></TagPicker>
 | 
			
		||||
              <TagPicker :show-search-bar="$store.state.optShowTagPickerFilter"></TagPicker>
 | 
			
		||||
            </b-tab>
 | 
			
		||||
          </b-tabs>
 | 
			
		||||
        </b-col>
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										10
									
								
								src/web/static_generated.c
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										10
									
								
								src/web/static_generated.c
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user