react-base-data-table 0.0.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 +183 -0
- package/dist/index.cjs.js +77 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.es.js +10434 -0
- package/dist/index.es.js.map +1 -0
- package/dist/style.css +1 -0
- package/dist/types/App.d.ts +3 -0
- package/dist/types/DUMMY_ITEMS.d.ts +6 -0
- package/dist/types/components/BaseButton.d.ts +17 -0
- package/dist/types/components/BaseTable/BaseTable.d.ts +46 -0
- package/dist/types/components/BaseTable/BaseTableCell.d.ts +29 -0
- package/dist/types/components/BaseTable/BaseTableGroupRow.d.ts +13 -0
- package/dist/types/components/BaseTable/BaseTableHeader.d.ts +18 -0
- package/dist/types/components/BaseTable/BaseTableHeaders.d.ts +16 -0
- package/dist/types/components/BaseTable/BaseTableRow.d.ts +29 -0
- package/dist/types/components/BaseTable/BaseTableWithContext.d.ts +3 -0
- package/dist/types/components/BaseTable/CommentPopup.d.ts +15 -0
- package/dist/types/components/BaseTable/ContextMenu.d.ts +15 -0
- package/dist/types/components/BaseTable/CustomRenderItem.d.ts +8 -0
- package/dist/types/components/BaseTable/TableFilter.d.ts +16 -0
- package/dist/types/components/BaseTable/cellImplementation/ListCell.d.ts +10 -0
- package/dist/types/components/BaseTable/contexts/useCommentPopupContext.d.ts +12 -0
- package/dist/types/components/BaseTable/hooks/useCellPopup.d.ts +16 -0
- package/dist/types/components/BaseTable/hooks/useDragSelection.d.ts +13 -0
- package/dist/types/components/BaseTable/hooks/useRowDragDrop.d.ts +16 -0
- package/dist/types/components/BaseTable/hooks/useTableData.d.ts +19 -0
- package/dist/types/components/BaseTable/hooks/useTableFiltering.d.ts +13 -0
- package/dist/types/components/BaseTable/hooks/useTableGrouping.d.ts +28 -0
- package/dist/types/components/BaseTable/hooks/useTableInteractions.d.ts +35 -0
- package/dist/types/components/BaseTable/hooks/useTableSorting.d.ts +13 -0
- package/dist/types/components/BaseTable/hooks/useVirtualRows.d.ts +10 -0
- package/dist/types/components/BaseTable/models/ActiveTableFilter.d.ts +4 -0
- package/dist/types/components/BaseTable/models/BaseTableHeaders.d.ts +30 -0
- package/dist/types/components/BaseTable/models/CellCordinate.d.ts +4 -0
- package/dist/types/components/BaseTable/models/CommentData.d.ts +9 -0
- package/dist/types/components/BaseTable/models/ContextMenuAction.d.ts +12 -0
- package/dist/types/components/BaseTable/models/GroupInfo.d.ts +7 -0
- package/dist/types/components/BaseTable/models/HighlightCondition.d.ts +7 -0
- package/dist/types/components/BaseTable/models/ItemWithGroupInfo.d.ts +7 -0
- package/dist/types/components/BaseTable/models/TableConfiguration.d.ts +4 -0
- package/dist/types/components/BaseTable/models/TableItem.d.ts +4 -0
- package/dist/types/components/BaseTable/tableFunctions/CellSelection.d.ts +6 -0
- package/dist/types/components/BaseTable/tableFunctions/FilteringAndSorting.d.ts +7 -0
- package/dist/types/components/ColorPicker.d.ts +7 -0
- package/dist/types/enum/DateUnits.d.ts +8 -0
- package/dist/types/enum/FilterTypes.d.ts +4 -0
- package/dist/types/hooks/useClickOutside.d.ts +2 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/main.d.ts +1 -0
- package/dist/types/utils/array.d.ts +5 -0
- package/dist/types/utils/enum.d.ts +3 -0
- package/dist/types/utils/sorting.d.ts +4 -0
- package/dist/vite.svg +1 -0
- package/package.json +74 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type TableItem from "./TableItem";
|
|
3
|
+
export declare const TableHeaderType: {
|
|
4
|
+
readonly STRING: "string";
|
|
5
|
+
readonly LIST: "list";
|
|
6
|
+
readonly NUMBER: "number";
|
|
7
|
+
};
|
|
8
|
+
export type TableHeaderType = (typeof TableHeaderType)[keyof typeof TableHeaderType];
|
|
9
|
+
export default interface BaseTableHeader {
|
|
10
|
+
id: string;
|
|
11
|
+
text: string;
|
|
12
|
+
hasFilter?: boolean;
|
|
13
|
+
width?: number;
|
|
14
|
+
children?: BaseTableHeader[];
|
|
15
|
+
editOptions?: {
|
|
16
|
+
editable?: boolean;
|
|
17
|
+
isDisabled?: (item: TableItem) => boolean;
|
|
18
|
+
greyedOutIfNotEditable?: boolean;
|
|
19
|
+
required?: boolean;
|
|
20
|
+
type: TableHeaderType;
|
|
21
|
+
options?: string[];
|
|
22
|
+
defaultValue?: string | number;
|
|
23
|
+
canAddNewOption?: boolean;
|
|
24
|
+
};
|
|
25
|
+
sortable?: boolean;
|
|
26
|
+
align?: "left" | "center" | "right";
|
|
27
|
+
customSort?: (a: TableItem, b: TableItem, ascendingOrder: boolean) => number;
|
|
28
|
+
customHeader?: (header: BaseTableHeader) => ReactNode;
|
|
29
|
+
customRender?: (item: TableItem, header: BaseTableHeader) => ReactNode;
|
|
30
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type CellCoordinate from "./CellCordinate";
|
|
2
|
+
import type TableItem from "./TableItem";
|
|
3
|
+
export default interface ContextMenuAction {
|
|
4
|
+
icon?: string;
|
|
5
|
+
iconColor?: string;
|
|
6
|
+
text: string;
|
|
7
|
+
onClick: (item: TableItem, itemCoordinates: CellCoordinate) => void;
|
|
8
|
+
groupName?: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
subActions?: ContextMenuAction[];
|
|
11
|
+
customRender?: () => React.ReactNode;
|
|
12
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type CellCoordinate from "../models/CellCordinate";
|
|
2
|
+
declare const calculateSelectedCellAndExpandedSelection: (e: React.KeyboardEvent, selectedCell: CellCoordinate | undefined, expandedSelection: CellCoordinate[], columnsCount: number, rowsCount: number) => {
|
|
3
|
+
newSelectedCell: CellCoordinate | undefined;
|
|
4
|
+
newExpandedSelection: CellCoordinate[];
|
|
5
|
+
};
|
|
6
|
+
export default calculateSelectedCellAndExpandedSelection;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type ActiveTableFilter from "../models/ActiveTableFilter";
|
|
2
|
+
import type BaseTableHeader from "../models/BaseTableHeaders";
|
|
3
|
+
import type TableItem from "../models/TableItem";
|
|
4
|
+
export declare const NBSP = "\u00A0";
|
|
5
|
+
export declare const filterItems: (items: TableItem[], filters: ActiveTableFilter[]) => TableItem[];
|
|
6
|
+
export declare const sortItems: (items: TableItem[], headers: BaseTableHeader[], currentSortType: "asc" | "desc", sortBy: string | undefined) => TableItem[];
|
|
7
|
+
export declare const tryToConvertToNumber: (item: any) => any;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
declare const ColorPicker: ({ initialColor, applyOpacity, onColorChange, onClose, }: {
|
|
2
|
+
initialColor?: string;
|
|
3
|
+
applyOpacity?: number;
|
|
4
|
+
onColorChange: (color: string) => void;
|
|
5
|
+
onClose?: () => void;
|
|
6
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export default ColorPicker;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { default as BaseTable } from "./components/BaseTable/BaseTableWithContext";
|
|
2
|
+
import ActiveTableFilter from "./components/BaseTable/models/ActiveTableFilter";
|
|
3
|
+
export type { ActiveTableFilter };
|
|
4
|
+
import BaseTableHeader from "./components/BaseTable/models/BaseTableHeaders";
|
|
5
|
+
export type { BaseTableHeader };
|
|
6
|
+
import TableConfiguration from "./components/BaseTable/models/TableConfiguration";
|
|
7
|
+
export type { TableConfiguration };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./index.css";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import TableItem from "../components/BaseTable/models/TableItem";
|
|
2
|
+
export declare const arrayMove: <T>(array: Array<T>, fromIndex: number, toIndex: number) => void;
|
|
3
|
+
export declare const removeDuplicates: (arr: string[]) => string[];
|
|
4
|
+
export declare const isArrayOfType: <T>(array: TableItem[], type: T) => boolean;
|
|
5
|
+
export declare const isNumberArray: (array: unknown[]) => array is number[];
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const alphabeticalSort: (a: string, b: string) => 1 | 0 | -1;
|
|
2
|
+
export declare const alphabeticalSortInverse: (a: string, b: string) => 1 | 0 | -1;
|
|
3
|
+
export declare const numericalSort: (a: number, b: number) => number;
|
|
4
|
+
export declare const numericalSortInverse: (a: number, b: number) => number;
|
package/dist/vite.svg
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
package/package.json
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "react-base-data-table",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"types": "dist/types/index.d.ts",
|
|
7
|
+
"main": "dist/index.es.js",
|
|
8
|
+
"style": "dist/style.css",
|
|
9
|
+
"module": "dist/index.es.js",
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"typings"
|
|
13
|
+
],
|
|
14
|
+
"sideEffects": [
|
|
15
|
+
"**/*.css"
|
|
16
|
+
],
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"require": "./dist/index.cjs.js",
|
|
20
|
+
"import": "./dist/index.es.js",
|
|
21
|
+
"types": "./dist/types/index.d.ts"
|
|
22
|
+
},
|
|
23
|
+
"./style.css": "./dist/style.css"
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"dev": "vite",
|
|
27
|
+
"build": "tsc -p tsconfig.app.json && vite build",
|
|
28
|
+
"buildForNPM": "vite build && tsc -p tsconfig.app.json",
|
|
29
|
+
"buildForNPM:css": "tailwind -i ./src/index.css -o ./dist/style.css --minify",
|
|
30
|
+
"lint": "eslint .",
|
|
31
|
+
"preview": "vite preview",
|
|
32
|
+
"test": "jest",
|
|
33
|
+
"test:watch": "jest --watch"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@eslint/js": "^9.13.0",
|
|
37
|
+
"@mdi/js": "^7.4.47",
|
|
38
|
+
"@mdi/react": "^1.6.1",
|
|
39
|
+
"@tailwindcss/postcss": "^4.1.11",
|
|
40
|
+
"@tailwindcss/vite": "^4.1.11",
|
|
41
|
+
"@testing-library/dom": "^10.4.0",
|
|
42
|
+
"@testing-library/jest-dom": "^6.6.3",
|
|
43
|
+
"@testing-library/react": "^16.2.0",
|
|
44
|
+
"@testing-library/user-event": "^14.6.0",
|
|
45
|
+
"@types/jest": "^29.5.14",
|
|
46
|
+
"@types/react": "^18.3.12",
|
|
47
|
+
"@types/react-color": "^3.0.13",
|
|
48
|
+
"@types/react-dom": "^18.3.1",
|
|
49
|
+
"@vitejs/plugin-react": "^4.3.3",
|
|
50
|
+
"daisyui": "^5.0.43",
|
|
51
|
+
"eslint": "^9.13.0",
|
|
52
|
+
"eslint-plugin-react-hooks": "^5.0.0",
|
|
53
|
+
"eslint-plugin-react-refresh": "^0.4.14",
|
|
54
|
+
"globals": "^15.11.0",
|
|
55
|
+
"jest": "^29.7.0",
|
|
56
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
57
|
+
"postcss": "^8.4.49",
|
|
58
|
+
"prettier": "^3.4.0",
|
|
59
|
+
"tailwindcss": "^4.1.11",
|
|
60
|
+
"ts-jest": "^29.2.5",
|
|
61
|
+
"ts-node": "^10.9.2",
|
|
62
|
+
"typescript": "~5.6.2",
|
|
63
|
+
"typescript-eslint": "^8.11.0",
|
|
64
|
+
"vite": "^5.4.10"
|
|
65
|
+
},
|
|
66
|
+
"peerDependencies": {
|
|
67
|
+
"react": "^19.1.0",
|
|
68
|
+
"react-dom": "^19.1.0"
|
|
69
|
+
},
|
|
70
|
+
"dependencies": {
|
|
71
|
+
"@tanstack/react-virtual": "^3.13.12",
|
|
72
|
+
"react-color": "^2.19.3"
|
|
73
|
+
}
|
|
74
|
+
}
|