New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

lyraus-ui

Package Overview
Dependencies
Maintainers
0
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lyraus-ui

[![npm version](https://img.shields.io/npm/v/lyraus-ui.svg)](https://www.npmjs.com/package/lyraus-ui) [![downloads](https://img.shields.io/npm/dm/lyraus-ui.svg)](https://www.npmjs.com/package/lyraus-ui)

  • 0.2.21-b
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-50%
Maintainers
0
Weekly downloads
 
Created
Source

LyrausTable Vue.js Component

npm version downloads

Overview

The LyrausTable component is a versatile table component designed for displaying tabular data in Vue.js applications. It provides various features such as pagination, sticky columns, sorting, filtering, and customizable column rendering.

Installation

npm install lyraus-ui

Usage:

<script>
  import { LyrausTable } from "lyraus-ui";
</script>
<template>
  ...
  <LyrausTable :data="List" :columns="columns" />
  ...
</template>

Column Object

PropsDescriptionExampleTypeDefault
keyIdentifier for using data."orderNo"String
labelColumn title (optional).Order NumberString
widthYou have to give width to use sticky option (optional).80Number
isDateChanges the date format (optional).trueBooleanfalse
dontDisplayTo provent displaying values for a column (optional).trueBooleanfalse
centerCenters the slot component (optional).trueBooleanfalse
maxLengthLimit the displayed text to a specified length (optional).14Number
extraKeysExtra data to show in same column (optional).["unitType"]Array

Table Props

PropsDescriptionExampleTypeDefault
columnsAn array of objects representing the columns of the table. Each object should contain key, label, and width properties.[{ key: "orderNo", label: "Order No", width: 90, isDate:false, extraKeys=["unitType"] }]Array
dataAn array of objects representing the rows of data to be displayed in the table.[{orderNo: 85}]Array
pageCountTotal count of rows in the entire dataset (optional).16Number
pagePropYou have to give your currentPage state to this prop to persist the currentPage data while changing tabs in the app (optional).1Number
searchPropYou have to give your search value to this prop to persist the search data while changing tabs in the app (optional).1Number
totalCountTotal count of pages in the paginated data (optional).324Number
isLoadingBoolean indicating whether data is being loaded (optional).trueBooleanfalse
checkboxColumnEnables a checkbox column (optional).trueBooleanfalse
enablePaginationEnables pagination (optional).trueBooleanfalse
useCheckAllBoxEnables a checkbox in the selectable column to select all rows (optional).trueBooleanfalse
indexColumnEnables index column (optional).trueBooleanfalse
searchBarEnables a search bar above the table (optional).trueBooleanfalse
rightExtraSlotEnables an extra slot at top right side of the table(optional).trueBooleanfalse
batchOperationsEnables batch operation controls (optional).trueBooleanfalse
handleSearchA function to handle search queries (optional).Function
batchOperationsListA list of options for batch operations (optional).Array
clickableColumnsArray of column keys to make columns clickable(optional).['orderNo', 'deliveredName']Array
dblClickableColumnsArray of column keys to make columns double clickable(optional).['orderNo', 'deliveredName']Array
stickyLeftArray of column keys to make columns sticky on the left side(optional).['orderNo', 'deliveredName']Array
stickyRightArray of column keys to make columns sticky on the right side(optional).['dropdownColumn', 'buttonsColumn']Array
alternateRowBgArray of two Tailwind color classes for alternating row background colors(optional).['white', 'gray-100']Array
innerTableAn array representing the inner table columns (optional).[{key: "vehicle",label: "Vehicle",width: "100px", extraKeys=["orderNo"]}]Array
buttonsColumnConfiguration object for rendering custom buttons in a column (optional).{ label: 'İşlem', width: 90 }Object
dropdownColumnsConfiguration array for rendering dropdowns in a column (optional).[{ key: 'status' label: 'Durum', width: 180}]Object
@row-clickFunction for handling row click (optional).(row, index) => handleRowClick(row, index)Function
@dbl-row-clickFunction for handling row double click (optional).(row, index) => handleDblRowClick(row, index)Function
@update-selectedFunction for updating selected checkboxes (optional).(val) => handleSelected(val)Function
@update-search-valueFunction for updating search value (optional).(val) => handleSearchValue(val)Function
@update-selected-batch-opFunction for updating selected batch opertaion (optional).(val) => handleBatchOp(val)Function
@update-current-pageFunction for updating current page (optional).(val) => handleCurrentPage(val)Function
paginationButtonColorTailwind color class of pagination buttons (optional).red-500stringgray-600
paginationHoverColorTailwind color class of pagination buttons on hover (optional).red-600stringgray-700
paginationTextColorTailwind color class of pagination button text (optional).gray-100stringwhite
tableHeightHeight of the table (optional).50vhstring65vh
containerClassTailwind class for the most outer div (optional).string
operationsDivTailwind class for the div containing batch operations and search bar (optional).flex justify-between items-center mb-6stringflex justify-between items-center mb-4
tableClassTailwind class for the table element (optional).min-w-full divide-y divide-red-500stringmin-w-full divide-y divide-gray-200
theadClassTailwind class for the table header element (optional).bg-red-500 sticky top-0 z-10stringbg-gray-50 sticky top-0 z-10
thClassTailwind class for table header cells (optional).py-4 text-left text-xs font-medium bg-red-500 text-gray-500 tracking-wider border-gray-200stringpy-3 text-left text-xs font-medium bg-gray-50 text-gray-500 tracking-wider border-gray-200
tdClassTailwind class for table data cells (optional).whitespace-nowrap border-gray-200 text-mdstringwhitespace-nowrap border-gray-200 text-xs
tbodyClassTailwind class for table body (optional).text-whitestringtext-black
innerTableClassTailwind class for the inner table element (optional).divide-gray-200 border-red-500 sticky left-0 w-screenstringdivide-gray-200 border-gray-300 sticky left-0 w-screen
innerTheadClassTailwind class for the inner table header element (optional).bg-red-500stringbg-gray-50
innerThClassTailwind class for inner table header cells (optional).py-4 text-left text-xs font-medium bg-red-500 text-gray-500 tracking-wider border-gray-200stringpy-2 text-left text-xs font-medium bg-gray-50 text-gray-500 tracking-wider border-gray-200
innerTdClassTailwind class for inner table data cells (optional).whitespace-nowrap text-xsstringwhitespace-nowrap text-xs
innerTbodyClassTailwind class for inner table body (optional).text-whitestring
outerDivClassTailwind class for the outer div wrapping the table(optional).stringoverflow-auto m-2
innerDivClassTailwind class for the inner div wrapping the table (optional).string

Operations

How to use default search bar.

<template>
  <LyrausTable
    :data="List"
    :columns="columns"
    :searchBar="true"
    @update-search-value="(val) => handleSearchValue(val)"
    :handleSearch="handleSearch"
  >
    ...
  </LyrausTable>
</template>

<script>
  export default {
      data () {
          return {
              search: ""
          }
      }
      methods: {
          handleSearchValue(val) {
              this.search = val;
          },
          handleSearch() {
              console.log(this.search);
          },
      }
  }
</script>
Batch Operations:

How to use default batch operations.

<template>
  <LyrausTable
    :data="List"
    :columns="columns"
    :batchOperations="true"
    :batchOperationsList="batchOperationsList"
    @update-selected-batch-op="(val) => handleBatchOp(val)"
  >
    ...
  </LyrausTable>
</template>

<script>
  export default {
      data () {
          return {
              batchOperationsList: [
                  {
                      id: 1,
                      name: "Something One",
                  },
                  {
                      id: 2,
                      name: "Something Two",
                  },
              ],
          }
      }
      methods: {
          handleBatchOp(val) {
             handleAction(val);
          },
          handleAction(val) {
              switch (val) {
                  case '1':
                      console.log('Case 1 In');
                      break;
                  case '2':
                      console.log('Case 2 In');
                      break;
                  default:
                      console.log('Unknown action');
              }
          }
      }
  }
</script>

Slots

Search Bar:

Slot to change default search bar.

<LyrausTable :data="List" :columns="columns">
  <template v-slot:searchBar> < Add Your Custom Search Bar > </template>
</LyrausTable>
Extra Top Right Slot:

Slot for custom component at top right side of the table.

<LyrausTable :data="List" :columns="columns">
  <template v-slot:rightExtra> < Add Your Custom Component > </template>
</LyrausTable>
Batch Operations:

Slot to change default batch operations.

<LyrausTable :data="List" :columns="columns" :batchOperations="true">
  <template v-slot:batchOperations>
    < Add Your Custom Batch Operations Component >
  </template>
</LyrausTable>
Sort Button:

Slot for custom sort buttons in table headers.

<LyrausTable :data="List" :columns="columns">
  <template v-slot:sortButton="{ columnKey }">
    <button
      v-if="columnKey === 'orderNo'"
      class="pr-1"
      @click="triggerSort(columnKey, 'Artan')"
    >
      <i class="fas fa-sort"></i>
    </button>
    <button
      v-if="columnKey === 'outpointAdress'"
      class="pr-1"
      @click="triggerSortTwo(columnKey, 'Artan')"
    >
      <i class="fas fa-sort"></i>
    </button>
  </template>
</LyrausTable>
Filter Button:

Slot for custom filter buttons in table headers.

<LyrausTable :data="List" :columns="columns">
  <template v-slot:filterButton="{ columnKey }">
    <TableStatusPanel
      v-if="columnKey === 'outpointAdress'"
      class="h-4 w-4"
      :statusList="receivedNameStatusList"
      :initialStatus="filterType"
      @setStatusFilter="(val) => (val, handleFilter(val))"
    />
  </template>
</LyrausTable>
Column Dropdown:

Slot for custom dropdowns in column. To use this you have to add dropdownColumn prop. If you want this to stick right side of the screen add :stickyRight=['dropdownColumn'] prop.

<LyrausTable
  :data="List"
  :columns="columns"
  :dropdownColumn="[
      { key: 'Durum', label: 'Durum', width: 180 },
    ]"
>
  <template v-slot:colDropdown="{ item, dropdownKey }">
    <div
      v-if="dropdownKey === 'dropdownColumnDurum'"
      class="table-td w-36 border-r border-opacity-20"
    >
      <ChangeStatus
        :plaque="item.vehicle"
        :defaultTitle="item.stateName"
        :stateId="item.stateId"
        :typeId="item.typeId"
        :planId="item.id"
        :orderNo="item.orderNo"
        :note="item.note"
        @changeVehicle="
                    () => ((selected = item), $modal.show('change-vehicle-modal'))
                "
        @refresh="() => getAll()"
        @vehicleStatu="
                    (r) => (
                        ($refs.vehicleStatu.modalData = {
                            detail: item,
                            activeStatu: r,
                        }),
                    $refs.vehicleStatu.show()
                )
                "
      />
    </div>
  </template>
</LyrausTable>
Column Buttons:

Slot for custom buttons in a column. To use this you have to add buttonsColumn prop. If you want this to stick right side of the screen add :stickyRight=['buttonsColumn'] prop.

<LyrausTable
  :data="List"
  :columns="columns"
  :buttonsColumn="{ label: 'İşlem', width: 90 }"
>
  <template v-slot:colButtons="{ item, index }">
    <div class="flex items-center justify-end space-x-2 px-2">
      <button
        class="px-1 rounded text-sm"
        :disabled="isDisabled"
        @click="editData(item, index)"
      >
        <i class="fas fa-edit"></i>
      </button>
    </div>
    <div class="flex items-center justify-end space-x-2 px-2">
      <button
        class="px-1 rounded text-sm"
        :disabled="isDisabled"
        @click="deleteData(item, index)"
      >
        <i class="fas fa-trash"></i>
      </button>
    </div>
  </template>
</LyrausTable>
Row Buttons:

Slot for custom buttons in each row.

<LyrausTable :data="List" :columns="columns">
  <template v-slot:rowButtons="{ item, index, columnKey }">
    <button
      v-if="columnKey === 'receivedName'"
      @click="handleName(item, index)"
    >
      <img class="w-5 h-5 ml-3" src="../assets/planing/filteredit.svg" alt="" />
    </button>
    <button
      v-if="columnKey === 'outpointAdress'"
      @click="handleLocation(item, index)"
    >
      <img class="w-5 h-5 ml-3" src="../assets/planing/location.svg" alt="" />
    </button>
  </template>
</LyrausTable>

FAQs

Package last updated on 05 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc