react-markdown-table-ts 0.3.15 → 0.4.1

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/dist/types.d.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  /**
2
- * Represents a single row of data in the input table, consisting of cells.
2
+ * Represents a single row in a table, consisting of cells.
3
3
  */
4
- export type InputTableRowData = readonly string[];
4
+ export type TableRow = readonly string[];
5
5
  /**
6
- * Represents the structure of the input table.
6
+ * Represents the structure of a Markdown table.
7
7
  */
8
- export interface InputTableData {
9
- inputTableHeader: string[];
10
- inputTableBody: readonly string[][];
8
+ export interface InputData {
9
+ inputDataHeader: string[];
10
+ inputDataBody: readonly string[][];
11
11
  }
12
12
  /**
13
13
  * Props for the MarkdownTable component.
package/dist/utils.d.ts CHANGED
@@ -1,13 +1,11 @@
1
- import { InputTableData, InputTableRowData } from './types';
1
+ import { TableRow, InputData } from './types';
2
2
  /**
3
- * Calculates the maximum width for each column based on the content and newline replacement rules.
4
- * @param inputDataRows - All rows (header and body) of the input table.
5
- * @param maxColumnCount - The maximum number of columns in the input table.
6
- * @param minWidth - The minimum width for each column. Defaults to 3.
7
- * @param canReplaceNewlines - Whether to replace newlines with '<br>' (affects width) or a space.
3
+ * Calculates the maximum width for each column based on the content.
4
+ * @param tableRows - All rows (header and body) of the table.
5
+ * @param maxColumnCount - The maximum number of columns in the table.
8
6
  * @returns An array of maximum widths for each column.
9
7
  */
10
- export declare function calculateColumnWidths(inputDataRows: readonly InputTableRowData[], maxColumnCount: number, minWidth: number | undefined, canReplaceNewlines: boolean): number[];
8
+ export declare function calculateColumnWidths(tableRows: readonly TableRow[], maxColumnCount: number): number[];
11
9
  /**
12
10
  * Formats a single row into a Markdown-formatted string.
13
11
  * @param columnCount - The number of columns in the table.
@@ -18,7 +16,7 @@ export declare function calculateColumnWidths(inputDataRows: readonly InputTable
18
16
  * @param canReplaceNewlines - Flag to replace newlines with <br> tags.
19
17
  * @returns The Markdown string for the row.
20
18
  */
21
- export declare function formatMarkdownTableBody(columnCount: number, currentRow: InputTableRowData, columnAlignments: readonly ('left' | 'right' | 'center' | 'none')[], columnWidths?: readonly number[], useTabs?: boolean, canReplaceNewlines?: boolean): string;
19
+ export declare function formatMarkdownRow(columnCount: number, currentRow: TableRow, columnAlignments: readonly ('left' | 'right' | 'center' | 'none')[], columnWidths?: readonly number[], useTabs?: boolean, canReplaceNewlines?: boolean): string;
22
20
  /**
23
21
  * Generates the alignment row for the Markdown table syntax.
24
22
  * @param columnCount - The number of columns in the table.
@@ -27,7 +25,7 @@ export declare function formatMarkdownTableBody(columnCount: number, currentRow:
27
25
  * @param useTabs - Flag to use tabs between columns.
28
26
  * @returns The Markdown string for the alignment row.
29
27
  */
30
- export declare function formatMarkdownTableAlignmentRow(columnCount: number, columnAlignments: readonly ('left' | 'right' | 'center' | 'none')[], columnWidths?: readonly number[], useTabs?: boolean): string;
28
+ export declare function formatAlignmentRow(columnCount: number, columnAlignments: readonly ('left' | 'right' | 'center' | 'none')[], columnWidths?: readonly number[], useTabs?: boolean): string;
31
29
  /**
32
30
  * Generates a complete Markdown table string from the provided data.
33
31
  * @param inputData - The table data including headers and rows.
@@ -37,7 +35,13 @@ export declare function formatMarkdownTableAlignmentRow(columnCount: number, col
37
35
  * @param replaceNewlines - Flag to replace newlines with <br> tags.
38
36
  * @returns The complete Markdown table string.
39
37
  */
40
- export declare function generateMarkdownTableString(inputData: InputTableData, columnAlignments: readonly ('left' | 'right' | 'center' | 'none')[], canAdjustColumnWidths?: boolean, useTabs?: boolean, replaceNewlines?: boolean): string;
38
+ export declare function generateMarkdownTableString(inputData: InputData, columnAlignments: readonly ('left' | 'right' | 'center' | 'none')[], canAdjustColumnWidths?: boolean, useTabs?: boolean, replaceNewlines?: boolean): string;
39
+ /**
40
+ * Replaces newline characters in a string with <br> tags.
41
+ * @param cell - The cell content to process.
42
+ * @returns The processed cell content with newlines replaced.
43
+ */
44
+ export declare function replaceNewlinesInCell(cell: string): string;
41
45
  /**
42
46
  * Converts a zero-based column index to its corresponding Excel-style column name.
43
47
  * For example, 0 -> 'A', 1 -> 'B', ..., 25 -> 'Z', 26 -> 'AA', etc.
package/package.json CHANGED
@@ -1,75 +1,78 @@
1
- {
2
- "name": "react-markdown-table-ts",
3
- "version": "0.3.15",
4
- "description": "A React component that converts structured data into Markdown table syntax and displays it within a `<pre>` tag.",
5
- "main": "dist/index.cjs.js",
6
- "module": "dist/index.esm.js",
7
- "types": "dist/index.d.ts",
8
- "files": [
9
- "dist"
10
- ],
11
- "scripts": {
12
- "build": "rollup -c",
13
- "type-check": "tsc --noEmit",
14
- "prepublishOnly": "npm run build",
15
- "prepare": "npm run build",
16
- "lint": "gts lint",
17
- "clean": "gts clean",
18
- "compile": "tsc",
19
- "fix": "gts fix",
20
- "pretest": "npm run compile",
21
- "posttest": "npm run lint",
22
- "test": "jest --config jest.config.js --coverage",
23
- "test:watch": "jest --config jest.config.js --watch",
24
- "test:ci": "jest --config jest.config.js --coverage --ci",
25
- "release": "standard-version"
26
- },
27
- "keywords": [
28
- "markdown",
29
- "md",
30
- "table",
31
- "tables",
32
- "react",
33
- "ts",
34
- "typescript",
35
- "types",
36
- "typed",
37
- "generate",
38
- "generator",
39
- "convert",
40
- "converter"
41
- ],
42
- "author": "Keith Walsh",
43
- "license": "MIT",
44
- "repository": "https://github.com/keithwalsh/react-markdown-table-ts.git",
45
- "peerDependencies": {
46
- "react": "^18.2.0",
47
- "react-dom": "^18.2.0"
48
- },
49
- "devDependencies": {
50
- "@rollup/plugin-commonjs": "^26.0.3",
51
- "@rollup/plugin-node-resolve": "^15.3.0",
52
- "@rollup/plugin-typescript": "^11.1.6",
53
- "@testing-library/jest-dom": "^6.5.0",
54
- "@testing-library/react": "^16.0.1",
55
- "@types/jest": "^29.5.13",
56
- "@types/node": "20.12.7",
57
- "@types/prismjs": "^1.26.4",
58
- "@types/react": "^18.3.8",
59
- "@types/react-dom": "^18.3.0",
60
- "gts": "^5.3.1",
61
- "identity-obj-proxy": "^3.0.0",
62
- "jest": "^29.7.0",
63
- "jest-environment-jsdom": "^29.7.0",
64
- "react": "^18.2.0",
65
- "react-dom": "^18.2.0",
66
- "rollup": "^2.79.1",
67
- "rollup-plugin-typescript2": "^0.36.0",
68
- "standard-version": "^9.5.0",
69
- "ts-jest": "^29.2.5",
70
- "typescript": "^5.1.6"
71
- },
72
- "dependencies": {
73
- "prismjs": "^1.29.0"
74
- }
75
- }
1
+ {
2
+ "name": "react-markdown-table-ts",
3
+ "version": "0.4.1",
4
+ "description": "A React component that converts structured data into Markdown table syntax and displays it within a `<pre>` tag.",
5
+ "main": "dist/index.cjs.js",
6
+ "module": "dist/index.esm.js",
7
+ "types": "dist/index.d.ts",
8
+ "files": [
9
+ "dist"
10
+ ],
11
+ "scripts": {
12
+ "build": "rollup -c",
13
+ "type-check": "tsc --noEmit",
14
+ "prepublishOnly": "npm run build",
15
+ "prepare": "npm run build",
16
+ "lint": "gts lint",
17
+ "clean": "gts clean",
18
+ "compile": "tsc",
19
+ "fix": "gts fix",
20
+ "pretest": "npm run compile",
21
+ "posttest": "npm run lint",
22
+ "test": "jest --config jest.config.js --coverage",
23
+ "test:watch": "jest --config jest.config.js --watch",
24
+ "test:ci": "jest --config jest.config.js --coverage --ci",
25
+ "release": "standard-version"
26
+ },
27
+ "keywords": [
28
+ "markdown",
29
+ "md",
30
+ "table",
31
+ "tables",
32
+ "react",
33
+ "ts",
34
+ "typescript",
35
+ "types",
36
+ "typed",
37
+ "generate",
38
+ "generator",
39
+ "convert",
40
+ "converter"
41
+ ],
42
+ "author": "Keith Walsh",
43
+ "license": "MIT",
44
+ "repository": "https://github.com/keithwalsh/react-markdown-table-ts.git",
45
+ "peerDependencies": {
46
+ "react": "^18.2.0",
47
+ "react-dom": "^18.2.0"
48
+ },
49
+ "devDependencies": {
50
+ "@rollup/plugin-commonjs": "^26.0.3",
51
+ "@rollup/plugin-node-resolve": "^15.3.0",
52
+ "@rollup/plugin-typescript": "^11.1.6",
53
+ "@testing-library/jest-dom": "^6.5.0",
54
+ "@testing-library/react": "^16.0.1",
55
+ "@types/jest": "^29.5.13",
56
+ "@types/node": "20.12.7",
57
+ "@types/prismjs": "^1.26.4",
58
+ "@types/react": "^18.3.8",
59
+ "@types/react-dom": "^18.3.0",
60
+ "gts": "^5.3.1",
61
+ "identity-obj-proxy": "^3.0.0",
62
+ "jest": "^29.7.0",
63
+ "jest-environment-jsdom": "^29.7.0",
64
+ "react": "^18.2.0",
65
+ "react-dom": "^18.2.0",
66
+ "rollup": "^2.79.1",
67
+ "rollup-plugin-typescript2": "^0.36.0",
68
+ "standard-version": "^9.5.0",
69
+ "ts-jest": "^29.2.5",
70
+ "typescript": "^5.1.6"
71
+ },
72
+ "dependencies": {
73
+ "@emotion/react": "^11.13.5",
74
+ "@emotion/styled": "^11.13.5",
75
+ "@mui/material": "^6.1.8",
76
+ "prismjs": "^1.29.0"
77
+ }
78
+ }
@@ -1,2 +0,0 @@
1
- import '@testing-library/jest-dom';
2
- import '@testing-library/react';
@@ -1,3 +0,0 @@
1
- import '@testing-library/jest-dom';
2
- import '@testing-library/react';
3
- //# sourceMappingURL=jest.setup.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"jest.setup.js","sourceRoot":"","sources":["../jest.setup.ts"],"names":[],"mappings":"AAAA,OAAO,2BAA2B,CAAC;AACnC,OAAO,wBAAwB,CAAC"}
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
- import 'prismjs/components/prism-markdown';
3
- import 'prismjs/plugins/line-numbers/prism-line-numbers';
4
- import { MarkdownTableProps } from './types';
5
- export declare const MarkdownTable: React.FC<MarkdownTableProps>;
package/dist/src/index.js DELETED
@@ -1,62 +0,0 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- // src/index.tsx
3
- import { useEffect, useMemo, useRef } from 'react';
4
- import Prism from 'prismjs';
5
- import 'prismjs/components/prism-markdown';
6
- import 'prismjs/plugins/line-numbers/prism-line-numbers';
7
- import { MarkdownTableError } from './validation';
8
- import { generateMarkdownTableString, generateAlphabetHeaders } from './utils';
9
- // CSS styles
10
- var PRISM_CSS = "\ncode[class*=language-],pre[class*=language-]{color:#000;background:0 0;text-shadow:0 1px #fff;font-family:Consolas,Monaco,\"Andale Mono\",\"Ubuntu Mono\",monospace;font-size:1em;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}code[class*=language-] ::-moz-selection,code[class*=language-]::-moz-selection,pre[class*=language-] ::-moz-selection,pre[class*=language-]::-moz-selection{text-shadow:none;background:#b3d4fc}code[class*=language-] ::selection,code[class*=language-]::selection,pre[class*=language-] ::selection,pre[class*=language-]::selection{text-shadow:none;background:#b3d4fc}@media print{code[class*=language-],pre[class*=language-]{text-shadow:none}}pre[class*=language-]{padding:1em;margin:.5em 0;overflow:auto}:not(pre)>code[class*=language-],pre[class*=language-]{background:#f5f2f0}:not(pre)>code[class*=language-]{padding:.1em;border-radius:.3em;white-space:normal}pre[class*=language-].line-numbers{position:relative;padding-left:3.8em;counter-reset:linenumber}pre[class*=language-].line-numbers>code{position:relative;white-space:inherit}.line-numbers .line-numbers-rows{position:absolute;pointer-events:none;top:0;font-size:100%;left:-3.8em;width:3em;letter-spacing:-1px;border-right:1px solid #999;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.line-numbers-rows>span{display:block;counter-increment:linenumber}.line-numbers-rows>span:before{content:counter(linenumber);color:#999;display:block;padding-right:.8em;text-align:right}\n";
11
- export var MarkdownTable = function (_a) {
12
- var _b = _a.inputData, inputData = _b === void 0 ? null : _b, _c = _a.hasHeader, hasHeader = _c === void 0 ? true : _c, _d = _a.columnAlignments, columnAlignments = _d === void 0 ? [] : _d, _e = _a.isCompact, isCompact = _e === void 0 ? false : _e, _f = _a.hasTabs, hasTabs = _f === void 0 ? false : _f, _g = _a.canReplaceNewlines, canReplaceNewlines = _g === void 0 ? false : _g, className = _a.className, onTableCreate = _a.onTableCreate;
13
- var adjustColumnWidths = !isCompact;
14
- var preElementRef = useRef(null);
15
- var markdownTableSyntax = useMemo(function () {
16
- if (inputData === null) {
17
- return 'Error: No data provided for the table.';
18
- }
19
- try {
20
- if (!Array.isArray(inputData) || inputData.length === 0) {
21
- throw new MarkdownTableError("The 'data' prop must be a non-empty two-dimensional array.");
22
- }
23
- var tableData = hasHeader
24
- ? {
25
- inputTableHeader: inputData[0],
26
- inputTableBody: inputData.slice(1),
27
- }
28
- : {
29
- inputTableHeader: generateAlphabetHeaders(inputData[0].length),
30
- inputTableBody: inputData,
31
- };
32
- return generateMarkdownTableString(tableData, columnAlignments, adjustColumnWidths, hasTabs, canReplaceNewlines);
33
- }
34
- catch (error) {
35
- if (error instanceof MarkdownTableError) {
36
- return "Error: ".concat(error.message);
37
- }
38
- else {
39
- throw error;
40
- }
41
- }
42
- }, [
43
- inputData,
44
- hasHeader,
45
- columnAlignments,
46
- isCompact,
47
- hasTabs,
48
- canReplaceNewlines,
49
- ]);
50
- useEffect(function () {
51
- if (onTableCreate) {
52
- onTableCreate(markdownTableSyntax);
53
- }
54
- }, [markdownTableSyntax, onTableCreate]);
55
- useEffect(function () {
56
- if (preElementRef.current) {
57
- Prism.highlightElement(preElementRef.current.querySelector('code'));
58
- }
59
- }, [markdownTableSyntax]);
60
- return (_jsxs(_Fragment, { children: [_jsx("style", { children: PRISM_CSS }), _jsx("pre", { ref: preElementRef, className: "".concat(className, " language-markdown line-numbers"), children: _jsx("code", { className: "language-markdown", role: "code", children: markdownTableSyntax }) })] }));
61
- };
62
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":";AAAA,gBAAgB;AAEhB,OAAc,EAAC,SAAS,EAAE,OAAO,EAAE,MAAM,EAAC,MAA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AAC,CAAC,CAAC,CAAC,MAAM,CAAC;oBAC9D,cAAc,EAAE,SAAS;iBAC1B,CAAC;YAEN,OAAO,2BAA2B,CAChC,SAAS,EACT,gBAAgB,EAChB,kBAAkB,EAClB,OAAO,EACP,kBAAkB,CACnB,CAAC;SACH;QAAC,OAAO,KAAK,EAAE;YACd,IAAI,KAAK,YAAY,kBAAkB,EAAE;gBACvC,OAAO,iBAAU,KAAK,CAAC,OAAO,CAAE,CAAC;aAClC;iBAAM;gBACL,MAAM,KAAK,CAAC;aACb;SACF;IACH,CAAC,EAAE;QACD,SAAS;QACT,SAAS;QACT,gBAAgB;QAChB,SAAS;QACT,OAAO;QACP,kBAAkB;KACnB,CAAC,CAAC;IAEH,SAAS,CAAC;QACR,IAAI,aAAa,EAAE;YACjB,aAAa,CAAC,mBAAmB,CAAC,CAAC;SACpC;IACH,CAAC,EAAE,CAAC,mBAAmB,EAAE,aAAa,CAAC,CAAC,CAAC;IAEzC,SAAS,CAAC;QACR,IAAI,aAAa,CAAC,OAAO,EAAE;YACzB,KAAK,CAAC,gBAAgB,CACpB,aAAa,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAgB,CAC3D,CAAC;SACH;IACH,CAAC,EAAE,CAAC,mBAAmB,CAAC,CAAC,CAAC;IAE1B,OAAO,CACL,8BACE,0BAAQ,SAAS,GAAS,EAC1B,cACE,GAAG,EAAE,aAAa,EAClB,SAAS,EAAE,UAAG,SAAS,oCAAiC,YAExD,eAAM,SAAS,EAAC,mBAAmB,EAAC,IAAI,EAAC,MAAM,YAC5C,mBAAmB,GACf,GACH,IACL,CACJ,CAAC;AACJ,CAAC,CAAC"}
@@ -1,56 +0,0 @@
1
- /**
2
- * Represents a single row of data in the input table, consisting of cells.
3
- */
4
- export type InputTableRowData = readonly string[];
5
- /**
6
- * Represents the structure of the input table.
7
- */
8
- export interface InputTableData {
9
- inputTableHeader: string[];
10
- inputTableBody: readonly string[][];
11
- }
12
- /**
13
- * Props for the MarkdownTable component.
14
- */
15
- export interface MarkdownTableProps {
16
- /**
17
- * The entire table data as a two-dimensional array.
18
- * If `hasHeader` is true, the first row is treated as the header.
19
- * @default null
20
- */
21
- inputData?: string[][] | null;
22
- /**
23
- * Indicates whether the first row of `data` is a header.
24
- * @default true
25
- */
26
- hasHeader?: boolean;
27
- /**
28
- * Optional array specifying the alignment for each column.
29
- * Acceptable values are 'left', 'center', 'right', or 'none'.
30
- */
31
- columnAlignments?: readonly ('left' | 'center' | 'right' | 'none')[];
32
- /**
33
- * Optional flag to provide a compact version of the table with minimal column widths.
34
- * When `true`, column widths are not adjusted based on content.
35
- * @default false
36
- */
37
- isCompact?: boolean;
38
- /**
39
- * Optional flag to add tabs between columns in the Markdown table.
40
- * @default false
41
- */
42
- hasTabs?: boolean;
43
- /**
44
- * Optional CSS class for styling the rendered Markdown table.
45
- */
46
- className?: string;
47
- /**
48
- * Optional flag to replace newlines with <br> tags in table cells.
49
- * @default false
50
- */
51
- canReplaceNewlines?: boolean;
52
- /**
53
- * Optional callback function to receive the generated Markdown table string.
54
- */
55
- onTableCreate?: (markdownTableString: string) => void;
56
- }
package/dist/src/types.js DELETED
@@ -1,3 +0,0 @@
1
- // src/types.ts
2
- export {};
3
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,eAAe"}
@@ -1,58 +0,0 @@
1
- import { InputTableData, InputTableRowData } from './types';
2
- /**
3
- * Calculates the maximum width for each column based on the content.
4
- * @param inputDataRows - All rows (header and body) of the input table.
5
- * @param maxColumnCount - The maximum number of columns in the input table.
6
- * @param minWidth - The minimum width for each column. Defaults to 3.
7
- * @returns An array of maximum widths for each column.
8
- */
9
- export declare function calculateColumnWidths(inputDataRows: readonly InputTableRowData[], maxColumnCount: number, minWidth?: number): number[];
10
- /**
11
- * Formats a single row into a Markdown-formatted string.
12
- * @param columnCount - The number of columns in the table.
13
- * @param currentRow - The data of the current row.
14
- * @param columnAlignments - Alignment settings for each column.
15
- * @param columnWidths - Widths of each column.
16
- * @param useTabs - Flag to use tabs between columns.
17
- * @param canReplaceNewlines - Flag to replace newlines with <br> tags.
18
- * @returns The Markdown string for the row.
19
- */
20
- export declare function formatMarkdownRow(columnCount: number, currentRow: InputTableRowData, columnAlignments: readonly ('left' | 'right' | 'center' | 'none')[], columnWidths?: readonly number[], useTabs?: boolean, canReplaceNewlines?: boolean): string;
21
- /**
22
- * Generates the alignment row for the Markdown table syntax.
23
- * @param columnCount - The number of columns in the table.
24
- * @param columnAlignments - Alignment settings for each column.
25
- * @param columnWidths - Widths of each column.
26
- * @param useTabs - Flag to use tabs between columns.
27
- * @returns The Markdown string for the alignment row.
28
- */
29
- export declare function formatAlignmentRow(columnCount: number, columnAlignments: readonly ('left' | 'right' | 'center' | 'none')[], columnWidths?: readonly number[], useTabs?: boolean): string;
30
- /**
31
- * Generates a complete Markdown table string from the provided data.
32
- * @param inputData - The table data including headers and rows.
33
- * @param columnAlignments - Alignment settings for each column.
34
- * @param canAdjustColumnWidths - Flag to adjust column widths based on content.
35
- * @param useTabs - Flag to use tabs between columns.
36
- * @param replaceNewlines - Flag to replace newlines with <br> tags.
37
- * @returns The complete Markdown table string.
38
- */
39
- export declare function generateMarkdownTableString(inputData: InputTableData, columnAlignments: readonly ('left' | 'right' | 'center' | 'none')[], canAdjustColumnWidths?: boolean, useTabs?: boolean, replaceNewlines?: boolean): string;
40
- /**
41
- * Replaces newline characters in a string with <br> tags.
42
- * @param cell - The cell content to process.
43
- * @returns The processed cell content with newlines replaced.
44
- */
45
- export declare function replaceNewlinesInCell(cell: string): string;
46
- /**
47
- * Converts a zero-based column index to its corresponding Excel-style column name.
48
- * For example, 0 -> 'A', 1 -> 'B', ..., 25 -> 'Z', 26 -> 'AA', etc.
49
- * @param index - The zero-based column index.
50
- * @returns The corresponding column name.
51
- */
52
- export declare function getColumnName(index: number): string;
53
- /**
54
- * Generates an array of alphabetic headers based on the specified column count.
55
- * @param columnCount - The number of columns.
56
- * @returns An array of column header names.
57
- */
58
- export declare function generateAlphabetHeaders(columnCount: number): string[];
package/dist/src/utils.js DELETED
@@ -1,179 +0,0 @@
1
- // src/utils.ts
2
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4
- if (ar || !(i in from)) {
5
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
6
- ar[i] = from[i];
7
- }
8
- }
9
- return to.concat(ar || Array.prototype.slice.call(from));
10
- };
11
- /**
12
- * Calculates the maximum width for each column based on the content.
13
- * @param inputDataRows - All rows (header and body) of the input table.
14
- * @param maxColumnCount - The maximum number of columns in the input table.
15
- * @param minWidth - The minimum width for each column. Defaults to 3.
16
- * @returns An array of maximum widths for each column.
17
- */
18
- export function calculateColumnWidths(inputDataRows, maxColumnCount, minWidth) {
19
- if (minWidth === void 0) { minWidth = 3; }
20
- // Initialize column widths with the minimum width.
21
- var columnWidths = Array.from({ length: maxColumnCount }, function () { return minWidth; });
22
- // Iterate over each row in the input data.
23
- for (var _i = 0, inputDataRows_1 = inputDataRows; _i < inputDataRows_1.length; _i++) {
24
- var currentRow = inputDataRows_1[_i];
25
- // Iterate over each column index up to maxColumnCount.
26
- for (var columnIndex = 0; columnIndex < maxColumnCount; columnIndex++) {
27
- // Retrieve the cell value; default to an empty string if undefined or null.
28
- var cellValue = currentRow[columnIndex];
29
- var cellString = cellValue !== null && cellValue !== undefined ? String(cellValue) : '';
30
- // Update the column width if the current cell's length is greater.
31
- if (cellString.length > columnWidths[columnIndex]) {
32
- columnWidths[columnIndex] = cellString.length;
33
- }
34
- }
35
- }
36
- return columnWidths;
37
- }
38
- /**
39
- * Formats a single row into a Markdown-formatted string.
40
- * @param columnCount - The number of columns in the table.
41
- * @param currentRow - The data of the current row.
42
- * @param columnAlignments - Alignment settings for each column.
43
- * @param columnWidths - Widths of each column.
44
- * @param useTabs - Flag to use tabs between columns.
45
- * @param canReplaceNewlines - Flag to replace newlines with <br> tags.
46
- * @returns The Markdown string for the row.
47
- */
48
- export function formatMarkdownRow(columnCount, currentRow, columnAlignments, columnWidths, useTabs, canReplaceNewlines) {
49
- var _a, _b;
50
- if (useTabs === void 0) { useTabs = false; }
51
- if (canReplaceNewlines === void 0) { canReplaceNewlines = false; }
52
- var defaultAlignment = 'left';
53
- var adjustedAlignments = columnAlignments.length < columnCount
54
- ? __spreadArray(__spreadArray([], columnAlignments, true), Array(columnCount - columnAlignments.length).fill(defaultAlignment), true) : columnAlignments;
55
- var markdownRow = '|';
56
- for (var i = 0; i < columnCount; i++) {
57
- var cell = (_a = currentRow[i]) !== null && _a !== void 0 ? _a : '';
58
- if (canReplaceNewlines) {
59
- cell = replaceNewlinesInCell(cell);
60
- }
61
- var alignment = (_b = adjustedAlignments[i]) !== null && _b !== void 0 ? _b : defaultAlignment;
62
- var targetWidth = columnWidths ? columnWidths[i] : cell.length;
63
- if (alignment === 'right') {
64
- markdownRow += "".concat(useTabs ? '\t' : ' ').concat(cell.padStart(targetWidth)).concat(useTabs ? '\t' : ' ', "|");
65
- }
66
- else if (alignment === 'center') {
67
- var totalPadding = targetWidth - cell.length;
68
- var paddingLeft = Math.floor(totalPadding / 2);
69
- var paddingRight = totalPadding - paddingLeft;
70
- markdownRow += "".concat(useTabs ? '\t' : ' ').concat(' '.repeat(paddingLeft)).concat(cell).concat(' '.repeat(paddingRight)).concat(useTabs ? '\t' : ' ', "|");
71
- }
72
- else {
73
- // Left alignment or default
74
- markdownRow += "".concat(useTabs ? '\t' : ' ').concat(cell.padEnd(targetWidth)).concat(useTabs ? '\t' : ' ', "|");
75
- }
76
- }
77
- return markdownRow;
78
- }
79
- /**
80
- * Generates the alignment row for the Markdown table syntax.
81
- * @param columnCount - The number of columns in the table.
82
- * @param columnAlignments - Alignment settings for each column.
83
- * @param columnWidths - Widths of each column.
84
- * @param useTabs - Flag to use tabs between columns.
85
- * @returns The Markdown string for the alignment row.
86
- */
87
- export function formatAlignmentRow(columnCount, columnAlignments, columnWidths, useTabs) {
88
- var _a;
89
- if (useTabs === void 0) { useTabs = false; }
90
- var defaultAlignment = 'left';
91
- var adjustedAlignments = columnAlignments.length < columnCount
92
- ? __spreadArray(__spreadArray([], columnAlignments, true), Array(columnCount - columnAlignments.length).fill(defaultAlignment), true) : columnAlignments;
93
- var alignmentRow = '|';
94
- for (var i = 0; i < columnCount; i++) {
95
- var alignment = (_a = adjustedAlignments[i]) !== null && _a !== void 0 ? _a : defaultAlignment;
96
- var targetWidth = columnWidths ? columnWidths[i] : 3;
97
- var alignIndicator = '';
98
- switch (alignment) {
99
- case 'left':
100
- alignIndicator = ":".concat('-'.repeat(targetWidth - 1));
101
- break;
102
- case 'center':
103
- alignIndicator = ":".concat('-'.repeat(targetWidth - 2), ":");
104
- break;
105
- case 'right':
106
- alignIndicator = "".concat('-'.repeat(targetWidth - 1), ":");
107
- break;
108
- default:
109
- alignIndicator = "".concat('-'.repeat(targetWidth));
110
- break;
111
- }
112
- alignmentRow += "".concat(useTabs ? '\t' : ' ').concat(alignIndicator).concat(useTabs ? '\t' : ' ', "|");
113
- }
114
- return alignmentRow;
115
- }
116
- /**
117
- * Generates a complete Markdown table string from the provided data.
118
- * @param inputData - The table data including headers and rows.
119
- * @param columnAlignments - Alignment settings for each column.
120
- * @param canAdjustColumnWidths - Flag to adjust column widths based on content.
121
- * @param useTabs - Flag to use tabs between columns.
122
- * @param replaceNewlines - Flag to replace newlines with <br> tags.
123
- * @returns The complete Markdown table string.
124
- */
125
- export function generateMarkdownTableString(inputData, columnAlignments, canAdjustColumnWidths, useTabs, replaceNewlines) {
126
- if (canAdjustColumnWidths === void 0) { canAdjustColumnWidths = true; }
127
- if (useTabs === void 0) { useTabs = false; }
128
- if (replaceNewlines === void 0) { replaceNewlines = false; }
129
- var headerColumnCount = inputData.inputTableHeader.length;
130
- var bodyColumnCounts = inputData.inputTableBody.map(function (currentRow) { return currentRow.length; });
131
- var maxColumnCount = Math.max.apply(Math, __spreadArray([headerColumnCount], bodyColumnCounts, false));
132
- var columnWidths = canAdjustColumnWidths
133
- ? calculateColumnWidths(__spreadArray([inputData.inputTableHeader], inputData.inputTableBody, true), maxColumnCount)
134
- : undefined;
135
- var markdownHeaderRow = formatMarkdownRow(maxColumnCount, inputData.inputTableHeader, columnAlignments, columnWidths, useTabs, replaceNewlines);
136
- var markdownAlignmentRow = formatAlignmentRow(maxColumnCount, columnAlignments, columnWidths, useTabs);
137
- var markdownBodyRows = inputData.inputTableBody
138
- .map(function (currentRow) {
139
- return formatMarkdownRow(maxColumnCount, currentRow, columnAlignments, columnWidths, useTabs, replaceNewlines);
140
- })
141
- .join('\n');
142
- return "".concat(markdownHeaderRow, "\n").concat(markdownAlignmentRow, "\n").concat(markdownBodyRows).trimEnd();
143
- }
144
- /**
145
- * Replaces newline characters in a string with <br> tags.
146
- * @param cell - The cell content to process.
147
- * @returns The processed cell content with newlines replaced.
148
- */
149
- export function replaceNewlinesInCell(cell) {
150
- return cell.replace(/\n/g, '<br>');
151
- }
152
- /**
153
- * Converts a zero-based column index to its corresponding Excel-style column name.
154
- * For example, 0 -> 'A', 1 -> 'B', ..., 25 -> 'Z', 26 -> 'AA', etc.
155
- * @param index - The zero-based column index.
156
- * @returns The corresponding column name.
157
- */
158
- export function getColumnName(index) {
159
- var columnName = '';
160
- var currentIndex = index;
161
- while (currentIndex >= 0) {
162
- columnName = String.fromCharCode((currentIndex % 26) + 65) + columnName;
163
- currentIndex = Math.floor(currentIndex / 26) - 1;
164
- }
165
- return columnName;
166
- }
167
- /**
168
- * Generates an array of alphabetic headers based on the specified column count.
169
- * @param columnCount - The number of columns.
170
- * @returns An array of column header names.
171
- */
172
- export function generateAlphabetHeaders(columnCount) {
173
- var alphabetHeaders = [];
174
- for (var i = 0; i < columnCount; i++) {
175
- alphabetHeaders.push(getColumnName(i));
176
- }
177
- return alphabetHeaders;
178
- }
179
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @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C;KACxC;IACD,OAAO,eAAe,CAAC;AACzB,CAAC"}
@@ -1,13 +0,0 @@
1
- import { MarkdownTableProps } from './types';
2
- /**
3
- * Custom error class for handling Markdown table generation errors.
4
- */
5
- export declare class MarkdownTableError extends Error {
6
- constructor(message: string);
7
- }
8
- /**
9
- * Validates the structure of the table data based on the `hasHeader` flag.
10
- * Throws an error if validation fails.
11
- * @param markdownTableProps - The props to validate.
12
- */
13
- export declare function validateMarkdownTableProps(markdownTableProps: MarkdownTableProps): void;