@megha-ui/react 1.2.170 → 1.2.171
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/components/block/index.js +3 -5
- package/dist/components/button/index.js +3 -5
- package/dist/components/button/types/borderStyle.js +1 -2
- package/dist/components/button/types/cursorType.js +1 -2
- package/dist/components/card/index.js +7 -9
- package/dist/components/checkbox/index.js +7 -9
- package/dist/components/date-input/index.js +6 -8
- package/dist/components/dropdown/index.js +42 -47
- package/dist/components/grid/hooks/useBulkSelect.js +6 -10
- package/dist/components/grid/hooks/usePagination.js +6 -10
- package/dist/components/grid/hooks/useResizeObserver.js +3 -5
- package/dist/components/grid/hooks/useSearch.js +3 -7
- package/dist/components/grid/hooks/useSort.js +4 -8
- package/dist/components/grid/hooks/useVisibleData.js +6 -10
- package/dist/components/grid/index.js +149 -186
- package/dist/components/grid/types/grid.d.ts +1 -0
- package/dist/components/grid/types/grid.js +1 -2
- package/dist/components/grid/utils/SummariseDetails.js +12 -17
- package/dist/components/grid/utils/calculatedropdown.js +4 -6
- package/dist/components/grid/utils/globalSearchChips.js +11 -16
- package/dist/components/grid/utils/gridFilterDropdown.js +22 -27
- package/dist/components/grid/utils/gridHeader.js +78 -118
- package/dist/components/grid/utils/gridHeaderDropdown.js +4 -6
- package/dist/components/grid/utils/gridRow.js +29 -34
- package/dist/components/grid/utils/groupedGridDetails.js +17 -22
- package/dist/components/grid/utils/groupedRow.js +12 -17
- package/dist/components/grid/utils/pagination.js +7 -11
- package/dist/components/grid/utils/paginationUtils.js +1 -5
- package/dist/components/grid/utils/regexUtils.js +2 -7
- package/dist/components/grid/utils/shimmer.js +4 -6
- package/dist/components/grid/utils/textFilterDropdown.js +8 -13
- package/dist/components/loader/index.js +6 -41
- package/dist/components/modal/index.js +11 -13
- package/dist/components/tabs/index.js +19 -26
- package/dist/components/text/index.js +3 -5
- package/dist/components/text/textType.js +1 -2
- package/dist/components/text-input/index.js +10 -12
- package/dist/components/textarea/index.js +3 -5
- package/dist/components/texteditor/index.js +25 -27
- package/dist/components/toggle/index.js +4 -6
- package/dist/index.js +16 -41
- package/dist/services/commonService.js +3 -7
- package/package.json +1 -1
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
4
2
|
const GridHeaderDropdown = ({ options, onClose, column, }) => {
|
|
5
|
-
return ((
|
|
3
|
+
return (_jsx(_Fragment, { children: options
|
|
6
4
|
.filter((option) => (["asc", "dsc"].includes(option.order || "") && (column === null || column === void 0 ? void 0 : column.sortable)) ||
|
|
7
5
|
option.label.includes("Group") ||
|
|
8
6
|
option.label.includes("Ungroup"))
|
|
9
|
-
.map((option, index) => ((
|
|
7
|
+
.map((option, index) => (_jsx("div", { style: { padding: "0.5rem 0.75rem", cursor: "pointer" }, onClick: () => {
|
|
10
8
|
column && option.action && option.action(column, option.order);
|
|
11
9
|
column &&
|
|
12
10
|
option.groupBy &&
|
|
@@ -14,4 +12,4 @@ const GridHeaderDropdown = ({ options, onClose, column, }) => {
|
|
|
14
12
|
onClose();
|
|
15
13
|
}, children: option.label }, index))) }));
|
|
16
14
|
};
|
|
17
|
-
|
|
15
|
+
export default GridHeaderDropdown;
|
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const react_1 = require("react");
|
|
8
|
-
const shimmer_1 = __importDefault(require("./shimmer"));
|
|
9
|
-
const checkbox_1 = __importDefault(require("../../checkbox"));
|
|
10
|
-
const commonService_1 = require("../../../services/commonService");
|
|
11
|
-
const md_1 = require("react-icons/md");
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { memo, useCallback, useEffect, useState } from "react";
|
|
3
|
+
import Shimmer from "./shimmer";
|
|
4
|
+
import Checkbox from "../../checkbox";
|
|
5
|
+
import { formatValue } from "../../../services/commonService";
|
|
6
|
+
import { MdDragIndicator } from "react-icons/md";
|
|
12
7
|
const isUrl = (value) => {
|
|
13
8
|
if (value) {
|
|
14
9
|
const urlPattern = new RegExp("^(https?:\\/\\/)?" +
|
|
@@ -25,25 +20,25 @@ const isUrl = (value) => {
|
|
|
25
20
|
};
|
|
26
21
|
const GridRow = ({ item, rowStyle, cellStyle, rowHeight, bulkSelect, selectedRows, toggleRowSelection, columns, widthMode, index, rowKey, hasVerticalScroll, onRowClick, loading, groupBy, rowIndex, columnIndex, hlBorderColor, handleDragStart, handleDragOver, handleDrop, draggable, checkboxWrapper, hugColumnWidths, hugColumnHeights, alternateRowColor, isExpandable, expandedRow, ignoreRowSelect, locale, formatOptions, }) => {
|
|
27
22
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
28
|
-
const [itemsAlign, setItemsAlign] =
|
|
29
|
-
const [draggableIndex, setDraggableIndex] =
|
|
30
|
-
const handleRowClick =
|
|
23
|
+
const [itemsAlign, setItemsAlign] = useState("stretch");
|
|
24
|
+
const [draggableIndex, setDraggableIndex] = useState(0);
|
|
25
|
+
const handleRowClick = useCallback(() => {
|
|
31
26
|
onRowClick === null || onRowClick === void 0 ? void 0 : onRowClick(item);
|
|
32
27
|
}, [onRowClick, item]);
|
|
33
|
-
const getRowClassNames =
|
|
28
|
+
const getRowClassNames = useCallback(() => {
|
|
34
29
|
let classNames = ["row"];
|
|
35
30
|
if (onRowClick)
|
|
36
31
|
classNames.push("cursor-pointer");
|
|
37
32
|
return classNames.join(" ");
|
|
38
33
|
}, [onRowClick]);
|
|
39
|
-
|
|
34
|
+
useEffect(() => {
|
|
40
35
|
setItemsAlign(Object.values(item)
|
|
41
36
|
.map((value) => value.itemsAlign)
|
|
42
37
|
.every((item) => item === "start")
|
|
43
38
|
? "start"
|
|
44
39
|
: "stretch");
|
|
45
40
|
}, [item]);
|
|
46
|
-
|
|
41
|
+
useEffect(() => {
|
|
47
42
|
let _dragIndex = 0;
|
|
48
43
|
if (draggable && columns.length > 0) {
|
|
49
44
|
if (columns[0].key === "actions") {
|
|
@@ -54,10 +49,10 @@ const GridRow = ({ item, rowStyle, cellStyle, rowHeight, bulkSelect, selectedRow
|
|
|
54
49
|
}, [columns]);
|
|
55
50
|
return isExpandable &&
|
|
56
51
|
expandedRow === item.id.value &&
|
|
57
|
-
item.expandedDetails ? ((
|
|
52
|
+
item.expandedDetails ? (_jsxs("div", { children: [_jsxs("div", { id: `${index}`, draggable: draggable, onDragStart: (e) => handleDragStart && handleDragStart(e, index), onDragOver: (e) => handleDragOver && handleDragOver(e), onDrop: (e) => handleDrop && handleDrop(e, index), className: getRowClassNames(), style: Object.assign(Object.assign({}, rowStyle), { position: "relative", display: "flex", alignItems: itemsAlign, fontSize: "inherit", minHeight: rowHeight, height: "max-content", boxSizing: "border-box", backgroundColor: alternateRowColor && (index + 1) % 2 === 0
|
|
58
53
|
? "var(--row-bg)"
|
|
59
|
-
: "var(--row-bg-even)" }), onClick: handleRowClick, children: [bulkSelect && ((
|
|
60
|
-
ignoreRowSelect.has((_a = item["id"].value) === null || _a === void 0 ? void 0 : _a.toString()), onChange: () => { var _a; return toggleRowSelection((_a = item["id"].value) === null || _a === void 0 ? void 0 : _a.toString()); }, selected: item["id"] && selectedRows.has(item["id"].value), wrapperClass: checkboxWrapper }) })), item[groupBy] && ((
|
|
54
|
+
: "var(--row-bg-even)" }), onClick: handleRowClick, children: [bulkSelect && (_jsx("div", { style: Object.assign(Object.assign({}, cellStyle), { textTransform: "uppercase", padding: "0.5rem", textAlign: "left", whiteSpace: "nowrap", textOverflow: "ellipsis" }), children: _jsx(Checkbox, { noLabel: true, disabled: ignoreRowSelect &&
|
|
55
|
+
ignoreRowSelect.has((_a = item["id"].value) === null || _a === void 0 ? void 0 : _a.toString()), onChange: () => { var _a; return toggleRowSelection((_a = item["id"].value) === null || _a === void 0 ? void 0 : _a.toString()); }, selected: item["id"] && selectedRows.has(item["id"].value), wrapperClass: checkboxWrapper }) })), item[groupBy] && (_jsx("div", { style: {
|
|
61
56
|
width: widthMode === "auto"
|
|
62
57
|
? "auto"
|
|
63
58
|
: ((_b = columns.find((column) => column.key === groupBy)) === null || _b === void 0 ? void 0 : _b.width)
|
|
@@ -70,20 +65,20 @@ const GridRow = ({ item, rowStyle, cellStyle, rowHeight, bulkSelect, selectedRow
|
|
|
70
65
|
backgroundColor: alternateRowColor && (index + 1) % 2 === 0
|
|
71
66
|
? "var(--row-bg)"
|
|
72
67
|
: "var(--row-bg-even)",
|
|
73
|
-
}, className: `column index-${groupBy}`, children: (
|
|
68
|
+
}, className: `column index-${groupBy}`, children: _jsx("div", { children: ((_d = item[groupBy]) === null || _d === void 0 ? void 0 : _d.html) || ((_e = item[groupBy]) === null || _e === void 0 ? void 0 : _e.value) }) })), columns.map((column, colIndex) => {
|
|
74
69
|
var _a, _b, _c, _d;
|
|
75
70
|
const cellData = item[column.key];
|
|
76
71
|
const cellValue = cellData && Object.keys(cellData).includes("html")
|
|
77
72
|
? cellData === null || cellData === void 0 ? void 0 : cellData.html
|
|
78
73
|
: cellData && Object.keys(cellData).includes("value")
|
|
79
|
-
?
|
|
74
|
+
? formatValue(cellData === null || cellData === void 0 ? void 0 : cellData.value, (_a = column.dataType) !== null && _a !== void 0 ? _a : "string", locale, formatOptions)
|
|
80
75
|
: cellData
|
|
81
76
|
? cellData
|
|
82
77
|
: "";
|
|
83
78
|
const cellUrl = cellData === null || cellData === void 0 ? void 0 : cellData.url;
|
|
84
79
|
const isHidden = column.overflowHidden;
|
|
85
80
|
if (!column.hidden && groupBy !== column.key) {
|
|
86
|
-
return ((
|
|
81
|
+
return (_jsxs("div", { id: `column-${index}-${colIndex}`, className: `column index-${column.key}`, style: Object.assign(Object.assign({}, cellStyle), { padding: "0.5rem", display: "flex", alignItems: "center", justifyContent: "flex-start", overflow: isHidden ? "hidden" : "visible", textOverflow: isHidden ? "ellipsis" : "clip", whiteSpace: isHidden ? "nowrap" : "normal", width: widthMode === "auto"
|
|
87
82
|
? "auto"
|
|
88
83
|
: (column === null || column === void 0 ? void 0 : column.width)
|
|
89
84
|
? column === null || column === void 0 ? void 0 : column.width
|
|
@@ -98,10 +93,10 @@ const GridRow = ({ item, rowStyle, cellStyle, rowHeight, bulkSelect, selectedRow
|
|
|
98
93
|
? `1px solid ${hlBorderColor}`
|
|
99
94
|
: "", backgroundColor: alternateRowColor && (index + 1) % 2 === 0
|
|
100
95
|
? "var(--row-bg)"
|
|
101
|
-
: "var(--row-bg-even)" }), children: [draggable && colIndex === draggableIndex && ((
|
|
96
|
+
: "var(--row-bg-even)" }), children: [draggable && colIndex === draggableIndex && (_jsx("div", { onDragStart: (e) => handleDragStart && handleDragStart(e, index), style: {
|
|
102
97
|
cursor: "grab",
|
|
103
98
|
margin: "0 0.25rem",
|
|
104
|
-
}, children: "\u2630" })), loading ? ((
|
|
99
|
+
}, children: "\u2630" })), loading ? (_jsx("div", { style: { width: column.width, height: rowHeight }, children: _jsx(Shimmer, { height: 32, width: column.width }) })) : (_jsx("div", { className: (cellData === null || cellData === void 0 ? void 0 : cellData.className) || "", id: `column-${column.key}-${(_b = column.dataType) !== null && _b !== void 0 ? _b : "string"}`, style: {
|
|
105
100
|
display: "flex",
|
|
106
101
|
alignItems: "center", // Vertically center content within the cell
|
|
107
102
|
width: "100%",
|
|
@@ -111,29 +106,29 @@ const GridRow = ({ item, rowStyle, cellStyle, rowHeight, bulkSelect, selectedRow
|
|
|
111
106
|
column.dataType === "currency"
|
|
112
107
|
? "end"
|
|
113
108
|
: "start",
|
|
114
|
-
}, children: isUrl(cellUrl) ? ((
|
|
109
|
+
}, children: isUrl(cellUrl) ? (_jsx("a", { href: cellUrl, target: "_blank", rel: "noopener noreferrer", children: cellValue })) : column.render ? (column.render(cellValue)) : (cellValue) }))] }, `${column.key}-${(_d = (_c = item.id) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : index}`));
|
|
115
110
|
}
|
|
116
111
|
return null;
|
|
117
112
|
})] }), isExpandable &&
|
|
118
113
|
expandedRow === item.id.value &&
|
|
119
114
|
item.expandedDetails &&
|
|
120
|
-
item.expandedDetails.html] }, String((_g = (_f = item.id) === null || _f === void 0 ? void 0 : _f.value) !== null && _g !== void 0 ? _g : index))) : ((
|
|
115
|
+
item.expandedDetails.html] }, String((_g = (_f = item.id) === null || _f === void 0 ? void 0 : _f.value) !== null && _g !== void 0 ? _g : index))) : (_jsxs("div", { id: `${index}`, draggable: draggable, onDragStart: (e) => handleDragStart && handleDragStart(e, index), onDragOver: (e) => handleDragOver && handleDragOver(e), onDrop: (e) => handleDrop && handleDrop(e, index), className: getRowClassNames(), style: Object.assign(Object.assign({}, rowStyle), { position: "relative", display: "flex", alignItems: itemsAlign, fontSize: "inherit", minHeight: rowHeight, height: "max-content", boxSizing: "border-box", backgroundColor: alternateRowColor && (index + 1) % 2 === 0
|
|
121
116
|
? "var(--row-bg)"
|
|
122
|
-
: "var(--row-bg-even)" }), onClick: handleRowClick, children: [bulkSelect && ((
|
|
117
|
+
: "var(--row-bg-even)" }), onClick: handleRowClick, children: [bulkSelect && (_jsx("div", { style: Object.assign(Object.assign({}, cellStyle), { textTransform: "uppercase", padding: "0.5rem", textAlign: "left", whiteSpace: "nowrap", textOverflow: "ellipsis" }), children: _jsx(Checkbox, { noLabel: true, disabled: ignoreRowSelect &&
|
|
123
118
|
ignoreRowSelect.has((_h = item["id"].value) === null || _h === void 0 ? void 0 : _h.toString()), onChange: () => { var _a; return toggleRowSelection((_a = item["id"].value) === null || _a === void 0 ? void 0 : _a.toString()); }, selected: item["id"] && selectedRows.has(item["id"].value), wrapperClass: checkboxWrapper }) })), columns.map((column, colIndex) => {
|
|
124
119
|
var _a, _b, _c;
|
|
125
120
|
const cellData = item[column.key];
|
|
126
121
|
const cellValue = cellData && Object.keys(cellData).includes("html")
|
|
127
122
|
? cellData === null || cellData === void 0 ? void 0 : cellData.html
|
|
128
123
|
: cellData && Object.keys(cellData).includes("value")
|
|
129
|
-
?
|
|
124
|
+
? formatValue(cellData === null || cellData === void 0 ? void 0 : cellData.value, (_a = column.dataType) !== null && _a !== void 0 ? _a : "string", locale, formatOptions)
|
|
130
125
|
: cellData
|
|
131
126
|
? cellData
|
|
132
127
|
: "";
|
|
133
128
|
const cellUrl = cellData === null || cellData === void 0 ? void 0 : cellData.url;
|
|
134
129
|
const isHidden = column.overflowHidden;
|
|
135
130
|
if (!column.hidden && groupBy !== column.key) {
|
|
136
|
-
return ((
|
|
131
|
+
return (_jsxs("div", { id: `column-${index}-${colIndex}`, className: `column index-${column.key}`, style: Object.assign(Object.assign({}, cellStyle), { padding: "0.5rem", display: "flex", alignItems: "center", justifyContent: "flex-start", overflow: isHidden ? "hidden" : "visible", textOverflow: isHidden ? "ellipsis" : "clip", whiteSpace: isHidden ? "nowrap" : "normal", width: widthMode === "auto"
|
|
137
132
|
? "auto"
|
|
138
133
|
: (column === null || column === void 0 ? void 0 : column.width)
|
|
139
134
|
? column === null || column === void 0 ? void 0 : column.width
|
|
@@ -148,9 +143,9 @@ const GridRow = ({ item, rowStyle, cellStyle, rowHeight, bulkSelect, selectedRow
|
|
|
148
143
|
? `1px solid ${hlBorderColor}`
|
|
149
144
|
: "", backgroundColor: alternateRowColor && (index + 1) % 2 === 0
|
|
150
145
|
? "var(--row-bg)"
|
|
151
|
-
: "var(--row-bg-even)" }), children: [draggable && colIndex === draggableIndex && ((
|
|
146
|
+
: "var(--row-bg-even)" }), children: [draggable && colIndex === draggableIndex && (_jsx("div", { onDragStart: (e) => handleDragStart && handleDragStart(e, index), style: {
|
|
152
147
|
cursor: "grab",
|
|
153
|
-
}, children: (
|
|
148
|
+
}, children: _jsx(MdDragIndicator, { size: "1.25rem" }) })), loading ? (_jsx("div", { style: { width: column.width, height: rowHeight }, children: _jsx(Shimmer, { height: 32, width: column.width }) })) : (_jsx("div", { className: (cellData === null || cellData === void 0 ? void 0 : cellData.className) || "", style: {
|
|
154
149
|
display: "flex",
|
|
155
150
|
alignItems: "center", // Vertically center content within the cell
|
|
156
151
|
width: "100%",
|
|
@@ -160,9 +155,9 @@ const GridRow = ({ item, rowStyle, cellStyle, rowHeight, bulkSelect, selectedRow
|
|
|
160
155
|
column.dataType === "currency"
|
|
161
156
|
? "end"
|
|
162
157
|
: "start",
|
|
163
|
-
}, children: isUrl(cellUrl) ? ((
|
|
158
|
+
}, children: isUrl(cellUrl) ? (_jsx("a", { href: cellUrl, target: "_blank", rel: "noopener noreferrer", children: cellValue })) : column.render ? (column.render(cellValue)) : (cellValue) }))] }, `${column.key}-${(_c = (_b = item.id) === null || _b === void 0 ? void 0 : _b.value) !== null && _c !== void 0 ? _c : index}`));
|
|
164
159
|
}
|
|
165
160
|
return null;
|
|
166
161
|
})] }, String((_k = (_j = item.id) === null || _j === void 0 ? void 0 : _j.value) !== null && _k !== void 0 ? _k : index)));
|
|
167
162
|
};
|
|
168
|
-
|
|
163
|
+
export default memo(GridRow);
|
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
-
const react_1 = require("react");
|
|
8
|
-
const groupedRow_1 = __importDefault(require("./groupedRow"));
|
|
9
|
-
const SummariseDetails_1 = __importDefault(require("./SummariseDetails"));
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { memo, useEffect, useRef, useState } from "react";
|
|
3
|
+
import GroupedRow from "./groupedRow";
|
|
4
|
+
import SummariseDetails from "./SummariseDetails";
|
|
10
5
|
const GroupedGrid = ({ groupedData, rowOpened, startIndex, endIndex, alternateRowColor, updateRowOpened, columnWidths, columnHeights, groupBy, widthMode, rowKey, rowHeight, headerBackground, isSummarise, gridGroupBy, rowStyle, sortable, cellStyle, summariseKeys, summariseDetails, activeCalculateColor, gridRef, setCalculatePosition, calculatePosition, calculatetextColor, setCalculateVisible, calculateVisible, summariseDisplay, recalculate, selectedRowStyle, isLoading, selectedRow, onRowClick, gridColumns, bulkSelect, selectedRows, toggleRowSelection, hasVerticalScroll, setColumnWidths, setColumnHeights, actionsKey, locale, formatOptions, }) => {
|
|
11
|
-
const groupedDiv =
|
|
12
|
-
const [renderedKeys, setRenderedKeys] =
|
|
13
|
-
|
|
6
|
+
const groupedDiv = useRef(null);
|
|
7
|
+
const [renderedKeys, setRenderedKeys] = useState([]);
|
|
8
|
+
useEffect(() => {
|
|
14
9
|
var _a;
|
|
15
10
|
const groupedColumns = (_a = groupedDiv.current) === null || _a === void 0 ? void 0 : _a.querySelectorAll(".group-column");
|
|
16
11
|
const _renderedKeys = [];
|
|
@@ -38,7 +33,7 @@ const GroupedGrid = ({ groupedData, rowOpened, startIndex, endIndex, alternateRo
|
|
|
38
33
|
.join(">"));
|
|
39
34
|
}),
|
|
40
35
|
]);
|
|
41
|
-
return ((
|
|
36
|
+
return (_jsx("div", { ref: groupedDiv, children: groupedData
|
|
42
37
|
.filter((item) => {
|
|
43
38
|
return item.type === "main" && item.level === 1
|
|
44
39
|
? true
|
|
@@ -50,7 +45,7 @@ const GroupedGrid = ({ groupedData, rowOpened, startIndex, endIndex, alternateRo
|
|
|
50
45
|
.map((item, gIndex) => {
|
|
51
46
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
52
47
|
if (gIndex >= startIndex && gIndex <= endIndex)
|
|
53
|
-
return item.type === "main" ? ((
|
|
48
|
+
return item.type === "main" ? (_jsxs("div", { style: {
|
|
54
49
|
width: "100%",
|
|
55
50
|
display: "flex",
|
|
56
51
|
alignItems: "center",
|
|
@@ -61,7 +56,7 @@ const GroupedGrid = ({ groupedData, rowOpened, startIndex, endIndex, alternateRo
|
|
|
61
56
|
}, children: [(_a = item.groupedKey) === null || _a === void 0 ? void 0 : _a.split(">").filter((key) => key !== item.key).map((columnKey) => {
|
|
62
57
|
const column = gridColumns.find((column) => column.key === columnKey);
|
|
63
58
|
if (column) {
|
|
64
|
-
return ((
|
|
59
|
+
return (_jsx("div", { style: {
|
|
65
60
|
width: widthMode === "auto"
|
|
66
61
|
? "auto"
|
|
67
62
|
: (column === null || column === void 0 ? void 0 : column.width)
|
|
@@ -70,14 +65,14 @@ const GroupedGrid = ({ groupedData, rowOpened, startIndex, endIndex, alternateRo
|
|
|
70
65
|
? columnWidths[`column-${columnKey}`]
|
|
71
66
|
: "fit-content",
|
|
72
67
|
padding: "0.5rem",
|
|
73
|
-
}, className: `column index-${groupBy}`, children: (
|
|
68
|
+
}, className: `column index-${groupBy}`, children: _jsx("div", { style: {
|
|
74
69
|
color: alternateRowColor && (gIndex + 1) % 2 === 0
|
|
75
70
|
? "var(--row-header-bg)"
|
|
76
71
|
: "var(--row-bg)",
|
|
77
72
|
}, children: "--" }) }));
|
|
78
73
|
}
|
|
79
74
|
return null;
|
|
80
|
-
}), (
|
|
75
|
+
}), _jsxs("div", { style: {
|
|
81
76
|
display: "flex",
|
|
82
77
|
alignItems: "center",
|
|
83
78
|
fontSize: "inherit",
|
|
@@ -93,7 +88,7 @@ const GroupedGrid = ({ groupedData, rowOpened, startIndex, endIndex, alternateRo
|
|
|
93
88
|
flexGrow: 0,
|
|
94
89
|
cursor: "pointer",
|
|
95
90
|
padding: "0.5rem",
|
|
96
|
-
}, className: `group-column ${item.key}`, onClick: () => updateRowOpened(item.groupedValue), children: [(
|
|
91
|
+
}, className: `group-column ${item.key}`, onClick: () => updateRowOpened(item.groupedValue), children: [_jsx("span", { style: {
|
|
97
92
|
fontSize: "inherit",
|
|
98
93
|
marginRight: "0.5rem",
|
|
99
94
|
color: "black",
|
|
@@ -106,14 +101,14 @@ const GroupedGrid = ({ groupedData, rowOpened, startIndex, endIndex, alternateRo
|
|
|
106
101
|
display: "flex",
|
|
107
102
|
alignItems: "center",
|
|
108
103
|
justifyContent: "center",
|
|
109
|
-
}, children: rowOpened.includes(item.groupedValue || "") ? "-" : "+" }), (
|
|
104
|
+
}, children: rowOpened.includes(item.groupedValue || "") ? "-" : "+" }), _jsxs("div", { style: {
|
|
110
105
|
display: "flex",
|
|
111
106
|
alignItems: "center",
|
|
112
107
|
flexWrap: "wrap",
|
|
113
|
-
}, children: [(
|
|
114
|
-
parseInt(((_d = item === null || item === void 0 ? void 0 : item.count) === null || _d === void 0 ? void 0 : _d.toString()) || "0") > 0 && ((
|
|
108
|
+
}, children: [_jsx("span", { style: { marginRight: "0.5rem" }, children: item.html ? _jsx(_Fragment, { children: item.html }) : item.value }), _jsx("span", { children: `(${item === null || item === void 0 ? void 0 : item.count})` })] })] }), isSummarise &&
|
|
109
|
+
parseInt(((_d = item === null || item === void 0 ? void 0 : item.count) === null || _d === void 0 ? void 0 : _d.toString()) || "0") > 0 && (_jsx(SummariseDetails, { rowIndex: gIndex, removedKeys: item.groupedKey.split(">"), columns: gridColumns, groupBy: gridGroupBy, sortable: sortable, cellStyle: cellStyle, columnWidths: columnWidths, widthMode: widthMode, summariseKeys: summariseKeys, summariseDetails: summariseDetails, activeCalculateColor: activeCalculateColor, gridRef: gridRef, setCalculatePosition: setCalculatePosition, calculatePosition: calculatePosition, calculatetextColor: calculatetextColor, setCalculateVisible: setCalculateVisible, calculateVisible: calculateVisible, summariseDisplay: summariseDisplay, recalculate: recalculate, groupedData: item.groupedValue, actionsKey: actionsKey }))] }, String((_e = item.groupedValue) !== null && _e !== void 0 ? _e : gIndex))) : (_jsx(GroupedRow, { item: item.rowData, index: gIndex, rowStyle: Object.assign(Object.assign({}, rowStyle), (selectedRow === gIndex ? selectedRowStyle : {})), cellStyle: cellStyle, rowHeight: rowHeight, alternateRowColor: alternateRowColor, bulkSelect: bulkSelect, columns: gridColumns, widthMode: widthMode, rowKey: rowKey, onRowClick: onRowClick, loading: isLoading, groupBy: gridGroupBy, selectedRows: selectedRows, toggleRowSelection: toggleRowSelection, hasVerticalScroll: hasVerticalScroll, hugColumnWidths: columnWidths }, String(((_g = (_f = item.rowData) === null || _f === void 0 ? void 0 : _f.id) === null || _g === void 0 ? void 0 : _g.value)
|
|
115
110
|
? `${item.groupedValue}-${(_j = (_h = item.rowData) === null || _h === void 0 ? void 0 : _h.id) === null || _j === void 0 ? void 0 : _j.value}`
|
|
116
111
|
: gIndex)));
|
|
117
112
|
}) }));
|
|
118
113
|
};
|
|
119
|
-
|
|
114
|
+
export default memo(GroupedGrid);
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
-
const react_1 = require("react");
|
|
8
|
-
const shimmer_1 = __importDefault(require("./shimmer"));
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { memo, useCallback } from "react";
|
|
3
|
+
import Shimmer from "./shimmer";
|
|
9
4
|
const isUrl = (value) => {
|
|
10
5
|
if (value) {
|
|
11
6
|
const urlPattern = new RegExp("^(https?:\\/\\/)?" +
|
|
@@ -21,23 +16,23 @@ const isUrl = (value) => {
|
|
|
21
16
|
return false;
|
|
22
17
|
};
|
|
23
18
|
const GroupedRow = ({ item, rowStyle, cellStyle, rowHeight, columns, widthMode, index, rowKey, onRowClick, loading, groupBy, hugColumnWidths, alternateRowColor, }) => {
|
|
24
|
-
const handleRowClick =
|
|
19
|
+
const handleRowClick = useCallback(() => {
|
|
25
20
|
onRowClick === null || onRowClick === void 0 ? void 0 : onRowClick(item);
|
|
26
21
|
}, [onRowClick, item]);
|
|
27
|
-
const getRowClassNames =
|
|
22
|
+
const getRowClassNames = useCallback(() => {
|
|
28
23
|
let classNames = ["row"];
|
|
29
24
|
if (onRowClick)
|
|
30
25
|
classNames.push("cursor-pointer");
|
|
31
26
|
return classNames.join(" ");
|
|
32
27
|
}, [onRowClick]);
|
|
33
|
-
return ((
|
|
28
|
+
return (_jsxs("div", { id: `${index}`, className: getRowClassNames(), style: Object.assign(Object.assign({}, rowStyle), { position: "relative", display: "flex", alignItems: "center", fontSize: "inherit", minHeight: rowHeight, height: "max-content", boxSizing: "border-box", backgroundColor: alternateRowColor && (index + 1) % 2 === 0
|
|
34
29
|
? "var(--row-bg)"
|
|
35
30
|
: "var(--row-bg-even)" }), onClick: handleRowClick, children: [groupBy
|
|
36
31
|
.split(",")
|
|
37
32
|
.filter((item) => item)
|
|
38
33
|
.map((_groupBy) => {
|
|
39
34
|
var _a, _b;
|
|
40
|
-
return ((
|
|
35
|
+
return (_jsx("div", { style: {
|
|
41
36
|
width: widthMode === "auto"
|
|
42
37
|
? "auto"
|
|
43
38
|
: ((_a = columns.find((column) => column.key === _groupBy)) === null || _a === void 0 ? void 0 : _a.width)
|
|
@@ -52,7 +47,7 @@ const GroupedRow = ({ item, rowStyle, cellStyle, rowHeight, columns, widthMode,
|
|
|
52
47
|
flex: widthMode === "auto" ? 1 : undefined,
|
|
53
48
|
flexGrow: widthMode === "auto" ? 1 : 0,
|
|
54
49
|
flexShrink: widthMode === "auto" ? 1 : 0,
|
|
55
|
-
}, className: `column index-${groupBy}`, children: (
|
|
50
|
+
}, className: `column index-${groupBy}`, children: _jsx("div", {}) }));
|
|
56
51
|
}), columns
|
|
57
52
|
.filter((column) => !groupBy.includes(column.key))
|
|
58
53
|
.map((column, colIndex) => {
|
|
@@ -68,7 +63,7 @@ const GroupedRow = ({ item, rowStyle, cellStyle, rowHeight, columns, widthMode,
|
|
|
68
63
|
const cellUrl = cellData === null || cellData === void 0 ? void 0 : cellData.url;
|
|
69
64
|
const isHidden = column.overflowHidden;
|
|
70
65
|
if (!column.hidden) {
|
|
71
|
-
return ((
|
|
66
|
+
return (_jsx("div", { id: `column-${index}-${colIndex}`, className: `column index-${column.key}`, style: Object.assign(Object.assign({}, cellStyle), { padding: "0.5rem", display: "flex", alignItems: "center", justifyContent: "flex-start", overflow: isHidden ? "hidden" : "visible", textOverflow: isHidden ? "ellipsis" : "clip", whiteSpace: isHidden ? "nowrap" : "normal", height: "100%", width: widthMode === "auto"
|
|
72
67
|
? "auto"
|
|
73
68
|
: (column === null || column === void 0 ? void 0 : column.width)
|
|
74
69
|
? column === null || column === void 0 ? void 0 : column.width
|
|
@@ -81,7 +76,7 @@ const GroupedRow = ({ item, rowStyle, cellStyle, rowHeight, columns, widthMode,
|
|
|
81
76
|
// : "",
|
|
82
77
|
backgroundColor: alternateRowColor && (index + 1) % 2 === 0
|
|
83
78
|
? "var(--row-bg)"
|
|
84
|
-
: "var(--row-bg-even)" }), children: loading ? ((
|
|
79
|
+
: "var(--row-bg-even)" }), children: loading ? (_jsx("div", { style: { width: column.width, height: rowHeight }, children: _jsx(Shimmer, { height: 32, width: column.width }) })) : (_jsx("div", { className: (cellData === null || cellData === void 0 ? void 0 : cellData.className) || "", style: {
|
|
85
80
|
display: "flex",
|
|
86
81
|
alignItems: "center", // Vertically center content within the cell
|
|
87
82
|
width: "100%",
|
|
@@ -91,9 +86,9 @@ const GroupedRow = ({ item, rowStyle, cellStyle, rowHeight, columns, widthMode,
|
|
|
91
86
|
column.dataType === "currency"
|
|
92
87
|
? "end"
|
|
93
88
|
: "start",
|
|
94
|
-
}, children: isUrl(cellUrl) ? ((
|
|
89
|
+
}, children: isUrl(cellUrl) ? (_jsx("a", { href: cellUrl, target: "_blank", rel: "noopener noreferrer", children: cellValue })) : column.render ? (column.render(cellValue)) : (cellValue) })) }, `${column.key}-${(_b = (_a = item.id) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : index}`));
|
|
95
90
|
}
|
|
96
91
|
return null;
|
|
97
92
|
})] }));
|
|
98
93
|
};
|
|
99
|
-
|
|
94
|
+
export default memo(GroupedRow);
|
|
@@ -1,22 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getTotalPages = exports.getPaginatedData = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
2
|
const getPaginatedData = (data, currentPage, rowsPerPage) => {
|
|
6
3
|
const startIndex = (currentPage - 1) * rowsPerPage;
|
|
7
4
|
return data.slice(startIndex, startIndex + rowsPerPage);
|
|
8
5
|
};
|
|
9
|
-
exports.getPaginatedData = getPaginatedData;
|
|
10
6
|
const getTotalPages = (dataLength, rowsPerPage) => {
|
|
11
7
|
return Math.ceil(dataLength / rowsPerPage);
|
|
12
8
|
};
|
|
13
|
-
exports.getTotalPages = getTotalPages;
|
|
14
9
|
const Pagination = ({ currentPage, totalPages, handleChangePage, rowsPerPage, handleChangeRowsPerPage, rowsPerPageOptions, range = 5, }) => {
|
|
15
10
|
const renderPageNumbers = () => {
|
|
16
11
|
const pageNumbers = [];
|
|
17
12
|
if (totalPages <= range) {
|
|
18
13
|
for (let i = 1; i <= totalPages; i++) {
|
|
19
|
-
pageNumbers.push((
|
|
14
|
+
pageNumbers.push(_jsx("button", { className: `page-number ${i === currentPage ? "active" : ""}`, onClick: () => handleChangePage(i), children: i }, i));
|
|
20
15
|
}
|
|
21
16
|
}
|
|
22
17
|
else {
|
|
@@ -26,13 +21,14 @@ const Pagination = ({ currentPage, totalPages, handleChangePage, rowsPerPage, ha
|
|
|
26
21
|
startPage = Math.max(1, endPage - range + 1);
|
|
27
22
|
}
|
|
28
23
|
for (let i = startPage; i <= endPage; i++) {
|
|
29
|
-
pageNumbers.push((
|
|
24
|
+
pageNumbers.push(_jsx("button", { className: `page-number ${i === currentPage ? "active" : ""}`, onClick: () => handleChangePage(i), children: i }, i));
|
|
30
25
|
}
|
|
31
26
|
}
|
|
32
27
|
return pageNumbers;
|
|
33
28
|
};
|
|
34
|
-
return ((
|
|
29
|
+
return (_jsx("div", { className: "pagination text-sm px-2.5", children: _jsxs("div", { children: [_jsx("button", { onClick: () => handleChangePage(currentPage - 1), disabled: currentPage === 1, style: currentPage === 1 ? { cursor: "not-allowed", color: "#ccc" } : {}, children: "Prev" }), renderPageNumbers(), _jsx("button", { onClick: () => handleChangePage(currentPage + 1), disabled: currentPage >= totalPages, style: currentPage >= totalPages
|
|
35
30
|
? { cursor: "not-allowed", color: "#ccc" }
|
|
36
|
-
: {}, children: "Next" }), (
|
|
31
|
+
: {}, children: "Next" }), _jsx("select", { value: rowsPerPage, onChange: handleChangeRowsPerPage, children: rowsPerPageOptions.map((option) => (_jsx("option", { value: option, children: option }, option))) })] }) }));
|
|
37
32
|
};
|
|
38
|
-
|
|
33
|
+
export default Pagination;
|
|
34
|
+
export { getPaginatedData, getTotalPages };
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getTotalPages = void 0;
|
|
4
|
-
const getTotalPages = (dataLength, rowsPerPage) => {
|
|
1
|
+
export const getTotalPages = (dataLength, rowsPerPage) => {
|
|
5
2
|
return Math.ceil(dataLength / rowsPerPage);
|
|
6
3
|
};
|
|
7
|
-
exports.getTotalPages = getTotalPages;
|
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createRegexFromWildcard = void 0;
|
|
4
|
-
exports.isValidDateFormat = isValidDateFormat;
|
|
5
|
-
const createRegexFromWildcard = (query) => {
|
|
1
|
+
export const createRegexFromWildcard = (query) => {
|
|
6
2
|
const escapedQuery = query.replace(/([.+^${}()|[\]\\])/g, "\\$1");
|
|
7
3
|
const regexPattern = "^" + escapedQuery.replace(/\*/g, ".*").replace(/\?/g, ".") + ".*$";
|
|
8
4
|
return new RegExp(regexPattern, "i");
|
|
9
5
|
};
|
|
10
|
-
|
|
11
|
-
function isValidDateFormat(dateStr) {
|
|
6
|
+
export function isValidDateFormat(dateStr) {
|
|
12
7
|
if (!dateStr || typeof dateStr !== "string")
|
|
13
8
|
return false;
|
|
14
9
|
const patterns = [
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
2
|
const Shimmer = ({ style, width, height }) => {
|
|
5
|
-
return ((
|
|
3
|
+
return (_jsxs(_Fragment, { children: [_jsx("style", { children: `
|
|
6
4
|
@keyframes shimmer {
|
|
7
5
|
0% {
|
|
8
6
|
background-position: -1000px 0;
|
|
@@ -22,6 +20,6 @@ const Shimmer = ({ style, width, height }) => {
|
|
|
22
20
|
background-size: 1000px 100%;
|
|
23
21
|
animation: shimmer 1.2s infinite;
|
|
24
22
|
}
|
|
25
|
-
` }), (
|
|
23
|
+
` }), _jsx("div", { className: "shimmer-wrapper", style: {}, children: _jsx("div", { className: "shimmer", style: Object.assign(Object.assign({}, style), { width, height }) }) })] }));
|
|
26
24
|
};
|
|
27
|
-
|
|
25
|
+
export default Shimmer;
|
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
-
const react_1 = require("react");
|
|
8
|
-
const dropdown_1 = __importDefault(require("../../dropdown"));
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect } from "react";
|
|
3
|
+
import Dropdown from "../../dropdown";
|
|
9
4
|
const TextFilterDropdown = ({ headerDropdownIndex, searchOptions, combined, position, columnKey, searchElement, activeSearchType, sortingOps, searchable, searchInput, columnIndex, }) => {
|
|
10
|
-
|
|
5
|
+
useEffect(() => {
|
|
11
6
|
var _a;
|
|
12
7
|
if (searchElement) {
|
|
13
8
|
const _searchElement = document.getElementById("search-input");
|
|
@@ -21,17 +16,17 @@ const TextFilterDropdown = ({ headerDropdownIndex, searchOptions, combined, posi
|
|
|
21
16
|
const clickedOption = searchOptions.find((item) => selected === item.value);
|
|
22
17
|
clickedOption === null || clickedOption === void 0 ? void 0 : clickedOption.action(columnKey, selected);
|
|
23
18
|
};
|
|
24
|
-
return ((
|
|
19
|
+
return (_jsxs("div", { style: Object.assign(Object.assign({ position: "absolute", top: combined ? 0 : "calc(100% + 5px)" }, (combined
|
|
25
20
|
? {
|
|
26
21
|
left: "100%",
|
|
27
22
|
}
|
|
28
23
|
: columnIndex > 1
|
|
29
24
|
? { right: 0 }
|
|
30
|
-
: { left: 0 })), { zIndex: headerDropdownIndex ? headerDropdownIndex : 1000, backgroundColor: "white", boxShadow: "0px 0.5rem 1rem 0px rgba(0,0,0,0.2)", listStyleType: "none", padding: "0.25rem 0", width: 230, borderRadius: "0.5rem", margin: 0 }), id: "grid-dropdown", onClick: (e) => e.stopPropagation(), children: [searchInput && searchInput, sortingOps && sortingOps, (
|
|
25
|
+
: { left: 0 })), { zIndex: headerDropdownIndex ? headerDropdownIndex : 1000, backgroundColor: "white", boxShadow: "0px 0.5rem 1rem 0px rgba(0,0,0,0.2)", listStyleType: "none", padding: "0.25rem 0", width: 230, borderRadius: "0.5rem", margin: 0 }), id: "grid-dropdown", onClick: (e) => e.stopPropagation(), children: [searchInput && searchInput, sortingOps && sortingOps, _jsx("div", { style: {
|
|
31
26
|
padding: "0.5rem 0.75rem",
|
|
32
|
-
}, children: (
|
|
27
|
+
}, children: _jsx(Dropdown, { options: searchOptions, selectedValues: [activeSearchType], onChange: (selected) => { var _a; return handleDropdownChange((_a = selected[0].toString()) !== null && _a !== void 0 ? _a : "", columnKey); }, searchEnabled: false, maxDropdownHeight: 350 }) }), !["blank", "notblank"].includes(activeSearchType.toLowerCase()) && (_jsx("div", { style: {
|
|
33
28
|
padding: "0.5rem 0.75rem",
|
|
34
29
|
cursor: "pointer",
|
|
35
30
|
}, children: searchElement }))] }));
|
|
36
31
|
};
|
|
37
|
-
|
|
32
|
+
export default TextFilterDropdown;
|
|
@@ -1,41 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
37
|
-
const styled_components_1 = __importStar(require("styled-components"));
|
|
38
|
-
const spin = (0, styled_components_1.keyframes) `
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import styled, { keyframes } from "styled-components";
|
|
3
|
+
const spin = keyframes `
|
|
39
4
|
0% {
|
|
40
5
|
transform: rotate(0deg);
|
|
41
6
|
}
|
|
@@ -43,7 +8,7 @@ const spin = (0, styled_components_1.keyframes) `
|
|
|
43
8
|
transform: rotate(360deg);
|
|
44
9
|
}
|
|
45
10
|
`;
|
|
46
|
-
const Spinner =
|
|
11
|
+
const Spinner = styled.div `
|
|
47
12
|
display: inline-block;
|
|
48
13
|
width: ${(props) => props.size}px;
|
|
49
14
|
height: ${(props) => props.size}px;
|
|
@@ -53,6 +18,6 @@ const Spinner = styled_components_1.default.div `
|
|
|
53
18
|
animation: ${spin} 1s linear infinite;
|
|
54
19
|
`;
|
|
55
20
|
const Loader = ({ size = 40, color = "#3498db", className = "", }) => {
|
|
56
|
-
return (
|
|
21
|
+
return _jsx(Spinner, { size: size, color: color, className: className });
|
|
57
22
|
};
|
|
58
|
-
|
|
23
|
+
export default Loader;
|