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

am_table_vue

v2.2.2

Published

This template should help you get started with Vue 3 development as a ready-made table that offers various services and integrates easily with various projects

Downloads

4

Readme

am_table_vuejs_componenet

This template should help you get started with Vue 3 development as a ready-made table that offers various services and integrates easily with various projects

table image, table image

Demo

Discover Demo.

Features

  • Sorting
    • Allow users to click on table headers to sort data in ascending or descending order.
  • Filtering
    • Enable filtering of data based on different types, such as text, numbers, dates, etc.
    • Implement filter inputs or dropdowns for each column to allow users to enter filter criteria.
    • Apply filters dynamically as users input their criteria.
  • Pagination
    • Divide the data into pages and display a set number of rows per page.
    • Provide pagination controls (e.g., previous, next, page numbers) to navigate between pages.
    • Allow users to configure the number of rows per page.
  • Search
    • mplement a search input to allow users to search for data by any field.
    • Dynamically update the table to display only the rows that match the search criteria.
    • Provide options to perform case-sensitive or case-insensitive searches.
  • Card View
    • Provide an option to switch between table view and card view.
    • Display relevant information in the card, including images, titles, descriptions, etc.
  • Responsive Design
    • Ensure that the table or card view is responsive and adjusts to different screen sizes.
    • responsive behavior for columns, pagination, and any other relevant elements.
  • Dark mode
  • hide fields
    • You can hide fields as simply as possible
  • Selected Rows
    • You can Select Rows by Checkbox for export or perform other operations

Installation

Install amtablevuecomponenet with npm

  npm install am_table_vue
  npm i am_table_vue

Usage/Examples

<template>
  <AmhVueTable
    :data="state.data"
    :columns="state.columns"
    :config="state.config"
  >
    <!-- to render the html code -->
    <template v-slot="{ column, row }">
      <div v-if="column.title == 'Actions'">
        <button @click="add(row.name)">add</button>
      </div>
    </template>
  </AmhVueTable>
</template>
<script setup>
   import { reactive } from "vue";
  import AmhVueTable from "am_table_vue";
   // import css
   import "am_table_vue/dist/style.css";

   const state = reactive({
     data: [
       {
         name: "ahmed",
         age: 22,
         adresse:'Tamri Agadir'
         aviable: 1,
         date: new Date("12/05/2022"),
         image: "https://via.placeholder.com/640x480.png/0033aa?text=dolore",
       },
       {
         name: "hasan",
         age: 33,
         adresse:'Taghazout Agadir',
         aviable: 1,
         date: new Date("12/06/2022"),
         image: "https://via.placeholder.com/640x480.png/0033aa?text=dolore",
       },
     ],

     columns: [
       {
         title: "Name",
         field: "name",
         EnableFilter: true,
         sortable: true,
         filterOptions: {
           InputType: "text",
           placeholder: "filter By Name",
         },
       },
        {
       title: "Adresse",
       field: "adresse",
       hidden:true,
       EnableFilter: true,
       sortable: true,
       filterOptions: {
         InputType: "text",
         placeholder: "filter By Name",
       },
     },

       {
         title: "AGE",
         field: "age",
         EnableFilter: true,
         sortable: true,
         filterOptions: {
           InputType: "text",
           placeholder: "filter By age",
         },
       },
       {
         title: "Aviable",
         field: "aviable",
         EnableFilter: true,
         sortable: true,
         filterOptions: {
           InputType: "select",
           placeholder: "filter By aviablity",
           filterSelectOptions: [
             { title: "all", selected: true },
             { title: "aviable", value: "1" },
             { title: "non aviable", value: "0" },
           ],
         },
       },
       {
         title: "Date",
         field: "date",
         isDate: true,
         dateMomentFormat: "L", // use momentjs formats
         EnableFilter: true,
         filterOptions: {
           InputType: "date",
           placeholder: "filter By Date",
         },
       },
       {
         title: "Image",
         field: "image",
         Cssclass: "imageClass",
         isImage: true,
         EnableFilter: false,
       },
       {
         title: "Actions",
         isHtml: true,
         EnableFilter: false,
       },
     ],
     config: {
       EnableSearch: true,
       searchplaceholder: "Search in Table",
       EnableUseDarkMode: true,
       EnableCardsTemp: true,
       SearchInFields: ["name", "age", "date"],
       EnablePagination: true,
       PaginationConfig: {
         itemsPerPage: 3,
         CurrentPage: 1,
       },
     },
   });

   const add = (name) => {
     console.log(name);
   };
</script>

Available props

| Attribute | Type | Default | required | description | | :-------- | :--------------: | --------: | :------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | | data | Array of objects | null , [] | true | This attribute define the data to be displayed in the table | | columns | Array of objects | null ,[] | true | This attribute defines which columns will be displayed in the table, if you will allow fields to be filtered or sorted by this column, if you want to hide it can be specified here | | config | object | {} | true | This attribute defines table settings such as applying pagination, dark mode, and table search, as well as allowing data to be displayed as cards |

Available Events

| Events | Description | | :-------------------- | :--------------------------------------------------------------------------------------------: | | @SelectedRows-Changed | This event occurs whenever a row selection when you enbale EnableselectOption in cofnfig props |

Explanation of using config props

Here we define the able configuration

config: {

EnableSearch: True or False if you want to enable all table searching,

searchplaceholder: all table searching placeholder,

EnableUseDarkMode: true or false if you want to use dark mode or not,

SearchInFields: ["field1", "field2"], // Determine the fields that are used in the comprehensive search

EnableCardsTemp: true or false if you want provide an option to switch between table view and card view,

EnablePagination: true or false to enable pagination or not,

PaginationConfig: { // if pagination enbled this object for config the pagination

itemsPerPage: 3, // number of items by page

CurrentPage: 1, // start page or current page

},

},

Explanation of using columns props

Here we define the columns

columns: [ {

title: The defined title for the column that will appear in the table columns,

field:The field as it is in object data in order to fetch the data related to this field,

hidden:true or flase if you want to hide fields or not,

EnableFilter: true or false In order to allow table filtering using this column ,

EnableselectOptions: true or false to allow check rows for export or other operations ,

sortable: true or false In order to allow table sorting using this column ,

isDate: true or false We specify if this field is for the date ,

dateMomentFormat: this field is for the date choose the format from momentjs between 'l', 'LL', 'LLL', 'lll', 'LLLL', 'llll', 'L',

isImage: true or false We specify if this field is for the image ,

isHtml: true or false We specify if this field is for the render html code ,

filterOptions: An object with which we define filter settings { InputType: type of filter input text for number and string or select or date for filtring date,

filterSelectOptions: [ // if InputType is select { title: 'select option title', value: 'select option value' }, ]

placeholder:"placeholder for filtring input element",

},

},

]

<script setup>
  import { reactive } from "vue";

  const state = reactive({
    // exemple
    columns: [
      {
        title: "Name",
        field: "name",
        isImage: false,
        isHtml: false,
        isDate: false,
        EnableFilter: true,
        sortable: true,
        filterOptions: {
          InputType: "text",
          placeholder: "filter By name",
        },
      },
    ],
  });
</script>

Explanation of using data props

This table contains objects that contain data that populates the table from the field specified in the column for each field

<script setup>
  import { reactive } from "vue";

  const state = reactive({
    data: [
      {
        name: "ahmed",
        age: 22,
        aviable: 1,
        date: new Date("12/05/2022"),
        image: "https://via.placeholder.com/640x480.png/0033aa?text=dolore",
      },
    ],
  });
</script>

hide field

<template>
  <AmhVueTable
    :data="state.data"
    :columns="state.columns"
    :config="state.config"
  >
  </AmhVueTable>
</template>
<script setup>
  import { reactive } from "vue";
  import AmhVueTable from "am_table_vue";
   // import css
   import "am_table_vue/dist/style.css";

  const state = reactive({
   data: [
      {
        name: "ahmed",
        age: 22,
        aviable: 1,
        date: new Date("12/05/2022"),
        image: "https://via.placeholder.com/640x480.png/0033aa?text=dolore",
      },

    ],

    columns: [
      {
        title: "Name",
        field: "name",
        hidden:true , // to hide field name
        EnableFilter: true,
        sortable: true,
        filterOptions: {
          InputType: "text",
          placeholder: "filter By Name",
        },
      },
      {
        title: "AGE",
        field: "age",
        EnableFilter: true,
        sortable: true,
        filterOptions: {
          InputType: "text",
          placeholder: "filter By age",
        },
      },
    ]
     config: {
      EnableSearch: true,
      searchplaceholder: "Search in Table",
      EnableUseDarkMode: true,
      EnableCardsTemp: true,
      SearchInFields: ["name", "age", "date"],
      EnablePagination: true,
      PaginationConfig: {
        itemsPerPage: 3,
        CurrentPage: 1,
      },
    },
  });
</script>

Select Rows field

<template>
  <!-- @SelectedRows-Changed : This event occurs whenever a row selection -->
  <AmhVueTable
    :data="state.data"
    :columns="state.columns"
    :config="state.config"
    @SelectedRows-Changed="GetCheckedData"
  >
  </AmhVueTable>
</template>
<script setup>
  import { reactive } from "vue";
  import AmhVueTable from "am_table_vue";
   // import css
   import "am_table_vue/dist/style.css";

  const state = reactive({
   data: [
      {
        name: "ahmed",
        age: 22,
        aviable: 1,
        date: new Date("12/05/2022"),
        image: "https://via.placeholder.com/640x480.png/0033aa?text=dolore",
      },

    ],

    columns: [
      {
        title: "Name",
        field: "name",
        hidden:false ,
        EnableFilter: true,
        sortable: true,
        filterOptions: {
          InputType: "text",
          placeholder: "filter By Name",
        },
      },
      {
        title: "AGE",
        field: "age",
        EnableFilter: true,
        sortable: true,
        filterOptions: {
          InputType: "text",
          placeholder: "filter By age",
        },
      },
    ]
     config: {
      EnableSearch: true,
      searchplaceholder: "Search in Table",
      EnableUseDarkMode: true,
      EnableCardsTemp: true,
      SearchInFields: ["name", "age", "date"],
      EnablePagination: true,
      EnableselectOptions:true, // Enable Select Rows
      PaginationConfig: {
        itemsPerPage: 3,
        CurrentPage: 1,
      },
    },
  });

  // for use selected data :
  const GetCheckedData = (data) => {
    // selected data
    console.log(data)
  }
</script>

🔗 Links

portfolio linkedin