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

@dotnetbrightener/vue-modal-dialog-service

v1.0.2

Published

An injected service into your Vue Component for showing Modal Dialogs with ease

Downloads

7

Readme

vue-modal-dialog-service

An injected service into your Vue Component for showing Modal Dialogs with ease

GitHub open issues GitHub

Features

Installation

npm install @dotnetbrightener/vue-modal-dialog-service --save

Usage

Reference the plugin to your main.js

import Vue from 'vue';
import { ModalDialogPlugin } from '@dotnetbrightener/vue-modal-dialog-service';


Vue.use(ModalDialogPlugin);

In your component methods:

... // omitted code
methods: {
    ... // ommited Code
    /**
    *   Show alert dialog with provided message
    */
    async showAlert() {
        await this.$modalDialogService.showAlert(`This is alert message`, `This is alert title`);
    },

    /**
    *   Show confirmation dialog with provided options
    */
    async showConfirmation() {
      const confirmed = await this.$modalDialogService.showConfirmation(`This is confirmation message`,
      `This is confirmation title`, 
      {
        yesText: 'Yes',
        noText: 'No'
      });

      // console.log('confirmed: ', confirmed); // will be true / false
    }
}

Create custom dialog

Create a vue component as you would normally do

<!-- dialog-components/custom-dialog-component.vue -->
<template>
    <div class="modal-content">
        <div class="modal-header" v-if="!!title">
            <h5 class="modal-title">
                Your 'title' props will display here {{ title }}
            </h5>
        </div>
        <div class="modal-body">
            This is content of custom dialog
        </div>
        <div class="modal-footer">
        <button type="button" class="btn btn-primary btn-yes" @click="button1Clicked">
            Button 1
        </button>
        <button type="button" class="btn btn-light" @click="button2Clicked">
            Button 2
        </button>
        </div>
    </div>
</template>
<script>
export default {
    // the props will be passed from your execution
    props: [
        'title',
        'customContent'
    ],
    methods: {
        button1Clicked() {
            alert('you clicked button 1. It will not close the dialog');
        },

        button2Clicked() {
            alert('you clicked button 2. Now it will close the dialog');
            // return whatever you want to the caller by passing the value to .closeModal() method
            // ,closeModal is defined by the service
            this.closeModal('this is response from custom dialog');
        }
    }
};
</script>

In your component method, use the following to display the custom component

... // omitted code
methods: {
    ... // ommited Code
    /**
    *   Show alert dialog with provided message
    */
    async showCustomComponent() {
        const dialogComponent = await import('./dialog-components/custom-dialog-component.vue').then(_ => _.default);

        const dialogResult = await this.$modalDialogService.showModalDialog(dialogComponent, {
            isCenter: true,
            // custom props
            title: 'This is custom props'
        });

        // dialogResult is whatever you return when you call this.closeModal() from the component;
    },
}

Animation

If you would like to have animation in opening dialog modals, add the link to animated css stylesheet in your document's head section

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css" />

Project Development

Setup

npm install

Compiles and hot-reloads for development

npm run serve

Compiles and minifies for production

npm run build

Run your tests

npm run test

Lints and fixes files

npm run lint

Customize configuration

See Configuration Reference.