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

vue3_jspreadsheet

v0.5.2

Published

A simple Vue3 wrapper for JSpreadsheet module, which is awesome in itself.

Downloads

411

Readme

A simple Vue3 wrapper for JSpreadsheet

*** Major update for 0.5.0 ***

modify jspreadsheet-ce's element and moving jsuites' dep into the bundle itself(&removing unused elements)

*** update for 0.4.2 ***

Updated when modelData changes array size (ex. push or pop array item), in both dimensions, the component doestn't update jspreadsheet instance data, now it will act accordingly. No need to manual refresh the component.

*** Major update for 0.4.0 ***

This is a major update. Instead of binding Vue's emit event to each event of JSpreadsheet, this commit uses jspreadsheet's global onevent to communicate changes between Vue modelValue and jspreadsheet instance, making the code less and working with more options such as jspreadsheet's sorting function.

*** Update for 0.3 ***

Fixed Github Issue #2

*** Update for 0.2.5 ***

Fixed a major problematic setting in package.json, which would cause webpack not to compile imported css from node_modules. For Node & webpack users, please must update to version ^0.2.5!

Requirement

Obviously, you need to have your Vue3 properly configured.

Install

node environment

npm install vue3_jspreadsheet

...or with yarn

yarn add vue3_jspreadsheet

CDN

Import js from unpkg.com:

<script src="https://unpkg.com/vue3_jspreadsheet" />

also requires to get the global css setting (from JSpreadsheet & JSuites).

<link rel="stylesheet" href="https://unpkg.com/vue3_jspreadsheet/dist/vue3_jspreadsheet.css"/>

Usage

Node

You'll need to import global css first from the app's entry js file, as such:

import 'vue3_jspreadsheet/dist/vue3_jspreadsheet.css';

then just import the component when you need it, for example:

<template>
  <VueJSpreadsheet v-model="data" />
</template>

<script>
import VueJSpreadsheet from 'vue3_jspreadsheet';
import {ref} from 'vue';

export default {
  components: {
    VueJSpreadsheet
  },
  setup() {
    const data = ref([
      [123,42,4124,"test"],
      [4,525,124,"geg"],
      [4241,"24",32]
    ]);
    return {data};
  },
}
</script>

The result would look like this: image

Browser (CDN) setup

The component would be imported as global object named "VueJSpreadsheet", just register it with Vue. For example:

<!DOCTYPE html>
<html lang="">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <script src="https://unpkg.com/vue"></script>
    <script src="https://unpkg.com/vue3_jspreadsheet"></script>
    <link rel="stylesheet" href="https://unpkg.com/vue3_jspreadsheet/dist/vue3_jspreadsheet.css"/>
  </head>
  <body>
    <div id="app">
    </div>
    <div id="app2">
    </div>
    <script>
        // just mount it as the root component
        var app = Vue.createApp(VueJSpreadsheet);
        app.mount('#app');

        // mount with component register
        var app2 = Vue.createApp({
            template: `
            <VueJSpreadsheet v-model="test_data" />
            `,
            data(){
                return {
                    test_data:[[42,42,42,42]]
                }
            },
        });
        app2.use(VueJSpreadsheet);
        app2.mount('#app2');
    </script>
  </body>
</html>

The result would look like this: image

Props

This component is quite simple. It just wrapps around the original JSpreadsheet. It has the v-model bind to the sheet's data, with bi-directional data flow.

Other custom options of JSpreadsheet are all avaliable via props:options.

Example setting:

<template>
  <VueJSpreadsheet v-model="data" :options="myOption" />
</template>

<script>
import VueJSpreadsheet from "vue3_jspreadsheet";
import { ref } from "vue";

export default {
  components: {
    VueJSpreadsheet,
  },
  setup() {
    const data = ref([
      [42, 42, 42, 42],
      [42, 42, 42, 42],
    ]);
    const myOption = ref({
      search: true,
      columns: [
        { title: "First Column", width: 100 },
        { title: "Second Column", width: 150 },
        { title: "Third Column", width: 200 },
        { title: "Fourth Column", width: 250 },
      ],
    });
    return { data, myOption };
  },
};
</script>

The result would look like this: image