nillud-data-table 1.0.4 → 1.0.5

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.
Files changed (3) hide show
  1. package/README.md +12 -8
  2. package/dist/index.js +17 -18
  3. package/package.json +1 -7
package/README.md CHANGED
@@ -434,19 +434,23 @@ excelCustomColumns={[
434
434
 
435
435
  Для использования модуля Excel необходимо установить библиотеку [exceljs](https://www.npmjs.com/package/exceljs)
436
436
 
437
- Для использования модуля экспорта необходимо его подключить
438
- ```ts
439
- import { exportToExcel } from 'nillud-data-table/export-excel';
440
- ```
437
+ ```bash
438
+ npm i exceljs
439
+ -или-
440
+ yarn add exceljs
441
+ ```
441
442
 
442
443
  ### wordBtn
443
444
 
444
445
  Необязательный параметр. Тип **boolean**, по умолчанию **false**. При значении **true** над таблицей с правой стороны появляется кнопка экспорта Word, которая по умолчанию принимает в себя исходный массив **tableData**
445
446
 
446
- Для использования модуля экспорта необходимо его подключить
447
- ```ts
448
- import { exportToWord } from 'nillud-data-table/export-word';
449
- ```
447
+ Для использования модуля Word необходимо установить библиотеки [docx](https://www.npmjs.com/package/docx) и [file-saver](https://www.npmjs.com/package/file-saver)
448
+
449
+ ```bash
450
+ npm i docx file-saver
451
+ -или-
452
+ yarn add docx file-saver
453
+ ```
450
454
 
451
455
  ### wordOptions
452
456
 
package/dist/index.js CHANGED
@@ -393,22 +393,6 @@ function useDebouncedEffect(callback, deps, delay) {
393
393
  }, [...deps, delay]);
394
394
  }
395
395
 
396
- // components/export/WordExport.tsx
397
- import {
398
- AlignmentType,
399
- Document,
400
- Packer,
401
- PageOrientation,
402
- Paragraph,
403
- Table,
404
- TableCell,
405
- TableRow,
406
- TextRun,
407
- VerticalAlign,
408
- WidthType
409
- } from "docx";
410
- import saveAs from "file-saver";
411
-
412
396
  // utils/exportUtils/ExportHelpers.ts
413
397
  function prepareExportRows(columns, data) {
414
398
  return data.map(
@@ -437,6 +421,21 @@ var WordExport = ({
437
421
  // exportCustomColumns
438
422
  }) => {
439
423
  const createNewWord = async () => {
424
+ const {
425
+ AlignmentType,
426
+ Document,
427
+ Packer,
428
+ PageOrientation,
429
+ // PageOrientation,
430
+ Paragraph,
431
+ Table,
432
+ TableCell,
433
+ TableRow,
434
+ TextRun,
435
+ VerticalAlign,
436
+ WidthType
437
+ } = await import("docx");
438
+ const { saveAs } = await import("file-saver");
440
439
  const {
441
440
  fontSize = 0,
442
441
  boldHeaders = true,
@@ -560,10 +559,10 @@ var setColumnAutoWidths = (sheet) => {
560
559
  };
561
560
 
562
561
  // components/export/ExportExcel.tsx
563
- import ExcelJS from "exceljs";
564
562
  import { jsx as jsx14 } from "react/jsx-runtime";
565
563
  var ExportExcel = ({ columns, excelData, title, exportCustomColumns }) => {
566
- const exportExcel = () => {
564
+ const exportExcel = async () => {
565
+ const ExcelJS = await import("exceljs");
567
566
  const workbook = new ExcelJS.Workbook();
568
567
  const sheet = workbook.addWorksheet(title, {
569
568
  pageSetup: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nillud-data-table",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
@@ -13,12 +13,6 @@
13
13
  ".": {
14
14
  "import": "./dist/index.js"
15
15
  },
16
- "./export-excel": {
17
- "import": "./dist/export-excel.js"
18
- },
19
- "./export-word": {
20
- "import": "./dist/export-word.js"
21
- },
22
16
  "./types": "./dist/index.d.ts",
23
17
  "./styles.css": "./dist/styles.css"
24
18
  },