1.2.9 • Published 3 years ago

@acodez/table v1.2.9

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

@acodez/table

npm_version license



Installation

npm install @acodez/table

Props API

PropertyTypeRequiredDefault valueDescription
headingsarrayyesheadings of table
rowsarrayyesarray of data
isCheckablebooleannofalsewhether rows can be selected
pageCheckedLabelstringno | label for items in page selected
ultimateCheckedLabelstringno | label for all items in list including all pages selected
isCheckablebooleannofalsewhether rows can be selected
isAllCheckedbooleannofalsecheck if all rows in page is selected
isUltimatedCheckedbooleannofalsecheck if all entries in list including all pages is selected
onCheckfunctionno | function to check single entry
onAllCheckfunctionno | function to check all entries in page
onUltimateCheckfunctionno | function to check all entries in list including all pages
buttonsarraynoempty arrayrow actions
checkedstringno
tablestylestringno | table style 'gapped' or not
sizestringno | table size (medium or empty)
backgroundColorstringno | table background color (grey or empty)
bulkactionsarraynoempty arraybulk actions for those rows selected

Usage

import Table from '@acodez/table';
import '@acodez/table/dist/index.css';

function CourseCard({ rowData, value }) {
  return (
    <div>
      <h5 style={{ fontSize: 18 }}>The Complete JavaScript Course 2020: From Zero to Expert!</h5>
    </div>
  );
}


       const COURSE_LISTING_HEADINGS = [
          {
            label: 'TITLE',
            key: 'title',
            type: 'custom',
            style: { fontSize: '22px' },
            component: CourseCard,
            sortable: true,
          },
          { label: 'STATUS', key: 'status', sortable: true, type: 'status' },
          {
            label: 'RATING',
            key: 'rating',
            style: { fontSize: '22px' },
            currency: '$',
            type: 'currency',
            sortable: true,
          },
          { label: 'ENROLLMENT', key: 'enrollment', style: { fontSize: '22px' }, sortable: true },
          { label: 'MATERIALS', key: 'materialCount', style: { fontSize: '22px' }, sortable: true },
        ]
         const data = [
            {
              "isPublished": false,
              "status": "Draft",
              "rating": 0,
              "enrollment": 0,
              "materialCount": 0,
              "title": "dg",
              "subject": []
            },
            {
              "isPublished": false,
              "status": "Active",
              "rating": 0,
              "enrollment": 0,
              "materialCount": 0,
              "title": "sfgsd",
              "subject": []
            },

            {
              "isPublished": false,
              "status": "Active",
              "rating": 0,
              "enrollment": 0,
              "materialCount": 0,
              "title": "Test",
              "subject": []
            },
            {
              "isPublished": false,
              "status": "Active",
              "rating": 0,
              "enrollment": 0,
              "materialCount": 0,
              "title": "English 5",
              "subject": []
            },
            {
              "isPublished": false,
              "status": "Active",
              "rating": 0,
              "enrollment": 0,
              "materialCount": 0,
              "title": "ds",
              "subject": []
            },
            {
              "isPublished": false,
              "status": "Active",
              "rating": 0,
              "enrollment": 0,
              "materialCount": 0,
              "title": "English",
              "subject": []
            },

            {
              "isPublished": true,
              "status": "Draft",
              "rating": 0,
              "title": "9th Std",
              "subject": [
                {
                  "status": "Active",
                  "isDeleted": true,
                  "title": "Maths",
                  "chapter": []
                }
              ],
              "enrollment": 0,
              "materialCount": 0
            },
            {
              "isPublished": true,
              "status": "Active",
              "rating": 0,
              "title": "Monsoon",
              "subject": [
                {
                  "status": "Active",
                  "isDeleted": false,
                  "title": "hi",
                  "chapter": []
                }
              ]
            },
          ]


       <Table
            size="medium"
            onSort={() => { }}
            headings={COURSE_LISTING_HEADINGS}
            rows={data}
            buttons={[
              {
                action: (data) => {
                  history.push(`/courses/${data._id}/details`);
                },
                label: 'edit',
              },
              {
                action: (id) => {
                  deleteCourse(id._id);
                },
                type: 'modal',
                confirmText: 'Delete',
                label: 'delete',
              },
              {
                icon: more,
                label: 'list',
                type: 'list',
                items: [
                  {
                    label: 'Send Email',
                    onClick: (id) => {
                      alert(id);
                    },
                  },
                  {
                    label: 'Send Notificaion',
                    onClick: () => { },
                  },
                ],
              },
            ]}
          />
1.2.9

3 years ago

1.2.8

3 years ago

1.2.7

3 years ago

1.2.6

3 years ago

1.2.5

3 years ago

1.2.4

3 years ago

1.2.3

3 years ago

1.2.2

3 years ago

1.2.1

3 years ago

1.2.0

3 years ago

1.1.6

3 years ago

1.1.5

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.0.15

3 years ago

1.0.14

3 years ago

1.0.13

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.9

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago