Socket
Book a DemoInstallSign in
Socket

@ilb/antd-tables

Package Overview
Dependencies
Maintainers
6
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ilb/antd-tables

Библиотека для упрощения создания таблиц с CRUD-действиями

1.1.0
latest
npmnpm
Version published
Weekly downloads
0
Maintainers
6
Weekly downloads
 
Created
Source

antd-tables

Библиотека для упрощения создания таблиц с CRUD-действиями

Пример:

// schema - ajv-схема для формы создания/редактирования записи. + На основе нее формируются колонки таблицы
const schema = {
  type: "object",
  properties: {
    name: {
      title: "Название",
      type: "string",
    },
    code: {
      title: "Код",
      type: "string",
    },
  },
  required: ["name", "code"],
};

// resource - обьект с функциями getList, create, update и delete
const resource = {
  getList: async () => {
    // получение списка записей
    return [
      {
        id: 1,
        name: "Создано",
        code: "CREATED"
      },
      {
        id: 2,
        name: "Завершено",
        code: "COMPLETED"
      },
    ]
  },
  create: async () => {
    // создание записи 
  },
  update: async () => {
    // изменение записи
  },
  delete: async () => {
    // удаление записи
  },
};

// config - параметры таблицы
// config.title - текст заголовка таблицы
// config.withId - отображать ли в таблице id записи

// access - массив с параметрами доступа: 
//  * create - можно добавлять записи
//  * update - можно редактировать записи
//  * delete - можно удалять записи

<SimpleEditableTable
  schema={schema}
  resource={resource}
  config={{ title: "Статусы", withId: true }}
  access={["create", "update", "delete"]}
/>;

FAQs

Package last updated on 04 Jun 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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.