3.1.6 • Published 2 years ago

@asurraa/sura-ui-table v3.1.6

Weekly downloads
321
License
-
Repository
github
Last release
2 years ago

Storybook

@asurraa/sura-ui-table

Extendable on top of AntdTable with multiple functional and use Internally at AsuRaa.

yarn add @asurraa/sura-ui-table

CASL Integration

import { AsurRaaTable } from "@asurraa/sura-ui-table/dist/AsurRaaTable";
import type { AsurRaaTableProps as OriginProps } from "@asurraa/sura-ui-table/dist/AsurRaaTable";
import { AbilitySubjects } from "@src/casl/ability";

// ? see https://stackoverflow.com/questions/41285211/overriding-interface-property-type-defined-in-typescript-d-ts-file
type Modify<T, R> = Omit<T, keyof R> & R;

export declare module "@asurraa/sura-ui-table/dist/AsurRaaTable" {
  export declare interface AsurRaaTableProps
    extends Modify<
      OriginProps,
      Required<{
        abilitySubjects: AbilitySubjects;
      }>
    > {}
}

Installation

  1. Wrap Provider
// app.tsx
import react from "react";
import { AsurRaaTableProvider } from "@asurraa/sura-ui/table";

const App = () => {
  return (
    <div>
      <AsurRaaTableProvider>
        <Page />
      </AsurRaaTableProvider>
    </div>
  );
};
  1. Table Usages
import { Tag } from "antd";
import React from "react";
import AsurRaaTable, {
  AsurRaaColumnsInterface,
} from "../../components/asurraa-table/AsurRaaTable";
import {
  useGetAllProduct,
  refreshProductServices,
} from "../../services/product.service";

const ServicesPage = () => {
  const { data, isError, isLoading } = useGetAllProduct();
  const column: Array<AsurRaaColumnsInterface> = [
    {
      title: "Product Name",
      width: 100,
      dataIndex: "productname",
      key: "name",
      fixed: "left",
    },
    {
      title: "Quantity",
      width: 100,
      dataIndex: "quantity",
      key: "quantity",
      // fixed: "left",
    },
    {
      title: "Unit",
      dataIndex: "unit",
      key: "unit",
      width: 150,
    },
    {
      title: "Price",
      dataIndex: "price",
      key: "price",
      width: 150,
    },
    {
      title: "Status",
      dataIndex: "status",
      key: "3",
      width: 150,
      render: (props) => {
        //console.log("props", props);
        return <Tag>{props.toString()}</Tag>;
      },
    },
    {
      title: "Id",
      dataIndex: "id",
      key: "4",
      width: 150,
    },
  ];

  return (
    <div>
      <AsurRaaTable
        antdTableProps={{ bordered: true, loading: isLoading }}

        createButton={{
          onClick: () => //console.log("hi"),
        }}
        refreshButton={{
          onClick: () => refreshProductServices(),
        }}
        deleteActionButton={(props) => ({

          onOk: () => //console.log("props with delete", props),
        })}
        asurRaaColumnProps={column}
        data={data?.data}
      />
    </div>
  );
};

export default ServicesPage;
3.1.3

2 years ago

3.1.2

2 years ago

3.1.1

2 years ago

3.1.6

2 years ago

3.1.5

2 years ago

3.1.4

2 years ago

3.0.45

2 years ago

3.0.46

2 years ago

3.0.44

2 years ago

3.0.49

2 years ago

3.0.47

2 years ago

3.0.48

2 years ago

3.0.54

2 years ago

3.0.55

2 years ago

3.0.53

2 years ago

3.0.50

2 years ago

3.0.51

2 years ago

3.1.0

2 years ago

3.0.43

2 years ago

3.0.41

2 years ago

3.0.42

2 years ago

3.0.40

2 years ago

3.0.34

2 years ago

3.0.35

2 years ago

3.0.33

2 years ago

3.0.38

2 years ago

3.0.39

2 years ago

3.0.36

2 years ago

3.0.37

2 years ago

3.0.30

2 years ago

3.0.31

2 years ago

3.0.29

2 years ago

3.0.16

2 years ago

3.0.17

2 years ago

3.0.15

2 years ago

3.0.23

2 years ago

3.0.24

2 years ago

3.0.21

2 years ago

3.0.22

2 years ago

3.0.27

2 years ago

3.0.28

2 years ago

3.0.25

2 years ago

3.0.26

2 years ago

3.0.20

2 years ago

3.0.18

2 years ago

3.0.19

2 years ago

3.0.12

2 years ago

3.0.13

2 years ago

3.0.10

2 years ago

3.0.11

2 years ago

3.0.14

2 years ago

3.0.9

3 years ago

3.0.8

3 years ago

3.0.7

3 years ago

3.0.4

3 years ago

3.0.3

3 years ago

3.0.2

3 years ago

2.1.1

3 years ago

2.1.0

3 years ago

3.0.1

3 years ago

3.0.0

3 years ago

2.0.11

3 years ago

2.0.10

3 years ago

2.0.9

3 years ago

2.0.8

3 years ago

2.0.7

3 years ago

2.0.6

3 years ago

2.0.3

3 years ago

2.0.5

3 years ago

2.0.4

3 years ago

2.0.2

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.0.0

3 years ago

0.0.18

3 years ago

0.0.15

3 years ago

0.0.14

3 years ago

0.0.10

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago