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

@mamenko/editable-table

v0.1.4

Published

Vue 3 (Vuetify 3 based) tablelike component

Downloads

16

Readme

EditableTable

This component is a Vue 3 (Vuetify 3 based) editable table designed for use in web applications.

Installation

You can install the component via npm:

npm install --save @mamenko/editable-table

Usage

<template>
  <EditableTable :columns="columns" :rows="rows" />
</template>

<script>
import EditableTable from '@mamenko/editable-table';

export default {
  components: {
    EditableTable
  },
  data() {
    return {
      columns: [
        // Define column structure here
      ],
      rows: [
        // Define row data here
      ]
    };
  }
};
</script>

Props

  • autoAddRow (Boolean, default: true): Automatically add a new row when trying to move to the next row from the last one.
  • border (Boolean): Sets borders for table cells and header.
  • columns (Array, required): Array of objects describing the structure of table columns.
  • height (String): Height of the table container.
  • noHeader (Boolean): Disables table header.
  • noSoundOnError (Boolean): Disables sound on validation error.
  • readonly (Boolean): Prevents editing of the table.
  • rows (Array, required): Array of objects representing table row data.

Structure of Column Objects

  • class (String): Column class if needed.
  • format (String): Value format string for the column. Use {0} for simple type; {title}, {value}, etc for object type as placeholders. HTML accepted. Example: <i>{0}</i>, {title} ({value}).
  • items (Array|Object): Column items. Can be an array of strings or an object containing:
    • values: array of strings OR objects with fields {title: String, value: Number|String, subtitle: String};
    • exact: boolean (default: false, always true if value is set);
    • filterSubtitle: boolean (default: true, false if no subtitle) set to false to prevent subtitle filtering;
    • search: function (value) returning new values array.
  • key (String, required): Unique key for the column.
  • label (String): Column label.
  • type (String): Column type (text, email, tel, number, date, time).
  • editable (Boolean): Flag for column editability.
  • validation (String|Function): Column validation standard string (int, number, required) or function (value, rowIndex: Number, columnKey: String) returning true or error message.
  • width (Number): Column width (1-12) in Vuetify grid units.

Events

  • update (rows: Array): Triggered when a row's data is updated.
  • validationError ({rowId: number, columnKey: string, value: any, message: string}): Triggered when a validation error occurs.

Styles

CSS variables define various visual aspects of the editable table component, such as cell outlines, header styles, and row borders. These properties can be customized or overridden to achieve the desired visual appearance of the table. Default values use variables from Vuetify.

  .editable-table {
    --cell-error-outline: 2px solid rgb(var(--v-theme-error));
    --cell-focused-outline: 2px solid rgb(var(--v-theme-primary));
    --cell-focused-outline-non-active: 2px solid rgba(var(--v-theme-primary), var(--v-disabled-opacity));
    --cell-focused-outline-offset: -2px;
    --header-background-color: rgb(var(--v-theme-surface-light));
    --header-border: 1px solid rgba(var(--v-border-color), var(--v-border-opacity));
    --header-bottom-border: 4px double rgba(var(--v-border-color), var(--v-border-opacity));
    --header-font-weight: bold;
    --header-text-align: center;
    --header-text-color: rgb(var(--v-theme-on-surface-light));
    --row-border: 1px solid rgba(var(--v-border-color), var(--v-border-opacity));
  }

These styles for header, rows and cells can be customized too:

.editable-table-header
.editable-table-row
.editable-table-cell

Example

Component in action on site.

Source.

Dependencies

This component requires vue version 3.4.0 and above; vuetify version 3.6.4 and above.

License

This project is licensed under the MIT License.

Author

Zhenya Mamenko