gbs-add-block 0.0.61 → 0.0.63
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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# GBS Building Blocks 2.0 (v0.0.
|
|
1
|
+
# GBS Building Blocks 2.0 (v0.0.63)
|
|
2
2
|
|
|
3
3
|
Latest and upgraded version of GBS building blocks with headless UI and removed dependencies.
|
|
4
4
|
|
|
@@ -6,7 +6,7 @@ Latest and upgraded version of GBS building blocks with headless UI and removed
|
|
|
6
6
|
|
|
7
7
|
For detailed documentation on usage and props, Please visit: [Building Block Documentation v2.0](https://blackmax-designs.gitbook.io/building-block-v2.0)
|
|
8
8
|
|
|
9
|
-
## What's New 🎉 (Ver 0.0.
|
|
9
|
+
## What's New 🎉 (Ver 0.0.63)
|
|
10
10
|
|
|
11
11
|
- Updated for bug fixes.
|
|
12
12
|
- New component "Skeleton" & "Navbar" Added.
|
package/index.js
CHANGED
|
@@ -77,7 +77,12 @@ const copyComponent = async (component, destPath) => {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
await fs.copy(componentSrc, componentDest, { overwrite: true });
|
|
80
|
-
console.log(
|
|
80
|
+
console.log(
|
|
81
|
+
`✓ Component ${component} installed successfully ${
|
|
82
|
+
component === "Grid" &&
|
|
83
|
+
"This Version of Grid will be deprecated soon. Please Install The New Data Grid Component"
|
|
84
|
+
}`
|
|
85
|
+
);
|
|
81
86
|
} catch (error) {
|
|
82
87
|
console.error(`Error installing component ${component}:`, error.message);
|
|
83
88
|
process.exit(1);
|
|
@@ -96,10 +101,7 @@ const installComponentWithDependencies = async (component, destPath) => {
|
|
|
96
101
|
|
|
97
102
|
if (pendingInstalls.length === 0) {
|
|
98
103
|
console.log(
|
|
99
|
-
`✓ ${component} and all its dependencies are already installed
|
|
100
|
-
component === "Grid" &&
|
|
101
|
-
"This Version of Grid will be deprecated soon. Please Install The New Data Grid Component"
|
|
102
|
-
}`
|
|
104
|
+
`✓ ${component} and all its dependencies are already installed.`
|
|
103
105
|
);
|
|
104
106
|
return;
|
|
105
107
|
}
|
package/package.json
CHANGED
|
@@ -1,152 +1,3 @@
|
|
|
1
|
-
// import React from "react";
|
|
2
|
-
// import Icon from "../../icon/Icon";
|
|
3
|
-
// import { listFilter } from "../../icon/iconPaths";
|
|
4
|
-
// import FilterPopup from "./FilterPopup";
|
|
5
|
-
// import { Column, GridBodyProps } from "../type";
|
|
6
|
-
|
|
7
|
-
// const GridBody: React.FC<GridBodyProps> = ({
|
|
8
|
-
// selectAll,
|
|
9
|
-
// handleSelectAll,
|
|
10
|
-
// workingColumns,
|
|
11
|
-
// tableHeaderStyle,
|
|
12
|
-
// toggleFilterPopup,
|
|
13
|
-
// activeFilterArray,
|
|
14
|
-
// handleFilterAction,
|
|
15
|
-
// workingDataSource,
|
|
16
|
-
// isFetching,
|
|
17
|
-
// currentPage,
|
|
18
|
-
// pageSettings,
|
|
19
|
-
// gridColumnStyleSelectAll,
|
|
20
|
-
// isRowSelected,
|
|
21
|
-
// handleSelect,
|
|
22
|
-
// gridColumnStyle,
|
|
23
|
-
// rowChange,
|
|
24
|
-
// }) => {
|
|
25
|
-
// const renderCell = (rowData: any, column: Column, rowIndex: number) => {
|
|
26
|
-
// const cellValue = rowData[column.field];
|
|
27
|
-
|
|
28
|
-
// if (column.template) {
|
|
29
|
-
// return (
|
|
30
|
-
// <column.template
|
|
31
|
-
// rowData={rowData}
|
|
32
|
-
// rowIndex={rowIndex + currentPage * pageSettings.pageNumber}
|
|
33
|
-
// rowChange={(changes: any) => rowChange?.(changes)}
|
|
34
|
-
// />
|
|
35
|
-
// );
|
|
36
|
-
// }
|
|
37
|
-
|
|
38
|
-
// if (column.tooltip) {
|
|
39
|
-
// return (
|
|
40
|
-
// <span title={cellValue?.toString()}>
|
|
41
|
-
// {cellValue && cellValue.length > 10
|
|
42
|
-
// ? `${cellValue.slice(0, 10)}...`
|
|
43
|
-
// : cellValue}
|
|
44
|
-
// </span>
|
|
45
|
-
// );
|
|
46
|
-
// }
|
|
47
|
-
|
|
48
|
-
// return cellValue;
|
|
49
|
-
// };
|
|
50
|
-
|
|
51
|
-
// return (
|
|
52
|
-
// <div className="overflow-x-auto">
|
|
53
|
-
// <table className="min-w-full">
|
|
54
|
-
// <thead>
|
|
55
|
-
// <tr>
|
|
56
|
-
// {selectAll && (
|
|
57
|
-
// <th className="text-left border-b border-t bg-gray-50 px-4 py-4 dark:bg-gray-700 dark:text-white">
|
|
58
|
-
// <input type="checkbox" onChange={handleSelectAll} />
|
|
59
|
-
// </th>
|
|
60
|
-
// )}
|
|
61
|
-
// {workingColumns.map((column, colIndex) => (
|
|
62
|
-
// <th
|
|
63
|
-
// key={colIndex}
|
|
64
|
-
// className={tableHeaderStyle}
|
|
65
|
-
// style={{ width: column.width ? `${column.width}px` : "auto" }}
|
|
66
|
-
// >
|
|
67
|
-
// <div className="flex items-center relative">
|
|
68
|
-
// {column.headerText || column.field}
|
|
69
|
-
// {column.filter && !column.template && (
|
|
70
|
-
// <>
|
|
71
|
-
// <button onClick={() => toggleFilterPopup(colIndex)}>
|
|
72
|
-
// <Icon
|
|
73
|
-
// dimensions={{ width: "12", height: "12" }}
|
|
74
|
-
// elements={listFilter}
|
|
75
|
-
// svgClass={`ml-2 fill-none dark:stroke-white ${
|
|
76
|
-
// activeFilterArray.some(
|
|
77
|
-
// (filter) => filter.filterColumn === column.field
|
|
78
|
-
// )
|
|
79
|
-
// ? "stroke-red-400"
|
|
80
|
-
// : "stroke-black"
|
|
81
|
-
// }`}
|
|
82
|
-
// />
|
|
83
|
-
// </button>
|
|
84
|
-
// <FilterPopup
|
|
85
|
-
// show={column.showFilterPopup ?? false}
|
|
86
|
-
// columnHeader={column.field}
|
|
87
|
-
// filterAction={(action: any) =>
|
|
88
|
-
// handleFilterAction(action, colIndex)
|
|
89
|
-
// }
|
|
90
|
-
// />
|
|
91
|
-
// </>
|
|
92
|
-
// )}
|
|
93
|
-
// </div>
|
|
94
|
-
// </th>
|
|
95
|
-
// ))}
|
|
96
|
-
// </tr>
|
|
97
|
-
// </thead>
|
|
98
|
-
// <tbody>
|
|
99
|
-
// {workingDataSource.length > 0 && !isFetching ? (
|
|
100
|
-
// workingDataSource
|
|
101
|
-
// .slice(
|
|
102
|
-
// currentPage * pageSettings.pageNumber,
|
|
103
|
-
// (currentPage + 1) * pageSettings.pageNumber
|
|
104
|
-
// )
|
|
105
|
-
// .map((rowData, rowIndex) => (
|
|
106
|
-
// <tr
|
|
107
|
-
// key={rowIndex}
|
|
108
|
-
// className="hover:bg-gray-50 dark:hover:bg-gray-900 cursor-pointer"
|
|
109
|
-
// >
|
|
110
|
-
// {selectAll && (
|
|
111
|
-
// <td className={gridColumnStyleSelectAll}>
|
|
112
|
-
// <input
|
|
113
|
-
// type="checkbox"
|
|
114
|
-
// checked={isRowSelected(rowData)}
|
|
115
|
-
// onChange={() => handleSelect(rowData)}
|
|
116
|
-
// />
|
|
117
|
-
// </td>
|
|
118
|
-
// )}
|
|
119
|
-
// {workingColumns.map((column, colIndex) => (
|
|
120
|
-
// <td
|
|
121
|
-
// key={colIndex}
|
|
122
|
-
// className={gridColumnStyle}
|
|
123
|
-
// style={{
|
|
124
|
-
// width: column.width ? `${column.width}px` : "auto",
|
|
125
|
-
// }}
|
|
126
|
-
// >
|
|
127
|
-
// {renderCell(rowData, column, rowIndex)}
|
|
128
|
-
// </td>
|
|
129
|
-
// ))}
|
|
130
|
-
// </tr>
|
|
131
|
-
// ))
|
|
132
|
-
// ) : (
|
|
133
|
-
// <tr>
|
|
134
|
-
// <td
|
|
135
|
-
// colSpan={workingColumns.length}
|
|
136
|
-
// className="text-center p-4 border-b text-sm"
|
|
137
|
-
// >
|
|
138
|
-
// {isFetching ? "Fetching Data Please Wait..." : "No Data Found"}
|
|
139
|
-
// </td>
|
|
140
|
-
// </tr>
|
|
141
|
-
// )}
|
|
142
|
-
// </tbody>
|
|
143
|
-
// </table>
|
|
144
|
-
// </div>
|
|
145
|
-
// );
|
|
146
|
-
// };
|
|
147
|
-
|
|
148
|
-
// export default GridBody;
|
|
149
|
-
|
|
150
1
|
import React from "react";
|
|
151
2
|
import { useGridContext } from "../context/GridContext";
|
|
152
3
|
import { useGridFilter, useGridRowSelection } from "../hooks/GridHooks";
|
|
@@ -281,8 +132,8 @@ const GridBody = () => {
|
|
|
281
132
|
isRowSelected(rowData)
|
|
282
133
|
? "bg-blue-100 dark:bg-blue-900"
|
|
283
134
|
: rowIndex % 2 === 0
|
|
284
|
-
? "bg-gray-50 dark:bg-zinc-800"
|
|
285
|
-
: "bg-white dark:bg-zinc-900"
|
|
135
|
+
? "bg-gray-50 dark:bg-zinc-800 cursor-pointer hover:bg-zinc-200 dark:hover:bg-zinc-700"
|
|
136
|
+
: "bg-white dark:bg-zinc-900 cursor-pointer hover:bg-zinc-200 dark:hover:bg-zinc-700"
|
|
286
137
|
}
|
|
287
138
|
onClick={() => rowChange(rowData)}
|
|
288
139
|
>
|
|
@@ -1,125 +1,3 @@
|
|
|
1
|
-
// import React from "react";
|
|
2
|
-
// import Icon from "../../icon/Icon";
|
|
3
|
-
// import {
|
|
4
|
-
// leftArrow,
|
|
5
|
-
// leftArrows,
|
|
6
|
-
// rightArrow,
|
|
7
|
-
// rightArrows,
|
|
8
|
-
// } from "../../icon/iconPaths";
|
|
9
|
-
// import { PaginationProps } from "../type";
|
|
10
|
-
|
|
11
|
-
// export default function Pagination({
|
|
12
|
-
// goToFirstPage,
|
|
13
|
-
// currentPage,
|
|
14
|
-
// prevPage,
|
|
15
|
-
// pageStart,
|
|
16
|
-
// goToPage,
|
|
17
|
-
// workingDataSource,
|
|
18
|
-
// pageEnd,
|
|
19
|
-
// totalPages,
|
|
20
|
-
// nextPage,
|
|
21
|
-
// goToEndPage,
|
|
22
|
-
// }: PaginationProps) {
|
|
23
|
-
// return (
|
|
24
|
-
// <div className="flex p-2 justify-between dark:text-white text-xs mt-4">
|
|
25
|
-
// <div className="flex gap-4">
|
|
26
|
-
// <button
|
|
27
|
-
// onClick={goToFirstPage}
|
|
28
|
-
// className={`${
|
|
29
|
-
// currentPage === 0
|
|
30
|
-
// ? "text-gray-200 dark:text-gray-700 cursor-pointer"
|
|
31
|
-
// : ""
|
|
32
|
-
// }`}
|
|
33
|
-
// >
|
|
34
|
-
// <Icon
|
|
35
|
-
// elements={leftArrows}
|
|
36
|
-
// svgClass={`${
|
|
37
|
-
// currentPage === 0
|
|
38
|
-
// ? "stroke-gray-200 fill-none dark:stroke-gray-700 cursor-pointer"
|
|
39
|
-
// : "stroke-black fill-none dark:stroke-white cursor-pointer"
|
|
40
|
-
// }`}
|
|
41
|
-
// />
|
|
42
|
-
// </button>
|
|
43
|
-
// <button onClick={prevPage}>
|
|
44
|
-
// <Icon
|
|
45
|
-
// elements={leftArrow}
|
|
46
|
-
// svgClass={`${
|
|
47
|
-
// currentPage === 0
|
|
48
|
-
// ? "stroke-gray-200 fill-none dark:stroke-gray-700 cursor-pointer"
|
|
49
|
-
// : "stroke-black fill-none dark:stroke-white cursor-pointer"
|
|
50
|
-
// }`}
|
|
51
|
-
// />
|
|
52
|
-
// </button>
|
|
53
|
-
// <div className="flex flex-row gap-3 items-center">
|
|
54
|
-
// {pageStart > 0 && (
|
|
55
|
-
// <button
|
|
56
|
-
// className="p-1 w-5 h-5 flex items-center justify-center rounded-full cursor-pointer"
|
|
57
|
-
// onClick={() => goToPage(pageStart - 1)}
|
|
58
|
-
// >
|
|
59
|
-
// ...
|
|
60
|
-
// </button>
|
|
61
|
-
// )}
|
|
62
|
-
// {workingDataSource.length > 0 &&
|
|
63
|
-
// Array.from({ length: pageEnd - pageStart }).map((_, i) => (
|
|
64
|
-
// <button
|
|
65
|
-
// key={i}
|
|
66
|
-
// onClick={() => goToPage(pageStart + i)}
|
|
67
|
-
// className={`${
|
|
68
|
-
// pageStart + i === currentPage
|
|
69
|
-
// ? "font-bold text-white p-2 h-6 bg-black flex items-center justify-center rounded-md w-auto dark:bg-white dark:text-black"
|
|
70
|
-
// : ""
|
|
71
|
-
// }`}
|
|
72
|
-
// >
|
|
73
|
-
// {pageStart + i + 1}
|
|
74
|
-
// </button>
|
|
75
|
-
// ))}
|
|
76
|
-
// {pageEnd < totalPages && (
|
|
77
|
-
// <button onClick={() => goToPage(pageEnd)}>...</button>
|
|
78
|
-
// )}
|
|
79
|
-
// </div>
|
|
80
|
-
// <button
|
|
81
|
-
// onClick={nextPage}
|
|
82
|
-
// className={`${
|
|
83
|
-
// currentPage === totalPages - 1 || workingDataSource.length <= 0
|
|
84
|
-
// ? "text-gray-200 dark:text-gray-700 cursor-pointer"
|
|
85
|
-
// : ""
|
|
86
|
-
// }`}
|
|
87
|
-
// >
|
|
88
|
-
// <Icon
|
|
89
|
-
// elements={rightArrow}
|
|
90
|
-
// svgClass={`${
|
|
91
|
-
// currentPage === totalPages - 1 || workingDataSource.length <= 0
|
|
92
|
-
// ? "stroke-gray-200 fill-none dark:stroke-gray-700 cursor-pointer"
|
|
93
|
-
// : "stroke-black fill-none dark:stroke-white cursor-pointer"
|
|
94
|
-
// }`}
|
|
95
|
-
// />
|
|
96
|
-
// </button>
|
|
97
|
-
// <button
|
|
98
|
-
// onClick={goToEndPage}
|
|
99
|
-
// className={`${
|
|
100
|
-
// currentPage === totalPages - 1 || workingDataSource.length <= 0
|
|
101
|
-
// ? "text-gray-200 dark:text-gray-700 cursor-pointer"
|
|
102
|
-
// : ""
|
|
103
|
-
// }`}
|
|
104
|
-
// >
|
|
105
|
-
// <Icon
|
|
106
|
-
// elements={rightArrows}
|
|
107
|
-
// svgClass={`${
|
|
108
|
-
// currentPage === totalPages - 1 || workingDataSource.length <= 0
|
|
109
|
-
// ? "stroke-gray-200 fill-none dark:stroke-gray-700 cursor-pointer"
|
|
110
|
-
// : "stroke-black fill-none dark:stroke-white cursor-pointer"
|
|
111
|
-
// }`}
|
|
112
|
-
// />
|
|
113
|
-
// </button>
|
|
114
|
-
// </div>
|
|
115
|
-
// <div className="flex text-xs">
|
|
116
|
-
// {currentPage + 1} of {totalPages} pages ({workingDataSource.length})
|
|
117
|
-
// items
|
|
118
|
-
// </div>
|
|
119
|
-
// </div>
|
|
120
|
-
// );
|
|
121
|
-
// }
|
|
122
|
-
|
|
123
1
|
import React from "react";
|
|
124
2
|
import { useGridPagination } from "../hooks/GridHooks";
|
|
125
3
|
import Icon from "../../icon/Icon";
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Grampro Business Services and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
* Extended Documentation for Grid can be found at
|
|
7
|
-
* https://psychedelic-step-e70.notion.site/Data-GRID-by-GBS-R-D-20ff97c899d24bc590215a6196435fa3
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
"use client";
|
|
11
|
-
|
|
12
1
|
import React, { forwardRef, useImperativeHandle } from "react";
|
|
13
2
|
import type { GridProps } from "../type";
|
|
14
3
|
import Pagination from "./GridPagination";
|