nillud-data-table 1.0.8 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -86,6 +86,7 @@ const data = [{ name: 'Иван' }]
86
86
  | [paginationCounts](#paginationcounts) | - | array<number> | Принимает массив чисел, число - количество строк для пагинации, (0 это все) |
87
87
  | [scrollable](#scrollable) | - | boolean | Зафиксировать высоту таблицы и добавить скролл |
88
88
  | [scrollHeight](#scrollheight) | - | number | Высота тела таблицы, работает, если scrollable: true |
89
+ | [exportSectionComponent](#exportsectioncomponent) | - | import module| Необходимо импортировать модуль ExportSection
89
90
  | [exportCustomColumns](#exportcustomcolumns) | - | array [\{\}] | Принимает в себя массив объектов (\{\ key: string, width: number \}\) |
90
91
  | [excelBtn](#excelbtn) | - | boolean | Показывать кнопку экспорта Excel |
91
92
  | [wordBtn](#wordbtn) | - | boolean | Показывать кнопку экспорта Word |
@@ -413,6 +414,29 @@ scrollable
413
414
  scrollHeight={410}
414
415
  ```
415
416
 
417
+ ### exportSectionComponent
418
+
419
+ Необязательный параметр. Необходимо подключить модуль ExportSection и установить пакеты для экспорта Word и Excel
420
+
421
+ ```bash
422
+ npm i exceljs docx file-saver
423
+ -или-
424
+ yarn add exceljs docx file-saver
425
+ ```
426
+
427
+ Использование:
428
+
429
+ ```tsx
430
+ import { ExportSection } from 'nillud-data-table/export'
431
+
432
+ <DataTable
433
+ tableData={tableData}
434
+ columns={columns}
435
+ tableName={'current-tasks'}
436
+ ExportSectionComponent={ExportSection}
437
+ />
438
+ ```
439
+
416
440
  ### exportCustomColumns
417
441
 
418
442
  Необязательный параметр. Принимает в себя массив объектов формата.
@@ -445,17 +469,6 @@ npm i exceljs
445
469
  yarn add exceljs
446
470
  ```
447
471
 
448
- ```tsx
449
- import ExportExcel from 'nillud-data-table/export/ExportExcel';
450
-
451
- <DataTable>
452
- ...
453
- excelBtn
454
- ExportExcelComponent={ExportExcel}
455
- ...
456
- </DataTable>
457
- ```
458
-
459
472
  ### wordBtn
460
473
 
461
474
  Необязательный параметр. Тип **boolean**, по умолчанию **false**. При значении **true** над таблицей с правой стороны появляется кнопка экспорта Word, которая по умолчанию принимает в себя исходный массив **tableData**
@@ -468,17 +481,6 @@ npm i docx file-saver
468
481
  yarn add docx file-saver
469
482
  ```
470
483
 
471
- ```tsx
472
- import WordExport from 'nillud-data-table/export/WordExport';
473
-
474
- <DataTable>
475
- ...
476
- wordBtn
477
- WordExportComponent={WordExport}
478
- ...
479
- </DataTable>
480
- ```
481
-
482
484
  ### wordOptions
483
485
 
484
486
  Необязательный параметр. Используется вместе с **wordBtn**. Принимает в себя объект
@@ -0,0 +1,69 @@
1
+ import { ReactElement } from 'react';
2
+
3
+ type TableElement = {
4
+ [key: string]: string | number;
5
+ };
6
+ type TableData = Array<TableElement>;
7
+ type Column = {
8
+ field: string;
9
+ title: string;
10
+ width?: number;
11
+ autoinc?: boolean;
12
+ formatter?: (cell: string, row: TableElement) => ReactElement;
13
+ exportCustomCell?: (cell: string, row: TableElement) => string;
14
+ headerFilter?: (headerValue: string, rowValue: string) => string;
15
+ sortable?: boolean;
16
+ filterable?: boolean;
17
+ };
18
+ type ExportOptions = {
19
+ fontSize?: number;
20
+ boldHeaders?: boolean;
21
+ autoLandscape?: boolean;
22
+ maxColumnsBeforeLandscape?: number;
23
+ };
24
+ type TableProps = {
25
+ tableData: TableData;
26
+ columns: Array<Column>;
27
+ tableName: string;
28
+ loading?: boolean;
29
+ loadingElement?: ReactElement | null;
30
+ isFooter?: boolean;
31
+ paginationCounts?: Array<number> | null;
32
+ scrollable?: boolean;
33
+ scrollHeight?: number;
34
+ exportCustomColumns?: Array<{
35
+ header: string;
36
+ key: string;
37
+ width: number;
38
+ }> | null;
39
+ excelBtn?: boolean;
40
+ wordBtn?: boolean;
41
+ downloadSectionLeftSideContent?: ReactElement | null;
42
+ headerGroup?: Array<{
43
+ title: string;
44
+ cols: number;
45
+ }> | null;
46
+ groupBy?: string | null;
47
+ isTitles?: boolean;
48
+ wordOptions?: ExportOptions;
49
+ ExportSectionComponent?: React.ComponentType<{
50
+ wordBtn: boolean;
51
+ excelBtn: boolean;
52
+ downloadSectionLeftSideContent: React.ReactNode;
53
+ tableData: TableData;
54
+ columns: Array<Column>;
55
+ tableName: string;
56
+ exportCustomColumns?: Array<{
57
+ header: string;
58
+ key: string;
59
+ width: number;
60
+ }> | null;
61
+ wordOptions?: any;
62
+ }>;
63
+ };
64
+ type DataTableRef = {
65
+ getData: () => TableData;
66
+ getCurrentData: () => TableData;
67
+ };
68
+
69
+ export type { Column as C, DataTableRef as D, ExportOptions as E, TableProps as T, TableElement as a, TableData as b };
@@ -0,0 +1,17 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactElement } from 'react';
3
+ import { b as TableData, C as Column, T as TableProps, E as ExportOptions } from '../DataTable.types-H_KYwjEQ.js';
4
+
5
+ type Props = {
6
+ wordBtn: boolean;
7
+ excelBtn: boolean;
8
+ downloadSectionLeftSideContent: ReactElement | null;
9
+ tableData: TableData;
10
+ columns: Array<Column>;
11
+ tableName: string;
12
+ exportCustomColumns?: TableProps['exportCustomColumns'];
13
+ wordOptions?: ExportOptions;
14
+ };
15
+ declare const ExportSection: ({ wordBtn, excelBtn, downloadSectionLeftSideContent, tableData, columns, tableName, exportCustomColumns, wordOptions }: Props) => react_jsx_runtime.JSX.Element;
16
+
17
+ export { ExportSection };
package/dist/index.d.ts CHANGED
@@ -1,71 +1,7 @@
1
- import React$1, { ReactElement } from 'react';
1
+ import React from 'react';
2
+ import { T as TableProps, D as DataTableRef } from './DataTable.types-H_KYwjEQ.js';
3
+ export { C as Column, a as TableElement } from './DataTable.types-H_KYwjEQ.js';
2
4
 
3
- type TableElement = {
4
- [key: string]: string | number;
5
- };
6
- type TableData = Array<TableElement>;
7
- type Column = {
8
- field: string;
9
- title: string;
10
- width?: number;
11
- autoinc?: boolean;
12
- formatter?: (cell: string, row: TableElement) => ReactElement;
13
- exportCustomCell?: (cell: string, row: TableElement) => string;
14
- headerFilter?: (headerValue: string, rowValue: string) => string;
15
- sortable?: boolean;
16
- filterable?: boolean;
17
- };
18
- type ExportOptions = {
19
- fontSize?: number;
20
- boldHeaders?: boolean;
21
- autoLandscape?: boolean;
22
- maxColumnsBeforeLandscape?: number;
23
- };
24
- type TableProps = {
25
- tableData: TableData;
26
- columns: Array<Column>;
27
- tableName: string;
28
- loading?: boolean;
29
- loadingElement?: ReactElement | null;
30
- isFooter?: boolean;
31
- paginationCounts?: Array<number> | null;
32
- scrollable?: boolean;
33
- scrollHeight?: number;
34
- exportCustomColumns?: Array<{
35
- header: string;
36
- key: string;
37
- width: number;
38
- }> | null;
39
- excelBtn?: boolean;
40
- wordBtn?: boolean;
41
- downloadSectionLeftSideContent?: ReactElement | null;
42
- headerGroup?: Array<{
43
- title: string;
44
- cols: number;
45
- }> | null;
46
- groupBy?: string | null;
47
- isTitles?: boolean;
48
- wordOptions?: ExportOptions;
49
- ExportSectionComponent?: React.ComponentType<{
50
- wordBtn: boolean;
51
- excelBtn: boolean;
52
- downloadSectionLeftSideContent: React.ReactNode;
53
- tableData: TableData;
54
- columns: Array<Column>;
55
- tableName: string;
56
- exportCustomColumns?: Array<{
57
- header: string;
58
- key: string;
59
- width: number;
60
- }> | null;
61
- wordOptions?: any;
62
- }>;
63
- };
64
- type DataTableRef = {
65
- getData: () => TableData;
66
- getCurrentData: () => TableData;
67
- };
5
+ declare const DataTable: React.ForwardRefExoticComponent<TableProps & React.RefAttributes<DataTableRef>>;
68
6
 
69
- declare const DataTable: React$1.ForwardRefExoticComponent<TableProps & React$1.RefAttributes<DataTableRef>>;
70
-
71
- export { type Column, DataTable, type DataTableRef, type TableElement, type TableProps };
7
+ export { DataTable, DataTableRef, TableProps };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nillud-data-table",
3
- "version": "1.0.8",
3
+ "version": "1.1.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -16,7 +16,7 @@
16
16
  },
17
17
  "./export": {
18
18
  "import": "./dist/export/index.js",
19
- "types": "./dist/index.d.ts"
19
+ "types": "./dist/export/index.d.ts"
20
20
  },
21
21
  "./types": "./dist/index.d.ts",
22
22
  "./styles.css": "./dist/styles.css"
@@ -37,7 +37,7 @@
37
37
  "typescript": "^5.8.3"
38
38
  },
39
39
  "scripts": {
40
- "build": "tsup && npm run build:styles",
40
+ "build": "tsup && node postbuild.js && npm run build:styles",
41
41
  "build:styles": "node build-styles.js"
42
42
  }
43
43
  }