tabulify 1.0.15 → 1.0.17
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.cjs.js +2 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +2 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/types/components/Pagination/index.d.ts +9 -0
- package/dist/types/components/Table/index.d.ts +4 -0
- package/dist/types/components/Table.d.ts +1 -1
- package/dist/types/index.d.ts +3 -1
- package/dist/types/types/index.d.ts +27 -0
- package/dist/types/utils/index.d.ts +1 -0
- package/package.json +10 -5
- package/.eslintrc.json +0 -34
- package/.prettierrc +0 -6
- package/eslint.config.mjs +0 -14
- package/jest.config.ts +0 -10
package/dist/index.cjs.js
CHANGED
@@ -21,13 +21,14 @@ var Table = function (_a) {
|
|
21
21
|
var paginatedData = pagination
|
22
22
|
? dataSource.slice((currentPage - 1) * pageSize, currentPage * pageSize)
|
23
23
|
: dataSource;
|
24
|
+
console.log('DEBUG', Boolean(onRowClick));
|
24
25
|
return (React.createElement("div", { className: className },
|
25
26
|
React.createElement("table", { className: "tabulify-table" },
|
26
27
|
React.createElement("thead", { className: "tabulify-head" },
|
27
28
|
React.createElement("tr", null,
|
28
29
|
rowSelection && React.createElement("th", null),
|
29
30
|
columns.map(function (column) { return (React.createElement("th", { className: "tabulify-cell", key: getUniqueId(column.key) }, column.title)); }))),
|
30
|
-
React.createElement("tbody", { className: "tabulify-body" }, paginatedData.map(function (record, index) { return (React.createElement("tr", { key: getUniqueId(record[dataIndex]), onClick: function () { return onRowClick === null || onRowClick === void 0 ? void 0 : onRowClick(record[dataIndex]); } }, columns.map(function (column) { return (React.createElement("td", { className: "tabulify-cell", key: getUniqueId(column.key) }, column.render ? (column.render(record[column.key], record, index)) : (React.createElement(React.Fragment, null, "".concat(record[column.key]))))); }))); }))),
|
31
|
+
React.createElement("tbody", { className: "tabulify-body" }, paginatedData.map(function (record, index) { return (React.createElement("tr", { key: getUniqueId(record[dataIndex]), onClick: function () { return onRowClick === null || onRowClick === void 0 ? void 0 : onRowClick(record[dataIndex]); }, className: Boolean(onRowClick) ? 'has-hover' : '' }, columns.map(function (column) { return (React.createElement("td", { className: "tabulify-cell", key: getUniqueId(column.key) }, column.render ? (column.render(record[column.key], record, index)) : (React.createElement(React.Fragment, null, "".concat(record[column.key]))))); }))); }))),
|
31
32
|
pagination && (React.createElement("div", { className: "tabulify-pagination" }, Array.from({ length: Math.ceil(pagination.total / pageSize) }, function (_, i) { return i + 1; }).map(function (page) { return (React.createElement("button", { key: page, className: currentPage === page ? 'active' : '', onClick: function () { return handlePageChange(page); } }, page)); })))));
|
32
33
|
};
|
33
34
|
|
package/dist/index.cjs.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../src/
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../src/utils/index.ts","../src/components/Table/index.tsx"],"sourcesContent":["export const getUniqueId = (prefix: unknown): string =>\n `${prefix ?? 'id'}-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;\n","import React, { useState } from 'react';\nimport { TableProps } from '../../types';\nimport { getUniqueId } from '../../utils';\n\n// Table Component\nconst Table = <T,>({\n columns,\n dataSource,\n rowSelection,\n pagination,\n dataIndex,\n className,\n onRowClick,\n}: TableProps<T>) => {\n const [currentPage, setCurrentPage] = useState(pagination?.current || 1);\n\n const pageSize = pagination?.pageSize || dataSource.length;\n\n // Handle pagination\n const handlePageChange = (page: number) => {\n setCurrentPage(page);\n pagination?.onChange?.(page);\n };\n\n // Paginate data\n const paginatedData = pagination\n ? dataSource.slice((currentPage - 1) * pageSize, currentPage * pageSize)\n : dataSource;\n\n console.log('DEBUG', Boolean(onRowClick));\n\n return (\n <div className={className}>\n <table className=\"tabulify-table\">\n <thead className=\"tabulify-head\">\n <tr>\n {rowSelection && <th></th>}\n {columns.map((column) => (\n <th className=\"tabulify-cell\" key={getUniqueId(column.key)}>\n {column.title}\n </th>\n ))}\n </tr>\n </thead>\n <tbody className=\"tabulify-body\">\n {paginatedData.map((record, index) => (\n <tr\n key={getUniqueId(record[dataIndex])}\n onClick={() => onRowClick?.(record[dataIndex])}\n className={Boolean(onRowClick) ? 'has-hover' : ''}\n >\n {columns.map((column) => (\n <td className=\"tabulify-cell\" key={getUniqueId(column.key)}>\n {column.render ? (\n column.render(record[column.key], record, index)\n ) : (\n <>{`${record[column.key]}`}</>\n )}\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n {pagination && (\n <div className=\"tabulify-pagination\">\n {Array.from(\n { length: Math.ceil(pagination.total / pageSize) },\n (_, i) => i + 1\n ).map((page) => (\n <button\n key={page}\n className={currentPage === page ? 'active' : ''}\n onClick={() => handlePageChange(page)}\n >\n {page}\n </button>\n ))}\n </div>\n )}\n </div>\n );\n};\n\nexport default Table;\n"],"names":["useState"],"mappings":";;;;AAAO,IAAM,WAAW,GAAG,UAAC,MAAe,EAAA;AACzC,IAAA,OAAA,EAAG,CAAA,MAAA,CAAA,MAAM,KAAN,IAAA,IAAA,MAAM,KAAN,KAAA,CAAA,GAAA,MAAM,GAAI,IAAI,EAAI,GAAA,CAAA,CAAA,MAAA,CAAA,IAAI,CAAC,GAAG,EAAE,EAAI,GAAA,CAAA,CAAA,MAAA,CAAA,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAE;AAA/E,CAA+E;;ACGjF;AACM,IAAA,KAAK,GAAG,UAAK,EAQH,EAAA;AAPd,IAAA,IAAA,OAAO,aAAA,EACP,UAAU,gBAAA,EACV,YAAY,kBAAA,EACZ,UAAU,GAAA,EAAA,CAAA,UAAA,EACV,SAAS,GAAA,EAAA,CAAA,SAAA,EACT,SAAS,GAAA,EAAA,CAAA,SAAA,EACT,UAAU,GAAA,EAAA,CAAA,UAAA;IAEJ,IAAA,EAAA,GAAgCA,cAAQ,CAAC,CAAA,UAAU,KAAV,IAAA,IAAA,UAAU,uBAAV,UAAU,CAAE,OAAO,K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AU,CAAC,KAAK,GAAG,QAAQ,CAAC,EAAE,EAClD,UAAC,CAAC,EAAE,CAAC,EAAA,EAAK,OAAA,CAAC,GAAG,CAAC,CAAL,EAAK,CAChB,CAAC,GAAG,CAAC,UAAC,IAAI,EAAK,EAAA,QACd,KACE,CAAA,aAAA,CAAA,QAAA,EAAA,EAAA,GAAG,EAAE,IAAI,EACT,SAAS,EAAE,WAAW,KAAK,IAAI,GAAG,QAAQ,GAAG,EAAE,EAC/C,OAAO,EAAE,cAAM,OAAA,gBAAgB,CAAC,IAAI,CAAC,GAAA,EAAA,EAEpC,IAAI,CACE,IACV,CAAC,CACE,CACP,CACG;AAEV;;;;"}
|
package/dist/index.esm.js
CHANGED
@@ -19,13 +19,14 @@ var Table = function (_a) {
|
|
19
19
|
var paginatedData = pagination
|
20
20
|
? dataSource.slice((currentPage - 1) * pageSize, currentPage * pageSize)
|
21
21
|
: dataSource;
|
22
|
+
console.log('DEBUG', Boolean(onRowClick));
|
22
23
|
return (React.createElement("div", { className: className },
|
23
24
|
React.createElement("table", { className: "tabulify-table" },
|
24
25
|
React.createElement("thead", { className: "tabulify-head" },
|
25
26
|
React.createElement("tr", null,
|
26
27
|
rowSelection && React.createElement("th", null),
|
27
28
|
columns.map(function (column) { return (React.createElement("th", { className: "tabulify-cell", key: getUniqueId(column.key) }, column.title)); }))),
|
28
|
-
React.createElement("tbody", { className: "tabulify-body" }, paginatedData.map(function (record, index) { return (React.createElement("tr", { key: getUniqueId(record[dataIndex]), onClick: function () { return onRowClick === null || onRowClick === void 0 ? void 0 : onRowClick(record[dataIndex]); } }, columns.map(function (column) { return (React.createElement("td", { className: "tabulify-cell", key: getUniqueId(column.key) }, column.render ? (column.render(record[column.key], record, index)) : (React.createElement(React.Fragment, null, "".concat(record[column.key]))))); }))); }))),
|
29
|
+
React.createElement("tbody", { className: "tabulify-body" }, paginatedData.map(function (record, index) { return (React.createElement("tr", { key: getUniqueId(record[dataIndex]), onClick: function () { return onRowClick === null || onRowClick === void 0 ? void 0 : onRowClick(record[dataIndex]); }, className: Boolean(onRowClick) ? 'has-hover' : '' }, columns.map(function (column) { return (React.createElement("td", { className: "tabulify-cell", key: getUniqueId(column.key) }, column.render ? (column.render(record[column.key], record, index)) : (React.createElement(React.Fragment, null, "".concat(record[column.key]))))); }))); }))),
|
29
30
|
pagination && (React.createElement("div", { className: "tabulify-pagination" }, Array.from({ length: Math.ceil(pagination.total / pageSize) }, function (_, i) { return i + 1; }).map(function (page) { return (React.createElement("button", { key: page, className: currentPage === page ? 'active' : '', onClick: function () { return handlePageChange(page); } }, page)); })))));
|
30
31
|
};
|
31
32
|
|
package/dist/index.esm.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../src/
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../src/utils/index.ts","../src/components/Table/index.tsx"],"sourcesContent":["export const getUniqueId = (prefix: unknown): string =>\n `${prefix ?? 'id'}-${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;\n","import React, { useState } from 'react';\nimport { TableProps } from '../../types';\nimport { getUniqueId } from '../../utils';\n\n// Table Component\nconst Table = <T,>({\n columns,\n dataSource,\n rowSelection,\n pagination,\n dataIndex,\n className,\n onRowClick,\n}: TableProps<T>) => {\n const [currentPage, setCurrentPage] = useState(pagination?.current || 1);\n\n const pageSize = pagination?.pageSize || dataSource.length;\n\n // Handle pagination\n const handlePageChange = (page: number) => {\n setCurrentPage(page);\n pagination?.onChange?.(page);\n };\n\n // Paginate data\n const paginatedData = pagination\n ? dataSource.slice((currentPage - 1) * pageSize, currentPage * pageSize)\n : dataSource;\n\n console.log('DEBUG', Boolean(onRowClick));\n\n return (\n <div className={className}>\n <table className=\"tabulify-table\">\n <thead className=\"tabulify-head\">\n <tr>\n {rowSelection && <th></th>}\n {columns.map((column) => (\n <th className=\"tabulify-cell\" key={getUniqueId(column.key)}>\n {column.title}\n </th>\n ))}\n </tr>\n </thead>\n <tbody className=\"tabulify-body\">\n {paginatedData.map((record, index) => (\n <tr\n key={getUniqueId(record[dataIndex])}\n onClick={() => onRowClick?.(record[dataIndex])}\n className={Boolean(onRowClick) ? 'has-hover' : ''}\n >\n {columns.map((column) => (\n <td className=\"tabulify-cell\" key={getUniqueId(column.key)}>\n {column.render ? (\n column.render(record[column.key], record, index)\n ) : (\n <>{`${record[column.key]}`}</>\n )}\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n {pagination && (\n <div className=\"tabulify-pagination\">\n {Array.from(\n { length: Math.ceil(pagination.total / pageSize) },\n (_, i) => i + 1\n ).map((page) => (\n <button\n key={page}\n className={currentPage === page ? 'active' : ''}\n onClick={() => handlePageChange(page)}\n >\n {page}\n </button>\n ))}\n </div>\n )}\n </div>\n );\n};\n\nexport default Table;\n"],"names":[],"mappings":";;AAAO,IAAM,WAAW,GAAG,UAAC,MAAe,EAAA;AACzC,IAAA,OAAA,EAAG,CAAA,MAAA,CAAA,MAAM,KAAN,IAAA,IAAA,MAAM,KAAN,KAAA,CAAA,GAAA,MAAM,GAAI,IAAI,EAAI,GAAA,CAAA,CAAA,MAAA,CAAA,IAAI,CAAC,GAAG,EAAE,EAAI,GAAA,CAAA,CAAA,MAAA,CAAA,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAE;AAA/E,CAA+E;;ACGjF;AACM,IAAA,KAAK,GAAG,UAAK,EAQH,EAAA;AAPd,IAAA,IAAA,OAAO,aAAA,EACP,UAAU,gBAAA,EACV,YAAY,kBAAA,EACZ,UAAU,GAAA,EAAA,CAAA,UAAA,EACV,SAAS,GAAA,EAAA,CAAA,SAAA,EACT,SAAS,GAAA,EAAA,CAAA,SAAA,EACT,UAAU,GAAA,EAAA,CAAA,UAAA;IAEJ,IAAA,EAAA,GAAgC,QAAQ,CAAC,CAAA,UAAU,KAAV,IAAA,IAAA,UAAU,uBAAV,UAAU,CAAE,OAAO,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AAU,CAAC,KAAK,GAAG,QAAQ,CAAC,EAAE,EAClD,UAAC,CAAC,EAAE,CAAC,EAAA,EAAK,OAAA,CAAC,GAAG,CAAC,CAAL,EAAK,CAChB,CAAC,GAAG,CAAC,UAAC,IAAI,EAAK,EAAA,QACd,KACE,CAAA,aAAA,CAAA,QAAA,EAAA,EAAA,GAAG,EAAE,IAAI,EACT,SAAS,EAAE,WAAW,KAAK,IAAI,GAAG,QAAQ,GAAG,EAAE,EAC/C,OAAO,EAAE,cAAM,OAAA,gBAAgB,CAAC,IAAI,CAAC,GAAA,EAAA,EAEpC,IAAI,CACE,IACV,CAAC,CACE,CACP,CACG;AAEV;;;;"}
|
@@ -1,5 +1,5 @@
|
|
1
|
+
import './styles.css';
|
1
2
|
import React from 'react';
|
2
3
|
import { TableProps } from './Table.types';
|
3
|
-
import './Table.css';
|
4
4
|
declare const Table: <T>({ columns, dataSource, rowSelection, pagination, dataIndex, className, onRowClick, }: TableProps<T>) => React.JSX.Element;
|
5
5
|
export default Table;
|
package/dist/types/index.d.ts
CHANGED
@@ -1,2 +1,4 @@
|
|
1
|
+
import './components/Table/styles.css';
|
1
2
|
export { default as Table } from './components/Table';
|
2
|
-
export type { TableProps, Column, Pagination, RowSelection
|
3
|
+
export type { TableProps, Column, Pagination, RowSelection } from './types';
|
4
|
+
export {};
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
export interface Column<T, K extends keyof T = keyof T> {
|
3
|
+
title: string;
|
4
|
+
key: K;
|
5
|
+
sorter?: (a: T, b: T) => number;
|
6
|
+
render?: (value: T[K], record: T, index: number) => React.ReactNode;
|
7
|
+
}
|
8
|
+
export interface RowSelection<T> {
|
9
|
+
type: 'checkbox' | 'radio';
|
10
|
+
selectedRowKeys?: (keyof T)[];
|
11
|
+
onChange?: (selectedRowKeys: (keyof T)[], selectedRows: T[]) => void;
|
12
|
+
}
|
13
|
+
export interface Pagination {
|
14
|
+
pageSize: number;
|
15
|
+
total: number;
|
16
|
+
current?: number;
|
17
|
+
onChange?: (page: number) => void;
|
18
|
+
}
|
19
|
+
export interface TableProps<T> {
|
20
|
+
className?: string;
|
21
|
+
columns: Column<T>[];
|
22
|
+
dataSource: T[];
|
23
|
+
dataIndex: keyof T;
|
24
|
+
rowSelection?: RowSelection<T>;
|
25
|
+
pagination?: Pagination;
|
26
|
+
onRowClick?: (id: T[keyof T]) => void;
|
27
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const getUniqueId: (prefix: unknown) => string;
|
package/package.json
CHANGED
@@ -1,13 +1,11 @@
|
|
1
1
|
{
|
2
2
|
"name": "tabulify",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.17",
|
4
4
|
"type": "module",
|
5
5
|
"description": "A lightweight and customizable React table component.",
|
6
|
-
"main": "dist/index.js",
|
7
|
-
"module": "dist/index.esm.js",
|
8
|
-
"types": "dist/types/index.d.ts",
|
9
6
|
"scripts": {
|
10
7
|
"build": "rollup -c",
|
8
|
+
"watch": "rollup -c --watch",
|
11
9
|
"prepublishOnly": "npm run build",
|
12
10
|
"test": "jest",
|
13
11
|
"test:watch": "jest --watch",
|
@@ -63,5 +61,12 @@
|
|
63
61
|
"ts-jest": "^29.2.5",
|
64
62
|
"ts-node": "^10.9.2",
|
65
63
|
"typescript": "^5.6.3"
|
66
|
-
}
|
64
|
+
},
|
65
|
+
"files": [
|
66
|
+
"dist/**/*"
|
67
|
+
],
|
68
|
+
"main": "dist/index.js",
|
69
|
+
"module": "dist/index.esm.js",
|
70
|
+
"types": "dist/types/index.d.ts",
|
71
|
+
"style": "dist/index.cjs.css"
|
67
72
|
}
|
package/.eslintrc.json
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"settings": {
|
3
|
-
"react": {
|
4
|
-
"version": "detect"
|
5
|
-
}
|
6
|
-
},
|
7
|
-
"env": {
|
8
|
-
"browser": true,
|
9
|
-
"es2021": true
|
10
|
-
},
|
11
|
-
"extends": [
|
12
|
-
"eslint:recommended",
|
13
|
-
"plugin:react/recommended",
|
14
|
-
"plugin:@typescript-eslint/recommended",
|
15
|
-
"airbnb",
|
16
|
-
"plugin:prettier/recommended"
|
17
|
-
],
|
18
|
-
"parser": "@typescript-eslint/parser",
|
19
|
-
"parserOptions": {
|
20
|
-
"ecmaFeatures": {
|
21
|
-
"jsx": true
|
22
|
-
},
|
23
|
-
"ecmaVersion": "latest",
|
24
|
-
"sourceType": "module"
|
25
|
-
},
|
26
|
-
"plugins": ["react", "@typescript-eslint"],
|
27
|
-
"rules": {
|
28
|
-
"react/react-in-jsx-scope": "off",
|
29
|
-
"react/prop-types": "off",
|
30
|
-
"no-unused-vars": "warn",
|
31
|
-
"@typescript-eslint/no-unused-vars": ["warn"],
|
32
|
-
"jsx-a11y/anchor-is-valid": "off"
|
33
|
-
}
|
34
|
-
}
|
package/.prettierrc
DELETED
package/eslint.config.mjs
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
import globals from "globals";
|
2
|
-
import pluginJs from "@eslint/js";
|
3
|
-
import tseslint from "typescript-eslint";
|
4
|
-
import pluginReact from "eslint-plugin-react";
|
5
|
-
|
6
|
-
|
7
|
-
/** @type {import('eslint').Linter.Config[]} */
|
8
|
-
export default [
|
9
|
-
{files: ["**/*.{js,mjs,cjs,ts,jsx,tsx}"]},
|
10
|
-
{languageOptions: { globals: globals.browser }},
|
11
|
-
pluginJs.configs.recommended,
|
12
|
-
...tseslint.configs.recommended,
|
13
|
-
pluginReact.configs.flat.recommended,
|
14
|
-
];
|
package/jest.config.ts
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
import type { Config } from 'jest';
|
2
|
-
|
3
|
-
const config: Config = {
|
4
|
-
preset: 'ts-jest',
|
5
|
-
testEnvironment: 'jest-environment-jsdom',
|
6
|
-
testMatch: ['**/*.test.ts', '**/*.test.tsx'], // Match test files
|
7
|
-
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], // Resolve these extensions
|
8
|
-
};
|
9
|
-
|
10
|
-
export default config;
|