npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vue-simple-complete

v1.2.0

Published

https://github.com/rohitkvv/vue-simple-complete/releases/tag/1.2.0

Downloads

129

Readme

vue-simple-complete

https://github.com/rohitkvv/vue-simple-complete/releases/tag/1.2.0

Description

A simple autocomplete input 🔨 built using Vue.JS & Typescript

DeepScan grade Language grade: JavaScript Snyk Vulnerabilities for GitHub Repo

Project setup

yarn add vue-simple-complete

npm i vue-simple-complete

<script>
  import VueSimpleComplete from "vue-simple-complete";

  export default {
    name: 'app',
    data() {
    },
    components: {
      VueSimpleComplete
    },
  };
</script>

Wiki

| Props | Type | Description | |-----------------|-----------|---------------| | :items | Array | This contains data for the auto-complete, this can either be an array of string or an array of custom objects| | :objectMatchkey | String | This is required if the items is of type object array. The objectMatchKey then becomes the key that is used within the match function | | :template | Object | This is required if the items is of type object array. The template is then used to display the items as per the defined template. If the template is not defined then ObjectMatchKey will be used to form the items display |

| Function | Type | Description | |------------------|-----------|---------------| | @inputChanged | Function | When input is changed this event gets fired. The consumers of the vue-simple-complete component can listen to this event and get the entered or selected value |

📄 Additional Info:

  • The component comes with a basic styling, and the items panel usually takes the full width of the container it's placed in. To contain it's width, it can be wrapped within a div with custom width.
  • Up & Down keys can be used to go over the items in the list.
  • Down key can be used to open the items panel, when the panel is collapsed.
  • Esc key will clear out the selected value when the focus is on the input

Example-1: With items of Object type

<vue-simple-complete
        :items="items"
        :objectMatchkey="objectMatchkey"
        :template="template"
        @inputChanged="onInputChanged">
</vue-simple-complete>

<script>
  import VueSimpleComplete from "vue-simple-complete";

  export default {
    name: 'app',
    components: {
      "vue-simple-complete": VueSimpleComplete
    },
    data() {
        return {
            items: [
                { Id: 1, Name: "Amsterdam" },
                { Id: 2, Name: "Berlin" },
                { Id: 3, Name: "London" },
                { Id: 4, Name: "Mumbai" }
            ],
            objectMatchkey: "Name",
            template: {
                keys: ["Id", "Name"],
                separator: ", "
            },
            changedInput: ""
        };
    },
    methods: {
        onInputChanged(value) {
            this.changedInput = value;
        }
    }
  };
</script>

ObjectImage1 ObjectImage2 ObjectImage3

Example-2: With items of string type

<vue-simple-complete
        :items="items"
        @inputChanged="onInputChanged">
</vue-simple-complete>

<script>
  import VueSimpleComplete from "vue-simple-complete";

  export default {
    name: 'app',
    components: {
      "vue-simple-complete": VueSimpleComplete
    },
    data() {
        return {
            items: [
                "Amsterdam",
                "Berlin",
                "London",
                "Mumbai"
            ],
            changedInput: ""
        };
    },
    methods: {
        onInputChanged(value) {
            this.changedInput = value;
        }
    }
  };
</script>

StringImage1 StringImage2 StringImage3

Note:

There is a known issue where you will see the following error when you import the component into a TypeScript project

Could not find a declaration file for module 'vue-simple-complete'.
Try `npm install @types/vue-simple-complete` if it exists or add a new declaration (.d.ts) file containing `declare module 'vue-simple-complete';`

As a temporary solution, please edit your TypeScript Config file (tsconfig.json) and add a new key value pair, as -


"noImplicitAny": false