Giter Site home page Giter Site logo

stfalcon-studio / stf-vue-select Goto Github PK

View Code? Open in Web Editor NEW
62.0 5.0 15.0 1.29 MB

stf vue select - most flexible and customized select

License: MIT License

Vue 28.57% JavaScript 61.19% HTML 3.69% CSS 6.55%
flexible select vuejs2 ideal objects custom labels input search customized

stf-vue-select's Introduction

stf vue select VUE2

Join the chat at https://gitter.im/stfalcon-studio/stf-vue-select

stf vue select - most flexible and customized select

For detailed explanation on how things work, checkout the DEMO

install

# install 
npm install stf-vue-select --save

import

import {StfSelect, StfSelectOption} from "stf-vue-select";
import "stf-vue-select/dist/lib/stf-vue-select.min.css";

...

Vue.component('stf-select-option', StfSelectOption);
Vue.component('stf-select', StfSelect);

Using without webpack minified files

<script src="./dist/lib/stf-vue-select.min.js"></script>

Vue.use(StfSelectPlugin) 

usage

    <template>
  <div id="app">
    <img src="./assets/logo.png">
    <h1>stf-vue-select - the most flexible vue select</h1>
    <br>
    <label>Select without input</label>
    <stf-select v-model="value" style="width: 300px; margin: 0 auto">
      <div slot="label">Input address</div>
      <div slot="value">
        <div v-if="value">
           <span>{{value.address}} (<small>{{value.text}}</small>)</span>
        </div>
      </div>
      <section class="options delivery_order__options">
          <stf-select-option  
           v-for="item of list" :key="item.id"
           :value="item"
           :class="{'stf-select-option_selected': item.id === (value && value.id)}" 
           >
              <span>{{item.text}} (<small>{{item.address}}</small>)</span>
          </stf-select-option>
      </section>
    </stf-select>

    <br>
    <label>Select with input</label>
    <stf-select v-model="value" style="width: 300px; margin: 0 auto">
      <div slot="label">Input address</div>
      <div slot="value">
        <div v-if="value">
           <span>{{value.address}} (<small>{{value.text}}</small>)</span>
        </div>
      </div>
      <div slot="search-input">
          <input @input="onsearch">
      </div>
      <section class="options delivery_order__options">
          <stf-select-option  
           v-for="item of listFinded" :key="item.id"
           :value="item"
           :class="{'stf-select-option_selected': item.id === (value && value.id)}" 
           >
              <span>{{item.text}} (<small>{{item.address}}</small>)</span>
          </stf-select-option>
      </section>
    </stf-select>
  </div>
</template>

<script>
import {StfSelect, StfSelectOption} from './components/stf-select'

export default {
  name: 'app',
  components: {
    StfSelect, 
    StfSelectOption
  },
  created() {
    this.listFinded = this.list;
  },
  data () {
    return {
      value: null,
      list: [
        {
          text: "text1",
          address: "address1",
          id: 1
        },
        {
          text: "text2",
          address: "address2",
          id: 2
        },
        {
          text: "text3",
          address: "address3",
          id: 3
        },
      ],
      listFinded: [
      ]
    }
  },
  methods: {
    onsearch(e) {
      if (e.target.value) {
        this.listFinded = this.list.filter(el => el.text.indexOf(e.target.value) !== -1 || el.address.indexOf(e.target.value) !== -1);
      } else {
        this.listFinded = this.list;
      }
    }
  }

}
</script>

<style>
#app {
  font-family: 'Avenir', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>

options

props: {
    value: [Object, Number, String, Array, Boolean],
    more: Boolean,
    pending: Boolean,
    optionsWrapClass: String,
    needFocusInpOnTab: {
        type: Boolean,
        default: false
    },
},

For detailed explanation on how things work, checkout the DEMO

stf-vue-select's People

Contributors

andreysyagrovskiy avatar gitter-badger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

stf-vue-select's Issues

Failed to execute 'removeChild'

Everything is working just fine, however when I change my page (using vue-router) i always get this error in the console from stf-vue-select.
I am using stf-vue-select in my main-layout which every page uses.

[Vue warn]: Error in beforeDestroy hook: "NotFoundError: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node."

found in

---> <StfSelect>
        <USelect> at src/components/core/USelect.vue
         <LangSelector> at src/components/LangSelector.vue
           <MainMenu> at src/layouts/MainMenu.vue
             <MdToolbar>
               <MdAppToolbar>
                 <MdAppInternalSideDrawer>
                   <MainLayout> at src/layouts/MainLayout.vue
                     <Home> at src/pages/Home.vue
                       <App> at src/App.vue
                         <Root>




vue.esm.js?efeb:1696 DOMException: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.
    at VueComponent.beforeDestroy (webpack-internal:///./node_modules/flexible-vue-select/dist/lib/stf-vue-select.min.js:1:12811)
    at callHook (webpack-internal:///./node_modules/vue/dist/vue.esm.js:2869:21)
    at VueComponent.Vue.$destroy (webpack-internal:///./node_modules/vue/dist/vue.esm.js:2654:5)
    at destroy (webpack-internal:///./node_modules/vue/dist/vue.esm.js:4066:27)
    at invokeDestroyHook (webpack-internal:///./node_modules/vue/dist/vue.esm.js:5600:59)
    at VueComponent.patch [as __patch__] (webpack-internal:///./node_modules/vue/dist/vue.esm.js:5923:30)
    at VueComponent.Vue.$destroy (webpack-internal:///./node_modules/vue/dist/vue.esm.js:2677:8)
    at destroy (webpack-internal:///./node_modules/vue/dist/vue.esm.js:4066:27)
    at invokeDestroyHook (webpack-internal:///./node_modules/vue/dist/vue.esm.js:5600:59)
    at VueComponent.patch [as __patch__] (webpack-internal:///./node_modules/vue/dist/vue.esm.js:5923:30)

console.log

Hi! Thx for base select functionality. However, it would be really great if you remove console.log(window.userAgent) ))
Thx in advance!

onchange

is there an onchange event listener?

Thanks

module not found

 ERROR  Failed to compile with 2 errors                                                                                                      11:21:49

This dependency was not found:

* !!vue-style-loader!css-loader?{"sourceMap":false}!../../../../vue-loader/lib/style-compiler/index?{"vue":true,"id":"data-v-0978a9e7","scoped":false,"hasInlineConfig":false}!sass-loader?{"sourceMap":false}!./stf-select.scss in ./node_modules/stf-vue-select/src/components/stf-select/StfSelect.vue

To install it, you can run: npm install --save !!vue-style-loader!css-loader?{"sourceMap":false}!../../../../vue-loader/lib/style-compiler/index?{"vue":true,"id":"data-v-0978a9e7","scoped":false,"hasInlineConfig":false}!sass-loader?{"sourceMap":false}!./stf-select.scss


This relative module was not found:

* ./components/stf-select in ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0&bustCache!./src/components/HelloWorld.vue

Unknown plugin "transform-runtime"

ERROR in ./~/stf-vue-select/dist/lib/stf-vue-select.min.js
Module build failed: ReferenceError: Unknown plugin "transform-runtime" specified in "/node_modules/stf-vue-select/.babelrc" at 0, attempted to resolve relative to "/node_modules/stf-vue-select"

Select Options in Buefy Modal

When showing the component in a Buefy modal, the select options are shown behind the modal.
It's not a style issue, the position is wrong in the dom.

Refresh position

Is any way to refresh position of options?
Sometime I have a problem like on the screenshot
zaznaczenie_495

Search input should be optional

Is there any posibility to disable search input slot?
When I have selected value and I want to change it, selected value is not visible.

image

image

I have workaround, but passing property for it would be awesome.

.stf-select__search-input {
    display: none !important;
}

.stf-select__search-enabled .stf-select__search-input {
    display: block !important;
}

Vue.use or Vue.component

Hi,
First, thanks a lot for your work. We really like your vue select component but we need to load it without import because our project import Vue with cdn.

Vue.use(StfVueSelect);
Vue.use(StfVueSelectOptions);

or :

Vue.component('stf-select', StfVueSelect);
Vue.component('stf-select-options', StfVueSelectOptions);

It's possible to include this way to load your library and minify it in dist file to load it ? :)
Thanks a lot.

Error when trying to install library

Just tried to add this package to a project using npm install --save stf-vue-select on newest macOS and get this error:

Skjermbilde 2020-04-21 kl  14 04 11

Any idea what is going on?

Be able to specify a container

I would like to be able to specify a container/wrapper element since it the positioning doesn't work right now if you for example use slidebars.js.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.